Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • Synzvato/decentraleyes
  • gkrishnaks/decentraleyes
  • ExE-Boss/decentraleyes
  • whtsky/decentraleyes
  • grtgarrett/decentraleyes
  • An_dz/decentraleyes
  • Alaska/decentraleyes
  • finn/decentraleyes
  • klippy/decentraleyes
9 results
Show changes
Showing
with 1736 additions and 263 deletions
/**
* Domain Exceptions
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2017-10-08 (originally "tainted")
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Public Constants
*/
const literal = {
'MTBmYXN0ZmluZ2Vycy5jb20=': true,
'Y291cmllci10cmlidW5lLmNvbQ==': true,
'Y29kZS53b3JsZA==': true,
'Y29sdW1iaWF0cmlidW5lLmNvbQ==': true,
'Y29sdW1iaWFkYWlseWhlcmFsZC5jb20=': true,
'Y2FtYnJpZGdlY2hyb24uY29t': true,
'Y2FudG9uZGFpbHlsZWRnZXIuY29t': true,
'Y2FudG9ucmVwLmNvbQ==': true,
'Y2FwZWNvZHRpbWVzLmNvbQ==': true,
'Y2FwdGNoYS5yZWFsdGVrLmNvbQ==': true,
'Y2FybWl0aW1lcy5jb20=': true,
'Y2RuanMuY29t': true,
'Y2VsbG1hcHBlci5uZXQ=': true,
'Y2hhcmxlc3RvbmV4cHJlc3MuY29t': true,
'Y2hlYm95Z2FubmV3cy5jb20=': true,
'Y2hpZWZ0YWluLmNvbQ==': true,
'Y2hpbGxpY290aGV0aW1lc2J1bGxldGluLmNvbQ==': true,
'Y2hpbGxpY290aGVuZXdzLmNvbQ==': true,
'Y2hpcGxleXBhcGVyLmNvbQ==': true,
'Y2hyb25pY2xlLWV4cHJlc3MuY29t': true,
'Y2lyY3VpdGxhYi5jb20=': true,
'Y2pvbmxpbmUuY29t': true,
'Y3JlYXRpdmVjb21tb25zLm9yZw==': true,
'Y3Jlc3R2aWV3YnVsbGV0aW4uY29t': true,
'Y3Jvb2tzdG9udGltZXMuY29t': true,
'Y3Nnb3N0YXRzLmdn': true,
'YW10cmliLmNvbQ==': true,
'YW1hcmlsbG8uY29t': true,
'YW1lc3RyaWIuY29t': true,
'YW55dmFuLmNvbQ==': true,
'YWNrLm5ldA==': true,
'YWR2b2NhdGVwcmVzcy5jb20=': true,
'YWRlbG5ld3MuY29t': true,
'YWRoZXJlbnQubGF2aWxsZWF2ZWxvLm9yZw==': true,
'YWxlZG90aW1lc3JlY29yZC5jb20=': true,
'YWxpY2V0eC5jb20=': true,
'YXBhbGFjaHRpbWVzLmNvbQ==': true,
'YXJkbW9yZWl0ZS5jb20=': true,
'YXVndXN0YWNocm9uaWNsZS5jb20=': true,
'YXVyb3JhYWR2ZXJ0aXNlci5uZXQ=': true,
'Ym9vbmV2aWxsZWRlbW9jcmF0LmNvbQ==': true,
'Ym9vbnZpbGxlZGFpbHluZXdzLmNvbQ==': true,
'YmFybmVzdmlsbGUtZW50ZXJwcmlzZS5jb20=': true,
'YmFybnN0YWJsZXBhdHJpb3QuY29t': true,
'YmFzaXNzZXRleGNoYW5nZS5vcmc=': true,
'YmNkZW1vY3JhdG9ubGluZS5jb20=': true,
'YmVhdXJlZ2FyZGRhaWx5bmV3cy5uZXQ=': true,
'Ymx1ZXJpZGdlbm93LmNvbQ==': true,
'Ymx1ZmZ0b250b2RheS5jb20=': true,
'YmxvZy5kYXRhd3JhcHBlci5kZQ==': true,
'YnIuc3BhbmtiYW5nLmNvbQ==': true,
'YnJvd253b29kdHguY29t': true,
'YnV0bGVyY291bnR5dGltZXNnYXpldHRlLmNvbQ==': true,
'YnVja3Njb3VudHljb3VyaWVydGltZXMuY29t': true,
'YnVuZGxlb2Zob2xkaW5nLmNvbQ==': true,
'YnVybGluZ3RvbmNvdW50eXRpbWVzLmNvbQ==': true,
'Z291cHN0YXRlLmNvbQ==': true,
'Z29lcmllLmNvbQ==': true,
'Z2F6ZXRhZG9wb3ZvLmNvbS5icg==': true,
'Z2Fkc2RlbnRpbWVzLmNvbQ==': true,
'Z2FpbmVzdmlsbGUuY29t': true,
'Z2FsZXNidXJnLmNvbQ==': true,
'Z2FsdmFuZXdzLmNvbQ==': true,
'Z2FzdG9uZ2F6ZXR0ZS5jb20=': true,
'Z2N0ZWxlZ3JhbS5jb20=': true,
'Z2R0Lm9xbGYuZ291di5xYy5jYQ==': true,
'Z2VuZXNlb3JlcHVibGljLmNvbQ==': true,
'Z2xvYmV0cm90dGVyLmRl': true,
'Z2xvd2luZy1iZWFyLm9yZw==': true,
'Z3JhbmRsYWtlbmV3cy5jb20=': true,
'Z3Jhbml0ZWZhbGxzbmV3cy5jb20=': true,
'Z3JlZW53b29kZGVtb2NyYXQuY29t': true,
'ZG92ZXJwb3N0LmNvbQ==': true,
'ZG9jcy5zZXJ2aWNlbm93LmNvbQ==': true,
'ZG9kZ2VnbG9iZS5jb20=': true,
'ZG9uYWxkc29udmlsbGVjaGllZi5jb20=': true,
'ZGFpbHktamVmZi5jb20=': true,
'ZGFpbHljb21ldC5jb20=': true,
'ZGFpbHljb21tZXJjaWFsLmNvbQ==': true,
'ZGFuc3ZpbGxlb25saW5lLmNvbQ==': true,
'ZGUuc2hhcmtvb24uY29t': true,
'ZGUuc3BhbmtiYW5nLmNvbQ==': true,
'ZGV2aWxzbGFrZWpvdXJuYWwuY29t': true,
'ZGlzcGF0Y2guY29t': true,
'ZHJvcGJveC5jb20=': true,
'ZW4uc2hhcmtvb24uY29t': true,
'ZW50ZXJwcmlzZW5ld3MuY29t': true,
'ZWFzdHBlb3JpYXRpbWVzY291cmllci5jb20=': true,
'ZWNoby1uZXdzLmNvLnVr': true,
'ZWNoby1waWxvdC5jb20=': true,
'ZWRpbmJ1cmdyZXZpZXcuY29t': true,
'ZWxsd29vZGNpdHlsZWRnZXIuY29t': true,
'ZXBleS5jb20=': true,
'ZXMuc2hhcmtvb24uY29t': true,
'ZXMuc3BhbmtiYW5nLmNvbQ==': true,
'ZXZvaWNlLmNvbQ==': true,
'ZXhhbWluZXItZW50ZXJwcmlzZS5jb20=': true,
'ZXhhbWluZXIubmV0': true,
'Zm93bGVydHJpYnVuZS5jb20=': true,
'Zm9zdGVycy5jb20=': true,
'ZmF5b2JzZXJ2ZXIuY29t': true,
'ZnIuc2hhcmtvb24uY29t': true,
'ZnIuc3BhbmtiYW5nLmNvbQ==': true,
'ZnJlZWJ1c3kuaW8=': true,
'a28uc2hhcmtvb24uY29t': true,
'a2luc3Rvbi5jb20=': true,
'a2lvd2Fjb3VudHlzaWduYWwuY29t': true,
'a2lya3N2aWxsZWRhaWx5ZXhwcmVzcy5jb20=': true,
'aG91bWF0b2RheS5jb20=': true,
'aG9ja2Vzc2luY29tbXVuaXR5bmV3cy5jb20=': true,
'aG9sbGFuZHNlbnRpbmVsLmNvbQ==': true,
'aGF2ZW5ld3MuY29t': true,
'aGFtYnVyZ3JlcG9ydGVyLmNvbQ==': true,
'aGFubmliYWwubmV0': true,
'aGRuZXdzLm5ldA==': true,
'aGVsZW5hLWFya2Fuc2FzLmNvbQ==': true,
'aGVyYWxkZGVtb2NyYXQuY29t': true,
'aGVyYWxkbmV3cy5jb20=': true,
'aGVyYWxkdHJpYnVuZS5jb20=': true,
'aGlsbHNkYWxlLm5ldA==': true,
'aHN2dm9pY2UuY29t': true,
'aHV0Y2huZXdzLmNvbQ==': true,
'aW4uc3BhbmtiYW5nLmNvbQ==': true,
'aW5kZW9ubGluZS5jb20=': true,
'aWNvLm9yZy51aw==': true,
'aWQuc3BhbmtiYW5nLmNvbQ==': true,
'aWRlbnRpLmNh': true,
'aXQuc2hhcmtvb24uY29t': true,
'aXQuc3BhbmtiYW5nLmNvbQ==': true,
'am91cm5hbGRlbW9jcmF0LmNvbQ==': true,
'am91cm5hbHN0YW5kYXJkLmNvbQ==': true,
'am95ZnVsbm9pc2VyZWNvcmRpbmdzLmNvbQ==': true,
'amEuc2hhcmtvb24uY29t': true,
'amFja3Nvbm5ld3NwYXBlcnMuY29t': true,
'amFja3NvbnZpbGxlLmNvbQ==': true,
'amRuZXdzLmNvbQ==': true,
'anAuc3BhbmtiYW5nLmNvbQ==': true,
'b253ZWxvLmNvbQ==': true,
'b25saW5lYXRoZW5zLmNvbQ==': true,
'b2FrcmlkZ2VyLmNvbQ==': true,
'b2NhbGEuY29t': true,
'b2hpby5jb20=': true,
'b2xuZXlkYWlseW1haWwuY29t': true,
'b3Bhdm90ZS5jb20=': true,
'b3BlbmRhdGEuY2JzLm5s': true,
'b3BlbndlYXRoZXJtYXAub3Jn': true,
'b3J6ZXN6ZS5jb20ucGw=': true,
'b3Jpb25nYXpldHRlLmNvbQ==': true,
'b3R0YXdhaGVyYWxkLmNvbQ==': true,
'bGEuc3BhbmtiYW5nLmNvbQ==': true,
'bGF6aXNrYS5jb20ucGw=': true,
'bGFiZG9vci5jb20=': true,
'bGFqdW50YXRyaWJ1bmVkZW1vY3JhdC5jb20=': true,
'bGFrZW5ld3NvbmxpbmUuY29t': true,
'bGVhdmVud29ydGh0aW1lcy5jb20=': true,
'bGVlc3ZpbGxlZGFpbHlsZWFkZXIuY29t': true,
'bGVtb24tYWlkLmRl': true,
'bGVuY29ubmVjdC5jb20=': true,
'bGVvbWluc3RlcmNoYW1wLmNvbQ==': true,
'bGluY29sbmNvdXJpZXIuY29t': true,
'bGlua2Jvc3RvbmhvbWVzLmNvbQ==': true,
'bGlubmNvdW50eWxlYWRlci5jb20=': true,
'bHViYm9ja29ubGluZS5jb20=': true,
'bS1jZS5wbA==': true,
'bW9iZXJseW1vbml0b3IuY29t': true,
'bW9qY2hvcnpvdy5wbA==': true,
'bW9qYnl0b20ucGw=': true,
'bW9qZWdsaXdpY2UucGw=': true,
'bW9qZWthdG93aWNlLnBs': true,
'bW9qZXR5Y2h5LnBs': true,
'bW9qbWlrb2xvdy5wbA==': true,
'bW9ucm9lY29wb3N0LmNvbQ==': true,
'bW9ucm9lbmV3cy5jb20=': true,
'bW9udGVuZXdzLmNvbQ==': true,
'bW9ybmluZ3N1bi5uZXQ=': true,
'bW9ydG9udGltZXNuZXdzLmNvbQ==': true,
'bW9zY293dmlsbGFnZXIuY29t': true,
'bWFudWFsc2xpYi5jb20=': true,
'bWNkb25vdWdodm9pY2UuY29t': true,
'bWNwaGVyc29uc2VudGluZWwuY29t': true,
'bWV0cm93ZXN0ZGFpbHluZXdzLmNvbQ==': true,
'bWV4aWNvbGVkZ2VyLmNvbQ==': true,
'bWVzbGlldXgucGFyaXMuZnI=': true,
'bWdtLmdvdi50cg==': true,
'bWlhbWlvay5jb20=': true,
'bWlkZGxldG93bnRyYW5zY3JpcHQuY29t': true,
'bWlkbG90aGlhbm1pcnJvci5jb20=': true,
'bWlsZm9yZGJlYWNvbi5jb20=': true,
'bWlsZm9yZGRhaWx5bmV3cy5jb20=': true,
'bWlsbGJ1cnlzdXR0b24uY29t': true,
'bWluaWdhbWVzLm1haWwucnU=': true,
'bWluaXF1YWR0ZXN0YmVuY2guY29t': true,
'bXBubm93LmNvbQ==': true,
'bXMuc3BhbmtiYW5nLmNvbQ==': true,
'bXRzaGFzdGFuZXdzLmNvbQ==': true,
'bXl0b3dubmVvLmNvbQ==': true,
'bm9yd2ljaGJ1bGxldGluLmNvbQ==': true,
'bm9ydGhuZWlnaGJvcm5ld3MuY29t': true,
'bmNuZXdzcHJlc3MuY29t': true,
'bmV2YWRhaW93YWpvdXJuYWwuY29t': true,
'bmV3Y29tZXJzdG93bi1uZXdzLmNvbQ==': true,
'bmV3YmVybnNqLmNvbQ==': true,
'bmV3bG9vay5kdGVlbmVyZ3kuY29t': true,
'bmV3c2NoaWVmLmNvbQ==': true,
'bmV3c2hlcmFsZC5jb20=': true,
'bmV3c3JlcHVibGljYW4uY29t': true,
'bmV3c3RyaWJ1bmUuaW5mbw==': true,
'bmV3cG9ydHJpLmNvbQ==': true,
'bmV3cy1qb3VybmFsb25saW5lLmNvbQ==': true,
'bmV3cy1zdGFyLmNvbQ==': true,
'bmVhZ2xlLmNvbQ==': true,
'bmVvc2hvZGFpbHluZXdzLmNvbQ==': true,
'bmhtLmFjLnVr': true,
'bmwuc2hhcmtvb24uY29t': true,
'bmwuc3BhbmtiYW5nLmNvbQ==': true,
'bndmZGFpbHluZXdzLmNvbQ==': true,
'c291dGhjb2FzdHRvZGF5LmNvbQ==': true,
'c29taWliby5jb20=': true,
'c29vZXZlbmluZ25ld3MuY29t': true,
'c29zbm93aWVja2kucGw=': true,
'c2F2YW5uYWhub3cuY29t': true,
'c2FsaW5hLmNvbQ==': true,
'c2Nhbi5uZXh0Y2xvdWQuY29t': true,
'c2NvdHRoZWxtZS5jby51aw==': true,
'c2NzdW50aW1lcy5jb20=': true,
'c2Uuc3BhbmtiYW5nLmNvbQ==': true,
'c2VhY29hc3RvbmxpbmUuY29t': true,
'c2VjdXJlLnBheW1lbnRldm9sdXRpb24uY29t': true,
'c2VjdXJpdHloZWFkZXJzLmNvbQ==': true,
'c2VjdXJpdHloZWFkZXJzLmlv': true,
'c2Vrdm9pY2UuY29t': true,
'c2VudGluZWwtc3RhbmRhcmQuY29t': true,
'c2hlbGJ5c3Rhci5jb20=': true,
'c2llbWlhbm93aWNlLm5ldC5wbA==': true,
'c2lnbmFsLm9yZw==': true,
'c2lza2l5b3VkYWlseS5jb20=': true,
'c2otci5jb20=': true,
'c2puZXdzb25saW5lLmNvbQ==': true,
'c2tvdXNlbi5kaw==': true,
'c2tvdXNlbi5ubw==': true,
'c2xlZXB5ZXllbmV3cy5jb20=': true,
'c3BhbmtiYW5nLmNvbQ==': true,
'c3JwcmVzc2dhemV0dGUuY29t': true,
'c3R1cmdpc2pvdXJuYWwuY29t': true,
'c3R1dHRnYXJ0ZGFpbHlsZWFkZXIuY29t': true,
'c3RhZGl1bS5zZQ==': true,
'c3Rhcm5ld3NvbmxpbmUuY29t': true,
'c3RhcmNvdXJpZXIuY29t': true,
'c3RhcmZsLmNvbQ==': true,
'c3RhdGVzbWFuLmNvbQ==': true,
'c3RhdWd1c3RpbmUuY29t': true,
'c3RlZmFuc3VuZGluLmdpdGh1Yi5pbw==': true,
'c3RldWJlbmNvdXJpZXIuY29t': true,
'c3RqYW1lc25ld3MuY29t': true,
'c3d0aW1lcy5jb20=': true,
'c3dpb255LnBs': true,
'cG9jb25vcmVjb3JkLmNvbQ==': true,
'cG9lZGIudHc=': true,
'cG9udGlhY2RhaWx5bGVhZGVyLmNvbQ==': true,
'cG9zdHNvdXRoLmNvbQ==': true,
'cGF0cmlvdGxlZGdlci5jb20=': true,
'cGF3aHVza2Fqb3VybmFsY2FwaXRhbC5jb20=': true,
'cGFsbWJlYWNocG9zdC5jb20=': true,
'cGFuZG9jLm9yZw==': true,
'cGFyaXMtZXhwcmVzcy5jb20=': true,
'cGJjb21tZXJjaWFsLmNvbQ==': true,
'cGVraW50aW1lcy5jb20=': true,
'cGVvcGxlZm9uZS5jaA==': true,
'cGlla2FyeXNsYXNraWUuY29tLnBs': true,
'cGpzdGFyLmNvbQ==': true,
'cGwuc2hhcmtvb24uY29t': true,
'cGwuc3BhbmtiYW5nLmNvbQ==': true,
'cHJhdHR0cmlidW5lLmNvbQ==': true,
'cHJlc3Nhcmd1cy5jb20=': true,
'cHJlc3NtZW50b3IuY29t': true,
'cHJvY2Vzc3R5cGVmb3VuZHJ5LmNvbQ==': true,
'cHJvZ3Jlc3MtaW5kZXguY29t': true,
'cHJvc3BlcnByZXNzbmV3cy5jb20=': true,
'cHJvdmlkZW5jZWpvdXJuYWwuY29t': true,
'cHQuc2hhcmtvb24uY29t': true,
'cHQuc3BhbmtiYW5nLmNvbQ==': true,
'cHlza293aWNlLmNvbS5wbA==': true,
'cXdlcnRlZS5jb20=': true,
'cmV2aWV3YXRsYXMuY29t': true,
'cmVjb3JkLWNvdXJpZXIuY29t': true,
'cmVjb3Jkb25saW5lLmNvbQ==': true,
'cmVjb3JkbmV0LmNvbQ==': true,
'cmVjb3Jkc3Rhci5jb20=': true,
'cmVkd29vZGZhbGxzZ2F6ZXR0ZS5jb20=': true,
'cmVnZW50Z3JleW1vdXRoLmNvLm56': true,
'cmVnaXN0ZXJndWFyZC5jb20=': true,
'cmVwb3J0LXVyaS5pbw==': true,
'cmlkZ2VjcmVzdGNhLmNvbQ==': true,
'cnJzdGFyLmNvbQ==': true,
'cnUuc2hhcmtvb24uY29t': true,
'cnUuc3BhbmtiYW5nLmNvbQ==': true,
'cnVkYXNsYXNrYS5jb20ucGw=': true,
'cnVubmVsc2NvdW50eXJlZ2lzdGVyLmNvbQ==': true,
'cnlibmlja2kuY29t': true,
'd29kemlzbGF3LmNvbS5wbA==': true,
'd29vZGZvcmR0aW1lcy5jb20=': true,
'd29yY2VzdGVybWFnLmNvbQ==': true,
'd2F4YWhhY2hpZXR4LmNvbQ==': true,
'd2F5bmVpbmRlcGVuZGVudC5jb20=': true,
'd2F5bmVwb3N0LmNvbQ==': true,
'd2FsdG9uc3VuLmNvbQ==': true,
'd2FzaGluZ3RvbnRpbWVzcmVwb3J0ZXIuY29t': true,
'd2ViLXBhdGllbnQuZGs=': true,
'd2Vla2x5Y2l0aXplbi5jb20=': true,
'd2VsbGluZ3RvbmRhaWx5bmV3cy5jb20=': true,
'd2VsbHN2aWxsZWRhaWx5LmNvbQ==': true,
'd2hpdGVhd2F5Lm5v': true,
'd2hpdGVhd2F5LmNvbQ==': true,
'd2hpdGVhd2F5LnNl': true,
'd2hpdGVoYWxsam91cm5hbC5jb20=': true,
'dG9uZXMuYmU=': true,
'dG9wc2FpbGFkdmVydGlzZXIuY29t': true,
'dGF1bnRvbmdhemV0dGUuY29t': true,
'dGFmdG1pZHdheWRyaWxsZXIuY29t': true,
'dGV1dG9wb2xpc3ByZXNzLmNvbQ==': true,
'dGVsZWdyYW0uY29t': true,
'dGguc3BhbmtiYW5nLmNvbQ==': true,
'dGhlLWRhaWx5LXJlY29yZC5jb20=': true,
'dGhlLWRpc3BhdGNoLmNvbQ==': true,
'dGhlLWxlYWRlci5jb20=': true,
'dGhlLXJldmlldy5jb20=': true,
'dGhlY2FyYm9uZGFsZW5ld3MuY29t': true,
'dGhlZ3JhZnRvbm5ld3MuY29t': true,
'dGhlZ3VyZG9udGltZXMuY29t': true,
'dGhlZGFpbHlyZXBvcnRlci5jb20=': true,
'dGhlZGVzdGlubG9nLmNvbQ==': true,
'dGhla2Fuc2FuLmNvbQ==': true,
'dGhlaGF3a2V5ZS5jb20=': true,
'dGhlaW50ZWxsLmNvbQ==': true,
'dGhlbGFuZG1hcmsuY29t': true,
'dGhlbGVkZ2VyLmNvbQ==': true,
'dGhlc3VidXJiYW5pdGUuY29t': true,
'dGhlcGVycnljaGllZi5jb20=': true,
'dGhlcm9sbGFkYWlseW5ld3MuY29t': true,
'dGhlcmVjb3JkaGVyYWxkLmNvbQ==': true,
'dGhldGltZXNuZXdzLmNvbQ==': true,
'dGhpc3dlZWtuZXdzLmNvbQ==': true,
'dGltZXMtZ2F6ZXR0ZS5jb20=': true,
'dGltZXN0ZWxlZ3JhbS5jb20=': true,
'dGltZXNjYWxlLmNvbQ==': true,
'dGltZXNvbmxpbmUuY29t': true,
'dGltZXNyZXBvcnRlci5jb20=': true,
'dHIuc2hhcmtvb24uY29t': true,
'dHIuc3BhbmtiYW5nLmNvbQ==': true,
'dHJhbnNjZW5kLWluZm8uY29t': true,
'dHVuZW15bXVzaWMuY29t': true,
'dHVzY2Fsb29zYW5ld3MuY29t': true,
'dW5pZmllZHBvcnRhbC1tZW0uZXBmaW5kaWEuZ292Lmlu': true,
'dWRhY2l0eS5jb20=': true,
'dXRpY2FvZC5jb20=': true,
'dXdvcmxkLmNvbQ==': true,
'dmFuYWxzdHluZWxlYWRlci5jb20=': true,
'dnZkYWlseXByZXNzLmNvbQ==': true,
'eW91cmdsZW5yb3NldHguY29t': true,
'eW91cnN0ZXBoZW52aWxsZXR4LmNvbQ==': true,
'eW91cnZhbGxleXZvaWNlLmNvbQ==': true,
'eW91cnZvdGVtYXR0ZXJzLmNvLnVr': true,
'eWFkaS5zaw==': true,
'eWVscC5jb20=': true,
'em9yeS5jb20ucGw=': true,
'emFicnplLmNvbS5wbA==': true,
'emgtaGFudC5zaGFya29vbi5jb20=': true
};
const dynamic = [
'd2lja2VkbG9jYWxcLmNvbQ==',
'eWFuZGV4XC5jb20=',
'eWFuZGV4XC5ydQ=='
];
/**
* Exports
*/
export default {
'literal': Object.fromEntries(Object.entries(literal).map(([key, value]) => [atob(key), value])),
'dynamic': dynamic.map((value) => new RegExp(atob(value)))
};
/**
* Resource Aliases
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2018-02-24 (originally "shorthands")
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Public Constants
*/
const aliases = {
// Google Hosted Libraries [Deprecated]
'ajax.googleapis.com': {
'resources/jquery/1.8/jquery.min.jsm': {
'path': 'resources/jquery/1.8.3/jquery.min.jsm',
'version': '1.8.3'
},
'resources/jquery/1.7/jquery.min.jsm': {
'path': 'resources/jquery/1.7.2/jquery.min.jsm',
'version': '1.7.2'
},
'resources/jquery/1.6/jquery.min.jsm': {
'path': 'resources/jquery/1.6.4/jquery.min.jsm',
'version': '1.6.4'
},
'resources/jquery/1.5/jquery.min.jsm': {
'path': 'resources/jquery/1.5.2/jquery.min.jsm',
'version': '1.5.2'
},
'resources/jquery/1.4/jquery.min.jsm': {
'path': 'resources/jquery/1.4.4/jquery.min.jsm',
'version': '1.4.4'
},
'resources/jquery/1.3/jquery.min.jsm': {
'path': 'resources/jquery/1.3.2/jquery.min.jsm',
'version': '1.3.2'
},
'resources/jquery/1.2/jquery.min.jsm': {
'path': 'resources/jquery/1.2.6/jquery.min.jsm',
'version': '1.2.6'
}
},
// jQuery CDN [Deprecated]
'code.jquery.com': {
'resources/jquery/1.7/jquery.min.jsm': {
'path': 'resources/jquery/1.7.0/jquery.min.jsm',
'version': '1.7.0'
},
'resources/jquery/1.6/jquery.min.jsm': {
'path': 'resources/jquery/1.6.0/jquery.min.jsm',
'version': '1.6.0'
},
'resources/jquery/1.5/jquery.min.jsm': {
'path': 'resources/jquery/1.5.0/jquery.min.jsm',
'version': '1.5.0'
},
'resources/jquery/1.4/jquery.min.jsm': {
'path': 'resources/jquery/1.4.0/jquery.min.jsm',
'version': '1.4.0'
},
'resources/jquery/1.3/jquery.min.jsm': {
'path': 'resources/jquery/1.3.0/jquery.min.jsm',
'version': '1.3.0'
}
}
};
/**
* Initializations
*/
// Geekzu Public Service [Mirror]
aliases['sdn.geekzu.org'] = aliases['ajax.googleapis.com'];
// USTC Linux User Group [Mirror]
aliases['ajax.proxy.ustclug.org'] = aliases['ajax.googleapis.com'];
/**
* Exports
*/
export default aliases;
/**
* Resource Environments
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2014-07-24 (originally "files")
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Public Constants
*/
const stable = {
// AngularJS
'resources/angularjs/1.0.1/angular.min.jsm': true,
'resources/angularjs/1.0.2/angular.min.jsm': true,
'resources/angularjs/1.0.3/angular.min.jsm': true,
'resources/angularjs/1.0.4/angular.min.jsm': true,
'resources/angularjs/1.0.5/angular.min.jsm': true,
'resources/angularjs/1.0.6/angular.min.jsm': true,
'resources/angularjs/1.0.8/angular.min.jsm': true,
'resources/angularjs/1.2.0/angular.min.jsm': true,
'resources/angularjs/1.2.1/angular.min.jsm': true,
'resources/angularjs/1.2.10/angular.min.jsm': true,
'resources/angularjs/1.2.15/angular.min.jsm': true,
'resources/angularjs/1.2.16/angular.min.jsm': true,
'resources/angularjs/1.2.20/angular.min.jsm': true,
'resources/angularjs/1.2.23/angular.min.jsm': true,
'resources/angularjs/1.2.26/angular.min.jsm': true,
'resources/angularjs/1.2.28/angular.min.jsm': true,
'resources/angularjs/1.2.29/angular.min.jsm': true,
'resources/angularjs/1.3.0/angular.min.jsm': true,
'resources/angularjs/1.3.3/angular.min.jsm': true,
'resources/angularjs/1.3.8/angular.min.jsm': true,
'resources/angularjs/1.3.10/angular.min.jsm': true,
'resources/angularjs/1.3.11/angular.min.jsm': true,
'resources/angularjs/1.3.14/angular.min.jsm': true,
'resources/angularjs/1.3.15/angular.min.jsm': true,
'resources/angularjs/1.4.0/angular.min.jsm': true,
'resources/angularjs/1.4.2/angular.min.jsm': true,
'resources/angularjs/1.4.8/angular.min.jsm': true,
// Backbone.js
'resources/backbone.js/0.9.0/backbone-min.jsm': true,
'resources/backbone.js/0.9.1/backbone-min.jsm': true,
'resources/backbone.js/0.9.2/backbone-min.jsm': true,
'resources/backbone.js/0.9.9/backbone-min.jsm': true,
'resources/backbone.js/0.9.10/backbone-min.jsm': true,
'resources/backbone.js/1.0.0/backbone-min.jsm': true,
'resources/backbone.js/1.1.0/backbone-min.jsm': true,
'resources/backbone.js/1.1.1/backbone-min.jsm': true,
'resources/backbone.js/1.1.2/backbone-min.jsm': true,
'resources/backbone.js/1.2.0/backbone-min.jsm': true,
'resources/backbone.js/1.2.1/backbone-min.jsm': true,
'resources/backbone.js/1.2.2/backbone-min.jsm': true,
'resources/backbone.js/1.2.3/backbone-min.jsm': true,
// Dojo
'resources/dojo/1.4.1/dojo/dojo.jsm': true,
'resources/dojo/1.4.5/dojo/dojo.jsm': true,
'resources/dojo/1.5.0/dojo/dojo.jsm': true,
'resources/dojo/1.6.1/dojo/dojo.jsm': true,
'resources/dojo/1.7.5/dojo/dojo.jsm': true,
'resources/dojo/1.8.3/dojo/dojo.jsm': true,
'resources/dojo/1.8.7/dojo/dojo.jsm': true,
'resources/dojo/1.8.9/dojo/dojo.jsm': true,
'resources/dojo/1.9.1/dojo/dojo.jsm': true,
'resources/dojo/1.9.3/dojo/dojo.jsm': true,
'resources/dojo/1.9.7/dojo/dojo.jsm': true,
'resources/dojo/1.10.4/dojo/dojo.jsm': true,
// Ember.js
'resources/ember.js/1.0.1/ember.min.jsm': true,
'resources/ember.js/1.1.3/ember.min.jsm': true,
'resources/ember.js/1.2.2/ember.min.jsm': true,
'resources/ember.js/1.3.2/ember.min.jsm': true,
'resources/ember.js/1.4.0/ember.min.jsm': true,
'resources/ember.js/1.5.1/ember.min.jsm': true,
'resources/ember.js/2.0.0/ember.min.jsm': true,
'resources/ember.js/2.0.2/ember.min.jsm': true,
'resources/ember.js/2.1.0/ember.min.jsm': true,
// Ext Core
'resources/ext-core/3.0.0/ext-core.jsm': true,
'resources/ext-core/3.1.0/ext-core.jsm': true,
// jQuery
'resources/jquery/1.2.3/jquery.min.jsm': true,
'resources/jquery/1.2.6/jquery.min.jsm': true,
'resources/jquery/1.3.0/jquery.min.jsm': true,
'resources/jquery/1.3.1/jquery.min.jsm': true,
'resources/jquery/1.3.2/jquery.min.jsm': true,
'resources/jquery/1.4.0/jquery.min.jsm': true,
'resources/jquery/1.4.1/jquery.min.jsm': true,
'resources/jquery/1.4.2/jquery.min.jsm': true,
'resources/jquery/1.4.3/jquery.min.jsm': true,
'resources/jquery/1.4.4/jquery.min.jsm': true,
'resources/jquery/1.5.0/jquery.min.jsm': true,
'resources/jquery/1.5.1/jquery.min.jsm': true,
'resources/jquery/1.5.2/jquery.min.jsm': true,
'resources/jquery/1.6.0/jquery.min.jsm': true,
'resources/jquery/1.6.1/jquery.min.jsm': true,
'resources/jquery/1.6.2/jquery.min.jsm': true,
'resources/jquery/1.6.3/jquery.min.jsm': true,
'resources/jquery/1.6.4/jquery.min.jsm': true,
'resources/jquery/1.7.0/jquery.min.jsm': true,
'resources/jquery/1.7.1/jquery.min.jsm': true,
'resources/jquery/1.7.2/jquery.min.jsm': true,
'resources/jquery/1.8.0/jquery.min.jsm': true,
'resources/jquery/1.8.1/jquery.min.jsm': true,
'resources/jquery/1.8.2/jquery.min.jsm': true,
'resources/jquery/1.8.3/jquery.min.jsm': true,
'resources/jquery/1.9.0/jquery.min.jsm': true,
'resources/jquery/1.9.1/jquery.min.jsm': true,
'resources/jquery/1.10.0/jquery.min.jsm': true,
'resources/jquery/1.10.1/jquery.min.jsm': true,
'resources/jquery/1.10.2/jquery.min.jsm': true,
'resources/jquery/1.11.0/jquery.min.jsm': true,
'resources/jquery/1.11.1/jquery.min.jsm': true,
'resources/jquery/1.11.2/jquery.min.jsm': true,
'resources/jquery/1.11.3/jquery.min.jsm': true,
'resources/jquery/1.12.0/jquery.min.jsm': true,
'resources/jquery/1.12.1/jquery.min.jsm': true,
'resources/jquery/1.12.2/jquery.min.jsm': true,
'resources/jquery/1.12.3/jquery.min.jsm': true,
'resources/jquery/1.12.4/jquery.min.jsm': true,
'resources/jquery/2.0.0/jquery.min.jsm': true,
'resources/jquery/2.0.1/jquery.min.jsm': true,
'resources/jquery/2.0.2/jquery.min.jsm': true,
'resources/jquery/2.0.3/jquery.min.jsm': true,
'resources/jquery/2.1.0/jquery.min.jsm': true,
'resources/jquery/2.1.1/jquery.min.jsm': true,
'resources/jquery/2.1.3/jquery.min.jsm': true,
'resources/jquery/2.1.4/jquery.min.jsm': true,
// jQuery UI
'resources/jqueryui/1.5.3/jquery-ui.min.jsm': true,
'resources/jqueryui/1.6.0/jquery-ui.min.jsm': true,
'resources/jqueryui/1.7.3/jquery-ui.min.jsm': true,
'resources/jqueryui/1.8.24/jquery-ui.min.jsm': true,
'resources/jqueryui/1.9.2/jquery-ui.min.jsm': true,
'resources/jqueryui/1.10.4/jquery-ui.min.jsm': true,
'resources/jqueryui/1.11.0/jquery-ui.min.jsm': true,
'resources/jqueryui/1.11.1/jquery-ui.min.jsm': true,
'resources/jqueryui/1.11.2/jquery-ui.min.jsm': true,
'resources/jqueryui/1.11.3/jquery-ui.min.jsm': true,
'resources/jqueryui/1.11.4/jquery-ui.min.jsm': true,
// Modernizr
'resources/modernizr/2.6.2/modernizr.min.jsm': true,
'resources/modernizr/2.7.1/modernizr.min.jsm': true,
'resources/modernizr/2.7.2/modernizr.min.jsm': true,
'resources/modernizr/2.8.2/modernizr.min.jsm': true,
'resources/modernizr/2.8.3/modernizr.min.jsm': true,
// MooTools
'resources/mootools/1.1.1/mootools-yui-compressed.jsm': true,
'resources/mootools/1.1.2/mootools-yui-compressed.jsm': true,
'resources/mootools/1.2.1/mootools-yui-compressed.jsm': true,
'resources/mootools/1.2.3/mootools-yui-compressed.jsm': true,
'resources/mootools/1.2.4/mootools-yui-compressed.jsm': true,
'resources/mootools/1.2.5/mootools-yui-compressed.jsm': true,
'resources/mootools/1.3.0/mootools-yui-compressed.jsm': true,
'resources/mootools/1.3.1/mootools-yui-compressed.jsm': true,
'resources/mootools/1.3.2/mootools-yui-compressed.jsm': true,
'resources/mootools/1.4.1/mootools-yui-compressed.jsm': true,
'resources/mootools/1.4.5/mootools-yui-compressed.jsm': true,
'resources/mootools/1.5.0/mootools-yui-compressed.jsm': true,
'resources/mootools/1.5.1/mootools-yui-compressed.jsm': true,
// Prototype
'resources/prototype/1.6.0.2/prototype.jsm': true,
'resources/prototype/1.6.0.3/prototype.jsm': true,
'resources/prototype/1.6.1.0/prototype.jsm': true,
'resources/prototype/1.7.0.0/prototype.jsm': true,
'resources/prototype/1.7.1.0/prototype.jsm': true,
'resources/prototype/1.7.2.0/prototype.jsm': true,
'resources/prototype/1.7.3.0/prototype.jsm': true,
// Scriptaculous
'resources/scriptaculous/1.8.1/scriptaculous.jsm': true,
'resources/scriptaculous/1.8.2/scriptaculous.jsm': true,
'resources/scriptaculous/1.8.3/scriptaculous.jsm': true,
'resources/scriptaculous/1.9.0/scriptaculous.jsm': true,
// SWFObject
'resources/swfobject/2.1/swfobject.jsm': true,
'resources/swfobject/2.2/swfobject.jsm': true,
// Underscore.js
'resources/underscore.js/1.3.0/underscore-min.jsm': true,
'resources/underscore.js/1.3.1/underscore-min.jsm': true,
'resources/underscore.js/1.3.3/underscore-min.jsm': true,
'resources/underscore.js/1.4.0/underscore-min.jsm': true,
'resources/underscore.js/1.4.1/underscore-min.jsm': true,
'resources/underscore.js/1.4.2/underscore-min.jsm': true,
'resources/underscore.js/1.4.3/underscore-min.jsm': true,
'resources/underscore.js/1.4.4/underscore-min.jsm': true,
'resources/underscore.js/1.5.0/underscore-min.jsm': true,
'resources/underscore.js/1.5.1/underscore-min.jsm': true,
'resources/underscore.js/1.5.2/underscore-min.jsm': true,
'resources/underscore.js/1.6.0/underscore-min.jsm': true,
'resources/underscore.js/1.7.0/underscore-min.jsm': true,
'resources/underscore.js/1.8.0/underscore-min.jsm': true,
'resources/underscore.js/1.8.1/underscore-min.jsm': true,
'resources/underscore.js/1.8.2/underscore-min.jsm': true,
'resources/underscore.js/1.8.3/underscore-min.jsm': true,
// Web Font Loader
'resources/webfont/1.0.0/webfont.jsm': true,
'resources/webfont/1.0.1/webfont.jsm': true,
'resources/webfont/1.0.2/webfont.jsm': true,
'resources/webfont/1.0.3/webfont.jsm': true,
'resources/webfont/1.0.4/webfont.jsm': true,
'resources/webfont/1.0.5/webfont.jsm': true,
'resources/webfont/1.0.6/webfont.jsm': true,
'resources/webfont/1.0.9/webfont.jsm': true,
'resources/webfont/1.0.10/webfont.jsm': true,
'resources/webfont/1.0.11/webfont.jsm': true,
'resources/webfont/1.0.12/webfont.jsm': true,
'resources/webfont/1.0.13/webfont.jsm': true,
'resources/webfont/1.0.14/webfont.jsm': true,
'resources/webfont/1.0.15/webfont.jsm': true,
'resources/webfont/1.0.16/webfont.jsm': true,
'resources/webfont/1.0.17/webfont.jsm': true,
'resources/webfont/1.0.18/webfont.jsm': true,
'resources/webfont/1.0.19/webfont.jsm': true,
'resources/webfont/1.0.21/webfont.jsm': true,
'resources/webfont/1.0.22/webfont.jsm': true,
'resources/webfont/1.0.23/webfont.jsm': true,
'resources/webfont/1.0.24/webfont.jsm': true,
'resources/webfont/1.0.25/webfont.jsm': true,
'resources/webfont/1.0.26/webfont.jsm': true,
'resources/webfont/1.0.27/webfont.jsm': true,
'resources/webfont/1.0.28/webfont.jsm': true,
'resources/webfont/1.0.29/webfont.jsm': true,
'resources/webfont/1.0.30/webfont.jsm': true,
'resources/webfont/1.0.31/webfont.jsm': true,
'resources/webfont/1.1.0/webfont.jsm': true,
'resources/webfont/1.1.1/webfont.jsm': true,
'resources/webfont/1.1.2/webfont.jsm': true,
'resources/webfont/1.3.0/webfont.jsm': true,
'resources/webfont/1.4.2/webfont.jsm': true,
'resources/webfont/1.4.6/webfont.jsm': true,
'resources/webfont/1.4.7/webfont.jsm': true,
'resources/webfont/1.4.8/webfont.jsm': true,
'resources/webfont/1.4.10/webfont.jsm': true,
'resources/webfont/1.5.0/webfont.jsm': true,
'resources/webfont/1.5.2/webfont.jsm': true,
'resources/webfont/1.5.3/webfont.jsm': true,
'resources/webfont/1.5.6/webfont.jsm': true,
'resources/webfont/1.5.10/webfont.jsm': true,
'resources/webfont/1.5.18/webfont.jsm': true
};
const staging = {...stable, ...{
// AngularJS
'resources/angularjs/1.5.8/angular.min.jsm': true,
'resources/angularjs/1.6.1/angular.min.jsm': true,
'resources/angularjs/1.6.5/angular.min.jsm': true,
// Backbone.js
'resources/backbone.js/1.3.3/backbone-min.jsm': true,
'resources/backbone.js/1.4.0/backbone-min.jsm': true,
// jQuery
'resources/jquery/2.2.0/jquery.min.jsm': true,
'resources/jquery/2.2.1/jquery.min.jsm': true,
'resources/jquery/2.2.2/jquery.min.jsm': true,
'resources/jquery/2.2.3/jquery.min.jsm': true,
'resources/jquery/2.2.4/jquery.min.jsm': true,
'resources/jquery/3.0.0/jquery.min.jsm': true,
'resources/jquery/3.1.0/jquery.min.jsm': true,
'resources/jquery/3.1.1/jquery.min.jsm': true,
'resources/jquery/3.2.0/jquery.min.jsm': true,
'resources/jquery/3.2.1/jquery.min.jsm': true,
'resources/jquery/3.3.1/jquery.min.jsm': true,
'resources/jquery/3.4.0/jquery.min.jsm': true,
'resources/jquery/3.4.1/jquery.min.jsm': true,
'resources/jquery/3.5.0/jquery.min.jsm': true,
'resources/jquery/3.5.1/jquery.min.jsm': true,
'resources/jquery/3.6.0/jquery.min.jsm': true,
'resources/jquery/3.6.1/jquery.min.jsm': true,
'resources/jquery/3.6.4/jquery.min.jsm': true,
'resources/jquery/3.7.0/jquery.min.jsm': true,
'resources/jquery/3.7.1/jquery.min.jsm': true,
// Moment.js
'resources/moment.js/2.8.3/moment.min.jsm': true,
'resources/moment.js/2.8.4/moment.min.jsm': true,
'resources/moment.js/2.10.2/moment.min.jsm': true,
'resources/moment.js/2.10.3/moment.min.jsm': true,
'resources/moment.js/2.10.6/moment.min.jsm': true,
'resources/moment.js/2.11.1/moment.min.jsm': true,
'resources/moment.js/2.11.2/moment.min.jsm': true,
'resources/moment.js/2.17.0/moment.min.jsm': true,
'resources/moment.js/2.17.1/moment.min.jsm': true,
'resources/moment.js/2.18.1/moment.min.jsm': true,
'resources/moment.js/2.19.1/moment.min.jsm': true,
'resources/moment.js/2.19.2/moment.min.jsm': true,
'resources/moment.js/2.19.3/moment.min.jsm': true,
'resources/moment.js/2.20.1/moment.min.jsm': true,
'resources/moment.js/2.22.0/moment.min.jsm': true,
'resources/moment.js/2.22.1/moment.min.jsm': true,
'resources/moment.js/2.22.2/moment.min.jsm': true,
'resources/moment.js/2.24.0/moment.min.jsm': true,
'resources/moment.js/2.29.1/moment.min.jsm': true,
'resources/moment.js/2.29.4/moment.min.jsm': true,
// Underscore.js
'resources/underscore.js/1.9.0/underscore-min.jsm': true,
'resources/underscore.js/1.9.1/underscore-min.jsm': true,
'resources/underscore.js/1.13.4/underscore-min.jsm': true
}};
/**
* Exports
*/
export default {
stable,
staging
};
/**
* Resource Mappings
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2014-05-30
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import ResourceSets from './sets.js';
/**
* Public Constants
*/
const mappings = {
// Google Hosted Libraries
'ajax.googleapis.com': {
'/ajax/libs/': {
'angularjs/{version}/angular.': ResourceSets.angular,
'dojo/{version}/dojo/dojo.': ResourceSets.dojo,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'ext-core/{version}/ext-core-debug.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jqueryui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'mootools/{version}/mootools-yui-compressed.': ResourceSets.mootools,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'webfont/{version}/webfont.': ResourceSets.webfont,
// Mapping Aliases [Deprecated]
'dojo/1/dojo/dojo.': {
'path': 'resources/dojo/1.6.1/dojo/dojo.jsm',
'type': 'application/javascript'
},
'jquery/1/jquery.': {
'path': 'resources/jquery/1.11.1/jquery.min.jsm',
'type': 'application/javascript'
},
'jqueryui/1/jquery-ui.js': {
'path': 'resources/jqueryui/1.10.4/jquery-ui.min.jsm',
'type': 'application/javascript'
},
'jqueryui/1/jquery-ui.min.js': {
'path': 'resources/jqueryui/1.10.4/jquery-ui.min.jsm',
'type': 'application/javascript'
},
'mootools/1/mootools-yui-compressed.': {
'path': 'resources/mootools/1.1.2/mootools-yui-compressed.jsm',
'type': 'application/javascript'
},
'prototype/1/prototype.': {
'path': 'resources/prototype/1.7.1.0/prototype.jsm',
'type': 'application/javascript'
},
'scriptaculous/1/scriptaculous.': {
'path': 'resources/scriptaculous/1.9.0/scriptaculous.jsm',
'type': 'application/javascript'
},
'swfobject/2/swfobject.': {
'path': 'resources/swfobject/2.2/swfobject.jsm',
'type': 'application/javascript'
},
'webfont/1/webfont.': {
'path': 'resources/webfont/1.5.18/webfont.jsm',
'type': 'application/javascript'
}
}
},
// Microsoft Ajax CDN
'ajax.aspnetcdn.com': {
'/ajax/': {
'jQuery/jquery-{version}.': ResourceSets.jQuery,
'jquery/jquery-{version}.': ResourceSets.jQuery,
'modernizr/modernizr-{version}.': ResourceSets.modernizr
}
},
// Microsoft Ajax CDN [Deprecated]
'ajax.microsoft.com': {
'/ajax/': {
'jQuery/jquery-{version}.': ResourceSets.jQuery,
'jquery/jquery-{version}.': ResourceSets.jQuery,
'modernizr/modernizr-{version}.': ResourceSets.modernizr
}
},
// CDNJS (Cloudflare)
'cdnjs.cloudflare.com': {
'/ajax/libs/': {
'angular.js/{version}/angular.': ResourceSets.angular,
'backbone.js/{version}/backbone.': ResourceSets.backbone,
'backbone.js/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo.': ResourceSets.dojo,
'ember.js/{version}/ember.': ResourceSets.ember,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jqueryui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'modernizr/{version}/modernizr.': ResourceSets.modernizr,
'moment.js/{version}/moment.': ResourceSets.moment,
'mootools/{version}/mootools-core': ResourceSets.mootools,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'underscore.js/{version}/underscore.': ResourceSets.underscore,
'underscore.js/{version}/underscore-min.': ResourceSets.underscore,
'webfont/{version}/webfont': ResourceSets.webfont
}
},
// jQuery CDN (Fastly)
'code.jquery.com': {
'/': {
'jquery-{version}.': ResourceSets.jQuery,
'ui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'ui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
// Mapping Aliases [Deprecated]
'jquery-latest.': {
'path': 'resources/jquery/1.11.1/jquery.min.jsm',
'type': 'application/javascript'
},
'jquery.': {
'path': 'resources/jquery/1.11.1/jquery.min.jsm',
'type': 'application/javascript'
}
}
},
// jsDelivr (Cloudflare, Fastly)
'cdn.jsdelivr.net': {
'/': {
'angularjs/{version}/angular.': ResourceSets.angular,
'backbonejs/{version}/backbone.': ResourceSets.backbone,
'backbonejs/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo.': ResourceSets.dojo,
'emberjs/{version}/ember.': ResourceSets.ember,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jquery.ui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jquery.ui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'momentjs/{version}/moment.': ResourceSets.moment,
'mootools/{version}/mootools-': ResourceSets.mootools,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'underscorejs/{version}/underscore.': ResourceSets.underscore,
'underscorejs/{version}/underscore-min.': ResourceSets.underscore,
'webfontloader/{version}/webfont': ResourceSets.webfont
}
},
// Yandex CDN
'yastatic.net': {
'/': {
'angularjs/{version}/angular.': ResourceSets.angular,
'backbone/{version}/backbone.': ResourceSets.backbone,
'backbone/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo/dojo.': ResourceSets.dojo,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jquery-ui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jquery-ui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'modernizr/{version}/modernizr.': ResourceSets.modernizr,
'momentjs/{version}/moment.': ResourceSets.moment,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'underscore/{version}/underscore.': ResourceSets.underscore,
'underscore/{version}/underscore-min.': ResourceSets.underscore
}
},
// Yandex CDN [Deprecated]
'yandex.st': {
'/': {
'angularjs/{version}/angular.': ResourceSets.angular,
'backbone/{version}/backbone.': ResourceSets.backbone,
'backbone/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo/dojo.': ResourceSets.dojo,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jquery-ui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jquery-ui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'modernizr/{version}/modernizr.': ResourceSets.modernizr,
'momentjs/{version}/moment.': ResourceSets.moment,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'underscore/{version}/underscore.': ResourceSets.underscore,
'underscore/{version}/underscore-min.': ResourceSets.underscore
}
},
// Baidu CDN
'apps.bdimg.com': {
'/libs/': {
'angular.js/{version}/angular.': ResourceSets.angular,
'backbone.js/{version}/backbone.': ResourceSets.backbone,
'backbone.js/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo.': ResourceSets.dojo,
'ember.js/{version}/ember.': ResourceSets.ember,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jqueryui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'moment/{version}/moment.': ResourceSets.moment,
'mootools/{version}/mootools-yui-compressed.': ResourceSets.mootools,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'swfobject/{version}/swfobject_src.': ResourceSets.swfobject,
'underscore.js/{version}/underscore.': ResourceSets.underscore,
'underscore.js/{version}/underscore-min.': ResourceSets.underscore,
'webfont/{version}/webfont.': ResourceSets.webfont,
'webfont/{version}/webfont_debug.': ResourceSets.webfont
}
},
// Baidu CDN [Deprecated]
'libs.baidu.com': {
'/': {
'angular.js/{version}/angular.': ResourceSets.angular,
'backbone.js/{version}/backbone.': ResourceSets.backbone,
'backbone.js/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo.': ResourceSets.dojo,
'ember.js/{version}/ember.': ResourceSets.ember,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jqueryui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'moment/{version}/moment.': ResourceSets.moment,
'mootools/{version}/mootools-yui-compressed.': ResourceSets.mootools,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'swfobject/{version}/swfobject_src.': ResourceSets.swfobject,
'underscore.js/{version}/underscore.': ResourceSets.underscore,
'underscore.js/{version}/underscore-min.': ResourceSets.underscore,
'webfont/{version}/webfont.': ResourceSets.webfont,
'webfont/{version}/webfont_debug.': ResourceSets.webfont
}
},
// Sina Public Resources
'lib.sinaapp.com': {
'/js/': {
'angular.js/angular-{version}/angular.': ResourceSets.angular,
'backbone/{version}/backbone.': ResourceSets.backbone,
'dojo/{version}/dojo.': ResourceSets.dojo,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'ext-core/{version}/ext-core-debug.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jquery-ui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jquery-ui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'mootools/{version}/mootools.': ResourceSets.mootools,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'underscore/{version}/underscore.': ResourceSets.underscore,
'underscore/{version}/underscore-min.': ResourceSets.underscore,
'webfont/{version}/webfont.': ResourceSets.webfont,
'webfont/{version}/webfont_debug.': ResourceSets.webfont
}
},
// UpYun Library
'upcdn.b0.upaiyun.com': {
'/libs/': {
'dojo/dojo-{version}.': ResourceSets.dojo,
'emberjs/emberjs-{version}.': ResourceSets.ember,
'jquery/jquery-{version}.': ResourceSets.jQuery,
'jqueryui/jquery.ui-{version}.js': ResourceSets.jQueryUI,
'jqueryui/jquery.ui-{version}.min.js': ResourceSets.jQueryUI,
'modernizr/modernizr-{version}.': ResourceSets.modernizr,
'mootoolscore/mootools.core-{version}.': ResourceSets.mootools
}
},
// Tencent Cloud CDN
'mat1.gtimg.com': {
'/libs/': {
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jquery/jquery-{version}.': ResourceSets.jQuery
}
},
// BootCDN [Dissolved]
'cdn.bootcss.com': {
'/': {
'angular.js/{version}/angular.': ResourceSets.angular,
'backbone.js/{version}/backbone.': ResourceSets.backbone,
'backbone.js/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo.': ResourceSets.dojo,
'ember.js/{version}/ember.': ResourceSets.ember,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jqueryui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'modernizr/{version}/modernizr.': ResourceSets.modernizr,
'moment.js/{version}/moment.': ResourceSets.moment,
'mootools/{version}/mootools-yui-compressed.': ResourceSets.mootools,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'underscore.js/{version}/underscore.': ResourceSets.underscore,
'underscore.js/{version}/underscore-min.': ResourceSets.underscore,
'webfont/{version}/webfontloader.': ResourceSets.webfont
}
}
};
/**
* Initializations
*/
// Geekzu Public Service [Mirror]
mappings['sdn.geekzu.org'] = {
'/ajax/ajax/libs/': mappings['ajax.googleapis.com']['/ajax/libs/']
};
// USTC Linux User Group [Mirror]
mappings['ajax.proxy.ustclug.org'] = mappings['ajax.googleapis.com'];
/**
* Exports
*/
export default mappings;
/**
* Resource Sets
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2014-05-30 (originally "resources")
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Public Constants
*/
const sets = {
// AngularJS
'angular': {
'path': 'resources/angularjs/{version}/angular.min.jsm',
'type': 'application/javascript'
},
// Backbone.js
'backbone': {
'path': 'resources/backbone.js/{version}/backbone-min.jsm',
'type': 'application/javascript'
},
// Dojo
'dojo': {
'path': 'resources/dojo/{version}/dojo/dojo.jsm',
'type': 'application/javascript'
},
// Ember.js
'ember': {
'path': 'resources/ember.js/{version}/ember.min.jsm',
'type': 'application/javascript'
},
// Ext Core
'extCore': {
'path': 'resources/ext-core/{version}/ext-core.jsm',
'type': 'application/javascript'
},
// jQuery
'jQuery': {
'path': 'resources/jquery/{version}/jquery.min.jsm',
'type': 'application/javascript'
},
// jQuery UI
'jQueryUI': {
'path': 'resources/jqueryui/{version}/jquery-ui.min.jsm',
'type': 'application/javascript'
},
// Modernizr
'modernizr': {
'path': 'resources/modernizr/{version}/modernizr.min.jsm',
'type': 'application/javascript'
},
// Moment.js
'moment': {
'path': 'resources/moment.js/{version}/moment.min.jsm',
'type': 'application/javascript'
},
// MooTools
'mootools': {
'path': 'resources/mootools/{version}/mootools-yui-compressed.jsm',
'type': 'application/javascript'
},
// Prototype
'prototypeJS': {
'path': 'resources/prototype/{version}/prototype.jsm',
'type': 'application/javascript'
},
// Scriptaculous
'scriptaculous': {
'path': 'resources/scriptaculous/{version}/scriptaculous.jsm',
'type': 'application/javascript'
},
// SWFObject
'swfobject': {
'path': 'resources/swfobject/{version}/swfobject.jsm',
'type': 'application/javascript'
},
// Underscore.js
'underscore': {
'path': 'resources/underscore.js/{version}/underscore-min.jsm',
'type': 'application/javascript'
},
// Web Font Loader
'webfont': {
'path': 'resources/webfont/{version}/webfont.jsm',
'type': 'application/javascript'
}
};
/**
* Exports
*/
export default sets;
/**
* Setting Defaults
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2024-10-10
* @license MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import Constants from '../constants.js';
/**
* Public Constants
*/
const defaults = {
[Constants.Setting.BLOCK_MISSING]: false,
[Constants.Setting.DISABLE_PREFETCH]: true,
[Constants.Setting.ENFORCE_STAGING]: false,
[Constants.Setting.SHOW_ICON_BADGE]: true,
[Constants.Setting.SHOW_RELEASE_NOTES]: true,
[Constants.Setting.STRIP_METADATA]: true,
[Constants.Setting.WHITELISTED_DOMAINS]: {},
[Constants.Setting.XHR_TEST_DOMAIN]: Constants.Address.DECENTRALEYES
};
/**
* Exports
*/
export default defaults;
/**
* Statistic Defaults
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2024-10-10
* @license MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import Constants from '../constants.js';
/**
* Public Constants
*/
const defaults = {
[Constants.Statistic.AMOUNT_INJECTED]: {
'value': 0, 'createdAt': new Date().toISOString()
},
[Constants.Statistic.AMOUNT_SANITIZED]: {
'value': 0, 'createdAt': new Date().toISOString()
},
[Constants.Statistic.AMOUNT_BLOCKED]: {
'value': 0, 'createdAt': new Date().toISOString()
}
};
/**
* Exports
*/
export default defaults;
/**
* Entry Point
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2016-04-04
* @license MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import './core/request/interceptor.js';
import './core/request/sanitizer.js';
import './utilities/messenger.js';
/**
* Background Helpers
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2017-10-26
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import Constants from '../data/constants.js';
import ResourceMappings from '../data/resource/mappings.js';
import Storage from '../core/storage.js';
/**
* Public Functions
*/
const normalizeDomain = (domain) => {
domain = domain.toLowerCase().trim().replace(/[^A-Za-z0-9.-]/g, '');
if (domain.startsWith(Constants.Address.WWW_PREFIX)) {
domain = domain.slice(Constants.Address.WWW_PREFIX.length);
}
return domain;
};
const domainIsWhitelisted = async (domain, whitelistedDomains = null) => {
if (domain !== null) {
if (! whitelistedDomains) {
whitelistedDomains = await Storage.getSetting(Constants.Setting.WHITELISTED_DOMAINS);
}
return Boolean(whitelistedDomains[domain]);
}
return false;
};
const updateWhitelistedDomains = async (whitelistedDomains) => {
await Storage.updateSetting(Constants.Setting.WHITELISTED_DOMAINS, whitelistedDomains);
};
const addDomainToWhitelist = async (domain) => {
const whitelistedDomains = await Storage.getSetting(Constants.Setting.WHITELISTED_DOMAINS);
whitelistedDomains[domain] = true;
await updateWhitelistedDomains(whitelistedDomains);
chrome.runtime.sendMessage({
'topic': 'domain:added-to-whitelist', 'value': whitelistedDomains
}, () => {
if (chrome.runtime.lastError) { /**/ }
});
};
const removeDomainFromWhitelist = async (domain) => {
const whitelistedDomains = await Storage.getSetting(Constants.Setting.WHITELISTED_DOMAINS);
delete whitelistedDomains[domain];
await updateWhitelistedDomains(whitelistedDomains);
chrome.runtime.sendMessage({
'topic': 'domain:removed-from-whitelist', 'value': whitelistedDomains
}, () => {
if (chrome.runtime.lastError) { /**/ }
});
};
const extractDomainFromUrl = (url, normalize = true) => {
let extractedDomain = null;
if (typeof url !== 'string') {
return null;
}
if (url.startsWith(Constants.Address.CHROME)) {
return null;
}
try {
extractedDomain = new URL(url).hostname;
} catch {
return null;
}
if (extractedDomain === '') {
return null;
}
if (normalize === true) {
extractedDomain = normalizeDomain(extractedDomain);
}
return extractedDomain;
};
const determineValidHosts = () => {
const validHosts = [];
for (const mapping of Object.keys(ResourceMappings)) {
const supportedHost = Constants.Address.ANY_PROTOCOL + mapping + Constants.Address.ANY_PATH;
validHosts.push(supportedHost);
}
return validHosts;
};
const setPrefetchDisabled = (disable) => {
if (disable === false) {
chrome.privacy.network.networkPredictionEnabled.clear({});
} else {
chrome.privacy.network.networkPredictionEnabled.set({'value': false});
}
};
const determineIconPaths = (type) => {
let sizes, iconPaths;
sizes = ['16', '18', '19', '32', '36', '38', '64'];
iconPaths = {};
for (const size of sizes) {
iconPaths[size] = chrome.runtime.getURL(`images/icons/action/${type}/${size}.png`);
}
return iconPaths;
};
/**
* Exports
*/
export default {
normalizeDomain,
domainIsWhitelisted,
updateWhitelistedDomains,
addDomainToWhitelist,
removeDomainFromWhitelist,
extractDomainFromUrl,
determineValidHosts,
setPrefetchDisabled,
determineIconPaths
};
/**
* Runtime Messenger
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2018-05-28
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import Constants from '../data/constants.js';
import Helpers from '../utilities/helpers.js';
import Storage from '../core/storage.js';
/**
* Private Functions
*/
const _handleMessageReceived = (message, sender, sendResponse) => {
let topic, value;
topic = message.topic;
value = message.value;
if (topic === 'extension:is-initialized') {
sendResponse({'value': true});
return Constants.MessageResponse.SYNCHRONOUS;
}
if (topic === 'tab-context:get') {
Storage.getTabContext(value).then((tabContext) => {
sendResponse({'value': tabContext});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'settings:get') {
Storage.getSettings(value?.concise).then((settings) => {
sendResponse({'value': settings});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'setting:update') {
Storage.updateSetting(value.key, value.value).then(() => {
sendResponse({'value': true});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'whitelisted-domains:update') {
Helpers.updateWhitelistedDomains(value).then(() => {
sendResponse({'value': true});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'statistics:get-amount-injected') {
Storage.getStatistic(Constants.Statistic.AMOUNT_INJECTED).then((amountInjected) => {
sendResponse({'value': amountInjected});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'domain:extract-from-url') {
sendResponse({'value': Helpers.extractDomainFromUrl(value)});
return Constants.MessageResponse.SYNCHRONOUS;
}
if (topic === 'domain:normalize') {
sendResponse({'value': Helpers.normalizeDomain(value)});
return Constants.MessageResponse.SYNCHRONOUS;
}
if (topic === 'domain:add-to-whitelist') {
Helpers.addDomainToWhitelist(value).then(() => {
sendResponse({'value': true});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'domain:remove-from-whitelist') {
Helpers.removeDomainFromWhitelist(value).then(() => {
sendResponse({'value': true});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'domain:is-whitelisted') {
Helpers.domainIsWhitelisted(value).then((domainIsWhitelisted) => {
sendResponse({'value': domainIsWhitelisted});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
};
/**
* Event Handlers
*/
chrome.runtime.onMessage.addListener(_handleMessageReceived);
/**
* Browser API Wrappers
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2017-12-03
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Public Constants
*/
const action = {
setBadgeBackgroundColor (details) {
chrome.action.setBadgeBackgroundColor(details);
},
setBadgeText (details) {
chrome.action.setBadgeText(details);
},
setBadgeTextColor (details) {
if (chrome.action.setBadgeTextColor !== undefined) {
chrome.action.setBadgeTextColor(details);
}
},
setIcon (details) {
chrome.action.setIcon(details);
},
async setTitle (details) {
const platformInformation = await chrome.runtime.getPlatformInfo();
if (platformInformation.os !== chrome.runtime.PlatformOs.ANDROID) {
await chrome.action.setTitle(details);
}
}
};
/**
* Exports
*/
export default {
action
};
#
# API Configuration
#
"project_id" : "153483"
"base_url" : "https://api.crowdin.com"
#
# Directory Configuration
#
"preserve_hierarchy" : true
#
# File Configuration
#
files: [{
"source" : "/_locales/en_US/messages.json",
"translation" : "/_locales/%locale_with_underscore%/messages.json",
"export_only_approved" : true,
"languages_mapping" : {
"locale_with_underscore" : {
"ar" : "ar",
"bg" : "bg",
"bn" : "bn",
"ca" : "ca",
"cs" : "cs",
"da" : "da",
"de" : "de",
"el" : "el",
"eo" : "eo",
"es-ES" : "es",
"et" : "et",
"fi" : "fi",
"fr" : "fr",
"he" : "he",
"hr" : "hr",
"hu" : "hu",
"id" : "id",
"is" : "is",
"it" : "it",
"ja" : "ja",
"ko" : "ko",
"lb" : "lb",
"nb" : "nb",
"nl" : "nl",
"pa-IN" : "pa",
"pl" : "pl",
"ro" : "ro",
"ru" : "ru",
"si-LK" : "si",
"sq" : "sq",
"sr" : "sr",
"sv-SE" : "sv",
"tl" : "tl",
"tr" : "tr",
"uk" : "uk",
"vi" : "vi"
}
}
}]
INTRODUCTION
------------
This script (first introduced in Decentraleyes v1.1.5) should make reviewing this extension a lot easier than it used to be. It's open source and open for scrutiny, and it automatically compares the bundled libraries (resources) to their original sources (after removing any source mapping URLs).
FOR NON-LINUX USERS
-------------------
This usage guide is tailored to Linux based operating systems. If you're on a different type of system, the easiest direct solution might be to launch a free Linux box with Node.js pre-installed on Red Hat OpenShift. You can then SSH into it (after adding your own machine's public key to your account).
Having said that, every terminal command in the usage guide below comes with a description, so it should not be too hard to get this done on practically any type of configuration.
USAGE INSTRUCTIONS
------------------
1. Make sure you have Node.js installed on your machine (or install it).
2. Open up a terminal and 'cd' into this directory.
Description: Navigate to this directory.
3. Execute 'npm install' to fetch any dependencies.
4. Run the audit script by executing 'node run'.
Description: Run the script through Node.js and view the output.
Note: If you'd like to store the report, run 'node run > report.txt'.
Note description: It's possible to write the console output to a file.
/**
* Resource Audit Script
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2014-07-24
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Imports
*/
var fileSystem, crypto, http, path, sourceMappingURL;
fileSystem = require('fs');
crypto = require('crypto');
https = require('https');
path = require('path');
sourceMappingURL = require('source-map-url');
/**
* Variables
*/
var localResourceLocation = '../resources';
var localResourceLocationLength = localResourceLocation.length;
var localResourcePaths = [];
var resourceAmount = 0;
/**
* Functions
*/
function _fetchLocalResourcePaths(folderPath) {
fileSystem.readdirSync(folderPath).forEach(function (resourceName) {
if (resourceName === '_audit') {
return localResourcePaths;
}
var resourcePath = folderPath + '/' + resourceName;
var resourceStatistics = fileSystem.statSync(resourcePath);
if (resourceStatistics && resourceStatistics.isDirectory()) {
_fetchLocalResourcePaths(resourcePath);
} else {
localResourcePaths.push(resourcePath);
}
});
return localResourcePaths;
}
function _getLocalResourceContents(fileLocation, callback) {
fileSystem.exists(fileLocation, function (exists) {
if (exists) {
fileSystem.stat(fileLocation, function (error, statistics) {
fileSystem.open(fileLocation, 'r', function (error, fileDescriptor) {
var buffer = new Buffer(statistics.size);
fileSystem.read(fileDescriptor, buffer, 0, buffer.length, null, function (error, bytesRead, buffer) {
var localFileContents = buffer.toString('utf8', 0, buffer.length);
fileSystem.close(fileDescriptor);
callback(localFileContents);
});
});
});
}
});
}
function _getRemoteResourceContents(remoteResourceRoute, callback) {
var resourceURL = 'https://ajax.googleapis.com/ajax/libs/' + remoteResourceRoute;
https.get(resourceURL, function (response) {
var resourceContents = '';
response.on('data', function (chunk) {
resourceContents = resourceContents + chunk;
});
response.on('end', function () {
if (response.statusCode === 200) {
callback(resourceContents, resourceURL);
} else {
resourceURL = 'https://cdnjs.cloudflare.com/ajax/libs/' + remoteResourceRoute;
https.get(resourceURL, function (response) {
resourceContents = '';
response.on('data', function (chunk) {
resourceContents = resourceContents + chunk;
});
response.on('end', function () {
if (response.statusCode !== 200) {
throw 'Error: Resource ' + remoteResourceRoute + ' could not be fetched.';
}
callback(resourceContents, resourceURL);
});
});
}
});
});
}
function _hashFileContents(fileContents) {
var hash;
hash = crypto.createHash('sha512');
hash.setEncoding('hex');
hash.write(fileContents);
hash.end();
return hash.read();
}
function _compareResources(localResourceContents, remoteResourceContents, URL) {
var hasSourceMappingURL = sourceMappingURL.existsIn(remoteResourceContents);
var sourceMappingNotice = '[ ] REMOTE RESOURCE HAD SOURCE MAPPING URL';
if (hasSourceMappingURL) {
remoteResourceContents = sourceMappingURL.removeFrom(remoteResourceContents);
sourceMappingNotice = '[X] REMOTE RESOURCE HAD SOURCE MAPPING URL';
}
// Remove the syntax invalidation character from the local contents.
localResourceContents = localResourceContents.substring(1);
var localResourceHash = _hashFileContents(localResourceContents);
var remoteResourceHash = _hashFileContents(remoteResourceContents);
console.log('RESOURCE HASH (SHA512): ' + localResourceHash);
console.log('RESOURCE HASH (SHA512): ' + remoteResourceHash);
var fileHashesMatch = (localResourceHash === remoteResourceHash);
if (!fileHashesMatch) {
console.log(URL);
console.log(remoteResourceContents);
throw 'Error: Decentraleyes resource hash mismatch.';
}
console.log();
console.log('[X] LOCAL AND REMOTE RESOURCE HASHES MATCH');
console.log(sourceMappingNotice);
}
function _showCompletedMessage() {
console.log();
console.log(' *** FILE INTEGRITY CHECKS COMPLETED');
console.log(' *** ' + resourceAmount + '/' + resourceAmount + ' RESOURCES WERE ANALYZED');
console.log();
}
/**
* Initializations
*/
_fetchLocalResourcePaths(localResourceLocation);
resourceAmount = localResourcePaths.length;
/**
* Script
*/
localResourcePaths.forEach(function (resourcePath, index) {
var resourceRoute = resourcePath.substr(localResourceLocationLength + 1);
resourceRoute = resourceRoute.substring(0, resourceRoute.length - 4);
_getLocalResourceContents(resourcePath, function (localResourceContents) {
_getRemoteResourceContents(resourceRoute, function (remoteResourceContents, URL) {
console.log();
console.log(resourceRoute.toUpperCase());
console.log();
// Compare resource content hashes.
_compareResources(localResourceContents, remoteResourceContents, URL);
console.log();
console.log('------------------------------------------');
if (index === resourceAmount - 1) {
setTimeout(function () {
_showCompletedMessage();
}, 500);
}
});
});
});
@(function(){var t=this;var e=t.Backbone;var i=[];var r=i.push;var s=i.slice;var n=i.splice;var a;if(typeof exports!=="undefined"){a=exports}else{a=t.Backbone={}}a.VERSION="1.0.0";var h=t._;if(!h&&typeof require!=="undefined")h=require("underscore");a.$=t.jQuery||t.Zepto||t.ender||t.$;a.noConflict=function(){t.Backbone=e;return this};a.emulateHTTP=false;a.emulateJSON=false;var o=a.Events={on:function(t,e,i){if(!l(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,i){if(!l(this,"once",t,[e,i])||!e)return this;var r=this;var s=h.once(function(){r.off(t,s);e.apply(this,arguments)});s._callback=e;return this.on(t,s,i)},off:function(t,e,i){var r,s,n,a,o,u,c,f;if(!this._events||!l(this,"off",t,[e,i]))return this;if(!t&&!e&&!i){this._events={};return this}a=t?[t]:h.keys(this._events);for(o=0,u=a.length;o<u;o++){t=a[o];if(n=this._events[t]){this._events[t]=r=[];if(e||i){for(c=0,f=n.length;c<f;c++){s=n[c];if(e&&e!==s.callback&&e!==s.callback._callback||i&&i!==s.context){r.push(s)}}}if(!r.length)delete this._events[t]}}return this},trigger:function(t){if(!this._events)return this;var e=s.call(arguments,1);if(!l(this,"trigger",t,e))return this;var i=this._events[t];var r=this._events.all;if(i)c(i,e);if(r)c(r,arguments);return this},stopListening:function(t,e,i){var r=this._listeners;if(!r)return this;var s=!e&&!i;if(typeof e==="object")i=this;if(t)(r={})[t._listenerId]=t;for(var n in r){r[n].off(e,i,this);if(s)delete this._listeners[n]}return this}};var u=/\s+/;var l=function(t,e,i,r){if(!i)return true;if(typeof i==="object"){for(var s in i){t[e].apply(t,[s,i[s]].concat(r))}return false}if(u.test(i)){var n=i.split(u);for(var a=0,h=n.length;a<h;a++){t[e].apply(t,[n[a]].concat(r))}return false}return true};var c=function(t,e){var i,r=-1,s=t.length,n=e[0],a=e[1],h=e[2];switch(e.length){case 0:while(++r<s)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<s)(i=t[r]).callback.call(i.ctx,n);return;case 2:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a);return;case 3:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a,h);return;default:while(++r<s)(i=t[r]).callback.apply(i.ctx,e)}};var f={listenTo:"on",listenToOnce:"once"};h.each(f,function(t,e){o[e]=function(e,i,r){var s=this._listeners||(this._listeners={});var n=e._listenerId||(e._listenerId=h.uniqueId("l"));s[n]=e;if(typeof i==="object")r=this;e[t](i,r,this);return this}});o.bind=o.on;o.unbind=o.off;h.extend(a,o);var d=a.Model=function(t,e){var i;var r=t||{};e||(e={});this.cid=h.uniqueId("c");this.attributes={};h.extend(this,h.pick(e,p));if(e.parse)r=this.parse(r,e)||{};if(i=h.result(this,"defaults")){r=h.defaults({},r,i)}this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};var p=["url","urlRoot","collection"];h.extend(d.prototype,o,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(t){return h.clone(this.attributes)},sync:function(){return a.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return h.escape(this.get(t))},has:function(t){return this.get(t)!=null},set:function(t,e,i){var r,s,n,a,o,u,l,c;if(t==null)return this;if(typeof t==="object"){s=t;i=e}else{(s={})[t]=e}i||(i={});if(!this._validate(s,i))return false;n=i.unset;o=i.silent;a=[];u=this._changing;this._changing=true;if(!u){this._previousAttributes=h.clone(this.attributes);this.changed={}}c=this.attributes,l=this._previousAttributes;if(this.idAttribute in s)this.id=s[this.idAttribute];for(r in s){e=s[r];if(!h.isEqual(c[r],e))a.push(r);if(!h.isEqual(l[r],e)){this.changed[r]=e}else{delete this.changed[r]}n?delete c[r]:c[r]=e}if(!o){if(a.length)this._pending=true;for(var f=0,d=a.length;f<d;f++){this.trigger("change:"+a[f],this,c[a[f]],i)}}if(u)return this;if(!o){while(this._pending){this._pending=false;this.trigger("change",this,i)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,h.extend({},e,{unset:true}))},clear:function(t){var e={};for(var i in this.attributes)e[i]=void 0;return this.set(e,h.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!h.isEmpty(this.changed);return h.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?h.clone(this.changed):false;var e,i=false;var r=this._changing?this._previousAttributes:this.attributes;for(var s in t){if(h.isEqual(r[s],e=t[s]))continue;(i||(i={}))[s]=e}return i},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return h.clone(this._previousAttributes)},fetch:function(t){t=t?h.clone(t):{};if(t.parse===void 0)t.parse=true;var e=this;var i=t.success;t.success=function(r){if(!e.set(e.parse(r,t),t))return false;if(i)i(e,r,t);e.trigger("sync",e,r,t)};R(this,t);return this.sync("read",this,t)},save:function(t,e,i){var r,s,n,a=this.attributes;if(t==null||typeof t==="object"){r=t;i=e}else{(r={})[t]=e}if(r&&(!i||!i.wait)&&!this.set(r,i))return false;i=h.extend({validate:true},i);if(!this._validate(r,i))return false;if(r&&i.wait){this.attributes=h.extend({},a,r)}if(i.parse===void 0)i.parse=true;var o=this;var u=i.success;i.success=function(t){o.attributes=a;var e=o.parse(t,i);if(i.wait)e=h.extend(r||{},e);if(h.isObject(e)&&!o.set(e,i)){return false}if(u)u(o,t,i);o.trigger("sync",o,t,i)};R(this,i);s=this.isNew()?"create":i.patch?"patch":"update";if(s==="patch")i.attrs=r;n=this.sync(s,this,i);if(r&&i.wait)this.attributes=a;return n},destroy:function(t){t=t?h.clone(t):{};var e=this;var i=t.success;var r=function(){e.trigger("destroy",e,e.collection,t)};t.success=function(s){if(t.wait||e.isNew())r();if(i)i(e,s,t);if(!e.isNew())e.trigger("sync",e,s,t)};if(this.isNew()){t.success();return false}R(this,t);var s=this.sync("delete",this,t);if(!t.wait)r();return s},url:function(){var t=h.result(this,"urlRoot")||h.result(this.collection,"url")||U();if(this.isNew())return t;return t+(t.charAt(t.length-1)==="/"?"":"/")+encodeURIComponent(this.id)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return this.id==null},isValid:function(t){return this._validate({},h.extend(t||{},{validate:true}))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=h.extend({},this.attributes,t);var i=this.validationError=this.validate(t,e)||null;if(!i)return true;this.trigger("invalid",this,i,h.extend(e||{},{validationError:i}));return false}});var v=["keys","values","pairs","invert","pick","omit"];h.each(v,function(t){d.prototype[t]=function(){var e=s.call(arguments);e.unshift(this.attributes);return h[t].apply(h,e)}});var g=a.Collection=function(t,e){e||(e={});if(e.url)this.url=e.url;if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,h.extend({silent:true},e))};var m={add:true,remove:true,merge:true};var y={add:true,merge:false,remove:false};h.extend(g.prototype,o,{model:d,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return a.sync.apply(this,arguments)},add:function(t,e){return this.set(t,h.defaults(e||{},y))},remove:function(t,e){t=h.isArray(t)?t.slice():[t];e||(e={});var i,r,s,n;for(i=0,r=t.length;i<r;i++){n=this.get(t[i]);if(!n)continue;delete this._byId[n.id];delete this._byId[n.cid];s=this.indexOf(n);this.models.splice(s,1);this.length--;if(!e.silent){e.index=s;n.trigger("remove",n,this,e)}this._removeReference(n)}return this},set:function(t,e){e=h.defaults(e||{},m);if(e.parse)t=this.parse(t,e);if(!h.isArray(t))t=t?[t]:[];var i,s,a,o,u,l;var c=e.at;var f=this.comparator&&c==null&&e.sort!==false;var d=h.isString(this.comparator)?this.comparator:null;var p=[],v=[],g={};for(i=0,s=t.length;i<s;i++){if(!(a=this._prepareModel(t[i],e)))continue;if(u=this.get(a)){if(e.remove)g[u.cid]=true;if(e.merge){u.set(a.attributes,e);if(f&&!l&&u.hasChanged(d))l=true}}else if(e.add){p.push(a);a.on("all",this._onModelEvent,this);this._byId[a.cid]=a;if(a.id!=null)this._byId[a.id]=a}}if(e.remove){for(i=0,s=this.length;i<s;++i){if(!g[(a=this.models[i]).cid])v.push(a)}if(v.length)this.remove(v,e)}if(p.length){if(f)l=true;this.length+=p.length;if(c!=null){n.apply(this.models,[c,0].concat(p))}else{r.apply(this.models,p)}}if(l)this.sort({silent:true});if(e.silent)return this;for(i=0,s=p.length;i<s;i++){(a=p[i]).trigger("add",a,this,e)}if(l)this.trigger("sort",this,e);return this},reset:function(t,e){e||(e={});for(var i=0,r=this.models.length;i<r;i++){this._removeReference(this.models[i])}e.previousModels=this.models;this._reset();this.add(t,h.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return this},push:function(t,e){t=this._prepareModel(t,e);this.add(t,h.extend({at:this.length},e));return t},pop:function(t){var e=this.at(this.length-1);this.remove(e,t);return e},unshift:function(t,e){t=this._prepareModel(t,e);this.add(t,h.extend({at:0},e));return t},shift:function(t){var e=this.at(0);this.remove(e,t);return e},slice:function(t,e){return this.models.slice(t,e)},get:function(t){if(t==null)return void 0;return this._byId[t.id!=null?t.id:t.cid||t]},at:function(t){return this.models[t]},where:function(t,e){if(h.isEmpty(t))return e?void 0:[];return this[e?"find":"filter"](function(e){for(var i in t){if(t[i]!==e.get(i))return false}return true})},findWhere:function(t){return this.where(t,true)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");t||(t={});if(h.isString(this.comparator)||this.comparator.length===1){this.models=this.sortBy(this.comparator,this)}else{this.models.sort(h.bind(this.comparator,this))}if(!t.silent)this.trigger("sort",this,t);return this},sortedIndex:function(t,e,i){e||(e=this.comparator);var r=h.isFunction(e)?e:function(t){return t.get(e)};return h.sortedIndex(this.models,t,r,i)},pluck:function(t){return h.invoke(this.models,"get",t)},fetch:function(t){t=t?h.clone(t):{};if(t.parse===void 0)t.parse=true;var e=t.success;var i=this;t.success=function(r){var s=t.reset?"reset":"set";i[s](r,t);if(e)e(i,r,t);i.trigger("sync",i,r,t)};R(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?h.clone(e):{};if(!(t=this._prepareModel(t,e)))return false;if(!e.wait)this.add(t,e);var i=this;var r=e.success;e.success=function(s){if(e.wait)i.add(t,e);if(r)r(t,s,e)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(t instanceof d){if(!t.collection)t.collection=this;return t}e||(e={});e.collection=this;var i=new this.model(t,e);if(!i._validate(t,e)){this.trigger("invalid",this,t,e);return false}return i},_removeReference:function(t){if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(e&&t==="change:"+e.idAttribute){delete this._byId[e.previous(e.idAttribute)];if(e.id!=null)this._byId[e.id]=e}this.trigger.apply(this,arguments)}});var _=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","indexOf","shuffle","lastIndexOf","isEmpty","chain"];h.each(_,function(t){g.prototype[t]=function(){var e=s.call(arguments);e.unshift(this.models);return h[t].apply(h,e)}});var w=["groupBy","countBy","sortBy"];h.each(w,function(t){g.prototype[t]=function(e,i){var r=h.isFunction(e)?e:function(t){return t.get(e)};return h[t](this.models,r,i)}});var b=a.View=function(t){this.cid=h.uniqueId("view");this._configure(t||{});this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()};var x=/^(\S+)\s*(.*)$/;var E=["model","collection","el","id","attributes","className","tagName","events"];h.extend(b.prototype,o,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();this.stopListening();return this},setElement:function(t,e){if(this.$el)this.undelegateEvents();this.$el=t instanceof a.$?t:a.$(t);this.el=this.$el[0];if(e!==false)this.delegateEvents();return this},delegateEvents:function(t){if(!(t||(t=h.result(this,"events"))))return this;this.undelegateEvents();for(var e in t){var i=t[e];if(!h.isFunction(i))i=this[t[e]];if(!i)continue;var r=e.match(x);var s=r[1],n=r[2];i=h.bind(i,this);s+=".delegateEvents"+this.cid;if(n===""){this.$el.on(s,i)}else{this.$el.on(s,n,i)}}return this},undelegateEvents:function(){this.$el.off(".delegateEvents"+this.cid);return this},_configure:function(t){if(this.options)t=h.extend({},h.result(this,"options"),t);h.extend(this,h.pick(t,E));this.options=t},_ensureElement:function(){if(!this.el){var t=h.extend({},h.result(this,"attributes"));if(this.id)t.id=h.result(this,"id");if(this.className)t["class"]=h.result(this,"className");var e=a.$("<"+h.result(this,"tagName")+">").attr(t);this.setElement(e,false)}else{this.setElement(h.result(this,"el"),false)}}});a.sync=function(t,e,i){var r=k[t];h.defaults(i||(i={}),{emulateHTTP:a.emulateHTTP,emulateJSON:a.emulateJSON});var s={type:r,dataType:"json"};if(!i.url){s.url=h.result(e,"url")||U()}if(i.data==null&&e&&(t==="create"||t==="update"||t==="patch")){s.contentType="application/json";s.data=JSON.stringify(i.attrs||e.toJSON(i))}if(i.emulateJSON){s.contentType="application/x-www-form-urlencoded";s.data=s.data?{model:s.data}:{}}if(i.emulateHTTP&&(r==="PUT"||r==="DELETE"||r==="PATCH")){s.type="POST";if(i.emulateJSON)s.data._method=r;var n=i.beforeSend;i.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",r);if(n)return n.apply(this,arguments)}}if(s.type!=="GET"&&!i.emulateJSON){s.processData=false}if(s.type==="PATCH"&&window.ActiveXObject&&!(window.external&&window.external.msActiveXFilteringEnabled)){s.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var o=i.xhr=a.ajax(h.extend(s,i));e.trigger("request",e,o,i);return o};var k={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};a.ajax=function(){return a.$.ajax.apply(a.$,arguments)};var S=a.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var $=/\((.*?)\)/g;var T=/(\(\?)?:\w+/g;var H=/\*\w+/g;var A=/[\-{}\[\]+?.,\\\^$|#\s]/g;h.extend(S.prototype,o,{initialize:function(){},route:function(t,e,i){if(!h.isRegExp(t))t=this._routeToRegExp(t);if(h.isFunction(e)){i=e;e=""}if(!i)i=this[e];var r=this;a.history.route(t,function(s){var n=r._extractParameters(t,s);i&&i.apply(r,n);r.trigger.apply(r,["route:"+e].concat(n));r.trigger("route",e,n);a.history.trigger("route",r,e,n)});return this},navigate:function(t,e){a.history.navigate(t,e);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=h.result(this,"routes");var t,e=h.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(A,"\\$&").replace($,"(?:$1)?").replace(T,function(t,e){return e?t:"([^/]+)"}).replace(H,"(.*?)");return new RegExp("^"+t+"$")},_extractParameters:function(t,e){var i=t.exec(e).slice(1);return h.map(i,function(t){return t?decodeURIComponent(t):null})}});var I=a.History=function(){this.handlers=[];h.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var N=/^[#\/]|\s+$/g;var P=/^\/+|\/+$/g;var O=/msie [\w.]+/;var C=/\/$/;I.started=false;h.extend(I.prototype,o,{interval:50,getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=this.location.pathname;var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.substr(i.length)}else{t=this.getHash()}}return t.replace(N,"")},start:function(t){if(I.started)throw new Error("Backbone.history has already been started");I.started=true;this.options=h.extend({},{root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var e=this.getFragment();var i=document.documentMode;var r=O.exec(navigator.userAgent.toLowerCase())&&(!i||i<=7);this.root=("/"+this.root+"/").replace(P,"/");if(r&&this._wantsHashChange){this.iframe=a.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow;this.navigate(e)}if(this._hasPushState){a.$(window).on("popstate",this.checkUrl)}else if(this._wantsHashChange&&"onhashchange"in window&&!r){a.$(window).on("hashchange",this.checkUrl)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}this.fragment=e;var s=this.location;var n=s.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!n){this.fragment=this.getFragment(null,true);this.location.replace(this.root+this.location.search+"#"+this.fragment);return true}else if(this._wantsPushState&&this._hasPushState&&n&&s.hash){this.fragment=this.getHash().replace(N,"");this.history.replaceState({},document.title,this.root+this.fragment+s.search)}if(!this.options.silent)return this.loadUrl()},stop:function(){a.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl);clearInterval(this._checkUrlInterval);I.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getFragment(this.getHash(this.iframe))}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(t){var e=this.fragment=this.getFragment(t);var i=h.any(this.handlers,function(t){if(t.route.test(e)){t.callback(e);return true}});return i},navigate:function(t,e){if(!I.started)return false;if(!e||e===true)e={trigger:e};t=this.getFragment(t||"");if(this.fragment===t)return;this.fragment=t;var i=this.root+t;if(this._hasPushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,i)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getFragment(this.getHash(this.iframe))){if(!e.replace)this.iframe.document.open().close();this._updateHash(this.iframe.location,t,e.replace)}}else{return this.location.assign(i)}if(e.trigger)this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});a.history=new I;var j=function(t,e){var i=this;var r;if(t&&h.has(t,"constructor")){r=t.constructor}else{r=function(){return i.apply(this,arguments)}}h.extend(r,i,e);var s=function(){this.constructor=r};s.prototype=i.prototype;r.prototype=new s;if(t)h.extend(r.prototype,t);r.__super__=i.prototype;return r};d.extend=g.extend=S.extend=b.extend=I.extend=j;var U=function(){throw new Error('A "url" property or function must be specified')};var R=function(t,e){var i=e.error;e.error=function(r){if(i)i(t,r,e);t.trigger("error",t,r,e)}}}).call(this);
@(function(){var t=this;var e=t.Backbone;var i=[];var r=i.push;var s=i.slice;var n=i.splice;var a;if(typeof exports!=="undefined"){a=exports}else{a=t.Backbone={}}a.VERSION="1.1.0";var h=t._;if(!h&&typeof require!=="undefined")h=require("underscore");a.$=t.jQuery||t.Zepto||t.ender||t.$;a.noConflict=function(){t.Backbone=e;return this};a.emulateHTTP=false;a.emulateJSON=false;var o=a.Events={on:function(t,e,i){if(!l(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,i){if(!l(this,"once",t,[e,i])||!e)return this;var r=this;var s=h.once(function(){r.off(t,s);e.apply(this,arguments)});s._callback=e;return this.on(t,s,i)},off:function(t,e,i){var r,s,n,a,o,u,c,f;if(!this._events||!l(this,"off",t,[e,i]))return this;if(!t&&!e&&!i){this._events={};return this}a=t?[t]:h.keys(this._events);for(o=0,u=a.length;o<u;o++){t=a[o];if(n=this._events[t]){this._events[t]=r=[];if(e||i){for(c=0,f=n.length;c<f;c++){s=n[c];if(e&&e!==s.callback&&e!==s.callback._callback||i&&i!==s.context){r.push(s)}}}if(!r.length)delete this._events[t]}}return this},trigger:function(t){if(!this._events)return this;var e=s.call(arguments,1);if(!l(this,"trigger",t,e))return this;var i=this._events[t];var r=this._events.all;if(i)c(i,e);if(r)c(r,arguments);return this},stopListening:function(t,e,i){var r=this._listeningTo;if(!r)return this;var s=!e&&!i;if(!i&&typeof e==="object")i=this;if(t)(r={})[t._listenId]=t;for(var n in r){t=r[n];t.off(e,i,this);if(s||h.isEmpty(t._events))delete this._listeningTo[n]}return this}};var u=/\s+/;var l=function(t,e,i,r){if(!i)return true;if(typeof i==="object"){for(var s in i){t[e].apply(t,[s,i[s]].concat(r))}return false}if(u.test(i)){var n=i.split(u);for(var a=0,h=n.length;a<h;a++){t[e].apply(t,[n[a]].concat(r))}return false}return true};var c=function(t,e){var i,r=-1,s=t.length,n=e[0],a=e[1],h=e[2];switch(e.length){case 0:while(++r<s)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<s)(i=t[r]).callback.call(i.ctx,n);return;case 2:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a);return;case 3:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a,h);return;default:while(++r<s)(i=t[r]).callback.apply(i.ctx,e)}};var f={listenTo:"on",listenToOnce:"once"};h.each(f,function(t,e){o[e]=function(e,i,r){var s=this._listeningTo||(this._listeningTo={});var n=e._listenId||(e._listenId=h.uniqueId("l"));s[n]=e;if(!r&&typeof i==="object")r=this;e[t](i,r,this);return this}});o.bind=o.on;o.unbind=o.off;h.extend(a,o);var d=a.Model=function(t,e){var i=t||{};e||(e={});this.cid=h.uniqueId("c");this.attributes={};if(e.collection)this.collection=e.collection;if(e.parse)i=this.parse(i,e)||{};i=h.defaults({},i,h.result(this,"defaults"));this.set(i,e);this.changed={};this.initialize.apply(this,arguments)};h.extend(d.prototype,o,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(t){return h.clone(this.attributes)},sync:function(){return a.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return h.escape(this.get(t))},has:function(t){return this.get(t)!=null},set:function(t,e,i){var r,s,n,a,o,u,l,c;if(t==null)return this;if(typeof t==="object"){s=t;i=e}else{(s={})[t]=e}i||(i={});if(!this._validate(s,i))return false;n=i.unset;o=i.silent;a=[];u=this._changing;this._changing=true;if(!u){this._previousAttributes=h.clone(this.attributes);this.changed={}}c=this.attributes,l=this._previousAttributes;if(this.idAttribute in s)this.id=s[this.idAttribute];for(r in s){e=s[r];if(!h.isEqual(c[r],e))a.push(r);if(!h.isEqual(l[r],e)){this.changed[r]=e}else{delete this.changed[r]}n?delete c[r]:c[r]=e}if(!o){if(a.length)this._pending=true;for(var f=0,d=a.length;f<d;f++){this.trigger("change:"+a[f],this,c[a[f]],i)}}if(u)return this;if(!o){while(this._pending){this._pending=false;this.trigger("change",this,i)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,h.extend({},e,{unset:true}))},clear:function(t){var e={};for(var i in this.attributes)e[i]=void 0;return this.set(e,h.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!h.isEmpty(this.changed);return h.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?h.clone(this.changed):false;var e,i=false;var r=this._changing?this._previousAttributes:this.attributes;for(var s in t){if(h.isEqual(r[s],e=t[s]))continue;(i||(i={}))[s]=e}return i},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return h.clone(this._previousAttributes)},fetch:function(t){t=t?h.clone(t):{};if(t.parse===void 0)t.parse=true;var e=this;var i=t.success;t.success=function(r){if(!e.set(e.parse(r,t),t))return false;if(i)i(e,r,t);e.trigger("sync",e,r,t)};M(this,t);return this.sync("read",this,t)},save:function(t,e,i){var r,s,n,a=this.attributes;if(t==null||typeof t==="object"){r=t;i=e}else{(r={})[t]=e}i=h.extend({validate:true},i);if(r&&!i.wait){if(!this.set(r,i))return false}else{if(!this._validate(r,i))return false}if(r&&i.wait){this.attributes=h.extend({},a,r)}if(i.parse===void 0)i.parse=true;var o=this;var u=i.success;i.success=function(t){o.attributes=a;var e=o.parse(t,i);if(i.wait)e=h.extend(r||{},e);if(h.isObject(e)&&!o.set(e,i)){return false}if(u)u(o,t,i);o.trigger("sync",o,t,i)};M(this,i);s=this.isNew()?"create":i.patch?"patch":"update";if(s==="patch")i.attrs=r;n=this.sync(s,this,i);if(r&&i.wait)this.attributes=a;return n},destroy:function(t){t=t?h.clone(t):{};var e=this;var i=t.success;var r=function(){e.trigger("destroy",e,e.collection,t)};t.success=function(s){if(t.wait||e.isNew())r();if(i)i(e,s,t);if(!e.isNew())e.trigger("sync",e,s,t)};if(this.isNew()){t.success();return false}M(this,t);var s=this.sync("delete",this,t);if(!t.wait)r();return s},url:function(){var t=h.result(this,"urlRoot")||h.result(this.collection,"url")||U();if(this.isNew())return t;return t+(t.charAt(t.length-1)==="/"?"":"/")+encodeURIComponent(this.id)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return this.id==null},isValid:function(t){return this._validate({},h.extend(t||{},{validate:true}))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=h.extend({},this.attributes,t);var i=this.validationError=this.validate(t,e)||null;if(!i)return true;this.trigger("invalid",this,i,h.extend(e,{validationError:i}));return false}});var p=["keys","values","pairs","invert","pick","omit"];h.each(p,function(t){d.prototype[t]=function(){var e=s.call(arguments);e.unshift(this.attributes);return h[t].apply(h,e)}});var v=a.Collection=function(t,e){e||(e={});if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,h.extend({silent:true},e))};var g={add:true,remove:true,merge:true};var m={add:true,remove:false};h.extend(v.prototype,o,{model:d,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return a.sync.apply(this,arguments)},add:function(t,e){return this.set(t,h.extend({merge:false},e,m))},remove:function(t,e){var i=!h.isArray(t);t=i?[t]:h.clone(t);e||(e={});var r,s,n,a;for(r=0,s=t.length;r<s;r++){a=t[r]=this.get(t[r]);if(!a)continue;delete this._byId[a.id];delete this._byId[a.cid];n=this.indexOf(a);this.models.splice(n,1);this.length--;if(!e.silent){e.index=n;a.trigger("remove",a,this,e)}this._removeReference(a)}return i?t[0]:t},set:function(t,e){e=h.defaults({},e,g);if(e.parse)t=this.parse(t,e);var i=!h.isArray(t);t=i?t?[t]:[]:h.clone(t);var r,s,n,a,o,u,l;var c=e.at;var f=this.model;var p=this.comparator&&c==null&&e.sort!==false;var v=h.isString(this.comparator)?this.comparator:null;var m=[],y=[],_={};var w=e.add,b=e.merge,x=e.remove;var E=!p&&w&&x?[]:false;for(r=0,s=t.length;r<s;r++){o=t[r];if(o instanceof d){n=a=o}else{n=o[f.prototype.idAttribute]}if(u=this.get(n)){if(x)_[u.cid]=true;if(b){o=o===a?a.attributes:o;if(e.parse)o=u.parse(o,e);u.set(o,e);if(p&&!l&&u.hasChanged(v))l=true}t[r]=u}else if(w){a=t[r]=this._prepareModel(o,e);if(!a)continue;m.push(a);a.on("all",this._onModelEvent,this);this._byId[a.cid]=a;if(a.id!=null)this._byId[a.id]=a}if(E)E.push(u||a)}if(x){for(r=0,s=this.length;r<s;++r){if(!_[(a=this.models[r]).cid])y.push(a)}if(y.length)this.remove(y,e)}if(m.length||E&&E.length){if(p)l=true;this.length+=m.length;if(c!=null){for(r=0,s=m.length;r<s;r++){this.models.splice(c+r,0,m[r])}}else{if(E)this.models.length=0;var T=E||m;for(r=0,s=T.length;r<s;r++){this.models.push(T[r])}}}if(l)this.sort({silent:true});if(!e.silent){for(r=0,s=m.length;r<s;r++){(a=m[r]).trigger("add",a,this,e)}if(l||E&&E.length)this.trigger("sort",this,e)}return i?t[0]:t},reset:function(t,e){e||(e={});for(var i=0,r=this.models.length;i<r;i++){this._removeReference(this.models[i])}e.previousModels=this.models;this._reset();t=this.add(t,h.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return t},push:function(t,e){return this.add(t,h.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);this.remove(e,t);return e},unshift:function(t,e){return this.add(t,h.extend({at:0},e))},shift:function(t){var e=this.at(0);this.remove(e,t);return e},slice:function(){return s.apply(this.models,arguments)},get:function(t){if(t==null)return void 0;return this._byId[t.id]||this._byId[t.cid]||this._byId[t]},at:function(t){return this.models[t]},where:function(t,e){if(h.isEmpty(t))return e?void 0:[];return this[e?"find":"filter"](function(e){for(var i in t){if(t[i]!==e.get(i))return false}return true})},findWhere:function(t){return this.where(t,true)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");t||(t={});if(h.isString(this.comparator)||this.comparator.length===1){this.models=this.sortBy(this.comparator,this)}else{this.models.sort(h.bind(this.comparator,this))}if(!t.silent)this.trigger("sort",this,t);return this},pluck:function(t){return h.invoke(this.models,"get",t)},fetch:function(t){t=t?h.clone(t):{};if(t.parse===void 0)t.parse=true;var e=t.success;var i=this;t.success=function(r){var s=t.reset?"reset":"set";i[s](r,t);if(e)e(i,r,t);i.trigger("sync",i,r,t)};M(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?h.clone(e):{};if(!(t=this._prepareModel(t,e)))return false;if(!e.wait)this.add(t,e);var i=this;var r=e.success;e.success=function(t,e,s){if(s.wait)i.add(t,s);if(r)r(t,e,s)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(t instanceof d){if(!t.collection)t.collection=this;return t}e=e?h.clone(e):{};e.collection=this;var i=new this.model(t,e);if(!i.validationError)return i;this.trigger("invalid",this,i.validationError,e);return false},_removeReference:function(t){if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(e&&t==="change:"+e.idAttribute){delete this._byId[e.previous(e.idAttribute)];if(e.id!=null)this._byId[e.id]=e}this.trigger.apply(this,arguments)}});var y=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain"];h.each(y,function(t){v.prototype[t]=function(){var e=s.call(arguments);e.unshift(this.models);return h[t].apply(h,e)}});var _=["groupBy","countBy","sortBy"];h.each(_,function(t){v.prototype[t]=function(e,i){var r=h.isFunction(e)?e:function(t){return t.get(e)};return h[t](this.models,r,i)}});var w=a.View=function(t){this.cid=h.uniqueId("view");t||(t={});h.extend(this,h.pick(t,x));this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()};var b=/^(\S+)\s*(.*)$/;var x=["model","collection","el","id","attributes","className","tagName","events"];h.extend(w.prototype,o,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();this.stopListening();return this},setElement:function(t,e){if(this.$el)this.undelegateEvents();this.$el=t instanceof a.$?t:a.$(t);this.el=this.$el[0];if(e!==false)this.delegateEvents();return this},delegateEvents:function(t){if(!(t||(t=h.result(this,"events"))))return this;this.undelegateEvents();for(var e in t){var i=t[e];if(!h.isFunction(i))i=this[t[e]];if(!i)continue;var r=e.match(b);var s=r[1],n=r[2];i=h.bind(i,this);s+=".delegateEvents"+this.cid;if(n===""){this.$el.on(s,i)}else{this.$el.on(s,n,i)}}return this},undelegateEvents:function(){this.$el.off(".delegateEvents"+this.cid);return this},_ensureElement:function(){if(!this.el){var t=h.extend({},h.result(this,"attributes"));if(this.id)t.id=h.result(this,"id");if(this.className)t["class"]=h.result(this,"className");var e=a.$("<"+h.result(this,"tagName")+">").attr(t);this.setElement(e,false)}else{this.setElement(h.result(this,"el"),false)}}});a.sync=function(t,e,i){var r=T[t];h.defaults(i||(i={}),{emulateHTTP:a.emulateHTTP,emulateJSON:a.emulateJSON});var s={type:r,dataType:"json"};if(!i.url){s.url=h.result(e,"url")||U()}if(i.data==null&&e&&(t==="create"||t==="update"||t==="patch")){s.contentType="application/json";s.data=JSON.stringify(i.attrs||e.toJSON(i))}if(i.emulateJSON){s.contentType="application/x-www-form-urlencoded";s.data=s.data?{model:s.data}:{}}if(i.emulateHTTP&&(r==="PUT"||r==="DELETE"||r==="PATCH")){s.type="POST";if(i.emulateJSON)s.data._method=r;var n=i.beforeSend;i.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",r);if(n)return n.apply(this,arguments)}}if(s.type!=="GET"&&!i.emulateJSON){s.processData=false}if(s.type==="PATCH"&&E){s.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var o=i.xhr=a.ajax(h.extend(s,i));e.trigger("request",e,o,i);return o};var E=typeof window!=="undefined"&&!!window.ActiveXObject&&!(window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent);var T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};a.ajax=function(){return a.$.ajax.apply(a.$,arguments)};var k=a.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var S=/\((.*?)\)/g;var $=/(\(\?)?:\w+/g;var H=/\*\w+/g;var A=/[\-{}\[\]+?.,\\\^$|#\s]/g;h.extend(k.prototype,o,{initialize:function(){},route:function(t,e,i){if(!h.isRegExp(t))t=this._routeToRegExp(t);if(h.isFunction(e)){i=e;e=""}if(!i)i=this[e];var r=this;a.history.route(t,function(s){var n=r._extractParameters(t,s);i&&i.apply(r,n);r.trigger.apply(r,["route:"+e].concat(n));r.trigger("route",e,n);a.history.trigger("route",r,e,n)});return this},navigate:function(t,e){a.history.navigate(t,e);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=h.result(this,"routes");var t,e=h.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(A,"\\$&").replace(S,"(?:$1)?").replace($,function(t,e){return e?t:"([^/]+)"}).replace(H,"(.*?)");return new RegExp("^"+t+"$")},_extractParameters:function(t,e){var i=t.exec(e).slice(1);return h.map(i,function(t){return t?decodeURIComponent(t):null})}});var I=a.History=function(){this.handlers=[];h.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var N=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var P=/msie [\w.]+/;var C=/\/$/;var j=/[?#].*$/;I.started=false;h.extend(I.prototype,o,{interval:50,getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=this.location.pathname;var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.slice(i.length)}else{t=this.getHash()}}return t.replace(N,"")},start:function(t){if(I.started)throw new Error("Backbone.history has already been started");I.started=true;this.options=h.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var e=this.getFragment();var i=document.documentMode;var r=P.exec(navigator.userAgent.toLowerCase())&&(!i||i<=7);this.root=("/"+this.root+"/").replace(O,"/");if(r&&this._wantsHashChange){this.iframe=a.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow;this.navigate(e)}if(this._hasPushState){a.$(window).on("popstate",this.checkUrl)}else if(this._wantsHashChange&&"onhashchange"in window&&!r){a.$(window).on("hashchange",this.checkUrl)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}this.fragment=e;var s=this.location;var n=s.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!n){this.fragment=this.getFragment(null,true);this.location.replace(this.root+this.location.search+"#"+this.fragment);return true}else if(this._hasPushState&&n&&s.hash){this.fragment=this.getHash().replace(N,"");this.history.replaceState({},document.title,this.root+this.fragment+s.search)}}if(!this.options.silent)return this.loadUrl()},stop:function(){a.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl);clearInterval(this._checkUrlInterval);I.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getFragment(this.getHash(this.iframe))}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){t=this.fragment=this.getFragment(t);return h.any(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!I.started)return false;if(!e||e===true)e={trigger:!!e};var i=this.root+(t=this.getFragment(t||""));t=t.replace(j,"");if(this.fragment===t)return;this.fragment=t;if(t===""&&i!=="/")i=i.slice(0,-1);if(this._hasPushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,i)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getFragment(this.getHash(this.iframe))){if(!e.replace)this.iframe.document.open().close();this._updateHash(this.iframe.location,t,e.replace)}}else{return this.location.assign(i)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});a.history=new I;var R=function(t,e){var i=this;var r;if(t&&h.has(t,"constructor")){r=t.constructor}else{r=function(){return i.apply(this,arguments)}}h.extend(r,i,e);var s=function(){this.constructor=r};s.prototype=i.prototype;r.prototype=new s;if(t)h.extend(r.prototype,t);r.__super__=i.prototype;return r};d.extend=v.extend=k.extend=w.extend=I.extend=R;var U=function(){throw new Error('A "url" property or function must be specified')};var M=function(t,e){var i=e.error;e.error=function(r){if(i)i(t,r,e);t.trigger("error",t,r,e)}}}).call(this);
@(function(t,e){if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,s){t.Backbone=e(t,s,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore"),r;try{r=require("jquery")}catch(s){}e(t,exports,i,r)}else{t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}})(this,function(t,e,i,r){var s=t.Backbone;var n=[];var a=n.push;var o=n.slice;var h=n.splice;e.VERSION="1.1.1";e.$=r;e.noConflict=function(){t.Backbone=s;return this};e.emulateHTTP=false;e.emulateJSON=false;var u=e.Events={on:function(t,e,i){if(!c(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,r){if(!c(this,"once",t,[e,r])||!e)return this;var s=this;var n=i.once(function(){s.off(t,n);e.apply(this,arguments)});n._callback=e;return this.on(t,n,r)},off:function(t,e,r){var s,n,a,o,h,u,l,f;if(!this._events||!c(this,"off",t,[e,r]))return this;if(!t&&!e&&!r){this._events=void 0;return this}o=t?[t]:i.keys(this._events);for(h=0,u=o.length;h<u;h++){t=o[h];if(a=this._events[t]){this._events[t]=s=[];if(e||r){for(l=0,f=a.length;l<f;l++){n=a[l];if(e&&e!==n.callback&&e!==n.callback._callback||r&&r!==n.context){s.push(n)}}}if(!s.length)delete this._events[t]}}return this},trigger:function(t){if(!this._events)return this;var e=o.call(arguments,1);if(!c(this,"trigger",t,e))return this;var i=this._events[t];var r=this._events.all;if(i)f(i,e);if(r)f(r,arguments);return this},stopListening:function(t,e,r){var s=this._listeningTo;if(!s)return this;var n=!e&&!r;if(!r&&typeof e==="object")r=this;if(t)(s={})[t._listenId]=t;for(var a in s){t=s[a];t.off(e,r,this);if(n||i.isEmpty(t._events))delete this._listeningTo[a]}return this}};var l=/\s+/;var c=function(t,e,i,r){if(!i)return true;if(typeof i==="object"){for(var s in i){t[e].apply(t,[s,i[s]].concat(r))}return false}if(l.test(i)){var n=i.split(l);for(var a=0,o=n.length;a<o;a++){t[e].apply(t,[n[a]].concat(r))}return false}return true};var f=function(t,e){var i,r=-1,s=t.length,n=e[0],a=e[1],o=e[2];switch(e.length){case 0:while(++r<s)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<s)(i=t[r]).callback.call(i.ctx,n);return;case 2:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a);return;case 3:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a,o);return;default:while(++r<s)(i=t[r]).callback.apply(i.ctx,e);return}};var d={listenTo:"on",listenToOnce:"once"};i.each(d,function(t,e){u[e]=function(e,r,s){var n=this._listeningTo||(this._listeningTo={});var a=e._listenId||(e._listenId=i.uniqueId("l"));n[a]=e;if(!s&&typeof r==="object")s=this;e[t](r,s,this);return this}});u.bind=u.on;u.unbind=u.off;i.extend(e,u);var p=e.Model=function(t,e){var r=t||{};e||(e={});this.cid=i.uniqueId("c");this.attributes={};if(e.collection)this.collection=e.collection;if(e.parse)r=this.parse(r,e)||{};r=i.defaults({},r,i.result(this,"defaults"));this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};i.extend(p.prototype,u,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return this.get(t)!=null},set:function(t,e,r){var s,n,a,o,h,u,l,c;if(t==null)return this;if(typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r||(r={});if(!this._validate(n,r))return false;a=r.unset;h=r.silent;o=[];u=this._changing;this._changing=true;if(!u){this._previousAttributes=i.clone(this.attributes);this.changed={}}c=this.attributes,l=this._previousAttributes;if(this.idAttribute in n)this.id=n[this.idAttribute];for(s in n){e=n[s];if(!i.isEqual(c[s],e))o.push(s);if(!i.isEqual(l[s],e)){this.changed[s]=e}else{delete this.changed[s]}a?delete c[s]:c[s]=e}if(!h){if(o.length)this._pending=r;for(var f=0,d=o.length;f<d;f++){this.trigger("change:"+o[f],this,c[o[f]],r)}}if(u)return this;if(!h){while(this._pending){r=this._pending;this._pending=false;this.trigger("change",this,r)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:true}))},clear:function(t){var e={};for(var r in this.attributes)e[r]=void 0;return this.set(e,i.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!i.isEmpty(this.changed);return i.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?i.clone(this.changed):false;var e,r=false;var s=this._changing?this._previousAttributes:this.attributes;for(var n in t){if(i.isEqual(s[n],e=t[n]))continue;(r||(r={}))[n]=e}return r},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=this;var r=t.success;t.success=function(i){if(!e.set(e.parse(i,t),t))return false;if(r)r(e,i,t);e.trigger("sync",e,i,t)};M(this,t);return this.sync("read",this,t)},save:function(t,e,r){var s,n,a,o=this.attributes;if(t==null||typeof t==="object"){s=t;r=e}else{(s={})[t]=e}r=i.extend({validate:true},r);if(s&&!r.wait){if(!this.set(s,r))return false}else{if(!this._validate(s,r))return false}if(s&&r.wait){this.attributes=i.extend({},o,s)}if(r.parse===void 0)r.parse=true;var h=this;var u=r.success;r.success=function(t){h.attributes=o;var e=h.parse(t,r);if(r.wait)e=i.extend(s||{},e);if(i.isObject(e)&&!h.set(e,r)){return false}if(u)u(h,t,r);h.trigger("sync",h,t,r)};M(this,r);n=this.isNew()?"create":r.patch?"patch":"update";if(n==="patch")r.attrs=s;a=this.sync(n,this,r);if(s&&r.wait)this.attributes=o;return a},destroy:function(t){t=t?i.clone(t):{};var e=this;var r=t.success;var s=function(){e.trigger("destroy",e,e.collection,t)};t.success=function(i){if(t.wait||e.isNew())s();if(r)r(e,i,t);if(!e.isNew())e.trigger("sync",e,i,t)};if(this.isNew()){t.success();return false}M(this,t);var n=this.sync("delete",this,t);if(!t.wait)s();return n},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||q();if(this.isNew())return t;return t.replace(/([^\/])$/,"$1/")+encodeURIComponent(this.id)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.extend(t||{},{validate:true}))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=i.extend({},this.attributes,t);var r=this.validationError=this.validate(t,e)||null;if(!r)return true;this.trigger("invalid",this,r,i.extend(e,{validationError:r}));return false}});var v=["keys","values","pairs","invert","pick","omit"];i.each(v,function(t){p.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.attributes);return i[t].apply(i,e)}});var g=e.Collection=function(t,e){e||(e={});if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,i.extend({silent:true},e))};var m={add:true,remove:true,merge:true};var y={add:true,remove:false};i.extend(g.prototype,u,{model:p,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:false},e,y))},remove:function(t,e){var r=!i.isArray(t);t=r?[t]:i.clone(t);e||(e={});var s,n,a,o;for(s=0,n=t.length;s<n;s++){o=t[s]=this.get(t[s]);if(!o)continue;delete this._byId[o.id];delete this._byId[o.cid];a=this.indexOf(o);this.models.splice(a,1);this.length--;if(!e.silent){e.index=a;o.trigger("remove",o,this,e)}this._removeReference(o,e)}return r?t[0]:t},set:function(t,e){e=i.defaults({},e,m);if(e.parse)t=this.parse(t,e);var r=!i.isArray(t);t=r?t?[t]:[]:i.clone(t);var s,n,a,o,h,u,l;var c=e.at;var f=this.model;var d=this.comparator&&c==null&&e.sort!==false;var v=i.isString(this.comparator)?this.comparator:null;var g=[],y=[],_={};var b=e.add,w=e.merge,x=e.remove;var E=!d&&b&&x?[]:false;for(s=0,n=t.length;s<n;s++){h=t[s]||{};if(h instanceof p){a=o=h}else{a=h[f.prototype.idAttribute||"id"]}if(u=this.get(a)){if(x)_[u.cid]=true;if(w){h=h===o?o.attributes:h;if(e.parse)h=u.parse(h,e);u.set(h,e);if(d&&!l&&u.hasChanged(v))l=true}t[s]=u}else if(b){o=t[s]=this._prepareModel(h,e);if(!o)continue;g.push(o);this._addReference(o,e)}o=u||o;if(E&&(o.isNew()||!_[o.id]))E.push(o);_[o.id]=true}if(x){for(s=0,n=this.length;s<n;++s){if(!_[(o=this.models[s]).cid])y.push(o)}if(y.length)this.remove(y,e)}if(g.length||E&&E.length){if(d)l=true;this.length+=g.length;if(c!=null){for(s=0,n=g.length;s<n;s++){this.models.splice(c+s,0,g[s])}}else{if(E)this.models.length=0;var k=E||g;for(s=0,n=k.length;s<n;s++){this.models.push(k[s])}}}if(l)this.sort({silent:true});if(!e.silent){for(s=0,n=g.length;s<n;s++){(o=g[s]).trigger("add",o,this,e)}if(l||E&&E.length)this.trigger("sort",this,e)}return r?t[0]:t},reset:function(t,e){e||(e={});for(var r=0,s=this.models.length;r<s;r++){this._removeReference(this.models[r],e)}e.previousModels=this.models;this._reset();t=this.add(t,i.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);this.remove(e,t);return e},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);this.remove(e,t);return e},slice:function(){return o.apply(this.models,arguments)},get:function(t){if(t==null)return void 0;return this._byId[t]||this._byId[t.id]||this._byId[t.cid]},at:function(t){return this.models[t]},where:function(t,e){if(i.isEmpty(t))return e?void 0:[];return this[e?"find":"filter"](function(e){for(var i in t){if(t[i]!==e.get(i))return false}return true})},findWhere:function(t){return this.where(t,true)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");t||(t={});if(i.isString(this.comparator)||this.comparator.length===1){this.models=this.sortBy(this.comparator,this)}else{this.models.sort(i.bind(this.comparator,this))}if(!t.silent)this.trigger("sort",this,t);return this},pluck:function(t){return i.invoke(this.models,"get",t)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=t.success;var r=this;t.success=function(i){var s=t.reset?"reset":"set";r[s](i,t);if(e)e(r,i,t);r.trigger("sync",r,i,t)};M(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};if(!(t=this._prepareModel(t,e)))return false;if(!e.wait)this.add(t,e);var r=this;var s=e.success;e.success=function(t,i){if(e.wait)r.add(t,e);if(s)s(t,i,e)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(t instanceof p)return t;e=e?i.clone(e):{};e.collection=this;var r=new this.model(t,e);if(!r.validationError)return r;this.trigger("invalid",this,r.validationError,e);return false},_addReference:function(t,e){this._byId[t.cid]=t;if(t.id!=null)this._byId[t.id]=t;if(!t.collection)t.collection=this;t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(e&&t==="change:"+e.idAttribute){delete this._byId[e.previous(e.idAttribute)];if(e.id!=null)this._byId[e.id]=e}this.trigger.apply(this,arguments)}});var _=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain","sample"];i.each(_,function(t){g.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.models);return i[t].apply(i,e)}});var b=["groupBy","countBy","sortBy","indexBy"];i.each(b,function(t){g.prototype[t]=function(e,r){var s=i.isFunction(e)?e:function(t){return t.get(e)};return i[t](this.models,s,r)}});var w=e.View=function(t){this.cid=i.uniqueId("view");t||(t={});i.extend(this,i.pick(t,E));this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()};var x=/^(\S+)\s*(.*)$/;var E=["model","collection","el","id","attributes","className","tagName","events"];i.extend(w.prototype,u,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();this.stopListening();return this},setElement:function(t,i){if(this.$el)this.undelegateEvents();this.$el=t instanceof e.$?t:e.$(t);this.el=this.$el[0];if(i!==false)this.delegateEvents();return this},delegateEvents:function(t){if(!(t||(t=i.result(this,"events"))))return this;this.undelegateEvents();for(var e in t){var r=t[e];if(!i.isFunction(r))r=this[t[e]];if(!r)continue;var s=e.match(x);var n=s[1],a=s[2];r=i.bind(r,this);n+=".delegateEvents"+this.cid;if(a===""){this.$el.on(n,r)}else{this.$el.on(n,a,r)}}return this},undelegateEvents:function(){this.$el.off(".delegateEvents"+this.cid);return this},_ensureElement:function(){if(!this.el){var t=i.extend({},i.result(this,"attributes"));if(this.id)t.id=i.result(this,"id");if(this.className)t["class"]=i.result(this,"className");var r=e.$("<"+i.result(this,"tagName")+">").attr(t);this.setElement(r,false)}else{this.setElement(i.result(this,"el"),false)}}});e.sync=function(t,r,s){var n=T[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:n,dataType:"json"};if(!s.url){a.url=i.result(r,"url")||q()}if(s.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(s.attrs||r.toJSON(s))}if(s.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(s.emulateHTTP&&(n==="PUT"||n==="DELETE"||n==="PATCH")){a.type="POST";if(s.emulateJSON)a.data._method=n;var o=s.beforeSend;s.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",n);if(o)return o.apply(this,arguments)}}if(a.type!=="GET"&&!s.emulateJSON){a.processData=false}if(a.type==="PATCH"&&k){a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var h=s.xhr=e.ajax(i.extend(a,s));r.trigger("request",r,h,s);return h};var k=typeof window!=="undefined"&&!!window.ActiveXObject&&!(window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent);var T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var $=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var S=/\((.*?)\)/g;var H=/(\(\?)?:\w+/g;var A=/\*\w+/g;var I=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend($.prototype,u,{initialize:function(){},route:function(t,r,s){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){s=r;r=""}if(!s)s=this[r];var n=this;e.history.route(t,function(i){var a=n._extractParameters(t,i);n.execute(s,a);n.trigger.apply(n,["route:"+r].concat(a));n.trigger("route",r,a);e.history.trigger("route",n,r,a)});return this},execute:function(t,e){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(I,"\\$&").replace(S,"(?:$1)?").replace(H,function(t,e){return e?t:"([^/?]+)"}).replace(A,"([^?]*?)");return new RegExp("^"+t+"(?:\\?(.*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var N=e.History=function(){this.handlers=[];i.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var R=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var P=/msie [\w.]+/;var j=/\/$/;var C=/#.*$/;N.started=false;i.extend(N.prototype,u,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=decodeURI(this.location.pathname+this.location.search);var i=this.root.replace(j,"");if(!t.indexOf(i))t=t.slice(i.length)}else{t=this.getHash()}}return t.replace(R,"")},start:function(t){if(N.started)throw new Error("Backbone.history has already been started");N.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var r=this.getFragment();var s=document.documentMode;var n=P.exec(navigator.userAgent.toLowerCase())&&(!s||s<=7);this.root=("/"+this.root+"/").replace(O,"/");if(n&&this._wantsHashChange){var a=e.$('<iframe src="javascript:0" tabindex="-1">');this.iframe=a.hide().appendTo("body")[0].contentWindow;this.navigate(r)}if(this._hasPushState){e.$(window).on("popstate",this.checkUrl)}else if(this._wantsHashChange&&"onhashchange"in window&&!n){e.$(window).on("hashchange",this.checkUrl)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}this.fragment=r;var o=this.location;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){this.fragment=this.getFragment(null,true);this.location.replace(this.root+"#"+this.fragment);return true}else if(this._hasPushState&&this.atRoot()&&o.hash){this.fragment=this.getHash().replace(R,"");this.history.replaceState({},document.title,this.root+this.fragment)}}if(!this.options.silent)return this.loadUrl()},stop:function(){e.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl);clearInterval(this._checkUrlInterval);N.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getFragment(this.getHash(this.iframe))}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){t=this.fragment=this.getFragment(t);return i.any(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!N.started)return false;if(!e||e===true)e={trigger:!!e};var i=this.root+(t=this.getFragment(t||""));t=t.replace(C,"");if(this.fragment===t)return;this.fragment=t;if(t===""&&i!=="/")i=i.slice(0,-1);if(this._hasPushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,i)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getFragment(this.getHash(this.iframe))){if(!e.replace)this.iframe.document.open().close();this._updateHash(this.iframe.location,t,e.replace)}}else{return this.location.assign(i)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new N;var U=function(t,e){var r=this;var s;if(t&&i.has(t,"constructor")){s=t.constructor}else{s=function(){return r.apply(this,arguments)}}i.extend(s,r,e);var n=function(){this.constructor=s};n.prototype=r.prototype;s.prototype=new n;if(t)i.extend(s.prototype,t);s.__super__=r.prototype;return s};p.extend=g.extend=$.extend=w.extend=N.extend=U;var q=function(){throw new Error('A "url" property or function must be specified')};var M=function(t,e){var i=e.error;e.error=function(r){if(i)i(t,r,e);t.trigger("error",t,r,e)}};return e});
@(function(t,e){if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,s){t.Backbone=e(t,s,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore");e(t,exports,i)}else{t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}})(this,function(t,e,i,r){var s=t.Backbone;var n=[];var a=n.push;var o=n.slice;var h=n.splice;e.VERSION="1.1.2";e.$=r;e.noConflict=function(){t.Backbone=s;return this};e.emulateHTTP=false;e.emulateJSON=false;var u=e.Events={on:function(t,e,i){if(!c(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,r){if(!c(this,"once",t,[e,r])||!e)return this;var s=this;var n=i.once(function(){s.off(t,n);e.apply(this,arguments)});n._callback=e;return this.on(t,n,r)},off:function(t,e,r){var s,n,a,o,h,u,l,f;if(!this._events||!c(this,"off",t,[e,r]))return this;if(!t&&!e&&!r){this._events=void 0;return this}o=t?[t]:i.keys(this._events);for(h=0,u=o.length;h<u;h++){t=o[h];if(a=this._events[t]){this._events[t]=s=[];if(e||r){for(l=0,f=a.length;l<f;l++){n=a[l];if(e&&e!==n.callback&&e!==n.callback._callback||r&&r!==n.context){s.push(n)}}}if(!s.length)delete this._events[t]}}return this},trigger:function(t){if(!this._events)return this;var e=o.call(arguments,1);if(!c(this,"trigger",t,e))return this;var i=this._events[t];var r=this._events.all;if(i)f(i,e);if(r)f(r,arguments);return this},stopListening:function(t,e,r){var s=this._listeningTo;if(!s)return this;var n=!e&&!r;if(!r&&typeof e==="object")r=this;if(t)(s={})[t._listenId]=t;for(var a in s){t=s[a];t.off(e,r,this);if(n||i.isEmpty(t._events))delete this._listeningTo[a]}return this}};var l=/\s+/;var c=function(t,e,i,r){if(!i)return true;if(typeof i==="object"){for(var s in i){t[e].apply(t,[s,i[s]].concat(r))}return false}if(l.test(i)){var n=i.split(l);for(var a=0,o=n.length;a<o;a++){t[e].apply(t,[n[a]].concat(r))}return false}return true};var f=function(t,e){var i,r=-1,s=t.length,n=e[0],a=e[1],o=e[2];switch(e.length){case 0:while(++r<s)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<s)(i=t[r]).callback.call(i.ctx,n);return;case 2:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a);return;case 3:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a,o);return;default:while(++r<s)(i=t[r]).callback.apply(i.ctx,e);return}};var d={listenTo:"on",listenToOnce:"once"};i.each(d,function(t,e){u[e]=function(e,r,s){var n=this._listeningTo||(this._listeningTo={});var a=e._listenId||(e._listenId=i.uniqueId("l"));n[a]=e;if(!s&&typeof r==="object")s=this;e[t](r,s,this);return this}});u.bind=u.on;u.unbind=u.off;i.extend(e,u);var p=e.Model=function(t,e){var r=t||{};e||(e={});this.cid=i.uniqueId("c");this.attributes={};if(e.collection)this.collection=e.collection;if(e.parse)r=this.parse(r,e)||{};r=i.defaults({},r,i.result(this,"defaults"));this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};i.extend(p.prototype,u,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return this.get(t)!=null},set:function(t,e,r){var s,n,a,o,h,u,l,c;if(t==null)return this;if(typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r||(r={});if(!this._validate(n,r))return false;a=r.unset;h=r.silent;o=[];u=this._changing;this._changing=true;if(!u){this._previousAttributes=i.clone(this.attributes);this.changed={}}c=this.attributes,l=this._previousAttributes;if(this.idAttribute in n)this.id=n[this.idAttribute];for(s in n){e=n[s];if(!i.isEqual(c[s],e))o.push(s);if(!i.isEqual(l[s],e)){this.changed[s]=e}else{delete this.changed[s]}a?delete c[s]:c[s]=e}if(!h){if(o.length)this._pending=r;for(var f=0,d=o.length;f<d;f++){this.trigger("change:"+o[f],this,c[o[f]],r)}}if(u)return this;if(!h){while(this._pending){r=this._pending;this._pending=false;this.trigger("change",this,r)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:true}))},clear:function(t){var e={};for(var r in this.attributes)e[r]=void 0;return this.set(e,i.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!i.isEmpty(this.changed);return i.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?i.clone(this.changed):false;var e,r=false;var s=this._changing?this._previousAttributes:this.attributes;for(var n in t){if(i.isEqual(s[n],e=t[n]))continue;(r||(r={}))[n]=e}return r},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=this;var r=t.success;t.success=function(i){if(!e.set(e.parse(i,t),t))return false;if(r)r(e,i,t);e.trigger("sync",e,i,t)};q(this,t);return this.sync("read",this,t)},save:function(t,e,r){var s,n,a,o=this.attributes;if(t==null||typeof t==="object"){s=t;r=e}else{(s={})[t]=e}r=i.extend({validate:true},r);if(s&&!r.wait){if(!this.set(s,r))return false}else{if(!this._validate(s,r))return false}if(s&&r.wait){this.attributes=i.extend({},o,s)}if(r.parse===void 0)r.parse=true;var h=this;var u=r.success;r.success=function(t){h.attributes=o;var e=h.parse(t,r);if(r.wait)e=i.extend(s||{},e);if(i.isObject(e)&&!h.set(e,r)){return false}if(u)u(h,t,r);h.trigger("sync",h,t,r)};q(this,r);n=this.isNew()?"create":r.patch?"patch":"update";if(n==="patch")r.attrs=s;a=this.sync(n,this,r);if(s&&r.wait)this.attributes=o;return a},destroy:function(t){t=t?i.clone(t):{};var e=this;var r=t.success;var s=function(){e.trigger("destroy",e,e.collection,t)};t.success=function(i){if(t.wait||e.isNew())s();if(r)r(e,i,t);if(!e.isNew())e.trigger("sync",e,i,t)};if(this.isNew()){t.success();return false}q(this,t);var n=this.sync("delete",this,t);if(!t.wait)s();return n},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||M();if(this.isNew())return t;return t.replace(/([^\/])$/,"$1/")+encodeURIComponent(this.id)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.extend(t||{},{validate:true}))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=i.extend({},this.attributes,t);var r=this.validationError=this.validate(t,e)||null;if(!r)return true;this.trigger("invalid",this,r,i.extend(e,{validationError:r}));return false}});var v=["keys","values","pairs","invert","pick","omit"];i.each(v,function(t){p.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.attributes);return i[t].apply(i,e)}});var g=e.Collection=function(t,e){e||(e={});if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,i.extend({silent:true},e))};var m={add:true,remove:true,merge:true};var y={add:true,remove:false};i.extend(g.prototype,u,{model:p,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:false},e,y))},remove:function(t,e){var r=!i.isArray(t);t=r?[t]:i.clone(t);e||(e={});var s,n,a,o;for(s=0,n=t.length;s<n;s++){o=t[s]=this.get(t[s]);if(!o)continue;delete this._byId[o.id];delete this._byId[o.cid];a=this.indexOf(o);this.models.splice(a,1);this.length--;if(!e.silent){e.index=a;o.trigger("remove",o,this,e)}this._removeReference(o,e)}return r?t[0]:t},set:function(t,e){e=i.defaults({},e,m);if(e.parse)t=this.parse(t,e);var r=!i.isArray(t);t=r?t?[t]:[]:i.clone(t);var s,n,a,o,h,u,l;var c=e.at;var f=this.model;var d=this.comparator&&c==null&&e.sort!==false;var v=i.isString(this.comparator)?this.comparator:null;var g=[],y=[],_={};var b=e.add,w=e.merge,x=e.remove;var E=!d&&b&&x?[]:false;for(s=0,n=t.length;s<n;s++){h=t[s]||{};if(h instanceof p){a=o=h}else{a=h[f.prototype.idAttribute||"id"]}if(u=this.get(a)){if(x)_[u.cid]=true;if(w){h=h===o?o.attributes:h;if(e.parse)h=u.parse(h,e);u.set(h,e);if(d&&!l&&u.hasChanged(v))l=true}t[s]=u}else if(b){o=t[s]=this._prepareModel(h,e);if(!o)continue;g.push(o);this._addReference(o,e)}o=u||o;if(E&&(o.isNew()||!_[o.id]))E.push(o);_[o.id]=true}if(x){for(s=0,n=this.length;s<n;++s){if(!_[(o=this.models[s]).cid])y.push(o)}if(y.length)this.remove(y,e)}if(g.length||E&&E.length){if(d)l=true;this.length+=g.length;if(c!=null){for(s=0,n=g.length;s<n;s++){this.models.splice(c+s,0,g[s])}}else{if(E)this.models.length=0;var k=E||g;for(s=0,n=k.length;s<n;s++){this.models.push(k[s])}}}if(l)this.sort({silent:true});if(!e.silent){for(s=0,n=g.length;s<n;s++){(o=g[s]).trigger("add",o,this,e)}if(l||E&&E.length)this.trigger("sort",this,e)}return r?t[0]:t},reset:function(t,e){e||(e={});for(var r=0,s=this.models.length;r<s;r++){this._removeReference(this.models[r],e)}e.previousModels=this.models;this._reset();t=this.add(t,i.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);this.remove(e,t);return e},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);this.remove(e,t);return e},slice:function(){return o.apply(this.models,arguments)},get:function(t){if(t==null)return void 0;return this._byId[t]||this._byId[t.id]||this._byId[t.cid]},at:function(t){return this.models[t]},where:function(t,e){if(i.isEmpty(t))return e?void 0:[];return this[e?"find":"filter"](function(e){for(var i in t){if(t[i]!==e.get(i))return false}return true})},findWhere:function(t){return this.where(t,true)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");t||(t={});if(i.isString(this.comparator)||this.comparator.length===1){this.models=this.sortBy(this.comparator,this)}else{this.models.sort(i.bind(this.comparator,this))}if(!t.silent)this.trigger("sort",this,t);return this},pluck:function(t){return i.invoke(this.models,"get",t)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=t.success;var r=this;t.success=function(i){var s=t.reset?"reset":"set";r[s](i,t);if(e)e(r,i,t);r.trigger("sync",r,i,t)};q(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};if(!(t=this._prepareModel(t,e)))return false;if(!e.wait)this.add(t,e);var r=this;var s=e.success;e.success=function(t,i){if(e.wait)r.add(t,e);if(s)s(t,i,e)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(t instanceof p)return t;e=e?i.clone(e):{};e.collection=this;var r=new this.model(t,e);if(!r.validationError)return r;this.trigger("invalid",this,r.validationError,e);return false},_addReference:function(t,e){this._byId[t.cid]=t;if(t.id!=null)this._byId[t.id]=t;if(!t.collection)t.collection=this;t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(e&&t==="change:"+e.idAttribute){delete this._byId[e.previous(e.idAttribute)];if(e.id!=null)this._byId[e.id]=e}this.trigger.apply(this,arguments)}});var _=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain","sample"];i.each(_,function(t){g.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.models);return i[t].apply(i,e)}});var b=["groupBy","countBy","sortBy","indexBy"];i.each(b,function(t){g.prototype[t]=function(e,r){var s=i.isFunction(e)?e:function(t){return t.get(e)};return i[t](this.models,s,r)}});var w=e.View=function(t){this.cid=i.uniqueId("view");t||(t={});i.extend(this,i.pick(t,E));this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()};var x=/^(\S+)\s*(.*)$/;var E=["model","collection","el","id","attributes","className","tagName","events"];i.extend(w.prototype,u,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();this.stopListening();return this},setElement:function(t,i){if(this.$el)this.undelegateEvents();this.$el=t instanceof e.$?t:e.$(t);this.el=this.$el[0];if(i!==false)this.delegateEvents();return this},delegateEvents:function(t){if(!(t||(t=i.result(this,"events"))))return this;this.undelegateEvents();for(var e in t){var r=t[e];if(!i.isFunction(r))r=this[t[e]];if(!r)continue;var s=e.match(x);var n=s[1],a=s[2];r=i.bind(r,this);n+=".delegateEvents"+this.cid;if(a===""){this.$el.on(n,r)}else{this.$el.on(n,a,r)}}return this},undelegateEvents:function(){this.$el.off(".delegateEvents"+this.cid);return this},_ensureElement:function(){if(!this.el){var t=i.extend({},i.result(this,"attributes"));if(this.id)t.id=i.result(this,"id");if(this.className)t["class"]=i.result(this,"className");var r=e.$("<"+i.result(this,"tagName")+">").attr(t);this.setElement(r,false)}else{this.setElement(i.result(this,"el"),false)}}});e.sync=function(t,r,s){var n=T[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:n,dataType:"json"};if(!s.url){a.url=i.result(r,"url")||M()}if(s.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(s.attrs||r.toJSON(s))}if(s.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(s.emulateHTTP&&(n==="PUT"||n==="DELETE"||n==="PATCH")){a.type="POST";if(s.emulateJSON)a.data._method=n;var o=s.beforeSend;s.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",n);if(o)return o.apply(this,arguments)}}if(a.type!=="GET"&&!s.emulateJSON){a.processData=false}if(a.type==="PATCH"&&k){a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var h=s.xhr=e.ajax(i.extend(a,s));r.trigger("request",r,h,s);return h};var k=typeof window!=="undefined"&&!!window.ActiveXObject&&!(window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent);var T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var $=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var S=/\((.*?)\)/g;var H=/(\(\?)?:\w+/g;var A=/\*\w+/g;var I=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend($.prototype,u,{initialize:function(){},route:function(t,r,s){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){s=r;r=""}if(!s)s=this[r];var n=this;e.history.route(t,function(i){var a=n._extractParameters(t,i);n.execute(s,a);n.trigger.apply(n,["route:"+r].concat(a));n.trigger("route",r,a);e.history.trigger("route",n,r,a)});return this},execute:function(t,e){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(I,"\\$&").replace(S,"(?:$1)?").replace(H,function(t,e){return e?t:"([^/?]+)"}).replace(A,"([^?]*?)");return new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var N=e.History=function(){this.handlers=[];i.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var R=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var P=/msie [\w.]+/;var C=/\/$/;var j=/#.*$/;N.started=false;i.extend(N.prototype,u,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=decodeURI(this.location.pathname+this.location.search);var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.slice(i.length)}else{t=this.getHash()}}return t.replace(R,"")},start:function(t){if(N.started)throw new Error("Backbone.history has already been started");N.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var r=this.getFragment();var s=document.documentMode;var n=P.exec(navigator.userAgent.toLowerCase())&&(!s||s<=7);this.root=("/"+this.root+"/").replace(O,"/");if(n&&this._wantsHashChange){var a=e.$('<iframe src="javascript:0" tabindex="-1">');this.iframe=a.hide().appendTo("body")[0].contentWindow;this.navigate(r)}if(this._hasPushState){e.$(window).on("popstate",this.checkUrl)}else if(this._wantsHashChange&&"onhashchange"in window&&!n){e.$(window).on("hashchange",this.checkUrl)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}this.fragment=r;var o=this.location;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){this.fragment=this.getFragment(null,true);this.location.replace(this.root+"#"+this.fragment);return true}else if(this._hasPushState&&this.atRoot()&&o.hash){this.fragment=this.getHash().replace(R,"");this.history.replaceState({},document.title,this.root+this.fragment)}}if(!this.options.silent)return this.loadUrl()},stop:function(){e.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl);if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);N.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getFragment(this.getHash(this.iframe))}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){t=this.fragment=this.getFragment(t);return i.any(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!N.started)return false;if(!e||e===true)e={trigger:!!e};var i=this.root+(t=this.getFragment(t||""));t=t.replace(j,"");if(this.fragment===t)return;this.fragment=t;if(t===""&&i!=="/")i=i.slice(0,-1);if(this._hasPushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,i)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getFragment(this.getHash(this.iframe))){if(!e.replace)this.iframe.document.open().close();this._updateHash(this.iframe.location,t,e.replace)}}else{return this.location.assign(i)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new N;var U=function(t,e){var r=this;var s;if(t&&i.has(t,"constructor")){s=t.constructor}else{s=function(){return r.apply(this,arguments)}}i.extend(s,r,e);var n=function(){this.constructor=s};n.prototype=r.prototype;s.prototype=new n;if(t)i.extend(s.prototype,t);s.__super__=r.prototype;return s};p.extend=g.extend=$.extend=w.extend=N.extend=U;var M=function(){throw new Error('A "url" property or function must be specified')};var q=function(t,e){var i=e.error;e.error=function(r){if(i)i(t,r,e);t.trigger("error",t,r,e)}};return e});
@(function(t){var e=typeof self=="object"&&self.self==self&&self||typeof global=="object"&&global.global==global&&global;if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,s){e.Backbone=t(e,s,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore"),r;try{r=require("jquery")}catch(s){}t(e,exports,i,r)}else{e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}})(function(t,e,i,r){var s=t.Backbone;var n=[];var a=n.slice;e.VERSION="1.2.0";e.$=r;e.noConflict=function(){t.Backbone=s;return this};e.emulateHTTP=false;e.emulateJSON=false;var o=e.Events={};var h=/\s+/;var u=function(t,e,r,s,n){var a=0,o;if(r&&typeof r==="object"){for(o=i.keys(r);a<o.length;a++){e=t(e,o[a],r[o[a]],n)}}else if(r&&h.test(r)){for(o=r.split(h);a<o.length;a++){e=t(e,o[a],s,n)}}else{e=t(e,r,s,n)}return e};o.on=function(t,e,i){return l(this,t,e,i)};var l=function(t,e,i,r,s){t._events=u(c,t._events||{},e,i,{context:r,ctx:t,listening:s});if(s){var n=t._listeners||(t._listeners={});n[s.id]=s}return t};o.listenTo=function(t,e,r){if(!t)return this;var s=t._listenId||(t._listenId=i.uniqueId("l"));var n=this._listeningTo||(this._listeningTo={});var a=n[s];if(!a){var o=this._listenId||(this._listenId=i.uniqueId("l"));a=n[s]={obj:t,objId:s,id:o,listeningTo:n,count:0}}l(t,e,r,this,a);return this};var c=function(t,e,i,r){if(i){var s=t[e]||(t[e]=[]);var n=r.context,a=r.ctx,o=r.listening;if(o)o.count++;s.push({callback:i,context:n,ctx:n||a,listening:o})}return t};o.off=function(t,e,i){if(!this._events)return this;this._events=u(f,this._events,t,e,{context:i,listeners:this._listeners});return this};o.stopListening=function(t,e,r){var s=this._listeningTo;if(!s)return this;var n=t?[t._listenId]:i.keys(s);for(var a=0;a<n.length;a++){var o=s[n[a]];if(!o)break;o.obj.off(e,r,this)}if(i.isEmpty(s))this._listeningTo=void 0;return this};var f=function(t,e,r,s){if(!t)return;var n=0,a,o;var h=s.context,u=s.listeners;if(!e&&!r&&!h){var l=i.keys(u);for(;n<l.length;n++){o=u[l[n]];delete u[o.id];delete o.listeningTo[o.objId]}return}var c=e?[e]:i.keys(t);for(;n<c.length;n++){e=c[n];var f=t[e];if(!f)break;var d=[];for(var v=0;v<f.length;v++){var g=f[v];if(r&&r!==g.callback&&r!==g.callback._callback||h&&h!==g.context){d.push(g)}else{o=g.listening;if(o&&--o.count===0){delete u[o.id];delete o.listeningTo[o.objId]}}}if(d.length){t[e]=d}else{delete t[e]}}if(i.size(t))return t};o.once=function(t,e,r){var s=u(d,{},t,e,i.bind(this.off,this));return this.on(s,void 0,r)};o.listenToOnce=function(t,e,r){var s=u(d,{},e,r,i.bind(this.stopListening,this,t));return this.listenTo(t,s)};var d=function(t,e,r,s){if(r){var n=t[e]=i.once(function(){s(e,n);r.apply(this,arguments)});n._callback=r}return t};o.trigger=function(t){if(!this._events)return this;var e=Math.max(0,arguments.length-1);var i=Array(e);for(var r=0;r<e;r++)i[r]=arguments[r+1];u(v,this._events,t,void 0,i);return this};var v=function(t,e,i,r){if(t){var s=t[e];var n=t.all;if(s&&n)n=n.slice();if(s)g(s,r);if(n)g(n,[e].concat(r))}return t};var g=function(t,e){var i,r=-1,s=t.length,n=e[0],a=e[1],o=e[2];switch(e.length){case 0:while(++r<s)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<s)(i=t[r]).callback.call(i.ctx,n);return;case 2:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a);return;case 3:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a,o);return;default:while(++r<s)(i=t[r]).callback.apply(i.ctx,e);return}};var p=function(t,e,r){switch(t){case 1:return function(){return i[e](this[r])};case 2:return function(t){return i[e](this[r],t)};case 3:return function(t,s){return i[e](this[r],t,s)};case 4:return function(t,s,n){return i[e](this[r],t,s,n)};default:return function(){var t=a.call(arguments);t.unshift(this[r]);return i[e].apply(i,t)}}};var m=function(t,e,r){i.each(e,function(e,s){if(i[s])t.prototype[s]=p(e,s,r)})};o.bind=o.on;o.unbind=o.off;i.extend(e,o);var _=e.Model=function(t,e){var r=t||{};e||(e={});this.cid=i.uniqueId(this.cidPrefix);this.attributes={};if(e.collection)this.collection=e.collection;if(e.parse)r=this.parse(r,e)||{};r=i.defaults({},r,i.result(this,"defaults"));this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};i.extend(_.prototype,o,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return this.get(t)!=null},matches:function(t){return!!i.iteratee(t,this)(this.attributes)},set:function(t,e,r){var s,n,a,o,h,u,l,c;if(t==null)return this;if(typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r||(r={});if(!this._validate(n,r))return false;a=r.unset;h=r.silent;o=[];u=this._changing;this._changing=true;if(!u){this._previousAttributes=i.clone(this.attributes);this.changed={}}c=this.attributes,l=this._previousAttributes;if(this.idAttribute in n)this.id=n[this.idAttribute];for(s in n){e=n[s];if(!i.isEqual(c[s],e))o.push(s);if(!i.isEqual(l[s],e)){this.changed[s]=e}else{delete this.changed[s]}a?delete c[s]:c[s]=e}if(!h){if(o.length)this._pending=r;for(var f=0;f<o.length;f++){this.trigger("change:"+o[f],this,c[o[f]],r)}}if(u)return this;if(!h){while(this._pending){r=this._pending;this._pending=false;this.trigger("change",this,r)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:true}))},clear:function(t){var e={};for(var r in this.attributes)e[r]=void 0;return this.set(e,i.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!i.isEmpty(this.changed);return i.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?i.clone(this.changed):false;var e,r=false;var s=this._changing?this._previousAttributes:this.attributes;for(var n in t){if(i.isEqual(s[n],e=t[n]))continue;(r||(r={}))[n]=e}return r},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=this;var r=t.success;t.success=function(i){if(!e.set(e.parse(i,t),t))return false;if(r)r.call(t.context,e,i,t);e.trigger("sync",e,i,t)};F(this,t);return this.sync("read",this,t)},save:function(t,e,r){var s,n,a,o=this.attributes,h;if(t==null||typeof t==="object"){s=t;r=e}else{(s={})[t]=e}r=i.extend({validate:true},r);h=r.wait;if(s&&!h){if(!this.set(s,r))return false}else{if(!this._validate(s,r))return false}if(s&&h){this.attributes=i.extend({},o,s)}if(r.parse===void 0)r.parse=true;var u=this;var l=r.success;r.success=function(t){u.attributes=o;var e=r.parse?u.parse(t,r):t;if(h)e=i.extend(s||{},e);if(i.isObject(e)&&!u.set(e,r)){return false}if(l)l.call(r.context,u,t,r);u.trigger("sync",u,t,r)};F(this,r);n=this.isNew()?"create":r.patch?"patch":"update";if(n==="patch"&&!r.attrs)r.attrs=s;a=this.sync(n,this,r);if(s&&h)this.attributes=o;return a},destroy:function(t){t=t?i.clone(t):{};var e=this;var r=t.success;var s=t.wait;var n=function(){e.stopListening();e.trigger("destroy",e,e.collection,t)};t.success=function(i){if(s)n();if(r)r.call(t.context,e,i,t);if(!e.isNew())e.trigger("sync",e,i,t)};var a=false;if(this.isNew()){i.defer(t.success)}else{F(this,t);a=this.sync("delete",this,t)}if(!s)n();return a},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||q();if(this.isNew())return t;var e=this.id||this.attributes[this.idAttribute];return t.replace(/([^\/])$/,"$1/")+encodeURIComponent(e)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.extend(t||{},{validate:true}))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=i.extend({},this.attributes,t);var r=this.validationError=this.validate(t,e)||null;if(!r)return true;this.trigger("invalid",this,r,i.extend(e,{validationError:r}));return false}});var y={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};m(_,y,"attributes");var b=e.Collection=function(t,e){e||(e={});if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,i.extend({silent:true},e))};var x={add:true,remove:true,merge:true};var w={add:true,remove:false};i.extend(b.prototype,o,{model:_,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:false},e,w))},remove:function(t,e){var r=!i.isArray(t),s;t=r?[t]:i.clone(t);e||(e={});s=this._removeModels(t,e);if(!e.silent&&s)this.trigger("update",this,e);return r?t[0]:t},set:function(t,e){e=i.defaults({},e,x);if(e.parse)t=this.parse(t,e);var r=!i.isArray(t);t=r?t?[t]:[]:t.slice();var s,n,a,o,h;var u=e.at;if(u!=null)u=+u;if(u<0)u+=this.length+1;var l=this.comparator&&u==null&&e.sort!==false;var c=i.isString(this.comparator)?this.comparator:null;var f=[],d=[],v={};var g=e.add,p=e.merge,m=e.remove;var _=!l&&g&&m?[]:false;var y=false;for(var b=0;b<t.length;b++){a=t[b];if(o=this.get(a)){if(m)v[o.cid]=true;if(p&&a!==o){a=this._isModel(a)?a.attributes:a;if(e.parse)a=o.parse(a,e);o.set(a,e);if(l&&!h&&o.hasChanged(c))h=true}t[b]=o}else if(g){n=t[b]=this._prepareModel(a,e);if(!n)continue;f.push(n);this._addReference(n,e)}n=o||n;if(!n)continue;s=this.modelId(n.attributes);if(_&&(n.isNew()||!v[s])){_.push(n);y=y||!this.models[b]||n.cid!==this.models[b].cid}v[s]=true}if(m){for(var b=0;b<this.length;b++){if(!v[(n=this.models[b]).cid])d.push(n)}if(d.length)this._removeModels(d,e)}if(f.length||y){if(l)h=true;this.length+=f.length;if(u!=null){for(var b=0;b<f.length;b++){this.models.splice(u+b,0,f[b])}}else{if(_)this.models.length=0;var w=_||f;for(var b=0;b<w.length;b++){this.models.push(w[b])}}}if(h)this.sort({silent:true});if(!e.silent){var E=u!=null?i.clone(e):e;for(var b=0;b<f.length;b++){if(u!=null)E.index=u+b;(n=f[b]).trigger("add",n,this,E)}if(h||y)this.trigger("sort",this,e);if(f.length||d.length)this.trigger("update",this,e)}return r?t[0]:t},reset:function(t,e){e=e?i.clone(e):{};for(var r=0;r<this.models.length;r++){this._removeReference(this.models[r],e)}e.previousModels=this.models;this._reset();t=this.add(t,i.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);this.remove(e,t);return e},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);this.remove(e,t);return e},slice:function(){return a.apply(this.models,arguments)},get:function(t){if(t==null)return void 0;var e=this.modelId(this._isModel(t)?t.attributes:t);return this._byId[t]||this._byId[e]||this._byId[t.cid]},at:function(t){if(t<0)t+=this.length;return this.models[t]},where:function(t,e){var r=i.matches(t);return this[e?"find":"filter"](function(t){return r(t.attributes)})},findWhere:function(t){return this.where(t,true)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");t||(t={});if(i.isString(this.comparator)||this.comparator.length===1){this.models=this.sortBy(this.comparator,this)}else{this.models.sort(i.bind(this.comparator,this))}if(!t.silent)this.trigger("sort",this,t);return this},pluck:function(t){return i.invoke(this.models,"get",t)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=t.success;var r=this;t.success=function(i){var s=t.reset?"reset":"set";r[s](i,t);if(e)e.call(t.context,r,i,t);r.trigger("sync",r,i,t)};F(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};var r=e.wait;if(!(t=this._prepareModel(t,e)))return false;if(!r)this.add(t,e);var s=this;var n=e.success;e.success=function(t,e,i){if(r)s.add(t,i);if(n)n.call(i.context,t,e,i)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(t){return t[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(this._isModel(t)){if(!t.collection)t.collection=this;return t}e=e?i.clone(e):{};e.collection=this;var r=new this.model(t,e);if(!r.validationError)return r;this.trigger("invalid",this,r.validationError,e);return false},_removeModels:function(t,e){var i,r,s,n,a=false;for(var i=0,o=0;i<t.length;i++){var n=t[i]=this.get(t[i]);if(!n)continue;var h=this.modelId(n.attributes);if(h!=null)delete this._byId[h];delete this._byId[n.cid];var s=this.indexOf(n);this.models.splice(s,1);this.length--;if(!e.silent){e.index=s;n.trigger("remove",n,this,e)}t[o++]=n;this._removeReference(n,e);a=true}if(t.length!==o)t=t.slice(0,o);return a},_isModel:function(t){return t instanceof _},_addReference:function(t,e){this._byId[t.cid]=t;var i=this.modelId(t.attributes);if(i!=null)this._byId[i]=t;t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(t==="change"){var s=this.modelId(e.previousAttributes());var n=this.modelId(e.attributes);if(s!==n){if(s!=null)delete this._byId[s];if(n!=null)this._byId[n]=e}}this.trigger.apply(this,arguments)}});var E={forEach:3,each:3,map:3,collect:3,reduce:4,foldl:4,inject:4,reduceRight:4,foldr:4,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:2,contains:2,invoke:2,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3};m(b,E,"models");var k=["groupBy","countBy","sortBy","indexBy"];i.each(k,function(t){if(!i[t])return;b.prototype[t]=function(e,r){var s=i.isFunction(e)?e:function(t){return t.get(e)};return i[t](this.models,s,r)}});var S=e.View=function(t){this.cid=i.uniqueId("view");t||(t={});i.extend(this,i.pick(t,T));this._ensureElement();this.initialize.apply(this,arguments)};var I=/^(\S+)\s*(.*)$/;var T=["model","collection","el","id","attributes","className","tagName","events"];i.extend(S.prototype,o,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this._removeElement();this.stopListening();return this},_removeElement:function(){this.$el.remove()},setElement:function(t){this.undelegateEvents();this._setElement(t);this.delegateEvents();return this},_setElement:function(t){this.$el=t instanceof e.$?t:e.$(t);this.el=this.$el[0]},delegateEvents:function(t){if(!(t||(t=i.result(this,"events"))))return this;this.undelegateEvents();for(var e in t){var r=t[e];if(!i.isFunction(r))r=this[t[e]];if(!r)continue;var s=e.match(I);this.delegate(s[1],s[2],i.bind(r,this))}return this},delegate:function(t,e,i){this.$el.on(t+".delegateEvents"+this.cid,e,i)},undelegateEvents:function(){if(this.$el)this.$el.off(".delegateEvents"+this.cid);return this},undelegate:function(t,e,i){this.$el.off(t+".delegateEvents"+this.cid,e,i)},_createElement:function(t){return document.createElement(t)},_ensureElement:function(){if(!this.el){var t=i.extend({},i.result(this,"attributes"));if(this.id)t.id=i.result(this,"id");if(this.className)t["class"]=i.result(this,"className");this.setElement(this._createElement(i.result(this,"tagName")));this._setAttributes(t)}else{this.setElement(i.result(this,"el"))}},_setAttributes:function(t){this.$el.attr(t)}});e.sync=function(t,r,s){var n=P[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:n,dataType:"json"};if(!s.url){a.url=i.result(r,"url")||q()}if(s.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(s.attrs||r.toJSON(s))}if(s.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(s.emulateHTTP&&(n==="PUT"||n==="DELETE"||n==="PATCH")){a.type="POST";if(s.emulateJSON)a.data._method=n;var o=s.beforeSend;s.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",n);if(o)return o.apply(this,arguments)}}if(a.type!=="GET"&&!s.emulateJSON){a.processData=false}var h=s.error;s.error=function(t,e,i){s.textStatus=e;s.errorThrown=i;if(h)h.call(s.context,t,e,i)};var u=s.xhr=e.ajax(i.extend(a,s));r.trigger("request",r,u,s);return u};var P={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var H=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var $=/\((.*?)\)/g;var A=/(\(\?)?:\w+/g;var C=/\*\w+/g;var N=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend(H.prototype,o,{initialize:function(){},route:function(t,r,s){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){s=r;r=""}if(!s)s=this[r];var n=this;e.history.route(t,function(i){var a=n._extractParameters(t,i);if(n.execute(s,a,r)!==false){n.trigger.apply(n,["route:"+r].concat(a));n.trigger("route",r,a);e.history.trigger("route",n,r,a)}});return this},execute:function(t,e,i){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(N,"\\$&").replace($,"(?:$1)?").replace(A,function(t,e){return e?t:"([^/?]+)"}).replace(C,"([^?]*?)");return new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var R=e.History=function(){this.handlers=[];i.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var j=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var U=/#.*$/;R.started=false;i.extend(R.prototype,o,{interval:50,atRoot:function(){var t=this.location.pathname.replace(/[^\/]$/,"$&/");return t===this.root&&!this.getSearch()},matchRoot:function(){var t=this.decodeFragment(this.location.pathname);var e=t.slice(0,this.root.length-1)+"/";return e===this.root},decodeFragment:function(t){return decodeURI(t.replace(/%25/g,"%2525"))},getSearch:function(){var t=this.location.href.replace(/#.*/,"").match(/\?.+/);return t?t[0]:""},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getPath:function(){var t=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return t.charAt(0)==="/"?t.slice(1):t},getFragment:function(t){if(t==null){if(this._usePushState||!this._wantsHashChange){t=this.getPath()}else{t=this.getHash()}}return t.replace(j,"")},start:function(t){if(R.started)throw new Error("Backbone.history has already been started");R.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._hasHashChange="onhashchange"in window;this._useHashChange=this._wantsHashChange&&this._hasHashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.history&&this.history.pushState);this._usePushState=this._wantsPushState&&this._hasPushState;this.fragment=this.getFragment();this.root=("/"+this.root+"/").replace(O,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";this.location.replace(e+"#"+this.getPath());return true}else if(this._hasPushState&&this.atRoot()){this.navigate(this.getHash(),{replace:true})}}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){var r=document.createElement("iframe");r.src="javascript:0";r.style.display="none";r.tabIndex=-1;var s=document.body;this.iframe=s.insertBefore(r,s.firstChild).contentWindow;this.iframe.document.open().close();this.iframe.location.hash="#"+this.fragment}var n=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState){n("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){n("hashchange",this.checkUrl,false)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}if(!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};if(this._usePushState){t("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){t("hashchange",this.checkUrl,false)}if(this.iframe){document.body.removeChild(this.iframe.frameElement);this.iframe=null}if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);R.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getHash(this.iframe)}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){if(!this.matchRoot())return false;t=this.fragment=this.getFragment(t);return i.any(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!R.started)return false;if(!e||e===true)e={trigger:!!e};t=this.getFragment(t||"");var i=this.root;if(t===""||t.charAt(0)==="?"){i=i.slice(0,-1)||"/"}var r=i+t;t=this.decodeFragment(t.replace(U,""));if(this.fragment===t)return;this.fragment=t;if(this._usePushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,r)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getHash(this.iframe)){if(!e.replace)this.iframe.document.open().close();this._updateHash(this.iframe.location,t,e.replace)}}else{return this.location.assign(r)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new R;var M=function(t,e){var r=this;var s;if(t&&i.has(t,"constructor")){s=t.constructor}else{s=function(){return r.apply(this,arguments)}}i.extend(s,r,e);var n=function(){this.constructor=s};n.prototype=r.prototype;s.prototype=new n;if(t)i.extend(s.prototype,t);s.__super__=r.prototype;return s};_.extend=b.extend=H.extend=S.extend=R.extend=M;var q=function(){throw new Error('A "url" property or function must be specified')};var F=function(t,e){var i=e.error;e.error=function(r){if(i)i.call(e.context,t,r,e);t.trigger("error",t,r,e)}};return e});
@(function(t){var e=typeof self=="object"&&self.self==self&&self||typeof global=="object"&&global.global==global&&global;if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,s){e.Backbone=t(e,s,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore"),r;try{r=require("jquery")}catch(s){}t(e,exports,i,r)}else{e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}})(function(t,e,i,r){var s=t.Backbone;var n=[].slice;e.VERSION="1.2.1";e.$=r;e.noConflict=function(){t.Backbone=s;return this};e.emulateHTTP=false;e.emulateJSON=false;var a=function(t,e,r){switch(t){case 1:return function(){return i[e](this[r])};case 2:return function(t){return i[e](this[r],t)};case 3:return function(t,s){return i[e](this[r],t,s)};case 4:return function(t,s,n){return i[e](this[r],t,s,n)};default:return function(){var t=n.call(arguments);t.unshift(this[r]);return i[e].apply(i,t)}}};var o=function(t,e,r){i.each(e,function(e,s){if(i[s])t.prototype[s]=a(e,s,r)})};var h=e.Events={};var u=/\s+/;var l=function(t,e,r,s,n){var a=0,o;if(r&&typeof r==="object"){if(s!==void 0&&"context"in n&&n.context===void 0)n.context=s;for(o=i.keys(r);a<o.length;a++){e=t(e,o[a],r[o[a]],n)}}else if(r&&u.test(r)){for(o=r.split(u);a<o.length;a++){e=t(e,o[a],s,n)}}else{e=t(e,r,s,n)}return e};h.on=function(t,e,i){return c(this,t,e,i)};var c=function(t,e,i,r,s){t._events=l(f,t._events||{},e,i,{context:r,ctx:t,listening:s});if(s){var n=t._listeners||(t._listeners={});n[s.id]=s}return t};h.listenTo=function(t,e,r){if(!t)return this;var s=t._listenId||(t._listenId=i.uniqueId("l"));var n=this._listeningTo||(this._listeningTo={});var a=n[s];if(!a){var o=this._listenId||(this._listenId=i.uniqueId("l"));a=n[s]={obj:t,objId:s,id:o,listeningTo:n,count:0}}c(t,e,r,this,a);return this};var f=function(t,e,i,r){if(i){var s=t[e]||(t[e]=[]);var n=r.context,a=r.ctx,o=r.listening;if(o)o.count++;s.push({callback:i,context:n,ctx:n||a,listening:o})}return t};h.off=function(t,e,i){if(!this._events)return this;this._events=l(d,this._events,t,e,{context:i,listeners:this._listeners});return this};h.stopListening=function(t,e,r){var s=this._listeningTo;if(!s)return this;var n=t?[t._listenId]:i.keys(s);for(var a=0;a<n.length;a++){var o=s[n[a]];if(!o)break;o.obj.off(e,r,this)}if(i.isEmpty(s))this._listeningTo=void 0;return this};var d=function(t,e,r,s){if(!t)return;var n=0,a;var o=s.context,h=s.listeners;if(!e&&!r&&!o){var u=i.keys(h);for(;n<u.length;n++){a=h[u[n]];delete h[a.id];delete a.listeningTo[a.objId]}return}var l=e?[e]:i.keys(t);for(;n<l.length;n++){e=l[n];var c=t[e];if(!c)break;var f=[];for(var d=0;d<c.length;d++){var v=c[d];if(r&&r!==v.callback&&r!==v.callback._callback||o&&o!==v.context){f.push(v)}else{a=v.listening;if(a&&--a.count===0){delete h[a.id];delete a.listeningTo[a.objId]}}}if(f.length){t[e]=f}else{delete t[e]}}if(i.size(t))return t};h.once=function(t,e,r){var s=l(v,{},t,e,i.bind(this.off,this));return this.on(s,void 0,r)};h.listenToOnce=function(t,e,r){var s=l(v,{},e,r,i.bind(this.stopListening,this,t));return this.listenTo(t,s)};var v=function(t,e,r,s){if(r){var n=t[e]=i.once(function(){s(e,n);r.apply(this,arguments)});n._callback=r}return t};h.trigger=function(t){if(!this._events)return this;var e=Math.max(0,arguments.length-1);var i=Array(e);for(var r=0;r<e;r++)i[r]=arguments[r+1];l(g,this._events,t,void 0,i);return this};var g=function(t,e,i,r){if(t){var s=t[e];var n=t.all;if(s&&n)n=n.slice();if(s)p(s,r);if(n)p(n,[e].concat(r))}return t};var p=function(t,e){var i,r=-1,s=t.length,n=e[0],a=e[1],o=e[2];switch(e.length){case 0:while(++r<s)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<s)(i=t[r]).callback.call(i.ctx,n);return;case 2:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a);return;case 3:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a,o);return;default:while(++r<s)(i=t[r]).callback.apply(i.ctx,e);return}};h.bind=h.on;h.unbind=h.off;i.extend(e,h);var m=e.Model=function(t,e){var r=t||{};e||(e={});this.cid=i.uniqueId(this.cidPrefix);this.attributes={};if(e.collection)this.collection=e.collection;if(e.parse)r=this.parse(r,e)||{};r=i.defaults({},r,i.result(this,"defaults"));this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};i.extend(m.prototype,h,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return this.get(t)!=null},matches:function(t){return!!i.iteratee(t,this)(this.attributes)},set:function(t,e,r){if(t==null)return this;var s;if(typeof t==="object"){s=t;r=e}else{(s={})[t]=e}r||(r={});if(!this._validate(s,r))return false;var n=r.unset;var a=r.silent;var o=[];var h=this._changing;this._changing=true;if(!h){this._previousAttributes=i.clone(this.attributes);this.changed={}}var u=this.attributes;var l=this.changed;var c=this._previousAttributes;if(this.idAttribute in s)this.id=s[this.idAttribute];for(var f in s){e=s[f];if(!i.isEqual(u[f],e))o.push(f);if(!i.isEqual(c[f],e)){l[f]=e}else{delete l[f]}n?delete u[f]:u[f]=e}if(!a){if(o.length)this._pending=r;for(var d=0;d<o.length;d++){this.trigger("change:"+o[d],this,u[o[d]],r)}}if(h)return this;if(!a){while(this._pending){r=this._pending;this._pending=false;this.trigger("change",this,r)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:true}))},clear:function(t){var e={};for(var r in this.attributes)e[r]=void 0;return this.set(e,i.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!i.isEmpty(this.changed);return i.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?i.clone(this.changed):false;var e=this._changing?this._previousAttributes:this.attributes;var r={};for(var s in t){var n=t[s];if(i.isEqual(e[s],n))continue;r[s]=n}return i.size(r)?r:false},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=i.extend({parse:true},t);var e=this;var r=t.success;t.success=function(i){var s=t.parse?e.parse(i,t):i;if(!e.set(s,t))return false;if(r)r.call(t.context,e,i,t);e.trigger("sync",e,i,t)};q(this,t);return this.sync("read",this,t)},save:function(t,e,r){var s;if(t==null||typeof t==="object"){s=t;r=e}else{(s={})[t]=e}r=i.extend({validate:true,parse:true},r);var n=r.wait;if(s&&!n){if(!this.set(s,r))return false}else{if(!this._validate(s,r))return false}var a=this;var o=r.success;var h=this.attributes;r.success=function(t){a.attributes=h;var e=r.parse?a.parse(t,r):t;if(n)e=i.extend({},s,e);if(e&&!a.set(e,r))return false;if(o)o.call(r.context,a,t,r);a.trigger("sync",a,t,r)};q(this,r);if(s&&n)this.attributes=i.extend({},h,s);var u=this.isNew()?"create":r.patch?"patch":"update";if(u==="patch"&&!r.attrs)r.attrs=s;var l=this.sync(u,this,r);this.attributes=h;return l},destroy:function(t){t=t?i.clone(t):{};var e=this;var r=t.success;var s=t.wait;var n=function(){e.stopListening();e.trigger("destroy",e,e.collection,t)};t.success=function(i){if(s)n();if(r)r.call(t.context,e,i,t);if(!e.isNew())e.trigger("sync",e,i,t)};var a=false;if(this.isNew()){i.defer(t.success)}else{q(this,t);a=this.sync("delete",this,t)}if(!s)n();return a},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||M();if(this.isNew())return t;var e=this.get(this.idAttribute);return t.replace(/[^\/]$/,"$&/")+encodeURIComponent(e)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.defaults({validate:true},t))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=i.extend({},this.attributes,t);var r=this.validationError=this.validate(t,e)||null;if(!r)return true;this.trigger("invalid",this,r,i.extend(e,{validationError:r}));return false}});var _={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};o(m,_,"attributes");var y=e.Collection=function(t,e){e||(e={});if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,i.extend({silent:true},e))};var b={add:true,remove:true,merge:true};var x={add:true,remove:false};i.extend(y.prototype,h,{model:m,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:false},e,x))},remove:function(t,e){e=i.extend({},e);var r=!i.isArray(t);t=r?[t]:i.clone(t);var s=this._removeModels(t,e);if(!e.silent&&s)this.trigger("update",this,e);return r?s[0]:s},set:function(t,e){e=i.defaults({},e,b);if(e.parse&&!this._isModel(t))t=this.parse(t,e);var r=!i.isArray(t);t=r?t?[t]:[]:t.slice();var s,n,a,o,h;var u=e.at;if(u!=null)u=+u;if(u<0)u+=this.length+1;var l=this.comparator&&u==null&&e.sort!==false;var c=i.isString(this.comparator)?this.comparator:null;var f=[],d=[],v={};var g=e.add,p=e.merge,m=e.remove;var _=!l&&g&&m?[]:false;var y=false;for(var x=0;x<t.length;x++){a=t[x];if(o=this.get(a)){if(m)v[o.cid]=true;if(p&&a!==o){a=this._isModel(a)?a.attributes:a;if(e.parse)a=o.parse(a,e);o.set(a,e);if(l&&!h&&o.hasChanged(c))h=true}t[x]=o}else if(g){n=t[x]=this._prepareModel(a,e);if(!n)continue;f.push(n);this._addReference(n,e)}n=o||n;if(!n)continue;s=this.modelId(n.attributes);if(_&&(n.isNew()||!v[s])){_.push(n);y=y||!this.models[x]||n.cid!==this.models[x].cid}v[s]=true}if(m){for(var x=0;x<this.length;x++){if(!v[(n=this.models[x]).cid])d.push(n)}if(d.length)this._removeModels(d,e)}if(f.length||y){if(l)h=true;this.length+=f.length;if(u!=null){for(var x=0;x<f.length;x++){this.models.splice(u+x,0,f[x])}}else{if(_)this.models.length=0;var w=_||f;for(var x=0;x<w.length;x++){this.models.push(w[x])}}}if(h)this.sort({silent:true});if(!e.silent){var E=u!=null?i.clone(e):e;for(var x=0;x<f.length;x++){if(u!=null)E.index=u+x;(n=f[x]).trigger("add",n,this,E)}if(h||y)this.trigger("sort",this,e);if(f.length||d.length)this.trigger("update",this,e)}return r?t[0]:t},reset:function(t,e){e=e?i.clone(e):{};for(var r=0;r<this.models.length;r++){this._removeReference(this.models[r],e)}e.previousModels=this.models;this._reset();t=this.add(t,i.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);return this.remove(e,t)},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);return this.remove(e,t)},slice:function(){return n.apply(this.models,arguments)},get:function(t){if(t==null)return void 0;var e=this.modelId(this._isModel(t)?t.attributes:t);return this._byId[t]||this._byId[e]||this._byId[t.cid]},at:function(t){if(t<0)t+=this.length;return this.models[t]},where:function(t,e){var r=i.matches(t);return this[e?"find":"filter"](function(t){return r(t.attributes)})},findWhere:function(t){return this.where(t,true)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");t||(t={});if(i.isString(this.comparator)||this.comparator.length===1){this.models=this.sortBy(this.comparator,this)}else{this.models.sort(i.bind(this.comparator,this))}if(!t.silent)this.trigger("sort",this,t);return this},pluck:function(t){return i.invoke(this.models,"get",t)},fetch:function(t){t=i.extend({parse:true},t);var e=t.success;var r=this;t.success=function(i){var s=t.reset?"reset":"set";r[s](i,t);if(e)e.call(t.context,r,i,t);r.trigger("sync",r,i,t)};q(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};var r=e.wait;t=this._prepareModel(t,e);if(!t)return false;if(!r)this.add(t,e);var s=this;var n=e.success;e.success=function(t,e,i){if(r)s.add(t,i);if(n)n.call(i.context,t,e,i)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(t){return t[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(this._isModel(t)){if(!t.collection)t.collection=this;return t}e=e?i.clone(e):{};e.collection=this;var r=new this.model(t,e);if(!r.validationError)return r;this.trigger("invalid",this,r.validationError,e);return false},_removeModels:function(t,e){var i=[];for(var r=0;r<t.length;r++){var s=this.get(t[r]);if(!s)continue;var n=this.indexOf(s);this.models.splice(n,1);this.length--;if(!e.silent){e.index=n;s.trigger("remove",s,this,e)}i.push(s);this._removeReference(s,e)}return i.length?i:false},_isModel:function(t){return t instanceof m},_addReference:function(t,e){this._byId[t.cid]=t;var i=this.modelId(t.attributes);if(i!=null)this._byId[i]=t;t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){delete this._byId[t.cid];var i=this.modelId(t.attributes);if(i!=null)delete this._byId[i];if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(t==="change"){var s=this.modelId(e.previousAttributes());var n=this.modelId(e.attributes);if(s!==n){if(s!=null)delete this._byId[s];if(n!=null)this._byId[n]=e}}this.trigger.apply(this,arguments)}});var w={forEach:3,each:3,map:3,collect:3,reduce:4,foldl:4,inject:4,reduceRight:4,foldr:4,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:2,contains:2,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3};o(y,w,"models");var E=["groupBy","countBy","sortBy","indexBy"];i.each(E,function(t){if(!i[t])return;y.prototype[t]=function(e,r){var s=i.isFunction(e)?e:function(t){return t.get(e)};return i[t](this.models,s,r)}});var k=e.View=function(t){this.cid=i.uniqueId("view");i.extend(this,i.pick(t,I));this._ensureElement();this.initialize.apply(this,arguments)};var S=/^(\S+)\s*(.*)$/;var I=["model","collection","el","id","attributes","className","tagName","events"];i.extend(k.prototype,h,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this._removeElement();this.stopListening();return this},_removeElement:function(){this.$el.remove()},setElement:function(t){this.undelegateEvents();this._setElement(t);this.delegateEvents();return this},_setElement:function(t){this.$el=t instanceof e.$?t:e.$(t);this.el=this.$el[0]},delegateEvents:function(t){t||(t=i.result(this,"events"));if(!t)return this;this.undelegateEvents();for(var e in t){var r=t[e];if(!i.isFunction(r))r=this[r];if(!r)continue;var s=e.match(S);this.delegate(s[1],s[2],i.bind(r,this))}return this},delegate:function(t,e,i){this.$el.on(t+".delegateEvents"+this.cid,e,i);return this},undelegateEvents:function(){if(this.$el)this.$el.off(".delegateEvents"+this.cid);return this},undelegate:function(t,e,i){this.$el.off(t+".delegateEvents"+this.cid,e,i);return this},_createElement:function(t){return document.createElement(t)},_ensureElement:function(){if(!this.el){var t=i.extend({},i.result(this,"attributes"));if(this.id)t.id=i.result(this,"id");if(this.className)t["class"]=i.result(this,"className");this.setElement(this._createElement(i.result(this,"tagName")));this._setAttributes(t)}else{this.setElement(i.result(this,"el"))}},_setAttributes:function(t){this.$el.attr(t)}});e.sync=function(t,r,s){var n=T[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:n,dataType:"json"};if(!s.url){a.url=i.result(r,"url")||M()}if(s.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(s.attrs||r.toJSON(s))}if(s.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(s.emulateHTTP&&(n==="PUT"||n==="DELETE"||n==="PATCH")){a.type="POST";if(s.emulateJSON)a.data._method=n;var o=s.beforeSend;s.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",n);if(o)return o.apply(this,arguments)}}if(a.type!=="GET"&&!s.emulateJSON){a.processData=false}var h=s.error;s.error=function(t,e,i){s.textStatus=e;s.errorThrown=i;if(h)h.call(s.context,t,e,i)};var u=s.xhr=e.ajax(i.extend(a,s));r.trigger("request",r,u,s);return u};var T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var P=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var H=/\((.*?)\)/g;var $=/(\(\?)?:\w+/g;var A=/\*\w+/g;var C=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend(P.prototype,h,{initialize:function(){},route:function(t,r,s){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){s=r;r=""}if(!s)s=this[r];var n=this;e.history.route(t,function(i){var a=n._extractParameters(t,i);if(n.execute(s,a,r)!==false){n.trigger.apply(n,["route:"+r].concat(a));n.trigger("route",r,a);e.history.trigger("route",n,r,a)}});return this},execute:function(t,e,i){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(C,"\\$&").replace(H,"(?:$1)?").replace($,function(t,e){return e?t:"([^/?]+)"}).replace(A,"([^?]*?)");return new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var N=e.History=function(){this.handlers=[];i.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var R=/^[#\/]|\s+$/g;var j=/^\/+|\/+$/g;var O=/#.*$/;N.started=false;i.extend(N.prototype,h,{interval:50,atRoot:function(){var t=this.location.pathname.replace(/[^\/]$/,"$&/");return t===this.root&&!this.getSearch()},matchRoot:function(){var t=this.decodeFragment(this.location.pathname);var e=t.slice(0,this.root.length-1)+"/";return e===this.root},decodeFragment:function(t){return decodeURI(t.replace(/%25/g,"%2525"))},getSearch:function(){var t=this.location.href.replace(/#.*/,"").match(/\?.+/);return t?t[0]:""},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getPath:function(){var t=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return t.charAt(0)==="/"?t.slice(1):t},getFragment:function(t){if(t==null){if(this._usePushState||!this._wantsHashChange){t=this.getPath()}else{t=this.getHash()}}return t.replace(R,"")},start:function(t){if(N.started)throw new Error("Backbone.history has already been started");N.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._hasHashChange="onhashchange"in window;this._useHashChange=this._wantsHashChange&&this._hasHashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.history&&this.history.pushState);this._usePushState=this._wantsPushState&&this._hasPushState;this.fragment=this.getFragment();this.root=("/"+this.root+"/").replace(j,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";this.location.replace(e+"#"+this.getPath());return true}else if(this._hasPushState&&this.atRoot()){this.navigate(this.getHash(),{replace:true})}}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe");this.iframe.src="javascript:0";this.iframe.style.display="none";this.iframe.tabIndex=-1;var r=document.body;var s=r.insertBefore(this.iframe,r.firstChild).contentWindow;s.document.open();s.document.close();s.location.hash="#"+this.fragment}var n=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState){n("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){n("hashchange",this.checkUrl,false)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}if(!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};if(this._usePushState){t("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){t("hashchange",this.checkUrl,false)}if(this.iframe){document.body.removeChild(this.iframe);this.iframe=null}if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);N.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getHash(this.iframe.contentWindow)}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){if(!this.matchRoot())return false;t=this.fragment=this.getFragment(t);return i.any(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!N.started)return false;if(!e||e===true)e={trigger:!!e};t=this.getFragment(t||"");var i=this.root;if(t===""||t.charAt(0)==="?"){i=i.slice(0,-1)||"/"}var r=i+t;t=this.decodeFragment(t.replace(O,""));if(this.fragment===t)return;this.fragment=t;if(this._usePushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,r)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var s=this.iframe.contentWindow;if(!e.replace){s.document.open();s.document.close()}this._updateHash(s.location,t,e.replace)}}else{return this.location.assign(r)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new N;var U=function(t,e){var r=this;var s;if(t&&i.has(t,"constructor")){s=t.constructor}else{s=function(){return r.apply(this,arguments)}}i.extend(s,r,e);var n=function(){this.constructor=s};n.prototype=r.prototype;s.prototype=new n;if(t)i.extend(s.prototype,t);s.__super__=r.prototype;return s};m.extend=y.extend=P.extend=k.extend=N.extend=U;var M=function(){throw new Error('A "url" property or function must be specified')};var q=function(t,e){var i=e.error;e.error=function(r){if(i)i.call(e.context,t,r,e);t.trigger("error",t,r,e)}};return e});