Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
352 lines (349 loc) · 446 KB

File metadata and controls

352 lines (349 loc) · 446 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var LOCAL_CONFIG=require("local.config"),loopback=require("loopback"),client=exports.client=loopback();require("./bower_components/angular/angular.js"),require("./bower_components/angular-route/angular-route.js");var remote=loopback.createDataSource({connector:loopback.Remote,root:LOCAL_CONFIG.serverInfo.root}),User=require("models/user"),Todo=require("models/todo");User.attachTo(remote),Todo.attachTo(remote);var routes=LOCAL_CONFIG.routes,dependencies=["ngRoute"],app=module.exports=angular.module("app",dependencies);require("./controllers/app.ctrl"),require("./controllers/home.ctrl"),require("./controllers/todo.ctrl"),require("./controllers/user.ctrl"),require("./controllers/login.ctrl"),require("./controllers/register.ctrl"),Object.keys(routes).forEach(function(e){var r=routes[e],o=r.controller.replace("Ctrl",".ctrl").toLowerCase(),t=require("./controllers/"+o);app.controller(t.name,t)}),app.config(["$routeProvider","$locationProvider",function(e,r){Object.keys(routes).forEach(function(r){var o=routes[r];e.when(r,o)}),e.otherwise({redirectTo:"/"}),r.html5Mode(!0)}]);
},{"./bower_components/angular-route/angular-route.js":2,"./bower_components/angular/angular.js":3,"./controllers/app.ctrl":4,"./controllers/home.ctrl":5,"./controllers/login.ctrl":6,"./controllers/register.ctrl":7,"./controllers/todo.ctrl":8,"./controllers/user.ctrl":9,"local.config":47,"loopback":50,"models/todo":48,"models/user":49}],2:[function(require,module,exports){
!function(e,r){"use strict";function t(){function e(e,t){return r.extend(new(r.extend(function(){},{prototype:e})),t)}function t(e,r){var t=r.caseInsensitiveMatch,n={originalPath:e,regexp:e},a=n.keys=[];return e=e.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?\*])?/g,function(e,r,t,n){var o="?"===n?n:null,i="*"===n?n:null;return a.push({name:t,optional:!!o}),r=r||"",""+(o?"":r)+"(?:"+(o?r:"")+(i&&"(.+?)"||"([^/]+)")+(o||"")+")"+(o||"")}).replace(/([\/$\*])/g,"\\$1"),n.regexp=new RegExp("^"+e+"$",t?"i":""),n}var n={};this.when=function(e,a){if(n[e]=r.extend({reloadOnSearch:!0},a,e&&t(e,a)),e){var o="/"==e[e.length-1]?e.substr(0,e.length-1):e+"/";n[o]=r.extend({redirectTo:e},t(o,a))}return this},this.otherwise=function(e){return this.when(null,e),this},this.$get=["$rootScope","$location","$routeParams","$q","$injector","$http","$templateCache","$sce",function(t,a,o,i,c,l,u,s){function p(e,r){var t=r.keys,n={};if(!r.regexp)return null;var a=r.regexp.exec(e);if(!a)return null;for(var o=1,i=a.length;i>o;++o){var c=t[o-1],l="string"==typeof a[o]?decodeURIComponent(a[o]):a[o];c&&l&&(n[c.name]=l)}return n}function $(){var e=h(),n=m.current;e&&n&&e.$$route===n.$$route&&r.equals(e.pathParams,n.pathParams)&&!e.reloadOnSearch&&!d?(n.params=e.params,r.copy(n.params,o),t.$broadcast("$routeUpdate",n)):(e||n)&&(d=!1,t.$broadcast("$routeChangeStart",e,n),m.current=e,e&&e.redirectTo&&(r.isString(e.redirectTo)?a.path(f(e.redirectTo,e.params)).search(e.params).replace():a.url(e.redirectTo(e.pathParams,a.path(),a.search())).replace()),i.when(e).then(function(){if(e){var t,n,a=r.extend({},e.resolve);return r.forEach(a,function(e,t){a[t]=r.isString(e)?c.get(e):c.invoke(e)}),r.isDefined(t=e.template)?r.isFunction(t)&&(t=t(e.params)):r.isDefined(n=e.templateUrl)&&(r.isFunction(n)&&(n=n(e.params)),n=s.getTrustedResourceUrl(n),r.isDefined(n)&&(e.loadedTemplateUrl=n,t=l.get(n,{cache:u}).then(function(e){return e.data}))),r.isDefined(t)&&(a.$template=t),i.all(a)}}).then(function(a){e==m.current&&(e&&(e.locals=a,r.copy(e.params,o)),t.$broadcast("$routeChangeSuccess",e,n))},function(r){e==m.current&&t.$broadcast("$routeChangeError",e,n,r)}))}function h(){var t,o;return r.forEach(n,function(n){!o&&(t=p(a.path(),n))&&(o=e(n,{params:r.extend({},a.search(),t),pathParams:t}),o.$$route=n)}),o||n[null]&&e(n[null],{params:{},pathParams:{}})}function f(e,t){var n=[];return r.forEach((e||"").split(":"),function(e,r){if(0===r)n.push(e);else{var a=e.match(/(\w+)(.*)/),o=a[1];n.push(t[o]),n.push(a[2]||""),delete t[o]}}),n.join("")}var d=!1,m={routes:n,reload:function(){d=!0,t.$evalAsync($)}};return t.$on("$locationChangeSuccess",$),m}]}function n(){this.$get=function(){return{}}}function a(e,t,n){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(a,o,i,c,l){function u(){h&&(h.remove(),h=null),p&&(p.$destroy(),p=null),$&&(n.leave($,function(){h=null}),h=$,$=null)}function s(){var i=e.current&&e.current.locals,c=i&&i.$template;if(r.isDefined(c)){var s=a.$new(),h=e.current,m=l(s,function(e){n.enter(e,null,$||o,function(){!r.isDefined(f)||f&&!a.$eval(f)||t()}),u()});$=m,p=h.scope=s,p.$emit("$viewContentLoaded"),p.$eval(d)}else u()}var p,$,h,f=i.autoscroll,d=i.onload||"";a.$on("$routeChangeSuccess",s),s()}}}function o(e,r,t){return{restrict:"ECA",priority:-400,link:function(n,a){var o=t.current,i=o.locals;a.html(i.$template);var c=e(a.contents());if(o.controller){i.$scope=n;var l=r(o.controller,i);o.controllerAs&&(n[o.controllerAs]=l),a.data("$ngControllerController",l),a.children().data("$ngControllerController",l)}c(n)}}}var i=r.module("ngRoute",["ng"]).provider("$route",t);i.provider("$routeParams",n),i.directive("ngView",a),i.directive("ngView",o),a.$inject=["$route","$anchorScroll","$animate"],o.$inject=["$compile","$controller","$route"]}(window,window.angular);
},{}],3:[function(require,module,exports){
!function(t,e,n){"use strict";function r(t){return function(){var e,n,r=arguments[0],i="["+(t?t+":":"")+r+"] ",o=arguments[1],s=arguments,a=function(t){return"function"==typeof t?t.toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof t?"undefined":"string"!=typeof t?JSON.stringify(t):t};for(e=i+o.replace(/\{\d+\}/g,function(t){var e,n=+t.slice(1,-1);return n+2<s.length?(e=s[n+2],"function"==typeof e?e.toString().replace(/ ?\{[\s\S]*$/,""):"undefined"==typeof e?"undefined":"string"!=typeof e?L(e):e):t}),e=e+"\nhttp://errors.angularjs.org/1.2.16/"+(t?t+"/":"")+r,n=2;n<arguments.length;n++)e=e+(2==n?"?":"&")+"p"+(n-2)+"="+encodeURIComponent(a(arguments[n]));return new Error(e)}}function i(t){if(null==t||E(t))return!1;var e=t.length;return 1===t.nodeType&&e?!0:w(t)||S(t)||0===e||"number"==typeof e&&e>0&&e-1 in t}function o(t,e,n){var r;if(t)if(C(t))for(r in t)"prototype"==r||"length"==r||"name"==r||t.hasOwnProperty&&!t.hasOwnProperty(r)||e.call(n,t[r],r);else if(t.forEach&&t.forEach!==o)t.forEach(e,n);else if(i(t))for(r=0;r<t.length;r++)e.call(n,t[r],r);else for(r in t)t.hasOwnProperty(r)&&e.call(n,t[r],r);return t}function s(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e.sort()}function a(t,e,n){for(var r=s(t),i=0;i<r.length;i++)e.call(n,t[r[i]],r[i]);return r}function u(t){return function(e,n){t(n,e)}}function c(){for(var t,e=Or.length;e;){if(e--,t=Or[e].charCodeAt(0),57==t)return Or[e]="A",Or.join("");if(90!=t)return Or[e]=String.fromCharCode(t+1),Or.join("");Or[e]="0"}return Or.unshift("0"),Or.join("")}function l(t,e){e?t.$$hashKey=e:delete t.$$hashKey}function f(t){var e=t.$$hashKey;return o(arguments,function(e){e!==t&&o(e,function(e,n){t[n]=e})}),l(t,e),t}function h(t){return parseInt(t,10)}function p(t,e){return f(new(f(function(){},{prototype:t})),e)}function $(){}function d(t){return t}function v(t){return function(){return t}}function g(t){return"undefined"==typeof t}function m(t){return"undefined"!=typeof t}function y(t){return null!=t&&"object"==typeof t}function w(t){return"string"==typeof t}function b(t){return"number"==typeof t}function x(t){return"[object Date]"===kr.call(t)}function S(t){return"[object Array]"===kr.call(t)}function C(t){return"function"==typeof t}function k(t){return"[object RegExp]"===kr.call(t)}function E(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function A(t){return t&&t.$evalAsync&&t.$watch}function O(t){return"[object File]"===kr.call(t)}function T(t){return"[object Blob]"===kr.call(t)}function M(t){return!(!t||!(t.nodeName||t.prop&&t.attr&&t.find))}function P(t,e,n){var r=[];return o(t,function(t,i,o){r.push(e.call(n,t,i,o))}),r}function j(t,e){return-1!=N(t,e)}function N(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0;n<t.length;n++)if(e===t[n])return n;return-1}function D(t,e){var n=N(t,e);return n>=0&&t.splice(n,1),e}function R(t,e){if(E(t)||A(t))throw Er("cpws","Can't copy! Making copies of Window or Scope instances is not supported.");if(e){if(t===e)throw Er("cpi","Can't copy! Source and destination are identical.");if(S(t)){e.length=0;for(var n=0;n<t.length;n++)e.push(R(t[n]))}else{var r=e.$$hashKey;o(e,function(t,n){delete e[n]});for(var i in t)e[i]=R(t[i]);l(e,r)}}else e=t,t&&(S(t)?e=R(t,[]):x(t)?e=new Date(t.getTime()):k(t)?e=new RegExp(t.source):y(t)&&(e=R(t,{})));return e}function q(t,e){e=e||{};for(var n in t)!t.hasOwnProperty(n)||"$"===n.charAt(0)&&"$"===n.charAt(1)||(e[n]=t[n]);return e}function V(t,e){if(t===e)return!0;if(null===t||null===e)return!1;if(t!==t&&e!==e)return!0;var r,i,o,s=typeof t,a=typeof e;if(s==a&&"object"==s){if(!S(t)){if(x(t))return x(e)&&t.getTime()==e.getTime();if(k(t)&&k(e))return t.toString()==e.toString();if(A(t)||A(e)||E(t)||E(e)||S(e))return!1;o={};for(i in t)if("$"!==i.charAt(0)&&!C(t[i])){if(!V(t[i],e[i]))return!1;o[i]=!0}for(i in e)if(!o.hasOwnProperty(i)&&"$"!==i.charAt(0)&&e[i]!==n&&!C(e[i]))return!1;return!0}if(!S(e))return!1;if((r=t.length)==e.length){for(i=0;r>i;i++)if(!V(t[i],e[i]))return!1;return!0}}return!1}function I(){return e.securityPolicy&&e.securityPolicy.isActive||e.querySelector&&!(!e.querySelector("[ng-csp]")&&!e.querySelector("[data-ng-csp]"))}function U(t,e,n){return t.concat(Sr.call(e,n))}function F(t,e){return Sr.call(t,e||0)}function _(t,e){var n=arguments.length>2?F(arguments,2):[];return!C(e)||e instanceof RegExp?e:n.length?function(){return arguments.length?e.apply(t,n.concat(Sr.call(arguments,0))):e.apply(t,n)}:function(){return arguments.length?e.apply(t,arguments):e.call(t)}}function H(t,r){var i=r;return"string"==typeof t&&"$"===t.charAt(0)?i=n:E(r)?i="$WINDOW":r&&e===r?i="$DOCUMENT":A(r)&&(i="$SCOPE"),i}function L(t,e){return"undefined"==typeof t?n:JSON.stringify(t,H,e?" ":null)}function B(t){return w(t)?JSON.parse(t):t}function z(t){if("function"==typeof t)t=!0;else if(t&&0!==t.length){var e=pr(""+t);t=!("f"==e||"0"==e||"false"==e||"no"==e||"n"==e||"[]"==e)}else t=!1;return t}function W(t){t=yr(t).clone();try{t.empty()}catch(e){}var n=3,r=yr("<div>").append(t).html();try{return t[0].nodeType===n?pr(r):r.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(t,e){return"<"+pr(e)})}catch(e){return pr(r)}}function Q(t){try{return decodeURIComponent(t)}catch(e){}}function J(t){var e,n,r={};return o((t||"").split("&"),function(t){if(t&&(e=t.split("="),n=Q(e[0]),m(n))){var i=m(e[1])?Q(e[1]):!0;r[n]?S(r[n])?r[n].push(i):r[n]=[r[n],i]:r[n]=i}}),r}function X(t){var e=[];return o(t,function(t,n){S(t)?o(t,function(t){e.push(K(n,!0)+(t===!0?"":"="+K(t,!0)))}):e.push(K(n,!0)+(t===!0?"":"="+K(t,!0)))}),e.length?e.join("&"):""}function G(t){return K(t,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function K(t,e){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,e?"%20":"+")}function Y(t,n){function r(t){t&&a.push(t)}var i,s,a=[t],u=["ng:app","ng-app","x-ng-app","data-ng-app"],c=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;o(u,function(n){u[n]=!0,r(e.getElementById(n)),n=n.replace(":","\\:"),t.querySelectorAll&&(o(t.querySelectorAll("."+n),r),o(t.querySelectorAll("."+n+"\\:"),r),o(t.querySelectorAll("["+n+"]"),r))}),o(a,function(t){if(!i){var e=" "+t.className+" ",n=c.exec(e);n?(i=t,s=(n[2]||"").replace(/\s+/g,",")):o(t.attributes,function(e){!i&&u[e.name]&&(i=t,s=e.value)})}}),i&&n(i,s?[s]:[])}function Z(n,r){var i=function(){if(n=yr(n),n.injector()){var t=n[0]===e?"document":W(n);throw Er("btstrpd","App Already Bootstrapped with this Element '{0}'",t)}r=r||[],r.unshift(["$provide",function(t){t.value("$rootElement",n)}]),r.unshift("ng");var i=De(r);return i.invoke(["$rootScope","$rootElement","$compile","$injector","$animate",function(t,e,n,r){t.$apply(function(){e.data("$injector",r),n(e)(t)})}]),i},s=/^NG_DEFER_BOOTSTRAP!/;return t&&!s.test(t.name)?i():(t.name=t.name.replace(s,""),void(Ar.resumeBootstrap=function(t){o(t,function(t){r.push(t)}),i()}))}function te(t,e){return e=e||"_",t.replace(Mr,function(t,n){return(n?e:"")+t.toLowerCase()})}function ee(){wr=t.jQuery,wr?(yr=wr,f(wr.fn,{scope:zr.scope,isolateScope:zr.isolateScope,controller:zr.controller,injector:zr.injector,inheritedData:zr.inheritedData}),fe("remove",!0,!0,!1),fe("empty",!1,!1,!1),fe("html",!1,!1,!0)):yr=de,Ar.element=yr}function ne(t,e,n){if(!t)throw Er("areq","Argument '{0}' is {1}",e||"?",n||"required");return t}function re(t,e,n){return n&&S(t)&&(t=t[t.length-1]),ne(C(t),e,"not a function, got "+(t&&"object"==typeof t?t.constructor.name||"Object":typeof t)),t}function ie(t,e){if("hasOwnProperty"===t)throw Er("badname","hasOwnProperty is not a valid {0} name",e)}function oe(t,e,n){if(!e)return t;for(var r,i=e.split("."),o=t,s=i.length,a=0;s>a;a++)r=i[a],t&&(t=(o=t)[r]);return!n&&C(t)?_(o,t):t}function se(t){var e=t[0],n=t[t.length-1];if(e===n)return yr(e);var r=e,i=[r];do{if(r=r.nextSibling,!r)break;i.push(r)}while(r!==n);return yr(i)}function ae(t){function e(t,e,n){return t[e]||(t[e]=n())}var n=r("$injector"),i=r("ng"),o=e(t,"angular",Object);return o.$$minErr=o.$$minErr||r,e(o,"module",function(){var t={};return function(r,o,s){var a=function(t,e){if("hasOwnProperty"===t)throw i("badname","hasOwnProperty is not a valid {0} name",e)};return a(r,"module"),o&&t.hasOwnProperty(r)&&(t[r]=null),e(t,r,function(){function t(t,n,r){return function(){return e[r||"push"]([t,n,arguments]),u}}if(!o)throw n("nomod","Module '{0}' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.",r);var e=[],i=[],a=t("$injector","invoke"),u={_invokeQueue:e,_runBlocks:i,requires:o,name:r,provider:t("$provide","provider"),factory:t("$provide","factory"),service:t("$provide","service"),value:t("$provide","value"),constant:t("$provide","constant","unshift"),animation:t("$animateProvider","register"),filter:t("$filterProvider","register"),controller:t("$controllerProvider","register"),directive:t("$compileProvider","directive"),config:a,run:function(t){return i.push(t),this}};return s&&a(s),u})}})}function ue(e){f(e,{bootstrap:Z,copy:R,extend:f,equals:V,element:yr,forEach:o,injector:De,noop:$,bind:_,toJson:L,fromJson:B,identity:d,isUndefined:g,isDefined:m,isString:w,isFunction:C,isObject:y,isNumber:b,isElement:M,isArray:S,version:Pr,isDate:x,lowercase:pr,uppercase:dr,callbacks:{counter:0},$$minErr:r,$$csp:I}),br=ae(t);try{br("ngLocale")}catch(n){br("ngLocale",[]).provider("$locale",rn)}br("ng",["ngLocale"],["$provide",function(t){t.provider({$$sanitizeUri:Pn}),t.provider("$compile",_e).directive({a:ki,input:Ri,textarea:Ri,form:Ti,script:go,select:wo,style:xo,option:bo,ngBind:Qi,ngBindHtml:Xi,ngBindTemplate:Ji,ngClass:Gi,ngClassEven:Yi,ngClassOdd:Ki,ngCloak:Zi,ngController:to,ngForm:Mi,ngHide:lo,ngIf:no,ngInclude:ro,ngInit:oo,ngNonBindable:so,ngPluralize:ao,ngRepeat:uo,ngShow:co,ngStyle:fo,ngSwitch:ho,ngSwitchWhen:po,ngSwitchDefault:$o,ngOptions:yo,ngTransclude:vo,ngModel:_i,ngList:Bi,ngChange:Hi,required:Li,ngRequired:Li,ngValue:Wi}).directive({ngInclude:io}).directive(Ei).directive(eo),t.provider({$anchorScroll:Re,$animate:ti,$browser:Ie,$cacheFactory:Ue,$controller:Be,$document:ze,$exceptionHandler:We,$filter:Hn,$interpolate:en,$interval:nn,$http:Ke,$httpBackend:Ze,$location:gn,$log:mn,$parse:En,$rootScope:Mn,$q:An,$sce:qn,$sceDelegate:Rn,$sniffer:Vn,$templateCache:Fe,$timeout:In,$window:_n,$$rAF:Tn,$$asyncCallback:qe})}])}function ce(){return++Dr}function le(t){return t.replace(Vr,function(t,e,n,r){return r?n.toUpperCase():n}).replace(Ir,"Moz$1")}function fe(t,e,n,r){function i(t){var i,s,a,u,c,l,f,h=n&&t?[this.filter(t)]:[this],p=e;if(!r||null!=t)for(;h.length;)for(i=h.shift(),s=0,a=i.length;a>s;s++)for(u=yr(i[s]),p?u.triggerHandler("$destroy"):p=!p,c=0,l=(f=u.children()).length;l>c;c++)h.push(wr(f[c]));return o.apply(this,arguments)}var o=wr.fn[t];o=o.$original||o,i.$original=o,wr.fn[t]=i}function he(t){return!_r.test(t)}function pe(t,e){var n,r,i,o,s,a,u=e.createDocumentFragment(),c=[];if(he(t))c.push(e.createTextNode(t));else{for(n=u.appendChild(e.createElement("div")),r=(Hr.exec(t)||["",""])[1].toLowerCase(),i=Br[r]||Br._default,n.innerHTML="<div>&#160;</div>"+i[1]+t.replace(Lr,"<$1></$2>")+i[2],n.removeChild(n.firstChild),o=i[0];o--;)n=n.lastChild;for(s=0,a=n.childNodes.length;a>s;++s)c.push(n.childNodes[s]);n=u.firstChild,n.textContent=""}return u.textContent="",u.innerHTML="",c}function $e(t,n){n=n||e;var r;return(r=Fr.exec(t))?[n.createElement(r[1])]:pe(t,n)}function de(t){if(t instanceof de)return t;if(w(t)&&(t=Tr(t)),!(this instanceof de)){if(w(t)&&"<"!=t.charAt(0))throw Ur("nosel","Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element");return new de(t)}if(w(t)){ke(this,$e(t));var n=yr(e.createDocumentFragment());n.append(this)}else ke(this,t)}function ve(t){return t.cloneNode(!0)}function ge(t){ye(t);for(var e=0,n=t.childNodes||[];e<n.length;e++)ge(n[e])}function me(t,e,n,r){if(m(r))throw Ur("offargs","jqLite#off() does not support the `selector` argument");var i=we(t,"events"),s=we(t,"handle");s&&(g(e)?o(i,function(e,n){qr(t,n,e),delete i[n]}):o(e.split(" "),function(e){g(n)?(qr(t,e,i[e]),delete i[e]):D(i[e]||[],n)}))}function ye(t,e){var r=t[Nr],i=jr[r];if(i){if(e)return void delete jr[r].data[e];i.handle&&(i.events.$destroy&&i.handle({},"$destroy"),me(t)),delete jr[r],t[Nr]=n}}function we(t,e,n){var r=t[Nr],i=jr[r||-1];return m(n)?(i||(t[Nr]=r=ce(),i=jr[r]={}),void(i[e]=n)):i&&i[e]}function be(t,e,n){var r=we(t,"data"),i=m(n),o=!i&&m(e),s=o&&!y(e);if(r||s||we(t,"data",r={}),i)r[e]=n;else{if(!o)return r;if(s)return r&&r[e];f(r,e)}}function xe(t,e){return t.getAttribute?(" "+(t.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+e+" ")>-1:!1}function Se(t,e){e&&t.setAttribute&&o(e.split(" "),function(e){t.setAttribute("class",Tr((" "+(t.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+Tr(e)+" "," ")))})}function Ce(t,e){if(e&&t.setAttribute){var n=(" "+(t.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");o(e.split(" "),function(t){t=Tr(t),-1===n.indexOf(" "+t+" ")&&(n+=t+" ")}),t.setAttribute("class",Tr(n))}}function ke(t,e){if(e){e=e.nodeName||!m(e.length)||E(e)?[e]:e;for(var n=0;n<e.length;n++)t.push(e[n])}}function Ee(t,e){return Ae(t,"$"+(e||"ngController")+"Controller")}function Ae(t,e,r){t=yr(t),9==t[0].nodeType&&(t=t.find("html"));for(var i=S(e)?e:[e];t.length;){for(var o=t[0],s=0,a=i.length;a>s;s++)if((r=t.data(i[s]))!==n)return r;t=yr(o.parentNode||11===o.nodeType&&o.host)}}function Oe(t){for(var e=0,n=t.childNodes;e<n.length;e++)ge(n[e]);for(;t.firstChild;)t.removeChild(t.firstChild)}function Te(t,e){var n=Wr[e.toLowerCase()];return n&&Qr[t.nodeName]&&n}function Me(t,n){var r=function(r,i){if(r.preventDefault||(r.preventDefault=function(){r.returnValue=!1}),r.stopPropagation||(r.stopPropagation=function(){r.cancelBubble=!0}),r.target||(r.target=r.srcElement||e),g(r.defaultPrevented)){var s=r.preventDefault;r.preventDefault=function(){r.defaultPrevented=!0,s.call(r)},r.defaultPrevented=!1}r.isDefaultPrevented=function(){return r.defaultPrevented||r.returnValue===!1};var a=q(n[i||r.type]||[]);o(a,function(e){e.call(t,r)}),8>=mr?(r.preventDefault=null,r.stopPropagation=null,r.isDefaultPrevented=null):(delete r.preventDefault,delete r.stopPropagation,delete r.isDefaultPrevented)};return r.elem=t,r}function Pe(t){var e,r=typeof t;return"object"==r&&null!==t?"function"==typeof(e=t.$$hashKey)?e=t.$$hashKey():e===n&&(e=t.$$hashKey=c()):e=t,r+":"+e}function je(t){o(t,this.put,this)}function Ne(t){var e,n,r,i;return"function"==typeof t?(e=t.$inject)||(e=[],t.length&&(n=t.toString().replace(Kr,""),r=n.match(Jr),o(r[1].split(Xr),function(t){t.replace(Gr,function(t,n,r){e.push(r)})})),t.$inject=e):S(t)?(i=t.length-1,re(t[i],"fn"),e=t.slice(0,i)):re(t,"fn",!0),e}function De(t){function e(t){return function(e,n){return y(e)?void o(e,u(t)):t(e,n)}}function n(t,e){if(ie(t,"service"),(C(e)||S(e))&&(e=b.instantiate(e)),!e.$get)throw Yr("pget","Provider '{0}' must define $get factory method.",t);return m[t+p]=e}function r(t,e){return n(t,{$get:e})}function i(t,e){return r(t,["$injector",function(t){return t.instantiate(e)}])}function s(t,e){return r(t,v(e))}function a(t,e){ie(t,"constant"),m[t]=e,x[t]=e}function c(t,e){var n=b.get(t+p),r=n.$get;n.$get=function(){var t=k.invoke(r,n);return k.invoke(e,null,{$delegate:t})}}function l(t){var e,n,r,i,s=[];return o(t,function(t){if(!g.get(t)){g.put(t,!0);try{if(w(t))for(e=br(t),s=s.concat(l(e.requires)).concat(e._runBlocks),n=e._invokeQueue,r=0,i=n.length;i>r;r++){var o=n[r],a=b.get(o[0]);a[o[1]].apply(a,o[2])}else C(t)?s.push(b.invoke(t)):S(t)?s.push(b.invoke(t)):re(t,"module")}catch(u){throw S(t)&&(t=t[t.length-1]),u.message&&u.stack&&-1==u.stack.indexOf(u.message)&&(u=u.message+"\n"+u.stack),Yr("modulerr","Failed to instantiate module {0} due to:\n{1}",t,u.stack||u.message||u)}}}),s}function f(t,e){function n(n){if(t.hasOwnProperty(n)){if(t[n]===h)throw Yr("cdep","Circular dependency found: {0}",d.join(" <- "));return t[n]}try{return d.unshift(n),t[n]=h,t[n]=e(n)}catch(r){throw t[n]===h&&delete t[n],r}finally{d.shift()}}function r(t,e,r){var i,o,s,a=[],u=Ne(t);for(o=0,i=u.length;i>o;o++){if(s=u[o],"string"!=typeof s)throw Yr("itkn","Incorrect injection token! Expected service name as string, got {0}",s);a.push(r&&r.hasOwnProperty(s)?r[s]:n(s))}return t.$inject||(t=t[i]),t.apply(e,a)}function i(t,e){var n,i,o=function(){};return o.prototype=(S(t)?t[t.length-1]:t).prototype,n=new o,i=r(t,n,e),y(i)||C(i)?i:n}return{invoke:r,instantiate:i,get:n,annotate:Ne,has:function(e){return m.hasOwnProperty(e+p)||t.hasOwnProperty(e)}}}var h={},p="Provider",d=[],g=new je,m={$provide:{provider:e(n),factory:e(r),service:e(i),value:e(s),constant:e(a),decorator:c}},b=m.$injector=f(m,function(){throw Yr("unpr","Unknown provider: {0}",d.join(" <- "))}),x={},k=x.$injector=f(x,function(t){var e=b.get(t+p);return k.invoke(e.$get,e)});return o(l(t),function(t){k.invoke(t||$)}),k}function Re(){var t=!0;this.disableAutoScrolling=function(){t=!1},this.$get=["$window","$location","$rootScope",function(e,n,r){function i(t){var e=null;return o(t,function(t){e||"a"!==pr(t.nodeName)||(e=t)}),e}function s(){var t,r=n.hash();r?(t=a.getElementById(r))?t.scrollIntoView():(t=i(a.getElementsByName(r)))?t.scrollIntoView():"top"===r&&e.scrollTo(0,0):e.scrollTo(0,0)}var a=e.document;return t&&r.$watch(function(){return n.hash()},function(){r.$evalAsync(s)}),s}]}function qe(){this.$get=["$$rAF","$timeout",function(t,e){return t.supported?function(e){return t(e)}:function(t){return e(t,0,!1)}}]}function Ve(t,e,r,i){function s(t){try{t.apply(null,F(arguments,1))}finally{if(m--,0===m)for(;y.length;)try{y.pop()()}catch(e){r.error(e)}}}function a(t,e){!function n(){o(x,function(t){t()}),b=e(n,t)}()}function u(){k=null,S!=c.url()&&(S=c.url(),o(E,function(t){t(c.url())}))}var c=this,l=e[0],f=t.location,h=t.history,p=t.setTimeout,d=t.clearTimeout,v={};c.isMock=!1;var m=0,y=[];c.$$completeOutstandingRequest=s,c.$$incOutstandingRequestCount=function(){m++},c.notifyWhenNoOutstandingRequests=function(t){o(x,function(t){t()}),0===m?t():y.push(t)};var b,x=[];c.addPollFn=function(t){return g(b)&&a(100,p),x.push(t),t};var S=f.href,C=e.find("base"),k=null;c.url=function(e,n){if(f!==t.location&&(f=t.location),h!==t.history&&(h=t.history),e){if(S==e)return;return S=e,i.history?n?h.replaceState(null,"",e):(h.pushState(null,"",e),C.attr("href",C.attr("href"))):(k=e,n?f.replace(e):f.href=e),c}return k||f.href.replace(/%27/g,"'")};var E=[],A=!1;c.onUrlChange=function(e){return A||(i.history&&yr(t).on("popstate",u),i.hashchange?yr(t).on("hashchange",u):c.addPollFn(u),A=!0),E.push(e),e},c.baseHref=function(){var t=C.attr("href");return t?t.replace(/^(https?\:)?\/\/[^\/]*/,""):""};var O={},T="",M=c.baseHref();c.cookies=function(t,e){var i,o,s,a,u;if(!t){if(l.cookie!==T)for(T=l.cookie,o=T.split("; "),O={},a=0;a<o.length;a++)s=o[a],u=s.indexOf("="),u>0&&(t=unescape(s.substring(0,u)),O[t]===n&&(O[t]=unescape(s.substring(u+1))));return O}e===n?l.cookie=escape(t)+"=;path="+M+";expires=Thu, 01 Jan 1970 00:00:00 GMT":w(e)&&(i=(l.cookie=escape(t)+"="+escape(e)+";path="+M).length+1,i>4096&&r.warn("Cookie '"+t+"' possibly not set or overflowed because it was too large ("+i+" > 4096 bytes)!"))},c.defer=function(t,e){var n;return m++,n=p(function(){delete v[n],s(t)},e||0),v[n]=!0,n},c.defer.cancel=function(t){return v[t]?(delete v[t],d(t),s($),!0):!1}}function Ie(){this.$get=["$window","$log","$sniffer","$document",function(t,e,n,r){return new Ve(t,r,e,n)}]}function Ue(){this.$get=function(){function t(t,n){function i(t){t!=h&&(p?p==t&&(p=t.n):p=t,o(t.n,t.p),o(t,h),h=t,h.n=null)}function o(t,e){t!=e&&(t&&(t.p=e),e&&(e.n=t))}if(t in e)throw r("$cacheFactory")("iid","CacheId '{0}' is already taken!",t);var s=0,a=f({},n,{id:t}),u={},c=n&&n.capacity||Number.MAX_VALUE,l={},h=null,p=null;return e[t]={put:function(t,e){if(c<Number.MAX_VALUE){var n=l[t]||(l[t]={key:t});i(n)}if(!g(e))return t in u||s++,u[t]=e,s>c&&this.remove(p.key),e},get:function(t){if(c<Number.MAX_VALUE){var e=l[t];if(!e)return;i(e)}return u[t]},remove:function(t){if(c<Number.MAX_VALUE){var e=l[t];if(!e)return;e==h&&(h=e.p),e==p&&(p=e.n),o(e.n,e.p),delete l[t]}delete u[t],s--},removeAll:function(){u={},s=0,l={},h=p=null},destroy:function(){u=null,a=null,l=null,delete e[t]},info:function(){return f({},a,{size:s})}}}var e={};return t.info=function(){var t={};return o(e,function(e,n){t[n]=e.info()}),t},t.get=function(t){return e[t]},t}}function Fe(){this.$get=["$cacheFactory",function(t){return t("templates")}]}function _e(t,r){var i={},s="Directive",a=/^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,c=/(([\d\w\-_]+)(?:\:([^;]+))?;?)/,l=/^(on[a-z]+|formaction)$/;this.directive=function h(e,n){return ie(e,"directive"),w(e)?(ne(n,"directiveFactory"),i.hasOwnProperty(e)||(i[e]=[],t.factory(e+s,["$injector","$exceptionHandler",function(t,n){var r=[];return o(i[e],function(i,o){try{var s=t.invoke(i);C(s)?s={compile:v(s)}:!s.compile&&s.link&&(s.compile=v(s.link)),s.priority=s.priority||0,s.index=o,s.name=s.name||e,s.require=s.require||s.controller&&s.name,s.restrict=s.restrict||"A",r.push(s)}catch(a){n(a)}}),r}])),i[e].push(n)):o(e,u(h)),this},this.aHrefSanitizationWhitelist=function(t){return m(t)?(r.aHrefSanitizationWhitelist(t),this):r.aHrefSanitizationWhitelist()},this.imgSrcSanitizationWhitelist=function(t){return m(t)?(r.imgSrcSanitizationWhitelist(t),this):r.imgSrcSanitizationWhitelist()},this.$get=["$injector","$interpolate","$exceptionHandler","$http","$templateCache","$parse","$controller","$rootScope","$document","$sce","$animate","$$sanitizeUri",function(t,r,u,h,$,g,m,b,x,k,E,A){function O(t,e,n,r,i){t instanceof yr||(t=yr(t)),o(t,function(e,n){3==e.nodeType&&e.nodeValue.match(/\S+/)&&(t[n]=e=yr(e).wrap("<span></span>").parent()[0])});var s=M(t,e,t,n,r,i);return T(t,"ng-scope"),function(e,n,r){ne(e,"scope");var i=n?zr.clone.call(t):t;o(r,function(t,e){i.data("$"+e+"Controller",t)});for(var a=0,u=i.length;u>a;a++){var c=i[a],l=c.nodeType;(1===l||9===l)&&i.eq(a).data("$scope",e)}return n&&n(i,e),s&&s(e,i,i),i}}function T(t,e){try{t.addClass(e)}catch(n){}}function M(t,e,r,i,o,s){function a(t,r,i,o){var s,a,u,c,l,f,h,p,d,v=r.length,g=new Array(v);for(h=0;v>h;h++)g[h]=r[h];for(h=0,d=0,p=$.length;p>h;d++)u=g[d],s=$[h++],a=$[h++],c=yr(u),s?(s.scope?(l=t.$new(),c.data("$scope",l)):l=t,f=s.transclude,f||!o&&e?s(a,l,u,i,P(t,f||e)):s(a,l,u,i,o)):a&&a(t,u.childNodes,n,o)}for(var u,c,l,f,h,p,$=[],d=0;d<t.length;d++)u=new Y,c=j(t[d],[],u,0===d?i:n,o),l=c.length?R(c,t[d],u,e,r,null,[],[],s):null,l&&l.scope&&T(yr(t[d]),"ng-scope"),h=l&&l.terminal||!(f=t[d].childNodes)||!f.length?null:M(f,l?l.transclude:e),$.push(l,h),p=p||l||h,s=null;return p?a:null}function P(t,e){return function(n,r,i){var o=!1;n||(n=t.$new(),n.$$transcluded=!0,o=!0);var s=e(n,r,i);return o&&s.on("$destroy",_(n,n.$destroy)),s}}function j(t,e,n,r,i){var o,s,u=t.nodeType,l=n.$attr;switch(u){case 1:U(e,He(xr(t).toLowerCase()),"E",r,i);for(var f,h,p,$,d,v=t.attributes,g=0,m=v&&v.length;m>g;g++){var y=!1,b=!1;if(f=v[g],!mr||mr>=8||f.specified){h=f.name,$=He(h),ie.test($)&&(h=te($.substr(6),"-"));var x=$.replace(/(Start|End)$/,"");$===x+"Start"&&(y=h,b=h.substr(0,h.length-5)+"end",h=h.substr(0,h.length-6)),p=He(h.toLowerCase()),l[p]=h,n[p]=d=Tr(f.value),Te(t,p)&&(n[p]=!0),X(t,e,d,p),U(e,p,"A",r,i,y,b)}}if(s=t.className,w(s)&&""!==s)for(;o=c.exec(s);)p=He(o[2]),U(e,p,"C",r,i)&&(n[p]=Tr(o[3])),s=s.substr(o.index+o[0].length);break;case 3:Q(e,t.nodeValue);break;case 8:try{o=a.exec(t.nodeValue),o&&(p=He(o[1]),U(e,p,"M",r,i)&&(n[p]=Tr(o[2])))}catch(S){}}return e.sort(B),e}function N(t,e,n){var r=[],i=0;if(e&&t.hasAttribute&&t.hasAttribute(e)){do{if(!t)throw ei("uterdir","Unterminated attribute, found '{0}' but no matching '{1}' found.",e,n);1==t.nodeType&&(t.hasAttribute(e)&&i++,t.hasAttribute(n)&&i--),r.push(t),t=t.nextSibling}while(i>0)}else r.push(t);return yr(r)}function D(t,e,n){return function(r,i,o,s,a){return i=N(i[0],e,n),t(r,i,o,s,a)}}function R(t,i,s,a,c,l,f,h,p){function $(t,e,n,r){t&&(n&&(t=D(t,n,r)),t.require=x.require,(U===x||x.$$isolateScope)&&(t=K(t,{isolateScope:!0})),f.push(t)),e&&(n&&(e=D(e,n,r)),e.require=x.require,(U===x||x.$$isolateScope)&&(e=K(e,{isolateScope:!0})),h.push(e))}function d(t,e,n){var r,i="data",s=!1;if(w(t)){for(;"^"==(r=t.charAt(0))||"?"==r;)t=t.substr(1),"^"==r&&(i="inheritedData"),s=s||"?"==r;if(r=null,n&&"data"===i&&(r=n[t]),r=r||e[i]("$"+t+"Controller"),!r&&!s)throw ei("ctreq","Controller '{0}', required by directive '{1}', can't be found!",t,k);return r}return S(t)&&(r=[],o(t,function(t){r.push(d(t,e,n))})),r}function v(t,e,a,c,l){function p(t,e){var r;return arguments.length<2&&(e=t,t=n),J&&(r=k),l(t,e,r)}var $,v,y,w,b,x,S,C,k={};if($=i===a?s:q(s,new Y(yr(a),s.$attr)),v=$.$$element,U){var E=/^\s*([@=&])(\??)\s*(\w*)\s*$/,A=yr(a);S=e.$new(!0),_&&_===U.$$originalDirective?A.data("$isolateScope",S):A.data("$isolateScopeNoTemplate",S),T(A,"ng-isolate-scope"),o(U.scope,function(t,n){var i,o,s,a,u=t.match(E)||[],c=u[3]||n,l="?"==u[2],f=u[1];switch(S.$$isolateBindings[n]=f+c,f){case"@":$.$observe(c,function(t){S[n]=t}),$.$$observers[c].$$scope=e,$[c]&&(S[n]=r($[c])(e));break;case"=":if(l&&!$[c])return;o=g($[c]),a=o.literal?V:function(t,e){return t===e},s=o.assign||function(){throw i=S[n]=o(e),ei("nonassign","Expression '{0}' used with directive '{1}' is non-assignable!",$[c],U.name)},i=S[n]=o(e),S.$watch(function(){var t=o(e);return a(t,S[n])||(a(t,i)?s(e,t=S[n]):S[n]=t),i=t},null,o.literal);break;case"&":o=g($[c]),S[n]=function(t){return o(e,t)};break;default:throw ei("iscp","Invalid isolate scope definition for directive '{0}'. Definition: {... {1}: '{2}' ...}",U.name,n,t)}})}for(C=l&&p,R&&o(R,function(t){var n,r={$scope:t===U||t.$$isolateScope?S:e,$element:v,$attrs:$,$transclude:C};x=t.controller,"@"==x&&(x=$[t.name]),n=m(x,r),k[t.name]=n,J||v.data("$"+t.name+"Controller",n),t.controllerAs&&(r.$scope[t.controllerAs]=n)}),y=0,w=f.length;w>y;y++)try{b=f[y],b(b.isolateScope?S:e,v,$,b.require&&d(b.require,v,k),C)}catch(O){u(O,W(v))}var M=e;for(U&&(U.template||null===U.templateUrl)&&(M=S),t&&t(M,a.childNodes,n,l),y=h.length-1;y>=0;y--)try{b=h[y],b(b.isolateScope?S:e,v,$,b.require&&d(b.require,v,k),C)}catch(O){u(O,W(v))}}p=p||{};for(var b,x,k,E,A,M,P=-Number.MAX_VALUE,R=p.controllerDirectives,U=p.newIsolateScopeDirective,_=p.templateDirective,B=p.nonTlbTranscludeDirective,Q=!1,J=p.hasElementTranscludeDirective,X=s.$$element=yr(i),Z=l,te=a,ee=0,ne=t.length;ne>ee;ee++){x=t[ee];var ie=x.$$start,oe=x.$$end;if(ie&&(X=N(i,ie,oe)),E=n,P>x.priority)break;if((M=x.scope)&&(b=b||x,x.templateUrl||(z("new/isolated scope",U,x,X),y(M)&&(U=x))),k=x.name,!x.templateUrl&&x.controller&&(M=x.controller,R=R||{},z("'"+k+"' controller",R[k],x,X),R[k]=x),(M=x.transclude)&&(Q=!0,x.$$tlb||(z("transclusion",B,x,X),B=x),"element"==M?(J=!0,P=x.priority,E=N(i,ie,oe),X=s.$$element=yr(e.createComment(" "+k+": "+s[k]+" ")),i=X[0],G(c,yr(F(E)),i),te=O(E,a,P,Z&&Z.name,{nonTlbTranscludeDirective:B})):(E=yr(ve(i)).contents(),X.empty(),te=O(E,a))),x.template)if(z("template",_,x,X),_=x,M=C(x.template)?x.template(X,s):x.template,M=re(M),x.replace){if(Z=x,E=he(M)?[]:yr(M),i=E[0],1!=E.length||1!==i.nodeType)throw ei("tplrt","Template for directive '{0}' must have exactly one root element. {1}",k,"");G(c,X,i);var se={$attr:{}},ae=j(i,[],se),ue=t.splice(ee+1,t.length-(ee+1));U&&I(ae),t=t.concat(ae).concat(ue),H(s,se),ne=t.length}else X.html(M);if(x.templateUrl)z("template",_,x,X),_=x,x.replace&&(Z=x),v=L(t.splice(ee,t.length-ee),X,s,c,te,f,h,{controllerDirectives:R,newIsolateScopeDirective:U,templateDirective:_,nonTlbTranscludeDirective:B}),ne=t.length;else if(x.compile)try{A=x.compile(X,s,te),C(A)?$(null,A,ie,oe):A&&$(A.pre,A.post,ie,oe)}catch(ce){u(ce,W(X))}x.terminal&&(v.terminal=!0,P=Math.max(P,x.priority))}return v.scope=b&&b.scope===!0,v.transclude=Q&&te,p.hasElementTranscludeDirective=J,v}function I(t){for(var e=0,n=t.length;n>e;e++)t[e]=p(t[e],{$$isolateScope:!0})}function U(e,r,o,a,c,l,f){if(r===c)return null;var h=null;if(i.hasOwnProperty(r))for(var $,d=t.get(r+s),v=0,g=d.length;g>v;v++)try{$=d[v],(a===n||a>$.priority)&&-1!=$.restrict.indexOf(o)&&(l&&($=p($,{$$start:l,$$end:f})),e.push($),h=$)}catch(m){u(m)}return h}function H(t,e){var n=e.$attr,r=t.$attr,i=t.$$element;o(t,function(r,i){"$"!=i.charAt(0)&&(e[i]&&(r+=("style"===i?";":" ")+e[i]),t.$set(i,r,!0,n[i]))}),o(e,function(e,o){"class"==o?(T(i,e),t["class"]=(t["class"]?t["class"]+" ":"")+e):"style"==o?(i.attr("style",i.attr("style")+";"+e),t.style=(t.style?t.style+";":"")+e):"$"==o.charAt(0)||t.hasOwnProperty(o)||(t[o]=e,r[o]=n[o])})}function L(t,e,n,r,i,s,a,u){var c,l,p=[],d=e[0],v=t.shift(),g=f({},v,{templateUrl:null,transclude:null,replace:null,$$originalDirective:v}),m=C(v.templateUrl)?v.templateUrl(e,n):v.templateUrl;return e.empty(),h.get(k.getTrustedResourceUrl(m),{cache:$}).success(function(f){var h,$,w,b;if(f=re(f),v.replace){if(w=he(f)?[]:yr(f),h=w[0],1!=w.length||1!==h.nodeType)throw ei("tplrt","Template for directive '{0}' must have exactly one root element. {1}",v.name,m);$={$attr:{}},G(r,e,h);var x=j(h,[],$);y(v.scope)&&I(x),t=x.concat(t),H(n,$)}else h=d,e.html(f);for(t.unshift(g),c=R(t,h,n,i,e,v,s,a,u),o(r,function(t,n){t==h&&(r[n]=e[0])}),l=M(e[0].childNodes,i);p.length;){var S=p.shift(),C=p.shift(),k=p.shift(),E=p.shift(),A=e[0];if(C!==d){var O=C.className;u.hasElementTranscludeDirective&&v.replace||(A=ve(h)),G(k,yr(C),A),T(yr(A),O)}b=c.transclude?P(S,c.transclude):E,c(l,S,A,r,b)}p=null}).error(function(t,e,n,r){throw ei("tpload","Failed to load template: {0}",r.url)}),function(t,e,n,r,i){p?(p.push(e),p.push(n),p.push(r),p.push(i)):c(l,e,n,r,i)}}function B(t,e){var n=e.priority-t.priority;return 0!==n?n:t.name!==e.name?t.name<e.name?-1:1:t.index-e.index}function z(t,e,n,r){if(e)throw ei("multidir","Multiple directives [{0}, {1}] asking for {2} on: {3}",e.name,n.name,t,W(r))}function Q(t,e){var n=r(e,!0);n&&t.push({priority:0,compile:v(function(t,e){var r=e.parent(),i=r.data("$binding")||[];i.push(n),T(r.data("$binding",i),"ng-binding"),t.$watch(n,function(t){e[0].nodeValue=t})})})}function J(t,e){if("srcdoc"==e)return k.HTML;var n=xr(t);return"xlinkHref"==e||"FORM"==n&&"action"==e||"IMG"!=n&&("src"==e||"ngSrc"==e)?k.RESOURCE_URL:void 0}function X(t,e,n,i){var o=r(n,!0);if(o){if("multiple"===i&&"SELECT"===xr(t))throw ei("selmulti","Binding to the 'multiple' attribute is not supported. Element: {0}",W(t));e.push({priority:100,compile:function(){return{pre:function(e,n,s){var a=s.$$observers||(s.$$observers={});if(l.test(i))throw ei("nodomevents","Interpolations for HTML DOM event attributes are disallowed. Please use the ng- versions (such as ng-click instead of onclick) instead.");o=r(s[i],!0,J(t,i)),o&&(s[i]=o(e),(a[i]||(a[i]=[])).$$inter=!0,(s.$$observers&&s.$$observers[i].$$scope||e).$watch(o,function(t,e){"class"===i&&t!=e?s.$updateClass(t,e):s.$set(i,t)}))}}}})}}function G(t,n,r){var i,o,s=n[0],a=n.length,u=s.parentNode;if(t)for(i=0,o=t.length;o>i;i++)if(t[i]==s){t[i++]=r;for(var c=i,l=c+a-1,f=t.length;f>c;c++,l++)f>l?t[c]=t[l]:delete t[c];t.length-=a-1;break}u&&u.replaceChild(r,s);var h=e.createDocumentFragment();h.appendChild(s),r[yr.expando]=s[yr.expando];for(var p=1,$=n.length;$>p;p++){var d=n[p];yr(d).remove(),h.appendChild(d),delete n[p]}n[0]=r,n.length=1}function K(t,e){return f(function(){return t.apply(null,arguments)},t,e)}var Y=function(t,e){this.$$element=t,this.$attr=e||{}};Y.prototype={$normalize:He,$addClass:function(t){t&&t.length>0&&E.addClass(this.$$element,t)},$removeClass:function(t){t&&t.length>0&&E.removeClass(this.$$element,t)},$updateClass:function(t,e){var n=Le(t,e),r=Le(e,t);0===n.length?E.removeClass(this.$$element,r):0===r.length?E.addClass(this.$$element,n):E.setClass(this.$$element,n,r)},$set:function(t,e,r,i){var s,a=Te(this.$$element[0],t);a&&(this.$$element.prop(t,e),i=a),this[t]=e,i?this.$attr[t]=i:(i=this.$attr[t],i||(this.$attr[t]=i=te(t,"-"))),s=xr(this.$$element),("A"===s&&"href"===t||"IMG"===s&&"src"===t)&&(this[t]=e=A(e,"src"===t)),r!==!1&&(null===e||e===n?this.$$element.removeAttr(i):this.$$element.attr(i,e));
var c=this.$$observers;c&&o(c[t],function(t){try{t(e)}catch(n){u(n)}})},$observe:function(t,e){var n=this,r=n.$$observers||(n.$$observers={}),i=r[t]||(r[t]=[]);return i.push(e),b.$evalAsync(function(){i.$$inter||e(n[t])}),e}};var Z=r.startSymbol(),ee=r.endSymbol(),re="{{"==Z||"}}"==ee?d:function(t){return t.replace(/\{\{/g,Z).replace(/}}/g,ee)},ie=/^ngAttr[A-Z]/;return O}]}function He(t){return le(t.replace(ni,""))}function Le(t,e){var n="",r=t.split(/\s+/),i=e.split(/\s+/);t:for(var o=0;o<r.length;o++){for(var s=r[o],a=0;a<i.length;a++)if(s==i[a])continue t;n+=(n.length>0?" ":"")+s}return n}function Be(){var t={},e=/^(\S+)(\s+as\s+(\w+))?$/;this.register=function(e,n){ie(e,"controller"),y(e)?f(t,e):t[e]=n},this.$get=["$injector","$window",function(n,i){return function(o,s){var a,u,c,l;if(w(o)&&(u=o.match(e),c=u[1],l=u[3],o=t.hasOwnProperty(c)?t[c]:oe(s.$scope,c,!0)||oe(i,c,!0),re(o,c,!0)),a=n.instantiate(o,s),l){if(!s||"object"!=typeof s.$scope)throw r("$controller")("noscp","Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",c||o.name,l);s.$scope[l]=a}return a}}]}function ze(){this.$get=["$window",function(t){return yr(t.document)}]}function We(){this.$get=["$log",function(t){return function(){t.error.apply(t,arguments)}}]}function Qe(t){var e,n,r,i={};return t?(o(t.split("\n"),function(t){r=t.indexOf(":"),e=pr(Tr(t.substr(0,r))),n=Tr(t.substr(r+1)),e&&(i[e]?i[e]+=", "+n:i[e]=n)}),i):i}function Je(t){var e=y(t)?t:n;return function(n){return e||(e=Qe(t)),n?e[pr(n)]||null:e}}function Xe(t,e,n){return C(n)?n(t,e):(o(n,function(n){t=n(t,e)}),t)}function Ge(t){return t>=200&&300>t}function Ke(){var t=/^\s*(\[|\{[^\{])/,e=/[\}\]]\s*$/,r=/^\)\]\}',?\n/,i={"Content-Type":"application/json;charset=utf-8"},s=this.defaults={transformResponse:[function(n){return w(n)&&(n=n.replace(r,""),t.test(n)&&e.test(n)&&(n=B(n))),n}],transformRequest:[function(t){return!y(t)||O(t)||T(t)?t:L(t)}],headers:{common:{Accept:"application/json, text/plain, */*"},post:R(i),put:R(i),patch:R(i)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"},u=this.interceptors=[],c=this.responseInterceptors=[];this.$get=["$httpBackend","$browser","$cacheFactory","$rootScope","$q","$injector",function(t,e,r,i,l,h){function p(t){function r(t){var e=f({},t,{data:Xe(t.data,t.headers,a.transformResponse)});return Ge(t.status)?e:l.reject(e)}function i(t){function e(t){var e;o(t,function(n,r){C(n)&&(e=n(),null!=e?t[r]=e:delete t[r])})}var n,r,i,a=s.headers,u=f({},t.headers);a=f({},a.common,a[pr(t.method)]),e(a),e(u);t:for(n in a){r=pr(n);for(i in u)if(pr(i)===r)continue t;u[n]=a[n]}return u}var a={method:"get",transformRequest:s.transformRequest,transformResponse:s.transformResponse},u=i(t);f(a,t),a.headers=u,a.method=dr(a.method);var c=Fn(a.url)?e.cookies()[a.xsrfCookieName||s.xsrfCookieName]:n;c&&(u[a.xsrfHeaderName||s.xsrfHeaderName]=c);var h=function(t){u=t.headers;var e=Xe(t.data,Je(u),t.transformRequest);return g(t.data)&&o(u,function(t,e){"content-type"===pr(e)&&delete u[e]}),g(t.withCredentials)&&!g(s.withCredentials)&&(t.withCredentials=s.withCredentials),v(t,e,u).then(r,r)},p=[h,n],$=l.when(a);for(o(k,function(t){(t.request||t.requestError)&&p.unshift(t.request,t.requestError),(t.response||t.responseError)&&p.push(t.response,t.responseError)});p.length;){var d=p.shift(),m=p.shift();$=$.then(d,m)}return $.success=function(t){return $.then(function(e){t(e.data,e.status,e.headers,a)}),$},$.error=function(t){return $.then(null,function(e){t(e.data,e.status,e.headers,a)}),$},$}function $(){o(arguments,function(t){p[t]=function(e,n){return p(f(n||{},{method:t,url:e}))}})}function d(){o(arguments,function(t){p[t]=function(e,n,r){return p(f(r||{},{method:t,url:e,data:n}))}})}function v(e,n,r){function o(t,e,n,r){c&&(Ge(t)?c.put(d,[t,e,Qe(n),r]):c.remove(d)),a(e,t,n,r),i.$$phase||i.$apply()}function a(t,n,r,i){n=Math.max(n,0),(Ge(n)?h.resolve:h.reject)({data:t,status:n,headers:Je(r),config:e,statusText:i})}function u(){var t=N(p.pendingRequests,e);-1!==t&&p.pendingRequests.splice(t,1)}var c,f,h=l.defer(),$=h.promise,d=b(e.url,e.params);if(p.pendingRequests.push(e),$.then(u,u),(e.cache||s.cache)&&e.cache!==!1&&"GET"==e.method&&(c=y(e.cache)?e.cache:y(s.cache)?s.cache:x),c)if(f=c.get(d),m(f)){if(f.then)return f.then(u,u),f;S(f)?a(f[1],f[0],R(f[2]),f[3]):a(f,200,{},"OK")}else c.put(d,$);return g(f)&&t(e.method,d,n,o,r,e.timeout,e.withCredentials,e.responseType),$}function b(t,e){if(!e)return t;var n=[];return a(e,function(t,e){null===t||g(t)||(S(t)||(t=[t]),o(t,function(t){y(t)&&(t=L(t)),n.push(K(e)+"="+K(t))}))}),n.length>0&&(t+=(-1==t.indexOf("?")?"?":"&")+n.join("&")),t}var x=r("$http"),k=[];return o(u,function(t){k.unshift(w(t)?h.get(t):h.invoke(t))}),o(c,function(t,e){var n=w(t)?h.get(t):h.invoke(t);k.splice(e,0,{response:function(t){return n(l.when(t))},responseError:function(t){return n(l.reject(t))}})}),p.pendingRequests=[],$("get","delete","head","jsonp"),d("post","put"),p.defaults=s,p}]}function Ye(e){if(8>=mr&&(!e.match(/^(get|post|head|put|delete|options)$/i)||!t.XMLHttpRequest))return new t.ActiveXObject("Microsoft.XMLHTTP");if(t.XMLHttpRequest)return new t.XMLHttpRequest;throw r("$httpBackend")("noxhr","This browser does not support XMLHttpRequest.")}function Ze(){this.$get=["$browser","$window","$document",function(t,e,n){return tn(t,Ye,t.defer,e.angular.callbacks,n[0])}]}function tn(t,e,n,r,i){function s(t,e){var n=i.createElement("script"),r=function(){n.onreadystatechange=n.onload=n.onerror=null,i.body.removeChild(n),e&&e()};return n.type="text/javascript",n.src=t,mr&&8>=mr?n.onreadystatechange=function(){/loaded|complete/.test(n.readyState)&&r()}:n.onload=n.onerror=function(){r()},i.body.appendChild(n),r}var a=-1;return function(i,u,c,l,f,h,p,d){function v(){y=a,b&&b(),x&&x.abort()}function g(e,r,i,o,s){C&&n.cancel(C),b=x=null,0===r&&(r=i?200:"file"==Un(u).protocol?404:0),r=1223===r?204:r,s=s||"",e(r,i,o,s),t.$$completeOutstandingRequest($)}var y;if(t.$$incOutstandingRequestCount(),u=u||t.url(),"jsonp"==pr(i)){var w="_"+(r.counter++).toString(36);r[w]=function(t){r[w].data=t};var b=s(u.replace("JSON_CALLBACK","angular.callbacks."+w),function(){r[w].data?g(l,200,r[w].data):g(l,y||-2),r[w]=Ar.noop})}else{var x=e(i);if(x.open(i,u,!0),o(f,function(t,e){m(t)&&x.setRequestHeader(e,t)}),x.onreadystatechange=function(){if(x&&4==x.readyState){var t=null,e=null;y!==a&&(t=x.getAllResponseHeaders(),e="response"in x?x.response:x.responseText),g(l,y||x.status,e,t,x.statusText||"")}},p&&(x.withCredentials=!0),d)try{x.responseType=d}catch(S){if("json"!==d)throw S}x.send(c||null)}if(h>0)var C=n(v,h);else h&&h.then&&h.then(v)}}function en(){var t="{{",e="}}";this.startSymbol=function(e){return e?(t=e,this):t},this.endSymbol=function(t){return t?(e=t,this):e},this.$get=["$parse","$exceptionHandler","$sce",function(n,r,i){function o(o,u,c){for(var l,f,h,p,$=0,d=[],v=o.length,m=!1,y=[];v>$;)-1!=(l=o.indexOf(t,$))&&-1!=(f=o.indexOf(e,l+s))?($!=l&&d.push(o.substring($,l)),d.push(h=n(p=o.substring(l+s,f))),h.exp=p,$=f+a,m=!0):($!=v&&d.push(o.substring($)),$=v);if((v=d.length)||(d.push(""),v=1),c&&d.length>1)throw ri("noconcat","Error while interpolating: {0}\nStrict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce",o);return!u||m?(y.length=v,h=function(t){try{for(var e,n=0,s=v;s>n;n++)"function"==typeof(e=d[n])&&(e=e(t),e=c?i.getTrusted(c,e):i.valueOf(e),null===e||g(e)?e="":"string"!=typeof e&&(e=L(e))),y[n]=e;return y.join("")}catch(a){var u=ri("interr","Can't interpolate: {0}\n{1}",o,a.toString());r(u)}},h.exp=o,h.parts=d,h):void 0}var s=t.length,a=e.length;return o.startSymbol=function(){return t},o.endSymbol=function(){return e},o}]}function nn(){this.$get=["$rootScope","$window","$q",function(t,e,n){function r(r,o,s,a){var u=e.setInterval,c=e.clearInterval,l=n.defer(),f=l.promise,h=0,p=m(a)&&!a;return s=m(s)?s:0,f.then(null,null,r),f.$$intervalId=u(function(){l.notify(h++),s>0&&h>=s&&(l.resolve(h),c(f.$$intervalId),delete i[f.$$intervalId]),p||t.$apply()},o),i[f.$$intervalId]=l,f}var i={};return r.cancel=function(t){return t&&t.$$intervalId in i?(i[t.$$intervalId].reject("canceled"),clearInterval(t.$$intervalId),delete i[t.$$intervalId],!0):!1},r}]}function rn(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"¤",posSuf:"",negPre:"(¤",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),SHORTMONTH:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),DAY:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),SHORTDAY:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(","),AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(t){return 1===t?"one":"other"}}}}function on(t){for(var e=t.split("/"),n=e.length;n--;)e[n]=G(e[n]);return e.join("/")}function sn(t,e,n){var r=Un(t,n);e.$$protocol=r.protocol,e.$$host=r.hostname,e.$$port=h(r.port)||oi[r.protocol]||null}function an(t,e,n){var r="/"!==t.charAt(0);r&&(t="/"+t);var i=Un(t,n);e.$$path=decodeURIComponent(r&&"/"===i.pathname.charAt(0)?i.pathname.substring(1):i.pathname),e.$$search=J(i.search),e.$$hash=decodeURIComponent(i.hash),e.$$path&&"/"!=e.$$path.charAt(0)&&(e.$$path="/"+e.$$path)}function un(t,e){return 0===e.indexOf(t)?e.substr(t.length):void 0}function cn(t){var e=t.indexOf("#");return-1==e?t:t.substr(0,e)}function ln(t){return t.substr(0,cn(t).lastIndexOf("/")+1)}function fn(t){return t.substring(0,t.indexOf("/",t.indexOf("//")+2))}function hn(t,e){this.$$html5=!0,e=e||"";var r=ln(t);sn(t,this,t),this.$$parse=function(e){var n=un(r,e);if(!w(n))throw si("ipthprfx",'Invalid url "{0}", missing path prefix "{1}".',e,r);an(n,this,t),this.$$path||(this.$$path="/"),this.$$compose()},this.$$compose=function(){var t=X(this.$$search),e=this.$$hash?"#"+G(this.$$hash):"";this.$$url=on(this.$$path)+(t?"?"+t:"")+e,this.$$absUrl=r+this.$$url.substr(1)},this.$$rewrite=function(i){var o,s;return(o=un(t,i))!==n?(s=o,(o=un(e,o))!==n?r+(un("/",o)||o):t+s):(o=un(r,i))!==n?r+o:r==i+"/"?r:void 0}}function pn(t,e){var n=ln(t);sn(t,this,t),this.$$parse=function(r){function i(t,e,n){var r,i=/^\/?.*?:(\/.*)/;return 0===e.indexOf(n)&&(e=e.replace(n,"")),i.exec(e)?t:(r=i.exec(t),r?r[1]:t)}var o=un(t,r)||un(n,r),s="#"==o.charAt(0)?un(e,o):this.$$html5?o:"";if(!w(s))throw si("ihshprfx",'Invalid url "{0}", missing hash prefix "{1}".',r,e);an(s,this,t),this.$$path=i(this.$$path,s,t),this.$$compose()},this.$$compose=function(){var n=X(this.$$search),r=this.$$hash?"#"+G(this.$$hash):"";this.$$url=on(this.$$path)+(n?"?"+n:"")+r,this.$$absUrl=t+(this.$$url?e+this.$$url:"")},this.$$rewrite=function(e){return cn(t)==cn(e)?e:void 0}}function $n(t,e){this.$$html5=!0,pn.apply(this,arguments);var n=ln(t);this.$$rewrite=function(r){var i;return t==cn(r)?r:(i=un(n,r))?t+e+i:n===r+"/"?n:void 0}}function dn(t){return function(){return this[t]}}function vn(t,e){return function(n){return g(n)?this[t]:(this[t]=e(n),this.$$compose(),this)}}function gn(){var e="",n=!1;this.hashPrefix=function(t){return m(t)?(e=t,this):e},this.html5Mode=function(t){return m(t)?(n=t,this):n},this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(r,i,o,s){function a(t){r.$broadcast("$locationChangeSuccess",u.absUrl(),t)}var u,c,l,f=i.baseHref(),h=i.url();n?(l=fn(h)+(f||"/"),c=o.history?hn:$n):(l=cn(h),c=pn),u=new c(l,"#"+e),u.$$parse(u.$$rewrite(h)),s.on("click",function(e){if(!e.ctrlKey&&!e.metaKey&&2!=e.which){for(var n=yr(e.target);"a"!==pr(n[0].nodeName);)if(n[0]===s[0]||!(n=n.parent())[0])return;var o=n.prop("href");y(o)&&"[object SVGAnimatedString]"===o.toString()&&(o=Un(o.animVal).href);var a=u.$$rewrite(o);o&&!n.attr("target")&&a&&!e.isDefaultPrevented()&&(e.preventDefault(),a!=i.url()&&(u.$$parse(a),r.$apply(),t.angular["ff-684208-preventDefault"]=!0))}}),u.absUrl()!=h&&i.url(u.absUrl(),!0),i.onUrlChange(function(t){u.absUrl()!=t&&(r.$evalAsync(function(){var e=u.absUrl();u.$$parse(t),r.$broadcast("$locationChangeStart",t,e).defaultPrevented?(u.$$parse(e),i.url(e)):a(e)}),r.$$phase||r.$digest())});var p=0;return r.$watch(function(){var t=i.url(),e=u.$$replace;return p&&t==u.absUrl()||(p++,r.$evalAsync(function(){r.$broadcast("$locationChangeStart",u.absUrl(),t).defaultPrevented?u.$$parse(t):(i.url(u.absUrl(),e),a(t))})),u.$$replace=!1,p}),u}]}function mn(){var t=!0,e=this;this.debugEnabled=function(e){return m(e)?(t=e,this):t},this.$get=["$window",function(n){function r(t){return t instanceof Error&&(t.stack?t=t.message&&-1===t.stack.indexOf(t.message)?"Error: "+t.message+"\n"+t.stack:t.stack:t.sourceURL&&(t=t.message+"\n"+t.sourceURL+":"+t.line)),t}function i(t){var e=n.console||{},i=e[t]||e.log||$,s=!1;try{s=!!i.apply}catch(a){}return s?function(){var t=[];return o(arguments,function(e){t.push(r(e))}),i.apply(e,t)}:function(t,e){i(t,null==e?"":e)}}return{log:i("log"),info:i("info"),warn:i("warn"),error:i("error"),debug:function(){var n=i("debug");return function(){t&&n.apply(e,arguments)}}()}}]}function yn(t,e){if("constructor"===t)throw ui("isecfld",'Referencing "constructor" field in Angular expressions is disallowed! Expression: {0}',e);return t}function wn(t,e){if(t){if(t.constructor===t)throw ui("isecfn","Referencing Function in Angular expressions is disallowed! Expression: {0}",e);if(t.document&&t.location&&t.alert&&t.setInterval)throw ui("isecwindow","Referencing the Window in Angular expressions is disallowed! Expression: {0}",e);if(t.children&&(t.nodeName||t.prop&&t.attr&&t.find))throw ui("isecdom","Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}",e)}return t}function bn(t,e,r,i,o){o=o||{};for(var s,a=e.split("."),u=0;a.length>1;u++){s=yn(a.shift(),i);var c=t[s];c||(c={},t[s]=c),t=c,t.then&&o.unwrapPromises&&(ai(i),"$$v"in t||!function(t){t.then(function(e){t.$$v=e})}(t),t.$$v===n&&(t.$$v={}),t=t.$$v)}return s=yn(a.shift(),i),t[s]=r,r}function xn(t,e,r,i,o,s,a){return yn(t,s),yn(e,s),yn(r,s),yn(i,s),yn(o,s),a.unwrapPromises?function(a,u){var c,l=u&&u.hasOwnProperty(t)?u:a;return null==l?l:(l=l[t],l&&l.then&&(ai(s),"$$v"in l||(c=l,c.$$v=n,c.then(function(t){c.$$v=t})),l=l.$$v),e?null==l?n:(l=l[e],l&&l.then&&(ai(s),"$$v"in l||(c=l,c.$$v=n,c.then(function(t){c.$$v=t})),l=l.$$v),r?null==l?n:(l=l[r],l&&l.then&&(ai(s),"$$v"in l||(c=l,c.$$v=n,c.then(function(t){c.$$v=t})),l=l.$$v),i?null==l?n:(l=l[i],l&&l.then&&(ai(s),"$$v"in l||(c=l,c.$$v=n,c.then(function(t){c.$$v=t})),l=l.$$v),o?null==l?n:(l=l[o],l&&l.then&&(ai(s),"$$v"in l||(c=l,c.$$v=n,c.then(function(t){c.$$v=t})),l=l.$$v),l):l):l):l):l)}:function(s,a){var u=a&&a.hasOwnProperty(t)?a:s;return null==u?u:(u=u[t],e?null==u?n:(u=u[e],r?null==u?n:(u=u[r],i?null==u?n:(u=u[i],o?null==u?n:u=u[o]:u):u):u):u)}}function Sn(t,e){return yn(t,e),function(e,r){return null==e?n:(r&&r.hasOwnProperty(t)?r:e)[t]}}function Cn(t,e,r){return yn(t,r),yn(e,r),function(r,i){return null==r?n:(r=(i&&i.hasOwnProperty(t)?i:r)[t],null==r?n:r[e])}}function kn(t,e,r){if($i.hasOwnProperty(t))return $i[t];var i,s=t.split("."),a=s.length;if(e.unwrapPromises||1!==a)if(e.unwrapPromises||2!==a)if(e.csp)i=6>a?xn(s[0],s[1],s[2],s[3],s[4],r,e):function(t,i){var o,u=0;do o=xn(s[u++],s[u++],s[u++],s[u++],s[u++],r,e)(t,i),i=n,t=o;while(a>u);return o};else{var u="var p;\n";o(s,function(t,n){yn(t,r),u+="if(s == null) return undefined;\ns="+(n?"s":'((k&&k.hasOwnProperty("'+t+'"))?k:s)')+'["'+t+'"];\n'+(e.unwrapPromises?'if (s && s.then) {\n pw("'+r.replace(/(["\r\n])/g,"\\$1")+'");\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v=v;});\n}\n s=s.$$v\n}\n':"")}),u+="return s;";var c=new Function("s","k","pw",u);c.toString=v(u),i=e.unwrapPromises?function(t,e){return c(t,e,ai)}:c}else i=Cn(s[0],s[1],r);else i=Sn(s[0],r);return"hasOwnProperty"!==t&&($i[t]=i),i}function En(){var t={},e={csp:!1,unwrapPromises:!1,logPromiseWarnings:!0};this.unwrapPromises=function(t){return m(t)?(e.unwrapPromises=!!t,this):e.unwrapPromises},this.logPromiseWarnings=function(t){return m(t)?(e.logPromiseWarnings=t,this):e.logPromiseWarnings},this.$get=["$filter","$sniffer","$log",function(n,r,i){return e.csp=r.csp,ai=function(t){e.logPromiseWarnings&&!ci.hasOwnProperty(t)&&(ci[t]=!0,i.warn("[$parse] Promise found in the expression `"+t+"`. Automatic unwrapping of promises in Angular expressions is deprecated."))},function(r){var i;switch(typeof r){case"string":if(t.hasOwnProperty(r))return t[r];var o=new hi(e),s=new pi(o,n,e);return i=s.parse(r,!1),"hasOwnProperty"!==r&&(t[r]=i),i;case"function":return r;default:return $}}}]}function An(){this.$get=["$rootScope","$exceptionHandler",function(t,e){return On(function(e){t.$evalAsync(e)},e)}]}function On(t,e){function r(t){return t}function i(t){return c(t)}function s(t){var e=a(),n=0,r=S(t)?[]:{};return o(t,function(t,i){n++,u(t).then(function(t){r.hasOwnProperty(i)||(r[i]=t,--n||e.resolve(r))},function(t){r.hasOwnProperty(i)||e.reject(t)})}),0===n&&e.resolve(r),e.promise}var a=function(){var o,s,c=[];return s={resolve:function(e){if(c){var r=c;c=n,o=u(e),r.length&&t(function(){for(var t,e=0,n=r.length;n>e;e++)t=r[e],o.then(t[0],t[1],t[2])})}},reject:function(t){s.resolve(l(t))},notify:function(e){if(c){var n=c;c.length&&t(function(){for(var t,r=0,i=n.length;i>r;r++)t=n[r],t[2](e)})}},promise:{then:function(t,n,s){var u=a(),l=function(n){try{u.resolve((C(t)?t:r)(n))}catch(i){u.reject(i),e(i)}},f=function(t){try{u.resolve((C(n)?n:i)(t))}catch(r){u.reject(r),e(r)}},h=function(t){try{u.notify((C(s)?s:r)(t))}catch(n){e(n)}};return c?c.push([l,f,h]):o.then(l,f,h),u.promise},"catch":function(t){return this.then(null,t)},"finally":function(t){function e(t,e){var n=a();return e?n.resolve(t):n.reject(t),n.promise}function n(n,i){var o=null;try{o=(t||r)()}catch(s){return e(s,!1)}return o&&C(o.then)?o.then(function(){return e(n,i)},function(t){return e(t,!1)}):e(n,i)}return this.then(function(t){return n(t,!0)},function(t){return n(t,!1)})}}}},u=function(e){return e&&C(e.then)?e:{then:function(n){var r=a();return t(function(){r.resolve(n(e))}),r.promise}}},c=function(t){var e=a();return e.reject(t),e.promise},l=function(n){return{then:function(r,o){var s=a();return t(function(){try{s.resolve((C(o)?o:i)(n))}catch(t){s.reject(t),e(t)}}),s.promise}}},f=function(n,o,s,l){var f,h=a(),p=function(t){try{return(C(o)?o:r)(t)}catch(n){return e(n),c(n)}},$=function(t){try{return(C(s)?s:i)(t)}catch(n){return e(n),c(n)}},d=function(t){try{return(C(l)?l:r)(t)}catch(n){e(n)}};return t(function(){u(n).then(function(t){f||(f=!0,h.resolve(u(t).then(p,$,d)))},function(t){f||(f=!0,h.resolve($(t)))},function(t){f||h.notify(d(t))})}),h.promise};return{defer:a,reject:c,when:f,all:s}}function Tn(){this.$get=["$window","$timeout",function(t,e){var n=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame,r=t.cancelAnimationFrame||t.webkitCancelAnimationFrame||t.mozCancelAnimationFrame||t.webkitCancelRequestAnimationFrame,i=!!n,o=i?function(t){var e=n(t);return function(){r(e)}}:function(t){var n=e(t,16.66,!1);return function(){e.cancel(n)}};return o.supported=i,o}]}function Mn(){var t=10,e=r("$rootScope"),n=null;this.digestTtl=function(e){return arguments.length&&(t=e),t},this.$get=["$injector","$exceptionHandler","$parse","$browser",function(r,s,a,u){function l(){this.$id=c(),this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null,this["this"]=this.$root=this,this.$$destroyed=!1,this.$$asyncQueue=[],this.$$postDigestQueue=[],this.$$listeners={},this.$$listenerCount={},this.$$isolateBindings={}}function f(t){if(g.$$phase)throw e("inprog","{0} already in progress",g.$$phase);g.$$phase=t}function h(){g.$$phase=null}function p(t,e){var n=a(t);return re(n,e),n}function d(t,e,n){do t.$$listenerCount[n]-=e,0===t.$$listenerCount[n]&&delete t.$$listenerCount[n];while(t=t.$parent)}function v(){}l.prototype={constructor:l,$new:function(t){var e,n;return t?(n=new l,n.$root=this.$root,n.$$asyncQueue=this.$$asyncQueue,n.$$postDigestQueue=this.$$postDigestQueue):(e=function(){},e.prototype=this,n=new e,n.$id=c()),n["this"]=n,n.$$listeners={},n.$$listenerCount={},n.$parent=this,n.$$watchers=n.$$nextSibling=n.$$childHead=n.$$childTail=null,n.$$prevSibling=this.$$childTail,this.$$childHead?(this.$$childTail.$$nextSibling=n,this.$$childTail=n):this.$$childHead=this.$$childTail=n,n},$watch:function(t,e,r){var i=this,o=p(t,"watch"),s=i.$$watchers,a={fn:e,last:v,get:o,exp:t,eq:!!r};if(n=null,!C(e)){var u=p(e||$,"listener");a.fn=function(t,e,n){u(n)}}if("string"==typeof t&&o.constant){var c=a.fn;a.fn=function(t,e,n){c.call(this,t,e,n),D(s,a)}}return s||(s=i.$$watchers=[]),s.unshift(a),function(){D(s,a),n=null}},$watchCollection:function(t,e){function n(){o=h(c);var t,e;if(y(o))if(i(o)){s!==p&&(s=p,v=s.length=0,f++),t=o.length,v!==t&&(f++,s.length=v=t);for(var n=0;t>n;n++){var r=s[n]!==s[n]&&o[n]!==o[n];r||s[n]===o[n]||(f++,s[n]=o[n])}}else{s!==$&&(s=$={},v=0,f++),t=0;for(e in o)o.hasOwnProperty(e)&&(t++,s.hasOwnProperty(e)?s[e]!==o[e]&&(f++,s[e]=o[e]):(v++,s[e]=o[e],f++));if(v>t){f++;for(e in s)s.hasOwnProperty(e)&&!o.hasOwnProperty(e)&&(v--,delete s[e])}}else s!==o&&(s=o,f++);return f}function r(){if(d?(d=!1,e(o,o,c)):e(o,u,c),l)if(y(o))if(i(o)){u=new Array(o.length);for(var t=0;t<o.length;t++)u[t]=o[t]}else{u={};for(var n in o)$r.call(o,n)&&(u[n]=o[n])}else u=o}var o,s,u,c=this,l=e.length>1,f=0,h=a(t),p=[],$={},d=!0,v=0;return this.$watch(n,r)},$digest:function(){var r,i,o,a,u,c,l,p,$,d,g,m=this.$$asyncQueue,y=this.$$postDigestQueue,w=t,b=this,x=[];f("$digest"),n=null;do{for(c=!1,p=b;m.length;){try{g=m.shift(),g.scope.$eval(g.expression)}catch(S){h(),s(S)}n=null}t:do{if(a=p.$$watchers)for(u=a.length;u--;)try{if(r=a[u])if((i=r.get(p))===(o=r.last)||(r.eq?V(i,o):"number"==typeof i&&"number"==typeof o&&isNaN(i)&&isNaN(o))){if(r===n){c=!1;break t}}else c=!0,n=r,r.last=r.eq?R(i):i,r.fn(i,o===v?i:o,p),5>w&&($=4-w,x[$]||(x[$]=[]),d=C(r.exp)?"fn: "+(r.exp.name||r.exp.toString()):r.exp,d+="; newVal: "+L(i)+"; oldVal: "+L(o),x[$].push(d))}catch(S){h(),s(S)}if(!(l=p.$$childHead||p!==b&&p.$$nextSibling))for(;p!==b&&!(l=p.$$nextSibling);)p=p.$parent}while(p=l);if((c||m.length)&&!w--)throw h(),e("infdig","{0} $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: {1}",t,L(x))}while(c||m.length);for(h();y.length;)try{y.shift()()}catch(S){s(S)}},$destroy:function(){if(!this.$$destroyed){var t=this.$parent;this.$broadcast("$destroy"),this.$$destroyed=!0,this!==g&&(o(this.$$listenerCount,_(null,d,this)),t.$$childHead==this&&(t.$$childHead=this.$$nextSibling),t.$$childTail==this&&(t.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling),this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=this.$root=null,this.$$listeners={},this.$$watchers=this.$$asyncQueue=this.$$postDigestQueue=[],this.$destroy=this.$digest=this.$apply=$,this.$on=this.$watch=function(){return $})}},$eval:function(t,e){return a(t)(this,e)},$evalAsync:function(t){g.$$phase||g.$$asyncQueue.length||u.defer(function(){g.$$asyncQueue.length&&g.$digest()}),this.$$asyncQueue.push({scope:this,expression:t})},$$postDigest:function(t){this.$$postDigestQueue.push(t)},$apply:function(t){try{return f("$apply"),this.$eval(t)}catch(e){s(e)}finally{h();try{g.$digest()}catch(e){throw s(e),e}}},$on:function(t,e){var n=this.$$listeners[t];n||(this.$$listeners[t]=n=[]),n.push(e);var r=this;do r.$$listenerCount[t]||(r.$$listenerCount[t]=0),r.$$listenerCount[t]++;while(r=r.$parent);var i=this;return function(){n[N(n,e)]=null,d(i,1,t)}},$emit:function(t){var e,n,r,i=[],o=this,a=!1,u={name:t,targetScope:o,stopPropagation:function(){a=!0},preventDefault:function(){u.defaultPrevented=!0},defaultPrevented:!1},c=U([u],arguments,1);do{for(e=o.$$listeners[t]||i,u.currentScope=o,n=0,r=e.length;r>n;n++)if(e[n])try{e[n].apply(null,c)}catch(l){s(l)}else e.splice(n,1),n--,r--;if(a)return u;o=o.$parent}while(o);return u},$broadcast:function(t){for(var e,n,r,i=this,o=i,a=i,u={name:t,targetScope:i,preventDefault:function(){u.defaultPrevented=!0},defaultPrevented:!1},c=U([u],arguments,1);o=a;){for(u.currentScope=o,e=o.$$listeners[t]||[],n=0,r=e.length;r>n;n++)if(e[n])try{e[n].apply(null,c)}catch(l){s(l)}else e.splice(n,1),n--,r--;if(!(a=o.$$listenerCount[t]&&o.$$childHead||o!==i&&o.$$nextSibling))for(;o!==i&&!(a=o.$$nextSibling);)o=o.$parent}return u}};var g=new l;return g}]}function Pn(){var t=/^\s*(https?|ftp|mailto|tel|file):/,e=/^\s*(https?|ftp|file):|data:image\//;this.aHrefSanitizationWhitelist=function(e){return m(e)?(t=e,this):t},this.imgSrcSanitizationWhitelist=function(t){return m(t)?(e=t,this):e},this.$get=function(){return function(n,r){var i,o=r?e:t;return mr&&!(mr>=8)||(i=Un(n).href,""===i||i.match(o))?n:"unsafe:"+i}}}function jn(t){return t.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")}function Nn(t){if("self"===t)return t;if(w(t)){if(t.indexOf("***")>-1)throw di("iwcard","Illegal sequence *** in string matcher. String: {0}",t);return t=jn(t).replace("\\*\\*",".*").replace("\\*","[^:/.?&;]*"),new RegExp("^"+t+"$")}if(k(t))return new RegExp("^"+t.source+"$");throw di("imatcher",'Matchers may only be "self", string patterns or RegExp objects')}function Dn(t){var e=[];return m(t)&&o(t,function(t){e.push(Nn(t))}),e}function Rn(){this.SCE_CONTEXTS=vi;var t=["self"],e=[];this.resourceUrlWhitelist=function(e){return arguments.length&&(t=Dn(e)),t},this.resourceUrlBlacklist=function(t){return arguments.length&&(e=Dn(t)),e},this.$get=["$injector",function(r){function i(t,e){return"self"===t?Fn(e):!!t.exec(e.href)}function o(n){var r,o,s=Un(n.toString()),a=!1;for(r=0,o=t.length;o>r;r++)if(i(t[r],s)){a=!0;break}if(a)for(r=0,o=e.length;o>r;r++)if(i(e[r],s)){a=!1;break}return a}function s(t){var e=function(t){this.$$unwrapTrustedValue=function(){return t}};return t&&(e.prototype=new t),e.prototype.valueOf=function(){return this.$$unwrapTrustedValue()},e.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()},e}function a(t,e){var r=h.hasOwnProperty(t)?h[t]:null;if(!r)throw di("icontext","Attempted to trust a value in invalid context. Context: {0}; Value: {1}",t,e);if(null===e||e===n||""===e)return e;if("string"!=typeof e)throw di("itype","Attempted to trust a non-string value in a content requiring a string: Context: {0}",t);return new r(e)}function u(t){return t instanceof f?t.$$unwrapTrustedValue():t}function c(t,e){if(null===e||e===n||""===e)return e;var r=h.hasOwnProperty(t)?h[t]:null;if(r&&e instanceof r)return e.$$unwrapTrustedValue();if(t===vi.RESOURCE_URL){if(o(e))return e;throw di("insecurl","Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}",e.toString())}if(t===vi.HTML)return l(e);throw di("unsafe","Attempting to use an unsafe value in a safe context.")}var l=function(){throw di("unsafe","Attempting to use an unsafe value in a safe context.")};r.has("$sanitize")&&(l=r.get("$sanitize"));var f=s(),h={};return h[vi.HTML]=s(f),h[vi.CSS]=s(f),h[vi.URL]=s(f),h[vi.JS]=s(f),h[vi.RESOURCE_URL]=s(h[vi.URL]),{trustAs:a,getTrusted:c,valueOf:u}}]}function qn(){var t=!0;this.enabled=function(e){return arguments.length&&(t=!!e),t},this.$get=["$parse","$sniffer","$sceDelegate",function(e,n,r){if(t&&n.msie&&n.msieDocumentMode<8)throw di("iequirks","Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks mode. You can fix this by adding the text <!doctype html> to the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more information.");var i=R(vi);i.isEnabled=function(){return t},i.trustAs=r.trustAs,i.getTrusted=r.getTrusted,i.valueOf=r.valueOf,t||(i.trustAs=i.getTrusted=function(t,e){return e},i.valueOf=d),i.parseAs=function(t,n){var r=e(n);return r.literal&&r.constant?r:function(e,n){return i.getTrusted(t,r(e,n))}};var s=i.parseAs,a=i.getTrusted,u=i.trustAs;return o(vi,function(t,e){var n=pr(e);i[le("parse_as_"+n)]=function(e){return s(t,e)},i[le("get_trusted_"+n)]=function(e){return a(t,e)},i[le("trust_as_"+n)]=function(e){return u(t,e)}}),i}]}function Vn(){this.$get=["$window","$document",function(t,e){var n,r,i={},o=h((/android (\d+)/.exec(pr((t.navigator||{}).userAgent))||[])[1]),s=/Boxee/i.test((t.navigator||{}).userAgent),a=e[0]||{},u=a.documentMode,c=/^(Moz|webkit|O|ms)(?=[A-Z])/,l=a.body&&a.body.style,f=!1,p=!1;if(l){for(var $ in l)if(r=c.exec($)){n=r[0],n=n.substr(0,1).toUpperCase()+n.substr(1);break}n||(n="WebkitOpacity"in l&&"webkit"),f=!!("transition"in l||n+"Transition"in l),p=!!("animation"in l||n+"Animation"in l),!o||f&&p||(f=w(a.body.style.webkitTransition),p=w(a.body.style.webkitAnimation))}return{history:!(!t.history||!t.history.pushState||4>o||s),hashchange:"onhashchange"in t&&(!u||u>7),hasEvent:function(t){if("input"==t&&9==mr)return!1;if(g(i[t])){var e=a.createElement("div");i[t]="on"+t in e}return i[t]},csp:I(),vendorPrefix:n,transitions:f,animations:p,android:o,msie:mr,msieDocumentMode:u}}]}function In(){this.$get=["$rootScope","$browser","$q","$exceptionHandler",function(t,e,n,r){function i(i,s,a){var u,c=n.defer(),l=c.promise,f=m(a)&&!a;return u=e.defer(function(){try{c.resolve(i())}catch(e){c.reject(e),r(e)}finally{delete o[l.$$timeoutId]}f||t.$apply()},s),l.$$timeoutId=u,o[u]=c,l}var o={};return i.cancel=function(t){return t&&t.$$timeoutId in o?(o[t.$$timeoutId].reject("canceled"),delete o[t.$$timeoutId],e.defer.cancel(t.$$timeoutId)):!1},i}]}function Un(t){var e=t;return mr&&(gi.setAttribute("href",e),e=gi.href),gi.setAttribute("href",e),{href:gi.href,protocol:gi.protocol?gi.protocol.replace(/:$/,""):"",host:gi.host,search:gi.search?gi.search.replace(/^\?/,""):"",hash:gi.hash?gi.hash.replace(/^#/,""):"",hostname:gi.hostname,port:gi.port,pathname:"/"===gi.pathname.charAt(0)?gi.pathname:"/"+gi.pathname}}function Fn(t){var e=w(t)?Un(t):t;return e.protocol===mi.protocol&&e.host===mi.host}function _n(){this.$get=v(t)}function Hn(t){function e(r,i){if(y(r)){var s={};return o(r,function(t,n){s[n]=e(n,t)}),s}return t.factory(r+n,i)}var n="Filter";this.register=e,this.$get=["$injector",function(t){return function(e){return t.get(e+n)}}],e("currency",Bn),e("date",Yn),e("filter",Ln),e("json",Zn),e("limitTo",tr),e("lowercase",Si),e("number",zn),e("orderBy",er),e("uppercase",Ci)}function Ln(){return function(t,e,n){if(!S(t))return t;var r=typeof n,i=[];i.check=function(t){for(var e=0;e<i.length;e++)if(!i[e](t))return!1;return!0},"function"!==r&&(n="boolean"===r&&n?function(t,e){return Ar.equals(t,e)}:function(t,e){if(t&&e&&"object"==typeof t&&"object"==typeof e){for(var r in t)if("$"!==r.charAt(0)&&$r.call(t,r)&&n(t[r],e[r]))return!0;return!1}return e=(""+e).toLowerCase(),(""+t).toLowerCase().indexOf(e)>-1});var o=function(t,e){if("string"==typeof e&&"!"===e.charAt(0))return!o(t,e.substr(1));switch(typeof t){case"boolean":case"number":case"string":return n(t,e);case"object":switch(typeof e){case"object":return n(t,e);default:for(var r in t)if("$"!==r.charAt(0)&&o(t[r],e))return!0}return!1;case"array":for(var i=0;i<t.length;i++)if(o(t[i],e))return!0;return!1;default:return!1}};switch(typeof e){case"boolean":case"number":case"string":e={$:e};case"object":for(var s in e)!function(t){"undefined"!=typeof e[t]&&i.push(function(n){return o("$"==t?n:n&&n[t],e[t])})}(s);break;case"function":i.push(e);break;default:return t}for(var a=[],u=0;u<t.length;u++){var c=t[u];i.check(c)&&a.push(c)}return a}}function Bn(t){var e=t.NUMBER_FORMATS;return function(t,n){return g(n)&&(n=e.CURRENCY_SYM),Wn(t,e.PATTERNS[1],e.GROUP_SEP,e.DECIMAL_SEP,2).replace(/\u00A4/g,n)
}}function zn(t){var e=t.NUMBER_FORMATS;return function(t,n){return Wn(t,e.PATTERNS[0],e.GROUP_SEP,e.DECIMAL_SEP,n)}}function Wn(t,e,n,r,i){if(null==t||!isFinite(t)||y(t))return"";var o=0>t;t=Math.abs(t);var s=t+"",a="",u=[],c=!1;if(-1!==s.indexOf("e")){var l=s.match(/([\d\.]+)e(-?)(\d+)/);l&&"-"==l[2]&&l[3]>i+1?s="0":(a=s,c=!0)}if(c)i>0&&t>-1&&1>t&&(a=t.toFixed(i));else{var f=(s.split(yi)[1]||"").length;g(i)&&(i=Math.min(Math.max(e.minFrac,f),e.maxFrac));var h=Math.pow(10,i);t=Math.round(t*h)/h;var p=(""+t).split(yi),$=p[0];p=p[1]||"";var d,v=0,m=e.lgSize,w=e.gSize;if($.length>=m+w)for(v=$.length-m,d=0;v>d;d++)(v-d)%w===0&&0!==d&&(a+=n),a+=$.charAt(d);for(d=v;d<$.length;d++)($.length-d)%m===0&&0!==d&&(a+=n),a+=$.charAt(d);for(;p.length<i;)p+="0";i&&"0"!==i&&(a+=r+p.substr(0,i))}return u.push(o?e.negPre:e.posPre),u.push(a),u.push(o?e.negSuf:e.posSuf),u.join("")}function Qn(t,e,n){var r="";for(0>t&&(r="-",t=-t),t=""+t;t.length<e;)t="0"+t;return n&&(t=t.substr(t.length-e)),r+t}function Jn(t,e,n,r){return n=n||0,function(i){var o=i["get"+t]();return(n>0||o>-n)&&(o+=n),0===o&&-12==n&&(o=12),Qn(o,e,r)}}function Xn(t,e){return function(n,r){var i=n["get"+t](),o=dr(e?"SHORT"+t:t);return r[o][i]}}function Gn(t){var e=-1*t.getTimezoneOffset(),n=e>=0?"+":"";return n+=Qn(Math[e>0?"floor":"ceil"](e/60),2)+Qn(Math.abs(e%60),2)}function Kn(t,e){return t.getHours()<12?e.AMPMS[0]:e.AMPMS[1]}function Yn(t){function e(t){var e;if(e=t.match(n)){var r=new Date(0),i=0,o=0,s=e[8]?r.setUTCFullYear:r.setFullYear,a=e[8]?r.setUTCHours:r.setHours;e[9]&&(i=h(e[9]+e[10]),o=h(e[9]+e[11])),s.call(r,h(e[1]),h(e[2])-1,h(e[3]));var u=h(e[4]||0)-i,c=h(e[5]||0)-o,l=h(e[6]||0),f=Math.round(1e3*parseFloat("0."+(e[7]||0)));return a.call(r,u,c,l,f),r}return t}var n=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(n,r){var i,s,a="",u=[];if(r=r||"mediumDate",r=t.DATETIME_FORMATS[r]||r,w(n)&&(n=xi.test(n)?h(n):e(n)),b(n)&&(n=new Date(n)),!x(n))return n;for(;r;)s=bi.exec(r),s?(u=U(u,s,1),r=u.pop()):(u.push(r),r=null);return o(u,function(e){i=wi[e],a+=i?i(n,t.DATETIME_FORMATS):e.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),a}}function Zn(){return function(t){return L(t,!0)}}function tr(){return function(t,e){if(!S(t)&&!w(t))return t;if(e=h(e),w(t))return e?e>=0?t.slice(0,e):t.slice(e,t.length):"";var n,r,i=[];for(e>t.length?e=t.length:e<-t.length&&(e=-t.length),e>0?(n=0,r=e):(n=t.length+e,r=t.length);r>n;n++)i.push(t[n]);return i}}function er(t){return function(e,n,r){function i(t,e){for(var r=0;r<n.length;r++){var i=n[r](t,e);if(0!==i)return i}return 0}function o(t,e){return z(e)?function(e,n){return t(n,e)}:t}function s(t,e){var n=typeof t,r=typeof e;return n==r?("string"==n&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e?0:e>t?-1:1):r>n?-1:1}if(!S(e))return e;if(!n)return e;n=S(n)?n:[n],n=P(n,function(e){var n=!1,r=e||d;if(w(e)&&(("+"==e.charAt(0)||"-"==e.charAt(0))&&(n="-"==e.charAt(0),e=e.substring(1)),r=t(e),r.constant)){var i=r();return o(function(t,e){return s(t[i],e[i])},n)}return o(function(t,e){return s(r(t),r(e))},n)});for(var a=[],u=0;u<e.length;u++)a.push(e[u]);return a.sort(o(i,r))}}function nr(t){return C(t)&&(t={link:t}),t.restrict=t.restrict||"AC",v(t)}function rr(t,e,n,r){function i(e,n){n=n?"-"+te(n,"-"):"",r.removeClass(t,(e?Vi:qi)+n),r.addClass(t,(e?qi:Vi)+n)}var s=this,a=t.parent().controller("form")||Ai,u=0,c=s.$error={},l=[];s.$name=e.name||e.ngForm,s.$dirty=!1,s.$pristine=!0,s.$valid=!0,s.$invalid=!1,a.$addControl(s),t.addClass(Ii),i(!0),s.$addControl=function(t){ie(t.$name,"input"),l.push(t),t.$name&&(s[t.$name]=t)},s.$removeControl=function(t){t.$name&&s[t.$name]===t&&delete s[t.$name],o(c,function(e,n){s.$setValidity(n,!0,t)}),D(l,t)},s.$setValidity=function(t,e,n){var r=c[t];if(e)r&&(D(r,n),r.length||(u--,u||(i(e),s.$valid=!0,s.$invalid=!1),c[t]=!1,i(!0,t),a.$setValidity(t,!0,s)));else{if(u||i(e),r){if(j(r,n))return}else c[t]=r=[],u++,i(!1,t),a.$setValidity(t,!1,s);r.push(n),s.$valid=!1,s.$invalid=!0}},s.$setDirty=function(){r.removeClass(t,Ii),r.addClass(t,Ui),s.$dirty=!0,s.$pristine=!1,a.$setDirty()},s.$setPristine=function(){r.removeClass(t,Ui),r.addClass(t,Ii),s.$dirty=!1,s.$pristine=!0,o(l,function(t){t.$setPristine()})}}function ir(t,e,r,i){return t.$setValidity(e,r),r?i:n}function or(t,e,n){var r=n.prop("validity");if(y(r)){var i=function(n){return t.$error[e]||!(r.badInput||r.customError||r.typeMismatch)||r.valueMissing?n:void t.$setValidity(e,!1)};t.$parsers.push(i)}}function sr(t,e,n,i,o,s){var a=e.prop("validity");if(!o.android){var u=!1;e.on("compositionstart",function(){u=!0}),e.on("compositionend",function(){u=!1,c()})}var c=function(){if(!u){var r=e.val();z(n.ngTrim||"T")&&(r=Tr(r)),(i.$viewValue!==r||a&&""===r&&!a.valueMissing)&&(t.$$phase?i.$setViewValue(r):t.$apply(function(){i.$setViewValue(r)}))}};if(o.hasEvent("input"))e.on("input",c);else{var l,f=function(){l||(l=s.defer(function(){c(),l=null}))};e.on("keydown",function(t){var e=t.keyCode;91===e||e>15&&19>e||e>=37&&40>=e||f()}),o.hasEvent("paste")&&e.on("paste cut",f)}e.on("change",c),i.$render=function(){e.val(i.$isEmpty(i.$viewValue)?"":i.$viewValue)};var p,$,d=n.ngPattern;if(d){var v=function(t,e){return ir(i,"pattern",i.$isEmpty(e)||t.test(e),e)};$=d.match(/^\/(.*)\/([gim]*)$/),$?(d=new RegExp($[1],$[2]),p=function(t){return v(d,t)}):p=function(n){var i=t.$eval(d);if(!i||!i.test)throw r("ngPattern")("noregexp","Expected {0} to be a RegExp but was {1}. Element: {2}",d,i,W(e));return v(i,n)},i.$formatters.push(p),i.$parsers.push(p)}if(n.ngMinlength){var g=h(n.ngMinlength),m=function(t){return ir(i,"minlength",i.$isEmpty(t)||t.length>=g,t)};i.$parsers.push(m),i.$formatters.push(m)}if(n.ngMaxlength){var y=h(n.ngMaxlength),w=function(t){return ir(i,"maxlength",i.$isEmpty(t)||t.length<=y,t)};i.$parsers.push(w),i.$formatters.push(w)}}function ar(t,e,r,i,o,s){if(sr(t,e,r,i,o,s),i.$parsers.push(function(t){var e=i.$isEmpty(t);return e||Ni.test(t)?(i.$setValidity("number",!0),""===t?null:e?t:parseFloat(t)):(i.$setValidity("number",!1),n)}),or(i,"number",e),i.$formatters.push(function(t){return i.$isEmpty(t)?"":""+t}),r.min){var a=function(t){var e=parseFloat(r.min);return ir(i,"min",i.$isEmpty(t)||t>=e,t)};i.$parsers.push(a),i.$formatters.push(a)}if(r.max){var u=function(t){var e=parseFloat(r.max);return ir(i,"max",i.$isEmpty(t)||e>=t,t)};i.$parsers.push(u),i.$formatters.push(u)}i.$formatters.push(function(t){return ir(i,"number",i.$isEmpty(t)||b(t),t)})}function ur(t,e,n,r,i,o){sr(t,e,n,r,i,o);var s=function(t){return ir(r,"url",r.$isEmpty(t)||Pi.test(t),t)};r.$formatters.push(s),r.$parsers.push(s)}function cr(t,e,n,r,i,o){sr(t,e,n,r,i,o);var s=function(t){return ir(r,"email",r.$isEmpty(t)||ji.test(t),t)};r.$formatters.push(s),r.$parsers.push(s)}function lr(t,e,n,r){g(n.name)&&e.attr("name",c()),e.on("click",function(){e[0].checked&&t.$apply(function(){r.$setViewValue(n.value)})}),r.$render=function(){var t=n.value;e[0].checked=t==r.$viewValue},n.$observe("value",r.$render)}function fr(t,e,n,r){var i=n.ngTrueValue,o=n.ngFalseValue;w(i)||(i=!0),w(o)||(o=!1),e.on("click",function(){t.$apply(function(){r.$setViewValue(e[0].checked)})}),r.$render=function(){e[0].checked=r.$viewValue},r.$isEmpty=function(t){return t!==i},r.$formatters.push(function(t){return t===i}),r.$parsers.push(function(t){return t?i:o})}function hr(t,e){return t="ngClass"+t,["$animate",function(n){function r(t,e){var n=[];t:for(var r=0;r<t.length;r++){for(var i=t[r],o=0;o<e.length;o++)if(i==e[o])continue t;n.push(i)}return n}function i(t){if(S(t))return t;if(w(t))return t.split(" ");if(y(t)){var e=[];return o(t,function(t,n){t&&e.push(n)}),e}return t}return{restrict:"AC",link:function(s,a,u){function c(t){var e=f(t,1);u.$addClass(e)}function l(t){var e=f(t,-1);u.$removeClass(e)}function f(t,e){var n=a.data("$classCounts")||{},r=[];return o(t,function(t){(e>0||n[t])&&(n[t]=(n[t]||0)+e,n[t]===+(e>0)&&r.push(t))}),a.data("$classCounts",n),r.join(" ")}function h(t,e){var i=r(e,t),o=r(t,e);o=f(o,-1),i=f(i,1),0===i.length?n.removeClass(a,o):0===o.length?n.addClass(a,i):n.setClass(a,i,o)}function p(t){if(e===!0||s.$index%2===e){var n=i(t||[]);if($){if(!V(t,$)){var r=i($);h(r,n)}}else c(n)}$=R(t)}var $;s.$watch(u[t],p,!0),u.$observe("class",function(){p(s.$eval(u[t]))}),"ngClass"!==t&&s.$watch("$index",function(n,r){var o=1&n;if(o!==r&1){var a=i(s.$eval(u[t]));o===e?c(a):l(a)}})}}}]}var pr=function(t){return w(t)?t.toLowerCase():t},$r=Object.prototype.hasOwnProperty,dr=function(t){return w(t)?t.toUpperCase():t},vr=function(t){return w(t)?t.replace(/[A-Z]/g,function(t){return String.fromCharCode(32|t.charCodeAt(0))}):t},gr=function(t){return w(t)?t.replace(/[a-z]/g,function(t){return String.fromCharCode(-33&t.charCodeAt(0))}):t};"i"!=="I".toLowerCase()&&(pr=vr,dr=gr);var mr,yr,wr,br,xr,Sr=[].slice,Cr=[].push,kr=Object.prototype.toString,Er=r("ng"),Ar=(t.angular,t.angular||(t.angular={})),Or=["0","0","0"];mr=h((/msie (\d+)/.exec(pr(navigator.userAgent))||[])[1]),isNaN(mr)&&(mr=h((/trident\/.*; rv:(\d+)/.exec(pr(navigator.userAgent))||[])[1])),$.$inject=[],d.$inject=[];var Tr=function(){return String.prototype.trim?function(t){return w(t)?t.trim():t}:function(t){return w(t)?t.replace(/^\s\s*/,"").replace(/\s\s*$/,""):t}}();xr=9>mr?function(t){return t=t.nodeName?t:t[0],t.scopeName&&"HTML"!=t.scopeName?dr(t.scopeName+":"+t.nodeName):t.nodeName}:function(t){return t.nodeName?t.nodeName:t[0].nodeName};var Mr=/[A-Z]/g,Pr={full:"1.2.16",major:1,minor:2,dot:16,codeName:"badger-enumeration"},jr=de.cache={},Nr=de.expando="ng-"+(new Date).getTime(),Dr=1,Rr=t.document.addEventListener?function(t,e,n){t.addEventListener(e,n,!1)}:function(t,e,n){t.attachEvent("on"+e,n)},qr=t.document.removeEventListener?function(t,e,n){t.removeEventListener(e,n,!1)}:function(t,e,n){t.detachEvent("on"+e,n)},Vr=(de._data=function(t){return this.cache[t[this.expando]]||{}},/([\:\-\_]+(.))/g),Ir=/^moz([A-Z])/,Ur=r("jqLite"),Fr=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,_r=/<|&#?\w+;/,Hr=/<([\w:]+)/,Lr=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Br={option:[1,'<select multiple="multiple">',"</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};Br.optgroup=Br.option,Br.tbody=Br.tfoot=Br.colgroup=Br.caption=Br.thead,Br.th=Br.td;var zr=de.prototype={ready:function(n){function r(){i||(i=!0,n())}var i=!1;"complete"===e.readyState?setTimeout(r):(this.on("DOMContentLoaded",r),de(t).on("load",r))},toString:function(){var t=[];return o(this,function(e){t.push(""+e)}),"["+t.join(", ")+"]"},eq:function(t){return yr(t>=0?this[t]:this[this.length+t])},length:0,push:Cr,sort:[].sort,splice:[].splice},Wr={};o("multiple,selected,checked,disabled,readOnly,required,open".split(","),function(t){Wr[pr(t)]=t});var Qr={};o("input,select,option,textarea,button,form,details".split(","),function(t){Qr[dr(t)]=!0}),o({data:be,inheritedData:Ae,scope:function(t){return yr(t).data("$scope")||Ae(t.parentNode||t,["$isolateScope","$scope"])},isolateScope:function(t){return yr(t).data("$isolateScope")||yr(t).data("$isolateScopeNoTemplate")},controller:Ee,injector:function(t){return Ae(t,"$injector")},removeAttr:function(t,e){t.removeAttribute(e)},hasClass:xe,css:function(t,e,r){if(e=le(e),!m(r)){var i;return 8>=mr&&(i=t.currentStyle&&t.currentStyle[e],""===i&&(i="auto")),i=i||t.style[e],8>=mr&&(i=""===i?n:i),i}t.style[e]=r},attr:function(t,e,r){var i=pr(e);if(Wr[i]){if(!m(r))return t[e]||(t.attributes.getNamedItem(e)||$).specified?i:n;r?(t[e]=!0,t.setAttribute(e,i)):(t[e]=!1,t.removeAttribute(i))}else if(m(r))t.setAttribute(e,r);else if(t.getAttribute){var o=t.getAttribute(e,2);return null===o?n:o}},prop:function(t,e,n){return m(n)?void(t[e]=n):t[e]},text:function(){function t(t,n){var r=e[t.nodeType];return g(n)?r?t[r]:"":void(t[r]=n)}var e=[];return 9>mr?(e[1]="innerText",e[3]="nodeValue"):e[1]=e[3]="textContent",t.$dv="",t}(),val:function(t,e){if(g(e)){if("SELECT"===xr(t)&&t.multiple){var n=[];return o(t.options,function(t){t.selected&&n.push(t.value||t.text)}),0===n.length?null:n}return t.value}t.value=e},html:function(t,e){if(g(e))return t.innerHTML;for(var n=0,r=t.childNodes;n<r.length;n++)ge(r[n]);t.innerHTML=e},empty:Oe},function(t,e){de.prototype[e]=function(e,r){var i,o;if(t!==Oe&&(2==t.length&&t!==xe&&t!==Ee?e:r)===n){if(y(e)){for(i=0;i<this.length;i++)if(t===be)t(this[i],e);else for(o in e)t(this[i],o,e[o]);return this}for(var s=t.$dv,a=s===n?Math.min(this.length,1):this.length,u=0;a>u;u++){var c=t(this[u],e,r);s=s?s+c:c}return s}for(i=0;i<this.length;i++)t(this[i],e,r);return this}}),o({removeData:ye,dealoc:ge,on:function So(t,n,r,i){if(m(i))throw Ur("onargs","jqLite#on() does not support the `selector` or `eventData` parameters");var s=we(t,"events"),a=we(t,"handle");s||we(t,"events",s={}),a||we(t,"handle",a=Me(t,s)),o(n.split(" "),function(n){var i=s[n];if(!i){if("mouseenter"==n||"mouseleave"==n){var o=e.body.contains||e.body.compareDocumentPosition?function(t,e){var n=9===t.nodeType?t.documentElement:t,r=e&&e.parentNode;return t===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):t.compareDocumentPosition&&16&t.compareDocumentPosition(r)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1};s[n]=[];var u={mouseleave:"mouseout",mouseenter:"mouseover"};So(t,u[n],function(t){var e=this,r=t.relatedTarget;(!r||r!==e&&!o(e,r))&&a(t,n)})}else Rr(t,n,a),s[n]=[];i=s[n]}i.push(r)})},off:me,one:function(t,e,n){t=yr(t),t.on(e,function r(){t.off(e,n),t.off(e,r)}),t.on(e,n)},replaceWith:function(t,e){var n,r=t.parentNode;ge(t),o(new de(e),function(e){n?r.insertBefore(e,n.nextSibling):r.replaceChild(e,t),n=e})},children:function(t){var e=[];return o(t.childNodes,function(t){1===t.nodeType&&e.push(t)}),e},contents:function(t){return t.contentDocument||t.childNodes||[]},append:function(t,e){o(new de(e),function(e){(1===t.nodeType||11===t.nodeType)&&t.appendChild(e)})},prepend:function(t,e){if(1===t.nodeType){var n=t.firstChild;o(new de(e),function(e){t.insertBefore(e,n)})}},wrap:function(t,e){e=yr(e)[0];var n=t.parentNode;n&&n.replaceChild(e,t),e.appendChild(t)},remove:function(t){ge(t);var e=t.parentNode;e&&e.removeChild(t)},after:function(t,e){var n=t,r=t.parentNode;o(new de(e),function(t){r.insertBefore(t,n.nextSibling),n=t})},addClass:Ce,removeClass:Se,toggleClass:function(t,e,n){e&&o(e.split(" "),function(e){var r=n;g(r)&&(r=!xe(t,e)),(r?Ce:Se)(t,e)})},parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},next:function(t){if(t.nextElementSibling)return t.nextElementSibling;for(var e=t.nextSibling;null!=e&&1!==e.nodeType;)e=e.nextSibling;return e},find:function(t,e){return t.getElementsByTagName?t.getElementsByTagName(e):[]},clone:ve,triggerHandler:function(t,e,n){var r=(we(t,"events")||{})[e];n=n||[];var i=[{preventDefault:$,stopPropagation:$}];o(r,function(e){e.apply(t,i.concat(n))})}},function(t,e){de.prototype[e]=function(e,n,r){for(var i,o=0;o<this.length;o++)g(i)?(i=t(this[o],e,n,r),m(i)&&(i=yr(i))):ke(i,t(this[o],e,n,r));return m(i)?i:this},de.prototype.bind=de.prototype.on,de.prototype.unbind=de.prototype.off}),je.prototype={put:function(t,e){this[Pe(t)]=e},get:function(t){return this[Pe(t)]},remove:function(t){var e=this[t=Pe(t)];return delete this[t],e}};var Jr=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,Xr=/,/,Gr=/^\s*(_?)(\S+?)\1\s*$/,Kr=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,Yr=r("$injector"),Zr=r("$animate"),ti=["$provide",function(t){this.$$selectors={},this.register=function(e,n){var r=e+"-animation";if(e&&"."!=e.charAt(0))throw Zr("notcsel","Expecting class selector starting with '.' got '{0}'.",e);this.$$selectors[e.substr(1)]=r,t.factory(r,n)},this.classNameFilter=function(t){return 1===arguments.length&&(this.$$classNameFilter=t instanceof RegExp?t:null),this.$$classNameFilter},this.$get=["$timeout","$$asyncCallback",function(t,e){function n(t){t&&e(t)}return{enter:function(t,e,r,i){r?r.after(t):(e&&e[0]||(e=r.parent()),e.append(t)),n(i)},leave:function(t,e){t.remove(),n(e)},move:function(t,e,n,r){this.enter(t,e,n,r)},addClass:function(t,e,r){e=w(e)?e:S(e)?e.join(" "):"",o(t,function(t){Ce(t,e)}),n(r)},removeClass:function(t,e,r){e=w(e)?e:S(e)?e.join(" "):"",o(t,function(t){Se(t,e)}),n(r)},setClass:function(t,e,r,i){o(t,function(t){Ce(t,e),Se(t,r)}),n(i)},enabled:$}}]}],ei=r("$compile");_e.$inject=["$provide","$$sanitizeUriProvider"];var ni=/^(x[\:\-_]|data[\:\-_])/i,ri=r("$interpolate"),ii=/^([^\?#]*)(\?([^#]*))?(#(.*))?$/,oi={http:80,https:443,ftp:21},si=r("$location");$n.prototype=pn.prototype=hn.prototype={$$html5:!1,$$replace:!1,absUrl:dn("$$absUrl"),url:function(t,e){if(g(t))return this.$$url;var n=ii.exec(t);return n[1]&&this.path(decodeURIComponent(n[1])),(n[2]||n[1])&&this.search(n[3]||""),this.hash(n[5]||"",e),this},protocol:dn("$$protocol"),host:dn("$$host"),port:dn("$$port"),path:vn("$$path",function(t){return"/"==t.charAt(0)?t:"/"+t}),search:function(t,e){switch(arguments.length){case 0:return this.$$search;case 1:if(w(t))this.$$search=J(t);else{if(!y(t))throw si("isrcharg","The first argument of the `$location#search()` call must be a string or an object.");this.$$search=t}break;default:g(e)||null===e?delete this.$$search[t]:this.$$search[t]=e}return this.$$compose(),this},hash:vn("$$hash",d),replace:function(){return this.$$replace=!0,this}};var ai,ui=r("$parse"),ci={},li={"null":function(){return null},"true":function(){return!0},"false":function(){return!1},undefined:$,"+":function(t,e,r,i){return r=r(t,e),i=i(t,e),m(r)?m(i)?r+i:r:m(i)?i:n},"-":function(t,e,n,r){return n=n(t,e),r=r(t,e),(m(n)?n:0)-(m(r)?r:0)},"*":function(t,e,n,r){return n(t,e)*r(t,e)},"/":function(t,e,n,r){return n(t,e)/r(t,e)},"%":function(t,e,n,r){return n(t,e)%r(t,e)},"^":function(t,e,n,r){return n(t,e)^r(t,e)},"=":$,"===":function(t,e,n,r){return n(t,e)===r(t,e)},"!==":function(t,e,n,r){return n(t,e)!==r(t,e)},"==":function(t,e,n,r){return n(t,e)==r(t,e)},"!=":function(t,e,n,r){return n(t,e)!=r(t,e)},"<":function(t,e,n,r){return n(t,e)<r(t,e)},">":function(t,e,n,r){return n(t,e)>r(t,e)},"<=":function(t,e,n,r){return n(t,e)<=r(t,e)},">=":function(t,e,n,r){return n(t,e)>=r(t,e)},"&&":function(t,e,n,r){return n(t,e)&&r(t,e)},"||":function(t,e,n,r){return n(t,e)||r(t,e)},"&":function(t,e,n,r){return n(t,e)&r(t,e)},"|":function(t,e,n,r){return r(t,e)(t,e,n(t,e))},"!":function(t,e,n){return!n(t,e)}},fi={n:"\n",f:"\f",r:"\r",t:" ",v:" ","'":"'",'"':'"'},hi=function(t){this.options=t};hi.prototype={constructor:hi,lex:function(t){this.text=t,this.index=0,this.ch=n,this.lastCh=":",this.tokens=[];for(var e,r=[];this.index<this.text.length;){if(this.ch=this.text.charAt(this.index),this.is("\"'"))this.readString(this.ch);else if(this.isNumber(this.ch)||this.is(".")&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdent(this.ch))this.readIdent(),this.was("{,")&&"{"===r[0]&&(e=this.tokens[this.tokens.length-1])&&(e.json=-1===e.text.indexOf("."));else if(this.is("(){}[].,;:?"))this.tokens.push({index:this.index,text:this.ch,json:this.was(":[,")&&this.is("{[")||this.is("}]:,")}),this.is("{[")&&r.unshift(this.ch),this.is("}]")&&r.shift(),this.index++;else{if(this.isWhitespace(this.ch)){this.index++;continue}var i=this.ch+this.peek(),o=i+this.peek(2),s=li[this.ch],a=li[i],u=li[o];u?(this.tokens.push({index:this.index,text:o,fn:u}),this.index+=3):a?(this.tokens.push({index:this.index,text:i,fn:a}),this.index+=2):s?(this.tokens.push({index:this.index,text:this.ch,fn:s,json:this.was("[,:")&&this.is("+-")}),this.index+=1):this.throwError("Unexpected next character ",this.index,this.index+1)}this.lastCh=this.ch}return this.tokens},is:function(t){return-1!==t.indexOf(this.ch)},was:function(t){return-1!==t.indexOf(this.lastCh)},peek:function(t){var e=t||1;return this.index+e<this.text.length?this.text.charAt(this.index+e):!1},isNumber:function(t){return t>="0"&&"9">=t},isWhitespace:function(t){return" "===t||"\r"===t||" "===t||"\n"===t||" "===t||" "===t},isIdent:function(t){return t>="a"&&"z">=t||t>="A"&&"Z">=t||"_"===t||"$"===t},isExpOperator:function(t){return"-"===t||"+"===t||this.isNumber(t)},throwError:function(t,e,n){n=n||this.index;var r=m(e)?"s "+e+"-"+this.index+" ["+this.text.substring(e,n)+"]":" "+n;throw ui("lexerr","Lexer Error: {0} at column{1} in expression [{2}].",t,r,this.text)},readNumber:function(){for(var t="",e=this.index;this.index<this.text.length;){var n=pr(this.text.charAt(this.index));if("."==n||this.isNumber(n))t+=n;else{var r=this.peek();if("e"==n&&this.isExpOperator(r))t+=n;else if(this.isExpOperator(n)&&r&&this.isNumber(r)&&"e"==t.charAt(t.length-1))t+=n;else{if(!this.isExpOperator(n)||r&&this.isNumber(r)||"e"!=t.charAt(t.length-1))break;this.throwError("Invalid exponent")}}this.index++}t=1*t,this.tokens.push({index:e,text:t,json:!0,fn:function(){return t}})},readIdent:function(){for(var t,e,n,r,i=this,o="",s=this.index;this.index<this.text.length&&(r=this.text.charAt(this.index),"."===r||this.isIdent(r)||this.isNumber(r));)"."===r&&(t=this.index),o+=r,this.index++;if(t)for(e=this.index;e<this.text.length;){if(r=this.text.charAt(e),"("===r){n=o.substr(t-s+1),o=o.substr(0,t-s),this.index=e;break}if(!this.isWhitespace(r))break;e++}var a={index:s,text:o};if(li.hasOwnProperty(o))a.fn=li[o],a.json=li[o];else{var u=kn(o,this.options,this.text);a.fn=f(function(t,e){return u(t,e)},{assign:function(t,e){return bn(t,o,e,i.text,i.options)}})}this.tokens.push(a),n&&(this.tokens.push({index:t,text:".",json:!1}),this.tokens.push({index:t+1,text:n,json:!1}))},readString:function(t){var e=this.index;this.index++;for(var n="",r=t,i=!1;this.index<this.text.length;){var o=this.text.charAt(this.index);if(r+=o,i){if("u"===o){var s=this.text.substring(this.index+1,this.index+5);s.match(/[\da-f]{4}/i)||this.throwError("Invalid unicode escape [\\u"+s+"]"),this.index+=4,n+=String.fromCharCode(parseInt(s,16))}else{var a=fi[o];n+=a?a:o}i=!1}else if("\\"===o)i=!0;else{if(o===t)return this.index++,void this.tokens.push({index:e,text:r,string:n,json:!0,fn:function(){return n}});n+=o}this.index++}this.throwError("Unterminated quote",e)}};var pi=function(t,e,n){this.lexer=t,this.$filter=e,this.options=n};pi.ZERO=f(function(){return 0},{constant:!0}),pi.prototype={constructor:pi,parse:function(t,e){this.text=t,this.json=e,this.tokens=this.lexer.lex(t),e&&(this.assignment=this.logicalOR,this.functionCall=this.fieldAccess=this.objectIndex=this.filterChain=function(){this.throwError("is not valid json",{text:t,index:0})});var n=e?this.primary():this.statements();return 0!==this.tokens.length&&this.throwError("is an unexpected token",this.tokens[0]),n.literal=!!n.literal,n.constant=!!n.constant,n},primary:function(){var t;if(this.expect("("))t=this.filterChain(),this.consume(")");else if(this.expect("["))t=this.arrayDeclaration();else if(this.expect("{"))t=this.object();else{var e=this.expect();t=e.fn,t||this.throwError("not a primary expression",e),e.json&&(t.constant=!0,t.literal=!0)}for(var n,r;n=this.expect("(","[",".");)"("===n.text?(t=this.functionCall(t,r),r=null):"["===n.text?(r=t,t=this.objectIndex(t)):"."===n.text?(r=t,t=this.fieldAccess(t)):this.throwError("IMPOSSIBLE");return t},throwError:function(t,e){throw ui("syntax","Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}].",e.text,t,e.index+1,this.text,this.text.substring(e.index))},peekToken:function(){if(0===this.tokens.length)throw ui("ueoe","Unexpected end of expression: {0}",this.text);return this.tokens[0]},peek:function(t,e,n,r){if(this.tokens.length>0){var i=this.tokens[0],o=i.text;if(o===t||o===e||o===n||o===r||!t&&!e&&!n&&!r)return i}return!1},expect:function(t,e,n,r){var i=this.peek(t,e,n,r);return i?(this.json&&!i.json&&this.throwError("is not valid json",i),this.tokens.shift(),i):!1},consume:function(t){this.expect(t)||this.throwError("is unexpected, expecting ["+t+"]",this.peek())},unaryFn:function(t,e){return f(function(n,r){return t(n,r,e)},{constant:e.constant})},ternaryFn:function(t,e,n){return f(function(r,i){return t(r,i)?e(r,i):n(r,i)},{constant:t.constant&&e.constant&&n.constant})},binaryFn:function(t,e,n){return f(function(r,i){return e(r,i,t,n)},{constant:t.constant&&n.constant})},statements:function(){for(var t=[];;)if(this.tokens.length>0&&!this.peek("}",")",";","]")&&t.push(this.filterChain()),!this.expect(";"))return 1===t.length?t[0]:function(e,n){for(var r,i=0;i<t.length;i++){var o=t[i];o&&(r=o(e,n))}return r}},filterChain:function(){for(var t,e=this.expression();;){if(!(t=this.expect("|")))return e;e=this.binaryFn(e,t.fn,this.filter())}},filter:function(){for(var t=this.expect(),e=this.$filter(t.text),n=[];;){if(!(t=this.expect(":"))){var r=function(t,r,i){for(var o=[i],s=0;s<n.length;s++)o.push(n[s](t,r));return e.apply(t,o)};return function(){return r}}n.push(this.expression())}},expression:function(){return this.assignment()},assignment:function(){var t,e,n=this.ternary();return(e=this.expect("="))?(n.assign||this.throwError("implies assignment but ["+this.text.substring(0,e.index)+"] can not be assigned to",e),t=this.ternary(),function(e,r){return n.assign(e,t(e,r),r)}):n},ternary:function(){var t,e,n=this.logicalOR();return(e=this.expect("?"))?(t=this.ternary(),(e=this.expect(":"))?this.ternaryFn(n,t,this.ternary()):void this.throwError("expected :",e)):n},logicalOR:function(){for(var t,e=this.logicalAND();;){if(!(t=this.expect("||")))return e;e=this.binaryFn(e,t.fn,this.logicalAND())}},logicalAND:function(){var t,e=this.equality();return(t=this.expect("&&"))&&(e=this.binaryFn(e,t.fn,this.logicalAND())),e},equality:function(){var t,e=this.relational();return(t=this.expect("==","!=","===","!=="))&&(e=this.binaryFn(e,t.fn,this.equality())),e},relational:function(){var t,e=this.additive();return(t=this.expect("<",">","<=",">="))&&(e=this.binaryFn(e,t.fn,this.relational())),e},additive:function(){for(var t,e=this.multiplicative();t=this.expect("+","-");)e=this.binaryFn(e,t.fn,this.multiplicative());return e},multiplicative:function(){for(var t,e=this.unary();t=this.expect("*","/","%");)e=this.binaryFn(e,t.fn,this.unary());return e},unary:function(){var t;return this.expect("+")?this.primary():(t=this.expect("-"))?this.binaryFn(pi.ZERO,t.fn,this.unary()):(t=this.expect("!"))?this.unaryFn(t.fn,this.unary()):this.primary()},fieldAccess:function(t){var e=this,n=this.expect().text,r=kn(n,this.options,this.text);return f(function(e,n,i){return r(i||t(e,n))},{assign:function(r,i,o){return bn(t(r,o),n,i,e.text,e.options)}})},objectIndex:function(t){var e=this,r=this.expression();return this.consume("]"),f(function(i,o){var s,a,u=t(i,o),c=r(i,o);return u?(s=wn(u[c],e.text),s&&s.then&&e.options.unwrapPromises&&(a=s,"$$v"in s||(a.$$v=n,a.then(function(t){a.$$v=t})),s=s.$$v),s):n},{assign:function(n,i,o){var s=r(n,o),a=wn(t(n,o),e.text);return a[s]=i}})},functionCall:function(t,e){var n=[];if(")"!==this.peekToken().text)do n.push(this.expression());while(this.expect(","));this.consume(")");var r=this;return function(i,o){for(var s=[],a=e?e(i,o):i,u=0;u<n.length;u++)s.push(n[u](i,o));var c=t(i,o,a)||$;wn(a,r.text),wn(c,r.text);var l=c.apply?c.apply(a,s):c(s[0],s[1],s[2],s[3],s[4]);return wn(l,r.text)}},arrayDeclaration:function(){var t=[],e=!0;if("]"!==this.peekToken().text)do{if(this.peek("]"))break;var n=this.expression();t.push(n),n.constant||(e=!1)}while(this.expect(","));return this.consume("]"),f(function(e,n){for(var r=[],i=0;i<t.length;i++)r.push(t[i](e,n));return r},{literal:!0,constant:e})},object:function(){var t=[],e=!0;if("}"!==this.peekToken().text)do{if(this.peek("}"))break;var n=this.expect(),r=n.string||n.text;this.consume(":");var i=this.expression();t.push({key:r,value:i}),i.constant||(e=!1)}while(this.expect(","));return this.consume("}"),f(function(e,n){for(var r={},i=0;i<t.length;i++){var o=t[i];r[o.key]=o.value(e,n)}return r},{literal:!0,constant:e})}};var $i={},di=r("$sce"),vi={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},gi=e.createElement("a"),mi=Un(t.location.href,!0);Hn.$inject=["$provide"],Bn.$inject=["$locale"],zn.$inject=["$locale"];var yi=".",wi={yyyy:Jn("FullYear",4),yy:Jn("FullYear",2,0,!0),y:Jn("FullYear",1),MMMM:Xn("Month"),MMM:Xn("Month",!0),MM:Jn("Month",2,1),M:Jn("Month",1,1),dd:Jn("Date",2),d:Jn("Date",1),HH:Jn("Hours",2),H:Jn("Hours",1),hh:Jn("Hours",2,-12),h:Jn("Hours",1,-12),mm:Jn("Minutes",2),m:Jn("Minutes",1),ss:Jn("Seconds",2),s:Jn("Seconds",1),sss:Jn("Milliseconds",3),EEEE:Xn("Day"),EEE:Xn("Day",!0),a:Kn,Z:Gn},bi=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,xi=/^\-?\d+$/;Yn.$inject=["$locale"];var Si=v(pr),Ci=v(dr);er.$inject=["$parse"];var ki=v({restrict:"E",compile:function(t,n){return 8>=mr&&(n.href||n.name||n.$set("href",""),t.append(e.createComment("IE fix"))),n.href||n.xlinkHref||n.name?void 0:function(t,e){var n="[object SVGAnimatedString]"===kr.call(e.prop("href"))?"xlink:href":"href";e.on("click",function(t){e.attr(n)||t.preventDefault()})}}}),Ei={};o(Wr,function(t,e){if("multiple"!=t){var n=He("ng-"+e);Ei[n]=function(){return{priority:100,link:function(t,r,i){t.$watch(i[n],function(t){i.$set(e,!!t)})}}}}}),o(["src","srcset","href"],function(t){var e=He("ng-"+t);Ei[e]=function(){return{priority:99,link:function(n,r,i){var o=t,s=t;"href"===t&&"[object SVGAnimatedString]"===kr.call(r.prop("href"))&&(s="xlinkHref",i.$attr[s]="xlink:href",o=null),i.$observe(e,function(t){t&&(i.$set(s,t),mr&&o&&r.prop(o,i[s]))})}}}});var Ai={$addControl:$,$removeControl:$,$setValidity:$,$setDirty:$,$setPristine:$};rr.$inject=["$element","$attrs","$scope","$animate"];var Oi=function(t){return["$timeout",function(e){var r={name:"form",restrict:t?"EAC":"E",controller:rr,compile:function(){return{pre:function(t,r,i,o){if(!i.action){var s=function(t){t.preventDefault?t.preventDefault():t.returnValue=!1};Rr(r[0],"submit",s),r.on("$destroy",function(){e(function(){qr(r[0],"submit",s)},0,!1)})}var a=r.parent().controller("form"),u=i.name||i.ngForm;u&&bn(t,u,o,u),a&&r.on("$destroy",function(){a.$removeControl(o),u&&bn(t,u,n,u),f(o,Ai)})}}}};return r}]},Ti=Oi(),Mi=Oi(!0),Pi=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,ji=/^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*$/i,Ni=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,Di={text:sr,number:ar,url:ur,email:cr,radio:lr,checkbox:fr,hidden:$,button:$,submit:$,reset:$,file:$},Ri=["$browser","$sniffer",function(t,e){return{restrict:"E",require:"?ngModel",link:function(n,r,i,o){o&&(Di[pr(i.type)]||Di.text)(n,r,i,o,e,t)}}}],qi="ng-valid",Vi="ng-invalid",Ii="ng-pristine",Ui="ng-dirty",Fi=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate",function(t,e,n,i,s,a){function u(t,e){e=e?"-"+te(e,"-"):"",a.removeClass(i,(t?Vi:qi)+e),a.addClass(i,(t?qi:Vi)+e)}this.$viewValue=Number.NaN,this.$modelValue=Number.NaN,this.$parsers=[],this.$formatters=[],this.$viewChangeListeners=[],this.$pristine=!0,this.$dirty=!1,this.$valid=!0,this.$invalid=!1,this.$name=n.name;var c=s(n.ngModel),l=c.assign;if(!l)throw r("ngModel")("nonassign","Expression '{0}' is non-assignable. Element: {1}",n.ngModel,W(i));this.$render=$,this.$isEmpty=function(t){return g(t)||""===t||null===t||t!==t};var f=i.inheritedData("$formController")||Ai,h=0,p=this.$error={};i.addClass(Ii),u(!0),this.$setValidity=function(t,e){p[t]!==!e&&(e?(p[t]&&h--,h||(u(!0),this.$valid=!0,this.$invalid=!1)):(u(!1),this.$invalid=!0,this.$valid=!1,h++),p[t]=!e,u(e,t),f.$setValidity(t,e,this))},this.$setPristine=function(){this.$dirty=!1,this.$pristine=!0,a.removeClass(i,Ui),a.addClass(i,Ii)},this.$setViewValue=function(n){this.$viewValue=n,this.$pristine&&(this.$dirty=!0,this.$pristine=!1,a.removeClass(i,Ii),a.addClass(i,Ui),f.$setDirty()),o(this.$parsers,function(t){n=t(n)}),this.$modelValue!==n&&(this.$modelValue=n,l(t,n),o(this.$viewChangeListeners,function(t){try{t()}catch(n){e(n)}}))};var d=this;t.$watch(function(){var e=c(t);if(d.$modelValue!==e){var n=d.$formatters,r=n.length;
for(d.$modelValue=e;r--;)e=n[r](e);d.$viewValue!==e&&(d.$viewValue=e,d.$render())}return e})}],_i=function(){return{require:["ngModel","^?form"],controller:Fi,link:function(t,e,n,r){var i=r[0],o=r[1]||Ai;o.$addControl(i),t.$on("$destroy",function(){o.$removeControl(i)})}}},Hi=v({require:"ngModel",link:function(t,e,n,r){r.$viewChangeListeners.push(function(){t.$eval(n.ngChange)})}}),Li=function(){return{require:"?ngModel",link:function(t,e,n,r){if(r){n.required=!0;var i=function(t){return n.required&&r.$isEmpty(t)?void r.$setValidity("required",!1):(r.$setValidity("required",!0),t)};r.$formatters.push(i),r.$parsers.unshift(i),n.$observe("required",function(){i(r.$viewValue)})}}}},Bi=function(){return{require:"ngModel",link:function(t,e,r,i){var s=/\/(.*)\//.exec(r.ngList),a=s&&new RegExp(s[1])||r.ngList||",",u=function(t){if(!g(t)){var e=[];return t&&o(t.split(a),function(t){t&&e.push(Tr(t))}),e}};i.$parsers.push(u),i.$formatters.push(function(t){return S(t)?t.join(", "):n}),i.$isEmpty=function(t){return!t||!t.length}}}},zi=/^(true|false|\d+)$/,Wi=function(){return{priority:100,compile:function(t,e){return zi.test(e.ngValue)?function(t,e,n){n.$set("value",t.$eval(n.ngValue))}:function(t,e,n){t.$watch(n.ngValue,function(t){n.$set("value",t)})}}}},Qi=nr(function(t,e,r){e.addClass("ng-binding").data("$binding",r.ngBind),t.$watch(r.ngBind,function(t){e.text(t==n?"":t)})}),Ji=["$interpolate",function(t){return function(e,n,r){var i=t(n.attr(r.$attr.ngBindTemplate));n.addClass("ng-binding").data("$binding",i),r.$observe("ngBindTemplate",function(t){n.text(t)})}}],Xi=["$sce","$parse",function(t,e){return function(n,r,i){function o(){return(s(n)||"").toString()}r.addClass("ng-binding").data("$binding",i.ngBindHtml);var s=e(i.ngBindHtml);n.$watch(o,function(){r.html(t.getTrustedHtml(s(n))||"")})}}],Gi=hr("",!0),Ki=hr("Odd",0),Yi=hr("Even",1),Zi=nr({compile:function(t,e){e.$set("ngCloak",n),t.removeClass("ng-cloak")}}),to=[function(){return{scope:!0,controller:"@",priority:500}}],eo={};o("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(t){var e=He("ng-"+t);eo[e]=["$parse",function(n){return{compile:function(r,i){var o=n(i[e]);return function(e,n){n.on(pr(t),function(t){e.$apply(function(){o(e,{$event:t})})})}}}}]});var no=["$animate",function(t){return{transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(n,r,i,o,s){var a,u,c;n.$watch(i.ngIf,function(o){z(o)?u||(u=n.$new(),s(u,function(n){n[n.length++]=e.createComment(" end ngIf: "+i.ngIf+" "),a={clone:n},t.enter(n,r.parent(),r)})):(c&&(c.remove(),c=null),u&&(u.$destroy(),u=null),a&&(c=se(a.clone),t.leave(c,function(){c=null}),a=null))})}}}],ro=["$http","$templateCache","$anchorScroll","$animate","$sce",function(t,e,n,r,i){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:Ar.noop,compile:function(o,s){var a=s.ngInclude||s.src,u=s.onload||"",c=s.autoscroll;return function(o,s,l,f,h){var p,$,d,v=0,g=function(){$&&($.remove(),$=null),p&&(p.$destroy(),p=null),d&&(r.leave(d,function(){$=null}),$=d,d=null)};o.$watch(i.parseAsResourceUrl(a),function(i){var a=function(){!m(c)||c&&!o.$eval(c)||n()},l=++v;i?(t.get(i,{cache:e}).success(function(t){if(l===v){var e=o.$new();f.template=t;var n=h(e,function(t){g(),r.enter(t,null,s,a)});p=e,d=n,p.$emit("$includeContentLoaded"),o.$eval(u)}}).error(function(){l===v&&g()}),o.$emit("$includeContentRequested")):(g(),f.template=null)})}}}}],io=["$compile",function(t){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(e,n,r,i){n.html(i.template),t(n.contents())(e)}}}],oo=nr({priority:450,compile:function(){return{pre:function(t,e,n){t.$eval(n.ngInit)}}}}),so=nr({terminal:!0,priority:1e3}),ao=["$locale","$interpolate",function(t,e){var n=/{}/g;return{restrict:"EA",link:function(r,i,s){var a=s.count,u=s.$attr.when&&i.attr(s.$attr.when),c=s.offset||0,l=r.$eval(u)||{},f={},h=e.startSymbol(),p=e.endSymbol(),$=/^when(Minus)?(.+)$/;o(s,function(t,e){$.test(e)&&(l[pr(e.replace("when","").replace("Minus","-"))]=i.attr(s.$attr[e]))}),o(l,function(t,r){f[r]=e(t.replace(n,h+a+"-"+c+p))}),r.$watch(function(){var e=parseFloat(r.$eval(a));return isNaN(e)?"":(e in l||(e=t.pluralCat(e-c)),f[e](r,i,!0))},function(t){i.text(t)})}}}],uo=["$parse","$animate",function(t,n){function s(t){return t.clone[0]}function a(t){return t.clone[t.clone.length-1]}var u="$$NG_REMOVED",c=r("ngRepeat");return{transclude:"element",priority:1e3,terminal:!0,$$tlb:!0,link:function(r,l,f,h,p){var $,d,v,g,m,y,w,b,x,S=f.ngRepeat,C=S.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),k={$id:Pe};if(!C)throw c("iexp","Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",S);if(y=C[1],w=C[2],$=C[3],$?(d=t($),v=function(t,e,n){return x&&(k[x]=t),k[b]=e,k.$index=n,d(r,k)}):(g=function(t,e){return Pe(e)},m=function(t){return t}),C=y.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/),!C)throw c("iidexp","'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",y);b=C[3]||C[1],x=C[2];var E={};r.$watchCollection(w,function(t){var f,h,$,d,y,w,C,k,A,O,T,M,P=l[0],j={},N=[];if(i(t))O=t,A=v||g;else{A=v||m,O=[];for(w in t)t.hasOwnProperty(w)&&"$"!=w.charAt(0)&&O.push(w);O.sort()}for(d=O.length,h=N.length=O.length,f=0;h>f;f++)if(w=t===O?f:O[f],C=t[w],k=A(w,C,f),ie(k,"`track by` id"),E.hasOwnProperty(k))T=E[k],delete E[k],j[k]=T,N[f]=T;else{if(j.hasOwnProperty(k))throw o(N,function(t){t&&t.scope&&(E[t.id]=t)}),c("dupes","Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}",S,k);N[f]={id:k},j[k]=!1}for(w in E)E.hasOwnProperty(w)&&(T=E[w],M=se(T.clone),n.leave(M),o(M,function(t){t[u]=!0}),T.scope.$destroy());for(f=0,h=O.length;h>f;f++){if(w=t===O?f:O[f],C=t[w],T=N[f],N[f-1]&&(P=a(N[f-1])),T.scope){y=T.scope,$=P;do $=$.nextSibling;while($&&$[u]);s(T)!=$&&n.move(se(T.clone),null,yr(P)),P=a(T)}else y=r.$new();y[b]=C,x&&(y[x]=w),y.$index=f,y.$first=0===f,y.$last=f===d-1,y.$middle=!(y.$first||y.$last),y.$odd=!(y.$even=0===(1&f)),T.scope||p(y,function(t){t[t.length++]=e.createComment(" end ngRepeat: "+S+" "),n.enter(t,null,yr(P)),P=t,T.scope=y,T.clone=t,j[T.id]=T})}E=j})}}}],co=["$animate",function(t){return function(e,n,r){e.$watch(r.ngShow,function(e){t[z(e)?"removeClass":"addClass"](n,"ng-hide")})}}],lo=["$animate",function(t){return function(e,n,r){e.$watch(r.ngHide,function(e){t[z(e)?"addClass":"removeClass"](n,"ng-hide")})}}],fo=nr(function(t,e,n){t.$watch(n.ngStyle,function(t,n){n&&t!==n&&o(n,function(t,n){e.css(n,"")}),t&&e.css(t)},!0)}),ho=["$animate",function(t){return{restrict:"EA",require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(e,n,r,i){var s,a,u,c=r.ngSwitch||r.on,l=[];e.$watch(c,function(n){var c,f=l.length;if(f>0){if(u){for(c=0;f>c;c++)u[c].remove();u=null}for(u=[],c=0;f>c;c++){var h=a[c];l[c].$destroy(),u[c]=h,t.leave(h,function(){u.splice(c,1),0===u.length&&(u=null)})}}a=[],l=[],(s=i.cases["!"+n]||i.cases["?"])&&(e.$eval(r.change),o(s,function(n){var r=e.$new();l.push(r),n.transclude(r,function(e){var r=n.element;a.push(e),t.enter(e,r.parent(),r)})}))})}}}],po=nr({transclude:"element",priority:800,require:"^ngSwitch",link:function(t,e,n,r,i){r.cases["!"+n.ngSwitchWhen]=r.cases["!"+n.ngSwitchWhen]||[],r.cases["!"+n.ngSwitchWhen].push({transclude:i,element:e})}}),$o=nr({transclude:"element",priority:800,require:"^ngSwitch",link:function(t,e,n,r,i){r.cases["?"]=r.cases["?"]||[],r.cases["?"].push({transclude:i,element:e})}}),vo=nr({link:function(t,e,n,i,o){if(!o)throw r("ngTransclude")("orphan","Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found. Element: {0}",W(e));o(function(t){e.empty(),e.append(t)})}}),go=["$templateCache",function(t){return{restrict:"E",terminal:!0,compile:function(e,n){if("text/ng-template"==n.type){var r=n.id,i=e[0].text;t.put(r,i)}}}}],mo=r("ngOptions"),yo=v({terminal:!0}),wo=["$compile","$parse",function(t,r){var i=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,a={$setViewValue:$};return{restrict:"E",require:["select","?ngModel"],controller:["$element","$scope","$attrs",function(t,e,n){var r,i,o=this,s={},u=a;o.databound=n.ngModel,o.init=function(t,e,n){u=t,r=e,i=n},o.addOption=function(e){ie(e,'"option value"'),s[e]=!0,u.$viewValue==e&&(t.val(e),i.parent()&&i.remove())},o.removeOption=function(t){this.hasOption(t)&&(delete s[t],u.$viewValue==t&&this.renderUnknownOption(t))},o.renderUnknownOption=function(e){var n="? "+Pe(e)+" ?";i.val(n),t.prepend(i),t.val(n),i.prop("selected",!0)},o.hasOption=function(t){return s.hasOwnProperty(t)},e.$on("$destroy",function(){o.renderUnknownOption=$})}],link:function(a,u,c,l){function f(t,e,n,r){n.$render=function(){var t=n.$viewValue;r.hasOption(t)?(k.parent()&&k.remove(),e.val(t),""===t&&$.prop("selected",!0)):g(t)&&$?e.val(""):r.renderUnknownOption(t)},e.on("change",function(){t.$apply(function(){k.parent()&&k.remove(),n.$setViewValue(e.val())})})}function h(t,e,n){var r;n.$render=function(){var t=new je(n.$viewValue);o(e.find("option"),function(e){e.selected=m(t.get(e.value))})},t.$watch(function(){V(r,n.$viewValue)||(r=R(n.$viewValue),n.$render())}),e.on("change",function(){t.$apply(function(){var t=[];o(e.find("option"),function(e){e.selected&&t.push(e.value)}),n.$setViewValue(t)})})}function p(e,o,a){function u(){var t,n,r,i,u,c,v,w,E,A,O,T,M,P,j,N={"":[]},D=[""],R=a.$modelValue,q=d(e)||[],V=h?s(q):q,I={},U=!1;if(y)if(g&&S(R)){U=new je([]);for(var F=0;F<R.length;F++)I[f]=R[F],U.put(g(e,I),R[F])}else U=new je(R);for(O=0;E=V.length,E>O;O++){if(v=O,h){if(v=V[O],"$"===v.charAt(0))continue;I[h]=v}if(I[f]=q[v],t=p(e,I)||"",(n=N[t])||(n=N[t]=[],D.push(t)),y)T=m(U.remove(g?g(e,I):$(e,I)));else{if(g){var _={};_[f]=R,T=g(e,_)===g(e,I)}else T=R===$(e,I);U=U||T}j=l(e,I),j=m(j)?j:"",n.push({id:g?g(e,I):h?V[O]:O,label:j,selected:T})}for(y||(b||null===R?N[""].unshift({id:"",label:"",selected:!U}):U||N[""].unshift({id:"?",label:"",selected:!0})),A=0,w=D.length;w>A;A++){for(t=D[A],n=N[t],k.length<=A?(i={element:C.clone().attr("label",t),label:n.label},u=[i],k.push(u),o.append(i.element)):(u=k[A],i=u[0],i.label!=t&&i.element.attr("label",i.label=t)),M=null,O=0,E=n.length;E>O;O++)r=n[O],(c=u[O+1])?(M=c.element,c.label!==r.label&&M.text(c.label=r.label),c.id!==r.id&&M.val(c.id=r.id),c.selected!==r.selected&&M.prop("selected",c.selected=r.selected)):(""===r.id&&b?P=b:(P=x.clone()).val(r.id).attr("selected",r.selected).text(r.label),u.push(c={element:P,label:r.label,id:r.id,selected:r.selected}),M?M.after(P):i.element.append(P),M=P);for(O++;u.length>O;)u.pop().element.remove()}for(;k.length>A;)k.pop()[0].element.remove()}var c;if(!(c=w.match(i)))throw mo("iexp","Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '{0}'. Element: {1}",w,W(o));var l=r(c[2]||c[1]),f=c[4]||c[6],h=c[5],p=r(c[3]||""),$=r(c[2]?c[1]:f),d=r(c[7]),v=c[8],g=v?r(c[8]):null,k=[[{element:o,label:""}]];b&&(t(b)(e),b.removeClass("ng-scope"),b.remove()),o.empty(),o.on("change",function(){e.$apply(function(){var t,r,i,s,u,c,l,p,v,m=d(e)||[],w={};if(y){for(i=[],c=0,p=k.length;p>c;c++)for(t=k[c],u=1,l=t.length;l>u;u++)if((s=t[u].element)[0].selected){if(r=s.val(),h&&(w[h]=r),g)for(v=0;v<m.length&&(w[f]=m[v],g(e,w)!=r);v++);else w[f]=m[r];i.push($(e,w))}}else{if(r=o.val(),"?"==r)i=n;else if(""===r)i=null;else if(g){for(v=0;v<m.length;v++)if(w[f]=m[v],g(e,w)==r){i=$(e,w);break}}else w[f]=m[r],h&&(w[h]=r),i=$(e,w);k[0].length>1&&k[0][1].id!==r&&(k[0][1].selected=!1)}a.$setViewValue(i)})}),a.$render=u,e.$watch(u)}if(l[1]){for(var $,d=l[0],v=l[1],y=c.multiple,w=c.ngOptions,b=!1,x=yr(e.createElement("option")),C=yr(e.createElement("optgroup")),k=x.clone(),E=0,A=u.children(),O=A.length;O>E;E++)if(""===A[E].value){$=b=A.eq(E);break}d.init(v,b,k),y&&(v.$isEmpty=function(t){return!t||0===t.length}),w?p(a,u,v):y?h(a,u,v):f(a,u,v,d)}}}}],bo=["$interpolate",function(t){var e={addOption:$,removeOption:$};return{restrict:"E",priority:100,compile:function(n,r){if(g(r.value)){var i=t(n.text(),!0);i||r.$set("value",n.text())}return function(t,n,r){var o="$selectController",s=n.parent(),a=s.data(o)||s.parent().data(o);a&&a.databound?n.prop("selected",!1):a=e,i?t.$watch(i,function(t,e){r.$set("value",t),t!==e&&a.removeOption(e),a.addOption(t)}):a.addOption(r.value),n.on("$destroy",function(){a.removeOption(r.value)})}}}}],xo=v({restrict:"E",terminal:!0});return t.angular.bootstrap?void console.log("WARNING: Tried to load angular more than once."):(ee(),ue(Ar),void yr(e).ready(function(){Y(e,Z)}))}(window,document),!angular.$$csp()&&angular.element(document).find("head").prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}.ng-animate-block-transitions{transition:0s all!important;-webkit-transition:0s all!important;}</style>');
},{}],4:[function(require,module,exports){
function AppCtrl(){}module.exports=AppCtrl;
},{}],5:[function(require,module,exports){
function HomeCtrl(o){o.foo=Math.random()}module.exports=HomeCtrl;
},{}],6:[function(require,module,exports){
function LoginCtrl(){}module.exports=LoginCtrl;
},{}],7:[function(require,module,exports){
function RegisterCtrl(){}module.exports=RegisterCtrl;
},{}],8:[function(require,module,exports){
function TodoCtrl(){}module.exports=TodoCtrl;
},{}],9:[function(require,module,exports){
function UserCtrl(){}module.exports=UserCtrl;
},{}],10:[function(require,module,exports){
},{}],11:[function(require,module,exports){
function replacer(t,e){return util.isUndefined(e)?""+e:!util.isNumber(e)||!isNaN(e)&&isFinite(e)?util.isFunction(e)||util.isRegExp(e)?e.toString():e:e.toString()}function truncate(t,e){return util.isString(t)?t.length<e?t:t.slice(0,e):t}function getMessage(t){return truncate(JSON.stringify(t.actual,replacer),128)+" "+t.operator+" "+truncate(JSON.stringify(t.expected,replacer),128)}function fail(t,e,r,i,s){throw new assert.AssertionError({message:r,actual:t,expected:e,operator:i,stackStartFunction:s})}function ok(t,e){t||fail(t,!0,e,"==",assert.ok)}function _deepEqual(t,e){if(t===e)return!0;if(util.isBuffer(t)&&util.isBuffer(e)){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}return util.isDate(t)&&util.isDate(e)?t.getTime()===e.getTime():util.isRegExp(t)&&util.isRegExp(e)?t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase:util.isObject(t)||util.isObject(e)?objEquiv(t,e):t==e}function isArguments(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function objEquiv(t,e){if(util.isNullOrUndefined(t)||util.isNullOrUndefined(e))return!1;if(t.prototype!==e.prototype)return!1;if(isArguments(t))return isArguments(e)?(t=pSlice.call(t),e=pSlice.call(e),_deepEqual(t,e)):!1;try{var r,i,s=objectKeys(t),n=objectKeys(e)}catch(a){return!1}if(s.length!=n.length)return!1;for(s.sort(),n.sort(),i=s.length-1;i>=0;i--)if(s[i]!=n[i])return!1;for(i=s.length-1;i>=0;i--)if(r=s[i],!_deepEqual(t[r],e[r]))return!1;return!0}function expectedException(t,e){return t&&e?"[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e?!0:e.call({},t)===!0?!0:!1:!1}function _throws(t,e,r,i){var s;util.isString(r)&&(i=r,r=null);try{e()}catch(n){s=n}if(i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),t&&!s&&fail(s,r,"Missing expected exception"+i),!t&&expectedException(s,r)&&fail(s,r,"Got unwanted exception"+i),t&&s&&r&&!expectedException(s,r)||!t&&s)throw s}var util=require("util/"),pSlice=Array.prototype.slice,hasOwn=Object.prototype.hasOwnProperty,assert=module.exports=ok;assert.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=getMessage(this),this.generatedMessage=!0);var e=t.stackStartFunction||fail;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var i=r.stack,s=e.name,n=i.indexOf("\n"+s);if(n>=0){var a=i.indexOf("\n",n+1);i=i.substring(a+1)}this.stack=i}}},util.inherits(assert.AssertionError,Error),assert.fail=fail,assert.ok=ok,assert.equal=function(t,e,r){t!=e&&fail(t,e,r,"==",assert.equal)},assert.notEqual=function(t,e,r){t==e&&fail(t,e,r,"!=",assert.notEqual)},assert.deepEqual=function(t,e,r){_deepEqual(t,e)||fail(t,e,r,"deepEqual",assert.deepEqual)},assert.notDeepEqual=function(t,e,r){_deepEqual(t,e)&&fail(t,e,r,"notDeepEqual",assert.notDeepEqual)},assert.strictEqual=function(t,e,r){t!==e&&fail(t,e,r,"===",assert.strictEqual)},assert.notStrictEqual=function(t,e,r){t===e&&fail(t,e,r,"!==",assert.notStrictEqual)},assert.throws=function(){_throws.apply(this,[!0].concat(pSlice.call(arguments)))},assert.doesNotThrow=function(){_throws.apply(this,[!1].concat(pSlice.call(arguments)))},assert.ifError=function(t){if(t)throw t};var objectKeys=Object.keys||function(t){var e=[];for(var r in t)hasOwn.call(t,r)&&e.push(r);return e};
},{"util/":13}],12:[function(require,module,exports){
module.exports=function(o){return o&&"object"==typeof o&&"function"==typeof o.copy&&"function"==typeof o.fill&&"function"==typeof o.readUInt8};
},{}],13:[function(require,module,exports){
(function(e,t){function r(e,t){var r={seen:[],stylize:o};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(t)?r.showHidden=t:t&&exports._extend(r,t),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=n),s(r,e,r.depth)}function n(e,t){var n=r.styles[t];return n?"["+r.colors[n][0]+"m"+e+"["+r.colors[n][1]+"m":e}function o(e){return e}function i(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function s(e,t,r){if(e.customInspect&&t&&S(t.inspect)&&t.inspect!==exports.inspect&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return x(n)||(n=s(e,n,r)),n}var o=u(e,t);if(o)return o;var g=Object.keys(t),y=i(g);if(e.showHidden&&(g=Object.getOwnPropertyNames(t)),O(t)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return c(t);if(0===g.length){if(S(t)){var d=t.name?": "+t.name:"";return e.stylize("[Function"+d+"]","special")}if(v(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(w(t))return e.stylize(Date.prototype.toString.call(t),"date");if(O(t))return c(t)}var m="",h=!1,b=["{","}"];if(f(t)&&(h=!0,b=["[","]"]),S(t)){var j=t.name?": "+t.name:"";m=" [Function"+j+"]"}if(v(t)&&(m=" "+RegExp.prototype.toString.call(t)),w(t)&&(m=" "+Date.prototype.toUTCString.call(t)),O(t)&&(m=" "+c(t)),0===g.length&&(!h||0==t.length))return b[0]+m+b[1];if(0>r)return v(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var z;return z=h?l(e,t,r,y,g):g.map(function(n){return p(e,t,r,y,n,h)}),e.seen.pop(),a(z,m,b)}function u(e,t){if(b(t))return e.stylize("undefined","undefined");if(x(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return m(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,r,n,o){for(var i=[],s=0,u=t.length;u>s;++s)i.push(_(t,String(s))?p(e,t,r,n,String(s),!0):"");return o.forEach(function(o){o.match(/^\d+$/)||i.push(p(e,t,r,n,o,!0))}),i}function p(e,t,r,n,o,i){var u,c,l;if(l=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]},l.get?c=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(c=e.stylize("[Setter]","special")),_(n,o)||(u="["+o+"]"),c||(e.seen.indexOf(l.value)<0?(c=y(r)?s(e,l.value,null):s(e,l.value,r-1),c.indexOf("\n")>-1&&(c=i?c.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+c.split("\n").map(function(e){return" "+e}).join("\n"))):c=e.stylize("[Circular]","special")),b(u)){if(i&&o.match(/^\d+$/))return c;u=JSON.stringify(""+o),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=e.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=e.stylize(u,"string"))}return u+": "+c}function a(e,t,r){var n=0,o=e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return o>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function f(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function d(e){return null==e}function m(e){return"number"==typeof e}function x(e){return"string"==typeof e}function h(e){return"symbol"==typeof e}function b(e){return void 0===e}function v(e){return j(e)&&"[object RegExp]"===E(e)}function j(e){return"object"==typeof e&&null!==e}function w(e){return j(e)&&"[object Date]"===E(e)}function O(e){return j(e)&&("[object Error]"===E(e)||e instanceof Error)}function S(e){return"function"==typeof e}function z(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function E(e){return Object.prototype.toString.call(e)}function D(e){return 10>e?"0"+e.toString(10):e.toString(10)}function N(){var e=new Date,t=[D(e.getHours()),D(e.getMinutes()),D(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}function _(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var A=/%[sdj%]/g;exports.format=function(e){if(!x(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(r(arguments[n]));return t.join(" ")}for(var n=1,o=arguments,i=o.length,s=String(e).replace(A,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(o[n++]);case"%d":return Number(o[n++]);case"%j":try{return JSON.stringify(o[n++])}catch(t){return"[Circular]"}default:return e}}),u=o[n];i>n;u=o[++n])s+=y(u)||!j(u)?" "+u:" "+r(u);return s},exports.deprecate=function(r,n){function o(){if(!i){if(e.throwDeprecation)throw new Error(n);e.traceDeprecation?console.trace(n):console.error(n),i=!0}return r.apply(this,arguments)}if(b(t.process))return function(){return exports.deprecate(r,n).apply(this,arguments)};if(e.noDeprecation===!0)return r;var i=!1;return o};var k,J={};exports.debuglog=function(t){if(b(k)&&(k=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!J[t])if(new RegExp("\\b"+t+"\\b","i").test(k)){var r=e.pid;J[t]=function(){var e=exports.format.apply(exports,arguments);console.error("%s %d: %s",t,r,e)}}else J[t]=function(){};return J[t]},exports.inspect=r,r.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},r.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},exports.isArray=f,exports.isBoolean=g,exports.isNull=y,exports.isNullOrUndefined=d,exports.isNumber=m,exports.isString=x,exports.isSymbol=h,exports.isUndefined=b,exports.isRegExp=v,exports.isObject=j,exports.isDate=w,exports.isError=O,exports.isFunction=S,exports.isPrimitive=z,exports.isBuffer=require("./support/isBuffer");var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];exports.log=function(){console.log("%s - %s",N(),exports.format.apply(exports,arguments))},exports.inherits=require("inherits"),exports._extend=function(e,t){if(!t||!j(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});
},{"./support/isBuffer":12,"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"inherits":29}],14:[function(require,module,exports){
module.exports=require(10)
},{}],15:[function(require,module,exports){
function Buffer(e,t,r){if(!(this instanceof Buffer))return new Buffer(e,t,r);var n=typeof e;if("base64"===t&&"string"===n)for(e=stringtrim(e);e.length%4!==0;)e+="=";var i;if("number"===n)i=coerce(e);else if("string"===n)i=Buffer.byteLength(e,t);else{if("object"!==n)throw new Error("First argument needs to be a number, array or string.");i=coerce(e.length)}var s;Buffer._useTypedArrays?s=Buffer._augment(new Uint8Array(i)):(s=this,s.length=i,s._isBuffer=!0);var a;if(Buffer._useTypedArrays&&"number"==typeof e.byteLength)s._set(e);else if(isArrayish(e))for(a=0;i>a;a++)s[a]=Buffer.isBuffer(e)?e.readUInt8(a):e[a];else if("string"===n)s.write(e,0,t);else if("number"===n&&!Buffer._useTypedArrays&&!r)for(a=0;i>a;a++)s[a]=0;return s}function _hexWrite(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var s=t.length;assert(s%2===0,"Invalid hex string"),n>s/2&&(n=s/2);for(var a=0;n>a;a++){var o=parseInt(t.substr(2*a,2),16);assert(!isNaN(o),"Invalid hex string"),e[r+a]=o}return Buffer._charsWritten=2*a,a}function _utf8Write(e,t,r,n){var i=Buffer._charsWritten=blitBuffer(utf8ToBytes(t),e,r,n);return i}function _asciiWrite(e,t,r,n){var i=Buffer._charsWritten=blitBuffer(asciiToBytes(t),e,r,n);return i}function _binaryWrite(e,t,r,n){return _asciiWrite(e,t,r,n)}function _base64Write(e,t,r,n){var i=Buffer._charsWritten=blitBuffer(base64ToBytes(t),e,r,n);return i}function _utf16leWrite(e,t,r,n){var i=Buffer._charsWritten=blitBuffer(utf16leToBytes(t),e,r,n);return i}function _base64Slice(e,t,r){return base64.fromByteArray(0===t&&r===e.length?e:e.slice(t,r))}function _utf8Slice(e,t,r){var n="",i="";r=Math.min(e.length,r);for(var s=t;r>s;s++)e[s]<=127?(n+=decodeUtf8Char(i)+String.fromCharCode(e[s]),i=""):i+="%"+e[s].toString(16);return n+decodeUtf8Char(i)}function _asciiSlice(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(e[i]);return n}function _binarySlice(e,t,r){return _asciiSlice(e,t,r)}function _hexSlice(e,t,r){var n=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var i="",s=t;r>s;s++)i+=toHex(e[s]);return i}function _utf16leSlice(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}function _readUInt16(e,t,r,n){n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(void 0!==t&&null!==t,"missing offset"),assert(t+1<e.length,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var s;return r?(s=e[t],i>t+1&&(s|=e[t+1]<<8)):(s=e[t]<<8,i>t+1&&(s|=e[t+1])),s}}function _readUInt32(e,t,r,n){n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(void 0!==t&&null!==t,"missing offset"),assert(t+3<e.length,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var s;return r?(i>t+2&&(s=e[t+2]<<16),i>t+1&&(s|=e[t+1]<<8),s|=e[t],i>t+3&&(s+=e[t+3]<<24>>>0)):(i>t+1&&(s=e[t+1]<<16),i>t+2&&(s|=e[t+2]<<8),i>t+3&&(s|=e[t+3]),s+=e[t]<<24>>>0),s}}function _readInt16(e,t,r,n){n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(void 0!==t&&null!==t,"missing offset"),assert(t+1<e.length,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var s=_readUInt16(e,t,r,!0),a=32768&s;return a?-1*(65535-s+1):s}}function _readInt32(e,t,r,n){n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(void 0!==t&&null!==t,"missing offset"),assert(t+3<e.length,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var s=_readUInt32(e,t,r,!0),a=2147483648&s;return a?-1*(4294967295-s+1):s}}function _readFloat(e,t,r,n){return n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(t+3<e.length,"Trying to read beyond buffer length")),ieee754.read(e,t,r,23,4)}function _readDouble(e,t,r,n){return n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(t+7<e.length,"Trying to read beyond buffer length")),ieee754.read(e,t,r,52,8)}function _writeUInt16(e,t,r,n,i){i||(assert(void 0!==t&&null!==t,"missing value"),assert("boolean"==typeof n,"missing or invalid endian"),assert(void 0!==r&&null!==r,"missing offset"),assert(r+1<e.length,"trying to write beyond buffer length"),verifuint(t,65535));var s=e.length;if(!(r>=s))for(var a=0,o=Math.min(s-r,2);o>a;a++)e[r+a]=(t&255<<8*(n?a:1-a))>>>8*(n?a:1-a)}function _writeUInt32(e,t,r,n,i){i||(assert(void 0!==t&&null!==t,"missing value"),assert("boolean"==typeof n,"missing or invalid endian"),assert(void 0!==r&&null!==r,"missing offset"),assert(r+3<e.length,"trying to write beyond buffer length"),verifuint(t,4294967295));var s=e.length;if(!(r>=s))for(var a=0,o=Math.min(s-r,4);o>a;a++)e[r+a]=t>>>8*(n?a:3-a)&255}function _writeInt16(e,t,r,n,i){i||(assert(void 0!==t&&null!==t,"missing value"),assert("boolean"==typeof n,"missing or invalid endian"),assert(void 0!==r&&null!==r,"missing offset"),assert(r+1<e.length,"Trying to write beyond buffer length"),verifsint(t,32767,-32768));var s=e.length;r>=s||(t>=0?_writeUInt16(e,t,r,n,i):_writeUInt16(e,65535+t+1,r,n,i))}function _writeInt32(e,t,r,n,i){i||(assert(void 0!==t&&null!==t,"missing value"),assert("boolean"==typeof n,"missing or invalid endian"),assert(void 0!==r&&null!==r,"missing offset"),assert(r+3<e.length,"Trying to write beyond buffer length"),verifsint(t,2147483647,-2147483648));var s=e.length;r>=s||(t>=0?_writeUInt32(e,t,r,n,i):_writeUInt32(e,4294967295+t+1,r,n,i))}function _writeFloat(e,t,r,n,i){i||(assert(void 0!==t&&null!==t,"missing value"),assert("boolean"==typeof n,"missing or invalid endian"),assert(void 0!==r&&null!==r,"missing offset"),assert(r+3<e.length,"Trying to write beyond buffer length"),verifIEEE754(t,3.4028234663852886e38,-3.4028234663852886e38));var s=e.length;r>=s||ieee754.write(e,t,r,n,23,4)}function _writeDouble(e,t,r,n,i){i||(assert(void 0!==t&&null!==t,"missing value"),assert("boolean"==typeof n,"missing or invalid endian"),assert(void 0!==r&&null!==r,"missing offset"),assert(r+7<e.length,"Trying to write beyond buffer length"),verifIEEE754(t,1.7976931348623157e308,-1.7976931348623157e308));var s=e.length;r>=s||ieee754.write(e,t,r,n,52,8)}function stringtrim(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function clamp(e,t,r){return"number"!=typeof e?r:(e=~~e,e>=t?t:e>=0?e:(e+=t,e>=0?e:0))}function coerce(e){return e=~~Math.ceil(+e),0>e?0:e}function isArray(e){return(Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)})(e)}function isArrayish(e){return isArray(e)||Buffer.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function toHex(e){return 16>e?"0"+e.toString(16):e.toString(16)}function utf8ToBytes(e){for(var t=[],r=0;r<e.length;r++){var n=e.charCodeAt(r);if(127>=n)t.push(e.charCodeAt(r));else{var i=r;n>=55296&&57343>=n&&r++;for(var s=encodeURIComponent(e.slice(i,r+1)).substr(1).split("%"),a=0;a<s.length;a++)t.push(parseInt(s[a],16))}}return t}function asciiToBytes(e){for(var t=[],r=0;r<e.length;r++)t.push(255&e.charCodeAt(r));return t}function utf16leToBytes(e){for(var t,r,n,i=[],s=0;s<e.length;s++)t=e.charCodeAt(s),r=t>>8,n=t%256,i.push(n),i.push(r);return i}function base64ToBytes(e){return base64.toByteArray(e)}function blitBuffer(e,t,r,n){for(var i=0;n>i&&!(i+r>=t.length||i>=e.length);i++)t[i+r]=e[i];return i}function decodeUtf8Char(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}function verifuint(e,t){assert("number"==typeof e,"cannot write a non-number as a number"),assert(e>=0,"specified a negative value for writing an unsigned value"),assert(t>=e,"value is larger than maximum value for type"),assert(Math.floor(e)===e,"value has a fractional component")}function verifsint(e,t,r){assert("number"==typeof e,"cannot write a non-number as a number"),assert(t>=e,"value larger than maximum allowed value"),assert(e>=r,"value smaller than minimum allowed value"),assert(Math.floor(e)===e,"value has a fractional component")}function verifIEEE754(e,t,r){assert("number"==typeof e,"cannot write a non-number as a number"),assert(t>=e,"value larger than maximum allowed value"),assert(e>=r,"value smaller than minimum allowed value")}function assert(e,t){if(!e)throw new Error(t||"Failed assertion")}var base64=require("base64-js"),ieee754=require("ieee754");exports.Buffer=Buffer,exports.SlowBuffer=Buffer,exports.INSPECT_MAX_BYTES=50,Buffer.poolSize=8192,Buffer._useTypedArrays=function(){if("function"!=typeof Uint8Array||"function"!=typeof ArrayBuffer)return!1;try{var e=new Uint8Array(0);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray}catch(t){return!1}}(),Buffer.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.isBuffer=function(e){return!(null===e||void 0===e||!e._isBuffer)},Buffer.byteLength=function(e,t){var r;switch(e+="",t||"utf8"){case"hex":r=e.length/2;break;case"utf8":case"utf-8":r=utf8ToBytes(e).length;break;case"ascii":case"binary":case"raw":r=e.length;break;case"base64":r=base64ToBytes(e).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=2*e.length;break;default:throw new Error("Unknown encoding")}return r},Buffer.concat=function(e,t){if(assert(isArray(e),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===e.length)return new Buffer(0);if(1===e.length)return e[0];var r;if("number"!=typeof t)for(t=0,r=0;r<e.length;r++)t+=e[r].length;var n=new Buffer(t),i=0;for(r=0;r<e.length;r++){var s=e[r];s.copy(n,i),i+=s.length}return n},Buffer.prototype.write=function(e,t,r,n){if(isFinite(t))isFinite(r)||(n=r,r=void 0);else{var i=n;n=t,t=r,r=i}t=Number(t)||0;var s=this.length-t;r?(r=Number(r),r>s&&(r=s)):r=s,n=String(n||"utf8").toLowerCase();var a;switch(n){case"hex":a=_hexWrite(this,e,t,r);break;case"utf8":case"utf-8":a=_utf8Write(this,e,t,r);break;case"ascii":a=_asciiWrite(this,e,t,r);break;case"binary":a=_binaryWrite(this,e,t,r);break;case"base64":a=_base64Write(this,e,t,r);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":a=_utf16leWrite(this,e,t,r);break;default:throw new Error("Unknown encoding")}return a},Buffer.prototype.toString=function(e,t,r){var n=this;if(e=String(e||"utf8").toLowerCase(),t=Number(t)||0,r=void 0!==r?Number(r):r=n.length,r===t)return"";var i;switch(e){case"hex":i=_hexSlice(n,t,r);break;case"utf8":case"utf-8":i=_utf8Slice(n,t,r);break;case"ascii":i=_asciiSlice(n,t,r);break;case"binary":i=_binarySlice(n,t,r);break;case"base64":i=_base64Slice(n,t,r);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":i=_utf16leSlice(n,t,r);break;default:throw new Error("Unknown encoding")}return i},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},Buffer.prototype.copy=function(e,t,r,n){var i=this;if(r||(r=0),n||0===n||(n=this.length),t||(t=0),n!==r&&0!==e.length&&0!==i.length){assert(n>=r,"sourceEnd < sourceStart"),assert(t>=0&&t<e.length,"targetStart out of bounds"),assert(r>=0&&r<i.length,"sourceStart out of bounds"),assert(n>=0&&n<=i.length,"sourceEnd out of bounds"),n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var s=n-r;if(100>s||!Buffer._useTypedArrays)for(var a=0;s>a;a++)e[a+t]=this[a+r];else e._set(this.subarray(r,r+s),t)}},Buffer.prototype.slice=function(e,t){var r=this.length;if(e=clamp(e,r,0),t=clamp(t,r,r),Buffer._useTypedArrays)return Buffer._augment(this.subarray(e,t));for(var n=t-e,i=new Buffer(n,void 0,!0),s=0;n>s;s++)i[s]=this[s+e];return i},Buffer.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},Buffer.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},Buffer.prototype.readUInt8=function(e,t){return t||(assert(void 0!==e&&null!==e,"missing offset"),assert(e<this.length,"Trying to read beyond buffer length")),e>=this.length?void 0:this[e]},Buffer.prototype.readUInt16LE=function(e,t){return _readUInt16(this,e,!0,t)},Buffer.prototype.readUInt16BE=function(e,t){return _readUInt16(this,e,!1,t)},Buffer.prototype.readUInt32LE=function(e,t){return _readUInt32(this,e,!0,t)},Buffer.prototype.readUInt32BE=function(e,t){return _readUInt32(this,e,!1,t)},Buffer.prototype.readInt8=function(e,t){if(t||(assert(void 0!==e&&null!==e,"missing offset"),assert(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length)){var r=128&this[e];return r?-1*(255-this[e]+1):this[e]}},Buffer.prototype.readInt16LE=function(e,t){return _readInt16(this,e,!0,t)},Buffer.prototype.readInt16BE=function(e,t){return _readInt16(this,e,!1,t)},Buffer.prototype.readInt32LE=function(e,t){return _readInt32(this,e,!0,t)},Buffer.prototype.readInt32BE=function(e,t){return _readInt32(this,e,!1,t)},Buffer.prototype.readFloatLE=function(e,t){return _readFloat(this,e,!0,t)},Buffer.prototype.readFloatBE=function(e,t){return _readFloat(this,e,!1,t)},Buffer.prototype.readDoubleLE=function(e,t){return _readDouble(this,e,!0,t)},Buffer.prototype.readDoubleBE=function(e,t){return _readDouble(this,e,!1,t)},Buffer.prototype.writeUInt8=function(e,t,r){r||(assert(void 0!==e&&null!==e,"missing value"),assert(void 0!==t&&null!==t,"missing offset"),assert(t<this.length,"trying to write beyond buffer length"),verifuint(e,255)),t>=this.length||(this[t]=e)},Buffer.prototype.writeUInt16LE=function(e,t,r){_writeUInt16(this,e,t,!0,r)},Buffer.prototype.writeUInt16BE=function(e,t,r){_writeUInt16(this,e,t,!1,r)},Buffer.prototype.writeUInt32LE=function(e,t,r){_writeUInt32(this,e,t,!0,r)},Buffer.prototype.writeUInt32BE=function(e,t,r){_writeUInt32(this,e,t,!1,r)},Buffer.prototype.writeInt8=function(e,t,r){r||(assert(void 0!==e&&null!==e,"missing value"),assert(void 0!==t&&null!==t,"missing offset"),assert(t<this.length,"Trying to write beyond buffer length"),verifsint(e,127,-128)),t>=this.length||(e>=0?this.writeUInt8(e,t,r):this.writeUInt8(255+e+1,t,r))},Buffer.prototype.writeInt16LE=function(e,t,r){_writeInt16(this,e,t,!0,r)},Buffer.prototype.writeInt16BE=function(e,t,r){_writeInt16(this,e,t,!1,r)},Buffer.prototype.writeInt32LE=function(e,t,r){_writeInt32(this,e,t,!0,r)},Buffer.prototype.writeInt32BE=function(e,t,r){_writeInt32(this,e,t,!1,r)},Buffer.prototype.writeFloatLE=function(e,t,r){_writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function(e,t,r){_writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function(e,t,r){_writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function(e,t,r){_writeDouble(this,e,t,!1,r)},Buffer.prototype.fill=function(e,t,r){if(e||(e=0),t||(t=0),r||(r=this.length),"string"==typeof e&&(e=e.charCodeAt(0)),assert("number"==typeof e&&!isNaN(e),"value is not a number"),assert(r>=t,"end < start"),r!==t&&0!==this.length){assert(t>=0&&t<this.length,"start out of bounds"),assert(r>=0&&r<=this.length,"end out of bounds");for(var n=t;r>n;n++)this[n]=e}},Buffer.prototype.inspect=function(){for(var e=[],t=this.length,r=0;t>r;r++)if(e[r]=toHex(this[r]),r===exports.INSPECT_MAX_BYTES){e[r+1]="...";break}return"<Buffer "+e.join(" ")+">"},Buffer.prototype.toArrayBuffer=function(){if("function"==typeof Uint8Array){if(Buffer._useTypedArrays)return new Buffer(this).buffer;for(var e=new Uint8Array(this.length),t=0,r=e.length;r>t;t+=1)e[t]=this[t];return e.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var BP=Buffer.prototype;Buffer._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=BP.get,e.set=BP.set,e.write=BP.write,e.toString=BP.toString,e.toLocaleString=BP.toString,e.toJSON=BP.toJSON,e.copy=BP.copy,e.slice=BP.slice,e.readUInt8=BP.readUInt8,e.readUInt16LE=BP.readUInt16LE,e.readUInt16BE=BP.readUInt16BE,e.readUInt32LE=BP.readUInt32LE,e.readUInt32BE=BP.readUInt32BE,e.readInt8=BP.readInt8,e.readInt16LE=BP.readInt16LE,e.readInt16BE=BP.readInt16BE,e.readInt32LE=BP.readInt32LE,e.readInt32BE=BP.readInt32BE,e.readFloatLE=BP.readFloatLE,e.readFloatBE=BP.readFloatBE,e.readDoubleLE=BP.readDoubleLE,e.readDoubleBE=BP.readDoubleBE,e.writeUInt8=BP.writeUInt8,e.writeUInt16LE=BP.writeUInt16LE,e.writeUInt16BE=BP.writeUInt16BE,e.writeUInt32LE=BP.writeUInt32LE,e.writeUInt32BE=BP.writeUInt32BE,e.writeInt8=BP.writeInt8,e.writeInt16LE=BP.writeInt16LE,e.writeInt16BE=BP.writeInt16BE,e.writeInt32LE=BP.writeInt32LE,e.writeInt32BE=BP.writeInt32BE,e.writeFloatLE=BP.writeFloatLE,e.writeFloatBE=BP.writeFloatBE,e.writeDoubleLE=BP.writeDoubleLE,e.writeDoubleBE=BP.writeDoubleBE,e.fill=BP.fill,e.inspect=BP.inspect,e.toArrayBuffer=BP.toArrayBuffer,e};
},{"base64-js":16,"ieee754":17}],16:[function(require,module,exports){
var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(){"use strict";function r(r){var t=r.charCodeAt(0);return t===a?62:t===h?63:o>t?-1:o+10>t?t-o+26+26:A+26>t?t-A:c+26>t?t-c+26:void 0}function t(t){function e(r){u[l++]=r}var a,h,o,c,A,u;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.length;A="="===t.charAt(i-2)?2:"="===t.charAt(i-1)?1:0,u=new n(3*t.length/4-A),o=A>0?t.length-4:t.length;var l=0;for(a=0,h=0;o>a;a+=4,h+=3)c=r(t.charAt(a))<<18|r(t.charAt(a+1))<<12|r(t.charAt(a+2))<<6|r(t.charAt(a+3)),e((16711680&c)>>16),e((65280&c)>>8),e(255&c);return 2===A?(c=r(t.charAt(a))<<2|r(t.charAt(a+1))>>4,e(255&c)):1===A&&(c=r(t.charAt(a))<<10|r(t.charAt(a+1))<<4|r(t.charAt(a+2))>>2,e(c>>8&255),e(255&c)),u}function e(r){function t(r){return lookup.charAt(r)}function e(r){return t(r>>18&63)+t(r>>12&63)+t(r>>6&63)+t(63&r)}var n,a,h,o=r.length%3,c="";for(n=0,h=r.length-o;h>n;n+=3)a=(r[n]<<16)+(r[n+1]<<8)+r[n+2],c+=e(a);switch(o){case 1:a=r[r.length-1],c+=t(a>>2),c+=t(a<<4&63),c+="==";break;case 2:a=(r[r.length-2]<<8)+r[r.length-1],c+=t(a>>10),c+=t(a>>4&63),c+=t(a<<2&63),c+="="}return c}var n="undefined"!=typeof Uint8Array?Uint8Array:Array,a=("0".charCodeAt(0),"+".charCodeAt(0)),h="/".charCodeAt(0),o="0".charCodeAt(0),c="a".charCodeAt(0),A="A".charCodeAt(0);module.exports.toByteArray=t,module.exports.fromByteArray=e}();
},{}],17:[function(require,module,exports){
exports.read=function(o,t,a,r,h){var M,p,w=8*h-r-1,f=(1<<w)-1,e=f>>1,i=-7,n=a?h-1:0,s=a?-1:1,N=o[t+n];for(n+=s,M=N&(1<<-i)-1,N>>=-i,i+=w;i>0;M=256*M+o[t+n],n+=s,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+o[t+n],n+=s,i-=8);if(0===M)M=1-e;else{if(M===f)return p?0/0:1/0*(N?-1:1);p+=Math.pow(2,r),M-=e}return(N?-1:1)*p*Math.pow(2,M-r)},exports.write=function(o,t,a,r,h,M){var p,w,f,e=8*M-h-1,i=(1<<e)-1,n=i>>1,s=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,N=r?0:M-1,u=r?1:-1,l=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(w=isNaN(t)?1:0,p=i):(p=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-p))<1&&(p--,f*=2),t+=p+n>=1?s/f:s*Math.pow(2,1-n),t*f>=2&&(p++,f/=2),p+n>=i?(w=0,p=i):p+n>=1?(w=(t*f-1)*Math.pow(2,h),p+=n):(w=t*Math.pow(2,n-1)*Math.pow(2,h),p=0));h>=8;o[a+N]=255&w,N+=u,w/=256,h-=8);for(p=p<<h|w,e+=h;e>0;o[a+N]=255&p,N+=u,p/=256,e-=8);o[a+N-u]|=128*l};
},{}],18:[function(require,module,exports){
function toArray(r,e){if(r.length%intSize!==0){var f=r.length+(intSize-r.length%intSize);r=Buffer.concat([r,zeroBuffer],f)}for(var t=[],n=e?r.readInt32BE:r.readInt32LE,u=0;u<r.length;u+=intSize)t.push(n.call(r,u));return t}function toBuffer(r,e,f){for(var t=new Buffer(e),n=f?t.writeInt32BE:t.writeInt32LE,u=0;u<r.length;u++)n.call(t,r[u],4*u,!0);return t}function hash(r,e,f,t){Buffer.isBuffer(r)||(r=new Buffer(r));var n=e(toArray(r,t),r.length*chrsz);return toBuffer(n,f,t)}var Buffer=require("buffer").Buffer,intSize=4,zeroBuffer=new Buffer(intSize);zeroBuffer.fill(0);var chrsz=8;module.exports={hash:hash};
},{"buffer":15}],19:[function(require,module,exports){
function hmac(e,r,f){Buffer.isBuffer(r)||(r=new Buffer(r)),Buffer.isBuffer(f)||(f=new Buffer(f)),r.length>blocksize?r=e(r):r.length<blocksize&&(r=Buffer.concat([r,zeroBuffer],blocksize));for(var t=new Buffer(blocksize),n=new Buffer(blocksize),i=0;blocksize>i;i++)t[i]=54^r[i],n[i]=92^r[i];var c=e(Buffer.concat([t,f]));return e(Buffer.concat([n,c]))}function hash(e,r){e=e||"sha1";var f=algorithms[e],t=[],n=0;return f||error("algorithm:",e,"is not yet supported"),{update:function(e){return Buffer.isBuffer(e)||(e=new Buffer(e)),t.push(e),n+=e.length,this},digest:function(e){var n=Buffer.concat(t),i=r?hmac(f,r,n):f(n);return t=null,e?i.toString(e):i}}}function error(){var e=[].slice.call(arguments).join(" ");throw new Error([e,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}function each(e,r){for(var f in e)r(e[f],f)}var Buffer=require("buffer").Buffer,sha=require("./sha"),sha256=require("./sha256"),rng=require("./rng"),md5=require("./md5"),algorithms={sha1:sha,sha256:sha256,md5:md5},blocksize=64,zeroBuffer=new Buffer(blocksize);zeroBuffer.fill(0),exports.createHash=function(e){return hash(e)},exports.createHmac=function(e,r){return hash(e,r)},exports.randomBytes=function(e,r){if(!r||!r.call)return new Buffer(rng(e));try{r.call(this,void 0,new Buffer(rng(e)))}catch(f){r(f)}},each(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(e){exports[e]=function(){error("sorry,",e,"is not implemented yet")}});
},{"./md5":20,"./rng":21,"./sha":22,"./sha256":23,"buffer":15}],20:[function(require,module,exports){
function md5_vm_test(){return"900150983cd24fb0d6963f7d28e17f72"==hex_md5("abc")}function core_md5(d,_){d[_>>5]|=128<<_%32,d[(_+64>>>9<<4)+14]=_;for(var m=1732584193,f=-271733879,i=-1732584194,h=271733878,r=0;r<d.length;r+=16){var n=m,e=f,g=i,t=h;m=md5_ff(m,f,i,h,d[r+0],7,-680876936),h=md5_ff(h,m,f,i,d[r+1],12,-389564586),i=md5_ff(i,h,m,f,d[r+2],17,606105819),f=md5_ff(f,i,h,m,d[r+3],22,-1044525330),m=md5_ff(m,f,i,h,d[r+4],7,-176418897),h=md5_ff(h,m,f,i,d[r+5],12,1200080426),i=md5_ff(i,h,m,f,d[r+6],17,-1473231341),f=md5_ff(f,i,h,m,d[r+7],22,-45705983),m=md5_ff(m,f,i,h,d[r+8],7,1770035416),h=md5_ff(h,m,f,i,d[r+9],12,-1958414417),i=md5_ff(i,h,m,f,d[r+10],17,-42063),f=md5_ff(f,i,h,m,d[r+11],22,-1990404162),m=md5_ff(m,f,i,h,d[r+12],7,1804603682),h=md5_ff(h,m,f,i,d[r+13],12,-40341101),i=md5_ff(i,h,m,f,d[r+14],17,-1502002290),f=md5_ff(f,i,h,m,d[r+15],22,1236535329),m=md5_gg(m,f,i,h,d[r+1],5,-165796510),h=md5_gg(h,m,f,i,d[r+6],9,-1069501632),i=md5_gg(i,h,m,f,d[r+11],14,643717713),f=md5_gg(f,i,h,m,d[r+0],20,-373897302),m=md5_gg(m,f,i,h,d[r+5],5,-701558691),h=md5_gg(h,m,f,i,d[r+10],9,38016083),i=md5_gg(i,h,m,f,d[r+15],14,-660478335),f=md5_gg(f,i,h,m,d[r+4],20,-405537848),m=md5_gg(m,f,i,h,d[r+9],5,568446438),h=md5_gg(h,m,f,i,d[r+14],9,-1019803690),i=md5_gg(i,h,m,f,d[r+3],14,-187363961),f=md5_gg(f,i,h,m,d[r+8],20,1163531501),m=md5_gg(m,f,i,h,d[r+13],5,-1444681467),h=md5_gg(h,m,f,i,d[r+2],9,-51403784),i=md5_gg(i,h,m,f,d[r+7],14,1735328473),f=md5_gg(f,i,h,m,d[r+12],20,-1926607734),m=md5_hh(m,f,i,h,d[r+5],4,-378558),h=md5_hh(h,m,f,i,d[r+8],11,-2022574463),i=md5_hh(i,h,m,f,d[r+11],16,1839030562),f=md5_hh(f,i,h,m,d[r+14],23,-35309556),m=md5_hh(m,f,i,h,d[r+1],4,-1530992060),h=md5_hh(h,m,f,i,d[r+4],11,1272893353),i=md5_hh(i,h,m,f,d[r+7],16,-155497632),f=md5_hh(f,i,h,m,d[r+10],23,-1094730640),m=md5_hh(m,f,i,h,d[r+13],4,681279174),h=md5_hh(h,m,f,i,d[r+0],11,-358537222),i=md5_hh(i,h,m,f,d[r+3],16,-722521979),f=md5_hh(f,i,h,m,d[r+6],23,76029189),m=md5_hh(m,f,i,h,d[r+9],4,-640364487),h=md5_hh(h,m,f,i,d[r+12],11,-421815835),i=md5_hh(i,h,m,f,d[r+15],16,530742520),f=md5_hh(f,i,h,m,d[r+2],23,-995338651),m=md5_ii(m,f,i,h,d[r+0],6,-198630844),h=md5_ii(h,m,f,i,d[r+7],10,1126891415),i=md5_ii(i,h,m,f,d[r+14],15,-1416354905),f=md5_ii(f,i,h,m,d[r+5],21,-57434055),m=md5_ii(m,f,i,h,d[r+12],6,1700485571),h=md5_ii(h,m,f,i,d[r+3],10,-1894986606),i=md5_ii(i,h,m,f,d[r+10],15,-1051523),f=md5_ii(f,i,h,m,d[r+1],21,-2054922799),m=md5_ii(m,f,i,h,d[r+8],6,1873313359),h=md5_ii(h,m,f,i,d[r+15],10,-30611744),i=md5_ii(i,h,m,f,d[r+6],15,-1560198380),f=md5_ii(f,i,h,m,d[r+13],21,1309151649),m=md5_ii(m,f,i,h,d[r+4],6,-145523070),h=md5_ii(h,m,f,i,d[r+11],10,-1120210379),i=md5_ii(i,h,m,f,d[r+2],15,718787259),f=md5_ii(f,i,h,m,d[r+9],21,-343485551),m=safe_add(m,n),f=safe_add(f,e),i=safe_add(i,g),h=safe_add(h,t)}return Array(m,f,i,h)}function md5_cmn(d,_,m,f,i,h){return safe_add(bit_rol(safe_add(safe_add(_,d),safe_add(f,h)),i),m)}function md5_ff(d,_,m,f,i,h,r){return md5_cmn(_&m|~_&f,d,_,i,h,r)}function md5_gg(d,_,m,f,i,h,r){return md5_cmn(_&f|m&~f,d,_,i,h,r)}function md5_hh(d,_,m,f,i,h,r){return md5_cmn(_^m^f,d,_,i,h,r)}function md5_ii(d,_,m,f,i,h,r){return md5_cmn(m^(_|~f),d,_,i,h,r)}function safe_add(d,_){var m=(65535&d)+(65535&_),f=(d>>16)+(_>>16)+(m>>16);return f<<16|65535&m}function bit_rol(d,_){return d<<_|d>>>32-_}var helpers=require("./helpers");module.exports=function(d){return helpers.hash(d,core_md5,16)};
},{"./helpers":18}],21:[function(require,module,exports){
!function(){var r,n,t=this;r=function(r){for(var n,n,t=new Array(r),o=0;r>o;o++)0==(3&o)&&(n=4294967296*Math.random()),t[o]=n>>>((3&o)<<3)&255;return t},t.crypto&&crypto.getRandomValues&&(n=function(r){var n=new Uint8Array(r);return crypto.getRandomValues(n),n}),module.exports=n||r}();
},{}],22:[function(require,module,exports){
function core_sha1(r,a){r[a>>5]|=128<<24-a%32,r[(a+64>>9<<4)+15]=a;for(var e=Array(80),d=1732584193,s=-271733879,f=-1732584194,n=271733878,t=-1009589776,o=0;o<r.length;o+=16){for(var _=d,u=s,h=f,l=n,c=t,i=0;80>i;i++){e[i]=16>i?r[o+i]:rol(e[i-3]^e[i-8]^e[i-14]^e[i-16],1);var v=safe_add(safe_add(rol(d,5),sha1_ft(i,s,f,n)),safe_add(safe_add(t,e[i]),sha1_kt(i)));t=n,n=f,f=rol(s,30),s=d,d=v}d=safe_add(d,_),s=safe_add(s,u),f=safe_add(f,h),n=safe_add(n,l),t=safe_add(t,c)}return Array(d,s,f,n,t)}function sha1_ft(r,a,e,d){return 20>r?a&e|~a&d:40>r?a^e^d:60>r?a&e|a&d|e&d:a^e^d}function sha1_kt(r){return 20>r?1518500249:40>r?1859775393:60>r?-1894007588:-899497514}function safe_add(r,a){var e=(65535&r)+(65535&a),d=(r>>16)+(a>>16)+(e>>16);return d<<16|65535&e}function rol(r,a){return r<<a|r>>>32-a}var helpers=require("./helpers");module.exports=function(r){return helpers.hash(r,core_sha1,20,!0)};
},{"./helpers":18}],23:[function(require,module,exports){
var helpers=require("./helpers"),safe_add=function(a,e){var r=(65535&a)+(65535&e),d=(a>>16)+(e>>16)+(r>>16);return d<<16|65535&r},S=function(a,e){return a>>>e|a<<32-e},R=function(a,e){return a>>>e},Ch=function(a,e,r){return a&e^~a&r},Maj=function(a,e,r){return a&e^a&r^e&r},Sigma0256=function(a){return S(a,2)^S(a,13)^S(a,22)},Sigma1256=function(a){return S(a,6)^S(a,11)^S(a,25)},Gamma0256=function(a){return S(a,7)^S(a,18)^R(a,3)},Gamma1256=function(a){return S(a,17)^S(a,19)^R(a,10)},core_sha256=function(a,e){var r,d,n,f,s,t,u,_,o,i,S,c,m=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),h=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),g=new Array(64);a[e>>5]|=128<<24-e%32,a[(e+64>>9<<4)+15]=e;for(var o=0;o<a.length;o+=16){r=h[0],d=h[1],n=h[2],f=h[3],s=h[4],t=h[5],u=h[6],_=h[7];for(var i=0;64>i;i++)g[i]=16>i?a[i+o]:safe_add(safe_add(safe_add(Gamma1256(g[i-2]),g[i-7]),Gamma0256(g[i-15])),g[i-16]),S=safe_add(safe_add(safe_add(safe_add(_,Sigma1256(s)),Ch(s,t,u)),m[i]),g[i]),c=safe_add(Sigma0256(r),Maj(r,d,n)),_=u,u=t,t=s,s=safe_add(f,S),f=n,n=d,d=r,r=safe_add(S,c);h[0]=safe_add(r,h[0]),h[1]=safe_add(d,h[1]),h[2]=safe_add(n,h[2]),h[3]=safe_add(f,h[3]),h[4]=safe_add(s,h[4]),h[5]=safe_add(t,h[5]),h[6]=safe_add(u,h[6]),h[7]=safe_add(_,h[7])}return h};module.exports=function(a){return helpers.hash(a,core_sha256,32,!0)};
},{"./helpers":18}],24:[function(require,module,exports){
function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(e){return"function"==typeof e}function isNumber(e){return"number"==typeof e}function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(e){if(!isNumber(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},EventEmitter.prototype.emit=function(e){var t,n,s,i,r,o;if(this._events||(this._events={}),"error"===e&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length))throw t=arguments[1],t instanceof Error?t:TypeError('Uncaught, unspecified "error" event.');if(n=this._events[e],isUndefined(n))return!1;if(isFunction(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(s=arguments.length,i=new Array(s-1),r=1;s>r;r++)i[r-1]=arguments[r];n.apply(this,i)}else if(isObject(n)){for(s=arguments.length,i=new Array(s-1),r=1;s>r;r++)i[r-1]=arguments[r];for(o=n.slice(),s=o.length,r=0;s>r;r++)o[r].apply(this,i)}return!0},EventEmitter.prototype.addListener=function(e,t){var n;if(!isFunction(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,isFunction(t.listener)?t.listener:t),this._events[e]?isObject(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,isObject(this._events[e])&&!this._events[e].warned){var n;n=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),console.trace())}return this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(e,t){function n(){this.removeListener(e,n),s||(s=!0,t.apply(this,arguments))}if(!isFunction(t))throw TypeError("listener must be a function");var s=!1;return n.listener=t,this.on(e,n),this},EventEmitter.prototype.removeListener=function(e,t){var n,s,i,r;if(!isFunction(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,s=-1,n===t||isFunction(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(isObject(n)){for(r=i;r-->0;)if(n[r]===t||n[r].listener&&n[r].listener===t){s=r;break}if(0>s)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},EventEmitter.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],isFunction(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},EventEmitter.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?isFunction(this._events[e])?[this._events[e]]:this._events[e].slice():[]},EventEmitter.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?isFunction(e._events[t])?1:e._events[t].length:0};
},{}],25:[function(require,module,exports){
var http=module.exports,EventEmitter=require("events").EventEmitter,Request=require("./lib/request"),url=require("url");http.request=function(e,t){"string"==typeof e&&(e=url.parse(e)),e||(e={}),e.host||e.port||(e.port=parseInt(window.location.port,10)),!e.host&&e.hostname&&(e.host=e.hostname),e.scheme||(e.scheme=window.location.protocol.split(":")[0]),e.host||(e.host=window.location.hostname||window.location.host),/:/.test(e.host)&&(e.port||(e.port=e.host.split(":")[1]),e.host=e.host.split(":")[0]),e.port||(e.port="https"==e.scheme?443:80);var o=new Request(new xhrHttp,e);return t&&o.on("response",t),o},http.get=function(e,t){e.method="GET";var o=http.request(e,t);return o.end(),o},http.Agent=function(){},http.Agent.defaultMaxSockets=4;var xhrHttp=function(){if("undefined"==typeof window)throw new Error("no window object present");if(window.XMLHttpRequest)return window.XMLHttpRequest;if(window.ActiveXObject){for(var e=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{var o=new window.ActiveXObject(e[t]);return function(){if(o){var r=o;return o=null,r}return new window.ActiveXObject(e[t])}}catch(r){}throw new Error("ajax not supported in this browser")}throw new Error("ajax not supported in this browser")}();http.STATUS_CODES={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};
},{"./lib/request":26,"events":24,"url":44}],26:[function(require,module,exports){
var Stream=require("stream"),Response=require("./response"),Base64=require("Base64"),inherits=require("inherits"),Request=module.exports=function(e,t){var r=this;r.writable=!0,r.xhr=e,r.body=[],r.uri=(t.scheme||"http")+"://"+t.host+(t.port?":"+t.port:"")+(t.path||"/"),"undefined"==typeof t.withCredentials&&(t.withCredentials=!0);try{e.withCredentials=t.withCredentials}catch(s){}if(e.open(t.method||"GET",r.uri,!0),r._headers={},t.headers)for(var o=objectKeys(t.headers),i=0;i<o.length;i++){var n=o[i];if(r.isSafeRequestHeader(n)){var a=t.headers[n];r.setHeader(n,a)}}t.auth&&this.setHeader("Authorization","Basic "+Base64.btoa(t.auth));var h=new Response;h.on("close",function(){r.emit("close")}),h.on("ready",function(){r.emit("response",h)}),e.onreadystatechange=function(){e.__aborted||h.handle(e)}};inherits(Request,Stream),Request.prototype.setHeader=function(e,t){this._headers[e.toLowerCase()]=t},Request.prototype.getHeader=function(e){return this._headers[e.toLowerCase()]},Request.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},Request.prototype.write=function(e){this.body.push(e)},Request.prototype.destroy=function(){this.xhr.__aborted=!0,this.xhr.abort(),this.emit("close")},Request.prototype.end=function(e){void 0!==e&&this.body.push(e);for(var t=objectKeys(this._headers),r=0;r<t.length;r++){var s=t[r],o=this._headers[s];if(isArray(o))for(var i=0;i<o.length;i++)this.xhr.setRequestHeader(s,o[i]);else this.xhr.setRequestHeader(s,o)}if(0===this.body.length)this.xhr.send("");else if("string"==typeof this.body[0])this.xhr.send(this.body.join(""));else if(isArray(this.body[0])){for(var n=[],r=0;r<this.body.length;r++)n.push.apply(n,this.body[r]);this.xhr.send(n)}else if(/Array/.test(Object.prototype.toString.call(this.body[0]))){for(var a=0,r=0;r<this.body.length;r++)a+=this.body[r].length;for(var n=new this.body[0].constructor(a),h=0,r=0;r<this.body.length;r++)for(var d=this.body[r],i=0;i<d.length;i++)n[h++]=d[i];this.xhr.send(n)}else{for(var n="",r=0;r<this.body.length;r++)n+=this.body[r].toString();this.xhr.send(n)}},Request.unsafeHeaders=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"],Request.prototype.isSafeRequestHeader=function(e){return e?-1===indexOf(Request.unsafeHeaders,e.toLowerCase()):!1};var objectKeys=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t},isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0;r<e.length;r++)if(e[r]===t)return r;return-1};
},{"./response":27,"Base64":28,"inherits":29,"stream":37}],27:[function(require,module,exports){
function parseHeaders(e){for(var t=e.getAllResponseHeaders().split(/\r?\n/),s={},r=0;r<t.length;r++){var a=t[r];if(""!==a){var i=a.match(/^([^:]+):\s*(.*)/);if(i){var o=i[1].toLowerCase(),n=i[2];void 0!==s[o]?isArray(s[o])?s[o].push(n):s[o]=[s[o],n]:s[o]=n}else s[a]=!0}}return s}var Stream=require("stream"),util=require("util"),Response=module.exports=function(){this.offset=0,this.readable=!0};util.inherits(Response,Stream);var capable={streaming:!0,status2:!0};Response.prototype.getResponse=function(e){var t=String(e.responseType).toLowerCase();return"blob"===t?e.responseBlob||e.response:"arraybuffer"===t?e.response:e.responseText},Response.prototype.getHeader=function(e){return this.headers[e.toLowerCase()]},Response.prototype.handle=function(e){if(2===e.readyState&&capable.status2){try{this.statusCode=e.status,this.headers=parseHeaders(e)}catch(t){capable.status2=!1}capable.status2&&this.emit("ready")}else if(capable.streaming&&3===e.readyState){try{this.statusCode||(this.statusCode=e.status,this.headers=parseHeaders(e),this.emit("ready"))}catch(t){}try{this._emitData(e)}catch(t){capable.streaming=!1}}else 4===e.readyState&&(this.statusCode||(this.statusCode=e.status,this.emit("ready")),this._emitData(e),e.error?this.emit("error",this.getResponse(e)):this.emit("end"),this.emit("close"))},Response.prototype._emitData=function(e){var t=this.getResponse(e);return t.toString().match(/ArrayBuffer/)?(this.emit("data",new Uint8Array(t,this.offset)),void(this.offset=t.byteLength)):void(t.length>this.offset&&(this.emit("data",t.slice(this.offset)),this.offset=t.length))};var isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};
},{"stream":37,"util":46}],28:[function(require,module,exports){
!function(){function t(t){this.message=t}var e="undefined"!=typeof exports?exports:this,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=new Error,t.prototype.name="InvalidCharacterError",e.btoa||(e.btoa=function(e){for(var o,n,a=0,i=r,c="";e.charAt(0|a)||(i="=",a%1);c+=i.charAt(63&o>>8-a%1*8)){if(n=e.charCodeAt(a+=.75),n>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}return c}),e.atob||(e.atob=function(e){if(e=e.replace(/=+$/,""),e.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,n,a=0,i=0,c="";n=e.charAt(i++);~n&&(o=a%4?64*o+n:n,a++%4)?c+=String.fromCharCode(255&o>>(-2*a&6)):0)n=r.indexOf(n);return c})}();
},{}],29:[function(require,module,exports){
module.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t};
},{}],30:[function(require,module,exports){
function noop(){}var process=module.exports={};process.nextTick=function(){var o="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(o)return function(o){return window.setImmediate(o)};if(e){var n=[];return window.addEventListener("message",function(o){var e=o.source;if((e===window||null===e)&&"process-tick"===o.data&&(o.stopPropagation(),n.length>0)){var s=n.shift();s()}},!0),function(o){n.push(o),window.postMessage("process-tick","*")}}return function(o){setTimeout(o,0)}}(),process.title="browser",process.browser=!0,process.env={},process.argv=[],process.on=noop,process.once=noop,process.off=noop,process.emit=noop,process.binding=function(){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(){throw new Error("process.chdir is not supported")};
},{}],31:[function(require,module,exports){
(function(r){function t(r,t){for(var e=0,n=r.length-1;n>=0;n--){var s=r[n];"."===s?r.splice(n,1):".."===s?(r.splice(n,1),e++):e&&(r.splice(n,1),e--)}if(t)for(;e--;e)r.unshift("..");return r}function e(r,t){if(r.filter)return r.filter(t);for(var e=[],n=0;n<r.length;n++)t(r[n],n,r)&&e.push(r[n]);return e}var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(r){return n.exec(r).slice(1)};exports.resolve=function(){for(var n="",s=!1,o=arguments.length-1;o>=-1&&!s;o--){var u=o>=0?arguments[o]:r.cwd();if("string"!=typeof u)throw new TypeError("Arguments to path.resolve must be strings");u&&(n=u+"/"+n,s="/"===u.charAt(0))}return n=t(e(n.split("/"),function(r){return!!r}),!s).join("/"),(s?"/":"")+n||"."},exports.normalize=function(r){var n=exports.isAbsolute(r),s="/"===o(r,-1);return r=t(e(r.split("/"),function(r){return!!r}),!n).join("/"),r||n||(r="."),r&&s&&(r+="/"),(n?"/":"")+r},exports.isAbsolute=function(r){return"/"===r.charAt(0)},exports.join=function(){var r=Array.prototype.slice.call(arguments,0);return exports.normalize(e(r,function(r){if("string"!=typeof r)throw new TypeError("Arguments to path.join must be strings");return r}).join("/"))},exports.relative=function(r,t){function e(r){for(var t=0;t<r.length&&""===r[t];t++);for(var e=r.length-1;e>=0&&""===r[e];e--);return t>e?[]:r.slice(t,e-t+1)}r=exports.resolve(r).substr(1),t=exports.resolve(t).substr(1);for(var n=e(r.split("/")),s=e(t.split("/")),o=Math.min(n.length,s.length),u=o,i=0;o>i;i++)if(n[i]!==s[i]){u=i;break}for(var l=[],i=u;i<n.length;i++)l.push("..");return l=l.concat(s.slice(u)),l.join("/")},exports.sep="/",exports.delimiter=":",exports.dirname=function(r){var t=s(r),e=t[0],n=t[1];return e||n?(n&&(n=n.substr(0,n.length-1)),e+n):"."},exports.basename=function(r,t){var e=s(r)[2];return t&&e.substr(-1*t.length)===t&&(e=e.substr(0,e.length-t.length)),e},exports.extname=function(r){return s(r)[3]};var o="b"==="ab".substr(-1)?function(r,t,e){return r.substr(t,e)}:function(r,t,e){return 0>t&&(t=r.length+t),r.substr(t,e)}}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30}],32:[function(require,module,exports){
(function(e){!function(o){function n(e){throw RangeError(M[e])}function t(e,o){for(var n=e.length;n--;)e[n]=o(e[n]);return e}function r(e,o){return t(e.split(L),o).join(".")}function f(e){for(var o,n,t=[],r=0,f=e.length;f>r;)o=e.charCodeAt(r++),o>=55296&&56319>=o&&f>r?(n=e.charCodeAt(r++),56320==(64512&n)?t.push(((1023&o)<<10)+(1023&n)+65536):(t.push(o),r--)):t.push(o);return t}function i(e){return t(e,function(e){var o="";return e>65535&&(e-=65536,o+=T(e>>>10&1023|55296),e=56320|1023&e),o+=T(e)}).join("")}function u(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:C}function c(e,o){return e+22+75*(26>e)-((0!=o)<<5)}function d(e,o,n){var t=0;for(e=n?R(e/A):e>>1,e+=R(e/o);e>P*j>>1;t+=C)e=R(e/P);return R(t+(P+1)*e/(e+m))}function l(e){var o,t,r,f,c,l,s,p,a,h,v=[],w=e.length,g=0,y=F,m=I;for(t=e.lastIndexOf(E),0>t&&(t=0),r=0;t>r;++r)e.charCodeAt(r)>=128&&n("not-basic"),v.push(e.charCodeAt(r));for(f=t>0?t+1:0;w>f;){for(c=g,l=1,s=C;f>=w&&n("invalid-input"),p=u(e.charCodeAt(f++)),(p>=C||p>R((x-g)/l))&&n("overflow"),g+=p*l,a=m>=s?b:s>=m+j?j:s-m,!(a>p);s+=C)h=C-a,l>R(x/h)&&n("overflow"),l*=h;o=v.length+1,m=d(g-c,o,0==c),R(g/o)>x-y&&n("overflow"),y+=R(g/o),g%=o,v.splice(g++,0,y)}return i(v)}function s(e){var o,t,r,i,u,l,s,p,a,h,v,w,g,y,m,A=[];for(e=f(e),w=e.length,o=F,t=0,u=I,l=0;w>l;++l)v=e[l],128>v&&A.push(T(v));for(r=i=A.length,i&&A.push(E);w>r;){for(s=x,l=0;w>l;++l)v=e[l],v>=o&&s>v&&(s=v);for(g=r+1,s-o>R((x-t)/g)&&n("overflow"),t+=(s-o)*g,o=s,l=0;w>l;++l)if(v=e[l],o>v&&++t>x&&n("overflow"),v==o){for(p=t,a=C;h=u>=a?b:a>=u+j?j:a-u,!(h>p);a+=C)m=p-h,y=C-h,A.push(T(c(h+m%y,0))),p=R(m/y);A.push(T(c(p,0))),u=d(t,g,r==i),t=0,++r}++t,++o}return A.join("")}function p(e){return r(e,function(e){return O.test(e)?l(e.slice(4).toLowerCase()):e})}function a(e){return r(e,function(e){return S.test(e)?"xn--"+s(e):e})}var h="object"==typeof exports&&exports,v="object"==typeof module&&module&&module.exports==h&&module,w="object"==typeof e&&e;(w.global===w||w.window===w)&&(o=w);var g,y,x=2147483647,C=36,b=1,j=26,m=38,A=700,I=72,F=128,E="-",O=/^xn--/,S=/[^ -~]/,L=/\x2E|\u3002|\uFF0E|\uFF61/g,M={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=C-b,R=Math.floor,T=String.fromCharCode;if(g={version:"1.2.4",ucs2:{decode:f,encode:i},decode:l,encode:s,toASCII:a,toUnicode:p},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return g});else if(h&&!h.nodeType)if(v)v.exports=g;else for(y in g)g.hasOwnProperty(y)&&(h[y]=g[y]);else o.punycode=g}(this)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});
},{}],33:[function(require,module,exports){
"use strict";function hasOwnProperty(r,e){return Object.prototype.hasOwnProperty.call(r,e)}module.exports=function(r,e,t,n){e=e||"&",t=t||"=";var o={};if("string"!=typeof r||0===r.length)return o;var a=/\+/g;r=r.split(e);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var p=r.length;s>0&&p>s&&(p=s);for(var y=0;p>y;++y){var u,c,i,l,f=r[y].replace(a,"%20"),v=f.indexOf(t);v>=0?(u=f.substr(0,v),c=f.substr(v+1)):(u=f,c=""),i=decodeURIComponent(u),l=decodeURIComponent(c),hasOwnProperty(o,i)?isArray(o[i])?o[i].push(l):o[i]=[o[i],l]:o[i]=l}return o};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)};
},{}],34:[function(require,module,exports){
"use strict";function map(r,e){if(r.map)return r.map(e);for(var t=[],n=0;n<r.length;n++)t.push(e(r[n],n));return t}var stringifyPrimitive=function(r){switch(typeof r){case"string":return r;case"boolean":return r?"true":"false";case"number":return isFinite(r)?r:"";default:return""}};module.exports=function(r,e,t,n){return e=e||"&",t=t||"=",null===r&&(r=void 0),"object"==typeof r?map(objectKeys(r),function(n){var i=encodeURIComponent(stringifyPrimitive(n))+t;return isArray(r[n])?r[n].map(function(r){return i+encodeURIComponent(stringifyPrimitive(r))}).join(e):i+encodeURIComponent(stringifyPrimitive(r[n]))}).join(e):n?encodeURIComponent(stringifyPrimitive(n))+t+encodeURIComponent(stringifyPrimitive(r)):""};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)},objectKeys=Object.keys||function(r){var e=[];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.push(t);return e};
},{}],35:[function(require,module,exports){
"use strict";exports.decode=exports.parse=require("./decode"),exports.encode=exports.stringify=require("./encode");
},{"./decode":33,"./encode":34}],36:[function(require,module,exports){
function Duplex(e){return this instanceof Duplex?(Readable.call(this,e),Writable.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",onend)):new Duplex(e)}function onend(){if(!this.allowHalfOpen&&!this._writableState.ended){var e=this;setImmediate(function(){e.end()})}}module.exports=Duplex;var inherits=require("inherits"),setImmediate=require("process/browser.js").nextTick,Readable=require("./readable.js"),Writable=require("./writable.js");inherits(Duplex,Readable),Duplex.prototype.write=Writable.prototype.write,Duplex.prototype.end=Writable.prototype.end,Duplex.prototype._write=Writable.prototype._write;
},{"./readable.js":40,"./writable.js":42,"inherits":29,"process/browser.js":38}],37:[function(require,module,exports){
function Stream(){EE.call(this)}module.exports=Stream;var EE=require("events").EventEmitter,inherits=require("inherits");inherits(Stream,EE),Stream.Readable=require("./readable.js"),Stream.Writable=require("./writable.js"),Stream.Duplex=require("./duplex.js"),Stream.Transform=require("./transform.js"),Stream.PassThrough=require("./passthrough.js"),Stream.Stream=Stream,Stream.prototype.pipe=function(e,r){function t(r){e.writable&&!1===e.write(r)&&m.pause&&m.pause()}function n(){m.readable&&m.resume&&m.resume()}function o(){u||(u=!0,e.end())}function i(){u||(u=!0,"function"==typeof e.destroy&&e.destroy())}function s(e){if(a(),0===EE.listenerCount(this,"error"))throw e}function a(){m.removeListener("data",t),e.removeListener("drain",n),m.removeListener("end",o),m.removeListener("close",i),m.removeListener("error",s),e.removeListener("error",s),m.removeListener("end",a),m.removeListener("close",a),e.removeListener("close",a)}var m=this;m.on("data",t),e.on("drain",n),e._isStdio||r&&r.end===!1||(m.on("end",o),m.on("close",i));var u=!1;return m.on("error",s),e.on("error",s),m.on("end",a),m.on("close",a),e.on("close",a),e.emit("pipe",m),e};
},{"./duplex.js":36,"./passthrough.js":39,"./readable.js":40,"./transform.js":41,"./writable.js":42,"events":24,"inherits":29}],38:[function(require,module,exports){
var process=module.exports={};process.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,n="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(n){var o=[];return window.addEventListener("message",function(e){var n=e.source;if((n===window||null===n)&&"process-tick"===e.data&&(e.stopPropagation(),o.length>0)){var r=o.shift();r()}},!0),function(e){o.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),process.title="browser",process.browser=!0,process.env={},process.argv=[],process.binding=function(){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(){throw new Error("process.chdir is not supported")};
},{}],39:[function(require,module,exports){
function PassThrough(r){return this instanceof PassThrough?void Transform.call(this,r):new PassThrough(r)}module.exports=PassThrough;var Transform=require("./transform.js"),inherits=require("inherits");inherits(PassThrough,Transform),PassThrough.prototype._transform=function(r,s,o){o(null,r)};
},{"./transform.js":41,"inherits":29}],40:[function(require,module,exports){
(function(e){function t(e){e=e||{};var t=e.highWaterMark;this.highWaterMark=t||0===t?t:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!e.objectMode,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(_||(_=require("string_decoder").StringDecoder),this.decoder=new _(e.encoding),this.encoding=e.encoding)}function n(e){return this instanceof n?(this._readableState=new t(e,this),this.readable=!0,void S.call(this)):new n(e)}function r(e,t,n,r,a){var o=d(t,n);if(o)e.emit("error",o);else if(null===n||void 0===n)t.reading=!1,t.ended||s(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!a){var u=new Error("stream.push() after EOF");e.emit("error",u)}else if(t.endEmitted&&a){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else!t.decoder||a||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,a?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&l(e),h(e,t);else a||(t.reading=!1);return i(t)}function i(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function a(e){if(e>=C)e=C;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function o(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:isNaN(e)||null===e?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=a(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function d(e,t){var n=null;return R.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||n||(n=new TypeError("Invalid non-string/buffer chunk")),n}function s(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?l(e):v(e)}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?E(function(){u(e)}):u(e))}function u(e){e.emit("readable")}function h(e,t){t.readingMore||(t.readingMore=!0,E(function(){f(e,t)}))}function f(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function p(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&c(e)}}function c(e){function t(e){var t=e.write(n);!1===t&&r.awaitDrain++}var n,r=e._readableState;for(r.awaitDrain=0;r.pipesCount&&null!==(n=e.read());)if(1===r.pipesCount?t(r.pipes,0,null):w(r.pipes,t),e.emit("data",n),r.awaitDrain>0)return;return 0===r.pipesCount?(r.flowing=!1,void(M.listenerCount(e,"data")>0&&b(e))):void(r.ranOut=!0)}function g(){this._readableState.ranOut&&(this._readableState.ranOut=!1,c(this))}function b(e,t){var n=e._readableState;if(n.flowing)throw new Error("Cannot switch to old mode now.");var r=t||!1,i=!1;e.readable=!0,e.pipe=S.prototype.pipe,e.on=e.addListener=S.prototype.on,e.on("readable",function(){i=!0;for(var t;!r&&null!==(t=e.read());)e.emit("data",t);null===t&&(i=!1,e._readableState.needReadable=!0)}),e.pause=function(){r=!0,this.emit("pause")},e.resume=function(){r=!1,i?E(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function m(e,t){var n,r=t.buffer,i=t.length,a=!!t.decoder,o=!!t.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(o)n=r.shift();else if(!e||e>=i)n=a?r.join(""):R.concat(r,i),r.length=0;else if(e<r[0].length){var d=r[0];n=d.slice(0,e),r[0]=d.slice(e)}else if(e===r[0].length)n=r.shift();else{n=a?"":new R(e);for(var s=0,l=0,u=r.length;u>l&&e>s;l++){var d=r[0],h=Math.min(e-s,d.length);a?n+=d.slice(0,h):d.copy(n,s,0,h),h<d.length?r[0]=d.slice(h):r.shift(),s+=h}}return n}function v(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,E(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function w(e,t){for(var n=0,r=e.length;r>n;n++)t(e[n],n)}function y(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1}module.exports=n,n.ReadableState=t;var _,M=require("events").EventEmitter,S=require("./index.js"),R=require("buffer").Buffer,E=require("process/browser.js").nextTick,k=require("inherits");k(n,S),n.prototype.push=function(e,t){var n=this._readableState;return"string"!=typeof e||n.objectMode||(t=t||n.defaultEncoding,t!==n.encoding&&(e=new R(e,t),t="")),r(this,n,e,t,!1)},n.prototype.unshift=function(e){var t=this._readableState;return r(this,t,e,"",!0)},n.prototype.setEncoding=function(e){_||(_=require("string_decoder").StringDecoder),this._readableState.decoder=new _(e),this._readableState.encoding=e};var C=8388608;n.prototype.read=function(e){var t=this._readableState;t.calledRead=!0;var n=e;if(("number"!=typeof e||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l(this),null;if(e=o(e,t),0===e&&t.ended)return 0===t.length&&v(this),null;var r=t.needReadable;t.length-e<=t.highWaterMark&&(r=!0),(t.ended||t.reading)&&(r=!1),r&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),r&&!t.reading&&(e=o(n,t));var i;return i=e>0?m(e,t):null,null===i&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&v(this),i},n.prototype._read=function(){this.emit("error",new Error("not implemented"))},n.prototype.pipe=function(t,n){function r(e){e===u&&a()}function i(){t.end()}function a(){t.removeListener("close",d),t.removeListener("finish",s),t.removeListener("drain",m),t.removeListener("error",o),t.removeListener("unpipe",r),u.removeListener("end",i),u.removeListener("end",a),(!t._writableState||t._writableState.needDrain)&&m()}function o(e){l(),0===v&&0===M.listenerCount(t,"error")&&t.emit("error",e)}function d(){t.removeListener("finish",s),l()}function s(){t.removeListener("close",d),l()}function l(){u.unpipe(t)}var u=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=t;break;case 1:h.pipes=[h.pipes,t];break;default:h.pipes.push(t)}h.pipesCount+=1;var f=(!n||n.end!==!1)&&t!==e.stdout&&t!==e.stderr,b=f?i:a;h.endEmitted?E(b):u.once("end",b),t.on("unpipe",r);var m=p(u);t.on("drain",m);var v=M.listenerCount(t,"error");return t.once("error",o),t.once("close",d),t.once("finish",s),t.emit("pipe",u),h.flowing||(this.on("readable",g),h.flowing=!0,E(function(){c(u)})),t},n.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",g),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",g),t.flowing=!1;for(var i=0;r>i;i++)n[i].emit("unpipe",this);return this}var i=y(t.pipes,e);return-1===i?this:(t.pipes.splice(i,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},n.prototype.on=function(e,t){var n=S.prototype.on.call(this,e,t);if("data"!==e||this._readableState.flowing||b(this),"readable"===e&&this.readable){var r=this._readableState;r.readableListening||(r.readableListening=!0,r.emittedReadable=!1,r.needReadable=!0,r.reading?r.length&&l(this,r):this.read(0))}return n},n.prototype.addListener=n.prototype.on,n.prototype.resume=function(){b(this),this.read(0),this.emit("resume")},n.prototype.pause=function(){b(this,!0),this.emit("pause")},n.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;e.on("end",function(){if(t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)}),e.on("data",function(i){if(t.decoder&&(i=t.decoder.write(i)),i&&(t.objectMode||i.length)){var a=r.push(i);a||(n=!0,e.pause())}});for(var i in e)"function"==typeof e[i]&&"undefined"==typeof this[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));var a=["error","close","destroy","pause","resume"];return w(a,function(t){e.on(t,function(e){return r.emit.apply(r,t,e)})}),r._read=function(){n&&(n=!1,e.resume())},r},n._fromList=m}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"./index.js":37,"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"buffer":15,"events":24,"inherits":29,"process/browser.js":38,"string_decoder":43}],41:[function(require,module,exports){
function TransformState(r,t){this.afterTransform=function(r,n){return afterTransform(t,r,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function afterTransform(r,t,n){var e=r._transformState;e.transforming=!1;var a=e.writecb;if(!a)return r.emit("error",new Error("no writecb in Transform class"));e.writechunk=null,e.writecb=null,null!==n&&void 0!==n&&r.push(n),a&&a(t);var i=r._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&r._read(i.highWaterMark)}function Transform(r){if(!(this instanceof Transform))return new Transform(r);Duplex.call(this,r);var t=(this._transformState=new TransformState(r,this),this);this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(r){done(t,r)}):done(t)})}function done(r,t){if(t)return r.emit("error",t);var n=r._writableState,e=(r._readableState,r._transformState);if(n.length)throw new Error("calling transform done when ws.length != 0");if(e.transforming)throw new Error("calling transform done when still transforming");return r.push(null)}module.exports=Transform;var Duplex=require("./duplex.js"),inherits=require("inherits");inherits(Transform,Duplex),Transform.prototype.push=function(r,t){return this._transformState.needTransform=!1,Duplex.prototype.push.call(this,r,t)},Transform.prototype._transform=function(){throw new Error("not implemented")},Transform.prototype._write=function(r,t,n){var e=this._transformState;if(e.writecb=n,e.writechunk=r,e.writeencoding=t,!e.transforming){var a=this._readableState;(e.needTransform||a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}},Transform.prototype._read=function(){var r=this._transformState;r.writechunk&&r.writecb&&!r.transforming?(r.transforming=!0,this._transform(r.writechunk,r.writeencoding,r.afterTransform)):r.needTransform=!0};
},{"./duplex.js":36,"inherits":29}],42:[function(require,module,exports){
function WriteReq(e,t,r){this.chunk=e,this.encoding=t,this.callback=r}function WritableState(e,t){e=e||{};var r=e.highWaterMark;this.highWaterMark=r||0===r?r:16384,this.objectMode=!!e.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=e.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){onwrite(t,e)},this.writecb=null,this.writelen=0,this.buffer=[]}function Writable(e){return this instanceof Writable||this instanceof Stream.Duplex?(this._writableState=new WritableState(e,this),this.writable=!0,void Stream.call(this)):new Writable(e)}function writeAfterEnd(e,t,r){var i=new Error("write after end");e.emit("error",i),setImmediate(function(){r(i)})}function validChunk(e,t,r,i){var n=!0;if(!Buffer.isBuffer(r)&&"string"!=typeof r&&null!==r&&void 0!==r&&!t.objectMode){var f=new TypeError("Invalid non-string/buffer chunk");e.emit("error",f),setImmediate(function(){i(f)}),n=!1}return n}function decodeChunk(e,t,r){return e.objectMode||e.decodeStrings===!1||"string"!=typeof t||(t=new Buffer(t,r)),t}function writeOrBuffer(e,t,r,i,n){r=decodeChunk(t,r,i);var f=t.objectMode?1:r.length;t.length+=f;var o=t.length<t.highWaterMark;return t.needDrain=!o,t.writing?t.buffer.push(new WriteReq(r,i,n)):doWrite(e,t,f,r,i,n),o}function doWrite(e,t,r,i,n,f){t.writelen=r,t.writecb=f,t.writing=!0,t.sync=!0,e._write(i,n,t.onwrite),t.sync=!1}function onwriteError(e,t,r,i,n){r?setImmediate(function(){n(i)}):n(i),e.emit("error",i)}function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function onwrite(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(onwriteStateUpdate(r),t)onwriteError(e,r,i,t,n);else{var f=needFinish(e,r);f||r.bufferProcessing||!r.buffer.length||clearBuffer(e,r),i?setImmediate(function(){afterWrite(e,r,f,n)}):afterWrite(e,r,f,n)}}function afterWrite(e,t,r,i){r||onwriteDrain(e,t),i(),r&&finishMaybe(e,t)}function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function clearBuffer(e,t){t.bufferProcessing=!0;for(var r=0;r<t.buffer.length;r++){var i=t.buffer[r],n=i.chunk,f=i.encoding,o=i.callback,a=t.objectMode?1:n.length;if(doWrite(e,t,a,n,f,o),t.writing){r++;break}}t.bufferProcessing=!1,r<t.buffer.length?t.buffer=t.buffer.slice(r):t.buffer.length=0}function needFinish(e,t){return t.ending&&0===t.length&&!t.finished&&!t.writing}function finishMaybe(e,t){var r=needFinish(e,t);return r&&(t.finished=!0,e.emit("finish")),r}function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?setImmediate(r):e.once("finish",r)),t.ended=!0}module.exports=Writable,Writable.WritableState=WritableState;var isUint8Array="undefined"!=typeof Uint8Array?function(e){return e instanceof Uint8Array}:function(e){return e&&e.constructor&&"Uint8Array"===e.constructor.name},isArrayBuffer="undefined"!=typeof ArrayBuffer?function(e){return e instanceof ArrayBuffer}:function(e){return e&&e.constructor&&"ArrayBuffer"===e.constructor.name},inherits=require("inherits"),Stream=require("./index.js"),setImmediate=require("process/browser.js").nextTick,Buffer=require("buffer").Buffer;inherits(Writable,Stream),Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},Writable.prototype.write=function(e,t,r){var i=this._writableState,n=!1;return"function"==typeof t&&(r=t,t=null),!Buffer.isBuffer(e)&&isUint8Array(e)&&(e=new Buffer(e)),isArrayBuffer(e)&&"undefined"!=typeof Uint8Array&&(e=new Buffer(new Uint8Array(e))),Buffer.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=function(){}),i.ended?writeAfterEnd(this,i,r):validChunk(this,i,e,r)&&(n=writeOrBuffer(this,i,e,t,r)),n},Writable.prototype._write=function(e,t,r){r(new Error("not implemented"))},Writable.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),"undefined"!=typeof e&&null!==e&&this.write(e,t),i.ending||i.finished||endWritable(this,i,r)};
},{"./index.js":37,"buffer":15,"inherits":29,"process/browser.js":38}],43:[function(require,module,exports){
function assertEncoding(e){if(e&&!Buffer.isEncoding(e))throw new Error("Unknown encoding: "+e)}function passThroughWrite(e){return e.toString(this.encoding)}function utf16DetectIncompleteChar(e){var t=this.charReceived=e.length%2;return this.charLength=t?2:0,t}function base64DetectIncompleteChar(e){var t=this.charReceived=e.length%3;return this.charLength=t?3:0,t}var Buffer=require("buffer").Buffer,StringDecoder=exports.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),assertEncoding(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=utf16DetectIncompleteChar;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=base64DetectIncompleteChar;break;default:return void(this.write=passThroughWrite)}this.charBuffer=new Buffer(6),this.charReceived=0,this.charLength=0};StringDecoder.prototype.write=function(e){for(var t="",r=0;this.charLength;){var h=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,r,h),this.charReceived+=h-r,r=h,this.charReceived<this.charLength)return"";t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var i=t.charCodeAt(t.length-1);if(!(i>=55296&&56319>=i)){if(this.charReceived=this.charLength=0,h==e.length)return t;e=e.slice(h,e.length);break}this.charLength+=this.surrogateSize,t=""}var c=this.detectIncompleteChar(e),n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-c,n),this.charReceived=c,n-=c),t+=e.toString(this.encoding,0,n);var n=t.length-1,i=t.charCodeAt(n);if(i>=55296&&56319>=i){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),this.charBuffer.write(t.charAt(t.length-1),this.encoding),t.substring(0,n)}return t},StringDecoder.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(2>=t&&r>>4==14){this.charLength=3;break}if(3>=t&&r>>3==30){this.charLength=4;break}}return t},StringDecoder.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,h=this.charBuffer,i=this.encoding;t+=h.slice(0,r).toString(i)}return t};
},{"buffer":15}],44:[function(require,module,exports){
!function(){"use strict";function t(t,h,a){if(t&&"object"==typeof t&&t.href)return t;if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n={},p=t;p=p.trim();var i=r.exec(p);if(i){i=i[0];var q=i.toLowerCase();n.protocol=q,p=p.substr(i.length)}if(a||i||p.match(/^\/\/[^@\/]+@[^@\/]+/)){var j="//"===p.substr(0,2);!j||i&&g[i]||(p=p.substr(2),n.slashes=!0)}if(!g[i]&&(j||i&&!y[i])){var x=p.indexOf("@");if(-1!==x){for(var A=p.slice(0,x),O=!0,z=0,C=m.length;C>z;z++)if(-1!==A.indexOf(m[z])){O=!1;break}O&&(n.auth=decodeURIComponent(A),p=p.substr(x+1))}for(var Z=-1,z=0,C=f.length;C>z;z++){var k=p.indexOf(f[z]);-1!==k&&(0>Z||Z>k)&&(Z=k)}-1!==Z?(n.host=p.substr(0,Z),p=p.substr(Z)):(n.host=p,p="");for(var w=s(n.host),I=Object.keys(w),z=0,C=I.length;C>z;z++){var R=I[z];n[R]=w[R]}n.hostname=n.hostname||"";var U="["===n.hostname[0]&&"]"===n.hostname[n.hostname.length-1];if(n.hostname.length>l)n.hostname="";else if(!U)for(var $=n.hostname.split(/\./),z=0,C=$.length;C>z;z++){var _=$[z];if(_&&!_.match(u)){for(var L="",E=0,P=_.length;P>E;E++)L+=_.charCodeAt(E)>127?"x":_[E];if(!L.match(u)){var T=$.slice(0,z),B=$.slice(z+1),D=_.match(v);D&&(T.push(D[1]),B.unshift(D[2])),B.length&&(p="/"+B.join(".")+p),n.hostname=T.join(".");break}}}if(n.hostname=n.hostname.toLowerCase(),!U){for(var F=n.hostname.split("."),G=[],z=0;z<F.length;++z){var H=F[z];G.push(H.match(/[^A-Za-z0-9_-]/)?"xn--"+o.encode(H):H)}n.hostname=G.join(".")}n.host=(n.hostname||"")+(n.port?":"+n.port:""),n.href+=n.host,U&&(n.hostname=n.hostname.substr(1,n.hostname.length-2),"/"!==p[0]&&(p="/"+p))}if(!d[q])for(var z=0,C=c.length;C>z;z++){var J=c[z],K=encodeURIComponent(J);K===J&&(K=escape(J)),p=p.split(J).join(K)}var M=p.indexOf("#");-1!==M&&(n.hash=p.substr(M),p=p.slice(0,M));var N=p.indexOf("?");return-1!==N?(n.search=p.substr(N),n.query=p.substr(N+1),h&&(n.query=b.parse(n.query)),p=p.slice(0,N)):h&&(n.search="",n.query={}),p&&(n.pathname=p),y[i]&&n.hostname&&!n.pathname&&(n.pathname="/"),(n.pathname||n.search)&&(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=e(n),n}function e(e){"string"==typeof e&&(e=t(e));var h=e.auth||"";h&&(h=encodeURIComponent(h),h=h.replace(/%3A/i,":"),h+="@");var a=e.protocol||"",s=e.pathname||"",o=e.hash||"",r=!1,n="";void 0!==e.host?r=h+e.host:void 0!==e.hostname&&(r=h+(-1===e.hostname.indexOf(":")?e.hostname:"["+e.hostname+"]"),e.port&&(r+=":"+e.port)),e.query&&"object"==typeof e.query&&Object.keys(e.query).length&&(n=b.stringify(e.query));var p=e.search||n&&"?"+n||"";return a&&":"!==a.substr(-1)&&(a+=":"),e.slashes||(!a||y[a])&&r!==!1?(r="//"+(r||""),s&&"/"!==s.charAt(0)&&(s="/"+s)):r||(r=""),o&&"#"!==o.charAt(0)&&(o="#"+o),p&&"?"!==p.charAt(0)&&(p="?"+p),a+r+s+p+o}function h(t,h){return e(a(t,h))}function a(h,a){if(!h)return a;if(h=t(e(h),!1,!0),a=t(e(a),!1,!0),h.hash=a.hash,""===a.href)return h.href=e(h),h;if(a.slashes&&!a.protocol)return a.protocol=h.protocol,y[a.protocol]&&a.hostname&&!a.pathname&&(a.path=a.pathname="/"),a.href=e(a),a;if(a.protocol&&a.protocol!==h.protocol){if(!y[a.protocol])return a.href=e(a),a;if(h.protocol=a.protocol,!a.host&&!g[a.protocol]){for(var s=(a.pathname||"").split("/");s.length&&!(a.host=s.shift()););a.host||(a.host=""),a.hostname||(a.hostname=""),""!==s[0]&&s.unshift(""),s.length<2&&s.unshift(""),a.pathname=s.join("/")}return h.pathname=a.pathname,h.search=a.search,h.query=a.query,h.host=a.host||"",h.auth=a.auth,h.hostname=a.hostname||a.host,h.port=a.port,(void 0!==h.pathname||void 0!==h.search)&&(h.path=(h.pathname?h.pathname:"")+(h.search?h.search:"")),h.slashes=h.slashes||a.slashes,h.href=e(h),h}var o=h.pathname&&"/"===h.pathname.charAt(0),r=void 0!==a.host||a.pathname&&"/"===a.pathname.charAt(0),n=r||o||h.host&&a.pathname,p=n,i=h.pathname&&h.pathname.split("/")||[],s=a.pathname&&a.pathname.split("/")||[],c=h.protocol&&!y[h.protocol];if(c&&(delete h.hostname,delete h.port,h.host&&(""===i[0]?i[0]=h.host:i.unshift(h.host)),delete h.host,a.protocol&&(delete a.hostname,delete a.port,a.host&&(""===s[0]?s[0]=a.host:s.unshift(a.host)),delete a.host),n=n&&(""===s[0]||""===i[0])),r)h.host=a.host||""===a.host?a.host:h.host,h.hostname=a.hostname||""===a.hostname?a.hostname:h.hostname,h.search=a.search,h.query=a.query,i=s;else if(s.length)i||(i=[]),i.pop(),i=i.concat(s),h.search=a.search,h.query=a.query;else if("search"in a){if(c){h.hostname=h.host=i.shift();var f=h.host&&h.host.indexOf("@")>0?h.host.split("@"):!1;f&&(h.auth=f.shift(),h.host=h.hostname=f.shift())}return h.search=a.search,h.query=a.query,(void 0!==h.pathname||void 0!==h.search)&&(h.path=(h.pathname?h.pathname:"")+(h.search?h.search:"")),h.href=e(h),h}if(!i.length)return delete h.pathname,h.search?delete h.path:h.path="/"+h.search,h.href=e(h),h;for(var m=i.slice(-1)[0],l=(h.host||a.host)&&("."===m||".."===m)||""===m,u=0,v=i.length;v>=0;v--)m=i[v],"."==m?i.splice(v,1):".."===m?(i.splice(v,1),u++):u&&(i.splice(v,1),u--);if(!n&&!p)for(;u--;u)i.unshift("..");!n||""===i[0]||i[0]&&"/"===i[0].charAt(0)||i.unshift(""),l&&"/"!==i.join("/").substr(-1)&&i.push("");var d=""===i[0]||i[0]&&"/"===i[0].charAt(0);if(c){h.hostname=h.host=d?"":i.length?i.shift():"";var f=h.host&&h.host.indexOf("@")>0?h.host.split("@"):!1;f&&(h.auth=f.shift(),h.host=h.hostname=f.shift())}return n=n||h.host&&i.length,n&&!d&&i.unshift(""),h.pathname=i.join("/"),(void 0!==h.pathname||void 0!==h.search)&&(h.path=(h.pathname?h.pathname:"")+(h.search?h.search:"")),h.auth=a.auth||h.auth,h.slashes=h.slashes||a.slashes,h.href=e(h),h}function s(t){var e={},h=n.exec(t);return h&&(h=h[0],":"!==h&&(e.port=h.substr(1)),t=t.substr(0,t.length-h.length)),t&&(e.hostname=t),e}var o=require("punycode");exports.parse=t,exports.resolve=h,exports.resolveObject=a,exports.format=e;var r=/^([a-z0-9.+-]+:)/i,n=/:[0-9]*$/,p=["<",">",'"',"`"," ","\r","\n"," "],i=["{","}","|","\\","^","~","`"].concat(p),c=["'"].concat(p),f=["%","/","?",";","#"].concat(i).concat(c),m=["/","@","?","#"].concat(p),l=255,u=/^[a-zA-Z0-9][a-z0-9A-Z_-]{0,62}$/,v=/^([a-zA-Z0-9][a-z0-9A-Z_-]{0,62})(.*)$/,d={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=require("querystring")}();
},{"punycode":32,"querystring":35}],45:[function(require,module,exports){
module.exports=require(12)
},{}],46:[function(require,module,exports){
module.exports=require(13)
},{"./support/isBuffer":45,"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"inherits":29}],47:[function(require,module,exports){
(function(e){module.exports=e.LOCAL_CONFIG={serverInfo:{api:{protocol:"http",port:3e3,host:"localhost",root:"/api"},root:"http://localhost:3000/api"},routes:{"/":{controller:"HomeCtrl",templateUrl:"/views/welcome.html"},"/me":{controller:"UserCtrl",templateUrl:"/views/me.html"},"/my/todos":{controller:"TodoCtrl",templateUrl:"/views/todos.html"},"/login":{controller:"LoginCtrl",templateUrl:"/views/login.html"},"/register":{controller:"RegisterCtrl",templateUrl:"/views/register.html"}}}}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30}],48:[function(require,module,exports){
var loopback=require("loopback"),Todo=module.exports=loopback.DataModel.extend("Todo",{title:String,done:{type:Boolean,"default":!1}});
},{"loopback":50}],49:[function(require,module,exports){
var loopback=require("loopback"),User=module.exports=loopback.User.extend("User",{title:String,done:{type:Boolean,"default":!1}});
},{"loopback":50}],50:[function(require,module,exports){
var loopback=module.exports=require("./lib/loopback"),datasourceJuggler=require("loopback-datasource-juggler");loopback.Connector=require("./lib/connectors/base-connector"),loopback.Memory=require("./lib/connectors/memory"),loopback.Mail=require("./lib/connectors/mail"),loopback.Remote=require("./lib/connectors/remote"),loopback.GeoPoint=require("loopback-datasource-juggler/lib/geo").GeoPoint,loopback.ValidationError=datasourceJuggler.ValidationError;
},{"./lib/connectors/base-connector":54,"./lib/connectors/mail":55,"./lib/connectors/memory":56,"./lib/connectors/remote":57,"./lib/loopback":58,"loopback-datasource-juggler":75,"loopback-datasource-juggler/lib/geo":80}],51:[function(require,module,exports){
(function(e,t){function r(e,t){t&&g("object"==typeof t,e+" config must be a valid JSON object")}function o(e,t){"object"==typeof e&&Object.keys(e).forEach(function(r){t(r,e[r])})}function s(e){return y.classify(e)}function i(e){return y.camelize(e)}function n(e){var r;return g("object"==typeof e,"cannont create data source without config object"),"string"==typeof e.connector&&(r=q.join(t,"connectors",e.connector+".js"),v.existsSync(r)&&(e.connector=require(r))),require("./loopback").createDataSource(e)}function a(e,t,r){var o=require("./loopback").createModel(e,t.properties,t.options),s=r.dataSources[t.dataSource];return g(d(s),e+' is referencing a dataSource that does not exist: "'+t.dataSource+'"'),o.attachTo(s),o}function c(e,t){g(e,"cannot require directory contents without directory name");var r={};if(2===arguments.length)t.forEach(function(t){var o=Path.resolve(Path.join(e,t));r[t]=u(o)});else if(1===arguments.length){var o=h(e);o.sort(function(e,t){return e=e.toLowerCase(),t=t.toLowerCase(),t>e?-1:e>t?1:0}),o.forEach(function(t){if("index.js"!==t&&"_"!==t[0]){var o=q.resolve(q.join(e,t)),s=q.extname(t),i=v.statSync(o);if(!i.isFile()||s in require.extensions){var n=q.basename(t,s);r[n]=u(o)}}})}return r}function u(e){try{return require.apply(this,arguments)}catch(t){throw console.error('failed to require "%s"',e),t}}function h(){try{return v.readdirSync.apply(v,arguments)}catch(e){return[]}}function d(e){return e instanceof m}function l(e,t){try{return require(q.join(e,t+".json"))}catch(r){if("MODULE_NOT_FOUND"!==r.code)throw r}}function p(e){e._handlers=void 0}var m=require("loopback-datasource-juggler").DataSource,f=(require("loopback-datasource-juggler").ModelBuilder,require("./compat")),g=require("assert"),v=require("fs"),b=require("underscore"),_=require("strong-remoting"),S=require("strong-remoting/ext/swagger"),y=require("underscore.string"),q=require("path"),k=exports=module.exports={};k.remotes=function(){if(this._remotes)return this._remotes;var e=this.get("remoting")||{};return this._remotes=_.create(e)},k.disuse=function(e){if(this.stack)for(var t=0;t<this.stack.length;t++)this.stack[t].route===e&&this.stack.splice(t,1)},k.model=function(e,t){if(1===arguments.length){g("function"==typeof e,"app.model(Model) => Model must be a function / constructor"),g(e.modelName,'Model must have a "modelName" property');var r=f.getClassNameForRemoting(e);return this.remotes().exports[r]=e,this.models().push(e),p(this),e.shared=!0,e.app=this,void e.emit("attached",this)}var o=e;return t=t||{},g("string"==typeof o,'app.model(name, config) => "name" name must be a string'),e=this.models[o]=this.models[s(o)]=this.models[i(o)]=a(o,t,this),t.public!==!1&&this.model(e),e},k.models=function(){return this._models||(this._models=[])},k.dataSource=function(e,t){this.dataSources[e]=this.dataSources[s(e)]=this.dataSources[i(e)]=n(t)},k.remoteObjects=function(){var e={},t=this.models();return t.forEach(function(t){t.shared&&"function"==typeof t.sharedCtor&&(e[f.getClassNameForRemoting(t)]=t)}),e},k.docs=function(e){var t=this.remotes();S(t,e)},k.handler=function(e){var t=this._handlers||(this._handlers={});if(t[e])return t[e];var r=this.remotes(),o=this._handlers[e]=r.handler(e);return o},k.dataSources=k.datasources={},k.enableAuth=function(){var e=this.remotes();e.before("**",function(e,t,r){var o=e.req,s=r.ctor,i=e.instance,n=i&&i.id||o.param("id");s.checkAccess?(o.pause(),s.checkAccess(o.accessToken,n,r.name,function(e,r){if(o.resume(),e)console.log(e),t(e);else if(r)t();else{var s=new Error("Access Denied");s.statusCode=401,t(s)}})):t()}),this.isAuthEnabled=!0},k.boot=function(t){t=t||{},"string"==typeof t&&(t={appRootDir:t});var s=this,i=t.appRootDir=t.appRootDir||e.cwd(),n=t.app,a=t.models,u=t.dataSources;if(n||(n=l(i,"app")||{}),a||(a=l(i,"models")||{}),u||(u=l(i,"datasources")||{}),r("app",n),r("model",a),r("data source",u),n.host=e.env.npm_config_host||e.env.OPENSHIFT_SLS_IP||e.env.OPENSHIFT_NODEJS_IP||e.env.HOST||n.host||e.env.npm_package_config_host||s.get("host"),n.port=b.find([e.env.npm_config_port,e.env.OPENSHIFT_SLS_PORT,e.env.OPENSHIFT_NODEJS_PORT,e.env.PORT,n.port,e.env.npm_package_config_port,s.get("port"),3e3],b.isFinite),n.restApiRoot=n.restApiRoot||s.get("restApiRoot")||"/api",void 0!==n.host&&(g("string"==typeof n.host,"app.host must be a string"),s.set("host",n.host)),void 0!==n.port){var h=typeof n.port;g("string"===h||"number"===h,"app.port must be a string or number"),s.set("port",n.port)}g(void 0!==n.restApiRoot,"app.restBasePath is required"),g("string"==typeof n.restApiRoot,"app.restBasePath must be a string"),g(/^\//.test(n.restApiRoot),'app.restBasePath must start with "/"'),s.set("restApiRoot",n.restBasePath);for(var d in n){var p=s.get(d);(void 0===p||null===p)&&s.set(d,n[d])}o(u,function(e,t){s.dataSource(e,t)}),o(a,function(e,t){s.model(e,t)});try{require("./loopback").autoAttach()}catch(m){if("AssertionError"!==m.name)throw m;console.warn(m)}var f=s.remotes().exports.swagger,v=n.swagger&&n.swagger.requireToken;f&&(f.requireToken=v||!1);c(q.join(i,"models")),c(q.join(i,"boot"))},k.installMiddleware=function(){var e=require("../");this.use(e.favicon());var r="development"===this.get("env")?"dev":"default";this.use(e.logger(r)),this.use(e.cookieParser(this.get("cookieSecret"))),this.use(e.token({model:this.models.accessToken})),this.use(e.bodyParser()),this.use(e.methodOverride()),this.emit("middleware:preprocessors"),this.use(this.get("restApiRoot")||"/api",e.rest()),this.emit("middleware:handlers"),this.use(this.router),this.use(e.static(q.join(t,"public"))),this.use(e.urlNotFound()),this.emit("middleware:error-handlers"),this.use(e.errorHandler())},k.listen=function(e){var t=this,r=require("http").createServer(this);r.on("listening",function(){t.set("port",this.address().port)});var o=0==arguments.length||1==arguments.length&&"function"==typeof arguments[0];return o?r.listen(this.get("port"),this.get("host"),e):r.listen.apply(r,arguments),r}}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"/../../../../node_modules/loopback/lib");
},{"../":50,"./compat":53,"./loopback":58,"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"assert":11,"fs":10,"http":25,"loopback-datasource-juggler":75,"path":31,"strong-remoting":101,"strong-remoting/ext/swagger":100,"underscore":117,"underscore.string":116}],52:[function(require,module,exports){
function browserExpress(){return{}}module.exports=browserExpress,browserExpress.errorHandler={};
},{}],53:[function(require,module,exports){
var assert=require("assert"),compat=exports;compat.usePluralNamesForRemoting=!1,compat.getClassNameForRemoting=function(e){return assert("function"==typeof e,"compat.getClassNameForRemoting expects a constructor as the argument"),compat.usePluralNamesForRemoting?(assert(e.pluralModelName,'Model must have a "pluralModelName" property in compat mode'),e.pluralModelName):e.modelName};
},{"assert":11}],54:[function(require,module,exports){
function Connector(t){EventEmitter.apply(this,arguments),this.options=t,debug("created with options",t)}module.exports=Connector;var EventEmitter=require("events").EventEmitter,debug=require("debug")("connector"),util=require("util"),inherits=util.inherits,assert=require("assert");inherits(Connector,EventEmitter),Connector._createJDBAdapter=function(t){var e={};t.initialize(e,function(){})},Connector.prototype._addCrudOperationsFromJDBAdapter=function(){};
},{"assert":11,"debug":70,"events":24,"util":46}],55:[function(require,module,exports){
(function(t){function o(t){n("object"==typeof t,"cannot initiaze MailConnector without a settings object");var o=t.transports||[];this.transportsIndex={},this.transports=[],a.isServer&&o.forEach(this.setupTransport.bind(this))}function r(){}var e=require("nodemailer"),n=require("assert"),s=require("debug"),a=require("../loopback");module.exports=o,o.initialize=function(t,r){t.connector=new o(t.settings),r()},o.prototype.DataAccessObject=r,o.prototype.setupTransport=function(t){var o=this;o.transports=o.transports||[],o.transportsIndex=o.transportsIndex||{};var r=e.createTransport(t.type,t);o.transportsIndex[t.type]=r,o.transports.push(r)},o.prototype.transportForName=function(t){return this.transportsIndex[t]},o.prototype.defaultTransport=function(){return this.transports[0]||this.stubTransport},r.send=function(o,r){var e=this.dataSource,a=e&&e.settings,i=e.connector;n(i,"Cannot send mail without a connector!");var p=i.transportForName(o.transport);p||(p=i.defaultTransport()),(s.enabled||a&&a.debug)&&(console.log("Sending Mail:"),o.transport&&console.log(" TRANSPORT:",o.transport),console.log(" TO:",o.to),console.log(" FROM:",o.from),console.log(" SUBJECT:",o.subject),console.log(" TEXT:",o.text),console.log(" HTML:",o.html)),p?(n(p.sendMail,"You must supply an Email.settings.transports containing a valid transport"),p.sendMail(o,r)):(console.warn("Warning: No email transport specified for sending email. Setup a transport to send mail messages."),t.nextTick(function(){r(null,o)}))},r.prototype.send=function(t){this.constructor.send(this,t)},o.mailer=o.prototype.mailer=r.mailer=r.prototype.mailer=e}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"../loopback":58,"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"assert":11,"debug":70,"nodemailer":14}],56:[function(require,module,exports){
function Memory(){}module.exports=Memory;var Connector=require("./base-connector"),debug=require("debug")("memory"),util=require("util"),inherits=util.inherits,assert=require("assert"),JdbMemory=require("loopback-datasource-juggler/lib/connectors/memory");inherits(Memory,Connector),Memory.initialize=JdbMemory.initialize;
},{"./base-connector":54,"assert":11,"debug":70,"loopback-datasource-juggler/lib/connectors/memory":77,"util":46}],57:[function(require,module,exports){
function RemoteConnector(t){assert("object"==typeof t,"cannot initiaze RemoteConnector without a settings object"),this.client=t.client,this.adapter=t.adapter||"rest",this.protocol=t.protocol||"http",this.root=t.root||"",this.host=t.host||"localhost",this.port=t.port||3e3,this.url=t.url?t.url:this.protocol+"://"+this.host+":"+this.port+this.root,this.DataAccessObject=function(){}}function getSharedClass(t,o){return _.find(t.classes(),function(t){return t.name===o})}function noop(){}var assert=require("assert"),compat=require("../compat"),_=require("underscore");module.exports=RemoteConnector,RemoteConnector.prototype.connect=function(){},RemoteConnector.initialize=function(t,o){var e=t.connector=new RemoteConnector(t.settings);e.connect(),o()},RemoteConnector.prototype.define=function(t){var o=t.model,e=compat.getClassNameForRemoting(o),n=this.url,r=this.adapter;o.remotes(function(t,s){var c=getSharedClass(s,e);s.connect(n,r),c.methods().forEach(o.createProxyMethod.bind(o))})};
},{"../compat":53,"assert":11,"underscore":117}],58:[function(require,module,exports){
(function(e){function t(){var e=o();return n(e,c),e.models=function(){return c.models.apply(this,arguments)},e}var o=require("express"),r=require("fs"),a=require("ejs"),u=(require("events").EventEmitter,require("path")),c=require("./application"),i=require("loopback-datasource-juggler").DataSource,n=(require("loopback-datasource-juggler").ModelBuilder,require("inflection"),require("util")._extend),l=require("assert"),s=exports=module.exports=t;s.isBrowser="undefined"!=typeof window,s.isServer=!s.isBrowser,s.version=require("../package.json").version,s.mime=o.mime,s.compat=require("./compat");for(var d in o)Object.defineProperty(s,d,Object.getOwnPropertyDescriptor(o,d));s.isServer&&r.readdirSync(u.join(e,"middleware")).filter(function(e){return e.match(/\.js$/)}).forEach(function(e){s[e.replace(/\.js$/,"")]=require("./middleware/"+e)}),s.errorHandler.title="Loopback",s.createDataSource=function(e,t){var o=new i(e,t,s.Model.modelBuilder);return o.createModel=function(e,t,r){var a=s.createModel(e,t,r);return a.attachTo(o),a},o.settings&&o.settings.defaultForType&&s.setDefaultDataSourceForType(o.settings.defaultForType,o),o},s.createModel=function(e,t,o){o=o||{};var r=o.base||o.super;"string"==typeof r&&(r=s.getModel(r)),r=r||s.Model;var a=r.extend(e,t,o);try{s.autoAttachModel(a)}catch(u){}return a},s.remoteMethod=function(e,t){e.shared=!0,"object"==typeof t&&Object.keys(t).forEach(function(o){e[o]=t[o]}),e.http=e.http||{verb:"get"}},s.template=function(e){var t=this._templates||(this._templates={}),o=t[e]||(t[e]=r.readFileSync(e,"utf8"));return a.compile(o)},s.memory=function(e){e=e||"default";var t=(this._memoryDataSources||(this._memoryDataSources={}))[e];return t||(t=this._memoryDataSources[e]=s.createDataSource({connector:s.Memory})),t},s.getModel=function(e){return s.Model.modelBuilder.models[e]},s.getModelByType=function(e){l("function"==typeof e,"The model type must be a constructor");var t=s.Model.modelBuilder.models;for(var o in t)if(t[o].prototype instanceof e)return t[o];return e},s.setDefaultDataSourceForType=function(e,t){var o=this.defaultDataSources||(this.defaultDataSources={});return t instanceof i||(t=this.createDataSource(t)),o[e]=t,t},s.getDefaultDataSourceForType=function(e){return this.defaultDataSources&&this.defaultDataSources[e]},s.autoAttach=function(){var e=this.Model.modelBuilder.models;l.equal(typeof e,"object","Cannot autoAttach without a models object"),Object.keys(e).forEach(function(t){var o=e[t];!o||o.dataSource instanceof i||s.autoAttachModel(o)})},s.autoAttachModel=function(e){if(e.autoAttach){var t=s.getDefaultDataSourceForType(e.autoAttach);l(t instanceof i,'cannot autoAttach model "'+e.modelName+'". No dataSource found of type '+e.autoAttach),e.attachTo(t)}},s.Model=require("./models/model"),s.DataModel=require("./models/data-model"),s.Email=require("./models/email"),s.User=require("./models/user"),s.Application=require("./models/application"),s.AccessToken=require("./models/access-token"),s.Role=require("./models/role").Role,s.RoleMapping=require("./models/role").RoleMapping,s.ACL=require("./models/acl").ACL,s.Scope=require("./models/acl").Scope;var m={DB:"db",MAIL:"mail"};s.Email.autoAttach=m.MAIL,s.DataModel.autoAttach=m.DB,s.User.autoAttach=m.DB,s.AccessToken.autoAttach=m.DB,s.Role.autoAttach=m.DB,s.RoleMapping.autoAttach=m.DB,s.ACL.autoAttach=m.DB,s.Scope.autoAttach=m.DB,s.Application.autoAttach=m.DB}).call(this,"/../../../../node_modules/loopback/lib");
},{"../package.json":118,"./application":51,"./compat":53,"./models/access-token":60,"./models/acl":61,"./models/application":62,"./models/data-model":63,"./models/email":64,"./models/model":65,"./models/role":66,"./models/user":67,"assert":11,"ejs":71,"events":24,"express":52,"fs":10,"inflection":74,"loopback-datasource-juggler":75,"path":31,"util":46}],59:[function(require,module,exports){
function AccessContext(e){if(!(this instanceof AccessContext))return new AccessContext(e);e=e||{},this.principals=e.principals||[];var s=e.model;s="string"==typeof s?loopback.getModel(s):s,this.model=s,this.modelName=s&&s.modelName,this.modelId=e.id||e.modelId,this.property=e.property||AccessContext.ALL,this.method=e.method,this.accessType=e.accessType||AccessContext.ALL,this.accessToken=e.accessToken||AccessToken.ANONYMOUS;var t=e.principalType||Principal.USER,i=e.principalId||void 0,c=e.principalName||void 0;i&&this.addPrincipal(t,i,c);var n=this.accessToken||{};n.userId&&this.addPrincipal(Principal.USER,n.userId),n.appId&&this.addPrincipal(Principal.APPLICATION,n.appId)}function Principal(e,s,t){return this instanceof Principal?(this.type=e,this.id=s,void(this.name=t)):new Principal(e,s,t)}function AccessRequest(e,s,t,i){if(!(this instanceof AccessRequest))return new AccessRequest(e,s,t);if(1===arguments.length&&"object"==typeof e){var c=e||{};this.model=c.model||AccessContext.ALL,this.property=c.property||AccessContext.ALL,this.accessType=c.accessType||AccessContext.ALL,this.permission=c.permission||AccessContext.DEFAULT}else this.model=e||AccessContext.ALL,this.property=s||AccessContext.ALL,this.accessType=t||AccessContext.ALL,this.permission=i||AccessContext.DEFAULT;debug.enabled&&(debug("---AccessRequest---"),debug(" model %s",this.model),debug(" property %s",this.property),debug(" accessType %s",this.accessType),debug(" permission %s",this.permission),debug(" isWildcard() %s",this.isWildcard()))}var loopback=require("../loopback"),AccessToken=require("./access-token"),debug=require("debug")("loopback:security:access-context");AccessContext.ALL="*",AccessContext.READ="READ",AccessContext.WRITE="WRITE",AccessContext.EXECUTE="EXECUTE",AccessContext.DEFAULT="DEFAULT",AccessContext.ALLOW="ALLOW",AccessContext.ALARM="ALARM",AccessContext.AUDIT="AUDIT",AccessContext.DENY="DENY",AccessContext.permissionOrder={DEFAULT:0,ALLOW:1,ALARM:2,AUDIT:3,DENY:4},AccessContext.prototype.addPrincipal=function(e,s,t){for(var i=new Principal(e,s,t),c=0;c<this.principals.length;c++){var n=this.principals[c];if(n.equals(i))return!1}return this.principals.push(i),debug("adding principal %j",i),!0},AccessContext.prototype.getUserId=function(){for(var e=0;e<this.principals.length;e++){var s=this.principals[e];if(s.type===Principal.USER)return s.id}return null},AccessContext.prototype.getAppId=function(){for(var e=0;e<this.principals.length;e++){var s=this.principals[e];if(s.type===Principal.APPLICATION)return s.id}return null},AccessContext.prototype.isAuthenticated=function(){return!(!this.getUserId()&&!this.getAppId())},AccessContext.prototype.debug=function(){debug.enabled&&(debug("---AccessContext---"),this.principals&&this.principals.length?(debug("principals:"),this.principals.forEach(function(e){debug("principal: %j",e)})):debug("principals: %j",this.principals),debug("modelName %s",this.modelName),debug("modelId %s",this.modelId),debug("property %s",this.property),debug("method %s",this.method),debug("accessType %s",this.accessType),this.accessToken&&(debug("accessToken:"),debug(" id %j",this.accessToken.id),debug(" ttl %j",this.accessToken.ttl)),debug("getUserId() %s",this.getUserId()),debug("isAuthenticated() %s",this.isAuthenticated()))},Principal.USER="USER",Principal.APP=Principal.APPLICATION="APP",Principal.ROLE="ROLE",Principal.SCOPE="SCOPE",Principal.prototype.equals=function(e){return e instanceof Principal?this.type===e.type&&String(this.id)===String(e.id):!1},AccessRequest.prototype.isWildcard=function(){return this.model===AccessContext.ALL||this.property===AccessContext.ALL||this.accessType===AccessContext.ALL},module.exports.AccessContext=AccessContext,module.exports.Principal=Principal,module.exports.AccessRequest=AccessRequest;
},{"../loopback":58,"./access-token":60,"debug":70}],60:[function(require,module,exports){
(function(e){function t(e,t){var n,o,r=t.params||[],i=t.headers||[],s=t.cookies||[],c=0;for(r.push("access_token"),i.push("X-Access-Token"),i.push("authorization"),s.push("access_token"),s.push("authorization"),n=r.length;n>c;c++)if(o=e.param(r[c]),"string"==typeof o)return o;for(c=0,n=i.length;n>c;c++)if(o=e.header(i[c]),"string"==typeof o)return o;if(e.signedCookies)for(c=0,n=i.length;n>c;c++)if(o=e.signedCookies[s[c]],"string"==typeof o)return o;return null}var n=require("../loopback").Model,o=(require("../loopback"),require("assert")),r=(require("crypto"),require("uid2")),i=1209600,s=64,c=require("./role").Role,a=require("./acl").ACL,u={id:{type:String,id:!0},ttl:{type:Number,ttl:!0,"default":i},created:{type:Date,"default":function(){return new Date}}},l=module.exports=n.extend("AccessToken",u,{acls:[{principalType:a.ROLE,principalId:c.EVERYONE,permission:"DENY"},{principalType:a.ROLE,principalId:c.EVERYONE,property:"create",permission:"ALLOW"}],relations:{user:{type:"belongsTo",model:"User",foreignKey:"userId"}}});l.ANONYMOUS=new l({id:"$anonymous"}),l.createAccessTokenId=function(e){r(this.settings.accessTokenIdLength||s,function(t,n){t?e(t):e(null,n)})},l.beforeCreate=function(e,t){t=t||{},l.createAccessTokenId(function(n,o){n?e(n):(t.id=o,e())})},l.findForRequest=function(n,o,r){var i=t(n,o);i?this.findById(i,function(e,t){e?r(e):t?t.validate(function(e,n){e?r(e):n?r(null,t):r(new Error("Invalid Access Token"))}):r()}):e.nextTick(function(){r()})},l.prototype.validate=function(e){try{o(this.created&&"function"==typeof this.created.getTime,"token.created must be a valid Date"),o(0!==this.ttl,"token.ttl must be not be 0"),o(this.ttl,"token.ttl must exist"),o(this.ttl>=-1,"token.ttl must be >= -1");var t=Date.now(),n=this.created.getTime(),r=(t-n)/1e3,i=this.ttl,s=i>r;s?e(null,s):this.destroy(function(t){e(t,s)})}catch(c){e(c)}}}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"../loopback":58,"./acl":61,"./role":66,"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"assert":11,"crypto":19,"uid2":115}],61:[function(require,module,exports){
(function(e){var i=require("../loopback"),r=require("async"),s=require("assert"),n=require("debug")("loopback:security:acl"),o=require("./access-context"),c=o.AccessContext,p=o.Principal,t=o.AccessRequest,a=require("./role"),l=a.Role,d={model:String,property:String,accessType:String,permission:String,principalType:String,principalId:String},u=i.createModel("ACL",d);u.ALL=c.ALL,u.DEFAULT=c.DEFAULT,u.ALLOW=c.ALLOW,u.ALARM=c.ALARM,u.AUDIT=c.AUDIT,u.DENY=c.DENY,u.READ=c.READ,u.WRITE=c.WRITE,u.EXECUTE=c.EXECUTE,u.USER=p.USER,u.APP=u.APPLICATION=p.APPLICATION,u.ROLE=p.ROLE,u.SCOPE=p.SCOPE,u.getMatchingScore=function(e,i){for(var r=["model","property","accessType"],s=0,n=0;n<r.length;n++){s=4*s;var o=e[r[n]]||u.ALL,p=i[r[n]]||u.ALL;if(o===p)s+=3;else if(o===u.ALL)s+=2;else{if(p!==u.ALL)return-1;s+=1}}switch(s=4*s,e.principalType){case u.USER:s+=4;break;case u.APP:s+=3;break;case u.ROLE:s+=2;break;default:s+=1}if(s=8*s,e.principalType===u.ROLE)switch(e.principalId){case l.OWNER:s+=4;break;case l.RELATED:s+=3;break;case l.AUTHENTICATED:case l.UNAUTHENTICATED:s+=2;break;case l.EVERYONE:s+=1;break;default:s+=5}return s=4*s,s+=c.permissionOrder[e.permission||u.ALLOW]-1},u.resolvePermission=function(e,i){i instanceof t||(i=new t(i)),e=e.sort(function(e,r){return u.getMatchingScore(r,i)-u.getMatchingScore(e,i)}),n.enabled&&n("ACLs by order: %j",e);for(var r=u.DEFAULT,s=0,o=0;o<e.length&&(s=u.getMatchingScore(e[o],i),!(0>s));o++){if(!i.isWildcard()){r=e[o].permission;break}if(e[o].model===i.model&&e[o].property===i.property&&e[o].accessType===i.accessType){r=e[o].permission;break}c.permissionOrder[e[o].permission]>c.permissionOrder[r]&&(r=e[o].permission)}var p=new t(i.model,i.property,i.accessType,r||u.DEFAULT);return p},u.getStaticACLs=function(e,r){var s=i.getModel(e),n=[];s&&s.settings.acls&&s.settings.acls.forEach(function(i){n.push(new u({model:e,property:i.property||u.ALL,principalType:i.principalType,principalId:i.principalId,accessType:i.accessType,permission:i.permission})),n[n.length-1].debug("Adding ACL")});var o=s&&(s.definition.properties[r]||s._scopeMeta&&s._scopeMeta[r]||s[r]||s.prototype[r]);return o&&o.acls&&o.acls.forEach(function(e){n.push(new u({model:s.modelName,property:r,principalType:e.principalType,principalId:e.principalId,accessType:e.accessType,permission:e.permission}))}),n},u.checkPermission=function(r,s,o,c,p,a){c=c||u.ALL;var l=c===u.ALL?void 0:{inq:[c,u.ALL]};p=p||u.ALL;var d=p===u.ALL?void 0:{inq:[p,u.ALL]},L=new t(o,c,p),m=this.getStaticACLs(o,c),A=this.resolvePermission(m,L);if(A&&A.permission===u.DENY)return n("Permission denied by statically resolved permission"),n(" Resolved Permission: %j",A),void e.nextTick(function(){a&&a(null,A)});var y=this;this.find({where:{principalType:r,principalId:s,model:o,property:l,accessType:d}},function(e,r){if(e)return void(a&&a(e));if(m=m.concat(r),A=y.resolvePermission(m,L),A&&A.permission===u.DEFAULT){var s=i.getModel(o);A.permission=s&&s.settings.defaultPermission||u.ALLOW}a&&a(null,A)})},u.prototype.debug=function(){n.enabled&&(n("---ACL---"),n("model %s",this.model),n("property %s",this.property),n("principalType %s",this.principalType),n("principalId %s",this.principalId),n("accessType %s",this.accessType),n("permission %s",this.permission))},u.checkAccess=function(e,s){e instanceof c||(e=new c(e));var o=e.model,p=e.property,a=e.accessType,d=p===u.ALL?void 0:{inq:[p,u.ALL]},L=a===u.ALL?void 0:{inq:[a,u.ALL]},m=new t(o.modelName,p,a),A=[],y=this.getStaticACLs(o.modelName,p),T=this,f=i.getModelByType(l);this.find({where:{model:o.modelName,property:d,accessType:L}},function(i,c){if(i)return void(s&&s(i));var p=[];c=c.concat(y),c.forEach(function(i){for(var r=0;r<e.principals.length;r++){var s=e.principals[r];if(s.type===i.principalType&&String(s.id)===String(i.principalId))return void A.push(i)}i.principalType===u.ROLE&&p.push(function(r){f.isInRole(i.principalId,e,function(e,s){n.enabled&&n("In role %j: %j",i.principalId,s),!e&&s&&A.push(i),r(e,i)})})}),r.parallel(p,function(e){if(e)return void(s&&s(e,null));var i=T.resolvePermission(A,m);i&&i.permission===u.DEFAULT&&(i.permission=o&&o.settings.defaultPermission||u.ALLOW),n("checkAccess() returns: %j",i),s&&s(null,i)})})},u.checkAccessForToken=function(e,i,r,n,o){s(e,"Access token is required");var p=new c({accessToken:e,model:i,property:n,method:n,modelId:r});p.accessType=p.model._getAccessTypeForMethod(n),p.debug(),this.checkAccess(p,function(e,i){return e?void(o&&o(e)):void(o&&o(null,i.permission!==u.DENY))})};var L={name:{type:String,required:!0},description:String},m=i.createModel("Scope",L);m.checkPermission=function(e,r,s,n,o){this.findOne({where:{name:e}},function(e,c){if(e)o&&o(e);else{var p=i.getModelByType(u);p.checkPermission(u.SCOPE,c.id,r,s,n,o)}})},module.exports.ACL=u,module.exports.Scope=m}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"../loopback":58,"./access-context":59,"./role":66,"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"assert":11,"async":68,"debug":70}],62:[function(require,module,exports){
function generateKey(e,t,i){e=e||"loopback",t=t||"sha1",i=i||"hex";var a=crypto.createHmac(t,e),n=crypto.randomBytes(32);a.update(n);var r=a.digest(i);return r}var loopback=require("../loopback"),assert=require("assert"),AuthenticationSchemeSchema={scheme:String,credential:Object},APNSSettingSchema={production:Boolean,certData:String,keyData:String,pushOptions:{type:{gateway:String,port:Number}},feedbackOptions:{type:{gateway:String,port:Number,batchFeedback:Boolean,interval:Number}}},GcmSettingsSchema={serverApiKey:String},PushNotificationSettingSchema={apns:APNSSettingSchema,gcm:GcmSettingsSchema},ApplicationSchema={id:{type:String,id:!0},name:{type:String,required:!0},description:String,icon:String,owner:String,collaborators:[String],email:String,emailVerified:Boolean,url:String,callbackUrls:[String],permissions:[String],clientKey:String,javaScriptKey:String,restApiKey:String,windowsKey:String,masterKey:String,pushSettings:PushNotificationSettingSchema,authenticationEnabled:{type:Boolean,"default":!0},anonymousAllowed:{type:Boolean,"default":!0},authenticationSchemes:[AuthenticationSchemeSchema],status:{type:String,"default":"sandbox"},created:{type:Date,"default":Date},modified:{type:Date,"default":Date}},crypto=require("crypto"),Application=loopback.createModel("Application",ApplicationSchema);Application.beforeCreate=function(e){var t=this;t.created=t.modified=new Date,t.id=generateKey("id","md5"),t.clientKey=generateKey("client"),t.javaScriptKey=generateKey("javaScript"),t.restApiKey=generateKey("restApi"),t.windowsKey=generateKey("windows"),t.masterKey=generateKey("master"),e()},Application.register=function(e,t,i,a){assert(e,"owner is required"),assert(t,"name is required"),"function"!=typeof i||a||(a=i,i={});var n={owner:e,name:t};for(var r in i)r in n||(n[r]=i[r]);this.create(n,a)},Application.prototype.resetKeys=function(e){this.clientKey=generateKey("client"),this.javaScriptKey=generateKey("javaScript"),this.restApiKey=generateKey("restApi"),this.windowsKey=generateKey("windows"),this.masterKey=generateKey("master"),this.modified=new Date,this.save(e)},Application.resetKeys=function(e,t){this.findById(e,function(e,i){return e?void(t&&t(e,i)):void i.resetKeys(t)})},Application.authenticate=function(e,t,i){this.findById(e,function(e,a){if(e||!a)return void(i&&i(e,null));for(var n=null,r=["clientKey","javaScriptKey","restApiKey","windowsKey","masterKey"],o=0;o<r.length;o++)if(a[r[o]]===t){n={application:a,keyType:r[o]};break}i&&i(null,n)})},module.exports=Application;
},{"../loopback":58,"assert":11,"crypto":19}],63:[function(require,module,exports){
function setRemoting(t,e){e=e||{};for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o]);t.shared=!0,t._delegate=!0}function throwNotAttached(t,e){throw new Error("Cannot call "+t+"."+e+"(). The "+e+" method has not been setup. The DataModel has not been correctly attached to a DataSource!")}function convertNullToNotFoundError(t,e){if(null!==t.result)return e();var o=t.method.sharedClass.name,a=t.getArgByName("id"),r='Unkown "'+o+'" id "'+a+'".',d=new Error(r);d.statusCode=d.status=404,e(d)}var Model=require("./model"),DataModel=module.exports=Model.extend("DataModel");DataModel.create=function(){throwNotAttached(this.modelName,"create")},setRemoting(DataModel.create,{description:"Create a new instance of the model and persist it into the data source",accepts:{arg:"data",type:"object",description:"Model instance data",http:{source:"body"}},returns:{arg:"data",type:"object",root:!0},http:{verb:"post",path:"/"}}),DataModel.upsert=DataModel.updateOrCreate=function(){throwNotAttached(this.modelName,"updateOrCreate")},setRemoting(DataModel.upsert,{description:"Update an existing model instance or insert a new one into the data source",accepts:{arg:"data",type:"object",description:"Model instance data",http:{source:"body"}},returns:{arg:"data",type:"object",root:!0},http:{verb:"put",path:"/"}}),DataModel.findOrCreate=function(){throwNotAttached(this.modelName,"findOrCreate")},DataModel.exists=function(){throwNotAttached(this.modelName,"exists")},setRemoting(DataModel.exists,{description:"Check whether a model instance exists in the data source",accepts:{arg:"id",type:"any",description:"Model id",required:!0},returns:{arg:"exists",type:"any"},http:{verb:"get",path:"/:id/exists"}}),DataModel.findById=function(){throwNotAttached(this.modelName,"find")},setRemoting(DataModel.findById,{description:"Find a model instance by id from the data source",accepts:{arg:"id",type:"any",description:"Model id",required:!0},returns:{arg:"data",type:"any",root:!0},http:{verb:"get",path:"/:id"},rest:{after:convertNullToNotFoundError}}),DataModel.find=function(){throwNotAttached(this.modelName,"find")},setRemoting(DataModel.find,{description:"Find all instances of the model matched by filter from the data source",accepts:{arg:"filter",type:"object",description:"Filter defining fields, where, orderBy, offset, and limit"},returns:{arg:"data",type:"array",root:!0},http:{verb:"get",path:"/"}}),DataModel.findOne=function(){throwNotAttached(this.modelName,"findOne")},setRemoting(DataModel.findOne,{description:"Find first instance of the model matched by filter from the data source",accepts:{arg:"filter",type:"object",description:"Filter defining fields, where, orderBy, offset, and limit"},returns:{arg:"data",type:"object",root:!0},http:{verb:"get",path:"/findOne"}}),DataModel.remove=DataModel.deleteAll=DataModel.destroyAll=function(){throwNotAttached(this.modelName,"destroyAll")},DataModel.removeById=DataModel.deleteById=DataModel.destroyById=function(){throwNotAttached(this.modelName,"deleteById")},setRemoting(DataModel.deleteById,{description:"Delete a model instance by id from the data source",accepts:{arg:"id",type:"any",description:"Model id",required:!0},http:{verb:"del",path:"/:id"}}),DataModel.count=function(){throwNotAttached(this.modelName,"count")},setRemoting(DataModel.count,{description:"Count instances of the model matched by where from the data source",accepts:{arg:"where",type:"object",description:"Criteria to match model instances"},returns:{arg:"count",type:"number"},http:{verb:"get",path:"/count"}}),DataModel.prototype.save=function(){throwNotAttached(this.constructor.modelName,"save")},DataModel.prototype.isNewRecord=function(){throwNotAttached(this.constructor.modelName,"isNewRecord")},DataModel.prototype.remove=DataModel.prototype.delete=DataModel.prototype.destroy=function(){throwNotAttached(this.constructor.modelName,"destroy")},DataModel.prototype.updateAttribute=function(){throwNotAttached(this.constructor.modelName,"updateAttribute")},DataModel.prototype.updateAttributes=function(){throwNotAttached(this.modelName,"updateAttributes")},setRemoting(DataModel.prototype.updateAttributes,{description:"Update attributes for a model instance and persist it into the data source",accepts:{arg:"data",type:"object",http:{source:"body"},description:"An object of model property name/value pairs"},returns:{arg:"data",type:"object",root:!0},http:{verb:"put",path:"/"}}),DataModel.prototype.reload=function(){throwNotAttached(this.constructor.modelName,"reload")};
},{"./model":65}],64:[function(require,module,exports){
var Model=require("../loopback").Model,loopback=require("../loopback"),properties={to:{type:String,required:!0},from:{type:String,required:!0},subject:{type:String,required:!0},text:{type:String},html:{type:String}},Email=module.exports=Model.extend("Email",properties);Email.prototype.send=function(){throw new Error("You must connect the Email Model to a Mail connector")};
},{"../loopback":58}],65:[function(require,module,exports){
var loopback=require("../loopback"),compat=require("../compat"),ModelBuilder=require("loopback-datasource-juggler").ModelBuilder,modeler=new ModelBuilder,assert=require("assert"),Model=module.exports=modeler.define("Model");Model.shared=!0,Model.setup=function(){var e=this;return e.sharedCtor=function(t,r,o){if("function"==typeof t?(o=t,t=null,r=null):"function"==typeof r&&(o=r,"object"!=typeof t?(r=t,t=null):r=null),r&&t){var a=new e(t);a.id=r,o(null,a)}else t?o(null,new e(t)):r?e.findById(r,function(e,t){e?o(e):t?o(null,t):(e=new Error("could not find a model with id "+r),e.statusCode=404,o(e))}):o(new Error("must specify an id or data"))},e.beforeRemote=function(e,t){var r=this;if(this.app){var o=this.app.remotes(),a=compat.getClassNameForRemoting(r);o.before(a+"."+e,function(e,r){t(e,e.result,r)})}else{var n=arguments;this.once("attached",function(){r.beforeRemote.apply(r,n)})}},e.afterRemote=function(e,t){var r=this;if(this.app){var o=this.app.remotes(),a=compat.getClassNameForRemoting(r);o.after(a+"."+e,function(e,r){t(e,e.result,r)})}else{var n=arguments;this.once("attached",function(){r.afterRemote.apply(r,n)})}},e.sharedCtor.accepts=[{arg:"id",type:"any",http:{source:"path"}}],e.sharedCtor.http=[{path:"/:id"}],e.sharedCtor.returns={root:!0},e};var _aclModel=null;Model._ACL=function(e){if(void 0!==e&&(_aclModel=e),_aclModel)return _aclModel;var t=require("./acl").ACL;return _aclModel=loopback.getModelByType(t)},Model.checkAccess=function(e,t,r,o){var a=require("./access-token").ANONYMOUS;e=e||a;var n=Model._ACL(),s="string"==typeof r?r:r&&r.name;n.checkAccessForToken(e,this.modelName,t,s,o)},Model._getAccessTypeForMethod=function(e){"string"==typeof e&&(e={name:e}),assert("object"==typeof e,"method is a required argument and must be a RemoteMethod object");var t=Model._ACL();switch(e.name){case"create":return t.WRITE;case"updateOrCreate":return t.WRITE;case"upsert":return t.WRITE;case"exists":return t.READ;case"findById":return t.READ;case"find":return t.READ;case"findOne":return t.READ;case"destroyById":return t.WRITE;case"deleteById":return t.WRITE;case"removeById":return t.WRITE;case"count":return t.READ;default:return t.EXECUTE}},Model.getApp=function(e){var t=this;this.app?e(null,this.app):t.once("attached",function(){assert(t.app),e(null,t.app)})},Model.remotes=function(e){this.getApp(function(t,r){e(null,r.remotes())})},Model.createProxyMethod=function(e){var t=this,r=e.isStatic?t:t.prototype,o=r[e.name],a=r[e.name]=function(){var r,o=Array.prototype.slice.call(arguments),a="function"==typeof o[o.length-1];a&&(r=o.pop()),t.remotes(function(t,a){a.invoke(e.stringName,o,r)})};for(var n in o)a[n]=o[n];a._delegate=!0},Model.setup();
},{"../compat":53,"../loopback":58,"./access-token":60,"./acl":61,"assert":11,"loopback-datasource-juggler":75}],66:[function(require,module,exports){
(function(e){function n(e){return e===o.User||e.prototype instanceof o.User}function i(e,n){return void 0===e||null===e||""===e||void 0===n||null===n||""===n?!1:e===n||e.toString()===n.toString()}var o=require("../loopback"),t=require("debug")("loopback:security:role"),r=require("assert"),l=require("async"),u=require("./access-context").AccessContext,c={id:{type:String,id:!0},name:{type:String,required:!0},description:String,created:{type:Date,"default":Date},modified:{type:Date,"default":Date}},s={id:{type:String,id:!0},roleId:String,principalType:String,principalId:String},d=o.createModel("RoleMapping",s,{relations:{role:{type:"belongsTo",model:"Role",foreignKey:"roleId"}}});d.USER="USER",d.APP=d.APPLICATION="APP",d.ROLE="ROLE",d.prototype.application=function(n){if(this.principalType===d.APPLICATION){var i=this.constructor.Application||o.getModelByType(o.Application);i.findById(this.principalId,n)}else e.nextTick(function(){n&&n(null,null)})},d.prototype.user=function(n){if(this.principalType===d.USER){var i=this.constructor.User||o.getModelByType(o.User);i.findById(this.principalId,n)}else e.nextTick(function(){n&&n(null,null)})},d.prototype.childRole=function(n){if(this.principalType===d.ROLE){var i=this.constructor.Role||o.getModelByType(p);i.findById(this.principalId,n)}else e.nextTick(function(){n&&n(null,null)})};var p=o.createModel("Role",c,{relations:{principals:{type:"hasMany",model:"RoleMapping",foreignKey:"roleId"}}});p.once("dataSourceAttached",function(){var e=this.RoleMapping||o.getModelByType(d);p.prototype.users=function(n){e.find({where:{roleId:this.id,principalType:d.USER}},function(e,i){return e?void(n&&n(e)):i.map(function(e){return e.principalId})})},p.prototype.applications=function(n){e.find({where:{roleId:this.id,principalType:d.APPLICATION}},function(e,i){return e?void(n&&n(e)):i.map(function(e){return e.principalId})})},p.prototype.roles=function(n){e.find({where:{roleId:this.id,principalType:d.ROLE}},function(e,i){return e?void(n&&n(e)):i.map(function(e){return e.principalId})})}}),p.OWNER="$owner",p.RELATED="$related",p.AUTHENTICATED="$authenticated",p.UNAUTHENTICATED="$unauthenticated",p.EVERYONE="$everyone",p.registerResolver=function(e,n){p.resolvers||(p.resolvers={}),p.resolvers[e]=n},p.registerResolver(p.OWNER,function(n,i,o){if(!i||!i.model||!i.modelId)return void e.nextTick(function(){o&&o(null,!1)});var t=i.model,r=i.modelId,l=i.getUserId();p.isOwner(t,r,l,o)}),p.isOwner=function(o,l,u,c){return r(o,"Model class is required"),t("isOwner(): %s %s userId: %s",o&&o.modelName,l,u),u?n(o)?void e.nextTick(function(){c(null,i(l,u))}):void o.findById(l,function(e,r){if(e||!r)return t("Model not found for id %j",l),void(c&&c(e,!1));t("Model found: %j",r);var s=r.userId||r.owner;if(s)return void(c&&c(null,i(s,u)));for(var d in o.relations){var p=o.relations[d];if("belongsTo"===p.type&&n(p.modelTo))return t("Checking relation %s to %s: %j",d,p.modelTo.modelName,p),void r[d](function(e,n){!e&&n?(t("User found: %j",n.id),c&&c(null,i(n.id,u))):c&&c(e,!1)})}t("No matching belongsTo relation found for model %j and user: %j",l,u),c&&c(null,!1)}):void e.nextTick(function(){c(null,!1)})},p.registerResolver(p.AUTHENTICATED,function(n,i,o){return i?void p.isAuthenticated(i,o):void e.nextTick(function(){o&&o(null,!1)})}),p.isAuthenticated=function(n,i){e.nextTick(function(){i&&i(null,n.isAuthenticated())})},p.registerResolver(p.UNAUTHENTICATED,function(n,i,o){e.nextTick(function(){o&&o(null,!i||!i.isAuthenticated())})}),p.registerResolver(p.EVERYONE,function(n,i,o){e.nextTick(function(){o&&o(null,!0)})}),p.isInRole=function(n,i,r){t("isInRole(): %s %j",n,i),i instanceof u||(i=new u(i));var c=p.resolvers[n];if(c)return t("Custom resolver found for role %s",n),void c(n,i,r);if(0===i.principals.length)return t("isInRole() returns: false"),void e.nextTick(function(){r&&r(null,!1)});var s=i.principals.some(function(e){var i=e.type||void 0,o=e.id||void 0;return i===d.ROLE&&o===n});if(s)return t("isInRole() returns: %j",s),void e.nextTick(function(){r&&r(null,!0)});var a=this.RoleMapping||o.getModelByType(d);this.findOne({where:{name:n}},function(n,o){return n?void(r&&r(n)):o?(t("Role found: %j",o),void l.some(i.principals,function(n,i){var r=n.type||void 0,l=n.id||void 0;r&&l?a.findOne({where:{roleId:o.id,principalType:r,principalId:l}},function(e,n){t("Role mapping found: %j",n),i(!e&&n)}):e.nextTick(function(){i(!1)})},function(e){t("isInRole() returns: %j",e),r&&r(null,e)})):void(r&&r(null,!1))})},p.getRoles=function(e,n){t("getRoles(): %j",e),e instanceof u||(e=new u(e));var i=[],r=function(e){e&&-1===i.indexOf(e)&&i.push(e)},c=this,s=[];Object.keys(p.resolvers).forEach(function(n){s.push(function(i){c.isInRole(n,e,function(e,o){t.enabled&&t("In role %j: %j",n,o),!e&&o?(r(n),i()):i(e,null)})})});var a=this.RoleMapping||o.getModelByType(d);e.principals.forEach(function(e){var n=e.type||void 0,i=e.id||void 0;n===d.ROLE&&i&&r(i),n&&i&&s.push(function(e){a.find({where:{principalType:n,principalId:i}},function(n,i){return t("Role mappings found: %s %j",n,i),n?void(e&&e(n)):(i.forEach(function(e){r(e.roleId)}),void(e&&e()))})})}),l.parallel(s,function(e){t("getRoles() returns: %j %j",e,i),n&&n(e,i)})},module.exports={Role:p,RoleMapping:d}}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"../loopback":58,"./access-context":59,"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"assert":11,"async":68,"debug":70}],67:[function(require,module,exports){
(function(e){var r=require("../loopback").Model,t=require("../loopback"),i=require("path"),o=10,s=require("crypto"),n=require("bcryptjs"),a=(require("passport"),require("passport-local").Strategy,require("./access-token"),1209600),p=900,c=31556926,l=require("./role").Role,u=require("./acl").ACL,d=require("assert"),m=require("debug")("loopback:user"),f={realm:{type:String},username:{type:String},password:{type:String,required:!0},email:{type:String,required:!0},emailVerified:Boolean,verificationToken:String,credentials:["UserCredential"],challenges:["Challenge"],status:String,created:Date,lastUpdated:Date},h={acls:[{principalType:u.ROLE,principalId:l.EVERYONE,permission:u.DENY},{principalType:u.ROLE,principalId:l.EVERYONE,permission:u.ALLOW,property:"create"},{principalType:u.ROLE,principalId:l.OWNER,permission:u.ALLOW,property:"removeById"},{principalType:u.ROLE,principalId:l.EVERYONE,permission:u.ALLOW,property:"login"},{principalType:u.ROLE,principalId:l.EVERYONE,permission:u.ALLOW,property:"logout"},{principalType:u.ROLE,principalId:l.OWNER,permission:u.ALLOW,property:"findById"},{principalType:u.ROLE,principalId:l.OWNER,permission:u.ALLOW,property:"updateAttributes"}],relations:{accessTokens:{type:"hasMany",model:"AccessToken",foreignKey:"userId"}}},y=module.exports=r.extend("User",f,h);y.login=function(e,r,t){"function"==typeof r&&(t=r,r=void 0),r=(r||"").toLowerCase();var i={};if(e.email)i.email=e.email;else{if(!e.username){var o=new Error("username or email is required");return o.statusCode=400,t(o)}i.username=e.username}this.findOne({where:i},function(o,s){var n=new Error("login failed");n.statusCode=401,o?(m("An error is reported from User.findOne: %j",o),t(n)):s?s.hasPassword(e.password,function(o,a){o?(m("An error is reported from User.hasPassword: %j",o),t(n)):a?s.accessTokens.create({ttl:Math.min(e.ttl||y.settings.ttl,y.settings.maxTTL)},function(e,i){return e?t(e):("user"===r&&(i.__data.user=s),void t(e,i))}):(m("The password is invalid for user %s",i.email||i.username),t(n))}):(m("No matching record is found for user %s",i.email||i.username),t(n))})},y.logout=function(e,r){this.relations.accessTokens.modelTo.findById(e,function(e,t){e?r(e):t?t.destroy(r):r(new Error("could not find accessToken"))})},y.prototype.hasPassword=function(e,r){this.password&&e?n.compare(e,this.password,function(e,t){return e?r(e):void r(null,t)}):r(null,!1)},y.prototype.verify=function(r,o){function n(e){r.verifyHref+="?token="+e.verificationToken,r.text=r.text||"Please verify your email by opening this link in a web browser:\n {href}",r.text=r.text.replace("{href}",r.verifyHref);var i=t.template(r.template);p.send({to:r.to||e.email,subject:r.subject||"Thanks for Registering",text:r.text,html:i(r)},function(r,t){r?o(r):o(null,{email:t,token:e.verificationToken,uid:e.id})})}var a=this;d("object"==typeof r,"options required when calling user.verify()"),d(r.type,"You must supply a verification type (options.type)"),d("email"===r.type,"Unsupported verification type"),d(r.to||this.email,"Must include options.to when calling user.verify() or the user must have an email property"),d(r.from,"Must include options.from when calling user.verify() or the user must have an email property"),r.redirect=r.redirect||"/",r.template=i.resolve(r.template||i.join(e,"..","..","templates","verify.ejs")),r.user=this,r.protocol=r.protocol||"http",r.host=r.host||"localhost",r.verifyHref=r.verifyHref||r.protocol+"://"+r.host+y.http.path+y.confirm.http.path;var p=r.mailer||this.constructor.email||t.getModelByType(t.Email);s.randomBytes(64,function(e,r){e?o(e):(a.verificationToken=r.toString("hex"),a.save(function(e){e?o(e):n(a)}))})},y.confirm=function(e,r,t,i){this.findById(e,function(e,t){e?i(e):t.verificationToken===r?(t.verificationToken=void 0,t.emailVerified=!0,t.save(function(e){e?i(e):i()})):i(new Error("invalid token"))})},y.resetPassword=function(e,r){var t=this,i=t.settings.resetPasswordTokenTTL||p;if(e=e||{},"string"==typeof e.email)t.findOne({email:e.email},function(o,s){o?r(o):s?s.accessTokens.create({ttl:i},function(i,o){i?r(i):(r(),t.emit("resetPasswordRequest",{email:e.email,accessToken:o}))}):r()});else{var o=new Error("email is required");o.statusCode=400,r(o)}},y.setup=function(){r.setup.call(this);var e=this;this.settings.maxTTL=this.settings.maxTTL||c,this.settings.ttl=a,e.setter.password=function(e){var r=n.genSaltSync(this.constructor.settings.saltWorkFactor||o);this.$password=n.hashSync(e,r)},t.remoteMethod(e.login,{accepts:[{arg:"credentials",type:"object",required:!0,http:{source:"body"}},{arg:"include",type:"string",http:{source:"query"},description:"Related objects to include in the response. See the description of return value for more details."}],returns:{arg:"accessToken",type:"object",root:!0,description:"The response body contains properties of the AccessToken created on login.\nDepending on the value of `include` parameter, the body may contain additional properties:\n\n - `user` - `{User}` - Data of the currently logged in user. (`include=user`)\n\n"},http:{verb:"post"}}),t.remoteMethod(e.logout,{accepts:[{arg:"access_token",type:"string",required:!0,http:function(e){var r=e&&e.req,t=r&&r.accessToken,i=t&&t.id;return i},description:"Do not supply this argument, it is automatically extracted from request headers."}],http:{verb:"all"}}),t.remoteMethod(e.confirm,{accepts:[{arg:"uid",type:"string",required:!0},{arg:"token",type:"string",required:!0},{arg:"redirect",type:"string",required:!0}],http:{verb:"get",path:"/confirm"}}),t.remoteMethod(e.resetPassword,{accepts:[{arg:"options",type:"object",required:!0,http:{source:"body"}}],http:{verb:"post",path:"/reset"}}),e.on("attached",function(){e.afterRemote("confirm",function(e){e.req?e.res.redirect(e.req.param("redirect")):fn(new Error("transport unsupported"))})}),e.email=require("./email"),e.accessToken=require("./access-token"),e.validatesUniquenessOf("email",{message:"Email already exists"});var i=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return e.validatesFormatOf("email",{"with":i,message:"Must provide a valid email"}),e},y.setup()}).call(this,"/../../../../node_modules/loopback/lib/models");
},{"../loopback":58,"./access-token":60,"./acl":61,"./email":64,"./role":66,"assert":11,"bcryptjs":69,"crypto":19,"debug":70,"passport":14,"passport-local":14,"path":31}],68:[function(require,module,exports){
(function(n){!function(){function t(n){var t=!1;return function(){if(t)throw new Error("Callback was already called.");t=!0,n.apply(e,arguments)}}var e,r,u={};e=this,null!=e&&(r=e.async),u.noConflict=function(){return e.async=r,u};var i=function(n,t){if(n.forEach)return n.forEach(t);for(var e=0;e<n.length;e+=1)t(n[e],e,n)},c=function(n,t){if(n.map)return n.map(t);var e=[];return i(n,function(n,r,u){e.push(t(n,r,u))}),e},o=function(n,t,e){return n.reduce?n.reduce(t,e):(i(n,function(n,r,u){e=t(e,n,r,u)}),e)},a=function(n){if(Object.keys)return Object.keys(n);var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(e);return t};"undefined"!=typeof n&&n.nextTick?(u.nextTick=n.nextTick,u.setImmediate="undefined"!=typeof setImmediate?function(n){setImmediate(n)}:u.nextTick):"function"==typeof setImmediate?(u.nextTick=function(n){setImmediate(n)},u.setImmediate=u.nextTick):(u.nextTick=function(n){setTimeout(n,0)},u.setImmediate=u.nextTick),u.each=function(n,e,r){if(r=r||function(){},!n.length)return r();var u=0;i(n,function(i){e(i,t(function(t){t?(r(t),r=function(){}):(u+=1,u>=n.length&&r(null))}))})},u.forEach=u.each,u.eachSeries=function(n,t,e){if(e=e||function(){},!n.length)return e();var r=0,u=function(){t(n[r],function(t){t?(e(t),e=function(){}):(r+=1,r>=n.length?e(null):u())})};u()},u.forEachSeries=u.eachSeries,u.eachLimit=function(n,t,e,r){var u=l(t);u.apply(null,[n,e,r])},u.forEachLimit=u.eachLimit;var l=function(n){return function(t,e,r){if(r=r||function(){},!t.length||0>=n)return r();var u=0,i=0,c=0;!function o(){if(u>=t.length)return r();for(;n>c&&i<t.length;)i+=1,c+=1,e(t[i-1],function(n){n?(r(n),r=function(){}):(u+=1,c-=1,u>=t.length?r():o())})}()}},f=function(n){return function(){var t=Array.prototype.slice.call(arguments);return n.apply(null,[u.each].concat(t))}},s=function(n,t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[l(n)].concat(e))}},p=function(n){return function(){var t=Array.prototype.slice.call(arguments);return n.apply(null,[u.eachSeries].concat(t))}},m=function(n,t,e,r){var u=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e,r){u[n.index]=r,t(e)})},function(n){r(n,u)})};u.map=f(m),u.mapSeries=p(m),u.mapLimit=function(n,t,e,r){return y(t)(n,e,r)};var y=function(n){return s(n,m)};u.reduce=function(n,t,e,r){u.eachSeries(n,function(n,r){e(t,n,function(n,e){t=e,r(n)})},function(n){r(n,t)})},u.inject=u.reduce,u.foldl=u.reduce,u.reduceRight=function(n,t,e,r){var i=c(n,function(n){return n}).reverse();u.reduce(i,t,e,r)},u.foldr=u.reduceRight;var h=function(n,t,e,r){var u=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e){e&&u.push(n),t()})},function(){r(c(u.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})};u.filter=f(h),u.filterSeries=p(h),u.select=u.filter,u.selectSeries=u.filterSeries;var v=function(n,t,e,r){var u=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e){e||u.push(n),t()})},function(){r(c(u.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})};u.reject=f(v),u.rejectSeries=p(v);var d=function(n,t,e,r){n(t,function(n,t){e(n,function(e){e?(r(n),r=function(){}):t()})},function(){r()})};u.detect=f(d),u.detectSeries=p(d),u.some=function(n,t,e){u.each(n,function(n,r){t(n,function(n){n&&(e(!0),e=function(){}),r()})},function(){e(!1)})},u.any=u.some,u.every=function(n,t,e){u.each(n,function(n,r){t(n,function(n){n||(e(!1),e=function(){}),r()})},function(){e(!0)})},u.all=u.every,u.sortBy=function(n,t,e){u.map(n,function(n,e){t(n,function(t,r){t?e(t):e(null,{value:n,criteria:r})})},function(n,t){if(n)return e(n);var r=function(n,t){var e=n.criteria,r=t.criteria;return r>e?-1:e>r?1:0};e(null,c(t.sort(r),function(n){return n.value}))})},u.auto=function(n,t){t=t||function(){};var e=a(n);if(!e.length)return t(null);var r={},c=[],l=function(n){c.unshift(n)},f=function(n){for(var t=0;t<c.length;t+=1)if(c[t]===n)return void c.splice(t,1)},s=function(){i(c.slice(0),function(n){n()})};l(function(){a(r).length===e.length&&(t(null,r),t=function(){})}),i(e,function(e){var c=n[e]instanceof Function?[n[e]]:n[e],p=function(n){var c=Array.prototype.slice.call(arguments,1);if(c.length<=1&&(c=c[0]),n){var o={};i(a(r),function(n){o[n]=r[n]}),o[e]=c,t(n,o),t=function(){}}else r[e]=c,u.setImmediate(s)},m=c.slice(0,Math.abs(c.length-1))||[],y=function(){return o(m,function(n,t){return n&&r.hasOwnProperty(t)},!0)&&!r.hasOwnProperty(e)};if(y())c[c.length-1](p,r);else{var h=function(){y()&&(f(h),c[c.length-1](p,r))};l(h)}})},u.waterfall=function(n,t){if(t=t||function(){},n.constructor!==Array){var e=new Error("First argument to waterfall must be an array of functions");return t(e)}if(!n.length)return t();var r=function(n){return function(e){if(e)t.apply(null,arguments),t=function(){};else{var i=Array.prototype.slice.call(arguments,1),c=n.next();i.push(c?r(c):t),u.setImmediate(function(){n.apply(null,i)})}}};r(u.iterator(n))()};var g=function(n,t,e){if(e=e||function(){},t.constructor===Array)n.map(t,function(n,t){n&&n(function(n){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),t.call(null,n,e)})},e);else{var r={};n.each(a(t),function(n,e){t[n](function(t){var u=Array.prototype.slice.call(arguments,1);u.length<=1&&(u=u[0]),r[n]=u,e(t)})},function(n){e(n,r)})}};u.parallel=function(n,t){g({map:u.map,each:u.each},n,t)},u.parallelLimit=function(n,t,e){g({map:y(t),each:l(t)},n,e)},u.series=function(n,t){if(t=t||function(){},n.constructor===Array)u.mapSeries(n,function(n,t){n&&n(function(n){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),t.call(null,n,e)})},t);else{var e={};u.eachSeries(a(n),function(t,r){n[t](function(n){var u=Array.prototype.slice.call(arguments,1);u.length<=1&&(u=u[0]),e[t]=u,r(n)})},function(n){t(n,e)})}},u.iterator=function(n){var t=function(e){var r=function(){return n.length&&n[e].apply(null,arguments),r.next()};return r.next=function(){return e<n.length-1?t(e+1):null},r};return t(0)},u.apply=function(n){var t=Array.prototype.slice.call(arguments,1);return function(){return n.apply(null,t.concat(Array.prototype.slice.call(arguments)))}};var k=function(n,t,e,r){var u=[];n(t,function(n,t){e(n,function(n,e){u=u.concat(e||[]),t(n)})},function(n){r(n,u)})};u.concat=f(k),u.concatSeries=p(k),u.whilst=function(n,t,e){n()?t(function(r){return r?e(r):void u.whilst(n,t,e)}):e()},u.doWhilst=function(n,t,e){n(function(r){return r?e(r):void(t()?u.doWhilst(n,t,e):e())})},u.until=function(n,t,e){n()?e():t(function(r){return r?e(r):void u.until(n,t,e)})},u.doUntil=function(n,t,e){n(function(r){return r?e(r):void(t()?e():u.doUntil(n,t,e))})},u.queue=function(n,e){function r(n,t,r,c){t.constructor!==Array&&(t=[t]),i(t,function(t){var i={data:t,callback:"function"==typeof c?c:null};r?n.tasks.unshift(i):n.tasks.push(i),n.saturated&&n.tasks.length===e&&n.saturated(),u.setImmediate(n.process)})}void 0===e&&(e=1);var c=0,o={tasks:[],concurrency:e,saturated:null,empty:null,drain:null,push:function(n,t){r(o,n,!1,t)},unshift:function(n,t){r(o,n,!0,t)},process:function(){if(c<o.concurrency&&o.tasks.length){var e=o.tasks.shift();o.empty&&0===o.tasks.length&&o.empty(),c+=1;var r=function(){c-=1,e.callback&&e.callback.apply(e,arguments),o.drain&&o.tasks.length+c===0&&o.drain(),o.process()},u=t(r);n(e.data,u)}},length:function(){return o.tasks.length},running:function(){return c}};return o},u.cargo=function(n,t){var e=!1,r=[],o={tasks:r,payload:t,saturated:null,empty:null,drain:null,push:function(n,e){n.constructor!==Array&&(n=[n]),i(n,function(n){r.push({data:n,callback:"function"==typeof e?e:null}),o.saturated&&r.length===t&&o.saturated()}),u.setImmediate(o.process)},process:function a(){if(!e){if(0===r.length)return void(o.drain&&o.drain());var u="number"==typeof t?r.splice(0,t):r.splice(0),l=c(u,function(n){return n.data});o.empty&&o.empty(),e=!0,n(l,function(){e=!1;var n=arguments;i(u,function(t){t.callback&&t.callback.apply(null,n)}),a()})}},length:function(){return r.length},running:function(){return e}};return o};var A=function(n){return function(t){var e=Array.prototype.slice.call(arguments,1);t.apply(null,e.concat([function(t){var e=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(t?console.error&&console.error(t):console[n]&&i(e,function(t){console[n](t)}))}]))}};u.log=A("log"),u.dir=A("dir"),u.memoize=function(n,t){var e={},r={};t=t||function(n){return n};var u=function(){var u=Array.prototype.slice.call(arguments),i=u.pop(),c=t.apply(null,u);c in e?i.apply(null,e[c]):c in r?r[c].push(i):(r[c]=[i],n.apply(null,u.concat([function(){e[c]=arguments;var n=r[c];delete r[c];for(var t=0,u=n.length;u>t;t++)n[t].apply(null,arguments)}])))};return u.memo=e,u.unmemoized=n,u},u.unmemoize=function(n){return function(){return(n.unmemoized||n).apply(null,arguments)}},u.times=function(n,t,e){for(var r=[],i=0;n>i;i++)r.push(i);return u.map(r,t,e)},u.timesSeries=function(n,t,e){for(var r=[],i=0;n>i;i++)r.push(i);return u.mapSeries(r,t,e)},u.compose=function(){var n=Array.prototype.reverse.call(arguments);return function(){var t=this,e=Array.prototype.slice.call(arguments),r=e.pop();u.reduce(n,e,function(n,e,r){e.apply(t,n.concat([function(){var n=arguments[0],t=Array.prototype.slice.call(arguments,1);r(n,t)}]))},function(n,e){r.apply(t,[n].concat(e))})}};var x=function(n,t){var e=function(){var e=this,r=Array.prototype.slice.call(arguments),u=r.pop();return n(t,function(n,t){n.apply(e,r.concat([t]))},u)};if(arguments.length>2){var r=Array.prototype.slice.call(arguments,2);return e.apply(this,r)}return e};u.applyEach=f(x),u.applyEachSeries=p(x),u.forever=function(n,t){function e(r){if(r){if(t)return t(r);throw r}n(e)}e()},"undefined"!=typeof define&&define.amd?define([],function(){return u}):"undefined"!=typeof module&&module.exports?module.exports=u:e.async=u}()}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30}],69:[function(require,module,exports){
(function(r){function e(r){throw r}var n=null;!function(t){function o(r,e,n,t){for(var o,l=r[e],a=r[e+1],l=l^n[0],u=0;14>=u;)o=t[l>>24&255],o+=t[256|l>>16&255],o^=t[512|l>>8&255],o+=t[768|255&l],a^=o^n[++u],o=t[a>>24&255],o+=t[256|a>>16&255],o^=t[512|a>>8&255],o+=t[768|255&a],l^=o^n[++u];return r[e]=a^n[17],r[e+1]=l,r}function l(r,e){var n,t=0;for(n=0;4>n;n++)t=t<<8|255&r[e],e=(e+1)%r.length;return{key:t,a:e}}function a(r,e,n){for(var t=0,a=[0,0],u=e.length,s=n.length,f=0;u>f;f++){var i=l(r,t),t=i.a;e[f]^=i.key}for(f=0;u>f;f+=2)a=o(a,0,e,n),e[f]=a[0],e[f+1]=a[1];for(f=0;s>f;f+=2)a=o(a,0,e,n),n[f]=a[0],n[f+1]=a[1]}function u(r,e,n,t){for(var a,u=0,s=[0,0],f=n.length,i=t.length,h=0;f>h;h++)a=l(e,u),u=a.a,n[h]^=a.key;for(h=u=0;f>h;h+=2)a=l(r,u),u=a.a,s[0]^=a.key,a=l(r,u),u=a.a,s[1]^=a.key,s=o(s,0,n,t),n[h]=s[0],n[h+1]=s[1];for(h=0;i>h;h+=2)a=l(r,u),u=a.a,s[0]^=a.key,a=l(r,u),u=a.a,s[1]^=a.key,s=o(s,0,n,t),t[h]=s[0],t[h+1]=s[1]}function s(e){"undefined"!=typeof r&&"function"==typeof r.nextTick?"function"==typeof setImmediate?setImmediate(e):r.nextTick(e):setTimeout(e,0)}function f(r,t,l,f){function i(){if(!(l>y)){for(y=0;64>y;y++)for(d=0;c>>1>d;d++)o(h,d<<1,p,g);for(e=[],y=0;c>y;y++)e.push((h[y]>>24&255)>>>0),e.push((h[y]>>16&255)>>>0),e.push((h[y]>>8&255)>>>0),e.push((255&h[y])>>>0);return f?(f(n,e),n):e}for(var e=new Date;l>y&&(y+=1,a(r,p,g),a(t,p,g),!(100<Date.now()-e)););return f&&s(i),n}var h=b.slice(),c=h.length;(4>l||l>31)&&e(Error("Illegal number of rounds: "+l)),16!=t.length&&e(Error("Illegal salt length: "+t.length+" != 16")),l=1<<l;var p=m.slice(),g=v.slice();u(t,r,p,g);var d,y=0;if("undefined"!=typeof f)return i(),n;for(var I;;)if((I=i())!==n)return I}function i(r){for(var e,n,t=[],o=0;o<r.length;o++){e=r.charCodeAt(o),n=[];do n.push(255&e),e>>=8;while(e);t=t.concat(n.reverse())}return t}function h(r,t,o){function l(r){var e=[];return e.push("$2"),a>="a"&&e.push(a),e.push("$"),10>s&&e.push("0"),e.push(s.toString()),e.push("$"),e.push(d.b(h,h.length)),e.push(d.b(r,4*b.length-1)),e.join("")}var a,u;("$"!=t.charAt(0)||"2"!=t.charAt(1))&&e(Error("Invalid salt version: "+t.substring(0,2))),"$"==t.charAt(2)?(a=String.fromCharCode(0),u=3):(a=t.charAt(2),("a"!=a||"$"!=t.charAt(3))&&e(Error("Invalid salt revision: "+t.substring(2,4))),u=4),"$"<t.charAt(u+2)&&e(Error("Missing salt rounds"));var s=10*parseInt(t.substring(u,u+1),10)+parseInt(t.substring(u+1,u+2),10);t=t.substring(u+3,u+25),r=i(r+(a>="a"?"\x00":""));var h=[],h=d.c(t,16);return"undefined"==typeof o?l(f(r,h,s)):(f(r,h,s,function(r,e){r?o(r,n):o(n,l(e))}),n)}function c(){if("undefined"!=typeof module&&module.exports)return require("crypto").randomBytes(16);var r=new Uint32Array(16);return t.crypto&&"function"==typeof t.crypto.getRandomValues?t.crypto.getRandomValues(r):"function"==typeof I?I(r):e(Error("Failed to generate random values: Web Crypto API not available / no polyfill set")),Array.prototype.slice.call(r)}var p="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),g=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],d={b:function(r,n){var t,o,l=0,a=[];for((0>=n||n>r.length)&&e(Error("Invalid 'len': "+n));n>l;){if(t=255&r[l++],a.push(p[t>>2&63]),t=(3&t)<<4,l>=n){a.push(p[63&t]);break}if(o=255&r[l++],t|=o>>4&15,a.push(p[63&t]),t=(15&o)<<2,l>=n){a.push(p[63&t]);break}o=255&r[l++],t|=o>>6&3,a.push(p[63&t]),a.push(p[63&o])}return a.join("")},c:function(r,n){var t,o,l,a=0,u=r.length,s=0,f=[];for(0>=n&&e(Error("Illegal 'len': "+n));u-1>a&&n>s&&(l=r.charCodeAt(a++),t=l<g.length?g[l]:-1,l=r.charCodeAt(a++),o=l<g.length?g[l]:-1,-1!=t&&-1!=o)&&(l=t<<2>>>0,l|=(48&o)>>4,f.push(String.fromCharCode(l)),!(++s>=n||a>=u))&&(l=r.charCodeAt(a++),t=l<g.length?g[l]:-1,-1!=t)&&(l=(15&o)<<4>>>0,l|=(60&t)>>2,f.push(String.fromCharCode(l)),!(++s>=n||a>=u));)l=r.charCodeAt(a++),o=l<g.length?g[l]:-1,l=(3&t)<<6>>>0,l|=o,f.push(String.fromCharCode(l)),++s;for(u=[],a=0;s>a;a++)u.push(f[a].charCodeAt(0));return u}},y={},m=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],v=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],b=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892],I=n;y.setRandomPolyfill=function(r){I=r},y.genSaltSync=function(r){r||(r=10);var n;r=r||10,(4>r||r>31)&&e(Error("Illegal number of rounds: "+r));var t=[];t.push("$2a$"),10>r&&t.push("0"),t.push(r.toString()),t.push("$");try{t.push(d.b(c(),16)),n=t.join("")}catch(o){e(o)}return n},y.genSalt=function(r,t,o){"function"==typeof t&&(o=t,t=-1);var l;"function"==typeof r?(o=r,l=10):l=parseInt(r,10),"function"!=typeof o&&e(Error("Illegal or missing 'callback': "+o)),s(function(){try{var r=y.genSaltSync(l);o(n,r)}catch(e){o(e,n)}})},y.hashSync=function(r,e){return e||(e=10),"number"==typeof e&&(e=y.genSaltSync(e)),h(r,e)},y.hash=function(r,n,t){"function"!=typeof t&&e(Error("Illegal 'callback': "+t)),"number"==typeof n?y.genSalt(n,function(e,n){h(r,n,t)}):h(r,n,t)},y.compareSync=function(r,n){("string"!=typeof r||"string"!=typeof n)&&e(Error("Illegal argument types: "+typeof r+", "+typeof n)),60!=n.length&&e(Error("Illegal hash length: "+n.length+" != 60"));for(var t=y.hashSync(r,n.substr(0,n.length-31)),o=t.length==n.length,l=t.length<n.length?t.length:n.length,a=0;l>a;++a)t.length>=a&&n.length>=a&&t[a]!=n[a]&&(o=!1);return o},y.compare=function(r,n,t){"function"!=typeof t&&e(Error("Illegal 'callback': "+t)),y.hash(r,n.substr(0,29),function(r,e){t(r,n===e)})},y.getRounds=function(r){return"string"!=typeof r&&e(Error("Illegal type of 'hash': "+typeof r)),parseInt(r.split("$")[2],10)},y.getSalt=function(r){return"string"!=typeof r&&e(Error("Illegal type of 'hash': "+typeof r)),60!=r.length&&e(Error("Illegal hash length: "+r.length+" != 60")),r.substring(0,29)},"undefined"!=typeof module&&module.exports?module.exports=y:"undefined"!=typeof define&&define.amd?define("bcrypt",function(){return y}):(t.dcodeIO||(t.dcodeIO={}),t.dcodeIO.bcrypt=y)}(this)}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"crypto":19}],70:[function(require,module,exports){
function debug(e){return debug.enabled(e)?function(n){n=coerce(n);var u=new Date,o=u-(debug[e]||u);debug[e]=u,n=e+" "+n+" +"+debug.humanize(o),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function coerce(e){return e instanceof Error?e.stack||e.message:e}module.exports=debug,debug.names=[],debug.skips=[],debug.enable=function(e){try{localStorage.debug=e}catch(n){}for(var u=(e||"").split(/[\s,]+/),o=u.length,t=0;o>t;t++)e=u[t].replace("*",".*?"),"-"===e[0]?debug.skips.push(new RegExp("^"+e.substr(1)+"$")):debug.names.push(new RegExp("^"+e+"$"))},debug.disable=function(){debug.enable("")},debug.humanize=function(e){var n=1e3,u=6e4,o=60*u;return e>=o?(e/o).toFixed(1)+"h":e>=u?(e/u).toFixed(1)+"m":e>=n?(e/n|0)+"s":e+"ms"},debug.enabled=function(e){for(var n=0,u=debug.skips.length;u>n;n++)if(debug.skips[n].test(e))return!1;for(var n=0,u=debug.names.length;u>n;n++)if(debug.names[n].test(e))return!0;return!1};try{window.localStorage&&debug.enable(localStorage.debug)}catch(e){}
},{}],71:[function(require,module,exports){
function filtered(e){return e.substr(1).split("|").reduce(function(e,r){var n=r.split(":"),t=n.shift(),i=n.join(":")||"";return i&&(i=", "+i),"filters."+t+"("+e+i+")"})}function rethrow(e,r,n,t){var i=r.split("\n"),s=Math.max(t-3,0),a=Math.min(i.length,t+3),o=i.slice(s,a).map(function(e,r){var n=r+s+1;return(n==t?" >> ":" ")+n+"| "+e}).join("\n");throw e.path=n,e.message=(n||"ejs")+":"+t+"\n"+o+"\n\n"+e.message,e}function resolveInclude(e,r){var n=join(dirname(r),e),t=extname(e);return t||(n+=".ejs"),n}var utils=require("./utils"),path=require("path"),dirname=path.dirname,extname=path.extname,join=path.join,fs=require("fs"),read=fs.readFileSync,filters=exports.filters=require("./filters"),cache={};exports.clearCache=function(){cache={}};var parse=exports.parse=function(e,r){var r=r||{},n=r.open||exports.open||"<%",t=r.close||exports.close||"%>",i=r.filename,s=r.compileDebug!==!1,a="";a+="var buf = [];",!1!==r._with&&(a+="\nwith (locals || {}) { (function(){ "),a+="\n buf.push('";for(var o=1,l=!1,c=0,u=e.length;u>c;++c){var f=e[c];if(e.slice(c,n.length+c)==n){c+=n.length;var p,h,m=(s?"__stack.lineno=":"")+o;switch(e[c]){case"=":p="', escape(("+m+", ",h=")), '",++c;break;case"-":p="', ("+m+", ",h="), '",++c;break;default:p="');"+m+";",h="; buf.push('"}var d=e.indexOf(t,c),x=e.substring(c,d),g=c,v=null,_=0;if("-"==x[x.length-1]&&(x=x.substring(0,x.length-2),l=!0),0==x.trim().indexOf("include")){var w=x.trim().slice(7).trim();if(!i)throw new Error("filename option is required for includes");var b=resolveInclude(w,i);v=read(b,"utf8"),v=exports.parse(v,{filename:b,_with:!1,open:n,close:t,compileDebug:s}),a+="' + (function(){"+v+"})() + '",x=""}for(;~(_=x.indexOf("\n",_));)_++,o++;":"==x.substr(0,1)&&(x=filtered(x)),x&&(x.lastIndexOf("//")>x.lastIndexOf("\n")&&(x+="\n"),a+=p,a+=x,a+=h),c+=d-g+t.length-1}else"\\"==f?a+="\\\\":"'"==f?a+="\\'":"\r"==f||("\n"==f?l?l=!1:(a+="\\n",o++):a+=f)}return a+=!1!==r._with?"'); })();\n} \nreturn buf.join('');":"');\nreturn buf.join('');"},compile=exports.compile=function(e,r){r=r||{};var n=r.escape||utils.escape,t=JSON.stringify(e),i=r.compileDebug!==!1,s=r.client,a=r.filename?JSON.stringify(r.filename):"undefined";e=i?["var __stack = { lineno: 1, input: "+t+", filename: "+a+" };",rethrow.toString(),"try {",exports.parse(e,r),"} catch (err) {"," rethrow(err, __stack.input, __stack.filename, __stack.lineno);","}"].join("\n"):exports.parse(e,r),r.debug&&console.log(e),s&&(e="escape = escape || "+n.toString()+";\n"+e);try{var o=new Function("locals, filters, escape, rethrow",e)}catch(l){throw"SyntaxError"==l.name&&(l.message+=r.filename?" in "+a:" while compiling ejs"),l}return s?o:function(e){return o.call(this,e,filters,n,rethrow)}};exports.render=function(e,r){var n,r=r||{};if(r.cache){if(!r.filename)throw new Error('"cache" option requires "filename".');n=cache[r.filename]||(cache[r.filename]=compile(e,r))}else n=compile(e,r);return r.__proto__=r.locals,n.call(r.scope,r)},exports.renderFile=function(e,r,n){var t=e+":string";"function"==typeof r&&(n=r,r={}),r.filename=e;var i;try{i=r.cache?cache[t]||(cache[t]=read(e,"utf8")):read(e,"utf8")}catch(s){return void n(s)}n(null,exports.render(i,r))},exports.__express=exports.renderFile,require.extensions?require.extensions[".ejs"]=function(e,r){r=r||e.filename;var n={filename:r,client:!0},t=fs.readFileSync(r).toString(),i=compile(t,n);e._compile("module.exports = "+i.toString()+";",r)}:require.registerExtension&&require.registerExtension(".ejs",function(e){return compile(e,{})});
},{"./filters":72,"./utils":73,"fs":10,"path":31}],72:[function(require,module,exports){
exports.first=function(r){return r[0]},exports.last=function(r){return r[r.length-1]},exports.capitalize=function(r){return r=String(r),r[0].toUpperCase()+r.substr(1,r.length)},exports.downcase=function(r){return String(r).toLowerCase()},exports.upcase=function(r){return String(r).toUpperCase()},exports.sort=function(r){return Object.create(r).sort()},exports.sort_by=function(r,t){return Object.create(r).sort(function(r,e){return r=r[t],e=e[t],r>e?1:e>r?-1:0})},exports.size=exports.length=function(r){return r.length},exports.plus=function(r,t){return Number(r)+Number(t)},exports.minus=function(r,t){return Number(r)-Number(t)},exports.times=function(r,t){return Number(r)*Number(t)},exports.divided_by=function(r,t){return Number(r)/Number(t)},exports.join=function(r,t){return r.join(t||", ")},exports.truncate=function(r,t,e){return r=String(r),r.length>t&&(r=r.slice(0,t),e&&(r+=e)),r},exports.truncate_words=function(r,t){var r=String(r),e=r.split(/ +/);return e.slice(0,t).join(" ")},exports.replace=function(r,t,e){return String(r).replace(t,e||"")},exports.prepend=function(r,t){return Array.isArray(r)?[t].concat(r):t+r},exports.append=function(r,t){return Array.isArray(r)?r.concat(t):r+t},exports.map=function(r,t){return r.map(function(r){return r[t]})},exports.reverse=function(r){return Array.isArray(r)?r.reverse():String(r).split("").reverse().join("")},exports.get=function(r,t){return r[t]},exports.json=function(r){return JSON.stringify(r)};
},{}],73:[function(require,module,exports){
exports.escape=function(e){return String(e).replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")};
},{}],74:[function(require,module,exports){
!function(e){var i=["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"],n=[[new RegExp("(m)en$","gi")],[new RegExp("(pe)ople$","gi")],[new RegExp("(child)ren$","gi")],[new RegExp("([ti])a$","gi")],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi")],[new RegExp("(hive)s$","gi")],[new RegExp("(tive)s$","gi")],[new RegExp("(curve)s$","gi")],[new RegExp("([lr])ves$","gi")],[new RegExp("([^fo])ves$","gi")],[new RegExp("([^aeiouy]|qu)ies$","gi")],[new RegExp("(s)eries$","gi")],[new RegExp("(m)ovies$","gi")],[new RegExp("(x|ch|ss|sh)es$","gi")],[new RegExp("([m|l])ice$","gi")],[new RegExp("(bus)es$","gi")],[new RegExp("(o)es$","gi")],[new RegExp("(shoe)s$","gi")],[new RegExp("(cris|ax|test)es$","gi")],[new RegExp("(octop|vir)i$","gi")],[new RegExp("(alias|status)es$","gi")],[new RegExp("^(ox)en","gi")],[new RegExp("(vert|ind)ices$","gi")],[new RegExp("(matr)ices$","gi")],[new RegExp("(quiz)zes$","gi")],[new RegExp("(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hive)$","gi"),"$1s"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]],g=[[new RegExp("(m)an$","gi")],[new RegExp("(pe)rson$","gi")],[new RegExp("(child)$","gi")],[new RegExp("^(ox)$","gi")],[new RegExp("(ax|test)is$","gi")],[new RegExp("(octop|vir)us$","gi")],[new RegExp("(alias|status)$","gi")],[new RegExp("(bu)s$","gi")],[new RegExp("(buffal|tomat|potat)o$","gi")],[new RegExp("([ti])um$","gi")],[new RegExp("sis$","gi")],[new RegExp("(?:([^f])fe|([lr])f)$","gi")],[new RegExp("(hive)$","gi")],[new RegExp("([^aeiouy]|qu)y$","gi")],[new RegExp("(x|ch|ss|sh)$","gi")],[new RegExp("(matr|vert|ind)ix|ex$","gi")],[new RegExp("([m|l])ouse$","gi")],[new RegExp("(quiz)$","gi")],[new RegExp("(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hive)s$","gi"),"$1"],[new RegExp("(tive)s$","gi"),"$1"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("ss$","gi"),"ss"],[new RegExp("s$","gi"),""]],s=["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"],p=new RegExp("(_ids|_id)$","g"),r=new RegExp("_","g"),t=new RegExp("[ _]","g"),o=new RegExp("([A-Z])","g"),$=new RegExp("^_"),x={_apply_rules:function(e,i,n,g){if(g)e=g;else{var s=x.indexOf(n,e.toLowerCase())>-1;if(!s)for(var p=0,r=i.length;r>p;p++)if(e.match(i[p][0])){void 0!==i[p][1]&&(e=e.replace(i[p][0],i[p][1]));break}}return e},indexOf:function(e,i,n,g){n||(n=-1);for(var s=-1,p=n,r=e.length;r>p;p++)if(e[p]===i||g&&g(e[p],i)){s=p;break}return s},pluralize:function(e,g){return x._apply_rules(e,n,i,g)},singularize:function(e,n){return x._apply_rules(e,g,i,n)},camelize:function(e,i){for(var n,g,s,p,r=e.split("/"),t=0,o=r.length;o>t;t++){for(n=r[t].split("_"),g=0,s=n.length;s>g;g++)0!==g&&(n[g]=n[g].toLowerCase()),p=n[g].charAt(0),p=i&&0===t&&0===g?p.toLowerCase():p.toUpperCase(),n[g]=p+n[g].substring(1);r[t]=n.join("")}return r.join("::")},underscore:function(e,i){if(i&&e===e.toUpperCase())return e;for(var n=e.split("::"),g=0,s=n.length;s>g;g++)n[g]=n[g].replace(o,"_$1"),n[g]=n[g].replace($,"");return n.join("/").toLowerCase()},humanize:function(e,i){return e=e.toLowerCase(),e=e.replace(p,""),e=e.replace(r," "),i||(e=x.capitalize(e)),e},capitalize:function(e){return e=e.toLowerCase(),e.substring(0,1).toUpperCase()+e.substring(1)},dasherize:function(e){return e.replace(t,"-")},titleize:function(e){e=e.toLowerCase().replace(r," ");for(var i,n,g,p=e.split(" "),t=0,o=p.length;o>t;t++){for(i=p[t].split("-"),n=0,g=i.length;g>n;n++)x.indexOf(s,i[n].toLowerCase())<0&&(i[n]=x.capitalize(i[n]));p[t]=i.join("-")}return e=p.join(" "),e=e.substring(0,1).toUpperCase()+e.substring(1)},demodulize:function(e){var i=e.split("::");return i[i.length-1]},tableize:function(e){return e=x.underscore(e),e=x.pluralize(e)},classify:function(e){return e=x.camelize(e),e=x.singularize(e)},foreign_key:function(e,i){return e=x.demodulize(e),e=x.underscore(e)+(i?"":"_")+"id"},ordinalize:function(e){for(var i=e.split(" "),n=0,g=i.length;g>n;n++){var s=parseInt(i[n],10);if(!isNaN(s)){var p=i[n].substring(i[n].length-2),r=i[n].substring(i[n].length-1),t="th";"11"!=p&&"12"!=p&&"13"!=p&&("1"===r?t="st":"2"===r?t="nd":"3"===r&&(t="rd")),i[n]+=t}}return i.join(" ")},transform:function(e,i){for(var n=0,g=i.length;g>n;n++){var s=i[n];this.hasOwnProperty(s)&&(e=this[s](e))}return e}};return x.version="1.3.5","undefined"!=typeof define?define(function(e,i,n){n.exports=x}):"undefined"==typeof exports?void(e.inflection=x):void(module.exports=x)}(this);
},{}],75:[function(require,module,exports){
exports.ModelBuilder=exports.LDL=require("./lib/model-builder.js").ModelBuilder,exports.DataSource=exports.Schema=require("./lib/datasource.js").DataSource,exports.ModelBaseClass=require("./lib/model.js"),exports.Connector=require("./lib/connector.js"),exports.ValidationError=require("./lib/validations.js").ValidationError;var baseSQL="./lib/sql";exports.__defineGetter__("BaseSQL",function(){return require(baseSQL)}),exports.__defineGetter__("version",function(){return require("./package.json").version});var commonTest="./test/common_test";exports.__defineGetter__("test",function(){return require(commonTest)});
},{"./lib/connector.js":76,"./lib/datasource.js":79,"./lib/model-builder.js":86,"./lib/model.js":88,"./lib/validations.js":93,"./package.json":99}],76:[function(require,module,exports){
(function(t){function e(t,e){this._models={},this.name=t,this.settings=e||{}}module.exports=e,e.prototype.relational=!1,e.prototype.getTypes=function(){return["db","nosql"]},e.prototype.getDefaultIdType=function(){return String},e.prototype.getMedadata=function(){return this._metadata||(this._metadata={types:this.getTypes(),defaultIdType:this.getDefaultIdType(),isRelational:this.isRelational||-1!==this.getTypes().indexOf("rdbms"),schemaForSettings:{}}),this._metadata},e.prototype.execute=function(){throw new Error("query method should be declared in connector")},e.prototype.getDataSource=function(t){var e=this._models[t];return e||console.trace("Model not found: "+t),e&&e.model.dataSource},e.prototype.idName=function(t){return this.getDataSource(t).idName(t)},e.prototype.idNames=function(t){return this.getDataSource(t).idNames(t)},e.prototype.id=function(t,e){var o=this._models[t].properties[e];return o||console.trace("Property not found: "+t+"."+e),o.id},e.prototype.define=function(t){t.settings||(t.settings={}),this._models[t.model.modelName]=t},e.prototype.defineProperty=function(t,e,o){this._models[t].properties[e]=o},e.prototype.disconnect=function(e){e&&t.nextTick(e)},e.prototype.getIdValue=function(t,e){return e&&e[this.idName(t)]},e.prototype.setIdValue=function(t,e,o){e&&(e[this.idName(t)]=o)},e.prototype.getType=function(){return this.type}}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30}],77:[function(require,module,exports){
(function(e){function t(e,i){e instanceof t?(this.isTransaction=!0,this.cache=e.cache,this.ids=e.ids,this.constructor.super_.call(this,"memory",i),this._models=e._models):(this.isTransaction=!1,this.cache={},this.ids={},this.constructor.super_.call(this,"memory",i))}function i(e){return null===e||void 0===e?e:JSON.stringify(e)}function r(e){return null===e||void 0===e?e:"string"==typeof e?JSON.parse(e):e}function n(e){function t(e,t){if("string"==typeof t&&e&&"RegExp"===e.constructor.name)return t.match(e);if("undefined"==typeof e)return void 0;if("undefined"==typeof t)return void 0;if("object"==typeof e){if(e.near)return!0;if(e.inq){if(!t)return!1;for(var r=0;r<e.inq.length;r+=1)if(e.inq[r]==t)return!0;return!1}if(i(e.gt)&&e.gt<t)return!0;if(i(e.gte)&&e.gte<=t)return!0;if(i(e.lt)&&e.lt>t)return!0;if(i(e.lte)&&e.lte>=t)return!0}return(null!==e?e.toString():e)==(null!==t?t.toString():t)}function i(e){return"number"==typeof e}if("function"==typeof e.where)return e.where;var r=Object.keys(e.where);return function(i){var n=!0;return r.forEach(function(r){t(e.where[r],i&&i[r])||(n=!1)}),n}}function o(e,t){return e?(Object.keys(t).forEach(function(i){e[i]=t[i]}),e):t}var s=require("util"),c=require("../connector"),u=require("../geo"),a=require("../utils"),l=require("fs"),h=require("async");exports.initialize=function(e,i){e.connector=new t(null,e.settings),e.connector.connect(i)},exports.Memory=t,s.inherits(t,c),t.prototype.getDefaultIdType=function(){return Number},t.prototype.getTypes=function(){return["db","nosql","memory"]},t.prototype.connect=function(e){this.isTransaction?this.onTransactionExec=e:this.loadFromFile(e)},t.prototype.loadFromFile=function(t){var i=this;i.settings.file?l.readFile(i.settings.file,{encoding:"utf8",flag:"r"},function(e,r){e&&"ENOENT"!==e.code?t&&t(e):(r?(r=JSON.parse(r.toString()),i.ids=r.ids||{},i.cache=r.models||{}):i.cache||(i.ids={},i.cache={}),t&&t())}):e.nextTick(t)},t.prototype.saveToFile=function(t,i){var r=this;this.settings.file?(r.writeQueue||(r.writeQueue=h.queue(function(e,t){var i=JSON.stringify({ids:r.ids,models:r.cache},null," ");l.writeFile(r.settings.file,i,function(i){t(i),e.callback&&e.callback(i,e.data)})},1)),r.writeQueue.push({data:t,callback:i})):e.nextTick(function(){i&&i(null,t)})},t.prototype.define=function(e){this.constructor.super_.prototype.define.apply(this,[].slice.call(arguments));var t=e.model.modelName;this.cache[t]||(this.cache[t]={},this.ids[t]=1)},t.prototype.create=function(e,t,r){var n=this.ids[e];void 0===n&&(this.ids[e]=1,n=1);var o=this.getIdValue(e,t)||n;o>n&&(n=o),this.ids[e]=Number(n)+1;var s=this._models[e].properties,c=this.idName(e);o=s[c]&&s[c].type&&s[c].type(o)||o,this.setIdValue(e,t,o),this.cache[e]||(this.cache[e]={}),this.cache[e][o]=i(t),this.saveToFile(o,r)},t.prototype.updateOrCreate=function(e,t,i){var r=this;this.exists(e,r.getIdValue(e,t),function(n,o){o?r.save(e,t,i):r.create(e,t,function(n,o){r.setIdValue(e,t,o),i(n,t)})})},t.prototype.save=function(e,t,r){this.cache[e][this.getIdValue(e,t)]=i(t),this.saveToFile(t,r)},t.prototype.exists=function(t,i,r){e.nextTick(function(){r(null,this.cache[t]&&this.cache[t].hasOwnProperty(i))}.bind(this))},t.prototype.find=function(t,i,r){e.nextTick(function(){r(null,i in this.cache[t]&&this.fromDb(t,this.cache[t][i]))}.bind(this))},t.prototype.destroy=function(e,t,i){delete this.cache[e][t],this.saveToFile(null,i)},t.prototype.fromDb=function(e,t){if(!t)return null;t=r(t);var i=this._models[e].properties;for(var n in t){var o=t[n];if(void 0!==o&&null!==o){if(i[n])switch(i[n].type.name){case"Date":o=new Date(o.toString().replace(/GMT.*$/,"GMT"));break;case"Boolean":o=Boolean(o);break;case"Number":o=Number(o)}t[n]=o}}return t},t.prototype.all=function(t,i,r){function o(e,t){for(var i=0,r=this.length;r>i;i++){if(e[this[i].key]>t[this[i].key])return 1*this[i].reverse;if(e[this[i].key]<t[this[i].key])return-1*this[i].reverse}return 0}var s=this,c=Object.keys(this.cache[t]).map(function(e){return this.fromDb(t,this.cache[t][e])}.bind(this));if(i){if(i.order){var l=i.order;"string"==typeof i.order&&(l=[i.order]),l.forEach(function(e,t){var i=1,r=e.match(/\s+(A|DE)SC$/i);r&&(e=e.replace(/\s+(A|DE)SC/i,""),"de"===r[1].toLowerCase()&&(i=-1)),l[t]={key:e,reverse:i}}),c=c.sort(o.bind(l))}var h=u.nearFilter(i.where);h&&(c=u.filter(c,h)),i.where&&(c=c?c.filter(n(i)):c),i.fields&&(c=c.map(a.selectFields(i.fields))),i.skip=i.skip||0,i.limit=i.limit||c.length,c=c.slice(i.skip,i.skip+i.limit)}e.nextTick(function(){i&&i.include?s._models[t].model.include(c,i.include,r):r(null,c)})},t.prototype.destroyAll=function(e,t,i){i||"function"!=typeof t||(i=t,t=void 0);var r=this.cache[e],o=null;t&&(o=n({where:t})),Object.keys(r).forEach(function(t){(!o||o(this.fromDb(e,r[t])))&&delete r[t]}.bind(this)),t||(this.cache[e]={}),this.saveToFile(null,i)},t.prototype.count=function(t,i,r){var o=this.cache[t],s=Object.keys(o);if(r){var c={where:r};s=s.map(function(e){return this.fromDb(t,o[e])}.bind(this)),s=s.filter(n(c))}e.nextTick(function(){i(null,s.length)})},t.prototype.updateAttributes=function(e,t,i,n){if(!t){var s=new Error("You must provide an id when updating attributes!");if(n)return n(s);throw s}this.setIdValue(e,i,t);var c=this.cache[e],u=c&&this.cache[e][t];u=u&&r(u),u?this.save(e,o(u,i),n):n(new Error("Could not update attributes. Object with id "+t+" does not exist!"))},t.prototype.transaction=function(){return new t(this)},t.prototype.exec=function(e){this.onTransactionExec(),setTimeout(e,50)},t.prototype.buildNearFilter=function(){}}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"../connector":76,"../geo":80,"../utils":92,"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"async":94,"fs":10,"util":46}],78:[function(require,module,exports){
function DataAccessObject(){if(DataAccessObject._mixins){var t=this,e=arguments;DataAccessObject._mixins.forEach(function(i){i.call(t,e)})}}function idName(t){return t.getDataSource().idName?t.getDataSource().idName(t.modelName):"id"}function getIdValue(t,e){return e&&e[t.getDataSource().idName(t.modelName)]}function setIdValue(t,e,i){e&&(e[idName(t)]=i)}function setRemoting(t,e){e=e||{};for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.shared=!0}function stillConnecting(t,e,i){return t.ready(e,i)}function convertNullToNotFoundError(t,e){if(null!==t.result)return e();var i=t.method.sharedClass.name,n=t.getArgByName("id"),r='Unkown "'+i+'" id "'+n+'".',a=new Error(r);a.statusCode=a.status=404,e(a)}function defineReadonlyProp(t,e,i){Object.defineProperty(t,e,{writable:!1,enumerable:!0,configurable:!0,value:i})}module.exports=DataAccessObject;var jutil=require("./jutil"),validations=require("./validations.js"),ValidationError=validations.ValidationError,Relation=require("./relations.js"),Inclusion=require("./include.js"),List=require("./list.js"),geo=require("./geo"),Memory=require("./connectors/memory").Memory,utils=require("./utils"),fieldsToArray=utils.fieldsToArray,removeUndefined=utils.removeUndefined;DataAccessObject._forDB=function(t){if(!this.getDataSource().isRelational||!this.getDataSource().isRelational())return t;var e={};for(var i in t){var n=this.getPropertyType(i);e[i]="JSON"===n||"Any"===n||"Object"===n||t[i]instanceof Array?JSON.stringify(t[i]):t[i]}return e},DataAccessObject.create=function(t,e){function i(){0===--u&&(e(s?c:null,o),s||o.forEach(r.emit.bind("changed")))}function n(){l.trigger("create",function(t){l.trigger("save",function(i){var n=idName(r);this._adapter().create(a,this.constructor._forDB(l.toObject(!0)),function(a,o,c){return o&&(l.__data[n]=o,l.__dataWas[n]=o,defineReadonlyProp(l,n,o)),c&&(l._rev=c),a?e(a,l):void i.call(l,function(){t.call(l,function(){e(a,l),a||r.emit("changed",l)})})},l)},l)},l)}if(!stillConnecting(this.getDataSource(),this,arguments)){var r=this,a=r.modelName;if("function"==typeof t&&(e=t,t={}),"function"!=typeof e&&(e=function(){}),t||(t={}),Array.isArray(t)){var o=[],c=Array(t.length),s=!1,u=t.length;0===u&&e(null,[]);for(var o=[],d=0;d<t.length;d+=1)!function(t,e){o.push(r.create(t,function(t){t&&(c[e]=t,s=!0),i()}))}(t[d],d);return o}var l;return l=t instanceof r&&!getIdValue(this,t)?t:new r(t),t=l.toObject(!0),l.isValid(function(t){t?n():e(new ValidationError(l),l)},t),l}},setRemoting(DataAccessObject.create,{description:"Create a new instance of the model and persist it into the data source",accepts:{arg:"data",type:"object",description:"Model instance data",http:{source:"body"}},returns:{arg:"data",type:"object",root:!0},http:{verb:"post",path:"/"}}),DataAccessObject.upsert=DataAccessObject.updateOrCreate=function(t,e){if(!stillConnecting(this.getDataSource(),this,arguments)){var i=this;if(!getIdValue(this,t))return this.create(t,e);if(this.getDataSource().connector.updateOrCreate){var n=new i(t);this.getDataSource().connector.updateOrCreate(i.modelName,n.toObject(!0),function(t,i){var r;i?(n._initProperties(i),r=n):r=null,e(t,r)})}else this.findById(getIdValue(this,t),function(n,r){if(n)return e(n);if(r)r.updateAttributes(t,e);else{var a=new i(t);a.save(t,e)}})}},setRemoting(DataAccessObject.upsert,{description:"Update an existing model instance or insert a new one into the data source",accepts:{arg:"data",type:"object",description:"Model instance data",http:{source:"body"}},returns:{arg:"data",type:"object",root:!0},http:{verb:"put",path:"/"}}),DataAccessObject.findOrCreate=function(t,e,i){void 0===t&&(t={where:{}}),("function"==typeof e||"undefined"==typeof e)&&(i=e,e=t&&t.where),"undefined"==typeof i&&(i=function(){});var n=this;this.findOne(t,function(t,r){return t?i(t):r?i(null,r):void n.create(e,i)})},DataAccessObject.exists=function(t,e){stillConnecting(this.getDataSource(),this,arguments)||(void 0!==t&&null!==t&&""!==t?this.dataSource.connector.exists(this.modelName,t,e):e(new Error("Model::exists requires the id argument")))},setRemoting(DataAccessObject.exists,{description:"Check whether a model instance exists in the data source",accepts:{arg:"id",type:"any",description:"Model id",required:!0},returns:{arg:"exists",type:"any"},http:{verb:"get",path:"/:id/exists"}}),DataAccessObject.findById=function(t,e){stillConnecting(this.getDataSource(),this,arguments)||this.getDataSource().connector.find(this.modelName,t,function(i,n){var r=null;n&&(getIdValue(this,n)||setIdValue(this,n,t),r=new this,r._initProperties(n)),e(i,r)}.bind(this))},setRemoting(DataAccessObject.findById,{description:"Find a model instance by id from the data source",accepts:{arg:"id",type:"any",description:"Model id",required:!0},returns:{arg:"data",type:"any",root:!0},http:{verb:"get",path:"/:id"},rest:{after:convertNullToNotFoundError}}),DataAccessObject.all=function(){DataAccessObject.find.apply(this,arguments)};var operators={gt:">",gte:">=",lt:"<",lte:"<=",between:"BETWEEN",inq:"IN",nin:"NOT IN",neq:"!=",like:"LIKE",nlike:"NOT LIKE"};DataAccessObject._coerce=function(t){if(!t)return t;var e=this.getDataSource().getModelDefinition(this.modelName).properties;for(var i in t){var n=e[i]&&e[i].type;if(n){if((Array.isArray(n)||n===Array)&&(n=n[0]),n===Date){var r=Date;n=function(t){return new r(t)}}else n===Boolean?n=function(t){return"true"===t?!0:"false"===t?!1:Boolean(t)}:n===Number&&(n=function(t){var e=Number(t);return isNaN(e)?t:e});if(n&&n!==geo.GeoPoint){var a=t[i];if(null!==a&&void 0!==a){var o=null;if("object"==typeof a){if(1!==Object.keys(a).length)continue;for(var c in operators)if(c in a){a=a[c],o=c;break}}if(Array.isArray(a))for(var s=0;s<a.length;s++)a[s]=n(a[s]);else a=n(a);if(o){var u={};u[o]=a,a=u}t[i]=a}}}}return t},DataAccessObject.find=function(t,e){if(!stillConnecting(this.getDataSource(),this,arguments)){1===arguments.length&&(e=t,t=null);var i=this;t=t||{},t.where&&(t.where=this._coerce(t.where));var n=t.fields,r=t&&geo.nearFilter(t.where),a=!!this.getDataSource().connector.buildNearFilter;if(n&&(t.fields=fieldsToArray(n,Object.keys(this.definition.properties))),t=removeUndefined(t),r)if(a)this.getDataSource().connector.buildNearFilter(t,r);else if(t.where)return void this.getDataSource().connector.all(this.modelName,{},function(n,r){var a=new Memory,o=i.modelName;n?e(n):Array.isArray(r)?(a.define({properties:i.dataSource.definitions[i.modelName].properties,settings:i.dataSource.definitions[i.modelName].settings,model:i}),r.forEach(function(t){a.create(o,t,function(){})}),a.all(o,t,e)):e(null,[])}.bind(this));this.getDataSource().connector.all(this.modelName,t,function(n,o){o&&o.forEach?(o.forEach(function(e,n){var r=new i;if(r._initProperties(e,{fields:t.fields}),t&&t.include)if(t.collect)r=r.__cachedRelations[t.collect];else{var a=t.include||[];"string"==typeof a?a=[a]:Array.isArray(a)||"object"!=typeof a||(a=Object.keys(a)),a.forEach(function(t){var e=r.__cachedRelations[t];Array.isArray(e)&&(e=new List(e,null,r)),r.__data[t]=e}),delete r.__data.__cachedRelations}o[n]=r}),o&&o.countBeforeLimit&&(o.countBeforeLimit=o.countBeforeLimit),!a&&r&&(o=geo.filter(o,r)),e(n,o)):e(n,[])})}},setRemoting(DataAccessObject.find,{description:"Find all instances of the model matched by filter from the data source",accepts:{arg:"filter",type:"object",description:"Filter defining fields, where, orderBy, offset, and limit"},returns:{arg:"data",type:"array",root:!0},http:{verb:"get",path:"/"}}),DataAccessObject.findOne=function(t,e){stillConnecting(this.getDataSource(),this,arguments)||("function"==typeof t&&(e=t,t={}),t=t||{},t.limit=1,this.find(t,function(t,i){return t||!i||!i.length>0?e(t,null):void e(t,i[0])}))},setRemoting(DataAccessObject.findOne,{description:"Find first instance of the model matched by filter from the data source",accepts:{arg:"filter",type:"object",description:"Filter defining fields, where, orderBy, offset, and limit"},returns:{arg:"data",type:"object",root:!0},http:{verb:"get",path:"/findOne"}}),DataAccessObject.remove=DataAccessObject.deleteAll=DataAccessObject.destroyAll=function(t,e){if(!stillConnecting(this.getDataSource(),this,arguments)){var i=this;e||"function"!=typeof t||(e=t,t=void 0),t?(t=removeUndefined(t),t=this._coerce(t),this.getDataSource().connector.destroyAll(this.modelName,t,function(n,r){e&&e(n,r),n||i.emit("deletedAll",t)}.bind(this))):this.getDataSource().connector.destroyAll(this.modelName,function(t,n){e&&e(t,n),t||i.emit("deletedAll")}.bind(this))}},DataAccessObject.removeById=DataAccessObject.deleteById=DataAccessObject.destroyById=function(t,e){if(!stillConnecting(this.getDataSource(),this,arguments)){var i=this;this.getDataSource().connector.destroy(this.modelName,t,function(n){"function"==typeof e&&e(n),n||i.emit("deleted",t)}.bind(this))}},setRemoting(DataAccessObject.deleteById,{description:"Delete a model instance by id from the data source",accepts:{arg:"id",type:"any",description:"Model id",required:!0},http:{verb:"del",path:"/:id"}}),DataAccessObject.count=function(t,e){stillConnecting(this.getDataSource(),this,arguments)||("function"==typeof t&&(e=t,t=null),t=removeUndefined(t),t=this._coerce(t),this.getDataSource().connector.count(this.modelName,e,t))},setRemoting(DataAccessObject.count,{description:"Count instances of the model matched by where from the data source",accepts:{arg:"where",type:"object",description:"Criteria to match model instances"},returns:{arg:"count",type:"number"},http:{verb:"get",path:"/count"}}),DataAccessObject.prototype.save=function(t,e){function i(){r.trigger("save",function(t){r.trigger("update",function(i){r._adapter().save(o,r.constructor._forDB(a),function(o){return o?e(o,r):(r._initProperties(a),void i.call(r,function(){t.call(r,function(){e(o,r),o||n.emit("changed",r)})}))})},a)},a)}if(!stillConnecting(this.getDataSource(),this,arguments)){var n=this.constructor;"function"==typeof t&&(e=t,t={}),e=e||function(){},t=t||{},"validate"in t||(t.validate=!0),"throws"in t||(t.throws=!1);var r=this,a=r.toObject(!0),o=n.modelName;return getIdValue(n,this)?t.validate?void r.isValid(function(n){if(n)i();else{var a=new ValidationError(r);if(t.throws)throw a;e(a,r)}}):i():n.create(this,e)}},DataAccessObject.prototype.isNewRecord=function(){return!getIdValue(this.constructor,this)},DataAccessObject.prototype._adapter=function(){return this.getDataSource().connector},DataAccessObject.prototype.remove=DataAccessObject.prototype.delete=DataAccessObject.prototype.destroy=function(t){if(!stillConnecting(this.getDataSource(),this,arguments)){var e=this.constructor,i=getIdValue(this.constructor,this);this.trigger("destroy",function(n){this._adapter().destroy(this.constructor.modelName,i,function(r){return r?t(r):void n(function(){t&&t(),e.emit("deleted",i)})}.bind(this))})}},DataAccessObject.prototype.updateAttribute=function(t,e,i){var n={};n[t]=e,this.updateAttributes(n,i)},DataAccessObject.prototype.updateAttributes=function(t,e){if(!stillConnecting(this.getDataSource(),this,arguments)){var i=this,n=this.constructor,r=n.modelName;"function"==typeof t&&(e=t,t=null),t||(t={});for(var a in t)i[a]=t[a];i.isValid(function(a){a?i.trigger("save",function(a){i.trigger("update",function(o){var c={};for(var s in t)i[s]=t[s],c[s]=i[s];i._adapter().updateAttributes(r,getIdValue(i.constructor,i),i.constructor._forDB(c),function(r){if(!r)for(var c in t)i.__dataWas[c]=i.__data[c];o.call(i,function(){a.call(i,function(){e&&e(r,i),r||n.emit("changed",i)})})})},t)},t):e&&e(new ValidationError(i),i)},t)}},setRemoting(DataAccessObject.prototype.updateAttributes,{description:"Update attributes for a model instance and persist it into the data source",accepts:{arg:"data",type:"object",http:{source:"body"},description:"An object of model property name/value pairs"},returns:{arg:"data",type:"object",root:!0},http:{verb:"put",path:"/"}}),DataAccessObject.prototype.reload=function(t){stillConnecting(this.getDataSource(),this,arguments)||this.constructor.findById(getIdValue(this.constructor,this),t)};var defineScope=require("./scope.js").defineScope;DataAccessObject.scope=function(t,e,i){defineScope(this,i||this,t,e)},jutil.mixin(DataAccessObject,Inclusion),jutil.mixin(DataAccessObject,Relation);
},{"./connectors/memory":77,"./geo":80,"./include.js":82,"./jutil":84,"./list.js":85,"./relations.js":89,"./scope.js":90,"./utils":92,"./validations.js":93}],79:[function(require,module,exports){
(function(e){function t(e,o,n){if(!(this instanceof t))return new t(e,o);"object"==typeof e&&void 0===o&&(o=e,e=void 0),"string"==typeof e&&-1!==e.indexOf("://")&&(e=u.parseSettings(e)),"string"==typeof o&&-1!==o.indexOf("://")&&(o=u.parseSettings(o)),this.modelBuilder=n||new d,this.models=this.modelBuilder.models,this.definitions=this.modelBuilder.definitions,this._operations={},this.setup(e,o),this._setupConnector();var i=this.connector,r=i&&i.DataAccessObject||this.constructor.DataAccessObject;this.DataAccessObject=function(){},Object.keys(r).forEach(function(e){var t=r[e];this.DataAccessObject[e]=t,"function"==typeof t&&this.defineOperation(e,{accepts:t.accepts,returns:t.returns,http:t.http,remoteEnabled:t.shared?!0:!1,scope:this.DataAccessObject,fnName:e})}.bind(this)),Object.keys(r.prototype).forEach(function(e){var t=r.prototype[e];this.DataAccessObject.prototype[e]=t,"function"==typeof t&&this.defineOperation(e,{prototype:!0,accepts:t.accepts,returns:t.returns,http:t.http,remoteEnabled:t.shared?!0:!1,scope:this.DataAccessObject.prototype,fnName:e})}.bind(this))}function o(e){var t=[];return e.match(/^\//)||(t.push("./connectors/"+e),0!==e.indexOf("loopback-connector-")&&t.push("loopback-connector-"+e)),-1===["mongodb","oracle","mysql","postgresql","mssql","rest","soap"].indexOf(e)&&t.push(e),t}function n(e,t){var o;t=t||require;for(var n=0;n<e.length;n++){try{o=t(e[n])}catch(i){}if(o)break}return o}function i(e){return e?e.prototype instanceof f:!1}function r(e){return e&&!e.settings.unresolved&&e.dataSource instanceof t}function c(e){return e?e.charAt(0).toUpperCase()+(e.length>1?e.slice(1).toLowerCase():""):e}function s(e,t){if(!e)return e;var o=e.split(/-|_/);o[0]=t?o[0].toLowerCase():c(o[0]);for(var n=1;n<o.length;n++)o[n]=c(o[n]);return o.join("")}function a(e,t,o){Object.defineProperty(e,t,{writable:!1,enumerable:!1,configurable:!1,value:o})}var d=require("./model-builder.js").ModelBuilder,l=require("./model-definition.js"),p=require("./jutil"),u=require("./utils"),f=require("./model.js"),h=require("./dao.js"),y=require("./scope.js").defineScope,m=require("events").EventEmitter,v=require("util"),g=require("assert"),b=require("async");"loopback"===e.env.DEBUG&&(e.env.DEBUG="loopback:*");var N=require("debug")("loopback:datasource");exports.DataSource=t;var S=Array.prototype.slice;v.inherits(t,m),t.DataAccessObject=h,t.prototype._setupConnector=function(){if(this.connector=this.connector||this.adapter,this.adapter=this.connector,this.connector){this.connector.dataSource||(this.connector.dataSource=this);var e=this;this.connector.log=function(t,o){e.log(t,o)},this.connector.logger=function(e){var t=Date.now(),o=this.log;return function(n){o(n||e,t)}}}},t._resolveConnector=function(e,t){var i=o(e),r=n(i,t),c=null;return r||(c='\nWARNING: LoopBack connector "'+e+'" is not installed at any of the locations '+i+". To fix, run:\n\n npm install "+e+"\n"),{connector:r,error:c}},t.prototype.setup=function(o,n){var i,r=this;if(o&&"object"==typeof o&&!n&&(n=o,o=void 0),"object"==typeof n&&(n.initialize?i=n:n.connector?i=n.connector:n.adapter&&(i=n.adapter)),this.settings=n||{},this.settings.debug=this.settings.debug||N.enabled,this.settings.debug&&N("Settings: %j",this.settings),this.connected=!1,this.connecting=!1,"string"==typeof i&&(o=i,i=void 0),o=o||i&&i.name,this.name=o,o&&!i)if("object"==typeof o)i=o,this.name=i.name;else{var c=t._resolveConnector(o);if(i=c.connector,!i)return void console.error(c.error)}if(i){var s=function(e){if(this._setupConnector(),!this.connector)throw new Error("Connector is not defined correctly: it should create `connector` member of dataSource");this.connected=!e,this.connected?this.emit("connected"):(console.error("Connection fails: ",e,"\nIt will be retried for the next request."),this.connecting=!1)}.bind(this);"function"==typeof i.initialize?i.initialize(this,s):"function"==typeof i&&(this.connector=new i(this.settings),s())}r.connect=function(t){var o=this;return o.connected||o.connecting?void e.nextTick(function(){t&&t()}):(o.connecting=!0,void(o.connector.connect?o.connector.connect(function(e,n){e?(o.connected=!1,o.connecting=!1,o.emit("error",e)):(o.connected=!0,o.connecting=!1,o.emit("connected")),t&&t(e,n)}):e.nextTick(function(){o.connected=!0,o.connecting=!1,o.emit("connected"),t&&t()})))}},t.relationTypes=["belongsTo","hasMany","hasAndBelongsToMany"],t.prototype.defineScopes=function(e,t){if(t)for(var o in t)y(e,e,o,t[o])},t.prototype.defineRelations=function(e,o){var n=function(t,o,n,i){r(n)||n.once("dataSourceAttached",function(n){if(!i||r(i)){var c={foreignKey:o.foreignKey,as:t,model:n};i&&(c.through=i),e[o.type].call(e,t,c)}}),i&&!r(i)&&i.once("dataSourceAttached",function(i){if(r(n)){var c={foreignKey:o.foreignKey,as:t,model:n,through:i};e[o.type].call(e,t,c)}})};if(o)for(var c in o){var s=o[c];g(-1!==t.relationTypes.indexOf(s.type),"Invalid relation type: "+s.type);var a=i(s.model)?s.model:this.getModel(s.model,!0),d=null;if(s.through&&(d=i(s.through)?s.through:this.getModel(s.through,!0)),!r(a)||d&&!r(d))n(c,s,a,d);else{var l={foreignKey:s.foreignKey,as:c,model:a};d&&(l.through=d),e[s.type].call(e,c,l)}}},t.prototype.setupDataAccess=function(e,t){if(this.connector){var o=e.definition.idName(),n=e.definition.rawProperties[o];if(n&&n.generated&&this.connector.getDefaultIdType){var i=this.connector.getDefaultIdType()||String;n.type=i,e.definition.properties[o].type=i}this.connector.define&&this.connector.define({model:e,properties:e.definition.properties,settings:t})}this.mixin(e);var r=t.relationships||t.relations;this.defineRelations(e,r);var c=t.scopes||{};this.defineScopes(e,c)},t.prototype.createModel=t.prototype.define=function(e,t,o){var n=S.call(arguments);if(!e)throw new Error("Class name required");1===n.length&&(t={},n.push(t)),2===n.length&&(o={},n.push(o)),t=t||{},o=o||{},this.isRelational()&&((void 0===o.strict||null===o.strict)&&(o.strict=!0),o.strict===!1&&(o.strict="throw"));var i=this.modelBuilder.define(e,t,o);return i.dataSource=this,o.unresolved?i:(this.setupDataAccess(i,o),i.emit("dataSourceAttached",i),i)},t.prototype.mixin=function(e){var t=this.operations(),o=this.DataAccessObject;p.mixin(e,o,{proxyFunctions:!0,override:!0}),Object.keys(t).forEach(function(o){var n,i=t[o];i.enabled&&(n=i.prototype?e.prototype:e,Object.keys(i).filter(function(e){return~["scope","fnName","prototype"].indexOf(e)}).forEach(function(e){"undefined"!=typeof i[e]&&(i.scope[i.fnName][e]=i[e])}))})},t.prototype.getModel=function(e,t){return this.modelBuilder.getModel(e,t)},t.prototype.getModelDefinition=function(e){return this.modelBuilder.getModelDefinition(e)},t.prototype.getTypes=function(){var e=this.connector&&this.connector.getTypes()||[];return"string"==typeof e&&(e=e.split(/[\s,\/]+/)),e},t.prototype.supportTypes=function(e){var t=this.getTypes();if(Array.isArray(e)){for(var o=0;o<e.length;o++)if(-1===t.indexOf(e[o]))return!1;return!0}return-1!==t.indexOf(e)},t.prototype.attach=function(e){return e.dataSource===this?e:(e.modelBuilder!==this.modelBuilder&&(this.modelBuilder.definitions[e.modelName]=e.definition,this.modelBuilder.models[e.modelName]=e,e.modelBuilder=this.modelBuilder),e.dataSource=this,this.setupDataAccess(e,e.settings),e.emit("dataSourceAttached",e),e)},t.prototype.defineProperty=function(e,t,o){this.modelBuilder.defineProperty(e,t,o);var n=this.getModelDefinition(e).properties[t];this.connector&&this.connector.defineProperty&&this.connector.defineProperty(e,t,n)},t.prototype.automigrate=function(t,o){this.freeze(),this.connector.automigrate?this.connector.automigrate(t,o):(o||"function"!=typeof t||(o=t,t=void 0),o&&e.nextTick(o))},t.prototype.autoupdate=function(t,o){this.freeze(),this.connector.autoupdate?this.connector.autoupdate(t,o):(o||"function"!=typeof t||(o=t,t=void 0),o&&e.nextTick(o))},t.prototype.discoverModelDefinitions=function(t,o){this.freeze(),this.connector.discoverModelDefinitions?this.connector.discoverModelDefinitions(t,o):o&&e.nextTick(o)},t.prototype.discoverModelDefinitionsSync=function(e){return this.freeze(),this.connector.discoverModelDefinitionsSync?this.connector.discoverModelDefinitionsSync(e):null},t.prototype.discoverModelProperties=function(t,o,n){this.freeze(),this.connector.discoverModelProperties?this.connector.discoverModelProperties(t,o,n):n&&e.nextTick(n)},t.prototype.discoverModelPropertiesSync=function(e,t){return this.freeze(),this.connector.discoverModelPropertiesSync?this.connector.discoverModelPropertiesSync(e,t):null},t.prototype.discoverPrimaryKeys=function(t,o,n){this.freeze(),this.connector.discoverPrimaryKeys?this.connector.discoverPrimaryKeys(t,o,n):n&&e.nextTick(n)},t.prototype.discoverPrimaryKeysSync=function(e,t){return this.freeze(),this.connector.discoverPrimaryKeysSync?this.connector.discoverPrimaryKeysSync(e,t):null},t.prototype.discoverForeignKeys=function(t,o,n){this.freeze(),this.connector.discoverForeignKeys?this.connector.discoverForeignKeys(t,o,n):n&&e.nextTick(n)},t.prototype.discoverForeignKeysSync=function(e,t){return this.freeze(),this.connector.discoverForeignKeysSync?this.connector.discoverForeignKeysSync(e,t):null},t.prototype.discoverExportedForeignKeys=function(t,o,n){this.freeze(),this.connector.discoverExportedForeignKeys?this.connector.discoverExportedForeignKeys(t,o,n):n&&e.nextTick(n)},t.prototype.discoverExportedForeignKeysSync=function(e,t){return this.freeze(),this.connector.discoverExportedForeignKeysSync?this.connector.discoverExportedForeignKeysSync(e,t):null},t.prototype.discoverSchema=function(e,t,o){t=t||{},o||"function"!=typeof t||(o=t,t={}),t.visited={},t.relations=!1,this.discoverSchemas(e,t,function(e,t){if(e)return void(o&&o(e,t));for(var n in t)return void(o&&o(null,t[n]))})},t.prototype.discoverSchemas=function(e,o,n){o=o||{},n||"function"!=typeof o||(n=o,o={});var i=this,r=this.connector.name||this.name,c=[this.discoverModelProperties.bind(this,e,o),this.discoverPrimaryKeys.bind(this,e,o)],a=o.associations||o.relations;a&&c.push(this.discoverForeignKeys.bind(this,e,o)),b.parallel(c,function(c,d){if(c)return void(n&&n(c));var l=d[0];if(!l||0===l.length)return void(n&&n());var p=d[1],u={};p.forEach(function(e){u[e.columnName]=e.keySeq}),i.settings.debug&&N("Primary keys: ",u);var f={name:s(e,!1),options:{idInjection:!1},properties:{}};f.options[r]={schema:l[0].owner,table:e},l.forEach(function(e){var t=e,o=s(e.columnName,!0);f.properties[o]={type:e.type,required:"N"===e.nullable,length:e.dataLength,precision:e.dataPrecision,scale:e.dataScale},u[e.columnName]&&(f.properties[o].id=u[e.columnName]),f.properties[o][r]={columnName:t.columnName,dataType:t.dataType,dataLength:t.dataLength,dataPrecision:e.dataPrecision,dataScale:e.dataScale,nullable:t.nullable}}),o.visited=o.visited||{};var h=l[0].owner+"."+e;o.visited.hasOwnProperty(h)||(i.settings.debug&&N("Adding schema for "+h),o.visited[h]=f);var y={};if(a){var m={},v=d[2];v.forEach(function(e){var t={keySeq:e.keySeq,owner:e.pkOwner,tableName:e.pkTableName,columnName:e.pkColumnName};m[e.fkName]?m[e.fkName].push(t):m[e.fkName]=[t]}),i.settings.debug&&N("Foreign keys: ",m),f.options.relations={},v.forEach(function(e){var t=s(e.pkTableName,!0);f.options.relations[t]={model:s(e.pkTableName,!1),type:"belongsTo",foreignKey:s(e.fkColumnName,!0)};var n=e.pkOwner+"."+e.pkTableName;o.visited.hasOwnProperty(n)||y.hasOwnProperty(n)||(y[n]={owner:e.pkOwner,tableName:e.pkTableName})})}if(0===Object.keys(y).length)n&&n(null,o.visited);else{var g=[];for(var S in y){i.settings.debug&&N("Discovering related schema for "+h);var k={};for(var w in o)k[w]=o[w];k.owner=y[S].owner,g.push(t.prototype.discoverSchemas.bind(i,y[S].tableName,k))}b.parallel(g,function(e,t){var o=t&&t[0];n&&n(e,o)})}})},t.prototype.discoverSchemasSync=function(e,t){var o=this,n=this.name||this.connector.name,i=this.discoverModelPropertiesSync(e,t);if(!i||0===i.length)return[];var r=this.discoverPrimaryKeysSync(e,t),c={};r.forEach(function(e){c[e.columnName]=e.keySeq}),o.settings.debug&&N("Primary keys: ",c);var a={name:s(e,!1),options:{idInjection:!1},properties:{}};a.options[n]={schema:i.length>0&&i[0].owner,table:e},i.forEach(function(e){var t=e,o=s(e.columnName,!0);a.properties[o]={type:e.type,required:"N"===e.nullable,length:e.dataLength,precision:e.dataPrecision,scale:e.dataScale},c[e.columnName]&&(a.properties[o].id=c[e.columnName]),a.properties[o][n]={columnName:t.columnName,dataType:t.dataType,dataLength:t.dataLength,dataPrecision:e.dataPrecision,dataScale:e.dataScale,nullable:t.nullable}}),t.visited=t.visited||{};var d=i[0].owner+"."+e;t.visited.hasOwnProperty(d)||(o.settings.debug&&N("Adding schema for "+d),t.visited[d]=a);var l={},p=t.associations||t.relations;if(p){var u={},f=this.discoverForeignKeysSync(e,t);f.forEach(function(e){var t={keySeq:e.keySeq,owner:e.pkOwner,tableName:e.pkTableName,columnName:e.pkColumnName};u[e.fkName]?u[e.fkName].push(t):u[e.fkName]=[t]}),o.settings.debug&&N("Foreign keys: ",u),a.options.relations={},f.forEach(function(e){var o=s(e.pkTableName,!0);a.options.relations[o]={model:s(e.pkTableName,!1),type:"belongsTo",foreignKey:s(e.fkColumnName,!0)};var n=e.pkOwner+"."+e.pkTableName;t.visited.hasOwnProperty(n)||l.hasOwnProperty(n)||(l[n]={owner:e.pkOwner,tableName:e.pkTableName})})}if(0===Object.keys(l).length)return t.visited;for(var h in l){o.settings.debug&&N("Discovering related schema for "+d);var y={};for(var m in t)y[m]=t[m];y.owner=l[h].owner,o.discoverSchemasSync(l[h].tableName,y)}return t.visited},t.prototype.discoverAndBuildModels=function(e,t,o){var n=this;this.discoverSchemas(e,t,function(e,t){if(e)return void(o&&o(e,t));var i=[];for(var r in t){var c=t[r];i.push(c)}var s=n.modelBuilder.buildModels(i);for(var a in s)s[a].attachTo(n);o&&o(e,s)})},t.prototype.discoverAndBuildModelsSync=function(e,t){var o=this.discoverSchemasSync(e,t),n=[];for(var i in o){var r=o[i];n.push(r)}var c=this.modelBuilder.buildModels(n);return c},t.prototype.isActual=function(t,o){this.freeze(),this.connector.isActual?this.connector.isActual(t,o):(o||"function"!=typeof t||(o=t,t=void 0),o&&e.nextTick(function(){o(null,!0)}))},t.prototype.log=function(e,t){N(e,t),this.emit("log",e,t)},t.prototype.freeze=function(){if(!this.connector)throw new Error("The connector has not been initialized.");this.connector.freezeDataSource&&this.connector.freezeDataSource(),this.connector.freezeSchema&&this.connector.freezeSchema()},t.prototype.tableName=function(e){return this.getModelDefinition(e).tableName(this.connector.name)},t.prototype.columnName=function(e,t){return this.getModelDefinition(e).columnName(this.connector.name,t)},t.prototype.columnMetadata=function(e,t){return this.getModelDefinition(e).columnMetadata(this.connector.name,t)},t.prototype.columnNames=function(e){return this.getModelDefinition(e).columnNames(this.connector.name)},t.prototype.idColumnName=function(e){return this.getModelDefinition(e).idColumnName(this.connector.name)},t.prototype.idName=function(e){return this.getModelDefinition(e).idName||console.error("No id name",this.getModelDefinition(e)),this.getModelDefinition(e).idName()},t.prototype.idNames=function(e){return this.getModelDefinition(e).idNames()},t.prototype.idProperty=function(e){var t=this.getModelDefinition(e),o=t&&t.ids();return o&&o[0]&&o[0].property},t.prototype.defineForeignKey=function(e,t,o){if(!this.getModelDefinition(e).rawProperties[t]){var n=Number;if(o){var i=this.getModelDefinition(o),r=i&&i.idName();r&&(n=i.properties[r].type)}if(this.connector.defineForeignKey){var c=function(o,i){if(o)throw o;this.defineProperty(e,t,{type:i||n})}.bind(this);switch(this.connector.defineForeignKey.length){case 4:this.connector.defineForeignKey(e,t,o,c);break;default:case 3:this.connector.defineForeignKey(e,t,c)}}else this.defineProperty(e,t,{type:n})}},t.prototype.disconnect=function(t){var o=this;this.connected&&"function"==typeof this.connector.disconnect?this.connector.disconnect(function(e,n){o.connected=!1,t&&t(e,n)}):e.nextTick(function(){t&&t()})},t.prototype.copyModel=function(e){var t=this,o=e.modelName,n=e.modelBuilder.getModelDefinition(o),i=function(){e.apply(this,[].slice.call(arguments))};return v.inherits(i,e),i.__proto__=e,a(i,"dataSource",t),a(i,"modelName",o),a(i,"relations",e.relations),o in t.modelBuilder.models||(t.modelBuilder.models[o]=i,t.modelBuilder.definitions[o]=new l(t.modelBuilder,n.name,n.properties,n.settings),!t.isTransaction&&t.connector&&t.connector.define&&t.connector.define({model:i,properties:n.properties,settings:n.settings})),i},t.prototype.transaction=function(){var e=this,t=new m;for(var o in e)t[o]=e[o];t.isTransaction=!0,t.origin=e,t.name=e.name,t.settings=e.settings,t.connected=!1,t.connecting=!1,t.connector=e.connector.transaction(),t.modelBuilder=new d,t.models=t.modelBuilder.models,t.definitions=t.modelBuilder.definitions;for(var n in e.modelBuilder.models)e.copyModel.call(t,e.modelBuilder.models[n]);return t.exec=function(e){t.connector.exec(e)},t},t.prototype.enableRemote=function(e){var t=this.getOperation(e);if(!t)throw new Error(e+" is not provided by the attached connector");t.remoteEnabled=!0},t.prototype.disableRemote=function(e){var t=this.getOperation(e);if(!t)throw new Error(e+" is not provided by the attached connector");t.remoteEnabled=!1},t.prototype.getOperation=function(e){for(var t=this.operations(),o=Object.keys(t),n=0;n<o.length;n++){var i=t[o[n]];if(i.name===e)return i}},t.prototype.operations=function(){return this._operations},t.prototype.defineOperation=function(e,t,o){t.fn=o,t.name=e,this._operations[e]=t},t.prototype.isRelational=function(){return this.connector&&this.connector.relational},t.prototype.ready=function(e,t){var o=this;if(this.connected)return!1;var n=t.callee,i=null,r=null;return i=function(){o.removeListener("error",r),n.apply(e,[].slice.call(t))},r=function(e){o.removeListener("connected",i);var n=[].slice.call(t),r=n.pop();"function"==typeof r&&r(e)},this.once("connected",i),this.once("error",r),this.connecting||this.connect(),!0},t.Text=d.Text,t.JSON=d.JSON,t.Any=d.Any,t.registerType=function(e){d.registerType(e)}}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"./dao.js":78,"./jutil":84,"./model-builder.js":86,"./model-definition.js":87,"./model.js":88,"./scope.js":90,"./utils":92,"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"assert":11,"async":94,"debug":95,"events":24,"util":46}],80:[function(require,module,exports){
function GeoPoint(t){return this instanceof GeoPoint?("string"==typeof t&&(t=t.split(/,\s*/),assert(2===t.length,'must provide a string "lng,lat" creating a GeoPoint with a string')),Array.isArray(t)?t={lng:Number(t[0]),lat:Number(t[1])}:(t.lng=Number(t.lng),t.lat=Number(t.lat)),assert("object"==typeof t,"must provide a lat and lng object when creating a GeoPoint"),assert("number"==typeof t.lat&&!isNaN(t.lat),"lat must be a number when creating a GeoPoint"),assert("number"==typeof t.lng&&!isNaN(t.lng),"lng must be a number when creating a GeoPoint"),assert(t.lng<=180,"lng must be <= 180"),assert(t.lng>=-180,"lng must be >= -180"),assert(t.lat<=90,"lat must be <= 90"),assert(t.lat>=-90,"lat must be >= -90"),this.lat=t.lat,void(this.lng=t.lng)):new GeoPoint(t)}function geoDistance(t,e,n,a,o){t*=DEG2RAD,e*=DEG2RAD,n*=DEG2RAD,a*=DEG2RAD;var r=Math.pow(Math.sin((a-e)/2),2),i=Math.pow(Math.sin((n-t)/2),2),s=Math.sqrt(r+Math.cos(a)*Math.cos(e)*i),l=o&&o.type||"miles";return 2*Math.asin(s)*EARTH_RADIUS[l]}var assert=require("assert");exports.nearFilter=function(t){var e=!1;return t&&"object"==typeof t&&Object.keys(t).forEach(function(n){var a=t[n];a&&a.near&&(e={near:a.near,maxDistance:a.maxDistance,key:n})}),e},exports.filter=function(t,e){var n=e.near,a=e.maxDistance>0?e.maxDistance:!1,o=e.key,r={},i=[];return t.forEach(function(t){var e=t[o];if(e&&(e instanceof GeoPoint||(e=GeoPoint(e)),"number"==typeof e.lat&&"number"==typeof e.lng)){var s=GeoPoint.distanceBetween(n,e);a&&s>a||(r[t.id]=s,i.push(t))}}),i.sort(function(t,e){var n=e[o],a=e[o];if(n&&a){var i=r[t.id],s=r[e.id];return s===i?0:i>s?1:-1}return 0})},exports.GeoPoint=GeoPoint,GeoPoint.distanceBetween=function(t,e,n){t instanceof GeoPoint||(t=GeoPoint(t)),e instanceof GeoPoint||(e=GeoPoint(e));var a=t.lat,o=t.lng,r=e.lat,i=e.lng;return geoDistance(a,o,r,i,n)},GeoPoint.prototype.distanceTo=function(t,e){return GeoPoint.distanceBetween(this,t,e)},GeoPoint.prototype.toString=function(){return this.lng+","+this.lat};var PI=3.141592653589793,DEG2RAD=.01745329252,RAD2DEG=57.29577951308,EARTH_RADIUS={kilometers:6370.99056,meters:6370990.56,miles:3958.75,feet:20902200,radians:1,degrees:RAD2DEG};
},{"assert":11}],81:[function(require,module,exports){
function Hookable(){}function capitalize(o){return o.charAt(0).toUpperCase()+o.slice(1)}module.exports=Hookable,Hookable.afterInitialize=null,Hookable.beforeValidate=null,Hookable.afterValidate=null,Hookable.beforeSave=null,Hookable.afterSave=null,Hookable.beforeCreate=null,Hookable.afterCreate=null,Hookable.beforeUpdate=null,Hookable.afterUpdate=null,Hookable.beforeDestroy=null,Hookable.afterDestroy=null,Hookable.prototype.trigger=function(o,e,l){function t(o){n?n.call(i,o):o&&o.call(this)}var a=capitalize(o),r=this.constructor["before"+a]||this.constructor["pre"+a],n=this.constructor["after"+a]||this.constructor["post"+a];"validate"===o&&(r=r||this.constructor.beforeValidation,n=n||this.constructor.afterValidation);var i=this;e?r?r.call(i,function(){e.call(i,t)},l):e.call(i,t):t()};
},{}],82:[function(require,module,exports){
(function(e){function n(){}var r=require("async"),o=require("./utils"),t=o.isPlainObject,i=o.defineCachedRelations;module.exports=n,n.include=function(n,o,l){function u(e){if("string"==typeof e)return[e];if(t(e)){var n=[];for(var r in e){var o={};o[r]=e[r],n.push(o)}return n}return e}function a(e,n,o){var l,u,a=c.relations;t(n)?(l=Object.keys(n)[0],u=n[l]):(l=n,u=null);var s=a[l];return s?void r.each(e,function(e,n){if("belongsTo"===s.type&&(null===e[s.keyFrom]||void 0===e[s.keyFrom]))return i(e),e.__cachedRelations[l]=null,e===r?e.__data[l]=null:e[l]=null,n();var r=e instanceof c?e:new c(e);r[l](function(o,t){if(o)return n(o);if(i(e),e.__cachedRelations[l]=t,e===r?(e.__data[l]=t,e.strict=!1):e[l]=t,u&&t){var a=s.multiple?t:[t];s.modelTo.include(a,u,n)}else n(null,t)})},o):function(){o(new Error('Relation "'+l+'" is not defined for '+c.modelName+" model"))}}var c=this;return!o||Array.isArray(o)&&0===o.length||t(o)&&0===Object.keys(o).length?e.nextTick(function(){l&&l(null,n)}):(o=u(o),void r.each(o,function(e,r){a(n,e,r)},function(e){l&&l(e,n)}))}}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"./utils":92,"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"async":94}],83:[function(require,module,exports){
module.exports=function(r){function n(e){if(null===e||void 0===e)return r.Any;for(var t in r.schemaTypes){var a=r.schemaTypes[t];if(a!==Object&&a!==Array&&e instanceof a)return t}var i=typeof e;if("string"===i||"number"===i||"boolean"===i)return i;if(e instanceof Date)return"date";if(Array.isArray(e)){for(var o=0;o<e.length;o++)if(null!==e[o]&&void 0!==e[o]){var f=n(e[o]);if(f)return[f]}return"array"}if("function"===i)return e.constructor.name;var u={};for(var c in e){var f=n(e[c]);f&&(u[c]=f)}return 0===Object.keys(u).length?"object":u}return n};
},{}],84:[function(require,module,exports){
function mixInto(e,t){var r=[];Object.keys(e).forEach(function(i,o){var n=t.hasOwnProperty(i),s=Object.getOwnPropertyDescriptor(e,i),p=n&&Object.getOwnPropertyDescriptor(t,i),c="function"==typeof s.value,a=n&&"function"==typeof p.value,u=a&&p.value._delegate,f=o.override||!n||u;f&&(c&&(s.value=exports.proxy(s.value,r)),Object.defineProperty(t,i,s))})}var util=require("util");exports.inherits=function(e,t,r){util.inherits(e,t),r=r||{staticProperties:!0,override:!1},r.staticProperties&&Object.keys(t).forEach(function(i){if("super_"!==i&&(!e.hasOwnProperty(i)||r.override)){var o=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,o)}})},exports.mixin=function(e,t,r){if(Array.isArray(e._mixins)){if(-1!==e._mixins.indexOf(t))return;e._mixins.push(t)}else e._mixins=[t];return r=r||{staticProperties:!0,instanceProperties:!0,override:!1,proxyFunctions:!1},void 0===r.staticProperties&&(r.staticProperties=!0),void 0===r.instanceProperties&&(r.instanceProperties=!0),r.staticProperties&&mixInto(t,e,r),r.instanceProperties&&t.prototype&&mixInto(t.prototype,e.prototype,r),e},exports.proxy=function(e,t){t=t||[];for(var r=0;r<t.length;r++)if(t[r]._delegate===e)return t[r];var i=function(){return e.apply(this,arguments)};return i._delegate=e,t.push(i),Object.keys(e).forEach(function(t){i[t]=e[t]}),i};
},{"util":46}],85:[function(require,module,exports){
function List(t,r,e){var i=this;if(!(i instanceof List))return new List(t,r,e);if("string"==typeof t)try{t=JSON.parse(t)}catch(o){throw new Error("could not create List from JSON string: ",t)}var n=[];if(n.__proto__=List.prototype,t=t||[],!Array.isArray(t))throw new Error("Items must be an array: "+t);return r||(r=t[0]&&t[0].constructor),Array.isArray(r)&&(r=r[0]),r===Array&&(r=Any),Object.defineProperty(n,"itemType",{writable:!0,enumerable:!1,value:r}),e&&Object.defineProperty(n,"parent",{writable:!0,enumerable:!1,value:e}),t.forEach(function(t,e){n[e]=!r||t instanceof r?t:r(t)}),n}var util=require("util"),Any=require("./types").Types.Any;module.exports=List,util.inherits(List,Array);var _push=List.prototype.push;List.prototype.push=function(t){var r=this.itemType&&t instanceof this.itemType?t:this.itemType(t);return _push.call(this,r),r},List.prototype.toObject=function(t){var r=[];return this.forEach(function(e){r.push(e.toObject?e.toObject(t):e)}),r},List.prototype.toJSON=function(){return this.toObject(!0)},List.prototype.toString=function(){return JSON.stringify(this.toJSON())};
},{"./types":91,"util":46}],86:[function(require,module,exports){
function ModelBuilder(){this.models={},this.definitions={}}function isModelClass(e){return e?e.prototype instanceof DefaultModelBaseClass:!1}function hiddenProperty(e,t,r){Object.defineProperty(e,t,{writable:!0,enumerable:!1,configurable:!0,value:r})}var inflection=require("inflection"),EventEmitter=require("events").EventEmitter,util=require("util"),assert=require("assert"),DefaultModelBaseClass=require("./model.js"),List=require("./list.js"),ModelDefinition=require("./model-definition.js"),mergeSettings=require("./utils").mergeSettings;require("./types")(ModelBuilder);var introspect=require("./introspection")(ModelBuilder);exports.ModelBuilder=exports.Schema=ModelBuilder;var slice=Array.prototype.slice;util.inherits(ModelBuilder,EventEmitter),ModelBuilder.defaultInstance=new ModelBuilder,ModelBuilder.prototype.getModel=function(e,t){var r=this.models[e];return!r&&t&&(r=this.define(e,{},{unresolved:!0})),r},ModelBuilder.prototype.getModelDefinition=function(e){return this.definitions[e]},ModelBuilder.prototype.define=function(e,t,r,i){var n=this,o=slice.call(arguments),s=r&&r.plural||inflection.pluralize(e);if(!e)throw new Error("Class name required");1===o.length&&(t={},o.push(t)),2===o.length&&(r={},o.push(r)),t=t||{},r=r||{},(void 0===r.strict||null===r.strict)&&(r.strict=!1);var a=i||DefaultModelBaseClass,d=r.base||r["super"];d&&(isModelClass(d)?a=d:(a=this.models[d],assert(a,"Base model is not found: "+d)));var l=this.models[e];if(!l||!l.settings.unresolved){l=function v(e,t){if(!(this instanceof v))return new v(e,t);if(l.settings.unresolved)throw new Error("Model "+l.modelName+" is not defined.");a.apply(this,arguments)};var u=new EventEmitter;for(var p in EventEmitter.prototype)"function"==typeof EventEmitter.prototype[p]&&(l[p]=EventEmitter.prototype[p].bind(u));hiddenProperty(l,"modelName",e)}if(util.inherits(l,a),this.models[e]=l,r.unresolved)return l.settings={unresolved:!0},l;hiddenProperty(l,"modelBuilder",n),hiddenProperty(l,"dataSource",n),hiddenProperty(l,"pluralModelName",s),hiddenProperty(l,"relations",{}),hiddenProperty(l,"http",{path:"/"+s});for(var f in a)"_mixins"===f||f in l||(l[f]=a[f]);r.models&&Object.keys(r.models).forEach(function(e){var t=r.models[e];l[e]="string"==typeof t?n.getModel(t,!0):t}),l.getter={},l.setter={};var c=new ModelDefinition(this,e,t,r);this.definitions[e]=c,l.definition=c,l.settings=c.settings;var h=r.idInjection;h!==!1&&(h=!0);var y=c.idNames();if(y.length>0&&(h=!1),h&&l.definition.defineProperty("id",{type:Number,id:1,generated:!0}),y=c.idNames(),1===y.length){var m=y[0];"id"!==m&&Object.defineProperty(l.prototype,"id",{get:function(){var e=l.definition.idNames[0];return this.__data[e]},configurable:!0,enumerable:!1})}else Object.defineProperty(l.prototype,"id",{get:function(){var e={},t=l.definition.idNames();for(var r in t)e[r]=this.__data[r];return e},configurable:!0,enumerable:!1});return l.forEachProperty=function(e){Object.keys(l.definition.properties).forEach(e)},l.attachTo=function(e){e.attach(this)},l.extend=function(e,t,r){var i=l.definition.properties,o=l.definition.settings;t=t||{},r=r||{};var s=!1;for(var a in t)if(t[a].id){s=!0;break}Object.keys(i).forEach(function(e){s&&i[e].id||void 0===t[e]&&(t[e]=i[e])}),r=mergeSettings(o,r);var d=n.define(e,t,r,l);return"function"==typeof d.setup&&d.setup.call(d),d},l.registerProperty=function(e){var t=c.build(),r=t[e],i=r.type;if(!i)throw new Error("Invalid type for property "+e);if(r.required){var o="object"==typeof r.required?r.required:void 0;l.validatesPresenceOf(e,o)}Object.defineProperty(l.prototype,e,{get:function(){return l.getter[e]?l.getter[e].call(this):this.__data&&this.__data[e]},set:function(r){var i=l.definition.properties[e].type;if(Array.isArray(i)||i===Array)i=List;else if("Date"===i.name){var o=Date;i=function(e){return new o(e)}}else"string"==typeof i&&(i=n.resolveType(i));l.setter[e]?l.setter[e].call(this,r):(this.__data||(this.__data={}),this.__data[e]=null===r||void 0===r?r:i===List?i(r,t[e].type,this.__data):r instanceof i?r:i(r))},configurable:!0,enumerable:!0}),Object.defineProperty(l.prototype,e+"$was",{get:function(){return this.__dataWas&&this.__dataWas[e]},configurable:!0,enumerable:!1}),Object.defineProperty(l.prototype,"$"+e,{get:function(){return this.__data&&this.__data[e]},set:function(t){this.__data||(this.__data={}),this.__data[e]=t},configurable:!0,enumerable:!1})},l.forEachProperty(l.registerProperty),l.emit("defined",l),l},ModelBuilder.prototype.defineProperty=function(e,t,r){this.definitions[e].defineProperty(t,r),this.models[e].registerProperty(t)},ModelBuilder.prototype.extendModel=function(e,t){var r=this;Object.keys(t).forEach(function(i){var n=t[i];r.defineProperty(e,i,n)})},ModelBuilder.prototype.copyModel=function(e){var t=this,r=e.modelName,i=e.modelBuilder.definitions[r],n=function(){e.apply(this,[].slice.call(arguments))};return util.inherits(n,e),n.__proto__=e,hiddenProperty(n,"modelBuilder",t),hiddenProperty(n,"modelName",r),hiddenProperty(n,"relations",e.relations),r in t.models||(t.models[r]=n,t.definitions[r]={properties:i.properties,settings:i.settings}),n},ModelBuilder.prototype.getSchemaName=function(e){return e?e:("number"!=typeof this._nameCount?this._nameCount=0:this._nameCount++,"AnonymousModel_"+this._nameCount)},ModelBuilder.prototype.resolveType=function(e){if(!e)return e;if(Array.isArray(e)&&e.length>0){var t=this.resolveType(e[0]);return"function"==typeof t?[t]:t}if("string"==typeof e){var r=ModelBuilder.schemaTypes[e.toLowerCase()]||this.models[e];return r?r:e=this.define(e,{},{unresolved:!0})}return"Object"===e.constructor.name?e.type?this.resolveType(e.type):this.define(this.getSchemaName(null),e,{anonymous:!0,idInjection:!1}):"function"==typeof e?e:e},ModelBuilder.prototype.buildModels=function(e){var t={};Array.isArray(e)||(e=e.properties&&e.name?[e]:[{name:this.getSchemaName(),properties:e,options:{anonymous:!0}}]);var r=[];for(var i in e){var n=this.getSchemaName(e[i].name);e[i].name=n;var o=this.define(e[i].name,e[i].properties,e[i].options);t[n]=o,r=r.concat(o.definition.relations)}for(var s=0;s<r.length;s++){var a=r[s],d=t[a.source],l=t[a.target];d&&l&&"function"==typeof d[a.type]&&d[a.type](l,{as:a.as})}return t},ModelBuilder.prototype.buildModelFromInstance=function(e,t,r){var i=introspect(t);return this.define(e,i,r)};
},{"./introspection":83,"./list.js":85,"./model-definition.js":87,"./model.js":88,"./types":91,"./utils":92,"assert":11,"events":24,"inflection":96,"util":46}],87:[function(require,module,exports){
function ModelDefinition(e,i,t,r){if(!(this instanceof ModelDefinition))return new ModelDefinition(e,i,t,r);if(this.modelBuilder=e||ModelBuilder.defaultInstance,assert(i,"name is missing"),2===arguments.length&&"object"==typeof i){var n=i;this.name=n.name,this.rawProperties=n.properties||{},this.settings=n.settings||{}}else assert("string"==typeof i,"name must be a string"),this.name=i,this.rawProperties=t||{},this.settings=r||{};this.relations=[],this.properties=null,this.build()}function isModelClass(e){return e?e.prototype instanceof ModelBaseClass:!1}var assert=require("assert"),util=require("util"),EventEmitter=require("events").EventEmitter,traverse=require("traverse"),ModelBaseClass=require("./model"),ModelBuilder=require("./model-builder");module.exports=ModelDefinition,util.inherits(ModelDefinition,EventEmitter),require("./types")(ModelDefinition),ModelDefinition.prototype.tableName=function(e){var i=this.settings;return i[e]?i[e].table||i[e].tableName||this.name:this.name},ModelDefinition.prototype.columnName=function(e,i){if(!i)return i;this.build();var t=this.properties[i];return t&&t[e]?t[e].column||t[e].columnName||i:i},ModelDefinition.prototype.columnMetadata=function(e,i){if(!i)return i;this.build();var t=this.properties[i];return t&&t[e]?t[e]:null},ModelDefinition.prototype.columnNames=function(e){this.build();var i=this.properties,t=[];for(var r in i)t.push(i[r][e]?property[e].column||i[r][e].columnName||r:r);return t},ModelDefinition.prototype.ids=function(){if(this._ids)return this._ids;var e=[];this.build();var i=this.properties;for(var t in i){var r=i[t].id;r&&("number"!=typeof r&&(r=1),e.push({name:t,id:r,property:i[t]}))}return e.sort(function(e,i){return e.key-i.key}),this._ids=e,e},ModelDefinition.prototype.idColumnName=function(e){return this.columnName(e,this.idName())},ModelDefinition.prototype.idName=function(){var e=this.ids()[0];return this.properties.id&&this.properties.id.id?"id":e&&e.name},ModelDefinition.prototype.idNames=function(){var e=this.ids(),i=e.map(function(e){return e.name});return i},ModelDefinition.prototype.indexes=function(){this.build();var e={};if(this.settings.indexes)for(var i in this.settings.indexes)e[i]=this.settings.indexes[i];for(var t in this.properties)this.properties[t].index&&(e[t+"_index"]=this.properties[t].index);return e},ModelDefinition.prototype.build=function(e){if(e&&(this.properties=null,this.relations=[],this._ids=null),this.properties)return this.properties;this.properties={};for(var i in this.rawProperties){var t=this.rawProperties[i],r=this.modelBuilder.resolveType(t);if("string"==typeof r)this.relations.push({source:this.name,target:r,type:Array.isArray(t)?"hasMany":"belongsTo",as:i});else{var n={type:r};if("object"==typeof t&&null!==t)for(var s in t)"type"!==s&&(n[s]=t[s]);this.properties[i]=n}}return this.properties},ModelDefinition.prototype.defineProperty=function(e,i){this.rawProperties[e]=i,this.build(!0)},ModelDefinition.prototype.toJSON=function(e){if(e&&(this.json=null),this.json)return i;var i={name:this.name,properties:{},settings:this.settings};this.build(e);var t=function(e){return void 0===e||null===e?e:"function"==typeof e.toJSON?e.toJSON():"function"==typeof e?isModelClass(e)?e.settings&&e.settings.anonymous?e.definition&&e.definition.toJSON().properties:e.modelName:e.name:e};for(var r in this.properties)i.properties[r]=traverse(this.properties[r]).map(t);return this.json=i,i};
},{"./model":88,"./model-builder":86,"./types":91,"assert":11,"events":24,"traverse":98,"util":46}],88:[function(require,module,exports){
function ModelBaseClass(t,e){e=e||{},"applySetters"in e||(e.applySetters=!0),this._initProperties(t,e)}function clone(t){return t}module.exports=ModelBaseClass;var util=require("util"),traverse=require("traverse"),jutil=require("./jutil"),List=require("./list"),Hookable=require("./hooks"),validations=require("./validations.js"),BASE_TYPES=["String","Boolean","Number","Date","Text"];ModelBaseClass.prototype._initProperties=function(t,e){function a(t){var e=i[t]["default"];return void 0!==e?"function"==typeof e?e():e:void 0}var r=this,o=this.constructor,i=o.definition.build();t=t||{},e=e||{};var n=e.applySetters,s=e.strict;void 0===s&&(s=o.definition.settings.strict),Object.defineProperty(this,"__cachedRelations",{writable:!0,enumerable:!1,configurable:!0,value:{}}),Object.defineProperty(this,"__data",{writable:!0,enumerable:!1,configurable:!0,value:{}}),Object.defineProperty(this,"__dataWas",{writable:!0,enumerable:!1,configurable:!0,value:{}}),Object.defineProperty(this,"__dataSource",{writable:!0,enumerable:!1,configurable:!0,value:e.dataSource}),Object.defineProperty(this,"__strict",{writable:!0,enumerable:!1,configurable:!0,value:s}),t.__cachedRelations&&(this.__cachedRelations=t.__cachedRelations);for(var l in t)if(l in i&&"function"!=typeof t[l])this.__data[l]=this.__dataWas[l]=clone(t[l]);else if(l in o.relations)"belongsTo"===o.relations[l].type&&null!==t[l]&&void 0!==t[l]&&(this.__data[o.relations[l].keyFrom]=this.__dataWas[l]=t[l][o.relations[l].keyTo]),this.__cachedRelations[l]=t[l];else if(s===!1)this.__data[l]=this.__dataWas[l]=clone(t[l]);else if("throw"===s)throw new Error("Unknown property: "+l);if(n===!0)for(var d in t)"function"!=typeof t[d]&&(d in i||d in o.relations)&&(r[d]=r.__data[d]||t[d]);if(s===!1)for(var d in t)"function"==typeof t[d]||d in i||(r[d]=r.__data[d]||t[d]);o.forEachProperty(function(t){void 0===r.__data[t]?r.__data[t]=r.__dataWas[t]=a(t):r.__dataWas[t]=r.__data[t]}),o.forEachProperty(function(t){var e=i[t].type;if(-1===BASE_TYPES.indexOf(e.name)){if("object"!=typeof r.__data[t]&&r.__data[t])try{r.__data[t]=JSON.parse(r.__data[t]+"")}catch(a){r.__data[t]=String(r.__data[t])}("Array"===e.name||Array.isArray(e))&&(r.__data[t]instanceof List||(r.__data[t]=new List(r.__data[t],e,r)))}}),this.trigger("initialize")},ModelBaseClass.defineProperty=function(t,e){this.dataSource.defineProperty(this.modelName,t,e)},ModelBaseClass.getPropertyType=function(t){var e=this.definition.properties[t];if(!e)return null;if(!e.type)throw new Error("Type not defined for property "+this.modelName+"."+t);return e.type.name},ModelBaseClass.prototype.getPropertyType=function(t){return this.constructor.getPropertyType(t)},ModelBaseClass.toString=function(){return"[Model "+this.modelName+"]"},ModelBaseClass.prototype.toObject=function(t){void 0===t&&(t=!0);var e={},a=this,r=this.__strict,o=r===!1||!t;this.constructor.forEachProperty(function(t){e[t]=a[t]instanceof List?a[t].toObject(!o):a.__data.hasOwnProperty(t)?void 0!==a[t]&&null!==a[t]&&a[t].toObject?a[t].toObject(!o):a[t]:null});var i=null;if(o){for(var n in a)a.hasOwnProperty(n)&&!e.hasOwnProperty(n)&&(i=a[n],e[n]=void 0!==i&&null!==i&&i.toObject?i.toObject(!o):i);for(n in a.__data)e.hasOwnProperty(n)||(i=a.hasOwnProperty(n)?a[n]:a.__data[n],e[n]=void 0!==i&&null!==i&&i.toObject?i.toObject(!o):i)}return e},ModelBaseClass.prototype.toJSON=function(){return this.toObject(!1)},ModelBaseClass.prototype.fromObject=function(t){for(var e in t)this[e]=t[e]},ModelBaseClass.prototype.propertyChanged=function(t){return this.__data[t]!==this.__dataWas[t]},ModelBaseClass.prototype.reset=function(){var t=this;for(var e in t)"id"===e||t.constructor.dataSource.definitions[t.constructor.modelName].properties[e]||delete t[e],t.propertyChanged(e)&&(t[e]=t[e+"$was"])},ModelBaseClass.prototype.inspect=function(){return util.inspect(this.__data,!1,4,!0)},ModelBaseClass.mixin=function(t,e){return jutil.mixin(this,t,e)},ModelBaseClass.prototype.getDataSource=function(){return this.__dataSource||this.constructor.dataSource},ModelBaseClass.getDataSource=function(){return this.dataSource},ModelBaseClass.prototype.setStrict=function(t){this.__strict=t},jutil.mixin(ModelBaseClass,Hookable),jutil.mixin(ModelBaseClass,validations.Validatable);
},{"./hooks":81,"./jutil":84,"./list":85,"./validations.js":93,"traverse":98,"util":46}],89:[function(require,module,exports){
function Relation(){}function lookupModel(e,o){if(e[o])return e[o];var t=o.toLowerCase();for(var i in e)if(i.toLowerCase()===t)return e[i]}var i8n=require("inflection"),defineScope=require("./scope.js").defineScope,ModelBaseClass=require("./model.js");module.exports=Relation,Relation.relationNameFor=function(e){for(var o in this.relations)if("belongsTo"===this.relations[o].type&&this.relations[o].keyFrom===e)return o},Relation.hasMany=function(e,o){function t(o,t){e.findById(o,function(e,o){return e?t(e):o?void(o[s]&&o[s].toString()===this[l].toString()?t(null,o):t(new Error("Permission denied"))):t(new Error("Not found"))}.bind(this))}function i(o,t){var i=this;e.findById(o,function(e,o){return e?t(e):o?void(o[s]&&o[s].toString()===i[l].toString()?o.destroy(t):t(new Error("Permission denied"))):t(new Error("Not found"))})}var r=this.modelName;if(o=o||{},"string"==typeof e)if(o.as=e,o.model)e=o.model;else{var n=i8n.singularize(e).toLowerCase();e=lookupModel(this.dataSource.modelBuilder.models,n)}var a=o.as||i8n.camelize(e.pluralModelName,!0),s=o.foreignKey||i8n.camelize(r+"_id",!0),l=this.dataSource.idName(this.modelName)||"id";this.relations[a]={type:"hasMany",keyFrom:l,keyTo:s,modelTo:e,multiple:!0},o.through&&(this.relations[a].modelThrough=o.through);var d={findById:t,destroy:i};if(o.through){var h=i8n.camelize(e.modelName+"_id",!0);d.create=function(t,i){"object"!=typeof t&&(i=t,t={}),"function"!=typeof i&&(i=function(){});var r=this;e.create(t,function(e,t){if(e)return i(e,t);var n={};n[o.through.relationNameFor(s)]=r,n[o.through.relationNameFor(h)]=t,o.through.create(n,function(o){o?t.destroy(function(){i(o)}):i(e,t)})})},d.add=function(e,t){var i={},r={};r[s]=this[l],i[o.through.relationNameFor(s)]=this,r[h]=e[l]||e,i[o.through.relationNameFor(h)]=e,o.through.findOrCreate({where:r},i,t)},d.remove=function(e,t){var i={};i[h]=e[l]||e,o.through.findOne({where:i},function(e,o){return e?t(e):o?void o.destroy(t):t()})},delete d.destroy}defineScope(this.prototype,o.through||e,a,function(){var t={};return t.where={},t.where[s]=this[l],o.through&&(t.collect=i8n.camelize(e.modelName,!0),t.include=t.collect),t},d),o.through||e.dataSource.defineForeignKey(e.modelName,s,this.modelName)},Relation.belongsTo=function(e,o){if(o=o||{},"string"==typeof e)if(o.as=e,o.model)e=o.model;else{var t=e.toLowerCase();e=lookupModel(this.dataSource.modelBuilder.models,t)}var i=this.dataSource.idName(e.modelName)||"id",r=o.as||i8n.camelize(e.modelName,!0),n=o.foreignKey||r+"Id";this.relations[r]={type:"belongsTo",keyFrom:n,keyTo:i,modelTo:e,multiple:!1},this.dataSource.defineForeignKey(this.modelName,n,e.modelName),this.prototype.__finders__=this.prototype.__finders__||{},this.prototype.__finders__[r]=function(o,t){return null===o?void t(null,null):void e.findById(o,function(e,o){return e?t(e):o?void(o[i]===this[n]?t(null,o):t(new Error("Permission denied"))):t(null,null)}.bind(this))};var a=function(e,o){if(1===arguments.length)o=e,e=!1;else if(arguments.length>2)throw new Error("Method can't be called with more than two arguments");var t,a=this;if(!e&&this.__cachedRelations&&void 0!==this.__cachedRelations[r]&&(t=this.__cachedRelations[r]),o instanceof ModelBaseClass)this[n]=o[i],this.__cachedRelations[r]=o;else{if("function"==typeof o)return"undefined"==typeof t?(this.__finders__[r].apply(a,[this[n],function(e,t){e||(a.__cachedRelations[r]=t),o(e,t)}]),this[n]):(o(null,t),t);if("undefined"==typeof o)return this[n];this[n]=o,delete this.__cachedRelations[r]}};Object.defineProperty(this.prototype,r,{enumerable:!0,configurable:!0,get:function(){var o=function(){return a.apply(this,arguments)};return o.create=function(o,t){var r=this;e.create(o,function(e,o){e?t&&t(e):(r[n]=o[i],t&&t(e,o))})}.bind(this),o.build=function(o){return new e(o)}.bind(this),o._targetClass=e.modelName,o}});var s=function(){var e=this[r];e.apply(this,arguments)};s.shared=!0,s.http={verb:"get",path:"/"+r},s.accepts={arg:"refresh",type:"boolean",http:{source:"query"}},s.description="Fetches belongsTo relation "+r,s.returns={arg:r,type:"object",root:!0},this.prototype["__get__"+r]=s},Relation.hasAndBelongsToMany=function(e,o){o=o||{};var t=this.dataSource.modelBuilder.models;if("string"==typeof e&&(o.as=e,e=o.model?o.model:lookupModel(t,i8n.singularize(e).toLowerCase())||e,"string"==typeof e))throw new Error('Could not find "'+e+'" relation for '+this.modelName);if(!o.through){var i=this.modelName+e.modelName,r=e.modelName+this.modelName;o.through=lookupModel(t,i)||lookupModel(t,r)||this.dataSource.define(i)}o.through.belongsTo(this),o.through.belongsTo(e),this.hasMany(e,{as:o.as,through:o.through})};
},{"./model.js":88,"./scope.js":90,"inflection":96}],90:[function(require,module,exports){
function defineScope(e,t,o,i,n){function r(e){return new t(s(this._scope,{where:e||{}}).where)}function c(e,t){"function"==typeof e&&(t=e,e={}),this.build(e).save(t)}function a(e){t.find(this._scope,function(t,o){t?e(t):!function i(t){t.length>0?t.shift().destroy(function(o){o&&e&&e(o),i(t)}):e&&e()}(o)})}function s(e,t){return e=e||{},t.where&&(e.where=merge(e.where,t.where)),t.include&&(e.include=t.include),t.collect&&(e.collect=t.collect),t.order&&(e.order=t.order),void 0!==t.limit&&(e.limit=t.limit),void 0!==t.skip&&(e.skip=t.skip),void 0!==t.offset&&(e.offset=t.offset),void 0!==t.fields&&(e.fields=t.fields),e}e._scopeMeta||(e._scopeMeta={}),e===t?e._scopeMeta[o]=i:t._scopeMeta||(t._scopeMeta={}),Object.defineProperty(e,o,{enumerable:!1,configurable:!0,get:function(){var e=this,l=function f(i,n){var r={},c=!1,a=!0;if(1===arguments.length)n=i;else{if(2!==arguments.length)throw new Error("Method can be only called with one or two arguments");"boolean"==typeof i?c=i:(r=i,c=!0,a=!1)}if(!e.__cachedRelations||void 0===e.__cachedRelations[o]||c){var l=s(r,f._scope);return t.find(l,function(t,i){!t&&a&&(defineCachedRelations(e),e.__cachedRelations[o]=i),n(t,i)})}n(null,e.__cachedRelations[o])};l._scope="function"==typeof i?i.call(this):i,l._targetClass=t.modelName,l._scope.collect&&(l._targetClass=i8n.capitalize(l._scope.collect)),l.build=r,l.create=c,l.destroyAll=a;for(var d in n)l[d]=n[d].bind(this);return Object.keys(t._scopeMeta).forEach(function(e){Object.defineProperty(l,e,{enumerable:!1,get:function(){return s(l._scope,t._scopeMeta[e]),l}})}.bind(this)),l}});var l=function(){var e=this[o];e.apply(this[o],arguments)};l.shared=!0,l.http={verb:"get",path:"/"+o},l.accepts={arg:"filter",type:"object"},l.description="Queries "+o+" of this model.",l.returns={arg:o,type:"array",root:!0},e["__get__"+o]=l;var d=function(){var e=this[o].create;e.apply(this[o],arguments)};d.shared=!0,d.http={verb:"post",path:"/"+o},d.accepts={arg:"data",type:"object",http:{source:"body"}},d.description="Creates a new instance in "+o+" of this model.",d.returns={arg:"data",type:"object",root:!0},e["__create__"+o]=d;var f=function(){var e=this[o].destroyAll;e.apply(this[o],arguments)};f.shared=!0,f.http={verb:"delete",path:"/"+o},f.description="Deletes all "+o+" of this model.",f.returns={arg:"data",type:"object",root:!0},e["__delete__"+o]=f}function merge(e,t){return e=e||{},t&&Object.keys(t).forEach(function(o){e[o]=t[o]}),e}var i8n=require("inflection"),utils=require("./utils"),defineCachedRelations=utils.defineCachedRelations;exports.defineScope=defineScope;
},{"./utils":92,"inflection":96}],91:[function(require,module,exports){
(function(e){var t={};t.Text=function r(e){return this instanceof r?void(this.value=e):e},t.Text.prototype.toObject=t.Text.prototype.toJSON=function(){return this.value},t.JSON=function o(e){return this instanceof o?void(this.value=e):e},t.JSON.prototype.toObject=t.JSON.prototype.toJSON=function(){return this.value},t.Any=function i(e){return this instanceof i?void(this.value=e):e},t.Any.prototype.toObject=t.Any.prototype.toJSON=function(){return this.value},module.exports=function(r){var o=require("./geo").GeoPoint;for(var i in t)r[i]=t[i];r.schemaTypes={},r.registerType=function(e,t){t=t||[],t=t.concat([e.name]);for(var r=0;r<t.length;r++)this.schemaTypes[t[r].toLowerCase()]=e},r.registerType(t.Text),r.registerType(t.JSON),r.registerType(t.Any),r.registerType(String),r.registerType(Number),r.registerType(Boolean),r.registerType(Date),r.registerType(e,["Binary"]),r.registerType(Array),r.registerType(o),r.registerType(Object)},module.exports.Types=t}).call(this,require("buffer").Buffer);
},{"./geo":80,"buffer":15}],92:[function(require,module,exports){
(function(e){function r(r){try{return require(r)}catch(t){console.log('Run "npm install loopback-datasource-juggler '+r+'" command to use loopback-datasource-juggler using '+r+" database engine"),e.exit(1)}}function t(e,r){if(e){var t=r;if("string"==typeof e)return[e];if(Array.isArray(e)&&e.length>0)return e;if("object"==typeof e){var o=[],n=[],a=Object.keys(e);if(!a.length)return;a.forEach(function(r){e[r]?o.push(r):r in e&&!e[r]&&n.push(r)}),o.length>0?t=o:n.length>0&&n.forEach(function(e){var r=t.indexOf(e);t.splice(r,1)})}return t}}function o(e){return function(r){for(var t,o={},n=0;n<e.length;n++)t=e[n],o[t]=r[t];return o}}function n(e){return"object"!=typeof e||null===e?e:i(e).forEach(function(e){return void 0===e&&this.remove(),Array.isArray(e)||"object"!=typeof e||null===e||e.constructor===Object?e:(this.update(e,!0),e)})}function a(e){if(!e)return{};var r=l.parse(e,!1),t={};if(t.connector=r.protocol&&r.protocol.split(":")[0],t.host=t.hostname=r.hostname,t.port=r.port&&Number(r.port),t.user=t.username=r.auth&&r.auth.split(":")[0],t.password=r.auth&&r.auth.split(":")[1],t.database=r.pathname&&r.pathname.split("/")[1],t.url=e,r.query){var o=f.parse(r.query);for(var n in o)t[n]=o[n]}return t}function s(e,r){var t=Array.isArray(r),o=t&&[]||{};return t?(e=e||[],o=o.concat(e),r.forEach(function(e){-1===o.indexOf(e)&&o.push(e)})):(e&&"object"==typeof e&&Object.keys(e).forEach(function(r){o[r]=e[r]}),Object.keys(r).forEach(function(t){o[t]="object"==typeof r[t]&&r[t]&&e[t]?s(e[t],r[t]):r[t]})),o}function u(e){e.__cachedRelations||Object.defineProperty(e,"__cachedRelations",{writable:!0,enumerable:!1,configurable:!0,value:{}})}function c(e){return"object"==typeof e&&null!==e&&e.constructor===Object}exports.safeRequire=r,exports.fieldsToArray=t,exports.selectFields=o,exports.removeUndefined=n,exports.parseSettings=a,exports.mergeSettings=s,exports.isPlainObject=c,exports.defineCachedRelations=u;var i=require("traverse"),l=require("url"),f=require("qs")}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"qs":97,"traverse":98,"url":44}],93:[function(require,module,exports){
(function(i){function n(){}function t(i,n,t){v(this[i])&&t()}function e(i,n,t){if(!m.call(this,i,n,t)){var e=this[i].length;n.min&&e<n.min&&t("min"),n.max&&e>n.max&&t("max"),n.is&&e!==n.is&&t("is")}}function o(i,n,t){return m.call(this,i,n,t)?void 0:"number"!=typeof this[i]?t("number"):n.int&&this[i]!==Math.round(this[i])?t("int"):void 0}function s(i,n,t){m.call(this,i,n,t)||~n.in.indexOf(this[i])||t()}function r(i,n,t){m.call(this,i,n,t)||~n.in.indexOf(this[i])&&t()}function a(i,n,t){m.call(this,i,n,t)||("string"==typeof this[i]?this[i].match(n["with"])||t():t())}function l(i,n,t,e){n.customValidator.call(this,t,e)}function u(i,n,t,e){var o={where:{}};o.where[i]=this[i],this.constructor.find(o,function(i,n){return i?t():(n.length>1?t():1!==n.length||this.id&&n[0].id&&n[0].id.toString()==this.id.toString()||t(),void e())}.bind(this))}function c(i,n){return function(){p(this,i,arguments,n)}}function f(i){Object.defineProperty(i,"errors",{enumerable:!1,configurable:!0,value:!1})}function h(i,n,t){{var e=n[0],o=n[1];n[2]||{}}if("string"!=typeof e)return!1;if(d(i,o,"if"))return!1;if(d(i,o,"unless"))return!1;var s=!1,r=x[o.validation],a=[];return a.push(e),a.push(o),a.push(function(n){var t,r=o.validation;o.message&&(t=o.message),!t&&O[o.validation]&&(t=O[o.validation]),t||(t="is invalid"),n&&(r+="."+n,t=t[n]?t[n]:O.common[n]?O.common[n]:"is invalid"),i.errors.add(e,t,r),s=!0}),t&&a.push(function(){t(s)}),r.apply(i,a),s}function d(i,n,t){var e=!0;return"function"==typeof n[t]?(e=n[t].call(i),"unless"===t&&(e=!e)):"string"==typeof n[t]&&("function"==typeof i[n[t]]?(e=i[n[t]].call(i),"unless"===t&&(e=!e)):i.__data.hasOwnProperty(n[t])?(e=i[n[t]],"unless"===t&&(e=!e)):e="if"===t),!e}function m(i,n,t){var e=null===this[i]||!(i in this);return e?(n.allowNull||t("null"),!0):v(this[i])?(n.allowBlank||t("blank"),!0):!1}function v(i){return"undefined"==typeof i?!0:i instanceof Array&&0===i.length?!0:null===i?!0:"string"==typeof i&&""===i?!0:!1}function p(i,n,t,e){i._validations||Object.defineProperty(i,"_validations",{writable:!0,configurable:!0,enumerable:!1,value:[]}),t=[].slice.call(t);var o;o="object"==typeof t[t.length-1]?t.pop():{},"custom"===n&&"function"==typeof t[t.length-1]&&(o.customValidator=t.pop()),o.validation=n,t.forEach(function(n){i._validations.push([n,o,e])})}function g(){Object.defineProperty(this,"codes",{enumerable:!1,configurable:!0,value:{}})}function b(i){return this instanceof b?(this.name="ValidationError",this.message="The Model instance is not valid. See `details` property of the error object for more info.",this.statusCode=422,this.details={context:i&&i.constructor&&i.constructor.modelName,codes:i.errors&&i.errors.codes,messages:i.errors},void Error.captureStackTrace(this,this.constructor)):new b(i)}var y=require("util");exports.ValidationError=b,exports.Validatable=n,n.validatesPresenceOf=c("presence"),n.validatesLengthOf=c("length"),n.validatesNumericalityOf=c("numericality"),n.validatesInclusionOf=c("inclusion"),n.validatesExclusionOf=c("exclusion"),n.validatesFormatOf=c("format"),n.validate=c("custom"),n.validateAsync=c("custom",{async:!0}),n.validatesUniquenessOf=c("uniqueness",{async:!0});var x={presence:t,length:e,numericality:o,inclusion:s,exclusion:r,format:a,custom:l,uniqueness:u};n.prototype.isValid=function(n,t){var e=!0,o=this,s=0,r=!1;return this.constructor._validations?(Object.defineProperty(this,"errors",{enumerable:!1,configurable:!0,value:new g}),this.trigger("validate",function(t){function o(i){l=l||i,0===--s&&t.call(a,function(){e&&!l&&f(a),n&&n(e&&!l)})}var a=this,l=!1;this.constructor._validations.forEach(function(n){n[2]&&n[2].async?(r=!0,s+=1,i.nextTick(function(){h(a,n,o)})):h(a,n)&&(e=!1)}),r||t.call(a,function(){e&&f(a),n&&n(e)})},t),r?void 0:e):(f(this),n&&this.trigger("validate",function(i){i.call(o,function(){n(e)})}),e)};var O={presence:"can't be blank",length:{min:"too short",max:"too long",is:"length is wrong"},common:{blank:"is blank","null":"is null"},numericality:{"int":"is not an integer",number:"is not a number"},inclusion:"is not included in the list",exclusion:"is reserved",uniqueness:"is not unique"};g.prototype.add=function(i,n,t){t=t||"invalid",this[i]||(this[i]=[],this.codes[i]=[]),this[i].push(n),this.codes[i].push(t)},y.inherits(b,Error)}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30,"util":46}],94:[function(require,module,exports){
module.exports=require(68)
},{"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30}],95:[function(require,module,exports){
module.exports=require(70)
},{}],96:[function(require,module,exports){
module.exports=require(74)
},{}],97:[function(require,module,exports){
function promote(r,t){if(0==r[t].length)return r[t]={};var e={};for(var n in r[t])hasOwnProperty.call(r[t],n)&&(e[n]=r[t][n]);return r[t]=e,e}function parse(r,t,e,n){var o=r.shift();if(!Object.getOwnPropertyDescriptor(Object.prototype,e))if(o){var i=t[e]=t[e]||[];"]"==o?isArray(i)?""!=n&&i.push(n):"object"==typeof i?i[objectKeys(i).length]=n:i=t[e]=[t[e],n]:~indexOf(o,"]")?(o=o.substr(0,o.length-1),!isint.test(o)&&isArray(i)&&(i=promote(t,e)),parse(r,i,o,n)):(!isint.test(o)&&isArray(i)&&(i=promote(t,e)),parse(r,i,o,n))}else isArray(t[e])?t[e].push(n):t[e]="object"==typeof t[e]?n:"undefined"==typeof t[e]?n:[t[e],n]}function merge(r,t,e){if(~indexOf(t,"]")){{var n=t.split("[");n.length}parse(n,r,"base",e)}else{if(!isint.test(t)&&isArray(r.base)){var o={};for(var i in r.base)o[i]=r.base[i];r.base=o}set(r.base,t,e)}return r}function compact(r){if("object"!=typeof r)return r;if(isArray(r)){var t=[];for(var e in r)hasOwnProperty.call(r,e)&&t.push(r[e]);return t}for(var n in r)r[n]=compact(r[n]);return r}function parseObject(r){var t={base:{}};return forEach(objectKeys(r),function(e){merge(t,e,r[e])}),compact(t.base)}function parseString(r){var t=reduce(String(r).split("&"),function(r,t){var e=indexOf(t,"="),n=lastBraceInKey(t),o=t.substr(0,n||e),i=t.substr(n||e,t.length),i=i.substr(indexOf(i,"=")+1,i.length);return""==o&&(o=t,i=""),""==o?r:merge(r,decode(o),decode(i))},{base:{}}).base;return compact(t)}function stringifyString(r,t){if(!t)throw new TypeError("stringify expects an object");return t+"="+encodeURIComponent(r)}function stringifyArray(r,t){var e=[];if(!t)throw new TypeError("stringify expects an object");for(var n=0;n<r.length;n++)e.push(stringify(r[n],t+"["+n+"]"));return e.join("&")}function stringifyObject(r,t){for(var e,n=[],o=objectKeys(r),i=0,s=o.length;s>i;++i)e=o[i],""!=e&&n.push(null==r[e]?encodeURIComponent(e)+"=":stringify(r[e],t?t+"["+encodeURIComponent(e)+"]":encodeURIComponent(e)));return n.join("&")}function set(r,t,e){var n=r[t];Object.getOwnPropertyDescriptor(Object.prototype,t)||(void 0===n?r[t]=e:isArray(n)?n.push(e):r[t]=[n,e])}function lastBraceInKey(r){for(var t,e,n=r.length,o=0;n>o;++o)if(e=r[o],"]"==e&&(t=!1),"["==e&&(t=!0),"="==e&&!t)return o}function decode(r){try{return decodeURIComponent(r.replace(/\+/g," "))}catch(t){return r}}var toString=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty,indexOf="function"==typeof Array.prototype.indexOf?function(r,t){return r.indexOf(t)}:function(r,t){for(var e=0;e<r.length;e++)if(r[e]===t)return e;return-1},isArray=Array.isArray||function(r){return"[object Array]"==toString.call(r)},objectKeys=Object.keys||function(r){var t=[];for(var e in r)r.hasOwnProperty(e)&&t.push(e);return t},forEach="function"==typeof Array.prototype.forEach?function(r,t){return r.forEach(t)}:function(r,t){for(var e=0;e<r.length;e++)t(r[e])},reduce=function(r,t,e){if("function"==typeof r.reduce)return r.reduce(t,e);for(var n=e,o=0;o<r.length;o++)n=t(n,r[o]);return n},isint=/^[0-9]+$/;exports.parse=function(r){return null==r||""==r?{}:"object"==typeof r?parseObject(r):parseString(r)};var stringify=exports.stringify=function(r,t){return isArray(r)?stringifyArray(r,t):"[object Object]"==toString.call(r)?stringifyObject(r,t):"string"==typeof r?stringifyString(r,t):t+"="+encodeURIComponent(String(r))};
},{}],98:[function(require,module,exports){
function Traverse(e){this.value=e}function walk(e,t,r){var o=[],n=[],a=!0;return function i(e){function c(){if("object"==typeof l.node&&null!==l.node){l.keys&&l.node_===l.node||(l.keys=objectKeys(l.node)),l.isLeaf=0==l.keys.length;for(var t=0;t<n.length;t++)if(n[t].node_===e){l.circular=n[t];break}}else l.isLeaf=!0,l.keys=null;l.notLeaf=!l.isLeaf,l.notRoot=!l.isRoot}var s=r?copy(e):e,u={},f=!0,l={node:s,node_:e,path:[].concat(o),parent:n[n.length-1],parents:n,key:o.slice(-1)[0],isRoot:0===o.length,level:o.length,circular:null,update:function(e,t){l.isRoot||(l.parent.node[l.key]=e),l.node=e,t&&(f=!1)},"delete":function(e){delete l.parent.node[l.key],e&&(f=!1)},remove:function(e){isArray(l.parent.node)?l.parent.node.splice(l.key,1):delete l.parent.node[l.key],e&&(f=!1)},keys:null,before:function(e){u.before=e},after:function(e){u.after=e},pre:function(e){u.pre=e},post:function(e){u.post=e},stop:function(){a=!1},block:function(){f=!1}};if(!a)return l;c();var p=t.call(l,l.node);return void 0!==p&&l.update&&l.update(p),u.before&&u.before.call(l,l.node),f?("object"!=typeof l.node||null===l.node||l.circular||(n.push(l),c(),forEach(l.keys,function(e,t){o.push(e),u.pre&&u.pre.call(l,l.node[e],e);var n=i(l.node[e]);r&&hasOwnProperty.call(l.node,e)&&(l.node[e]=n.node),n.isLast=t==l.keys.length-1,n.isFirst=0==t,u.post&&u.post.call(l,n),o.pop()}),n.pop()),u.after&&u.after.call(l,l.node),l):l}(e).node}function copy(e){if("object"==typeof e&&null!==e){var t;if(isArray(e))t=[];else if(isDate(e))t=new Date(e.getTime?e.getTime():e);else if(isRegExp(e))t=new RegExp(e);else if(isError(e))t={message:e.message};else if(isBoolean(e))t=new Boolean(e);else if(isNumber(e))t=new Number(e);else if(isString(e))t=new String(e);else if(Object.create&&Object.getPrototypeOf)t=Object.create(Object.getPrototypeOf(e));else if(e.constructor===Object)t={};else{var r=e.constructor&&e.constructor.prototype||e.__proto__||{},o=function(){};o.prototype=r,t=new o}return forEach(objectKeys(e),function(r){t[r]=e[r]}),t}return e}function toS(e){return Object.prototype.toString.call(e)}function isDate(e){return"[object Date]"===toS(e)}function isRegExp(e){return"[object RegExp]"===toS(e)}function isError(e){return"[object Error]"===toS(e)}function isBoolean(e){return"[object Boolean]"===toS(e)}function isNumber(e){return"[object Number]"===toS(e)}function isString(e){return"[object String]"===toS(e)}var traverse=module.exports=function(e){return new Traverse(e)};Traverse.prototype.get=function(e){for(var t=this.value,r=0;r<e.length;r++){var o=e[r];if(!t||!hasOwnProperty.call(t,o)){t=void 0;break}t=t[o]}return t},Traverse.prototype.has=function(e){for(var t=this.value,r=0;r<e.length;r++){var o=e[r];if(!t||!hasOwnProperty.call(t,o))return!1;t=t[o]}return!0},Traverse.prototype.set=function(e,t){for(var r=this.value,o=0;o<e.length-1;o++){var n=e[o];hasOwnProperty.call(r,n)||(r[n]={}),r=r[n]}return r[e[o]]=t,t},Traverse.prototype.map=function(e){return walk(this.value,e,!0)},Traverse.prototype.forEach=function(e){return this.value=walk(this.value,e,!1),this.value},Traverse.prototype.reduce=function(e,t){var r=1===arguments.length,o=r?this.value:t;return this.forEach(function(t){this.isRoot&&r||(o=e.call(this,o,t))}),o},Traverse.prototype.paths=function(){var e=[];return this.forEach(function(){e.push(this.path)}),e},Traverse.prototype.nodes=function(){var e=[];return this.forEach(function(){e.push(this.node)}),e},Traverse.prototype.clone=function(){var e=[],t=[];return function r(o){for(var n=0;n<e.length;n++)if(e[n]===o)return t[n];if("object"==typeof o&&null!==o){var a=copy(o);return e.push(o),t.push(a),forEach(objectKeys(o),function(e){a[e]=r(o[e])}),e.pop(),t.pop(),a}return o}(this.value)};var objectKeys=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t},isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r++)t(e[r],r,e)};forEach(objectKeys(Traverse.prototype),function(e){traverse[e]=function(t){var r=[].slice.call(arguments,1),o=new Traverse(t);return o[e].apply(o,r)}});var hasOwnProperty=Object.hasOwnProperty||function(e,t){return t in e};
},{}],99:[function(require,module,exports){
module.exports={
"name": "loopback-datasource-juggler",
"version": "1.3.10",
"description": "LoopBack DataSoure Juggler",
"keywords": [
"StrongLoop",
"LoopBack",
"DataSource",
"Connector",
"Database",
"Juggler",
"ORM"
],
"repository": {
"type": "git",
"url": "https://github.com/strongloop/loopback-datasource-juggler"
},
"main": "index.js",
"scripts": {
"test": "make test"
},
"engines": [
"node >= 0.6"
],
"devDependencies": {
"should": "~1.2.2",
"mocha": "~1.17.1"
},
"dependencies": {
"async": "~0.2.10",
"inflection": "~1.3.5",
"traverse": "~0.6.6",
"qs": "~0.6.6",
"debug": "~0.7.4"
},
"license": {
"name": "Dual MIT/StrongLoop",
"url": "https://github.com/strongloop/loopback-datasource-juggler/blob/master/LICENSE"
}
}
},{}],100:[function(require,module,exports){
function Swagger(e,t,r){function a(e){e(null,l)}var n=t||{},o=n.name||"swagger",s=n.version,p=n.basePath,c=e.handler("rest").adapter,i=c.allRoutes(),u=e.classes(),h={},d=Remoting.extend(h),m={},l={apiVersion:s,swaggerVersion:"1.1",basePath:p,apis:[]};return u.forEach(function(t){function a(e){e(null,m[t.name])}l.apis.push({path:"/"+o+t.http.path,description:t.ctor.sharedCtor&&t.ctor.sharedCtor.description}),m[t.name]={apiVersion:l.apiVersion,swaggerVersion:l.swaggerVersion,basePath:l.basePath,apis:[],models:r},d.method(a,{path:t.name,http:{path:t.http.path},returns:{type:"object",root:!0}}),addDynamicBasePathGetter(e,o+"."+t.name,m[t.name])}),i.forEach(function(e){var t,r=e.method.split("."),a=m[r[0]];return a?(t=u.filter(function(e){return e.name===r[0]})[0],t&&t.sharedCtor&&t.sharedCtor.accepts&&r.length>2&&(e.accepts=(e.accepts||[]).concat(t.sharedCtor.accepts)),void a.apis.push(routeToAPI(e))):void console.error("Route exists with no class: %j",e)}),d.method(a,{returns:[{type:"object",root:!0}]}),addDynamicBasePathGetter(e,o+".resources",l),e.exports[o]=h,h}function addDynamicBasePathGetter(e,t,r){function a(){return s}function n(e){return Object.defineProperty(e,"basePath",{configurable:!1,enumerable:!0,get:a})}var o=r.basePath||"/",s=String(r.basePath)||"";return/^https?:\/\//.test(s)||e.before(t,function(e,t){var r=e.req.headers,a=r.Host||r.host;s=e.req.protocol+"://"+a+o,t()}),n(r)}function routeToAPI(e){var t=e.returns&&e.returns[0];return{path:convertPathFragments(e.path),operations:[{httpMethod:convertVerb(e.verb),nickname:e.method.replace(/\./g,"_"),responseClass:t?t.model||prepareDataType(t.type):"void",parameters:e.accepts?e.accepts.map(acceptToParameter(e)):[],errorResponses:[],summary:e.description,notes:""}]}}function convertPathFragments(e){return e.split("/").map(function(e){return":"===e.charAt(0)?"{"+e.slice(1)+"}":e}).join("/")}function convertVerb(e){return"all"===e.toLowerCase()?"POST":"del"===e.toLowerCase()?"DELETE":e.toUpperCase()}function acceptToParameter(e){var t="form";return"get"===e.verb.toLowerCase()&&(t="query"),function(r){var a=r.name||r.arg,n=t;return-1!==e.path.indexOf(":"+a)&&(n="path"),r.http&&r.http.source&&(n=r.http.source),{paramType:n||t,name:a,description:r.description,dataType:r.model||prepareDataType(r.type),required:!!r.required,allowMultiple:!1}}}function prepareDataType(e){if(!e)return"void";switch(e){case"buffer":return"byte";case"date":return"Date";case"number":return"double"}return e}module.exports=Swagger;var Remoting=require("../");
},{"../":101}],101:[function(require,module,exports){
module.exports=require("./lib/remote-objects");
},{"./lib/remote-objects":105}],102:[function(require,module,exports){
function ExportsHelper(t){return this instanceof ExportsHelper?void(this._obj=t):new ExportsHelper(t)}function setPath(t,e){var r=this,p=r._obj,o=t.split("."),n=o.pop();return o.forEach(function(t){p[t]||(p[t]={}),p=p[t]}),debug("Setting %s to %s",t,e),p[n]=e,r}function type(t,e){var r=this,p=e.path||e.name||t.name||null,o=e.sharedCtor||null,n=e.accepts||null;return p?(o||(o=function(){var e=[].slice.call(arguments);e.pop()(null,t.apply(null,e))}),o.accepts||(o.accepts=n),o.returns||(o.returns={type:"object",root:!0}),PASSTHROUGH_OPTIONS.forEach(function(t){e[t]&&(o[t]=e[t])}),r.setPath(p,t),t.shared=!0,t.sharedCtor=o,new ExportsHelper(t.prototype)):r}function method(t,e){var r=this,p=e.path||e.name||t.name||null,o=e.accepts||null,n=e.returns||null;return p?(r.setPath(p,t),t.shared=!0,t.accepts=o,t.returns=n,PASSTHROUGH_OPTIONS.forEach(function(r){e[r]&&(t[r]=e[r])}),r):r}module.exports=ExportsHelper;var debug=require("debug")("strong-remoting:exports-helper"),PASSTHROUGH_OPTIONS=["http","description"];ExportsHelper.prototype.setPath=setPath,ExportsHelper.prototype.addType=type,ExportsHelper.prototype.type=type,ExportsHelper.prototype.addMethod=method,ExportsHelper.prototype.method=method;
},{"debug":112}],103:[function(require,module,exports){
function HttpContext(e,t,r){this.req=e,this.res=t,this.method=r,this.args=this.buildArgs(r),this.methodString=r.stringName}function coerce(e){return"string"!=typeof e?e:"null"==e?null:"true"==e?!0:"false"==e?!1:isfloat.test(e)?parseFloat(e,10):isint.test(e)?parseInt(e,10):e}function coerceAll(e){var t=Array.isArray(e)?"array":typeof e;switch(t){case"string":return coerce(e);case"object":Object.keys(e).forEach(function(t){e[t]=coerceAll(e[t])});break;case"array":e.map(function(e){return coerceAll(e)})}return e}module.exports=HttpContext;var EventEmitter=require("events").EventEmitter,debug=require("debug")("strong-remoting:http-context"),util=require("util"),inherits=util.inherits,assert=require("assert"),SUPPORTED_TYPES=["json","application/javascript","text/javascript"];inherits(HttpContext,EventEmitter),HttpContext.prototype.buildArgs=function(e){{var t={},r=e.accepts;e.returns}return r.forEach(function(e){var r=e.http,s=e.name||e.arg;if(r)switch(typeof r){case"function":t[s]=r(this);break;case"object":switch(r.source){case"body":t[s]=this.req.body;break;case"form":t[s]=this.req.body&&this.req.body[s];break;case"query":t[s]=this.req.query[s];break;case"path":t[s]=this.req.params[s];break;case"req":t[s]=this.req;break;case"res":t[s]=this.res;break;case"context":t[s]=this}}else t[s]=this.getArgByName(s,e);var a=typeof t[e.arg],i=e.type&&e.type.toLowerCase();"boolean"===i&&"string"===a&&(t[e.arg]=Boolean(t[e.arg])),"number"===i&&"string"===a&&(t[e.arg]=Number(t[e.arg]))}.bind(this)),t},HttpContext.prototype.getArgByName=function(e){var t=this.req,r=t.param("args");r&&(r=JSON.parse(r)),"object"==typeof r&&r||(r={});var s=r&&r[e]||this.req.param(e);return"object"==typeof s&&(s=coerceAll(s)),s};var isint=/^[0-9]+$/,isfloat=/^([0-9]+)?\.[0-9]+$/;HttpContext.prototype.invoke=function(e,t,r,s){var a=this.args;if(s)try{a=this.buildArgs(t)}catch(i){return r(i)}var n=t.http,o=n&&n.pipe,c=o&&o.dest,p=o&&o.source;if(c)switch(c){case"res":this.res.header("Content-Type","application/json"),this.res.header("Transfer-Encoding","chunked");var u=t.invoke(e,a,r);u.pipe(this.res);break;default:r(new Error("unsupported pipe destination"))}else if(p)switch(c){case"req":this.req.pipe(t.invoke(e,a,r));break;default:r(new Error("unsupported pipe source"))}else t.invoke(e,a,r)},HttpContext.prototype.done=function(){var e=this.result,t=this.res;t.header("X-Powered-By","LoopBack");var r=this.req.accepts(SUPPORTED_TYPES),s="undefined"!=typeof e;if(s)switch(r){case"json":case"application/javascript":case"text/javascript":t.jsonp(e);break;default:t.send(406)}else t.header("Content-Type","application/json"),t.statusCode=204,t.end()};
},{"assert":11,"debug":112,"events":24,"util":46}],104:[function(require,module,exports){
function HttpInvokation(t,e,r){this.base=r,this.method=t,this.args=e||[];var o,n=this.namedArgs={};t.accepts.forEach(function(t){o=e.shift(),HttpInvokation.isAcceptable(o,t)&&(n[t.arg||t.name]=o)})}module.exports=HttpInvokation;var EventEmitter=require("events").EventEmitter,debug=require("debug")("strong-remoting:http-invokation"),util=require("util"),inherits=util.inherits,path=require("path"),assert=require("assert"),request=require("request"),SUPPORTED_TYPES=["json","application/javascript","text/javascript"];inherits(HttpInvokation,EventEmitter),HttpInvokation.isAcceptable=function(t,e){var r=e.type&&e.type.toLowerCase(),o=r&&"any"!==r;return o?(typeof t).toLowerCase()===r:!0},HttpInvokation.prototype.createRequest=function(){{var t=this.method,e={json:!0,method:t.getHttpMethod()||"GET"},r=t.accepts;t.returns}return e.url=this.base+t.getFullPath(),r.forEach(function(t){var r=t.http,o=t.name||t.arg,n=this.getArgByName(o);if(r)switch(typeof r){case"function":break;case"object":switch(r.source){case"body":e.body=n;break;case"form":e.body=e.body||{},e.body[o]=n;break;case"query":e.qs=e.qs||{},e.qs[o]=n;break;case"path":e.url=e.url.replace(":"+o,n)}}else e.body=e.body||{},e.body[o]=n}.bind(this)),e},HttpInvokation.prototype.getArgByName=function(t){return this.namedArgs[t]},HttpInvokation.prototype.invoke=function(t){var e=this.createRequest();request(e,function(e,r,o){return e?t(e):void this.transformResponse(r,o,t)}.bind(this))},HttpInvokation.prototype.transformResponse=function(t,e,r){var o,n=[null],a=this.method,s=a.returns,i="object"==typeof e,u=t.statusCode>=400;return u?(i&&e.error?(o=new Error(e.error.message),o.name=e.error.name,o.stack=e.error.stack,o.details=e.error.details):o=new Error("Error: "+t.statusCode),r(o)):(s.forEach(function(e){var r,o=(e.http,e.name||e.arg);r=e.root?t.body:t.body[o],n.push(r)}.bind(this)),void r.apply(this,n))};
},{"assert":11,"debug":112,"events":24,"path":31,"request":110,"util":46}],105:[function(require,module,exports){
function RemoteObjects(e){EventEmitter.call(this,{wildcard:!0}),this.setMaxListeners(16),this.options=e||{},this.exports=this.options.exports||{}}function searchListenerTree(e,t,r,s){if(!r)return[];var n,i,o,c,a,h,u,p=[],f=t.length,l=t[s],m=t[s+1];if(s===f&&r._listeners){if("function"==typeof r._listeners)return e&&e.push(r._listeners),[r];for(n=0,i=r._listeners.length;i>n;n++)e&&e.push(r._listeners[n]);return[r]}if("*"===l||"**"===l||r[l]){if("*"===l){for(o in r)"_listeners"!==o&&r.hasOwnProperty(o)&&(p=p.concat(searchListenerTree(e,t,r[o],s+1)));return p}if("**"===l){u=s+1===f||s+2===f&&"*"===m,u&&r._listeners&&(p=p.concat(searchListenerTree(e,t,r,f)));for(o in r)"_listeners"!==o&&r.hasOwnProperty(o)&&("*"===o||"**"===o?(r[o]._listeners&&!u&&(p=p.concat(searchListenerTree(e,t,r[o],f))),p=p.concat(searchListenerTree(e,t,r[o],s))):p=p.concat(o===m?searchListenerTree(e,t,r[o],s+2):searchListenerTree(e,t,r[o],s)));return p}p=p.concat(searchListenerTree(e,t,r[l],s+1))}if(c=r["*"],c&&searchListenerTree(e,t,c,s+1),a=r["**"])if(f>s){a._listeners&&searchListenerTree(e,t,a,f);for(o in a)"_listeners"!==o&&a.hasOwnProperty(o)&&(o===m?searchListenerTree(e,t,a[o],s+2):o===l?searchListenerTree(e,t,a[o],s+1):(h={},h[o]=a[o],searchListenerTree(e,t,{"**":h},s+1)))}else a._listeners?searchListenerTree(e,t,a,f):a["*"]&&a["*"]._listeners&&searchListenerTree(e,t,a["*"],f);return p}module.exports=RemoteObjects;var EventEmitter=require("eventemitter2").EventEmitter2,debug=require("debug")("strong-remoting:remotes"),util=require("util"),inherits=util.inherits,assert=require("assert"),SharedClass=require("./shared-class"),ExportsHelper=require("./exports-helper");require("./rest-adapter"),inherits(RemoteObjects,EventEmitter),RemoteObjects.create=function(e){return new RemoteObjects(e)},RemoteObjects.extend=function(e){return new ExportsHelper(e)},RemoteObjects.prototype.handler=function(e,t){var r=this.adapter(e),s=new r(this,t),n=s.createHandler();return n&&(n.adapter=s),n},RemoteObjects.prototype.connect=function(e,t){var r=this.adapter(t),s=new r(this);return this.serverAdapter=s,s.connect(e)},RemoteObjects.prototype.invoke=function(e,t,r,s){return assert(this.serverAdapter,"Cannot invoke method without an adapter. See RemoteObjects#connect()."),this.serverAdapter.invoke.apply(this.serverAdapter,arguments,s)},RemoteObjects.prototype.adapter=function(e){return require("./"+e+"-adapter")},RemoteObjects.prototype.classes=function(){var e=this.exports;return Object.keys(e).map(function(t){return new SharedClass(t,e[t])})},RemoteObjects.prototype.findMethod=function(e){for(var t=this.methods(),r=0;r<t.length;r++)if(t[r].stringName===e)return t[r]},RemoteObjects.prototype.methods=function(){var e=[];return this.classes().forEach(function(t){e=t.methods().concat(e)}),e},RemoteObjects.prototype.toJSON=function(){var e={},t=this.methods();return t.forEach(function(t){e[t.stringName]={http:t.fn&&t.fn.http,accepts:t.accepts,returns:t.returns}}),e},RemoteObjects.prototype.before=function(e,t){this.on("before."+e,t)},RemoteObjects.prototype.after=function(e,t){this.on("after."+e,t)},RemoteObjects.prototype.execHooks=function(e,t,r,s,n){function i(e){c.push(e)}function o(e){if(e)return n(e);var i=c.shift();i?i.call(r,s,o,t):n()}var c=[],a=e+"."+t.sharedClass.name+(t.isStatic?".":".prototype.")+t.name;this._events||init.call(this);var h;if(this.objectName=t.sharedClass.name,this.methodName=t.name,this.wildcard){h=[];var u="string"==typeof a?a.split(this.delimiter):a.slice();searchListenerTree.call(this,h,u,this.listenerTree,0)}else h=this._events[a];if("function"==typeof h)return this.event=a,i(h),o();if(h){for(var p=arguments.length,f=new Array(p-1),l=1;p>l;l++)f[l-1]=arguments[l];for(var m=h.slice(),l=0,p=m.length;p>l;l++)i(m[l])}return o()},RemoteObjects.prototype.invokeMethodInContext=function(e,t,r){var s=this,n=this.getScope(e,t);s.execHooks("before",t,n,e,function(i){return i?r(i):void e.invoke(n,t,function(i,o){return i?r(i):(e.result=o,void s.execHooks("after",t,n,e,function(e){return e?r(e):void r()}))})})},RemoteObjects.prototype.getScope=function(e,t){return e.instance||t.ctor};
},{"./exports-helper":102,"./rest-adapter":106,"./shared-class":107,"assert":11,"debug":112,"eventemitter2":113,"util":46}],106:[function(require,module,exports){
function RestAdapter(t){EventEmitter.call(this),this.remotes=t,this.Context=HttpContext}function getRoutes(t){var e=t.fn||t.ctor,r=e&&e.http;return r&&!Array.isArray(r)&&(r=[r]),r?r.forEach(function(e){e.verb=String(e.verb||"all").toLowerCase(),e.path=e.path||"/"+t.name}):r="sharedCtor"===t.name?[{verb:"all",path:"/prototype"}]:[{verb:"all",path:t.name?"/"+t.name:""}],r}function sortRoutes(t){return":"===t.path[1]?1:-1}function RestClass(t){nonEnumerableConstPropery(this,"sharedClass",t),this.name=t.name,this.routes=getRoutes(t),this.ctor=t.sharedCtor&&new RestMethod(this,t.sharedCtor),this.methods=t.methods().filter(function(t){return!t.isSharedCtor}).map(function(t){return new RestMethod(this,t)}.bind(this))}function RestMethod(t,e){nonEnumerableConstPropery(this,"restClass",t),nonEnumerableConstPropery(this,"sharedMethod",e),this.fullName=e.stringName,this.name=this.fullName.split(".").slice(1).join("."),this.accepts=e.accepts,this.returns=e.returns,this.description=e.description;var r=getRoutes(e);if(e.isStatic||!t.ctor)this.routes=r;else{var s=this.routes=[];r.forEach(function(e){t.ctor.routes.forEach(function(t){var r=util._extend({},e);r.path=joinPaths(t.path,e.path),s.push(r)})})}}function getTypeString(t){return"function"==typeof t&&(t=t.name),"string"==typeof t?t.toLowerCase():(debug("WARNING: unkown ctorOrName of type %s: %j",typeof t,t),"undefined")}function nonEnumerableConstPropery(t,e,r){Object.defineProperty(t,e,{value:r,enumerable:!1,writable:!1,configurable:!1})}function joinPaths(t,e){if(!t)return e;if(!e||"/"==e)return t;var r=t[t.length-1]+e[0];return"//"==r?t+e.slice(1):"/"==r[0]||"/"==r[1]?t+e:t+"/"+e}module.exports=RestAdapter,RestAdapter.RestClass=RestClass,RestAdapter.RestMethod=RestMethod;var EventEmitter=require("events").EventEmitter,debug=require("debug")("strong-remoting:rest-adapter"),util=require("util"),inherits=util.inherits,assert=require("assert"),express=require("express"),cors=require("cors"),async=require("async"),HttpInvokation=require("./http-invokation"),HttpContext=require("./http-context");inherits(RestAdapter,EventEmitter),RestAdapter.create=RestAdapter.createRestAdapter=function(t){return new RestAdapter(t)},RestAdapter.prototype.getRoutes=getRoutes,RestAdapter.prototype.connect=function(t){this.connection=t},RestAdapter.prototype.invoke=function(t,e,r){assert(this.connection,"Cannot invoke method without a connection. See RemoteObjects#connect()."),assert("string"==typeof t,"method is required when calling invoke()");var s=arguments[arguments.length-1];e=Array.isArray(e)?e:[],r="function"==typeof s?s:void 0;var o=this.getRestMethodByName(t),n=new HttpInvokation(o,e,this.connection);n.invoke(r)},RestAdapter.prototype.getRestMethodByName=function(t){for(var e=this.getClasses(),r=0;r<e.length;r++)for(var s=e[r],o=0;o<s.methods.length;o++){var n=s.methods[o];if(n.fullName===t)return n}},RestAdapter.prototype.createHandler=function(){var t=express(),e=this,r=this.getClasses();t.use(function(t,e,r){t.is("application/json")&&"0"===t.get("Content-Length")&&(t._body=!0,t.body={}),r()}),debug("remoting options: %j",this.remotes.options);var s=this.remotes.options.urlencoded||{},o=this.remotes.options.json||{strict:!1},n=this.remotes.options.cors||{};return t.use(express.urlencoded(s)),t.use(express.json(o)),t.use(cors(n)),r.forEach(function(r){var s=express(),o=r.sharedClass.name;debug("registering REST handler for class %j",o),r.methods.forEach(function(t){var r=t.sharedMethod;debug(" method %s",r.stringName),t.routes.forEach(function(t){e._registerMethodRouteHandlers(s,r,t)})}),s.use(RestAdapter.remoteMethodNotFoundHandler(o)),r.routes.forEach(function(e){debug(" at %s",e.path),t.use(e.path,s)}),Object.keys(s.routes).forEach(function(t){Array.isArray(s.routes[t])&&(s.routes[t]=s.routes[t].sort(sortRoutes))})}),t.use(RestAdapter.urlNotFoundHandler()),t.use(RestAdapter.errorHandler()),t},RestAdapter.remoteMethodNotFoundHandler=function(t){return t=t||"(unknown)",function(e,r,s){var o='Shared class "'+t+'" has no method handling '+e.method+" "+e.url,n=new Error(o);n.status=n.statusCode=404,s(n)}},RestAdapter.urlNotFoundHandler=function(){return function(t,e,r){var s="There is no method to handle "+t.method+" "+t.url,o=new Error(s);o.status=o.statusCode=404,r(o)}},RestAdapter.errorHandler=function(){return function(t,e,r){"string"==typeof t&&(t=new Error(t),t.status=t.statusCode=500),r.statusCode=t.statusCode||t.status||500,debug("Error in %s %s: %s",e.method,e.url,t.stack);var s={name:t.name,status:r.statusCode,message:t.message||"An unknown error occurred"};for(var o in t)s[o]=t[o];s.stack=t.stack,r.send({error:s})}},RestAdapter.prototype._registerMethodRouteHandlers=function(t,e,r){var s=e.isStatic?this._createStaticMethodHandler(e):this._createPrototypeMethodHandler(e);debug(" %s %s %s",r.verb,r.path,s.name),t[r.verb](r.path,s)},RestAdapter.prototype._createStaticMethodHandler=function(t){var e=this,r=this.Context;return function(s,o,n){var a=new r(s,o,t);e._invokeMethod(a,t,n)}},RestAdapter.prototype._createPrototypeMethodHandler=function(t){var e=this,r=this.Context;return function(s,o,n){var a=new r(s,o,t);a.invoke(t,t.sharedCtor,function(r,s){return r?n(r):(a.instance=s,void e._invokeMethod(a,t,n))},!0)}},RestAdapter.prototype._invokeMethod=function(t,e,r){var s=this.remotes,o=[];e.rest.before&&o.push(function(r){debug("Invoking rest.before for "+t.methodString),e.rest.before.call(s.getScope(t,e),t,r)}),o.push(this.remotes.invokeMethodInContext.bind(this.remotes,t,e)),e.rest.after&&o.push(function(r){debug("Invoking rest.after for "+t.methodString),e.rest.after.call(s.getScope(t,e),t,r)}),async.series(o,function(e){return e?r(e):void t.done()})},RestAdapter.prototype.allRoutes=function(){function t(t,r,s){r="/"===r||"//"===r?o:o+r,"/"===r[r.length-1]&&(r=r.substr(0,r.length-1)),r=r.replace(/\/\//g,"/"),e.push({verb:t,path:r,description:s.description,method:s.stringName,accepts:s.accepts&&s.accepts.length?s.accepts:void 0,returns:s.returns&&s.returns.length?s.returns:void 0})}var e=[],r=this,s=(this.remotes,this.Context,this.remotes.classes()),o="";return s.forEach(function(e){r.getRoutes(e).forEach(function(s){o=s.path;var n=e.methods(),a=[];n.forEach(function(e){-1===a.indexOf(e.fn)&&(a.push(e.fn),r.getRoutes(e).forEach(function(s){e.isStatic?t(s.verb,s.path,e):r.getRoutes(e.sharedCtor).forEach(function(r){t(s.verb,r.path+s.path,e)})}))})})}),e},RestAdapter.prototype.getClasses=function(){return this.remotes.classes().map(function(t){return new RestClass(t)})},RestClass.prototype.getPath=function(){return this.routes[0].path},RestMethod.prototype.isReturningArray=function(){return 1==this.returns.length&&this.returns[0].root&&"array"===getTypeString(this.returns[0].type)||!1},RestMethod.prototype.acceptsSingleBodyArgument=function(){if(1!=this.accepts.length)return!1;var t=this.accepts[0];return t.http&&"body"==t.http.source&&"object"==getTypeString(t.type)||!1},RestMethod.prototype.getHttpMethod=function(){var t=this.routes[0].verb;return"all"==t?"POST":"del"==t?"DELETE":t.toUpperCase()},RestMethod.prototype.getPath=function(){return this.routes[0].path},RestMethod.prototype.getFullPath=function(){return joinPaths(this.restClass.getPath(),this.getPath())};
},{"./http-context":103,"./http-invokation":104,"assert":11,"async":109,"cors":111,"debug":112,"events":24,"express":14,"util":46}],107:[function(require,module,exports){
function SharedClass(e,t){this.name=e||t.remoteNamespace,this.ctor=t,"function"==typeof t&&(assert(t.sharedCtor,"must define a sharedCtor"),this.sharedCtor=new SharedMethod(t.sharedCtor,"sharedCtor")),this.http=util._extend({path:"/"+this.name},t.http),assert(this.name,"must include a remoteNamespace when creating a SharedClass")}function eachRemoteFunctionInObject(e,t){if(e)for(var r in e)if("super_"!==r){var s;try{s=e[r]}catch(a){}"function"==typeof s&&s.shared&&t(s,r)}}module.exports=SharedClass;var debug=require("debug")("strong-remoting:shared-class"),util=require("util"),inherits=util.inherits,SharedMethod=require("./shared-method"),assert=require("assert");SharedClass.prototype.methods=function(){var e=this.ctor,t=[],r=this;return eachRemoteFunctionInObject(e,function(e,s){t.push(new SharedMethod(e,s,r,!0))}),eachRemoteFunctionInObject(e.prototype,function(e,s){t.push(new SharedMethod(e,s,r))}),t};
},{"./shared-method":108,"assert":11,"debug":112,"util":46}],108:[function(require,module,exports){
(function(e){function t(e,t,r,s){a(e),this.fn=e,this.name=t,this.isStatic=s,this.accepts=e.accepts||[],this.returns=e.returns||[],this.description=e.description,this.http=e.http||{},this.rest=e.rest||{},this.sharedClass=r,r&&(this.ctor=r.ctor,this.sharedCtor=r.sharedCtor),"sharedCtor"===t&&(this.isSharedCtor=!0),this.accepts&&!Array.isArray(this.accepts)&&(this.accepts=[this.accepts]),this.returns&&!Array.isArray(this.returns)&&(this.returns=[this.returns]),this.stringName=(r?r.name:"")+(s?".":".prototype.")+t}module.exports=t;var r=(require("events").EventEmitter,require("debug")("strong-remoting:shared-method")),s=require("util"),a=(s.inherits,require("assert")),n=require("traverse");t.prototype.invoke=function(e,s,a){function n(e){return e?a(e):(i=t.toResult(c,[].slice.call(arguments,1)),r("- %s - result %j",h.name,i),void a(null,i))}var i,u=this.accepts,c=this.returns,o=this.fn,h=this,f=[];if(u)for(var p=0;p<u.length;p++){var l=u[p],d=l.name||l.arg,y=t.convertArg(l,s[d]),b=t.getType(y);if("undefined"!==b){if("string"===b&&"any"!==l.type&&b!==l.type)switch(l.type){case"number":y=Number(y);break;case"boolean":y=Boolean(y);break;case"object":case"array":try{y=JSON.parse(y)}catch(g){return r("- %s - invalid value for argument '%s' of type '%s': %s",h.name,d,l.type,y),a(g)}}f.push(y)}else{if(l.required){var g=new Error(d+" is a required arg");return g.statusCode=400,a(g)}f.push(void 0)}}return f.push(n),r("- %s - invoke with",this.name,f),o.apply(e,f)},t.getType=function(t){var r=typeof t;switch(r){case"undefined":case"boolean":case"number":case"function":case"string":return r;case"object":return null===t?"null":e.isBuffer(t)?"buffer":Array.isArray(t)?"array":t instanceof Date?"date":"object"}},t.convertArg=function(t,r){if(t.http&&("req"===t.http.source||"res"===t.http.source||"context"===t.http.source))return r;if(null===r||"object"!=typeof r)return r;var s=n(r).forEach(function(t){if(null===t||"object"!=typeof t)return t;var r=t;if("base64"===t.$type||"date"===t.$type){switch(t.$type){case"base64":r=new e(t.$data,"base64");break;case"date":r=new Date(t.$data)}this.update(r)}return r});return s},t.toResult=function(e,r){function s(e){switch(t.getType(e)){case"date":return{$type:"date",$data:e.toString()};case"buffer":return{$type:"base64",$data:e.toString("base64")}}return e}var a={};if(e.length)return e=e.filter(function(e,t){return t>=r.length?!1:e.root?(a=s(r[t]),!1):!0}),e.forEach(function(e,t){a[e.name||e.arg]=s(r[t])}),a}}).call(this,require("buffer").Buffer);
},{"assert":11,"buffer":15,"debug":112,"events":24,"traverse":114,"util":46}],109:[function(require,module,exports){
(function(n){!function(){function t(n){var t=!1;return function(){if(t)throw new Error("Callback was already called.");t=!0,n.apply(e,arguments)}}var e,r,u={};e=this,null!=e&&(r=e.async),u.noConflict=function(){return e.async=r,u};var i=function(n,t){if(n.forEach)return n.forEach(t);for(var e=0;e<n.length;e+=1)t(n[e],e,n)},c=function(n,t){if(n.map)return n.map(t);var e=[];return i(n,function(n,r,u){e.push(t(n,r,u))}),e},o=function(n,t,e){return n.reduce?n.reduce(t,e):(i(n,function(n,r,u){e=t(e,n,r,u)}),e)},a=function(n){if(Object.keys)return Object.keys(n);var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(e);return t};"undefined"!=typeof n&&n.nextTick?(u.nextTick=n.nextTick,u.setImmediate="undefined"!=typeof setImmediate?setImmediate:u.nextTick):"function"==typeof setImmediate?(u.nextTick=function(n){setImmediate(n)},u.setImmediate=u.nextTick):(u.nextTick=function(n){setTimeout(n,0)},u.setImmediate=u.nextTick),u.each=function(n,e,r){if(r=r||function(){},!n.length)return r();var u=0;i(n,function(i){e(i,t(function(t){t?(r(t),r=function(){}):(u+=1,u>=n.length&&r(null))}))})},u.forEach=u.each,u.eachSeries=function(n,t,e){if(e=e||function(){},!n.length)return e();var r=0,u=function(){t(n[r],function(t){t?(e(t),e=function(){}):(r+=1,r>=n.length?e(null):u())})};u()},u.forEachSeries=u.eachSeries,u.eachLimit=function(n,t,e,r){var u=l(t);u.apply(null,[n,e,r])},u.forEachLimit=u.eachLimit;var l=function(n){return function(t,e,r){if(r=r||function(){},!t.length||0>=n)return r();var u=0,i=0,c=0;!function o(){if(u>=t.length)return r();for(;n>c&&i<t.length;)i+=1,c+=1,e(t[i-1],function(n){n?(r(n),r=function(){}):(u+=1,c-=1,u>=t.length?r():o())})}()}},f=function(n){return function(){var t=Array.prototype.slice.call(arguments);return n.apply(null,[u.each].concat(t))}},s=function(n,t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[l(n)].concat(e))}},p=function(n){return function(){var t=Array.prototype.slice.call(arguments);return n.apply(null,[u.eachSeries].concat(t))}},m=function(n,t,e,r){var u=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e,r){u[n.index]=r,t(e)})},function(n){r(n,u)})};u.map=f(m),u.mapSeries=p(m),u.mapLimit=function(n,t,e,r){return y(t)(n,e,r)};var y=function(n){return s(n,m)};u.reduce=function(n,t,e,r){u.eachSeries(n,function(n,r){e(t,n,function(n,e){t=e,r(n)})},function(n){r(n,t)})},u.inject=u.reduce,u.foldl=u.reduce,u.reduceRight=function(n,t,e,r){var i=c(n,function(n){return n}).reverse();u.reduce(i,t,e,r)},u.foldr=u.reduceRight;var h=function(n,t,e,r){var u=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e){e&&u.push(n),t()})},function(){r(c(u.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})};u.filter=f(h),u.filterSeries=p(h),u.select=u.filter,u.selectSeries=u.filterSeries;var v=function(n,t,e,r){var u=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e){e||u.push(n),t()})},function(){r(c(u.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})};u.reject=f(v),u.rejectSeries=p(v);var d=function(n,t,e,r){n(t,function(n,t){e(n,function(e){e?(r(n),r=function(){}):t()})},function(){r()})};u.detect=f(d),u.detectSeries=p(d),u.some=function(n,t,e){u.each(n,function(n,r){t(n,function(n){n&&(e(!0),e=function(){}),r()})},function(){e(!1)})},u.any=u.some,u.every=function(n,t,e){u.each(n,function(n,r){t(n,function(n){n||(e(!1),e=function(){}),r()})},function(){e(!0)})},u.all=u.every,u.sortBy=function(n,t,e){u.map(n,function(n,e){t(n,function(t,r){t?e(t):e(null,{value:n,criteria:r})})},function(n,t){if(n)return e(n);var r=function(n,t){var e=n.criteria,r=t.criteria;return r>e?-1:e>r?1:0};e(null,c(t.sort(r),function(n){return n.value}))})},u.auto=function(n,t){t=t||function(){};var e=a(n);if(!e.length)return t(null);var r={},c=[],l=function(n){c.unshift(n)},f=function(n){for(var t=0;t<c.length;t+=1)if(c[t]===n)return void c.splice(t,1)},s=function(){i(c.slice(0),function(n){n()})};l(function(){a(r).length===e.length&&(t(null,r),t=function(){})}),i(e,function(e){var c=n[e]instanceof Function?[n[e]]:n[e],p=function(n){var c=Array.prototype.slice.call(arguments,1);if(c.length<=1&&(c=c[0]),n){var o={};i(a(r),function(n){o[n]=r[n]}),o[e]=c,t(n,o),t=function(){}}else r[e]=c,u.setImmediate(s)},m=c.slice(0,Math.abs(c.length-1))||[],y=function(){return o(m,function(n,t){return n&&r.hasOwnProperty(t)},!0)&&!r.hasOwnProperty(e)};if(y())c[c.length-1](p,r);else{var h=function(){y()&&(f(h),c[c.length-1](p,r))};l(h)}})},u.waterfall=function(n,t){if(t=t||function(){},n.constructor!==Array){var e=new Error("First argument to waterfall must be an array of functions");return t(e)}if(!n.length)return t();var r=function(n){return function(e){if(e)t.apply(null,arguments),t=function(){};else{var i=Array.prototype.slice.call(arguments,1),c=n.next();i.push(c?r(c):t),u.setImmediate(function(){n.apply(null,i)})}}};r(u.iterator(n))()};var g=function(n,t,e){if(e=e||function(){},t.constructor===Array)n.map(t,function(n,t){n&&n(function(n){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),t.call(null,n,e)})},e);else{var r={};n.each(a(t),function(n,e){t[n](function(t){var u=Array.prototype.slice.call(arguments,1);u.length<=1&&(u=u[0]),r[n]=u,e(t)})},function(n){e(n,r)})}};u.parallel=function(n,t){g({map:u.map,each:u.each},n,t)},u.parallelLimit=function(n,t,e){g({map:y(t),each:l(t)},n,e)},u.series=function(n,t){if(t=t||function(){},n.constructor===Array)u.mapSeries(n,function(n,t){n&&n(function(n){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),t.call(null,n,e)})},t);else{var e={};u.eachSeries(a(n),function(t,r){n[t](function(n){var u=Array.prototype.slice.call(arguments,1);u.length<=1&&(u=u[0]),e[t]=u,r(n)})},function(n){t(n,e)})}},u.iterator=function(n){var t=function(e){var r=function(){return n.length&&n[e].apply(null,arguments),r.next()};return r.next=function(){return e<n.length-1?t(e+1):null},r};return t(0)},u.apply=function(n){var t=Array.prototype.slice.call(arguments,1);return function(){return n.apply(null,t.concat(Array.prototype.slice.call(arguments)))}};var k=function(n,t,e,r){var u=[];n(t,function(n,t){e(n,function(n,e){u=u.concat(e||[]),t(n)})},function(n){r(n,u)})};u.concat=f(k),u.concatSeries=p(k),u.whilst=function(n,t,e){n()?t(function(r){return r?e(r):void u.whilst(n,t,e)}):e()},u.doWhilst=function(n,t,e){n(function(r){return r?e(r):void(t()?u.doWhilst(n,t,e):e())})},u.until=function(n,t,e){n()?e():t(function(r){return r?e(r):void u.until(n,t,e)})},u.doUntil=function(n,t,e){n(function(r){return r?e(r):void(t()?e():u.doUntil(n,t,e))})},u.queue=function(n,e){function r(n,t,r,c){t.constructor!==Array&&(t=[t]),i(t,function(t){var i={data:t,callback:"function"==typeof c?c:null};r?n.tasks.unshift(i):n.tasks.push(i),n.saturated&&n.tasks.length===e&&n.saturated(),u.setImmediate(n.process)})}void 0===e&&(e=1);var c=0,o={tasks:[],concurrency:e,saturated:null,empty:null,drain:null,push:function(n,t){r(o,n,!1,t)},unshift:function(n,t){r(o,n,!0,t)},process:function(){if(c<o.concurrency&&o.tasks.length){var e=o.tasks.shift();o.empty&&0===o.tasks.length&&o.empty(),c+=1;var r=function(){c-=1,e.callback&&e.callback.apply(e,arguments),o.drain&&o.tasks.length+c===0&&o.drain(),o.process()},u=t(r);n(e.data,u)}},length:function(){return o.tasks.length},running:function(){return c}};return o},u.cargo=function(n,t){var e=!1,r=[],o={tasks:r,payload:t,saturated:null,empty:null,drain:null,push:function(n,e){n.constructor!==Array&&(n=[n]),i(n,function(n){r.push({data:n,callback:"function"==typeof e?e:null}),o.saturated&&r.length===t&&o.saturated()}),u.setImmediate(o.process)},process:function a(){if(!e){if(0===r.length)return void(o.drain&&o.drain());var u="number"==typeof t?r.splice(0,t):r.splice(0),l=c(u,function(n){return n.data});o.empty&&o.empty(),e=!0,n(l,function(){e=!1;var n=arguments;i(u,function(t){t.callback&&t.callback.apply(null,n)}),a()})}},length:function(){return r.length},running:function(){return e}};return o};var A=function(n){return function(t){var e=Array.prototype.slice.call(arguments,1);t.apply(null,e.concat([function(t){var e=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(t?console.error&&console.error(t):console[n]&&i(e,function(t){console[n](t)}))}]))}};u.log=A("log"),u.dir=A("dir"),u.memoize=function(n,t){var e={},r={};t=t||function(n){return n};var u=function(){var u=Array.prototype.slice.call(arguments),i=u.pop(),c=t.apply(null,u);c in e?i.apply(null,e[c]):c in r?r[c].push(i):(r[c]=[i],n.apply(null,u.concat([function(){e[c]=arguments;var n=r[c];delete r[c];for(var t=0,u=n.length;u>t;t++)n[t].apply(null,arguments)}])))};return u.memo=e,u.unmemoized=n,u},u.unmemoize=function(n){return function(){return(n.unmemoized||n).apply(null,arguments)}},u.times=function(n,t,e){for(var r=[],i=0;n>i;i++)r.push(i);return u.map(r,t,e)},u.timesSeries=function(n,t,e){for(var r=[],i=0;n>i;i++)r.push(i);return u.mapSeries(r,t,e)},u.compose=function(){var n=Array.prototype.reverse.call(arguments);return function(){var t=this,e=Array.prototype.slice.call(arguments),r=e.pop();u.reduce(n,e,function(n,e,r){e.apply(t,n.concat([function(){var n=arguments[0],t=Array.prototype.slice.call(arguments,1);r(n,t)}]))},function(n,e){r.apply(t,[n].concat(e))})}};var x=function(n,t){var e=function(){var e=this,r=Array.prototype.slice.call(arguments),u=r.pop();return n(t,function(n,t){n.apply(e,r.concat([t]))},u)};if(arguments.length>2){var r=Array.prototype.slice.call(arguments,2);return e.apply(this,r)}return e};u.applyEach=f(x),u.applyEachSeries=p(x),u.forever=function(n,t){function e(r){if(r){if(t)return t(r);throw r}n(e)}e()},"undefined"!=typeof define&&define.amd?define([],function(){return u}):"undefined"!=typeof module&&module.exports?module.exports=u:e.async=u}()}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30}],110:[function(require,module,exports){
function request(e,r){if("function"!=typeof r)throw new Error("Bad callback given: "+r);if(!e)throw new Error("No options given");var t=e.onResponse;if(e="string"==typeof e?{uri:e}:JSON.parse(JSON.stringify(e)),e.onResponse=t,e.verbose&&(request.log=getLogger()),e.url&&(e.uri=e.url,delete e.url),!e.uri&&""!==e.uri)throw new Error("options.uri is a required argument");if("string"!=typeof e.uri)throw new Error("options.uri must be a string");for(var o=["proxy","_redirectsFollowed","maxRedirects","followRedirect"],n=0;n<o.length;n++)if(e[o[n]])throw new Error("options."+o[n]+" is not supported");if(e.callback=r,e.method=e.method||"GET",e.headers=e.headers||{},e.body=e.body||null,e.timeout=e.timeout||request.DEFAULT_TIMEOUT,e.headers.host)throw new Error("Options.headers.host is not supported");return e.json&&(e.headers.accept=e.headers.accept||"application/json","GET"!==e.method&&(e.headers["content-type"]="application/json"),"boolean"!=typeof e.json?e.body=JSON.stringify(e.json):"string"!=typeof e.body&&(e.body=JSON.stringify(e.body))),e.onResponse=e.onResponse||noop,e.onResponse===!0&&(e.onResponse=r,e.callback=noop),!e.headers.authorization&&e.auth&&(e.headers.authorization="Basic "+b64_enc(e.auth.username+":"+e.auth.password)),run_xhr(e)}function run_xhr(e){function r(){a=!0;var r=new Error("ETIMEDOUT");return r.code="ETIMEDOUT",r.duration=e.timeout,request.log.error("Timeout",{id:i._id,milliseconds:e.timeout}),e.callback(r,i)}function t(){if(a)return request.log.debug("Ignoring timed out state change",{state:i.readyState,id:i.id});if(request.log.debug("State change",{state:i.readyState,id:i.id,timed_out:a}),i.readyState===XHR.OPENED){request.log.debug("Request started",{id:i.id});for(var r in e.headers)i.setRequestHeader(r,e.headers[r])}else i.readyState===XHR.HEADERS_RECEIVED?o():i.readyState===XHR.LOADING?(o(),n()):i.readyState===XHR.DONE&&(o(),n(),s())}function o(){if(!p.response){if(p.response=!0,request.log.debug("Got response",{id:i.id,status:i.status}),clearTimeout(i.timeoutTimer),i.statusCode=i.status,u&&0==i.statusCode){var r=new Error("CORS request rejected: "+e.uri);return r.cors="rejected",p.loading=!0,p.end=!0,e.callback(r,i)}e.onResponse(null,i)}}function n(){p.loading||(p.loading=!0,request.log.debug("Response body loading",{id:i.id}))}function s(){if(!p.end){if(p.end=!0,request.log.debug("Request done",{id:i.id}),i.body=i.responseText,e.json)try{i.body=JSON.parse(i.responseText)}catch(r){return e.callback(r,i)}e.callback(null,i,i.body)}}var i=new XHR,a=!1,u=is_crossDomain(e.uri),d="withCredentials"in i;if(req_seq+=1,i.seq_id=req_seq,i.id=req_seq+": "+e.method+" "+e.uri,i._id=i.id,u&&!d){var c=new Error("Browser does not support cross-origin request: "+e.uri);return c.cors="unsupported",e.callback(c,i)}i.timeoutTimer=setTimeout(r,e.timeout);var p={response:!1,loading:!1,end:!1};return i.onreadystatechange=t,i.open(e.method,e.uri,!0),u&&(i.withCredentials=!!e.withCredentials),i.send(e.body),i}function noop(){}function getLogger(){var e,r,t={},o=["trace","debug","info","warn","error"];for(r=0;r<o.length;r++)e=o[r],t[e]=noop,"undefined"!=typeof console&&console&&console[e]&&(t[e]=formatted(console,e));return t}function formatted(e,r){function t(t,o){return"object"==typeof o&&(t+=" "+JSON.stringify(o)),e[r].call(e,t)}return t}function is_crossDomain(e){var r,t=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/;try{r=location.href}catch(o){r=document.createElement("a"),r.href="",r=r.href}var n=t.exec(r.toLowerCase())||[],s=t.exec(e.toLowerCase()),i=!(!s||s[1]==n[1]&&s[2]==n[2]&&(s[3]||("http:"===s[1]?80:443))==(n[3]||("http:"===n[1]?80:443)));return i}function b64_enc(e){var r,t,o,n,s,i,a,u,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=0,p=0,l="",f=[];if(!e)return e;do r=e.charCodeAt(c++),t=e.charCodeAt(c++),o=e.charCodeAt(c++),u=r<<16|t<<8|o,n=u>>18&63,s=u>>12&63,i=u>>6&63,a=63&u,f[p++]=d.charAt(n)+d.charAt(s)+d.charAt(i)+d.charAt(a);while(c<e.length);switch(l=f.join(""),e.length%3){case 1:l=l.slice(0,-2)+"==";break;case 2:l=l.slice(0,-1)+"="}return l}var XHR=XMLHttpRequest;if(!XHR)throw new Error("missing XMLHttpRequest");module.exports=request,request.log={trace:noop,debug:noop,info:noop,warn:noop,error:noop};var DEFAULT_TIMEOUT=18e4,req_seq=0;request.withCredentials=!1,request.DEFAULT_TIMEOUT=DEFAULT_TIMEOUT,request.defaults=function(e){var r=function(r){var t=function(t,o){t="string"==typeof t?{uri:t}:JSON.parse(JSON.stringify(t));for(var n in e)void 0===t[n]&&(t[n]=e[n]);return r(t,o)};return t},t=r(request);return t.get=r(request.get),t.post=r(request.post),t.put=r(request.put),t.head=r(request.head),t};var shortcuts=["get","put","post","head"];shortcuts.forEach(function(e){var r=e.toUpperCase(),t=e.toLowerCase();request[t]=function(e){"string"==typeof e?e={method:r,uri:e}:(e=JSON.parse(JSON.stringify(e)),e.method=r);var t=[e].concat(Array.prototype.slice.apply(arguments,[1]));return request.apply(this,t)}}),request.couch=function(e,r){function t(e,t,o){if(e)return r(e,t,o);if((t.statusCode<200||t.statusCode>299)&&o.error){e=new Error("CouchDB error: "+(o.error.reason||o.error.error));for(var n in o)e[n]=o[n];return r(e,t,o)}return r(e,t,o)}"string"==typeof e&&(e={uri:e}),e.json=!0,e.body&&(e.json=e.body),delete e.body,r=r||noop;var o=request(e,t);return o};
},{}],111:[function(require,module,exports){
!function(){"use strict";function n(n,e){var o=n.origin;return o===!0?o=e.headers.origin:o||(o="*"),{key:"Access-Control-Allow-Origin",value:o}}function e(n){var e=n.methods||s.methods;return e.join&&(e=n.methods.join(",")),{key:"Access-Control-Allow-Methods",value:e}}function o(n){return n.credentials===!0?{key:"Access-Control-Allow-Credentials",value:"true"}:null}function r(n,e){var o=n.headers;return o?o.join&&(o=o.join(",")):o=e.headers["access-control-request-headers"],o&&o.length?{key:"Access-Control-Allow-Headers",value:o}:null}function i(n){var e=n.maxAge&&n.maxAge.toString();return e&&e.length?{key:"Access-Control-Allow-Max-Age",value:e}:null}function t(t,u,s,l){var c=[],a=function(n,e){n.forEach(function(n){n&&n.value&&e.setHeader(n.key,n.value)})};"OPTIONS"===u.method?(c.push(n(t,u)),c.push(o(t,u)),c.push(e(t,u)),c.push(r(t,u)),c.push(i(t,u)),a(c,s),s.statusCode=204,s.end()):(c.push(n(t,u)),c.push(o(t,u)),a(c,s),l())}function u(n){n||(n={}),void 0===n.origin&&(n.origin=s.origin),void 0===n.methods&&(n.methods=s.methods);var e=null;return e="function"==typeof n?n:function(e,o){o(null,n)},function(n,o,r){n.pause(),e(n,function(e,i){if(n.resume(),e)r(e);else{var u=null;i.origin&&"function"==typeof i.origin?u=i.origin:i.origin&&(u=function(n,e){e(null,i.origin)}),u?(n.pause(),u(n.headers.origin,function(e,u){n.resume(),e||!u?r(e):(i.origin=u,t(i,n,o,r))})):r()}})}}var s={origin:"*",methods:"GET,HEAD,PUT,POST,DELETE"};module.exports=u}();
},{}],112:[function(require,module,exports){
function debug(e){return debug.enabled(e)?function(n){var u=new Date,o=u-(debug[e]||u);debug[e]=u,n=e+" "+n+" +"+debug.humanize(o),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}module.exports=debug,debug.names=[],debug.skips=[],debug.enable=function(e){try{localStorage.debug=e}catch(n){}for(var u=(e||"").split(/[\s,]+/),o=u.length,t=0;o>t;t++)e=u[t].replace("*",".*?"),"-"===e[0]?debug.skips.push(new RegExp("^"+e.substr(1)+"$")):debug.names.push(new RegExp("^"+e+"$"))},debug.disable=function(){debug.enable("")},debug.humanize=function(e){var n=1e3,u=6e4,o=60*u;return e>=o?(e/o).toFixed(1)+"h":e>=u?(e/u).toFixed(1)+"m":e>=n?(e/n|0)+"s":e+"ms"},debug.enabled=function(e){for(var n=0,u=debug.skips.length;u>n;n++)if(debug.skips[n].test(e))return!1;for(var n=0,u=debug.names.length;u>n;n++)if(debug.names[n].test(e))return!0;return!1},window.localStorage&&debug.enable(localStorage.debug);
},{}],113:[function(require,module,exports){
(function(e){!function(e){function t(){this._events={},this._conf&&s.call(this,this._conf)}function s(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners&&(this._events.maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this.newListener=e.newListener),this.wildcard&&(this.listenerTree={}))}function i(e){this._events={},this.newListener=!1,s.call(this,e)}function n(e,t,s,i){if(!s)return[];var r,l,o,h,a,f,c,u=[],_=t.length,p=t[i],d=t[i+1];if(i===_&&s._listeners){if("function"==typeof s._listeners)return e&&e.push(s._listeners),[s];for(r=0,l=s._listeners.length;l>r;r++)e&&e.push(s._listeners[r]);return[s]}if("*"===p||"**"===p||s[p]){if("*"===p){for(o in s)"_listeners"!==o&&s.hasOwnProperty(o)&&(u=u.concat(n(e,t,s[o],i+1)));return u}if("**"===p){c=i+1===_||i+2===_&&"*"===d,c&&s._listeners&&(u=u.concat(n(e,t,s,_)));for(o in s)"_listeners"!==o&&s.hasOwnProperty(o)&&("*"===o||"**"===o?(s[o]._listeners&&!c&&(u=u.concat(n(e,t,s[o],_))),u=u.concat(n(e,t,s[o],i))):u=u.concat(o===d?n(e,t,s[o],i+2):n(e,t,s[o],i)));return u}u=u.concat(n(e,t,s[p],i+1))}if(h=s["*"],h&&n(e,t,h,i+1),a=s["**"])if(_>i){a._listeners&&n(e,t,a,_);for(o in a)"_listeners"!==o&&a.hasOwnProperty(o)&&(o===d?n(e,t,a[o],i+2):o===p?n(e,t,a[o],i+1):(f={},f[o]=a[o],n(e,t,{"**":f},i+1)))}else a._listeners?n(e,t,a,_):a["*"]&&a["*"]._listeners&&n(e,t,a["*"],_);return u}function r(e,t){e="string"==typeof e?e.split(this.delimiter):e.slice();for(var s=0,i=e.length;i>s+1;s++)if("**"===e[s]&&"**"===e[s+1])return;for(var n=this.listenerTree,r=e.shift();r;){if(n[r]||(n[r]={}),n=n[r],0===e.length){if(n._listeners){if("function"==typeof n._listeners)n._listeners=[n._listeners,t];else if(l(n._listeners)&&(n._listeners.push(t),!n._listeners.warned)){var h=o;"undefined"!=typeof this._events.maxListeners&&(h=this._events.maxListeners),h>0&&n._listeners.length>h&&(n._listeners.warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",n._listeners.length),console.trace())}}else n._listeners=t;return!0}r=e.shift()}return!0}var l=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=10;i.prototype.delimiter=".",i.prototype.setMaxListeners=function(e){this._events||t.call(this),this._events.maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e},i.prototype.event="",i.prototype.once=function(e,t){return this.many(e,1,t),this},i.prototype.many=function(e,t,s){function i(){0===--t&&n.off(e,i),s.apply(this,arguments)}var n=this;if("function"!=typeof s)throw new Error("many only accepts instances of Function");return i._origin=s,this.on(e,i),n},i.prototype.emit=function(){this._events||t.call(this);var e=arguments[0];if("newListener"===e&&!this.newListener&&!this._events.newListener)return!1;if(this._all){for(var s=arguments.length,i=new Array(s-1),r=1;s>r;r++)i[r-1]=arguments[r];for(r=0,s=this._all.length;s>r;r++)this.event=e,this._all[r].apply(this,i)}if("error"===e&&!(this._all||this._events.error||this.wildcard&&this.listenerTree.error))throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");var l;if(this.wildcard){l=[];var o="string"==typeof e?e.split(this.delimiter):e.slice();n.call(this,l,o,this.listenerTree,0)}else l=this._events[e];if("function"==typeof l){if(this.event=e,1===arguments.length)l.call(this);else if(arguments.length>1)switch(arguments.length){case 2:l.call(this,arguments[1]);break;case 3:l.call(this,arguments[1],arguments[2]);break;default:for(var s=arguments.length,i=new Array(s-1),r=1;s>r;r++)i[r-1]=arguments[r];l.apply(this,i)}return!0}if(l){for(var s=arguments.length,i=new Array(s-1),r=1;s>r;r++)i[r-1]=arguments[r];for(var h=l.slice(),r=0,s=h.length;s>r;r++)this.event=e,h[r].apply(this,i);return h.length>0||this._all}return this._all},i.prototype.on=function(e,s){if("function"==typeof e)return this.onAny(e),this;if("function"!=typeof s)throw new Error("on only accepts instances of Function");if(this._events||t.call(this),this.emit("newListener",e,s),this.wildcard)return r.call(this,e,s),this;if(this._events[e]){if("function"==typeof this._events[e])this._events[e]=[this._events[e],s];else if(l(this._events[e])&&(this._events[e].push(s),!this._events[e].warned)){var i=o;"undefined"!=typeof this._events.maxListeners&&(i=this._events.maxListeners),i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),console.trace())}}else this._events[e]=s;return this},i.prototype.onAny=function(e){if(this._all||(this._all=[]),"function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all.push(e),this},i.prototype.addListener=i.prototype.on,i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var s,i=[];if(this.wildcard){var r="string"==typeof e?e.split(this.delimiter):e.slice();i=n.call(this,null,r,this.listenerTree,0)}else{if(!this._events[e])return this;s=this._events[e],i.push({_listeners:s})}for(var o=0;o<i.length;o++){var h=i[o];if(s=h._listeners,l(s)){for(var a=-1,f=0,c=s.length;c>f;f++)if(s[f]===t||s[f].listener&&s[f].listener===t||s[f]._origin&&s[f]._origin===t){a=f;break}if(0>a)return this;this.wildcard?h._listeners.splice(a,1):this._events[e].splice(a,1),0===s.length&&(this.wildcard?delete h._listeners:delete this._events[e])}else(s===t||s.listener&&s.listener===t||s._origin&&s._origin===t)&&(this.wildcard?delete h._listeners:delete this._events[e])}return this},i.prototype.offAny=function(e){var t,s=0,i=0;if(e&&this._all&&this._all.length>0){for(t=this._all,s=0,i=t.length;i>s;s++)if(e===t[s])return t.splice(s,1),this}else this._all=[];return this},i.prototype.removeListener=i.prototype.off,i.prototype.removeAllListeners=function(e){if(0===arguments.length)return!this._events||t.call(this),this;if(this.wildcard)for(var s="string"==typeof e?e.split(this.delimiter):e.slice(),i=n.call(this,null,s,this.listenerTree,0),r=0;r<i.length;r++){var l=i[r];l._listeners=null}else{if(!this._events[e])return this;this._events[e]=null}return this},i.prototype.listeners=function(e){if(this.wildcard){var s=[],i="string"==typeof e?e.split(this.delimiter):e.slice();return n.call(this,s,i,this.listenerTree,0),s}return this._events||t.call(this),this._events[e]||(this._events[e]=[]),l(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]},i.prototype.listenersAny=function(){return this._all?this._all:[]},"function"==typeof define&&define.amd?define(function(){return i}):e.EventEmitter2=i}("undefined"!=typeof e&&"undefined"!=typeof e.title&&"undefined"!=typeof exports?exports:window)}).call(this,require("/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"/Users/ritch/Projects/loopback/loopback-example-full-stack/html5/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":30}],114:[function(require,module,exports){
module.exports=require(98)
},{}],115:[function(require,module,exports){
function tostr(t){var o,r;for(o=[],r=0;r<t.length;r++)o.push(UIDCHARS[t[r]%UIDCHARS.length]);return o.join("")}function uid(t,o){return"undefined"==typeof o?tostr(crypto.pseudoRandomBytes(t)):void crypto.pseudoRandomBytes(t,function(t,r){return t?o(t):void o(null,tostr(r))})}var crypto=require("crypto"),UIDCHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";module.exports=uid;
},{"crypto":19}],116:[function(require,module,exports){
!function(e,n){"use strict";function r(e,n){var r,t,u=e.toLowerCase();for(n=[].concat(n),r=0;r<n.length;r+=1)if(t=n[r]){if(t.test&&t.test(e))return!0;if(t.toLowerCase()===u)return!0}}var t=n.prototype.trim,u=n.prototype.trimRight,i=n.prototype.trimLeft,l=function(e){return 1*e||0},o=function(e,n){if(1>n)return"";for(var r="";n>0;)1&n&&(r+=e),n>>=1,e+=e;return r},a=[].slice,c=function(e){return null==e?"\\s":e.source?e.source:"["+g.escapeRegExp(e)+"]"},s={lt:"<",gt:">",quot:'"',amp:"&",apos:"'"},f={};for(var p in s)f[s[p]]=p;f["'"]="#39";var h=function(){function e(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}var r=o,t=function(){return t.cache.hasOwnProperty(arguments[0])||(t.cache[arguments[0]]=t.parse(arguments[0])),t.format.call(null,t.cache[arguments[0]],arguments)};return t.format=function(t,u){var i,l,o,a,c,s,f,p=1,g=t.length,d="",m=[];for(l=0;g>l;l++)if(d=e(t[l]),"string"===d)m.push(t[l]);else if("array"===d){if(a=t[l],a[2])for(i=u[p],o=0;o<a[2].length;o++){if(!i.hasOwnProperty(a[2][o]))throw new Error(h('[_.sprintf] property "%s" does not exist',a[2][o]));i=i[a[2][o]]}else i=a[1]?u[a[1]]:u[p++];if(/[^s]/.test(a[8])&&"number"!=e(i))throw new Error(h("[_.sprintf] expecting number but found %s",e(i)));switch(a[8]){case"b":i=i.toString(2);break;case"c":i=n.fromCharCode(i);break;case"d":i=parseInt(i,10);break;case"e":i=a[7]?i.toExponential(a[7]):i.toExponential();break;case"f":i=a[7]?parseFloat(i).toFixed(a[7]):parseFloat(i);break;case"o":i=i.toString(8);break;case"s":i=(i=n(i))&&a[7]?i.substring(0,a[7]):i;break;case"u":i=Math.abs(i);break;case"x":i=i.toString(16);break;case"X":i=i.toString(16).toUpperCase()}i=/[def]/.test(a[8])&&a[3]&&i>=0?"+"+i:i,s=a[4]?"0"==a[4]?"0":a[4].charAt(1):" ",f=a[6]-n(i).length,c=a[6]?r(s,f):"",m.push(a[5]?i+c:c+i)}return m.join("")},t.cache={},t.parse=function(e){for(var n=e,r=[],t=[],u=0;n;){if(null!==(r=/^[^\x25]+/.exec(n)))t.push(r[0]);else if(null!==(r=/^\x25{2}/.exec(n)))t.push("%");else{if(null===(r=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(n)))throw new Error("[_.sprintf] huh?");if(r[2]){u|=1;var i=[],l=r[2],o=[];if(null===(o=/^([a-z_][a-z_\d]*)/i.exec(l)))throw new Error("[_.sprintf] huh?");for(i.push(o[1]);""!==(l=l.substring(o[0].length));)if(null!==(o=/^\.([a-z_][a-z_\d]*)/i.exec(l)))i.push(o[1]);else{if(null===(o=/^\[(\d+)\]/.exec(l)))throw new Error("[_.sprintf] huh?");i.push(o[1])}r[2]=i}else u|=2;if(3===u)throw new Error("[_.sprintf] mixing positional and named placeholders is not (yet) supported");t.push(r)}n=n.substring(r[0].length)}return t},t}(),g={VERSION:"2.3.0",isBlank:function(e){return null==e&&(e=""),/^\s*$/.test(e)},stripTags:function(e){return null==e?"":n(e).replace(/<\/?[^>]+>/g,"")},capitalize:function(e){return e=null==e?"":n(e),e.charAt(0).toUpperCase()+e.slice(1)},chop:function(e,r){return null==e?[]:(e=n(e),r=~~r,r>0?e.match(new RegExp(".{1,"+r+"}","g")):[e])},clean:function(e){return g.strip(e).replace(/\s+/g," ")},count:function(e,r){if(null==e||null==r)return 0;e=n(e),r=n(r);for(var t=0,u=0,i=r.length;;){if(u=e.indexOf(r,u),-1===u)break;t++,u+=i}return t},chars:function(e){return null==e?[]:n(e).split("")},swapCase:function(e){return null==e?"":n(e).replace(/\S/g,function(e){return e===e.toUpperCase()?e.toLowerCase():e.toUpperCase()})},escapeHTML:function(e){return null==e?"":n(e).replace(/[&<>"']/g,function(e){return"&"+f[e]+";"})},unescapeHTML:function(e){return null==e?"":n(e).replace(/\&([^;]+);/g,function(e,r){var t;return r in s?s[r]:(t=r.match(/^#x([\da-fA-F]+)$/))?n.fromCharCode(parseInt(t[1],16)):(t=r.match(/^#(\d+)$/))?n.fromCharCode(~~t[1]):e})},escapeRegExp:function(e){return null==e?"":n(e).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")},splice:function(e,n,r,t){var u=g.chars(e);return u.splice(~~n,~~r,t),u.join("")},insert:function(e,n,r){return g.splice(e,n,0,r)},include:function(e,r){return""===r?!0:null==e?!1:-1!==n(e).indexOf(r)},join:function(){var e=a.call(arguments),n=e.shift();return null==n&&(n=""),e.join(n)},lines:function(e){return null==e?[]:n(e).split("\n")},reverse:function(e){return g.chars(e).reverse().join("")},startsWith:function(e,r){return""===r?!0:null==e||null==r?!1:(e=n(e),r=n(r),e.length>=r.length&&e.slice(0,r.length)===r)},endsWith:function(e,r){return""===r?!0:null==e||null==r?!1:(e=n(e),r=n(r),e.length>=r.length&&e.slice(e.length-r.length)===r)},succ:function(e){return null==e?"":(e=n(e),e.slice(0,-1)+n.fromCharCode(e.charCodeAt(e.length-1)+1))},titleize:function(e){return null==e?"":(e=n(e).toLowerCase(),e.replace(/(?:^|\s|-)\S/g,function(e){return e.toUpperCase()}))},camelize:function(e){return g.trim(e).replace(/[-_\s]+(.)?/g,function(e,n){return n?n.toUpperCase():""})},underscored:function(e){return g.trim(e).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()},dasherize:function(e){return g.trim(e).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()},classify:function(e){return g.titleize(n(e).replace(/[\W_]/g," ")).replace(/\s/g,"")},humanize:function(e){return g.capitalize(g.underscored(e).replace(/_id$/,"").replace(/_/g," "))},trim:function(e,r){return null==e?"":!r&&t?t.call(e):(r=c(r),n(e).replace(new RegExp("^"+r+"+|"+r+"+$","g"),""))},ltrim:function(e,r){return null==e?"":!r&&i?i.call(e):(r=c(r),n(e).replace(new RegExp("^"+r+"+"),""))},rtrim:function(e,r){return null==e?"":!r&&u?u.call(e):(r=c(r),n(e).replace(new RegExp(r+"+$"),""))},truncate:function(e,r,t){return null==e?"":(e=n(e),t=t||"...",r=~~r,e.length>r?e.slice(0,r)+t:e)},prune:function(e,r,t){if(null==e)return"";if(e=n(e),r=~~r,t=null!=t?n(t):"...",e.length<=r)return e;var u=function(e){return e.toUpperCase()!==e.toLowerCase()?"A":" "},i=e.slice(0,r+1).replace(/.(?=\W*\w*$)/g,u);return i=i.slice(i.length-2).match(/\w\w/)?i.replace(/\s*\S+$/,""):g.rtrim(i.slice(0,i.length-1)),(i+t).length>e.length?e:e.slice(0,i.length)+t},words:function(e,n){return g.isBlank(e)?[]:g.trim(e,n).split(n||/\s+/)},pad:function(e,r,t,u){e=null==e?"":n(e),r=~~r;var i=0;switch(t?t.length>1&&(t=t.charAt(0)):t=" ",u){case"right":return i=r-e.length,e+o(t,i);case"both":return i=r-e.length,o(t,Math.ceil(i/2))+e+o(t,Math.floor(i/2));default:return i=r-e.length,o(t,i)+e}},lpad:function(e,n,r){return g.pad(e,n,r)},rpad:function(e,n,r){return g.pad(e,n,r,"right")},lrpad:function(e,n,r){return g.pad(e,n,r,"both")},sprintf:h,vsprintf:function(e,n){return n.unshift(e),h.apply(null,n)},toNumber:function(e,n){return e?(e=g.trim(e),e.match(/^-?\d+(?:\.\d+)?$/)?l(l(e).toFixed(~~n)):0/0):0},numberFormat:function(e,n,r,t){if(isNaN(e)||null==e)return"";e=e.toFixed(~~n),t="string"==typeof t?t:",";var u=e.split("."),i=u[0],l=u[1]?(r||".")+u[1]:"";return i.replace(/(\d)(?=(?:\d{3})+$)/g,"$1"+t)+l},strRight:function(e,r){if(null==e)return"";e=n(e),r=null!=r?n(r):r;var t=r?e.indexOf(r):-1;return~t?e.slice(t+r.length,e.length):e},strRightBack:function(e,r){if(null==e)return"";e=n(e),r=null!=r?n(r):r;var t=r?e.lastIndexOf(r):-1;return~t?e.slice(t+r.length,e.length):e},strLeft:function(e,r){if(null==e)return"";e=n(e),r=null!=r?n(r):r;var t=r?e.indexOf(r):-1;return~t?e.slice(0,t):e},strLeftBack:function(e,n){if(null==e)return"";e+="",n=null!=n?""+n:n;var r=e.lastIndexOf(n);return~r?e.slice(0,r):e},toSentence:function(e,n,r,t){n=n||", ",r=r||" and ";var u=e.slice(),i=u.pop();return e.length>2&&t&&(r=g.rtrim(n)+r),u.length?u.join(n)+r+i:i},toSentenceSerial:function(){var e=a.call(arguments);return e[3]=!0,g.toSentence.apply(g,e)},slugify:function(e){if(null==e)return"";var r="ąàáäâãåæăćęèéëêìíïîłńòóöôõøśșțùúüûñçżź",t="aaaaaaaaaceeeeeiiiilnoooooosstuuuunczz",u=new RegExp(c(r),"g");return e=n(e).toLowerCase().replace(u,function(e){var n=r.indexOf(e);return t.charAt(n)||"-"}),g.dasherize(e.replace(/[^\w\s-]/g,""))},surround:function(e,n){return[n,e,n].join("")},quote:function(e,n){return g.surround(e,n||'"')},unquote:function(e,n){return n=n||'"',e[0]===n&&e[e.length-1]===n?e.slice(1,e.length-1):e},exports:function(){var e={};for(var n in this)this.hasOwnProperty(n)&&!n.match(/^(?:include|contains|reverse)$/)&&(e[n]=this[n]);return e},repeat:function(e,r,t){if(null==e)return"";if(r=~~r,null==t)return o(n(e),r);for(var u=[];r>0;u[--r]=e);return u.join(t)},naturalCmp:function(e,r){if(e==r)return 0;if(!e)return-1;if(!r)return 1;for(var t=/(\.\d+)|(\d+)|(\D+)/g,u=n(e).toLowerCase().match(t),i=n(r).toLowerCase().match(t),l=Math.min(u.length,i.length),o=0;l>o;o++){var a=u[o],c=i[o];if(a!==c){var s=parseInt(a,10);if(!isNaN(s)){var f=parseInt(c,10);if(!isNaN(f)&&s-f)return s-f}return c>a?-1:1}}return u.length===i.length?u.length-i.length:r>e?-1:1},levenshtein:function(e,r){if(null==e&&null==r)return 0;if(null==e)return n(r).length;if(null==r)return n(e).length;e=n(e),r=n(r);for(var t,u,i=[],l=0;l<=r.length;l++)for(var o=0;o<=e.length;o++)u=l&&o?e.charAt(o-1)===r.charAt(l-1)?t:Math.min(i[o],i[o-1],t)+1:l+o,t=i[o],i[o]=u;return i.pop()},toBoolean:function(e,n,t){return"number"==typeof e&&(e=""+e),"string"!=typeof e?!!e:(e=g.trim(e),r(e,n||["true","1"])?!0:r(e,t||["false","0"])?!1:void 0)}};g.strip=g.trim,g.lstrip=g.ltrim,g.rstrip=g.rtrim,g.center=g.lrpad,g.rjust=g.lpad,g.ljust=g.rpad,g.contains=g.include,g.q=g.quote,g.toBool=g.toBoolean,"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(module.exports=g),exports._s=g),"function"==typeof define&&define.amd&&define("underscore.string",[],function(){return g}),e._=e._||{},e._.string=e._.str=g}(this,String);
},{}],117:[function(require,module,exports){
(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?void(this._wrapped=n):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.6.0";var A=j.each=j.forEach=function(n,t,e){if(null==n)return n;if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return;return n};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var O="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},j.find=j.detect=function(n,t,r){var e;return k(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var k=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?-1!=n.indexOf(t):k(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,j.property(t))},j.where=function(n,t){return j.filter(n,j.matches(t))},j.findWhere=function(n,t){return j.find(n,j.matches(t))},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);var e=-1/0,u=-1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;o>u&&(e=n,u=o)}),e},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);var e=1/0,u=1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;u>o&&(e=n,u=o)}),e},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=j.values(n)),n[j.random(n.length-1)]):j.shuffle(n).slice(0,Math.max(0,t))};var E=function(n){return null==n?j.identity:j.isFunction(n)?n:j.property(n)};j.sortBy=function(n,t,r){return t=E(t),j.pluck(j.map(n,function(n,e,u){return{value:n,index:e,criteria:t.call(r,n,e,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||void 0===r)return 1;if(e>r||void 0===e)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=E(r),A(t,function(i,a){var o=r.call(e,i,a,t);n(u,o,i)}),u}};j.groupBy=F(function(n,t,r){j.has(n,t)?n[t].push(r):n[t]=[r]}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=E(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])<u?i=o+1:a=o}return i},j.toArray=function(n){return n?j.isArray(n)?o.call(n):n.length===+n.length?j.map(n,j.identity):j.values(n):[]},j.size=function(n){return null==n?0:n.length===+n.length?n.length:j.keys(n).length},j.first=j.head=j.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:0>t?[]:o.call(n,0,t)},j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var M=function(n,t,r){return t&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){return M(n,t,[])},j.without=function(n){return j.difference(n,o.call(arguments,1))},j.partition=function(n,t){var r=[],e=[];return A(n,function(n){(t(n)?r:e).push(n)}),[r,e]},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.contains(t,n)})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var R=function(){};j.bind=function(n,t){var r,e;if(_&&n.bind===_)return _.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;var u=new R;R.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){for(var r=0,e=t.slice(),u=0,i=e.length;i>u;u++)e[u]===j&&(e[u]=arguments[r++]);for(;r<arguments.length;)e.push(arguments[r++]);return n.apply(this,e)}},j.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return A(t,function(t){n[t]=j.bind(n[t],n)}),n},j.memoize=function(n,t){var r={};return t||(t=j.identity),function(){var e=t.apply(this,arguments);return j.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},j.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},j.defer=function(n){return j.delay.apply(j,[n,1].concat(o.call(arguments,1)))},j.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var c=function(){o=r.leading===!1?0:j.now(),a=null,i=n.apply(e,u),e=u=null};return function(){var l=j.now();o||r.leading!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u),e=u=null):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u,i,a,o,c=function(){var l=j.now()-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u),i=u=null))};return function(){i=this,u=arguments,a=j.now();var l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u),i=u=null),o}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return j.partial(t,n)},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=function(n){if(!j.isObject(n))return[];if(w)return w(n);var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},j.pairs=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},j.invert=function(n){for(var t={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)void 0===n[r]&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o)&&"constructor"in n&&"constructor"in t)return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return void 0===n},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.constant=function(n){return function(){return n}},j.property=function(n){return function(t){return t[n]}},j.matches=function(n){return function(t){if(t===n)return!0;for(var r in n)if(n[r]!==t[r])return!1;return!0}},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},j.now=Date.now||function(){return(new Date).getTime()};var T={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};T.unescape=j.invert(T.escape);var I={escape:new RegExp("["+j.keys(T.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(T.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(I[n],function(t){return T[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return j})}).call(this);
},{}],118:[function(require,module,exports){
module.exports={
"name": "loopback",
"description": "LoopBack: Open Mobile Platform for Node.js",
"keywords": [
"StrongLoop",
"LoopBack",
"Mobile",
"Backend",
"Platform",
"mBaaS"
],
"version": "1.7.2",
"scripts": {
"test": "mocha -R spec"
},
"dependencies": {
"debug": "~0.7.4",
"express": "~3.4.8",
"strong-remoting": "~1.3.1",
"inflection": "~1.3.5",
"passport": "~0.2.0",
"passport-local": "~0.1.6",
"nodemailer": "~0.6.0",
"ejs": "~0.8.5",
"bcryptjs": "~0.7.12",
"underscore.string": "~2.3.3",
"underscore": "~1.6.0",
"uid2": "0.0.3",
"async": "~0.2.10"
},
"peerDependencies": {
"loopback-datasource-juggler": "~1.3.3"
},
"devDependencies": {
"loopback-datasource-juggler": "~1.3.3",
"mocha": "~1.17.1",
"strong-task-emitter": "0.0.x",
"supertest": "~0.9.0",
"chai": "~1.9.0",
"loopback-testing": "~0.1.2",
"browserify": "~3.30.2",
"grunt": "~0.4.2",
"grunt-browserify": "~1.3.1",
"grunt-contrib-uglify": "~0.3.2",
"grunt-contrib-jshint": "~0.8.0",
"grunt-contrib-watch": "~0.5.3",
"karma-script-launcher": "~0.1.0",
"karma-chrome-launcher": "~0.1.2",
"karma-firefox-launcher": "~0.1.3",
"karma-html2js-preprocessor": "~0.1.0",
"karma-phantomjs-launcher": "~0.1.2",
"karma": "~0.10.9",
"karma-browserify": "0.1.0",
"karma-mocha": "~0.1.1",
"grunt-karma": "~0.6.2"
},
"repository": {
"type": "git",
"url": "https://github.com/strongloop/loopback"
},
"browser": {
"express": "./lib/browser-express.js",
"connect": false,
"passport": false,
"passport-local": false,
"nodemailer": false
},
"license": {
"name": "Dual MIT/StrongLoop",
"url": "https://github.com/strongloop/loopback/blob/master/LICENSE"
}
}
},{}]},{},[1])
Morty Proxy This is a proxified and sanitized view of the page, visit original site.