Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated libs

  • Loading branch information...
commit e8974509326b7b5ba6cef3f028cd1304a3a2a6e7 1 parent 0ff4134
@podefr podefr authored
Showing with 31,637 additions and 7,043 deletions.
  1. +1 −1  docs/files.html
  2. +1 −1  docs/index.html
  3. +1 −1  docs/symbols/LocalStore.html
  4. +1 −1  docs/symbols/ModelPlugin.html
  5. +1 −1  docs/symbols/OObject.html
  6. +1 −1  docs/symbols/Plugins.html
  7. +1 −1  docs/symbols/Transport.html
  8. +1 −1  docs/symbols/_global_.html
  9. +30 −26 lib/require.js
  10. +1 −0  node_modules/.bin/r.js
  11. +2,946 −2,859 node_modules/emily/build/Emily-map
  12. +31 −30 node_modules/emily/build/Emily.js
  13. +65 −13 node_modules/emily/build/uncompressed/concat.js
  14. +13 −6 node_modules/emily/emily-server.js
  15. +1 −0  node_modules/emily/node_modules/.bin/r.js
  16. +1 −0  node_modules/emily/node_modules/requirejs/.npmignore
  17. +15,472 −0 node_modules/emily/node_modules/requirejs/bin/r.js
  18. +41 −0 node_modules/emily/node_modules/requirejs/package.json
  19. +2,037 −0 node_modules/emily/node_modules/requirejs/require.js
  20. +4 −4 node_modules/emily/package.json
  21. +7,814 −2,165 node_modules/requirejs/bin/r.js
  22. +37 −20 node_modules/requirejs/package.json
  23. +1,380 −1,396 node_modules/requirejs/require.js
  24. +14 −0 node_modules/socket.io/History.md
  25. +4 −3 node_modules/socket.io/lib/manager.js
  26. +1 −1  node_modules/socket.io/lib/socket.io.js
  27. +1 −1  node_modules/socket.io/lib/transport.js
  28. +14 −2 node_modules/socket.io/lib/transports/http-polling.js
  29. +1 −0  node_modules/socket.io/lib/transports/http.js
  30. +2 −1  node_modules/socket.io/lib/transports/jsonp-polling.js
  31. +1 −2  node_modules/socket.io/lib/transports/websocket/hybi-16.js
  32. +1 −1  node_modules/socket.io/node_modules/policyfile/package.json
  33. +1 −1  node_modules/socket.io/node_modules/redis/package.json
  34. +10 −0 node_modules/socket.io/node_modules/socket.io-client/History.md
  35. +5 −4 node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js
  36. +2 −2 node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.min.js
  37. +1 −1  node_modules/socket.io/node_modules/socket.io-client/lib/io.js
  38. +3 −2 node_modules/socket.io/node_modules/socket.io-client/lib/transports/jsonp-polling.js
  39. +1 −1  ...socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/node_modules/zeparser/package.json
  40. +1 −1  node_modules/socket.io/node_modules/socket.io-client/node_modules/active-x-obfuscator/package.json
  41. +1 −1  node_modules/socket.io/node_modules/socket.io-client/node_modules/uglify-js/package.json
  42. +0 −9 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/.lock-wscript
  43. +2 −1  node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/.travis.yml
  44. +40 −0 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/History.md
  45. +2 −2 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/Makefile
  46. +26 −8 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/README.md
  47. +2 −2 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/bin/wscat
  48. BIN  node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/.wafpickle-7
  49. +374 −0 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Makefile
  50. +1 −0  ...dules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/bufferutil.node.d
  51. +27 −0 ...dules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d
  52. +27 −0 ...dules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/validation/src/validation.o.d
  53. +1 −0  ...dules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/validation.node.d
  54. BIN  node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/bufferutil.node
  55. 0  node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/linker.lock
  56. BIN  ...ocket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/bufferutil/src/bufferutil.o
  57. BIN  ...ocket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/validation/src/validation.o
  58. BIN  node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/src/bufferutil_2.o
  59. BIN  node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/src/validation_1.o
  60. BIN  node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/validation.node
  61. +6 −0 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/binding.Makefile
  62. +127 −0 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/bufferutil.target.mk
  63. +0 −49 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/c4che/Release.cache.py
  64. +0 −2  node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/c4che/build.config.py
  65. +13 −0 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/config.gypi
  66. +0 −36 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/config.log
  67. +205 −0 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/gyp-mac-tool
  68. +127 −0 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/validation.target.mk
  69. +1 −0  node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/fileapi/server.js
  70. +17 −0 ...modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats-express_3/package.json
  71. +33 −0 ...es/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats-express_3/public/index.html
  72. +21 −0 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats-express_3/server.js
  73. +2 −2 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats/package.json
  74. +5 −4 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats/public/index.html
  75. +3 −3 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/examples/serverstats/server.js
  76. +28 −0 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/install.js
  77. +4 −7 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.js
  78. +2 −1  node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/ErrorCodes.js
  79. +24 −9 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.hixie.js
  80. +2 −4 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.js
  81. +4 −7 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.js
  82. +123 −130 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocket.js
  83. +129 −97 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocketServer.js
  84. +0 −20 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/make.bat
  85. +1 −4 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/package.json
  86. +1 −1  node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/package.json
  87. +5 −0 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/.npmignore
  88. +3 −0  node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/README.md
  89. +3 −0  node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/example.js
  90. +34 −0 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/package.json
  91. +31 −0 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/tinycolor.js
  92. +12 −9 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/package.json
  93. +24 −22 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/bufferutil.cc
  94. +3 −1 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/validation.cc
  95. +55 −4 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/Sender.hixie.test.js
  96. +1 −3 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/WebSocket.test.js
  97. +29 −0 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/test/WebSocketServer.test.js
  98. +0 −38 node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/wscript
  99. +1 −1  node_modules/socket.io/node_modules/socket.io-client/node_modules/xmlhttprequest/package.json
  100. +7 −7 node_modules/socket.io/node_modules/socket.io-client/package.json
  101. +6 −6 node_modules/socket.io/package.json
  102. +95 −0 node_modules/socket.io/restrict_jsonp.patch
  103. +3 −3 package.json
