diff --git a/#!inf.json b/#!inf.json new file mode 100644 index 0000000..33ca136 --- /dev/null +++ b/#!inf.json @@ -0,0 +1,238 @@ +#!/usr/bin/env inf +{ + "#": "gi0.PINF.it/core/v0", + + "#": { + "/dist/firephp.build": "to.pinf.org.mozilla.web-ext", + "runner": "it.pinf.org.mozilla.web-ext" + }, + ":builder:": "/dist/firephp.build @ builder/v1", + ":runner:": "runner @ runner/v1", + + "gi0.PINF.it/build/v0 @ # /dist/firephp.build": (inf () >>> + { + "gi0.PINF.it/build/v0 @ # :builder: build() /": { + "port": 9000, + "manifest": { + "name": "FirePHP (Official)", + "version": "${version}", + "description": "Log from PHP to a devtools panel.", + "applications": { + "gecko": { + "id": "FirePHPExtension-Build@firephp.org", + "strict_min_version": "56.0" + } + }, + "icons": { + "48": "./src/skin/Logo.png" + }, + "permissions": [ + "activeTab", + "storage", + "webRequest", + "webNavigation", + "webRequestBlocking", + "" + ], + "content_security_policy": "script-src 'self'; style-src 'self'; object-src 'self'; img-src 'self'", + "background": { + "scripts": [ + { + "background.js": { + "gi0.PINF.it/build/v0 # /scripts # /background.js": { + "@it.pinf.org.browserify # router/v1": { + "src": "./src/background.js", + "format": "pinf", + "babel": { + "presets": { + "@babel/preset-env": { + "targets": "last 1 Firefox versions" + } + } + } + } + } + } + } + ] + }, + "devtools": { + "panels": [ + { + "devtools/dist/index.js": { + "label": "FirePHP", + "icon": "./src/skin/Logo.png", + "include": { + "codemirror.js": "codemirror/lib/codemirror.js", + "codemirror.css": "codemirror/lib/codemirror.css", + "codemirror/addon/selection/active-line.js": "codemirror/addon/selection/active-line.js", + "codemirror/mode/xml/xml.js": "codemirror/mode/xml/xml.js", + "codemirror/mode/javascript/javascript.js": "codemirror/mode/javascript/javascript.js", + "codemirror/mode/css/css.js": "codemirror/mode/css/css.js", + "codemirror/mode/htmlmixed/htmlmixed.js": "codemirror/mode/htmlmixed/htmlmixed.js", + "codemirror/mode/clike/clike.js": "codemirror/mode/clike/clike.js", + "codemirror/mode/php/php.js": "codemirror/mode/php/php.js" + }, + "code": { + "gi0.PINF.it/build/v0 # /scripts/devtools # /": { + "@fireconsole.rep.js # builder/v1": { + "externalizeCss": true, + "indexFilename": "index", + "indexFormat": "js", + "include": { + "jquery": false, + "regenerator-runtime": false, + "riot.csp.js": true, + "riot.js": false, + "riot.min.js": false + }, + "page": { + "@layout": { + "console": { + "@console": { + "@fireconsole": { + } + } + }, + "menu": { + "@menu": {} + }, + "settings": { + "@enabler": {} + }, + "inspector": { + "@inspector": {} + }, + "editor": { + "@editor": {} + }, + "manage": { + "@manage": { + "settings": { + "@settings": {} + } + } + } + } + }, + "reps": { + "layout": "./src/layout.rep.js", + "menu": "./src/menu.rep.js", + "summary": "./src/summary.rep.js", + "settings": "./src/settings.rep.js", + "manage": "./src/manage.rep.js", + "inspector": "./src/inspector.rep.js", + "editor": "./src/editor.rep.js", + "console": "./src/console.rep.js", + "enabler": "./src/enabler.rep.js" + }, + "babel": { + "presets": { + "@babel/preset-env": { + "targets": "last 1 Firefox versions" + } + } + } + } + } + } + } + } + ] + } + }, + "routes": { + "^/$": (javascript (API) >>> + + return function (req, res, next) { + + if ( + req.headers["x-firephp-version"] || + /\sFirePHP\/([\.|\d]*)\s?/.test(req.headers["user-agent"]) + ) { + + function wrap (message) { + return message.length + '|' + message + '|'; + } + + res.writeHead(200, { + 'X-Wf-Protocol-1': 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2', + 'X-Wf-1-Plugin-1': 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.0.0master1106021548', + 'X-Wf-1-Structure-1': 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1', + + // @see https://github.com/firephp/firephp/issues/16 + 'X-Wf-1-1-1-1': wrap('[{"Type":"LOG","File":"/path/to/file","Line":10},"Hello World"]'), + 'X-Wf-1-1-1-2': wrap('[{"Type":"INFO","File":"\/christoph\/projects\/gi0.FireConsole.org\/rep.js\/examples\/03-FirePHPCore\/index.php","Line":75},"\\u0427\\u0442\\u043e-\\u0442\\u043e"]'), + 'X-Wf-1-1-1-3': wrap('[{"Type":"INFO","File":"\/christoph\/projects\/gi0.FireConsole.org\/rep.js\/examples\/03-FirePHPCore\/index.php","Line":76},"Od\\u00f3metro"]'), + + 'X-Wf-1-Index': '3' + }); + + + res.end("FirePHP Core formatted messages sent in HTTP response headers."); + } else { + + res.end([ + "

No FirePHP HTTP request headers found.

", + "

http://127.0.0.1:8080/FirePHP.php

" + ].join("\\n")); + } + }; + <<<) + } + } + } + <<<), + + "gi0.PINF.it/build/v0 @ # onCommand() test": (inf () >>> + { + "# run": (run.bash.origin.method.progress () >>> + + BO_cecho "DEPRECATED: Tests are out of date. They were used to build up the extension." RED BOLD + BO_cecho "TODO: Build new tests that run on top of build.\n" MAGENTA BOLD + + # bash.origin.test tests + <<<) + } + <<<), + "gi0.PINF.it/build/v0 @ # onCommand() dev": (inf () >>> + { + "gi0.PINF.it/build/v0 @ # :runner: run() /dist/firephp.build": "" + } + <<<), + "gi0.PINF.it/build/v0 @ # onCommand() build": (inf () >>> + { + "gi0.PINF.it/build/v0 @ # :runner: build() /dist/firephp.build": "" + } + <<<), + "gi0.PINF.it/build/v0 @ # onCommand() publish": (inf () >>> + { + "# run": (run.bash.origin.script.method.progress () >>> + + depend { + "webext": "it.pinf.org.mozilla.web-ext # runner/v0" + } + + npm run build + + if [ $(git rev-parse --abbrev-ref HEAD) == "master" ] ; then + export MOZILLA_ADDONS_CHANNEL="listed" + fi + + pushd "dist/firephp.build" > /dev/null + CALL_webext sign { + "dist": "$(pwd)/../firephp.xpi", + "manifest": { + } + } + popd > /dev/null + + if [ $(git rev-parse --abbrev-ref HEAD) == "master" ] ; then + BO_cecho "Built extension (signed for addons listing) has been published for review by mozilla and can also be found at: dist/firephp.xpi" YELLOW BOLD + else + BO_cecho "Built extension (signed as self-hosted) can be found at: dist/firephp.xpi" YELLOW BOLD + fi + <<<) + } + <<<) +} \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8773a3e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,43 @@ +name: Build +on: + - push +jobs: + Build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: + - 13.x + steps: + - uses: actions/checkout@v2 + + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + path: node_modules + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }}-${{ hashFiles('npm-shrinkwrap.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Install Dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Upload extension as build artifact + uses: actions/upload-artifact@v1 + with: + name: firephp + path: dist/firephp.zip + + - name: Upload Release if tagging + uses: fnkr/github-action-ghr@v1 + if: startsWith(github.ref, 'refs/tags/') + env: + GHR_PATH: dist/firephp.zip + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index fc49b2c..3dda301 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,9 @@ *~.compiled.bash .actual.* node_modules/ +/package-lock.json .rt/ ~.rt_* -/dist/firephp.zip -/dist/firephp.build/.web-extension-id +/dist/ .~* -/dist/firephp.build.zip \ No newline at end of file +/tests/*/.extension.built diff --git a/.postbuild.sh b/.postbuild.sh new file mode 100755 index 0000000..298f557 --- /dev/null +++ b/.postbuild.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash.origin.script + +# TODO: Move to '#!inf.json' once pinf.it/build/v0 executes instructions in sequence. + +pushd "dist/firephp.build" > /dev/null + + # Remove files that we do not need + # TODO: Do this in a better way and coordinate with .gitignore + rm -Rf scripts/devtools/dist/dist/riot.min.js + rm -Rf scripts/devtools/dist/dist/riot.js + rm -Rf scripts/devtools/dist/dist/babel-regenerator-runtime.js + rm -Rf scripts/devtools/dist/dist/reps/insight.domplate.reps/dist/reps/dist/domplate.browser.js + rm -Rf scripts/devtools/dist/dist/reps/insight.domplate.reps/dist/reps/dist/domplate-eval.browser.js + rm -Rf lib/github.com~pinf~pinf-for-mozilla-web-ext/scripts/lib/pinf-loader-core.browser.js + rm -Rf lib/github.com~pinf~pinf-for-mozilla-web-ext/scripts/lib/babel-regenerator-runtime.js + rm -Rf scripts/devtools/dist/dist/reps/insight.domplate.reps/dist/reps/*/*.preview.htm + rm -Rf scripts/devtools/dist/dist/reps/insight.domplate.reps/dist/reps/reps.json + rm -Rf scripts/devtools/dist/dist/reps/io.shields.img.rep.js + rm -Rf scripts/devtools/dist/dist/reps/div.rep.js + rm -Rf scripts/devtools/dist/dist/reps/golden-layout.rep.js + rm -Rf skin/box.png + rm -Rf run.config.json + + # Remove signed archive as it needs to be re-signed + rm -f ../firephp.build.xpi 2> /dev/null || true + +popd > /dev/null + +pushd "dist" > /dev/null + + mv firephp.build firephp + zip -r firephp.zip firephp/ + mv firephp firephp.build + +popd > /dev/null + +BO_cecho "\nBuilt extension source can be found at: dist/firephp.build/" YELLOW BOLD +BO_cecho "This source can be loaded into a browser when running in extension development mode.\n" YELLOW BOLD diff --git a/.prepare.sh b/.prepare.sh new file mode 100755 index 0000000..c657990 --- /dev/null +++ b/.prepare.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# TODO: Get rid of this file once issues are fixed in underlying libraries. + +[ ! -e '.~/gi0.PINF.it~build~v0' ] || rm -Rf '.~/gi0.PINF.it~build~v0' +[ ! -e 'dist/firephp.build' ] || rm -Rf 'dist/firephp.build' + +[ -e '.~lib.json' ] || node_modules/.bin/lib.json from node_modules > '.~lib.json' diff --git a/README.md b/README.md index 8956fed..76e5536 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,21 @@ ![FirePHP Logo](https://github.com/firephp/firephp-for-browser-devtools/blob/master/src/skin/Logo.png?raw=true "FirePHP Logo") -FirePHP for Browser Developer Tools +FirePHP for Browser Developer Tools ![Build](https://github.com/firephp/firephp-for-browser-devtools/workflows/Build/badge.svg) =================================== This project holds the [FirePHP Tool](http://firephp.org) in the form of a Browser Extension compatible with: * Mozilla Firefox - https://developer.mozilla.org/en-US/Add-ons/WebExtensions * Google Chrome - https://developer.chrome.com/extensions + * Brave - (runs Google Chrome extensions) > Log from PHP to Browser Developer Tools via HTTP Response Headers. +Supported protocols: + + * FirePHP (Wildfire based) + * [Chrome Logger](https://craig.is/writing/chrome-logger/techspecs) + For a list of supported server libraries see [http://firephp.org](http://firephp.org). @@ -20,21 +26,18 @@ Preview Install -------- +======= -### Published +## Published * Firefox: [addons.mozilla.org/en-US/firefox/addon/firephp](https://addons.mozilla.org/en-US/firefox/addon/firephp/) - * Chrome: *TBD* - -### Local + * Chrome & Brave: [chrome.google.com/webstore/detail/firephp/ikfbpappjhegehjflebknjbhdocbgkdi](https://chrome.google.com/webstore/detail/firephp/ikfbpappjhegehjflebknjbhdocbgkdi) -**NOTE:** These downloads do **NOT** auto-update! +## Local - * Firefox: [dist/firephp.xpi](https://github.com/firephp/firephp-for-browser-devtools/raw/master/dist/firephp.xpi) - * Chrome: [dist/firephp.build](https://github.com/firephp/firephp-for-browser-devtools/raw/master/dist/firephp.build) + * Firefox & Chrome unpacked: [firephp.zip](https://github.com/firephp/firephp-for-browser-devtools/releases) (downloads do **NOT** auto-update) -### Source +## Source Requirements (tested on macOS): @@ -43,53 +46,57 @@ Requirements (tested on macOS): Build from source: - rm -Rf dist/ # Optional to verify build - nvm use 10 + nvm use 13 npm install - npm run build # Append '--ignore-dirty' if you removed 'dist/' - git diff # Optional to verify build - # Only the `version` property in `dist/firephp.build/manifest.json` should have changed. + npm run build -*Load Temporary Addon* at `dist/firephp.build/` into Firefox or Chrome. +*Load unpacked Addon* from `dist/firephp.build/` into Firefox, Chrome or Brave. + +Run from source: + +**Status: DEV - The development experience is still work in progress!** + + nvm use 13 + npm install + npm run dev -### Notes for build reviewers +## Notes for build reviewers - * Releases for this extension are built using [github.com/pinf-to/to.pinf.org.mozilla.web-ext](https://github.com/pinf-to/to.pinf.org.mozilla.web-ext). Build instructions for this tool are in `./workspace.sh`. + * Releases for this extension are built using [github.com/pinf-to/to.pinf.org.mozilla.web-ext](https://github.com/pinf-to/to.pinf.org.mozilla.web-ext). * The tool provides a runtime framework for browser extensions as well as a build tool. - * The following `./dist/firephp.build` files belong to the runtime framework and are copied into the build by the build tool: - * `./devtools-page.html` - * `./devtools-page.js` - * `./background.html` - * `./background.js` - * `./lib.js` - * `./default.css` - * `./lib/github.com~pinf~pinf-for-mozilla-web-ext/*` - * https://github.com/pinf/pinf-for-mozilla-web-ext - * https://github.com/pinf/pinf-loader-js - * `./lib/eventemitter3.js` - * https://github.com/primus/EventEmitter3 - * The following `./dist/firephp.build` files are generated by the build tool by processing source files from `./src` using instructions from `./workspace.sh`: - * `./skin` - * `./scripts/background.js` - * `./scripts/devtools/index.loader.js` - * `./scripts/devtools/index.html` - * `./scripts/devtools/dist/riot.csp.js` - * https://github.com/riot/riot - * `./scripts/devtools/dist/insight.rep.js` - * https://github.com/insight/insight.domplate.reps - * `./scripts/devtools/dist/insight.domplate.reps/*` - * https://github.com/insight/insight.domplate.reps - * `./scripts/devtools/lib/jsonrep.js` - * https://github.com/jsonrep/jsonrep - * `./scripts/devtools/*.rep.js` - * `./scripts/devtools/*.rep.css` - * `./manifest.json` + * The build is controlled by `./#!inf.json`. + * The following `./dist/firephp.build` files hold extension specific code and are built from `./src` by the build tool: + * `scripts/background.js` - webext **background.page** code + * `scripts/devtools/dist/index.js` - webext **devtools_page** code + * `scripts/devtools/dist/*.rep.*` - generated from `src/*.rep.js` + * `skin` + * `manifest.json` + * The following `./dist/firephp.build` files belong to the runtime framework and are generated by the build tool: + * `devtools-page.js` + * `devtools-page.html` + * `background.js` + * `background.html` + * `lib.js` + * `default.css` + * `scripts/devtools/dist/index.loader.js` + * `scripts/devtools/dist/index.html` + * `run.config.json` + * The following `./dist/firephp.build` files are supporting libraries provisioned by the build tool: + * `scripts/devtools/dist/dist/jquery3.min.js` - https://code.jquery.com/jquery-3.5.0.min.js + * `scripts/devtools/dist/dist/jsonrep.js` - https://github.com/jsonrep/jsonrep + * `scripts/devtools/dist/dist/riot.csp.js` - https://github.com/riot/riot + * `scripts/devtools/dist/dist/reps/insight.rep.js` - https://github.com/insight/insight.domplate.reps + * `scripts/devtools/dist/dist/reps/insight.domplate.reps/` - https://github.com/insight/insight.domplate.reps + * `scripts/devtools/dist/fireconsole.rep.*` - https://github.com/fireconsole/fireconsole.rep.js + * `lib/codemirror` - https://github.com/codemirror/codemirror + * `lib/github.com~pinf~pinf-for-mozilla-web-ext/` - https://github.com/pinf/pinf-for-mozilla-web-ext + * `lib/eventemitter3.js` - https://github.com/primus/EventEmitter3 Provenance ========== -Copyright 2016 [Christoph Dorn](http://christophdorn.com). +Copyright © 2016-2020 [Christoph Dorn](http://christophdorn.com). Licensed under the [Open Software License (OSL 3.0)](https://opensource.org/licenses/OSL-3.0). Contributions must be licensed under the [Academic Free License (AFL 3.0)](https://opensource.org/licenses/AFL-3.0). Learn about the OSL & AFL Licenses [here](http://rosenlaw.com/OSL3.0-explained.htm). diff --git a/dist/firephp.build/background.html b/dist/firephp.build/background.html deleted file mode 100644 index 5c13c9f..0000000 --- a/dist/firephp.build/background.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/dist/firephp.build/background.js b/dist/firephp.build/background.js deleted file mode 100644 index 74dd48d..0000000 --- a/dist/firephp.build/background.js +++ /dev/null @@ -1,73 +0,0 @@ - -const WINDOW = window; - - -WINDOW.crossbrowser.runtime.onMessage.addListener(function (request, sender, _sendResponse) { - - function sendResponse (response) { - - response.to = request.from; - response.from = request.to; - response.id = request.id; - - WINDOW.crossbrowser.tabs.sendMessage( - sender.tab.id, - response - ).catch(console.error); - } - - if (request.to === "fetch.url") { - - var url = request.url; - - if (!/^https?:/.test(url)) { - url = WINDOW.crossbrowser.runtime.getURL(url); - } - - WINDOW.fetch(url).then(function (response) { - return response.text(); - }).then(function (text) { - - sendResponse({ - response: text - }); - }).catch(function(err) { - -console.log("ERROR", err); - sendResponse({ - error: err - }); - }); - } else - if (request.to === "postJSON") { - - WINDOW.fetch(request.url, { - method: 'post', - headers: { - "Accept": "application/json; charset=utf-8", - "Content-Type": "application/json; charset=utf-8" - }, - body: request.data - }).then(function (response) { - return response.text(); - }).then(function (text) { - - return null; - }).catch(function(err) { - -console.log("ERROR", err); - return null; - }); - } -}); - -["background.js"].forEach(function (script) { - - const url = "scripts/" + script; - - WINDOW.PINF.sandbox(url, function (sandbox) { - - sandbox.main(); - - }, console.error); -}); diff --git a/dist/firephp.build/default.css b/dist/firephp.build/default.css deleted file mode 100644 index ea1834f..0000000 --- a/dist/firephp.build/default.css +++ /dev/null @@ -1,5 +0,0 @@ - -HTML, BODY { - padding: 0px; - margin: 0px; -} diff --git a/dist/firephp.build/devtools-page.html b/dist/firephp.build/devtools-page.html deleted file mode 100644 index 5d654b4..0000000 --- a/dist/firephp.build/devtools-page.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/dist/firephp.build/devtools-page.js b/dist/firephp.build/devtools-page.js deleted file mode 100644 index 8adb1df..0000000 --- a/dist/firephp.build/devtools-page.js +++ /dev/null @@ -1,48 +0,0 @@ - -const WINDOW = window; -const BROWSER = (typeof browser != "undefined") ? browser : chrome; - -const panels = new EventEmitter(); -panels.on("set", function (name, value) { - panels[name] = value; -}); - - -[].forEach(function (script) { - - const url = "scripts/" + script; - - WINDOW.PINF.sandbox(url, function (sandbox) { - - sandbox.main({ - panels: panels - }); - - }, console.error); - -}); - -[{"label":"FirePHP","icon":"skin/__icon_devtools_panel_Logo.png","filename":"devtools/index.html"}].forEach(function (panel) { - - const url = "scripts/" + panel.filename; - - WINDOW.crossbrowser.devtools.panels.create( - panel.label || undefined, - panel.icon || undefined, - url - ).then((panel) => { - - panels.emit("set", panel.name, panel); - - panel.onShown.addListener(function () { - -//console.log("INIT PANEL", url); - }); - - panel.onHidden.addListener(function () { - -//console.log("CLOSE PANEL", url); - }); - }); - -}); diff --git a/dist/firephp.build/lib.js b/dist/firephp.build/lib.js deleted file mode 100644 index 0de96c5..0000000 --- a/dist/firephp.build/lib.js +++ /dev/null @@ -1,117 +0,0 @@ - -(function (WINDOW) { - - const BROWSER = (typeof browser != "undefined") ? browser : chrome; - const IS_FIREFOX = (typeof browser !== "undefined"); - - function promisify (method, instance) { - return function (args) { - return new Promise (function (resolve, reject) { - try { - args = Array.from(args); - args.push(function (err, result) { - if (err) { - reject(err); - return; - } - resolve(result); - }); - method.apply(instance, args); - } catch (err) { - reject(err); - } - }); - } - } - - function promisifyNoErr (method, instance) { - return function (args) { - return new Promise (function (resolve, reject) { - try { - args = Array.from(args); - args.push(function (result) { - resolve(result); - }); - method.apply(instance, args); - } catch (err) { - reject(err); - } - }); - } - } - - WINDOW.crossbrowser = { - storage: { - onChanged: BROWSER.storage.onChanged, - local: { - get: async function () { - if (IS_FIREFOX) { - return BROWSER.storage.local.get.apply(BROWSER.storage.local, arguments); - } - return promisifyNoErr(BROWSER.storage.local.get, BROWSER.storage.local)(arguments); - }, - set: async function () { - if (IS_FIREFOX) { - return BROWSER.storage.local.set.apply(BROWSER.storage.local, arguments); - } - return promisifyNoErr(BROWSER.storage.local.set, BROWSER.storage.local)(arguments); - } - } - }, - runtime: { - getURL: BROWSER.runtime.getURL, - onMessage: BROWSER.runtime.onMessage, - sendMessage: async function () { - if (IS_FIREFOX) { - return BROWSER.runtime.sendMessage.apply(BROWSER.runtime, arguments); - } - const result = await promisifyNoErr(BROWSER.runtime.sendMessage, BROWSER.runtime)(arguments); - if (!result) { - throw Error(BROWSER.runtime.lastError.message || BROWSER.runtime.lastError); - } - return result; - }, - getManifest: function () { - return BROWSER.runtime.getManifest(); - } - }, - tabs: { - query: async function () { - if (IS_FIREFOX) { - return BROWSER.tabs.query.apply(BROWSER.tabs, arguments); - } - return promisifyNoErr(BROWSER.tabs.query, BROWSER.tabs)(arguments); - }, - sendMessage: async function () { - if (IS_FIREFOX) { - return BROWSER.tabs.sendMessage.apply(BROWSER.tabs, arguments); - } - return promisifyNoErr(BROWSER.tabs.sendMessage, BROWSER.tabs)(arguments); - }, - reload: async function () { - if (IS_FIREFOX) { - return BROWSER.tabs.reload.apply(BROWSER.tabs, arguments); - } - return promisifyNoErr(BROWSER.tabs.reload, BROWSER.tabs)(arguments); - } - }, - devtools: { - inspectedWindow: {}, - panels: { - create: async function () { - if (IS_FIREFOX) { - return BROWSER.devtools.panels.create.apply(BROWSER.devtools.panels, arguments); - } - return promisifyNoErr(BROWSER.devtools.panels.create, BROWSER.devtools.panels)(arguments); - } - } - } - }; - - Object.defineProperty(WINDOW.crossbrowser.devtools.inspectedWindow, 'tabId', { - get: function() { - return BROWSER.devtools.inspectedWindow.tabId; - } - }); - -})(window); diff --git a/dist/firephp.build/lib/eventemitter3.js b/dist/firephp.build/lib/eventemitter3.js deleted file mode 100644 index afacb4d..0000000 --- a/dist/firephp.build/lib/eventemitter3.js +++ /dev/null @@ -1,315 +0,0 @@ -// @see https://cdnjs.cloudflare.com/ajax/libs/eventemitter3/2.0.3/index.js - -'use strict'; - -var has = Object.prototype.hasOwnProperty - , prefix = '~'; - -/** - * Constructor to create a storage for our `EE` objects. - * An `Events` instance is a plain object whose properties are event names. - * - * @constructor - * @api private - */ -function Events() {} - -// -// We try to not inherit from `Object.prototype`. In some engines creating an -// instance in this way is faster than calling `Object.create(null)` directly. -// If `Object.create(null)` is not supported we prefix the event names with a -// character to make sure that the built-in object properties are not -// overridden or used as an attack vector. -// -if (Object.create) { - Events.prototype = Object.create(null); - - // - // This hack is needed because the `__proto__` property is still inherited in - // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. - // - if (!new Events().__proto__) prefix = false; -} - -/** - * Representation of a single event listener. - * - * @param {Function} fn The listener function. - * @param {Mixed} context The context to invoke the listener with. - * @param {Boolean} [once=false] Specify if the listener is a one-time listener. - * @constructor - * @api private - */ -function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; -} - -/** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. - * - * @constructor - * @api public - */ -function EventEmitter() { - this._events = new Events(); - this._eventsCount = 0; -} - -/** - * Return an array listing the events for which the emitter has registered - * listeners. - * - * @returns {Array} - * @api public - */ -EventEmitter.prototype.eventNames = function eventNames() { - var names = [] - , events - , name; - - if (this._eventsCount === 0) return names; - - for (name in (events = this._events)) { - if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); - } - - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - - return names; -}; - -/** - * Return the listeners registered for a given event. - * - * @param {String|Symbol} event The event name. - * @param {Boolean} exists Only check if there are listeners. - * @returns {Array|Boolean} - * @api public - */ -EventEmitter.prototype.listeners = function listeners(event, exists) { - var evt = prefix ? prefix + event : event - , available = this._events[evt]; - - if (exists) return !!available; - if (!available) return []; - if (available.fn) return [available.fn]; - - for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) { - ee[i] = available[i].fn; - } - - return ee; -}; - -/** - * Calls each of the listeners registered for a given event. - * - * @param {String|Symbol} event The event name. - * @returns {Boolean} `true` if the event had listeners, else `false`. - * @api public - */ -EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return false; - - var listeners = this._events[evt] - , len = arguments.length - , args - , i; - - if (listeners.fn) { - if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); - - switch (len) { - case 1: return listeners.fn.call(listeners.context), true; - case 2: return listeners.fn.call(listeners.context, a1), true; - case 3: return listeners.fn.call(listeners.context, a1, a2), true; - case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - - for (i = 1, args = new Array(len -1); i < len; i++) { - args[i - 1] = arguments[i]; - } - - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length - , j; - - for (i = 0; i < length; i++) { - if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); - - switch (len) { - case 1: listeners[i].fn.call(listeners[i].context); break; - case 2: listeners[i].fn.call(listeners[i].context, a1); break; - case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; - case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; - default: - if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { - args[j - 1] = arguments[j]; - } - - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - - return true; -}; - -/** - * Add a listener for a given event. - * - * @param {String|Symbol} event The event name. - * @param {Function} fn The listener function. - * @param {Mixed} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @api public - */ -EventEmitter.prototype.on = function on(event, fn, context) { - var listener = new EE(fn, context || this) - , evt = prefix ? prefix + event : event; - - if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++; - else if (!this._events[evt].fn) this._events[evt].push(listener); - else this._events[evt] = [this._events[evt], listener]; - - return this; -}; - -/** - * Add a one-time listener for a given event. - * - * @param {String|Symbol} event The event name. - * @param {Function} fn The listener function. - * @param {Mixed} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @api public - */ -EventEmitter.prototype.once = function once(event, fn, context) { - var listener = new EE(fn, context || this, true) - , evt = prefix ? prefix + event : event; - - if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++; - else if (!this._events[evt].fn) this._events[evt].push(listener); - else this._events[evt] = [this._events[evt], listener]; - - return this; -}; - -/** - * Remove the listeners of a given event. - * - * @param {String|Symbol} event The event name. - * @param {Function} fn Only remove the listeners that match this function. - * @param {Mixed} context Only remove the listeners that have this context. - * @param {Boolean} once Only remove one-time listeners. - * @returns {EventEmitter} `this`. - * @api public - */ -EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return this; - if (!fn) { - if (--this._eventsCount === 0) this._events = new Events(); - else delete this._events[evt]; - return this; - } - - var listeners = this._events[evt]; - - if (listeners.fn) { - if ( - listeners.fn === fn - && (!once || listeners.once) - && (!context || listeners.context === context) - ) { - if (--this._eventsCount === 0) this._events = new Events(); - else delete this._events[evt]; - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if ( - listeners[i].fn !== fn - || (once && !listeners[i].once) - || (context && listeners[i].context !== context) - ) { - events.push(listeners[i]); - } - } - - // - // Reset the array, or remove it completely if we have no more listeners. - // - if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; - else if (--this._eventsCount === 0) this._events = new Events(); - else delete this._events[evt]; - } - - return this; -}; - -/** - * Remove all listeners, or those of the specified event. - * - * @param {String|Symbol} [event] The event name. - * @returns {EventEmitter} `this`. - * @api public - */ -EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) { - if (--this._eventsCount === 0) this._events = new Events(); - else delete this._events[evt]; - } - } else { - this._events = new Events(); - this._eventsCount = 0; - } - - return this; -}; - -// -// Alias methods names because people roll like that. -// -EventEmitter.prototype.off = EventEmitter.prototype.removeListener; -EventEmitter.prototype.addListener = EventEmitter.prototype.on; - -// -// This function doesn't apply anymore. -// -EventEmitter.prototype.setMaxListeners = function setMaxListeners() { - return this; -}; - -// -// Expose the prefix. -// -EventEmitter.prefixed = prefix; - -// -// Allow `EventEmitter` to be imported as module namespace. -// -EventEmitter.EventEmitter = EventEmitter; - -// -// Expose the module. -// -if ('undefined' !== typeof module) { - module.exports = EventEmitter; -} - -window.EventEmitter = EventEmitter; diff --git a/dist/firephp.build/lib/github.com~pinf~pinf-for-mozilla-web-ext/scripts/lib/pinf-loader-full.browser.js b/dist/firephp.build/lib/github.com~pinf~pinf-for-mozilla-web-ext/scripts/lib/pinf-loader-full.browser.js deleted file mode 100644 index 017e194..0000000 --- a/dist/firephp.build/lib/github.com~pinf~pinf-for-mozilla-web-ext/scripts/lib/pinf-loader-full.browser.js +++ /dev/null @@ -1,790 +0,0 @@ -((function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -var exports = init(); -[["PINF","PINF"]].forEach(function (expose) { -if (typeof window !== "undefined") { -window[expose[0]] = exports[expose[1]]; -} else if (typeof self !== "undefined") { -self[expose[0]] = exports[expose[1]]; -} -}); -}; define.amd = true; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 1 ? normalizeIdentifier(splitIdentifier.slice(1).join("/")) : "")]; - } - - if (!moduleInitializers["/" + normalizeIdentifier(identifier)]) { - throw new Error("Descriptor for package '" + pkg.id + "' in sandbox '" + sandbox.id + "' does not declare 'mappings[\"" + splitIdentifier[0] + "\"]' property nor does sandbox have module memoized at '" + "/" + normalizeIdentifier(identifier) + "' needed to satisfy module path '" + identifier + "' in module '" + moduleIdentifier + "'!"); - } - - return [Package(""), pluginify("/" + normalizeIdentifier(identifier))]; - } - - module.require = function (identifier) { - identifier = resolveIdentifier(identifier); - return identifier[0].require(identifier[1]).exports; - }; - - module.require.supports = ["ucjs-pinf-0"]; - - module.require.id = function (identifier) { - identifier = resolveIdentifier(identifier); - return identifier[0].require.id(identifier[1]); - }; - - module.require.async = function (identifier, loadedCallback, errorCallback) { - identifier = resolveIdentifier(identifier); - var mi = moduleIdentifier; - - if (/^\//.test(identifier[0].id)) { - mi = "/main.js"; - } - - identifier[0].load(identifier[1], module.bundle, function (err, moduleAPI) { - if (err) { - if (errorCallback) return errorCallback(err); - throw err; - } - - loadedCallback(moduleAPI); - }); - }; - - module.require.sandbox = normalizeSandboxArguments(function (programIdentifier, options, loadedCallback, errorCallback) { - options.load = options.load || sandboxOptions.load; - - if (/^\./.test(programIdentifier)) { - programIdentifier = sandboxIdentifier + "/" + programIdentifier; - programIdentifier = programIdentifier.replace(/\/\.\//g, "/"); - } - - return PINF.sandbox(programIdentifier, options, loadedCallback, errorCallback); - }); - module.require.sandbox.id = sandboxIdentifier; - - module.load = function () { - module.bundle = moduleInitializers[moduleIdentifier][0]; - - if (typeof moduleInitializers[moduleIdentifier][1] === "function") { - var moduleInterface = { - id: module.id, - filename: moduleInitializers[moduleIdentifier][2].filename || (module.bundle.replace(/\.js$/, "") + "/" + module.id).replace(/\/+/g, "/"), - exports: {} - }; - - if (packageIdentifier === "" && pkg.main === moduleIdentifier) { - module.require.main = moduleInterface; - } - - if (sandboxOptions.onInitModule) { - sandboxOptions.onInitModule(moduleInterface, module, pkg, sandbox, { - normalizeIdentifier: normalizeIdentifier, - resolveIdentifier: resolveIdentifier, - finalizeLoad: finalizeLoad, - moduleInitializers: moduleInitializers, - initializedModules: initializedModules - }); - } - - var exports = moduleInitializers[moduleIdentifier][1].call(exports, module.require, module.exports, moduleInterface); - - if (typeof moduleInterface.exports !== "undefined" && (_typeof(moduleInterface.exports) !== "object" || keys(moduleInterface.exports).length !== 0)) { - module.exports = moduleInterface.exports; - } else if (typeof exports !== "undefined") { - module.exports = exports; - } - } else if (typeof moduleInitializers[moduleIdentifier][1] === "string") { - module.exports = decodeURIComponent(moduleInitializers[moduleIdentifier][1]); - } else { - module.exports = moduleInitializers[moduleIdentifier][1]; - } - }; - - module.getReport = function () { - var exportsCount = 0, - key; - - for (key in module.exports) { - exportsCount++; - } - - return { - exports: exportsCount - }; - }; - - return module; - }; - - pkg.load = function (moduleIdentifier, bundleIdentifier, loadedCallback) { - if (moduleInitializers[packageIdentifier + (moduleIdentifier || pkg.main)]) { - return loadedCallback(null, pkg.require(moduleIdentifier).exports); - } - - var bundleSubPath = bundleIdentifier.substring(sandboxIdentifier.length); - load((!/^\//.test(moduleIdentifier) ? "/" + pkg.libPath : "") + moduleIdentifier, packageIdentifier, bundleSubPath.replace(/\.js$/g, ""), function (err) { - if (err) return loadedCallback(err); - loadedCallback(null, pkg.require(moduleIdentifier).exports); - }); - }; - - pkg.require = function (moduleIdentifier) { - var plugin = moduleIdentifier.plugin; - - if (moduleIdentifier) { - if (!/^\//.test(moduleIdentifier)) { - moduleIdentifier = ("/" + (moduleIdentifier.substring(0, pkg.libPath.length) === pkg.libPath ? "" : pkg.libPath)).replace(/\/\.\//, "/") + moduleIdentifier; - } - - moduleIdentifier = packageIdentifier + moduleIdentifier; - } else { - moduleIdentifier = packageIdentifier + pkg.main; - } - - if (!moduleInitializers[moduleIdentifier] && moduleInitializers[moduleIdentifier.replace(/\.js$/, "/index.js")]) { - moduleIdentifier = moduleIdentifier.replace(/\.js$/, "/index.js"); - } - - if (plugin && moduleInitializers[moduleIdentifier + ":" + plugin]) { - moduleIdentifier += ":" + plugin; - } - - if (!initializedModules[moduleIdentifier]) { - if (!moduleInitializers[moduleIdentifier]) { - console.error("[pinf-loader-js]", "moduleInitializers", moduleInitializers); - throw new Error("Module '" + moduleIdentifier + "' " + (plugin ? "for format '" + plugin + "' " : "") + "not found in sandbox '" + sandbox.id + "'!"); - } - - (initializedModules[moduleIdentifier] = Module(moduleIdentifier, lastModule)).load(); - } - - var loadingBundlesCallbacks; - - if (loadingBundles[moduleIdentifier]) { - loadingBundlesCallbacks = loadingBundles[moduleIdentifier]; - delete loadingBundles[moduleIdentifier]; - - for (var i = 0; i < loadingBundlesCallbacks.length; i++) { - loadingBundlesCallbacks[i](null, sandbox); - } - } - - var moduleInfo = create(initializedModules[moduleIdentifier]); - - if (plugin === "i18n") { - moduleInfo.exports = moduleInfo.exports.root; - } - - return moduleInfo; - }; - - pkg.require.id = function (moduleIdentifier) { - if (!/^\//.test(moduleIdentifier)) { - moduleIdentifier = "/" + pkg.libPath + moduleIdentifier; - } - - return ((packageIdentifier !== "" ? "/" + packageIdentifier + "/" : "") + moduleIdentifier).replace(/\/+/g, "/"); - }; - - pkg.getReport = function () { - return { - main: pkg.main, - mappings: pkg.mappings, - directories: pkg.directories, - libPath: pkg.libPath - }; - }; - - if (sandboxOptions.onInitPackage) { - sandboxOptions.onInitPackage(pkg, sandbox, { - normalizeIdentifier: normalizeIdentifier, - finalizeLoad: finalizeLoad, - moduleInitializers: moduleInitializers, - initializedModules: initializedModules - }); - } - - packages[packageIdentifier] = pkg; - return pkg; - }; - - sandbox.require = function (moduleIdentifier) { - return Package("").require(moduleIdentifier).exports; - }; - - sandbox.boot = function () { - if (typeof Package("").main !== "string") { - throw new Error("No 'main' property declared in '/package.json' in sandbox '" + sandbox.id + "'!"); - } - - return sandbox.require(Package("").main); - }; - - sandbox.main = function () { - var exports = sandbox.boot(); - return exports.main ? exports.main.apply(null, arguments) : exports; - }; - - sandbox.getReport = function () { - var report = { - bundles: {}, - packages: {}, - modules: {} - }, - key; - - for (key in bundleIdentifiers) { - report.bundles[key] = bundleIdentifiers[key]; - } - - for (key in packages) { - report.packages[key] = packages[key].getReport(); - } - - for (key in moduleInitializers) { - if (initializedModules[key]) { - report.modules[key] = initializedModules[key].getReport(); - } else { - report.modules[key] = {}; - } - } - - return report; - }; - - sandbox.reset = function () { - moduleInitializers = {}; - initializedModules = {}; - bundleIdentifiers = {}; - packages = {}; - loadingBundles = {}; - }; - - load(sandboxIdentifier.indexOf("?") === -1 ? ".js" : "", "", "", loadedCallback); - return sandbox; - }; - - var bundleIdentifiers = {}, - sandboxes = {}; - - var Require = function Require(bundle) { - var self = this; - - var bundleHandler = function bundleHandler(uid, callback) { - if (uid && bundleIdentifiers[uid]) { - throw new Error("You cannot split require.bundle(UID) calls where UID is constant!"); - } - - bundleIdentifiers[uid] = true; - loadedBundles.push([uid, function (sandbox) { - var moduleInitializers = {}, - req = new Require(uid); - delete req.bundle; - req.sandbox = sandbox; - - req.memoize = function (moduleIdentifier, moduleInitializer, moduleMeta) { - moduleInitializers[moduleIdentifier + (moduleMeta && moduleMeta.variation ? ":" + moduleMeta.variation : "")] = [moduleInitializer, moduleMeta || {}]; - }; - - callback(req, global || null); - return moduleInitializers; - }]); - }; - - var activeBundleHandler = bundleHandler; - - this.bundle = function () { - return activeBundleHandler.apply(null, arguments); - }; - - this.setActiveBundleHandler = function (handler) { - var oldHandler = activeBundleHandler; - activeBundleHandler = handler; - return oldHandler; - }; - }; - - var PINF = new Require(); - PINF.supports = ["ucjs-pinf-0"]; - PINF.sandbox = normalizeSandboxArguments(function (programIdentifier, options, loadedCallback, errorCallback) { - if (typeof programIdentifier === "function") { - options = options || {}; - var bundle = programIdentifier; - var fallbackLoad = options.load || loadInBrowser; - - options.load = function (uri, loadedCallback) { - if (uri === programIdentifier + ".js") { - PINF.bundle("", bundle); - loadedCallback(null); - return; - } - - return fallbackLoad(uri, loadedCallback); - }; - - programIdentifier = bundle.uri || "#pinf:" + Math.random().toString(36).substr(2, 9); - } - - var sandboxIdentifier = programIdentifier.replace(/\.js$/, ""); - return sandboxes[sandboxIdentifier] = Sandbox(sandboxIdentifier, options, function (err, sandbox) { - if (err) { - if (errorCallback) return errorCallback(err); - throw err; - } - - loadedCallback(sandbox); - }); - }); - PINF.Loader = Loader; - - PINF.getReport = function () { - var report = { - sandboxes: {} - }; - - for (var key in sandboxes) { - report.sandboxes[key] = sandboxes[key].getReport(); - } - - return report; - }; - - PINF.reset = function () { - for (var key in sandboxes) { - sandboxes[key].reset(); - } - - sandboxes = {}; - bundleIdentifiers = {}; - loadedBundles = []; - }; - - return PINF; - }; - - if (exports) exports.Loader = Loader; -})(typeof exports !== "undefined" ? exports : null); -},{}]},{},[1])(1) -}); - -})((typeof require !== "undefined" && require) || undefined, (typeof exports !== "undefined" && exports) || undefined, (typeof module !== "undefined" && module) || undefined)) \ No newline at end of file diff --git a/dist/firephp.build/lib/github.com~pinf~pinf-for-mozilla-web-ext/scripts/loader.js b/dist/firephp.build/lib/github.com~pinf~pinf-for-mozilla-web-ext/scripts/loader.js deleted file mode 100644 index 798e6cf..0000000 --- a/dist/firephp.build/lib/github.com~pinf~pinf-for-mozilla-web-ext/scripts/loader.js +++ /dev/null @@ -1,21 +0,0 @@ - -const PINF_CORE_LOADER = window.PINF; - -if (!PINF_CORE_LOADER) { - throw new Error("The 'PINF' core loader must be loaded first!"); -} - -const PINF = window.PINF = (function (window) { - - const exports = {}; - - exports.sandbox = PINF_CORE_LOADER.sandbox; - - exports.getReport = PINF_CORE_LOADER.getReport; - - exports.reset = PINF_CORE_LOADER.reset; - - exports.bundle = PINF_CORE_LOADER.bundle; - - return exports; -})(window); diff --git a/dist/firephp.build/manifest.json b/dist/firephp.build/manifest.json deleted file mode 100644 index e158d08..0000000 --- a/dist/firephp.build/manifest.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "manifest_version": 2, - "description": "Log from PHP to a devtools panel.", - "name": "FirePHP", - "version": "1.3.0", - "applications": { - "gecko": { - "id": "FirePHPExtension-Build@firephp.org", - "strict_min_version": "56.0" - } - }, - "icons": { - "48": "skin/__icon_48.png" - }, - "permissions": [ - "activeTab", - "storage", - "webRequest", - "webNavigation", - "webRequestBlocking", - "" - ], - "content_security_policy": "script-src 'self'; style-src 'self'; object-src 'self'; img-src 'self'", - "devtools_page": "devtools-page.html", - "background": { - "page": "background.html" - } -} \ No newline at end of file diff --git a/dist/firephp.build/scripts/background.js b/dist/firephp.build/scripts/background.js deleted file mode 100644 index 481f4d7..0000000 --- a/dist/firephp.build/scripts/background.js +++ /dev/null @@ -1,9307 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 0 && - tree._listeners.length > this._maxListeners - ) { - tree._listeners.warned = true; - logPossibleMemoryLeak.call(this, tree._listeners.length, name); - } - } - return true; - } - name = type.shift(); - } - return true; - } - - // By default EventEmitters will print a warning if more than - // 10 listeners are added to it. This is a useful default which - // helps finding memory leaks. - // - // Obviously not all Emitters should be limited to 10. This function allows - // that to be increased. Set to zero for unlimited. - - EventEmitter.prototype.delimiter = '.'; - - EventEmitter.prototype.setMaxListeners = function(n) { - if (n !== undefined) { - this._maxListeners = n; - if (!this._conf) this._conf = {}; - this._conf.maxListeners = n; - } - }; - - EventEmitter.prototype.event = ''; - - - EventEmitter.prototype.once = function(event, fn) { - return this._once(event, fn, false); - }; - - EventEmitter.prototype.prependOnceListener = function(event, fn) { - return this._once(event, fn, true); - }; - - EventEmitter.prototype._once = function(event, fn, prepend) { - this._many(event, 1, fn, prepend); - return this; - }; - - EventEmitter.prototype.many = function(event, ttl, fn) { - return this._many(event, ttl, fn, false); - } - - EventEmitter.prototype.prependMany = function(event, ttl, fn) { - return this._many(event, ttl, fn, true); - } - - EventEmitter.prototype._many = function(event, ttl, fn, prepend) { - var self = this; - - if (typeof fn !== 'function') { - throw new Error('many only accepts instances of Function'); - } - - function listener() { - if (--ttl === 0) { - self.off(event, listener); - } - return fn.apply(this, arguments); - } - - listener._origin = fn; - - this._on(event, listener, prepend); - - return self; - }; - - EventEmitter.prototype.emit = function() { - - this._events || init.call(this); - - var type = arguments[0]; - - if (type === 'newListener' && !this._newListener) { - if (!this._events.newListener) { - return false; - } - } - - var al = arguments.length; - var args,l,i,j; - var handler; - - if (this._all && this._all.length) { - handler = this._all.slice(); - if (al > 3) { - args = new Array(al); - for (j = 0; j < al; j++) args[j] = arguments[j]; - } - - for (i = 0, l = handler.length; i < l; i++) { - this.event = type; - switch (al) { - case 1: - handler[i].call(this, type); - break; - case 2: - handler[i].call(this, type, arguments[1]); - break; - case 3: - handler[i].call(this, type, arguments[1], arguments[2]); - break; - default: - handler[i].apply(this, args); - } - } - } - - if (this.wildcard) { - handler = []; - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - searchListenerTree.call(this, handler, ns, this.listenerTree, 0); - } else { - handler = this._events[type]; - if (typeof handler === 'function') { - this.event = type; - switch (al) { - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - default: - args = new Array(al - 1); - for (j = 1; j < al; j++) args[j - 1] = arguments[j]; - handler.apply(this, args); - } - return true; - } else if (handler) { - // need to make copy of handlers because list can change in the middle - // of emit call - handler = handler.slice(); - } - } - - if (handler && handler.length) { - if (al > 3) { - args = new Array(al - 1); - for (j = 1; j < al; j++) args[j - 1] = arguments[j]; - } - for (i = 0, l = handler.length; i < l; i++) { - this.event = type; - switch (al) { - case 1: - handler[i].call(this); - break; - case 2: - handler[i].call(this, arguments[1]); - break; - case 3: - handler[i].call(this, arguments[1], arguments[2]); - break; - default: - handler[i].apply(this, args); - } - } - return true; - } else if (!this._all && type === 'error') { - if (arguments[1] instanceof Error) { - throw arguments[1]; // Unhandled 'error' event - } else { - throw new Error("Uncaught, unspecified 'error' event."); - } - return false; - } - - return !!this._all; - }; - - EventEmitter.prototype.emitAsync = function() { - - this._events || init.call(this); - - var type = arguments[0]; - - if (type === 'newListener' && !this._newListener) { - if (!this._events.newListener) { return Promise.resolve([false]); } - } - - var promises= []; - - var al = arguments.length; - var args,l,i,j; - var handler; - - if (this._all) { - if (al > 3) { - args = new Array(al); - for (j = 1; j < al; j++) args[j] = arguments[j]; - } - for (i = 0, l = this._all.length; i < l; i++) { - this.event = type; - switch (al) { - case 1: - promises.push(this._all[i].call(this, type)); - break; - case 2: - promises.push(this._all[i].call(this, type, arguments[1])); - break; - case 3: - promises.push(this._all[i].call(this, type, arguments[1], arguments[2])); - break; - default: - promises.push(this._all[i].apply(this, args)); - } - } - } - - if (this.wildcard) { - handler = []; - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - searchListenerTree.call(this, handler, ns, this.listenerTree, 0); - } else { - handler = this._events[type]; - } - - if (typeof handler === 'function') { - this.event = type; - switch (al) { - case 1: - promises.push(handler.call(this)); - break; - case 2: - promises.push(handler.call(this, arguments[1])); - break; - case 3: - promises.push(handler.call(this, arguments[1], arguments[2])); - break; - default: - args = new Array(al - 1); - for (j = 1; j < al; j++) args[j - 1] = arguments[j]; - promises.push(handler.apply(this, args)); - } - } else if (handler && handler.length) { - handler = handler.slice(); - if (al > 3) { - args = new Array(al - 1); - for (j = 1; j < al; j++) args[j - 1] = arguments[j]; - } - for (i = 0, l = handler.length; i < l; i++) { - this.event = type; - switch (al) { - case 1: - promises.push(handler[i].call(this)); - break; - case 2: - promises.push(handler[i].call(this, arguments[1])); - break; - case 3: - promises.push(handler[i].call(this, arguments[1], arguments[2])); - break; - default: - promises.push(handler[i].apply(this, args)); - } - } - } else if (!this._all && type === 'error') { - if (arguments[1] instanceof Error) { - return Promise.reject(arguments[1]); // Unhandled 'error' event - } else { - return Promise.reject("Uncaught, unspecified 'error' event."); - } - } - - return Promise.all(promises); - }; - - EventEmitter.prototype.on = function(type, listener) { - return this._on(type, listener, false); - }; - - EventEmitter.prototype.prependListener = function(type, listener) { - return this._on(type, listener, true); - }; - - EventEmitter.prototype.onAny = function(fn) { - return this._onAny(fn, false); - }; - - EventEmitter.prototype.prependAny = function(fn) { - return this._onAny(fn, true); - }; - - EventEmitter.prototype.addListener = EventEmitter.prototype.on; - - EventEmitter.prototype._onAny = function(fn, prepend){ - if (typeof fn !== 'function') { - throw new Error('onAny only accepts instances of Function'); - } - - if (!this._all) { - this._all = []; - } - - // Add the function to the event listener collection. - if(prepend){ - this._all.unshift(fn); - }else{ - this._all.push(fn); - } - - return this; - } - - EventEmitter.prototype._on = function(type, listener, prepend) { - if (typeof type === 'function') { - this._onAny(type, listener); - return this; - } - - if (typeof listener !== 'function') { - throw new Error('on only accepts instances of Function'); - } - this._events || init.call(this); - - // To avoid recursion in the case that type == "newListeners"! Before - // adding it to the listeners, first emit "newListeners". - if (this._newListener) - this.emit('newListener', type, listener); - - if (this.wildcard) { - growListenerTree.call(this, type, listener); - return this; - } - - if (!this._events[type]) { - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - } - else { - if (typeof this._events[type] === 'function') { - // Change to array. - this._events[type] = [this._events[type]]; - } - - // If we've already got an array, just add - if(prepend){ - this._events[type].unshift(listener); - }else{ - this._events[type].push(listener); - } - - // Check for listener leak - if ( - !this._events[type].warned && - this._maxListeners > 0 && - this._events[type].length > this._maxListeners - ) { - this._events[type].warned = true; - logPossibleMemoryLeak.call(this, this._events[type].length, type); - } - } - - return this; - } - - EventEmitter.prototype.off = function(type, listener) { - if (typeof listener !== 'function') { - throw new Error('removeListener only takes instances of Function'); - } - - var handlers,leafs=[]; - - if(this.wildcard) { - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); - } - else { - // does not use listeners(), so no side effect of creating _events[type] - if (!this._events[type]) return this; - handlers = this._events[type]; - leafs.push({_listeners:handlers}); - } - - for (var iLeaf=0; iLeaf 0) { - recursivelyGarbageCollect(root[key]); - } - if (Object.keys(obj).length === 0) { - delete root[key]; - } - } - } - recursivelyGarbageCollect(this.listenerTree); - - return this; - }; - - EventEmitter.prototype.offAny = function(fn) { - var i = 0, l = 0, fns; - if (fn && this._all && this._all.length > 0) { - fns = this._all; - for(i = 0, l = fns.length; i < l; i++) { - if(fn === fns[i]) { - fns.splice(i, 1); - if (this._removeListener) - this.emit("removeListenerAny", fn); - return this; - } - } - } else { - fns = this._all; - if (this._removeListener) { - for(i = 0, l = fns.length; i < l; i++) - this.emit("removeListenerAny", fns[i]); - } - this._all = []; - } - return this; - }; - - EventEmitter.prototype.removeListener = EventEmitter.prototype.off; - - EventEmitter.prototype.removeAllListeners = function(type) { - if (type === undefined) { - !this._events || init.call(this); - return this; - } - - if (this.wildcard) { - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); - - for (var iLeaf=0; iLeaf=0 ; i-- ) { - if(file.requestHeaders[i].name=="x-request-id") { - requestId = file.requestHeaders[i].value; - break; - } - } - - self.parseReceived(file.responseHeaders, { - "FirebugNetMonitorListener": { - "context": context, - "file": file - }, - "id": requestId || "id:" + file.href + ":" + requestIndex++, - "url": file.href, - // TODO: add "hostname" (file.request.URI.host?) - // TODO: add "port" (file.request.URI.port?) - "method": file.method, - "requestHeaders": file.requestHeaders - }); - } catch(e) { - console.error(e); - } - } - } - } - } - return this.firebugNetMonitorListener; -} - -HttpHeaderChannel.prototype.getMozillaRequestObserverListener = function(globals) { - if(!this.mozillaRequestObserverListener) { - var self = this; - this.mozillaRequestObserverListener = { - observe: function(subject, topic, data) - { - if (topic == "http-on-examine-response") { - - var httpChannel = subject.QueryInterface(globals.Ci.nsIHttpChannel); - - try { - var requestHeaders = []; - var requestId; - httpChannel.visitRequestHeaders({ - visitHeader: function(name, value) - { - requestHeaders.push({name: name, value: value}); - if(name.toLowerCase()=="x-request-id") { - requestId = value; - } - } - }); - var responseHeaders = [], - contentType = false; - httpChannel.visitResponseHeaders({ - visitHeader: function(name, value) - { - responseHeaders.push({name: name, value: value}); - if (name.toLowerCase() == "content-type") - contentType = value; - } - }); - self.parseReceived(responseHeaders, { - "MozillaRequestObserverListener": { - "httpChannel": httpChannel - }, - "id": requestId || "id:" + httpChannel.URI.spec + ":" + requestIndex++, - "url": httpChannel.URI.spec, - "hostname": httpChannel.URI.host, - "port": httpChannel.URI.port, - "method": httpChannel.requestMethod, - "status": httpChannel.responseStatus, - "contentType": contentType, - "requestHeaders": requestHeaders - }); - } catch(e) { - console.error(e); - } - } - } - } - } - return this.mozillaRequestObserverListener; -} - -},{"./channel":5}],3:[function(require,module,exports){ - -var CHANNEL = require("./channel"), - UTIL = require("fp-modules-for-nodejs/lib/util"); - -const HEADER_PREFIX = 'x-wf-'; - -var PostMessageChannel = exports.PostMessageChannel = function () { - if (!(this instanceof exports.PostMessageChannel)) - return new exports.PostMessageChannel(); - - this.__construct(); - - this.HEADER_PREFIX = HEADER_PREFIX; - - this.postMessageSender = null; -} - -PostMessageChannel.prototype = CHANNEL.Channel(); - -PostMessageChannel.prototype.enqueueOutgoing = function(message, bypassReceivers) -{ - var ret = this._enqueueOutgoing(message, bypassReceivers); - - var parts = {}; - this.flush({ - setMessagePart: function(key, value) { - parts[key] = value; - }, - getMessagePart: function(key) { - if (typeof parts[key] == "undefined") - return null; - return parts[key]; - } - }); - - var self = this; - - var payload = []; - UTIL.forEach(parts, function(part) - { - payload.push(part[0] + ": " + part[1]); - }); - self.postMessageSender(payload.join("\n")); - - return ret; -} - -PostMessageChannel.prototype.setPostMessageSender = function(postMessage) -{ - this.postMessageSender = postMessage; -} - -PostMessageChannel.prototype.parseReceivedPostMessage = function(msg) -{ - if (this.status != "open") - this.open(); - this.parseReceived(msg, null, { - skipChannelOpen: true, - skipChannelClose: true, - enableContinuousParsing: true - }); -} - -},{"./channel":5,"fp-modules-for-nodejs/lib/util":22}],4:[function(require,module,exports){ - -var CHANNEL = require("./channel"); - -const HEADER_PREFIX = '#x-wf-'; - -var ShellCommandChannel = exports.ShellCommandChannel = function () { - if (!(this instanceof exports.ShellCommandChannel)) - return new exports.ShellCommandChannel(); - - this.__construct(); - - this.HEADER_PREFIX = HEADER_PREFIX; -} - -ShellCommandChannel.prototype = CHANNEL.Channel(); - -},{"./channel":5}],5:[function(require,module,exports){ - -var UTIL = require("fp-modules-for-nodejs/lib/util"); -var PROTOCOL = require("./protocol"); -var TRANSPORT = require("./transport"); - -var Channel = exports.Channel = function () { - if (!(this instanceof exports.Channel)) - return new exports.Channel(); -} - -Channel.prototype.__construct = function(options) { - options = options || {}; - this.status = "closed"; - this.receivers = []; - this.listeners = []; - this.options = { - "messagePartMaxLength": 5000 - } - this.outgoingQueue = []; - - this.onError = options.onError || null; - - if(typeof options.enableTransport != "undefined" && options.enableTransport===false) { - // do not add transport - } else { - this.addReceiver(TRANSPORT.newReceiver(this)); - } -} - -Channel.prototype.enqueueOutgoing = function(message, bypassReceivers) { - return this._enqueueOutgoing(message, bypassReceivers); -} - -Channel.prototype._enqueueOutgoing = function(message, bypassReceivers) { - if(!bypassReceivers) { - // If a receiver with a matching ID is present on the channel we don't - // enqueue the message if receiver.onMessageReceived returns FALSE. - var enqueue = true; - for( var i=0 ; iparseInt(b[0])) return 1; - if(parseInt(a[0])0) { - for( var j=0 ; j=0 && offset <=3) - { - len = lines[i].length; - if (i+1 == lines.length) offset = 0; - else offset = lines[i+1].indexOf(self.HEADER_PREFIX); - if ( - (offset >=0 && offset <=3) || - lines[i].charAt(len-1) === "|" || - (lines[i].charAt(len-2) === "|" && lines[i].charAt(len-1) === "\\") - ) - { - if(m = expression.exec(lines[i])) { - headers.push({ - "name": m[1], - // prefixing value with '~' indicates approximate message length matching - // the message length has changed due to the newlines being replaced with &!10; - "value": ((true || fuzzy)?"~":"") + m[2] - }); - fuzzy = false; - } - } - else - { - lines[i] = lines[i] + "&!10;" + lines[i+1]; - lines.splice(i+1, 1); - i--; - fuzzy = true; - } - } else - if(m = expression.exec(lines[i])) { - headers.push({ - "name": m[1], - "value": m[2] - }); - fuzzy = false; - } - } - } -*/ - return headers; - } -} - -Channel.prototype.setTransport = function(transport) { - this.transport = transport; -} - - -},{"./protocol":9,"./transport":12,"fp-modules-for-nodejs/lib/util":22}],6:[function(require,module,exports){ - -var CHANNEL = require("../channel"), - UTIL = require("fp-modules-for-nodejs/lib/util"), - HTTP_CLIENT = require("fp-modules-for-nodejs/lib/http-client"), - JSON = require("fp-modules-for-nodejs/lib/json"); - -// TODO: Make this configurable -var HOST = "localhost"; -var PORT = 8099; - -const HEADER_PREFIX = 'x-wf-'; - -var HttpClientChannel = exports.HttpClientChannel = function () { - if (!(this instanceof exports.HttpClientChannel)) - return new exports.HttpClientChannel(); - - this.__construct(); - - this.HEADER_PREFIX = HEADER_PREFIX; -} - -HttpClientChannel.prototype = CHANNEL.Channel(); - -HttpClientChannel.prototype.flush = function(applicator, bypassTransport) -{ - var self = this; - if (typeof applicator === "undefined") - { - var parts = {}; - - applicator = { - setMessagePart: function(key, value) - { - parts[key] = value; - }, - getMessagePart: function(key) - { - if (typeof parts[key] === "undefined") - return null; - return parts[key]; - }, - flush: function(clannel) - { - if (UTIL.len(parts)==0) - return false; - - var data = []; - UTIL.forEach(parts, function(part) - { - data.push(part[0] + ": " + part[1]); - }); - data = data.join("\n"); - - HTTP_CLIENT.request({ - host: HOST, - port: PORT, - path: "/wildfire-server", - method: "POST", - headers: { - "content-type": "application/x-www-form-urlencoded", - "content-length": data.length, - "connection": "close" - }, - data: data - }, function(response) - { - if (response.status == 200) - { - try { - var data = JSON.decode(response.data); - if (data.success === true) - { - // success!! - } - else - console.error("ERROR Got error from wildfire server: " + data.error); - } catch(e) { - console.error("ERROR parsing JSON response from wildfire server (error: " + e + "): " + response.data); - } - } - else - console.error("ERROR from wildfire server (status: " + response.status + "): " + response.data); - }, function(e) - { - if (!/ECONNREFUSED/.test(e)) - console.error("ERROR sending message to wildfire server: " + e); -// else -// module.print("\0red([Wildfire: Not Connected]\0)\n"); - }); - return true; - } - }; - } - return self._flush(applicator); -} - -},{"../channel":5,"fp-modules-for-nodejs/lib/http-client":15,"fp-modules-for-nodejs/lib/json":16,"fp-modules-for-nodejs/lib/util":22}],7:[function(require,module,exports){ - -var Dispatcher = exports.Dispatcher = function () { - if (!(this instanceof exports.Dispatcher)) - return new exports.Dispatcher(); - this.channel = null; -} - -Dispatcher.prototype.setChannel = function(channel) { - return this._setChannel(channel); -} - -Dispatcher.prototype._setChannel = function(channel) { - this.channel = channel; -} - -Dispatcher.prototype.setProtocol = function(protocol) { - this.protocol = protocol; -} - -Dispatcher.prototype.setSender = function(sender) { - this.sender = sender; -} - -Dispatcher.prototype.setReceiver = function(receiver) { - this.receiver = receiver; -} - -Dispatcher.prototype.dispatch = function(message, bypassReceivers) { - return this._dispatch(message, bypassReceivers); -} - -Dispatcher.prototype._dispatch = function(message, bypassReceivers) { - if(!message.getProtocol()) message.setProtocol(this.protocol); - if(!message.getSender()) message.setSender(this.sender); - if(!message.getReceiver()) message.setReceiver(this.receiver); - this.channel.enqueueOutgoing(message, bypassReceivers); -} - -},{}],8:[function(require,module,exports){ - -var Message = exports.Message = function (dispatcher) { - if (!(this instanceof exports.Message)) - return new exports.Message(dispatcher); - - this.meta = null; - this.data = null; - - var self = this; - self.dispatch = function() { - if(!dispatcher) { - throw new Error("dispatcher not set"); - } - return dispatcher.dispatch(self); - } -} - -Message.prototype.setProtocol = function(protocol) { - this.protocol = protocol; -} - -Message.prototype.getProtocol = function() { - return this.protocol; -} - -Message.prototype.setSender = function(sender) { - this.sender = sender; -} - -Message.prototype.getSender = function() { - return this.sender; -} - -Message.prototype.setReceiver = function(receiver) { - this.receiver = receiver; -} - -Message.prototype.getReceiver = function() { - return this.receiver; -} - -Message.prototype.setMeta = function(meta) { - this.meta = meta; -} - -Message.prototype.getMeta = function() { - return this.meta; -} - -Message.prototype.setData = function(data) { - this.data = data; -} - -Message.prototype.getData = function() { - return this.data; -} - -},{}],9:[function(require,module,exports){ - -var MESSAGE = require("./message"); -var JSON = require("fp-modules-for-nodejs/lib/json"); -var UTIL = require("fp-modules-for-nodejs/lib/util"); - -// Tolerance within which messages must match the declared length -// This is used to compensate for length differences when messages are put back together -// because of newlines that were not encoded by sender -const FUZZY_MESSAGE_LENGTH_TOLERANCE = 200; - -var instances = {}; -var protocols = {}; - -exports.factory = function(uri) { - if(instances[uri]) { - return instances[uri]; - } - if(protocols[uri]) { - return (instances[uri] = protocols[uri](uri)); - } - return null; -} - - -protocols["http://registry.pinf.org/cadorn.org/wildfire/@meta/protocol/component/0.1.0"] = -protocols["__TEST__"] = function(uri) { - - return { - parse: function(buffers, receivers, senders, messages, key, value) { - - var parts = key.split('-'); - // parts[0] - receiver - // parts[1] - sender - // parts[2] - message id/index - - if(parts[0]=='index') { - // ignore the index header - return; - } else - if(parts[1]=='receiver') { - receivers[parts[0]] = value; - return; - } else - if(parts[2]=='sender') { - senders[parts[0] + ':' + parts[1]] = value; - return; - } - - // 62|...|\ - // @previous Did not allow for '|' in meta or data - // @ var m = value.match(/^(\d*)?\|(.*)\|(\\)?$/); - // @ if(!m) throw new Error("Error parsing message: " + value); - var m = [], i, j; - // TIP: fuzzy matching is not currently used - m.push((value.charAt(0)=="~")?true:false); - i = value.indexOf("|"); - // TODO: Check for \ before | and skip to next if present - if (value.charAt(i-1) === "\\") - throw new Error("Found \\ before |! in module " + module.id); - m.push(value.substring((m[0])?1:0, i)); - if (value.charAt(value.length-1) === "|") { // end in | - m.push(value.substring(i+1, value.length-1)); - m.push(""); - } else if (value.charAt(value.length-1) === "\\") { // end in |\ (i.e. a continuation) - m.push(value.substring(i+1, value.length-2)); - m.push("\\"); - } else throw new Error("Error parsing for trailing '|' in message part: " + value); - -// m[2] = m[2].replace(/\\{2}/g, "\\"); - - // length present and message matches length - complete message - if(m[1] && - ( - (m[0] && Math.abs(m[1]-m[2].length)0 && buffers[receiver].firsts==buffers[receiver].lasts) { - // first we sort all messages - buffers[receiver].messages.sort( - function (a, b) { - return a[0] - b[0]; - } - ); - // find the first "first" part and start collecting parts - // until "last" is found - var startIndex = null; - var buffer = null; - fuzzy = false; - for( i=0 ; i1) { - msg = ((i==0)?data.length:'') + - '|' + part + '|' + - ((i0) { - var newSenders = {}; - for( var senderKey in senders ) { - var senderParts = senderKey.split(":"); - newSenders[parts[1] + ":" + senderParts[1]] = senders[senderKey]; - } - UTIL.complete(senders, newSenders); - } - return; - } else - if(parts[0]=='plugin') { - - // NOTE: The old protocol specifies senders independent from receivers so we need to add senders for every receiver - // If no receiver is known yet we assume a receiver key of "1" - if(UTIL.len(receivers)==0) { - senders["1" + ":" + parts[1]] = value; - } else { - for( var receiverKey in receivers ) { - senders[receiverKey + ":" + parts[1]] = value; - } - } - return; - } - - // 62|...|\ - var m = value.match(/^(\d*)?\|(.*)\|(\\)?$/); - if(!m) { - throw new Error("Error parsing message: " + value); - } - - // length present and message matches length - complete message - if (m[1] && m[1] == m[2].length && !m[3]) { - enqueueMessage(parts[2], parts[0], parts[1], m[2]); - } else - // message continuation present - message part - if( m[3] ) { - enqueueBuffer(parts[2], parts[0], parts[1], m[2], (m[1])?'first':'part', m[1]); - } else - // no length and no message continuation - last message part - if( !m[1] && !m[3] ) { - enqueueBuffer(parts[2], parts[0], parts[1], m[2], 'last'); - } else { - console.error("m", m); - console.error("m[1]", m[1]); - console.error("m[2].length", m[2].length); - throw new Error('Error parsing message parts: ' + value); - } - - // this supports message parts arriving in any order as fast as possible - function enqueueBuffer(index, receiver, sender, value, position, length) { - if(!buffers[receiver]) { - buffers[receiver] = {"firsts": 0, "lasts": 0, "messages": []}; - } - if(position=="first") buffers[receiver].firsts += 1; - else if(position=="last") buffers[receiver].lasts += 1; - buffers[receiver].messages.push([index, value, position, length]); - - // if we have a mathching number of first and last parts we assume we have - // a complete message so we try and join it - if(buffers[receiver].firsts>0 && buffers[receiver].firsts==buffers[receiver].lasts) { - // first we sort all messages - buffers[receiver].messages.sort( - function (a, b) { - return a[0] - b[0]; - } - ); - // find the first "first" part and start collecting parts - // until "last" is found - var startIndex = null; - var buffer = null; - for( i=0 ; i0) { - meta["group"] = groupStack[groupStack.length-1]; - } - - switch(parts[0][name]) { - case "LOG": - meta["priority"] = "log"; - break; - case "INFO": - meta["priority"] = "info"; - break; - case "WARN": - meta["priority"] = "warn"; - break; - case "ERROR": - meta["priority"] = "error"; - break; - case "EXCEPTION": - var originalData = data; - data = { - "__className": originalData.Class, - "__isException": true, - "protected:message": originalData.Message, - "protected:file": originalData.File, - "protected:line": originalData.Line, - "private:trace": originalData.Trace - } - if (data["private:trace"] && data["private:trace"].length > 0) { - if (data["private:trace"][0].file != originalData.File || data["private:trace"][0].line != originalData.Line) { - data["private:trace"].unshift({ - "class": originalData.Class || "", - "type": originalData.Type || "", - "function": originalData.Function || "", - "file": originalData.File || "", - "line": originalData.Line || "", - "args": originalData.Args || "" - }); - } - } - meta["priority"] = "error"; - break; - case "TRACE": - meta["renderer"] = "http://registry.pinf.org/cadorn.org/renderers/packages/insight/0:structures/trace"; - var trace = [ - { - "class": data.Class || "", - "type": data.Type || "", - "function": data.Function || "", - "file": data.File || "", - "line": data.Line || "", - "args": data.Args || "" - } - ]; - if(data.Trace) { - trace = trace.concat(data.Trace); - } - data = { - "title": data.Message, - "trace": trace - }; - break; - case "TABLE": - meta["renderer"] = "http://registry.pinf.org/cadorn.org/renderers/packages/insight/0:structures/table"; - data = {"data": data}; - if(data.data.length==2 && typeof data.data[0] == "string") { - data.header = data.data[1].splice(0,1)[0]; - data.title = data.data[0]; - data.data = data.data[1]; - } else { - data.header = data.data.splice(0,1)[0]; - } - break; - case "GROUP_START": - groupIndex++; - meta["group.start"] = true; - meta["group"] = "group-" + groupIndex; - groupStack.push("group-" + groupIndex); - break; - case "GROUP_END": - meta["group.end"] = true; - if(groupStack.length>0) { - groupStack.pop(); - } - break; - default: - throw new Error("Log type '" + parts[0][name] + "' not implemented"); - break; - } - } else - if(name=="Label") { - meta["label"] = parts[0][name]; - } else - if(name=="File") { - meta["file"] = parts[0][name]; - } else - if(name=="Line") { - meta["line"] = parts[0][name]; - } else - if(name=="Collapsed") { - meta[".collapsed"] = (parts[0][name]=='true')?true:false; -// } else -// if(name=="Color") { -// meta["fc.group.color"] = parts[0][name]; - } - } - } else - // dump - { - data = parts; - meta["label"] = "Dump"; - } - - if(meta["renderer"] == "http://registry.pinf.org/cadorn.org/renderers/packages/insight/0:structures/table") { - if(meta["label"]) { - data.title = meta["label"]; - delete meta["label"]; - } - } else - if(meta["group.start"]) { - meta["group.title"] = meta["label"]; - delete meta["label"]; - if(typeof meta[".collapsed"] == "undefined" || !meta[".collapsed"]) { - meta["group.expand"] = meta["group"]; - } - delete meta[".collapsed"]; - } - - var message = MESSAGE.Message(); - message.setReceiver(receiver); - message.setSender(sender); - - try { - message.setMeta(JSON.encode(meta)); - } catch(e) { - console.error("Error encoding object (JsonStream compatibility)", e, meta); - throw e; - } - - try { - message.setData(JSON.encode(data)); - } catch(e) { - console.error("Error encoding object (JsonStream compatibility)", e, data); - throw e; - } - - messages[receiver].push([index, message]); - } - }, - - encodeMessage: function(options, message) { - throw new Error("Not implemented!"); - }, - - encodeKey: function(util, receiverId, senderId) { - throw new Error("Not implemented!"); - } - }; -}; - - - -protocols["http://registry.pinf.org/cadorn.org/wildfire/@meta/protocol/announce/0.1.0"] = function(uri) { - - return { - parse: function(buffers, receivers, senders, messages, key, value) { - - var parts = key.split('-'); - // parts[0] - message id/index - - if(parts[0]=='index') { - // ignore the index header - return; - } - - // 62|...|\ - var m = value.match(/^(\d*)?\|(.*)\|(\\)?$/); - if(!m) { - throw new Error("Error parsing message: " + value); - } - - // length present and message matches length - complete message - if(m[1] && m[1]==m[2].length && !m[3]) { - enqueueMessage(key, m[2]); - } else - // message continuation present - message part - if( m[3] ) { - enqueueBuffer(key, m[2], (m[1])?'first':'part', m[1]); - } else - // no length and no message continuation - last message part - if( !m[1] && !m[3] ) { - enqueueBuffer(key, m[2], 'last'); - } else { - throw new Error('Error parsing message: ' + value); - } - - // this supports message parts arriving in any order as fast as possible - function enqueueBuffer(index, value, position, length) { - - receiver = "*"; - if(!buffers[receiver]) { - buffers[receiver] = {"firsts": 0, "lasts": 0, "messages": []}; - } - if(position=="first") buffers[receiver].firsts += 1; - else if(position=="last") buffers[receiver].lasts += 1; - buffers[receiver].messages.push([index, value, position, length]); - - // if we have a mathching number of first and last parts we assume we have - // a complete message so we try and join it - if(buffers[receiver].firsts>0 && buffers[receiver].firsts==buffers[receiver].lasts) { - // first we sort all messages - buffers[receiver].messages.sort( - function (a, b) { - return a[0] - b[0]; - } - ); - // find the first "first" part and start collecting parts - // until "last" is found - var startIndex = null; - var buffer = null; - for( i=0 ; i2) { - msg = ((i==0)?data.length:'') + - '|' + part + '|' + - ((i 0 ) { - parts.push(part); - value = value.substr(length); - } - return parts; -} - -},{"./message":8,"fp-modules-for-nodejs/lib/json":16,"fp-modules-for-nodejs/lib/util":22}],10:[function(require,module,exports){ - -var Receiver = exports.Receiver = function () { - if (!(this instanceof exports.Receiver)) - return new exports.Receiver(); - - this.listeners = []; - this.ids = []; -} - -Receiver.prototype.setId = function(id) { - if(this.ids.length > 0) { - throw new Error("ID already set for receiver!"); - } - this.ids.push(id); -} - -Receiver.prototype.addId = function(id) { - this.ids.push(id); -} - -/** - * @deprecated - */ -Receiver.prototype.getId = function() { - if(this.ids.length > 1) { - throw new Error("DEPRECATED: Multiple IDs for receiver. Cannot use getId(). Use getIds() instead!"); - } - return this.ids[0]; -} - -Receiver.prototype.getIds = function() { - return this.ids; -} - -Receiver.prototype.hasId = function(id) { - for( var i=0 ; i= this._length) - return NaN; - - //var b = this._bytes[this._offset + offset]; - //return (b >= 0) ? b : -1 * ((b ^ 0xFF) + 1); - return B_GET(this._bytes, this._offset + offset) -}; - -Binary.prototype.indexOf = function(byteValue, start, stop) { - // HACK: use ByteString's slice since we know we won't be modifying result - var array = ByteString.prototype.slice.apply(this, [start, stop]).toArray(), - result = array.indexOf(byteValue); - return (result < 0) ? -1 : result + (start || 0); -}; - -Binary.prototype.lastIndexOf = function(byteValue, start, stop) { - // HACK: use ByteString's slice since we know we won't be modifying result - var array = ByteString.prototype.slice.apply(this, [start, stop]).toArray(), - result = array.lastIndexOf(byteValue); - return (result < 0) ? -1 : result + (start || 0); -}; - -// valueOf() -Binary.prototype.valueOf = function() { - return this; -}; - -/* ByteString */ - -var ByteString = exports.ByteString = function() { - if (!(this instanceof ByteString)) { - if (arguments.length == 0) - return new ByteString(); - if (arguments.length == 1) - return new ByteString(arguments[0]); - if (arguments.length == 2) - return new ByteString(arguments[0], arguments[1]); - if (arguments.length == 3) - return new ByteString(arguments[0], arguments[1], arguments[2]); - } - - // ByteString() - Construct an empty byte string. - if (arguments.length === 0) { - this._bytes = B_ALLOC(0); // null; - this._offset = 0; - this._length = 0; - } - // ByteString(byteString) - Copies byteString. - else if (arguments.length === 1 && arguments[0] instanceof ByteString) { - return arguments[0]; - } - // ByteString(byteArray) - Use the contents of byteArray. - else if (arguments.length === 1 && arguments[0] instanceof ByteArray) { - var copy = arguments[0].toByteArray(); - this._bytes = copy._bytes; - this._offset = copy._offset; - this._length = copy._length; - } - // ByteString(arrayOfNumbers) - Use the numbers in arrayOfNumbers as the bytes. - else if (arguments.length === 1 && Array.isArray(arguments[0])) { - var array = arguments[0]; - this._bytes = B_ALLOC(array.length); - for (var i = 0; i < array.length; i++) { - var b = array[i]; - // If any element is outside the range 0...255, an exception (TODO) is thrown. - if (b < -0x80 || b > 0xFF) - throw new Error("ByteString constructor argument Array of integers must be -128 - 255 ("+b+")"); - // Java "bytes" are interpreted as 2's complement - //this._bytes[i] = (b < 128) ? b : -1 * ((b ^ 0xFF) + 1); - B_SET(this._bytes, i, b); - } - this._offset = 0; - this._length = B_LENGTH(this._bytes); - } - // ByteString(string, charset) - Convert a string. The ByteString will contain string encoded with charset. - else if ((arguments.length === 1 || (arguments.length === 2 && arguments[1] === undefined)) && typeof arguments[0] === "string") { - this._bytes = B_ENCODE_DEFAULT(arguments[0]); - this._offset = 0; - this._length = B_LENGTH(this._bytes); - } - else if (arguments.length === 2 && typeof arguments[0] === "string" && typeof arguments[1] === "string") { - this._bytes = B_ENCODE(arguments[0], arguments[1]); - this._offset = 0; - this._length = B_LENGTH(this._bytes); - } - // private: ByteString(bytes, offset, length) - else if (arguments.length === 3 && typeof arguments[1] === "number" && typeof arguments[2] === "number") { - this._bytes = arguments[0]; - this._offset = arguments[1]; - this._length = arguments[2]; - } - else { - var util = require("./util"); - throw new Error("Illegal arguments to ByteString constructor: " + util.repr(arguments)); - } - - if (engine.ByteStringWrapper) - return engine.ByteStringWrapper(this); - else - return this; -}; - -ByteString.prototype = new Binary(); - -ByteString.prototype.__defineGetter__("length", function() { - return this._length; -}); -ByteString.prototype.__defineSetter__("length", function(length) { -}); - -// toByteArray() - Returns a byte for byte copy in a ByteArray. -// toByteArray(sourceCharset, targetCharset) - Returns a transcoded copy in a ByteArray. -// - implemented on Binary - -// toByteString() - Returns itself, since there's no need to copy an immutable ByteString. -// toByteString(sourceCharset, targetCharset) - Returns a transcoded copy. -// - implemented on Binary - -// toArray() - Returns an array containing the bytes as numbers. -// toArray(charset) - Returns an array containing the decoded Unicode code points. -// - implemented on Binary - -// toString() -ByteString.prototype.toString = function(charset) { - if (charset) - return this.decodeToString(charset); - - return "[ByteString "+this._length+"]"; -}; - -// decodeToString(charset) - Returns the decoded ByteArray as a string. -// - implemented on Binary - -ByteString.prototype.byteAt = -ByteString.prototype.charAt = function(offset) { - var byteValue = this.get(offset); - - if (isNaN(byteValue)) - return new ByteString(); - - return new ByteString([byteValue]); -}; - -// indexOf() - implemented on Binary -// lastIndexOf() - implemented on Binary - -// charCodeAt(offset) -ByteString.prototype.charCodeAt = Binary.prototype.get; - -// get(offset) - implemented on Binary - -// byteAt(offset) ByteString - implemented on Binary -// charAt(offset) ByteString - implemented on Binary - -// split(delimiter, [options]) -ByteString.prototype.split = function(delimiters, options) { - var options = options || {}, - count = options.count === undefined ? -1 : options.count, - includeDelimiter = options.includeDelimiter || false; - - // standardize delimiters into an array of ByteStrings: - if (!Array.isArray(delimiters)) - delimiters = [delimiters]; - - delimiters = delimiters.map(function(delimiter) { - if (typeof delimiter === "number") - delimiter = [delimiter]; - return new ByteString(delimiter); - }); - - var components = [], - startOffset = this._offset, - currentOffset = this._offset; - - // loop until there's no more bytes to consume - bytes_loop : - while (currentOffset < this._offset + this._length) { - - // try each delimiter until we find a match - delimiters_loop : - for (var i = 0; i < delimiters.length; i++) { - var d = delimiters[i]; - - for (var j = 0; j < d._length; j++) { - // reached the end of the bytes, OR bytes not equal - if (currentOffset + j > this._offset + this._length || - B_GET(this._bytes, currentOffset + j) !== B_GET(d._bytes, d._offset + j)) { - continue delimiters_loop; - } - } - - // push the part before the delimiter - components.push(new ByteString(this._bytes, startOffset, currentOffset - startOffset)); - - // optionally push the delimiter - if (includeDelimiter) - components.push(new ByteString(this._bytes, currentOffset, d._length)) - - // reset the offsets - startOffset = currentOffset = currentOffset + d._length; - - continue bytes_loop; - } - - // if there was no match, increment currentOffset to try the next one - currentOffset++; - } - - // push the remaining part, if any - if (currentOffset > startOffset) - components.push(new ByteString(this._bytes, startOffset, currentOffset - startOffset)); - - return components; -}; - -// slice() -// slice(begin) -// slice(begin, end) -ByteString.prototype.slice = function(begin, end) { - if (begin === undefined) - begin = 0; - else if (begin < 0) - begin = this._length + begin; - - if (end === undefined) - end = this._length; - else if (end < 0) - end = this._length + end; - - begin = Math.min(this._length, Math.max(0, begin)); - end = Math.min(this._length, Math.max(0, end)); - - return new ByteString(this._bytes, this._offset + begin, end - begin); -}; - -// substr(start) -// substr(start, length) -ByteString.prototype.substr = function(start, length) { - if (start !== undefined) { - if (length !== undefined) - return this.slice(start); - else - return this.slice(start, start + length); - } - return this.slice(); -}; - -// substring(first) -// substring(first, last) -ByteString.prototype.substring = function(from, to) { - if (from !== undefined) { - if (to !== undefined) - return this.slice(Math.max(Math.min(from, this._length), 0)); - else - return this.slice(Math.max(Math.min(from, this._length), 0), - Math.max(Math.min(to, this._length), 0)); - } - return this.slice(); -}; - -// [] ByteString - TODO - -// toSource() -ByteString.prototype.toSource = function() { - return "ByteString(["+this.toArray().join(",")+"])"; -}; - -/* ByteArray */ - -// ByteArray() - New, empty ByteArray. -// ByteArray(length) - New ByteArray filled with length zero bytes. -// ByteArray(byteArray) - Copy byteArray. -// ByteArray(byteString) - Copy contents of byteString. -// ByteArray(arrayOfBytes) - Use numbers in arrayOfBytes as contents. -// Throws an exception if any element is outside the range 0...255 (TODO). -// ByteArray(string, charset) - Create a ByteArray from a Javascript string, the result being encoded with charset. -var ByteArray = exports.ByteArray = function() { - if (!this instanceof ByteArray) { - if (arguments.length == 0) - return new ByteArray(); - if (arguments.length == 1) - return new ByteArray(arguments[0]); - if (arguments.length == 2) - return new ByteArray(arguments[0], arguments[1]); - if (arguments.length == 3) - return new ByteArray(arguments[0], arguments[1], arguments[2]); - } - - // ByteArray() - New, empty ByteArray. - if (arguments.length === 0) { - this._bytes = B_ALLOC(0); // null; - this._offset = 0; - this._length = 0; - } - // ByteArray(length) - New ByteArray filled with length zero bytes. - else if (arguments.length === 1 && typeof arguments[0] === "number") { - this._bytes = B_ALLOC(arguments[0]); // null; - this._offset = 0; - this._length = B_LENGTH(this._bytes); - } - // ByteArray(byteArray) - Copy byteArray. - // ByteArray(byteString) - Copy contents of byteString. - else if (arguments.length === 1 && (arguments[0] instanceof ByteArray || arguments[0] instanceof ByteString)) { - var byteArray = new ByteArray(arguments[0]._length); - B_COPY(arguments[0]._bytes, arguments[0]._offset, byteArray._bytes, byteArray._offset, byteArray._length); - return byteArray; - } - // ByteArray(arrayOfBytes) - Use numbers in arrayOfBytes as contents. - // Throws an exception if any element is outside the range 0...255 (TODO). - else if (arguments.length === 1 && Array.isArray(arguments[0])) { - var array = arguments[0]; - this._bytes = B_ALLOC(array.length); - for (var i = 0; i < array.length; i++) { - var b = array[i]; - // If any element is outside the range 0...255, an exception (TODO) is thrown. - if (b < 0 || b > 0xFF) - throw new Error("ByteString constructor argument Array of integers must be 0 - 255 ("+b+")"); - // Java "bytes" are interpreted as 2's complement - //this._bytes[i] = (b < 128) ? b : -1 * ((b ^ 0xFF) + 1); - B_SET(this._bytes, i, b); - } - this._offset = 0; - this._length = B_LENGTH(this._bytes); - } - // ByteArray(string, charset) - Create a ByteArray from a Javascript string, the result being encoded with charset. - else if ((arguments.length === 1 || (arguments.length === 2 && arguments[1] === undefined)) && typeof arguments[0] === "string") { - this._bytes = B_ENCODE_DEFAULT(arguments[0]); - this._offset = 0; - this._length = B_LENGTH(this._bytes); - } - else if (arguments.length === 2 && typeof arguments[0] === "string" && typeof arguments[1] === "string") { - this._bytes = B_ENCODE(arguments[0], arguments[1]); - this._offset = 0; - this._length = B_LENGTH(this._bytes); - } - // private: ByteArray(bytes, offset, length) - else if (arguments.length === 3 && typeof arguments[1] === "number" && typeof arguments[2] === "number") { - this._bytes = arguments[0]; - this._offset = arguments[1]; - this._length = arguments[2]; - } - else - throw new Error("Illegal arguments to ByteString constructor: [" + - Array.prototype.join.apply(arguments, [","]) + "] ("+arguments.length+")"); - - if (engine.ByteArrayWrapper) - return engine.ByteArrayWrapper(this); - else - return this; -}; - -ByteArray.prototype = new Binary(); - -ByteArray.prototype.__defineGetter__("length", function() { - return this._length; -}); -ByteArray.prototype.__defineSetter__("length", function(length) { - if (typeof length !== "number") - return; - - // same length - if (length === this._length) { - return; - } - // new length is less, truncate - else if (length < this._length) { - this._length = length; - } - // new length is more, but fits without moving, just clear new bytes - else if (this._offset + length <= B_LENGTH(this._bytes)) { - B_FILL(this._bytes, this._length, this._offset + length - 1, 0); - this._length = length; - } - // new length is more, but fits if we shift to bottom, so do that. - else if (length <= B_LENGTH(this._bytes)) { - B_COPY(this._bytes, this._offset, this._bytes, 0, this._length); - this._offset = 0; - B_FILL(this._bytes, this._length, this._offset + length - 1, 0); - this._length = length; - } - // new length is more than the allocated bytes array, allocate a new one and copy the data - else { - var newBytes = B_ALLOC(length); - B_COPY(this._bytes, this._offset, newBytes, 0, this._length); - this._bytes = newBytes; - this._offset = 0; - this._length = length; - } -}); - -// FIXME: array notation for set and get -ByteArray.prototype.set = function(index, b) { - // If any element is outside the range 0...255, an exception (TODO) is thrown. - if (b < 0 || b > 0xFF) - throw new Error("ByteString constructor argument Array of integers must be 0 - 255 ("+b+")"); - - if (index < 0 || index >= this._length) - throw new Error("Out of range"); - - // Java "bytes" are interpreted as 2's complement - //this._bytes[this._offset + index] = (b < 128) ? b : -1 * ((b ^ 0xFF) + 1); - B_SET(this._bytes, this._offset + index, b); -}; - -// toArray() -// toArray(charset) -// - implemented on Binary - -// toByteArray() - just a copy -// toByteArray(sourceCharset, targetCharset) - transcoded -// - implemented on Binary - -// toByteString() - byte for byte copy -// toByteString(sourceCharset, targetCharset) - transcoded -// - implemented on Binary - -// toString() - a string representation like "[ByteArray 10]" -// toString(charset) - an alias for decodeToString(charset) -ByteArray.prototype.toString = function(charset) { - if (charset) - return this.decodeToString(charset); - - return "[ByteArray "+this._length+"]"; -}; - -// decodeToString(charset) - implemented on Binary - -// byteAt(offset) ByteString - Return the byte at offset as a ByteString. -// - implemented on Binary - -// get(offset) Number - Return the byte at offset as a Number. -// - implemented on Binary - -// concat(other ByteArray|ByteString|Array) -// TODO: I'm assuming Array means an array of ByteStrings/ByteArrays, not an array of integers. -ByteArray.prototype.concat = function() { - var components = [this], - totalLength = this._length; - - for (var i = 0; i < arguments.length; i++) { - var component = Array.isArray(arguments[i]) ? arguments[i] : [arguments[i]]; - - for (var j = 0; j < component.length; j++) { - var subcomponent = component[j]; - if (!(subcomponent instanceof ByteString) && !(subcomponent instanceof ByteArray)) - throw "Arguments to ByteArray.concat() must be ByteStrings, ByteArrays, or Arrays of those."; - - components.push(subcomponent); - totalLength += subcomponent.length; - } - } - - var result = new ByteArray(totalLength), - offset = 0; - - components.forEach(function(component) { - B_COPY(component._bytes, component._offset, result._bytes, offset, component._length); - offset += component._length; - }); - - return result; -}; - -// pop() -> byte Number -ByteArray.prototype.pop = function() { - if (this._length === 0) - return undefined; - - this._length--; - - return B_GET(this._bytes, this._offset + this._length); -}; - -// push(...variadic Numbers...)-> count Number -ByteArray.prototype.push = function() { - var length, newLength = this.length += length = arguments.length; - try { - for (var i = 0; i < length; i++) - this.set(newLength - length + i, arguments[i]); - } catch (e) { - this.length -= length; - throw e; - } - return newLength; -}; - -// extendRight(...variadic Numbers / Arrays / ByteArrays / ByteStrings ...) -ByteArray.prototype.extendRight = function() { - throw "NYI"; -}; - -// shift() -> byte Number -ByteArray.prototype.shift = function() { - if (this._length === 0) - return undefined; - - this._length--; - this._offset++; - - return B_GET(this._bytes, this._offset - 1); -}; - -// unshift(...variadic Numbers...) -> count Number -ByteArray.prototype.unshift = function() { - var copy = this.slice(); - this.length = 0; - try { - this.push.apply(this, arguments); - this.push.apply(this, copy.toArray()); - return this.length; - } catch(e) { - B_COPY(copy._bytes, copy._offset, this._bytes, this._offset, copy.length); - this.length = copy.length; - throw e; - } -}; - -// extendLeft(...variadic Numbers / Arrays / ByteArrays / ByteStrings ...) -ByteArray.prototype.extendLeft = function() { - throw "NYI"; -}; - -// reverse() in place reversal -ByteArray.prototype.reverse = function() { - // "limit" is halfway, rounded down. "top" is the last index. - var limit = Math.floor(this._length/2) + this._offset, - top = this._length - 1; - - // swap each pair of bytes, up to the halfway point - for (var i = this._offset; i < limit; i++) { - var tmp = B_GET(this._bytes, i); - B_SET(this._bytes, i, B_GET(this._bytes, top - i)); - B_SET(this._bytes, top - i, tmp); - } - - return this; -}; - -// slice() -ByteArray.prototype.slice = function() { - return new ByteArray(ByteString.prototype.slice.apply(this, arguments)); -}; - -var numericCompareFunction = function(o1, o2) { return o1 - o2; }; - -// sort([compareFunction]) -ByteArray.prototype.sort = function(compareFunction) { - // FIXME: inefficient? - - var array = this.toArray(); - - if (arguments.length) - array.sort(compareFunction); - else - array.sort(numericCompareFunction); - - for (var i = 0; i < array.length; i++) - this.set(i, array[i]); -}; - -// splice() -ByteArray.prototype.splice = function(index, howMany /*, elem1, elem2 */) { - if (index === undefined) return; - if (index < 0) index += this.length; - if (howMany === undefined) howMany = this._length - index; - var end = index + howMany; - var remove = this.slice(index, end); - var keep = this.slice(end); - var inject = Array.prototype.slice.call(arguments, 2); - this._length = index; - this.push.apply(this, inject); - this.push.apply(this, keep.toArray()); - return remove; -}; - -// indexOf() - implemented on Binary -// lastIndexOf() - implemented on Binary - -// split() Returns an array of ByteArrays instead of ByteStrings. -ByteArray.prototype.split = function() { - var components = ByteString.prototype.split.apply(this.toByteString(), arguments); - - // convert ByteStrings to ByteArrays - for (var i = 0; i < components.length; i++) { - // we know we can use these byte buffers directly since we copied them above - components[i] = new ByteArray(components[i]._bytes, components[i]._offset, components[i]._length); - } - - return components; -}; - -// filter(callback[, thisObject]) -ByteArray.prototype.filter = function(callback, thisObject) { - var result = new ByteArray(this._length); - for (var i = 0, length = this._length; i < length; i++) { - var value = this.get(i); - if (callback.apply(thisObject, [value, i, this])) - result.push(value); - } - return result; -}; - -// forEach(callback[, thisObject]); -ByteArray.prototype.forEach = function(callback, thisObject) { - for (var i = 0, length = this._length; i < length; i++) - callback.apply(thisObject, [this.get(i), i, this]); -}; - -// every(callback[, thisObject]) -ByteArray.prototype.every = function(callback, thisObject) { - for (var i = 0, length = this._length; i < length; i++) - if (!callback.apply(thisObject, [this.get(i), i, this])) - return false; - return true; -}; - -// some(callback[, thisObject]) -ByteArray.prototype.some = function(callback, thisObject) { - for (var i = 0, length = this._length; i < length; i++) - if (callback.apply(thisObject, [this.get(i), i, this])) - return true; - return false; -}; - -// map(callback[, thisObject]); -ByteArray.prototype.map = function(callback, thisObject) { - var result = new ByteArray(this._length); - for (var i = 0, length = this._length; i < length; i++) - result.set(i, callback.apply(thisObject, [this.get(i), i, this])); - return result; -}; - -// reduce(callback[, initialValue]) -ByteArray.prototype.reduce = function(callback, initialValue) { - var value = initialValue; - for (var i = 0, length = this._length; i < length; i++) - value = callback(value, this.get(i), i, this); - return value; -}; - -// reduceRight(callback[, initialValue]) -ByteArray.prototype.reduceRight = function(callback, initialValue) { - var value = initialValue; - for (var i = this._length-1; i > 0; i--) - value = callback(value, this.get(i), i, this); - return value; -}; - -// displace(begin, end, values/ByteStrings/ByteArrays/Arrays...) -> length -// begin/end are specified like for slice. Can be used like splice but does not return the removed elements. -ByteArray.prototype.displace = function(begin, end) { - throw "NYI"; -}; - -// toSource() returns a string like "ByteArray([])" for a null byte-array. -ByteArray.prototype.toSource = function() { - return "ByteArray(["+this.toArray().join(",")+"])"; -}; - - -},{"./platform/node/binary":19,"./util":22}],15:[function(require,module,exports){ - -//var ENGINE = require("./platform/{platform}/http-client"); -var ENGINE = require("./platform/browser/http-client"); -var URI = require("./uri"); - -/** - * @param options object - * host: 'www.google.com' - * port: 80 - * path: '/upload' - * method: 'POST' - * headers: {} - * data: request (post) data - * responseEncoding: 'utf8' - */ -exports.request = function(options, successCallback, errorCallback) -{ - if (typeof options.url !== "undefined") - { - if (typeof options.host !== "undefined") - throw new Error("Cannot set 'host' when 'url' is set!"); - if (typeof options.path !== "undefined") - throw new Error("Cannot set 'path' when 'url' is set!"); - if (typeof options.port !== "undefined") - throw new Error("Cannot set 'port' when 'url' is set!"); - - var uri = URI.URI(options.url); - - options.host = uri.authority; - options.port = uri.port || ((uri.scheme === "https")?443:80); - options.path = uri.path || "/"; - - if (uri.query) { - options.path += "?" + uri.query; - } - } - options.method = options.method || "GET"; - options.port = options.port || 80; - options.path = options.path || "/"; - options.url = options.url || ("http://" + options.host + ":" + options.port + options.path); - options.headers = options.headers || { "Host": options.host }; - - options.headers["Host"] = options.headers["Host"] || options.host; - options.headers["User-Agent"] = options.headers["User-Agent"] || "pinf/modules-js/http-client"; - - return ENGINE.request(options, successCallback, errorCallback); -} - -},{"./platform/browser/http-client":18,"./uri":21}],16:[function(require,module,exports){ - -exports.encode = JSON.stringify; -exports.decode = JSON.parse; - -},{}],17:[function(require,module,exports){ - -/*! - A JavaScript implementation of the RSA Data Security, Inc. MD5 Message - Digest Algorithm, as defined in RFC 1321. - Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. - Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - Distributed under the BSD License - See http://pajhome.org.uk/crypt/md5 for more info. - Ported to Chiron and Narwhal by Kris Kowal, kriskowal -*/ - -// ported by: -// -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License - -var util = require("./util"); -var struct = require("./struct"); - -/* - * Configurable variables. You may need to tweak these to be compatible with - * the server-side, but the defaults work in most cases. - */ - -/*** hash - returns a hex string of the md5 hash for a given string. -*/ -exports.hash_md5 = function(s) { - return struct.bin2hex(exports.hash(s)); -} -exports.hash = function (s, _characterSize) { - if (util.no(_characterSize)) _characterSize = struct.characterSize; - return struct.binl2bin(core_md5(struct.str2binl(s), s.length * _characterSize)); -}; - -/* - * Calculate the MD5 of an array of little-endian words, and a bit length - */ -var core_md5 = function (x, len) { - /* append padding */ - x[len >> 5] |= 0x80 << ((len) % 32); - x[(((len + 64) >>> 9) << 4) + 14] = len; - - var a = 1732584193; - var b = -271733879; - var c = -1732584194; - var d = 271733878; - - for (var i = 0; i < x.length; i += 16) { - var olda = a; - var oldb = b; - var oldc = c; - var oldd = d; - - a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); - d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); - c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); - b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); - a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); - d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); - c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); - b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); - a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); - d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); - c = md5_ff(c, d, a, b, x[i+10], 17, -42063); - b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); - a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); - d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); - c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); - b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); - - a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); - d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); - c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); - b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); - a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); - d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); - c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); - b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); - a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); - d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); - c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); - b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); - a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); - d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); - c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); - b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); - - a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); - d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); - c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); - b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); - a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); - d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); - c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); - b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); - a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); - d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); - c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); - b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); - a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); - d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); - c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); - b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); - - a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); - d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); - c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); - b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); - a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); - d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); - c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); - b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); - a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); - d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); - c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); - b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); - a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); - d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); - c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); - b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); - - a = struct.addU32(a, olda); - b = struct.addU32(b, oldb); - c = struct.addU32(c, oldc); - d = struct.addU32(d, oldd); - } - return [a, b, c, d]; - -}; - -/* - * These functions implement the four basic operations the algorithm uses. - */ - -var md5_cmn = function (q, a, b, x, s, t) { - return struct.addU32(struct.rolU32(struct.addU32(a, q, x, t), s), b); -}; - -var md5_ff = function (a, b, c, d, x, s, t) { - return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); -}; - -var md5_gg = function (a, b, c, d, x, s, t) { - return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); -}; - -var md5_hh = function (a, b, c, d, x, s, t) { - return md5_cmn(b ^ c ^ d, a, b, x, s, t); -}; - -var md5_ii = function (a, b, c, d, x, s, t) { - return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); -}; - -/* - * Calculate the HMAC-MD5, of a key and some data - */ -var core_hmac_md5 = function (key, data, _characterSize) { - if (util.no(_characterSize)) _characterSize = struct.characterSize; - var bkey = struct.str2binl(key); - if(bkey.length > 16) bkey = core_md5(bkey, key.length * _characterSize); - - var ipad = [], opad = []; - for (var i = 0; i < 16; i++) { - ipad[i] = bkey[i] ^ 0x36363636; - opad[i] = bkey[i] ^ 0x5C5C5C5C; - } - - var hash = core_md5(ipad.concat(struct.str2binl(data)), 512 + data.length * _characterSize); - return core_md5(opad.concat(hash), 512 + 128); -}; - - -},{"./struct":20,"./util":22}],18:[function(require,module,exports){ - -exports.request = function(options, successCallback, errorCallback) -{ - try { - - // TODO: Add support for other browsers - - var request = new XMLHttpRequest(); - request.onreadystatechange = function (event) { - if (request.readyState == 4) { - - var headers = {}, - lines = request.getAllResponseHeaders().split("\n"); - for (var i=0,ic=lines.length ; i> 16) + (x >> 16) + (lsw >> 16); - acc = (msw << 16) | (lsw & 0xFFFF); - } - return acc; -}; - -/* undocumented rolU32 - Bitwise rotate a 32-bit number to the left. -*/ -exports.rolU32 = function (num, cnt) { - return (num << cnt) | (num >>> (32 - cnt)); -}; - -/* undocumented str2binl - Convert a string to an array of little-endian words - If characterSize is ASCII, characters >255 have their hi-byte silently ignored. -*/ -exports.str2binl = function (str, _characterSize) { - if (util.no(_characterSize)) - _characterSize = exports.characterSize; - var bin = []; - var mask = (1 << _characterSize) - 1; - for (var i = 0; i < str.length * _characterSize; i += _characterSize) - bin[i>>5] |= (str.charCodeAt(i / _characterSize) & mask) << (i % 32); - return bin; -}; - -/* undocumented str2binb - Convert an 8-bit or 16-bit string to an array of big-endian words - In 8-bit function, characters >255 have their hi-byte silently ignored. -*/ -exports.str2binb = function (str, _characterSize) { - if (util.no(_characterSize)) - _characterSize = exports.characterSize; - var bin = []; - var mask = (1 << _characterSize) - 1; - for (var i = 0; i < str.length * _characterSize; i += _characterSize) - bin[i>>5] |= ( - (str.charCodeAt(i / _characterSize) & mask) << - (32 - _characterSize - i % 32) - ); - return bin; -}; - -/* undocumented binl2str - Convert an array of little-endian words to a string -*/ -exports.binl2str = function (bin, _characterSize) { - return exports.binl2bin(bin, _characterSize).decodeToString('ascii'); -}; - -/* undocumented binl2bin - Convert an array of little-endian words to a string -*/ -exports.binl2bin = function (bin, _characterSize) { - if (util.no(_characterSize)) - _characterSize = exports.characterSize; - var str = []; - var mask = (1 << _characterSize) - 1; - for (var i = 0; i < bin.length * 32; i += _characterSize) - str.push((bin[i>>5] >>> (i % 32)) & mask); - return binary.ByteString(str); -}; - -/* undocumented binb2str - Convert an array of big-endian words to a string -*/ -exports.binb2str = function (bin, _characterSize) { - return exports.binb2bin(bin, _characterSize).decodeToString('ascii'); -}; - -/* undocumented binb2bin - Convert an array of big-endian words to a string -*/ -exports.binb2bin = function (bin, _characterSize) { - if (util.no(_characterSize)) - _characterSize = exports.characterSize; - var str = []; - var mask = (1 << _characterSize) - 1; - for (var i = 0; i < bin.length * 32; i += _characterSize) - str.push((bin[i>>5] >>> (32 - _characterSize - i % 32)) & mask); - return binary.ByteString(str); -}; - -/* undocumented binl2hex - Convert an array of little-endian words to a hex string. -*/ -exports.binl2hex = function (binarray, _alphabet16) { - if (util.no(_alphabet16)) - _alphabet16 = exports.alphabet16; - var str = ""; - for (var i = 0; i < binarray.length * 4; i++) { - str += _alphabet16.charAt((binarray[i>>2] >> ((i % 4) * 8 + 4)) & 0xF) + - _alphabet16.charAt((binarray[i>>2] >> ((i % 4) * 8)) & 0xF); - } - return str; -}; - -/* undocumented binb2hex - Convert an array of big-endian words to a hex string. -*/ -exports.binb2hex = function (binarray, _alphabet16) { - if (util.no(_alphabet16)) - _alphabet16 = exports.alphabet16; - var str = ""; - for (var i = 0; i < binarray.length * 4; i++) { - str += _alphabet16.charAt((binarray[i>>2] >> ((3 - i % 4)*8+4)) & 0xF) + - _alphabet16.charAt((binarray[i>>2] >> ((3 - i % 4) * 8)) & 0xF); - } - return str; -}; - -/* undocumented binl2base64 - Convert an array of little-endian words to a base-64 string -*/ -exports.binl2base64 = function (binarray) { - var str = ""; - for (var i = 0; i < binarray.length * 4; i += 3) { - var triplet = ( - (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16) | - (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8) | - ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF) - ); - for (var j = 0; j < 4; j++) { - if (i * 8 + j * 6 > binarray.length * 32) - str += exports.padBase64; - else str += exports.alphabet64.charAt((triplet >> 6*(3-j)) & 0x3F); - } - } - return str; -}; - -/* undocumented binb2base64 - Convert an array of big-endian words to a base-64 string -*/ -exports.binb2base64 = function (binarray) { - var str = ""; - for (var i = 0; i < binarray.length * 4; i += 3) { - var triplet = ( - (((binarray[i >> 2] >> 8 * (3 - i % 4)) & 0xFF) << 16) | - (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 ) | - ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF) - ); - for (var j = 0; j < 4; j++) { - if (i * 8 + j * 6 > binarray.length * 32) - str += exports.padBase64; - else str += exports.alphabet64.charAt((triplet >> 6*(3-j)) & 0x3F); - } - } - return str; -}; - -/* undocumented bin2hex - Convert a string to a hex string. - */ -exports.bin2hex = function (bin) { - - function convert(num) { - if (num > 65535) throw "error"; - var first = Math.round(num/4096 - .5), - temp1 = (num - first * 4096), - second = Math.round(temp1/256 -.5), - temp2 = (temp1 - second * 256), - third = Math.round(temp2/16 - .5), - fourth = (temp2 - third * 16); - return String(letter(third) + letter(fourth)); - } - - function letter(num) { - if (num < 10) return ""+num; - else { - if (num == 10) return "A"; - if (num == 11) return "B"; - if (num == 12) return "C"; - if (num == 13) return "D"; - if (num == 14) return "E"; - if (num == 15) return "F"; - } - } - - var str = ""; - for (var i = 0; i < bin.length; i++) { - str += convert(bin.charCodeAt(i)); - } - return str; -} - -},{"./binary":14,"./util":22}],21:[function(require,module,exports){ - -// -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License -// gmosx, George Moschovitis - -// Based on: http://data.iana.org/TLD/tlds-alpha-by-domain.txt -var TLDS = exports.TLDS = [ - "AC","AD","AE","AERO","AF","AG","AI","AL","AM","AN","AO","AQ","AR","ARPA","AS","ASIA","AT","AU","AW","AX","AZ", - "BA","BB","BD","BE","BF","BG","BH","BI","BIZ","BJ","BM","BN","BO","BR","BS","BT","BV","BW","BY","BZ", - "CA","CAT","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","COM","COOP","CR","CU","CV","CX","CY","CZ", - "DE","DJ","DK","DM","DO","DZ", - "EC","EDU","EE","EG","ER","ES","ET","EU", - "FI","FJ","FK","FM","FO","FR", - "GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GOV","GP","GQ","GR","GS","GT","GU","GW","GY", - "HK","HM","HN","HR","HT","HU", - "ID","IE","IL","IM","IN","INFO","INT","IO","IQ","IR","IS","IT", - "JE","JM","JO","JOBS","JP", - "KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ", - "LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY", - "MA","MC","MD","ME","MG","MH","MIL","MK","ML","MM","MN","MO","MOBI","MP","MQ","MR","MS","MT","MU","MUSEUM","MV","MW","MX","MY","MZ", - "NA","NAME","NC","NE","NET","NF","NG","NI","NL","NO","NP","NR","NU","NZ", - "OM","ORG", - "PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PRO","PS","PT","PW","PY", - "QA", - "RE","RO","RS","RU","RW", - "SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","ST","SU","SV","SY","SZ", - "TC","TD","TEL","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TP","TR","TRAVEL","TT","TV","TW","TZ", - "UA","UG","UK","US","UY","UZ", - "VA","VC","VE","VG","VI","VN","VU", - "WF","WS", - "XN", - "YE","YT","YU", - "ZA","ZM","ZW" -]; - - -/** - * Uniform Resource Identifier (URI) - RFC3986 - * http://www.ietf.org/rfc/rfc3986.txt - */ -var URI = exports.URI = function (uri) { - if (!(this instanceof URI)) - return new URI(uri); - if (typeof uri === "object") { - for (var name in uri) { - if (Object.prototype.hasOwnProperty.call(uri, name)) { - this[name] = uri[name]; - } - } - } else if (typeof uri === "string") { - exports.parse.call(this, uri); - } else { - throw new TypeError("Invalid argument for URI constructor."); - } - -}; - -URI.prototype.resolve = function (other) { - return exports.resolve(this, other); -}; - -URI.prototype.to = function (other) { - return exports.relative(this, other); -}; - -URI.prototype.from = function (other) { - return exports.relative(other, this); -}; - -/** - * Convert the URI to a String. - */ -URI.prototype.toString = function () { - return exports.format(this); -} - -exports.unescape = URI.unescape = function(uri, plus) { - return decodeURI(uri.replace(/\+/g, " ")); -} - -exports.unescapeComponent = URI.unescapeComponent = function(uri, plus) { - return decodeURIComponent(uri.replace(/\+/g, " ")); -} - -// from Chiron's HTTP module: - -/**** keys - members of a parsed URI object. -*/ -exports.keys = [ - "url", - "scheme", - "authorityRoot", - "authority", - "userInfo", - "user", - "password", - "domain", - "domains", - "port", - "path", - "root", - "directory", - "directories", - "file", - "query", - "anchor" -]; - -/**** expressionKeys - members of a parsed URI object that you get - from evaluting the strict regular expression. -*/ -exports.expressionKeys = [ - "url", - "scheme", - "authorityRoot", - "authority", - "userInfo", - "user", - "password", - "domain", - "port", - "path", - "root", - "directory", - "file", - "query", - "anchor" -]; - -/**** strictExpression -*/ -exports.strictExpression = new RegExp( /* url */ - "^" + - "(?:" + - "([^:/?#]+):" + /* scheme */ - ")?" + - "(?:" + - "(//)" + /* authorityRoot */ - "(" + /* authority */ - "(?:" + - "(" + /* userInfo */ - "([^:@/]*)" + /* user */ - ":?" + - "([^:@/]*)" + /* password */ - ")?" + - "@" + - ")?" + - "([^:/?#]*)" + /* domain */ - "(?::(\\d*))?" + /* port */ - ")" + - ")?" + - "(" + /* path */ - "(/?)" + /* root */ - "((?:[^?#/]*/)*)" + - "([^?#]*)" + /* file */ - ")" + - "(?:\\?([^#]*))?" + /* query */ - "(?:#(.*))?" /*anchor */ -); - -/**** Parser - returns a URI parser function given - a regular expression that renders - `expressionKeys` and returns an `Object` - mapping all `keys` to values. -*/ -exports.Parser = function (expression) { - return function (url) { - if (typeof url == "undefined") - throw new Error("HttpError: URL is undefined"); - if (typeof url != "string") - return new Object(url); - - var items = this instanceof URI ? this : Object.create(URI.prototype); - var parts = expression.exec(url); - - for (var i = 0; i < parts.length; i++) { - items[exports.expressionKeys[i]] = parts[i] ? parts[i] : ""; - } - - items.root = (items.root || items.authorityRoot) ? '/' : ''; - - items.directories = items.directory.split("/"); - if (items.directories[items.directories.length - 1] == "") { - items.directories.pop(); - } - - /* normalize */ - var directories = []; - for (var i = 0; i < items.directories.length; i++) { - var directory = items.directories[i]; - if (directory == '.') { - } else if (directory == '..') { - if (directories.length && directories[directories.length - 1] != '..') - directories.pop(); - else - directories.push('..'); - } else { - directories.push(directory); - } - } - items.directories = directories; - - items.domains = items.domain.split("."); - - return items; - }; -}; - -/**** parse - a strict URI parser. -*/ -exports.parse = exports.Parser(exports.strictExpression); - -/**** format - accepts a parsed URI object and returns - the corresponding string. -*/ -exports.format = function (object) { - if (typeof(object) == 'undefined') - throw new Error("UrlError: URL undefined for urls#format"); - if (object instanceof String || typeof(object) == 'string') - return object; - var domain = - object.domains ? - object.domains.join(".") : - object.domain; - var userInfo = ( - object.user || - object.password - ) ? - ( - (object.user || "") + - (object.password ? ":" + object.password : "") - ) : - object.userInfo; - var authority = ( - userInfo || - domain || - object.port - ) ? ( - (userInfo ? userInfo + "@" : "") + - (domain || "") + - (object.port ? ":" + object.port : "") - ) : - object.authority; - var directory = - object.directories ? - object.directories.join("/") : - object.directory; - var path = - directory || object.file ? - ( - (directory ? directory + "/" : "") + - (object.file || "") - ) : - object.path; - return ( - (object.scheme ? object.scheme + ":" : "") + - (authority ? "//" + authority : "") + - (object.root || (authority && path) ? "/" : "") + - (path ? path.replace(/^\//, "") : "") + - (object.query ? "?" + object.query : "") + - (object.anchor ? "#" + object.anchor : "") - ) || object.url || ""; -}; - -/**** resolveObject - returns an object representing a URL resolved from - a relative location and a source location. -*/ -exports.resolveObject = function (source, relative) { - if (!source) - return relative; - - source = exports.parse(source); - relative = exports.parse(relative); - - if (relative.url == "") - return source; - - delete source.url; - delete source.authority; - delete source.domain; - delete source.userInfo; - delete source.path; - delete source.directory; - - if ( - relative.scheme && relative.scheme != source.scheme || - relative.authority && relative.authority != source.authority - ) { - source = relative; - } else { - if (relative.root) { - source.directories = relative.directories; - } else { - - var directories = relative.directories; - for (var i = 0; i < directories.length; i++) { - var directory = directories[i]; - if (directory == ".") { - } else if (directory == "..") { - if (source.directories.length) { - source.directories.pop(); - } else { - source.directories.push('..'); - } - } else { - source.directories.push(directory); - } - } - - if (relative.file == ".") { - relative.file = ""; - } else if (relative.file == "..") { - source.directories.pop(); - relative.file = ""; - } - } - } - - if (relative.root) - source.root = relative.root; - if (relative.protcol) - source.scheme = relative.scheme; - if (!(!relative.path && relative.anchor)) - source.file = relative.file; - source.query = relative.query; - source.anchor = relative.anchor; - - return source; -}; - -/**** relativeObject - returns an object representing a relative URL to - a given target URL from a source URL. -*/ -exports.relativeObject = function (source, target) { - target = exports.parse(target); - source = exports.parse(source); - - delete target.url; - - if ( - target.scheme == source.scheme && - target.authority == source.authority - ) { - delete target.scheme; - delete target.authority; - delete target.userInfo; - delete target.user; - delete target.password; - delete target.domain; - delete target.domains; - delete target.port; - if ( - !!target.root == !!source.root && !( - target.root && - target.directories[0] != source.directories[0] - ) - ) { - delete target.path; - delete target.root; - delete target.directory; - while ( - source.directories.length && - target.directories.length && - target.directories[0] == source.directories[0] - ) { - target.directories.shift(); - source.directories.shift(); - } - while (source.directories.length) { - source.directories.shift(); - target.directories.unshift('..'); - } - - if (!target.root && !target.directories.length && !target.file && source.file) - target.directories.push('.'); - - if (source.file == target.file) - delete target.file; - if (source.query == target.query) - delete target.query; - if (source.anchor == target.anchor) - delete target.anchor; - } - } - - return target; -}; - -/** - * @returns a URL resovled to a relative URL from a source URL. - */ -exports.resolve = function (source, relative) { - return exports.format(exports.resolveObject(source, relative)); -}; - -/** - * @returns a relative URL to a target from a source. - */ -exports.relative = function (source, target) { - return exports.format(exports.relativeObject(source, target)); -}; - -/** - * converts a file-system path to a URI. - * @param path a String or String-like object, possibly a Path object, - * representing a file system Path - * @returns a URI as a String - */ -/* -TODO: Refactor -exports.pathToUri = function (path) { - var FS = require("file"); - return "file:" + FS.split(path).map(encodeURIComponent).join('/'); -}; -*/ - -},{}],22:[function(require,module,exports){ - -// -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License -// -- isaacs Isaac Schlueter -// -- nrstott Nathan Stott -// -- fitzgen Nick Fitzgerald -// -- nevilleburnell Neville Burnell -// -- cadorn Christoph Dorn - -// a decorator for functions that curry "polymorphically", -// that is, that return a function that can be tested -// against various objects if they're only "partially -// completed", or fewer arguments than needed are used. -// -// this enables the idioms: -// [1, 2, 3].every(lt(4)) eq true -// [1, 2, 3].map(add(1)) eq [2, 3, 4] -// [{}, {}, {}].forEach(set('a', 10)) -// -exports.operator = function (name, length, block) { - var operator = function () { - var args = exports.array(arguments); - var completion = function (object) { - if ( - typeof object == "object" && - object !== null && // seriously? typeof null == "object" - name in object && // would throw if object === null - // not interested in literal objects: - !Object.prototype.hasOwnProperty.call(object, name) - ) - return object[name].apply(object, args); - return block.apply( - this, - [object].concat(args) - ); - }; - if (arguments.length < length) { - // polymoprhic curry, delayed completion - return completion; - } else { - // immediate completion - return completion.call(this, args.shift()); - } - }; - operator.name = name; - operator.displayName = name; - operator.length = length; - operator.operator = block; - return operator; -}; - -exports.no = function (value) { - return value === null || value === undefined; -}; - -// object - -exports.object = exports.operator('toObject', 1, function (object) { - var items = object; - if (!items.length) - items = exports.items(object); - var copy = {}; - for (var i = 0; i < items.length; i++) { - var item = items[i]; - var key = item[0]; - var value = item[1]; - copy[key] = value; - } - return copy; -}); - -exports.object.copy = function (object) { - var copy = {}; - exports.object.keys(object).forEach(function (key) { - copy[key] = object[key]; - }); - return copy; -}; - -exports.object.deepCopy = function (object) { - var copy = {}; - exports.object.keys(object).forEach(function (key) { - copy[key] = exports.deepCopy(object[key]); - }); - return copy; -}; - -exports.object.eq = function (a, b, stack) { - return ( - !exports.no(a) && !exports.no(b) && - exports.array.eq( - exports.sort(exports.object.keys(a)), - exports.sort(exports.object.keys(b)) - ) && - exports.object.keys(a).every(function (key) { - return exports.eq(a[key], b[key], stack); - }) - ); -}; - -exports.object.len = function (object) { - return exports.object.keys(object).length; -}; - -exports.object.has = function (object, key) { - return Object.prototype.hasOwnProperty.call(object, key); -}; - -exports.object.keys = function (object) { - var keys = []; - for (var key in object) { - if (exports.object.has(object, key)) - keys.push(key); - } - return keys; -}; - -exports.object.values = function (object) { - var values = []; - exports.object.keys(object).forEach(function (key) { - values.push(object[key]); - }); - return values; -}; - -exports.object.items = function (object) { - var items = []; - exports.object.keys(object).forEach(function (key) { - items.push([key, object[key]]); - }); - return items; -}; - -/** - * Updates an object with the properties from another object. - * This function is variadic requiring a minimum of two arguments. - * The first argument is the object to update. Remaining arguments - * are considered the sources for the update. If multiple sources - * contain values for the same property, the last one with that - * property in the arguments list wins. - * - * example usage: - * util.update({}, { hello: "world" }); // -> { hello: "world" } - * util.update({}, { hello: "world" }, { hello: "le monde" }); // -> { hello: "le monde" } - * - * @returns Updated object - * @type Object - * - */ -exports.object.update = function () { - return variadicHelper(arguments, function(target, source) { - var key; - for (key in source) { - if (exports.object.has(source, key)) { - target[key] = source[key]; - } - } - }); -}; - -exports.object.deepUpdate = function (target, source) { - var key; - for (key in source) { - if(exports.object.has(source, key)) { - if(typeof source[key] == "object" && exports.object.has(target, key)) { - exports.object.deepUpdate(target[key], source[key]); - } else { - target[key] = source[key]; - } - } - } -}; - -/** - * Updates an object with the properties of another object(s) if those - * properties are not already defined for the target object. First argument is - * the object to complete, the remaining arguments are considered sources to - * complete from. If multiple sources contain the same property, the value of - * the first source with that property will be the one inserted in to the - * target. - * - * example usage: - * util.complete({}, { hello: "world" }); // -> { hello: "world" } - * util.complete({ hello: "narwhal" }, { hello: "world" }); // -> { hello: "narwhal" } - * util.complete({}, { hello: "world" }, { hello: "le monde" }); // -> { hello: "world" } - * - * @returns Completed object - * @type Object - * - */ -exports.object.complete = function () { - return variadicHelper(arguments, function(target, source) { - var key; - for (key in source) { - if ( - exports.object.has(source, key) && - !exports.object.has(target, key) - ) { - target[key] = source[key]; - } - } - }); -}; - -exports.object.deepComplete = function () { - return variadicHelper(arguments, function (target, source) { - var key; - for (key in source) { - if ( - exports.object.has(source, key) && - !exports.object.has(target, key) - ) { - target[key] = exports.deepCopy(source[key]); - } - } - }); -}; - -exports.object.deepDiff = function () { - var sources = Array.prototype.slice.call(arguments); - var diff = exports.deepCopy(sources.shift()); - return variadicHelper([diff].concat(sources), function (diff, source) { - var key; - for (key in source) { - if(exports.object.has(source, key)) { - if(exports.object.has(diff, key)) { - if(exports.deepEqual(diff[key], source[key])) { - delete diff[key]; - } else { - if(!exports.isArrayLike(diff[key])) { - diff[key] = exports.deepDiff(diff[key], source[key]); - } - } - } - } - } - }); -}; - -exports.object.repr = function (object) { - return "{" + - exports.object.keys(object) - .map(function (key) { - return exports.enquote(key) + ": " + - exports.repr(object[key]); - }).join(", ") + - "}"; -}; - -/** - * @param args Arguments list of the calling function - * First argument should be a callback that takes target and source parameters. - * Second argument should be target. - * Remaining arguments are treated a sources. - * - * @returns Target - * @type Object - */ -var variadicHelper = function (args, callback) { - var sources = Array.prototype.slice.call(args); - var target = sources.shift(); - - sources.forEach(function(source) { - callback(target, source); - }); - - return target; -}; - -// array - -exports.array = function (array) { - if (exports.no(array)) - return []; - if (!exports.isArrayLike(array)) { - if ( - array.toArray && - !Object.prototype.hasOwnProperty.call(array, 'toArray') - ) { - return array.toArray(); - } else if ( - array.forEach && - !Object.prototype.hasOwnProperty.call(array, 'forEach') - ) { - var results = []; - array.forEach(function (value) { - results.push(value); - }); - return results; - } else if (typeof array === "string") { - return Array.prototype.slice.call(array); - } else { - return exports.items(array); - } - } - return Array.prototype.slice.call(array); -}; - -exports.array.coerce = function (array) { - if (!Array.isArray(array)) - return exports.array(array); - return array; -}; - -exports.isArrayLike = function(object) { - return Array.isArray(object) || exports.isArguments(object); -}; - -// from http://code.google.com/p/google-caja/wiki/NiceNeighbor -// by "kangax" -// -// Mark Miller posted a solution that will work in ES5 compliant -// implementations, that may provide future insight: -// (http://groups.google.com/group/narwhaljs/msg/116097568bae41c6) -exports.isArguments = function (object) { - // ES5 reliable positive - if (Object.prototype.toString.call(object) == "[object Arguments]") - return true; - // for ES5, we will still need a way to distinguish false negatives - // from the following code (in ES5, it is possible to create - // an object that satisfies all of these constraints but is - // not an Arguments object). - // callee should exist - if ( - !typeof object == "object" || - !Object.prototype.hasOwnProperty.call(object, 'callee') || - !object.callee || - // It should be a Function object ([[Class]] === 'Function') - Object.prototype.toString.call(object.callee) !== '[object Function]' || - typeof object.length != 'number' - ) - return false; - for (var name in object) { - // both "callee" and "length" should be { DontEnum } - if (name === 'callee' || name === 'length') return false; - } - return true; -}; - -exports.array.copy = exports.array; - -exports.array.deepCopy = function (array) { - return array.map(exports.deepCopy); -}; - -exports.array.len = function (array) { - return array.length; -}; - -exports.array.has = function (array, value) { - return Array.prototype.indexOf.call(array, value) >= 0; -}; - -exports.array.put = function (array, key, value) { - array.splice(key, 0, value); - return array; -}; - -exports.array.del = function (array, begin, end) { - array.splice(begin, end === undefined ? 1 : (end - begin)); - return array; -}; - -exports.array.eq = function (a, b, stack) { - return exports.isArrayLike(b) && - a.length == b.length && - exports.zip(a, b).every(exports.apply(function (a, b) { - return exports.eq(a, b, stack); - })); -}; - -exports.array.lt = function (a, b) { - var length = Math.max(a.length, b.length); - for (var i = 0; i < length; i++) - if (!exports.eq(a[i], b[i])) - return exports.lt(a[i], b[i]); - return false; -}; - -exports.array.repr = function (array) { - return "[" + exports.map(array, exports.repr).join(', ') + "]"; -}; - -exports.array.first = function (array) { - return array[0]; -}; - -exports.array.last = function (array) { - return array[array.length - 1]; -}; - -exports.apply = exports.operator('apply', 2, function (args, block) { - return block.apply(this, args); -}); - -exports.copy = exports.operator('copy', 1, function (object) { - if (exports.no(object)) - return object; - if (exports.isArrayLike(object)) - return exports.array.copy(object); - if (object instanceof Date) - return object; - if (typeof object == 'object') - return exports.object.copy(object); - return object; -}); - -exports.deepCopy = exports.operator('deepCopy', 1, function (object) { - if (exports.no(object)) - return object; - if (exports.isArrayLike(object)) - return exports.array.deepCopy(object); - if (typeof object == 'object') - return exports.object.deepCopy(object); - return object; -}); - -exports.repr = exports.operator('repr', 1, function (object) { - if (exports.no(object)) - return String(object); - if (exports.isArrayLike(object)) - return exports.array.repr(object); - if (typeof object == 'object' && !(object instanceof Date)) - return exports.object.repr(object); - if (typeof object == 'string') - return exports.enquote(object); - return object.toString(); -}); - -exports.keys = exports.operator('keys', 1, function (object) { - if (exports.isArrayLike(object)) - return exports.range(object.length); - else if (typeof object == 'object') - return exports.object.keys(object); - return []; -}); - -exports.values = exports.operator('values', 1, function (object) { - if (exports.isArrayLike(object)) - return exports.array(object); - else if (typeof object == 'object') - return exports.object.values(object); - return []; -}); - -exports.items = exports.operator('items', 1, function (object) { - if (exports.isArrayLike(object) || typeof object == "string") - return exports.enumerate(object); - else if (typeof object == 'object') - return exports.object.items(object); - return []; -}); - -exports.len = exports.operator('len', 1, function (object) { - if (exports.isArrayLike(object)) - return exports.array.len(object); - else if (typeof object == 'object') - return exports.object.len(object); -}); - -exports.has = exports.operator('has', 2, function (object, value) { - if (exports.isArrayLike(object)) - return exports.array.has(object, value); - else if (typeof object == 'object') - return exports.object.has(object, value); - return false; -}); - -exports.get = exports.operator('get', 2, function (object, key, value) { - if (typeof object == "string") { - if (!typeof key == "number") - throw new Error("TypeError: String keys must be numbers"); - if (!exports.has(exports.range(object.length), key)) { - if (arguments.length == 3) - return value; - throw new Error("KeyError: " + exports.repr(key)); - } - return object.charAt(key); - } - if (typeof object == "object") { - if (!exports.object.has(object, key)) { - if (arguments.length == 3) - return value; - throw new Error("KeyError: " + exports.repr(key)); - } - return object[key]; - } - throw new Error("Object does not have keys: " + exports.repr(object)); -}); - -exports.set = exports.operator('set', 3, function (object, key, value) { - object[key] = value; - return object; -}); - -exports.getset = exports.operator('getset', 3, function (object, key, value) { - if (!exports.has(object, key)) - exports.set(object, key, value); - return exports.get(object, key); -}); - -exports.del = exports.operator('del', 2, function (object, begin, end) { - if (exports.isArrayLike(object)) - return exports.array.del(object, begin, end); - delete object[begin]; - return object; -}); - -exports.cut = exports.operator('cut', 2, function (object, key) { - var result = exports.get(object, key); - exports.del(object, key); - return result; -}); - -exports.put = exports.operator('put', 2, function (object, key, value) { - if (exports.isArrayLike(object)) - return exports.array.put(object, key, value); - return exports.set(object, key, value); -}); - -exports.first = exports.operator('first', 1, function (object) { - return object[0]; -}); - -exports.last = exports.operator('last', 1, function (object) { - return object[object.length - 1]; -}); - -exports.update = exports.operator('update', 2, function () { - var args = Array.prototype.slice.call(arguments); - return exports.object.update.apply(this, args); -}); - -exports.deepUpdate = exports.operator('deepUpdate', 2, function (target, source) { - exports.object.deepUpdate(target, source); -}); - -exports.complete = exports.operator('complete', 2, function (target, source) { - var args = Array.prototype.slice.call(arguments); - return exports.object.complete.apply(this, args); -}); - -exports.deepComplete = exports.operator('deepComplete', 2, function (target, source) { - var args = Array.prototype.slice.call(arguments); - return exports.object.deepComplete.apply(this, args); -}); - -exports.deepDiff = exports.operator('deepDiff', 2, function (target, source) { - var args = Array.prototype.slice.call(arguments); - return exports.object.deepDiff.apply(this, args); -}); - -exports.deepEqual = function(actual, expected) { - - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (actual instanceof Date && expected instanceof Date) { - return actual.getTime() === expected.getTime(); - - // 7.3. Other pairs that do not both pass typeof value == "object", - // equivalence is determined by ==. - } else if (typeof actual != 'object' && typeof expected != 'object') { - return actual == expected; - - // XXX specification bug: this should be specified - } else if (typeof expected == "string" || typeof actual == "string") { - return expected == actual; - - // 7.4. For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical "prototype" property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return actual.prototype === expected.prototype && exports.object.eq(actual, expected); - } -} - -exports.remove = exports.operator('remove', 2, function (list, value) { - var index; - if ((index = list.indexOf(value))>-1) - list.splice(index,1); - return list; -}); - -// TODO insert -// TODO discard - -exports.range = function () { - var start = 0, stop = 0, step = 1; - if (arguments.length == 1) { - stop = arguments[0]; - } else { - start = arguments[0]; - stop = arguments[1]; - step = arguments[2] || 1; - } - var range = []; - for (var i = start; i < stop; i += step) - range.push(i); - return range; -}; - -exports.forEach = function (array, block) { - Array.prototype.forEach.call( - exports.array.coerce(array), - block - ); -}; - -exports.forEachApply = function (array, block) { - Array.prototype.forEach.call( - exports.array.coerce(array), - exports.apply(block) - ); -}; - -exports.map = function (array, block, context) { - return Array.prototype.map.call( - exports.array.coerce(array), - block, - context - ); -}; - -exports.mapApply = function (array, block) { - return Array.prototype.map.call( - exports.array.coerce(array), - exports.apply(block) - ); -}; - -exports.every = exports.operator('every', 2, function (array, block, context) { - return exports.all(exports.map(array, block, context)); -}); - -exports.some = exports.operator('some', 2, function (array, block, context) { - return exports.any(exports.map(array, block, context)); -}); - -exports.all = exports.operator('all', 1, function (array) { - array = exports.array.coerce(array); - for (var i = 0; i < array.length; i++) - if (!array[i]) - return false; - return true; -}); - -exports.any = exports.operator('all', 1, function (array) { - array = exports.array.coerce(array); - for (var i = 0; i < array.length; i++) - if (array[i]) - return true; - return false; -}); - -exports.reduce = exports.operator('reduce', 2, function (array, block, basis) { - array = exports.array.coerce(array); - return array.reduce.apply(array, arguments); -}); - -exports.reduceRight = exports.operator('reduceRight', 2, function (array, block, basis) { - array = exports.array.coerce(array); - return array.reduceRight.apply(array, arguments); -}); - -exports.zip = function () { - return exports.transpose(arguments); -}; - -exports.transpose = function (array) { - array = exports.array.coerce(array); - var transpose = []; - var length = Math.min.apply(this, exports.map(array, function (row) { - return row.length; - })); - for (var i = 0; i < array.length; i++) { - var row = array[i]; - for (var j = 0; j < length; j++) { - var cell = row[j]; - if (!transpose[j]) - transpose[j] = []; - transpose[j][i] = cell; - } - } - return transpose; -}; - -exports.enumerate = function (array, start) { - array = exports.array.coerce(array); - if (exports.no(start)) - start = 0; - return exports.zip( - exports.range(start, start + array.length), - array - ); -}; - -// arithmetic, transitive, and logical operators - -exports.is = function (a, b) { - // - if (a === b) - // 0 === -0, but they are not identical - return a !== 0 || 1/a === 1/b; - // NaN !== NaN, but they are identical. - // NaNs are the only non-reflexive value, i.e., if a !== a, - // then a is a NaN. - return a !== a && b !== b; - // -}; - -exports.eq = exports.operator('eq', 2, function (a, b, stack) { - if (!stack) - stack = []; - if (a === b) - return true; - if (typeof a !== typeof b) - return false; - if (exports.no(a)) - return exports.no(b); - if (a instanceof Date) - return a.valueOf() === b.valueOf(); - if (a instanceof RegExp) - return a.source === b.source && - a.global === b.global && - a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline; - if (typeof a === "function") { - var caller = stack[stack.length - 1]; - // XXX what is this for? can it be axed? - // it comes from the "equiv" project code - return caller !== Object && - typeof caller !== "undefined"; - } - if (exports.isArrayLike(a)) - return exports.array.eq( - a, b, - stack.concat([a.constructor]) - ); - if (typeof a === 'object') - return exports.object.eq( - a, b, - stack.concat([a.constructor]) - ); - return false; -}); - -exports.ne = exports.operator('ne', 2, function (a, b) { - return !exports.eq(a, b); -}); - -exports.lt = exports.operator('lt', 2, function (a, b) { - if (exports.no(a) != exports.no(b)) - return exports.no(a) > exports.no(b); - if (exports.isArrayLike(a) && exports.isArrayLike(b)) - return exports.array.lt(a, b); - return a < b; -}); - -exports.gt = exports.operator('gt', 2, function (a, b) { - return !(exports.lt(a, b) || exports.eq(a, b)); -}); - -exports.le = exports.operator(2, 'le', function (a, b) { - return exports.lt(a, b) || exports.eq(a, b); -}); - -exports.ge = exports.operator(2, 'ge', function (a, b) { - return !exports.lt(a, b); -}); - -exports.mul = exports.operator(2, 'mul', function (a, b) { - if (typeof a == "string") - return exports.string.mul(a, b); - return a * b; -}); - -/*** by - returns a `comparator` that compares - values based on the values resultant from - a given `relation`. - accepts a `relation` and an optional comparator. - - To sort a list of objects based on their - "a" key:: - - objects.sort(by(get("a"))) - - To get those in descending order:: - - objects.sort(by(get("a")), desc) - - `by` returns a comparison function that also tracks - the arguments you used to construct it. This permits - `sort` and `sorted` to perform a Schwartzian transform - which can increase the performance of the sort - by a factor of 2. -*/ -exports.by = function (relation) { - var compare = arguments[1]; - if (exports.no(compare)) - compare = exports.compare; - var comparator = function (a, b) { - a = relation(a); - b = relation(b); - return compare(a, b); - }; - comparator.by = relation; - comparator.compare = compare; - return comparator; -}; - -exports.compare = exports.operator(2, 'compare', function (a, b) { - if (exports.no(a) !== exports.no(b)) - return exports.no(b) - exports.no(a); - if (typeof a === "number" && typeof b === "number") - return a - b; - return exports.eq(a, b) ? 0 : exports.lt(a, b) ? -1 : 1; -}); - -/*** sort - an in-place array sorter that uses a deep comparison - function by default (compare), and improves performance if - you provide a comparator returned by "by", using a - Schwartzian transform. -*/ -exports.sort = function (array, compare) { - if (exports.no(compare)) - compare = exports.compare; - if (compare.by) { - /* schwartzian transform */ - array.splice.apply( - array, - [0, array.length].concat( - array.map(function (value) { - return [compare.by(value), value]; - }).sort(function (a, b) { - return compare.compare(a[0], b[0]); - }).map(function (pair) { - return pair[1]; - }) - ) - ); - } else { - array.sort(compare); - } - return array; -}; - -/*** sorted - returns a sorted copy of an array using a deep - comparison function by default (compare), and - improves performance if you provide a comparator - returned by "by", using a Schwartzian transform. -*/ -exports.sorted = function (array, compare) { - return exports.sort(exports.array.copy(array), compare); -}; - -exports.reverse = function (array) { - return Array.prototype.reverse.call(array); -}; - -exports.reversed = function (array) { - return exports.reverse(exports.array.copy(array)); -}; - -exports.hash = exports.operator(1, 'hash', function (object) { - return '' + object; -}); - -exports.unique = exports.operator(1, 'unique', function (array, eq, hash) { - var visited = {}; - if (!eq) eq = exports.eq; - if (!hash) hash = exports.hash; - return array.filter(function (value) { - var bucket = exports.getset(visited, hash(value), []); - var finds = bucket.filter(function (other) { - return eq(value, other); - }); - if (!finds.length) - bucket.push(value); - return !finds.length; - }); -}); - -// string - -exports.string = exports.operator(1, 'toString', function (object) { - return '' + object; -}); - -exports.string.mul = function (string, n) { - return exports.range(n).map(function () { - return string; - }).join(''); -}; - -/*** escape - escapes all characters of a string that are - special to JavaScript and many other languages. - Recognizes all of the relevant - control characters and formats all other - non-printable characters as Hex byte escape - sequences or Unicode escape sequences depending - on their size. - - Pass ``true`` as an optional second argument and - ``escape`` produces valid contents for escaped - JSON strings, wherein non-printable-characters are - all escaped with the Unicode ``\u`` notation. -*/ -/* more Steve Levithan flagrence */ -var escapeExpression = /[^ !#-[\]-~]/g; -/* from Doug Crockford's JSON library */ -var escapePatterns = { - '\b': '\\b', '\t': '\\t', - '\n': '\\n', '\f': '\\f', '\r': '\\r', - '"' : '\\"', '\\': '\\\\' -}; -exports.escape = function (value, strictJson) { - if (typeof value != "string") - throw new Error( - module.path + - "#escape: requires a string. got " + - exports.repr(value) - ); - return value.replace( - escapeExpression, - function (match) { - if (escapePatterns[match]) - return escapePatterns[match]; - match = match.charCodeAt(); - if (!strictJson && match < 256) - return "\\x" + exports.padBegin(match.toString(16), 2); - return '\\u' + exports.padBegin(match.toString(16), 4); - } - ); -}; - -/*** enquote - transforms a string into a string literal, escaping - all characters of a string that are special to - JavaScript and and some other languages. - - ``enquote`` uses double quotes to be JSON compatible. - - Pass ``true`` as an optional second argument to - be strictly JSON compliant, wherein all - non-printable-characters are represented with - Unicode escape sequences. -*/ -exports.enquote = function (value, strictJson) { - return '"' + exports.escape(value, strictJson) + '"'; -}; - -/*** expand - transforms tabs to an equivalent number of spaces. -*/ -// TODO special case for \r if it ever matters -exports.expand = function (str, tabLength) { - str = String(str); - tabLength = tabLength || 4; - var output = [], - tabLf = /[\t\n]/g, - lastLastIndex = 0, - lastLfIndex = 0, - charsAddedThisLine = 0, - tabOffset, match; - while (match = tabLf.exec(str)) { - if (match[0] == "\t") { - tabOffset = ( - tabLength - 1 - - ( - (match.index - lastLfIndex) + - charsAddedThisLine - ) % tabLength - ); - charsAddedThisLine += tabOffset; - output.push( - str.slice(lastLastIndex, match.index) + - exports.mul(" ", tabOffset + 1) - ); - } else if (match[0] === "\n") { - output.push(str.slice(lastLastIndex, tabLf.lastIndex)); - lastLfIndex = tabLf.lastIndex; - charsAddedThisLine = 0; - } - lastLastIndex = tabLf.lastIndex; - } - return output.join("") + str.slice(lastLastIndex); -}; - -var trimBeginExpression = /^\s\s*/g; -exports.trimBegin = function (value) { - return String(value).replace(trimBeginExpression, ""); -}; - -var trimEndExpression = /\s\s*$/g; -exports.trimEnd = function (value) { - return String(value).replace(trimEndExpression, ""); -}; - -exports.trim = function (value) { - return String(value).replace(trimBeginExpression, "").replace(trimEndExpression, ""); -}; - -/* generates padBegin and padEnd */ -var augmentor = function (augment) { - return function (value, length, pad) { - if (exports.no(pad)) pad = '0'; - if (exports.no(length)) length = 2; - value = String(value); - while (value.length < length) { - value = augment(value, pad); - } - return value; - }; -}; - -/*** padBegin - - accepts: - - a `String` or `Number` value - - a minimum length of the resultant `String`: - by default, 2 - - a pad string: by default, ``'0'``. - - returns a `String` of the value padded up to at least - the minimum length. adds the padding to the begining - side of the `String`. - -*/ -exports.padBegin = augmentor(function (value, pad) { - return pad + value; -}); - -/*** padEnd - - accepts: - - a `String` or `Number` value - - a minimum length of the resultant `String`: - by default, 2 - - a pad string: by default, ``'0'``. - - returns a `String` of the value padded up to at least - the minimum length. adds the padding to the end - side of the `String`. - -*/ -exports.padEnd = augmentor(function (value, pad) { - return value + pad; -}); - -/*** splitName - splits a string into an array of words from an original - string. -*/ -// thanks go to Steve Levithan for this regular expression -// that, in addition to splitting any normal-form identifier -// in any case convention, splits XMLHttpRequest into -// "XML", "Http", and "Request" -var splitNameExpression = /[a-z]+|[A-Z](?:[a-z]+|[A-Z]*(?![a-z]))|[.\d]+/g; -exports.splitName = function (value) { - var result = String(value).match(splitNameExpression); - if (result) - return result; - return [value]; -}; - -/*** joinName - joins a list of words with a given delimiter - between alphanumeric words. -*/ -exports.joinName = function (delimiter, parts) { - if (exports.no(delimiter)) delimiter = '_'; - parts.unshift([]); - return parts.reduce(function (parts, part) { - if ( - part.match(/\d/) && - exports.len(parts) && parts[parts.length-1].match(/\d/) - ) { - return parts.concat([delimiter + part]); - } else { - return parts.concat([part]); - } - }).join(''); -}; - -/*** upper - converts a name to ``UPPER CASE`` using - a given delimiter between numeric words. - - see: - - `lower` - - `camel` - - `title` - -*/ -exports.upper = function (value, delimiter) { - if (exports.no(delimiter)) - return value.toUpperCase(); - return exports.splitName(value).map(function (part) { - return part.toUpperCase(); - }).join(delimiter); -}; - -/*** lower - converts a name to a ``lower case`` using - a given delimiter between numeric words. - - see: - - `upper` - - `camel` - - `title` - -*/ -exports.lower = function (value, delimiter) { - if (exports.no(delimiter)) - return String(value).toLowerCase(); - return exports.splitName(value).map(function (part) { - return part.toLowerCase(); - }).join(delimiter); -}; - -/*** camel - converts a name to ``camel Case`` using - a given delimiter between numeric words. - - see: - - `lower` - - `upper` - - `title` - -*/ -exports.camel = function (value, delimiter) { - return exports.joinName( - delimiter, - exports.mapApply( - exports.enumerate(exports.splitName(value)), - function (n, part) { - if (n) { - return ( - part.substring(0, 1).toUpperCase() + - part.substring(1).toLowerCase() - ); - } else { - return part.toLowerCase(); - } - } - ) - ); -}; - -/*** title - converts a name to ``Title Case`` using - a given delimiter between numeric words. - - see: - - `lower` - - `upper` - - `camel` - -*/ -exports.title = function (value, delimiter) { - return exports.joinName( - delimiter, - exports.splitName(value).map(function (part) { - return ( - part.substring(0, 1).toUpperCase() + - part.substring(1).toLowerCase() - ); - }) - ); -}; - - -},{}],23:[function(require,module,exports){ -(function (setImmediate){ -"use strict"; - -var BROWSER = typeof browser != "undefined" ? browser : chrome; - -var WILDFIRE = exports.WILDFIRE = require("./wildfire"); - -var LIB = require("./lib"); - -WILDFIRE.VERBOSE = true; -WILDFIRE.once("error", function (err) { - console.error(err); -}); - -async function initCurrentContext() { - if (currentContext) { - return; - } - - try { - var searchResult = await LIB.browser.tabs.query({ - currentWindow: true, - active: true - }); - - if (searchResult.length === 1) { - var tabDetails = searchResult[0]; - - if (tabDetails.url) { - setCurrentContextFromDetails({ - tabId: tabDetails.id, - url: tabDetails.url - }, true); - } - } - } catch (err) { - console.error(err.stack || err.message || err); - } -} - -setImmediate(initCurrentContext); - -function broadcastForContext(context, message) { - message.context = context; - message.to = "message-listener"; - return LIB.browser.runtime.sendMessage(message).catch(function (err) { - if (WILDFIRE.VERBOSE) console.log("WARNING", err); - }); -} - -WILDFIRE.on("message.firephp", function (message) { - if (WILDFIRE.VERBOSE) console.log("[background] WILDFIRE.on -| message.firephp (message):", message); - broadcastForContext(message.context, { - message: { - sender: message.sender, - receiver: message.receiver, - meta: message.meta, - data: message.data - } - }); -}); -var currentContext = null; -var lastDetailsForTabId = {}; - -function setCurrentContextFromDetails(details, clearIfNew) { - if (!details) { - if (currentContext) { - currentContext = null; - broadcastForContext(currentContext, { - event: "currentContext" - }); - } - } else { - var newCtx = { - url: details.url, - tabId: details.tabId - }; - newCtx.pageUid = JSON.stringify(newCtx); - newCtx.hostname = details.url.replace(/^[^:]+:\/\/([^:\/]+)(:\d+)?\/.*?$/, "$1"); - - if (newCtx !== currentContext && (!newCtx || !currentContext || newCtx.pageUid !== currentContext.pageUid)) { - currentContext = newCtx; - lastDetailsForTabId[currentContext.tabId] = details; - broadcastForContext(currentContext, { - event: "currentContext" - }); - } else { - broadcastForContext(currentContext, { - event: "currentContext" - }); - } - - if (clearIfNew) { - broadcastForContext(currentContext, { - event: "prepare" - }); - } - } -} - -async function runtime_onMessage(message) { - if (WILDFIRE.VERBOSE) console.log("[background] BROWSER.runtime -| onMessage (message):", message); - - if (message.to === "broadcast") { - if (message.event === "currentContext") { - if (!currentContext) { - await initCurrentContext(); - } - - broadcastForContext(currentContext, message); - } else { - if (!message.context && !currentContext) { - await initCurrentContext(); - } - - broadcastForContext(message.context || currentContext || null, message); - } - } else if (message.to === "background") { - if (message.event === "reload") { - LIB.browser.tabs.reload(message.context.tabId, { - bypassCache: true - }); - } - } -} - -BROWSER.runtime.onMessage.addListener(runtime_onMessage); -WILDFIRE.on("destroy", function () { - BROWSER.runtime.onMessage.removeListener(runtime_onMessage); -}); - -function webNavigation_onBeforeNavigate(details) { - if (WILDFIRE.VERBOSE) console.log("[background] BROWSER.webNavigation -| onBeforeNavigate (details):", details); - - if (details.parentFrameId !== -1) { - return; - } - - setCurrentContextFromDetails(details); -} - -BROWSER.webNavigation.onBeforeNavigate.addListener(webNavigation_onBeforeNavigate, { - url: [{}] -}); -WILDFIRE.on("destroy", function () { - BROWSER.webNavigation.onBeforeNavigate.removeListener(webNavigation_onBeforeNavigate); -}); - -function webRequest_onBeforeRequest(details) { - if (WILDFIRE.VERBOSE) console.log("[background] BROWSER.webRequest -| onBeforeRequest (details):", details); - - if (typeof details.documentUrl !== "undefined" || typeof details.initiator !== "undefined" || details.parentFrameId !== -1) { - return; - } - - setCurrentContextFromDetails(details, true); -} - -BROWSER.webRequest.onBeforeRequest.addListener(webRequest_onBeforeRequest, { - urls: [""] -}); -WILDFIRE.on("destroy", function () { - BROWSER.webRequest.onBeforeRequest.removeListener(webRequest_onBeforeRequest); -}); - -function tabs_onRemoved(tabId) { - if (WILDFIRE.VERBOSE) console.log("[background] BROWSER.tabs -| onRemoved (tabId):", tabId); - - if (currentContext && currentContext.tabId == tabId) { - setCurrentContextFromDetails(null); - } - - return broadcastForContext({ - tabId: tabId - }, { - event: "destroyContext" - }); -} - -BROWSER.tabs.onRemoved.addListener(tabs_onRemoved); -WILDFIRE.on("destroy", function () { - BROWSER.tabs.onRemoved.removeListener(tabs_onRemoved); -}); -}).call(this,require("timers").setImmediate) -},{"./lib":26,"./wildfire":30,"timers":38}],24:[function(require,module,exports){ -"use strict"; - -exports.for = function (API) { - var processor = null; - var requestIndex = 0; - - function onRequest(request) { - var requestId = null; - var headers = {}; - request.requestHeaders.forEach(function (header) { - if (header.name.toLowerCase() === "x-request-id") { - requestId = header.value; - } - - headers[header.name] = header.value; - }); - var result = processor({ - "id": requestId || "id:" + request.url + ":" + requestIndex, - "url": request.url, - "hostname": request.url.replace(/^https?:\/\/([^:\/]+)(:\d+)?\/.*?$/, "$1"), - "port": request.url.replace(/^https?:\/\/[^:]+:?(\d+)?\/.*?$/, "$1") || 80, - "method": request.method, - "headers": headers - }); - - if (!result) { - return {}; - } - - var changes = result; - var ret = {}; - - if (changes.requestHeaders) { - var headers = []; - Object.keys(changes.requestHeaders).forEach(function (name) { - headers.push({ - name: name, - value: changes.requestHeaders[name] - }); - }); - ret.requestHeaders = headers; - } - - return ret; - } - - API.BROWSER.webRequest.onBeforeSendHeaders.addListener(onRequest, { - urls: [""] - }, ["blocking", "requestHeaders"]); - API.on("destroy", function () { - API.BROWSER.webRequest.onBeforeSendHeaders.removeListener(onRequest); - }); - return { - register: function (_processor) { - processor = _processor; - } - }; -}; -},{}],25:[function(require,module,exports){ -"use strict"; - -exports.for = function (API) { - var pageUrlByTabId = {}; - var pageTimestampByTabId = {}; - - function onHeadersReceived(response) { - var pageUrl = response.documentUrl || response.url; - var pageTimeStamp = response.timeStamp; - - if (response.parentFrameId !== -1) { - pageUrl = pageUrlByTabId[response.tabId] || null; - pageTimeStamp = pageTimestampByTabId[response.tabId] || null; - } else if (response.type === "main_frame") { - pageUrlByTabId[response.tabId] = pageUrl; - pageTimestampByTabId[response.tabId] = pageTimeStamp; - } - - API.emit("http.response", { - "request": { - "id": response.requestId, - "context": { - frameId: response.frameId, - tabId: response.tabId, - url: response.url, - hostname: response.url.replace(/^[^:]+:\/\/([^:\/]+)(:\d+)?\/.*?$/, "$1"), - requestId: response.requestId, - requestType: response.type, - documentUrl: response.documentUrl, - timeStamp: response.timeStamp, - pageUrl: pageUrl, - pageTimeStamp: pageTimeStamp, - pageUid: JSON.stringify({ - url: pageUrl, - tabId: response.tabId - }), - requestUid: JSON.stringify({ - url: response.url, - timeStamp: response.timeStamp, - frameId: response.frameId, - tabId: response.tabId - }) - } - }, - "status": response.statusCode, - "headers": response.responseHeaders - }); - } - - API.BROWSER.webRequest.onHeadersReceived.addListener(onHeadersReceived, { - urls: [""] - }, ["responseHeaders"]); - API.on("destroy", function () { - API.BROWSER.webRequest.onHeadersReceived.removeListener(onHeadersReceived); - }); - return {}; -}; -},{}],26:[function(require,module,exports){ -"use strict"; - -exports.browser = window.crossbrowser; -},{}],27:[function(require,module,exports){ -"use strict"; - -exports.for = function (API) { - var transportReceiver1 = API.WILDFIRE.Receiver(); - transportReceiver1.setId("http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1"); - transportReceiver1.addListener({ - onMessageReceived: function (request, message) { - message.context = request.context; - - if (API.on && API.on.firePHPMessage) { - API.on.firePHPMessage(message); - } - } - }); - API.httpHeaderChannel.addReceiver(transportReceiver1); - var transportReceiver2 = API.WILDFIRE.Receiver(); - transportReceiver2.setId("http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1"); - transportReceiver2.addListener({ - onMessageReceived: function (request, message) { - message.context = request.context; - - if (API.on && API.on.firePHPMessage) { - API.on.firePHPMessage(message); - } - } - }); - API.httpHeaderChannel.addReceiver(transportReceiver2); - return {}; -}; -},{}],28:[function(require,module,exports){ -"use strict"; - -exports.for = function (API) { - var receivers = { - "http://registry.pinf.org/cadorn.org/insight/@meta/receiver/insight/controller/0": {}, - "http://registry.pinf.org/cadorn.org/insight/@meta/receiver/insight/plugin/0": {}, - "http://registry.pinf.org/cadorn.org/insight/@meta/receiver/insight/package/0": {}, - "http://registry.pinf.org/cadorn.org/insight/@meta/receiver/insight/selective/0": {}, - "http://registry.pinf.org/cadorn.org/insight/@meta/receiver/console/request/0": {}, - "http://registry.pinf.org/cadorn.org/insight/@meta/receiver/console/page/0": { - messageHandler: "insightMessage" - }, - "http://registry.pinf.org/cadorn.org/insight/@meta/receiver/console/process/0": {} - }; - Object.keys(receivers).forEach(function (uri) { - var receiver = API.WILDFIRE.Receiver(); - receiver.setId(uri); - receiver.addListener({ - onMessageReceived: function (request, message) { - message.context = request.context; - - if (receivers[uri].messageHandler && API.on && API.on[receivers[uri].messageHandler]) { - API.on[receivers[uri].messageHandler](message); - } else { - console.log("IGNORING insight MESSAGE:", message); - } - } - }); - API.httpHeaderChannel.addReceiver(receiver); - }); - return {}; -}; -},{}],29:[function(require,module,exports){ -"use strict"; - -var LIB = require("./lib"); - -var domainSettingsCache = {}; -var settingsByHostnameCache = {}; - -if (LIB.browser) { - LIB.browser.storage.onChanged.addListener(function (changes, area) { - for (var item of Object.keys(changes)) { - if (!/^domain\[.+\]\..+$/.test(item)) continue; - domainSettingsCache[item] = changes[item].newValue; - var m = item.match(/^domain\[([^\]]+)\]\.(.+)$/); - - if (m) { - if (!settingsByHostnameCache[m[1]]) { - settingsByHostnameCache[m[1]] = { - "enabled": false, - "enableUserAgentHeader": false, - "enableFirePHPHeader": false, - "enableChromeLoggerData": false - }; - } - - settingsByHostnameCache[m[1]][m[2]] = changes[item].newValue; - } - } - }); -} - -exports.getSetting = function (name) { - function get() { - if (!LIB.browser) return Promise.resolve(null); - return LIB.browser.storage.local.get(name).then(function (value) { - var m = name.match(/^domain\[([^\]]+)\]\.(.+)$/); - - if (m) { - if (!settingsByHostnameCache[m[1]]) { - settingsByHostnameCache[m[1]] = { - "enabled": false, - "enableUserAgentHeader": false, - "enableFirePHPHeader": false, - "enableChromeLoggerData": false - }; - } - - settingsByHostnameCache[m[1]][m[2]] = value[name] || false; - } - - return domainSettingsCache[name] = value[name]; - }); - } - - if (typeof domainSettingsCache[name] === "undefined") { - get(); - return Promise.resolve(false); - } - - return get(); -}; - -exports.setSetting = function (name, value) { - if (!LIB.browser) return Promise.resolve(null); - return LIB.browser.storage.local.set(name, value); -}; - -exports.getDomainSettingsForDomain = function (domain) { - return exports.getSetting("domain[" + domain + "].enabled").then(function (enabled) { - return exports.getSetting("domain[" + domain + "].enableUserAgentHeader").then(function (enableUserAgentHeader) { - return exports.getSetting("domain[" + domain + "].enableFirePHPHeader").then(function (enableFirePHPHeader) { - return exports.getSetting("domain[" + domain + "].enableChromeLoggerData").then(function (enableChromeLoggerData) { - return Promise.resolve({ - "enabled": enabled, - "enableUserAgentHeader": enableUserAgentHeader, - "enableFirePHPHeader": enableFirePHPHeader, - "enableChromeLoggerData": enableChromeLoggerData - }); - }); - }); - }); - }); -}; - -exports.isEnabledForDomain = function (domain) { - return exports.getDomainSettingsForDomain(domain).then(function (settings) { - return settings.enabled && (settings.enableUserAgentHeader || settings.enableFirePHPHeader || settings.enableChromeLoggerData); - }); -}; - -exports.getDomainSettingsForRequest = function (request) { - return exports.getDomainSettingsForDomain(request.hostname).then(function (settings) { - return settings; - }); -}; - -exports.getDomainSettingsForRequestSync = function (request) { - if (!exports.getDomainSettingsForRequestSync._fetchedOnce) { - exports.getDomainSettingsForRequestSync._fetchedOnce = {}; - } - - if (!exports.getDomainSettingsForRequestSync._fetchedOnce[request.hostname]) { - exports.getDomainSettingsForRequestSync._fetchedOnce[request.hostname] = true; - exports.getDomainSettingsForRequest(request); - } - - if (!settingsByHostnameCache[request.hostname]) { - settingsByHostnameCache[request.hostname] = { - "enabled": false, - "enableUserAgentHeader": false, - "enableFirePHPHeader": false, - "enableChromeLoggerData": false - }; - } - - return settingsByHostnameCache[request.hostname]; -}; -},{"./lib":26}],30:[function(require,module,exports){ -"use strict"; - -var EVENTS = require("eventemitter2"); - -var API = module.exports = new EVENTS(); -var BROWSER = typeof browser != "undefined" ? browser : chrome; -API.console = console; -API.BROWSER = BROWSER; -API.WILDFIRE = require("wildfire-for-js"); - -var REQUEST_OBSERVER = require("./adapters/http-request-observer").for(API); - -var RESPONSE_OBSERVER = require("./adapters/http-response-observer").for(API); - -var ENCODER = require("insight-for-js/lib/encoder/default"); - -var encoder = ENCODER.Encoder(); -encoder.setOption("maxObjectDepth", 1000); -encoder.setOption("maxArrayDepth", 1000); -encoder.setOption("maxOverallDepth", 1000); - -var SETTINGS = require("./settings"); - -var forceEnabled = false; - -API.forcedEnable = function (oo) { - forceEnabled = oo; -}; - -API.on.chromeLoggerMessage = function (message, context) { - try { - var i, ic, j, jc; - - var _loop = function () { - var log = {}; - - for (j = 0, jc = message.columns.length; j < jc; j++) { - log[message.columns[j]] = message.rows[i][j]; - } - - var meta = { - "msg.preprocessor": "FirePHPCoreCompatibility", - "lang.id": "registry.pinf.org/cadorn.org/github/renderers/packages/php/master", - "priority": log.type - }; - - if (log.backtrace) { - var m = log.backtrace.match(/^([^:]+?)(\s*:\s*(\d+))?$/); - - if (m) { - meta.file = m[1]; - - if (m[3] !== '') { - meta.line = parseInt(m[3]); - } - } - } - - if (log.log.length === 1) { - log.log = log.log[0]; - } - - var dataNode = encoder.encode(log.log, { - "lang": "php" - }, { - "jsonEncode": false - }); - var node = dataNode.origin; - Object.keys(meta).forEach(function (name) { - node.meta[name] = meta[name]; - }); - var msg = { - "context": context, - "sender": "https://github.com/ccampbell/chromelogger", - "receiver": "https://gi0.FireConsole.org/rep.js/InsightTree/0.1", - "meta": "{}", - "data": node - }; - API.emit("message.firephp", msg); - }; - - for (i = 0, ic = message.rows.length; i < ic; i++) { - _loop(); - } - } catch (err) { - console.error("Error formatting chromelogger message:", err); - } -}; - -API.on.insightMessage = function (message) { - API.emit("message.insight", message); -}; - -API.on.firePHPMessage = function (message) { - API.emit("message.firephp", message); -}; - -API.on.transport = function (info) { - API.emit("message.transport", info); -}; - -function isEnabled() { - return true; -} - -var httpHeaderChannel = API.httpHeaderChannel = API.WILDFIRE.HttpHeaderChannel({ - "enableTransport": false, - onError: function (err) { - console.error("HttpHeaderChannel error:", err); - API.emit("error", err); - } -}); -httpHeaderChannel.setNoReceiverCallback(function (id) { - API.console.error("trying to log to unknown receiver (extension): " + id); -}); -httpHeaderChannel.addListener({ - afterChannelOpen: function (context) { - if (API.VERBOSE) console.log("[wildfire] httpHeaderChannel -| afterChannelOpen (context):", context); - API.emit("response", { - context: context.context - }); - } -}); - -require("./receivers/firephp").for(API); - -require("./receivers/insight").for(API); - -var announceDispatcher = API.WILDFIRE.Dispatcher(); -announceDispatcher.setProtocol('http://registry.pinf.org/cadorn.org/wildfire/@meta/protocol/announce/0.1.0'); -announceDispatcher.setChannel(httpHeaderChannel); - -function getAnnounceMessageForRequest(request) { - if (!getAnnounceMessageForRequest._forHostnames) { - getAnnounceMessageForRequest._forHostnames = {}; - } - - var cache = getAnnounceMessageForRequest._forHostnames; - - if (cache[request.hostname]) { - return cache[request.hostname]; - } - - cache[request.hostname] = new API.WILDFIRE.Message(); - cache[request.hostname].setData(JSON.stringify({ - "authkey": "mykey", - "receivers": httpHeaderChannel.receivers.map(function (receiver) { - return receiver.getId(); - }) - })); - return cache[request.hostname]; -} - -var hostnameSettings = {}; -API.hostnameSettings = hostnameSettings; -REQUEST_OBSERVER.register(function (request) { - if (!isEnabled()) { - if (API.VERBOSE) console.log("[wildfire] REQUEST_OBSERVER handler: not enabled"); - return null; - } - - var settings = SETTINGS.getDomainSettingsForRequestSync(request); - if (API.VERBOSE) console.log("[wildfire] forceEnabled:", forceEnabled); - if (API.VERBOSE) console.log("[wildfire] request domain settings for '" + request.hostname + "':", settings); - hostnameSettings[request.hostname] = settings; - - if (!forceEnabled && !settings.enabled) { - return {}; - } - - if (forceEnabled || settings.enableUserAgentHeader) { - if (!request.headers["User-Agent"].match(/\sFirePHP\/([\.|\d]*)\s?/)) { - request.headers["User-Agent"] = request.headers["User-Agent"] + " FirePHP/0.5"; - } - } - - if (forceEnabled || settings.enableFirePHPHeader) { - request.headers["X-FirePHP-Version"] = "0.4"; - } - - if (API.VERBOSE) console.log("[wildfire] updated request headers:", request.headers); - return { - requestHeaders: request.headers - }; -}); -API.on("http.response", function (response) { - if (!isEnabled()) { - return; - } - - var settings = hostnameSettings[response.request.context.hostname]; - - if (!settings || !forceEnabled && !settings.enabled) { - return; - } - - if (API.VERBOSE) console.log("[wildfire] response domain settings for '" + response.request.context.hostname + "':", settings); - var chromeLoggerMessage = response.headers.filter(function (header) { - return header.name === "X-ChromeLogger-Data"; - }); - - if (chromeLoggerMessage.length > 0) { - chromeLoggerMessage.forEach(function (header) { - try { - var message = decodeURIComponent(escape(atob(header.value))); - message = JSON.parse(message); - API.on.chromeLoggerMessage(message, response.request.context); - } catch (err) { - console.error("header", header); - console.error("Error processing message:", err); - } - }); - } - - httpHeaderChannel.parseReceived(response.headers, { - "id": response.request.id, - "url": response.request.url, - "hostname": response.request.hostname, - "context": response.request.context, - "port": response.request.port, - "method": response.request.method, - "status": response.status, - "contentType": response.contentType, - "requestHeaders": response.request.headers - }); -}); -},{"./adapters/http-request-observer":24,"./adapters/http-response-observer":25,"./receivers/firephp":27,"./receivers/insight":28,"./settings":29,"eventemitter2":1,"insight-for-js/lib/encoder/default":31,"wildfire-for-js":13}],31:[function(require,module,exports){ - -var UTIL = require("fp-modules-for-nodejs/lib/util"); -var JSON = require("fp-modules-for-nodejs/lib/json"); - -var Encoder = exports.Encoder = function() { - if (!(this instanceof exports.Encoder)) - return new exports.Encoder(); - this.options = { - "maxObjectDepth": 4, - "maxArrayDepth": 4, - "maxOverallDepth": 6, - "includeLanguageMeta": true - }; -} - -Encoder.prototype.setOption = function(name, value) { - this.options[name] = value; -} - -Encoder.prototype.setOrigin = function(variable) { - this.origin = variable; - // reset some variables - this.instances = []; - return true; -} - -Encoder.prototype.encode = function(data, meta, options) { - - options = options || {}; - - if(typeof data != "undefined") { - this.setOrigin(data); - } - - // TODO: Use meta["fc.encoder.options"] to control encoding - - var graph = {}; - - try { - if(typeof this.origin != "undefined") { - graph["origin"] = this.encodeVariable(meta, this.origin); - } - } catch(err) { - console.warn("Error encoding variable", err.stack); - throw err; - } - - if(UTIL.len(this.instances)>0) { - graph["instances"] = []; - this.instances.forEach(function(instance) { - graph["instances"].push(instance[1]); - }); - } - - if(UTIL.has(options, "jsonEncode") && !options.jsonEncode) { - return graph; - } - - try { - return JSON.encode(graph); - } catch(e) { - console.warn("Error jsonifying object graph" + e); - throw e; - } - return null; -} - -function setMeta (node, name, value) { - node.meta = node.meta || {}; - node.meta[name] = value; -} - -function completeWithMeta (meta, node) { - node.meta = node.meta || {}; - Object.keys(meta).forEach(function (name) { - if (typeof node.meta[name] === 'undefined') { - node.meta[name] = meta[name]; - } - }); - return node; -} - -Encoder.prototype.encodeVariable = function(meta, variable, objectDepth, arrayDepth, overallDepth) { - objectDepth = objectDepth || 1; - arrayDepth = arrayDepth || 1; - overallDepth = overallDepth || 1; - - if(variable===null) { - var ret = {"type": "constant", "value": "null"}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "null"); - } - ret = completeWithMeta(meta, ret); - return ret; - } else - if(variable===true || variable===false) { - var ret = {"type": "constant", "value": (variable===true)?"true":"false"}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "boolean"); - } - ret = completeWithMeta(meta, ret); - return ret; - } - - var type = typeof variable; - if(type=="undefined") { - var ret = {"type": "constant", "value": "undefined"}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "undefined"); - } - completeWithMeta(meta, ret); - return ret; - } else - if(type=="number") { - if(Math.round(variable)==variable) { - var ret = {"type": "string", "value": ""+variable}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "integer"); - } - completeWithMeta(meta, ret); - return ret; - } else { - var ret = {"type": "string", "value": ""+variable}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "float"); - } - completeWithMeta(meta, ret); - return ret; - } - } else - if(type=="string") { - // HACK: This should be done via an option - // FirePHPCore compatibility: Detect resource string - if(variable=="** Excluded by Filter **") { - var ret = {"type": "string", "value": variable}; - setMeta(ret, "encoder.notice", "Excluded by Filter"); - setMeta(ret, "encoder.trimmed", true); - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "string"); - } - completeWithMeta(meta, ret); - return ret; - } else - if(variable.match(/^\*\*\sRecursion\s\([^\(]*\)\s\*\*$/)) { - var ret = {"type": "string", "value": variable}; - setMeta(ret, "encoder.notice", "Recursion"); - setMeta(ret, "encoder.trimmed", true); - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "string"); - } - completeWithMeta(meta, ret); - return ret; - } else - if(variable.match(/^\*\*\sResource\sid\s#\d*\s\*\*$/)) { - var ret = {"type": "string", "value": variable.substring(3, variable.length-3)}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "resource"); - } - completeWithMeta(meta, ret); - return ret; - } else { - var ret = {"type": "string", "value": variable}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "string"); - } - completeWithMeta(meta, ret); - return ret; - } - } - - if (variable && variable.__no_serialize === true) { - var ret = {"type": "string", "value": "Object"}; - setMeta(ret, "encoder.notice", "Excluded by __no_serialize"); - setMeta(ret, "encoder.trimmed", true); - completeWithMeta(meta, ret); - return ret; - } - - if(type=="function") { - var ret = {"type": "string", "string": ""+variable}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "function"); - } - completeWithMeta(meta, ret); - return ret; - } else - if(type=="object") { - - try { - if(UTIL.isArrayLike(variable)) { - var ret = { - "type": "array", - "value": this.encodeArray(meta, variable, objectDepth, arrayDepth, overallDepth) - }; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "array"); - } - ret = completeWithMeta(meta, ret); - return ret; - } - } catch (err) { -// TODO: Find a better way to encode variables that cause security exceptions when accessed etc... - var ret = {"type": "string", "string": "Cannot serialize"}; - setMeta(ret, "encoder.notice", "Cannot serialize"); - setMeta(ret, "encoder.trimmed", true); - completeWithMeta(meta, ret); - return ret; - } - // HACK: This should be done via an option - // FirePHPCore compatibility: we only have an object if a class name is present - - if(typeof variable["__className"] != "undefined" ) { - var ret = { - "type": "reference", - "value": this.encodeInstance(meta, variable, objectDepth, arrayDepth, overallDepth) - }; - completeWithMeta(meta, ret); - return ret; - } else { - var ret; - if (/^\[Exception\.\.\.\s/.test(variable)) { - ret = { - "type": "map", - "value": this.encodeException(meta, variable, objectDepth, arrayDepth, overallDepth) - }; - } else { - ret = { - "type": "map", - "value": this.encodeAssociativeArray(meta, variable, objectDepth, arrayDepth, overallDepth) - }; - } - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "map"); - } - completeWithMeta(meta, ret); - return ret; - } - } - - var ret = {"type": "string", "value": "Variable with type '" + type + "' unknown: "+variable}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "unknown"); - } - completeWithMeta(meta, ret); - return ret; -// return "["+(typeof variable)+"]["+variable+"]"; -} - -Encoder.prototype.encodeArray = function(meta, variable, objectDepth, arrayDepth, overallDepth) { - objectDepth = objectDepth || 1; - arrayDepth = arrayDepth || 1; - overallDepth = overallDepth || 1; - if(arrayDepth > this.options["maxArrayDepth"]) { - return {"notice": "Max Array Depth (" + this.options["maxArrayDepth"] + ")"}; - } else - if(overallDepth > this.options["maxOverallDepth"]) { - return {"notice": "Max Overall Depth (" + this.options["maxOverallDepth"] + ")"}; - } - var self = this, - items = []; - UTIL.forEach(variable, function(item) { - items.push(self.encodeVariable(meta, item, 1, arrayDepth + 1, overallDepth + 1)); - }); - return items; -} - - -Encoder.prototype.encodeAssociativeArray = function(meta, variable, objectDepth, arrayDepth, overallDepth) { - objectDepth = objectDepth || 1; - arrayDepth = arrayDepth || 1; - overallDepth = overallDepth || 1; - if(arrayDepth > this.options["maxArrayDepth"]) { - return {"notice": "Max Array Depth (" + this.options["maxArrayDepth"] + ")"}; - } else - if(overallDepth > this.options["maxOverallDepth"]) { - return {"notice": "Max Overall Depth (" + this.options["maxOverallDepth"] + ")"}; - } - var self = this, - items = []; - for (var key in variable) { - - // HACK: This should be done via an option - // FirePHPCore compatibility: numeric (integer) strings as keys in associative arrays get converted to integers - // http://www.php.net/manual/en/language.types.array.php - if(isNumber(key) && Math.round(key)==key) { - key = parseInt(key); - } - - items.push([ - self.encodeVariable(meta, key, 1, arrayDepth + 1, overallDepth + 1), - self.encodeVariable(meta, variable[key], 1, arrayDepth + 1, overallDepth + 1) - ]); - } - return items; -} - - -Encoder.prototype.encodeException = function(meta, variable, objectDepth, arrayDepth, overallDepth) { - var self = this, - items = []; - items.push([ - self.encodeVariable(meta, "message", 1, arrayDepth + 1, overallDepth + 1), - self.encodeVariable(meta, (""+variable), 1, arrayDepth + 1, overallDepth + 1) - ]); - return items; -} - -// http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric -function isNumber(n) { - return !isNaN(parseFloat(n)) && isFinite(n); -} - - - -Encoder.prototype.getInstanceId = function(object) { - for( var i=0 ; i this.options["maxObjectDepth"]) { - return {"notice": "Max Object Depth (" + this.options["maxObjectDepth"] + ")"}; - } else - if(overallDepth > this.options["maxOverallDepth"]) { - return {"notice": "Max Overall Depth (" + this.options["maxOverallDepth"] + ")"}; - } - - var self = this, - ret = {"type": "dictionary", "value": {}}; - - // HACK: This should be done via an option - // FirePHPCore compatibility: we have an object if a class name is present - var isPHPClass = false; - if(typeof object["__className"] != "undefined") { - isPHPClass = true; - setMeta(ret, "lang.class", object["__className"]); - delete(object["__className"]); - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "object"); - } - } - - // HACK: This should be done via an option - // FirePHPCore compatibility: we have an exception if a class name is present - if(typeof object["__isException"] != "undefined" && object["__isException"]) { - setMeta(ret, "lang.type", "exception"); - } - - UTIL.forEach(object, function(item) { - try { - if(item[0]=="__fc_tpl_id") { - ret['fc.tpl.id'] = item[1]; - return; - } - if(isPHPClass) { - var val = self.encodeVariable(meta, item[1], objectDepth + 1, 1, overallDepth + 1), - parts = item[0].split(":"), - name = parts[parts.length-1]; - if(parts[0]=="public") { - val["lang.visibility"] = "public"; - } else - if(parts[0]=="protected") { - val["lang.visibility"] = "protected"; - } else - if(parts[0]=="private") { - val["lang.visibility"] = "private"; - } else - if(parts[0]=="undeclared") { - val["lang.undeclared"] = 1; - } - if(parts.length==2 && parts[1]=="static") { - val["lang.static"] = 1; - } - ret["value"][name] = val; - } else { - ret["value"][item[0]] = self.encodeVariable(meta, item[1], objectDepth + 1, 1, overallDepth + 1); - } - } catch(e) { - console.warn(e); - ret["value"]["__oops__"] = {"notice": "Error encoding member (" + e + ")"}; - } - }); - - completeWithMeta(meta, ret); - - return ret; -} -},{"fp-modules-for-nodejs/lib/json":32,"fp-modules-for-nodejs/lib/util":33}],32:[function(require,module,exports){ -arguments[4][16][0].apply(exports,arguments) -},{"dup":16}],33:[function(require,module,exports){ -arguments[4][22][0].apply(exports,arguments) -},{"dup":22}],34:[function(require,module,exports){ -'use strict' - -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray - -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} - -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 - -function getLens (b64) { - var len = b64.length - - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - for (var i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk( - uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) - )) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) - } - - return parts.join('') -} - -},{}],35:[function(require,module,exports){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - -'use strict' - -var base64 = require('base64-js') -var ieee754 = require('ieee754') - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -var K_MAX_LENGTH = 0x7fffffff -exports.kMaxLength = K_MAX_LENGTH - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ -Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() - -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && - typeof console.error === 'function') { - console.error( - 'This browser lacks typed array (Uint8Array) support which is required by ' + - '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' - ) -} - -function typedArraySupport () { - // Can typed array instances can be augmented? - try { - var arr = new Uint8Array(1) - arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } } - return arr.foo() === 42 - } catch (e) { - return false - } -} - -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.buffer - } -}) - -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.byteOffset - } -}) - -function createBuffer (length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"') - } - // Return an augmented `Uint8Array` instance - var buf = new Uint8Array(length) - buf.__proto__ = Buffer.prototype - return buf -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new TypeError( - 'The "string" argument must be of type string. Received type number' - ) - } - return allocUnsafe(arg) - } - return from(arg, encodingOrOffset, length) -} - -// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 -if (typeof Symbol !== 'undefined' && Symbol.species != null && - Buffer[Symbol.species] === Buffer) { - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true, - enumerable: false, - writable: false - }) -} - -Buffer.poolSize = 8192 // not used by this implementation - -function from (value, encodingOrOffset, length) { - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } - - if (ArrayBuffer.isView(value)) { - return fromArrayLike(value) - } - - if (value == null) { - throw TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) - } - - if (isInstance(value, ArrayBuffer) || - (value && isInstance(value.buffer, ArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof value === 'number') { - throw new TypeError( - 'The "value" argument must not be of type number. Received type number' - ) - } - - var valueOf = value.valueOf && value.valueOf() - if (valueOf != null && valueOf !== value) { - return Buffer.from(valueOf, encodingOrOffset, length) - } - - var b = fromObject(value) - if (b) return b - - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && - typeof value[Symbol.toPrimitive] === 'function') { - return Buffer.from( - value[Symbol.toPrimitive]('string'), encodingOrOffset, length - ) - } - - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length) -} - -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Buffer.prototype.__proto__ = Uint8Array.prototype -Buffer.__proto__ = Uint8Array - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be of type number') - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } -} - -function alloc (size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(size).fill(fill, encoding) - : createBuffer(size).fill(fill) - } - return createBuffer(size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(size, fill, encoding) -} - -function allocUnsafe (size) { - assertSize(size) - return createBuffer(size < 0 ? 0 : checked(size) | 0) -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(size) -} - -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - - var length = byteLength(string, encoding) | 0 - var buf = createBuffer(length) - - var actual = buf.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual) - } - - return buf -} - -function fromArrayLike (array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0 - var buf = createBuffer(length) - for (var i = 0; i < length; i += 1) { - buf[i] = array[i] & 255 - } - return buf -} - -function fromArrayBuffer (array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds') - } - - var buf - if (byteOffset === undefined && length === undefined) { - buf = new Uint8Array(array) - } else if (length === undefined) { - buf = new Uint8Array(array, byteOffset) - } else { - buf = new Uint8Array(array, byteOffset, length) - } - - // Return an augmented `Uint8Array` instance - buf.__proto__ = Buffer.prototype - return buf -} - -function fromObject (obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - var buf = createBuffer(len) - - if (buf.length === 0) { - return buf - } - - obj.copy(buf, 0, 0, len) - return buf - } - - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { - return createBuffer(0) - } - return fromArrayLike(obj) - } - - if (obj.type === 'Buffer' && Array.isArray(obj.data)) { - return fromArrayLike(obj.data) - } -} - -function checked (length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true && - b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false -} - -Buffer.compare = function compare (a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ) - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (isInstance(buf, Uint8Array)) { - buf = Buffer.from(buf) - } - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + - 'Received type ' + typeof string - ) - } - - var len = string.length - var mustMatch = (arguments.length > 2 && arguments[2] === true) - if (!mustMatch && len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - } - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - var loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - var length = this.length - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.toLocaleString = Buffer.prototype.toString - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() - if (this.length > max) str += ' ... ' - return '' -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer.from(target, target.offset, target.byteLength) - } - if (!Buffer.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. ' + - 'Received type ' + (typeof target) - ) - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) - - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) - - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (numberIsNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - var strLen = string.length - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (numberIsNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0 - if (isFinite(length)) { - length = length >>> 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; ++i) { - out += toHex(buf[i]) - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf = this.subarray(start, end) - // Return an augmented `Uint8Array` instance - newBuf.__proto__ = Buffer.prototype - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('Index out of range') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { - // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end) - } else if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (var i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if ((encoding === 'utf8' && code < 128) || - encoding === 'latin1') { - // Fast path: If `val` fits into a single byte, use that numeric value. - val = code - } - } - } else if (typeof val === 'number') { - val = val & 255 - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : Buffer.from(val, encoding) - var len = bytes.length - if (len === 0) { - throw new TypeError('The value "' + val + - '" is invalid for argument "value"') - } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// HELPER FUNCTIONS -// ================ - -var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0] - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance (obj, type) { - return obj instanceof type || - (obj != null && obj.constructor != null && obj.constructor.name != null && - obj.constructor.name === type.name) -} -function numberIsNaN (obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare -} - -},{"base64-js":34,"ieee754":36}],36:[function(require,module,exports){ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = ((value * c) - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - -},{}],37:[function(require,module,exports){ -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - -},{}],38:[function(require,module,exports){ -(function (setImmediate,clearImmediate){ -var nextTick = require('process/browser.js').nextTick; -var apply = Function.prototype.apply; -var slice = Array.prototype.slice; -var immediateIds = {}; -var nextImmediateId = 0; - -// DOM APIs, for completeness - -exports.setTimeout = function() { - return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); -}; -exports.setInterval = function() { - return new Timeout(apply.call(setInterval, window, arguments), clearInterval); -}; -exports.clearTimeout = -exports.clearInterval = function(timeout) { timeout.close(); }; - -function Timeout(id, clearFn) { - this._id = id; - this._clearFn = clearFn; -} -Timeout.prototype.unref = Timeout.prototype.ref = function() {}; -Timeout.prototype.close = function() { - this._clearFn.call(window, this._id); -}; - -// Does not start the time, just sets up the members needed. -exports.enroll = function(item, msecs) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = msecs; -}; - -exports.unenroll = function(item) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = -1; -}; - -exports._unrefActive = exports.active = function(item) { - clearTimeout(item._idleTimeoutId); - - var msecs = item._idleTimeout; - if (msecs >= 0) { - item._idleTimeoutId = setTimeout(function onTimeout() { - if (item._onTimeout) - item._onTimeout(); - }, msecs); - } -}; - -// That's not how node.js implements it but the exposed api is the same. -exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { - var id = nextImmediateId++; - var args = arguments.length < 2 ? false : slice.call(arguments, 1); - - immediateIds[id] = true; - - nextTick(function onNextTick() { - if (immediateIds[id]) { - // fn.call() is faster so we optimize for the common use-case - // @see http://jsperf.com/call-apply-segu - if (args) { - fn.apply(null, args); - } else { - fn.call(null); - } - // Prevent ids from leaking - exports.clearImmediate(id); - } - }); - - return id; -}; - -exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { - delete immediateIds[id]; -}; -}).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":37,"timers":38}]},{},[23])(23) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/console.rep.css b/dist/firephp.build/scripts/devtools/console.rep.css deleted file mode 100644 index 771a1ca..0000000 --- a/dist/firephp.build/scripts/devtools/console.rep.css +++ /dev/null @@ -1,16 +0,0 @@ - -[_cssid="9051886b96d6421ced5fdf604fe05f9c22afe06c"].console { - overflow-x: hidden; - overflow-y: auto; - border-right: 1px solid #dcdcdc; - height: 100vh; -} - -[_cssid="9051886b96d6421ced5fdf604fe05f9c22afe06c"].console DIV.request { - padding: 3px; - padding-left: 10px; - padding-right: 10px; - color: #FFFFFF; - background-color: #0000FF; - border: 1px solid black; -} diff --git a/dist/firephp.build/scripts/devtools/console.rep.js b/dist/firephp.build/scripts/devtools/console.rep.js deleted file mode 100644 index ee72550..0000000 --- a/dist/firephp.build/scripts/devtools/console.rep.js +++ /dev/null @@ -1,1751 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); - } - - function timerExpired() { - var time = now(); - if (shouldInvoke(time)) { - return trailingEdge(time); - } - // Restart the timer. - timerId = setTimeout(timerExpired, remainingWait(time)); - } - - function trailingEdge(time) { - timerId = undefined; - - // Only invoke if we have `lastArgs` which means `func` has been - // debounced at least once. - if (trailing && lastArgs) { - return invokeFunc(time); - } - lastArgs = lastThis = undefined; - return result; - } - - function cancel() { - if (timerId !== undefined) { - clearTimeout(timerId); - } - lastInvokeTime = 0; - lastArgs = lastCallTime = lastThis = timerId = undefined; - } - - function flush() { - return timerId === undefined ? result : trailingEdge(now()); - } - - function debounced() { - var time = now(), - isInvoking = shouldInvoke(time); - - lastArgs = arguments; - lastThis = this; - lastCallTime = time; - - if (isInvoking) { - if (timerId === undefined) { - return leadingEdge(lastCallTime); - } - if (maxing) { - // Handle invocations in a tight loop. - timerId = setTimeout(timerExpired, wait); - return invokeFunc(lastCallTime); - } - } - if (timerId === undefined) { - timerId = setTimeout(timerExpired, wait); - } - return result; - } - debounced.cancel = cancel; - debounced.flush = flush; - return debounced; -} - -module.exports = debounce; - -},{"./isObject":8,"./now":11,"./toNumber":12}],8:[function(require,module,exports){ -/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); -} - -module.exports = isObject; - -},{}],9:[function(require,module,exports){ -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return value != null && typeof value == 'object'; -} - -module.exports = isObjectLike; - -},{}],10:[function(require,module,exports){ -var baseGetTag = require('./_baseGetTag'), - isObjectLike = require('./isObjectLike'); - -/** `Object#toString` result references. */ -var symbolTag = '[object Symbol]'; - -/** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ -function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); -} - -module.exports = isSymbol; - -},{"./_baseGetTag":2,"./isObjectLike":9}],11:[function(require,module,exports){ -var root = require('./_root'); - -/** - * Gets the timestamp of the number of milliseconds that have elapsed since - * the Unix epoch (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Date - * @returns {number} Returns the timestamp. - * @example - * - * _.defer(function(stamp) { - * console.log(_.now() - stamp); - * }, _.now()); - * // => Logs the number of milliseconds it took for the deferred invocation. - */ -var now = function() { - return root.Date.now(); -}; - -module.exports = now; - -},{"./_root":6}],12:[function(require,module,exports){ -var isObject = require('./isObject'), - isSymbol = require('./isSymbol'); - -/** Used as references for various `Number` constants. */ -var NAN = 0 / 0; - -/** Used to match leading and trailing whitespace. */ -var reTrim = /^\s+|\s+$/g; - -/** Used to detect bad signed hexadecimal string values. */ -var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; - -/** Used to detect binary string values. */ -var reIsBinary = /^0b[01]+$/i; - -/** Used to detect octal string values. */ -var reIsOctal = /^0o[0-7]+$/i; - -/** Built-in method references without a dependency on `root`. */ -var freeParseInt = parseInt; - -/** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3.2); - * // => 3.2 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3.2'); - * // => 3.2 - */ -function toNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - if (isObject(value)) { - var other = typeof value.valueOf == 'function' ? value.valueOf() : value; - value = isObject(other) ? (other + '') : other; - } - if (typeof value != 'string') { - return value === 0 ? value : +value; - } - value = value.replace(reTrim, ''); - var isBinary = reIsBinary.test(value); - return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); -} - -module.exports = toNumber; - -},{"./isObject":8,"./isSymbol":10}],13:[function(require,module,exports){ -"use strict"; - -var WINDOW = window; - -exports.main = function (JSONREP, node, options) { - return JSONREP.markupNode(node).then(function (code) { - return JSONREP.makeRep('
' + code + '
', { - css: { - ".@": "github.com~0ink~codeblock/codeblock:Codeblock", - "_code": "{\"_cssid\":\"9051886b96d6421ced5fdf604fe05f9c22afe06c\",\"repUri\":\"console\"}", - "_format": "json", - "_args": [], - "_compiled": false - }, - on: { - mount: function (el) { - var COMPONENT = require("./component"); - - var comp = COMPONENT.for({ - browser: WINDOW.crossbrowser - }); - comp.on("setting.enabled", function (enabled) { - if (!enabled) { - if (comp.currentContext && consoles[comp.currentContext.pageUid]) { - consoles[comp.currentContext.pageUid].getAPI().clear(); - } - } - }); - - function syncConsoleVisibility() { - if (!comp.currentContext) { - Object.keys(consoles).forEach(function (id) { - consoles[id].hide(); - }); - return; - } - - if (persistentConsole) { - return; - } - - Object.keys(consoles).forEach(function (id) { - if (id === comp.currentContext.pageUid) { - consoles[id].show(); - } else { - consoles[id].hide(); - } - }); - } - - comp.on("changed.context", function (context) { - comp.contextChangeAcknowledged(); - syncPersistentConsole(); - syncConsoleVisibility(); - }); - - function ensureRequestWrapper(fc, context) { - var panelEl = fc.getPanelEl(); - var id = context.requestUid.replace(/["\{\}]/g, '_'); - fc._requestWrappers = fc._requestWrappers || {}; - - if (!fc._requestWrappers[id]) { - var requestType = context.requestType; - - if (requestType === "sub_frame") { - requestType = "iframe"; - } else if (requestType === "main_frame") { - requestType = "page"; - } else if (requestType === "xmlhttprequest") { - requestType = "ajax"; - } - - requestType = requestType.toUpperCase(); - var domNode = WINDOW.document.createElement("div"); - panelEl.appendChild(domNode); - fc._requestWrappers[id] = WINDOW.FC.fireconsole.repRenderer.renderNodeInto({ - "meta": { - "wrapper": "wrappers/request" - }, - "value": { - "title": { - "type": "string", - "value": context.url - }, - "typeLabel": { - "type": "string", - "value": requestType - } - } - }, domNode).then(function () { - var consoleEl = domNode.querySelector('.body'); - var fireconsole = new WINDOW.FC.FireConsole(); - fireconsole.setPanelElement(consoleEl); - fireconsole.onAny(function (name, value) { - WINDOW.FC.fireconsole.emit(name, value); - }); - return fireconsole.getAPI(); - }, function (err) { - throw err; - }); - } - - return fc._requestWrappers[id]; - } - - comp.on("message", function (message) { - try { - if (message.message) { - message.message.context = message.context; - var fc = getConsoleForContext(message.context); - ensureRequestWrapper(fc, message.context).then(function (api) { - api.send(message.message); - scrollIfBottom(); - }); - } else if (message.event === "prepare") { - console.log("PREPARE CONSOLE!!!", message.context); - - var _fc = getConsoleForContext(message.context); - - if (!persistLogs) { - _fc.getAPI().clear(); - } - } else if (message.event === "clear") { - console.log("CLEAR CONSOLE!!!", message.context); - Object.keys(consoles).forEach(function (id) { - if (id == message.context.pageUid) { - consoles[id].getAPI().clear(); - } - }); - scrollIfBottom(); - } else if (message.event === "destroyContext") { - console.log("DESTROY CONTEXT!!!", message.context); - Object.keys(consoles).forEach(function (id) { - if (id == message.context.pageUid) { - WINDOW.FC.fireconsole.destroyConsoleForId(id.replace(/["\{\}]/g, '_')); - delete consoles[id]; - } - }); - } - } catch (err) { - console.error("message", JSON.stringify(message, null, 4)); - console.error("ERROR", err.message + "\n" + err.stack); - throw err; - } - }); - var consoles = {}; - var persistentConsole = null; - - function syncPersistentConsole() { - return WINDOW.crossbrowser.storage.local.get("persist-on-navigate").then(function (value) { - persistLogs = value["persist-on-navigate"]; - - if (persistLogs) { - if (!persistentConsole && comp.currentContext) { - persistentConsole = getConsoleForContext(comp.currentContext); - } - } else { - if (persistentConsole) { - if (comp.currentContext) { - getConsoleForContext(comp.currentContext).getAPI().clear(); - } - - persistentConsole = null; - - if (comp.currentContext) { - getConsoleForContext(comp.currentContext).getAPI().clear(); - } - } - } - - syncConsoleVisibility(); - }); - } - - var persistLogs = false; - - if (WINDOW.crossbrowser) { - WINDOW.crossbrowser.storage.onChanged.addListener(function (changes, area) { - if (changes["persist-on-navigate"]) { - syncPersistentConsole(); - } - }); - } - - function getConsoleForContext(context) { - if (persistentConsole) { - return persistentConsole; - } - - if (!context || typeof context.pageUid === "undefined") { - console.error("context", context); - throw new Error("'context' does not have required property 'pageUid'!"); - } - - if (!consoles[context.pageUid]) { - consoles[context.pageUid] = WINDOW.FC.fireconsole.consoleForId(context.pageUid.replace(/["\{\}]/g, '_')); - } - - return consoles[context.pageUid]; - } - - var isScrolledToBottom = false; - - function syncScrolledToBottom() { - if (el.scrollTop === el.scrollHeight - el.offsetHeight) { - isScrolledToBottom = true; - } else { - isScrolledToBottom = false; - } - } - - el.onscroll = syncScrolledToBottom; - - function scrollIfBottom() { - if (isScrolledToBottom) { - el.scrollTop = el.scrollHeight; - } - - syncScrolledToBottom(); - } - } - } - }, options); - }); -}; -},{"./component":14}],14:[function(require,module,exports){ -(function (setImmediate){ -"use strict"; - -var EVENTS = require("events"); - -var DEBOUNCE = require('lodash/debounce'); - -exports.for = function (ctx) { - var events = new EVENTS.EventEmitter(); - events.currentContext = null; - setImmediate(function () { - onContextMessage(null); - broadcastCurrentContext(); - }); - var contextChangeAcknowledged = false; - - events.contextChangeAcknowledged = function () { - contextChangeAcknowledged = true; - }; - - function onContextMessage(context) { - if (context !== events.currentContext && (!events.currentContext || !context || context.pageUid !== events.currentContext.pageUid)) { - events.currentContext = context; - contextChangeAcknowledged = false; - } - - if (!contextChangeAcknowledged) { - events.emit("changed.context", events.currentContext); - } - } - - ctx.browser.runtime.onMessage.addListener(function (message) { - try { - if (!ctx.browser || !ctx.browser.devtools || !ctx.browser.devtools.inspectedWindow || !message.context || message.context.tabId != ctx.browser.devtools.inspectedWindow.tabId) { - return; - } - - if (message.to === "message-listener") { - if (message.event === "currentContext" && typeof message.context !== "undefined") { - onContextMessage(message.context); - } - - events.emit("message", message); - } - } catch (err) { - console.error(err); - } - }); - ctx.browser.storage.onChanged.addListener(function (changes, area) { - try { - if (!events.currentContext) { - return; - } - - var prefix = "domain[".concat(events.currentContext.hostname, "]."); - - for (var item of Object.keys(changes)) { - if (!/^domain\[.+\]\..+$/.test(item)) continue; - - if (item.substring(0, prefix.length) === prefix) { - var name = item.substring(prefix.length); - events.emit("setting." + name, changes[item].newValue); - events.emit("changed.setting", name, changes[item].newValue); - } - } - } catch (err) { - console.error(err); - } - }); - var broadcastCurrentContext = DEBOUNCE(function () { - ctx.browser.runtime.sendMessage({ - to: "broadcast", - event: "currentContext" - }); - }, 250); - - events.getSetting = function (name) { - if (!events.currentContext) { - return Promise.resolve(null); - } - - return events._getSettingForHostname(events.currentContext.hostname, name); - }; - - events._getSettingForHostname = function (hostname, name) { - if (typeof ctx.browser === "undefined") { - return Promise.resolve(null); - } - - var key = "domain[" + hostname + "]." + name; - return ctx.browser.storage.local.get(key).then(function (value) { - return value[key] || false; - }).catch(function (err) { - console.error(err); - throw err; - }); - }; - - events.setSetting = function (name, value) { - if (!events.currentContext) { - throw new Error("Cannot set setting for name '".concat(name, "' due to no 'currentContext'!")); - } - - return events._setSettingForHostname(events.currentContext.hostname, name, value); - }; - - events._setSettingForHostname = function (hostname, name, value) { - if (typeof ctx.browser === "undefined") { - return Promise.resolve(null); - } - - return events._getSettingForHostname(hostname, name).then(function (existingValue) { - if (value === existingValue) { - return; - } - - var obj = {}; - obj["domain[" + hostname + "]." + name] = value; - return ctx.browser.storage.local.set(obj).then(broadcastCurrentContext); - }).catch(function (err) { - console.error(err); - throw err; - }); - }; - - events.getGlobalSetting = function (name) { - if (typeof ctx.browser === "undefined") { - return Promise.resolve(null); - } - - var defaultValue; - - if (name === "reloadOnEnable") { - defaultValue = true; - } - - return ctx.browser.storage.local.get(name).then(function (value) { - if (typeof value[name] === "undefined") { - if (typeof defaultValue !== "undefined") { - return defaultValue; - } - - return null; - } - - return value[name]; - }).catch(function (err) { - console.error(err); - throw err; - }); - }; - - events.setGlobalSetting = function (name, value) { - if (typeof ctx.browser === "undefined") { - return Promise.resolve(null); - } - - return events.getGlobalSetting(name).then(function (existingValue) { - if (value === existingValue) { - return; - } - - var obj = {}; - obj[name] = value; - return ctx.browser.storage.local.set(obj).then(broadcastCurrentContext); - }).catch(function (err) { - console.error(err); - throw err; - }); - }; - - events.isConfigured = function () { - return events.getSetting("enableUserAgentHeader").then(function (enableUserAgentHeader) { - return events.getSetting("enableFirePHPHeader").then(function (enableFirePHPHeader) { - return events.getSetting("enableChromeLoggerData").then(function (enableChromeLoggerData) { - return enableUserAgentHeader || enableFirePHPHeader || enableChromeLoggerData; - }); - }); - }); - }; - - events.reloadBrowser = function () { - ctx.browser.runtime.sendMessage({ - to: "background", - event: "reload", - context: { - tabId: ctx.browser.devtools.inspectedWindow.tabId - } - }); - }; - - events.clearConsole = function () { - ctx.browser.runtime.sendMessage({ - to: "broadcast", - event: "clear" - }); - }; - - events.showView = function (name) { - if (name === "manage") { - ctx.browser.runtime.sendMessage({ - to: "broadcast", - event: "manage" - }); - } - }; - - return events; -}; -}).call(this,require("timers").setImmediate) -},{"events":15,"lodash/debounce":7,"timers":17}],15:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var objectCreate = Object.create || objectCreatePolyfill -var objectKeys = Object.keys || objectKeysPolyfill -var bind = Function.prototype.bind || functionBindPolyfill - -function EventEmitter() { - if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) { - this._events = objectCreate(null); - this._eventsCount = 0; - } - - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -var defaultMaxListeners = 10; - -var hasDefineProperty; -try { - var o = {}; - if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 }); - hasDefineProperty = o.x === 0; -} catch (err) { hasDefineProperty = false } -if (hasDefineProperty) { - Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function() { - return defaultMaxListeners; - }, - set: function(arg) { - // check whether the input is a positive number (whose value is zero or - // greater and not a NaN). - if (typeof arg !== 'number' || arg < 0 || arg !== arg) - throw new TypeError('"defaultMaxListeners" must be a positive number'); - defaultMaxListeners = arg; - } - }); -} else { - EventEmitter.defaultMaxListeners = defaultMaxListeners; -} - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || isNaN(n)) - throw new TypeError('"n" argument must be a positive number'); - this._maxListeners = n; - return this; -}; - -function $getMaxListeners(that) { - if (that._maxListeners === undefined) - return EventEmitter.defaultMaxListeners; - return that._maxListeners; -} - -EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return $getMaxListeners(this); -}; - -// These standalone emit* functions are used to optimize calling of event -// handlers for fast cases because emit() itself often has a variable number of -// arguments and can be deoptimized because of that. These functions always have -// the same number of arguments and thus do not get deoptimized, so the code -// inside them can execute faster. -function emitNone(handler, isFn, self) { - if (isFn) - handler.call(self); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self); - } -} -function emitOne(handler, isFn, self, arg1) { - if (isFn) - handler.call(self, arg1); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1); - } -} -function emitTwo(handler, isFn, self, arg1, arg2) { - if (isFn) - handler.call(self, arg1, arg2); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2); - } -} -function emitThree(handler, isFn, self, arg1, arg2, arg3) { - if (isFn) - handler.call(self, arg1, arg2, arg3); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2, arg3); - } -} - -function emitMany(handler, isFn, self, args) { - if (isFn) - handler.apply(self, args); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].apply(self, args); - } -} - -EventEmitter.prototype.emit = function emit(type) { - var er, handler, len, args, i, events; - var doError = (type === 'error'); - - events = this._events; - if (events) - doError = (doError && events.error == null); - else if (!doError) - return false; - - // If there is no 'error' event listener then throw. - if (doError) { - if (arguments.length > 1) - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; - } - return false; - } - - handler = events[type]; - - if (!handler) - return false; - - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); - } - - return true; -}; - -function _addListener(target, type, listener, prepend) { - var m; - var events; - var existing; - - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - - events = target._events; - if (!events) { - events = target._events = objectCreate(null); - target._eventsCount = 0; - } else { - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (events.newListener) { - target.emit('newListener', type, - listener.listener ? listener.listener : listener); - - // Re-assign `events` because a newListener handler could have caused the - // this._events to be assigned to a new object - events = target._events; - } - existing = events[type]; - } - - if (!existing) { - // Optimize the case of one listener. Don't need the extra array object. - existing = events[type] = listener; - ++target._eventsCount; - } else { - if (typeof existing === 'function') { - // Adding the second element, need to change to array. - existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { - // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } - } - - // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } - } - } - - return target; -} - -EventEmitter.prototype.addListener = function addListener(type, listener) { - return _addListener(this, type, listener, false); -}; - -EventEmitter.prototype.on = EventEmitter.prototype.addListener; - -EventEmitter.prototype.prependListener = - function prependListener(type, listener) { - return _addListener(this, type, listener, true); - }; - -function onceWrapper() { - if (!this.fired) { - this.target.removeListener(this.type, this.wrapFn); - this.fired = true; - switch (arguments.length) { - case 0: - return this.listener.call(this.target); - case 1: - return this.listener.call(this.target, arguments[0]); - case 2: - return this.listener.call(this.target, arguments[0], arguments[1]); - case 3: - return this.listener.call(this.target, arguments[0], arguments[1], - arguments[2]); - default: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } - } -} - -function _onceWrap(target, type, listener) { - var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); - wrapped.listener = listener; - state.wrapFn = wrapped; - return wrapped; -} - -EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - this.on(type, _onceWrap(this, type, listener)); - return this; -}; - -EventEmitter.prototype.prependOnceListener = - function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - this.prependListener(type, _onceWrap(this, type, listener)); - return this; - }; - -// Emits a 'removeListener' event if and only if the listener was removed. -EventEmitter.prototype.removeListener = - function removeListener(type, listener) { - var list, events, position, i, originalListener; - - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - - events = this._events; - if (!events) - return this; - - list = events[type]; - if (!list) - return this; - - if (list === listener || list.listener === listener) { - if (--this._eventsCount === 0) - this._events = objectCreate(null); - else { - delete events[type]; - if (events.removeListener) - this.emit('removeListener', type, list.listener || listener); - } - } else if (typeof list !== 'function') { - position = -1; - - for (i = list.length - 1; i >= 0; i--) { - if (list[i] === listener || list[i].listener === listener) { - originalListener = list[i].listener; - position = i; - break; - } - } - - if (position < 0) - return this; - - if (position === 0) - list.shift(); - else - spliceOne(list, position); - - if (list.length === 1) - events[type] = list[0]; - - if (events.removeListener) - this.emit('removeListener', type, originalListener || listener); - } - - return this; - }; - -EventEmitter.prototype.removeAllListeners = - function removeAllListeners(type) { - var listeners, events, i; - - events = this._events; - if (!events) - return this; - - // not listening for removeListener, no need to emit - if (!events.removeListener) { - if (arguments.length === 0) { - this._events = objectCreate(null); - this._eventsCount = 0; - } else if (events[type]) { - if (--this._eventsCount === 0) - this._events = objectCreate(null); - else - delete events[type]; - } - return this; - } - - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - var keys = objectKeys(events); - var key; - for (i = 0; i < keys.length; ++i) { - key = keys[i]; - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = objectCreate(null); - this._eventsCount = 0; - return this; - } - - listeners = events[type]; - - if (typeof listeners === 'function') { - this.removeListener(type, listeners); - } else if (listeners) { - // LIFO order - for (i = listeners.length - 1; i >= 0; i--) { - this.removeListener(type, listeners[i]); - } - } - - return this; - }; - -function _listeners(target, type, unwrap) { - var events = target._events; - - if (!events) - return []; - - var evlistener = events[type]; - if (!evlistener) - return []; - - if (typeof evlistener === 'function') - return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); -} - -EventEmitter.prototype.listeners = function listeners(type) { - return _listeners(this, type, true); -}; - -EventEmitter.prototype.rawListeners = function rawListeners(type) { - return _listeners(this, type, false); -}; - -EventEmitter.listenerCount = function(emitter, type) { - if (typeof emitter.listenerCount === 'function') { - return emitter.listenerCount(type); - } else { - return listenerCount.call(emitter, type); - } -}; - -EventEmitter.prototype.listenerCount = listenerCount; -function listenerCount(type) { - var events = this._events; - - if (events) { - var evlistener = events[type]; - - if (typeof evlistener === 'function') { - return 1; - } else if (evlistener) { - return evlistener.length; - } - } - - return 0; -} - -EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; -}; - -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - -function arrayClone(arr, n) { - var copy = new Array(n); - for (var i = 0; i < n; ++i) - copy[i] = arr[i]; - return copy; -} - -function unwrapListeners(arr) { - var ret = new Array(arr.length); - for (var i = 0; i < ret.length; ++i) { - ret[i] = arr[i].listener || arr[i]; - } - return ret; -} - -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; -} - -},{}],16:[function(require,module,exports){ -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - -},{}],17:[function(require,module,exports){ -(function (setImmediate,clearImmediate){ -var nextTick = require('process/browser.js').nextTick; -var apply = Function.prototype.apply; -var slice = Array.prototype.slice; -var immediateIds = {}; -var nextImmediateId = 0; - -// DOM APIs, for completeness - -exports.setTimeout = function() { - return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); -}; -exports.setInterval = function() { - return new Timeout(apply.call(setInterval, window, arguments), clearInterval); -}; -exports.clearTimeout = -exports.clearInterval = function(timeout) { timeout.close(); }; - -function Timeout(id, clearFn) { - this._id = id; - this._clearFn = clearFn; -} -Timeout.prototype.unref = Timeout.prototype.ref = function() {}; -Timeout.prototype.close = function() { - this._clearFn.call(window, this._id); -}; - -// Does not start the time, just sets up the members needed. -exports.enroll = function(item, msecs) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = msecs; -}; - -exports.unenroll = function(item) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = -1; -}; - -exports._unrefActive = exports.active = function(item) { - clearTimeout(item._idleTimeoutId); - - var msecs = item._idleTimeout; - if (msecs >= 0) { - item._idleTimeoutId = setTimeout(function onTimeout() { - if (item._onTimeout) - item._onTimeout(); - }, msecs); - } -}; - -// That's not how node.js implements it but the exposed api is the same. -exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { - var id = nextImmediateId++; - var args = arguments.length < 2 ? false : slice.call(arguments, 1); - - immediateIds[id] = true; - - nextTick(function onNextTick() { - if (immediateIds[id]) { - // fn.call() is faster so we optimize for the common use-case - // @see http://jsperf.com/call-apply-segu - if (args) { - fn.apply(null, args); - } else { - fn.call(null); - } - // Prevent ids from leaking - exports.clearImmediate(id); - } - }); - - return id; -}; - -exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { - delete immediateIds[id]; -}; -}).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":16,"timers":17}]},{},[13])(13) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/array.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/array.preview.htm deleted file mode 100644 index 07a6460..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/array.preview.htm +++ /dev/null @@ -1,40 +0,0 @@ - - - -

tag

- -array(
,
)
- -
- -

collapsedTag

- -array() - -
- -

shortTag

- -array(,) - -
- -

expandableStub

- - - -
- -

expandedStub

- - - -
- -

moreTag

- - ... - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/array.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/array.rep.css deleted file mode 100644 index 38fffc9..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/array.rep.css +++ /dev/null @@ -1,45 +0,0 @@ - -SPAN.array[__dbid="c8e051a0d8ba6235ed889e184aae731c7e813f48"] > SPAN { - color: #9C9C9C; - font-weight: bold; -} - -SPAN.array[__dbid="c8e051a0d8ba6235ed889e184aae731c7e813f48"] > SPAN.collapsed { - color: #0000FF; - font-weight: normal; - padding-left: 5px; - padding-right: 5px; -} - -SPAN.array[__dbid="c8e051a0d8ba6235ed889e184aae731c7e813f48"] > SPAN.summary { - color: #0000FF; - font-weight: normal; - padding-left: 5px; - padding-right: 5px; -} - -SPAN.array[__dbid="c8e051a0d8ba6235ed889e184aae731c7e813f48"] > DIV.element { - display: block; - padding-left: 20px; -} - -SPAN.array[__dbid="c8e051a0d8ba6235ed889e184aae731c7e813f48"] > SPAN.element { - padding-left: 2px; -} - -SPAN.array[__dbid="c8e051a0d8ba6235ed889e184aae731c7e813f48"] > DIV.element.expandable { - background-image: url(images/twisty-closed.png); - background-repeat: no-repeat; - background-position: 6px 2px; - cursor: pointer; -} -SPAN.array[__dbid="c8e051a0d8ba6235ed889e184aae731c7e813f48"] > DIV.element.expandable.expanded { - background-image: url(images/twisty-open.png); -} - -SPAN.array[__dbid="c8e051a0d8ba6235ed889e184aae731c7e813f48"] > .element > SPAN.value { -} - -SPAN.array[__dbid="c8e051a0d8ba6235ed889e184aae731c7e813f48"] > .element > SPAN.separator { - color: #9C9C9C; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/array.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/array.rep.js deleted file mode 100644 index b971360..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/array.rep.js +++ /dev/null @@ -1,308 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 2 && type == this.CONST_Short) { - element["tag"] = this.moreTag; - } else { - element["tag"] = this.getTag(context, element, type); - } - - elements.push(element); - - if (i > 2 && type == this.CONST_Short) { - elements[elements.length - 1].more = false; - break; - } - } - - return elements; - }, - isExpandable: function isExpandable(node) { - return node.type == "reference" || node.type == "dictionary" || node.type == "map" || node.type == "array"; - }, - onClick: function onClick(event) { - if (!domplate.util.isLeftClick(event)) { - return; - } - - var row = domplate.util.getAncestorByClass(event.target, "element"); - - if (domplate.util.hasClass(row, "expandable")) { - this.toggleRow(row); - } - - event.stopPropagation(); - }, - toggleRow: function toggleRow(row) { - var valueElement = domplate.util.getElementByClass(row, "value"); - - if (domplate.util.hasClass(row, "expanded")) { - domplate.util.removeClass(row, "expanded"); - this.expandedStub.replace({ - "tag": this.expandableStub, - "element": row.elementObject, - "context": row.contextObject, - "node": row.elementObject.node - }, valueElement); - } else { - domplate.util.setClass(row, "expanded"); - var rep = row.contextObject.repForNode(row.elementObject.node); - this.expandedStub.replace({ - "tag": rep.tag, - "element": row.elementObject, - "context": row.contextObject, - "node": row.elementObject.node - }, valueElement); - } - } - }; -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0) { var l0 = 0; var if_0 = 0; var e0 = 0; with (this) { l0 = __loop__.apply(this, [d0, function(i0,l0,d0,d1,d2,d3,d4,d5) { node = __path__(root, o,0+1+l0+0);node.addEventListener("click", __bind__(this, d0), false);node.contextObject = d1;node.elementObject = d2; node = __path__(root, o,0+1+l0+0,0,0); e0 = __link__(node, d3, d4); if_0 = __if__.apply(this, [d5, function(if_0) { }]); return 0+1; }]); } return 1;}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0) { var l0 = 0; var if_0 = 0; var e0 = 0; with (this) { l0 = __loop__.apply(this, [d0, function(i0,l0,d0,d1,d2) { node = __path__(root, o,0+1+l0+0,0,0); e0 = __link__(node, d0, d1); if_0 = __if__.apply(this, [d2, function(if_0) { }]); return 0+1; }]); } return 1;}) -} -, -"expandableStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var e0 = 0; with (this) { node = __path__(root, o); e0 = __link__(node, d0, d1); } return e0;}) -} -, -"expandedStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var e0 = 0; with (this) { node = __path__(root, o); e0 = __link__(node, d0, d1); } return e0;}) -} -, -"moreTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(VAR_label),"(",""); __loop__.apply(this, [elementIterator(context,node,CONST_Normal), __out__, function(element, __out__) { __code__.push("","","");__out__.push(onClick,context,element);__link__(element.tag, __code__, __out__, {"element":element,"node":element.node,"context":context}); __code__.push("","");__if__.apply(this, [element.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("","",")","",""); }}}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(VAR_label),"(","","","... ",__escape__(getElementCount(node))," ...","","",")","",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(VAR_label),"(",""); __loop__.apply(this, [elementIterator(context,node,CONST_Short), __out__, function(element, __out__) { __code__.push("","","");__link__(element.tag, __code__, __out__, {"element":element,"node":element.node,"context":context}); __code__.push("","");__if__.apply(this, [element.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("","",")","",""); }}}) -} -, -"expandableStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) {__link__(getTag(context,element,CONST_Collapsed), __code__, __out__, {"node":element.node,"context":context}); }}}) -} -, -"expandedStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) {__link__(tag, __code__, __out__, {"node":node,"context":context,"element":element}); }}}) -} -, -"moreTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("",""," ... ",""); }}}) -} -}; - rep.__dbid = "c8e051a0d8ba6235ed889e184aae731c7e813f48"; - rep.__dtid = "insight.domplate.reps/default/array"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("default/array.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/constant.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/constant.preview.htm deleted file mode 100644 index 577b4c2..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/constant.preview.htm +++ /dev/null @@ -1,16 +0,0 @@ - - - -

tag

- -Hello World - -
- -

shortTag

- -Hello World - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/constant.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/constant.rep.css deleted file mode 100644 index 0871cbe..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/constant.rep.css +++ /dev/null @@ -1,4 +0,0 @@ - -SPAN.constant[__dbid="3e909bde186a14516e0c86324d0f008fc71f2b2c"] { - color: #0000FF; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/constant.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/constant.rep.js deleted file mode 100644 index 2e3f164..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/constant.rep.js +++ /dev/null @@ -1,99 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i",__escape__(node.value),""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","",__escape__(node.value),""); }}}) -} -}; - rep.__dbid = "3e909bde186a14516e0c86324d0f008fc71f2b2c"; - rep.__dtid = "insight.domplate.reps/default/constant"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("default/constant.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/dictionary.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/dictionary.preview.htm deleted file mode 100644 index 3615324..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/dictionary.preview.htm +++ /dev/null @@ -1,40 +0,0 @@ - - - -

tag

- -dictionary(
key1:,
key2:
)
- -
- -

shortTag

- -dictionary(key1:,key2:) - -
- -

collapsedTag

- -dictionary() - -
- -

expandableStub

- - - -
- -

expandedStub

- - - -
- -

moreTag

- - ... - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/dictionary.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/dictionary.rep.css deleted file mode 100644 index e744920..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/dictionary.rep.css +++ /dev/null @@ -1,51 +0,0 @@ - -SPAN.dictionary[__dbid="91497e8f62a95c8946215eb31aaa2ffc2bf5cc84"] > SPAN { - color: #9C9C9C; -} - -SPAN.dictionary[__dbid="91497e8f62a95c8946215eb31aaa2ffc2bf5cc84"] > SPAN.collapsed { - color: #0000FF; - font-weight: normal; - padding-left: 5px; - padding-right: 5px; -} - -SPAN.dictionary[__dbid="91497e8f62a95c8946215eb31aaa2ffc2bf5cc84"] > SPAN.summary { - color: #0000FF; - font-weight: normal; - padding-left: 5px; - padding-right: 5px; -} - -SPAN.dictionary[__dbid="91497e8f62a95c8946215eb31aaa2ffc2bf5cc84"] > SPAN.member { - color: #9C9C9C; -} - -SPAN.dictionary[__dbid="91497e8f62a95c8946215eb31aaa2ffc2bf5cc84"] > DIV.member { - display: block; - padding-left: 20px; -} -SPAN.dictionary[__dbid="91497e8f62a95c8946215eb31aaa2ffc2bf5cc84"] > DIV.member.expandable { - background-image: url(images/twisty-closed.png); - background-repeat: no-repeat; - background-position: 6px 2px; - cursor: pointer; -} -SPAN.dictionary[__dbid="91497e8f62a95c8946215eb31aaa2ffc2bf5cc84"] > DIV.member.expandable.expanded { - background-image: url(images/twisty-open.png); -} - -SPAN.dictionary[__dbid="91497e8f62a95c8946215eb31aaa2ffc2bf5cc84"] > .member > SPAN.name { - color: #E59D07; - font-weight: normal; -} - -SPAN.dictionary[__dbid="91497e8f62a95c8946215eb31aaa2ffc2bf5cc84"] > .member > SPAN.value { - font-weight: normal; -} - -SPAN.dictionary[__dbid="91497e8f62a95c8946215eb31aaa2ffc2bf5cc84"] > .member > SPAN.delimiter, SPAN.dictionary > .member > SPAN.separator, SPAN.dictionary > .member SPAN.more { - color: #9C9C9C; - padding-left: 2px; - padding-right: 2px; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/dictionary.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/dictionary.rep.js deleted file mode 100644 index 3f5aed4..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/dictionary.rep.js +++ /dev/null @@ -1,353 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 1 && type == this.CONST_Short) { - member["tag"] = this.moreTag; - } else { - member["tag"] = this.getTag(context, member, type); - } - - members.push(member); - - if (members.length > 2 && type == this.CONST_Short) { - break; - } - } - - if (members.length > 0) { - members[members.length - 1]["more"] = false; - } - - return members; - }, - isExpandable: function isExpandable(node) { - return node.type == "reference" || node.type == "dictionary" || node.type == "map" || node.type == "array"; - }, - onClick: function onClick(event) { - if (!domplate.util.isLeftClick(event)) { - return; - } - - var row = domplate.util.getAncestorByClass(event.target, "member"); - - if (domplate.util.hasClass(row, "expandable")) { - if (this.toggleRow(row)) { - event.stopPropagation(); - } - } - }, - _isTagExpandable: function _isTagExpandable(tag) { - while (true) { - if (!tag.parentNode) { - return true; - } - - if (tag.getAttribute("allowTagExpand") === "false") { - return false; - } - - tag = tag.parentNode; - } - }, - toggleRow: function toggleRow(row) { - if (!this._isTagExpandable(row)) { - return false; - } - - var valueElement = domplate.util.getElementByClass(row, "value"); - - if (domplate.util.hasClass(row, "expanded")) { - domplate.util.removeClass(row, "expanded"); - this.expandedStub.replace({ - "tag": this.expandableStub, - "member": row.memberObject, - "node": row.memberObject.node, - "context": row.contextObject - }, valueElement); - } else { - domplate.util.setClass(row, "expanded"); - this.expandedStub.replace({ - "tag": row.contextObject.repForNode(row.memberObject.node).tag, - "member": row.memberObject, - "node": row.memberObject.node, - "context": row.contextObject - }, valueElement); - } - - return true; - } - }; -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0) { var l0 = 0; var if_0 = 0; var e0 = 0; with (this) { l0 = __loop__.apply(this, [d0, function(i0,l0,d0,d1,d2,d3,d4,d5) { node = __path__(root, o,0+1+l0+0);node.addEventListener("click", __bind__(this, d0), false);node.memberObject = d1;node.contextObject = d2; node = __path__(root, o,0+1+l0+0,0+1+1,0); e0 = __link__(node, d3, d4); if_0 = __if__.apply(this, [d5, function(if_0) { }]); return 0+1; }]); } return 1;}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0) { var l0 = 0; var if_0 = 0; var e0 = 0; with (this) { l0 = __loop__.apply(this, [d0, function(i0,l0,d0,d1,d2) { node = __path__(root, o,0+1+l0+0,0+1+1,0); e0 = __link__(node, d0, d1); if_0 = __if__.apply(this, [d2, function(if_0) { }]); return 0+1; }]); } return 1;}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -, -"expandableStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var e0 = 0; with (this) { node = __path__(root, o); e0 = __link__(node, d0, d1); } return e0;}) -} -, -"expandedStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var e0 = 0; with (this) { node = __path__(root, o); e0 = __link__(node, d0, d1); } return e0;}) -} -, -"moreTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(getLabel(node)),"(",""); __loop__.apply(this, [dictionaryIterator(context,node,CONST_Normal), __out__, function(member, __out__) { __code__.push("","","",__escape__(member.name),"","",":","","");__out__.push(onClick,member,context);__link__(member.tag, __code__, __out__, {"context":context,"node":member.node,"member":member}); __code__.push("","");__if__.apply(this, [member.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("","",")","",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(getLabel(node)),"(",""); __loop__.apply(this, [dictionaryIterator(context,node,CONST_Short), __out__, function(member, __out__) { __code__.push("","","",__escape__(member.name),"","",":","","");__link__(member.tag, __code__, __out__, {"context":context,"node":member.node,"member":member}); __code__.push("","");__if__.apply(this, [member.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("","",")","",""); }}}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(getLabel(node)),"(","","","... ",__escape__(getMemberCount(node))," ...","","",")","",""); }}}) -} -, -"expandableStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) {__link__(getTag(context,member,CONST_Collapsed), __code__, __out__, {"context":context,"node":member.node,"member":member}); }}}) -} -, -"expandedStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) {__link__(tag, __code__, __out__, {"context":context,"node":node,"member":member}); }}}) -} -, -"moreTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("",""," ... ",""); }}}) -} -}; - rep.__dbid = "91497e8f62a95c8946215eb31aaa2ffc2bf5cc84"; - rep.__dtid = "insight.domplate.reps/default/dictionary"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("default/dictionary.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/images/edit-rule.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/images/edit-rule.png deleted file mode 100644 index c1e3318..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/images/edit-rule.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/images/table.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/images/table.png deleted file mode 100644 index 2a61026..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/images/table.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/images/twisty-closed.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/images/twisty-closed.png deleted file mode 100644 index f80319b..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/images/twisty-closed.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/images/twisty-open.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/images/twisty-open.png deleted file mode 100644 index 8680124..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/images/twisty-open.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/map.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/map.preview.htm deleted file mode 100644 index 2a688a7..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/map.preview.htm +++ /dev/null @@ -1,28 +0,0 @@ - - - -

tag

- -map(
=>,
=>
)
- -
- -

shortTag

- -map(=>,=>) - -
- -

collapsedTag

- -map() - -
- -

moreTag

- - ... - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/map.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/map.rep.css deleted file mode 100644 index 423cdec..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/map.rep.css +++ /dev/null @@ -1,20 +0,0 @@ - -SPAN.map[__dbid="3dd180ce224195ebd5ae4041dd5384730e8c6534"] > SPAN { - color: #9C9C9C; - font-weight: bold; -} - -SPAN.map[__dbid="3dd180ce224195ebd5ae4041dd5384730e8c6534"] > DIV.pair { - display: block; - padding-left: 20px; -} - -SPAN.map[__dbid="3dd180ce224195ebd5ae4041dd5384730e8c6534"] > SPAN.pair { - padding-left: 2px; -} - -SPAN.map[__dbid="3dd180ce224195ebd5ae4041dd5384730e8c6534"] > .pair > SPAN.delimiter, SPAN.map > .pair > SPAN.separator { - color: #9C9C9C; - padding-left: 2px; - padding-right: 2px; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/map.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/map.rep.js deleted file mode 100644 index 626fc4e..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/map.rep.js +++ /dev/null @@ -1,293 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i"), T.SPAN({ - "class": "value", - "onclick": "$onClick", - "_nodeObject": "$pair.value.node", - "_contextObject": "$context", - "_expandable": "$pair.value.expandable" - }, T.TAG("$pair.value.tag", { - "node": "$pair.value.node", - "context": "$context" - })), T.IF("$pair.more", T.SPAN({ - "class": "separator" - }, ",")))), T.SPAN(")")), - shortTag: T.SPAN({ - "class": "map", - "_nodeObject": "$node" - }, T.SPAN("$VAR_label("), T.FOR("pair", "$context,$node,$CONST_Short|mapIterator", T.SPAN({ - "class": "pair" - }, T.TAG("$pair.key.tag", { - "node": "$pair.key.node", - "context": "$context" - }), T.SPAN({ - "class": "delimiter" - }, "=>"), T.SPAN({ - "class": "value", - "onclick": "$onClick", - "_nodeObject": "$pair.value.node", - "_contextObject": "$context", - "_expandable": "$pair.value.expandable" - }, T.TAG("$pair.value.tag", { - "node": "$pair.value.node", - "context": "$context" - })), T.IF("$pair.more", T.SPAN({ - "class": "separator" - }, ",")))), T.SPAN(")")), - collapsedTag: T.SPAN({ - "class": "map" - }, T.SPAN("$VAR_label("), T.SPAN({ - "class": "collapsed" - }, "... $node|getItemCount ..."), T.SPAN(")")), - moreTag: T.SPAN(" ... "), - getItemCount: function getItemCount(node) { - if (!node.value) return 0; - return node.value.length; - }, - onClick: function onClick(event) { - var row = domplate.util.getAncestorByClass(event.target, "value"); - - if (row.expandable) { - if (this.toggleRow(row)) { - event.stopPropagation(); - } - } - }, - isCollapsible: function isCollapsible(node) { - return node.type == "reference" || node.type == "dictionary" || node.type == "map" || node.type == "array"; - }, - getTag: function getTag(rep, type, node) { - if (node.meta && node.meta.collapsed) { - if (this.isCollapsible(node)) { - type = "collapsedTag"; - } else { - type = "shortTag"; - } - } - - if (typeof rep[type] === "undefined") { - if (type == "shortTag") { - return rep.tag; - } - - throw new Error("Rep does not have tag of type: " + type); - } - - return rep[type]; - }, - _isTagExpandable: function _isTagExpandable(tag) { - while (true) { - if (!tag.parentNode) { - return true; - } - - if (tag.getAttribute("allowTagExpand") === "false") { - return false; - } - - tag = tag.parentNode; - } - }, - toggleRow: function toggleRow(row) { - if (!this._isTagExpandable(row)) { - return false; - } - - var node = null; - - if (domplate.util.hasClass(row, "expanded")) { - node = this.collapsedTag.replace({ - "node": row.nodeObject, - "context": row.contextObject - }, row); - domplate.util.removeClass(row, "expanded"); - } else { - var valueRep = row.contextObject.repForNode(row.nodeObject).tag; - node = valueRep.replace({ - "node": row.nodeObject, - "context": row.contextObject - }, row); - domplate.util.setClass(row, "expanded"); - } - - return true; - }, - mapIterator: function mapIterator(context, node, type) { - var pairs = []; - if (!node.value) return pairs; - - for (var i = 0; i < node.value.length; i++) { - var valueRep = this.getTag(context.repForNode(node.value[i][1]), type, node.value[i][1]); - - if (i > 2 && type == this.CONST_Short) { - valueRep = this.moreTag; - } - - var pair = { - "key": { - "tag": this.getTag(context.repForNode(node.value[i][0]), type, node.value[i][0]), - "node": domplate.util.merge(node.value[i][0], { - "wrapped": true - }) - }, - "value": { - "tag": valueRep, - "node": domplate.util.merge(node.value[i][1], { - "wrapped": true - }), - "expandable": this.isCollapsible(node.value[i][1]) - }, - "more": i < node.value.length - 1 - }; - pairs.push(pair); - - if (i > 2 && type == this.CONST_Short) { - pairs[pairs.length - 1].more = false; - break; - } - } - - return pairs; - } - }; -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var l0 = 0; var if_0 = 0; var e0 = 0; var e1 = 0; with (this) { node = __path__(root, o);node.nodeObject = d0; l0 = __loop__.apply(this, [d1, function(i0,l0,d0,d1,d2,d3,d4,d5,d6,d7,d8) { node = __path__(root, o,0+1+l0+0,0); e0 = __link__(node, d0, d1); node = __path__(root, o,0+1+l0+0,0+e0+1);node.addEventListener("click", __bind__(this, d2), false);node.nodeObject = d3;node.contextObject = d4;node.expandable = d5; node = __path__(root, o,0+1+l0+0,0+e0+1,0); e1 = __link__(node, d6, d7); if_0 = __if__.apply(this, [d8, function(if_0) { }]); return 0+1; }]); } return 1;}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var l0 = 0; var if_0 = 0; var e0 = 0; var e1 = 0; with (this) { node = __path__(root, o);node.nodeObject = d0; l0 = __loop__.apply(this, [d1, function(i0,l0,d0,d1,d2,d3,d4,d5,d6,d7,d8) { node = __path__(root, o,0+1+l0+0,0); e0 = __link__(node, d0, d1); node = __path__(root, o,0+1+l0+0,0+e0+1);node.addEventListener("click", __bind__(this, d2), false);node.nodeObject = d3;node.contextObject = d4;node.expandable = d5; node = __path__(root, o,0+1+l0+0,0+e0+1,0); e1 = __link__(node, d6, d7); if_0 = __if__.apply(this, [d8, function(if_0) { }]); return 0+1; }]); } return 1;}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -, -"moreTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(VAR_label),"(","");__out__.push(node); __loop__.apply(this, [mapIterator(context,node,CONST_Normal), __out__, function(pair, __out__) { __code__.push("","");__link__(pair.key.tag, __code__, __out__, {"node":pair.key.node,"context":context}); __code__.push("","","=>","","");__out__.push(onClick,pair.value.node,context,pair.value.expandable);__link__(pair.value.tag, __code__, __out__, {"node":pair.value.node,"context":context}); __code__.push("","");__if__.apply(this, [pair.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("","",")","",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(VAR_label),"(","");__out__.push(node); __loop__.apply(this, [mapIterator(context,node,CONST_Short), __out__, function(pair, __out__) { __code__.push("","");__link__(pair.key.tag, __code__, __out__, {"node":pair.key.node,"context":context}); __code__.push("","","=>","","");__out__.push(onClick,pair.value.node,context,pair.value.expandable);__link__(pair.value.tag, __code__, __out__, {"node":pair.value.node,"context":context}); __code__.push("","");__if__.apply(this, [pair.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("","",")","",""); }}}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(VAR_label),"(","","","... ",__escape__(getItemCount(node))," ...","","",")","",""); }}}) -} -, -"moreTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("",""," ... ",""); }}}) -} -}; - rep.__dbid = "3dd180ce224195ebd5ae4041dd5384730e8c6534"; - rep.__dtid = "insight.domplate.reps/default/map"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("default/map.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/reference.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/reference.preview.htm deleted file mode 100644 index d9f8bc8..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/reference.preview.htm +++ /dev/null @@ -1,22 +0,0 @@ - - - -

tag

- - - -
- -

shortTag

- - - -
- -

collapsedTag

- - - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/reference.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/reference.rep.css deleted file mode 100644 index ec747fa..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/reference.rep.css +++ /dev/null @@ -1 +0,0 @@ -null \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/reference.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/reference.rep.js deleted file mode 100644 index db45380..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/reference.rep.js +++ /dev/null @@ -1,152 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i");__link__(getTag(context,node,CONST_Normal), __code__, __out__, {"context":context,"node":getInstanceNode(context,node)}); __code__.push("",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","");__link__(getTag(context,node,CONST_Collapsed), __code__, __out__, {"context":context,"node":getInstanceNode(context,node)}); __code__.push("",""); }}}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","");__link__(getTag(context,node,CONST_Collapsed), __code__, __out__, {"context":context,"node":getInstanceNode(context,node)}); __code__.push("",""); }}}) -} -}; - rep.__dbid = "485215d9752c351011a71bdfb2f63d02f1ffbc0b"; - rep.__dtid = "insight.domplate.reps/default/reference"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("default/reference.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/string.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/string.preview.htm deleted file mode 100644 index 7324bdd..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/string.preview.htm +++ /dev/null @@ -1,16 +0,0 @@ - - - -

tag

- -Hello World - -
- -

shortTag

- -Hello World - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/string.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/string.rep.css deleted file mode 100644 index 8b67b54..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/string.rep.css +++ /dev/null @@ -1,4 +0,0 @@ - -SPAN[__dbid="bc26bd236f1fdd412abbeac376be6d7301b0432e"] { - color: black; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/string.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/string.rep.js deleted file mode 100644 index e088844..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/string.rep.js +++ /dev/null @@ -1,129 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i limit) { - return this.escapeNewLines(text.substr(0, halfLimit) + "..." + text.substr(text.length - halfLimit)); - } else { - return this.escapeNewLines(text); - } - }, - escapeNewLines: function escapeNewLines(value) { - return value.replace(/\r/g, "\\r").replace(/\\n/g, "\\\n"); - }, - lineIterator: function lineIterator(value) { - var parts = ("" + value).replace(/\r/g, "\\r").split("\\n"); - var lines = []; - - for (var i = 0; i < parts.length; i++) { - lines.push({ - "value": parts[i], - "more": i < parts.length - 1 - }); - } - - return lines; - } - }; -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0) { var l0 = 0; var if_0 = 0; with (this) { l0 = __loop__.apply(this, [d0, function(i0,l0,d0) { if_0 = __if__.apply(this, [d0, function(if_0) { }]); return 0+1+d0; }]); } return 1;}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("",""); __loop__.apply(this, [lineIterator(node.value), __out__, function(line, __out__) { __code__.push("",__escape__(line.value));__if__.apply(this, [line.more, __out__, function(__out__) { __code__.push("","");}]); }]); __code__.push("",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","",__escape__(getValue(node)),""); }}}) -} -}; - rep.__dbid = "bc26bd236f1fdd412abbeac376be6d7301b0432e"; - rep.__dtid = "insight.domplate.reps/default/string"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("default/string.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/table.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/table.preview.htm deleted file mode 100644 index dc9aab8..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/table.preview.htm +++ /dev/null @@ -1,16 +0,0 @@ - - - -

tag

- -
- -
- -

shortTag

- - - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/table.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/table.rep.css deleted file mode 100644 index 34f5644..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/table.rep.css +++ /dev/null @@ -1,50 +0,0 @@ - -SPAN.table[__dbid="39ff1ebd3d2ba584e6cc7b584b5b45791c136b55"] { - background-image: url(images/table.png); - background-repeat: no-repeat; - background-position: 4px -1px; - padding-left: 25px; -} - -DIV.table[__dbid="39ff1ebd3d2ba584e6cc7b584b5b45791c136b55"] { - padding: 0px; - margin: 0px; -} - -DIV.table[__dbid="39ff1ebd3d2ba584e6cc7b584b5b45791c136b55"] TABLE { - border-bottom: 1px solid #D7D7D7; - border-right: 1px solid #D7D7D7; -} - -DIV.table[__dbid="39ff1ebd3d2ba584e6cc7b584b5b45791c136b55"] TABLE TBODY TR.hide { - display: none; -} - -DIV.table[__dbid="39ff1ebd3d2ba584e6cc7b584b5b45791c136b55"] TABLE TBODY TR TH.header { - vertical-align: top; - font-weight: bold; - text-align: center; - border: 1px solid #D7D7D7; - border-bottom: 0px; - border-right: 0px; - background-color: #ececec; - padding: 2px; - padding-left: 10px; - padding-right: 10px; -} - -DIV.table[__dbid="39ff1ebd3d2ba584e6cc7b584b5b45791c136b55"] TABLE TBODY TR TD.cell { - vertical-align: top; - padding-right: 10px; - border: 1px solid #D7D7D7; - border-bottom: 0px; - border-right: 0px; - padding: 2px; - padding-left: 10px; - padding-right: 10px; -} - -DIV.table[__dbid="39ff1ebd3d2ba584e6cc7b584b5b45791c136b55"] TABLE TBODY TR TD.cell:hover { - background-color: #ffc73d; - cursor: pointer; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/table.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/table.rep.js deleted file mode 100644 index 2369e6d..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/table.rep.js +++ /dev/null @@ -1,230 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i","","",""); __loop__.apply(this, [getHeaders(context,node), __out__, function(column, __out__) { __code__.push("","");__link__(column.tag, __code__, __out__, {"node":column.node}); __code__.push("",""); }]);__if__.apply(this, [hasNoHeader(node), __out__, function(__out__) { __code__.push("","","");}]); __code__.push("",""); __loop__.apply(this, [getRows(node), __out__, function(row, __out__) { __code__.push("",""); __loop__.apply(this, [getCells(context,row), __out__, function(cell, __out__) { __code__.push("","");__out__.push(onCellClick,cell.node);__link__(cell.tag, __code__, __out__, {"node":cell.node,"context":context}); __code__.push("",""); }]); __code__.push("",""); }]); __code__.push("","","",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","");__link__(getTitleTag(context,node), __code__, __out__, {"node":getTitleNode(node),"context":context}); __code__.push("",""); }}}) -} -}; - rep.__dbid = "39ff1ebd3d2ba584e6cc7b584b5b45791c136b55"; - rep.__dtid = "insight.domplate.reps/default/table"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("default/table.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trace.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trace.preview.htm deleted file mode 100644 index 2671d6b..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trace.preview.htm +++ /dev/null @@ -1,16 +0,0 @@ - - - -

tag

- -
FileLineInstruction
File ...10
Class(
,
)
File ...5
Function(
,
)
- -
- -

shortTag

- - - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trace.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trace.rep.css deleted file mode 100644 index a0d6c6a..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trace.rep.css +++ /dev/null @@ -1,82 +0,0 @@ - -SPAN.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] { - background-image: url(images/edit-rule.png); - background-repeat: no-repeat; - background-position: 4px 1px; - padding-left: 25px; - font-weight: bold; -} - -DIV.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] { - padding: 0px; - margin: 0px; -} - -DIV.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] TABLE { - border-bottom: 1px solid #D7D7D7; -} - -DIV.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] TABLE TBODY TR TH, DIV.structures-trace TABLE TBODY TR TD { - padding: 3px; - padding-left: 10px; - padding-right: 10px; -} - -DIV.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] TABLE TBODY TR TH.header-file { - white-space:nowrap; - font-weight: bold; - text-align: left; -} - -DIV.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] TABLE TBODY TR TH.header-line { - white-space:nowrap; - font-weight: bold; - text-align: right; -} -DIV.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] TABLE TBODY TR TH.header-inst { - white-space:nowrap; - font-weight: bold; - text-align: left; -} - -DIV.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] TABLE TBODY TR TD.cell-file { - vertical-align: top; - border: 1px solid #D7D7D7; - border-bottom: 0px; - border-right: 0px; -} -DIV.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] TABLE TBODY TR TD.cell-line { - white-space:nowrap; - vertical-align: top; - text-align: right; - border:1px solid #D7D7D7; - border-bottom: 0px; - border-right: 0px; -} -DIV.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] TABLE TBODY TR TD.cell-line[clickable="true"]:hover, DIV.structures-trace TABLE TBODY TR TD.cell-file[clickable="true"]:hover { - background-color: #ffc73d; - cursor: pointer; -} -DIV.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] TABLE TBODY TR TD.cell-inst { - vertical-align: top; - padding-left: 10px; - font-weight: bold; - border:1px solid #D7D7D7; - border-bottom: 0px; -} - -DIV.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] TABLE TBODY TR TD.cell-inst DIV.arg { - font-weight: normal; - padding-left: 3px; - padding-right: 3px; - display: inline-block; -} -DIV.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] TABLE TBODY TR TD.cell-inst DIV.arg:hover { - background-color: #ffc73d; - cursor: pointer; -} - -DIV.structures-trace[__dbid="02ce81bf834058ce5150d7be4d01e547baa84a2c"] TABLE TBODY TR TD.cell-inst .separator { - padding-left: 1px; - padding-right: 3px; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trace.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trace.rep.js deleted file mode 100644 index b1b90f3..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trace.rep.js +++ /dev/null @@ -1,302 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 2) { - if (file_shortest.length == file_original_length) { - file_shortest.pop(); - } - - file_shortest = file_shortest.join('/'); - - for (var i = 0; i < list.length; i++) { - list[i].file = '...' + list[i].file.substr(file_shortest.length); - } - } - } - } catch (e) {} - - return list; - } catch (err) { - console.error(err); - } - }, - getFrameLabel: function getFrameLabel(frame) { - try { - if (frame['class']) { - if (frame['type'] == 'throw') { - return 'throw ' + frame['class']; - } else if (frame['type'] == 'trigger') { - return 'trigger_error'; - } else { - return frame['class'] + frame['type'] + frame['function']; - } - } - - return frame['function']; - } catch (err) { - console.error(err); - } - }, - argIterator: function argIterator(context, frame) { - try { - if (!frame.args) { - return []; - } - - var items = []; - - for (var i = 0; i < frame.args.length; i++) { - var item = { - "node": domplate.util.merge(frame.args[i], { - "wrapped": true - }), - "tag": context.repForNode(frame.args[i]).shortTag, - "more": i < frame.args.length - 1 - }; - items.push(item); - } - - return items; - } catch (err) { - console.error(err); - } - }, - _getMasterRow: function _getMasterRow(row) { - while (true) { - if (!row.parentNode) { - return null; - } - - if (domplate.util.hasClass(row, "console-message")) { - break; - } - - row = row.parentNode; - } - - return row; - } - }; -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var l0 = 0; var l1 = 0; var if_0 = 0; var e0 = 0; with (this) { node = __path__(root, o);node.templateObject = _getTemplateObject(d0); l0 = __loop__.apply(this, [d1, function(i0,l0,d0,d1,d2,d3) { node = __path__(root, o,0,0,0+1+l0+0);node.frameNodeObj = d0; node = __path__(root, o,0,0,0+1+l0+0,0);node.addEventListener("click", __bind__(this, d1), false); node = __path__(root, o,0,0,0+1+l0+0,0+1);node.addEventListener("click", __bind__(this, d2), false); l1 = __loop__.apply(this, [d3, function(i1,l1,d0,d1,d2,d3,d4) { node = __path__(root, o,0,0,0+1+l0+0,0+1+1,0,0+1+l1+0);node.addEventListener("click", __bind__(this, d0), false);node.argNodeObj = d1; node = __path__(root, o,0,0,0+1+l0+0,0+1+1,0,0+1+l1+0,0); e0 = __link__(node, d2, d3); if_0 = __if__.apply(this, [d4, function(if_0) { }]); return 0+1; }]); return 0+1; }]); } return 1;}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1, d2) { var e0 = 0; with (this) { node = __path__(root, o);node.templateObject = _getTemplateObject(d0); node = __path__(root, o,0); e0 = __link__(node, d1, d2); } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","","","","","File","","","Line","","","Instruction","","");__out__.push(node); __loop__.apply(this, [getCallList(node), __out__, function(frame, __out__) { __code__.push("","","",__escape__(frame.file),"","",__escape__(frame.line),"","","",__escape__(getFrameLabel(frame)),"(");__out__.push(frame.node,onFileClick,onFileClick); __loop__.apply(this, [argIterator(context,frame), __out__, function(arg, __out__) { __code__.push("","");__out__.push(onArgClick,arg.node);__link__(arg.tag, __code__, __out__, {"node":arg.node,"context":context});__if__.apply(this, [arg.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("",")","","",""); }]); __code__.push("","","",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","");__out__.push(node);__link__(getCaptionTag(context,node), __code__, __out__, {"node":getCaptionNode(node)}); __code__.push("",""); }}}) -} -}; - rep.__dbid = "02ce81bf834058ce5150d7be4d01e547baa84a2c"; - rep.__dtid = "insight.domplate.reps/default/trace"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("default/trace.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trimmed.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trimmed.preview.htm deleted file mode 100644 index c3d24e9..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trimmed.preview.htm +++ /dev/null @@ -1,16 +0,0 @@ - - - -

tag

- -Trimmed! - -
- -

collapsedTag

- -Trimmed! - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trimmed.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trimmed.rep.css deleted file mode 100644 index eb294a5..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trimmed.rep.css +++ /dev/null @@ -1,7 +0,0 @@ - -SPAN.trimmed[__dbid="5ee0a11f1b7ce8d99318df96e48d8aae775a3482"] { - color: #FFFFFF; - background-color: blue; - padding-left: 5px; - padding-right: 5px; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trimmed.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trimmed.rep.js deleted file mode 100644 index c71eeb5..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/trimmed.rep.js +++ /dev/null @@ -1,102 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i",__escape__(getNotice(node)),""); }}}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","",__escape__(getNotice(node)),""); }}}) -} -}; - rep.__dbid = "5ee0a11f1b7ce8d99318df96e48d8aae775a3482"; - rep.__dtid = "insight.domplate.reps/default/trimmed"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("default/trimmed.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/unknown.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/unknown.preview.htm deleted file mode 100644 index bbff65e..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/unknown.preview.htm +++ /dev/null @@ -1,16 +0,0 @@ - - - -

tag

- -Hello World - -
- -

shortTag

- -Hello World - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/unknown.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/unknown.rep.css deleted file mode 100644 index b6c9e55..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/unknown.rep.css +++ /dev/null @@ -1,5 +0,0 @@ - -SPAN.unknown[__dbid="28f0cad32e3f8c4b4123b834007ba004ed6057b2"] { - color: #FFFFFF; - background-color: red; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/unknown.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/unknown.rep.js deleted file mode 100644 index 4db214e..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/default/unknown.rep.js +++ /dev/null @@ -1,99 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i",__escape__(node.value),""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","",__escape__(node.value),""); }}}) -} -}; - rep.__dbid = "28f0cad32e3f8c4b4123b834007ba004ed6057b2"; - rep.__dtid = "insight.domplate.reps/default/unknown"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("default/unknown.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-associative.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-associative.preview.htm deleted file mode 100644 index 0071d2e..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-associative.preview.htm +++ /dev/null @@ -1,28 +0,0 @@ - - - -

tag

- -map(
=>,
=>
)
- -
- -

shortTag

- -map(=>,=>) - -
- -

collapsedTag

- -map() - -
- -

moreTag

- - ... - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-associative.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-associative.rep.css deleted file mode 100644 index 448a23a..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-associative.rep.css +++ /dev/null @@ -1,30 +0,0 @@ - -SPAN.map[__dbid="4a95f694649c73f58a7f6356cfd1437e0be74823"] > SPAN { - color: #9C9C9C; - font-weight: bold; -} - -SPAN.map[__dbid="4a95f694649c73f58a7f6356cfd1437e0be74823"] > DIV.pair { - display: block; - padding-left: 20px; -} - -SPAN.map[__dbid="4a95f694649c73f58a7f6356cfd1437e0be74823"] > SPAN.pair { - padding-left: 2px; -} - -SPAN.map[__dbid="4a95f694649c73f58a7f6356cfd1437e0be74823"] > .pair > SPAN.delimiter, SPAN.map > .pair > SPAN.separator { - color: #9C9C9C; - padding-left: 2px; - padding-right: 2px; -} - - -SPAN.map[__dbid="4a95f694649c73f58a7f6356cfd1437e0be74823"] > SPAN { - color: green; - font-weight: normal; -} - -SPAN.map[__dbid="4a95f694649c73f58a7f6356cfd1437e0be74823"] > .pair > SPAN.delimiter, SPAN.map > .pair > SPAN.separator { - color: green; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-associative.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-associative.rep.js deleted file mode 100644 index 6f638b2..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-associative.rep.js +++ /dev/null @@ -1,293 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i"), T.SPAN({ - "class": "value", - "onclick": "$onClick", - "_nodeObject": "$pair.value.node", - "_contextObject": "$context", - "_expandable": "$pair.value.expandable" - }, T.TAG("$pair.value.tag", { - "node": "$pair.value.node", - "context": "$context" - })), T.IF("$pair.more", T.SPAN({ - "class": "separator" - }, ",")))), T.SPAN(")")), - shortTag: T.SPAN({ - "class": "map", - "_nodeObject": "$node" - }, T.SPAN("$VAR_label("), T.FOR("pair", "$context,$node,$CONST_Short|mapIterator", T.SPAN({ - "class": "pair" - }, T.TAG("$pair.key.tag", { - "node": "$pair.key.node", - "context": "$context" - }), T.SPAN({ - "class": "delimiter" - }, "=>"), T.SPAN({ - "class": "value", - "onclick": "$onClick", - "_nodeObject": "$pair.value.node", - "_contextObject": "$context", - "_expandable": "$pair.value.expandable" - }, T.TAG("$pair.value.tag", { - "node": "$pair.value.node", - "context": "$context" - })), T.IF("$pair.more", T.SPAN({ - "class": "separator" - }, ",")))), T.SPAN(")")), - collapsedTag: T.SPAN({ - "class": "map" - }, T.SPAN("$VAR_label("), T.SPAN({ - "class": "collapsed" - }, "... $node|getItemCount ..."), T.SPAN(")")), - moreTag: T.SPAN(" ... "), - getItemCount: function getItemCount(node) { - if (!node.value) return 0; - return node.value.length; - }, - onClick: function onClick(event) { - var row = domplate.util.getAncestorByClass(event.target, "value"); - - if (row.expandable) { - if (this.toggleRow(row)) { - event.stopPropagation(); - } - } - }, - isCollapsible: function isCollapsible(node) { - return node.type == "reference" || node.type == "dictionary" || node.type == "map" || node.type == "array"; - }, - getTag: function getTag(rep, type, node) { - if (node.meta && node.meta.collapsed) { - if (this.isCollapsible(node)) { - type = "collapsedTag"; - } else { - type = "shortTag"; - } - } - - if (typeof rep[type] === "undefined") { - if (type == "shortTag") { - return rep.tag; - } - - throw new Error("Rep does not have tag of type: " + type); - } - - return rep[type]; - }, - _isTagExpandable: function _isTagExpandable(tag) { - while (true) { - if (!tag.parentNode) { - return true; - } - - if (tag.getAttribute("allowTagExpand") === "false") { - return false; - } - - tag = tag.parentNode; - } - }, - toggleRow: function toggleRow(row) { - if (!this._isTagExpandable(row)) { - return false; - } - - var node = null; - - if (domplate.util.hasClass(row, "expanded")) { - node = this.collapsedTag.replace({ - "node": row.nodeObject, - "context": row.contextObject - }, row); - domplate.util.removeClass(row, "expanded"); - } else { - var valueRep = row.contextObject.repForNode(row.nodeObject).tag; - node = valueRep.replace({ - "node": row.nodeObject, - "context": row.contextObject - }, row); - domplate.util.setClass(row, "expanded"); - } - - return true; - }, - mapIterator: function mapIterator(context, node, type) { - var pairs = []; - if (!node.value) return pairs; - - for (var i = 0; i < node.value.length; i++) { - var valueRep = this.getTag(context.repForNode(node.value[i][1]), type, node.value[i][1]); - - if (i > 2 && type == this.CONST_Short) { - valueRep = this.moreTag; - } - - var pair = { - "key": { - "tag": this.getTag(context.repForNode(node.value[i][0]), type, node.value[i][0]), - "node": domplate.util.merge(node.value[i][0], { - "wrapped": true - }) - }, - "value": { - "tag": valueRep, - "node": domplate.util.merge(node.value[i][1], { - "wrapped": true - }), - "expandable": this.isCollapsible(node.value[i][1]) - }, - "more": i < node.value.length - 1 - }; - pairs.push(pair); - - if (i > 2 && type == this.CONST_Short) { - pairs[pairs.length - 1].more = false; - break; - } - } - - return pairs; - } - }; -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var l0 = 0; var if_0 = 0; var e0 = 0; var e1 = 0; with (this) { node = __path__(root, o);node.nodeObject = d0; l0 = __loop__.apply(this, [d1, function(i0,l0,d0,d1,d2,d3,d4,d5,d6,d7,d8) { node = __path__(root, o,0+1+l0+0,0); e0 = __link__(node, d0, d1); node = __path__(root, o,0+1+l0+0,0+e0+1);node.addEventListener("click", __bind__(this, d2), false);node.nodeObject = d3;node.contextObject = d4;node.expandable = d5; node = __path__(root, o,0+1+l0+0,0+e0+1,0); e1 = __link__(node, d6, d7); if_0 = __if__.apply(this, [d8, function(if_0) { }]); return 0+1; }]); } return 1;}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var l0 = 0; var if_0 = 0; var e0 = 0; var e1 = 0; with (this) { node = __path__(root, o);node.nodeObject = d0; l0 = __loop__.apply(this, [d1, function(i0,l0,d0,d1,d2,d3,d4,d5,d6,d7,d8) { node = __path__(root, o,0+1+l0+0,0); e0 = __link__(node, d0, d1); node = __path__(root, o,0+1+l0+0,0+e0+1);node.addEventListener("click", __bind__(this, d2), false);node.nodeObject = d3;node.contextObject = d4;node.expandable = d5; node = __path__(root, o,0+1+l0+0,0+e0+1,0); e1 = __link__(node, d6, d7); if_0 = __if__.apply(this, [d8, function(if_0) { }]); return 0+1; }]); } return 1;}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -, -"moreTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(VAR_label),"(","");__out__.push(node); __loop__.apply(this, [mapIterator(context,node,CONST_Normal), __out__, function(pair, __out__) { __code__.push("","");__link__(pair.key.tag, __code__, __out__, {"node":pair.key.node,"context":context}); __code__.push("","","=>","","");__out__.push(onClick,pair.value.node,context,pair.value.expandable);__link__(pair.value.tag, __code__, __out__, {"node":pair.value.node,"context":context}); __code__.push("","");__if__.apply(this, [pair.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("","",")","",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(VAR_label),"(","");__out__.push(node); __loop__.apply(this, [mapIterator(context,node,CONST_Short), __out__, function(pair, __out__) { __code__.push("","");__link__(pair.key.tag, __code__, __out__, {"node":pair.key.node,"context":context}); __code__.push("","","=>","","");__out__.push(onClick,pair.value.node,context,pair.value.expandable);__link__(pair.value.tag, __code__, __out__, {"node":pair.value.node,"context":context}); __code__.push("","");__if__.apply(this, [pair.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("","",")","",""); }}}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(VAR_label),"(","","","... ",__escape__(getItemCount(node))," ...","","",")","",""); }}}) -} -, -"moreTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("",""," ... ",""); }}}) -} -}; - rep.__dbid = "4a95f694649c73f58a7f6356cfd1437e0be74823"; - rep.__dtid = "insight.domplate.reps/php/array-associative"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("php/array-associative.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-indexed.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-indexed.preview.htm deleted file mode 100644 index f2d43d2..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-indexed.preview.htm +++ /dev/null @@ -1,40 +0,0 @@ - - - -

tag

- -array(
,
)
- -
- -

collapsedTag

- -array() - -
- -

shortTag

- -array(,) - -
- -

expandableStub

- - - -
- -

expandedStub

- - - -
- -

moreTag

- - ... - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-indexed.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-indexed.rep.css deleted file mode 100644 index b1ecdbc..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-indexed.rep.css +++ /dev/null @@ -1,55 +0,0 @@ - -SPAN.array[__dbid="e7edf46c5cf053a32cad8a256bef09bba0a1db61"] > SPAN { - color: #9C9C9C; - font-weight: bold; -} - -SPAN.array[__dbid="e7edf46c5cf053a32cad8a256bef09bba0a1db61"] > SPAN.collapsed { - color: #0000FF; - font-weight: normal; - padding-left: 5px; - padding-right: 5px; -} - -SPAN.array[__dbid="e7edf46c5cf053a32cad8a256bef09bba0a1db61"] > SPAN.summary { - color: #0000FF; - font-weight: normal; - padding-left: 5px; - padding-right: 5px; -} - -SPAN.array[__dbid="e7edf46c5cf053a32cad8a256bef09bba0a1db61"] > DIV.element { - display: block; - padding-left: 20px; -} - -SPAN.array[__dbid="e7edf46c5cf053a32cad8a256bef09bba0a1db61"] > SPAN.element { - padding-left: 2px; -} - -SPAN.array[__dbid="e7edf46c5cf053a32cad8a256bef09bba0a1db61"] > DIV.element.expandable { - background-image: url(images/twisty-closed.png); - background-repeat: no-repeat; - background-position: 6px 2px; - cursor: pointer; -} -SPAN.array[__dbid="e7edf46c5cf053a32cad8a256bef09bba0a1db61"] > DIV.element.expandable.expanded { - background-image: url(images/twisty-open.png); -} - -SPAN.array[__dbid="e7edf46c5cf053a32cad8a256bef09bba0a1db61"] > .element > SPAN.value { -} - -SPAN.array[__dbid="e7edf46c5cf053a32cad8a256bef09bba0a1db61"] > .element > SPAN.separator { - color: #9C9C9C; -} - - -SPAN.array[__dbid="e7edf46c5cf053a32cad8a256bef09bba0a1db61"] > SPAN { - color: green; - font-weight: normal; -} - -SPAN.array[__dbid="e7edf46c5cf053a32cad8a256bef09bba0a1db61"] > .element > SPAN.separator { - color: green; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-indexed.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-indexed.rep.js deleted file mode 100644 index 1325414..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/array-indexed.rep.js +++ /dev/null @@ -1,308 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 2 && type == this.CONST_Short) { - element["tag"] = this.moreTag; - } else { - element["tag"] = this.getTag(context, element, type); - } - - elements.push(element); - - if (i > 2 && type == this.CONST_Short) { - elements[elements.length - 1].more = false; - break; - } - } - - return elements; - }, - isExpandable: function isExpandable(node) { - return node.type == "reference" || node.type == "dictionary" || node.type == "map" || node.type == "array"; - }, - onClick: function onClick(event) { - if (!domplate.util.isLeftClick(event)) { - return; - } - - var row = domplate.util.getAncestorByClass(event.target, "element"); - - if (domplate.util.hasClass(row, "expandable")) { - this.toggleRow(row); - } - - event.stopPropagation(); - }, - toggleRow: function toggleRow(row) { - var valueElement = domplate.util.getElementByClass(row, "value"); - - if (domplate.util.hasClass(row, "expanded")) { - domplate.util.removeClass(row, "expanded"); - this.expandedStub.replace({ - "tag": this.expandableStub, - "element": row.elementObject, - "context": row.contextObject, - "node": row.elementObject.node - }, valueElement); - } else { - domplate.util.setClass(row, "expanded"); - var rep = row.contextObject.repForNode(row.elementObject.node); - this.expandedStub.replace({ - "tag": rep.tag, - "element": row.elementObject, - "context": row.contextObject, - "node": row.elementObject.node - }, valueElement); - } - } - }; -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0) { var l0 = 0; var if_0 = 0; var e0 = 0; with (this) { l0 = __loop__.apply(this, [d0, function(i0,l0,d0,d1,d2,d3,d4,d5) { node = __path__(root, o,0+1+l0+0);node.addEventListener("click", __bind__(this, d0), false);node.contextObject = d1;node.elementObject = d2; node = __path__(root, o,0+1+l0+0,0,0); e0 = __link__(node, d3, d4); if_0 = __if__.apply(this, [d5, function(if_0) { }]); return 0+1; }]); } return 1;}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0) { var l0 = 0; var if_0 = 0; var e0 = 0; with (this) { l0 = __loop__.apply(this, [d0, function(i0,l0,d0,d1,d2) { node = __path__(root, o,0+1+l0+0,0,0); e0 = __link__(node, d0, d1); if_0 = __if__.apply(this, [d2, function(if_0) { }]); return 0+1; }]); } return 1;}) -} -, -"expandableStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var e0 = 0; with (this) { node = __path__(root, o); e0 = __link__(node, d0, d1); } return e0;}) -} -, -"expandedStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var e0 = 0; with (this) { node = __path__(root, o); e0 = __link__(node, d0, d1); } return e0;}) -} -, -"moreTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(VAR_label),"(",""); __loop__.apply(this, [elementIterator(context,node,CONST_Normal), __out__, function(element, __out__) { __code__.push("","","");__out__.push(onClick,context,element);__link__(element.tag, __code__, __out__, {"element":element,"node":element.node,"context":context}); __code__.push("","");__if__.apply(this, [element.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("","",")","",""); }}}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(VAR_label),"(","","","... ",__escape__(getElementCount(node))," ...","","",")","",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(VAR_label),"(",""); __loop__.apply(this, [elementIterator(context,node,CONST_Short), __out__, function(element, __out__) { __code__.push("","","");__link__(element.tag, __code__, __out__, {"element":element,"node":element.node,"context":context}); __code__.push("","");__if__.apply(this, [element.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("","",")","",""); }}}) -} -, -"expandableStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) {__link__(getTag(context,element,CONST_Collapsed), __code__, __out__, {"node":element.node,"context":context}); }}}) -} -, -"expandedStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) {__link__(tag, __code__, __out__, {"node":node,"context":context,"element":element}); }}}) -} -, -"moreTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("",""," ... ",""); }}}) -} -}; - rep.__dbid = "e7edf46c5cf053a32cad8a256bef09bba0a1db61"; - rep.__dtid = "insight.domplate.reps/php/array-indexed"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("php/array-indexed.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/boolean.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/boolean.preview.htm deleted file mode 100644 index 25fa5f6..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/boolean.preview.htm +++ /dev/null @@ -1,16 +0,0 @@ - - - -

tag

- -TRUE - -
- -

shortTag

- -TRUE - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/boolean.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/boolean.rep.css deleted file mode 100644 index a8fb744..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/boolean.rep.css +++ /dev/null @@ -1,4 +0,0 @@ - -SPAN.boolean[__dbid="07daf9a04792322a3256378f92d6af6c8f0f23b8"] { - color: navy; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/boolean.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/boolean.rep.js deleted file mode 100644 index 6dcde6a..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/boolean.rep.js +++ /dev/null @@ -1,102 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i",__escape__(getValue(node)),""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","",__escape__(getValue(node)),""); }}}) -} -}; - rep.__dbid = "07daf9a04792322a3256378f92d6af6c8f0f23b8"; - rep.__dtid = "insight.domplate.reps/php/boolean"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("php/boolean.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/exception.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/exception.preview.htm deleted file mode 100644 index a560e9c..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/exception.preview.htm +++ /dev/null @@ -1,16 +0,0 @@ - - - -

tag

- -
FileLineInstruction
File ...10
Class(
,
)
File ...5
Function(
,
)
- -
- -

shortTag

- - - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/exception.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/exception.rep.css deleted file mode 100644 index 5b90996..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/exception.rep.css +++ /dev/null @@ -1,83 +0,0 @@ - -SPAN.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] { - background-image: url(images/edit-rule.png); - background-repeat: no-repeat; - background-position: 4px 1px; - padding-left: 25px; - font-weight: bold; -} - -DIV.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] { - padding: 0px; - margin: 0px; -} - -DIV.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] TABLE { - border-bottom: 1px solid #D7D7D7; -} - -DIV.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] TABLE TBODY TR TH, DIV.structures-trace TABLE TBODY TR TD { - padding: 3px; - padding-left: 10px; - padding-right: 10px; -} - -DIV.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] TABLE TBODY TR TH.header-file { - white-space:nowrap; - font-weight: bold; - text-align: left; -} - -DIV.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] TABLE TBODY TR TH.header-line { - white-space:nowrap; - font-weight: bold; - text-align: right; -} -DIV.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] TABLE TBODY TR TH.header-inst { - white-space:nowrap; - font-weight: bold; - text-align: left; -} - -DIV.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] TABLE TBODY TR TD.cell-file { - vertical-align: top; - border: 1px solid #D7D7D7; - border-bottom: 0px; - border-right: 0px; -} -DIV.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] TABLE TBODY TR TD.cell-line { - white-space:nowrap; - vertical-align: top; - text-align: right; - border:1px solid #D7D7D7; - border-bottom: 0px; - border-right: 0px; -} -DIV.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] TABLE TBODY TR TD.cell-line[clickable="true"]:hover, DIV.structures-trace TABLE TBODY TR TD.cell-file[clickable="true"]:hover { - background-color: #ffc73d; - cursor: pointer; -} -DIV.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] TABLE TBODY TR TD.cell-inst { - vertical-align: top; - padding-left: 10px; - font-weight: bold; - border:1px solid #D7D7D7; - border-bottom: 0px; -} - -DIV.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] TABLE TBODY TR TD.cell-inst DIV.arg { - font-weight: normal; - padding-left: 3px; - padding-right: 3px; - display: inline-block; -} -DIV.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] TABLE TBODY TR TD.cell-inst DIV.arg:hover { - background-color: #ffc73d; - cursor: pointer; -} - -DIV.structures-trace[__dbid="900280dccb9220e71264efb50a24debff867f7f3"] TABLE TBODY TR TD.cell-inst .separator { - padding-left: 1px; - padding-right: 3px; -} - diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/exception.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/exception.rep.js deleted file mode 100644 index e0a2859..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/exception.rep.js +++ /dev/null @@ -1,302 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 2) { - if (file_shortest.length == file_original_length) { - file_shortest.pop(); - } - - file_shortest = file_shortest.join('/'); - - for (var i = 0; i < list.length; i++) { - list[i].file = '...' + list[i].file.substr(file_shortest.length); - } - } - } - } catch (e) {} - - return list; - } catch (err) { - console.error(err); - } - }, - getFrameLabel: function getFrameLabel(frame) { - try { - if (frame['class']) { - if (frame['type'] == 'throw') { - return 'throw ' + frame['class']; - } else if (frame['type'] == 'trigger') { - return 'trigger_error'; - } else { - return frame['class'] + frame['type'] + frame['function']; - } - } - - return frame['function']; - } catch (err) { - console.error(err); - } - }, - argIterator: function argIterator(context, frame) { - try { - if (!frame.args) { - return []; - } - - var items = []; - - for (var i = 0; i < frame.args.length; i++) { - var item = { - "node": domplate.util.merge(frame.args[i], { - "wrapped": true - }), - "tag": context.repForNode(frame.args[i]).shortTag, - "more": i < frame.args.length - 1 - }; - items.push(item); - } - - return items; - } catch (err) { - console.error(err); - } - }, - _getMasterRow: function _getMasterRow(row) { - while (true) { - if (!row.parentNode) { - return null; - } - - if (domplate.util.hasClass(row, "console-message")) { - break; - } - - row = row.parentNode; - } - - return row; - } - }; -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var l0 = 0; var l1 = 0; var if_0 = 0; var e0 = 0; with (this) { node = __path__(root, o);node.templateObject = _getTemplateObject(d0); l0 = __loop__.apply(this, [d1, function(i0,l0,d0,d1,d2,d3) { node = __path__(root, o,0,0,0+1+l0+0);node.frameNodeObj = d0; node = __path__(root, o,0,0,0+1+l0+0,0);node.addEventListener("click", __bind__(this, d1), false); node = __path__(root, o,0,0,0+1+l0+0,0+1);node.addEventListener("click", __bind__(this, d2), false); l1 = __loop__.apply(this, [d3, function(i1,l1,d0,d1,d2,d3,d4) { node = __path__(root, o,0,0,0+1+l0+0,0+1+1,0,0+1+l1+0);node.addEventListener("click", __bind__(this, d0), false);node.argNodeObj = d1; node = __path__(root, o,0,0,0+1+l0+0,0+1+1,0,0+1+l1+0,0); e0 = __link__(node, d2, d3); if_0 = __if__.apply(this, [d4, function(if_0) { }]); return 0+1; }]); return 0+1; }]); } return 1;}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1, d2) { var e0 = 0; with (this) { node = __path__(root, o);node.templateObject = _getTemplateObject(d0); node = __path__(root, o,0); e0 = __link__(node, d1, d2); } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","","","","","File","","","Line","","","Instruction","","");__out__.push(node); __loop__.apply(this, [getCallList(node), __out__, function(frame, __out__) { __code__.push("","","",__escape__(frame.file),"","",__escape__(frame.line),"","","",__escape__(getFrameLabel(frame)),"(");__out__.push(frame.node,onFileClick,onFileClick); __loop__.apply(this, [argIterator(context,frame), __out__, function(arg, __out__) { __code__.push("","");__out__.push(onArgClick,arg.node);__link__(arg.tag, __code__, __out__, {"node":arg.node,"context":context});__if__.apply(this, [arg.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("",")","","",""); }]); __code__.push("","","",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","");__out__.push(node);__link__(getCaptionTag(context,node), __code__, __out__, {"node":getCaptionNode(node)}); __code__.push("",""); }}}) -} -}; - rep.__dbid = "900280dccb9220e71264efb50a24debff867f7f3"; - rep.__dtid = "insight.domplate.reps/php/exception"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("php/exception.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/float.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/float.preview.htm deleted file mode 100644 index 318ddeb..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/float.preview.htm +++ /dev/null @@ -1,16 +0,0 @@ - - - -

tag

- -1.1 - -
- -

shortTag

- -1.1 - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/float.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/float.rep.css deleted file mode 100644 index 0d97717..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/float.rep.css +++ /dev/null @@ -1,4 +0,0 @@ - -SPAN.float[__dbid="f0137b4e5003190e0ca62ea1c5350bfa1f3eb570"] { - color: green; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/float.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/float.rep.js deleted file mode 100644 index ebab717..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/float.rep.js +++ /dev/null @@ -1,115 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 1 ? '.' + x[1] : ''; - var rgx = /(\d+)(\d{3})/; - - while (rgx.test(x1)) { - x1 = x1.replace(rgx, '$1' + ',' + '$2'); - } - - return x1 + x2; - } - }; -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","",__escape__(getValue(node)),""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","",__escape__(getValue(node)),""); }}}) -} -}; - rep.__dbid = "f0137b4e5003190e0ca62ea1c5350bfa1f3eb570"; - rep.__dtid = "insight.domplate.reps/php/float"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("php/float.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/images/edit-rule.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/images/edit-rule.png deleted file mode 100644 index c1e3318..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/images/edit-rule.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/images/object-member-visibility-sprite.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/images/object-member-visibility-sprite.png deleted file mode 100644 index 9dbd6ff..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/images/object-member-visibility-sprite.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/images/twisty-closed.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/images/twisty-closed.png deleted file mode 100644 index f80319b..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/images/twisty-closed.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/images/twisty-open.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/images/twisty-open.png deleted file mode 100644 index 8680124..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/images/twisty-open.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/integer.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/integer.preview.htm deleted file mode 100644 index 473da89..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/integer.preview.htm +++ /dev/null @@ -1,16 +0,0 @@ - - - -

tag

- -1000 - -
- -

shortTag

- -1000 - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/integer.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/integer.rep.css deleted file mode 100644 index 1940778..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/integer.rep.css +++ /dev/null @@ -1,4 +0,0 @@ - -SPAN.integer[__dbid="5ed341c51e0e5ac9d3dc49339a6e69b8d999d256"] { - color: green; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/integer.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/integer.rep.js deleted file mode 100644 index 718e93f..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/integer.rep.js +++ /dev/null @@ -1,115 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 1 ? '.' + x[1] : ''; - var rgx = /(\d+)(\d{3})/; - - while (rgx.test(x1)) { - x1 = x1.replace(rgx, '$1' + ',' + '$2'); - } - - return x1 + x2; - } - }; -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","",__escape__(getValue(node)),""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","",__escape__(getValue(node)),""); }}}) -} -}; - rep.__dbid = "5ed341c51e0e5ac9d3dc49339a6e69b8d999d256"; - rep.__dtid = "insight.domplate.reps/php/integer"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("php/integer.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/null.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/null.preview.htm deleted file mode 100644 index 6ed3344..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/null.preview.htm +++ /dev/null @@ -1,16 +0,0 @@ - - - -

tag

- -NULL - -
- -

shortTag

- -NULL - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/null.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/null.rep.css deleted file mode 100644 index 35651bf..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/null.rep.css +++ /dev/null @@ -1,4 +0,0 @@ - -SPAN.null[__dbid="a255b796936893a5df535a7e12b22d5a662ea2a2"] { - color: navy; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/null.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/null.rep.js deleted file mode 100644 index 47e3f4c..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/null.rep.js +++ /dev/null @@ -1,102 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i",__escape__(getValue(node)),""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","",__escape__(getValue(node)),""); }}}) -} -}; - rep.__dbid = "a255b796936893a5df535a7e12b22d5a662ea2a2"; - rep.__dtid = "insight.domplate.reps/php/null"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("php/null.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/object.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/object.preview.htm deleted file mode 100644 index 1688447..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/object.preview.htm +++ /dev/null @@ -1,40 +0,0 @@ - - - -

tag

- -Foo(
key1:,
key2:
)
- -
- -

shortTag

- -Foo(key1:,key2:) - -
- -

collapsedTag

- -Foo() - -
- -

expandableStub

- - - -
- -

expandedStub

- - - -
- -

moreTag

- - ... - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/object.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/object.rep.css deleted file mode 100644 index 88eadf5..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/object.rep.css +++ /dev/null @@ -1,92 +0,0 @@ - -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > SPAN { - color: #9C9C9C; -} - -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > SPAN.collapsed { - color: #0000FF; - font-weight: normal; - padding-left: 5px; - padding-right: 5px; -} - -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > SPAN.summary { - color: #0000FF; - font-weight: normal; - padding-left: 5px; - padding-right: 5px; -} - -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > SPAN.member { - color: #9C9C9C; -} - -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > DIV.member { - display: block; - padding-left: 20px; -} -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > DIV.member.expandable { - background-image: url(images/twisty-closed.png); - background-repeat: no-repeat; - background-position: 6px 2px; - cursor: pointer; -} -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > DIV.member.expandable.expanded { - background-image: url(images/twisty-open.png); -} - -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > .member > SPAN.name { - color: #E59D07; - font-weight: normal; -} - -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > .member > SPAN.value { - font-weight: normal; -} - -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > .member > SPAN.delimiter, SPAN.dictionary > .member > SPAN.separator, SPAN.dictionary > .member SPAN.more { - color: #9C9C9C; - padding-left: 2px; - padding-right: 2px; -} - - -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > SPAN { - color: brown; - font-weight: bold; -} -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > DIV.member { - display: block; - padding-left: 20px; -} -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > .member > SPAN.name { - color: black; - padding-left: 12px; -} -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > .member > SPAN.name[decorator=private-static] { - background: url(images/object-member-visibility-sprite.png) no-repeat -4px -2px; -} -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > .member > SPAN.name[decorator=protected-static] { - background: url(images/object-member-visibility-sprite.png) no-repeat -4px -18px; -} -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > .member > SPAN.name[decorator=public-static] { - background: url(images/object-member-visibility-sprite.png) no-repeat -4px -34px; -} -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > .member > SPAN.name[decorator=undeclared-static] { - background: url(images/object-member-visibility-sprite.png) no-repeat -4px -50px; -} -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > .member > SPAN.name[decorator=private] { - background: url(images/object-member-visibility-sprite.png) no-repeat -4px -66px; -} -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > .member > SPAN.name[decorator=protected] { - background: url(images/object-member-visibility-sprite.png) no-repeat -4px -82px; -} -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > .member > SPAN.name[decorator=public] { - background: url(images/object-member-visibility-sprite.png) no-repeat -4px -98px; -} -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > .member > SPAN.name[decorator=undeclared] { - background: url(images/object-member-visibility-sprite.png) no-repeat -4px -114px; -} -SPAN.dictionary[__dbid="fc2f04314c99af4367ff734e927c773cb9b1251b"] > .member > SPAN.delimiter, SPAN.dictionary > .member > SPAN.separator, SPAN.dictionary > .member SPAN.more { - color: brown; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/object.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/object.rep.js deleted file mode 100644 index fe43358..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/object.rep.js +++ /dev/null @@ -1,387 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 1 && type == this.CONST_Short) { - member["tag"] = this.moreTag; - } else { - member["tag"] = this.getTag(context, member, type); - } - - members.push(member); - - if (members.length > 2 && type == this.CONST_Short) { - break; - } - } - - if (members.length > 0) { - members[members.length - 1]["more"] = false; - } - - return members; - }, - isExpandable: function isExpandable(node) { - return node.type == "reference" || node.type == "dictionary" || node.type == "map" || node.type == "array"; - }, - onClick: function onClick(event) { - if (!domplate.util.isLeftClick(event)) { - return; - } - - var row = domplate.util.getAncestorByClass(event.target, "member"); - - if (domplate.util.hasClass(row, "expandable")) { - if (this.toggleRow(row)) { - event.stopPropagation(); - } - } - }, - _isTagExpandable: function _isTagExpandable(tag) { - while (true) { - if (!tag.parentNode) { - return true; - } - - if (tag.getAttribute("allowTagExpand") === "false") { - return false; - } - - tag = tag.parentNode; - } - }, - toggleRow: function toggleRow(row) { - if (!this._isTagExpandable(row)) { - return false; - } - - var valueElement = domplate.util.getElementByClass(row, "value"); - - if (domplate.util.hasClass(row, "expanded")) { - domplate.util.removeClass(row, "expanded"); - this.expandedStub.replace({ - "tag": this.expandableStub, - "member": row.memberObject, - "node": row.memberObject.node, - "context": row.contextObject - }, valueElement); - } else { - domplate.util.setClass(row, "expanded"); - this.expandedStub.replace({ - "tag": row.contextObject.repForNode(row.memberObject.node).tag, - "member": row.memberObject, - "node": row.memberObject.node, - "context": row.contextObject - }, valueElement); - } - - return true; - } - }; - }(); - - var sub = function () { - return { - getLabel: function getLabel(node) { - return node.meta && node.meta["lang.class"] || "Object"; - }, - getMemberNameDecorator: function getMemberNameDecorator(member) { - var decorator = []; - - if (member.node.meta) { - if (member.node.meta["lang.visibility"]) { - decorator.push(member.node.meta["lang.visibility"]); - } else if (member.node.meta["lang.undeclared"]) { - decorator.push("undeclared"); - } - - if (member.node.meta["lang.static"]) { - decorator.push("static"); - } - } - - return decorator.join("-"); - } - }; - }(); - - Object.keys(sub).forEach(function (name) { - master[name] = sub[name]; - }); - return master; - }(); -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0) { var l0 = 0; var if_0 = 0; var e0 = 0; with (this) { l0 = __loop__.apply(this, [d0, function(i0,l0,d0,d1,d2,d3,d4,d5) { node = __path__(root, o,0+1+l0+0);node.addEventListener("click", __bind__(this, d0), false);node.memberObject = d1;node.contextObject = d2; node = __path__(root, o,0+1+l0+0,0+1+1,0); e0 = __link__(node, d3, d4); if_0 = __if__.apply(this, [d5, function(if_0) { }]); return 0+1; }]); } return 1;}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0) { var l0 = 0; var if_0 = 0; var e0 = 0; with (this) { l0 = __loop__.apply(this, [d0, function(i0,l0,d0,d1,d2) { node = __path__(root, o,0+1+l0+0,0+1+1,0); e0 = __link__(node, d0, d1); if_0 = __if__.apply(this, [d2, function(if_0) { }]); return 0+1; }]); } return 1;}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -, -"expandableStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var e0 = 0; with (this) { node = __path__(root, o); e0 = __link__(node, d0, d1); } return e0;}) -} -, -"expandedStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var e0 = 0; with (this) { node = __path__(root, o); e0 = __link__(node, d0, d1); } return e0;}) -} -, -"moreTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(getLabel(node)),"(",""); __loop__.apply(this, [dictionaryIterator(context,node,CONST_Normal), __out__, function(member, __out__) { __code__.push("","","",__escape__(member.name),"","",":","","");__out__.push(onClick,member,context);__link__(member.tag, __code__, __out__, {"context":context,"node":member.node,"member":member}); __code__.push("","");__if__.apply(this, [member.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("","",")","",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(getLabel(node)),"(",""); __loop__.apply(this, [dictionaryIterator(context,node,CONST_Short), __out__, function(member, __out__) { __code__.push("","","",__escape__(member.name),"","",":","","");__link__(member.tag, __code__, __out__, {"context":context,"node":member.node,"member":member}); __code__.push("","");__if__.apply(this, [member.more, __out__, function(__out__) { __code__.push("","",",","");}]); __code__.push("",""); }]); __code__.push("","",")","",""); }}}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","",__escape__(getLabel(node)),"(","","","... ",__escape__(getMemberCount(node))," ...","","",")","",""); }}}) -} -, -"expandableStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) {__link__(getTag(context,member,CONST_Collapsed), __code__, __out__, {"context":context,"node":member.node,"member":member}); }}}) -} -, -"expandedStub":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) {__link__(tag, __code__, __out__, {"context":context,"node":node,"member":member}); }}}) -} -, -"moreTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("",""," ... ",""); }}}) -} -}; - rep.__dbid = "fc2f04314c99af4367ff734e927c773cb9b1251b"; - rep.__dtid = "insight.domplate.reps/php/object"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("php/object.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/resource.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/resource.preview.htm deleted file mode 100644 index 341b49f..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/resource.preview.htm +++ /dev/null @@ -1,16 +0,0 @@ - - - -

tag

- -[RESOURCE] - -
- -

shortTag

- -[RESOURCE] - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/resource.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/resource.rep.css deleted file mode 100644 index c0a8b9e..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/resource.rep.css +++ /dev/null @@ -1,4 +0,0 @@ - -SPAN.resource[__dbid="4a4960b1fa287b63ab13aa5373caa1f7076ff7e5"] { - color: navy; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/resource.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/resource.rep.js deleted file mode 100644 index cbd2b0f..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/resource.rep.js +++ /dev/null @@ -1,102 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i","[",__escape__(getValue(node)),"]",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","[",__escape__(getValue(node)),"]",""); }}}) -} -}; - rep.__dbid = "4a4960b1fa287b63ab13aa5373caa1f7076ff7e5"; - rep.__dtid = "insight.domplate.reps/php/resource"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("php/resource.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/string.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/string.preview.htm deleted file mode 100644 index 75fa9dc..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/string.preview.htm +++ /dev/null @@ -1,22 +0,0 @@ - - - -

tag

- -Hello World - -
- -

shortTag

- -Hello World - -
- -

trimmedNoticeTag

- -undefined - - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/string.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/string.rep.css deleted file mode 100644 index 74c194b..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/string.rep.css +++ /dev/null @@ -1,27 +0,0 @@ - -SPAN.null[__dbid="e8cfecc4a8618496bf811fa7fbd33dfc2338df59"] { - color: navy; -} - -SPAN.string[__dbid="e8cfecc4a8618496bf811fa7fbd33dfc2338df59"] { - color: black; -} - -SPAN.string[__dbid="e8cfecc4a8618496bf811fa7fbd33dfc2338df59"][wrapped=true] { - color: red; -} - -SPAN.string[__dbid="e8cfecc4a8618496bf811fa7fbd33dfc2338df59"] > SPAN.special { - color: gray; - font-weight: bold; - padding-left: 3px; - padding-right: 3px; -} - -SPAN.string[__dbid="e8cfecc4a8618496bf811fa7fbd33dfc2338df59"] > SPAN.trimmed { - color: #FFFFFF; - background-color: blue; - padding-left: 5px; - padding-right: 5px; - margin-left: 5px; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/string.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/string.rep.js deleted file mode 100644 index cfd0235..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/string.rep.js +++ /dev/null @@ -1,249 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i= 5) { - trimLength = meta["string.trim.length"]; - } - - if (typeof meta["string.trim.newlines"] != "undefined") { - trimNewlines = meta["string.trim.newlines"]; - } - } - - var str = node.value; - - if (trimEnabled) { - if (trimLength > -1) { - str = this._cropString(str, trimLength); - } - - if (trimNewlines) { - str = this._escapeNewLines(str); - } - } - - var parts = str.split("\\n"); - var lines = [], - parts2; - - for (var i = 0, ci = parts.length; i < ci; i++) { - parts2 = parts[i].split("|:_!_:|"); - - for (var j = 0, cj = parts2.length; j < cj; j++) { - if (parts2[j] == "STRING_CROP") { - lines.push({ - "value": "", - "more": false, - "special": true, - "specialvalue": "..." - }); - } else if (parts2[j] == "STRING_NEWLINE") { - lines.push({ - "value": "", - "more": false, - "special": true, - "specialvalue": "\\\n" - }); - } else { - lines.push({ - "value": parts2[j], - "more": i < ci - 1 && j == cj - 1 ? true : false - }); - } - } - } - - if (node.meta["encoder.trimmed"] && node.meta["encoder.notice"]) { - lines.push({ - "value": "", - "trimmed": true - }); - } - - return lines; - }, - _cropString: function _cropString(value, limit) { - limit = limit || 50; - - if (value.length > limit) { - return value.substr(0, limit / 2) + "|:_!_:|STRING_CROP|:_!_:|" + value.substr(value.length - limit / 2); - } else { - return value; - } - }, - _escapeNewLines: function _escapeNewLines(value) { - return ("" + value).replace(/\r/g, "\\r").replace(/\\n/g, "|:_!_:|STRING_NEWLINE|:_!_:|"); - } - }; -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1, d2) { var l0 = 0; var if_0 = 0; var if_1 = 0; var if_2 = 0; var if_3 = 0; var if_4 = 0; var e0 = 0; with (this) { if_0 = __if__.apply(this, [d0, function(if_0) { }]); l0 = __loop__.apply(this, [d1, function(i0,l0,d0,d1,d2) { if_1 = __if__.apply(this, [d0, function(if_1) { }]); if_2 = __if__.apply(this, [d1, function(if_2) { }]); if_3 = __if__.apply(this, [d2, function(if_3,d0,d1) { node = __path__(root, o,0+d0+l0+0+1+d0+d1); e0 = __link__(node, d0, d1); }]); return 0+1+d0+d1+d2; }]); if_4 = __if__.apply(this, [d2, function(if_4) { }]); } return 1;}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1, d2) { var l0 = 0; var if_0 = 0; var if_1 = 0; var if_2 = 0; var if_3 = 0; var if_4 = 0; var e0 = 0; with (this) { if_0 = __if__.apply(this, [d0, function(if_0) { }]); l0 = __loop__.apply(this, [d1, function(i0,l0,d0,d1,d2) { if_1 = __if__.apply(this, [d0, function(if_1) { }]); if_2 = __if__.apply(this, [d1, function(if_2) { }]); if_3 = __if__.apply(this, [d2, function(if_3,d0,d1) { node = __path__(root, o,0+d0+l0+0+1+d0+d1); e0 = __link__(node, d0, d1); }]); return 0+1+d0+d1+d2; }]); if_4 = __if__.apply(this, [d2, function(if_4) { }]); } return 1;}) -} -, -"trimmedNoticeTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","");__if__.apply(this, [node.wrapped, __out__, function(__out__) { __code__.push("","'");}]); __loop__.apply(this, [getValue(node), __out__, function(line, __out__) { __code__.push("",__escape__(line.value));__if__.apply(this, [line.special, __out__, function(__out__) { __code__.push("","",__escape__(line.specialvalue),"");}]);__if__.apply(this, [line.more, __out__, function(__out__) { __code__.push("","");}]);__if__.apply(this, [line.trimmed, __out__, function(__out__) {__link__(getTrimmedTag(node), __code__, __out__, {"node":node});}]); }]);__if__.apply(this, [node.wrapped, __out__, function(__out__) { __code__.push("","'");}]); __code__.push("",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","");__if__.apply(this, [node.wrapped, __out__, function(__out__) { __code__.push("","'");}]); __loop__.apply(this, [getShortValue(node), __out__, function(line, __out__) { __code__.push("",__escape__(line.value));__if__.apply(this, [line.special, __out__, function(__out__) { __code__.push("","",__escape__(line.specialvalue),"");}]);__if__.apply(this, [line.more, __out__, function(__out__) { __code__.push("","");}]);__if__.apply(this, [line.trimmed, __out__, function(__out__) {__link__(getTrimmedTag(node), __code__, __out__, {"node":node});}]); }]);__if__.apply(this, [node.wrapped, __out__, function(__out__) { __code__.push("","'");}]); __code__.push("",""); }}}) -} -, -"trimmedNoticeTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","",__escape__(getNotice(node)),""); }}}) -} -}; - rep.__dbid = "e8cfecc4a8618496bf811fa7fbd33dfc2338df59"; - rep.__dtid = "insight.domplate.reps/php/string"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("php/string.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/unknown.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/unknown.preview.htm deleted file mode 100644 index 7b24740..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/unknown.preview.htm +++ /dev/null @@ -1,22 +0,0 @@ - - - -

tag

- -
UNKNOWN EXPANDED
- -
- -

collapsedTag

- -
UNKNOWN COLLAPSED
- -
- -

shortTag

- -
UNKNOWN SHORT
- - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/unknown.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/unknown.rep.css deleted file mode 100644 index 507dfcc..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/unknown.rep.css +++ /dev/null @@ -1,5 +0,0 @@ - -DIV.unknown[__dbid="859944ec3afd0136c208c76b33fd54c9f08cb1a5"] { - color: #FFFFFF; - background-color: red; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/unknown.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/unknown.rep.js deleted file mode 100644 index d0cb237..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/php/unknown.rep.js +++ /dev/null @@ -1,121 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i","UNKNOWN EXPANDED",""); }}}) -} -, -"collapsedTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","UNKNOWN COLLAPSED",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","UNKNOWN SHORT",""); }}}) -} -}; - rep.__dbid = "859944ec3afd0136c208c76b33fd54c9f08cb1a5"; - rep.__dtid = "insight.domplate.reps/php/unknown"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("php/unknown.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/console.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/console.preview.htm deleted file mode 100644 index 77b738f..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/console.preview.htm +++ /dev/null @@ -1,22 +0,0 @@ - - - -

tag

- -
- -
- -

shortTag

- - - -
- -

groupNoMessagesTag

- -
No Messages
- - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/console.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/console.rep.css deleted file mode 100644 index baf87d7..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/console.rep.css +++ /dev/null @@ -1,181 +0,0 @@ - -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] { - position: relative; - margin: 0; - border-bottom: 1px solid #D7D7D7; - padding: 0px; - background-color: #FFFFFF; -} -DIV.console-message.selected[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] { - background-color: #35FC03 !important; -} -DIV.console-message-group[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"][expanded=true] { - background-color: #77CDD9; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header { - position: relative; - padding-left: 34px; - padding-right: 10px; - padding-top: 3px; - padding-bottom: 4px; - cursor: pointer; - min-height: 16px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"][expanded=true] > DIV.header > SPAN.summary { - opacity: 0.4; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"][expanded=false] > DIV.header:hover { - background-color: #ffc73d; -} -DIV.console-message-group[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header { - background: url(images/document_page_next.png) no-repeat; - background-position: 2px 3px; - font-weight: bold; - background-color: #77CDD9; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header-priority-info { - background: url(images/information.png) no-repeat; - background-position: 2px 3px; - background-color: #c6eeff; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header-priority-warn { - background: url(images/exclamation-diamond.png) no-repeat; - background-position: 2px 3px; - background-color: #ffe68d; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header-priority-error { - background: url(images/exclamation-red.png) no-repeat; - background-position: 2px 3px; - background-color: #ffa7a7; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header > DIV.expander { - background-color: black; - width: 18px; - height: 18px; - display: inline-block; - float: left; - position: relative; - top: -1px; - margin-left: -14px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header > DIV.expander:hover { - cursor: pointer; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"][expanded=false] > DIV.header > DIV.expander { - background: url(images/plus-small-white.png) no-repeat; - background-position: 0px 1px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"][expanded=true] > DIV.header > DIV.expander { - background: url(images/minus-small-white.png) no-repeat; - background-position: 0px 1px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header > SPAN.summary > SPAN.label > SPAN, DIV.console-message > DIV.header > SPAN.fileline > DIV > DIV.label { - margin-right: 5px; - background-color: rgba(69,68,60,1); - padding-left: 5px; - padding-right: 5px; - color: white; - vertical-align: top; - margin-top: 1px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header > SPAN.fileline > DIV > DIV.label { - float: left; - margin-top: 0px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header > SPAN.summary > SPAN > SPAN.count { - color: #525252; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header > SPAN.fileline { - color: #525252; - word-wrap: break-word; - float: right; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"][expandedSummary=true] > DIV.header > SPAN.summary { - display: none; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"][keeptitle=true] > DIV.header, DIV.console-message-group > DIV.header { - text-align: left !important; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"][keeptitle=true] > DIV.header > SPAN.fileline, DIV.console-message-group > DIV.header > SPAN.fileline { - display: none !important; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"][keeptitle=true] > DIV.header > SPAN.summary, DIV.console-message-group > DIV.header > SPAN.summary { - display: inline !important; -} -DIV.console-message-group[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header > DIV.actions { - display: none !important; -} -DIV.console-message-group[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header > SPAN.summary > SPAN > SPAN.count { - color: #ffffff !important; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"][expanded=false] > DIV.header > SPAN.fileline { - display: none; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header > DIV.actions { - display: inline-block; - position: relative; - top: 0px; - left: 10px; - float: right; - margin-left: 0px; - margin-right: 5px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header > DIV.actions DIV.inspect { - display: inline-block; - background: url(images/node-magnifier.png) no-repeat; - width: 16px; - height: 16px; - margin-right: 4px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header > DIV.actions > DIV.file { - display: inline-block; - background: url(images/document-binary.png) no-repeat; - width: 16px; - height: 16px; - margin-right: 4px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.header > DIV.actions > DIV.inspect:hover, DIV.console-message > DIV.header > DIV.actions > DIV.file:hover { - cursor: pointer; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.body { - padding: 6px; - margin: 3px; - margin-top: 0px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"][expanded=false] > DIV.body { - display: none; -} -DIV.console-message-group[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.body { - padding: 0px; - margin: 0px; - margin-left: 20px; - border-top: 1px solid #000000; - border-left: 1px solid #000000; - margin-bottom: -1px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.body-priority-info { - border: 3px solid #c6eeff; - margin: 0px; - border-top: 0px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.body-priority-warn { - border: 3px solid #ffe68d; - margin: 0px; - border-top: 0px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.body-priority-error { - border: 3px solid #ffa7a7; - margin: 0px; - border-top: 0px; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] > DIV.body > DIV.group-no-messages { - background-color: white; - padding-left: 4px; - padding-right: 4px; - padding-top: 3px; - padding-bottom: 3px; - color: gray; -} -DIV.console-message[__dbid="3a7bebf32f91801fb7aab559c5946d27a0b717b9"] .hidden { - display: none !important; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/console.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/console.rep.js deleted file mode 100644 index 0442486..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/console.rep.js +++ /dev/null @@ -1,416 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i= masterRect.left && pointer.x <= masterRect.right && pointer.y >= masterRect.top && pointer.y <= masterRect.bottom) { - event.stopPropagation(); - - if (masterRow.getAttribute("expanded") == "true") { - masterRow.setAttribute("expanded", "false"); - masterRow.contextObject.dispatchEvent('contract', [event, { - "message": masterRow.messageObject, - "masterTag": masterRow, - "summaryTag": summaryTag, - "bodyTag": bodyTag - }]); - } else { - masterRow.setAttribute("expanded", "true"); - masterRow.contextObject.dispatchEvent('expand', [event, { - "message": masterRow.messageObject, - "masterTag": masterRow, - "summaryTag": summaryTag, - "bodyTag": bodyTag - }]); - - if (!bodyTag.innerHTML) { - if (typeof masterRow.messageObject.meta["group.start"] != "undefined") { - this.groupNoMessagesTag.replace({}, bodyTag, this); - } else { - this.expandForMasterRow(masterRow, bodyTag); - } - - this.postRender(bodyTag); - } - } - } else if (domplate.util.hasClass(event.target, "inspect")) { - event.stopPropagation(); - masterRow.contextObject.dispatchEvent('inspectMessage', [event, { - "message": masterRow.messageObject, - "masterTag": masterRow, - "summaryTag": summaryTag, - "bodyTag": bodyTag, - "args": { - "node": masterRow.messageObject - } - }]); - } else if (domplate.util.hasClass(event.target, "file")) { - event.stopPropagation(); - var args = { - "file": masterRow.messageObject.meta.file, - "line": masterRow.messageObject.meta.line - }; - - if (args["file"] && args["line"]) { - masterRow.contextObject.dispatchEvent('inspectFile', [event, { - "message": masterRow.messageObject, - "masterTag": masterRow, - "summaryTag": summaryTag, - "bodyTag": bodyTag, - "args": args - }]); - } - } else { - event.stopPropagation(); - masterRow.contextObject.dispatchEvent('click', [event, { - "message": masterRow.messageObject, - "masterTag": masterRow, - "bodyTag": bodyTag - }]); - } - }), _defineProperty(_ref, "setCount", function setCount(node, count) { - try { - var masterRow = this._getMasterRow(node), - headerTag = domplate.util.getChildByClass(masterRow, "header"), - summaryTag = domplate.util.getChildByClass(headerTag, "summary"); - - summaryTag.children[1].innerHTML += ' (' + count + ')'; - } catch (e) { - helpers.logger.error("Error setting count for node!: " + e); - } - }), _defineProperty(_ref, "postRender", function postRender(node) { - var masterRow = this._getMasterRow(node); - - if (typeof masterRow.messageObject.meta.keeptitle !== "undefined") { - console.log("keeptitle via (1)"); - masterRow.setAttribute("keeptitle", masterRow.messageObject.meta.keeptitle ? "true" : "false"); - } else if (masterRow.messageObject && _typeof(masterRow.messageObject.postRender) == "object") { - if (typeof masterRow.messageObject.postRender.keeptitle !== "undefined") { - console.log("keeptitle via (2)"); - masterRow.setAttribute("keeptitle", masterRow.messageObject.postRender.keeptitle ? "true" : "false"); - } - } - }), _defineProperty(_ref, "expandForMasterRow", function expandForMasterRow(masterRow, bodyTag) { - masterRow.setAttribute("expanded", "true"); - var rep = masterRow.contextObject.repForNode(masterRow.messageObject); - rep.tag.replace({ - "node": masterRow.messageObject, - "context": masterRow.contextObject - }, bodyTag, rep); - }), _defineProperty(_ref, "_getMasterRow", function _getMasterRow(row) { - while (true) { - if (!row.parentNode) { - return null; - } - - if (domplate.util.hasClass(row, "console-message")) { - break; - } - - row = row.parentNode; - } - - return row; - }), _ref; -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11) { var if_0 = 0; var e0 = 0; with (this) { node = __path__(root, o);node.addEventListener("mouseover", __bind__(this, d0), false);node.addEventListener("mousemove", __bind__(this, d1), false);node.addEventListener("mouseout", __bind__(this, d2), false);node.addEventListener("click", __bind__(this, d3), false);node.messageObject = d4;node.contextObject = d5;node.templateObject = _getTemplateObject(d6); node = __path__(root, o,0,0+1,0);node.addEventListener("click", __bind__(this, d7), false); node = __path__(root, o,0,0+1,0+1);node.addEventListener("click", __bind__(this, d8), false); if_0 = __if__.apply(this, [d9, function(if_0) { }]); node = __path__(root, o,0,0+1+1,0+1); e0 = __link__(node, d10, d11); } return 1;}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1) { var e0 = 0; with (this) { node = __path__(root, o); e0 = __link__(node, d0, d1); } return e0;}) -} -, -"groupNoMessagesTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o) { with (this) { } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","","","","","","","","","","","");__out__.push(onMouseOver,onMouseMove,onMouseOut,onClick,node,context,node,onClick,onClick);__if__.apply(this, [_hasLabel(node), __out__, function(__out__) { __code__.push("","",__escape__(_getLabel(node)),"");}]); __code__.push("","");__link__(_getTag(context,node,CONST_Short), __code__, __out__, {"node":_getValue(context,node),"context":context}); __code__.push("","","","",__escape__(_getFileLine(node)),"","","","","",""); }}}) -} -, -"shortTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) {__link__("getTag", __code__, __out__, {"node":node,"context":context}); }}}) -} -, -"groupNoMessagesTag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","No Messages",""); }}}) -} -}; - rep.__dbid = "3a7bebf32f91801fb7aab559c5946d27a0b717b9"; - rep.__dtid = "insight.domplate.reps/wrappers/console"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("wrappers/console.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/document-binary.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/document-binary.png deleted file mode 100644 index c21284e..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/document-binary.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/document_page_next.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/document_page_next.png deleted file mode 100644 index 7267e4b..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/document_page_next.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/exclamation-diamond.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/exclamation-diamond.png deleted file mode 100644 index 9b5b2c3..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/exclamation-diamond.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/exclamation-red.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/exclamation-red.png deleted file mode 100644 index 91f8553..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/exclamation-red.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/information.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/information.png deleted file mode 100644 index a85b986..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/information.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/minus-small-white.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/minus-small-white.png deleted file mode 100644 index ee963e4..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/minus-small-white.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/node-magnifier.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/node-magnifier.png deleted file mode 100644 index f6776f1..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/node-magnifier.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/plus-small-white.png b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/plus-small-white.png deleted file mode 100644 index 9616791..0000000 Binary files a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/images/plus-small-white.png and /dev/null differ diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/request.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/request.preview.htm deleted file mode 100644 index 4ce6a59..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/request.preview.htm +++ /dev/null @@ -1,10 +0,0 @@ - - - -

tag

- -
AJAX
- - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/request.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/request.rep.css deleted file mode 100644 index eb1ba95..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/request.rep.css +++ /dev/null @@ -1,91 +0,0 @@ - -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"] { - position: relative; - margin: 0; - border-bottom: 1px solid #D7D7D7; - padding: 0px; - background-color: steelblue; -} -DIV.console-request.selected[__dbid="42e45d15f38354db25f807078ed4de450a918dea"] { - background-color: #35FC03 !important; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"] > DIV.header { - position: relative; - padding-left: 34px; - padding-right: 10px; - padding-top: 4px; - padding-bottom: 4px; - cursor: pointer; - min-height: 16px; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"][expanded=false] > DIV.header:hover { - background-color: #ffc73d; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"] > DIV.header > DIV.expander { - background-color: black; - width: 18px; - height: 18px; - display: inline-block; - float: left; - position: relative; - top: -1px; - margin-left: -14px; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"] > DIV.header > DIV.expander:hover { - cursor: pointer; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"][expanded=false] > DIV.header > DIV.expander { - background: url(images/plus-small-white.png) no-repeat; - background-position: 0px 1px; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"][expanded=true] > DIV.header > DIV.expander { - background: url(images/minus-small-white.png) no-repeat; - background-position: 0px 1px; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"] > DIV.header > SPAN.fileline > DIV > DIV.label { - float: left; - margin-top: 0px; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"] > DIV.header > SPAN.summary > SPAN > SPAN.count { - color: #8c8c8c; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"] > DIV.header > SPAN.fileline { - color: #8c8c8c; - word-wrap: break-word; - float: right; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"] > DIV.header > SPAN.summary > SPAN { - color: #e6e6e6; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"][expandedSummary=true] > DIV.header > SPAN.summary { - display: none; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"] > DIV.header { - text-align: left !important; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"][keeptitle=true] > DIV.header > SPAN.summary { - display: inline !important; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"] > DIV.header > DIV.labels { - display: inline-block; - position: relative; - top: 0px; - left: 10px; - float: right; - margin-left: 0px; - margin-right: 5px; - font-weight: bold; - color: #c8daea; - padding-top: 1px; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"] > DIV.body { - padding: 0px; - margin: 0px; - background-color: #ffffff; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"][expanded=false] > DIV.body { - display: none; -} -DIV.console-request[__dbid="42e45d15f38354db25f807078ed4de450a918dea"] .hidden { - display: none !important; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/request.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/request.rep.js deleted file mode 100644 index a72ad9e..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/request.rep.js +++ /dev/null @@ -1,167 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i= masterRect.left && pointer.x <= masterRect.right && pointer.y >= masterRect.top && pointer.y <= masterRect.bottom) { - event.stopPropagation(); - - if (masterRow.getAttribute("expanded") == "true") { - masterRow.setAttribute("expanded", "false"); - } else { - masterRow.setAttribute("expanded", "true"); - } - } else { - event.stopPropagation(); - } - }, - _getMasterRow: function _getMasterRow(row) { - while (true) { - if (!row.parentNode) { - return null; - } - - if (domplate.util.hasClass(row, "console-request")) { - break; - } - - row = row.parentNode; - } - - return row; - } - }; -} - -exports.main = function (domplate, options) { - options = options || {}; - var rep = impl(domplate); - rep.__dom = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __path__ = context.__path__; -var __bind__ = context.__bind__; -var __if__ = context.__if__; -var __link__ = context.__link__; -var __loop__ = context.__loop__; -return (function (root, context, o, d0, d1, d2, d3, d4, d5) { var e0 = 0; with (this) { node = __path__(root, o);node.addEventListener("click", __bind__(this, d0), false);node.messageObject = d1;node.contextObject = d2;node.templateObject = _getTemplateObject(d3); node = __path__(root, o,0,0+1+1,0); e0 = __link__(node, d4, d5); } return 1;}) -} -}; - rep.__markup = { -"tag":function (context) { -var DomplateDebug = context.DomplateDebug; -var __escape__ = context.__escape__; -var __if__ = context.__if__; -var __loop__ = context.__loop__; -var __link__ = context.__link__; -return (function (__code__, __context__, __in__, __out__) { with (this) { with (__in__) { __code__.push("","","","","","",__escape__(_getTypeLabelValueString(context,node)),"","");__out__.push(onClick,node,context,node);__link__(_getTitleTag(context,node,CONST_Short), __code__, __out__, {"node":_getTitleValue(context,node),"context":context}); __code__.push("","","","","",""); }}}) -} -}; - rep.__dbid = "42e45d15f38354db25f807078ed4de450a918dea"; - rep.__dtid = "insight.domplate.reps/wrappers/request"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("wrappers/request.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/viewer.preview.htm b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/viewer.preview.htm deleted file mode 100644 index 2b350d9..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/viewer.preview.htm +++ /dev/null @@ -1,10 +0,0 @@ - - - -

tag

- -
- - - - \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/viewer.rep.css b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/viewer.rep.css deleted file mode 100644 index 71f2606..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/viewer.rep.css +++ /dev/null @@ -1,6 +0,0 @@ - -DIV.viewer-harness[__dbid="81dd6cc349cc607697b22148aa1809050c0fcda4"] { - padding: 2px 4px 1px 6px; - font-family: Lucida Grande, Tahoma, sans-serif; - font-size: 11px; -} diff --git a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/viewer.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/viewer.rep.js deleted file mode 100644 index 49a4b90..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.domplate.reps/wrappers/viewer.rep.js +++ /dev/null @@ -1,89 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i");__link__(_getTag(context,node), __code__, __out__, {"node":node,"context":context}); __code__.push("",""); }}}) -} -}; - rep.__dbid = "81dd6cc349cc607697b22148aa1809050c0fcda4"; - rep.__dtid = "insight.domplate.reps/wrappers/viewer"; - var res = domplate.domplate(rep); - var injectedCss = false; - - rep.__ensureCssInjected = function () { - if (injectedCss) return; - injectedCss = true; - domplate.loadStyle("wrappers/viewer.rep.css", options.cssBaseUrl || undefined); - }; - - Object.keys(rep).forEach(function (tagName) { - if (!rep[tagName].tag) return; - var replace_orig = res[tagName].replace; - - res[tagName].replace = function () { - var res = replace_orig.apply(this, arguments); - if (!res) return; - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - return res; - }; - }); - return res; -}; -},{}]},{},[1])(1) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/insight.rep.js b/dist/firephp.build/scripts/devtools/dist/insight.rep.js deleted file mode 100644 index 278226f..0000000 --- a/dist/firephp.build/scripts/devtools/dist/insight.rep.js +++ /dev/null @@ -1,4889 +0,0 @@ -PINF.bundle("", function(__require) { - __require.memoize("/main.js", function (_require, _exports, _module) { -var bundle = { require: _require, exports: _exports, module: _module }; -var exports = undefined; -var module = undefined; -var define = function (deps, init) { -_module.exports = init(); -}; define.amd = true; - var pmodule = bundle.module; - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mainModule = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 0) { - topBlock.push(', " class=\\""'); - if (this.attrs.hasOwnProperty("class")) addParts(this.attrs["class"], ',', topBlock, info, true); - topBlock.push(', " "'); - - for (var name in this.classes) { - topBlock.push(', ('); - addParts(this.classes[name], '', topBlock, info); - topBlock.push(' ? "', name, '" + " " : "")'); - } - - topBlock.push(', "\\""'); - } - - if (this.tagName == "br") { - topBlock.push(',"/>"'); - } else { - topBlock.push(',">"'); - this.generateChildMarkup(topBlock, topOuts, blocks, info); - topBlock.push(',""'); - } - }, - generateChildMarkup: function generateChildMarkup(topBlock, topOuts, blocks, info) { - for (var i = 0; i < this.children.length; ++i) { - var child = this.children[i]; - if (isTag(child)) child.tag.generateMarkup(topBlock, topOuts, blocks, info);else addParts(child, ',', topBlock, info, true); - } - }, - addCode: function addCode(topBlock, topOuts, blocks) { - if (topBlock.length) blocks.push(' __code__.push(""', topBlock.join(""), ');'); - if (topOuts.length) blocks.push('__out__.push(', topOuts.join(","), ');'); - topBlock.splice(0, topBlock.length); - topOuts.splice(0, topOuts.length); - }, - addLocals: function addLocals(blocks) { - var varNames = []; - this.getVarNames(varNames); - var map = {}; - - for (var i = 0; i < varNames.length; ++i) { - var name = varNames[i]; - if (map.hasOwnProperty(name)) continue; - map[name] = 1; - var names = name.split("."); - blocks.push('var ', names[0] + ' = ' + '__in__.' + names[0] + ';'); - } - }, - compileDOM: function compileDOM() { - var path = []; - var blocks = []; - this.domArgs = []; - path.embedIndex = 0; - path.loopIndex = 0; - path.ifIndex = 0; - path.staticIndex = 0; - path.renderIndex = 0; - var nodeCount = this.generateDOM(path, blocks, this.domArgs); - var fnBlock = ['(function (root, context, o']; - - for (var i = 0; i < path.staticIndex; ++i) { - fnBlock.push(', ', 's' + i); - } - - for (var i = 0; i < path.renderIndex; ++i) { - fnBlock.push(', ', 'd' + i); - } - - fnBlock.push(') {'); - - for (var i = 0; i < path.loopIndex; ++i) { - fnBlock.push(' var l', i, ' = 0;'); - } - - for (var i = 0; i < path.ifIndex; ++i) { - fnBlock.push(' var if_', i, ' = 0;'); - } - - for (var i = 0; i < path.embedIndex; ++i) { - fnBlock.push(' var e', i, ' = 0;'); - } - - if (this.subject) { - fnBlock.push(' with (this) {'); - } - - if (this.context) { - fnBlock.push(' with (context) {'); - } - - fnBlock.push(blocks.join("")); - if (this.context) fnBlock.push(' }'); - if (this.subject) fnBlock.push(' }'); - fnBlock.push(' return ', nodeCount, ';'); - fnBlock.push('})'); - var self = this; - var js = fnBlock.join(""); - js = js.replace('__SELF__JS__', js.replace(/\'/g, '\\\'')); - this.renderDOM = exports.EVAL.compileDOM(js, RT.makeDOMRuntime(exports.EVAL, { - self: self, - compiled: this.subject.__dom - })); - }, - generateDOM: function generateDOM(path, blocks, args) { - if (this.listeners || this.props) this.generateNodePath(path, blocks); - - if (this.listeners) { - for (var i = 0; i < this.listeners.length; i += 2) { - var val = this.listeners[i + 1]; - var arg = generateArg(val, path, args); - blocks.push('node.addEventListener("', this.listeners[i], '", __bind__(this, ', arg, '), false);'); - } - } - - if (this.props) { - for (var name in this.props) { - var val = this.props[name]; - var arg = generateArg(val, path, args); - blocks.push('node.', name, ' = ', arg, ';'); - } - } - - this.generateChildDOM(path, blocks, args); - return 1; - }, - generateNodePath: function generateNodePath(path, blocks) { - blocks.push(" node = __path__(root, o"); - - for (var i = 0; i < path.length; ++i) { - blocks.push(",", path[i]); - } - - blocks.push(");"); - }, - generateChildDOM: function generateChildDOM(path, blocks, args) { - path.push(0); - - for (var i = 0; i < this.children.length; ++i) { - var child = this.children[i]; - if (isTag(child)) path[path.length - 1] += '+' + child.tag.generateDOM(path, blocks, args);else path[path.length - 1] += '+1'; - } - - path.pop(); - } - }; - DomplateEmbed.prototype = copyObject(DomplateTag.prototype, { - merge: function merge(args, oldTag) { - this.value = oldTag ? oldTag.value : parseValue(args[0]); - this.attrs = oldTag ? oldTag.attrs : {}; - this.vars = oldTag ? copyArray(oldTag.vars) : []; - var attrs = args[1]; - - for (var name in attrs) { - var val = parseValue(attrs[name]); - this.attrs[name] = val; - readPartNames(val, this.vars); - } - - var retval = creator(this, DomplateEmbed); - return retval; - }, - getVarNames: function getVarNames(names) { - if (this.value instanceof Parts) names.push(this.value.parts[0].name); - if (this.vars) names.push.apply(names, this.vars); - }, - generateMarkup: function generateMarkup(topBlock, topOuts, blocks, info) { - this.addCode(topBlock, topOuts, blocks); - blocks.push('__link__('); - addParts(this.value, '', blocks, info); - blocks.push(', __code__, __out__, {'); - var lastName = null; - - for (var name in this.attrs) { - if (lastName) blocks.push(','); - lastName = name; - var val = this.attrs[name]; - blocks.push('"', name, '":'); - addParts(val, '', blocks, info); - } - - blocks.push('});'); - }, - generateDOM: function generateDOM(path, blocks, args) { - var embedName = 'e' + path.embedIndex++; - this.generateNodePath(path, blocks); - var valueName = 'd' + path.renderIndex++; - var argsName = 'd' + path.renderIndex++; - blocks.push(' ', embedName + ' = __link__(node, ', valueName, ', ', argsName, ');'); - return embedName; - } - }); - DomplateLoop.prototype = copyObject(DomplateTag.prototype, { - merge: function merge(args, oldTag) { - this.varName = oldTag ? oldTag.varName : args[0]; - this.iter = oldTag ? oldTag.iter : parseValue(args[1]); - this.vars = []; - this.children = oldTag ? copyArray(oldTag.children) : []; - var offset = Math.min(args.length, 2); - parseChildren(args, offset, this.vars, this.children); - var retval = creator(this, DomplateLoop); - return retval; - }, - getVarNames: function getVarNames(names) { - if (this.iter instanceof Parts) names.push(this.iter.parts[0].name); - DomplateTag.prototype.getVarNames.apply(this, [names]); - }, - generateMarkup: function generateMarkup(topBlock, topOuts, blocks, info) { - this.addCode(topBlock, topOuts, blocks); - var iterName; - - if (this.iter instanceof Parts) { - var part = this.iter.parts[0]; - iterName = part.names.join(','); - - if (part.format) { - for (var i = 0; i < part.format.length; ++i) { - iterName = part.format[i] + "(" + iterName + ")"; - } - } - } else { - iterName = this.iter; - } - - blocks.push(' __loop__.apply(this, [', iterName, ', __out__, function(', this.varName, ', __out__) {'); - this.generateChildMarkup(topBlock, topOuts, blocks, info); - this.addCode(topBlock, topOuts, blocks); - blocks.push(' }]);'); - }, - generateDOM: function generateDOM(path, blocks, args) { - var iterName = 'd' + path.renderIndex++; - var counterName = 'i' + path.loopIndex; - var loopName = 'l' + path.loopIndex++; - if (!path.length) path.push(-1, 0); - var preIndex = path.renderIndex; - path.renderIndex = 0; - var nodeCount = 0; - var subBlocks = []; - var basePath = path[path.length - 1]; - - for (var i = 0; i < this.children.length; ++i) { - path[path.length - 1] = basePath + '+' + loopName + '+' + nodeCount; - var child = this.children[i]; - if (isTag(child)) nodeCount += '+' + child.tag.generateDOM(path, subBlocks, args);else nodeCount += '+1'; - } - - path[path.length - 1] = basePath + '+' + loopName; - blocks.push(' ', loopName, ' = __loop__.apply(this, [', iterName, ', function(', counterName, ',', loopName); - - for (var i = 0; i < path.renderIndex; ++i) { - blocks.push(',d' + i); - } - - blocks.push(') {'); - blocks.push(subBlocks.join("")); - blocks.push(' return ', nodeCount, ';'); - blocks.push(' }]);'); - path.renderIndex = preIndex; - return loopName; - } - }); - DomplateIf.prototype = copyObject(DomplateTag.prototype, { - merge: function merge(args, oldTag) { - this.booleanVar = oldTag ? oldTag.booleanVar : parseValue(args[0]); - this.vars = []; - this.children = oldTag ? copyArray(oldTag.children) : []; - var offset = Math.min(args.length, 1); - parseChildren(args, offset, this.vars, this.children); - var retval = creator(this, DomplateIf); - return retval; - }, - getVarNames: function getVarNames(names) { - if (this.booleanVar instanceof Parts) names.push(this.booleanVar.parts[0].name); - DomplateTag.prototype.getVarNames.apply(this, [names]); - }, - generateMarkup: function generateMarkup(topBlock, topOuts, blocks, info) { - this.addCode(topBlock, topOuts, blocks); - var expr; - - if (this.booleanVar instanceof Parts) { - var part = this.booleanVar.parts[0]; - expr = part.names.join(','); - - if (part.format) { - for (var i = 0; i < part.format.length; ++i) { - expr = part.format[i] + "(" + expr + ")"; - } - } - } else { - expr = this.booleanVar; - } - - blocks.push('__if__.apply(this, [', expr, ', __out__, function(__out__) {'); - this.generateChildMarkup(topBlock, topOuts, blocks, info); - this.addCode(topBlock, topOuts, blocks); - blocks.push('}]);'); - }, - generateDOM: function generateDOM(path, blocks, args) { - var controlName = 'd' + path.renderIndex++; - var ifName = 'if_' + path.ifIndex++; - if (!path.length) path.push(-1, 0); - var preIndex = path.renderIndex; - path.renderIndex = 0; - var nodeCount = 0; - var subBlocks = []; - - for (var i = 0; i < this.children.length; ++i) { - var child = this.children[i]; - if (isTag(child)) nodeCount += '+' + child.tag.generateDOM(path, subBlocks, args);else nodeCount += '+1'; - } - - blocks.push(' ', ifName, ' = __if__.apply(this, [', controlName, ', function(', ifName); - - for (var i = 0; i < path.renderIndex; ++i) { - blocks.push(',d' + i); - } - - blocks.push(') {'); - blocks.push(subBlocks.join("")); - blocks.push(' }]);'); - path.renderIndex = preIndex; - return controlName; - } - }); - - function Variables(names, format) { - this.names = names; - this.format = format; - } - - function Parts(parts) { - this.parts = parts; - } - - function parseParts(str) { - var index = 0; - var parts = []; - var m; - var re = /\$([_A-Za-z][$_A-Za-z0-9.,|]*)/g; - - while (m = re.exec(str)) { - var pre = str.substr(index, re.lastIndex - m[0].length - index); - if (pre) parts.push(pre); - var segs = m[1].split("|"); - var vars = segs[0].split(",$"); - parts.push(new Variables(vars, segs.splice(1))); - index = re.lastIndex; - } - - if (!index) { - return str; - } - - var post = str.substr(index); - if (post) parts.push(post); - var retval = new Parts(parts); - return retval; - } - - function parseValue(val) { - return typeof val == 'string' ? parseParts(val) : val; - } - - function parseChildren(args, offset, vars, children) { - for (var i = offset; i < args.length; ++i) { - var val = parseValue(args[i]); - children.push(val); - readPartNames(val, vars); - } - } - - function readPartNames(val, vars) { - if (val instanceof Parts) { - for (var i = 0; i < val.parts.length; ++i) { - var part = val.parts[i]; - if (part instanceof Variables) vars.push(part.names[0]); - } - } - } - - function generateArg(val, path, args) { - if (val instanceof Parts) { - var vals = []; - - for (var i = 0; i < val.parts.length; ++i) { - var part = val.parts[i]; - - if (part instanceof Variables) { - var varName = 'd' + path.renderIndex++; - - if (part.format) { - for (var j = 0; j < part.format.length; ++j) { - varName = part.format[j] + '(' + varName + ')'; - } - } - - vals.push(varName); - } else vals.push('"' + part.replace(/"/g, '\\"') + '"'); - } - - return vals.join('+'); - } else { - args.push(val); - return 's' + path.staticIndex++; - } - } - - function addParts(val, delim, block, info, escapeIt) { - var vals = []; - - if (val instanceof Parts) { - for (var i = 0; i < val.parts.length; ++i) { - var part = val.parts[i]; - - if (part instanceof Variables) { - var partName = part.names.join(","); - - if (part.format) { - for (var j = 0; j < part.format.length; ++j) { - partName = part.format[j] + "(" + partName + ")"; - } - } - - if (escapeIt) vals.push("__escape__(" + partName + ")");else vals.push(partName); - } else vals.push('"' + part + '"'); - } - } else if (isTag(val)) { - info.args.push(val); - vals.push('s' + info.argIndex++); - } else vals.push('"' + val + '"'); - - var parts = vals.join(delim); - if (parts) block.push(delim, parts); - } - - function isTag(obj) { - return (typeof obj == "function" || obj instanceof Function) && !!obj.tag; - } - - function creator(tag, cons) { - var fn = function fn() { - var tag = arguments.callee.tag; - var cons = arguments.callee.cons; - var newTag = new cons(); - return newTag.merge(arguments, tag); - }; - - fn.tag = tag; - fn.cons = cons; - extend(fn, Renderer); - return fn; - } - - function defineTags() { - Array.from(arguments).forEach(function (tagName) { - var fnName = tagName.toUpperCase(); - - exports.tags[fnName] = function () { - var newTag = new this._domplate_.DomplateTag(tagName); - return newTag.merge(arguments); - }; - }); - } - - defineTags("a", "button", "br", "canvas", "col", "colgroup", "div", "fieldset", "form", "h1", "h2", "h3", "hr", "img", "input", "label", "legend", "li", "ol", "optgroup", "option", "p", "pre", "select", "span", "strong", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "tr", "tt", "ul"); -} - -exports.domplate = {}; -Domplate(exports.domplate); - -exports.domplate.ensureLoader = function () { - if (typeof window !== "undefined" && window.PINF) { - return window.PINF; - } - - var PINF = _require_("pinf-loader-js/loader.browser"); - - return window.PINF; -}; - -exports.domplate.loadRep = function (url, options, successCallback, errorCallback) { - if (typeof options === "function") { - errorCallback = successCallback; - successCallback = options; - options = {}; - } - - var PINF = exports.domplate.ensureLoader(); - return PINF.sandbox(url + ".rep", function (sandbox) { - var rep = sandbox.main(exports.domplate, options); - successCallback(rep); - }, errorCallback); -}; -},{"./renderer":2,"./rt":3,"./util":4,"pinf-loader-js/loader.browser":6}],2:[function(_require_,module,exports){ - -var Renderer = exports.Renderer = { - checkDebug: function checkDebug() {}, - renderHTML: function renderHTML(args, outputs, self) { - var code = []; - var markupArgs = [code, this.tag.context ? this.tag.context : null, args, outputs]; - markupArgs.push.apply(markupArgs, this.tag.markupArgs); - this.tag.renderMarkup.apply(self ? self : this.tag.subject, markupArgs); - - if (this.tag.resources && this.tag.subject._resourceListener) { - this.tag.subject._resourceListener.register(this.tag.resources); - } - - return code.join(""); - }, - insertRows: function insertRows(args, before, self) { - this.tag.compile(); - var outputs = []; - var html = this.renderHTML(args, outputs, self); - var doc = before.ownerDocument; - var table = doc.createElement("table"); - table.innerHTML = html; - var tbody = table.firstChild; - var parent = before.localName == "TR" ? before.parentNode : before; - var after = before.localName == "TR" ? before.nextSibling : null; - var firstRow = tbody.firstChild, - lastRow; - - while (tbody.firstChild) { - lastRow = tbody.firstChild; - if (after) parent.insertBefore(lastRow, after);else parent.appendChild(lastRow); - } - - var offset = 0; - - if (before.localName == "TR") { - var node = firstRow.parentNode.firstChild; - - for (; node && node != firstRow; node = node.nextSibling) { - ++offset; - } - } - - var domArgs = [firstRow, this.tag.context, offset]; - domArgs.push.apply(domArgs, this.tag.domArgs); - domArgs.push.apply(domArgs, outputs); - this.tag.renderDOM.apply(self ? self : this.tag.subject, domArgs); - return [firstRow, lastRow]; - }, - insertAfter: function insertAfter(args, before, self) { - this.tag.compile(); - var outputs = []; - var html = this.renderHTML(args, outputs, self); - var doc = before.ownerDocument; - var range = doc.createRange(); - range.selectNode(doc.body); - var frag = range.createContextualFragment(html); - var root = frag.firstChild; - if (before.nextSibling) before.parentNode.insertBefore(frag, before.nextSibling);else before.parentNode.appendChild(frag); - var domArgs = [root, this.tag.context, 0]; - domArgs.push.apply(domArgs, this.tag.domArgs); - domArgs.push.apply(domArgs, outputs); - this.tag.renderDOM.apply(self ? self : this.tag.subject ? this.tag.subject : null, domArgs); - return root; - }, - replace: function replace(args, parent, self) { - this.tag.compile(); - var outputs = []; - var html = this.renderHTML(args, outputs, self); - var root; - - if (parent.nodeType == 1) { - parent.innerHTML = html; - root = parent.firstChild; - } else { - if (!parent || parent.nodeType != 9) parent = document; - if (!womb || womb.ownerDocument != parent) womb = parent.createElement("div"); - womb.innerHTML = html; - root = womb.firstChild; - } - - var domArgs = [root, this.tag.context ? this.tag.context : null, 0]; - domArgs.push.apply(domArgs, this.tag.domArgs); - domArgs.push.apply(domArgs, outputs); - this.tag.renderDOM.apply(self ? self : this.tag.subject, domArgs); - return root; - }, - append: function append(args, parent, self) { - this.tag.compile(); - var outputs = []; - var html = this.renderHTML(args, outputs, self); - if (!womb || womb.ownerDocument != parent.ownerDocument) womb = parent.ownerDocument.createElement("div"); - womb.innerHTML = html; - root = womb.firstChild; - - while (womb.firstChild) { - parent.appendChild(womb.firstChild); - } - - var domArgs = [root, this.tag.context, 0]; - domArgs.push.apply(domArgs, this.tag.domArgs); - domArgs.push.apply(domArgs, outputs); - this.tag.renderDOM.apply(self ? self : this.tag.subject, domArgs); - return root; - }, - render: function render(args, self) { - this.tag.compile(); - var outputs = []; - var html = this.renderHTML(args, outputs, self); - return html; - } -}; -},{}],3:[function(_require_,module,exports){ - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function ArrayIterator(array) { - var index = -1; - - this.next = function () { - if (++index >= array.length) throw StopIteration; - return array[index]; - }; -} - -function StopIteration() {} - -exports.makeMarkupRuntime = function (EVAL, context) { - var self = context.self; - var tagName = null; - Object.keys(self.subject).forEach(function (name) { - if (self.subject[name].tag === self) { - tagName = name; - } - }); - - if (!tagName) { - throw new Error("Unable to determine 'tagName'!"); - } - - var exports = {}; - exports.compiled = context.compiled && context.compiled[tagName] || null; - - exports.__link__ = function (tag, code, outputs, args) { - if (!tag) { - return; - } - - if (!tag.tag) { - return; - } - - if (!exports.compiled && EVAL.onMarkupCode) { - return; - } - - tag.tag.compile(); - - if (self.resources && tag.tag.resources && tag.tag.resources !== self.resources) { - for (var key in tag.tag.resources) { - self.resources[key] = tag.tag.resources[key]; - } - } - - var tagOutputs = []; - var markupArgs = [code, tag.tag.context ? tag.tag.context : null, args, tagOutputs]; - markupArgs.push.apply(markupArgs, tag.tag.markupArgs); - tag.tag.renderMarkup.apply(tag.tag.subject, markupArgs); - outputs.push(tag); - outputs.push(tagOutputs); - }; - - exports.__escape__ = function (value) { - function replaceChars(ch) { - switch (ch) { - case "<": - return "<"; - - case ">": - return ">"; - - case "&": - return "&"; - - case "'": - return "'"; - - case '"': - return """; - } - - return "?"; - } - - ; - return String(value).replace(/[<>&"']/g, replaceChars); - }; - - exports.__loop__ = function (iter, outputs, fn) { - var iterOuts = []; - outputs.push(iterOuts); - - if (iter instanceof Array || typeof iter === "array" || Array.isArray(iter)) { - iter = new ArrayIterator(iter); - } - - try { - if (!iter || !iter.next) { - console.error("Cannot iterate loop", iter, _typeof(iter), outputs, fn); - throw new Error("Cannot iterate loop as iter.next() method is not defined"); - } - - while (1) { - var value = iter.next(); - var itemOuts = [0, 0]; - iterOuts.push(itemOuts); - fn.apply(this, [value, itemOuts]); - } - } catch (exc) { - if (exc != StopIteration) throw exc; - } - }; - - exports.__if__ = function (booleanVar, outputs, fn) { - var ifControl = []; - outputs.push(ifControl); - - if (booleanVar) { - ifControl.push(1); - fn.apply(this, [ifControl]); - } else { - ifControl.push(0); - } - }; - - return exports; -}; - -exports.makeDOMRuntime = function (EVAL, context) { - var self = context.self; - var tagName = null; - Object.keys(self.subject).forEach(function (name) { - if (self.subject[name].tag === self) { - tagName = name; - } - }); - - if (!tagName) { - throw new Error("Unable to determine 'tagName'!"); - } - - var exports = {}; - exports.compiled = context.compiled && context.compiled[tagName] || null; - - exports.__bind__ = function (object, fn) { - return function (event) { - return fn.apply(object, [event]); - }; - }; - - exports.__link__ = function (node, tag, args) { - if (!tag) { - return 0; - } - - if (!tag.tag) { - return 0; - } - - if (!exports.compiled && EVAL.onMarkupCode) { - return 0; - } - - tag.tag.compile(); - var domArgs = [node, tag.tag.context ? tag.tag.context : null, 0]; - domArgs.push.apply(domArgs, tag.tag.domArgs); - domArgs.push.apply(domArgs, args); - var oo = tag.tag.renderDOM.apply(tag.tag.subject, domArgs); - return oo; - }; - - exports.__loop__ = function (iter, fn) { - if (!Array.isArray(iter)) { - return 0; - } - - var nodeCount = 0; - - for (var i = 0; i < iter.length; ++i) { - iter[i][0] = i; - iter[i][1] = nodeCount; - nodeCount += fn.apply(this, iter[i]); - } - - return nodeCount; - }; - - exports.__if__ = function (control, fn) { - if (control && control[0]) { - fn.apply(this, [0, control[1]]); - } else {} - }; - - exports.__path__ = function (parent, offset) { - var root = parent; - - for (var i = 2; i < arguments.length; ++i) { - var index = arguments[i]; - if (i == 3) index += offset; - - if (index == -1) { - parent = parent.parentNode; - } else { - parent = parent.childNodes[index]; - } - } - - return parent; - }; - - return exports; -}; -},{}],4:[function(_require_,module,exports){ - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -var FBTrace = {}; -exports.merge = _require_("deepmerge"); - -exports.escapeNewLines = function (value) { - return value.replace(/\r/gm, "\\r").replace(/\n/gm, "\\n"); -}; - -exports.stripNewLines = function (value) { - return typeof value == "string" ? value.replace(/[\r\n]/gm, " ") : value; -}; - -exports.escapeJS = function (value) { - return value.replace(/\r/gm, "\\r").replace(/\n/gm, "\\n").replace('"', '\\"', "g"); -}; - -exports.cropString = function (text, limit, alterText) { - if (!alterText) alterText = "..."; - text = text + ""; - if (!limit) limit = 50; - var halfLimit = limit / 2; - halfLimit -= 2; - if (text.length > limit) return text.substr(0, halfLimit) + alterText + text.substr(text.length - halfLimit);else return text; -}; - -exports.cropStringLeft = function (text, limit, alterText) { - if (!alterText) alterText = "..."; - text = text + ""; - if (!limit) limit = 50; - limit -= alterText.length; - if (text.length > limit) return alterText + text.substr(text.length - limit);else return text; -}; - -exports.hasClass = function (node, name) { - if (!node || node.nodeType != 1) return false;else { - for (var i = 1; i < arguments.length; ++i) { - var name = arguments[i]; - var re = new RegExp("(^|\\s)" + name + "($|\\s)"); - if (!re.exec(node.getAttribute("class"))) return false; - } - - return true; - } -}; - -exports.setClass = function (node, name) { - if (node && !exports.hasClass(node, name)) node.className += " " + name; -}; - -exports.getClassValue = function (node, name) { - var re = new RegExp(name + "-([^ ]+)"); - var m = re.exec(node.className); - return m ? m[1] : ""; -}; - -exports.removeClass = function (node, name) { - if (node && node.className) { - var index = node.className.indexOf(name); - - if (index >= 0) { - var size = name.length; - node.className = node.className.substr(0, index - 1) + node.className.substr(index + size); - } - } -}; - -exports.toggleClass = function (elt, name) { - if (exports.hasClass(elt, name)) exports.removeClass(elt, name);else exports.setClass(elt, name); -}; - -exports.setClassTimed = function (elt, name, context, timeout) { - if (!timeout) timeout = 1300; - if (elt.__setClassTimeout) context.clearTimeout(elt.__setClassTimeout);else exports.setClass(elt, name); - - if (!exports.isVisible(elt)) { - if (elt.__invisibleAtSetPoint) elt.__invisibleAtSetPoint--;else elt.__invisibleAtSetPoint = 5; - } else { - delete elt.__invisibleAtSetPoint; - } - - elt.__setClassTimeout = context.setTimeout(function () { - delete elt.__setClassTimeout; - if (elt.__invisibleAtSetPoint) exports.setClassTimed(elt, name, context, timeout);else { - delete elt.__invisibleAtSetPoint; - exports.removeClass(elt, name); - } - }, timeout); -}; - -exports.cancelClassTimed = function (elt, name, context) { - if (elt.__setClassTimeout) { - exports.removeClass(elt, name); - context.clearTimeout(elt.__setClassTimeout); - delete elt.__setClassTimeout; - } -}; - -exports.$ = function (id, doc) { - if (doc) return doc.getElementById(id);else return document.getElementById(id); -}; - -exports.getChildByClass = function (node) { - for (var i = 1; i < arguments.length; ++i) { - var className = arguments[i]; - var child = node.firstChild; - node = null; - - for (; child; child = child.nextSibling) { - if (exports.hasClass(child, className)) { - node = child; - break; - } - } - } - - return node; -}; - -exports.getAncestorByClass = function (node, className) { - for (var parent = node; parent; parent = parent.parentNode) { - if (exports.hasClass(parent, className)) return parent; - } - - return null; -}; - -exports.getElementByClass = function (node, className) { - var args = cloneArray(arguments); - args.splice(0, 1); - var className = args.join(" "); - var elements = node.getElementsByClassName(className); - return elements[0]; -}; - -exports.getElementsByClass = function (node, className) { - var args = cloneArray(arguments); - args.splice(0, 1); - var className = args.join(" "); - return node.getElementsByClassName(className); -}; - -exports.getElementsByAttribute = function (node, attrName, attrValue) { - function iteratorHelper(node, attrName, attrValue, result) { - for (var child = node.firstChild; child; child = child.nextSibling) { - if (child.getAttribute(attrName) == attrValue) result.push(child); - iteratorHelper(child, attrName, attrValue, result); - } - } - - var result = []; - iteratorHelper(node, attrName, attrValue, result); - return result; -}; - -exports.isAncestor = function (node, potentialAncestor) { - for (var parent = node; parent; parent = parent.parentNode) { - if (parent == potentialAncestor) return true; - } - - return false; -}; - -exports.getNextElement = function (node) { - while (node && node.nodeType != 1) { - node = node.nextSibling; - } - - return node; -}; - -exports.getPreviousElement = function (node) { - while (node && node.nodeType != 1) { - node = node.previousSibling; - } - - return node; -}; - -exports.getBody = function (doc) { - if (doc.body) return doc.body; - var body = doc.getElementsByTagName("body")[0]; - if (body) return body; - return doc.documentElement; -}; - -exports.findNextDown = function (node, criteria) { - if (!node) return null; - - for (var child = node.firstChild; child; child = child.nextSibling) { - if (criteria(child)) return child; - var next = exports.findNextDown(child, criteria); - if (next) return next; - } -}; - -exports.findPreviousUp = function (node, criteria) { - if (!node) return null; - - for (var child = node.lastChild; child; child = child.previousSibling) { - var next = exports.findPreviousUp(child, criteria); - if (next) return next; - if (criteria(child)) return child; - } -}; - -exports.findNext = function (node, criteria, upOnly, maxRoot) { - if (!node) return null; - - if (!upOnly) { - var next = exports.findNextDown(node, criteria); - if (next) return next; - } - - for (var sib = node.nextSibling; sib; sib = sib.nextSibling) { - if (criteria(sib)) return sib; - var next = exports.findNextDown(sib, criteria); - if (next) return next; - } - - if (node.parentNode && node.parentNode != maxRoot) return exports.findNext(node.parentNode, criteria, true); -}; - -exports.findPrevious = function (node, criteria, downOnly, maxRoot) { - if (!node) return null; - - for (var sib = node.previousSibling; sib; sib = sib.previousSibling) { - var prev = exports.findPreviousUp(sib, criteria); - if (prev) return prev; - if (criteria(sib)) return sib; - } - - if (!downOnly) { - var next = exports.findPreviousUp(node, criteria); - if (next) return next; - } - - if (node.parentNode && node.parentNode != maxRoot) { - if (criteria(node.parentNode)) return node.parentNode; - return exports.findPrevious(node.parentNode, criteria, true); - } -}; - -exports.getNextByClass = function (root, state) { - function iter(node) { - return node.nodeType == 1 && exports.hasClass(node, state); - } - - return exports.findNext(root, iter); -}; - -exports.getPreviousByClass = function (root, state) { - function iter(node) { - return node.nodeType == 1 && exports.hasClass(node, state); - } - - return exports.findPrevious(root, iter); -}; - -exports.hasChildElements = function (node) { - if (node.contentDocument) return true; - - for (var child = node.firstChild; child; child = child.nextSibling) { - if (child.nodeType == 1) return true; - } - - return false; -}; - -exports.isElement = function (o) { - try { - return o && o instanceof Element; - } catch (ex) { - return false; - } -}; - -exports.isNode = function (o) { - try { - return o && o instanceof Node; - } catch (ex) { - return false; - } -}; - -exports.cancelEvent = function (event) { - event.stopPropagation(); - event.preventDefault(); -}; - -exports.isLeftClick = function (event) { - return event.button == 0 && exports.noKeyModifiers(event); -}; - -exports.isMiddleClick = function (event) { - return event.button == 1 && exports.noKeyModifiers(event); -}; - -exports.isRightClick = function (event) { - return event.button == 2 && exports.noKeyModifiers(event); -}; - -exports.noKeyModifiers = function (event) { - return !event.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey; -}; - -exports.isControlClick = function (event) { - return event.button == 0 && exports.isControl(event); -}; - -exports.isShiftClick = function (event) { - return event.button == 0 && exports.isShift(event); -}; - -exports.isControl = function (event) { - return (event.metaKey || event.ctrlKey) && !event.shiftKey && !event.altKey; -}; - -exports.isControlShift = function (event) { - return (event.metaKey || event.ctrlKey) && event.shiftKey && !event.altKey; -}; - -exports.isShift = function (event) { - return event.shiftKey && !event.metaKey && !event.ctrlKey && !event.altKey; -}; - -exports.bind = function () { - var args = cloneArray(arguments), - fn = args.shift(), - object = args.shift(); - return function () { - return fn.apply(object, arrayInsert(cloneArray(args), 0, arguments)); - }; -}; - -exports.bindFixed = function () { - var args = cloneArray(arguments), - fn = args.shift(), - object = args.shift(); - return function () { - return fn.apply(object, args); - }; -}; - -exports.extend = function (l, r) { - var newOb = {}; - - for (var n in l) { - newOb[n] = l[n]; - } - - for (var n in r) { - newOb[n] = r[n]; - } - - return newOb; -}; - -exports.keys = function (map) { - var keys = []; - - try { - for (var name in map) { - keys.push(name); - } - } catch (exc) {} - - return keys; -}; - -exports.values = function (map) { - var values = []; - - try { - for (var name in map) { - try { - values.push(map[name]); - } catch (exc) { - if (FBTrace.DBG_ERRORS) FBTrace.dumpPropreties("lib.values FAILED ", exc); - } - } - } catch (exc) { - if (FBTrace.DBG_ERRORS) FBTrace.dumpPropreties("lib.values FAILED ", exc); - } - - return values; -}; - -exports.remove = function (list, item) { - for (var i = 0; i < list.length; ++i) { - if (list[i] == item) { - list.splice(i, 1); - break; - } - } -}; - -exports.sliceArray = function (array, index) { - var slice = []; - - for (var i = index; i < array.length; ++i) { - slice.push(array[i]); - } - - return slice; -}; - -function cloneArray(array, fn) { - var newArray = []; - if (fn) for (var i = 0; i < array.length; ++i) { - newArray.push(fn(array[i])); - } else for (var i = 0; i < array.length; ++i) { - newArray.push(array[i]); - } - return newArray; -} - -function extendArray(array, array2) { - var newArray = []; - newArray.push.apply(newArray, array); - newArray.push.apply(newArray, array2); - return newArray; -} - -exports.extendArray = extendArray; -exports.cloneArray = cloneArray; - -function arrayInsert(array, index, other) { - for (var i = 0; i < other.length; ++i) { - array.splice(i + index, 0, other[i]); - } - - return array; -} - -exports.arrayInsert = arrayInsert; - -exports.isArrayLike = function (object) { - return Object.prototype.toString.call(object) == "[object Array]" || exports.isArguments(object); -}; - -exports.isArguments = function (object) { - if (Object.prototype.toString.call(object) == "[object Arguments]") return true; - if (!_typeof(object) == "object" || !Object.prototype.hasOwnProperty.call(object, 'callee') || !object.callee || Object.prototype.toString.call(object.callee) !== '[object Function]' || typeof object.length != 'number') return false; - - for (var name in object) { - if (name === 'callee' || name === 'length') return false; - } - - return true; -}; -},{"deepmerge":5}],5:[function(_require_,module,exports){ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.deepmerge = factory()); -}(this, (function () { 'use strict'; - -var isMergeableObject = function isMergeableObject(value) { - return isNonNullObject(value) - && !isSpecial(value) -}; - -function isNonNullObject(value) { - return !!value && typeof value === 'object' -} - -function isSpecial(value) { - var stringValue = Object.prototype.toString.call(value); - - return stringValue === '[object RegExp]' - || stringValue === '[object Date]' - || isReactElement(value) -} - -// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 -var canUseSymbol = typeof Symbol === 'function' && Symbol.for; -var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; - -function isReactElement(value) { - return value.$$typeof === REACT_ELEMENT_TYPE -} - -function emptyTarget(val) { - return Array.isArray(val) ? [] : {} -} - -function cloneUnlessOtherwiseSpecified(value, options) { - return (options.clone !== false && options.isMergeableObject(value)) - ? deepmerge(emptyTarget(value), value, options) - : value -} - -function defaultArrayMerge(target, source, options) { - return target.concat(source).map(function(element) { - return cloneUnlessOtherwiseSpecified(element, options) - }) -} - -function mergeObject(target, source, options) { - var destination = {}; - if (options.isMergeableObject(target)) { - Object.keys(target).forEach(function(key) { - destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); - }); - } - Object.keys(source).forEach(function(key) { - if (!options.isMergeableObject(source[key]) || !target[key]) { - destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); - } else { - destination[key] = deepmerge(target[key], source[key], options); - } - }); - return destination -} - -function deepmerge(target, source, options) { - options = options || {}; - options.arrayMerge = options.arrayMerge || defaultArrayMerge; - options.isMergeableObject = options.isMergeableObject || isMergeableObject; - - var sourceIsArray = Array.isArray(source); - var targetIsArray = Array.isArray(target); - var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; - - if (!sourceAndTargetTypesMatch) { - return cloneUnlessOtherwiseSpecified(source, options) - } else if (sourceIsArray) { - return options.arrayMerge(target, source, options) - } else { - return mergeObject(target, source, options) - } -} - -deepmerge.all = function deepmergeAll(array, options) { - if (!Array.isArray(array)) { - throw new Error('first argument should be an array') - } - - return array.reduce(function(prev, next) { - return deepmerge(prev, next, options) - }, {}) -}; - -var deepmerge_1 = deepmerge; - -return deepmerge_1; - -}))); - -},{}],6:[function(_require_,module,exports){ -/** - * Author: Christoph Dorn - * License: Zero-Clause BSD - https://opensource.org/licenses/0BSD -**/ - -exports.PINF = (function (global) { - - if (!global || typeof global !== "object") { - throw new Error("No root object scope provided!"); - } - - // If `PINF` gloabl already exists, don't do anything to change it. - if (typeof global.PINF !== "undefined") { - return global.PINF; - } - - const LOADER = _require_('./loader'); - - const PINF = LOADER.Loader({ - document: global.document - }); - - global.PINF = PINF; - - // Attach postMessage handler to listen for sandbox load triggers. - // This is useful in Web Workers where only the loader must be loaded and - // sandboxes can then be loaded like this: - // worker.postMessage(URIJS("notify://pinf-loader-js/sandbox/load").addSearch("uri", uri).toString()) - if (typeof global.addEventListener === "function") { - global.addEventListener("message", function (event) { - var m = null; - if ( - typeof event.data === "string" && - (m = event.data.match(/^notify:\/\/pinf-loader-js\/sandbox\/load\?uri=(.+)$/)) && - (m = decodeURIComponent(m[1])) && - // SECURITY: Only allow URIs that begin with `/` so that scripts may NOT - // be loaded cross-domain this way. If this was allowed one could - // load malicious code simply by posting a message to this window. - /^\/[^\/]/.test(m) - ) { - return PINF.sandbox(m, function (sandbox) { - sandbox.main(); - if (typeof global.postMessage === "function") { - global.postMessage(event.data.replace("/load?", "/loaded?")); - } - }, function (err) { - // TODO: Post error back to main frame instead of throwing? - throw err; - }); - } - }, false); - } - - return global.PINF; -}( - typeof window !== "undefined" ? - // Used in the browser - window : - typeof self !== "undefined" ? - // Used in web worker - self : - // No root scope variable found - null -)); - -},{"./loader":7}],7:[function(_require_,module,exports){ -/** - * Author: Christoph Dorn - * License: Zero-Clause BSD - https://opensource.org/licenses/0BSD -**/ - -(function (exports) { - -// The global `require` for the 'external' (to the loader) environment. -var Loader = function (global) { - - var loadedBundles = [], - // @see https://github.com/unscriptable/curl/blob/62caf808a8fd358ec782693399670be6806f1845/src/curl.js#L69 - readyStates = { 'loaded': 1, 'interactive': 1, 'complete': 1 }, - lastModule = null, - headTag = null; - - // For older browsers that don't have `Object.keys()` (Firefox 3.6) - function keys(obj) { - var keys = []; - for (var key in obj) { - keys.push(key); - } - return keys; - } - - // TODO: Use 'Object.create()` in modern browsers - function create (proto) { - function F() {} - F.prototype = proto; - return new F(); - }; - - function normalizeSandboxArguments (implementation) { - return function (programIdentifier, options, loadedCallback, errorCallback) { - /*DEBUG*/ if (typeof options === "function" && typeof loadedCallback === "object") { - /*DEBUG*/ throw new Error("Callback before options for `require.sandbox(programIdentifier, options, loadedCallback)`"); - /*DEBUG*/ } - if (typeof options === "function" && !loadedCallback && !errorCallback) { - loadedCallback = options; - options = {}; - } else - if (typeof options === "function" && typeof loadedCallback === "function" && !errorCallback) { - errorCallback = loadedCallback; - loadedCallback = options; - options = {}; - } else { - options = options || {}; - } - implementation(programIdentifier, options, loadedCallback, errorCallback); - }; - } - - // @credit https://github.com/unscriptable/curl/blob/62caf808a8fd358ec782693399670be6806f1845/src/curl.js#L319-360 - function loadInBrowser (uri, loadedCallback) { - try { - // See if we are in a web worker. - if (typeof importScripts !== "undefined") { - importScripts(uri.replace(/^\/?\{host\}/, "")); - return loadedCallback(null); - } - var document = global.document; - /*DEBUG*/ if (!document) { - /*DEBUG*/ throw new Error("Unable to get reference to 'document'!"); - /*DEBUG*/ } - var location = document.location; - if (/^\/?\{host\}\//.test(uri)) { - uri = location.protocol + "//" + location.host + uri.replace(/^\/?\{host\}/, ""); - } else - if (/^\/\//.test(uri)) { - uri = location.protocol + uri; - } - if (!headTag) { - headTag = document.getElementsByTagName("head")[0]; - } - var element = document.createElement("script"); - element.type = "text/javascript"; - element.onload = element.onreadystatechange = function (ev) { - ev = ev || global.event; - if (ev.type === "load" || readyStates[this.readyState]) { - this.onload = this.onreadystatechange = this.onerror = null; - loadedCallback(null, function () { - element.parentNode.removeChild(element); - }); - } - } - element.onerror = function (err) { - /*DEBUG*/ console.error(err); - return loadedCallback(new Error("Error loading '" + uri + "'")); - } - element.charset = "utf-8"; - element.async = true; - element.src = uri; - element = headTag.insertBefore(element, headTag.firstChild); - } catch(err) { - loadedCallback(err); - } - } - - // A set of modules working together. - var Sandbox = function (sandboxIdentifier, sandboxOptions, loadedCallback) { - - var moduleInitializers = {}, - initializedModules = {}, - /*DEBUG*/ bundleIdentifiers = {}, - packages = {}, - loadingBundles = {}; - - var sandbox = { - id: sandboxIdentifier - }; - - /*DEBUG*/ function logDebug() { - /*DEBUG*/ if (sandboxOptions.debug !== true) return; - /*DEBUG*/ // NOTRE: This does not work in google chrome. - /*DEBUG*/ //console.log.apply(null, arguments); - /*DEBUG*/ if (arguments.length === 1) { - /*DEBUG*/ console.log(arguments[0]); - /*DEBUG*/ } else - /*DEBUG*/ if (arguments.length === 2) { - /*DEBUG*/ console.log(arguments[0], arguments[1]); - /*DEBUG*/ } else - /*DEBUG*/ if (arguments.length === 3) { - /*DEBUG*/ console.log(arguments[0], arguments[1], arguments[2]); - /*DEBUG*/ } else - /*DEBUG*/ if (arguments.length === 4) { - /*DEBUG*/ console.log(arguments[0], arguments[1], arguments[2], arguments[3]); - /*DEBUG*/ } - /*DEBUG*/ } - - function rebaseUri (uri) { - if (!sandboxOptions.baseUrl) { - return uri; - } - return sandboxOptions.baseUrl + "/" + uri; - } - - function load (bundleIdentifier, packageIdentifier, bundleSubPath, loadedCallback) { - - var loadSandboxIdentifier = sandboxIdentifier; - var finalBundleIdentifier = null; - var moduleIdentifierPrefix = ""; - var finalPackageIdentifier = ""; - - try { - if (packageIdentifier !== "") { - - if (/^@bundle:/.test(packageIdentifier)) { - var absPackageIdentifier = packageIdentifier; - if (/^@bundle:\./.test(absPackageIdentifier)) { - absPackageIdentifier = absPackageIdentifier.replace(/^(@bundle:)\./, "$1" + sandboxIdentifier + "/."); - } - moduleIdentifierPrefix = packageIdentifier; - finalPackageIdentifier = packageIdentifier; - bundleIdentifier = absPackageIdentifier.replace(/^@bundle:/, "") + ".js"; - loadSandboxIdentifier = ""; - finalBundleIdentifier = "@bundle:" + packageIdentifier.replace(/^@bundle:/, "") + ".js"; - } else { - bundleIdentifier = ("/" + packageIdentifier + "/" + bundleIdentifier).replace(/\/+/g, "/"); - } - } - - if (initializedModules[bundleIdentifier]) { - // Module is already loaded and initialized. - loadedCallback(null, sandbox); - } else { - // Module is not initialized. - if (loadingBundles[bundleIdentifier]) { - // Module is already loading. - loadingBundles[bundleIdentifier].push(loadedCallback); - } else { - // Module is not already loading. - loadingBundles[bundleIdentifier] = []; - - bundleIdentifier = (loadSandboxIdentifier + bundleSubPath + bundleIdentifier).replace(/\/$/, ".js"); - - bundleIdentifier = bundleIdentifier.replace(/\.php\.js$/, ".php"); - - if (!finalBundleIdentifier) { - finalBundleIdentifier = bundleIdentifier; - } - - // Default to our script-injection browser loader. - (sandboxOptions.rootBundleLoader || sandboxOptions.load || loadInBrowser)( - rebaseUri(bundleIdentifier), - function (err, cleanupCallback) { - if (err) return loadedCallback(err); - // The rootBundleLoader is only applicable for the first load. - delete sandboxOptions.rootBundleLoader; - finalizeLoad(moduleIdentifierPrefix, finalBundleIdentifier, finalPackageIdentifier, function () { - loadedCallback(null, sandbox); - if (cleanupCallback) { - cleanupCallback(); - } - }); - } - ); - } - } - } catch(err) { - loadedCallback(err); - } - } - - // Called after a bundle has been loaded. Takes the top bundle off the *loading* stack - // and makes the new modules available to the sandbox. - function finalizeLoad (moduleIdentifierPrefix, bundleIdentifier, packageIdentifier, loadFinalized) { - var pending = 0; - function finalize () { - if (pending !== 0) { - return; - } - if (loadFinalized) loadFinalized(); - } - - pending += 1; - - // Assume a consistent statically linked set of modules has been memoized. - /*DEBUG*/ if (!loadedBundles[0]) { - /*DEBUG*/ throw new Error("No bundle memoized for '" + bundleIdentifier + "'! Check the file to ensure it contains JavaScript and that a bundle is memoized against the correct loader instance."); - /*DEBUG*/ } - /*DEBUG*/ bundleIdentifiers[bundleIdentifier] = loadedBundles[0][0]; - var loadedModuleInitializers = loadedBundles[0][1]({ - id: sandboxIdentifier - }); - var key; - for (key in loadedModuleInitializers) { - - var memoizeKey = moduleIdentifierPrefix + key; - - // If we have a package descriptor add it or merge it on top. - if (/^[^\/]*\/package.json$/.test(key)) { - - if (sandboxOptions.rewritePackageDescriptor) { - loadedModuleInitializers[key][0] = sandboxOptions.rewritePackageDescriptor(loadedModuleInitializers[key][0], memoizeKey); - } - - // Load all dependent resources - if (loadedModuleInitializers[key][0].mappings) { - for (var alias in loadedModuleInitializers[key][0].mappings) { - if (/^@script:\/\//.test(loadedModuleInitializers[key][0].mappings[alias])) { - pending += 1; - loadInBrowser( - rebaseUri(loadedModuleInitializers[key][0].mappings[alias].replace(/^@script:/, "")), - function () { - pending -= 1; - finalize(); - } - ); - } - } - } - - // NOTE: Not quite sure if we should allow agumenting package descriptors. - // When doing nested requires using same package we can either add all - // mappings (included mappings not needed until further down the tree) to - // the first encounter of the package descriptor or add more mappings as - // needed down the road. We currently support both. - - if (moduleInitializers[memoizeKey]) { - // TODO: Keep array of bundle identifiers instead of overwriting existing one? - // Overwriting may change subsequent bundeling behaviour? - moduleInitializers[memoizeKey][0] = bundleIdentifier; - // Only augment (instead of replace existing values). - if (typeof moduleInitializers[memoizeKey][1].main === "undefined") { - moduleInitializers[memoizeKey][1].main = loadedModuleInitializers[key][0].main; - } - if (loadedModuleInitializers[key][0].mappings) { - if (!moduleInitializers[memoizeKey][1].mappings) { - moduleInitializers[memoizeKey][1].mappings = {}; - } - for (var alias in loadedModuleInitializers[key][0].mappings) { - if (typeof moduleInitializers[memoizeKey][1].mappings[alias] === "undefined") { - moduleInitializers[memoizeKey][1].mappings[alias] = loadedModuleInitializers[key][0].mappings[alias]; - } - } - } - } else { - moduleInitializers[memoizeKey] = [bundleIdentifier, loadedModuleInitializers[key][0], loadedModuleInitializers[key][1]]; - } - // Now that we have a [updated] package descriptor, re-initialize it if we have it already in cache. - var packageIdentifier = packageIdentifier || key.split("/").shift(); - if (packages[packageIdentifier]) { - packages[packageIdentifier].init(); - } - } - // Only add modules that don't already exist! - // TODO: Log warning in debug mode if module already exists. - if (typeof moduleInitializers[memoizeKey] === "undefined") { - moduleInitializers[memoizeKey] = [bundleIdentifier, loadedModuleInitializers[key][0], loadedModuleInitializers[key][1]]; - } - } - loadedBundles.shift(); - - pending -= 1; - finalize(); - - return; - } - - var Package = function (packageIdentifier) { - if (packages[packageIdentifier]) { - return packages[packageIdentifier]; - } - - var pkg = { - id: packageIdentifier, - descriptor: {}, - main: "/main.js", - mappings: {}, - directories: {}, - libPath: "" - }; - - var parentModule = lastModule; - - pkg.init = function () { - var descriptor = (moduleInitializers[packageIdentifier + "/package.json"] && moduleInitializers[packageIdentifier + "/package.json"][1]) || {}; - if (descriptor) { - pkg.descriptor = descriptor; - if (typeof descriptor.main === "string") { - pkg.main = descriptor.main; - } - pkg.mappings = descriptor.mappings || pkg.mappings; - pkg.directories = descriptor.directories || pkg.directories; - // NOTE: We need `lib` directory support so that the source directory structure can be mapped - // into the bundle structure without modification. If this is not done, a module doing a relative _require_ - // for a resource outside of the lib directory will not find the file. - pkg.libPath = (typeof pkg.directories.lib !== "undefined" && pkg.directories.lib != "") ? pkg.directories.lib + "/" : pkg.libPath; - } - } - pkg.init(); - - function normalizeIdentifier (identifier) { - // If we have a period (".") in the basename we want an absolute path from - // the root of the package. Otherwise a relative path to the "lib" directory. - if (identifier.split("/").pop().indexOf(".") === -1) { - // We have a module relative to the "lib" directory of the package. - identifier = identifier + ".js"; - } else - if (!/^\//.test(identifier)) { - // We want an absolute path for the module from the root of the package. - identifier = "/" + identifier; - } - return identifier; - } - - var Module = function (moduleIdentifier, parentModule) { - - var moduleIdentifierSegment = null; - if (/^@bundle:/.test(moduleIdentifier)) { - moduleIdentifierSegment = moduleIdentifier.replace(packageIdentifier, "").replace(/\/[^\/]*$/, "").split("/"); - } else { - moduleIdentifierSegment = moduleIdentifier.replace(/\/[^\/]*$/, "").split("/"); - } - - var module = { - id: moduleIdentifier, - exports: {}, - parentModule: parentModule, - bundle: null, - pkg: packageIdentifier - }; - - function resolveIdentifier (identifier) { - if (/\/$/.test(identifier)) { - identifier += "index"; - } - lastModule = module; - // Check for plugin prefix. - var plugin = null; - if (/^[^!]*!/.test(identifier)) { - var m = identifier.match(/^([^!]*)!(.+)$/); - identifier = m[2]; - plugin = m[1]; - } - function pluginify (id) { - if (!plugin) return id; - id = new String(id); - id.plugin = plugin; - return id; - } - // Check for relative module path to module within same package. - if (/^\./.test(identifier)) { - var segments = identifier.replace(/^\.\//, "").split("../"); - identifier = "/" + moduleIdentifierSegment.slice(1, moduleIdentifierSegment.length-segments.length+1).concat(segments[segments.length-1]).join("/"); - if (identifier === "/.") { - return [pkg, pluginify("")]; - } - return [pkg, pluginify(normalizeIdentifier(identifier.replace(/\/\.$/, "/")))]; - } - var splitIdentifier = identifier.split("/"); - // Check for mapped module path to module within mapped package. - if (typeof pkg.mappings[splitIdentifier[0]] !== "undefined") { - return [Package(pkg.mappings[splitIdentifier[0]]), pluginify((splitIdentifier.length > 1)?normalizeIdentifier(splitIdentifier.slice(1).join("/")):"")]; - } - /*DEBUG*/ if (!moduleInitializers["/" + normalizeIdentifier(identifier)]) { - /*DEBUG*/ throw new Error("Descriptor for package '" + pkg.id + "' in sandbox '" + sandbox.id + "' does not declare 'mappings[\"" + splitIdentifier[0] + "\"]' property nor does sandbox have module memoized at '" + "/" + normalizeIdentifier(identifier) + "' needed to satisfy module path '" + identifier + "' in module '" + moduleIdentifier + "'!"); - /*DEBUG*/ } - return [Package(""), pluginify("/" + normalizeIdentifier(identifier))]; - } - - // Statically link a module and its dependencies - module.require = function (identifier) { - identifier = resolveIdentifier(identifier); - return identifier[0].require(identifier[1]).exports; - }; - - module.require.supports = [ - "ucjs-pinf-0" - ]; - - module.require.id = function (identifier) { - identifier = resolveIdentifier(identifier); - return identifier[0].require.id(identifier[1]); - }; - - module.require.async = function (identifier, loadedCallback, errorCallback) { - identifier = resolveIdentifier(identifier); - var mi = moduleIdentifier; - if (/^\//.test(identifier[0].id)) { - mi = "/main.js"; - } - identifier[0].load(identifier[1], module.bundle, function (err, moduleAPI) { - if (err) { - if (errorCallback) return errorCallback(err); - throw err; - } - loadedCallback(moduleAPI); - }); - }; - - module.require.sandbox = normalizeSandboxArguments (function (programIdentifier, options, loadedCallback, errorCallback) { - options.load = options.load || sandboxOptions.load; - // If the `programIdentifier` is relative it is resolved against the URI of the owning sandbox (not the owning page). - if (/^\./.test(programIdentifier)) - { - programIdentifier = sandboxIdentifier + "/" + programIdentifier; - // HACK: Temporary hack as zombie (https://github.com/assaf/zombie) does not normalize path before sending to server. - programIdentifier = programIdentifier.replace(/\/\.\//g, "/"); - } - return PINF.sandbox(programIdentifier, options, loadedCallback, errorCallback); - }); - module.require.sandbox.id = sandboxIdentifier; - - module.load = function () { - module.bundle = moduleInitializers[moduleIdentifier][0]; - if (typeof moduleInitializers[moduleIdentifier][1] === "function") { - - var moduleInterface = { - id: module.id, - filename: - // The `filename` from the meta info attached to the module. - // This is typically where the module was originally found on the filesystem. - moduleInitializers[moduleIdentifier][2].filename || - // Fall back to the virtual path of the module in the bundle. - // TODO: Insert a delimiter between bundle and module id. - (module.bundle.replace(/\.js$/, "") + "/" + module.id).replace(/\/+/g, "/"), - exports: {} - } - - if (packageIdentifier === "" && pkg.main === moduleIdentifier) { - module.require.main = moduleInterface; - } - - if (sandboxOptions.onInitModule) { - sandboxOptions.onInitModule(moduleInterface, module, pkg, sandbox, { - normalizeIdentifier: normalizeIdentifier, - resolveIdentifier: resolveIdentifier, - finalizeLoad: finalizeLoad, - moduleInitializers: moduleInitializers, - initializedModules: initializedModules - }); - } - - var exports = moduleInitializers[moduleIdentifier][1].call(exports, module.require, module.exports, moduleInterface); - if ( - typeof moduleInterface.exports !== "undefined" && - ( - typeof moduleInterface.exports !== "object" || - keys(moduleInterface.exports).length !== 0 - ) - ) { - module.exports = moduleInterface.exports; - } else - if (typeof exports !== "undefined") { - module.exports = exports; - } - } else - if (typeof moduleInitializers[moduleIdentifier][1] === "string") { - // TODO: Use more optimal string encoding algorythm to reduce payload size? - module.exports = decodeURIComponent(moduleInitializers[moduleIdentifier][1]); - } else { - module.exports = moduleInitializers[moduleIdentifier][1]; - } - }; - - /*DEBUG*/ module.getReport = function () { - /*DEBUG*/ var exportsCount = 0, - /*DEBUG*/ key; - /*DEBUG*/ for (key in module.exports) { - /*DEBUG*/ exportsCount++; - /*DEBUG*/ } - /*DEBUG*/ return { - /*DEBUG*/ exports: exportsCount - /*DEBUG*/ }; - /*DEBUG*/ }; - - return module; - }; - - pkg.load = function (moduleIdentifier, bundleIdentifier, loadedCallback) { - - // If module/bundle to be loaded asynchronously is already memoized we skip the load. - if (moduleInitializers[packageIdentifier + (moduleIdentifier || pkg.main)]) { - return loadedCallback(null, pkg.require(moduleIdentifier).exports); - } - var bundleSubPath = bundleIdentifier.substring(sandboxIdentifier.length); - load( - ((!/^\//.test(moduleIdentifier))?"/"+pkg.libPath:"") + moduleIdentifier, - packageIdentifier, - bundleSubPath.replace(/\.js$/g, ""), - function (err) { - if (err) return loadedCallback(err); - loadedCallback(null, pkg.require(moduleIdentifier).exports); - } - ); - } - - pkg.require = function (moduleIdentifier) { - - var plugin = moduleIdentifier.plugin; - - if (moduleIdentifier) { - if (!/^\//.test(moduleIdentifier)) { - moduleIdentifier = ("/" + ((moduleIdentifier.substring(0, pkg.libPath.length)===pkg.libPath)?"":pkg.libPath)).replace(/\/\.\//, "/") + moduleIdentifier; - } - moduleIdentifier = packageIdentifier + moduleIdentifier; - } else { - moduleIdentifier = packageIdentifier + pkg.main; - } - - if ( - !moduleInitializers[moduleIdentifier] && - moduleInitializers[moduleIdentifier.replace(/\.js$/, "/index.js")] - ) { - moduleIdentifier = moduleIdentifier.replace(/\.js$/, "/index.js"); - } - - // Use a specifically formatted module for requested plugin if available - if ( - plugin && - moduleInitializers[moduleIdentifier + ":" + plugin] - ) { - moduleIdentifier += ":" + plugin; - } - - if (!initializedModules[moduleIdentifier]) { - /*DEBUG*/ if (!moduleInitializers[moduleIdentifier]) { - /*DEBUG*/ console.error("[pinf-loader-js]", "moduleInitializers", moduleInitializers); - /*DEBUG*/ throw new Error("Module '" + moduleIdentifier + "' " + (plugin?"for format '" + plugin + "' ":"") + "not found in sandbox '" + sandbox.id + "'!"); - /*DEBUG*/ } - (initializedModules[moduleIdentifier] = Module(moduleIdentifier, lastModule)).load(); - } - - var loadingBundlesCallbacks; - if (loadingBundles[moduleIdentifier]) { - loadingBundlesCallbacks = loadingBundles[moduleIdentifier]; - delete loadingBundles[moduleIdentifier]; - for (var i=0 ; i0) { - graph["instances"] = []; - this.instances.forEach(function(instance) { - graph["instances"].push(instance[1]); - }); - } - - if(UTIL.has(options, "jsonEncode") && !options.jsonEncode) { - return graph; - } - - try { - return JSON.encode(graph); - } catch(e) { - console.warn("Error jsonifying object graph" + e); - throw e; - } - return null; -} - -function setMeta (node, name, value) { - node.meta = node.meta || {}; - node.meta[name] = value; -} - -function completeWithMeta (meta, node) { - node.meta = node.meta || {}; - Object.keys(meta).forEach(function (name) { - if (typeof node.meta[name] === 'undefined') { - node.meta[name] = meta[name]; - } - }); - return node; -} - -Encoder.prototype.encodeVariable = function(meta, variable, objectDepth, arrayDepth, overallDepth) { - objectDepth = objectDepth || 1; - arrayDepth = arrayDepth || 1; - overallDepth = overallDepth || 1; - - if(variable===null) { - var ret = {"type": "constant", "value": "null"}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "null"); - } - ret = completeWithMeta(meta, ret); - return ret; - } else - if(variable===true || variable===false) { - var ret = {"type": "constant", "value": (variable===true)?"true":"false"}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "boolean"); - } - ret = completeWithMeta(meta, ret); - return ret; - } - - var type = typeof variable; - if(type=="undefined") { - var ret = {"type": "constant", "value": "undefined"}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "undefined"); - } - completeWithMeta(meta, ret); - return ret; - } else - if(type=="number") { - if(Math.round(variable)==variable) { - var ret = {"type": "string", "value": ""+variable}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "integer"); - } - completeWithMeta(meta, ret); - return ret; - } else { - var ret = {"type": "string", "value": ""+variable}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "float"); - } - completeWithMeta(meta, ret); - return ret; - } - } else - if(type=="string") { - // HACK: This should be done via an option - // FirePHPCore compatibility: Detect resource string - if(variable=="** Excluded by Filter **") { - var ret = {"type": "string", "value": variable}; - setMeta(ret, "encoder.notice", "Excluded by Filter"); - setMeta(ret, "encoder.trimmed", true); - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "string"); - } - completeWithMeta(meta, ret); - return ret; - } else - if(variable.match(/^\*\*\sRecursion\s\([^\(]*\)\s\*\*$/)) { - var ret = {"type": "string", "value": variable}; - setMeta(ret, "encoder.notice", "Recursion"); - setMeta(ret, "encoder.trimmed", true); - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "string"); - } - completeWithMeta(meta, ret); - return ret; - } else - if(variable.match(/^\*\*\sResource\sid\s#\d*\s\*\*$/)) { - var ret = {"type": "string", "value": variable.substring(3, variable.length-3)}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "resource"); - } - completeWithMeta(meta, ret); - return ret; - } else { - var ret = {"type": "string", "value": variable}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "string"); - } - completeWithMeta(meta, ret); - return ret; - } - } - - if (variable && variable.__no_serialize === true) { - var ret = {"type": "string", "value": "Object"}; - setMeta(ret, "encoder.notice", "Excluded by __no_serialize"); - setMeta(ret, "encoder.trimmed", true); - completeWithMeta(meta, ret); - return ret; - } - - if(type=="function") { - var ret = {"type": "string", "string": ""+variable}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "function"); - } - completeWithMeta(meta, ret); - return ret; - } else - if(type=="object") { - - try { - if(UTIL.isArrayLike(variable)) { - var ret = { - "type": "array", - "value": this.encodeArray(meta, variable, objectDepth, arrayDepth, overallDepth) - }; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "array"); - } - ret = completeWithMeta(meta, ret); - return ret; - } - } catch (err) { -// TODO: Find a better way to encode variables that cause security exceptions when accessed etc... - var ret = {"type": "string", "string": "Cannot serialize"}; - setMeta(ret, "encoder.notice", "Cannot serialize"); - setMeta(ret, "encoder.trimmed", true); - completeWithMeta(meta, ret); - return ret; - } - // HACK: This should be done via an option - // FirePHPCore compatibility: we only have an object if a class name is present - - if(typeof variable["__className"] != "undefined" ) { - var ret = { - "type": "reference", - "value": this.encodeInstance(meta, variable, objectDepth, arrayDepth, overallDepth) - }; - completeWithMeta(meta, ret); - return ret; - } else { - var ret; - if (/^\[Exception\.\.\.\s/.test(variable)) { - ret = { - "type": "map", - "value": this.encodeException(meta, variable, objectDepth, arrayDepth, overallDepth) - }; - } else { - ret = { - "type": "map", - "value": this.encodeAssociativeArray(meta, variable, objectDepth, arrayDepth, overallDepth) - }; - } - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "map"); - } - completeWithMeta(meta, ret); - return ret; - } - } - - var ret = {"type": "string", "value": "Variable with type '" + type + "' unknown: "+variable}; - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "unknown"); - } - completeWithMeta(meta, ret); - return ret; -// return "["+(typeof variable)+"]["+variable+"]"; -} - -Encoder.prototype.encodeArray = function(meta, variable, objectDepth, arrayDepth, overallDepth) { - objectDepth = objectDepth || 1; - arrayDepth = arrayDepth || 1; - overallDepth = overallDepth || 1; - if(arrayDepth > this.options["maxArrayDepth"]) { - return {"notice": "Max Array Depth (" + this.options["maxArrayDepth"] + ")"}; - } else - if(overallDepth > this.options["maxOverallDepth"]) { - return {"notice": "Max Overall Depth (" + this.options["maxOverallDepth"] + ")"}; - } - var self = this, - items = []; - UTIL.forEach(variable, function(item) { - items.push(self.encodeVariable(meta, item, 1, arrayDepth + 1, overallDepth + 1)); - }); - return items; -} - - -Encoder.prototype.encodeAssociativeArray = function(meta, variable, objectDepth, arrayDepth, overallDepth) { - objectDepth = objectDepth || 1; - arrayDepth = arrayDepth || 1; - overallDepth = overallDepth || 1; - if(arrayDepth > this.options["maxArrayDepth"]) { - return {"notice": "Max Array Depth (" + this.options["maxArrayDepth"] + ")"}; - } else - if(overallDepth > this.options["maxOverallDepth"]) { - return {"notice": "Max Overall Depth (" + this.options["maxOverallDepth"] + ")"}; - } - var self = this, - items = []; - for (var key in variable) { - - // HACK: This should be done via an option - // FirePHPCore compatibility: numeric (integer) strings as keys in associative arrays get converted to integers - // http://www.php.net/manual/en/language.types.array.php - if(isNumber(key) && Math.round(key)==key) { - key = parseInt(key); - } - - items.push([ - self.encodeVariable(meta, key, 1, arrayDepth + 1, overallDepth + 1), - self.encodeVariable(meta, variable[key], 1, arrayDepth + 1, overallDepth + 1) - ]); - } - return items; -} - - -Encoder.prototype.encodeException = function(meta, variable, objectDepth, arrayDepth, overallDepth) { - var self = this, - items = []; - items.push([ - self.encodeVariable(meta, "message", 1, arrayDepth + 1, overallDepth + 1), - self.encodeVariable(meta, (""+variable), 1, arrayDepth + 1, overallDepth + 1) - ]); - return items; -} - -// http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric -function isNumber(n) { - return !isNaN(parseFloat(n)) && isFinite(n); -} - - - -Encoder.prototype.getInstanceId = function(object) { - for( var i=0 ; i this.options["maxObjectDepth"]) { - return {"notice": "Max Object Depth (" + this.options["maxObjectDepth"] + ")"}; - } else - if(overallDepth > this.options["maxOverallDepth"]) { - return {"notice": "Max Overall Depth (" + this.options["maxOverallDepth"] + ")"}; - } - - var self = this, - ret = {"type": "dictionary", "value": {}}; - - // HACK: This should be done via an option - // FirePHPCore compatibility: we have an object if a class name is present - var isPHPClass = false; - if(typeof object["__className"] != "undefined") { - isPHPClass = true; - setMeta(ret, "lang.class", object["__className"]); - delete(object["__className"]); - if(this.options["includeLanguageMeta"]) { - setMeta(ret, "lang.type", "object"); - } - } - - // HACK: This should be done via an option - // FirePHPCore compatibility: we have an exception if a class name is present - if(typeof object["__isException"] != "undefined" && object["__isException"]) { - setMeta(ret, "lang.type", "exception"); - } - - UTIL.forEach(object, function(item) { - try { - if(item[0]=="__fc_tpl_id") { - ret['fc.tpl.id'] = item[1]; - return; - } - if(isPHPClass) { - var val = self.encodeVariable(meta, item[1], objectDepth + 1, 1, overallDepth + 1), - parts = item[0].split(":"), - name = parts[parts.length-1]; - if(parts[0]=="public") { - val["lang.visibility"] = "public"; - } else - if(parts[0]=="protected") { - val["lang.visibility"] = "protected"; - } else - if(parts[0]=="private") { - val["lang.visibility"] = "private"; - } else - if(parts[0]=="undeclared") { - val["lang.undeclared"] = 1; - } - if(parts.length==2 && parts[1]=="static") { - val["lang.static"] = 1; - } - ret["value"][name] = val; - } else { - ret["value"][item[0]] = self.encodeVariable(meta, item[1], objectDepth + 1, 1, overallDepth + 1); - } - } catch(e) { - console.warn(e); - ret["value"]["__oops__"] = {"notice": "Error encoding member (" + e + ")"}; - } - }); - - completeWithMeta(meta, ret); - - return ret; -} -},{"fp-modules-for-nodejs/lib/json":4,"fp-modules-for-nodejs/lib/util":5}],4:[function(require,module,exports){ - -exports.encode = JSON.stringify; -exports.decode = JSON.parse; - -},{}],5:[function(require,module,exports){ - -// -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License -// -- isaacs Isaac Schlueter -// -- nrstott Nathan Stott -// -- fitzgen Nick Fitzgerald -// -- nevilleburnell Neville Burnell -// -- cadorn Christoph Dorn - -// a decorator for functions that curry "polymorphically", -// that is, that return a function that can be tested -// against various objects if they're only "partially -// completed", or fewer arguments than needed are used. -// -// this enables the idioms: -// [1, 2, 3].every(lt(4)) eq true -// [1, 2, 3].map(add(1)) eq [2, 3, 4] -// [{}, {}, {}].forEach(set('a', 10)) -// -exports.operator = function (name, length, block) { - var operator = function () { - var args = exports.array(arguments); - var completion = function (object) { - if ( - typeof object == "object" && - object !== null && // seriously? typeof null == "object" - name in object && // would throw if object === null - // not interested in literal objects: - !Object.prototype.hasOwnProperty.call(object, name) - ) - return object[name].apply(object, args); - return block.apply( - this, - [object].concat(args) - ); - }; - if (arguments.length < length) { - // polymoprhic curry, delayed completion - return completion; - } else { - // immediate completion - return completion.call(this, args.shift()); - } - }; - operator.name = name; - operator.displayName = name; - operator.length = length; - operator.operator = block; - return operator; -}; - -exports.no = function (value) { - return value === null || value === undefined; -}; - -// object - -exports.object = exports.operator('toObject', 1, function (object) { - var items = object; - if (!items.length) - items = exports.items(object); - var copy = {}; - for (var i = 0; i < items.length; i++) { - var item = items[i]; - var key = item[0]; - var value = item[1]; - copy[key] = value; - } - return copy; -}); - -exports.object.copy = function (object) { - var copy = {}; - exports.object.keys(object).forEach(function (key) { - copy[key] = object[key]; - }); - return copy; -}; - -exports.object.deepCopy = function (object) { - var copy = {}; - exports.object.keys(object).forEach(function (key) { - copy[key] = exports.deepCopy(object[key]); - }); - return copy; -}; - -exports.object.eq = function (a, b, stack) { - return ( - !exports.no(a) && !exports.no(b) && - exports.array.eq( - exports.sort(exports.object.keys(a)), - exports.sort(exports.object.keys(b)) - ) && - exports.object.keys(a).every(function (key) { - return exports.eq(a[key], b[key], stack); - }) - ); -}; - -exports.object.len = function (object) { - return exports.object.keys(object).length; -}; - -exports.object.has = function (object, key) { - return Object.prototype.hasOwnProperty.call(object, key); -}; - -exports.object.keys = function (object) { - var keys = []; - for (var key in object) { - if (exports.object.has(object, key)) - keys.push(key); - } - return keys; -}; - -exports.object.values = function (object) { - var values = []; - exports.object.keys(object).forEach(function (key) { - values.push(object[key]); - }); - return values; -}; - -exports.object.items = function (object) { - var items = []; - exports.object.keys(object).forEach(function (key) { - items.push([key, object[key]]); - }); - return items; -}; - -/** - * Updates an object with the properties from another object. - * This function is variadic requiring a minimum of two arguments. - * The first argument is the object to update. Remaining arguments - * are considered the sources for the update. If multiple sources - * contain values for the same property, the last one with that - * property in the arguments list wins. - * - * example usage: - * util.update({}, { hello: "world" }); // -> { hello: "world" } - * util.update({}, { hello: "world" }, { hello: "le monde" }); // -> { hello: "le monde" } - * - * @returns Updated object - * @type Object - * - */ -exports.object.update = function () { - return variadicHelper(arguments, function(target, source) { - var key; - for (key in source) { - if (exports.object.has(source, key)) { - target[key] = source[key]; - } - } - }); -}; - -exports.object.deepUpdate = function (target, source) { - var key; - for (key in source) { - if(exports.object.has(source, key)) { - if(typeof source[key] == "object" && exports.object.has(target, key)) { - exports.object.deepUpdate(target[key], source[key]); - } else { - target[key] = source[key]; - } - } - } -}; - -/** - * Updates an object with the properties of another object(s) if those - * properties are not already defined for the target object. First argument is - * the object to complete, the remaining arguments are considered sources to - * complete from. If multiple sources contain the same property, the value of - * the first source with that property will be the one inserted in to the - * target. - * - * example usage: - * util.complete({}, { hello: "world" }); // -> { hello: "world" } - * util.complete({ hello: "narwhal" }, { hello: "world" }); // -> { hello: "narwhal" } - * util.complete({}, { hello: "world" }, { hello: "le monde" }); // -> { hello: "world" } - * - * @returns Completed object - * @type Object - * - */ -exports.object.complete = function () { - return variadicHelper(arguments, function(target, source) { - var key; - for (key in source) { - if ( - exports.object.has(source, key) && - !exports.object.has(target, key) - ) { - target[key] = source[key]; - } - } - }); -}; - -exports.object.deepComplete = function () { - return variadicHelper(arguments, function (target, source) { - var key; - for (key in source) { - if ( - exports.object.has(source, key) && - !exports.object.has(target, key) - ) { - target[key] = exports.deepCopy(source[key]); - } - } - }); -}; - -exports.object.deepDiff = function () { - var sources = Array.prototype.slice.call(arguments); - var diff = exports.deepCopy(sources.shift()); - return variadicHelper([diff].concat(sources), function (diff, source) { - var key; - for (key in source) { - if(exports.object.has(source, key)) { - if(exports.object.has(diff, key)) { - if(exports.deepEqual(diff[key], source[key])) { - delete diff[key]; - } else { - if(!exports.isArrayLike(diff[key])) { - diff[key] = exports.deepDiff(diff[key], source[key]); - } - } - } - } - } - }); -}; - -exports.object.repr = function (object) { - return "{" + - exports.object.keys(object) - .map(function (key) { - return exports.enquote(key) + ": " + - exports.repr(object[key]); - }).join(", ") + - "}"; -}; - -/** - * @param args Arguments list of the calling function - * First argument should be a callback that takes target and source parameters. - * Second argument should be target. - * Remaining arguments are treated a sources. - * - * @returns Target - * @type Object - */ -var variadicHelper = function (args, callback) { - var sources = Array.prototype.slice.call(args); - var target = sources.shift(); - - sources.forEach(function(source) { - callback(target, source); - }); - - return target; -}; - -// array - -exports.array = function (array) { - if (exports.no(array)) - return []; - if (!exports.isArrayLike(array)) { - if ( - array.toArray && - !Object.prototype.hasOwnProperty.call(array, 'toArray') - ) { - return array.toArray(); - } else if ( - array.forEach && - !Object.prototype.hasOwnProperty.call(array, 'forEach') - ) { - var results = []; - array.forEach(function (value) { - results.push(value); - }); - return results; - } else if (typeof array === "string") { - return Array.prototype.slice.call(array); - } else { - return exports.items(array); - } - } - return Array.prototype.slice.call(array); -}; - -exports.array.coerce = function (array) { - if (!Array.isArray(array)) - return exports.array(array); - return array; -}; - -exports.isArrayLike = function(object) { - return Array.isArray(object) || exports.isArguments(object); -}; - -// from http://code.google.com/p/google-caja/wiki/NiceNeighbor -// by "kangax" -// -// Mark Miller posted a solution that will work in ES5 compliant -// implementations, that may provide future insight: -// (http://groups.google.com/group/narwhaljs/msg/116097568bae41c6) -exports.isArguments = function (object) { - // ES5 reliable positive - if (Object.prototype.toString.call(object) == "[object Arguments]") - return true; - // for ES5, we will still need a way to distinguish false negatives - // from the following code (in ES5, it is possible to create - // an object that satisfies all of these constraints but is - // not an Arguments object). - // callee should exist - if ( - !typeof object == "object" || - !Object.prototype.hasOwnProperty.call(object, 'callee') || - !object.callee || - // It should be a Function object ([[Class]] === 'Function') - Object.prototype.toString.call(object.callee) !== '[object Function]' || - typeof object.length != 'number' - ) - return false; - for (var name in object) { - // both "callee" and "length" should be { DontEnum } - if (name === 'callee' || name === 'length') return false; - } - return true; -}; - -exports.array.copy = exports.array; - -exports.array.deepCopy = function (array) { - return array.map(exports.deepCopy); -}; - -exports.array.len = function (array) { - return array.length; -}; - -exports.array.has = function (array, value) { - return Array.prototype.indexOf.call(array, value) >= 0; -}; - -exports.array.put = function (array, key, value) { - array.splice(key, 0, value); - return array; -}; - -exports.array.del = function (array, begin, end) { - array.splice(begin, end === undefined ? 1 : (end - begin)); - return array; -}; - -exports.array.eq = function (a, b, stack) { - return exports.isArrayLike(b) && - a.length == b.length && - exports.zip(a, b).every(exports.apply(function (a, b) { - return exports.eq(a, b, stack); - })); -}; - -exports.array.lt = function (a, b) { - var length = Math.max(a.length, b.length); - for (var i = 0; i < length; i++) - if (!exports.eq(a[i], b[i])) - return exports.lt(a[i], b[i]); - return false; -}; - -exports.array.repr = function (array) { - return "[" + exports.map(array, exports.repr).join(', ') + "]"; -}; - -exports.array.first = function (array) { - return array[0]; -}; - -exports.array.last = function (array) { - return array[array.length - 1]; -}; - -exports.apply = exports.operator('apply', 2, function (args, block) { - return block.apply(this, args); -}); - -exports.copy = exports.operator('copy', 1, function (object) { - if (exports.no(object)) - return object; - if (exports.isArrayLike(object)) - return exports.array.copy(object); - if (object instanceof Date) - return object; - if (typeof object == 'object') - return exports.object.copy(object); - return object; -}); - -exports.deepCopy = exports.operator('deepCopy', 1, function (object) { - if (exports.no(object)) - return object; - if (exports.isArrayLike(object)) - return exports.array.deepCopy(object); - if (typeof object == 'object') - return exports.object.deepCopy(object); - return object; -}); - -exports.repr = exports.operator('repr', 1, function (object) { - if (exports.no(object)) - return String(object); - if (exports.isArrayLike(object)) - return exports.array.repr(object); - if (typeof object == 'object' && !(object instanceof Date)) - return exports.object.repr(object); - if (typeof object == 'string') - return exports.enquote(object); - return object.toString(); -}); - -exports.keys = exports.operator('keys', 1, function (object) { - if (exports.isArrayLike(object)) - return exports.range(object.length); - else if (typeof object == 'object') - return exports.object.keys(object); - return []; -}); - -exports.values = exports.operator('values', 1, function (object) { - if (exports.isArrayLike(object)) - return exports.array(object); - else if (typeof object == 'object') - return exports.object.values(object); - return []; -}); - -exports.items = exports.operator('items', 1, function (object) { - if (exports.isArrayLike(object) || typeof object == "string") - return exports.enumerate(object); - else if (typeof object == 'object') - return exports.object.items(object); - return []; -}); - -exports.len = exports.operator('len', 1, function (object) { - if (exports.isArrayLike(object)) - return exports.array.len(object); - else if (typeof object == 'object') - return exports.object.len(object); -}); - -exports.has = exports.operator('has', 2, function (object, value) { - if (exports.isArrayLike(object)) - return exports.array.has(object, value); - else if (typeof object == 'object') - return exports.object.has(object, value); - return false; -}); - -exports.get = exports.operator('get', 2, function (object, key, value) { - if (typeof object == "string") { - if (!typeof key == "number") - throw new Error("TypeError: String keys must be numbers"); - if (!exports.has(exports.range(object.length), key)) { - if (arguments.length == 3) - return value; - throw new Error("KeyError: " + exports.repr(key)); - } - return object.charAt(key); - } - if (typeof object == "object") { - if (!exports.object.has(object, key)) { - if (arguments.length == 3) - return value; - throw new Error("KeyError: " + exports.repr(key)); - } - return object[key]; - } - throw new Error("Object does not have keys: " + exports.repr(object)); -}); - -exports.set = exports.operator('set', 3, function (object, key, value) { - object[key] = value; - return object; -}); - -exports.getset = exports.operator('getset', 3, function (object, key, value) { - if (!exports.has(object, key)) - exports.set(object, key, value); - return exports.get(object, key); -}); - -exports.del = exports.operator('del', 2, function (object, begin, end) { - if (exports.isArrayLike(object)) - return exports.array.del(object, begin, end); - delete object[begin]; - return object; -}); - -exports.cut = exports.operator('cut', 2, function (object, key) { - var result = exports.get(object, key); - exports.del(object, key); - return result; -}); - -exports.put = exports.operator('put', 2, function (object, key, value) { - if (exports.isArrayLike(object)) - return exports.array.put(object, key, value); - return exports.set(object, key, value); -}); - -exports.first = exports.operator('first', 1, function (object) { - return object[0]; -}); - -exports.last = exports.operator('last', 1, function (object) { - return object[object.length - 1]; -}); - -exports.update = exports.operator('update', 2, function () { - var args = Array.prototype.slice.call(arguments); - return exports.object.update.apply(this, args); -}); - -exports.deepUpdate = exports.operator('deepUpdate', 2, function (target, source) { - exports.object.deepUpdate(target, source); -}); - -exports.complete = exports.operator('complete', 2, function (target, source) { - var args = Array.prototype.slice.call(arguments); - return exports.object.complete.apply(this, args); -}); - -exports.deepComplete = exports.operator('deepComplete', 2, function (target, source) { - var args = Array.prototype.slice.call(arguments); - return exports.object.deepComplete.apply(this, args); -}); - -exports.deepDiff = exports.operator('deepDiff', 2, function (target, source) { - var args = Array.prototype.slice.call(arguments); - return exports.object.deepDiff.apply(this, args); -}); - -exports.deepEqual = function(actual, expected) { - - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (actual instanceof Date && expected instanceof Date) { - return actual.getTime() === expected.getTime(); - - // 7.3. Other pairs that do not both pass typeof value == "object", - // equivalence is determined by ==. - } else if (typeof actual != 'object' && typeof expected != 'object') { - return actual == expected; - - // XXX specification bug: this should be specified - } else if (typeof expected == "string" || typeof actual == "string") { - return expected == actual; - - // 7.4. For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical "prototype" property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return actual.prototype === expected.prototype && exports.object.eq(actual, expected); - } -} - -exports.remove = exports.operator('remove', 2, function (list, value) { - var index; - if ((index = list.indexOf(value))>-1) - list.splice(index,1); - return list; -}); - -// TODO insert -// TODO discard - -exports.range = function () { - var start = 0, stop = 0, step = 1; - if (arguments.length == 1) { - stop = arguments[0]; - } else { - start = arguments[0]; - stop = arguments[1]; - step = arguments[2] || 1; - } - var range = []; - for (var i = start; i < stop; i += step) - range.push(i); - return range; -}; - -exports.forEach = function (array, block) { - Array.prototype.forEach.call( - exports.array.coerce(array), - block - ); -}; - -exports.forEachApply = function (array, block) { - Array.prototype.forEach.call( - exports.array.coerce(array), - exports.apply(block) - ); -}; - -exports.map = function (array, block, context) { - return Array.prototype.map.call( - exports.array.coerce(array), - block, - context - ); -}; - -exports.mapApply = function (array, block) { - return Array.prototype.map.call( - exports.array.coerce(array), - exports.apply(block) - ); -}; - -exports.every = exports.operator('every', 2, function (array, block, context) { - return exports.all(exports.map(array, block, context)); -}); - -exports.some = exports.operator('some', 2, function (array, block, context) { - return exports.any(exports.map(array, block, context)); -}); - -exports.all = exports.operator('all', 1, function (array) { - array = exports.array.coerce(array); - for (var i = 0; i < array.length; i++) - if (!array[i]) - return false; - return true; -}); - -exports.any = exports.operator('all', 1, function (array) { - array = exports.array.coerce(array); - for (var i = 0; i < array.length; i++) - if (array[i]) - return true; - return false; -}); - -exports.reduce = exports.operator('reduce', 2, function (array, block, basis) { - array = exports.array.coerce(array); - return array.reduce.apply(array, arguments); -}); - -exports.reduceRight = exports.operator('reduceRight', 2, function (array, block, basis) { - array = exports.array.coerce(array); - return array.reduceRight.apply(array, arguments); -}); - -exports.zip = function () { - return exports.transpose(arguments); -}; - -exports.transpose = function (array) { - array = exports.array.coerce(array); - var transpose = []; - var length = Math.min.apply(this, exports.map(array, function (row) { - return row.length; - })); - for (var i = 0; i < array.length; i++) { - var row = array[i]; - for (var j = 0; j < length; j++) { - var cell = row[j]; - if (!transpose[j]) - transpose[j] = []; - transpose[j][i] = cell; - } - } - return transpose; -}; - -exports.enumerate = function (array, start) { - array = exports.array.coerce(array); - if (exports.no(start)) - start = 0; - return exports.zip( - exports.range(start, start + array.length), - array - ); -}; - -// arithmetic, transitive, and logical operators - -exports.is = function (a, b) { - // - if (a === b) - // 0 === -0, but they are not identical - return a !== 0 || 1/a === 1/b; - // NaN !== NaN, but they are identical. - // NaNs are the only non-reflexive value, i.e., if a !== a, - // then a is a NaN. - return a !== a && b !== b; - // -}; - -exports.eq = exports.operator('eq', 2, function (a, b, stack) { - if (!stack) - stack = []; - if (a === b) - return true; - if (typeof a !== typeof b) - return false; - if (exports.no(a)) - return exports.no(b); - if (a instanceof Date) - return a.valueOf() === b.valueOf(); - if (a instanceof RegExp) - return a.source === b.source && - a.global === b.global && - a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline; - if (typeof a === "function") { - var caller = stack[stack.length - 1]; - // XXX what is this for? can it be axed? - // it comes from the "equiv" project code - return caller !== Object && - typeof caller !== "undefined"; - } - if (exports.isArrayLike(a)) - return exports.array.eq( - a, b, - stack.concat([a.constructor]) - ); - if (typeof a === 'object') - return exports.object.eq( - a, b, - stack.concat([a.constructor]) - ); - return false; -}); - -exports.ne = exports.operator('ne', 2, function (a, b) { - return !exports.eq(a, b); -}); - -exports.lt = exports.operator('lt', 2, function (a, b) { - if (exports.no(a) != exports.no(b)) - return exports.no(a) > exports.no(b); - if (exports.isArrayLike(a) && exports.isArrayLike(b)) - return exports.array.lt(a, b); - return a < b; -}); - -exports.gt = exports.operator('gt', 2, function (a, b) { - return !(exports.lt(a, b) || exports.eq(a, b)); -}); - -exports.le = exports.operator(2, 'le', function (a, b) { - return exports.lt(a, b) || exports.eq(a, b); -}); - -exports.ge = exports.operator(2, 'ge', function (a, b) { - return !exports.lt(a, b); -}); - -exports.mul = exports.operator(2, 'mul', function (a, b) { - if (typeof a == "string") - return exports.string.mul(a, b); - return a * b; -}); - -/*** by - returns a `comparator` that compares - values based on the values resultant from - a given `relation`. - accepts a `relation` and an optional comparator. - - To sort a list of objects based on their - "a" key:: - - objects.sort(by(get("a"))) - - To get those in descending order:: - - objects.sort(by(get("a")), desc) - - `by` returns a comparison function that also tracks - the arguments you used to construct it. This permits - `sort` and `sorted` to perform a Schwartzian transform - which can increase the performance of the sort - by a factor of 2. -*/ -exports.by = function (relation) { - var compare = arguments[1]; - if (exports.no(compare)) - compare = exports.compare; - var comparator = function (a, b) { - a = relation(a); - b = relation(b); - return compare(a, b); - }; - comparator.by = relation; - comparator.compare = compare; - return comparator; -}; - -exports.compare = exports.operator(2, 'compare', function (a, b) { - if (exports.no(a) !== exports.no(b)) - return exports.no(b) - exports.no(a); - if (typeof a === "number" && typeof b === "number") - return a - b; - return exports.eq(a, b) ? 0 : exports.lt(a, b) ? -1 : 1; -}); - -/*** sort - an in-place array sorter that uses a deep comparison - function by default (compare), and improves performance if - you provide a comparator returned by "by", using a - Schwartzian transform. -*/ -exports.sort = function (array, compare) { - if (exports.no(compare)) - compare = exports.compare; - if (compare.by) { - /* schwartzian transform */ - array.splice.apply( - array, - [0, array.length].concat( - array.map(function (value) { - return [compare.by(value), value]; - }).sort(function (a, b) { - return compare.compare(a[0], b[0]); - }).map(function (pair) { - return pair[1]; - }) - ) - ); - } else { - array.sort(compare); - } - return array; -}; - -/*** sorted - returns a sorted copy of an array using a deep - comparison function by default (compare), and - improves performance if you provide a comparator - returned by "by", using a Schwartzian transform. -*/ -exports.sorted = function (array, compare) { - return exports.sort(exports.array.copy(array), compare); -}; - -exports.reverse = function (array) { - return Array.prototype.reverse.call(array); -}; - -exports.reversed = function (array) { - return exports.reverse(exports.array.copy(array)); -}; - -exports.hash = exports.operator(1, 'hash', function (object) { - return '' + object; -}); - -exports.unique = exports.operator(1, 'unique', function (array, eq, hash) { - var visited = {}; - if (!eq) eq = exports.eq; - if (!hash) hash = exports.hash; - return array.filter(function (value) { - var bucket = exports.getset(visited, hash(value), []); - var finds = bucket.filter(function (other) { - return eq(value, other); - }); - if (!finds.length) - bucket.push(value); - return !finds.length; - }); -}); - -// string - -exports.string = exports.operator(1, 'toString', function (object) { - return '' + object; -}); - -exports.string.mul = function (string, n) { - return exports.range(n).map(function () { - return string; - }).join(''); -}; - -/*** escape - escapes all characters of a string that are - special to JavaScript and many other languages. - Recognizes all of the relevant - control characters and formats all other - non-printable characters as Hex byte escape - sequences or Unicode escape sequences depending - on their size. - - Pass ``true`` as an optional second argument and - ``escape`` produces valid contents for escaped - JSON strings, wherein non-printable-characters are - all escaped with the Unicode ``\u`` notation. -*/ -/* more Steve Levithan flagrence */ -var escapeExpression = /[^ !#-[\]-~]/g; -/* from Doug Crockford's JSON library */ -var escapePatterns = { - '\b': '\\b', '\t': '\\t', - '\n': '\\n', '\f': '\\f', '\r': '\\r', - '"' : '\\"', '\\': '\\\\' -}; -exports.escape = function (value, strictJson) { - if (typeof value != "string") - throw new Error( - module.path + - "#escape: requires a string. got " + - exports.repr(value) - ); - return value.replace( - escapeExpression, - function (match) { - if (escapePatterns[match]) - return escapePatterns[match]; - match = match.charCodeAt(); - if (!strictJson && match < 256) - return "\\x" + exports.padBegin(match.toString(16), 2); - return '\\u' + exports.padBegin(match.toString(16), 4); - } - ); -}; - -/*** enquote - transforms a string into a string literal, escaping - all characters of a string that are special to - JavaScript and and some other languages. - - ``enquote`` uses double quotes to be JSON compatible. - - Pass ``true`` as an optional second argument to - be strictly JSON compliant, wherein all - non-printable-characters are represented with - Unicode escape sequences. -*/ -exports.enquote = function (value, strictJson) { - return '"' + exports.escape(value, strictJson) + '"'; -}; - -/*** expand - transforms tabs to an equivalent number of spaces. -*/ -// TODO special case for \r if it ever matters -exports.expand = function (str, tabLength) { - str = String(str); - tabLength = tabLength || 4; - var output = [], - tabLf = /[\t\n]/g, - lastLastIndex = 0, - lastLfIndex = 0, - charsAddedThisLine = 0, - tabOffset, match; - while (match = tabLf.exec(str)) { - if (match[0] == "\t") { - tabOffset = ( - tabLength - 1 - - ( - (match.index - lastLfIndex) + - charsAddedThisLine - ) % tabLength - ); - charsAddedThisLine += tabOffset; - output.push( - str.slice(lastLastIndex, match.index) + - exports.mul(" ", tabOffset + 1) - ); - } else if (match[0] === "\n") { - output.push(str.slice(lastLastIndex, tabLf.lastIndex)); - lastLfIndex = tabLf.lastIndex; - charsAddedThisLine = 0; - } - lastLastIndex = tabLf.lastIndex; - } - return output.join("") + str.slice(lastLastIndex); -}; - -var trimBeginExpression = /^\s\s*/g; -exports.trimBegin = function (value) { - return String(value).replace(trimBeginExpression, ""); -}; - -var trimEndExpression = /\s\s*$/g; -exports.trimEnd = function (value) { - return String(value).replace(trimEndExpression, ""); -}; - -exports.trim = function (value) { - return String(value).replace(trimBeginExpression, "").replace(trimEndExpression, ""); -}; - -/* generates padBegin and padEnd */ -var augmentor = function (augment) { - return function (value, length, pad) { - if (exports.no(pad)) pad = '0'; - if (exports.no(length)) length = 2; - value = String(value); - while (value.length < length) { - value = augment(value, pad); - } - return value; - }; -}; - -/*** padBegin - - accepts: - - a `String` or `Number` value - - a minimum length of the resultant `String`: - by default, 2 - - a pad string: by default, ``'0'``. - - returns a `String` of the value padded up to at least - the minimum length. adds the padding to the begining - side of the `String`. - -*/ -exports.padBegin = augmentor(function (value, pad) { - return pad + value; -}); - -/*** padEnd - - accepts: - - a `String` or `Number` value - - a minimum length of the resultant `String`: - by default, 2 - - a pad string: by default, ``'0'``. - - returns a `String` of the value padded up to at least - the minimum length. adds the padding to the end - side of the `String`. - -*/ -exports.padEnd = augmentor(function (value, pad) { - return value + pad; -}); - -/*** splitName - splits a string into an array of words from an original - string. -*/ -// thanks go to Steve Levithan for this regular expression -// that, in addition to splitting any normal-form identifier -// in any case convention, splits XMLHttpRequest into -// "XML", "Http", and "Request" -var splitNameExpression = /[a-z]+|[A-Z](?:[a-z]+|[A-Z]*(?![a-z]))|[.\d]+/g; -exports.splitName = function (value) { - var result = String(value).match(splitNameExpression); - if (result) - return result; - return [value]; -}; - -/*** joinName - joins a list of words with a given delimiter - between alphanumeric words. -*/ -exports.joinName = function (delimiter, parts) { - if (exports.no(delimiter)) delimiter = '_'; - parts.unshift([]); - return parts.reduce(function (parts, part) { - if ( - part.match(/\d/) && - exports.len(parts) && parts[parts.length-1].match(/\d/) - ) { - return parts.concat([delimiter + part]); - } else { - return parts.concat([part]); - } - }).join(''); -}; - -/*** upper - converts a name to ``UPPER CASE`` using - a given delimiter between numeric words. - - see: - - `lower` - - `camel` - - `title` - -*/ -exports.upper = function (value, delimiter) { - if (exports.no(delimiter)) - return value.toUpperCase(); - return exports.splitName(value).map(function (part) { - return part.toUpperCase(); - }).join(delimiter); -}; - -/*** lower - converts a name to a ``lower case`` using - a given delimiter between numeric words. - - see: - - `upper` - - `camel` - - `title` - -*/ -exports.lower = function (value, delimiter) { - if (exports.no(delimiter)) - return String(value).toLowerCase(); - return exports.splitName(value).map(function (part) { - return part.toLowerCase(); - }).join(delimiter); -}; - -/*** camel - converts a name to ``camel Case`` using - a given delimiter between numeric words. - - see: - - `lower` - - `upper` - - `title` - -*/ -exports.camel = function (value, delimiter) { - return exports.joinName( - delimiter, - exports.mapApply( - exports.enumerate(exports.splitName(value)), - function (n, part) { - if (n) { - return ( - part.substring(0, 1).toUpperCase() + - part.substring(1).toLowerCase() - ); - } else { - return part.toLowerCase(); - } - } - ) - ); -}; - -/*** title - converts a name to ``Title Case`` using - a given delimiter between numeric words. - - see: - - `lower` - - `upper` - - `camel` - -*/ -exports.title = function (value, delimiter) { - return exports.joinName( - delimiter, - exports.splitName(value).map(function (part) { - return ( - part.substring(0, 1).toUpperCase() + - part.substring(1).toLowerCase() - ); - }) - ); -}; - - -},{}],6:[function(require,module,exports){ - -const WINDOW = window; - -const DOMPLATE = require("domplate/dist/domplate.js").domplate; - - -function Renderer (options) { - var self = this; - - var loader = options.loader || new exports.Loader(options); - - self.domplate = DOMPLATE; - - function InsightDomplateContext () { - var self = this; - - self.repForNode = loader.repForNode.bind(loader); - self.wrapperRepForNode = loader.wrapperRepForNode.bind(loader); - - self.dispatchEvent = function (name, args) { - if (options.onEvent) { - try { - options.onEvent(name, args); - } catch (err) { - err.message += "(while dispatching event with name '" + name + "')"; - err.stack[0] += "(while dispatching event with name '" + name + "')"; - throw err; - } - } - } - - self.forNode = function (rootNode) { - const context = Object.create(self); - - context.getInstanceNode = function (node) { - if ( - !rootNode.instances || - !rootNode.instances[node.value] - ) { - console.error("node", node); - throw new Error("Object instance for reference '" + node.value + "' not found 'instances'!"); - } - return rootNode.instances[node.value]; - } - return context; - } - } - - var context = new InsightDomplateContext(); - - function ensureRepsForNodeLoaded (node) { - - // TODO: Optionally pre-fill with already loaded reps. - // TODO: Move node traversal into helper module. - var loadTypes = { -// "default/unknown": true - }; - function traverse (node) { - - if (node.type) { - loadTypes["default/" + node.type] = true; - } - - if (node.meta) { - if (node.meta["encoder.trimmed"]) { - loadTypes["default/trimmed"] = true; - } else - // DEPRECATED - if (node.meta.renderer === "structures/table") { - loadTypes["default/table"] = true; - loadTypes["default/string"] = true; - node.type = "table"; - } else - // DEPRECATED - if (node.meta.renderer === "structures/trace") { - loadTypes["default/trace"] = true; - loadTypes["default/string"] = true; - node.type = "trace"; - } else - if ( - node.meta["lang"] && - node.meta["lang.type"] - ) { - // TODO: Lookup 'node.meta["lang"]/node.meta["lang.type"]' and see - // what it extends to determine what sub-structures to parse. - if (node.meta["lang"] === "php") { - if (node.meta["lang.type"] === "array") { - if (node.value[0] && Array.isArray(node.value[0])) { - loadTypes["php/array-associative"] = true; - node.value.forEach(function (pair) { - traverse(pair[0]); - traverse(pair[1]); - }); - } else { - loadTypes["php/array-indexed"] = true; - node.value.forEach(function (node) { - traverse(node); - }); - } - } else - if (node.meta["lang.type"] === "map") { - loadTypes["php/array-associative"] = true; - node.value.forEach(function (pair) { - traverse(pair[0]); - traverse(pair[1]); - }); - } else - if (node.meta["lang.type"] === "exception") { - loadTypes["php/exception"] = true; - loadTypes["default/string"] = true; - if (node.value.title) { - traverse(node.value.title); - } - if (node.value.stack) { - node.value.stack.forEach(function (frame) { - frame.args.forEach(function (arg) { - traverse(arg); - }); - }); - } - } else { - loadTypes[node.meta["lang"] + "/" + node.meta["lang.type"]] = true; - - if (node.meta["lang.type"] === "table") { - loadTypes["default/string"] = true; - } else - if (node.meta["lang.type"] === "trace") { - loadTypes["default/string"] = true; - } - } - } else { - loadTypes[node.meta["lang"] + "/" + node.meta["lang.type"]] = true; - - if (node.meta["lang.type"] === "table") { - loadTypes["default/string"] = true; - } else - if (node.meta["lang.type"] === "trace") { - loadTypes["default/string"] = true; - } - } -/* - } else - if (node.meta["lang.id"] === "registry.pinf.org/cadorn.org/github/renderers/packages/php/master") { - if (node.meta["renderer"] === "http://registry.pinf.org/cadorn.org/renderers/packages/insight/0:structures/table") { - loadTypes["default/table"] = true; - loadTypes["default/string"] = true; - node.type = "table"; - } -*/ - } - if (node.meta.wrapper) { - loadTypes[node.meta.wrapper] = true; - - if (node.meta.wrapper === "wrappers/request") { - if (node.value.title) { - traverse(node.value.title); - } - } - } - } - - if (typeof node.value !== 'undefined') { - - let type = node.type || node.meta["lang.type"]; - - if (type === "array") { - node.value.forEach(function (node) { - traverse(node); - }); - } else - if (type === "dictionary") { - Object.keys(node.value).forEach(function (key) { - traverse(node.value[key]); - }); - } else - if (type === "map") { - node.value.forEach(function (pair) { - traverse(pair[0]); - traverse(pair[1]); - }); - } else - if (type === "reference") { - if (node.value.instance) { - traverse(node.value.instance); - } else - if ( - node.instances && - typeof node.value === "number" - ) { - traverse(node.instances[node.value]); - } else - if (typeof node.getInstance === 'function') { - traverse(node.getInstance()); - } - } else - if (type === "table") { - if (node.value.title) { - traverse(node.value.title); - } - if (node.value.header) { - node.value.header.forEach(function (node) { - traverse(node); - }); - } - if (node.value.body) { - node.value.body.forEach(function (row) { - row.forEach(function (cell) { - traverse(cell); - }); - }); - } - } else - if (type === "trace") { - if (node.value.title) { - traverse(node.value.title); - } - if (node.value.stack) { - node.value.stack.forEach(function (frame) { - frame.args.forEach(function (arg) { - traverse(arg); - }); - }); - } - } - } - } - traverse(node); - - return Promise.all(Object.keys(loadTypes).map(function (type) { - - type = type.split("/"); - - var repUri = loader.repUriForType(type[0], type[1]); - - return loader.ensureRepForUri(repUri).then(function () { - return null; - }); - })); - } - - self.renderNodeInto = function (node, selectorOrElement, options) { - options = options || {}; - - var el = ( - typeof selectorOrElement === 'string' && document.querySelector(selectorOrElement) - ) || selectorOrElement; - if (!el) { - throw new Error("Could not find element for selector '" + selectorOrElement + "'!"); - } - - // TODO: Optionally skip this. - // TODO: Once reps can be loaded async this can be optionally skipped. - return ensureRepsForNodeLoaded(node).then(function () { - - var wrapperRep = context.wrapperRepForNode(node); - - if (wrapperRep) { - - if (!wrapperRep[options.tagName || 'tag']) { - console.error("node", node); - console.error("wrapperRep", wrapperRep); - throw new Error(`Could not get tag '${options.tagName || 'tag'}' from wrapper!`); - } - - wrapperRep[options.tagName || 'tag'].replace({ - context: context.forNode(node), - node: node - }, el); - - return; - } - - var rep = context.repForNode(node); - - rep[options.tagName || 'tag'].replace({ - context: context.forNode(node), - node: node - }, el); - }); - } -} - -exports.Renderer = Renderer; - - -function Loader (options) { - let self = this; - - if (!options.repsBaseUrl) { - throw new Error("'options.repsBaseUrl' not set!"); - } - - var loadingReps = {}; - var loadedReps = {}; - - self.domplate = DOMPLATE; - - self.ensureRepForUri = function (repUri) { - - if (!loadingReps[repUri]) { - - loadingReps[repUri] = new WINDOW.Promise(function (resolve, reject) { - - // TODO: Optionally check against PINF sandbox directly to see if rep is loaded - // instead of letting domplate load them. - var url = options.repsBaseUrl + "/" + repUri; - - //DOMPLATE.loadRep(url, { cssBaseUrl: options.repsBaseUrl.replace(/\/?$/, "/") + repUri.replace(/^([^\/]+\/).+$/, "$1") }, function (rep) { - DOMPLATE.loadRep(url, { cssBaseUrl: options.repsBaseUrl.replace(/\/?$/, "/") }, function (rep) { - - setTimeout(function () { - rep.__ensureCssInjected(); - }, 0); - - loadedReps[repUri] = rep; - - resolve(rep); - }, function (err) { - var error = new Error("Error loading rep for uri '" + repUri + "' from '" + url + "'!"); - error.previous = err; - reject(error); - }); - }); - } - - return loadingReps[repUri]; - } - - self.repUriForType = function (lang, type) { - type = type || "unknown"; - return lang + "/" + type; - } - - function repUriForNode (node) { - - var lang = "default"; - var type = node.type; - - if (node.meta) { - if (node.meta["encoder.trimmed"]) { - type = "trimmed"; - } else - // DEPRECATED - if (node.meta.renderer === "structures/table") { - type = "table"; - } else - // DEPRECATED - if (node.meta.renderer === "structures/trace") { - type = "trace"; - } else - if ( - node.meta["lang"] && - node.meta["lang.type"] - ) { - lang = node.meta["lang"]; - type = node.meta["lang.type"]; - - if (lang === "php") { - if (type === "array") { - if (node.value[0] && Array.isArray(node.value[0])) { - type = "array-associative"; - } else { - type = "array-indexed"; - } - } else - if (type === "map") { - type = "array-associative"; - } - } - } else - if (node.meta["lang.id"] === "registry.pinf.org/cadorn.org/github/renderers/packages/php/master") { - lang = "php"; - type = node.meta["lang.type"]; - if (node.meta["renderer"] === "http://registry.pinf.org/cadorn.org/renderers/packages/insight/0:structures/table") { - lang = "default"; - type = "table"; - } - } - } - - if (!type) { - console.error("node", node); - console.error("lang", lang); - throw new Error('Could not determine type for node!'); - } - -// console.log("repUriForNode() lang, type:", lang, type); - - return self.repUriForType(lang, type); - } - - self.repForNode = function (node) { - - var repUri = repUriForNode(node); - - if (!loadedReps[repUri]) { - throw new Error("Rep for uri '" + repUri + "' not loaded!"); - } - - return loadedReps[repUri]; - } - self.wrapperRepForNode = function (node) { - if ( - node.meta && - node.meta.wrapper - ) { - if (!loadedReps[node.meta.wrapper]) { - throw new Error("Wrapper Rep for uri '" + node.meta.wrapper + "' not loaded!"); - } - return loadedReps[node.meta.wrapper]; - } - return null; - } -} - -exports.Loader = Loader; - -},{"domplate/dist/domplate.js":1}],7:[function(require,module,exports){ -"use strict"; - -var REPS = require("insight.domplate.reps"); - -var ENCODER = require("insight-for-js/lib/encoder/default"); - -var DECODER = require("insight-for-js/lib/decoder/default"); - -var repsBaseUrl = "/reps"; - -if (typeof bundle !== "undefined") { - repsBaseUrl = bundle.module.filename.replace(/\/[^\/]+\/[^\/]+$/, '/insight.domplate.reps'); -} - -var repLoader = new REPS.Loader({ - repsBaseUrl: repsBaseUrl -}); -var encoder = ENCODER.Encoder(); - -exports.main = function (JSONREP, node) { - var og = DECODER.generateFromMessage({ - meta: {}, - data: encoder.encode(node, {}, {}) - }, DECODER.EXTENDED); - var repRenderer = new REPS.Renderer({ - loader: repLoader, - onEvent: function onEvent(name, args) { - console.log('onEvent()', name, args); - } - }); - var rootNode = og.getOrigin(); - rootNode.meta = rootNode.meta || {}; - rootNode.meta.wrapper = 'wrappers/viewer'; - return JSONREP.makeRep('
', { - on: { - mount: function mount(el) { - repRenderer.renderNodeInto(rootNode, el); - } - } - }); -}; -},{"insight-for-js/lib/decoder/default":2,"insight-for-js/lib/encoder/default":3,"insight.domplate.reps":6}]},{},[7])(7) -}); - - }); -}); \ No newline at end of file diff --git a/dist/firephp.build/scripts/devtools/dist/riot.csp.js b/dist/firephp.build/scripts/devtools/dist/riot.csp.js deleted file mode 100644 index c9e4258..0000000 --- a/dist/firephp.build/scripts/devtools/dist/riot.csp.js +++ /dev/null @@ -1,10356 +0,0 @@ -/* Riot v3.13.2, @license MIT */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.riot = {}))); -}(this, (function (exports) { 'use strict'; - - /** - * Shorter and fast way to select a single node in the DOM - * @param { String } selector - unique dom selector - * @param { Object } ctx - DOM node where the target of our search will is located - * @returns { Object } dom node found - */ - function $(selector, ctx) { - return (ctx || document).querySelector(selector) - } - - var - // be aware, internal usage - // ATTENTION: prefix the global dynamic variables with `__` - // tags instances cache - __TAGS_CACHE = [], - // tags implementation cache - __TAG_IMPL = {}, - YIELD_TAG = 'yield', - - /** - * Const - */ - GLOBAL_MIXIN = '__global_mixin', - - // riot specific prefixes or attributes - ATTRS_PREFIX = 'riot-', - - // Riot Directives - REF_DIRECTIVES = ['ref', 'data-ref'], - IS_DIRECTIVE = 'data-is', - CONDITIONAL_DIRECTIVE = 'if', - LOOP_DIRECTIVE = 'each', - LOOP_NO_REORDER_DIRECTIVE = 'no-reorder', - SHOW_DIRECTIVE = 'show', - HIDE_DIRECTIVE = 'hide', - KEY_DIRECTIVE = 'key', - RIOT_EVENTS_KEY = '__riot-events__', - - // for typeof == '' comparisons - T_STRING = 'string', - T_OBJECT = 'object', - T_UNDEF = 'undefined', - T_FUNCTION = 'function', - - XLINK_NS = 'http://www.w3.org/1999/xlink', - SVG_NS = 'http://www.w3.org/2000/svg', - XLINK_REGEX = /^xlink:(\w+)/, - - WIN = typeof window === T_UNDEF ? /* istanbul ignore next */ undefined : window, - - // special native tags that cannot be treated like the others - RE_SPECIAL_TAGS = /^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/, - RE_SPECIAL_TAGS_NO_OPTION = /^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/, - RE_EVENTS_PREFIX = /^on/, - RE_HTML_ATTRS = /([-\w]+) ?= ?(?:"([^"]*)|'([^']*)|({[^}]*}))/g, - // some DOM attributes must be normalized - CASE_SENSITIVE_ATTRIBUTES = { - 'viewbox': 'viewBox', - 'preserveaspectratio': 'preserveAspectRatio' - }, - /** - * Matches boolean HTML attributes in the riot tag definition. - * With a long list like this, a regex is faster than `[].indexOf` in most browsers. - * @const {RegExp} - * @see [attributes.md](https://github.com/riot/compiler/blob/dev/doc/attributes.md) - */ - RE_BOOL_ATTRS = /^(?:disabled|checked|readonly|required|allowfullscreen|auto(?:focus|play)|compact|controls|default|formnovalidate|hidden|ismap|itemscope|loop|multiple|muted|no(?:resize|shade|validate|wrap)?|open|reversed|seamless|selected|sortable|truespeed|typemustmatch)$/, - // version# for IE 8-11, 0 for others - IE_VERSION = (WIN && WIN.document || /* istanbul ignore next */ {}).documentMode | 0; - - /** - * Create a generic DOM node - * @param { String } name - name of the DOM node we want to create - * @returns { Object } DOM node just created - */ - function makeElement(name) { - return name === 'svg' ? document.createElementNS(SVG_NS, name) : document.createElement(name) - } - - /** - * Set any DOM attribute - * @param { Object } dom - DOM node we want to update - * @param { String } name - name of the property we want to set - * @param { String } val - value of the property we want to set - */ - function setAttribute(dom, name, val) { - var xlink = XLINK_REGEX.exec(name); - if (xlink && xlink[1]) - { dom.setAttributeNS(XLINK_NS, xlink[1], val); } - else - { dom.setAttribute(name, val); } - } - - var styleNode; - // Create cache and shortcut to the correct property - var cssTextProp; - var byName = {}; - var needsInject = false; - - // skip the following code on the server - if (WIN) { - styleNode = ((function () { - // create a new style element with the correct type - var newNode = makeElement('style'); - // replace any user node or insert the new one into the head - var userNode = $('style[type=riot]'); - - setAttribute(newNode, 'type', 'text/css'); - /* istanbul ignore next */ - if (userNode) { - if (userNode.id) { newNode.id = userNode.id; } - userNode.parentNode.replaceChild(newNode, userNode); - } else { document.head.appendChild(newNode); } - - return newNode - }))(); - cssTextProp = styleNode.styleSheet; - } - - /** - * Object that will be used to inject and manage the css of every tag instance - */ - var styleManager = { - styleNode: styleNode, - /** - * Save a tag style to be later injected into DOM - * @param { String } css - css string - * @param { String } name - if it's passed we will map the css to a tagname - */ - add: function add(css, name) { - byName[name] = css; - needsInject = true; - }, - /** - * Inject all previously saved tag styles into DOM - * innerHTML seems slow: http://jsperf.com/riot-insert-style - */ - inject: function inject() { - if (!WIN || !needsInject) { return } - needsInject = false; - var style = Object.keys(byName) - .map(function (k) { return byName[k]; }) - .join('\n'); - /* istanbul ignore next */ - if (cssTextProp) { cssTextProp.cssText = style; } - else { styleNode.innerHTML = style; } - }, - - /** - * Remove a tag style of injected DOM later. - * @param {String} name a registered tagname - */ - remove: function remove(name) { - delete byName[name]; - needsInject = true; - } - }; - - var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; - - function unwrapExports (x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; - } - - function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; - } - - var csp_tmpl = createCommonjsModule(function (module, exports) { - (function (global, factory) { - factory(exports); - }(commonjsGlobal, (function (exports) { - function InfiniteChecker (maxIterations) { - if (this instanceof InfiniteChecker) { - this.maxIterations = maxIterations; - this.count = 0; - } else { - return new InfiniteChecker(maxIterations) - } - } - - InfiniteChecker.prototype.check = function () { - this.count += 1; - if (this.count > this.maxIterations) { - throw new Error('Infinite loop detected - reached max iterations') - } - }; - - function getGlobal (str) { - var ctx = (typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : this); - return typeof str !== 'undefined' ? ctx[str] : ctx - } - - var names = ['Object', 'String', 'Boolean', 'Number', 'RegExp', 'Date', 'Array']; - var immutable = { string: 'String', boolean: 'Boolean', number: 'Number' }; - - var primitives = names.map(getGlobal); - var protos = primitives.map(getProto); - - function Primitives (context) { - var this$1 = this; - - if (this instanceof Primitives) { - this.context = context; - for (var i = 0; i < names.length; i++) { - if (!this$1.context[names[i]]) { - this$1.context[names[i]] = wrap(primitives[i]); - } - } - } else { - return new Primitives(context) - } - } - - Primitives.prototype.replace = function (value) { - var primIndex = primitives.indexOf(value), - protoIndex = protos.indexOf(value), - name; - - if (~primIndex) { - name = names[primIndex]; - return this.context[name] - } else if (~protoIndex) { - name = names[protoIndex]; - return this.context[name].prototype - } - - return value - }; - - Primitives.prototype.getPropertyObject = function (object, property) { - if (immutable[typeof object]) { - return this.getPrototypeOf(object) - } - return object - }; - - Primitives.prototype.isPrimitive = function (value) { - return !!~primitives.indexOf(value) || !!~protos.indexOf(value) - }; - - Primitives.prototype.getPrototypeOf = function (value) { - if (value == null) { // handle null and undefined - return value - } - - var immutableType = immutable[typeof value], - proto; - - if (immutableType) { - proto = this.context[immutableType].prototype; - } else { - proto = Object.getPrototypeOf(value); - } - - if (!proto || proto === Object.prototype) { - return null - } - - var replacement = this.replace(proto); - - if (replacement === value) { - replacement = this.replace(Object.prototype); - } - return replacement - - }; - - Primitives.prototype.applyNew = function (func, args) { - if (func.wrapped) { - var prim = Object.getPrototypeOf(func); - var instance = new (Function.prototype.bind.apply(prim, arguments)); - - setProto(instance, func.prototype); - return instance - } - - return new (Function.prototype.bind.apply(func, arguments)) - - }; - - function getProto (func) { - return func.prototype - } - - function setProto (obj, proto) { - obj.__proto__ = proto; // eslint-disable-line - } - - function wrap (prim) { - var proto = Object.create(prim.prototype); - - var result = function () { - if (this instanceof result) { - prim.apply(this, arguments); - } else { - var instance = prim.apply(null, arguments); - - setProto(instance, proto); - return instance - } - }; - - setProto(result, prim); - result.prototype = proto; - result.wrapped = true; - return result - } - - var commonjsGlobal$$1 = typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof self !== 'undefined' ? self : {}; - - - - - - function createCommonjsModule$$1(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; - } - - var esprima = createCommonjsModule$$1(function (module, exports) { - (function webpackUniversalModuleDefinition(root, factory) { - /* istanbul ignore next */ - module.exports = factory(); - })(commonjsGlobal$$1, function() { - return /******/ (function(modules) { // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; - - /******/ // The require function - /******/ function __webpack_require__(moduleId) { - - /******/ // Check if module is in cache - /* istanbul ignore if */ - /******/ if(installedModules[moduleId]) - /******/ { return installedModules[moduleId].exports; } - - /******/ // Create a new module (and put it into the cache) - /******/ var module = installedModules[moduleId] = { - /******/ exports: {}, - /******/ id: moduleId, - /******/ loaded: false - /******/ }; - - /******/ // Execute the module function - /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - - /******/ // Flag the module as loaded - /******/ module.loaded = true; - - /******/ // Return the exports of the module - /******/ return module.exports; - /******/ } - - - /******/ // expose the modules object (__webpack_modules__) - /******/ __webpack_require__.m = modules; - - /******/ // expose the module cache - /******/ __webpack_require__.c = installedModules; - - /******/ // __webpack_public_path__ - /******/ __webpack_require__.p = ""; - - /******/ // Load entry module and return exports - /******/ return __webpack_require__(0); - /******/ }) - /************************************************************************/ - /******/ ([ - /* 0 */ - /***/ function(module, exports, __webpack_require__) { - var comment_handler_1 = __webpack_require__(1); - var parser_1 = __webpack_require__(3); - var jsx_parser_1 = __webpack_require__(11); - var tokenizer_1 = __webpack_require__(15); - function parse(code, options, delegate) { - var commentHandler = null; - var proxyDelegate = function (node, metadata) { - if (delegate) { - delegate(node, metadata); - } - if (commentHandler) { - commentHandler.visit(node, metadata); - } - }; - var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null; - var collectComment = false; - if (options) { - collectComment = (typeof options.comment === 'boolean' && options.comment); - var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment); - if (collectComment || attachComment) { - commentHandler = new comment_handler_1.CommentHandler(); - commentHandler.attach = attachComment; - options.comment = true; - parserDelegate = proxyDelegate; - } - } - var parser; - if (options && typeof options.jsx === 'boolean' && options.jsx) { - parser = new jsx_parser_1.JSXParser(code, options, parserDelegate); - } - else { - parser = new parser_1.Parser(code, options, parserDelegate); - } - var ast = (parser.parseProgram()); - if (collectComment) { - ast.comments = commentHandler.comments; - } - if (parser.config.tokens) { - ast.tokens = parser.tokens; - } - if (parser.config.tolerant) { - ast.errors = parser.errorHandler.errors; - } - return ast; - } - exports.parse = parse; - function tokenize(code, options, delegate) { - var tokenizer = new tokenizer_1.Tokenizer(code, options); - var tokens; - tokens = []; - try { - while (true) { - var token = tokenizer.getNextToken(); - if (!token) { - break; - } - if (delegate) { - token = delegate(token); - } - tokens.push(token); - } - } - catch (e) { - tokenizer.errorHandler.tolerate(e); - } - if (tokenizer.errorHandler.tolerant) { - tokens.errors = tokenizer.errors(); - } - return tokens; - } - exports.tokenize = tokenize; - var syntax_1 = __webpack_require__(2); - exports.Syntax = syntax_1.Syntax; - // Sync with *.json manifests. - exports.version = '3.1.3'; - - - /***/ }, - /* 1 */ - /***/ function(module, exports, __webpack_require__) { - var syntax_1 = __webpack_require__(2); - var CommentHandler = (function () { - function CommentHandler() { - this.attach = false; - this.comments = []; - this.stack = []; - this.leading = []; - this.trailing = []; - } - CommentHandler.prototype.insertInnerComments = function (node, metadata) { - var this$1 = this; - - // innnerComments for properties empty block - // `function a() {/** comments **\/}` - if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) { - var innerComments = []; - for (var i = this.leading.length - 1; i >= 0; --i) { - var entry = this$1.leading[i]; - if (metadata.end.offset >= entry.start) { - innerComments.unshift(entry.comment); - this$1.leading.splice(i, 1); - this$1.trailing.splice(i, 1); - } - } - if (innerComments.length) { - node.innerComments = innerComments; - } - } - }; - CommentHandler.prototype.findTrailingComments = function (node, metadata) { - var this$1 = this; - - var trailingComments = []; - if (this.trailing.length > 0) { - for (var i = this.trailing.length - 1; i >= 0; --i) { - var entry_1 = this$1.trailing[i]; - if (entry_1.start >= metadata.end.offset) { - trailingComments.unshift(entry_1.comment); - } - } - this.trailing.length = 0; - return trailingComments; - } - var entry = this.stack[this.stack.length - 1]; - if (entry && entry.node.trailingComments) { - var firstComment = entry.node.trailingComments[0]; - if (firstComment && firstComment.range[0] >= metadata.end.offset) { - trailingComments = entry.node.trailingComments; - delete entry.node.trailingComments; - } - } - return trailingComments; - }; - CommentHandler.prototype.findLeadingComments = function (node, metadata) { - var this$1 = this; - - var leadingComments = []; - var target; - while (this.stack.length > 0) { - var entry = this$1.stack[this$1.stack.length - 1]; - if (entry && entry.start >= metadata.start.offset) { - target = this$1.stack.pop().node; - } - else { - break; - } - } - if (target) { - var count = target.leadingComments ? target.leadingComments.length : 0; - for (var i = count - 1; i >= 0; --i) { - var comment = target.leadingComments[i]; - if (comment.range[1] <= metadata.start.offset) { - leadingComments.unshift(comment); - target.leadingComments.splice(i, 1); - } - } - if (target.leadingComments && target.leadingComments.length === 0) { - delete target.leadingComments; - } - return leadingComments; - } - for (var i = this.leading.length - 1; i >= 0; --i) { - var entry = this$1.leading[i]; - if (entry.start <= metadata.start.offset) { - leadingComments.unshift(entry.comment); - this$1.leading.splice(i, 1); - } - } - return leadingComments; - }; - CommentHandler.prototype.visitNode = function (node, metadata) { - if (node.type === syntax_1.Syntax.Program && node.body.length > 0) { - return; - } - this.insertInnerComments(node, metadata); - var trailingComments = this.findTrailingComments(node, metadata); - var leadingComments = this.findLeadingComments(node, metadata); - if (leadingComments.length > 0) { - node.leadingComments = leadingComments; - } - if (trailingComments.length > 0) { - node.trailingComments = trailingComments; - } - this.stack.push({ - node: node, - start: metadata.start.offset - }); - }; - CommentHandler.prototype.visitComment = function (node, metadata) { - var type = (node.type[0] === 'L') ? 'Line' : 'Block'; - var comment = { - type: type, - value: node.value - }; - if (node.range) { - comment.range = node.range; - } - if (node.loc) { - comment.loc = node.loc; - } - this.comments.push(comment); - if (this.attach) { - var entry = { - comment: { - type: type, - value: node.value, - range: [metadata.start.offset, metadata.end.offset] - }, - start: metadata.start.offset - }; - if (node.loc) { - entry.comment.loc = node.loc; - } - node.type = type; - this.leading.push(entry); - this.trailing.push(entry); - } - }; - CommentHandler.prototype.visit = function (node, metadata) { - if (node.type === 'LineComment') { - this.visitComment(node, metadata); - } - else if (node.type === 'BlockComment') { - this.visitComment(node, metadata); - } - else if (this.attach) { - this.visitNode(node, metadata); - } - }; - return CommentHandler; - }()); - exports.CommentHandler = CommentHandler; - - - /***/ }, - /* 2 */ - /***/ function(module, exports) { - exports.Syntax = { - AssignmentExpression: 'AssignmentExpression', - AssignmentPattern: 'AssignmentPattern', - ArrayExpression: 'ArrayExpression', - ArrayPattern: 'ArrayPattern', - ArrowFunctionExpression: 'ArrowFunctionExpression', - BlockStatement: 'BlockStatement', - BinaryExpression: 'BinaryExpression', - BreakStatement: 'BreakStatement', - CallExpression: 'CallExpression', - CatchClause: 'CatchClause', - ClassBody: 'ClassBody', - ClassDeclaration: 'ClassDeclaration', - ClassExpression: 'ClassExpression', - ConditionalExpression: 'ConditionalExpression', - ContinueStatement: 'ContinueStatement', - DoWhileStatement: 'DoWhileStatement', - DebuggerStatement: 'DebuggerStatement', - EmptyStatement: 'EmptyStatement', - ExportAllDeclaration: 'ExportAllDeclaration', - ExportDefaultDeclaration: 'ExportDefaultDeclaration', - ExportNamedDeclaration: 'ExportNamedDeclaration', - ExportSpecifier: 'ExportSpecifier', - ExpressionStatement: 'ExpressionStatement', - ForStatement: 'ForStatement', - ForOfStatement: 'ForOfStatement', - ForInStatement: 'ForInStatement', - FunctionDeclaration: 'FunctionDeclaration', - FunctionExpression: 'FunctionExpression', - Identifier: 'Identifier', - IfStatement: 'IfStatement', - ImportDeclaration: 'ImportDeclaration', - ImportDefaultSpecifier: 'ImportDefaultSpecifier', - ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', - ImportSpecifier: 'ImportSpecifier', - Literal: 'Literal', - LabeledStatement: 'LabeledStatement', - LogicalExpression: 'LogicalExpression', - MemberExpression: 'MemberExpression', - MetaProperty: 'MetaProperty', - MethodDefinition: 'MethodDefinition', - NewExpression: 'NewExpression', - ObjectExpression: 'ObjectExpression', - ObjectPattern: 'ObjectPattern', - Program: 'Program', - Property: 'Property', - RestElement: 'RestElement', - ReturnStatement: 'ReturnStatement', - SequenceExpression: 'SequenceExpression', - SpreadElement: 'SpreadElement', - Super: 'Super', - SwitchCase: 'SwitchCase', - SwitchStatement: 'SwitchStatement', - TaggedTemplateExpression: 'TaggedTemplateExpression', - TemplateElement: 'TemplateElement', - TemplateLiteral: 'TemplateLiteral', - ThisExpression: 'ThisExpression', - ThrowStatement: 'ThrowStatement', - TryStatement: 'TryStatement', - UnaryExpression: 'UnaryExpression', - UpdateExpression: 'UpdateExpression', - VariableDeclaration: 'VariableDeclaration', - VariableDeclarator: 'VariableDeclarator', - WhileStatement: 'WhileStatement', - WithStatement: 'WithStatement', - YieldExpression: 'YieldExpression' - }; - - - /***/ }, - /* 3 */ - /***/ function(module, exports, __webpack_require__) { - var assert_1 = __webpack_require__(4); - var messages_1 = __webpack_require__(5); - var error_handler_1 = __webpack_require__(6); - var token_1 = __webpack_require__(7); - var scanner_1 = __webpack_require__(8); - var syntax_1 = __webpack_require__(2); - var Node = __webpack_require__(10); - var ArrowParameterPlaceHolder = 'ArrowParameterPlaceHolder'; - var Parser = (function () { - function Parser(code, options, delegate) { - if (options === void 0) { options = {}; } - this.config = { - range: (typeof options.range === 'boolean') && options.range, - loc: (typeof options.loc === 'boolean') && options.loc, - source: null, - tokens: (typeof options.tokens === 'boolean') && options.tokens, - comment: (typeof options.comment === 'boolean') && options.comment, - tolerant: (typeof options.tolerant === 'boolean') && options.tolerant - }; - if (this.config.loc && options.source && options.source !== null) { - this.config.source = String(options.source); - } - this.delegate = delegate; - this.errorHandler = new error_handler_1.ErrorHandler(); - this.errorHandler.tolerant = this.config.tolerant; - this.scanner = new scanner_1.Scanner(code, this.errorHandler); - this.scanner.trackComment = this.config.comment; - this.operatorPrecedence = { - ')': 0, - ';': 0, - ',': 0, - '=': 0, - ']': 0, - '||': 1, - '&&': 2, - '|': 3, - '^': 4, - '&': 5, - '==': 6, - '!=': 6, - '===': 6, - '!==': 6, - '<': 7, - '>': 7, - '<=': 7, - '>=': 7, - '<<': 8, - '>>': 8, - '>>>': 8, - '+': 9, - '-': 9, - '*': 11, - '/': 11, - '%': 11 - }; - this.sourceType = (options && options.sourceType === 'module') ? 'module' : 'script'; - this.lookahead = null; - this.hasLineTerminator = false; - this.context = { - allowIn: true, - allowYield: true, - firstCoverInitializedNameError: null, - isAssignmentTarget: false, - isBindingElement: false, - inFunctionBody: false, - inIteration: false, - inSwitch: false, - labelSet: {}, - strict: (this.sourceType === 'module') - }; - this.tokens = []; - this.startMarker = { - index: 0, - lineNumber: this.scanner.lineNumber, - lineStart: 0 - }; - this.lastMarker = { - index: 0, - lineNumber: this.scanner.lineNumber, - lineStart: 0 - }; - this.nextToken(); - this.lastMarker = { - index: this.scanner.index, - lineNumber: this.scanner.lineNumber, - lineStart: this.scanner.lineStart - }; - } - Parser.prototype.throwError = function (messageFormat) { - var arguments$1 = arguments; - - var values = []; - for (var _i = 1; _i < arguments.length; _i++) { - values[_i - 1] = arguments$1[_i]; - } - var args = Array.prototype.slice.call(arguments, 1); - var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { - assert_1.assert(idx < args.length, 'Message reference must be in range'); - return args[idx]; - }); - var index = this.lastMarker.index; - var line = this.lastMarker.lineNumber; - var column = this.lastMarker.index - this.lastMarker.lineStart + 1; - throw this.errorHandler.createError(index, line, column, msg); - }; - Parser.prototype.tolerateError = function (messageFormat) { - var arguments$1 = arguments; - - var values = []; - for (var _i = 1; _i < arguments.length; _i++) { - values[_i - 1] = arguments$1[_i]; - } - var args = Array.prototype.slice.call(arguments, 1); - var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { - assert_1.assert(idx < args.length, 'Message reference must be in range'); - return args[idx]; - }); - var index = this.lastMarker.index; - var line = this.scanner.lineNumber; - var column = this.lastMarker.index - this.lastMarker.lineStart + 1; - this.errorHandler.tolerateError(index, line, column, msg); - }; - // Throw an exception because of the token. - Parser.prototype.unexpectedTokenError = function (token, message) { - var msg = message || messages_1.Messages.UnexpectedToken; - var value; - if (token) { - if (!message) { - msg = (token.type === token_1.Token.EOF) ? messages_1.Messages.UnexpectedEOS : - (token.type === token_1.Token.Identifier) ? messages_1.Messages.UnexpectedIdentifier : - (token.type === token_1.Token.NumericLiteral) ? messages_1.Messages.UnexpectedNumber : - (token.type === token_1.Token.StringLiteral) ? messages_1.Messages.UnexpectedString : - (token.type === token_1.Token.Template) ? messages_1.Messages.UnexpectedTemplate : - messages_1.Messages.UnexpectedToken; - if (token.type === token_1.Token.Keyword) { - if (this.scanner.isFutureReservedWord(token.value)) { - msg = messages_1.Messages.UnexpectedReserved; - } - else if (this.context.strict && this.scanner.isStrictModeReservedWord(token.value)) { - msg = messages_1.Messages.StrictReservedWord; - } - } - } - value = (token.type === token_1.Token.Template) ? token.value.raw : token.value; - } - else { - value = 'ILLEGAL'; - } - msg = msg.replace('%0', value); - if (token && typeof token.lineNumber === 'number') { - var index = token.start; - var line = token.lineNumber; - var column = token.start - this.lastMarker.lineStart + 1; - return this.errorHandler.createError(index, line, column, msg); - } - else { - var index = this.lastMarker.index; - var line = this.lastMarker.lineNumber; - var column = index - this.lastMarker.lineStart + 1; - return this.errorHandler.createError(index, line, column, msg); - } - }; - Parser.prototype.throwUnexpectedToken = function (token, message) { - throw this.unexpectedTokenError(token, message); - }; - Parser.prototype.tolerateUnexpectedToken = function (token, message) { - this.errorHandler.tolerate(this.unexpectedTokenError(token, message)); - }; - Parser.prototype.collectComments = function () { - var this$1 = this; - - if (!this.config.comment) { - this.scanner.scanComments(); - } - else { - var comments = this.scanner.scanComments(); - if (comments.length > 0 && this.delegate) { - for (var i = 0; i < comments.length; ++i) { - var e = comments[i]; - var node = void 0; - node = { - type: e.multiLine ? 'BlockComment' : 'LineComment', - value: this$1.scanner.source.slice(e.slice[0], e.slice[1]) - }; - if (this$1.config.range) { - node.range = e.range; - } - if (this$1.config.loc) { - node.loc = e.loc; - } - var metadata = { - start: { - line: e.loc.start.line, - column: e.loc.start.column, - offset: e.range[0] - }, - end: { - line: e.loc.end.line, - column: e.loc.end.column, - offset: e.range[1] - } - }; - this$1.delegate(node, metadata); - } - } - } - }; - // From internal representation to an external structure - Parser.prototype.getTokenRaw = function (token) { - return this.scanner.source.slice(token.start, token.end); - }; - Parser.prototype.convertToken = function (token) { - var t; - t = { - type: token_1.TokenName[token.type], - value: this.getTokenRaw(token) - }; - if (this.config.range) { - t.range = [token.start, token.end]; - } - if (this.config.loc) { - t.loc = { - start: { - line: this.startMarker.lineNumber, - column: this.startMarker.index - this.startMarker.lineStart - }, - end: { - line: this.scanner.lineNumber, - column: this.scanner.index - this.scanner.lineStart - } - }; - } - if (token.regex) { - t.regex = token.regex; - } - return t; - }; - Parser.prototype.nextToken = function () { - var token = this.lookahead; - this.lastMarker.index = this.scanner.index; - this.lastMarker.lineNumber = this.scanner.lineNumber; - this.lastMarker.lineStart = this.scanner.lineStart; - this.collectComments(); - this.startMarker.index = this.scanner.index; - this.startMarker.lineNumber = this.scanner.lineNumber; - this.startMarker.lineStart = this.scanner.lineStart; - var next; - next = this.scanner.lex(); - this.hasLineTerminator = (token && next) ? (token.lineNumber !== next.lineNumber) : false; - if (next && this.context.strict && next.type === token_1.Token.Identifier) { - if (this.scanner.isStrictModeReservedWord(next.value)) { - next.type = token_1.Token.Keyword; - } - } - this.lookahead = next; - if (this.config.tokens && next.type !== token_1.Token.EOF) { - this.tokens.push(this.convertToken(next)); - } - return token; - }; - Parser.prototype.nextRegexToken = function () { - this.collectComments(); - var token = this.scanner.scanRegExp(); - if (this.config.tokens) { - // Pop the previous token, '/' or '/=' - // This is added from the lookahead token. - this.tokens.pop(); - this.tokens.push(this.convertToken(token)); - } - // Prime the next lookahead. - this.lookahead = token; - this.nextToken(); - return token; - }; - Parser.prototype.createNode = function () { - return { - index: this.startMarker.index, - line: this.startMarker.lineNumber, - column: this.startMarker.index - this.startMarker.lineStart - }; - }; - Parser.prototype.startNode = function (token) { - return { - index: token.start, - line: token.lineNumber, - column: token.start - token.lineStart - }; - }; - Parser.prototype.finalize = function (meta, node) { - if (this.config.range) { - node.range = [meta.index, this.lastMarker.index]; - } - if (this.config.loc) { - node.loc = { - start: { - line: meta.line, - column: meta.column - }, - end: { - line: this.lastMarker.lineNumber, - column: this.lastMarker.index - this.lastMarker.lineStart - } - }; - if (this.config.source) { - node.loc.source = this.config.source; - } - } - if (this.delegate) { - var metadata = { - start: { - line: meta.line, - column: meta.column, - offset: meta.index - }, - end: { - line: this.lastMarker.lineNumber, - column: this.lastMarker.index - this.lastMarker.lineStart, - offset: this.lastMarker.index - } - }; - this.delegate(node, metadata); - } - return node; - }; - // Expect the next token to match the specified punctuator. - // If not, an exception will be thrown. - Parser.prototype.expect = function (value) { - var token = this.nextToken(); - if (token.type !== token_1.Token.Punctuator || token.value !== value) { - this.throwUnexpectedToken(token); - } - }; - // Quietly expect a comma when in tolerant mode, otherwise delegates to expect(). - Parser.prototype.expectCommaSeparator = function () { - if (this.config.tolerant) { - var token = this.lookahead; - if (token.type === token_1.Token.Punctuator && token.value === ',') { - this.nextToken(); - } - else if (token.type === token_1.Token.Punctuator && token.value === ';') { - this.nextToken(); - this.tolerateUnexpectedToken(token); - } - else { - this.tolerateUnexpectedToken(token, messages_1.Messages.UnexpectedToken); - } - } - else { - this.expect(','); - } - }; - // Expect the next token to match the specified keyword. - // If not, an exception will be thrown. - Parser.prototype.expectKeyword = function (keyword) { - var token = this.nextToken(); - if (token.type !== token_1.Token.Keyword || token.value !== keyword) { - this.throwUnexpectedToken(token); - } - }; - // Return true if the next token matches the specified punctuator. - Parser.prototype.match = function (value) { - return this.lookahead.type === token_1.Token.Punctuator && this.lookahead.value === value; - }; - // Return true if the next token matches the specified keyword - Parser.prototype.matchKeyword = function (keyword) { - return this.lookahead.type === token_1.Token.Keyword && this.lookahead.value === keyword; - }; - // Return true if the next token matches the specified contextual keyword - // (where an identifier is sometimes a keyword depending on the context) - Parser.prototype.matchContextualKeyword = function (keyword) { - return this.lookahead.type === token_1.Token.Identifier && this.lookahead.value === keyword; - }; - // Return true if the next token is an assignment operator - Parser.prototype.matchAssign = function () { - if (this.lookahead.type !== token_1.Token.Punctuator) { - return false; - } - var op = this.lookahead.value; - return op === '=' || - op === '*=' || - op === '**=' || - op === '/=' || - op === '%=' || - op === '+=' || - op === '-=' || - op === '<<=' || - op === '>>=' || - op === '>>>=' || - op === '&=' || - op === '^=' || - op === '|='; - }; - // Cover grammar support. - // - // When an assignment expression position starts with an left parenthesis, the determination of the type - // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead) - // or the first comma. This situation also defers the determination of all the expressions nested in the pair. - // - // There are three productions that can be parsed in a parentheses pair that needs to be determined - // after the outermost pair is closed. They are: - // - // 1. AssignmentExpression - // 2. BindingElements - // 3. AssignmentTargets - // - // In order to avoid exponential backtracking, we use two flags to denote if the production can be - // binding element or assignment target. - // - // The three productions have the relationship: - // - // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression - // - // with a single exception that CoverInitializedName when used directly in an Expression, generates - // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the - // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair. - // - // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not - // effect the current flags. This means the production the parser parses is only used as an expression. Therefore - // the CoverInitializedName check is conducted. - // - // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates - // the flags outside of the parser. This means the production the parser parses is used as a part of a potential - // pattern. The CoverInitializedName check is deferred. - Parser.prototype.isolateCoverGrammar = function (parseFunction) { - var previousIsBindingElement = this.context.isBindingElement; - var previousIsAssignmentTarget = this.context.isAssignmentTarget; - var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; - this.context.isBindingElement = true; - this.context.isAssignmentTarget = true; - this.context.firstCoverInitializedNameError = null; - var result = parseFunction.call(this); - if (this.context.firstCoverInitializedNameError !== null) { - this.throwUnexpectedToken(this.context.firstCoverInitializedNameError); - } - this.context.isBindingElement = previousIsBindingElement; - this.context.isAssignmentTarget = previousIsAssignmentTarget; - this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError; - return result; - }; - Parser.prototype.inheritCoverGrammar = function (parseFunction) { - var previousIsBindingElement = this.context.isBindingElement; - var previousIsAssignmentTarget = this.context.isAssignmentTarget; - var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; - this.context.isBindingElement = true; - this.context.isAssignmentTarget = true; - this.context.firstCoverInitializedNameError = null; - var result = parseFunction.call(this); - this.context.isBindingElement = this.context.isBindingElement && previousIsBindingElement; - this.context.isAssignmentTarget = this.context.isAssignmentTarget && previousIsAssignmentTarget; - this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError || this.context.firstCoverInitializedNameError; - return result; - }; - Parser.prototype.consumeSemicolon = function () { - if (this.match(';')) { - this.nextToken(); - } - else if (!this.hasLineTerminator) { - if (this.lookahead.type !== token_1.Token.EOF && !this.match('}')) { - this.throwUnexpectedToken(this.lookahead); - } - this.lastMarker.index = this.startMarker.index; - this.lastMarker.lineNumber = this.startMarker.lineNumber; - this.lastMarker.lineStart = this.startMarker.lineStart; - } - }; - // ECMA-262 12.2 Primary Expressions - Parser.prototype.parsePrimaryExpression = function () { - var node = this.createNode(); - var expr; - var value, token, raw; - switch (this.lookahead.type) { - case token_1.Token.Identifier: - if (this.sourceType === 'module' && this.lookahead.value === 'await') { - this.tolerateUnexpectedToken(this.lookahead); - } - expr = this.finalize(node, new Node.Identifier(this.nextToken().value)); - break; - case token_1.Token.NumericLiteral: - case token_1.Token.StringLiteral: - if (this.context.strict && this.lookahead.octal) { - this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.StrictOctalLiteral); - } - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - token = this.nextToken(); - raw = this.getTokenRaw(token); - expr = this.finalize(node, new Node.Literal(token.value, raw)); - break; - case token_1.Token.BooleanLiteral: - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - token = this.nextToken(); - token.value = (token.value === 'true'); - raw = this.getTokenRaw(token); - expr = this.finalize(node, new Node.Literal(token.value, raw)); - break; - case token_1.Token.NullLiteral: - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - token = this.nextToken(); - token.value = null; - raw = this.getTokenRaw(token); - expr = this.finalize(node, new Node.Literal(token.value, raw)); - break; - case token_1.Token.Template: - expr = this.parseTemplateLiteral(); - break; - case token_1.Token.Punctuator: - value = this.lookahead.value; - switch (value) { - case '(': - this.context.isBindingElement = false; - expr = this.inheritCoverGrammar(this.parseGroupExpression); - break; - case '[': - expr = this.inheritCoverGrammar(this.parseArrayInitializer); - break; - case '{': - expr = this.inheritCoverGrammar(this.parseObjectInitializer); - break; - case '/': - case '/=': - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - this.scanner.index = this.startMarker.index; - token = this.nextRegexToken(); - raw = this.getTokenRaw(token); - expr = this.finalize(node, new Node.RegexLiteral(token.value, raw, token.regex)); - break; - default: - this.throwUnexpectedToken(this.nextToken()); - } - break; - case token_1.Token.Keyword: - if (!this.context.strict && this.context.allowYield && this.matchKeyword('yield')) { - expr = this.parseIdentifierName(); - } - else if (!this.context.strict && this.matchKeyword('let')) { - expr = this.finalize(node, new Node.Identifier(this.nextToken().value)); - } - else { - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - if (this.matchKeyword('function')) { - expr = this.parseFunctionExpression(); - } - else if (this.matchKeyword('this')) { - this.nextToken(); - expr = this.finalize(node, new Node.ThisExpression()); - } - else if (this.matchKeyword('class')) { - expr = this.parseClassExpression(); - } - else { - this.throwUnexpectedToken(this.nextToken()); - } - } - break; - default: - this.throwUnexpectedToken(this.nextToken()); - } - return expr; - }; - // ECMA-262 12.2.5 Array Initializer - Parser.prototype.parseSpreadElement = function () { - var node = this.createNode(); - this.expect('...'); - var arg = this.inheritCoverGrammar(this.parseAssignmentExpression); - return this.finalize(node, new Node.SpreadElement(arg)); - }; - Parser.prototype.parseArrayInitializer = function () { - var this$1 = this; - - var node = this.createNode(); - var elements = []; - this.expect('['); - while (!this.match(']')) { - if (this$1.match(',')) { - this$1.nextToken(); - elements.push(null); - } - else if (this$1.match('...')) { - var element = this$1.parseSpreadElement(); - if (!this$1.match(']')) { - this$1.context.isAssignmentTarget = false; - this$1.context.isBindingElement = false; - this$1.expect(','); - } - elements.push(element); - } - else { - elements.push(this$1.inheritCoverGrammar(this$1.parseAssignmentExpression)); - if (!this$1.match(']')) { - this$1.expect(','); - } - } - } - this.expect(']'); - return this.finalize(node, new Node.ArrayExpression(elements)); - }; - // ECMA-262 12.2.6 Object Initializer - Parser.prototype.parsePropertyMethod = function (params) { - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var previousStrict = this.context.strict; - var body = this.isolateCoverGrammar(this.parseFunctionSourceElements); - if (this.context.strict && params.firstRestricted) { - this.tolerateUnexpectedToken(params.firstRestricted, params.message); - } - if (this.context.strict && params.stricted) { - this.tolerateUnexpectedToken(params.stricted, params.message); - } - this.context.strict = previousStrict; - return body; - }; - Parser.prototype.parsePropertyMethodFunction = function () { - var isGenerator = false; - var node = this.createNode(); - var previousAllowYield = this.context.allowYield; - this.context.allowYield = false; - var params = this.parseFormalParameters(); - var method = this.parsePropertyMethod(params); - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); - }; - Parser.prototype.parseObjectPropertyKey = function () { - var node = this.createNode(); - var token = this.nextToken(); - var key = null; - switch (token.type) { - case token_1.Token.StringLiteral: - case token_1.Token.NumericLiteral: - if (this.context.strict && token.octal) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictOctalLiteral); - } - var raw = this.getTokenRaw(token); - key = this.finalize(node, new Node.Literal(token.value, raw)); - break; - case token_1.Token.Identifier: - case token_1.Token.BooleanLiteral: - case token_1.Token.NullLiteral: - case token_1.Token.Keyword: - key = this.finalize(node, new Node.Identifier(token.value)); - break; - case token_1.Token.Punctuator: - if (token.value === '[') { - key = this.isolateCoverGrammar(this.parseAssignmentExpression); - this.expect(']'); - } - else { - this.throwUnexpectedToken(token); - } - break; - default: - this.throwUnexpectedToken(token); - } - return key; - }; - Parser.prototype.isPropertyKey = function (key, value) { - return (key.type === syntax_1.Syntax.Identifier && key.name === value) || - (key.type === syntax_1.Syntax.Literal && key.value === value); - }; - Parser.prototype.parseObjectProperty = function (hasProto) { - var node = this.createNode(); - var token = this.lookahead; - var kind; - var key; - var value; - var computed = false; - var method = false; - var shorthand = false; - if (token.type === token_1.Token.Identifier) { - this.nextToken(); - key = this.finalize(node, new Node.Identifier(token.value)); - } - else if (this.match('*')) { - this.nextToken(); - } - else { - computed = this.match('['); - key = this.parseObjectPropertyKey(); - } - var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); - if (token.type === token_1.Token.Identifier && token.value === 'get' && lookaheadPropertyKey) { - kind = 'get'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - this.context.allowYield = false; - value = this.parseGetterMethod(); - } - else if (token.type === token_1.Token.Identifier && token.value === 'set' && lookaheadPropertyKey) { - kind = 'set'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - value = this.parseSetterMethod(); - } - else if (token.type === token_1.Token.Punctuator && token.value === '*' && lookaheadPropertyKey) { - kind = 'init'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - value = this.parseGeneratorMethod(); - method = true; - } - else { - if (!key) { - this.throwUnexpectedToken(this.lookahead); - } - kind = 'init'; - if (this.match(':')) { - if (!computed && this.isPropertyKey(key, '__proto__')) { - if (hasProto.value) { - this.tolerateError(messages_1.Messages.DuplicateProtoProperty); - } - hasProto.value = true; - } - this.nextToken(); - value = this.inheritCoverGrammar(this.parseAssignmentExpression); - } - else if (this.match('(')) { - value = this.parsePropertyMethodFunction(); - method = true; - } - else if (token.type === token_1.Token.Identifier) { - var id = this.finalize(node, new Node.Identifier(token.value)); - if (this.match('=')) { - this.context.firstCoverInitializedNameError = this.lookahead; - this.nextToken(); - shorthand = true; - var init = this.isolateCoverGrammar(this.parseAssignmentExpression); - value = this.finalize(node, new Node.AssignmentPattern(id, init)); - } - else { - shorthand = true; - value = id; - } - } - else { - this.throwUnexpectedToken(this.nextToken()); - } - } - return this.finalize(node, new Node.Property(kind, key, computed, value, method, shorthand)); - }; - Parser.prototype.parseObjectInitializer = function () { - var this$1 = this; - - var node = this.createNode(); - this.expect('{'); - var properties = []; - var hasProto = { value: false }; - while (!this.match('}')) { - properties.push(this$1.parseObjectProperty(hasProto)); - if (!this$1.match('}')) { - this$1.expectCommaSeparator(); - } - } - this.expect('}'); - return this.finalize(node, new Node.ObjectExpression(properties)); - }; - // ECMA-262 12.2.9 Template Literals - Parser.prototype.parseTemplateHead = function () { - assert_1.assert(this.lookahead.head, 'Template literal must start with a template head'); - var node = this.createNode(); - var token = this.nextToken(); - var value = { - raw: token.value.raw, - cooked: token.value.cooked - }; - return this.finalize(node, new Node.TemplateElement(value, token.tail)); - }; - Parser.prototype.parseTemplateElement = function () { - if (this.lookahead.type !== token_1.Token.Template) { - this.throwUnexpectedToken(); - } - var node = this.createNode(); - var token = this.nextToken(); - var value = { - raw: token.value.raw, - cooked: token.value.cooked - }; - return this.finalize(node, new Node.TemplateElement(value, token.tail)); - }; - Parser.prototype.parseTemplateLiteral = function () { - var this$1 = this; - - var node = this.createNode(); - var expressions = []; - var quasis = []; - var quasi = this.parseTemplateHead(); - quasis.push(quasi); - while (!quasi.tail) { - expressions.push(this$1.parseExpression()); - quasi = this$1.parseTemplateElement(); - quasis.push(quasi); - } - return this.finalize(node, new Node.TemplateLiteral(quasis, expressions)); - }; - // ECMA-262 12.2.10 The Grouping Operator - Parser.prototype.reinterpretExpressionAsPattern = function (expr) { - var this$1 = this; - - switch (expr.type) { - case syntax_1.Syntax.Identifier: - case syntax_1.Syntax.MemberExpression: - case syntax_1.Syntax.RestElement: - case syntax_1.Syntax.AssignmentPattern: - break; - case syntax_1.Syntax.SpreadElement: - expr.type = syntax_1.Syntax.RestElement; - this.reinterpretExpressionAsPattern(expr.argument); - break; - case syntax_1.Syntax.ArrayExpression: - expr.type = syntax_1.Syntax.ArrayPattern; - for (var i = 0; i < expr.elements.length; i++) { - if (expr.elements[i] !== null) { - this$1.reinterpretExpressionAsPattern(expr.elements[i]); - } - } - break; - case syntax_1.Syntax.ObjectExpression: - expr.type = syntax_1.Syntax.ObjectPattern; - for (var i = 0; i < expr.properties.length; i++) { - this$1.reinterpretExpressionAsPattern(expr.properties[i].value); - } - break; - case syntax_1.Syntax.AssignmentExpression: - expr.type = syntax_1.Syntax.AssignmentPattern; - delete expr.operator; - this.reinterpretExpressionAsPattern(expr.left); - break; - default: - // Allow other node type for tolerant parsing. - break; - } - }; - Parser.prototype.parseGroupExpression = function () { - var this$1 = this; - - var expr; - this.expect('('); - if (this.match(')')) { - this.nextToken(); - if (!this.match('=>')) { - this.expect('=>'); - } - expr = { - type: ArrowParameterPlaceHolder, - params: [] - }; - } - else { - var startToken = this.lookahead; - var params = []; - if (this.match('...')) { - expr = this.parseRestElement(params); - this.expect(')'); - if (!this.match('=>')) { - this.expect('=>'); - } - expr = { - type: ArrowParameterPlaceHolder, - params: [expr] - }; - } - else { - var arrow = false; - this.context.isBindingElement = true; - expr = this.inheritCoverGrammar(this.parseAssignmentExpression); - if (this.match(',')) { - var expressions = []; - this.context.isAssignmentTarget = false; - expressions.push(expr); - while (this.startMarker.index < this.scanner.length) { - if (!this$1.match(',')) { - break; - } - this$1.nextToken(); - if (this$1.match('...')) { - if (!this$1.context.isBindingElement) { - this$1.throwUnexpectedToken(this$1.lookahead); - } - expressions.push(this$1.parseRestElement(params)); - this$1.expect(')'); - if (!this$1.match('=>')) { - this$1.expect('=>'); - } - this$1.context.isBindingElement = false; - for (var i = 0; i < expressions.length; i++) { - this$1.reinterpretExpressionAsPattern(expressions[i]); - } - arrow = true; - expr = { - type: ArrowParameterPlaceHolder, - params: expressions - }; - } - else { - expressions.push(this$1.inheritCoverGrammar(this$1.parseAssignmentExpression)); - } - if (arrow) { - break; - } - } - if (!arrow) { - expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); - } - } - if (!arrow) { - this.expect(')'); - if (this.match('=>')) { - if (expr.type === syntax_1.Syntax.Identifier && expr.name === 'yield') { - arrow = true; - expr = { - type: ArrowParameterPlaceHolder, - params: [expr] - }; - } - if (!arrow) { - if (!this.context.isBindingElement) { - this.throwUnexpectedToken(this.lookahead); - } - if (expr.type === syntax_1.Syntax.SequenceExpression) { - for (var i = 0; i < expr.expressions.length; i++) { - this$1.reinterpretExpressionAsPattern(expr.expressions[i]); - } - } - else { - this.reinterpretExpressionAsPattern(expr); - } - var params_1 = (expr.type === syntax_1.Syntax.SequenceExpression ? expr.expressions : [expr]); - expr = { - type: ArrowParameterPlaceHolder, - params: params_1 - }; - } - } - this.context.isBindingElement = false; - } - } - } - return expr; - }; - // ECMA-262 12.3 Left-Hand-Side Expressions - Parser.prototype.parseArguments = function () { - var this$1 = this; - - this.expect('('); - var args = []; - if (!this.match(')')) { - while (true) { - var expr = this$1.match('...') ? this$1.parseSpreadElement() : - this$1.isolateCoverGrammar(this$1.parseAssignmentExpression); - args.push(expr); - if (this$1.match(')')) { - break; - } - this$1.expectCommaSeparator(); - } - } - this.expect(')'); - return args; - }; - Parser.prototype.isIdentifierName = function (token) { - return token.type === token_1.Token.Identifier || - token.type === token_1.Token.Keyword || - token.type === token_1.Token.BooleanLiteral || - token.type === token_1.Token.NullLiteral; - }; - Parser.prototype.parseIdentifierName = function () { - var node = this.createNode(); - var token = this.nextToken(); - if (!this.isIdentifierName(token)) { - this.throwUnexpectedToken(token); - } - return this.finalize(node, new Node.Identifier(token.value)); - }; - Parser.prototype.parseNewExpression = function () { - var node = this.createNode(); - var id = this.parseIdentifierName(); - assert_1.assert(id.name === 'new', 'New expression must start with `new`'); - var expr; - if (this.match('.')) { - this.nextToken(); - if (this.lookahead.type === token_1.Token.Identifier && this.context.inFunctionBody && this.lookahead.value === 'target') { - var property = this.parseIdentifierName(); - expr = new Node.MetaProperty(id, property); - } - else { - this.throwUnexpectedToken(this.lookahead); - } - } - else { - var callee = this.isolateCoverGrammar(this.parseLeftHandSideExpression); - var args = this.match('(') ? this.parseArguments() : []; - expr = new Node.NewExpression(callee, args); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } - return this.finalize(node, expr); - }; - Parser.prototype.parseLeftHandSideExpressionAllowCall = function () { - var this$1 = this; - - var startToken = this.lookahead; - var previousAllowIn = this.context.allowIn; - this.context.allowIn = true; - var expr; - if (this.matchKeyword('super') && this.context.inFunctionBody) { - expr = this.createNode(); - this.nextToken(); - expr = this.finalize(expr, new Node.Super()); - if (!this.match('(') && !this.match('.') && !this.match('[')) { - this.throwUnexpectedToken(this.lookahead); - } - } - else { - expr = this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); - } - while (true) { - if (this$1.match('.')) { - this$1.context.isBindingElement = false; - this$1.context.isAssignmentTarget = true; - this$1.expect('.'); - var property = this$1.parseIdentifierName(); - expr = this$1.finalize(this$1.startNode(startToken), new Node.StaticMemberExpression(expr, property)); - } - else if (this$1.match('(')) { - this$1.context.isBindingElement = false; - this$1.context.isAssignmentTarget = false; - var args = this$1.parseArguments(); - expr = this$1.finalize(this$1.startNode(startToken), new Node.CallExpression(expr, args)); - } - else if (this$1.match('[')) { - this$1.context.isBindingElement = false; - this$1.context.isAssignmentTarget = true; - this$1.expect('['); - var property = this$1.isolateCoverGrammar(this$1.parseExpression); - this$1.expect(']'); - expr = this$1.finalize(this$1.startNode(startToken), new Node.ComputedMemberExpression(expr, property)); - } - else if (this$1.lookahead.type === token_1.Token.Template && this$1.lookahead.head) { - var quasi = this$1.parseTemplateLiteral(); - expr = this$1.finalize(this$1.startNode(startToken), new Node.TaggedTemplateExpression(expr, quasi)); - } - else { - break; - } - } - this.context.allowIn = previousAllowIn; - return expr; - }; - Parser.prototype.parseSuper = function () { - var node = this.createNode(); - this.expectKeyword('super'); - if (!this.match('[') && !this.match('.')) { - this.throwUnexpectedToken(this.lookahead); - } - return this.finalize(node, new Node.Super()); - }; - Parser.prototype.parseLeftHandSideExpression = function () { - var this$1 = this; - - assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.'); - var node = this.startNode(this.lookahead); - var expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() : - this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); - while (true) { - if (this$1.match('[')) { - this$1.context.isBindingElement = false; - this$1.context.isAssignmentTarget = true; - this$1.expect('['); - var property = this$1.isolateCoverGrammar(this$1.parseExpression); - this$1.expect(']'); - expr = this$1.finalize(node, new Node.ComputedMemberExpression(expr, property)); - } - else if (this$1.match('.')) { - this$1.context.isBindingElement = false; - this$1.context.isAssignmentTarget = true; - this$1.expect('.'); - var property = this$1.parseIdentifierName(); - expr = this$1.finalize(node, new Node.StaticMemberExpression(expr, property)); - } - else if (this$1.lookahead.type === token_1.Token.Template && this$1.lookahead.head) { - var quasi = this$1.parseTemplateLiteral(); - expr = this$1.finalize(node, new Node.TaggedTemplateExpression(expr, quasi)); - } - else { - break; - } - } - return expr; - }; - // ECMA-262 12.4 Update Expressions - Parser.prototype.parseUpdateExpression = function () { - var expr; - var startToken = this.lookahead; - if (this.match('++') || this.match('--')) { - var node = this.startNode(startToken); - var token = this.nextToken(); - expr = this.inheritCoverGrammar(this.parseUnaryExpression); - if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { - this.tolerateError(messages_1.Messages.StrictLHSPrefix); - } - if (!this.context.isAssignmentTarget) { - this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); - } - var prefix = true; - expr = this.finalize(node, new Node.UpdateExpression(token.value, expr, prefix)); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } - else { - expr = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall); - if (!this.hasLineTerminator && this.lookahead.type === token_1.Token.Punctuator) { - if (this.match('++') || this.match('--')) { - if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { - this.tolerateError(messages_1.Messages.StrictLHSPostfix); - } - if (!this.context.isAssignmentTarget) { - this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); - } - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var operator = this.nextToken().value; - var prefix = false; - expr = this.finalize(this.startNode(startToken), new Node.UpdateExpression(operator, expr, prefix)); - } - } - } - return expr; - }; - // ECMA-262 12.5 Unary Operators - Parser.prototype.parseUnaryExpression = function () { - var expr; - if (this.match('+') || this.match('-') || this.match('~') || this.match('!') || - this.matchKeyword('delete') || this.matchKeyword('void') || this.matchKeyword('typeof')) { - var node = this.startNode(this.lookahead); - var token = this.nextToken(); - expr = this.inheritCoverGrammar(this.parseUnaryExpression); - expr = this.finalize(node, new Node.UnaryExpression(token.value, expr)); - if (this.context.strict && expr.operator === 'delete' && expr.argument.type === syntax_1.Syntax.Identifier) { - this.tolerateError(messages_1.Messages.StrictDelete); - } - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } - else { - expr = this.parseUpdateExpression(); - } - return expr; - }; - Parser.prototype.parseExponentiationExpression = function () { - var startToken = this.lookahead; - var expr = this.inheritCoverGrammar(this.parseUnaryExpression); - if (expr.type !== syntax_1.Syntax.UnaryExpression && this.match('**')) { - this.nextToken(); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var left = expr; - var right = this.isolateCoverGrammar(this.parseExponentiationExpression); - expr = this.finalize(this.startNode(startToken), new Node.BinaryExpression('**', left, right)); - } - return expr; - }; - // ECMA-262 12.6 Exponentiation Operators - // ECMA-262 12.7 Multiplicative Operators - // ECMA-262 12.8 Additive Operators - // ECMA-262 12.9 Bitwise Shift Operators - // ECMA-262 12.10 Relational Operators - // ECMA-262 12.11 Equality Operators - // ECMA-262 12.12 Binary Bitwise Operators - // ECMA-262 12.13 Binary Logical Operators - Parser.prototype.binaryPrecedence = function (token) { - var op = token.value; - var precedence; - if (token.type === token_1.Token.Punctuator) { - precedence = this.operatorPrecedence[op] || 0; - } - else if (token.type === token_1.Token.Keyword) { - precedence = (op === 'instanceof' || (this.context.allowIn && op === 'in')) ? 7 : 0; - } - else { - precedence = 0; - } - return precedence; - }; - Parser.prototype.parseBinaryExpression = function () { - var this$1 = this; - - var startToken = this.lookahead; - var expr = this.inheritCoverGrammar(this.parseExponentiationExpression); - var token = this.lookahead; - var prec = this.binaryPrecedence(token); - if (prec > 0) { - this.nextToken(); - token.prec = prec; - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var markers = [startToken, this.lookahead]; - var left = expr; - var right = this.isolateCoverGrammar(this.parseExponentiationExpression); - var stack = [left, token, right]; - while (true) { - prec = this$1.binaryPrecedence(this$1.lookahead); - if (prec <= 0) { - break; - } - // Reduce: make a binary expression from the three topmost entries. - while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { - right = stack.pop(); - var operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - var node = this$1.startNode(markers[markers.length - 1]); - stack.push(this$1.finalize(node, new Node.BinaryExpression(operator, left, right))); - } - // Shift. - token = this$1.nextToken(); - token.prec = prec; - stack.push(token); - markers.push(this$1.lookahead); - stack.push(this$1.isolateCoverGrammar(this$1.parseExponentiationExpression)); - } - // Final reduce to clean-up the stack. - var i = stack.length - 1; - expr = stack[i]; - markers.pop(); - while (i > 1) { - var node = this$1.startNode(markers.pop()); - expr = this$1.finalize(node, new Node.BinaryExpression(stack[i - 1].value, stack[i - 2], expr)); - i -= 2; - } - } - return expr; - }; - // ECMA-262 12.14 Conditional Operator - Parser.prototype.parseConditionalExpression = function () { - var startToken = this.lookahead; - var expr = this.inheritCoverGrammar(this.parseBinaryExpression); - if (this.match('?')) { - this.nextToken(); - var previousAllowIn = this.context.allowIn; - this.context.allowIn = true; - var consequent = this.isolateCoverGrammar(this.parseAssignmentExpression); - this.context.allowIn = previousAllowIn; - this.expect(':'); - var alternate = this.isolateCoverGrammar(this.parseAssignmentExpression); - expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate)); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } - return expr; - }; - // ECMA-262 12.15 Assignment Operators - Parser.prototype.checkPatternParam = function (options, param) { - var this$1 = this; - - switch (param.type) { - case syntax_1.Syntax.Identifier: - this.validateParam(options, param, param.name); - break; - case syntax_1.Syntax.RestElement: - this.checkPatternParam(options, param.argument); - break; - case syntax_1.Syntax.AssignmentPattern: - this.checkPatternParam(options, param.left); - break; - case syntax_1.Syntax.ArrayPattern: - for (var i = 0; i < param.elements.length; i++) { - if (param.elements[i] !== null) { - this$1.checkPatternParam(options, param.elements[i]); - } - } - break; - case syntax_1.Syntax.YieldExpression: - break; - default: - assert_1.assert(param.type === syntax_1.Syntax.ObjectPattern, 'Invalid type'); - for (var i = 0; i < param.properties.length; i++) { - this$1.checkPatternParam(options, param.properties[i].value); - } - break; - } - }; - Parser.prototype.reinterpretAsCoverFormalsList = function (expr) { - var this$1 = this; - - var params = [expr]; - var options; - switch (expr.type) { - case syntax_1.Syntax.Identifier: - break; - case ArrowParameterPlaceHolder: - params = expr.params; - break; - default: - return null; - } - options = { - paramSet: {} - }; - for (var i = 0; i < params.length; ++i) { - var param = params[i]; - if (param.type === syntax_1.Syntax.AssignmentPattern) { - if (param.right.type === syntax_1.Syntax.YieldExpression) { - if (param.right.argument) { - this$1.throwUnexpectedToken(this$1.lookahead); - } - param.right.type = syntax_1.Syntax.Identifier; - param.right.name = 'yield'; - delete param.right.argument; - delete param.right.delegate; - } - } - this$1.checkPatternParam(options, param); - params[i] = param; - } - if (this.context.strict || !this.context.allowYield) { - for (var i = 0; i < params.length; ++i) { - var param = params[i]; - if (param.type === syntax_1.Syntax.YieldExpression) { - this$1.throwUnexpectedToken(this$1.lookahead); - } - } - } - if (options.message === messages_1.Messages.StrictParamDupe) { - var token = this.context.strict ? options.stricted : options.firstRestricted; - this.throwUnexpectedToken(token, options.message); - } - return { - params: params, - stricted: options.stricted, - firstRestricted: options.firstRestricted, - message: options.message - }; - }; - Parser.prototype.parseAssignmentExpression = function () { - var expr; - if (!this.context.allowYield && this.matchKeyword('yield')) { - expr = this.parseYieldExpression(); - } - else { - var startToken = this.lookahead; - var token = startToken; - expr = this.parseConditionalExpression(); - if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) { - // ECMA-262 14.2 Arrow Function Definitions - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var list = this.reinterpretAsCoverFormalsList(expr); - if (list) { - if (this.hasLineTerminator) { - this.tolerateUnexpectedToken(this.lookahead); - } - this.context.firstCoverInitializedNameError = null; - var previousStrict = this.context.strict; - var previousAllowYield = this.context.allowYield; - this.context.allowYield = true; - var node = this.startNode(startToken); - this.expect('=>'); - var body = this.match('{') ? this.parseFunctionSourceElements() : - this.isolateCoverGrammar(this.parseAssignmentExpression); - var expression = body.type !== syntax_1.Syntax.BlockStatement; - if (this.context.strict && list.firstRestricted) { - this.throwUnexpectedToken(list.firstRestricted, list.message); - } - if (this.context.strict && list.stricted) { - this.tolerateUnexpectedToken(list.stricted, list.message); - } - expr = this.finalize(node, new Node.ArrowFunctionExpression(list.params, body, expression)); - this.context.strict = previousStrict; - this.context.allowYield = previousAllowYield; - } - } - else { - if (this.matchAssign()) { - if (!this.context.isAssignmentTarget) { - this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); - } - if (this.context.strict && expr.type === syntax_1.Syntax.Identifier) { - var id = (expr); - if (this.scanner.isRestrictedWord(id.name)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictLHSAssignment); - } - if (this.scanner.isStrictModeReservedWord(id.name)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); - } - } - if (!this.match('=')) { - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } - else { - this.reinterpretExpressionAsPattern(expr); - } - token = this.nextToken(); - var right = this.isolateCoverGrammar(this.parseAssignmentExpression); - expr = this.finalize(this.startNode(startToken), new Node.AssignmentExpression(token.value, expr, right)); - this.context.firstCoverInitializedNameError = null; - } - } - } - return expr; - }; - // ECMA-262 12.16 Comma Operator - Parser.prototype.parseExpression = function () { - var this$1 = this; - - var startToken = this.lookahead; - var expr = this.isolateCoverGrammar(this.parseAssignmentExpression); - if (this.match(',')) { - var expressions = []; - expressions.push(expr); - while (this.startMarker.index < this.scanner.length) { - if (!this$1.match(',')) { - break; - } - this$1.nextToken(); - expressions.push(this$1.isolateCoverGrammar(this$1.parseAssignmentExpression)); - } - expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); - } - return expr; - }; - // ECMA-262 13.2 Block - Parser.prototype.parseStatementListItem = function () { - var statement = null; - this.context.isAssignmentTarget = true; - this.context.isBindingElement = true; - if (this.lookahead.type === token_1.Token.Keyword) { - switch (this.lookahead.value) { - case 'export': - if (this.sourceType !== 'module') { - this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalExportDeclaration); - } - statement = this.parseExportDeclaration(); - break; - case 'import': - if (this.sourceType !== 'module') { - this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalImportDeclaration); - } - statement = this.parseImportDeclaration(); - break; - case 'const': - statement = this.parseLexicalDeclaration({ inFor: false }); - break; - case 'function': - statement = this.parseFunctionDeclaration(); - break; - case 'class': - statement = this.parseClassDeclaration(); - break; - case 'let': - statement = this.isLexicalDeclaration() ? this.parseLexicalDeclaration({ inFor: false }) : this.parseStatement(); - break; - default: - statement = this.parseStatement(); - break; - } - } - else { - statement = this.parseStatement(); - } - return statement; - }; - Parser.prototype.parseBlock = function () { - var this$1 = this; - - var node = this.createNode(); - this.expect('{'); - var block = []; - while (true) { - if (this$1.match('}')) { - break; - } - block.push(this$1.parseStatementListItem()); - } - this.expect('}'); - return this.finalize(node, new Node.BlockStatement(block)); - }; - // ECMA-262 13.3.1 Let and Const Declarations - Parser.prototype.parseLexicalBinding = function (kind, options) { - var node = this.createNode(); - var params = []; - var id = this.parsePattern(params, kind); - // ECMA-262 12.2.1 - if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { - if (this.scanner.isRestrictedWord((id).name)) { - this.tolerateError(messages_1.Messages.StrictVarName); - } - } - var init = null; - if (kind === 'const') { - if (!this.matchKeyword('in') && !this.matchContextualKeyword('of')) { - this.expect('='); - init = this.isolateCoverGrammar(this.parseAssignmentExpression); - } - } - else if ((!options.inFor && id.type !== syntax_1.Syntax.Identifier) || this.match('=')) { - this.expect('='); - init = this.isolateCoverGrammar(this.parseAssignmentExpression); - } - return this.finalize(node, new Node.VariableDeclarator(id, init)); - }; - Parser.prototype.parseBindingList = function (kind, options) { - var this$1 = this; - - var list = [this.parseLexicalBinding(kind, options)]; - while (this.match(',')) { - this$1.nextToken(); - list.push(this$1.parseLexicalBinding(kind, options)); - } - return list; - }; - Parser.prototype.isLexicalDeclaration = function () { - var previousIndex = this.scanner.index; - var previousLineNumber = this.scanner.lineNumber; - var previousLineStart = this.scanner.lineStart; - this.collectComments(); - var next = this.scanner.lex(); - this.scanner.index = previousIndex; - this.scanner.lineNumber = previousLineNumber; - this.scanner.lineStart = previousLineStart; - return (next.type === token_1.Token.Identifier) || - (next.type === token_1.Token.Punctuator && next.value === '[') || - (next.type === token_1.Token.Punctuator && next.value === '{') || - (next.type === token_1.Token.Keyword && next.value === 'let') || - (next.type === token_1.Token.Keyword && next.value === 'yield'); - }; - Parser.prototype.parseLexicalDeclaration = function (options) { - var node = this.createNode(); - var kind = this.nextToken().value; - assert_1.assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const'); - var declarations = this.parseBindingList(kind, options); - this.consumeSemicolon(); - return this.finalize(node, new Node.VariableDeclaration(declarations, kind)); - }; - // ECMA-262 13.3.3 Destructuring Binding Patterns - Parser.prototype.parseBindingRestElement = function (params, kind) { - var node = this.createNode(); - this.expect('...'); - var arg = this.parsePattern(params, kind); - return this.finalize(node, new Node.RestElement(arg)); - }; - Parser.prototype.parseArrayPattern = function (params, kind) { - var this$1 = this; - - var node = this.createNode(); - this.expect('['); - var elements = []; - while (!this.match(']')) { - if (this$1.match(',')) { - this$1.nextToken(); - elements.push(null); - } - else { - if (this$1.match('...')) { - elements.push(this$1.parseBindingRestElement(params, kind)); - break; - } - else { - elements.push(this$1.parsePatternWithDefault(params, kind)); - } - if (!this$1.match(']')) { - this$1.expect(','); - } - } - } - this.expect(']'); - return this.finalize(node, new Node.ArrayPattern(elements)); - }; - Parser.prototype.parsePropertyPattern = function (params, kind) { - var node = this.createNode(); - var computed = false; - var shorthand = false; - var method = false; - var key; - var value; - if (this.lookahead.type === token_1.Token.Identifier) { - var keyToken = this.lookahead; - key = this.parseVariableIdentifier(); - var init = this.finalize(node, new Node.Identifier(keyToken.value)); - if (this.match('=')) { - params.push(keyToken); - shorthand = true; - this.nextToken(); - var expr = this.parseAssignmentExpression(); - value = this.finalize(this.startNode(keyToken), new Node.AssignmentPattern(init, expr)); - } - else if (!this.match(':')) { - params.push(keyToken); - shorthand = true; - value = init; - } - else { - this.expect(':'); - value = this.parsePatternWithDefault(params, kind); - } - } - else { - computed = this.match('['); - key = this.parseObjectPropertyKey(); - this.expect(':'); - value = this.parsePatternWithDefault(params, kind); - } - return this.finalize(node, new Node.Property('init', key, computed, value, method, shorthand)); - }; - Parser.prototype.parseObjectPattern = function (params, kind) { - var this$1 = this; - - var node = this.createNode(); - var properties = []; - this.expect('{'); - while (!this.match('}')) { - properties.push(this$1.parsePropertyPattern(params, kind)); - if (!this$1.match('}')) { - this$1.expect(','); - } - } - this.expect('}'); - return this.finalize(node, new Node.ObjectPattern(properties)); - }; - Parser.prototype.parsePattern = function (params, kind) { - var pattern; - if (this.match('[')) { - pattern = this.parseArrayPattern(params, kind); - } - else if (this.match('{')) { - pattern = this.parseObjectPattern(params, kind); - } - else { - if (this.matchKeyword('let') && (kind === 'const' || kind === 'let')) { - this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.UnexpectedToken); - } - params.push(this.lookahead); - pattern = this.parseVariableIdentifier(kind); - } - return pattern; - }; - Parser.prototype.parsePatternWithDefault = function (params, kind) { - var startToken = this.lookahead; - var pattern = this.parsePattern(params, kind); - if (this.match('=')) { - this.nextToken(); - var previousAllowYield = this.context.allowYield; - this.context.allowYield = true; - var right = this.isolateCoverGrammar(this.parseAssignmentExpression); - this.context.allowYield = previousAllowYield; - pattern = this.finalize(this.startNode(startToken), new Node.AssignmentPattern(pattern, right)); - } - return pattern; - }; - // ECMA-262 13.3.2 Variable Statement - Parser.prototype.parseVariableIdentifier = function (kind) { - var node = this.createNode(); - var token = this.nextToken(); - if (token.type === token_1.Token.Keyword && token.value === 'yield') { - if (this.context.strict) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); - } - if (!this.context.allowYield) { - this.throwUnexpectedToken(token); - } - } - else if (token.type !== token_1.Token.Identifier) { - if (this.context.strict && token.type === token_1.Token.Keyword && this.scanner.isStrictModeReservedWord(token.value)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); - } - else { - if (this.context.strict || token.value !== 'let' || kind !== 'var') { - this.throwUnexpectedToken(token); - } - } - } - else if (this.sourceType === 'module' && token.type === token_1.Token.Identifier && token.value === 'await') { - this.tolerateUnexpectedToken(token); - } - return this.finalize(node, new Node.Identifier(token.value)); - }; - Parser.prototype.parseVariableDeclaration = function (options) { - var node = this.createNode(); - var params = []; - var id = this.parsePattern(params, 'var'); - // ECMA-262 12.2.1 - if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { - if (this.scanner.isRestrictedWord((id).name)) { - this.tolerateError(messages_1.Messages.StrictVarName); - } - } - var init = null; - if (this.match('=')) { - this.nextToken(); - init = this.isolateCoverGrammar(this.parseAssignmentExpression); - } - else if (id.type !== syntax_1.Syntax.Identifier && !options.inFor) { - this.expect('='); - } - return this.finalize(node, new Node.VariableDeclarator(id, init)); - }; - Parser.prototype.parseVariableDeclarationList = function (options) { - var this$1 = this; - - var opt = { inFor: options.inFor }; - var list = []; - list.push(this.parseVariableDeclaration(opt)); - while (this.match(',')) { - this$1.nextToken(); - list.push(this$1.parseVariableDeclaration(opt)); - } - return list; - }; - Parser.prototype.parseVariableStatement = function () { - var node = this.createNode(); - this.expectKeyword('var'); - var declarations = this.parseVariableDeclarationList({ inFor: false }); - this.consumeSemicolon(); - return this.finalize(node, new Node.VariableDeclaration(declarations, 'var')); - }; - // ECMA-262 13.4 Empty Statement - Parser.prototype.parseEmptyStatement = function () { - var node = this.createNode(); - this.expect(';'); - return this.finalize(node, new Node.EmptyStatement()); - }; - // ECMA-262 13.5 Expression Statement - Parser.prototype.parseExpressionStatement = function () { - var node = this.createNode(); - var expr = this.parseExpression(); - this.consumeSemicolon(); - return this.finalize(node, new Node.ExpressionStatement(expr)); - }; - // ECMA-262 13.6 If statement - Parser.prototype.parseIfStatement = function () { - var node = this.createNode(); - var consequent; - var alternate = null; - this.expectKeyword('if'); - this.expect('('); - var test = this.parseExpression(); - if (!this.match(')') && this.config.tolerant) { - this.tolerateUnexpectedToken(this.nextToken()); - consequent = this.finalize(this.createNode(), new Node.EmptyStatement()); - } - else { - this.expect(')'); - consequent = this.parseStatement(); - if (this.matchKeyword('else')) { - this.nextToken(); - alternate = this.parseStatement(); - } - } - return this.finalize(node, new Node.IfStatement(test, consequent, alternate)); - }; - // ECMA-262 13.7.2 The do-while Statement - Parser.prototype.parseDoWhileStatement = function () { - var node = this.createNode(); - this.expectKeyword('do'); - var previousInIteration = this.context.inIteration; - this.context.inIteration = true; - var body = this.parseStatement(); - this.context.inIteration = previousInIteration; - this.expectKeyword('while'); - this.expect('('); - var test = this.parseExpression(); - this.expect(')'); - if (this.match(';')) { - this.nextToken(); - } - return this.finalize(node, new Node.DoWhileStatement(body, test)); - }; - // ECMA-262 13.7.3 The while Statement - Parser.prototype.parseWhileStatement = function () { - var node = this.createNode(); - var body; - this.expectKeyword('while'); - this.expect('('); - var test = this.parseExpression(); - if (!this.match(')') && this.config.tolerant) { - this.tolerateUnexpectedToken(this.nextToken()); - body = this.finalize(this.createNode(), new Node.EmptyStatement()); - } - else { - this.expect(')'); - var previousInIteration = this.context.inIteration; - this.context.inIteration = true; - body = this.parseStatement(); - this.context.inIteration = previousInIteration; - } - return this.finalize(node, new Node.WhileStatement(test, body)); - }; - // ECMA-262 13.7.4 The for Statement - // ECMA-262 13.7.5 The for-in and for-of Statements - Parser.prototype.parseForStatement = function () { - var this$1 = this; - - var init = null; - var test = null; - var update = null; - var forIn = true; - var left, right; - var node = this.createNode(); - this.expectKeyword('for'); - this.expect('('); - if (this.match(';')) { - this.nextToken(); - } - else { - if (this.matchKeyword('var')) { - init = this.createNode(); - this.nextToken(); - var previousAllowIn = this.context.allowIn; - this.context.allowIn = false; - var declarations = this.parseVariableDeclarationList({ inFor: true }); - this.context.allowIn = previousAllowIn; - if (declarations.length === 1 && this.matchKeyword('in')) { - var decl = declarations[0]; - if (decl.init && (decl.id.type === syntax_1.Syntax.ArrayPattern || decl.id.type === syntax_1.Syntax.ObjectPattern || this.context.strict)) { - this.tolerateError(messages_1.Messages.ForInOfLoopInitializer, 'for-in'); - } - init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); - this.nextToken(); - left = init; - right = this.parseExpression(); - init = null; - } - else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { - init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); - this.nextToken(); - left = init; - right = this.parseAssignmentExpression(); - init = null; - forIn = false; - } - else { - init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); - this.expect(';'); - } - } - else if (this.matchKeyword('const') || this.matchKeyword('let')) { - init = this.createNode(); - var kind = this.nextToken().value; - if (!this.context.strict && this.lookahead.value === 'in') { - init = this.finalize(init, new Node.Identifier(kind)); - this.nextToken(); - left = init; - right = this.parseExpression(); - init = null; - } - else { - var previousAllowIn = this.context.allowIn; - this.context.allowIn = false; - var declarations = this.parseBindingList(kind, { inFor: true }); - this.context.allowIn = previousAllowIn; - if (declarations.length === 1 && declarations[0].init === null && this.matchKeyword('in')) { - init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); - this.nextToken(); - left = init; - right = this.parseExpression(); - init = null; - } - else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { - init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); - this.nextToken(); - left = init; - right = this.parseAssignmentExpression(); - init = null; - forIn = false; - } - else { - this.consumeSemicolon(); - init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); - } - } - } - else { - var initStartToken = this.lookahead; - var previousAllowIn = this.context.allowIn; - this.context.allowIn = false; - init = this.inheritCoverGrammar(this.parseAssignmentExpression); - this.context.allowIn = previousAllowIn; - if (this.matchKeyword('in')) { - if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { - this.tolerateError(messages_1.Messages.InvalidLHSInForIn); - } - this.nextToken(); - this.reinterpretExpressionAsPattern(init); - left = init; - right = this.parseExpression(); - init = null; - } - else if (this.matchContextualKeyword('of')) { - if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { - this.tolerateError(messages_1.Messages.InvalidLHSInForLoop); - } - this.nextToken(); - this.reinterpretExpressionAsPattern(init); - left = init; - right = this.parseAssignmentExpression(); - init = null; - forIn = false; - } - else { - if (this.match(',')) { - var initSeq = [init]; - while (this.match(',')) { - this$1.nextToken(); - initSeq.push(this$1.isolateCoverGrammar(this$1.parseAssignmentExpression)); - } - init = this.finalize(this.startNode(initStartToken), new Node.SequenceExpression(initSeq)); - } - this.expect(';'); - } - } - } - if (typeof left === 'undefined') { - if (!this.match(';')) { - test = this.parseExpression(); - } - this.expect(';'); - if (!this.match(')')) { - update = this.parseExpression(); - } - } - var body; - if (!this.match(')') && this.config.tolerant) { - this.tolerateUnexpectedToken(this.nextToken()); - body = this.finalize(this.createNode(), new Node.EmptyStatement()); - } - else { - this.expect(')'); - var previousInIteration = this.context.inIteration; - this.context.inIteration = true; - body = this.isolateCoverGrammar(this.parseStatement); - this.context.inIteration = previousInIteration; - } - return (typeof left === 'undefined') ? - this.finalize(node, new Node.ForStatement(init, test, update, body)) : - forIn ? this.finalize(node, new Node.ForInStatement(left, right, body)) : - this.finalize(node, new Node.ForOfStatement(left, right, body)); - }; - // ECMA-262 13.8 The continue statement - Parser.prototype.parseContinueStatement = function () { - var node = this.createNode(); - this.expectKeyword('continue'); - var label = null; - if (this.lookahead.type === token_1.Token.Identifier && !this.hasLineTerminator) { - label = this.parseVariableIdentifier(); - var key = '$' + label.name; - if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { - this.throwError(messages_1.Messages.UnknownLabel, label.name); - } - } - this.consumeSemicolon(); - if (label === null && !this.context.inIteration) { - this.throwError(messages_1.Messages.IllegalContinue); - } - return this.finalize(node, new Node.ContinueStatement(label)); - }; - // ECMA-262 13.9 The break statement - Parser.prototype.parseBreakStatement = function () { - var node = this.createNode(); - this.expectKeyword('break'); - var label = null; - if (this.lookahead.type === token_1.Token.Identifier && !this.hasLineTerminator) { - label = this.parseVariableIdentifier(); - var key = '$' + label.name; - if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { - this.throwError(messages_1.Messages.UnknownLabel, label.name); - } - } - this.consumeSemicolon(); - if (label === null && !this.context.inIteration && !this.context.inSwitch) { - this.throwError(messages_1.Messages.IllegalBreak); - } - return this.finalize(node, new Node.BreakStatement(label)); - }; - // ECMA-262 13.10 The return statement - Parser.prototype.parseReturnStatement = function () { - if (!this.context.inFunctionBody) { - this.tolerateError(messages_1.Messages.IllegalReturn); - } - var node = this.createNode(); - this.expectKeyword('return'); - var hasArgument = !this.match(';') && !this.match('}') && - !this.hasLineTerminator && this.lookahead.type !== token_1.Token.EOF; - var argument = hasArgument ? this.parseExpression() : null; - this.consumeSemicolon(); - return this.finalize(node, new Node.ReturnStatement(argument)); - }; - // ECMA-262 13.11 The with statement - Parser.prototype.parseWithStatement = function () { - if (this.context.strict) { - this.tolerateError(messages_1.Messages.StrictModeWith); - } - var node = this.createNode(); - this.expectKeyword('with'); - this.expect('('); - var object = this.parseExpression(); - this.expect(')'); - var body = this.parseStatement(); - return this.finalize(node, new Node.WithStatement(object, body)); - }; - // ECMA-262 13.12 The switch statement - Parser.prototype.parseSwitchCase = function () { - var this$1 = this; - - var node = this.createNode(); - var test; - if (this.matchKeyword('default')) { - this.nextToken(); - test = null; - } - else { - this.expectKeyword('case'); - test = this.parseExpression(); - } - this.expect(':'); - var consequent = []; - while (true) { - if (this$1.match('}') || this$1.matchKeyword('default') || this$1.matchKeyword('case')) { - break; - } - consequent.push(this$1.parseStatementListItem()); - } - return this.finalize(node, new Node.SwitchCase(test, consequent)); - }; - Parser.prototype.parseSwitchStatement = function () { - var this$1 = this; - - var node = this.createNode(); - this.expectKeyword('switch'); - this.expect('('); - var discriminant = this.parseExpression(); - this.expect(')'); - var previousInSwitch = this.context.inSwitch; - this.context.inSwitch = true; - var cases = []; - var defaultFound = false; - this.expect('{'); - while (true) { - if (this$1.match('}')) { - break; - } - var clause = this$1.parseSwitchCase(); - if (clause.test === null) { - if (defaultFound) { - this$1.throwError(messages_1.Messages.MultipleDefaultsInSwitch); - } - defaultFound = true; - } - cases.push(clause); - } - this.expect('}'); - this.context.inSwitch = previousInSwitch; - return this.finalize(node, new Node.SwitchStatement(discriminant, cases)); - }; - // ECMA-262 13.13 Labelled Statements - Parser.prototype.parseLabelledStatement = function () { - var node = this.createNode(); - var expr = this.parseExpression(); - var statement; - if ((expr.type === syntax_1.Syntax.Identifier) && this.match(':')) { - this.nextToken(); - var id = (expr); - var key = '$' + id.name; - if (Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { - this.throwError(messages_1.Messages.Redeclaration, 'Label', id.name); - } - this.context.labelSet[key] = true; - var labeledBody = this.parseStatement(); - delete this.context.labelSet[key]; - statement = new Node.LabeledStatement(id, labeledBody); - } - else { - this.consumeSemicolon(); - statement = new Node.ExpressionStatement(expr); - } - return this.finalize(node, statement); - }; - // ECMA-262 13.14 The throw statement - Parser.prototype.parseThrowStatement = function () { - var node = this.createNode(); - this.expectKeyword('throw'); - if (this.hasLineTerminator) { - this.throwError(messages_1.Messages.NewlineAfterThrow); - } - var argument = this.parseExpression(); - this.consumeSemicolon(); - return this.finalize(node, new Node.ThrowStatement(argument)); - }; - // ECMA-262 13.15 The try statement - Parser.prototype.parseCatchClause = function () { - var this$1 = this; - - var node = this.createNode(); - this.expectKeyword('catch'); - this.expect('('); - if (this.match(')')) { - this.throwUnexpectedToken(this.lookahead); - } - var params = []; - var param = this.parsePattern(params); - var paramMap = {}; - for (var i = 0; i < params.length; i++) { - var key = '$' + params[i].value; - if (Object.prototype.hasOwnProperty.call(paramMap, key)) { - this$1.tolerateError(messages_1.Messages.DuplicateBinding, params[i].value); - } - paramMap[key] = true; - } - if (this.context.strict && param.type === syntax_1.Syntax.Identifier) { - if (this.scanner.isRestrictedWord((param).name)) { - this.tolerateError(messages_1.Messages.StrictCatchVariable); - } - } - this.expect(')'); - var body = this.parseBlock(); - return this.finalize(node, new Node.CatchClause(param, body)); - }; - Parser.prototype.parseFinallyClause = function () { - this.expectKeyword('finally'); - return this.parseBlock(); - }; - Parser.prototype.parseTryStatement = function () { - var node = this.createNode(); - this.expectKeyword('try'); - var block = this.parseBlock(); - var handler = this.matchKeyword('catch') ? this.parseCatchClause() : null; - var finalizer = this.matchKeyword('finally') ? this.parseFinallyClause() : null; - if (!handler && !finalizer) { - this.throwError(messages_1.Messages.NoCatchOrFinally); - } - return this.finalize(node, new Node.TryStatement(block, handler, finalizer)); - }; - // ECMA-262 13.16 The debugger statement - Parser.prototype.parseDebuggerStatement = function () { - var node = this.createNode(); - this.expectKeyword('debugger'); - this.consumeSemicolon(); - return this.finalize(node, new Node.DebuggerStatement()); - }; - // ECMA-262 13 Statements - Parser.prototype.parseStatement = function () { - var statement = null; - switch (this.lookahead.type) { - case token_1.Token.BooleanLiteral: - case token_1.Token.NullLiteral: - case token_1.Token.NumericLiteral: - case token_1.Token.StringLiteral: - case token_1.Token.Template: - case token_1.Token.RegularExpression: - statement = this.parseExpressionStatement(); - break; - case token_1.Token.Punctuator: - var value = this.lookahead.value; - if (value === '{') { - statement = this.parseBlock(); - } - else if (value === '(') { - statement = this.parseExpressionStatement(); - } - else if (value === ';') { - statement = this.parseEmptyStatement(); - } - else { - statement = this.parseExpressionStatement(); - } - break; - case token_1.Token.Identifier: - statement = this.parseLabelledStatement(); - break; - case token_1.Token.Keyword: - switch (this.lookahead.value) { - case 'break': - statement = this.parseBreakStatement(); - break; - case 'continue': - statement = this.parseContinueStatement(); - break; - case 'debugger': - statement = this.parseDebuggerStatement(); - break; - case 'do': - statement = this.parseDoWhileStatement(); - break; - case 'for': - statement = this.parseForStatement(); - break; - case 'function': - statement = this.parseFunctionDeclaration(); - break; - case 'if': - statement = this.parseIfStatement(); - break; - case 'return': - statement = this.parseReturnStatement(); - break; - case 'switch': - statement = this.parseSwitchStatement(); - break; - case 'throw': - statement = this.parseThrowStatement(); - break; - case 'try': - statement = this.parseTryStatement(); - break; - case 'var': - statement = this.parseVariableStatement(); - break; - case 'while': - statement = this.parseWhileStatement(); - break; - case 'with': - statement = this.parseWithStatement(); - break; - default: - statement = this.parseExpressionStatement(); - break; - } - break; - default: - this.throwUnexpectedToken(this.lookahead); - } - return statement; - }; - // ECMA-262 14.1 Function Definition - Parser.prototype.parseFunctionSourceElements = function () { - var this$1 = this; - - var node = this.createNode(); - this.expect('{'); - var body = this.parseDirectivePrologues(); - var previousLabelSet = this.context.labelSet; - var previousInIteration = this.context.inIteration; - var previousInSwitch = this.context.inSwitch; - var previousInFunctionBody = this.context.inFunctionBody; - this.context.labelSet = {}; - this.context.inIteration = false; - this.context.inSwitch = false; - this.context.inFunctionBody = true; - while (this.startMarker.index < this.scanner.length) { - if (this$1.match('}')) { - break; - } - body.push(this$1.parseStatementListItem()); - } - this.expect('}'); - this.context.labelSet = previousLabelSet; - this.context.inIteration = previousInIteration; - this.context.inSwitch = previousInSwitch; - this.context.inFunctionBody = previousInFunctionBody; - return this.finalize(node, new Node.BlockStatement(body)); - }; - Parser.prototype.validateParam = function (options, param, name) { - var key = '$' + name; - if (this.context.strict) { - if (this.scanner.isRestrictedWord(name)) { - options.stricted = param; - options.message = messages_1.Messages.StrictParamName; - } - if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { - options.stricted = param; - options.message = messages_1.Messages.StrictParamDupe; - } - } - else if (!options.firstRestricted) { - if (this.scanner.isRestrictedWord(name)) { - options.firstRestricted = param; - options.message = messages_1.Messages.StrictParamName; - } - else if (this.scanner.isStrictModeReservedWord(name)) { - options.firstRestricted = param; - options.message = messages_1.Messages.StrictReservedWord; - } - else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { - options.stricted = param; - options.message = messages_1.Messages.StrictParamDupe; - } - } - /* istanbul ignore next */ - if (typeof Object.defineProperty === 'function') { - Object.defineProperty(options.paramSet, key, { value: true, enumerable: true, writable: true, configurable: true }); - } - else { - options.paramSet[key] = true; - } - }; - Parser.prototype.parseRestElement = function (params) { - var node = this.createNode(); - this.expect('...'); - var arg = this.parsePattern(params); - if (this.match('=')) { - this.throwError(messages_1.Messages.DefaultRestParameter); - } - if (!this.match(')')) { - this.throwError(messages_1.Messages.ParameterAfterRestParameter); - } - return this.finalize(node, new Node.RestElement(arg)); - }; - Parser.prototype.parseFormalParameter = function (options) { - var this$1 = this; - - var params = []; - var param = this.match('...') ? this.parseRestElement(params) : this.parsePatternWithDefault(params); - for (var i = 0; i < params.length; i++) { - this$1.validateParam(options, params[i], params[i].value); - } - options.params.push(param); - return !this.match(')'); - }; - Parser.prototype.parseFormalParameters = function (firstRestricted) { - var this$1 = this; - - var options; - options = { - params: [], - firstRestricted: firstRestricted - }; - this.expect('('); - if (!this.match(')')) { - options.paramSet = {}; - while (this.startMarker.index < this.scanner.length) { - if (!this$1.parseFormalParameter(options)) { - break; - } - this$1.expect(','); - } - } - this.expect(')'); - return { - params: options.params, - stricted: options.stricted, - firstRestricted: options.firstRestricted, - message: options.message - }; - }; - Parser.prototype.parseFunctionDeclaration = function (identifierIsOptional) { - var node = this.createNode(); - this.expectKeyword('function'); - var isGenerator = this.match('*'); - if (isGenerator) { - this.nextToken(); - } - var message; - var id = null; - var firstRestricted = null; - if (!identifierIsOptional || !this.match('(')) { - var token = this.lookahead; - id = this.parseVariableIdentifier(); - if (this.context.strict) { - if (this.scanner.isRestrictedWord(token.value)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); - } - } - else { - if (this.scanner.isRestrictedWord(token.value)) { - firstRestricted = token; - message = messages_1.Messages.StrictFunctionName; - } - else if (this.scanner.isStrictModeReservedWord(token.value)) { - firstRestricted = token; - message = messages_1.Messages.StrictReservedWord; - } - } - } - var previousAllowYield = this.context.allowYield; - this.context.allowYield = !isGenerator; - var formalParameters = this.parseFormalParameters(firstRestricted); - var params = formalParameters.params; - var stricted = formalParameters.stricted; - firstRestricted = formalParameters.firstRestricted; - if (formalParameters.message) { - message = formalParameters.message; - } - var previousStrict = this.context.strict; - var body = this.parseFunctionSourceElements(); - if (this.context.strict && firstRestricted) { - this.throwUnexpectedToken(firstRestricted, message); - } - if (this.context.strict && stricted) { - this.tolerateUnexpectedToken(stricted, message); - } - this.context.strict = previousStrict; - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionDeclaration(id, params, body, isGenerator)); - }; - Parser.prototype.parseFunctionExpression = function () { - var node = this.createNode(); - this.expectKeyword('function'); - var isGenerator = this.match('*'); - if (isGenerator) { - this.nextToken(); - } - var message; - var id = null; - var firstRestricted; - var previousAllowYield = this.context.allowYield; - this.context.allowYield = !isGenerator; - if (!this.match('(')) { - var token = this.lookahead; - id = (!this.context.strict && !isGenerator && this.matchKeyword('yield')) ? this.parseIdentifierName() : this.parseVariableIdentifier(); - if (this.context.strict) { - if (this.scanner.isRestrictedWord(token.value)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); - } - } - else { - if (this.scanner.isRestrictedWord(token.value)) { - firstRestricted = token; - message = messages_1.Messages.StrictFunctionName; - } - else if (this.scanner.isStrictModeReservedWord(token.value)) { - firstRestricted = token; - message = messages_1.Messages.StrictReservedWord; - } - } - } - var formalParameters = this.parseFormalParameters(firstRestricted); - var params = formalParameters.params; - var stricted = formalParameters.stricted; - firstRestricted = formalParameters.firstRestricted; - if (formalParameters.message) { - message = formalParameters.message; - } - var previousStrict = this.context.strict; - var body = this.parseFunctionSourceElements(); - if (this.context.strict && firstRestricted) { - this.throwUnexpectedToken(firstRestricted, message); - } - if (this.context.strict && stricted) { - this.tolerateUnexpectedToken(stricted, message); - } - this.context.strict = previousStrict; - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionExpression(id, params, body, isGenerator)); - }; - // ECMA-262 14.1.1 Directive Prologues - Parser.prototype.parseDirective = function () { - var token = this.lookahead; - var directive = null; - var node = this.createNode(); - var expr = this.parseExpression(); - if (expr.type === syntax_1.Syntax.Literal) { - directive = this.getTokenRaw(token).slice(1, -1); - } - this.consumeSemicolon(); - return this.finalize(node, directive ? new Node.Directive(expr, directive) : - new Node.ExpressionStatement(expr)); - }; - Parser.prototype.parseDirectivePrologues = function () { - var this$1 = this; - - var firstRestricted = null; - var body = []; - while (true) { - var token = this$1.lookahead; - if (token.type !== token_1.Token.StringLiteral) { - break; - } - var statement = this$1.parseDirective(); - body.push(statement); - var directive = statement.directive; - if (typeof directive !== 'string') { - break; - } - if (directive === 'use strict') { - this$1.context.strict = true; - if (firstRestricted) { - this$1.tolerateUnexpectedToken(firstRestricted, messages_1.Messages.StrictOctalLiteral); - } - } - else { - if (!firstRestricted && token.octal) { - firstRestricted = token; - } - } - } - return body; - }; - // ECMA-262 14.3 Method Definitions - Parser.prototype.qualifiedPropertyName = function (token) { - switch (token.type) { - case token_1.Token.Identifier: - case token_1.Token.StringLiteral: - case token_1.Token.BooleanLiteral: - case token_1.Token.NullLiteral: - case token_1.Token.NumericLiteral: - case token_1.Token.Keyword: - return true; - case token_1.Token.Punctuator: - return token.value === '['; - } - return false; - }; - Parser.prototype.parseGetterMethod = function () { - var node = this.createNode(); - this.expect('('); - this.expect(')'); - var isGenerator = false; - var params = { - params: [], - stricted: null, - firstRestricted: null, - message: null - }; - var previousAllowYield = this.context.allowYield; - this.context.allowYield = false; - var method = this.parsePropertyMethod(params); - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); - }; - Parser.prototype.parseSetterMethod = function () { - var node = this.createNode(); - var options = { - params: [], - firstRestricted: null, - paramSet: {} - }; - var isGenerator = false; - var previousAllowYield = this.context.allowYield; - this.context.allowYield = false; - this.expect('('); - if (this.match(')')) { - this.tolerateUnexpectedToken(this.lookahead); - } - else { - this.parseFormalParameter(options); - } - this.expect(')'); - var method = this.parsePropertyMethod(options); - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionExpression(null, options.params, method, isGenerator)); - }; - Parser.prototype.parseGeneratorMethod = function () { - var node = this.createNode(); - var isGenerator = true; - var previousAllowYield = this.context.allowYield; - this.context.allowYield = true; - var params = this.parseFormalParameters(); - this.context.allowYield = false; - var method = this.parsePropertyMethod(params); - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); - }; - // ECMA-262 14.4 Generator Function Definitions - Parser.prototype.isStartOfExpression = function () { - var start = true; - var value = this.lookahead.value; - switch (this.lookahead.type) { - case token_1.Token.Punctuator: - start = (value === '[') || (value === '(') || (value === '{') || - (value === '+') || (value === '-') || - (value === '!') || (value === '~') || - (value === '++') || (value === '--') || - (value === '/') || (value === '/='); // regular expression literal - break; - case token_1.Token.Keyword: - start = (value === 'class') || (value === 'delete') || - (value === 'function') || (value === 'let') || (value === 'new') || - (value === 'super') || (value === 'this') || (value === 'typeof') || - (value === 'void') || (value === 'yield'); - break; - default: - break; - } - return start; - }; - Parser.prototype.parseYieldExpression = function () { - var node = this.createNode(); - this.expectKeyword('yield'); - var argument = null; - var delegate = false; - if (!this.hasLineTerminator) { - var previousAllowYield = this.context.allowYield; - this.context.allowYield = false; - delegate = this.match('*'); - if (delegate) { - this.nextToken(); - argument = this.parseAssignmentExpression(); - } - else if (this.isStartOfExpression()) { - argument = this.parseAssignmentExpression(); - } - this.context.allowYield = previousAllowYield; - } - return this.finalize(node, new Node.YieldExpression(argument, delegate)); - }; - // ECMA-262 14.5 Class Definitions - Parser.prototype.parseClassElement = function (hasConstructor) { - var token = this.lookahead; - var node = this.createNode(); - var kind; - var key; - var value; - var computed = false; - var method = false; - var isStatic = false; - if (this.match('*')) { - this.nextToken(); - } - else { - computed = this.match('['); - key = this.parseObjectPropertyKey(); - var id = key; - if (id.name === 'static' && (this.qualifiedPropertyName(this.lookahead) || this.match('*'))) { - token = this.lookahead; - isStatic = true; - computed = this.match('['); - if (this.match('*')) { - this.nextToken(); - } - else { - key = this.parseObjectPropertyKey(); - } - } - } - var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); - if (token.type === token_1.Token.Identifier) { - if (token.value === 'get' && lookaheadPropertyKey) { - kind = 'get'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - this.context.allowYield = false; - value = this.parseGetterMethod(); - } - else if (token.value === 'set' && lookaheadPropertyKey) { - kind = 'set'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - value = this.parseSetterMethod(); - } - } - else if (token.type === token_1.Token.Punctuator && token.value === '*' && lookaheadPropertyKey) { - kind = 'init'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - value = this.parseGeneratorMethod(); - method = true; - } - if (!kind && key && this.match('(')) { - kind = 'init'; - value = this.parsePropertyMethodFunction(); - method = true; - } - if (!kind) { - this.throwUnexpectedToken(this.lookahead); - } - if (kind === 'init') { - kind = 'method'; - } - if (!computed) { - if (isStatic && this.isPropertyKey(key, 'prototype')) { - this.throwUnexpectedToken(token, messages_1.Messages.StaticPrototype); - } - if (!isStatic && this.isPropertyKey(key, 'constructor')) { - if (kind !== 'method' || !method || value.generator) { - this.throwUnexpectedToken(token, messages_1.Messages.ConstructorSpecialMethod); - } - if (hasConstructor.value) { - this.throwUnexpectedToken(token, messages_1.Messages.DuplicateConstructor); - } - else { - hasConstructor.value = true; - } - kind = 'constructor'; - } - } - return this.finalize(node, new Node.MethodDefinition(key, computed, value, kind, isStatic)); - }; - Parser.prototype.parseClassElementList = function () { - var this$1 = this; - - var body = []; - var hasConstructor = { value: false }; - this.expect('{'); - while (!this.match('}')) { - if (this$1.match(';')) { - this$1.nextToken(); - } - else { - body.push(this$1.parseClassElement(hasConstructor)); - } - } - this.expect('}'); - return body; - }; - Parser.prototype.parseClassBody = function () { - var node = this.createNode(); - var elementList = this.parseClassElementList(); - return this.finalize(node, new Node.ClassBody(elementList)); - }; - Parser.prototype.parseClassDeclaration = function (identifierIsOptional) { - var node = this.createNode(); - var previousStrict = this.context.strict; - this.context.strict = true; - this.expectKeyword('class'); - var id = (identifierIsOptional && (this.lookahead.type !== token_1.Token.Identifier)) ? null : this.parseVariableIdentifier(); - var superClass = null; - if (this.matchKeyword('extends')) { - this.nextToken(); - superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); - } - var classBody = this.parseClassBody(); - this.context.strict = previousStrict; - return this.finalize(node, new Node.ClassDeclaration(id, superClass, classBody)); - }; - Parser.prototype.parseClassExpression = function () { - var node = this.createNode(); - var previousStrict = this.context.strict; - this.context.strict = true; - this.expectKeyword('class'); - var id = (this.lookahead.type === token_1.Token.Identifier) ? this.parseVariableIdentifier() : null; - var superClass = null; - if (this.matchKeyword('extends')) { - this.nextToken(); - superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); - } - var classBody = this.parseClassBody(); - this.context.strict = previousStrict; - return this.finalize(node, new Node.ClassExpression(id, superClass, classBody)); - }; - // ECMA-262 15.1 Scripts - // ECMA-262 15.2 Modules - Parser.prototype.parseProgram = function () { - var this$1 = this; - - var node = this.createNode(); - var body = this.parseDirectivePrologues(); - while (this.startMarker.index < this.scanner.length) { - body.push(this$1.parseStatementListItem()); - } - return this.finalize(node, new Node.Program(body, this.sourceType)); - }; - // ECMA-262 15.2.2 Imports - Parser.prototype.parseModuleSpecifier = function () { - var node = this.createNode(); - if (this.lookahead.type !== token_1.Token.StringLiteral) { - this.throwError(messages_1.Messages.InvalidModuleSpecifier); - } - var token = this.nextToken(); - var raw = this.getTokenRaw(token); - return this.finalize(node, new Node.Literal(token.value, raw)); - }; - // import {} ...; - Parser.prototype.parseImportSpecifier = function () { - var node = this.createNode(); - var imported; - var local; - if (this.lookahead.type === token_1.Token.Identifier) { - imported = this.parseVariableIdentifier(); - local = imported; - if (this.matchContextualKeyword('as')) { - this.nextToken(); - local = this.parseVariableIdentifier(); - } - } - else { - imported = this.parseIdentifierName(); - local = imported; - if (this.matchContextualKeyword('as')) { - this.nextToken(); - local = this.parseVariableIdentifier(); - } - else { - this.throwUnexpectedToken(this.nextToken()); - } - } - return this.finalize(node, new Node.ImportSpecifier(local, imported)); - }; - // {foo, bar as bas} - Parser.prototype.parseNamedImports = function () { - var this$1 = this; - - this.expect('{'); - var specifiers = []; - while (!this.match('}')) { - specifiers.push(this$1.parseImportSpecifier()); - if (!this$1.match('}')) { - this$1.expect(','); - } - } - this.expect('}'); - return specifiers; - }; - // import ...; - Parser.prototype.parseImportDefaultSpecifier = function () { - var node = this.createNode(); - var local = this.parseIdentifierName(); - return this.finalize(node, new Node.ImportDefaultSpecifier(local)); - }; - // import <* as foo> ...; - Parser.prototype.parseImportNamespaceSpecifier = function () { - var node = this.createNode(); - this.expect('*'); - if (!this.matchContextualKeyword('as')) { - this.throwError(messages_1.Messages.NoAsAfterImportNamespace); - } - this.nextToken(); - var local = this.parseIdentifierName(); - return this.finalize(node, new Node.ImportNamespaceSpecifier(local)); - }; - Parser.prototype.parseImportDeclaration = function () { - if (this.context.inFunctionBody) { - this.throwError(messages_1.Messages.IllegalImportDeclaration); - } - var node = this.createNode(); - this.expectKeyword('import'); - var src; - var specifiers = []; - if (this.lookahead.type === token_1.Token.StringLiteral) { - // import 'foo'; - src = this.parseModuleSpecifier(); - } - else { - if (this.match('{')) { - // import {bar} - specifiers = specifiers.concat(this.parseNamedImports()); - } - else if (this.match('*')) { - // import * as foo - specifiers.push(this.parseImportNamespaceSpecifier()); - } - else if (this.isIdentifierName(this.lookahead) && !this.matchKeyword('default')) { - // import foo - specifiers.push(this.parseImportDefaultSpecifier()); - if (this.match(',')) { - this.nextToken(); - if (this.match('*')) { - // import foo, * as foo - specifiers.push(this.parseImportNamespaceSpecifier()); - } - else if (this.match('{')) { - // import foo, {bar} - specifiers = specifiers.concat(this.parseNamedImports()); - } - else { - this.throwUnexpectedToken(this.lookahead); - } - } - } - else { - this.throwUnexpectedToken(this.nextToken()); - } - if (!this.matchContextualKeyword('from')) { - var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; - this.throwError(message, this.lookahead.value); - } - this.nextToken(); - src = this.parseModuleSpecifier(); - } - this.consumeSemicolon(); - return this.finalize(node, new Node.ImportDeclaration(specifiers, src)); - }; - // ECMA-262 15.2.3 Exports - Parser.prototype.parseExportSpecifier = function () { - var node = this.createNode(); - var local = this.parseIdentifierName(); - var exported = local; - if (this.matchContextualKeyword('as')) { - this.nextToken(); - exported = this.parseIdentifierName(); - } - return this.finalize(node, new Node.ExportSpecifier(local, exported)); - }; - Parser.prototype.parseExportDeclaration = function () { - var this$1 = this; - - if (this.context.inFunctionBody) { - this.throwError(messages_1.Messages.IllegalExportDeclaration); - } - var node = this.createNode(); - this.expectKeyword('export'); - var exportDeclaration; - if (this.matchKeyword('default')) { - // export default ... - this.nextToken(); - if (this.matchKeyword('function')) { - // export default function foo () {} - // export default function () {} - var declaration = this.parseFunctionDeclaration(true); - exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); - } - else if (this.matchKeyword('class')) { - // export default class foo {} - var declaration = this.parseClassDeclaration(true); - exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); - } - else { - if (this.matchContextualKeyword('from')) { - this.throwError(messages_1.Messages.UnexpectedToken, this.lookahead.value); - } - // export default {}; - // export default []; - // export default (1 + 2); - var declaration = this.match('{') ? this.parseObjectInitializer() : - this.match('[') ? this.parseArrayInitializer() : this.parseAssignmentExpression(); - this.consumeSemicolon(); - exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); - } - } - else if (this.match('*')) { - // export * from 'foo'; - this.nextToken(); - if (!this.matchContextualKeyword('from')) { - var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; - this.throwError(message, this.lookahead.value); - } - this.nextToken(); - var src = this.parseModuleSpecifier(); - this.consumeSemicolon(); - exportDeclaration = this.finalize(node, new Node.ExportAllDeclaration(src)); - } - else if (this.lookahead.type === token_1.Token.Keyword) { - // export var f = 1; - var declaration = void 0; - switch (this.lookahead.value) { - case 'let': - case 'const': - declaration = this.parseLexicalDeclaration({ inFor: false }); - break; - case 'var': - case 'class': - case 'function': - declaration = this.parseStatementListItem(); - break; - default: - this.throwUnexpectedToken(this.lookahead); - } - exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null)); - } - else { - var specifiers = []; - var source = null; - var isExportFromIdentifier = false; - this.expect('{'); - while (!this.match('}')) { - isExportFromIdentifier = isExportFromIdentifier || this$1.matchKeyword('default'); - specifiers.push(this$1.parseExportSpecifier()); - if (!this$1.match('}')) { - this$1.expect(','); - } - } - this.expect('}'); - if (this.matchContextualKeyword('from')) { - // export {default} from 'foo'; - // export {foo} from 'foo'; - this.nextToken(); - source = this.parseModuleSpecifier(); - this.consumeSemicolon(); - } - else if (isExportFromIdentifier) { - // export {default}; // missing fromClause - var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; - this.throwError(message, this.lookahead.value); - } - else { - // export {foo}; - this.consumeSemicolon(); - } - exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(null, specifiers, source)); - } - return exportDeclaration; - }; - return Parser; - }()); - exports.Parser = Parser; - - - /***/ }, - /* 4 */ - /***/ function(module, exports) { - function assert(condition, message) { - /* istanbul ignore if */ - if (!condition) { - throw new Error('ASSERT: ' + message); - } - } - exports.assert = assert; - - - /***/ }, - /* 5 */ - /***/ function(module, exports) { - // Error messages should be identical to V8. - exports.Messages = { - UnexpectedToken: 'Unexpected token %0', - UnexpectedTokenIllegal: 'Unexpected token ILLEGAL', - UnexpectedNumber: 'Unexpected number', - UnexpectedString: 'Unexpected string', - UnexpectedIdentifier: 'Unexpected identifier', - UnexpectedReserved: 'Unexpected reserved word', - UnexpectedTemplate: 'Unexpected quasi %0', - UnexpectedEOS: 'Unexpected end of input', - NewlineAfterThrow: 'Illegal newline after throw', - InvalidRegExp: 'Invalid regular expression', - UnterminatedRegExp: 'Invalid regular expression: missing /', - InvalidLHSInAssignment: 'Invalid left-hand side in assignment', - InvalidLHSInForIn: 'Invalid left-hand side in for-in', - InvalidLHSInForLoop: 'Invalid left-hand side in for-loop', - MultipleDefaultsInSwitch: 'More than one default clause in switch statement', - NoCatchOrFinally: 'Missing catch or finally after try', - UnknownLabel: 'Undefined label \'%0\'', - Redeclaration: '%0 \'%1\' has already been declared', - IllegalContinue: 'Illegal continue statement', - IllegalBreak: 'Illegal break statement', - IllegalReturn: 'Illegal return statement', - StrictModeWith: 'Strict mode code may not include a with statement', - StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode', - StrictVarName: 'Variable name may not be eval or arguments in strict mode', - StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', - StrictParamDupe: 'Strict mode function may not have duplicate parameter names', - StrictFunctionName: 'Function name may not be eval or arguments in strict mode', - StrictOctalLiteral: 'Octal literals are not allowed in strict mode.', - StrictDelete: 'Delete of an unqualified identifier in strict mode.', - StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode', - StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', - StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', - StrictReservedWord: 'Use of future reserved word in strict mode', - TemplateOctalLiteral: 'Octal literals are not allowed in template strings.', - ParameterAfterRestParameter: 'Rest parameter must be last formal parameter', - DefaultRestParameter: 'Unexpected token =', - DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals', - ConstructorSpecialMethod: 'Class constructor may not be an accessor', - DuplicateConstructor: 'A class may only have one constructor', - StaticPrototype: 'Classes may not have static property named prototype', - MissingFromClause: 'Unexpected token', - NoAsAfterImportNamespace: 'Unexpected token', - InvalidModuleSpecifier: 'Unexpected token', - IllegalImportDeclaration: 'Unexpected token', - IllegalExportDeclaration: 'Unexpected token', - DuplicateBinding: 'Duplicate binding %0', - ForInOfLoopInitializer: '%0 loop variable declaration may not have an initializer' - }; - - - /***/ }, - /* 6 */ - /***/ function(module, exports) { - var ErrorHandler = (function () { - function ErrorHandler() { - this.errors = []; - this.tolerant = false; - } - - ErrorHandler.prototype.recordError = function (error) { - this.errors.push(error); - }; - - ErrorHandler.prototype.tolerate = function (error) { - if (this.tolerant) { - this.recordError(error); - } - else { - throw error; - } - }; - - ErrorHandler.prototype.constructError = function (msg, column) { - var error = new Error(msg); - try { - throw error; - } - catch (base) { - /* istanbul ignore else */ - if (Object.create && Object.defineProperty) { - error = Object.create(base); - Object.defineProperty(error, 'column', { value: column }); - } - } - finally { - return error; - } - }; - - ErrorHandler.prototype.createError = function (index, line, col, description) { - var msg = 'Line ' + line + ': ' + description; - var error = this.constructError(msg, col); - error.index = index; - error.lineNumber = line; - error.description = description; - return error; - }; - - ErrorHandler.prototype.throwError = function (index, line, col, description) { - throw this.createError(index, line, col, description); - }; - - ErrorHandler.prototype.tolerateError = function (index, line, col, description) { - var error = this.createError(index, line, col, description); - if (this.tolerant) { - this.recordError(error); - } - else { - throw error; - } - }; - - return ErrorHandler; - }()); - exports.ErrorHandler = ErrorHandler; - - - /***/ }, - /* 7 */ - /***/ function(module, exports) { - (function (Token) { - Token[Token["BooleanLiteral"] = 1] = "BooleanLiteral"; - Token[Token["EOF"] = 2] = "EOF"; - Token[Token["Identifier"] = 3] = "Identifier"; - Token[Token["Keyword"] = 4] = "Keyword"; - Token[Token["NullLiteral"] = 5] = "NullLiteral"; - Token[Token["NumericLiteral"] = 6] = "NumericLiteral"; - Token[Token["Punctuator"] = 7] = "Punctuator"; - Token[Token["StringLiteral"] = 8] = "StringLiteral"; - Token[Token["RegularExpression"] = 9] = "RegularExpression"; - Token[Token["Template"] = 10] = "Template"; - })(exports.Token || (exports.Token = {})); - var Token = exports.Token; - - exports.TokenName = {}; - exports.TokenName[Token.BooleanLiteral] = 'Boolean'; - exports.TokenName[Token.EOF] = ''; - exports.TokenName[Token.Identifier] = 'Identifier'; - exports.TokenName[Token.Keyword] = 'Keyword'; - exports.TokenName[Token.NullLiteral] = 'Null'; - exports.TokenName[Token.NumericLiteral] = 'Numeric'; - exports.TokenName[Token.Punctuator] = 'Punctuator'; - exports.TokenName[Token.StringLiteral] = 'String'; - exports.TokenName[Token.RegularExpression] = 'RegularExpression'; - exports.TokenName[Token.Template] = 'Template'; - - - /***/ }, - /* 8 */ - /***/ function(module, exports, __webpack_require__) { - var assert_1 = __webpack_require__(4); - var messages_1 = __webpack_require__(5); - var character_1 = __webpack_require__(9); - var token_1 = __webpack_require__(7); - function hexValue(ch) { - return '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - function octalValue(ch) { - return '01234567'.indexOf(ch); - } - var Scanner = (function () { - function Scanner(code, handler) { - this.source = code; - this.errorHandler = handler; - this.trackComment = false; - this.length = code.length; - this.index = 0; - this.lineNumber = (code.length > 0) ? 1 : 0; - this.lineStart = 0; - this.curlyStack = []; - } - - Scanner.prototype.eof = function () { - return this.index >= this.length; - }; - - Scanner.prototype.throwUnexpectedToken = function (message) { - if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; } - this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, message); - }; - - Scanner.prototype.tolerateUnexpectedToken = function () { - this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, messages_1.Messages.UnexpectedTokenIllegal); - }; - - // ECMA-262 11.4 Comments - Scanner.prototype.skipSingleLineComment = function (offset) { - var this$1 = this; - - var comments; - var start, loc; - if (this.trackComment) { - comments = []; - start = this.index - offset; - loc = { - start: { - line: this.lineNumber, - column: this.index - this.lineStart - offset - }, - end: {} - }; - } - while (!this.eof()) { - var ch = this$1.source.charCodeAt(this$1.index); - ++this$1.index; - if (character_1.Character.isLineTerminator(ch)) { - if (this$1.trackComment) { - loc.end = { - line: this$1.lineNumber, - column: this$1.index - this$1.lineStart - 1 - }; - var entry = { - multiLine: false, - slice: [start + offset, this$1.index - 1], - range: [start, this$1.index - 1], - loc: loc - }; - comments.push(entry); - } - if (ch === 13 && this$1.source.charCodeAt(this$1.index) === 10) { - ++this$1.index; - } - ++this$1.lineNumber; - this$1.lineStart = this$1.index; - return comments; - } - } - if (this.trackComment) { - loc.end = { - line: this.lineNumber, - column: this.index - this.lineStart - }; - var entry = { - multiLine: false, - slice: [start + offset, this.index], - range: [start, this.index], - loc: loc - }; - comments.push(entry); - } - return comments; - }; - - Scanner.prototype.skipMultiLineComment = function () { - var this$1 = this; - - var comments; - var start, loc; - if (this.trackComment) { - comments = []; - start = this.index - 2; - loc = { - start: { - line: this.lineNumber, - column: this.index - this.lineStart - 2 - }, - end: {} - }; - } - while (!this.eof()) { - var ch = this$1.source.charCodeAt(this$1.index); - if (character_1.Character.isLineTerminator(ch)) { - if (ch === 0x0D && this$1.source.charCodeAt(this$1.index + 1) === 0x0A) { - ++this$1.index; - } - ++this$1.lineNumber; - ++this$1.index; - this$1.lineStart = this$1.index; - } - else if (ch === 0x2A) { - // Block comment ends with '*/'. - if (this$1.source.charCodeAt(this$1.index + 1) === 0x2F) { - this$1.index += 2; - if (this$1.trackComment) { - loc.end = { - line: this$1.lineNumber, - column: this$1.index - this$1.lineStart - }; - var entry = { - multiLine: true, - slice: [start + 2, this$1.index - 2], - range: [start, this$1.index], - loc: loc - }; - comments.push(entry); - } - return comments; - } - ++this$1.index; - } - else { - ++this$1.index; - } - } - // Ran off the end of the file - the whole thing is a comment - if (this.trackComment) { - loc.end = { - line: this.lineNumber, - column: this.index - this.lineStart - }; - var entry = { - multiLine: true, - slice: [start + 2, this.index], - range: [start, this.index], - loc: loc - }; - comments.push(entry); - } - this.tolerateUnexpectedToken(); - return comments; - }; - - Scanner.prototype.scanComments = function () { - var this$1 = this; - - var comments; - if (this.trackComment) { - comments = []; - } - var start = (this.index === 0); - while (!this.eof()) { - var ch = this$1.source.charCodeAt(this$1.index); - if (character_1.Character.isWhiteSpace(ch)) { - ++this$1.index; - } - else if (character_1.Character.isLineTerminator(ch)) { - ++this$1.index; - if (ch === 0x0D && this$1.source.charCodeAt(this$1.index) === 0x0A) { - ++this$1.index; - } - ++this$1.lineNumber; - this$1.lineStart = this$1.index; - start = true; - } - else if (ch === 0x2F) { - ch = this$1.source.charCodeAt(this$1.index + 1); - if (ch === 0x2F) { - this$1.index += 2; - var comment = this$1.skipSingleLineComment(2); - if (this$1.trackComment) { - comments = comments.concat(comment); - } - start = true; - } - else if (ch === 0x2A) { - this$1.index += 2; - var comment = this$1.skipMultiLineComment(); - if (this$1.trackComment) { - comments = comments.concat(comment); - } - } - else { - break; - } - } - else if (start && ch === 0x2D) { - // U+003E is '>' - if ((this$1.source.charCodeAt(this$1.index + 1) === 0x2D) && (this$1.source.charCodeAt(this$1.index + 2) === 0x3E)) { - // '-->' is a single-line comment - this$1.index += 3; - var comment = this$1.skipSingleLineComment(3); - if (this$1.trackComment) { - comments = comments.concat(comment); - } - } - else { - break; - } - } - else if (ch === 0x3C) { - if (this$1.source.slice(this$1.index + 1, this$1.index + 4) === '!--') { - this$1.index += 4; // `