Divide the MSB source codes into two repos
[msb/apigateway.git] / apiroute / apiroute-service / src / main / resources / api-doc / swagger-ui.js
1 /**
2  * swagger-ui - Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API
3  * @version v2.1.8-M1
4  * @link http://swagger.io
5  * @license Apache 2.0
6  */
7 $(function() {
8
9         // Helper function for vertically aligning DOM elements
10         // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
11         $.fn.vAlign = function() {
12                 return this.each(function(i){
13                 var ah = $(this).height();
14                 var ph = $(this).parent().height();
15                 var mh = (ph - ah) / 2;
16                 $(this).css('margin-top', mh);
17                 });
18         };
19
20         $.fn.stretchFormtasticInputWidthToParent = function() {
21                 return this.each(function(i){
22                 var p_width = $(this).closest("form").innerWidth();
23                 var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
24                 var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
25                 $(this).css('width', p_width - p_padding - this_padding);
26                 });
27         };
28
29         $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
30
31         // Vertically center these paragraphs
32         // Parent may need a min-height for this to work..
33         $('ul.downplayed li div.content p').vAlign();
34
35         // When a sandbox form is submitted..
36         $("form.sandbox").submit(function(){
37
38                 var error_free = true;
39
40                 // Cycle through the forms required inputs
41                 $(this).find("input.required").each(function() {
42
43                         // Remove any existing error styles from the input
44                         $(this).removeClass('error');
45
46                         // Tack the error style on if the input is empty..
47                         if ($(this).val() == '') {
48                                 $(this).addClass('error');
49                                 $(this).wiggle();
50                                 error_free = false;
51                         }
52
53                 });
54
55                 return error_free;
56         });
57
58 });
59
60 function clippyCopiedCallback(a) {
61   $('#api_key_copied').fadeIn().delay(1000).fadeOut();
62
63   // var b = $("#clippy_tooltip_" + a);
64   // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
65   //   b.attr("title", "copy to clipboard")
66   // },
67   // 500))
68 }
69
70 // Logging function that accounts for browsers that don't have window.console
71 log = function(){
72   log.history = log.history || [];
73   log.history.push(arguments);
74   if(this.console){
75     console.log( Array.prototype.slice.call(arguments)[0] );
76   }
77 };
78
79 // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
80 if (Function.prototype.bind && console && typeof console.log == "object") {
81     [
82       "log","info","warn","error","assert","dir","clear","profile","profileEnd"
83     ].forEach(function (method) {
84         console[method] = this.bind(console[method], console);
85     }, Function.prototype.call);
86 }
87
88 var Docs = {
89
90         shebang: function() {
91
92                 // If shebang has an operation nickname in it..
93                 // e.g. /docs/#!/words/get_search
94                 var fragments = $.param.fragment().split('/');
95                 fragments.shift(); // get rid of the bang
96
97                 switch (fragments.length) {
98                         case 1:
99                                 // Expand all operations for the resource and scroll to it
100                                 var dom_id = 'resource_' + fragments[0];
101
102                                 Docs.expandEndpointListForResource(fragments[0]);
103                                 $("#"+dom_id).slideto({highlight: false});
104                                 break;
105                         case 2:
106                                 // Refer to the endpoint DOM element, e.g. #words_get_search
107
108         // Expand Resource
109         Docs.expandEndpointListForResource(fragments[0]);
110         $("#"+dom_id).slideto({highlight: false});
111
112         // Expand operation
113                                 var li_dom_id = fragments.join('_');
114                                 var li_content_dom_id = li_dom_id + "_content";
115
116
117                                 Docs.expandOperation($('#'+li_content_dom_id));
118                                 $('#'+li_dom_id).slideto({highlight: false});
119                                 break;
120                 }
121
122         },
123
124         toggleEndpointListForResource: function(resource) {
125                 var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
126                 if (elem.is(':visible')) {
127                         Docs.collapseEndpointListForResource(resource);
128                 } else {
129                         Docs.expandEndpointListForResource(resource);
130                 }
131         },
132
133         // Expand resource
134         expandEndpointListForResource: function(resource) {
135                 var resource = Docs.escapeResourceName(resource);
136                 if (resource == '') {
137                         $('.resource ul.endpoints').slideDown();
138                         return;
139                 }
140                 
141                 $('li#resource_' + resource).addClass('active');
142
143                 var elem = $('li#resource_' + resource + ' ul.endpoints');
144                 elem.slideDown();
145         },
146
147         // Collapse resource and mark as explicitly closed
148         collapseEndpointListForResource: function(resource) {
149                 var resource = Docs.escapeResourceName(resource);
150                 if (resource == '') {
151                         $('.resource ul.endpoints').slideUp();
152                         return;
153                 }
154
155                 $('li#resource_' + resource).removeClass('active');
156
157                 var elem = $('li#resource_' + resource + ' ul.endpoints');
158                 elem.slideUp();
159         },
160
161         expandOperationsForResource: function(resource) {
162                 // Make sure the resource container is open..
163                 Docs.expandEndpointListForResource(resource);
164                 
165                 if (resource == '') {
166                         $('.resource ul.endpoints li.operation div.content').slideDown();
167                         return;
168                 }
169
170                 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
171                         Docs.expandOperation($(this));
172                 });
173         },
174
175         collapseOperationsForResource: function(resource) {
176                 // Make sure the resource container is open..
177                 Docs.expandEndpointListForResource(resource);
178
179                 if (resource == '') {
180                         $('.resource ul.endpoints li.operation div.content').slideUp();
181                         return;
182                 }
183
184                 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
185                         Docs.collapseOperation($(this));
186                 });
187         },
188
189         escapeResourceName: function(resource) {
190                 return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
191         },
192
193         expandOperation: function(elem) {
194                 elem.slideDown();
195         },
196
197         collapseOperation: function(elem) {
198                 elem.slideUp();
199         }
200 };
201
202 this["Handlebars"] = this["Handlebars"] || {};
203 this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
204 this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
205   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
206   return "<!--div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div class='auth_container' id='apikey_container'>\n  <div class='key_input_container'>\n    <div class='auth_label'>"
207     + escapeExpression(((helper = (helper = helpers.keyName || (depth0 != null ? depth0.keyName : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"keyName","hash":{},"data":data}) : helper)))
208     + "</div>\n    <input placeholder=\"api_key\" class=\"auth_input\" id=\"input_apiKey_entry\" name=\"apiKey\" type=\"text\"/>\n    <div class='auth_submit'><a class='auth_submit_button' id=\"apply_api_key\" href=\"#\">apply</a></div>\n  </div>\n</div>\n\n";
209 },"useData":true});
210 var SwaggerUi,
211   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
212   __hasProp = {}.hasOwnProperty;
213
214 SwaggerUi = (function(_super) {
215   __extends(SwaggerUi, _super);
216
217   function SwaggerUi() {
218     return SwaggerUi.__super__.constructor.apply(this, arguments);
219   }
220
221   SwaggerUi.prototype.dom_id = "swagger_ui";
222
223   SwaggerUi.prototype.options = null;
224
225   SwaggerUi.prototype.api = null;
226
227   SwaggerUi.prototype.headerView = null;
228
229   SwaggerUi.prototype.mainView = null;
230
231   SwaggerUi.prototype.initialize = function(options) {
232     if (options == null) {
233       options = {};
234     }
235     if (options.dom_id != null) {
236       this.dom_id = options.dom_id;
237       delete options.dom_id;
238     }
239     if (options.supportedSubmitMethods == null) {
240       options.supportedSubmitMethods = ['get', 'put', 'post', 'delete', 'head', 'options', 'patch'];
241     }
242     if ($('#' + this.dom_id) == null) {
243       $('body').append('<div id="' + this.dom_id + '"></div>');
244     }
245     this.options = options;
246     this.options.success = (function(_this) {
247       return function() {
248         return _this.render();
249       };
250     })(this);
251     this.options.progress = (function(_this) {
252       return function(d) {
253         return _this.showMessage(d);
254       };
255     })(this);
256     this.options.failure = (function(_this) {
257       return function(d) {
258         return _this.onLoadFailure(d);
259       };
260     })(this);
261     this.headerView = new HeaderView({
262       el: $('#header')
263     });
264     return this.headerView.on('update-swagger-ui', (function(_this) {
265       return function(data) {
266         return _this.updateSwaggerUi(data);
267       };
268     })(this));
269   };
270
271   SwaggerUi.prototype.setOption = function(option, value) {
272     return this.options[option] = value;
273   };
274
275   SwaggerUi.prototype.getOption = function(option) {
276     return this.options[option];
277   };
278
279   SwaggerUi.prototype.updateSwaggerUi = function(data) {
280     this.options.url = data.url;
281     return this.load();
282   };
283
284   SwaggerUi.prototype.load = function() {
285     var url, _ref;
286     if ((_ref = this.mainView) != null) {
287       _ref.clear();
288     }
289     url = this.options.url;
290     if (url && url.indexOf("http") !== 0) {
291       url = this.buildUrl(window.location.href.toString(), url);
292     }
293     this.options.url = url;
294     this.headerView.update(url);
295     return this.api = new SwaggerClient(this.options);
296   };
297
298   SwaggerUi.prototype.collapseAll = function() {
299     return Docs.collapseEndpointListForResource('');
300   };
301
302   SwaggerUi.prototype.listAll = function() {
303     return Docs.collapseOperationsForResource('');
304   };
305
306   SwaggerUi.prototype.expandAll = function() {
307     return Docs.expandOperationsForResource('');
308   };
309
310   SwaggerUi.prototype.render = function() {
311     this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
312     this.mainView = new MainView({
313       model: this.api,
314       el: $('#' + this.dom_id),
315       swaggerOptions: this.options
316     }).render();
317     this.showMessage();
318     switch (this.options.docExpansion) {
319       case "full":
320         this.expandAll();
321         break;
322       case "list":
323         this.listAll();
324     }
325     this.renderGFM();
326     if (this.options.onComplete) {
327       this.options.onComplete(this.api, this);
328     }
329     return setTimeout((function(_this) {
330       return function() {
331         return Docs.shebang();
332       };
333     })(this), 100);
334   };
335
336   SwaggerUi.prototype.buildUrl = function(base, url) {
337     var endOfPath, parts;
338     if (url.indexOf("/") === 0) {
339       parts = base.split("/");
340       base = parts[0] + "//" + parts[2];
341       return base + url;
342     } else {
343       endOfPath = base.length;
344       if (base.indexOf("?") > -1) {
345         endOfPath = Math.min(endOfPath, base.indexOf("?"));
346       }
347       if (base.indexOf("#") > -1) {
348         endOfPath = Math.min(endOfPath, base.indexOf("#"));
349       }
350       base = base.substring(0, endOfPath);
351       if (base.indexOf("/", base.length - 1) !== -1) {
352         return base + url;
353       }
354       return base + "/" + url;
355     }
356   };
357
358   SwaggerUi.prototype.showMessage = function(data) {
359     if (data == null) {
360       data = '';
361     }
362     $('#message-bar').removeClass('message-fail');
363     $('#message-bar').addClass('message-success');
364     return $('#message-bar').html(data);
365   };
366
367   SwaggerUi.prototype.onLoadFailure = function(data) {
368     var val;
369     if (data == null) {
370       data = '';
371     }
372     $('#message-bar').removeClass('message-success');
373     $('#message-bar').addClass('message-fail');
374     val = $('#message-bar').html(data);
375     if (this.options.onFailure != null) {
376       this.options.onFailure(data);
377     }
378     return val;
379   };
380
381   SwaggerUi.prototype.renderGFM = function(data) {
382     if (data == null) {
383       data = '';
384     }
385     return $('.markdown').each(function(index) {
386       return $(this).html(marked($(this).html()));
387     });
388   };
389
390   return SwaggerUi;
391
392 })(Backbone.Router);
393
394 window.SwaggerUi = SwaggerUi;
395
396 this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
397   return "<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>\n<div class='auth_container' id='basic_auth_container'>\n  <div class='key_input_container'>\n    <div class=\"auth_label\">Username</div>\n    <input placeholder=\"username\" class=\"auth_input\" id=\"input_username\" name=\"username\" type=\"text\"/>\n    <div class=\"auth_label\">Password</div>\n    <input placeholder=\"password\" class=\"auth_input\" id=\"input_password\" name=\"password\" type=\"password\"/>\n    <div class='auth_submit'><a class='auth_submit_button' id=\"apply_basic_auth\" href=\"#\">apply</a></div>\n  </div>\n</div>\n\n";
398   },"useData":true});
399 Handlebars.registerHelper('sanitize', function(html) {
400   html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
401   return new Handlebars.SafeString(html);
402 });
403
404 this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
405   var stack1, buffer = "";
406   stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
407   if (stack1 != null) { buffer += stack1; }
408   return buffer;
409 },"2":function(depth0,helpers,partials,data) {
410   var stack1, lambda=this.lambda, buffer = "    <option value=\"";
411   stack1 = lambda(depth0, depth0);
412   if (stack1 != null) { buffer += stack1; }
413   buffer += "\">";
414   stack1 = lambda(depth0, depth0);
415   if (stack1 != null) { buffer += stack1; }
416   return buffer + "</option>\n";
417 },"4":function(depth0,helpers,partials,data) {
418   return "  <option value=\"application/json\">application/json</option>\n";
419   },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
420   var stack1, buffer = "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
421   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
422   if (stack1 != null) { buffer += stack1; }
423   return buffer + "</select>\n";
424 },"useData":true});
425 var ApiKeyButton,
426   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
427   __hasProp = {}.hasOwnProperty;
428
429 ApiKeyButton = (function(_super) {
430   __extends(ApiKeyButton, _super);
431
432   function ApiKeyButton() {
433     return ApiKeyButton.__super__.constructor.apply(this, arguments);
434   }
435
436   ApiKeyButton.prototype.initialize = function() {};
437
438   ApiKeyButton.prototype.render = function() {
439     var template;
440     template = this.template();
441     $(this.el).html(template(this.model));
442     return this;
443   };
444
445   ApiKeyButton.prototype.events = {
446     "click #apikey_button": "toggleApiKeyContainer",
447     "click #apply_api_key": "applyApiKey"
448   };
449
450   ApiKeyButton.prototype.applyApiKey = function() {
451     var elem;
452     window.authorizations.add(this.model.name, new ApiKeyAuthorization(this.model.name, $("#input_apiKey_entry").val(), this.model["in"]));
453     window.swaggerUi.load();
454     return elem = $('#apikey_container').show();
455   };
456
457   ApiKeyButton.prototype.toggleApiKeyContainer = function() {
458     var elem;
459     if ($('#apikey_container').length > 0) {
460       elem = $('#apikey_container').first();
461       if (elem.is(':visible')) {
462         return elem.hide();
463       } else {
464         $('.auth_container').hide();
465         return elem.show();
466       }
467     }
468   };
469
470   ApiKeyButton.prototype.template = function() {
471     return Handlebars.templates.apikey_button_view;
472   };
473
474   return ApiKeyButton;
475
476 })(Backbone.View);
477
478 this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
479   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = "  <div class=\"info_title\">"
480     + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
481     + "</div>\n  <div class=\"info_description markdown\">";
482   stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.description : stack1), depth0);
483   if (stack1 != null) { buffer += stack1; }
484   buffer += "</div>\n  ";
485   stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
486   if (stack1 != null) { buffer += stack1; }
487   buffer += "\n  ";
488   stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.noop,"data":data});
489   if (stack1 != null) { buffer += stack1; }
490   buffer += "\n  ";
491   stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), {"name":"if","hash":{},"fn":this.program(6, data),"inverse":this.noop,"data":data});
492   if (stack1 != null) { buffer += stack1; }
493   buffer += "\n  ";
494   stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), {"name":"if","hash":{},"fn":this.program(8, data),"inverse":this.noop,"data":data});
495   if (stack1 != null) { buffer += stack1; }
496   buffer += "\n  ";
497   stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
498   if (stack1 != null) { buffer += stack1; }
499   return buffer + "\n";
500 },"2":function(depth0,helpers,partials,data) {
501   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
502   return "<div class=\"info_tos\"><a href=\""
503     + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), depth0))
504     + "\">Terms of service</a></div>";
505 },"4":function(depth0,helpers,partials,data) {
506   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
507   return "<div class='info_name'>Created by "
508     + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
509     + "</div>";
510 },"6":function(depth0,helpers,partials,data) {
511   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
512   return "<div class='info_url'>See more at <a href=\""
513     + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
514     + "\">"
515     + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
516     + "</a></div>";
517 },"8":function(depth0,helpers,partials,data) {
518   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
519   return "<div class='info_email'><a href=\"mailto:"
520     + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), depth0))
521     + "?subject="
522     + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
523     + "\">Contact the developer</a></div>";
524 },"10":function(depth0,helpers,partials,data) {
525   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
526   return "<div class='info_license'><a href='"
527     + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.url : stack1), depth0))
528     + "'>"
529     + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.name : stack1), depth0))
530     + "</a></div>";
531 },"12":function(depth0,helpers,partials,data) {
532   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
533   return "    , <span style=\"font-variant: small-caps\">api version</span>: "
534     + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), depth0))
535     + "\n    ";
536 },"14":function(depth0,helpers,partials,data) {
537   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
538   return "    <span style=\"float:right\"><a href=\""
539     + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
540     + "/debug?url="
541     + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
542     + "\"><img id=\"validator\" src=\""
543     + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
544     + "?url="
545     + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
546     + "\"></a>\n    </span>\n";
547 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
548   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class='info' id='api_info'>\n";
549   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.info : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
550   if (stack1 != null) { buffer += stack1; }
551   buffer += "</div>\n<div class='container' id='resources_container'>\n  <ul id='resources'></ul>\n\n  <div class=\"footer\">\n    <br>\n    <br>\n    <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: "
552     + escapeExpression(((helper = (helper = helpers.basePath || (depth0 != null ? depth0.basePath : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"basePath","hash":{},"data":data}) : helper)))
553     + "\n";
554   stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), {"name":"if","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data});
555   if (stack1 != null) { buffer += stack1; }
556   buffer += "]\n";
557   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.validatorUrl : depth0), {"name":"if","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data});
558   if (stack1 != null) { buffer += stack1; }
559   return buffer + "    </h4>\n    </div>\n</div>\n";
560 },"useData":true});
561 var BasicAuthButton,
562   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
563   __hasProp = {}.hasOwnProperty;
564
565 BasicAuthButton = (function(_super) {
566   __extends(BasicAuthButton, _super);
567
568   function BasicAuthButton() {
569     return BasicAuthButton.__super__.constructor.apply(this, arguments);
570   }
571
572   BasicAuthButton.prototype.initialize = function() {};
573
574   BasicAuthButton.prototype.render = function() {
575     var template;
576     template = this.template();
577     $(this.el).html(template(this.model));
578     return this;
579   };
580
581   BasicAuthButton.prototype.events = {
582     "click #basic_auth_button": "togglePasswordContainer",
583     "click #apply_basic_auth": "applyPassword"
584   };
585
586   BasicAuthButton.prototype.applyPassword = function() {
587     var elem, password, username;
588     username = $(".input_username").val();
589     password = $(".input_password").val();
590     window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
591     window.swaggerUi.load();
592     return elem = $('#basic_auth_container').hide();
593   };
594
595   BasicAuthButton.prototype.togglePasswordContainer = function() {
596     var elem;
597     if ($('#basic_auth_container').length > 0) {
598       elem = $('#basic_auth_container').show();
599       if (elem.is(':visible')) {
600         return elem.slideUp();
601       } else {
602         $('.auth_container').hide();
603         return elem.show();
604       }
605     }
606   };
607
608   BasicAuthButton.prototype.template = function() {
609     return Handlebars.templates.basic_auth_button_view;
610   };
611
612   return BasicAuthButton;
613
614 })(Backbone.View);
615
616 this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
617   return "deprecated";
618   },"3":function(depth0,helpers,partials,data) {
619   return "            <h4>Warning: Deprecated</h4>\n";
620   },"5":function(depth0,helpers,partials,data) {
621   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = "        <h4>Implementation Notes</h4>\n        <p class=\"markdown\">";
622   stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
623   if (stack1 != null) { buffer += stack1; }
624   return buffer + "</p>\n";
625 },"7":function(depth0,helpers,partials,data) {
626   return "        <div class=\"auth\">\n        <span class=\"api-ic ic-error\"></span>";
627   },"9":function(depth0,helpers,partials,data) {
628   var stack1, buffer = "          <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n";
629   stack1 = helpers.each.call(depth0, depth0, {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
630   if (stack1 != null) { buffer += stack1; }
631   return buffer + "          </div>\n";
632 },"10":function(depth0,helpers,partials,data) {
633   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = "            <div title='";
634   stack1 = lambda((depth0 != null ? depth0.description : depth0), depth0);
635   if (stack1 != null) { buffer += stack1; }
636   return buffer + "'>"
637     + escapeExpression(lambda((depth0 != null ? depth0.scope : depth0), depth0))
638     + "</div>\n";
639 },"12":function(depth0,helpers,partials,data) {
640   return "</div>";
641   },"14":function(depth0,helpers,partials,data) {
642   return "        <div class='access'>\n          <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n        </div>\n";
643   },"16":function(depth0,helpers,partials,data) {
644   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
645   return "          <h4>Response Class (Status "
646     + escapeExpression(((helper = (helper = helpers.successCode || (depth0 != null ? depth0.successCode : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"successCode","hash":{},"data":data}) : helper)))
647     + ")</h4>\n          <p><span class=\"model-signature\" /></p>\n          <br/>\n          <div class=\"response-content-type\" />\n";
648 },"18":function(depth0,helpers,partials,data) {
649   return "          <h4>Parameters</h4>\n          <table class='fullwidth'>\n          <thead>\n            <tr>\n            <th style=\"width: 100px; max-width: 100px\">Parameter</th>\n            <th style=\"width: 310px; max-width: 310px\">Value</th>\n            <th style=\"width: 200px; max-width: 200px\">Description</th>\n            <th style=\"width: 100px; max-width: 100px\">Parameter Type</th>\n            <th style=\"width: 220px; max-width: 230px\">Data Type</th>\n            </tr>\n          </thead>\n          <tbody class=\"operation-params\">\n\n          </tbody>\n          </table>\n";
650   },"20":function(depth0,helpers,partials,data) {
651   return "          <div style='margin:0;padding:0;display:inline'></div>\n          <h4>Response Messages</h4>\n          <table class='fullwidth'>\n            <thead>\n            <tr>\n              <th>HTTP Status Code</th>\n              <th>Reason</th>\n              <th>Response Model</th>\n            </tr>\n            </thead>\n            <tbody class=\"operation-status\">\n            \n            </tbody>\n          </table>\n";
652   },"22":function(depth0,helpers,partials,data) {
653   return "";
654 },"24":function(depth0,helpers,partials,data) {
655   return "          <div class='sandbox_header'>\n            <input class='submit' name='commit' type='button' value='Try it out!' />\n            <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n            <span class='response_throbber' style='display:none'></span>\n          </div>\n";
656   },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
657   var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "\n  <ul class='operations' >\n    <li class='"
658     + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
659     + " operation' id='"
660     + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
661     + "_"
662     + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
663     + "'>\n      <div class='heading'>\n        <h3>\n          <span class='http_method'>\n          <a href='#!/"
664     + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
665     + "/"
666     + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
667     + "' class=\"toggleOperation\">"
668     + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
669     + "</a>\n          </span>\n          <span class='path'>\n          <a href='#!/"
670     + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
671     + "/"
672     + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
673     + "' class=\"toggleOperation ";
674   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
675   if (stack1 != null) { buffer += stack1; }
676   buffer += "\">"
677     + escapeExpression(((helper = (helper = helpers.path || (depth0 != null ? depth0.path : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"path","hash":{},"data":data}) : helper)))
678     + "</a>\n          </span>\n        </h3>\n        <ul class='options'>\n          <li>\n          <a href='#!/"
679     + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
680     + "/"
681     + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
682     + "' class=\"toggleOperation\">";
683   stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
684   if (stack1 != null) { buffer += stack1; }
685   buffer += "</a>\n          </li>\n        </ul>\n      </div>\n      <div class='content' id='"
686     + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
687     + "_"
688     + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
689     + "_content' style='display:none'>\n";
690   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
691   if (stack1 != null) { buffer += stack1; }
692   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.description : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
693   if (stack1 != null) { buffer += stack1; }
694   stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(7, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
695   if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
696   if (stack1 != null) { buffer += stack1; }
697   buffer += "\n";
698   stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.oauth : depth0), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
699   if (stack1 != null) { buffer += stack1; }
700   buffer += "        ";
701   stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
702   if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
703   if (stack1 != null) { buffer += stack1; }
704   buffer += "\n";
705   stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
706   if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
707   if (stack1 != null) { buffer += stack1; }
708   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.type : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
709   if (stack1 != null) { buffer += stack1; }
710   buffer += "        <form accept-charset='UTF-8' class='sandbox'>\n          <div style='margin:0;padding:0;display:inline'></div>\n";
711   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.parameters : depth0), {"name":"if","hash":{},"fn":this.program(18, data),"inverse":this.noop,"data":data});
712   if (stack1 != null) { buffer += stack1; }
713   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.responseMessages : depth0), {"name":"if","hash":{},"fn":this.program(20, data),"inverse":this.noop,"data":data});
714   if (stack1 != null) { buffer += stack1; }
715   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isReadOnly : depth0), {"name":"if","hash":{},"fn":this.program(22, data),"inverse":this.program(24, data),"data":data});
716   if (stack1 != null) { buffer += stack1; }
717   return buffer + "        </form>\n        <div class='response' style='display:none'>\n          <h4>Request URL</h4>\n          <div class='block request_url'></div>\n          <h4>Response Body</h4>\n          <div class='block response_body'></div>\n          <h4>Response Code</h4>\n          <div class='block response_code'></div>\n          <h4>Response Headers</h4>\n          <div class='block response_headers'></div>\n        </div>\n      </div>\n    </li>\n  </ul>\n";
718 },"useData":true});
719 var ContentTypeView,
720   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
721   __hasProp = {}.hasOwnProperty;
722
723 ContentTypeView = (function(_super) {
724   __extends(ContentTypeView, _super);
725
726   function ContentTypeView() {
727     return ContentTypeView.__super__.constructor.apply(this, arguments);
728   }
729
730   ContentTypeView.prototype.initialize = function() {};
731
732   ContentTypeView.prototype.render = function() {
733     var template;
734     template = this.template();
735     $(this.el).html(template(this.model));
736     $('label[for=contentType]', $(this.el)).text('Response Content Type');
737     return this;
738   };
739
740   ContentTypeView.prototype.template = function() {
741     return Handlebars.templates.content_type;
742   };
743
744   return ContentTypeView;
745
746 })(Backbone.View);
747
748 this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
749   var stack1, buffer = "";
750   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
751   if (stack1 != null) { buffer += stack1; }
752   return buffer;
753 },"2":function(depth0,helpers,partials,data) {
754   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
755   return "                      <input type=\"file\" name='"
756     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
757     + "'/>\n                    <div class=\"parameter-content-type\" />\n";
758 },"4":function(depth0,helpers,partials,data) {
759   var stack1, buffer = "";
760   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
761   if (stack1 != null) { buffer += stack1; }
762   return buffer;
763 },"5":function(depth0,helpers,partials,data) {
764   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
765   return "                              <textarea class='body-textarea' name='"
766     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
767     + "'>"
768     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
769     + "</textarea>\n        <br />\n        <div class=\"parameter-content-type\" />\n";
770 },"7":function(depth0,helpers,partials,data) {
771   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
772   return "                              <textarea class='body-textarea' name='"
773     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
774     + "'></textarea>\n                          <br />\n                                <div class=\"parameter-content-type\" />\n";
775 },"9":function(depth0,helpers,partials,data) {
776   var stack1, buffer = "";
777   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(10, data),"data":data});
778   if (stack1 != null) { buffer += stack1; }
779   return buffer;
780 },"10":function(depth0,helpers,partials,data) {
781   var stack1, buffer = "";
782   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.program(13, data),"data":data});
783   if (stack1 != null) { buffer += stack1; }
784   return buffer;
785 },"11":function(depth0,helpers,partials,data) {
786   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
787   return "                              <input class='parameter' minlength='0' name='"
788     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
789     + "' placeholder='' type='text' value='"
790     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
791     + "'/>\n";
792 },"13":function(depth0,helpers,partials,data) {
793   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
794   return "                              <input class='parameter' minlength='0' name='"
795     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
796     + "' placeholder='' type='text' value=''/>\n";
797 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
798   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
799     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
800     + "</td>\n<td>\n\n";
801   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
802   if (stack1 != null) { buffer += stack1; }
803   buffer += "\n</td>\n<td class=\"markdown\">";
804   stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
805   if (stack1 != null) { buffer += stack1; }
806   buffer += "</td>\n<td>";
807   stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
808   if (stack1 != null) { buffer += stack1; }
809   return buffer + "</td>\n<td>\n        <span class=\"model-signature\"></span>\n</td>\n";
810 },"useData":true});
811 var HeaderView,
812   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
813   __hasProp = {}.hasOwnProperty;
814
815 HeaderView = (function(_super) {
816   __extends(HeaderView, _super);
817
818   function HeaderView() {
819     return HeaderView.__super__.constructor.apply(this, arguments);
820   }
821
822   HeaderView.prototype.events = {
823     'click #show-pet-store-icon': 'showPetStore',
824     'click #show-wordnik-dev-icon': 'showWordnikDev',
825     'click #explore': 'showCustom',
826     'keyup #input_baseUrl': 'showCustomOnKeyup',
827     'keyup #input_apiKey': 'showCustomOnKeyup'
828   };
829
830   HeaderView.prototype.initialize = function() {};
831
832   HeaderView.prototype.showPetStore = function(e) {
833     return this.trigger('update-swagger-ui', {
834       url: "http://petstore.swagger.wordnik.com/api/api-docs"
835     });
836   };
837
838   HeaderView.prototype.showWordnikDev = function(e) {
839     return this.trigger('update-swagger-ui', {
840       url: "http://api.wordnik.com/v4/resources.json"
841     });
842   };
843
844   HeaderView.prototype.showCustomOnKeyup = function(e) {
845     if (e.keyCode === 13) {
846       return this.showCustom();
847     }
848   };
849
850   HeaderView.prototype.showCustom = function(e) {
851     if (e != null) {
852       e.preventDefault();
853     }
854     return this.trigger('update-swagger-ui', {
855       url: $('#input_baseUrl').val(),
856       apiKey: $('#input_apiKey').val()
857     });
858   };
859
860   HeaderView.prototype.update = function(url, apiKey, trigger) {
861     if (trigger == null) {
862       trigger = false;
863     }
864     $('#input_baseUrl').val(url);
865     if (trigger) {
866       return this.trigger('update-swagger-ui', {
867         url: url
868       });
869     }
870   };
871
872   return HeaderView;
873
874 })(Backbone.View);
875
876 this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
877   return " multiple='multiple'";
878   },"3":function(depth0,helpers,partials,data) {
879   return "";
880 },"5":function(depth0,helpers,partials,data) {
881   var stack1, buffer = "";
882   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(6, data),"data":data});
883   if (stack1 != null) { buffer += stack1; }
884   return buffer;
885 },"6":function(depth0,helpers,partials,data) {
886   var stack1, helperMissing=helpers.helperMissing, buffer = "";
887   stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.program(7, data),"data":data}));
888   if (stack1 != null) { buffer += stack1; }
889   return buffer;
890 },"7":function(depth0,helpers,partials,data) {
891   return "          <option selected=\"\" value=''></option>\n";
892   },"9":function(depth0,helpers,partials,data) {
893   var stack1, buffer = "";
894   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
895   if (stack1 != null) { buffer += stack1; }
896   return buffer;
897 },"10":function(depth0,helpers,partials,data) {
898   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
899   return "        <option selected=\"\" value='"
900     + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
901     + "'>"
902     + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
903     + " (default)</option>\n";
904 },"12":function(depth0,helpers,partials,data) {
905   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
906   return "        <option value='"
907     + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
908     + "'>"
909     + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
910     + "</option>\n";
911 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
912   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
913     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
914     + "</td>\n<td>\n  <select ";
915   stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
916   if (stack1 != null) { buffer += stack1; }
917   buffer += " class='parameter' name='"
918     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
919     + "'>\n";
920   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(5, data),"data":data});
921   if (stack1 != null) { buffer += stack1; }
922   stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
923   if (stack1 != null) { buffer += stack1; }
924   buffer += "  </select>\n</td>\n<td class=\"markdown\">";
925   stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
926   if (stack1 != null) { buffer += stack1; }
927   buffer += "</td>\n<td>";
928   stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
929   if (stack1 != null) { buffer += stack1; }
930   return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>";
931 },"useData":true});
932 var MainView,
933   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
934   __hasProp = {}.hasOwnProperty;
935
936 MainView = (function(_super) {
937   var sorters;
938
939   __extends(MainView, _super);
940
941   function MainView() {
942     return MainView.__super__.constructor.apply(this, arguments);
943   }
944
945   sorters = {
946     'alpha': function(a, b) {
947       return a.path.localeCompare(b.path);
948     },
949     'method': function(a, b) {
950       return a.method.localeCompare(b.method);
951     }
952   };
953
954   MainView.prototype.initialize = function(opts) {
955     var auth, key, value, _ref;
956     if (opts == null) {
957       opts = {};
958     }
959     this.model.auths = [];
960     _ref = this.model.securityDefinitions;
961     for (key in _ref) {
962       value = _ref[key];
963       auth = {
964         name: key,
965         type: value.type,
966         value: value
967       };
968       this.model.auths.push(auth);
969     }
970     if (this.model.swaggerVersion === "2.0") {
971       if ("validatorUrl" in opts.swaggerOptions) {
972         return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
973       } else if (this.model.url.indexOf("localhost") > 0) {
974         return this.model.validatorUrl = null;
975       } else {
976        // return this.model.validatorUrl = "http://online.swagger.io/validator";
977         return this.model.validatorUrl = null;
978       }
979     }
980   };
981
982   MainView.prototype.render = function() {
983     var auth, button, counter, id, name, resource, resources, _i, _len, _ref;
984     if (this.model.securityDefinitions) {
985       for (name in this.model.securityDefinitions) {
986         auth = this.model.securityDefinitions[name];
987         if (auth.type === "apiKey" && $("#apikey_button").length === 0) {
988           button = new ApiKeyButton({
989             model: auth
990           }).render().el;
991           $('.auth_main_container').append(button);
992         }
993         if (auth.type === "basicAuth" && $("#basic_auth_button").length === 0) {
994           button = new BasicAuthButton({
995             model: auth
996           }).render().el;
997           $('.auth_main_container').append(button);
998         }
999       }
1000     }
1001     $(this.el).html(Handlebars.templates.main(this.model));
1002     resources = {};
1003     counter = 0;
1004     _ref = this.model.apisArray;
1005     for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1006       resource = _ref[_i];
1007       id = resource.name;
1008       while (typeof resources[id] !== 'undefined') {
1009         id = id + "_" + counter;
1010         counter += 1;
1011       }
1012       resource.id = id;
1013       resources[id] = resource;
1014       this.addResource(resource, this.model.auths);
1015     }
1016     $('.propWrap').hover(function() {
1017       return $('.optionsWrapper', $(this)).show();
1018     }, function() {
1019       return $('.optionsWrapper', $(this)).hide();
1020     });
1021     return this;
1022   };
1023
1024   MainView.prototype.addResource = function(resource, auths) {
1025     var resourceView;
1026     resource.id = resource.id.replace(/\s/g, '_');
1027     resourceView = new ResourceView({
1028       model: resource,
1029       tagName: 'li',
1030       id: 'resource_' + resource.id,
1031       className: 'resource',
1032       auths: auths,
1033       swaggerOptions: this.options.swaggerOptions
1034     });
1035     return $('#resources').append(resourceView.render().el);
1036   };
1037
1038   MainView.prototype.clear = function() {
1039     return $(this.el).html('');
1040   };
1041
1042   return MainView;
1043
1044 })(Backbone.View);
1045
1046 this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1047   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1048   return "        <textarea class='body-textarea' readonly='readonly' name='"
1049     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1050     + "'>"
1051     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1052     + "</textarea>\n";
1053 },"3":function(depth0,helpers,partials,data) {
1054   var stack1, buffer = "";
1055   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
1056   if (stack1 != null) { buffer += stack1; }
1057   return buffer;
1058 },"4":function(depth0,helpers,partials,data) {
1059   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1060   return "            "
1061     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1062     + "\n";
1063 },"6":function(depth0,helpers,partials,data) {
1064   return "            (empty)\n";
1065   },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1066   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
1067     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1068     + "</td>\n<td>\n";
1069   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
1070   if (stack1 != null) { buffer += stack1; }
1071   buffer += "</td>\n<td class=\"markdown\">";
1072   stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
1073   if (stack1 != null) { buffer += stack1; }
1074   buffer += "</td>\n<td>";
1075   stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
1076   if (stack1 != null) { buffer += stack1; }
1077   return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1078 },"useData":true});
1079 this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1080   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1081   return "        <textarea class='body-textarea'  readonly='readonly' placeholder='(required)' name='"
1082     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1083     + "'>"
1084     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1085     + "</textarea>\n";
1086 },"3":function(depth0,helpers,partials,data) {
1087   var stack1, buffer = "";
1088   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
1089   if (stack1 != null) { buffer += stack1; }
1090   return buffer;
1091 },"4":function(depth0,helpers,partials,data) {
1092   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1093   return "            "
1094     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1095     + "\n";
1096 },"6":function(depth0,helpers,partials,data) {
1097   return "            (empty)\n";
1098   },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1099   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
1100     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1101     + "</td>\n<td>\n";
1102   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
1103   if (stack1 != null) { buffer += stack1; }
1104   buffer += "</td>\n<td class=\"markdown\">";
1105   stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
1106   if (stack1 != null) { buffer += stack1; }
1107   buffer += "</td>\n<td>";
1108   stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
1109   if (stack1 != null) { buffer += stack1; }
1110   return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1111 },"useData":true});
1112 var OperationView,
1113   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1114   __hasProp = {}.hasOwnProperty;
1115
1116 OperationView = (function(_super) {
1117   __extends(OperationView, _super);
1118
1119   function OperationView() {
1120     return OperationView.__super__.constructor.apply(this, arguments);
1121   }
1122
1123   OperationView.prototype.invocationUrl = null;
1124
1125   OperationView.prototype.events = {
1126     'submit .sandbox': 'submitOperation',
1127     'click .submit': 'submitOperation',
1128     'click .response_hider': 'hideResponse',
1129     'click .toggleOperation': 'toggleOperationContent',
1130     'mouseenter .api-ic': 'mouseEnter',
1131     'mouseout .api-ic': 'mouseExit'
1132   };
1133
1134   OperationView.prototype.initialize = function(opts) {
1135     if (opts == null) {
1136       opts = {};
1137     }
1138     this.auths = opts.auths;
1139     this.parentId = this.model.parentId;
1140     this.nickname = this.model.nickname;
1141     return this;
1142   };
1143
1144   OperationView.prototype.mouseEnter = function(e) {
1145     var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
1146     elem = $(this.el).find('.content');
1147     x = e.pageX;
1148     y = e.pageY;
1149     scX = $(window).scrollLeft();
1150     scY = $(window).scrollTop();
1151     scMaxX = scX + $(window).width();
1152     scMaxY = scY + $(window).height();
1153     wd = elem.width();
1154     hgh = elem.height();
1155     if (x + wd > scMaxX) {
1156       x = scMaxX - wd;
1157     }
1158     if (x < scX) {
1159       x = scX;
1160     }
1161     if (y + hgh > scMaxY) {
1162       y = scMaxY - hgh;
1163     }
1164     if (y < scY) {
1165       y = scY;
1166     }
1167     pos = {};
1168     pos.top = y;
1169     pos.left = x;
1170     elem.css(pos);
1171     return $(e.currentTarget.parentNode).find('#api_information_panel').show();
1172   };
1173
1174   OperationView.prototype.mouseExit = function(e) {
1175     return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
1176   };
1177
1178   OperationView.prototype.render = function() {
1179     var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, modelAuths, o, param, ref, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4;
1180     isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
1181     if (!isMethodSubmissionSupported) {
1182       this.model.isReadOnly = true;
1183     }
1184     this.model.description = this.model.description || this.model.notes;
1185     if (this.model.description) {
1186       this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '<br />');
1187     }
1188     this.model.oauth = null;
1189     modelAuths = this.model.authorizations || this.model.security;
1190     if (modelAuths) {
1191       if (Array.isArray(modelAuths)) {
1192         for (_i = 0, _len = modelAuths.length; _i < _len; _i++) {
1193           auths = modelAuths[_i];
1194           for (key in auths) {
1195             auth = auths[key];
1196             for (a in this.auths) {
1197               auth = this.auths[a];
1198               if (auth.type === 'oauth2') {
1199                 this.model.oauth = {};
1200                 this.model.oauth.scopes = [];
1201                 _ref = auth.value.scopes;
1202                 for (k in _ref) {
1203                   v = _ref[k];
1204                   scopeIndex = auths[key].indexOf(k);
1205                   if (scopeIndex >= 0) {
1206                     o = {
1207                       scope: k,
1208                       description: v
1209                     };
1210                     this.model.oauth.scopes.push(o);
1211                   }
1212                 }
1213               }
1214             }
1215           }
1216         }
1217       } else {
1218         for (k in modelAuths) {
1219           v = modelAuths[k];
1220           if (k === "oauth2") {
1221             if (this.model.oauth === null) {
1222               this.model.oauth = {};
1223             }
1224             if (this.model.oauth.scopes === void 0) {
1225               this.model.oauth.scopes = [];
1226             }
1227             for (_j = 0, _len1 = v.length; _j < _len1; _j++) {
1228               o = v[_j];
1229               this.model.oauth.scopes.push(o);
1230             }
1231           }
1232         }
1233       }
1234     }
1235     if (typeof this.model.responses !== 'undefined') {
1236       this.model.responseMessages = [];
1237       _ref1 = this.model.responses;
1238       for (code in _ref1) {
1239         value = _ref1[code];
1240         schema = null;
1241         schemaObj = this.model.responses[code].schema;
1242         if (schemaObj && schemaObj['$ref']) {
1243           schema = schemaObj['$ref'];
1244           if (schema.indexOf('#/definitions/') === 0) {
1245             schema = schema.substring('#/definitions/'.length);
1246           }
1247         }
1248         this.model.responseMessages.push({
1249           code: code,
1250           message: value.description,
1251           responseModel: schema
1252         });
1253       }
1254     }
1255     if (typeof this.model.responseMessages === 'undefined') {
1256       this.model.responseMessages = [];
1257     }
1258     signatureModel = null;
1259     if (this.model.successResponse) {
1260       successResponse = this.model.successResponse;
1261       for (key in successResponse) {
1262         value = successResponse[key];
1263         this.model.successCode = key;
1264         if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
1265           signatureModel = {
1266             sampleJSON: JSON.stringify(value.createJSONSample(), void 0, 2),
1267             isParam: false,
1268             signature: value.getMockSignature()
1269           };
1270         }
1271       }
1272     } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
1273       signatureModel = {
1274         sampleJSON: this.model.responseSampleJSON,
1275         isParam: false,
1276         signature: this.model.responseClassSignature
1277       };
1278     }
1279     $(this.el).html(Handlebars.templates.operation(this.model));
1280     if (signatureModel) {
1281       responseSignatureView = new SignatureView({
1282         model: signatureModel,
1283         tagName: 'div'
1284       });
1285       $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
1286     } else {
1287       this.model.responseClassSignature = 'string';
1288       $('.model-signature', $(this.el)).html(this.model.type);
1289     }
1290     contentTypeModel = {
1291       isParam: false
1292     };
1293     contentTypeModel.consumes = this.model.consumes;
1294     contentTypeModel.produces = this.model.produces;
1295     _ref2 = this.model.parameters;
1296     for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1297       param = _ref2[_k];
1298       type = param.type || param.dataType || '';
1299       if (typeof type === 'undefined') {
1300         schema = param.schema;
1301         if (schema && schema['$ref']) {
1302           ref = schema['$ref'];
1303           if (ref.indexOf('#/definitions/') === 0) {
1304             type = ref.substring('#/definitions/'.length);
1305           } else {
1306             type = ref;
1307           }
1308         }
1309       }
1310       if (type && type.toLowerCase() === 'file') {
1311         if (!contentTypeModel.consumes) {
1312           contentTypeModel.consumes = 'multipart/form-data';
1313         }
1314       }
1315       param.type = type;
1316     }
1317     responseContentTypeView = new ResponseContentTypeView({
1318       model: contentTypeModel
1319     });
1320     $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1321     _ref3 = this.model.parameters;
1322     for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1323       param = _ref3[_l];
1324       this.addParameter(param, contentTypeModel.consumes);
1325     }
1326     _ref4 = this.model.responseMessages;
1327     for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
1328       statusCode = _ref4[_m];
1329       this.addStatusCode(statusCode);
1330     }
1331     return this;
1332   };
1333
1334   OperationView.prototype.addParameter = function(param, consumes) {
1335     var paramView;
1336     param.consumes = consumes;
1337     paramView = new ParameterView({
1338       model: param,
1339       tagName: 'tr',
1340       readOnly: this.model.isReadOnly
1341     });
1342     return $('.operation-params', $(this.el)).append(paramView.render().el);
1343   };
1344
1345   OperationView.prototype.addStatusCode = function(statusCode) {
1346     var statusCodeView;
1347     statusCodeView = new StatusCodeView({
1348       model: statusCode,
1349       tagName: 'tr'
1350     });
1351     return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
1352   };
1353
1354   OperationView.prototype.submitOperation = function(e) {
1355     var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
1356     if (e != null) {
1357       e.preventDefault();
1358     }
1359     form = $('.sandbox', $(this.el));
1360     error_free = true;
1361     form.find("input.required").each(function() {
1362       $(this).removeClass("error");
1363       if (jQuery.trim($(this).val()) === "") {
1364         $(this).addClass("error");
1365         $(this).wiggle({
1366           callback: (function(_this) {
1367             return function() {
1368               return $(_this).focus();
1369             };
1370           })(this)
1371         });
1372         return error_free = false;
1373       }
1374     });
1375     form.find("textarea.required").each(function() {
1376       $(this).removeClass("error");
1377       if (jQuery.trim($(this).val()) === "") {
1378         $(this).addClass("error");
1379         $(this).wiggle({
1380           callback: (function(_this) {
1381             return function() {
1382               return $(_this).focus();
1383             };
1384           })(this)
1385         });
1386         return error_free = false;
1387       }
1388     });
1389     if (error_free) {
1390       map = {};
1391       opts = {
1392         parent: this
1393       };
1394       isFileUpload = false;
1395       _ref = form.find("input");
1396       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1397         o = _ref[_i];
1398         if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1399           map[o.name] = o.value;
1400         }
1401         if (o.type === "file") {
1402           map[o.name] = o.files[0];
1403           isFileUpload = true;
1404         }
1405       }
1406       _ref1 = form.find("textarea");
1407       for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1408         o = _ref1[_j];
1409         if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1410           map[o.name] = o.value;
1411         }
1412       }
1413       _ref2 = form.find("select");
1414       for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1415         o = _ref2[_k];
1416         val = this.getSelectedValue(o);
1417         if ((val != null) && jQuery.trim(val).length > 0) {
1418           map[o.name] = val;
1419         }
1420       }
1421       opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
1422       opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
1423       $(".response_throbber", $(this.el)).show();
1424       if (isFileUpload) {
1425         return this.handleFileUpload(map, form);
1426       } else {
1427         return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
1428       }
1429     }
1430   };
1431
1432   OperationView.prototype.success = function(response, parent) {
1433     return parent.showCompleteStatus(response);
1434   };
1435
1436   OperationView.prototype.handleFileUpload = function(map, form) {
1437     var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3;
1438     _ref = form.serializeArray();
1439     for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1440       o = _ref[_i];
1441       if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1442         map[o.name] = o.value;
1443       }
1444     }
1445     bodyParam = new FormData();
1446     params = 0;
1447     _ref1 = this.model.parameters;
1448     for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1449       param = _ref1[_j];
1450       if (param.paramType === 'form' || param["in"] === 'formData') {
1451         if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
1452           bodyParam.append(param.name, map[param.name]);
1453         }
1454       }
1455     }
1456     headerParams = {};
1457     _ref2 = this.model.parameters;
1458     for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1459       param = _ref2[_k];
1460       if (param.paramType === 'header') {
1461         headerParams[param.name] = map[param.name];
1462       }
1463     }
1464     _ref3 = form.find('input[type~="file"]');
1465     for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1466       el = _ref3[_l];
1467       if (typeof el.files[0] !== 'undefined') {
1468         bodyParam.append($(el).attr('name'), el.files[0]);
1469         params += 1;
1470       }
1471     }
1472     this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
1473     $(".request_url", $(this.el)).html("<pre></pre>");
1474     $(".request_url pre", $(this.el)).text(this.invocationUrl);
1475     obj = {
1476       type: this.model.method,
1477       url: this.invocationUrl,
1478       headers: headerParams,
1479       data: bodyParam,
1480       dataType: 'json',
1481       contentType: false,
1482       processData: false,
1483       error: (function(_this) {
1484         return function(data, textStatus, error) {
1485           return _this.showErrorStatus(_this.wrap(data), _this);
1486         };
1487       })(this),
1488       success: (function(_this) {
1489         return function(data) {
1490           return _this.showResponse(data, _this);
1491         };
1492       })(this),
1493       complete: (function(_this) {
1494         return function(data) {
1495           return _this.showCompleteStatus(_this.wrap(data), _this);
1496         };
1497       })(this)
1498     };
1499     if (window.authorizations) {
1500       window.authorizations.apply(obj);
1501     }
1502     if (params === 0) {
1503       obj.data.append("fake", "true");
1504     }
1505     jQuery.ajax(obj);
1506     return false;
1507   };
1508
1509   OperationView.prototype.wrap = function(data) {
1510     var h, headerArray, headers, i, o, _i, _len;
1511     headers = {};
1512     headerArray = data.getAllResponseHeaders().split("\r");
1513     for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
1514       i = headerArray[_i];
1515       h = i.match(/^([^:]*?):(.*)$/);
1516       if (!h) {
1517         h = [];
1518       }
1519       h.shift();
1520       if (h[0] !== void 0 && h[1] !== void 0) {
1521         headers[h[0].trim()] = h[1].trim();
1522       }
1523     }
1524     o = {};
1525     o.content = {};
1526     o.content.data = data.responseText;
1527     o.headers = headers;
1528     o.request = {};
1529     o.request.url = this.invocationUrl;
1530     o.status = data.status;
1531     return o;
1532   };
1533
1534   OperationView.prototype.getSelectedValue = function(select) {
1535     var opt, options, _i, _len, _ref;
1536     if (!select.multiple) {
1537       return select.value;
1538     } else {
1539       options = [];
1540       _ref = select.options;
1541       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1542         opt = _ref[_i];
1543         if (opt.selected) {
1544           options.push(opt.value);
1545         }
1546       }
1547       if (options.length > 0) {
1548         return options;
1549       } else {
1550         return null;
1551       }
1552     }
1553   };
1554
1555   OperationView.prototype.hideResponse = function(e) {
1556     if (e != null) {
1557       e.preventDefault();
1558     }
1559     $(".response", $(this.el)).slideUp();
1560     return $(".response_hider", $(this.el)).fadeOut();
1561   };
1562
1563   OperationView.prototype.showResponse = function(response) {
1564     var prettyJson;
1565     prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
1566     return $(".response_body", $(this.el)).html(escape(prettyJson));
1567   };
1568
1569   OperationView.prototype.showErrorStatus = function(data, parent) {
1570     return parent.showStatus(data);
1571   };
1572
1573   OperationView.prototype.showCompleteStatus = function(data, parent) {
1574     return parent.showStatus(data);
1575   };
1576
1577   OperationView.prototype.formatXml = function(xml) {
1578     var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
1579     reg = /(>)(<)(\/*)/g;
1580     wsexp = /[ ]*(.*)[ ]+\n/g;
1581     contexp = /(<.+>)(.+\n)/g;
1582     xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
1583     pad = 0;
1584     formatted = '';
1585     lines = xml.split('\n');
1586     indent = 0;
1587     lastType = 'other';
1588     transitions = {
1589       'single->single': 0,
1590       'single->closing': -1,
1591       'single->opening': 0,
1592       'single->other': 0,
1593       'closing->single': 0,
1594       'closing->closing': -1,
1595       'closing->opening': 0,
1596       'closing->other': 0,
1597       'opening->single': 1,
1598       'opening->closing': 0,
1599       'opening->opening': 1,
1600       'opening->other': 1,
1601       'other->single': 0,
1602       'other->closing': -1,
1603       'other->opening': 0,
1604       'other->other': 0
1605     };
1606     _fn = function(ln) {
1607       var fromTo, j, key, padding, type, types, value;
1608       types = {
1609         single: Boolean(ln.match(/<.+\/>/)),
1610         closing: Boolean(ln.match(/<\/.+>/)),
1611         opening: Boolean(ln.match(/<[^!?].*>/))
1612       };
1613       type = ((function() {
1614         var _results;
1615         _results = [];
1616         for (key in types) {
1617           value = types[key];
1618           if (value) {
1619             _results.push(key);
1620           }
1621         }
1622         return _results;
1623       })())[0];
1624       type = type === void 0 ? 'other' : type;
1625       fromTo = lastType + '->' + type;
1626       lastType = type;
1627       padding = '';
1628       indent += transitions[fromTo];
1629       padding = ((function() {
1630         var _j, _ref, _results;
1631         _results = [];
1632         for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) {
1633           _results.push('  ');
1634         }
1635         return _results;
1636       })()).join('');
1637       if (fromTo === 'opening->closing') {
1638         return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
1639       } else {
1640         return formatted += padding + ln + '\n';
1641       }
1642     };
1643     for (_i = 0, _len = lines.length; _i < _len; _i++) {
1644       ln = lines[_i];
1645       _fn(ln);
1646     }
1647     return formatted;
1648   };
1649
1650   OperationView.prototype.showStatus = function(response) {
1651     var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, url;
1652     if (response.content === void 0) {
1653       content = response.data;
1654       url = response.url;
1655     } else {
1656       content = response.content.data;
1657       url = response.request.url;
1658     }
1659     headers = response.headers;
1660     contentType = null;
1661     if (headers) {
1662       contentType = headers["Content-Type"] || headers["content-type"];
1663       if (contentType) {
1664         contentType = contentType.split(";")[0].trim();
1665       }
1666     }
1667     $(".response_body", $(this.el)).removeClass('json');
1668     $(".response_body", $(this.el)).removeClass('xml');
1669     if (!content) {
1670       code = $('<code />').text("no content");
1671       pre = $('<pre class="json" />').append(code);
1672     } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
1673       json = null;
1674       try {
1675         json = JSON.stringify(JSON.parse(content), null, "  ");
1676       } catch (_error) {
1677         e = _error;
1678         json = "can't parse JSON.  Raw result:\n\n" + content;
1679       }
1680       code = $('<code />').text(json);
1681       pre = $('<pre class="json" />').append(code);
1682     } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
1683       code = $('<code />').text(this.formatXml(content));
1684       pre = $('<pre class="xml" />').append(code);
1685     } else if (contentType === "text/html") {
1686       code = $('<code />').html(_.escape(content));
1687       pre = $('<pre class="xml" />').append(code);
1688     } else if (/^image\//.test(contentType)) {
1689       pre = $('<img>').attr('src', url);
1690     } else {
1691       code = $('<code />').text(content);
1692       pre = $('<pre class="json" />').append(code);
1693     }
1694     response_body = pre;
1695     $(".request_url", $(this.el)).html("<pre></pre>");
1696     $(".request_url pre", $(this.el)).text(url);
1697     $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
1698     $(".response_body", $(this.el)).html(response_body);
1699     $(".response_headers", $(this.el)).html("<pre>" + _.escape(JSON.stringify(response.headers, null, "  ")).replace(/\n/g, "<br>") + "</pre>");
1700     $(".response", $(this.el)).slideDown();
1701     $(".response_hider", $(this.el)).show();
1702     $(".response_throbber", $(this.el)).hide();
1703     response_body_el = $('.response_body', $(this.el))[0];
1704     opts = this.options.swaggerOptions;
1705     if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
1706       return response_body_el;
1707     } else {
1708       return hljs.highlightBlock(response_body_el);
1709     }
1710   };
1711
1712   OperationView.prototype.toggleOperationContent = function() {
1713     var elem;
1714     elem = $('#' + Docs.escapeResourceName(this.parentId + "_" + this.nickname + "_content"));
1715     if (elem.is(':visible')) {
1716       return Docs.collapseOperation(elem);
1717     } else {
1718       return Docs.expandOperation(elem);
1719     }
1720   };
1721
1722   return OperationView;
1723
1724 })(Backbone.View);
1725
1726 var ParameterContentTypeView,
1727   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1728   __hasProp = {}.hasOwnProperty;
1729
1730 ParameterContentTypeView = (function(_super) {
1731   __extends(ParameterContentTypeView, _super);
1732
1733   function ParameterContentTypeView() {
1734     return ParameterContentTypeView.__super__.constructor.apply(this, arguments);
1735   }
1736
1737   ParameterContentTypeView.prototype.initialize = function() {};
1738
1739   ParameterContentTypeView.prototype.render = function() {
1740     var template;
1741     template = this.template();
1742     $(this.el).html(template(this.model));
1743     $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
1744     return this;
1745   };
1746
1747   ParameterContentTypeView.prototype.template = function() {
1748     return Handlebars.templates.parameter_content_type;
1749   };
1750
1751   return ParameterContentTypeView;
1752
1753 })(Backbone.View);
1754
1755 this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1756   var stack1, buffer = "";
1757   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
1758   if (stack1 != null) { buffer += stack1; }
1759   return buffer;
1760 },"2":function(depth0,helpers,partials,data) {
1761   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1762   return "                      <input type=\"file\" name='"
1763     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1764     + "'/>\n";
1765 },"4":function(depth0,helpers,partials,data) {
1766   var stack1, buffer = "";
1767   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
1768   if (stack1 != null) { buffer += stack1; }
1769   return buffer;
1770 },"5":function(depth0,helpers,partials,data) {
1771   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1772   return "                              <textarea class='body-textarea required' placeholder='(required)' name='"
1773     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1774     + "'>"
1775     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1776     + "</textarea>\n        <br />\n        <div class=\"parameter-content-type\" />\n";
1777 },"7":function(depth0,helpers,partials,data) {
1778   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1779   return "                              <textarea class='body-textarea required' placeholder='(required)' name='"
1780     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1781     + "'></textarea>\n                          <br />\n                                <div class=\"parameter-content-type\" />\n";
1782 },"9":function(depth0,helpers,partials,data) {
1783   var stack1, buffer = "";
1784   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
1785   if (stack1 != null) { buffer += stack1; }
1786   return buffer;
1787 },"10":function(depth0,helpers,partials,data) {
1788   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1789   return "                      <input class='parameter' class='required' type='file' name='"
1790     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1791     + "'/>\n";
1792 },"12":function(depth0,helpers,partials,data) {
1793   var stack1, buffer = "";
1794   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(13, data),"inverse":this.program(15, data),"data":data});
1795   if (stack1 != null) { buffer += stack1; }
1796   return buffer;
1797 },"13":function(depth0,helpers,partials,data) {
1798   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1799   return "                              <input class='parameter required' minlength='1' name='"
1800     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1801     + "' placeholder='(required)' type='text' value='"
1802     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1803     + "'/>\n";
1804 },"15":function(depth0,helpers,partials,data) {
1805   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1806   return "                              <input class='parameter required' minlength='1' name='"
1807     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1808     + "' placeholder='(required)' type='text' value=''/>\n";
1809 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1810   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
1811     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1812     + "</td>\n<td>\n";
1813   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
1814   if (stack1 != null) { buffer += stack1; }
1815   buffer += "</td>\n<td>\n      <strong><span class=\"markdown\">";
1816   stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
1817   if (stack1 != null) { buffer += stack1; }
1818   buffer += "</span></strong>\n</td>\n<td>";
1819   stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
1820   if (stack1 != null) { buffer += stack1; }
1821   return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1822 },"useData":true});
1823 this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1824   var stack1, buffer = "";
1825   stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
1826   if (stack1 != null) { buffer += stack1; }
1827   return buffer;
1828 },"2":function(depth0,helpers,partials,data) {
1829   var stack1, lambda=this.lambda, buffer = "  <option value=\"";
1830   stack1 = lambda(depth0, depth0);
1831   if (stack1 != null) { buffer += stack1; }
1832   buffer += "\">";
1833   stack1 = lambda(depth0, depth0);
1834   if (stack1 != null) { buffer += stack1; }
1835   return buffer + "</option>\n";
1836 },"4":function(depth0,helpers,partials,data) {
1837   return "  <option value=\"application/json\">application/json</option>\n";
1838   },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1839   var stack1, buffer = "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
1840   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
1841   if (stack1 != null) { buffer += stack1; }
1842   return buffer + "</select>\n";
1843 },"useData":true});
1844 var ParameterView,
1845   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1846   __hasProp = {}.hasOwnProperty;
1847
1848 ParameterView = (function(_super) {
1849   __extends(ParameterView, _super);
1850
1851   function ParameterView() {
1852     return ParameterView.__super__.constructor.apply(this, arguments);
1853   }
1854
1855   ParameterView.prototype.initialize = function() {
1856     return Handlebars.registerHelper('isArray', function(param, opts) {
1857       if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
1858         return opts.fn(this);
1859       } else {
1860         return opts.inverse(this);
1861       }
1862     });
1863   };
1864
1865   ParameterView.prototype.render = function() {
1866     var contentTypeModel, isParam, parameterContentTypeView, ref, responseContentTypeView, schema, signatureModel, signatureView, template, type;
1867     type = this.model.type || this.model.dataType;
1868     if (typeof type === 'undefined') {
1869       schema = this.model.schema;
1870       if (schema && schema['$ref']) {
1871         ref = schema['$ref'];
1872         if (ref.indexOf('#/definitions/') === 0) {
1873           type = ref.substring('#/definitions/'.length);
1874         } else {
1875           type = ref;
1876         }
1877       }
1878     }
1879     this.model.type = type;
1880     this.model.paramType = this.model["in"] || this.model.paramType;
1881     if (this.model.paramType === 'body' || this.model["in"] === 'body') {
1882       this.model.isBody = true;
1883     }
1884     if (type && type.toLowerCase() === 'file') {
1885       this.model.isFile = true;
1886     }
1887     this.model["default"] = this.model["default"] || this.model.defaultValue;
1888     if (this.model.allowableValues) {
1889       this.model.isList = true;
1890     }
1891     template = this.template();
1892     $(this.el).html(template(this.model));
1893     signatureModel = {
1894       sampleJSON: this.model.sampleJSON,
1895       isParam: true,
1896       signature: this.model.signature
1897     };
1898     if (this.model.sampleJSON) {
1899       signatureView = new SignatureView({
1900         model: signatureModel,
1901         tagName: 'div'
1902       });
1903       $('.model-signature', $(this.el)).append(signatureView.render().el);
1904     } else {
1905       $('.model-signature', $(this.el)).html(this.model.signature);
1906     }
1907     isParam = false;
1908     if (this.model.isBody) {
1909       isParam = true;
1910     }
1911     contentTypeModel = {
1912       isParam: isParam
1913     };
1914     contentTypeModel.consumes = this.model.consumes;
1915     if (isParam) {
1916       parameterContentTypeView = new ParameterContentTypeView({
1917         model: contentTypeModel
1918       });
1919       $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
1920     } else {
1921       responseContentTypeView = new ResponseContentTypeView({
1922         model: contentTypeModel
1923       });
1924       $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1925     }
1926     return this;
1927   };
1928
1929   ParameterView.prototype.template = function() {
1930     if (this.model.isList) {
1931       return Handlebars.templates.param_list;
1932     } else {
1933       if (this.options.readOnly) {
1934         if (this.model.required) {
1935           return Handlebars.templates.param_readonly_required;
1936         } else {
1937           return Handlebars.templates.param_readonly;
1938         }
1939       } else {
1940         if (this.model.required) {
1941           return Handlebars.templates.param_required;
1942         } else {
1943           return Handlebars.templates.param;
1944         }
1945       }
1946     }
1947   };
1948
1949   return ParameterView;
1950
1951 })(Backbone.View);
1952
1953 var ResourceView,
1954   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1955   __hasProp = {}.hasOwnProperty;
1956
1957 ResourceView = (function(_super) {
1958   __extends(ResourceView, _super);
1959
1960   function ResourceView() {
1961     return ResourceView.__super__.constructor.apply(this, arguments);
1962   }
1963
1964   ResourceView.prototype.initialize = function(opts) {
1965     if (opts == null) {
1966       opts = {};
1967     }
1968     this.auths = opts.auths;
1969     if ("" === this.model.description) {
1970       this.model.description = null;
1971     }
1972     if (this.model.description != null) {
1973       return this.model.summary = this.model.description;
1974     }
1975   };
1976
1977   ResourceView.prototype.render = function() {
1978     var counter, id, methods, operation, _i, _len, _ref;
1979     methods = {};
1980     $(this.el).html(Handlebars.templates.resource(this.model));
1981     _ref = this.model.operationsArray;
1982     for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1983       operation = _ref[_i];
1984       counter = 0;
1985       id = operation.nickname;
1986       while (typeof methods[id] !== 'undefined') {
1987         id = id + "_" + counter;
1988         counter += 1;
1989       }
1990       methods[id] = operation;
1991       operation.nickname = id;
1992       operation.parentId = this.model.id;
1993       this.addOperation(operation);
1994     }
1995     $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
1996     $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
1997     $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
1998     return this;
1999   };
2000
2001   ResourceView.prototype.addOperation = function(operation) {
2002     var operationView;
2003     operation.number = this.number;
2004     operationView = new OperationView({
2005       model: operation,
2006       tagName: 'li',
2007       className: 'endpoint',
2008       swaggerOptions: this.options.swaggerOptions,
2009       auths: this.auths
2010     });
2011     $('.endpoints', $(this.el)).append(operationView.render().el);
2012     return this.number++;
2013   };
2014
2015   ResourceView.prototype.callDocs = function(fnName, e) {
2016     e.preventDefault();
2017     return Docs[fnName](e.currentTarget.getAttribute('data-id'));
2018   };
2019
2020   return ResourceView;
2021
2022 })(Backbone.View);
2023
2024 this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
2025   return " : ";
2026   },"3":function(depth0,helpers,partials,data) {
2027   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
2028   return "<li>\n      <a href='"
2029     + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
2030     + "'>Raw</a>\n    </li>";
2031 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2032   var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "<div class='heading'>\n  <h2>\n    <a href='#!/"
2033     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2034     + "' class=\"toggleEndpointList\" data-id=\""
2035     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2036     + "\">"
2037     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
2038     + "</a> ";
2039   stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(options={"name":"summary","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
2040   if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
2041   if (stack1 != null) { buffer += stack1; }
2042   stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
2043   if (stack1 != null) { buffer += stack1; }
2044   buffer += "\n  </h2>\n  <ul class='options'>\n    <li>\n      <a href='#!/"
2045     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2046     + "' id='endpointListTogger_"
2047     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2048     + "' class=\"toggleEndpointList\" data-id=\""
2049     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2050     + "\">Show/Hide</a>\n    </li>\n    <li>\n      <a href='#' class=\"collapseResource\" data-id=\""
2051     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2052     + "\">\n        List Operations\n      </a>\n    </li>\n    <li>\n      <a href='#' class=\"expandResource\" data-id=\""
2053     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2054     + "\">\n        Expand Operations\n      </a>\n    </li>\n    ";
2055   stack1 = ((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(options={"name":"url","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
2056   if (!helpers.url) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
2057   if (stack1 != null) { buffer += stack1; }
2058   return buffer + "\n  </ul>\n</div>\n<ul class='endpoints' id='"
2059     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2060     + "_endpoint_list' style='display:none'>\n\n</ul>\n";
2061 },"useData":true});
2062 var ResponseContentTypeView,
2063   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
2064   __hasProp = {}.hasOwnProperty;
2065
2066 ResponseContentTypeView = (function(_super) {
2067   __extends(ResponseContentTypeView, _super);
2068
2069   function ResponseContentTypeView() {
2070     return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
2071   }
2072
2073   ResponseContentTypeView.prototype.initialize = function() {};
2074
2075   ResponseContentTypeView.prototype.render = function() {
2076     var template;
2077     template = this.template();
2078     $(this.el).html(template(this.model));
2079     $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
2080     return this;
2081   };
2082
2083   ResponseContentTypeView.prototype.template = function() {
2084     return Handlebars.templates.response_content_type;
2085   };
2086
2087   return ResponseContentTypeView;
2088
2089 })(Backbone.View);
2090
2091 this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
2092   var stack1, buffer = "";
2093   stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
2094   if (stack1 != null) { buffer += stack1; }
2095   return buffer;
2096 },"2":function(depth0,helpers,partials,data) {
2097   var stack1, lambda=this.lambda, buffer = "  <option value=\"";
2098   stack1 = lambda(depth0, depth0);
2099   if (stack1 != null) { buffer += stack1; }
2100   buffer += "\">";
2101   stack1 = lambda(depth0, depth0);
2102   if (stack1 != null) { buffer += stack1; }
2103   return buffer + "</option>\n";
2104 },"4":function(depth0,helpers,partials,data) {
2105   return "  <option value=\"application/json\">application/json</option>\n";
2106   },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2107   var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
2108   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
2109   if (stack1 != null) { buffer += stack1; }
2110   return buffer + "</select>\n";
2111 },"useData":true});
2112 var SignatureView,
2113   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
2114   __hasProp = {}.hasOwnProperty;
2115
2116 SignatureView = (function(_super) {
2117   __extends(SignatureView, _super);
2118
2119   function SignatureView() {
2120     return SignatureView.__super__.constructor.apply(this, arguments);
2121   }
2122
2123   SignatureView.prototype.events = {
2124     'click a.description-link': 'switchToDescription',
2125     'click a.snippet-link': 'switchToSnippet',
2126     'mousedown .snippet': 'snippetToTextArea'
2127   };
2128
2129   SignatureView.prototype.initialize = function() {};
2130
2131   SignatureView.prototype.render = function() {
2132     var template;
2133     template = this.template();
2134     $(this.el).html(template(this.model));
2135     this.switchToSnippet();
2136     this.isParam = this.model.isParam;
2137     if (this.isParam) {
2138       $('.notice', $(this.el)).text('Click to set as parameter value');
2139     }
2140     return this;
2141   };
2142
2143   SignatureView.prototype.template = function() {
2144     return Handlebars.templates.signature;
2145   };
2146
2147   SignatureView.prototype.switchToDescription = function(e) {
2148     if (e != null) {
2149       e.preventDefault();
2150     }
2151     $(".snippet", $(this.el)).hide();
2152     $(".description", $(this.el)).show();
2153     $('.description-link', $(this.el)).addClass('selected');
2154     return $('.snippet-link', $(this.el)).removeClass('selected');
2155   };
2156
2157   SignatureView.prototype.switchToSnippet = function(e) {
2158     if (e != null) {
2159       e.preventDefault();
2160     }
2161     $(".description", $(this.el)).hide();
2162     $(".snippet", $(this.el)).show();
2163     $('.snippet-link', $(this.el)).addClass('selected');
2164     return $('.description-link', $(this.el)).removeClass('selected');
2165   };
2166
2167   SignatureView.prototype.snippetToTextArea = function(e) {
2168     var textArea;
2169     if (this.isParam) {
2170       if (e != null) {
2171         e.preventDefault();
2172       }
2173       textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
2174       if ($.trim(textArea.val()) === '') {
2175         return textArea.val(this.model.sampleJSON);
2176       }
2177     }
2178   };
2179
2180   return SignatureView;
2181
2182 })(Backbone.View);
2183
2184 this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2185   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div>\n<ul class=\"signature-nav\">\n  <li><a class=\"description-link\" href=\"#\">Model</a></li>\n  <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n  <div class=\"description\">\n    ";
2186   stack1 = ((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper));
2187   if (stack1 != null) { buffer += stack1; }
2188   return buffer + "\n  </div>\n\n  <div class=\"snippet\">\n    <pre><code>"
2189     + escapeExpression(((helper = (helper = helpers.sampleJSON || (depth0 != null ? depth0.sampleJSON : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleJSON","hash":{},"data":data}) : helper)))
2190     + "</code></pre>\n    <small class=\"notice\"></small>\n  </div>\n</div>\n\n";
2191 },"useData":true});
2192 var StatusCodeView,
2193   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
2194   __hasProp = {}.hasOwnProperty;
2195
2196 StatusCodeView = (function(_super) {
2197   __extends(StatusCodeView, _super);
2198
2199   function StatusCodeView() {
2200     return StatusCodeView.__super__.constructor.apply(this, arguments);
2201   }
2202
2203   StatusCodeView.prototype.initialize = function() {};
2204
2205   StatusCodeView.prototype.render = function() {
2206     var responseModel, responseModelView, template;
2207     template = this.template();
2208     $(this.el).html(template(this.model));
2209     if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
2210       responseModel = {
2211         sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
2212         isParam: false,
2213         signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
2214       };
2215       responseModelView = new SignatureView({
2216         model: responseModel,
2217         tagName: 'div'
2218       });
2219       $('.model-signature', this.$el).append(responseModelView.render().el);
2220     } else {
2221       $('.model-signature', this.$el).html('');
2222     }
2223     return this;
2224   };
2225
2226   StatusCodeView.prototype.template = function() {
2227     return Handlebars.templates.status_code;
2228   };
2229
2230   return StatusCodeView;
2231
2232 })(Backbone.View);
2233
2234 this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2235   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td width='15%' class='code'>"
2236     + escapeExpression(((helper = (helper = helpers.code || (depth0 != null ? depth0.code : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"code","hash":{},"data":data}) : helper)))
2237     + "</td>\n<td>";
2238   stack1 = ((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"message","hash":{},"data":data}) : helper));
2239   if (stack1 != null) { buffer += stack1; }
2240   return buffer + "</td>\n<td width='50%'><span class=\"model-signature\" /></td>";
2241 },"useData":true});