View
2  docs/files.html
@@ -304,7 +304,7 @@ <h1 class="classTitle">File Index</h1>
</div>
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Wed May 30 2012 16:48:00 GMT+0200 (CEST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Fri Jun 15 2012 23:34:12 GMT+0200 (CEST)
</div>
</body>
</html>
View
2  docs/index.html
@@ -246,7 +246,7 @@ <h1 class="classTitle">Class Index</h1>
</div>
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Wed May 30 2012 16:48:00 GMT+0200 (CEST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Fri Jun 15 2012 23:34:12 GMT+0200 (CEST)
</div>
</body>
</html>
View
2  docs/symbols/LocalStore.html
@@ -398,7 +398,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Wed May 30 2012 16:48:00 GMT+0200 (CEST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Fri Jun 15 2012 23:34:11 GMT+0200 (CEST)
</div>
</body>
</html>
View
2  docs/symbols/ModelPlugin.html
@@ -871,7 +871,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Wed May 30 2012 16:48:00 GMT+0200 (CEST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Fri Jun 15 2012 23:34:12 GMT+0200 (CEST)
</div>
</body>
</html>
View
2  docs/symbols/OObject.html
@@ -729,7 +729,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Wed May 30 2012 16:48:00 GMT+0200 (CEST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Fri Jun 15 2012 23:34:12 GMT+0200 (CEST)
</div>
</body>
</html>
View
2  docs/symbols/Plugins.html
@@ -632,7 +632,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Wed May 30 2012 16:48:00 GMT+0200 (CEST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Fri Jun 15 2012 23:34:12 GMT+0200 (CEST)
</div>
</body>
</html>
View
2  docs/symbols/Transport.html
@@ -815,7 +815,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Wed May 30 2012 16:48:00 GMT+0200 (CEST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Fri Jun 15 2012 23:34:12 GMT+0200 (CEST)
</div>
</body>
</html>
View
2  docs/symbols/_global_.html
@@ -253,7 +253,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Wed May 30 2012 16:48:00 GMT+0200 (CEST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Fri Jun 15 2012 23:34:11 GMT+0200 (CEST)
</div>
</body>
</html>
View
56 lib/require.js
@@ -1,31 +1,35 @@
/*
- RequireJS 1.0.2 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
+ RequireJS 2.0.2 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
Available via the MIT or new BSD license.
see: http://github.com/jrburke/requirejs for details
*/
var requirejs,require,define;
-(function(){function J(a){return M.call(a)==="[object Function]"}function E(a){return M.call(a)==="[object Array]"}function Z(a,c,h){for(var k in c)if(!(k in K)&&(!(k in a)||h))a[k]=c[k];return d}function N(a,c,d){a=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+a);if(d)a.originalError=d;return a}function $(a,c,d){var k,j,q;for(k=0;q=c[k];k++){q=typeof q==="string"?{name:q}:q;j=q.location;if(d&&(!j||j.indexOf("/")!==0&&j.indexOf(":")===-1))j=d+"/"+(j||q.name);a[q.name]={name:q.name,location:j||
-q.name,main:(q.main||"main").replace(ea,"").replace(aa,"")}}}function V(a,c){a.holdReady?a.holdReady(c):c?a.readyWait+=1:a.ready(!0)}function fa(a){function c(b,l){var f,a;if(b&&b.charAt(0)===".")if(l){p.pkgs[l]?l=[l]:(l=l.split("/"),l=l.slice(0,l.length-1));f=b=l.concat(b.split("/"));var c;for(a=0;c=f[a];a++)if(c===".")f.splice(a,1),a-=1;else if(c==="..")if(a===1&&(f[2]===".."||f[0]===".."))break;else a>0&&(f.splice(a-1,2),a-=2);a=p.pkgs[f=b[0]];b=b.join("/");a&&b===f+"/"+a.main&&(b=f)}else b.indexOf("./")===
-0&&(b=b.substring(2));return b}function h(b,l){var f=b?b.indexOf("!"):-1,a=null,d=l?l.name:null,i=b,e,h;f!==-1&&(a=b.substring(0,f),b=b.substring(f+1,b.length));a&&(a=c(a,d));b&&(a?e=(f=m[a])&&f.normalize?f.normalize(b,function(b){return c(b,d)}):c(b,d):(e=c(b,d),h=E[e],h||(h=g.nameToUrl(e,null,l),E[e]=h)));return{prefix:a,name:e,parentMap:l,url:h,originalName:i,fullName:a?a+"!"+(e||""):e}}function k(){var b=!0,l=p.priorityWait,f,a;if(l){for(a=0;f=l[a];a++)if(!s[f]){b=!1;break}b&&delete p.priorityWait}return b}
-function j(b,l,f){return function(){var a=ga.call(arguments,0),c;if(f&&J(c=a[a.length-1]))c.__requireJsBuild=!0;a.push(l);return b.apply(null,a)}}function q(b,l){var a=j(g.require,b,l);Z(a,{nameToUrl:j(g.nameToUrl,b),toUrl:j(g.toUrl,b),defined:j(g.requireDefined,b),specified:j(g.requireSpecified,b),isBrowser:d.isBrowser});return a}function o(b){var l,a,c,C=b.callback,i=b.map,e=i.fullName,ba=b.deps;c=b.listeners;if(C&&J(C)){if(p.catchError.define)try{a=d.execCb(e,b.callback,ba,m[e])}catch(k){l=k}else a=
-d.execCb(e,b.callback,ba,m[e]);if(e)(C=b.cjsModule)&&C.exports!==void 0&&C.exports!==m[e]?a=m[e]=b.cjsModule.exports:a===void 0&&b.usingExports?a=m[e]:(m[e]=a,F[e]&&(Q[e]=!0))}else e&&(a=m[e]=C,F[e]&&(Q[e]=!0));if(D[b.id])delete D[b.id],b.isDone=!0,g.waitCount-=1,g.waitCount===0&&(I=[]);delete R[e];if(d.onResourceLoad&&!b.placeholder)d.onResourceLoad(g,i,b.depArray);if(l)return a=(e?h(e).url:"")||l.fileName||l.sourceURL,c=l.moduleTree,l=N("defineerror",'Error evaluating module "'+e+'" at location "'+
-a+'":\n'+l+"\nfileName:"+a+"\nlineNumber: "+(l.lineNumber||l.line),l),l.moduleName=e,l.moduleTree=c,d.onError(l);for(l=0;C=c[l];l++)C(a)}function r(b,a){return function(f){b.depDone[a]||(b.depDone[a]=!0,b.deps[a]=f,b.depCount-=1,b.depCount||o(b))}}function u(b,a){var f=a.map,c=f.fullName,h=f.name,i=L[b]||(L[b]=m[b]),e;if(!a.loading)a.loading=!0,e=function(b){a.callback=function(){return b};o(a);s[a.id]=!0;w()},e.fromText=function(b,a){var l=O;s[b]=!1;g.scriptCount+=1;g.fake[b]=!0;l&&(O=!1);d.exec(a);
-l&&(O=!0);g.completeLoad(b)},c in m?e(m[c]):i.load(h,q(f.parentMap,!0),e,p)}function v(b){D[b.id]||(D[b.id]=b,I.push(b),g.waitCount+=1)}function B(b){this.listeners.push(b)}function t(b,a){var f=b.fullName,c=b.prefix,d=c?L[c]||(L[c]=m[c]):null,i,e;f&&(i=R[f]);if(!i&&(e=!0,i={id:(c&&!d?M++ +"__p@:":"")+(f||"__r@"+M++),map:b,depCount:0,depDone:[],depCallbacks:[],deps:[],listeners:[],add:B},y[i.id]=!0,f&&(!c||L[c])))R[f]=i;c&&!d?(f=t(h(c),!0),f.add(function(){var a=h(b.originalName,b.parentMap),a=t(a,
-!0);i.placeholder=!0;a.add(function(b){i.callback=function(){return b};o(i)})})):e&&a&&(s[i.id]=!1,g.paused.push(i),v(i));return i}function x(b,a,f,c){var b=h(b,c),d=b.name,i=b.fullName,e=t(b),k=e.id,j=e.deps,n;if(i){if(i in m||s[k]===!0||i==="jquery"&&p.jQuery&&p.jQuery!==f().fn.jquery)return;y[k]=!0;s[k]=!0;i==="jquery"&&f&&S(f())}e.depArray=a;e.callback=f;for(f=0;f<a.length;f++)if(k=a[f])k=h(k,d?b:c),n=k.fullName,a[f]=n,n==="require"?j[f]=q(b):n==="exports"?(j[f]=m[i]={},e.usingExports=!0):n===
-"module"?e.cjsModule=j[f]={id:d,uri:d?g.nameToUrl(d,null,c):void 0,exports:m[i]}:n in m&&!(n in D)&&(!(i in F)||i in F&&Q[n])?j[f]=m[n]:(i in F&&(F[n]=!0,delete m[n],T[k.url]=!1),e.depCount+=1,e.depCallbacks[f]=r(e,f),t(k,!0).add(e.depCallbacks[f]));e.depCount?v(e):o(e)}function n(b){x.apply(null,b)}function z(b,a){if(!b.isDone){var c=b.map.fullName,d=b.depArray,g,i,e,k;if(c){if(a[c])return m[c];a[c]=!0}if(d)for(g=0;g<d.length;g++)if(i=d[g])if((e=h(i).prefix)&&(k=D[e])&&z(k,a),(e=D[i])&&!e.isDone&&
-s[i])i=z(e,a),b.depCallbacks[g](i);return c?m[c]:void 0}}function A(){var b=p.waitSeconds*1E3,a=b&&g.startTime+b<(new Date).getTime(),b="",c=!1,h=!1,j;if(!(g.pausedCount>0)){if(p.priorityWait)if(k())w();else return;for(j in s)if(!(j in K)&&(c=!0,!s[j]))if(a)b+=j+" ";else{h=!0;break}if(c||g.waitCount){if(a&&b)return j=N("timeout","Load timeout for modules: "+b),j.requireType="timeout",j.requireModules=b,d.onError(j);if(h||g.scriptCount){if((G||ca)&&!W)W=setTimeout(function(){W=0;A()},50)}else{if(g.waitCount){for(H=
-0;b=I[H];H++)z(b,{});g.paused.length&&w();X<5&&(X+=1,A())}X=0;d.checkReadyState()}}}}var g,w,p={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},catchError:{}},P=[],y={require:!0,exports:!0,module:!0},E={},m={},s={},D={},I=[],T={},M=0,R={},L={},F={},Q={},Y=0;S=function(b){if(!g.jQuery&&(b=b||(typeof jQuery!=="undefined"?jQuery:null))&&!(p.jQuery&&b.fn.jquery!==p.jQuery)&&("holdReady"in b||"readyWait"in b))if(g.jQuery=b,n(["jquery",[],function(){return jQuery}]),g.scriptCount)V(b,!0),g.jQueryIncremented=
-!0};w=function(){var b,a,c,h,j,i;Y+=1;if(g.scriptCount<=0)g.scriptCount=0;for(;P.length;)if(b=P.shift(),b[0]===null)return d.onError(N("mismatch","Mismatched anonymous define() module: "+b[b.length-1]));else n(b);if(!p.priorityWait||k())for(;g.paused.length;){j=g.paused;g.pausedCount+=j.length;g.paused=[];for(h=0;b=j[h];h++)a=b.map,c=a.url,i=a.fullName,a.prefix?u(a.prefix,b):!T[c]&&!s[i]&&(d.load(g,i,c),c.indexOf("empty:")!==0&&(T[c]=!0));g.startTime=(new Date).getTime();g.pausedCount-=j.length}Y===
-1&&A();Y-=1};g={contextName:a,config:p,defQueue:P,waiting:D,waitCount:0,specified:y,loaded:s,urlMap:E,urlFetched:T,scriptCount:0,defined:m,paused:[],pausedCount:0,plugins:L,needFullExec:F,fake:{},fullExec:Q,managerCallbacks:R,makeModuleMap:h,normalize:c,configure:function(b){var a,c,d;b.baseUrl&&b.baseUrl.charAt(b.baseUrl.length-1)!=="/"&&(b.baseUrl+="/");a=p.paths;d=p.pkgs;Z(p,b,!0);if(b.paths){for(c in b.paths)c in K||(a[c]=b.paths[c]);p.paths=a}if((a=b.packagePaths)||b.packages){if(a)for(c in a)c in
-K||$(d,a[c],c);b.packages&&$(d,b.packages);p.pkgs=d}if(b.priority)c=g.requireWait,g.requireWait=!1,g.takeGlobalQueue(),w(),g.require(b.priority),w(),g.requireWait=c,p.priorityWait=b.priority;if(b.deps||b.callback)g.require(b.deps||[],b.callback)},requireDefined:function(b,a){return h(b,a).fullName in m},requireSpecified:function(b,a){return h(b,a).fullName in y},require:function(b,c,f){if(typeof b==="string"){if(J(c))return d.onError(N("requireargs","Invalid require call"));if(d.get)return d.get(g,
-b,c);c=h(b,c);b=c.fullName;return!(b in m)?d.onError(N("notloaded","Module name '"+c.fullName+"' has not been loaded yet for context: "+a)):m[b]}(b&&b.length||c)&&x(null,b,c,f);if(!g.requireWait)for(;!g.scriptCount&&g.paused.length;)g.takeGlobalQueue(),w();return g.require},takeGlobalQueue:function(){U.length&&(ha.apply(g.defQueue,[g.defQueue.length-1,0].concat(U)),U=[])},completeLoad:function(b){var a;for(g.takeGlobalQueue();P.length;)if(a=P.shift(),a[0]===null){a[0]=b;break}else if(a[0]===b)break;
-else n(a),a=null;a?n(a):n([b,[],b==="jquery"&&typeof jQuery!=="undefined"?function(){return jQuery}:null]);S();d.isAsync&&(g.scriptCount-=1);w();d.isAsync||(g.scriptCount-=1)},toUrl:function(a,c){var d=a.lastIndexOf("."),h=null;d!==-1&&(h=a.substring(d,a.length),a=a.substring(0,d));return g.nameToUrl(a,h,c)},nameToUrl:function(a,h,f){var j,k,i,e,m=g.config,a=c(a,f&&f.fullName);if(d.jsExtRegExp.test(a))h=a+(h?h:"");else{j=m.paths;k=m.pkgs;f=a.split("/");for(e=f.length;e>0;e--)if(i=f.slice(0,e).join("/"),
-j[i]){f.splice(0,e,j[i]);break}else if(i=k[i]){a=a===i.name?i.location+"/"+i.main:i.location;f.splice(0,e,a);break}h=f.join("/")+(h||".js");h=(h.charAt(0)==="/"||h.match(/^\w+:/)?"":m.baseUrl)+h}return m.urlArgs?h+((h.indexOf("?")===-1?"?":"&")+m.urlArgs):h}};g.jQueryCheck=S;g.resume=w;return g}function ia(){var a,c,d;if(n&&n.readyState==="interactive")return n;a=document.getElementsByTagName("script");for(c=a.length-1;c>-1&&(d=a[c]);c--)if(d.readyState==="interactive")return n=d;return null}var ja=
-/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,ka=/require\(\s*["']([^'"\s]+)["']\s*\)/g,ea=/^\.\//,aa=/\.js$/,M=Object.prototype.toString,r=Array.prototype,ga=r.slice,ha=r.splice,G=!!(typeof window!=="undefined"&&navigator&&document),ca=!G&&typeof importScripts!=="undefined",la=G&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,da=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",K={},t={},U=[],n=null,X=0,O=!1,d,r={},I,v,x,y,u,z,A,H,B,S,W;if(typeof define==="undefined"){if(typeof requirejs!==
-"undefined")if(J(requirejs))return;else r=requirejs,requirejs=void 0;typeof require!=="undefined"&&!J(require)&&(r=require,require=void 0);d=requirejs=function(a,c,d){var k="_",j;!E(a)&&typeof a!=="string"&&(j=a,E(c)?(a=c,c=d):a=[]);if(j&&j.context)k=j.context;d=t[k]||(t[k]=fa(k));j&&d.configure(j);return d.require(a,c)};d.config=function(a){return d(a)};require||(require=d);d.toUrl=function(a){return t._.toUrl(a)};d.version="1.0.2";d.jsExtRegExp=/^\/|:|\?|\.js$/;v=d.s={contexts:t,skipAsync:{}};if(d.isAsync=
-d.isBrowser=G)if(x=v.head=document.getElementsByTagName("head")[0],y=document.getElementsByTagName("base")[0])x=v.head=y.parentNode;d.onError=function(a){throw a;};d.load=function(a,c,h){d.resourcesReady(!1);a.scriptCount+=1;d.attach(h,a,c);if(a.jQuery&&!a.jQueryIncremented)V(a.jQuery,!0),a.jQueryIncremented=!0};define=function(a,c,d){var k,j;typeof a!=="string"&&(d=c,c=a,a=null);E(c)||(d=c,c=[]);!c.length&&J(d)&&d.length&&(d.toString().replace(ja,"").replace(ka,function(a,d){c.push(d)}),c=(d.length===
-1?["require"]:["require","exports","module"]).concat(c));if(O&&(k=I||ia()))a||(a=k.getAttribute("data-requiremodule")),j=t[k.getAttribute("data-requirecontext")];(j?j.defQueue:U).push([a,c,d])};define.amd={multiversion:!0,plugins:!0,jQuery:!0};d.exec=function(a){return eval(a)};d.execCb=function(a,c,d,k){return c.apply(k,d)};d.addScriptToDom=function(a){I=a;y?x.insertBefore(a,y):x.appendChild(a);I=null};d.onScriptLoad=function(a){var c=a.currentTarget||a.srcElement,h;if(a.type==="load"||c&&la.test(c.readyState))n=
-null,a=c.getAttribute("data-requirecontext"),h=c.getAttribute("data-requiremodule"),t[a].completeLoad(h),c.detachEvent&&!da?c.detachEvent("onreadystatechange",d.onScriptLoad):c.removeEventListener("load",d.onScriptLoad,!1)};d.attach=function(a,c,h,k,j,n){var o;if(G)return k=k||d.onScriptLoad,o=c&&c.config&&c.config.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"),o.type=j||"text/javascript",o.charset="utf-8",o.async=!v.skipAsync[a],c&&o.setAttribute("data-requirecontext",
-c.contextName),o.setAttribute("data-requiremodule",h),o.attachEvent&&!da?(O=!0,n?o.onreadystatechange=function(){if(o.readyState==="loaded")o.onreadystatechange=null,o.attachEvent("onreadystatechange",k),n(o)}:o.attachEvent("onreadystatechange",k)):o.addEventListener("load",k,!1),o.src=a,n||d.addScriptToDom(o),o;else ca&&(importScripts(a),c.completeLoad(h));return null};if(G){u=document.getElementsByTagName("script");for(H=u.length-1;H>-1&&(z=u[H]);H--){if(!x)x=z.parentNode;if(A=z.getAttribute("data-main")){if(!r.baseUrl)u=
-A.split("/"),z=u.pop(),u=u.length?u.join("/")+"/":"./",r.baseUrl=u,A=z.replace(aa,"");r.deps=r.deps?r.deps.concat(A):[A];break}}}d.checkReadyState=function(){var a=v.contexts,c;for(c in a)if(!(c in K)&&a[c].waitCount)return;d.resourcesReady(!0)};d.resourcesReady=function(a){var c,h;d.resourcesDone=a;if(d.resourcesDone)for(h in a=v.contexts,a)if(!(h in K)&&(c=a[h],c.jQueryIncremented))V(c.jQuery,!1),c.jQueryIncremented=!1};d.pageLoaded=function(){if(document.readyState!=="complete")document.readyState=
-"complete"};if(G&&document.addEventListener&&!document.readyState)document.readyState="loading",window.addEventListener("load",d.pageLoaded,!1);d(r);if(d.isAsync&&typeof setTimeout!=="undefined")B=v.contexts[r.context||"_"],B.requireWait=!0,setTimeout(function(){B.requireWait=!1;B.takeGlobalQueue();B.jQueryCheck();B.scriptCount||B.resume();d.checkReadyState()},0)}})();
+(function(Z){function w(b){return J.call(b)==="[object Function]"}function G(b){return J.call(b)==="[object Array]"}function q(b,d){if(b){var f;for(f=0;f<b.length;f+=1)if(b[f]&&d(b[f],f,b))break}}function N(b,d){if(b){var f;for(f=b.length-1;f>-1;f-=1)if(b[f]&&d(b[f],f,b))break}}function x(b,d){for(var f in b)if(b.hasOwnProperty(f)&&d(b[f],f))break}function K(b,d,f,g){d&&x(d,function(d,k){if(f||!b.hasOwnProperty(k))g&&typeof d!=="string"?(b[k]||(b[k]={}),K(b[k],d,f,g)):b[k]=d});return b}function s(b,
+d){return function(){return d.apply(b,arguments)}}function $(b){if(!b)return b;var d=Z;q(b.split("."),function(b){d=d[b]});return d}function aa(b,d,f){return function(){var g=ga.call(arguments,0),e;if(f&&w(e=g[g.length-1]))e.__requireJsBuild=!0;g.push(d);return b.apply(null,g)}}function ba(b,d,f){q([["toUrl"],["undef"],["defined","requireDefined"],["specified","requireSpecified"]],function(g){var e=g[1]||g[0];b[g[0]]=d?aa(d[e],f):function(){var b=t[O];return b[e].apply(b,arguments)}})}function H(b,
+d,f,g){d=Error(d+"\nhttp://requirejs.org/docs/errors.html#"+b);d.requireType=b;d.requireModules=g;if(f)d.originalError=f;return d}function ha(){if(I&&I.readyState==="interactive")return I;N(document.getElementsByTagName("script"),function(b){if(b.readyState==="interactive")return I=b});return I}var ia=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,ja=/require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,ca=/\.js$/,ka=/^\.\//,J=Object.prototype.toString,y=Array.prototype,ga=y.slice,la=y.splice,u=!!(typeof window!==
+"undefined"&&navigator&&document),da=!u&&typeof importScripts!=="undefined",ma=u&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,O="_",S=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",t={},p={},P=[],L=!1,k,v,C,z,D,I,E,ea,fa;if(typeof define==="undefined"){if(typeof requirejs!=="undefined"){if(w(requirejs))return;p=requirejs;requirejs=void 0}typeof require!=="undefined"&&!w(require)&&(p=require,require=void 0);k=requirejs=function(b,d,f,g){var e=O,r;!G(b)&&
+typeof b!=="string"&&(r=b,G(d)?(b=d,d=f,f=g):b=[]);if(r&&r.context)e=r.context;(g=t[e])||(g=t[e]=k.s.newContext(e));r&&g.configure(r);return g.require(b,d,f)};k.config=function(b){return k(b)};require||(require=k);k.version="2.0.2";k.jsExtRegExp=/^\/|:|\?|\.js$/;k.isBrowser=u;y=k.s={contexts:t,newContext:function(b){function d(a,c,l){var A=c&&c.split("/"),b=m.map,i=b&&b["*"],h,d,f,e;if(a&&a.charAt(0)===".")if(c){A=m.pkgs[c]?[c]:A.slice(0,A.length-1);c=a=A.concat(a.split("/"));for(h=0;c[h];h+=1)if(d=
+c[h],d===".")c.splice(h,1),h-=1;else if(d==="..")if(h===1&&(c[2]===".."||c[0]===".."))break;else h>0&&(c.splice(h-1,2),h-=2);h=m.pkgs[c=a[0]];a=a.join("/");h&&a===c+"/"+h.main&&(a=c)}else a.indexOf("./")===0&&(a=a.substring(2));if(l&&(A||i)&&b){c=a.split("/");for(h=c.length;h>0;h-=1){f=c.slice(0,h).join("/");if(A)for(d=A.length;d>0;d-=1)if(l=b[A.slice(0,d).join("/")])if(l=l[f]){e=l;break}!e&&i&&i[f]&&(e=i[f]);if(e){c.splice(0,h,e);a=c.join("/");break}}}return a}function f(a){u&&q(document.getElementsByTagName("script"),
+function(c){if(c.getAttribute("data-requiremodule")===a&&c.getAttribute("data-requirecontext")===j.contextName)return c.parentNode.removeChild(c),!0})}function g(a){var c=m.paths[a];if(c&&G(c)&&c.length>1)return f(a),c.shift(),j.undef(a),j.require([a]),!0}function e(a,c,l,b){var T=a?a.indexOf("!"):-1,i=null,h=c?c.name:null,f=a,e=!0,g="",k,m;a||(e=!1,a="_@r"+(N+=1));T!==-1&&(i=a.substring(0,T),a=a.substring(T+1,a.length));i&&(i=d(i,h,b),m=o[i]);a&&(i?g=m&&m.normalize?m.normalize(a,function(a){return d(a,
+h,b)}):d(a,h,b):(g=d(a,h,b),k=j.nameToUrl(a,null,c)));a=i&&!m&&!l?"_unnormalized"+(O+=1):"";return{prefix:i,name:g,parentMap:c,unnormalized:!!a,url:k,originalName:f,isDefine:e,id:(i?i+"!"+g:g)+a}}function r(a){var c=a.id,l=n[c];l||(l=n[c]=new j.Module(a));return l}function p(a,c,l){var b=a.id,d=n[b];if(o.hasOwnProperty(b)&&(!d||d.defineEmitComplete))c==="defined"&&l(o[b]);else r(a).on(c,l)}function B(a,c){var l=a.requireModules,b=!1;if(c)c(a);else if(q(l,function(c){if(c=n[c])c.error=a,c.events.error&&
+(b=!0,c.emit("error",a))}),!b)k.onError(a)}function v(){P.length&&(la.apply(F,[F.length-1,0].concat(P)),P=[])}function t(a,c,l){a=a&&a.map;c=aa(l||j.require,a,c);ba(c,j,a);c.isBrowser=u;return c}function y(a){delete n[a];q(M,function(c,l){if(c.map.id===a)return M.splice(l,1),c.defined||(j.waitCount-=1),!0})}function z(a,c){var l=a.map.id,b=a.depMaps,d;if(a.inited){if(c[l])return a;c[l]=!0;q(b,function(a){if(a=n[a.id])return!a.inited||!a.enabled?(d=null,delete c[l],!0):d=z(a,K({},c))});return d}}function C(a,
+c,b){var d=a.map.id,e=a.depMaps;if(a.inited&&a.map.isDefine){if(c[d])return o[d];c[d]=a;q(e,function(i){var i=i.id,h=n[i];!Q[i]&&h&&(!h.inited||!h.enabled?b[d]=!0:(h=C(h,c,b),b[i]||a.defineDepById(i,h)))});a.check(!0);return o[d]}}function D(a){a.check()}function E(){var a=m.waitSeconds*1E3,c=a&&j.startTime+a<(new Date).getTime(),b=[],d=!1,e=!0,i,h,k;if(!U){U=!0;x(n,function(a){i=a.map;h=i.id;if(a.enabled&&!a.error)if(!a.inited&&c)g(h)?d=k=!0:(b.push(h),f(h));else if(!a.inited&&a.fetched&&i.isDefine&&
+(d=!0,!i.prefix))return e=!1});if(c&&b.length)return a=H("timeout","Load timeout for modules: "+b,null,b),a.contextName=j.contextName,B(a);e&&(q(M,function(a){if(!a.defined){var a=z(a,{}),c={};a&&(C(a,c,{}),x(c,D))}}),x(n,D));if((!c||k)&&d)if((u||da)&&!V)V=setTimeout(function(){V=0;E()},50);U=!1}}function W(a){r(e(a[0],null,!0)).init(a[1],a[2])}function J(a){var a=a.currentTarget||a.srcElement,c=j.onScriptLoad;a.detachEvent&&!S?a.detachEvent("onreadystatechange",c):a.removeEventListener("load",c,
+!1);c=j.onScriptError;a.detachEvent&&!S||a.removeEventListener("error",c,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}var m={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{}},n={},X={},F=[],o={},R={},N=1,O=1,M=[],U,Y,j,Q,V;Q={require:function(a){return t(a)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports=o[a.map.id]={}},module:function(a){return a.module={id:a.map.id,uri:a.map.url,config:function(){return m.config&&m.config[a.map.id]||{}},exports:o[a.map.id]}}};
+Y=function(a){this.events=X[a.id]||{};this.map=a;this.shim=m.shim[a.id];this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};Y.prototype={init:function(a,c,b,d){d=d||{};if(!this.inited){this.factory=c;if(b)this.on("error",b);else this.events.error&&(b=s(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.depMaps.rjsSkipMap=a.rjsSkipMap;this.errback=b;this.inited=!0;this.ignore=d.ignore;d.enabled||this.enabled?this.enable():this.check()}},defineDepById:function(a,
+c){var b;q(this.depMaps,function(c,d){if(c.id===a)return b=d,!0});return this.defineDep(b,c)},defineDep:function(a,c){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=c)},fetch:function(){if(!this.fetched){this.fetched=!0;j.startTime=(new Date).getTime();var a=this.map;if(this.shim)t(this,!0)(this.shim.deps||[],s(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=this.map.url;R[a]||
+(R[a]=!0,j.load(this.map.id,a))},check:function(a){if(this.enabled&&!this.enabling){var c=this.map.id,b=this.depExports,d=this.exports,e=this.factory,i;if(this.inited)if(this.error)this.emit("error",this.error);else{if(!this.defining){this.defining=!0;if(this.depCount<1&&!this.defined){if(w(e)){if(this.events.error)try{d=j.execCb(c,e,b,d)}catch(h){i=h}else d=j.execCb(c,e,b,d);if(this.map.isDefine)if((b=this.module)&&b.exports!==void 0&&b.exports!==this.exports)d=b.exports;else if(d===void 0&&this.usingExports)d=
+this.exports;if(i)return i.requireMap=this.map,i.requireModules=[this.map.id],i.requireType="define",B(this.error=i)}else d=e;this.exports=d;if(this.map.isDefine&&!this.ignore&&(o[c]=d,k.onResourceLoad))k.onResourceLoad(j,this.map,this.depMaps);delete n[c];this.defined=!0;j.waitCount-=1;j.waitCount===0&&(M=[])}this.defining=!1;if(!a&&this.defined&&!this.defineEmitted)this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0}}else this.fetch()}},callPlugin:function(){var a=
+this.map,c=a.id,b=e(a.prefix,null,!1,!0);p(b,"defined",s(this,function(b){var l=this.map.name,i=this.map.parentMap?this.map.parentMap.name:null;if(this.map.unnormalized){if(b.normalize&&(l=b.normalize(l,function(a){return d(a,i,!0)})||""),b=e(a.prefix+"!"+l,this.map.parentMap,!1,!0),p(b,"defined",s(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),b=n[b.id]){if(this.events.error)b.on("error",s(this,function(a){this.emit("error",a)}));b.enable()}}else l=s(this,function(a){this.init([],
+function(){return a},null,{enabled:!0})}),l.error=s(this,function(a){this.inited=!0;this.error=a;a.requireModules=[c];x(n,function(a){a.map.id.indexOf(c+"_unnormalized")===0&&y(a.map.id)});B(a)}),l.fromText=function(a,c){var b=L;b&&(L=!1);r(e(a));k.exec(c);b&&(L=!0);j.completeLoad(a)},b.load(a.name,t(a.parentMap,!0,function(a,c){a.rjsSkipMap=!0;return j.require(a,c)}),l,m)}));j.enable(b,this);this.pluginMaps[b.id]=b},enable:function(){this.enabled=!0;if(!this.waitPushed)M.push(this),j.waitCount+=
+1,this.waitPushed=!0;this.enabling=!0;q(this.depMaps,s(this,function(a,c){var b,d;if(typeof a==="string"){a=e(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.depMaps.rjsSkipMap);this.depMaps[c]=a;if(b=Q[a.id]){this.depExports[c]=b(this);return}this.depCount+=1;p(a,"defined",s(this,function(a){this.defineDep(c,a);this.check()}));this.errback&&p(a,"error",this.errback)}b=a.id;d=n[b];!Q[b]&&d&&!d.enabled&&j.enable(a,this)}));x(this.pluginMaps,s(this,function(a){var c=n[a.id];c&&!c.enabled&&
+j.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,c){var b=this.events[a];b||(b=this.events[a]=[]);b.push(c)},emit:function(a,c){q(this.events[a],function(a){a(c)});a==="error"&&delete this.events[a]}};return j={config:m,contextName:b,registry:n,defined:o,urlFetched:R,waitCount:0,defQueue:F,Module:Y,makeModuleMap:e,configure:function(a){a.baseUrl&&a.baseUrl.charAt(a.baseUrl.length-1)!=="/"&&(a.baseUrl+="/");var c=m.pkgs,b=m.shim,d=m.paths,f=m.map;K(m,a,!0);m.paths=K(d,a.paths,!0);if(a.map)m.map=
+K(f||{},a.map,!0,!0);if(a.shim)x(a.shim,function(a,c){G(a)&&(a={deps:a});if(a.exports&&!a.exports.__buildReady)a.exports=j.makeShimExports(a.exports);b[c]=a}),m.shim=b;if(a.packages)q(a.packages,function(a){a=typeof a==="string"?{name:a}:a;c[a.name]={name:a.name,location:a.location||a.name,main:(a.main||"main").replace(ka,"").replace(ca,"")}}),m.pkgs=c;x(n,function(a,c){a.map=e(c)});if(a.deps||a.callback)j.require(a.deps||[],a.callback)},makeShimExports:function(a){var c;return typeof a==="string"?
+(c=function(){return $(a)},c.exports=a,c):function(){return a.apply(Z,arguments)}},requireDefined:function(a,c){var b=e(a,c,!1,!0).id;return o.hasOwnProperty(b)},requireSpecified:function(a,c){a=e(a,c,!1,!0).id;return o.hasOwnProperty(a)||n.hasOwnProperty(a)},require:function(a,c,d,f){var g;if(typeof a==="string"){if(w(c))return B(H("requireargs","Invalid require call"),d);if(k.get)return k.get(j,a,c);a=e(a,c,!1,!0);a=a.id;return!o.hasOwnProperty(a)?B(H("notloaded",'Module name "'+a+'" has not been loaded yet for context: '+
+b)):o[a]}d&&!w(d)&&(f=d,d=void 0);c&&!w(c)&&(f=c,c=void 0);for(v();F.length;)if(g=F.shift(),g[0]===null)return B(H("mismatch","Mismatched anonymous define() module: "+g[g.length-1]));else W(g);r(e(null,f)).init(a,c,d,{enabled:!0});E();return j.require},undef:function(a){var c=e(a,null,!0),b=n[a];delete o[a];delete R[c.url];delete X[a];if(b){if(b.events.defined)X[a]=b.events;y(a)}},enable:function(a){n[a.id]&&r(a).enable()},completeLoad:function(a){var c=m.shim[a]||{},b=c.exports&&c.exports.exports,
+d,e;for(v();F.length;){e=F.shift();if(e[0]===null){e[0]=a;if(d)break;d=!0}else e[0]===a&&(d=!0);W(e)}e=n[a];if(!d&&!o[a]&&e&&!e.inited)if(m.enforceDefine&&(!b||!$(b)))if(g(a))return;else return B(H("nodefine","No define call for "+a,null,[a]));else W([a,c.deps||[],c.exports]);E()},toUrl:function(a,b){var d=a.lastIndexOf("."),e=null;d!==-1&&(e=a.substring(d,a.length),a=a.substring(0,d));return j.nameToUrl(a,e,b)},nameToUrl:function(a,b,e){var f,g,i,h,j,a=d(a,e&&e.id,!0);if(k.jsExtRegExp.test(a))b=
+a+(b||"");else{f=m.paths;g=m.pkgs;e=a.split("/");for(h=e.length;h>0;h-=1)if(j=e.slice(0,h).join("/"),i=g[j],j=f[j]){G(j)&&(j=j[0]);e.splice(0,h,j);break}else if(i){a=a===i.name?i.location+"/"+i.main:i.location;e.splice(0,h,a);break}b=e.join("/")+(b||".js");b=(b.charAt(0)==="/"||b.match(/^[\w\+\.\-]+:/)?"":m.baseUrl)+b}return m.urlArgs?b+((b.indexOf("?")===-1?"?":"&")+m.urlArgs):b},load:function(a,b){k.load(j,a,b)},execCb:function(a,b,d,e){return b.apply(e,d)},onScriptLoad:function(a){if(a.type===
+"load"||ma.test((a.currentTarget||a.srcElement).readyState))I=null,a=J(a),j.completeLoad(a.id)},onScriptError:function(a){var b=J(a);if(!g(b.id))return B(H("scripterror","Script error",a,[b.id]))}}}};k({});ba(k);if(u&&(v=y.head=document.getElementsByTagName("head")[0],C=document.getElementsByTagName("base")[0]))v=y.head=C.parentNode;k.onError=function(b){throw b;};k.load=function(b,d,f){var g=b&&b.config||{},e;if(u)return e=g.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):
+document.createElement("script"),e.type=g.scriptType||"text/javascript",e.charset="utf-8",e.setAttribute("data-requirecontext",b.contextName),e.setAttribute("data-requiremodule",d),e.attachEvent&&!(e.attachEvent.toString&&e.attachEvent.toString().indexOf("[native code")<0)&&!S?(L=!0,e.attachEvent("onreadystatechange",b.onScriptLoad)):(e.addEventListener("load",b.onScriptLoad,!1),e.addEventListener("error",b.onScriptError,!1)),e.src=f,E=e,C?v.insertBefore(e,C):v.appendChild(e),E=null,e;else da&&(importScripts(f),
+b.completeLoad(d))};u&&N(document.getElementsByTagName("script"),function(b){if(!v)v=b.parentNode;if(z=b.getAttribute("data-main")){D=z.split("/");ea=D.pop();fa=D.length?D.join("/")+"/":"./";if(!p.baseUrl)p.baseUrl=fa;z=ea.replace(ca,"");p.deps=p.deps?p.deps.concat(z):[z];return!0}});define=function(b,d,f){var g,e;typeof b!=="string"&&(f=d,d=b,b=null);G(d)||(f=d,d=[]);!d.length&&w(f)&&f.length&&(f.toString().replace(ia,"").replace(ja,function(b,e){d.push(e)}),d=(f.length===1?["require"]:["require",
+"exports","module"]).concat(d));if(L&&(g=E||ha()))b||(b=g.getAttribute("data-requiremodule")),e=t[g.getAttribute("data-requirecontext")];(e?e.defQueue:P).push([b,d,f])};define.amd={jQuery:!0};k.exec=function(b){return eval(b)};k(p)}})(this);
View
1  node_modules/.bin/r.js
View
5,805 node_modules/emily/build/Emily-map
2,946 additions, 2,859 deletions not shown
View
61 node_modules/emily/build/Emily.js
@@ -5,33 +5,34 @@
Copyright (c) 2012 Olivier Scherrer <pode.fr@gmail.com>
*/
-define("CouchDBStore",["Store","StateMachine","Tools","Promise"],function(b,e,h,f){function c(){var c=null,a={},d=new f,b={getView:function(){a.query=a.query||{};a.query.update_seq=true;c.request("CouchDB",{method:"GET",path:"/"+a.database+"/_design/"+a.design+"/_view/"+a.view,query:a.query},function(d){var b=JSON.parse(d);if(b.rows)this.reset(b.rows),i.event("subscribeToViewChanges",b.update_seq);else throw Error("CouchDBStore ["+a.database+", "+a.design+", "+a.view+"].sync() failed: "+d);},this)},
-getDocument:function(){c.request("CouchDB",{method:"GET",path:"/"+a.database+"/"+a.document,query:a.query},function(a){a=JSON.parse(a);a._id?(this.reset(a),i.event("subscribeToDocumentChanges")):d.reject(this)},this)},getBulkDocuments:function(){var d={path:"/"+a.database+"/_all_docs",query:a.query},b;a.keys instanceof Array?(d.method="POST",d.data=JSON.stringify({keys:a.keys}),d.headers={"Content-Type":"application/json"},b=d.data):(d.method="GET",b=JSON.stringify(a.query));a.query.include_docs=
-true;a.query.update_seq=true;c.request("CouchDB",d,function(d){var c=JSON.parse(d);if(c.rows)this.reset(c.rows),i.event("subscribeToBulkChanges",c.update_seq);else throw Error('CouchDBStore.sync("'+a.database+'", '+b+") failed: "+d);},this)},createDocument:function(d){c.request("CouchDB",{method:"PUT",path:"/"+a.database+"/"+a.document,headers:{"Content-Type":"application/json"},data:this.toJSON()},function(a){a=JSON.parse(a);a.ok?(d.resolve(a),i.event("subscribeToDocumentChanges")):d.reject(a)})},
-subscribeToViewChanges:function(d){h.mixin({feed:"continuous",heartbeat:2E4,since:d},a.query);this.stopListening=c.listen("CouchDB",{path:"/"+a.database+"/_changes",query:a.query},function(a){if(a=="\n")return false;var a=JSON.parse(a),d;d=a.deleted?"delete":a.changes[0].rev.search("1-")==0?"add":"change";i.event(d,a.id)},this)},subscribeToDocumentChanges:function(){this.stopListening=c.listen("CouchDB",{path:"/"+a.database+"/_changes",query:{feed:"continuous",heartbeat:2E4}},function(d){if(d=="\n")return false;
-d=JSON.parse(d);d.id==a.document&&d.changes.pop().rev!=this.get("_rev")&&(d.deleted?i.event("deleteDoc"):i.event("updateDoc"))},this)},subscribeToBulkChanges:function(d){h.mixin({feed:"continuous",heartbeat:2E4,since:d,include_docs:true},a.query);this.stopListening=c.listen("CouchDB",{path:"/"+a.database+"/_changes",query:a.query},function(a){if(a=="\n")return false;var a=JSON.parse(a),d;d=a.changes[0].rev.search("1-")==0?"bulkAdd":a.deleted?"delete":"bulkChange";i.event(d,a.id,a.doc)},this)},updateDocInStore:function(d){c.request("CouchDB",
-{method:"GET",path:"/"+a.database+"/_design/"+a.design+"/_view/"+a.view,query:a.query},function(a){JSON.parse(a).rows.some(function(a,b){a.id==d&&this.set(b,a)},this)},this)},addBulkDocInStore:function(d){if(a.query.startkey||a.query.endkey)a.query.include_docs=true,a.query.update_seq=true,c.request("CouchDB",{method:"GET",path:"/"+a.database+"/_all_docs",query:a.query},function(a){JSON.parse(a).rows.forEach(function(a,b){a.id==d&&this.alter("splice",b,0,a.doc)},this)},this);else return false},updateBulkDocInStore:function(a,
-d){this.loop(function(b,c){b.id==a&&this.set(c,d)},this)},removeDocInStore:function(a){this.loop(function(d,b){d.id==a&&this.del(b)},this)},addDocInStore:function(d){c.request("CouchDB",{method:"GET",path:"/"+a.database+"/_design/"+a.design+"/_view/"+a.view,query:a.query},function(a){JSON.parse(a).rows.some(function(a,b){a.id==d&&this.alter("splice",b,0,a)},this)},this)},updateDoc:function(){c.request("CouchDB",{method:"GET",path:"/"+a.database+"/"+a.document},function(a){this.reset(JSON.parse(a))},
-this)},deleteDoc:function(){this.reset({})},updateDatabase:function(d){c.request("CouchDB",{method:"PUT",path:"/"+a.database+"/"+a.document,headers:{"Content-Type":"application/json"},data:this.toJSON()},function(a){a=JSON.parse(a);a.ok?d.resolve(a):d.reject(a)})},updateDatabaseWithBulkDoc:function(d){var b=[];this.loop(function(a){b.push(a.doc)});c.request("CouchDB",{method:"POST",path:"/"+a.database+"/_bulk_docs",headers:{"Content-Type":"application/json"},data:JSON.stringify({docs:b})},function(a){d.resolve(JSON.parse(a))})},
-removeFromDatabase:function(){c.request("CouchDB",{method:"DELETE",path:"/"+a.database+"/"+a.document,query:{rev:this.get("_rev")}})},resolve:function(){d.resolve(this)},unsync:function(){this.stopListening();delete this.stopListening}},i=new e("Unsynched",{Unsynched:[["getView",b.getView,this,"Synched"],["getDocument",b.getDocument,this,"Synched"],["getBulkDocuments",b.getBulkDocuments,this,"Synched"]],Synched:[["updateDatabase",b.createDocument,this],["subscribeToViewChanges",b.subscribeToViewChanges,
-this,"Listening"],["subscribeToDocumentChanges",b.subscribeToDocumentChanges,this,"Listening"],["subscribeToBulkChanges",b.subscribeToBulkChanges,this,"Listening"],["unsync",function(){},"Unsynched"]],Listening:[["entry",b.resolve,this],["change",b.updateDocInStore,this],["bulkAdd",b.addBulkDocInStore,this],["bulkChange",b.updateBulkDocInStore,this],["delete",b.removeDocInStore,this],["add",b.addDocInStore,this],["updateDoc",b.updateDoc,this],["deleteDoc",b.deleteDoc,this],["updateDatabase",b.updateDatabase,
-this],["updateDatabaseWithBulkDoc",b.updateDatabaseWithBulkDoc,this],["removeFromDatabase",b.removeFromDatabase,this],["unsync",b.unsync,this,"Unsynched"]]});this.sync=function(a,b,c,f){if(typeof a=="string"&&typeof b=="string"&&typeof c=="string")return this.setSyncInfo(a,b,c,f),i.event("getView"),d;else if(typeof a=="string"&&typeof b=="string"&&typeof c!="string")return this.setSyncInfo(a,b,c),i.event("getDocument"),d;else if(typeof a=="string"&&b instanceof Object)return this.setSyncInfo(a,b),
-i.event("getBulkDocuments"),d;return false};this.setSyncInfo=function(d,b,c,f){if(typeof d=="string"&&typeof b=="string"&&typeof c=="string")return a.database=d,a.design=b,a.view=c,a.query=f,true;else if(typeof d=="string"&&typeof b=="string"&&typeof c!="string")return a.database=d,a.document=b,a.query=c,true;else if(typeof d=="string"&&b instanceof Object){a.database=d;a.query=b;if(a.query.keys instanceof Array)a.keys=a.query.keys,delete a.query.keys;return true}return false};this.getSyncInfo=function(){return a};
-this.unsync=function(){return i.event("unsync")};this.upload=function(){var d=new f;if(a.document)return i.event("updateDatabase",d),d;else if(!a.view)return i.event("updateDatabaseWithBulkDoc",d),d;return false};this.remove=function(){return a.document?i.event("removeFromDatabase"):false};this.setTransport=function(a){return a&&typeof a.listen=="function"&&typeof a.request=="function"?(c=a,true):false};this.getStateMachine=function(){return i};this.getTransport=function(){return c};this.actions=
-b}return function(){c.prototype=new b;return new c}});
-define("Observable",["Tools"],function(b){return function(){var e={};this.watch=function(b,f,c){if(typeof f=="function"){var g=e[b]=e[b]||[];observer=[f,c];g.push(observer);return[b,g.indexOf(observer)]}else return false};this.unwatch=function(b){var f=b[0],b=b[1];return e[f]&&e[f][b]?(delete e[f][b],e[f].some(function(b){return!!b})||delete e[f],true):false};this.notify=function(h){var f=e[h],c;if(f){for(c=f.length;c--;)f[c]&&f[c][0].apply(f[c][1]||null,b.toArray(arguments).slice(1));return true}else return false};
-this.hasObserver=function(b){return!(!b||!e[b[0]]||!e[b[0]][b[1]])};this.hasTopic=function(b){return!!e[b]};this.unwatchAll=function(b){e[b]?delete e[b]:e={};return true}}});
-define("Promise",["Observable","StateMachine"],function(b,e){return function(){var h,f,c=new e("Unresolved",{Unresolved:[["resolve",function(a){h=a;g.notify("success",a)},"Resolved"],["reject",function(a){f=a;g.notify("fail",a)},"Rejected"],["addSuccess",function(a,d){g.watch("success",a,d)}],["addFail",function(a,d){g.watch("fail",a,d)}]],Resolved:[["addSuccess",function(a,d){a.call(d,h)}]],Rejected:[["addFail",function(a,d){a.call(d,f)}]]}),g=new b;this.resolve=function(a){return c.event("resolve",
-a)};this.reject=function(a){return c.event("reject",a)};this.then=function(a,d,b,f){a instanceof Function&&(d instanceof Function?c.event("addSuccess",a):c.event("addSuccess",a,d));d instanceof Function&&c.event("addFail",d,b);b instanceof Function&&c.event("addFail",b,f);return this};this.getObservable=function(){return g};this.getStateMachine=function(){return c}}});
-define("StateMachine",["Tools"],function(b){function e(){var e={};this.add=function(b,c,g,a){var d=[];if(e[b])return false;return typeof b=="string"&&typeof c=="function"?(d[0]=c,typeof g=="object"&&(d[1]=g),typeof g=="string"&&(d[2]=g),typeof a=="string"&&(d[2]=a),e[b]=d,true):false};this.has=function(b){return!!e[b]};this.get=function(b){return e[b]||false};this.event=function c(c){var g=e[c];return g?(g[0].apply(g[1],b.toArray(arguments).slice(1)),g[2]):false}}return function(h,f){var c={},g="";
-this.init=function(a){return c[a]?(g=a,true):false};this.add=function(a){return c[a]?false:c[a]=new e};this.get=function(a){return c[a]};this.getCurrent=function(){return g};this.event=function(a){var d;d=c[g].event.apply(c[g].event,b.toArray(arguments));return d===false?false:(d&&(c[g].event("exit"),g=d,c[g].event("entry")),true)};b.loop(f,function(a,b){var c=this.add(b);a.forEach(function(a){c.add.apply(null,a)})},this);this.init(h)}});
-define("Store",["Observable","Tools"],function(b,e){return function(h){var f=e.clone(h)||{},c=new b,g=new b,a=function(a){var b=e.objectsDiffs(a,f);["updated","deleted","added"].forEach(function(a){b[a].forEach(function(b){c.notify(a,b,f[b]);g.notify(b,f[b],a)})})};this.getNbItems=function(){return f instanceof Array?f.length:e.count(f)};this.get=function(a){return f[a]};this.has=function(a){return f.hasOwnProperty(a)};this.set=function(a,b){var e;return typeof a!="undefined"?(e=this.has(a),f[a]=
-b,e=e?"updated":"added",c.notify(e,a,f[a]),g.notify(a,f[a],e),true):false};this.update=function(a,b,f){var h;return this.has(a)?(h=this.get(a),e.setNestedProperty(h,b,f),c.notify("updated",b,f),g.notify(a,h,"updated"),true):false};this.del=function(a){return this.has(a)?(this.alter("splice",a,1)||(delete f[a],c.notify("deleted",a),g.notify(a,f[a],"deleted")),true):false};this.delAll=function(a){return a instanceof Array?(a.sort(e.compareNumbers).reverse().forEach(this.del,this),true):false};this.alter=
-function(b){var c,g;return f[b]?(g=e.clone(f),c=f[b].apply(f,Array.prototype.slice.call(arguments,1)),a(g),c):false};this.watch=function(a,b,f){return c.watch(a,b,f)};this.unwatch=function(a){return c.unwatch(a)};this.getStoreObservable=function(){return c};this.watchValue=function(a,b,c){return g.watch(a,b,c)};this.unwatchValue=function(a){return g.unwatch(a)};this.getValueObservable=function(){return g};this.loop=function(a,b){e.loop(f,a,b)};this.reset=function(b){if(b instanceof Object){var c=
-e.clone(f);f=e.clone(b)||{};a(c);return true}else return false};this.toJSON=function(){return JSON.stringify(f)}}});
-define("Tools",function(){return{getGlobal:function(){return function(){return this}.call(null)},mixin:function(b,e,h){this.loop(b,function(f,c){if(!e[c]||!h)e[c]=b[c]});return e},count:function(b){var e=0;this.loop(b,function(){e++});return e},compareObjects:function(b,e){return Object.getOwnPropertyNames(b).sort().join("")==Object.getOwnPropertyNames(e).sort().join("")},compareNumbers:function(b,e){return b>e?1:b<e?-1:0},toArray:function(b){return Array.prototype.slice.call(b)},loop:function(b,
-e,h){var f,c;if(b instanceof Object&&typeof e=="function"){if(c=b.length)for(f=0;f<c;f++)e.call(h,b[f],f,b);else for(f in b)b.hasOwnProperty(f)&&e.call(h,b[f],f,b);return true}else return false},objectsDiffs:function(b,e){if(b instanceof Object&&e instanceof Object){var h=[],f=[],c=[],g=[];this.loop(e,function(a,c){typeof b[c]=="undefined"?g.push(c):a!==b[c]?f.push(c):a===b[c]&&h.push(c)});this.loop(b,function(a,b){typeof e[b]=="undefined"&&c.push(b)});return{updated:f,unchanged:h,added:g,deleted:c}}else return false},
-jsonify:function(b){return b instanceof Object?JSON.parse(JSON.stringify(b)):false},clone:function(b){return b instanceof Array?b.slice(0):typeof b=="object"&&b!==null&&!(b instanceof RegExp)?this.mixin(b,{}):false},getNestedProperty:function(b,e){return b&&b instanceof Object?typeof e=="string"&&e!=""?e.split(".").reduce(function(b,f){return b&&b[f]},b):typeof e=="number"?b[e]:b:b},setNestedProperty:function(b,e,h){if(b&&b instanceof Object)if(typeof e=="string"&&e!=""){var f=e.split(".");return f.reduce(function(b,
-e,a){b[e]=b[e]||{};f.length==a+1&&(b[e]=h);return b[e]},b)}else return typeof e=="number"?(b[e]=h,b[e]):b;else return b}}});
-define("Transport",["Store","Tools"],function(b,e){return function(h){var f=null;this.setReqHandlers=function(c){return c instanceof b?(f=c,true):false};this.getReqHandlers=function(){return f};this.request=function(b,e,a,d){return f.has(b)&&typeof e=="object"?(f.get(b)(e,function(){a&&a.apply(d,arguments)}),true):false};this.listen=function(b,g,a,d){if(f.has(b)&&typeof g=="object"&&typeof g.path=="string"&&typeof a=="function"){var h=function(){a.apply(d,arguments)},i;e.mixin({__keepalive__:true,
-method:"get"},g);i=f.get(b)(g,h,h);return function(){i.func.call(i.scope)}}else return false};this.setReqHandlers(h)}});
+define("CouchDBStore",["Store","StateMachine","Tools","Promise"],function(b,f,h,e){function c(){var g=null,a={},d=new e,c={getView:function(){a.query=a.query||{};a.query.update_seq=true;g.request("CouchDB",{method:"GET",path:"/"+a.database+"/_design/"+a.design+"/"+a.view,query:a.query},function(c){var d=JSON.parse(c);if(d.rows)this.reset(d.rows),typeof d.total_rows=="undefined"&&this.setReducedViewInfo(true),b.event("subscribeToViewChanges",d.update_seq);else throw Error("CouchDBStore ["+a.database+
+", "+a.design+", "+a.view+"].sync() failed: "+c);},this)},getDocument:function(){g.request("CouchDB",{method:"GET",path:"/"+a.database+"/"+a.document,query:a.query},function(a){a=JSON.parse(a);a._id?(this.reset(a),b.event("subscribeToDocumentChanges")):d.reject(this)},this)},getBulkDocuments:function(){var d={path:"/"+a.database+"/_all_docs",query:a.query},c;a.keys instanceof Array?(d.method="POST",d.data=JSON.stringify({keys:a.keys}),d.headers={"Content-Type":"application/json"},c=d.data):(d.method=
+"GET",c=JSON.stringify(a.query));a.query.include_docs=true;a.query.update_seq=true;g.request("CouchDB",d,function(d){var e=JSON.parse(d);if(e.rows)this.reset(e.rows),b.event("subscribeToBulkChanges",e.update_seq);else throw Error('CouchDBStore.sync("'+a.database+'", '+c+") failed: "+d);},this)},createDocument:function(d){g.request("CouchDB",{method:"PUT",path:"/"+a.database+"/"+a.document,headers:{"Content-Type":"application/json"},data:this.toJSON()},function(a){a=JSON.parse(a);a.ok?(d.resolve(a),
+b.event("subscribeToDocumentChanges")):d.reject(a)})},subscribeToViewChanges:function(d){h.mixin({feed:"continuous",heartbeat:2E4,since:d},a.query);this.stopListening=g.listen("CouchDB",{path:"/"+a.database+"/_changes",query:a.query},function(d){if(d=="\n")return false;var d=JSON.parse(d),c;c=a.reducedView?"updateReduced":d.deleted?"delete":d.changes[0].rev.search("1-")==0?"add":"change";b.event(c,d.id)},this)},subscribeToDocumentChanges:function(){this.stopListening=g.listen("CouchDB",{path:"/"+
+a.database+"/_changes",query:{feed:"continuous",heartbeat:2E4}},function(d){if(d=="\n")return false;d=JSON.parse(d);d.id==a.document&&d.changes.pop().rev!=this.get("_rev")&&(d.deleted?b.event("deleteDoc"):b.event("updateDoc"))},this)},subscribeToBulkChanges:function(d){h.mixin({feed:"continuous",heartbeat:2E4,since:d,include_docs:true},a.query);this.stopListening=g.listen("CouchDB",{path:"/"+a.database+"/_changes",query:a.query},function(a){if(a=="\n")return false;var a=JSON.parse(a),d;d=a.changes[0].rev.search("1-")==
+0?"bulkAdd":a.deleted?"delete":"bulkChange";b.event(d,a.id,a.doc)},this)},updateDocInStore:function(d){g.request("CouchDB",{method:"GET",path:"/"+a.database+"/_design/"+a.design+"/"+a.view,query:a.query},function(a){JSON.parse(a).rows.some(function(a,c){a.id==d&&this.set(c,a)},this)},this)},addBulkDocInStore:function(d){if(a.query.startkey||a.query.endkey)a.query.include_docs=true,a.query.update_seq=true,g.request("CouchDB",{method:"GET",path:"/"+a.database+"/_all_docs",query:a.query},function(a){JSON.parse(a).rows.forEach(function(a,
+c){a.id==d&&this.alter("splice",c,0,a.doc)},this)},this);else return false},updateBulkDocInStore:function(a,d){this.loop(function(c,b){c.id==a&&this.set(b,d)},this)},removeDocInStore:function(a){this.loop(function(d,c){d.id==a&&this.del(c)},this)},addDocInStore:function(d){g.request("CouchDB",{method:"GET",path:"/"+a.database+"/_design/"+a.design+"/"+a.view,query:a.query},function(a){JSON.parse(a).rows.some(function(a,c){a.id==d&&this.alter("splice",c,0,a)},this)},this)},updateReduced:function(){g.request("CouchDB",
+{method:"GET",path:"/"+a.database+"/_design/"+a.design+"/"+a.view,query:a.query},function(a){this.set(0,JSON.parse(a).rows[0])},this)},updateDoc:function(){g.request("CouchDB",{method:"GET",path:"/"+a.database+"/"+a.document},function(a){this.reset(JSON.parse(a))},this)},deleteDoc:function(){this.reset({})},updateDatabase:function(d){g.request("CouchDB",{method:"PUT",path:"/"+a.database+"/"+a.document,headers:{"Content-Type":"application/json"},data:this.toJSON()},function(a){a=JSON.parse(a);a.ok?
+d.resolve(a):d.reject(a)})},updateDatabaseWithBulkDoc:function(d){var c=[];this.loop(function(a){c.push(a.doc)});g.request("CouchDB",{method:"POST",path:"/"+a.database+"/_bulk_docs",headers:{"Content-Type":"application/json"},data:JSON.stringify({docs:c})},function(a){d.resolve(JSON.parse(a))})},removeFromDatabase:function(){g.request("CouchDB",{method:"DELETE",path:"/"+a.database+"/"+a.document,query:{rev:this.get("_rev")}})},resolve:function(){d.resolve(this)},unsync:function(){this.stopListening();
+delete this.stopListening}},b=new f("Unsynched",{Unsynched:[["getView",c.getView,this,"Synched"],["getDocument",c.getDocument,this,"Synched"],["getBulkDocuments",c.getBulkDocuments,this,"Synched"]],Synched:[["updateDatabase",c.createDocument,this],["subscribeToViewChanges",c.subscribeToViewChanges,this,"Listening"],["subscribeToDocumentChanges",c.subscribeToDocumentChanges,this,"Listening"],["subscribeToBulkChanges",c.subscribeToBulkChanges,this,"Listening"],["unsync",function(){},"Unsynched"]],Listening:[["entry",
+c.resolve,this],["change",c.updateDocInStore,this],["bulkAdd",c.addBulkDocInStore,this],["bulkChange",c.updateBulkDocInStore,this],["delete",c.removeDocInStore,this],["add",c.addDocInStore,this],["updateReduced",c.updateReduced,this],["updateDoc",c.updateDoc,this],["deleteDoc",c.deleteDoc,this],["updateDatabase",c.updateDatabase,this],["updateDatabaseWithBulkDoc",c.updateDatabaseWithBulkDoc,this],["removeFromDatabase",c.removeFromDatabase,this],["unsync",c.unsync,this,"Unsynched"]]});this.sync=function(a,
+c,e,g){if(typeof a=="string"&&typeof c=="string"&&typeof e=="string")return this.setSyncInfo(a,c,e,g),b.event("getView"),d;else if(typeof a=="string"&&typeof c=="string"&&typeof e!="string")return this.setSyncInfo(a,c,e),b.event("getDocument"),d;else if(typeof a=="string"&&c instanceof Object)return this.setSyncInfo(a,c),b.event("getBulkDocuments"),d;return false};this.setSyncInfo=function(d,c,e,b){this.clearSyncInfo();if(typeof d=="string"&&typeof c=="string"&&typeof e=="string")return a.database=
+d,a.design=c,a.view=e,a.query=b,true;else if(typeof d=="string"&&typeof c=="string"&&typeof e!="string")return a.database=d,a.document=c,a.query=e,true;else if(typeof d=="string"&&c instanceof Object){a.database=d;a.query=c;if(a.query.keys instanceof Array)a.keys=a.query.keys,delete a.query.keys;return true}return false};this.clearSyncInfo=function(){a={};return true};this.setReducedViewInfo=function(d){return typeof d=="boolean"?(a.reducedView=d,true):false};this.getSyncInfo=function(){return a};
+this.unsync=function(){return b.event("unsync")};this.upload=function(){var d=new e;if(a.document)return b.event("updateDatabase",d),d;else if(!a.view)return b.event("updateDatabaseWithBulkDoc",d),d;return false};this.remove=function(){return a.document?b.event("removeFromDatabase"):false};this.setTransport=function(a){return a&&typeof a.listen=="function"&&typeof a.request=="function"?(g=a,true):false};this.getStateMachine=function(){return b};this.getTransport=function(){return g};this.actions=
+c}return function(){c.prototype=new b;return new c}});
+define("Observable",["Tools"],function(b){return function(){var f={};this.watch=function(b,e,c){if(typeof e=="function"){var g=f[b]=f[b]||[];observer=[e,c];g.push(observer);return[b,g.indexOf(observer)]}else return false};this.unwatch=function(b){var e=b[0],b=b[1];return f[e]&&f[e][b]?(delete f[e][b],f[e].some(function(c){return!!c})||delete f[e],true):false};this.notify=function(h){var e=f[h],c;if(e){for(c=e.length;c--;)e[c]&&e[c][0].apply(e[c][1]||null,b.toArray(arguments).slice(1));return true}else return false};
+this.hasObserver=function(b){return!(!b||!f[b[0]]||!f[b[0]][b[1]])};this.hasTopic=function(b){return!!f[b]};this.unwatchAll=function(b){f[b]?delete f[b]:f={};return true}}});
+define("Promise",["Observable","StateMachine"],function(b,f){return function(){var h,e,c=new f("Unresolved",{Unresolved:[["resolve",function(a){h=a;g.notify("success",a)},"Resolved"],["reject",function(a){e=a;g.notify("fail",a)},"Rejected"],["addSuccess",function(a,d){g.watch("success",a,d)}],["addFail",function(a,d){g.watch("fail",a,d)}]],Resolved:[["addSuccess",function(a,d){a.call(d,h)}]],Rejected:[["addFail",function(a,d){a.call(d,e)}]]}),g=new b;this.resolve=function(a){return c.event("resolve",
+a)};this.reject=function(a){return c.event("reject",a)};this.then=function(a,d,b,e){a instanceof Function&&(d instanceof Function?c.event("addSuccess",a):c.event("addSuccess",a,d));d instanceof Function&&c.event("addFail",d,b);b instanceof Function&&c.event("addFail",b,e);return this};this.getObservable=function(){return g};this.getStateMachine=function(){return c}}});
+define("StateMachine",["Tools"],function(b){function f(){var f={};this.add=function(b,c,g,a){var d=[];if(f[b])return false;return typeof b=="string"&&typeof c=="function"?(d[0]=c,typeof g=="object"&&(d[1]=g),typeof g=="string"&&(d[2]=g),typeof a=="string"&&(d[2]=a),f[b]=d,true):false};this.has=function(b){return!!f[b]};this.get=function(b){return f[b]||false};this.event=function c(c){var g=f[c];return g?(g[0].apply(g[1],b.toArray(arguments).slice(1)),g[2]):false}}return function(h,e){var c={},g="";
+this.init=function(a){return c[a]?(g=a,true):false};this.add=function(a){return c[a]?false:c[a]=new f};this.get=function(a){return c[a]};this.getCurrent=function(){return g};this.event=function(a){var d;d=c[g].event.apply(c[g].event,b.toArray(arguments));return d===false?false:(d&&(c[g].event("exit"),g=d,c[g].event("entry")),true)};b.loop(e,function(a,d){var c=this.add(d);a.forEach(function(a){c.add.apply(null,a)})},this);this.init(h)}});
+define("Store",["Observable","Tools"],function(b,f){return function(h){var e=f.clone(h)||{},c=new b,g=new b,a=function(a){var b=f.objectsDiffs(a,e);["updated","deleted","added"].forEach(function(a){b[a].forEach(function(d){c.notify(a,d,e[d]);g.notify(d,e[d],a)})})};this.getNbItems=function(){return e instanceof Array?e.length:f.count(e)};this.get=function(a){return e[a]};this.has=function(a){return e.hasOwnProperty(a)};this.set=function(a,b){var f;return typeof a!="undefined"?(f=this.has(a),e[a]=
+b,f=f?"updated":"added",c.notify(f,a,e[a]),g.notify(a,e[a],f),true):false};this.update=function(a,b,e){var h;return this.has(a)?(h=this.get(a),f.setNestedProperty(h,b,e),c.notify("updated",b,e),g.notify(a,h,"updated"),true):false};this.del=function(a){return this.has(a)?(this.alter("splice",a,1)||(delete e[a],c.notify("deleted",a),g.notify(a,e[a],"deleted")),true):false};this.delAll=function(a){return a instanceof Array?(a.sort(f.compareNumbers).reverse().forEach(this.del,this),true):false};this.alter=
+function(d){var c,b;return e[d]?(b=f.clone(e),c=e[d].apply(e,Array.prototype.slice.call(arguments,1)),a(b),c):false};this.watch=function(a,b,e){return c.watch(a,b,e)};this.unwatch=function(a){return c.unwatch(a)};this.getStoreObservable=function(){return c};this.watchValue=function(a,b,c){return g.watch(a,b,c)};this.unwatchValue=function(a){return g.unwatch(a)};this.getValueObservable=function(){return g};this.loop=function(a,b){f.loop(e,a,b)};this.reset=function(b){if(b instanceof Object){var c=
+f.clone(e);e=f.clone(b)||{};a(c);return true}else return false};this.toJSON=function(){return JSON.stringify(e)}}});
+define("Tools",function(){return{getGlobal:function(){return function(){return this}.call(null)},mixin:function(b,f,h){this.loop(b,function(e,c){if(!f[c]||!h)f[c]=b[c]});return f},count:function(b){var f=0;this.loop(b,function(){f++});return f},compareObjects:function(b,f){return Object.getOwnPropertyNames(b).sort().join("")==Object.getOwnPropertyNames(f).sort().join("")},compareNumbers:function(b,f){return b>f?1:b<f?-1:0},toArray:function(b){return Array.prototype.slice.call(b)},loop:function(b,
+f,h){var e,c;if(b instanceof Object&&typeof f=="function"){if(c=b.length)for(e=0;e<c;e++)f.call(h,b[e],e,b);else for(e in b)b.hasOwnProperty(e)&&f.call(h,b[e],e,b);return true}else return false},objectsDiffs:function(b,f){if(b instanceof Object&&f instanceof Object){var h=[],e=[],c=[],g=[];this.loop(f,function(a,c){typeof b[c]=="undefined"?g.push(c):a!==b[c]?e.push(c):a===b[c]&&h.push(c)});this.loop(b,function(a,b){typeof f[b]=="undefined"&&c.push(b)});return{updated:e,unchanged:h,added:g,deleted:c}}else return false},
+jsonify:function(b){return b instanceof Object?JSON.parse(JSON.stringify(b)):false},clone:function(b){return b instanceof Array?b.slice(0):typeof b=="object"&&b!==null&&!(b instanceof RegExp)?this.mixin(b,{}):false},getNestedProperty:function(b,f){return b&&b instanceof Object?typeof f=="string"&&f!=""?f.split(".").reduce(function(b,e){return b&&b[e]},b):typeof f=="number"?b[f]:b:b},setNestedProperty:function(b,f,h){if(b&&b instanceof Object)if(typeof f=="string"&&f!=""){var e=f.split(".");return e.reduce(function(b,
+f,a){b[f]=b[f]||{};e.length==a+1&&(b[f]=h);return b[f]},b)}else return typeof f=="number"?(b[f]=h,b[f]):b;else return b}}});
+define("Transport",["Store","Tools"],function(b,f){return function(h){var e=null;this.setReqHandlers=function(c){return c instanceof b?(e=c,true):false};this.getReqHandlers=function(){return e};this.request=function(b,f,a,d){return e.has(b)&&typeof f=="object"?(e.get(b)(f,function(){a&&a.apply(d,arguments)}),true):false};this.listen=function(b,g,a,d){if(e.has(b)&&typeof g=="object"&&typeof g.path=="string"&&typeof a=="function"){var h=function(){a.apply(d,arguments)},i;f.mixin({__keepalive__:true,
+method:"get"},g);i=e.get(b)(g,h,h);return function(){i.func.call(i.scope)}}else return false};this.setReqHandlers(h)}});
View
78 node_modules/emily/build/uncompressed/concat.js
@@ -71,7 +71,7 @@ function CouchDBStore(Store, StateMachine, Tools, Promise) {
_transport.request(_channel, {
method: "GET",
- path: "/" + _syncInfo.database + "/_design/" + _syncInfo.design + "/" + "_view/" + _syncInfo.view,
+ path: "/" + _syncInfo.database + "/_design/" + _syncInfo.design + "/" + _syncInfo.view,
query: _syncInfo.query
}, function (results) {
var json = JSON.parse(results);
@@ -79,6 +79,11 @@ function CouchDBStore(Store, StateMachine, Tools, Promise) {
throw new Error("CouchDBStore [" + _syncInfo.database + ", " + _syncInfo.design + ", " + _syncInfo.view + "].sync() failed: " + results);
} else {
this.reset(json.rows);
+
+ if (typeof json.total_rows == "undefined") {
+ this.setReducedViewInfo(true);
+ }
+
_stateMachine.event("subscribeToViewChanges", json.update_seq);
}
}, this);
@@ -158,7 +163,7 @@ function CouchDBStore(Store, StateMachine, Tools, Promise) {
createDocument: function (promise) {
_transport.request(_channel, {
method: "PUT",
- path: '/' + _syncInfo.database + '/' + _syncInfo.document,
+ path: "/" + _syncInfo.database + "/" + _syncInfo.document,
headers: {
"Content-Type": "application/json"
},
@@ -200,14 +205,20 @@ function CouchDBStore(Store, StateMachine, Tools, Promise) {
var json = JSON.parse(changes),
action;
-
- if (json.deleted) {
- action = "delete";
- } else if (json.changes[0].rev.search("1-") == 0) {
- action = "add";
+
+ // reducedView is known on the first get view
+ if (_syncInfo.reducedView) {
+ action = "updateReduced";
} else {
- action = "change";
+ if (json.deleted) {
+ action = "delete";
+ } else if (json.changes[0].rev.search("1-") == 0) {
+ action = "add";
+ } else {
+ action = "change";
+ }
}
+
_stateMachine.event(action, json.id);
}, this);
},
@@ -301,7 +312,7 @@ function CouchDBStore(Store, StateMachine, Tools, Promise) {
updateDocInStore: function (id) {
_transport.request(_channel,{
method: "GET",
- path: '/'+_syncInfo.database+'/_design/'+_syncInfo.design+'/_view/'+_syncInfo.view,
+ path: "/" + _syncInfo.database + "/_design/" + _syncInfo.design + "/" + _syncInfo.view,
query: _syncInfo.query
}, function (view) {
var json = JSON.parse(view);
@@ -378,7 +389,7 @@ function CouchDBStore(Store, StateMachine, Tools, Promise) {
addDocInStore: function (id) {
_transport.request(_channel,{
method: "GET",
- path: '/'+_syncInfo.database+'/_design/'+_syncInfo.design+'/_view/'+_syncInfo.view,
+ path: "/" + _syncInfo.database + "/_design/" + _syncInfo.design + "/" + _syncInfo.view,
query: _syncInfo.query
}, function (view) {
var json = JSON.parse(view);
@@ -393,6 +404,23 @@ function CouchDBStore(Store, StateMachine, Tools, Promise) {
},
/**
+ * Update a reduced view (it has one row with no id)
+ * @private
+ */
+ updateReduced: function () {
+ _transport.request(_channel,{
+ method: "GET",
+ path: "/" + _syncInfo.database + "/_design/" + _syncInfo.design + "/" + _syncInfo.view,
+ query: _syncInfo.query
+ }, function (view) {
+ var json = JSON.parse(view);
+
+ this.set(0, json.rows[0]);
+
+ }, this);
+ },
+
+ /**
* Update the document when synchronized with a document.
* This differs than updating a document in a View
* @private
@@ -400,7 +428,7 @@ function CouchDBStore(Store, StateMachine, Tools, Promise) {
updateDoc: function () {
_transport.request(_channel, {
method: "GET",
- path: '/'+_syncInfo.database+'/' + _syncInfo.document
+ path: "/"+_syncInfo.database+"/" + _syncInfo.document
}, function (doc) {
this.reset(JSON.parse(doc));
}, this);
@@ -422,7 +450,7 @@ function CouchDBStore(Store, StateMachine, Tools, Promise) {
_transport.request(_channel, {
method: "PUT",
- path: '/' + _syncInfo.database + '/' + _syncInfo.document,
+ path: "/" + _syncInfo.database + "/" + _syncInfo.document,
headers: {
"Content-Type": "application/json"
},
@@ -467,7 +495,7 @@ function CouchDBStore(Store, StateMachine, Tools, Promise) {
removeFromDatabase: function () {
_transport.request(_channel, {
method: "DELETE",
- path: '/' + _syncInfo.database + '/' + _syncInfo.document,
+ path: "/" + _syncInfo.database + "/" + _syncInfo.document,
query: {
rev: this.get("_rev")
}
@@ -519,6 +547,7 @@ function CouchDBStore(Store, StateMachine, Tools, Promise) {
["bulkChange", actions.updateBulkDocInStore, this],
["delete", actions.removeDocInStore, this],
["add", actions.addDocInStore, this],
+ ["updateReduced", actions.updateReduced, this],
["updateDoc", actions.updateDoc, this],
["deleteDoc", actions.deleteDoc, this],
["updateDatabase", actions.updateDatabase, this],
@@ -559,6 +588,7 @@ function CouchDBStore(Store, StateMachine, Tools, Promise) {
* @returns {Boolean}
*/
this.setSyncInfo = function setSyncInfo() {
+ this.clearSyncInfo();
if (typeof arguments[0] == "string" && typeof arguments[1] == "string" && typeof arguments[2] == "string") {
_syncInfo["database"] = arguments[0];
_syncInfo["design"] = arguments[1];
@@ -583,6 +613,28 @@ function CouchDBStore(Store, StateMachine, Tools, Promise) {
};
/**
+ * Between two synchs, the previous info must be cleared up
+ * @private
+ */
+ this.clearSyncInfo = function clearSyncInfo() {
+ _syncInfo = {};
+ return true;
+ };
+
+ /**
+ * Set a flag to tell that a synchronized view is reduced
+ * @private
+ */
+ this.setReducedViewInfo = function setReducedViewInfo(reduced) {
+ if (typeof reduced == "boolean") {
+ _syncInfo.reducedView = reduced;
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ /**
* Get the synchronization information
* @private
* @returns
View
19 node_modules/emily/emily-server.js
@@ -24,7 +24,8 @@ requirejs(["Store"], function (Store) {
// Copy this to CouchDB2, 3... if you have more than one of them
"CouchDB": {
hostname: "127.0.0.1",
- port: 5984
+ port: 5984,
+ secure: function () {}
}
});
@@ -34,10 +35,18 @@ requirejs(["Store"], function (Store) {
// CouchDB is built-in
"CouchDB" : function (data, onEnd, onData) {
- data.hostname = exports.config.get("CouchDB").hostname;
- data.port = exports.config.get("CouchDB").port;
+
+ var cfg = exports.config.get("CouchDB");
+
+ data.hostname = cfg.hostname;
+ if (data.auth) {
+ data.hostname = data.auth + "@" + data.hostname;
+ }
+ data.port = cfg.port;
data.path += "?" + qs.stringify(data.query);
+ cfg.secure(data);
+
var req = http.request(data, function (res) {
var body = "";
@@ -69,6 +78,4 @@ requirejs(["Store"], function (Store) {
});
-});
-
-
+});
View
1  node_modules/emily/node_modules/.bin/r.js
View
1  node_modules/emily/node_modules/requirejs/.npmignore
@@ -0,0 +1 @@
+README.md
View
15,472 node_modules/emily/node_modules/requirejs/bin/r.js
15,472 additions, 0 deletions not shown
View
41 node_modules/emily/node_modules/requirejs/package.json
@@ -0,0 +1,41 @@
+{
+ "name": "requirejs",
+ "description": "Node adapter for RequireJS, for loading AMD modules. Includes RequireJS optimizer",
+ "version": "2.0.2",
+ "homepage": "http://github.com/jrburke/r.js",
+ "author": {
+ "name": "James Burke",
+ "email": "jrburke@gmail.com",
+ "url": "http://github.com/jrburke"
+ },
+ "licenses": [
+ {
+ "type": "BSD",
+ "url": "https://github.com/jrburke/r.js/blob/master/LICENSE"
+ },
+ {
+ "type": "MIT",
+ "url": "https://github.com/jrburke/r.js/blob/master/LICENSE"
+ }
+ ],
+ "main": "./bin/r.js",
+ "bin": {
+ "r.js": "./bin/r.js"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "_npmUser": {
+ "name": "podefr",
+ "email": "pode.fr@gmail.com"
+ },
+ "_id": "requirejs@2.0.2",
+ "dependencies": {},
+ "devDependencies": {},
+ "optionalDependencies": {},
+ "_engineSupported": true,
+ "_npmVersion": "1.1.14",
+ "_nodeVersion": "v0.6.17",
+ "_defaultsLoaded": true,
+ "_from": "requirejs@2.0.2"
+}
View
2,037 node_modules/emily/node_modules/requirejs/require.js
@@ -0,0 +1,2037 @@
+/** vim: et:ts=4:sw=4:sts=4
+ * @license RequireJS 2.0.2 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
+ * Available via the MIT or new BSD license.
+ * see: http://github.com/jrburke/requirejs for details
+ */
+/*jslint regexp: true, nomen: true */
+/*global window, navigator, document, importScripts, jQuery, setTimeout, opera */
+
+var requirejs, require, define;
+(function (global) {
+ 'use strict';
+
+ var version = '2.0.2',
+ commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
+ cjsRequireRegExp = /require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
+ jsSuffixRegExp = /\.js$/,
+ currDirRegExp = /^\.\//,
+ ostring = Object.prototype.toString,
+ ap = Array.prototype,
+ aps = ap.slice,
+ apsp = ap.splice,
+ isBrowser = !!(typeof window !== 'undefined' && navigator && document),
+ isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
+ //PS3 indicates loaded and complete, but need to wait for complete
+ //specifically. Sequence is 'loading', 'loaded', execution,
+ // then 'complete'. The UA check is unfortunate, but not sure how
+ //to feature test w/o causing perf issues.
+ readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
+ /^complete$/ : /^(complete|loaded)$/,
+ defContextName = '_',
+ //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
+ isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
+ contexts = {},
+ cfg = {},
+ globalDefQueue = [],
+ useInteractive = false,
+ req, s, head, baseElement, dataMain, src,
+ interactiveScript, currentlyAddingScript, mainScript, subPath;
+
+ function isFunction(it) {
+ return ostring.call(it) === '[object Function]';
+ }
+
+ function isArray(it) {
+ return ostring.call(it) === '[object Array]';
+ }
+
+ /**
+ * Helper function for iterating over an array. If the func returns
+ * a true value, it will break out of the loop.
+ */
+ function each(ary, func) {
+ if (ary) {
+ var i;
+ for (i = 0; i < ary.length; i += 1) {
+ if (ary[i] && func(ary[i], i, ary)) {
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Helper function for iterating over an array backwards. If the func
+ * returns a true value, it will break out of the loop.
+ */
+ function eachReverse(ary, func) {
+ if (ary) {
+ var i;
+ for (i = ary.length - 1; i > -1; i -= 1) {
+ if (ary[i] && func(ary[i], i, ary)) {
+ break;
+ }
+ }
+ }
+ }
+
+ function hasProp(obj, prop) {
+ return obj.hasOwnProperty(prop);
+ }
+
+ /**
+ * Cycles over properties in an object and calls a function for each
+ * property value. If the function returns a truthy value, then the
+ * iteration is stopped.
+ */
+ function eachProp(obj, func) {
+ var prop;
+ for (prop in obj) {
+ if (obj.hasOwnProperty(prop)) {
+ if (func(obj[prop], prop)) {
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Simple function to mix in properties from source into target,
+ * but only if target does not already have a property of the same name.
+ * This is not robust in IE for transferring methods that match
+ * Object.prototype names, but the uses of mixin here seem unlikely to
+ * trigger a problem related to that.
+ */
+ function mixin(target, source, force, deepStringMixin) {
+ if (source) {
+ eachProp(source, function (value, prop) {
+ if (force || !hasProp(target, prop)) {
+ if (deepStringMixin && typeof value !== 'string') {
+ if (!target[prop]) {
+ target[prop] = {};
+ }
+ mixin(target[prop], value, force, deepStringMixin);
+ } else {
+ target[prop] = value;
+ }
+ }
+ });
+ }
+ return target;
+ }
+
+ //Similar to Function.prototype.bind, but the 'this' object is specified
+ //first, since it is easier to read/figure out what 'this' will be.
+ function bind(obj, fn) {
+ return function () {
+ return fn.apply(obj, arguments);
+ };
+ }
+
+ function scripts() {
+ return document.getElementsByTagName('script');
+ }
+
+ //Allow getting a global that expressed in
+ //dot notation, like 'a.b.c'.
+ function getGlobal(value) {
+ if (!value) {
+ return value;
+ }
+ var g = global;
+ each(value.split('.'), function (part) {
+ g = g[part];
+ });
+ return g;
+ }
+
+ function makeContextModuleFunc(func, relMap, enableBuildCallback) {
+ return function () {
+ //A version of a require function that passes a moduleName
+ //value for items that may need to
+ //look up paths relative to the moduleName
+ var args = aps.call(arguments, 0), lastArg;
+ if (enableBuildCallback &&
+ isFunction((lastArg = args[args.length - 1]))) {
+ lastArg.__requireJsBuild = true;
+ }
+ args.push(relMap);
+ return func.apply(null, args);
+ };
+ }
+
+ function addRequireMethods(req, context, relMap) {
+ each([
+ ['toUrl'],
+ ['undef'],
+ ['defined', 'requireDefined'],
+ ['specified', 'requireSpecified']
+ ], function (item) {
+ var prop = item[1] || item[0];
+ req[item[0]] = context ? makeContextModuleFunc(context[prop], relMap) :
+ //If no context, then use default context. Reference from
+ //contexts instead of early binding to default context, so
+ //that during builds, the latest instance of the default
+ //context with its config gets used.
+ function () {
+ var ctx = contexts[defContextName];
+ return ctx[prop].apply(ctx, arguments);
+ };
+ });
+ }
+
+ /**
+ * Constructs an error with a pointer to an URL with more information.
+ * @param {String} id the error ID that maps to an ID on a web page.
+ * @param {String} message human readable error.
+ * @param {Error} [err] the original error, if there is one.
+ *
+ * @returns {Error}
+ */
+ function makeError(id, msg, err, requireModules) {
+ var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
+ e.requireType = id;
+ e.requireModules = requireModules;
+ if (err) {
+ e.originalError = err;
+ }
+ return e;
+ }
+
+ if (typeof define !== 'undefined') {
+ //If a define is already in play via another AMD loader,
+ //do not overwrite.
+ return;
+ }
+
+ if (typeof requirejs !== 'undefined') {
+ if (isFunction(requirejs)) {
+ //Do not overwrite and existing requirejs instance.
+ return;
+ }
+ cfg = requirejs;
+ requirejs = undefined;
+ }
+
+ //Allow for a require config object
+ if (typeof require !== 'undefined' && !isFunction(require)) {
+ //assume it is a config object.
+ cfg = require;
+ require = undefined;
+ }
+
+ function newContext(contextName) {
+ var config = {
+ waitSeconds: 7,
+ baseUrl: './',
+ paths: {},
+ pkgs: {},
+ shim: {}
+ },
+ registry = {},
+ undefEvents = {},
+ defQueue = [],
+ defined = {},
+ urlFetched = {},
+ requireCounter = 1,
+ unnormalizedCounter = 1,
+ //Used to track the order in which modules
+ //should be executed, by the order they
+ //load. Important for consistent cycle resolution
+ //behavior.
+ waitAry = [],
+ inCheckLoaded, Module, context, handlers,
+ checkLoadedTimeoutId;
+
+ /**
+ * Trims the . and .. from an array of path segments.
+ * It will keep a leading path segment if a .. will become
+ * the first path segment, to help with module name lookups,
+ * which act like paths, but can be remapped. But the end result,
+ * all paths that use this function should look normalized.
+ * NOTE: this method MODIFIES the input array.
+ * @param {Array} ary the array of path segments.
+ */
+ function trimDots(ary) {
+ var i, part;
+ for (i = 0; ary[i]; i+= 1) {
+ part = ary[i];
+ if (part === '.') {
+ ary.splice(i, 1);
+ i -= 1;
+ } else if (part === '..') {
+ if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
+ //End of the line. Keep at least one non-dot
+ //path segment at the front so it can be mapped
+ //correctly to disk. Otherwise, there is likely
+ //no path mapping for a path starting with '..'.
+ //This can still fail, but catches the most reasonable
+ //uses of ..
+ break;
+ } else if (i > 0) {
+ ary.splice(i - 1, 2);
+ i -= 2;
+ }
+ }
+ }
+ }
+
+ /**
+ * Given a relative module name, like ./something, normalize it to
+ * a real name that can be mapped to a path.
+ * @param {String} name the relative name
+ * @param {String} baseName a real name that the name arg is relative
+ * to.
+ * @param {Boolean} applyMap apply the map config to the value. Should
+ * only be done if this normalization is for a dependency ID.
+ * @returns {String} normalized name
+ */
+ function normalize(name, baseName, applyMap) {
+ var baseParts = baseName && baseName.split('/'),
+ map = config.map,
+ starMap = map && map['*'],
+ pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment,
+ foundMap;
+
+ //Adjust any relative paths.
+ if (name && name.charAt(0) === '.') {
+ //If have a base name, try to normalize against it,
+ //otherwise, assume it is a top-level require that will
+ //be relative to baseUrl in the end.
+ if (baseName) {
+ if (config.pkgs[baseName]) {
+ //If the baseName is a package name, then just treat it as one
+ //name to concat the name with.
+ baseParts = [baseName];
+ } else {
+ //Convert baseName to array, and lop off the last part,
+ //so that . matches that 'directory' and not name of the baseName's
+ //module. For instance, baseName of 'one/two/three', maps to
+ //'one/two/three.js', but we want the directory, 'one/two' for
+ //this normalization.
+ baseParts = baseParts.slice(0, baseParts.length - 1);
+ }
+
+ name = baseParts.concat(name.split('/'));
+ trimDots(name);
+
+ //Some use of packages may use a . path to reference the
+ //'main' module name, so normalize for that.
+ pkgConfig = config.pkgs[(pkgName = name[0])];
+ name = name.join('/');
+ if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
+ name = pkgName;
+ }
+ } else if (name.indexOf('./') === 0) {
+ // No baseName, so this is ID is resolved relative
+ // to baseUrl, pull off the leading dot.
+ name = name.substring(2);
+ }
+ }
+
+ //Apply map config if available.
+ if (applyMap && (baseParts || starMap) && map) {
+ nameParts = name.split('/');
+
+ for (i = nameParts.length; i > 0; i -= 1) {
+ nameSegment = nameParts.slice(0, i).join('/');
+
+ if (baseParts) {
+ //Find the longest baseName segment match in the config.
+ //So, do joins on the biggest to smallest lengths of baseParts.
+ for (j = baseParts.length; j > 0; j -= 1) {
+ mapValue = map[baseParts.slice(0, j).join('/')];
+
+ //baseName segment has config, find if it has one for
+ //this name.
+ if (mapValue) {
+ mapValue = mapValue[nameSegment];
+ if (mapValue) {
+ //Match, update name to the new value.
+ foundMap = mapValue;
+ break;
+ }
+ }
+ }
+ }
+
+ if (!foundMap && starMap && starMap[nameSegment]) {
+ foundMap = starMap[nameSegment];
+ }
+
+ if (foundMap) {
+ nameParts.splice(0, i, foundMap);
+ name = nameParts.join('/');
+ break;
+ }
+ }
+ }
+
+ return name;
+ }
+
+ function removeScript(name) {
+ if (isBrowser) {
+ each(scripts(), function (scriptNode) {
+ if (scriptNode.getAttribute('data-requiremodule') === name &&
+ scriptNode.getAttribute('data-requirecontext') === context.contextName) {
+ scriptNode.parentNode.removeChild(scriptNode);
+ return true;
+ }
+ });
+ }
+ }
+
+ function hasPathFallback(id) {
+ var pathConfig = config.paths[id];
+ if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
+ removeScript(id);
+ //Pop off the first array value, since it failed, and
+ //retry
+ pathConfig.shift();
+ context.undef(id);
+ context.require([id]);
+ return true;
+ }
+ }
+
+ /**
+ * Creates a module mapping that includes plugin prefix, module
+ * name, and path. If parentModuleMap is provided it will
+ * also normalize the name via require.normalize()
+ *
+ * @param {String} name the module name
+ * @param {String} [parentModuleMap] parent module map
+ * for the module name, used to resolve relative names.
+ * @param {Boolean} isNormalized: is the ID already normalized.
+ * This is true if this call is done for a define() module ID.
+ * @param {Boolean} applyMap: apply the map config to the ID.
+ * Should only be true if this map is for a dependency.
+ *
+ * @returns {Object}
+ */
+ function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
+ var index = name ? name.indexOf('!') : -1,
+ prefix = null,
+ parentName = parentModuleMap ? parentModuleMap.name : null,
+ originalName = name,
+ isDefine = true,
+ normalizedName = '',
+ url, pluginModule, suffix;
+
+ //If no name, then it means it is a require call, generate an
+ //internal name.
+ if (!name) {
+ isDefine = false;
+ name = '_@r' + (requireCounter += 1);
+ }
+
+ if (index !== -1) {
+ prefix = name.substring(0, index);
+ name = name.substring(index + 1, name.length);
+ }
+
+ if (prefix) {
+ prefix = normalize(prefix, parentName, applyMap);
+ pluginModule = defined[prefix];
+ }
+
+ //Account for relative paths if there is a base name.
+ if (name) {
+ if (prefix) {
+ if (pluginModule && pluginModule.normalize) {
+ //Plugin is loaded, use its normalize method.
+ normalizedName = pluginModule.normalize(name, function (name) {
+ return normalize(name, parentName, applyMap);
+ });
+ } else {
+ normalizedName = normalize(name, parentName, applyMap);
+ }
+ } else {
+ //A regular module.
+ normalizedName = normalize(name, parentName, applyMap);
+
+ //Calculate url for the module, if it has a name.
+ //Use name here since nameToUrl also calls normalize,
+ //and for relative names that are outside the baseUrl
+ //this causes havoc. Was thinking of just removing
+ //parentModuleMap to avoid extra normalization, but
+ //normalize() still does a dot removal because of
+ //issue #142, so just pass in name here and redo
+ //the normalization. Paths outside baseUrl are just
+ //messy to support.
+ url = context.nameToUrl(name, null, parentModuleMap);
+ }
+ }
+
+ //If the id is a plugin id that cannot be determined if it needs
+ //normalization, stamp it with a unique ID so two matching relative
+ //ids that may conflict can be separate.
+ suffix = prefix && !pluginModule && !isNormalized ?
+ '_unnormalized' + (unnormalizedCounter += 1) :
+ '';
+
+ return {
+ prefix: prefix,
+ name: normalizedName,
+ parentMap: parentModuleMap,
+ unnormalized: !!suffix,
+ url: url,
+ originalName: originalName,
+ isDefine: isDefine,
+ id: (prefix ?
+ prefix + '!' + normalizedName :
+ normalizedName) + suffix
+ };
+ }
+
+ function getModule(depMap) {
+ var id = depMap.id,
+ mod = registry[id];
+
+ if (!mod) {
+ mod = registry[id] = new context.Module(depMap);
+ }
+
+ return mod;
+ }
+
+ function on(depMap, name, fn) {
+ var id = depMap.id,
+ mod = registry[id];
+
+ if (hasProp(defined, id) &&
+ (!mod || mod.defineEmitComplete)) {
+ if (name === 'defined') {
+ fn(defined[id]);
+ }
+ } else {
+ getModule(depMap).on(name, fn);
+ }
+ }
+
+ function onError(err, errback) {
+ var ids = err.requireModules,
+ notified = false;
+
+ if (errback) {
+ errback(err);
+ } else {
+ each(ids, function (id) {
+ var mod = registry[id];
+ if (mod) {
+ //Set error on module, so it skips timeout checks.
+ mod.error = err;
+ if (mod.events.error) {
+ notified = true;
+ mod.emit('error', err);
+ }
+ }
+ });
+
+ if (!notified) {
+ req.onError(err);
+ }
+ }
+ }
+
+ /**
+ * Internal method to transfer globalQueue items to this context's
+ * defQueue.
+ */
+ function takeGlobalQueue() {
+ //Push all the globalDefQueue items into the context's defQueue
+ if (globalDefQueue.length) {
+ //Array splice in the values since the context code has a
+ //local var ref to defQueue, so cannot just reassign the one
+ //on context.
+ apsp.apply(defQueue,
+ [defQueue.length - 1, 0].concat(globalDefQueue));
+ globalDefQueue = [];
+ }
+ }
+
+ /**
+ * Helper function that creates a require function object to give to
+ * modules that ask for it as a dependency. It needs to be specific
+ * per module because of the implication of path mappings that may
+ * need to be relative to the module name.
+ */
+ function makeRequire(mod, enableBuildCallback, altRequire) {
+ var relMap = mod && mod.map,
+ modRequire = makeContextModuleFunc(altRequire || context.require,
+ relMap,
+ enableBuildCallback);
+
+ addRequireMethods(modRequire, context, relMap);
+ modRequire.isBrowser = isBrowser;
+
+ return modRequire;
+ }
+
+ handlers = {
+ 'require': function (mod) {
+ return makeRequire(mod);
+ },
+ 'exports': function (mod) {
+ mod.usingExports = true;
+ if (mod.map.isDefine) {
+ return (mod.exports = defined[mod.map.id] = {});
+ }
+ },
+ 'module': function (mod) {
+ return (mod.module = {
+ id: mod.map.id,
+ uri: mod.map.url,
+ config: function () {
+ return (config.config && config.config[mod.map.id]) || {};
+ },
+ exports: defined[mod.map.id]
+ });
+ }
+ };
+
+ function removeWaiting(id) {
+ //Clean up machinery used for waiting modules.
+ delete registry[id];
+
+ each(waitAry, function (mod, i) {
+ if (mod.map.id === id) {
+ waitAry.splice(i, 1);
+ if (!mod.defined) {
+ context.waitCount -= 1;
+ }
+ return true;
+ }
+ });
+ }
+
+ function findCycle(mod, traced) {
+ var id = mod.map.id,
+ depArray = mod.depMaps,
+ foundModule;
+
+ //Do not bother with unitialized modules or not yet enabled
+ //modules.
+ if (!mod.inited) {
+ return;
+ }
+
+ //Found the cycle.
+ if (traced[id]) {
+ return mod;
+ }
+
+ traced[id] = true;
+
+ //Trace through the dependencies.
+ each(depArray, function (depMap) {
+ var depId = depMap.id,
+ depMod = registry[depId];
+
+ if (!depMod) {
+ return;
+ }
+
+ if (!depMod.inited || !depMod.enabled) {
+ //Dependency is not inited, so this cannot
+ //be used to determine a cycle.
+ foundModule = null;
+ delete traced[id];
+ return true;
+ }
+
+ //mixin traced to a new object for each dependency, so that
+ //sibling dependencies in this object to not generate a
+ //false positive match on a cycle. Ideally an Object.create
+ //type of prototype delegation would be used here, but
+ //optimizing for file size vs. execution speed since hopefully
+ //the trees are small for circular dependency scans relative
+ //to the full app perf.
+ return (foundModule = findCycle(depMod, mixin({}, traced)));
+ });
+
+ return foundModule;
+ }
+
+ function forceExec(mod, traced, uninited) {
+ var id = mod.map.id,
+ depArray = mod.depMaps;
+
+ if (!mod.inited || !mod.map.isDefine) {
+ return;
+ }
+
+ if (traced[id]) {
+ return defined[id];
+ }
+
+ traced[id] = mod;
+
+ each(depArray, function(depMap) {
+ var depId = depMap.id,
+ depMod = registry[depId],
+ value;
+
+ if (handlers[depId]) {
+ return;
+ }
+
+ if (depMod) {
+ if (!depMod.inited || !depMod.enabled) {
+ //Dependency is not inited,
+ //so this module cannot be
+ //given a forced value yet.
+ uninited[id] = true;
+ return;
+ }
+
+ //Get the value for the current dependency
+ value = forceExec(depMod, traced, uninited);
+
+ //Even with forcing it may not be done,
+ //in particular if the module is waiting
+ //on a plugin resource.
+ if (!uninited[depId]) {
+ mod.defineDepById(depId, value);
+ }
+ }
+ });
+
+ mod.check(true);
+
+ return defined[id];
+ }
+
+ function modCheck(mod) {
+ mod.check();
+ }
+
+ function checkLoaded() {
+ var waitInterval = config.waitSeconds * 1000,
+ //It is possible to disable the wait interval by using waitSeconds of 0.
+ expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
+ noLoads = [],
+ stillLoading = false,
+ needCycleCheck = true,
+ map, modId, err, usingPathFallback;
+
+ //Do not bother if this call was a result of a cycle break.
+ if (inCheckLoaded) {
+ return;
+ }
+
+ inCheckLoaded = true;
+
+ //Figure out the state of all the modules.
+ eachProp(registry, function (mod) {
+ map = mod.map;
+ modId = map.id;
+
+ //Skip things that are not enabled or in error state.
+ if (!mod.enabled) {
+ return;
+ }
+
+ if (!mod.error) {
+ //If the module should be executed, and it has not
+ //been inited and time is up, remember it.
+ if (!mod.inited && expired) {
+ if (hasPathFallback(modId)) {
+ usingPathFallback = true;
+ stillLoading = true;
+ } else {
+ noLoads.push(modId);
+ removeScript(modId);
+ }
+ } else if (!mod.inited && mod.fetched && map.isDefine) {
+ stillLoading = true;
+ if (!map.prefix) {
+ //No reason to keep looking for unfinished
+ //loading. If the only stillLoading is a
+ //plugin resource though, keep going,
+ //because it may be that a plugin resource
+ //is waiting on a non-plugin cycle.
+ return (needCycleCheck = false);
+ }
+ }
+ }
+ });
+
+ if (expired && noLoads.length) {
+ //If wait time expired, throw error of unloaded modules.
+ err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);
+ err.contextName = context.contextName;
+ return onError(err);
+ }
+
+ //Not expired, check for a cycle.
+ if (needCycleCheck) {
+
+ each(waitAry, function (mod) {
+ if (mod.defined) {
+ return;
+ }
+
+ var cycleMod = findCycle(mod, {}),
+ traced = {};
+
+ if (cycleMod) {
+ forceExec(cycleMod, traced, {});
+
+ //traced modules may have been
+ //removed from the registry, but
+ //their listeners still need to
+ //be called.
+ eachProp(traced, modCheck);
+ }
+ });
+
+ //Now that dependencies have
+ //been satisfied, trigger the
+ //completion check that then
+ //notifies listeners.
+ eachProp(registry, modCheck);
+ }
+
+ //If still waiting on loads, and the waiting load is something
+ //other than a plugin resource, or there are still outstanding
+ //scripts, then just try back later.
+ if ((!expired || usingPathFallback) && stillLoading) {
+ //Something is still waiting to load. Wait for it, but only
+ //if a timeout is not already in effect.
+ if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
+ checkLoadedTimeoutId = setTimeout(function () {
+ checkLoadedTimeoutId = 0;
+ checkLoaded();
+ }, 50);
+ }
+ }
+
+ inCheckLoaded = false;
+ }
+
+ Module = function (map) {
+ this.events = undefEvents[map.id] || {};
+ this.map = map;
+ this.shim = config.shim[map.id];
+ this.depExports = [];
+ this.depMaps = [];
+ this.depMatched = [];
+ this.pluginMaps = {};
+ this.depCount = 0;
+
+ /* this.exports this.factory
+ this.depMaps = [],
+ this.enabled, this.fetched
+ */
+ };
+
+ Module.prototype = {
+ init: function(depMaps, factory, errback, options) {
+ options = options || {};
+
+ //Do not do more inits if already done. Can happen if there
+ //are multiple define calls for the same module. That is not
+ //a normal, common case, but it is also not unexpected.
+ if (this.inited) {
+ return;
+ }
+
+ this.factory = factory;
+
+ if (errback) {
+ //Register for errors on this module.
+ this.on('error', errback);
+ } else if (this.events.error) {
+ //If no errback already, but there are error listeners
+ //on this module, set up an errback to pass to the deps.
+ errback = bind(this, function (err) {
+ this.emit('error', err);
+ });
+ }
+
+ //Do a copy of the dependency array, so that
+ //source inputs are not modified. For example
+ //"shim" deps are passed in here directly, and
+ //doing a direct modification of the depMaps array
+ //would affect that config.
+ this.depMaps = depMaps && depMaps.slice(0);
+ this.depMaps.rjsSkipMap = depMaps.rjsSkipMap;
+
+ this.errback = errback;
+
+ //Indicate this module has be initialized
+ this.inited = true;
+
+ this.ignore = options.ignore;
+
+ //Could have option to init this module in enabled mode,
+ //or could have been previously marked as enabled. However,
+ //the dependencies are not known until init is called. So
+ //if enabled previously, now trigger dependencies as enabled.
+ if (options.enabled || this.enabled) {
+ //Enable this module and dependencies.
+ //Will call this.check()
+ this.enable();
+ } else {
+ this.check();
+ }
+ },
+
+ defineDepById: function (id, depExports) {
+ var i;
+
+ //Find the index for this dependency.
+ each(this.depMaps, function (map, index) {
+ if (map.id === id) {
+ i = index;
+ return true;
+ }
+ });
+
+ return this.defineDep(i, depExports);
+ },
+
+ defineDep: function (i, depExports) {
+ //Because of cycles, defined callback for a given
+ //export can be called more than once.
+ if (!this.depMatched[i]) {
+ this.depMatched[i] = true;
+ this.depCount -= 1;
+ this.depExports[i] = depExports;
+ }
+ },
+
+ fetch: function () {
+ if (this.fetched) {
+ return;
+ }
+ this.fetched = true;
+
+ context.startTime = (new Date()).getTime();
+
+ var map = this.map;
+
+ //If the manager is for a plugin managed resource,
+ //ask the plugin to load it now.
+ if (this.shim) {
+ makeRequire(this, true)(this.shim.deps || [], bind(this, function () {
+ return map.prefix ? this.callPlugin() : this.load();
+ }));
+ } else {
+ //Regular dependency.
+ return map.prefix ? this.callPlugin() : this.load();
+ }
+ },
+
+ load: function() {
+ var url = this.map.url;
+
+ //Regular dependency.
+ if (!urlFetched[url]) {
+ urlFetched[url] = true;
+ context.load(this.map.id, url);
+ }
+ },
+
+ /**
+ * Checks is the module is ready to define itself, and if so,
+ * define it. If the silent argument is true, then it will just
+ * define, but not notify listeners, and not ask for a context-wide
+ * check of all loaded modules. That is useful for cycle breaking.
+ */
+ check: function (silent) {
+ if (!this.enabled || this.enabling) {
+ return;
+ }
+
+ var id = this.map.id,
+ depExports = this.depExports,
+ exports = this.exports,
+ factory = this.factory,
+ err, cjsModule;
+
+ if (!this.inited) {
+ this.fetch();
+ } else if (this.error) {
+ this.emit('error', this.error);
+ } else if (!this.defining) {
+ //The factory could trigger another require call
+ //that would result in checking this module to
+ //define itself again. If already in the process
+ //of doing that, skip this work.
+ this.defining = true;
+
+ if (this.depCount < 1 && !this.defined) {
+ if (isFunction(factory)) {
+ //If there is an error listener, favor passing
+ //to that instead of throwing an error.
+ if (this.events.error) {
+ try {
+ exports = context.execCb(id, factory, depExports, exports);
+ } catch (e) {
+ err = e;
+ }
+ } else {
+ exports = context.execCb(id, factory, depExports, exports);
+ }
+
+ if (this.map.isDefine) {
+ //If setting exports via 'module' is in play,