pact_broker 2.53.0 → 2.54.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/lib/pact_broker/api/contracts/webhook_contract.rb +2 -2
  4. data/lib/pact_broker/test/test_data_builder.rb +1 -1
  5. data/lib/pact_broker/version.rb +1 -1
  6. data/lib/pact_broker/webhooks/webhook_event.rb +1 -1
  7. data/pact_broker.gemspec +1 -1
  8. data/spec/features/create_webhook_spec.rb +1 -1
  9. data/spec/fixtures/webhook_valid.json +1 -1
  10. data/spec/fixtures/webhook_valid_with_pacticipants.json +1 -1
  11. data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +12 -0
  12. data/vendor/hal-browser/README.adoc +169 -0
  13. data/vendor/hal-browser/browser.html +32 -21
  14. data/vendor/hal-browser/js/hal.js +30 -7
  15. data/vendor/hal-browser/js/hal/http/client.js +14 -6
  16. data/vendor/hal-browser/js/hal/resource.js +4 -2
  17. data/vendor/hal-browser/js/hal/views/documentation.js +1 -1
  18. data/vendor/hal-browser/js/hal/views/embedded_resource.js +10 -4
  19. data/vendor/hal-browser/js/hal/views/links.js +3 -2
  20. data/vendor/hal-browser/js/hal/views/non_safe_request_dialog.js +1 -1
  21. data/vendor/hal-browser/js/hal/views/properties.js +101 -2
  22. data/vendor/hal-browser/js/hal/views/query_uri_dialog.js +1 -1
  23. data/vendor/hal-browser/js/hal/views/request_headers.js +1 -1
  24. data/vendor/hal-browser/js/hal/views/resource.js +4 -3
  25. data/vendor/hal-browser/js/hal/views/response_headers.js +12 -1
  26. data/vendor/hal-browser/login.html +76 -0
  27. data/vendor/hal-browser/styles.css +3 -1
  28. data/vendor/hal-browser/vendor/js/URI.min.js +84 -0
  29. metadata +7 -11
  30. data/vendor/hal-browser/README.md +0 -41
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 146cb79312c70762f13a8a49ebd8cd52e33dc11669b5f647551624cd1bbdd8c7
4
- data.tar.gz: c8d41ae4b4dd59fa6684ecce7572ed9e31d5c96bfeadbc078d8e0eb8c2e5e4dc
3
+ metadata.gz: 9147b88a513fab2205b74006fcba47e6aff79b52205bc04d639f15cdc4078d12
4
+ data.tar.gz: 784bae2c2977392c3671580ca59f094da810aed6ef842e66eec540d531cd00f5
5
5
  SHA512:
6
- metadata.gz: b3d9ad57dc60c6cb6c8c4edead5b7cd10b69de4d63d4b5e355bf5cf5d0edf8f410a69601ef4a002d645c968e0b446dddc6b8a0b63ddb10aa9a51b3cc2331a398
7
- data.tar.gz: 50c7b30d1994654117c68db4b47ef9afd6d734691da60723c27ce717ca4313facaffa1cde5c43d388c82fcf3a3a47d08813cbc942aefd7168c4125f832cff4e9
6
+ metadata.gz: 6e8928e7c7b4d393d618e1ceec3b7e1a72d32db2e52c32f4e87a434ecce2857180a96db4a7103070fbddf8fd2d5661a411d273bc05c77042c22e68e1c5137912
7
+ data.tar.gz: 551c37f0fc7d63b11076adc2067800b7e2fd70ed52030859f07d287f80236d60520f60f67c91b9f1c3dca2695579a39021fe1b83ef5e5cccd8a05714f756c3a2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ <a name="v2.54.0"></a>
2
+ ### v2.54.0 (2020-05-13)
3
+
4
+
5
+ #### Features
6
+
7
+ * **hal browser**
8
+ * update to latest code ([a79ad290](/../../commit/a79ad290))
9
+
10
+
11
+ #### Bug Fixes
12
+
13
+ * update rack for CVE-2020-8161 ([96c3386a](/../../commit/96c3386a))
14
+
15
+ * **hal browser**
16
+ * fix xss vulnerability ([ac564412](/../../commit/ac564412))
17
+
18
+ * **webhooks**
19
+ * add missing validation for event names when creating webhooks ([5fc0563c](/../../commit/5fc0563c))
20
+
21
+
1
22
  <a name="v2.53.0"></a>
2
23
  ### v2.53.0 (2020-05-12)
3
24
 
@@ -2,6 +2,7 @@ require 'pact_broker/api/contracts/base_contract'
2
2
  require 'pact_broker/webhooks/check_host_whitelist'
3
3
  require 'pact_broker/webhooks/render'
4
4
  require 'pact_broker/pacticipants/service'
5
+ require 'pact_broker/webhooks/webhook_event'
5
6
 
6
7
  module PactBroker
7
8
  module Api
@@ -46,7 +47,6 @@ module PactBroker
46
47
 
47
48
  required(:name).filled(:pacticipant_exists?)
48
49
  end
49
-
50
50
  end
51
51
 
52
52
  property :provider do
@@ -155,7 +155,7 @@ module PactBroker
155
155
  property :name
156
156
 
157
157
  validation do
158
- required(:name).filled
158
+ required(:name).filled(included_in?: PactBroker::Webhooks::WebhookEvent::EVENT_NAMES)
159
159
  end
160
160
  end
161
161
  end
@@ -250,7 +250,7 @@ module PactBroker
250
250
  events = event_params.collect{ |e| PactBroker::Webhooks::WebhookEvent.new(e) }
251
251
  template_params = { method: 'POST', url: 'http://example.org', headers: {'Content-Type' => 'application/json'}, username: params[:username], password: params[:password]}
252
252
  request = PactBroker::Webhooks::WebhookRequestTemplate.new(template_params.merge(params))
253
- @webhook = PactBroker::Webhooks::Repository.new.create uuid, PactBroker::Domain::Webhook.new(request: request, events: events), consumer, provider
253
+ @webhook = PactBroker::Webhooks::Repository.new.create uuid, PactBroker::Domain::Webhook.new(request: request, events: events, description: params[:description]), consumer, provider
254
254
  self
255
255
  end
256
256
 
@@ -1,3 +1,3 @@
1
1
  module PactBroker
2
- VERSION = '2.53.0'
2
+ VERSION = '2.54.0'
3
3
  end
@@ -12,7 +12,7 @@ module PactBroker
12
12
  VERIFICATION_FAILED = 'provider_verification_failed'
13
13
  DEFAULT_EVENT_NAME = CONTRACT_CONTENT_CHANGED
14
14
 
15
- EVENT_NAMES = [CONTRACT_PUBLISHED, CONTRACT_CONTENT_CHANGED, VERIFICATION_PUBLISHED, VERIFICATION_FAILED]
15
+ EVENT_NAMES = [CONTRACT_PUBLISHED, CONTRACT_CONTENT_CHANGED, VERIFICATION_PUBLISHED, VERIFICATION_SUCCEEDED, VERIFICATION_FAILED]
16
16
 
17
17
  dataset_module do
18
18
  include PactBroker::Repositories::Helpers
data/pact_broker.gemspec CHANGED
@@ -51,7 +51,7 @@ Gem::Specification.new do |gem|
51
51
  gem.add_runtime_dependency 'sequel', '~> 5.28'
52
52
  gem.add_runtime_dependency 'webmachine', '1.5.0'
53
53
  gem.add_runtime_dependency 'semver2', '~> 3.4.2'
54
- gem.add_runtime_dependency 'rack', '>= 2.0.8', '~>2.0'
54
+ gem.add_runtime_dependency 'rack', '~> 2.2'
55
55
  gem.add_runtime_dependency 'redcarpet', '>=3.3.2', '~>3.3'
56
56
  gem.add_runtime_dependency 'pact-support', '~> 1.14', '>= 1.14.1'
57
57
  gem.add_runtime_dependency 'padrino-core', '>= 0.14.3', '~> 0.14'
@@ -11,7 +11,7 @@ describe "Creating a webhook" do
11
11
  description: "trigger build",
12
12
  enabled: false,
13
13
  events: [{
14
- name: 'something_happened'
14
+ name: 'contract_content_changed'
15
15
  }],
16
16
  request: {
17
17
  method: 'POST',
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "events": [{
3
- "name": "something_happened"
3
+ "name": "contract_content_changed"
4
4
  }],
5
5
  "request": {
6
6
  "method": "POST",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "events": [{
3
- "name": "something_happened"
3
+ "name": "contract_content_changed"
4
4
  }],
5
5
  "consumer": {
6
6
  "name": "Foo"
@@ -159,6 +159,18 @@ module PactBroker
159
159
  end
160
160
  end
161
161
 
162
+ context "with an event with an invalid name" do
163
+ let(:json) do
164
+ valid_webhook_with do |hash|
165
+ hash['events'].first['name'] = 'foo'
166
+ end
167
+ end
168
+
169
+ it "contains an error" do
170
+ expect(subject.errors[:'events.name'].first).to include "must be one of"
171
+ end
172
+ end
173
+
162
174
  context "with no method" do
163
175
  let(:json) do
164
176
  valid_webhook_with do |hash|
@@ -0,0 +1,169 @@
1
+ = HAL-browser
2
+
3
+ An API browser for the hal+json media type
4
+
5
+ == Example Usage
6
+
7
+ Here is an example of a hal+json API using the browser:
8
+
9
+ http://haltalk.herokuapp.com/explorer/browser.html[http://haltalk.herokuapp.com/explorer/browser.html]
10
+
11
+ == About HAL
12
+
13
+ HAL is a format based on json that establishes conventions for
14
+ representing links. For example:
15
+
16
+ [source,javascript]
17
+ ----
18
+ {
19
+ "_links": {
20
+ "self": { "href": "/orders" },
21
+ "next": { "href": "/orders?page=2" }
22
+ }
23
+ }
24
+ ----
25
+
26
+ More detail about HAL can be found at
27
+ http://stateless.co/hal_specification.html[http://stateless.co/hal_specification.html].
28
+
29
+ == Customizing the POST form
30
+
31
+ By default, the HAL Browser can't assume there is any metadata. When you click on the non-GET request button (to create a new resource), the user must enter the JSON document to submit. If your service includes metadata you can access, it's possible to plugin a custom view that makes use of it.
32
+
33
+ . Define your custom view.
34
+ +
35
+ Here is an example that leverages Spring Data REST's JSON Schema metadata found at */{entity}/schema*.
36
+ +
37
+ [source,javascript]
38
+ ----
39
+ var CustomPostForm = Backbone.View.extend({
40
+ initialize: function (opts) {
41
+ this.href = opts.href.split('{')[0];
42
+ this.vent = opts.vent;
43
+ _.bindAll(this, 'createNewResource');
44
+ },
45
+
46
+ events: {
47
+ 'submit form': 'createNewResource'
48
+ },
49
+
50
+ className: 'modal fade',
51
+
52
+ createNewResource: function (e) {
53
+ e.preventDefault();
54
+
55
+ var self = this;
56
+
57
+ var data = {}
58
+ Object.keys(this.schema.properties).forEach(function(property) {
59
+ if (!("format" in self.schema.properties[property])) {
60
+ data[property] = self.$('input[name=' + property + ']').val();
61
+ }
62
+ });
63
+
64
+ var opts = {
65
+ url: this.$('.url').val(),
66
+ headers: HAL.parseHeaders(this.$('.headers').val()),
67
+ method: this.$('.method').val(),
68
+ data: JSON.stringify(data)
69
+ };
70
+
71
+ var request = HAL.client.request(opts);
72
+ request.done(function (response) {
73
+ self.vent.trigger('response', {resource: response, jqxhr: jqxhr});
74
+ }).fail(function (response) {
75
+ self.vent.trigger('fail-response', {jqxhr: jqxhr});
76
+ }).always(function () {
77
+ self.vent.trigger('response-headers', {jqxhr: jqxhr});
78
+ window.location.hash = 'NON-GET:' + opts.url;
79
+ });
80
+
81
+ this.$el.modal('hide');
82
+ },
83
+
84
+ render: function (opts) {
85
+ var headers = HAL.client.getHeaders();
86
+ var headersString = '';
87
+
88
+ _.each(headers, function (value, name) {
89
+ headersString += name + ': ' + value + '\n';
90
+ });
91
+
92
+ var request = HAL.client.request({
93
+ url: this.href + '/schema',
94
+ method: 'GET'
95
+ });
96
+
97
+ var self = this;
98
+ request.done(function (schema) {
99
+ self.schema = schema;
100
+ self.$el.html(self.template({
101
+ href: self.href,
102
+ schema: self.schema,
103
+ user_defined_headers: headersString}));
104
+ self.$el.modal();
105
+ });
106
+
107
+ return this;
108
+ },
109
+ template: _.template($('#dynamic-request-template').html())
110
+ });
111
+ ----
112
+ +
113
+ . Register it by assigning to `HAL.customPostForm`
114
+ +
115
+ [source,javascript]
116
+ ----
117
+ HAL.customPostForm = CustomPostForm;
118
+ ----
119
+ +
120
+ . Load your custom JavaScript component and define your custom HTML template.
121
+ +
122
+ [source,html,indent=0]
123
+ ----
124
+ <script id="dynamic-request-template" type="text/template">
125
+ <div class="modal-header">
126
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
127
+ <h3>Make a non-GET request</h3>
128
+ </div>
129
+
130
+ <form class="non-safe" action="<%= href %>">
131
+ <div class="modal-body">
132
+ <p>Target URI</p>
133
+ <input name="url" type="text" class="url" value="<%= href %>" />
134
+ <p>Method:</p>
135
+ <input name="method" type="text" class="method" value="POST" />
136
+ <p>Headers:</p>
137
+ <textarea name="headers" class="headers" style="height: 100px">
138
+ Content-Type: application/json
139
+ <%= user_defined_headers %>
140
+ </textarea>
141
+ </div>
142
+ <% _.each(schema.properties, function(value, name) { %>
143
+ <% if (!("format" in value)) { %>
144
+ <input type="text" placeholder="<%= name %>" name="<%= name %>" />
145
+ <% } %>
146
+ <% }); %>
147
+ <div class="modal-footer">
148
+ <button type="submit" class="btn btn-primary">Make Request</button>
149
+ </div>
150
+ </form>
151
+ </script>
152
+ ----
153
+
154
+ NOTE: To load a custom JavaScript module AND a custom HTML template, you will probably need to create a customized version of `browser.html`.
155
+
156
+ NOTE: The HAL Browser uses a global `HAL` object, so there is no need to deal with JavaScript packages.
157
+
158
+ == Usage Instructions
159
+
160
+ All you should need to do is copy the files into your webroot.
161
+ It is OK to put it in a subdirectory; it does not need to be in the root.
162
+
163
+ All the JS and CSS dependencies come included in the vendor directory.
164
+
165
+ == TODO
166
+
167
+ * Provide feedback to user when there are issues with response (missing
168
+ self link, wrong media type identifier)
169
+ * Give 'self' and 'curies' links special treatment
@@ -26,7 +26,7 @@
26
26
  <ul class="nav">
27
27
  <li><a href="#/" id="entryPointLink">Go To Entry Point</a></li>
28
28
  <li><a href="https://github.com/mikekelly/hal-browser">About The HAL Browser</a></li>
29
- <li><a href="/">Pact Broker Home</a></li>
29
+ <li><a href="/">Pact Broker Home</a></li> <!-- pact_broker -->
30
30
  </ul>
31
31
  </div>
32
32
  </div>
@@ -38,7 +38,7 @@
38
38
  <script id="location-bar-template" type="text/template">
39
39
  <form>
40
40
  <div class="input-append span12 location-bar-container">
41
- <input class="span11" id="appendedInputButton" type="text" value="<%= url %>">
41
+ <input class="span11" id="appendedInputButton" type="text" value="<%= _.escape(url) %>">
42
42
  <button class="btn" type="submit">Go!</button>
43
43
  <span class="ajax-loader"></span>
44
44
  </div>
@@ -63,46 +63,47 @@
63
63
  <% if ($.isArray(obj)) { %>
64
64
  <% _.each(obj, function(link, i) { %>
65
65
  <tr>
66
- <% tdStyle = i > 0 ? "border-top:none" : "" %>
67
- <td style="<%= tdStyle %>"><strong><%= i === 0 ? HAL.truncateIfUrl(rel) : '' %></strong></td>
68
- <td><%= link.title || '' %></td>
69
- <td><%= link.name ? 'name: ' + link.name : 'index: ' + i %></a></td>
66
+ <!-- pact_broker escaping -->
67
+ <td><strong><%= HAL.truncateIfUrl(rel) %></strong></td>
68
+ <td><%- link.title || '' %></td>
69
+ <td><%- link.name ? 'name: ' + link.name : 'index: ' + i %></a></td>
70
70
  <td>
71
71
  <% if (HAL.isUrl(rel)) { %>
72
- <a class="dox" href="<%= HAL.buildUrl(rel) %>"><i class="icon-book"></i></a>
72
+ <a class="dox" href="<%= HAL.normalizeUrl(HAL.buildUrl(rel)) %>"><i class="icon-book"></i></a>
73
73
  <% } %>
74
74
  </td>
75
75
  <td>
76
76
  <% if (link.templated === true) { %>
77
- <a class="query btn btn-success" href="<%= link.href %>" title="Query URI template"><i class="icon-question-sign"></i></a>
77
+ <a class="query btn btn-success" href="<%= HAL.normalizeUrl(link.href) %>" title="Query URI template"><i class="icon-question-sign"></i></a>
78
78
  <% } else { %>
79
- <a class="follow btn btn-success" href="<%= link.href %>" title="Follow link"><i class="icon-arrow-right"></i></a>
79
+ <a class="follow btn btn-success" href="<%= HAL.normalizeUrl(link.href) %>" title="Follow link"><i class="icon-arrow-right"></i></a>
80
80
  <% } %>
81
81
  </td>
82
82
  <td>
83
- <a class="non-get btn btn-warning" href="<%= link.href %>" title="Perform non-GET request">!</a>
83
+ <a class="non-get btn btn-warning" href="<%= HAL.normalizeUrl(link.href) %>" title="Perform non-GET request">!</a>
84
84
  </td>
85
85
  </tr>
86
86
  <% }); %>
87
87
  <% } else { %>
88
88
  <tr>
89
89
  <td><strong><%= HAL.truncateIfUrl(rel) %></strong></td>
90
- <td><%= obj.title || '' %></td>
91
- <td><%= obj.name || '' %></td>
90
+ <!-- pact_broker escaping -->
91
+ <td><%- obj.title || '' %></td>
92
+ <td><%- obj.name || '' %></td>
92
93
  <td>
93
94
  <% if (HAL.isUrl(rel)) { %>
94
- <a class="dox" href="<%= HAL.buildUrl(rel) %>"><i class="icon-book"></i></a>
95
+ <a class="dox" href="<%= HAL.normalizeUrl(HAL.buildUrl(rel)) %>"><i class="icon-book"></i></a>
95
96
  <% } %>
96
97
  </td>
97
98
  <td>
98
99
  <% if (obj.templated === true) { %>
99
- <a class="query btn btn-success" href="<%= obj.href %>" title="Query URI template"><i class="icon-question-sign"></i></a>
100
+ <a class="query btn btn-success" href="<%= HAL.normalizeUrl(obj.href) %>" title="Query URI template"><i class="icon-question-sign"></i></a>
100
101
  <% } else { %>
101
- <a class="follow btn btn-success" href="<%= obj.href %>" title="Follow link"><i class="icon-arrow-right"></i></a>
102
+ <a class="follow btn btn-success" href="<%= HAL.normalizeUrl(obj.href) %>" title="Follow link"><i class="icon-arrow-right"></i></a>
102
103
  <% } %>
103
104
  </td>
104
105
  <td>
105
- <a class="non-get btn btn-warning" href="<%= obj.href %>" title="Perform non-GET request">!</a>
106
+ <a class="non-get btn btn-warning" href="<%= HAL.normalizeUrl(obj.href) %>" title="Perform non-GET request">!</a>
106
107
  </td>
107
108
  </tr>
108
109
  <% } %>
@@ -113,7 +114,7 @@
113
114
 
114
115
  <script id="properties-template" type="text/template">
115
116
  <h2>Properties</h2>
116
- <pre><%= _.escape(JSON.stringify(properties, null, HAL.jsonIndent)) %></pre>
117
+ <pre><%= properties %></pre>
117
118
  </script>
118
119
 
119
120
  <script id="request-headers-template" type="text/template">
@@ -125,7 +126,16 @@
125
126
  <h2>Response Headers</h2>
126
127
  <pre><%= status.code %> <%= status.text %>
127
128
 
128
- <%= _.escape(headers) %></pre>
129
+ <% _.each(headers, function(value, name) {
130
+ %><%= _.escape(name) %>: <%
131
+ if(HAL.isFollowableHeader(name)) {
132
+ %><a href="<%= HAL.normalizeUrl(value) %>" class="follow"><%
133
+ }
134
+ %><%= _.escape(value)
135
+ %><% if(HAL.isFollowableHeader(name)) {
136
+ %></a><%
137
+ } %>
138
+ <% }) %></pre>
129
139
  </script>
130
140
 
131
141
  <script id="response-body-template" type="text/template">
@@ -142,7 +152,7 @@
142
152
  <form id="query" action="<%= href %>">
143
153
  <div class="modal-body">
144
154
  <p>URI Template:</p>
145
- <pre><%= href %></pre>
155
+ <pre><%- href %></pre>
146
156
  <p>Input (JSON):</p>
147
157
  <textarea><%= input %></textarea>
148
158
  <p>Expanded URI:</p>
@@ -193,9 +203,10 @@ Content-Type: application/json
193
203
 
194
204
  <script id="embedded-resource-template" type="text/template">
195
205
  <div class="accordion-heading">
206
+ <!-- pact_broker -->
196
207
  <a class="accordion-toggle" href="#"><%= resource.identifier %><% if (resource.name || resource.title) { %>: <span class="embedded-resource-title"><%- resource.name || resource.title %></span><% } %>
197
208
  <% if (HAL.isUrl(resource.embed_rel)) { %>
198
- <span class="dox pull-right" data-href="<%= HAL.buildUrl(resource.embed_rel) %>">
209
+ <span class="dox pull-right" data-href="<%= HAL.normalizeUrl(HAL.buildUrl(resource.embed_rel)) %>">
199
210
  <i class="icon-book"></i>
200
211
  </span>
201
212
  <% } %>
@@ -203,11 +214,11 @@ Content-Type: application/json
203
214
  </div>
204
215
  </script>
205
216
 
206
-
207
217
  <script src="vendor/js/jquery-1.10.2.min.js"></script>
208
218
  <script src="vendor/js/underscore.js"></script>
209
219
  <script src="vendor/js/backbone.js"></script>
210
220
  <script src="vendor/js/uritemplates.js"></script>
221
+ <script src="vendor/js/URI.min.js"></script>
211
222
  <script src="vendor/js/bootstrap.js"></script>
212
223
 
213
224
  <script src="js/hal.js"></script>
@@ -1,10 +1,6 @@
1
1
  (function() {
2
2
  var urlRegex = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
3
3
 
4
- function isCurie(string) {
5
- return string.split(':').length > 1;
6
- };
7
-
8
4
  var HAL = {
9
5
  Models: {},
10
6
  Views: {},
@@ -12,17 +8,43 @@
12
8
  currentDocument: {},
13
9
  jsonIndent: 2,
14
10
  isUrl: function(str) {
15
- return str.match(urlRegex) || isCurie(str);
11
+ return str.match(urlRegex) || HAL.isCurie(str);
12
+ },
13
+ isCurie: function(string) {
14
+ var isCurie = false;
15
+ var curieParts = string.split(':');
16
+ var curies = HAL.currentDocument._links.curies;
17
+
18
+ if(curieParts.length > 1 && curies) {
19
+
20
+ for (var i=0; i<curies.length; i++) {
21
+ if (curies[i].name == curieParts[0]) {
22
+ isCurie = true;
23
+ break;
24
+ }
25
+ }
26
+ }
27
+ return isCurie;
28
+ },
29
+ isFollowableHeader: function(headerName) {
30
+ return headerName === 'Location' || headerName === 'Content-Location';
16
31
  },
17
32
  truncateIfUrl: function(str) {
18
33
  var replaceRegex = /(http|https):\/\/([^\/]*)\//;
19
34
  return str.replace(replaceRegex, '.../');
20
35
  },
36
+ normalizeUrl: function(rel) {
37
+ var cur = location.hash.slice(1);
38
+ var uri = new URI(rel)
39
+ var norm = uri.absoluteTo(cur);
40
+
41
+ return norm
42
+ },
21
43
  buildUrl: function(rel) {
22
44
  if (!HAL.currentDocument._links) {
23
45
  return rel;
24
46
  }
25
- if (!rel.match(urlRegex) && isCurie(rel) && HAL.currentDocument._links.curies) {
47
+ if (!rel.match(urlRegex) && HAL.isCurie(rel) && HAL.currentDocument._links.curies) {
26
48
  var parts = rel.split(':');
27
49
  var curies = HAL.currentDocument._links.curies;
28
50
  for (var i=0; i<curies.length; i++) {
@@ -32,7 +54,7 @@
32
54
  }
33
55
  }
34
56
  }
35
- else if (!rel.match(urlRegex) && isCurie(rel) && HAL.currentDocument._links.curie) {
57
+ else if (!rel.match(urlRegex) && HAL.isCurie(rel) && HAL.currentDocument._links.curie) {
36
58
  // Backward compatibility with <04 version of spec.
37
59
  var tmpl = uritemplate(HAL.currentDocument._links.curie.href);
38
60
  return tmpl.expand({ rel: rel.split(':')[1] });
@@ -54,6 +76,7 @@
54
76
  });
55
77
  return headers;
56
78
  },
79
+ customPostForm: undefined
57
80
  };
58
81
 
59
82
  window.HAL = HAL;
@@ -1,6 +1,9 @@
1
1
  HAL.Http.Client = function(opts) {
2
2
  this.vent = opts.vent;
3
- $.ajaxSetup({ headers: { 'Accept': 'application/hal+json, application/json, */*; q=0.01', 'X-Interface': 'HAL Browser' } });
3
+ this.defaultHeaders = { 'Accept': 'application/hal+json, application/json, */*; q=0.01', 'X-Interface': 'HAL Browser' }; //pact_broker
4
+ cookie = document.cookie.match('(^|;)\\s*' + 'MyHalBrowserToken' + '\\s*=\\s*([^;]+)');
5
+ cookie ? this.defaultHeaders.Authorization = 'Bearer ' + cookie.pop() : '';
6
+ this.headers = this.defaultHeaders;
4
7
  };
5
8
 
6
9
  HAL.Http.Client.prototype.get = function(url) {
@@ -9,6 +12,10 @@ HAL.Http.Client.prototype.get = function(url) {
9
12
  var jqxhr = $.ajax({
10
13
  url: url,
11
14
  dataType: 'json',
15
+ xhrFields: {
16
+ withCredentials: false
17
+ },
18
+ headers: this.headers,
12
19
  success: function(resource, textStatus, jqXHR) {
13
20
  self.vent.trigger('response', {
14
21
  resource: resource,
@@ -24,15 +31,16 @@ HAL.Http.Client.prototype.get = function(url) {
24
31
  HAL.Http.Client.prototype.request = function(opts) {
25
32
  var self = this;
26
33
  opts.dataType = 'json';
34
+ opts.xhrFields = opts.xhrFields || {};
35
+ opts.xhrFields.withCredentials = opts.xhrFields.withCredentials || false;
27
36
  self.vent.trigger('location-change', { url: opts.url });
28
37
  return jqxhr = $.ajax(opts);
29
38
  };
30
39
 
31
- HAL.Http.Client.prototype.updateDefaultHeaders = function(headers) {
32
- this.defaultHeaders = headers;
33
- $.ajaxSetup({ headers: headers });
40
+ HAL.Http.Client.prototype.updateHeaders = function(headers) {
41
+ this.headers = headers;
34
42
  };
35
43
 
36
- HAL.Http.Client.prototype.getDefaultHeaders = function() {
37
- return this.defaultHeaders;
44
+ HAL.Http.Client.prototype.getHeaders = function() {
45
+ return this.headers;
38
46
  };
@@ -2,8 +2,8 @@ HAL.Models.Resource = Backbone.Model.extend({
2
2
  initialize: function(representation) {
3
3
  representation = representation || {};
4
4
  this.links = representation._links;
5
- this.title = this.buildTitle(representation);
6
- this.name = this.buildName(representation);
5
+ this.title = this.buildTitle(representation); // pact_broker
6
+ this.name = this.buildName(representation); // pact_broker
7
7
  if(representation._embedded !== undefined) {
8
8
  this.embeddedResources = this.buildEmbeddedResources(representation._embedded);
9
9
  }
@@ -12,6 +12,7 @@ HAL.Models.Resource = Backbone.Model.extend({
12
12
  this.unset('_links', { silent: true });
13
13
  },
14
14
 
15
+ // pact_broker
15
16
  buildName: function(representation) {
16
17
  return representation.name ||
17
18
  (representation._links
@@ -19,6 +20,7 @@ HAL.Models.Resource = Backbone.Model.extend({
19
20
  && representation._links.self.name);
20
21
  },
21
22
 
23
+ // pact_broker
22
24
  buildTitle: function(representation) {
23
25
  return representation.title ||
24
26
  (representation._links
@@ -2,6 +2,6 @@ HAL.Views.Documenation = Backbone.View.extend({
2
2
  className: 'documentation',
3
3
 
4
4
  render: function(url) {
5
- this.$el.html('<iframe src=' + url + '></iframe>');
5
+ this.$el.html('<iframe src="' + url + '"></iframe>');
6
6
  }
7
7
  });
@@ -22,9 +22,9 @@ HAL.Views.EmbeddedResource = Backbone.View.extend({
22
22
  onToggleClick: function(e) {
23
23
  e.preventDefault();
24
24
  this.$accordionBody.collapse('toggle');
25
+ return false;
25
26
  },
26
-
27
-
27
+
28
28
  onDoxClick: function(e) {
29
29
  e.preventDefault();
30
30
  this.vent.trigger('show-docs', {
@@ -36,16 +36,22 @@ HAL.Views.EmbeddedResource = Backbone.View.extend({
36
36
  render: function() {
37
37
  this.$el.empty();
38
38
 
39
- this.linksView.render(this.resource.links);
40
39
  this.propertiesView.render(this.resource.toJSON());
40
+ this.linksView.render(this.resource.links);
41
41
 
42
42
  this.$el.append(this.template({
43
43
  resource: this.resource
44
44
  }));
45
45
 
46
46
  var $inner = $('<div class="accordion-inner"></div>');
47
- $inner.append(this.linksView.el);
48
47
  $inner.append(this.propertiesView.el);
48
+ $inner.append(this.linksView.el);
49
+
50
+ if (this.resource.embeddedResources) {
51
+ var embeddedResourcesView = new HAL.Views.EmbeddedResources({ vent: this.vent });
52
+ embeddedResourcesView.render(this.resource.embeddedResources);
53
+ $inner.append(embeddedResourcesView.el);
54
+ }
49
55
 
50
56
  this.$accordionBody = $('<div class="accordion-body collapse"></div>');
51
57
  this.$accordionBody.append($inner)
@@ -33,10 +33,11 @@ HAL.Views.Links = Backbone.View.extend({
33
33
  showNonSafeRequestDialog: function(e) {
34
34
  e.preventDefault();
35
35
 
36
- var d = new HAL.Views.NonSafeRequestDialog({
36
+ var postForm = (HAL.customPostForm !== undefined) ? HAL.customPostForm : HAL.Views.NonSafeRequestDialog;
37
+ var d = new postForm({
37
38
  href: $(e.currentTarget).attr('href'),
38
39
  vent: this.vent
39
- }).render({});
40
+ }).render({})
40
41
  },
41
42
 
42
43
  showDocs: function(e) {
@@ -37,7 +37,7 @@ HAL.Views.NonSafeRequestDialog = Backbone.View.extend({
37
37
  },
38
38
 
39
39
  render: function(opts) {
40
- var headers = HAL.client.getDefaultHeaders(),
40
+ var headers = HAL.client.getHeaders(),
41
41
  headersString = '';
42
42
 
43
43
  _.each(headers, function(value, name) {
@@ -5,9 +5,108 @@ HAL.Views.Properties = Backbone.View.extend({
5
5
  },
6
6
 
7
7
  className: 'properties',
8
-
8
+
9
+ _mkIndent: function(indent, space) {
10
+ var s = "";
11
+ for(var i=0; i<indent; ++i) {
12
+ s += space;
13
+ }
14
+ return s;
15
+ },
16
+
17
+ _mkSpace : function(spaceChar, cols) {
18
+ var s = "";
19
+ for(i=0; i<cols; ++i) {
20
+ s += spaceChar;
21
+ }
22
+ return s;
23
+ },
24
+
25
+ _isHalLink: function(key, value, stack) {
26
+ if(!(key === "href") || !(typeof value === "string")) {
27
+ return false;
28
+ }
29
+
30
+ var n = 3;
31
+ if(stack.length < n) {
32
+ return false;
33
+ }
34
+
35
+ var linkParent = stack[stack.length-n];
36
+
37
+ if(Array.isArray(linkParent)) {
38
+ if(stack.length < n+1) {
39
+ return false;
40
+ }
41
+ ++n;
42
+ linkParent = stack[stack.length-n];
43
+ }
44
+
45
+ if(stack.length < n+1) {
46
+ return false;
47
+ }
48
+ ++n;
49
+ var linkParentParent = stack[stack.length-n];
50
+
51
+ return linkParentParent["_links"] === linkParent;
52
+ },
53
+
54
+ _stringifyImpl: function(key, value, indent, stack) {
55
+ var s = "";
56
+ var space = this._mkSpace(' ', HAL.jsonIndent);
57
+ stack.push(value);
58
+ if(key !== null) {
59
+ s += '"' + key + '": ';
60
+ }
61
+
62
+ var link = this._isHalLink(key, value, stack);
63
+ if(link) {
64
+ s += "<a href='#" + value + "'>";
65
+ }
66
+
67
+ if(Array.isArray(value)) {
68
+ s += '[';
69
+ ++indent;
70
+ for(var i=0; i<value.length; ++i) {
71
+ s += this._stringifyImpl(null, value[i], indent, stack);
72
+ if(i+1<value.length) {
73
+ s += ", ";
74
+ }
75
+ }
76
+ --indent;
77
+ s += ']';
78
+ } else if(typeof value === "object" && value !== null) {
79
+ // typeof null is resolved as a object, but Object.keys(null) will raise exception
80
+ s += '{\n';
81
+ ++indent;
82
+ var keys = Object.keys(value);
83
+ for(var i=0; i<keys.length; ++i) {
84
+ var k = keys[i];
85
+ s += this._mkIndent(indent, space);
86
+ s += this._stringifyImpl(k, value[k], indent, stack);
87
+ if(i+1<keys.length) {
88
+ s += ",";
89
+ }
90
+ s += "\n";
91
+ }
92
+ --indent;
93
+ s += this._mkIndent(indent, space) + '}';
94
+ } else if(typeof value === "boolean" ||
95
+ typeof value === "number" ||
96
+ typeof value === "string" ||
97
+ (typeof value === "object" && value === null)) {
98
+ s += _.escape(JSON.stringify(value, null, space));
99
+ }
100
+ if(link) {
101
+ s += "</a>";
102
+ }
103
+ stack.pop();
104
+ return s;
105
+ },
106
+
9
107
  render: function(props) {
10
- this.$el.html(this.template({ properties: props }));
108
+ var propsHtml = this._stringifyImpl(null, props, 0, []);
109
+ this.$el.html(this.template({ properties: propsHtml }));
11
110
  },
12
111
 
13
112
  template: _.template($('#properties-template').html())
@@ -34,7 +34,7 @@ HAL.Views.QueryUriDialog = Backbone.View.extend({
34
34
  } catch (err) {
35
35
  result = 'Invalid json input';
36
36
  }
37
- this.$('.preview').html(result);
37
+ this.$('.preview').text(result);
38
38
  },
39
39
 
40
40
  extractExpressionNames: function (template) {
@@ -19,7 +19,7 @@ HAL.Views.RequestHeaders = Backbone.View.extend({
19
19
  updateRequestHeaders: function(e) {
20
20
  var inputText = this.$('textarea').val() || '';
21
21
  headers = HAL.parseHeaders(inputText);
22
- HAL.client.updateDefaultHeaders(headers)
22
+ HAL.client.updateHeaders(_.defaults(headers, HAL.client.defaultHeaders))
23
23
  },
24
24
 
25
25
  render: function() {
@@ -25,12 +25,13 @@ HAL.Views.Resource = Backbone.View.extend({
25
25
  propertiesView = new HAL.Views.Properties({ vent: this.vent }),
26
26
  embeddedResourcesView
27
27
 
28
- linksView.render(resource.links);
28
+
29
29
  propertiesView.render(resource.toJSON());
30
+ linksView.render(resource.links);
30
31
 
31
32
  this.$el.empty();
32
- this.$el.append(linksView.el);
33
- this.$el.append(propertiesView.el);
33
+ this.$el.append(linksView.el); // pact_broker swap order of links and properties
34
+ this.$el.append(propertiesView.el); // pact_broker
34
35
 
35
36
  if (resource.embeddedResources) {
36
37
  embeddedResourcesView = new HAL.Views.EmbeddedResources({ vent: this.vent });
@@ -3,15 +3,26 @@ HAL.Views.ResponseHeaders = Backbone.View.extend({
3
3
  this.vent = opts.vent;
4
4
  },
5
5
 
6
+ events: {
7
+ 'click .follow': 'followLink'
8
+ },
9
+
6
10
  className: 'response-headers',
7
11
 
12
+ followLink: function(e) {
13
+ e.preventDefault();
14
+ var $target = $(e.currentTarget);
15
+ var uri = $target.attr('href');
16
+ window.location.hash = uri;
17
+ },
18
+
8
19
  render: function(e) {
9
20
  this.$el.html(this.template({
10
21
  status: {
11
22
  code: e.jqxhr.status,
12
23
  text: e.jqxhr.statusText
13
24
  },
14
- headers: e.jqxhr.getAllResponseHeaders()
25
+ headers: HAL.parseHeaders(e.jqxhr.getAllResponseHeaders())
15
26
  }));
16
27
  },
17
28
 
@@ -0,0 +1,76 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Sign in - HAL Browser</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <link href="vendor/css/bootstrap.css" rel="stylesheet">
8
+ <link href="vendor/css/bootstrap-responsive.css" rel="stylesheet">
9
+ <style type="text/css">
10
+ body {
11
+ padding-top: 40px;
12
+ padding-bottom: 40px;
13
+ background-color: #f5f5f5;
14
+ }
15
+ .form-signin {
16
+ max-width: 300px;
17
+ padding: 19px 29px 29px;
18
+ margin: 0 auto 20px;
19
+ background-color: #fff;
20
+ border: 1px solid #e5e5e5;
21
+ -webkit-border-radius: 5px;
22
+ -moz-border-radius: 5px;
23
+ border-radius: 5px;
24
+ -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
25
+ -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
26
+ box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
27
+ }
28
+ .form-signin .form-signin-heading {
29
+ margin-bottom: 10px;
30
+ }
31
+ .form-signin input[type="text"], .form-signin input[type="password"] {
32
+ font-size: 16px;
33
+ height: auto;
34
+ margin-bottom: 15px;
35
+ padding: 7px 9px;
36
+ }
37
+ </style>
38
+ <script src="vendor/js/jquery-1.10.2.min.js"></script>
39
+ <script src="vendor/js/bootstrap.js"></script>
40
+ <script>
41
+ $(document).ready(function() {
42
+ $('#form-signin').submit(function(event){
43
+ event.preventDefault();
44
+ $.ajax({
45
+ url : '../oauth/token',
46
+ type : 'POST',
47
+ async : false,
48
+ data : 'password='+$("#password").val()+'&username='+$("#username").val()+'&grant_type=password',
49
+ headers : {
50
+ Authorization : 'Basic ' + btoa($("#clientid").val() + ':' + $("#clientsecret").val()),
51
+ "Content-Type" : 'application/x-www-form-urlencoded',
52
+ "Accept" : 'application/json'
53
+ },
54
+ dataType : 'json',
55
+ success : function(data) {
56
+ document.cookie = "MyHalBrowserToken=" + data.access_token;
57
+ window.location.href = 'browser.html'
58
+ }
59
+ });
60
+ });
61
+ });
62
+ </script>
63
+ </head>
64
+ <body>
65
+ <div class="container">
66
+ <form class="form-signin" id="form-signin">
67
+ <h3 class="form-signin-heading">HAL Browser - OAuth2</h3>
68
+ <input type="text" class="input-block-level" placeholder="Client ID" id="clientid">
69
+ <input type="text" class="input-block-level" placeholder="Client Secret" id="clientsecret">
70
+ <input type="text" class="input-block-level" placeholder="Username" id="username">
71
+ <input type="password" class="input-block-level" placeholder="Password" id="password">
72
+ <button type="submit" class="btn btn-large btn-primary" id="login">Sign in</button>
73
+ </form>
74
+ </div>
75
+ </body>
76
+ </html>
@@ -1,3 +1,5 @@
1
+ html, body, #browser, .hal-browser { height: 100%; }
2
+
1
3
  #browser #location-bar { margin: 10px 0; }
2
4
 
3
5
  #browser #location-bar .address {
@@ -28,7 +30,7 @@
28
30
 
29
31
  .documentation { height: 100%; }
30
32
  .documentation iframe { width: 100%; height: 100%; }
31
- .documentation iframe { min-height: 600px } /* Beth: don't know why we need this, it used to display full height without setting a min-height. No idea what changed. */
33
+ .documentation iframe { min-height: 600px } /* pact_broker Beth: don't know why we need this, it used to display full height without setting a min-height. No idea what changed. */
32
34
 
33
35
  .modal input, .modal textarea {
34
36
  width: 90%;
@@ -0,0 +1,84 @@
1
+ /*! URI.js v1.14.1 http://medialize.github.io/URI.js/ */
2
+ /* build contains: IPv6.js, punycode.js, SecondLevelDomains.js, URI.js, URITemplate.js */
3
+ (function(f,l){"object"===typeof exports?module.exports=l():"function"===typeof define&&define.amd?define(l):f.IPv6=l(f)})(this,function(f){var l=f&&f.IPv6;return{best:function(g){g=g.toLowerCase().split(":");var m=g.length,b=8;""===g[0]&&""===g[1]&&""===g[2]?(g.shift(),g.shift()):""===g[0]&&""===g[1]?g.shift():""===g[m-1]&&""===g[m-2]&&g.pop();m=g.length;-1!==g[m-1].indexOf(".")&&(b=7);var k;for(k=0;k<m&&""!==g[k];k++);if(k<b)for(g.splice(k,1,"0000");g.length<b;)g.splice(k,0,"0000");for(k=0;k<b;k++){for(var m=
4
+ g[k].split(""),f=0;3>f;f++)if("0"===m[0]&&1<m.length)m.splice(0,1);else break;g[k]=m.join("")}var m=-1,l=f=0,h=-1,r=!1;for(k=0;k<b;k++)r?"0"===g[k]?l+=1:(r=!1,l>f&&(m=h,f=l)):"0"===g[k]&&(r=!0,h=k,l=1);l>f&&(m=h,f=l);1<f&&g.splice(m,f,"");m=g.length;b="";""===g[0]&&(b=":");for(k=0;k<m;k++){b+=g[k];if(k===m-1)break;b+=":"}""===g[m-1]&&(b+=":");return b},noConflict:function(){f.IPv6===this&&(f.IPv6=l);return this}}});
5
+ (function(f){function l(b){throw RangeError(v[b]);}function g(b,e){for(var h=b.length;h--;)b[h]=e(b[h]);return b}function m(b,e){return g(b.split(u),e).join(".")}function b(b){for(var e=[],h=0,a=b.length,c,d;h<a;)c=b.charCodeAt(h++),55296<=c&&56319>=c&&h<a?(d=b.charCodeAt(h++),56320==(d&64512)?e.push(((c&1023)<<10)+(d&1023)+65536):(e.push(c),h--)):e.push(c);return e}function k(b){return g(b,function(b){var e="";65535<b&&(b-=65536,e+=A(b>>>10&1023|55296),b=56320|b&1023);return e+=A(b)}).join("")}function y(b,
6
+ e){return b+22+75*(26>b)-((0!=e)<<5)}function p(b,e,h){var a=0;b=h?q(b/700):b>>1;for(b+=q(b/e);455<b;a+=36)b=q(b/35);return q(a+36*b/(b+38))}function h(b){var e=[],h=b.length,a,c=0,d=128,t=72,w,x,g,f,m;w=b.lastIndexOf("-");0>w&&(w=0);for(x=0;x<w;++x)128<=b.charCodeAt(x)&&l("not-basic"),e.push(b.charCodeAt(x));for(w=0<w?w+1:0;w<h;){x=c;a=1;for(g=36;;g+=36){w>=h&&l("invalid-input");f=b.charCodeAt(w++);f=10>f-48?f-22:26>f-65?f-65:26>f-97?f-97:36;(36<=f||f>q((2147483647-c)/a))&&l("overflow");c+=f*a;m=
7
+ g<=t?1:g>=t+26?26:g-t;if(f<m)break;f=36-m;a>q(2147483647/f)&&l("overflow");a*=f}a=e.length+1;t=p(c-x,a,0==x);q(c/a)>2147483647-d&&l("overflow");d+=q(c/a);c%=a;e.splice(c++,0,d)}return k(e)}function r(e){var h,g,a,c,d,t,w,x,f,m=[],r,k,n;e=b(e);r=e.length;h=128;g=0;d=72;for(t=0;t<r;++t)f=e[t],128>f&&m.push(A(f));for((a=c=m.length)&&m.push("-");a<r;){w=2147483647;for(t=0;t<r;++t)f=e[t],f>=h&&f<w&&(w=f);k=a+1;w-h>q((2147483647-g)/k)&&l("overflow");g+=(w-h)*k;h=w;for(t=0;t<r;++t)if(f=e[t],f<h&&2147483647<
8
+ ++g&&l("overflow"),f==h){x=g;for(w=36;;w+=36){f=w<=d?1:w>=d+26?26:w-d;if(x<f)break;n=x-f;x=36-f;m.push(A(y(f+n%x,0)));x=q(n/x)}m.push(A(y(x,0)));d=p(g,k,a==c);g=0;++a}++g;++h}return m.join("")}var B="object"==typeof exports&&exports,C="object"==typeof module&&module&&module.exports==B&&module,z="object"==typeof global&&global;if(z.global===z||z.window===z)f=z;var s,n=/^xn--/,e=/[^ -~]/,u=/\x2E|\u3002|\uFF0E|\uFF61/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)",
9
+ "invalid-input":"Invalid input"},q=Math.floor,A=String.fromCharCode,D;s={version:"1.2.3",ucs2:{decode:b,encode:k},decode:h,encode:r,toASCII:function(b){return m(b,function(b){return e.test(b)?"xn--"+r(b):b})},toUnicode:function(b){return m(b,function(b){return n.test(b)?h(b.slice(4).toLowerCase()):b})}};if("function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return s});else if(B&&!B.nodeType)if(C)C.exports=s;else for(D in s)s.hasOwnProperty(D)&&(B[D]=s[D]);else f.punycode=
10
+ s})(this);
11
+ (function(f,l){"object"===typeof exports?module.exports=l():"function"===typeof define&&define.amd?define(l):f.SecondLevelDomains=l(f)})(this,function(f){var l=f&&f.SecondLevelDomains,g={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",
12
+ bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",
13
+ cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ","do":" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",
14
+ et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",
15
+ id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ","in":" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",
16
+ kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",
17
+ mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",
18
+ ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",
19
+ ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",
20
+ tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",
21
+ rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",
22
+ tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",
23
+ us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch "},has:function(f){var b=f.lastIndexOf(".");if(0>=b||b>=f.length-1)return!1;
24
+ var k=f.lastIndexOf(".",b-1);if(0>=k||k>=b-1)return!1;var l=g.list[f.slice(b+1)];return l?0<=l.indexOf(" "+f.slice(k+1,b)+" "):!1},is:function(f){var b=f.lastIndexOf(".");if(0>=b||b>=f.length-1||0<=f.lastIndexOf(".",b-1))return!1;var k=g.list[f.slice(b+1)];return k?0<=k.indexOf(" "+f.slice(0,b)+" "):!1},get:function(f){var b=f.lastIndexOf(".");if(0>=b||b>=f.length-1)return null;var k=f.lastIndexOf(".",b-1);if(0>=k||k>=b-1)return null;var l=g.list[f.slice(b+1)];return!l||0>l.indexOf(" "+f.slice(k+
25
+ 1,b)+" ")?null:f.slice(k+1)},noConflict:function(){f.SecondLevelDomains===this&&(f.SecondLevelDomains=l);return this}};return g});
26
+ (function(f,l){"object"===typeof exports?module.exports=l(require("./punycode"),require("./IPv6"),require("./SecondLevelDomains")):"function"===typeof define&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],l):f.URI=l(f.punycode,f.IPv6,f.SecondLevelDomains,f)})(this,function(f,l,g,m){function b(a,c){if(!(this instanceof b))return new b(a,c);void 0===a&&(a="undefined"!==typeof location?location.href+"":"");this.href(a);return void 0!==c?this.absoluteTo(c):this}function k(a){return a.replace(/([.*+?^=!:${}()|[\]\/\\])/g,
27
+ "\\$1")}function y(a){return void 0===a?"Undefined":String(Object.prototype.toString.call(a)).slice(8,-1)}function p(a){return"Array"===y(a)}function h(a,c){var d,b;if(p(c)){d=0;for(b=c.length;d<b;d++)if(!h(a,c[d]))return!1;return!0}var e=y(c);d=0;for(b=a.length;d<b;d++)if("RegExp"===e){if("string"===typeof a[d]&&a[d].match(c))return!0}else if(a[d]===c)return!0;return!1}function r(a,c){if(!p(a)||!p(c)||a.length!==c.length)return!1;a.sort();c.sort();for(var d=0,b=a.length;d<b;d++)if(a[d]!==c[d])return!1;
28
+ return!0}function B(a){return escape(a)}function C(a){return encodeURIComponent(a).replace(/[!'()*]/g,B).replace(/\*/g,"%2A")}function z(a){return function(c,d){if(void 0===c)return this._parts[a]||"";this._parts[a]=c||null;this.build(!d);return this}}function s(a,c){return function(d,b){if(void 0===d)return this._parts[a]||"";null!==d&&(d+="",d.charAt(0)===c&&(d=d.substring(1)));this._parts[a]=d;this.build(!b);return this}}var n=m&&m.URI;b.version="1.14.1";var e=b.prototype,u=Object.prototype.hasOwnProperty;
29
+ b._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,duplicateQueryParameters:b.duplicateQueryParameters,escapeQuerySpace:b.escapeQuerySpace}};b.duplicateQueryParameters=!1;b.escapeQuerySpace=!0;b.protocol_expression=/^[a-z][a-z0-9.+-]*$/i;b.idn_expression=/[^a-z0-9\.-]/i;b.punycode_expression=/(xn--)/i;b.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;b.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;
30
+ b.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u2018\u2019]))/ig;b.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u201e\u2018\u2019]+$/};b.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"};b.invalid_hostname_characters=
31
+ /[^a-zA-Z0-9\.-]/;b.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"};b.getDomAttribute=function(a){if(a&&a.nodeName){var c=a.nodeName.toLowerCase();return"input"===c&&"image"!==a.type?void 0:b.domAttributes[c]}};b.encode=C;b.decode=decodeURIComponent;b.iso8859=function(){b.encode=escape;b.decode=unescape};b.unicode=function(){b.encode=C;b.decode=
32
+ decodeURIComponent};b.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",",
33
+ "%3B":";","%3D":"="}}}};b.encodeQuery=function(a,c){var d=b.encode(a+"");void 0===c&&(c=b.escapeQuerySpace);return c?d.replace(/%20/g,"+"):d};b.decodeQuery=function(a,c){a+="";void 0===c&&(c=b.escapeQuerySpace);try{return b.decode(c?a.replace(/\+/g,"%20"):a)}catch(d){return a}};b.recodePath=function(a){a=(a+"").split("/");for(var c=0,d=a.length;c<d;c++)a[c]=b.encodePathSegment(b.decode(a[c]));return a.join("/")};b.decodePath=function(a){a=(a+"").split("/");for(var c=0,d=a.length;c<d;c++)a[c]=b.decodePathSegment(a[c]);
34
+ return a.join("/")};var v={encode:"encode",decode:"decode"},q,A=function(a,c){return function(d){try{return b[c](d+"").replace(b.characters[a][c].expression,function(d){return b.characters[a][c].map[d]})}catch(t){return d}}};for(q in v)b[q+"PathSegment"]=A("pathname",v[q]);b.encodeReserved=A("reserved","encode");b.parse=function(a,c){var d;c||(c={});d=a.indexOf("#");-1<d&&(c.fragment=a.substring(d+1)||null,a=a.substring(0,d));d=a.indexOf("?");-1<d&&(c.query=a.substring(d+1)||null,a=a.substring(0,
35
+ d));"//"===a.substring(0,2)?(c.protocol=null,a=a.substring(2),a=b.parseAuthority(a,c)):(d=a.indexOf(":"),-1<d&&(c.protocol=a.substring(0,d)||null,c.protocol&&!c.protocol.match(b.protocol_expression)?c.protocol=void 0:"//"===a.substring(d+1,d+3)?(a=a.substring(d+3),a=b.parseAuthority(a,c)):(a=a.substring(d+1),c.urn=!0)));c.path=a;return c};b.parseHost=function(a,c){var d=a.indexOf("/"),b;-1===d&&(d=a.length);"["===a.charAt(0)?(b=a.indexOf("]"),c.hostname=a.substring(1,b)||null,c.port=a.substring(b+
36
+ 2,d)||null,"/"===c.port&&(c.port=null)):a.indexOf(":")!==a.lastIndexOf(":")?(c.hostname=a.substring(0,d)||null,c.port=null):(b=a.substring(0,d).split(":"),c.hostname=b[0]||null,c.port=b[1]||null);c.hostname&&"/"!==a.substring(d).charAt(0)&&(d++,a="/"+a);return a.substring(d)||"/"};b.parseAuthority=function(a,c){a=b.parseUserinfo(a,c);return b.parseHost(a,c)};b.parseUserinfo=function(a,c){var d=a.indexOf("/"),t=a.lastIndexOf("@",-1<d?d:a.length-1);-1<t&&(-1===d||t<d)?(d=a.substring(0,t).split(":"),
37
+ c.username=d[0]?b.decode(d[0]):null,d.shift(),c.password=d[0]?b.decode(d.join(":")):null,a=a.substring(t+1)):(c.username=null,c.password=null);return a};b.parseQuery=function(a,c){if(!a)return{};a=a.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"");if(!a)return{};for(var d={},t=a.split("&"),e=t.length,f,h,g=0;g<e;g++)f=t[g].split("="),h=b.decodeQuery(f.shift(),c),f=f.length?b.decodeQuery(f.join("="),c):null,u.call(d,h)?("string"===typeof d[h]&&(d[h]=[d[h]]),d[h].push(f)):d[h]=f;return d};b.build=function(a){var c=
38
+ "";a.protocol&&(c+=a.protocol+":");a.urn||!c&&!a.hostname||(c+="//");c+=b.buildAuthority(a)||"";"string"===typeof a.path&&("/"!==a.path.charAt(0)&&"string"===typeof a.hostname&&(c+="/"),c+=a.path);"string"===typeof a.query&&a.query&&(c+="?"+a.query);"string"===typeof a.fragment&&a.fragment&&(c+="#"+a.fragment);return c};b.buildHost=function(a){var c="";if(a.hostname)c=b.ip6_expression.test(a.hostname)?c+("["+a.hostname+"]"):c+a.hostname;else return"";a.port&&(c+=":"+a.port);return c};b.buildAuthority=
39
+ function(a){return b.buildUserinfo(a)+b.buildHost(a)};b.buildUserinfo=function(a){var c="";a.username&&(c+=b.encode(a.username),a.password&&(c+=":"+b.encode(a.password)),c+="@");return c};b.buildQuery=function(a,c,d){var t="",e,f,h,g;for(f in a)if(u.call(a,f)&&f)if(p(a[f]))for(e={},h=0,g=a[f].length;h<g;h++)void 0!==a[f][h]&&void 0===e[a[f][h]+""]&&(t+="&"+b.buildQueryParameter(f,a[f][h],d),!0!==c&&(e[a[f][h]+""]=!0));else void 0!==a[f]&&(t+="&"+b.buildQueryParameter(f,a[f],d));return t.substring(1)};
40
+ b.buildQueryParameter=function(a,c,d){return b.encodeQuery(a,d)+(null!==c?"="+b.encodeQuery(c,d):"")};b.addQuery=function(a,c,d){if("object"===typeof c)for(var e in c)u.call(c,e)&&b.addQuery(a,e,c[e]);else if("string"===typeof c)void 0===a[c]?a[c]=d:("string"===typeof a[c]&&(a[c]=[a[c]]),p(d)||(d=[d]),a[c]=(a[c]||[]).concat(d));else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");};b.removeQuery=function(a,c,d){var e;if(p(c))for(d=0,e=c.length;d<e;d++)a[c[d]]=
41
+ void 0;else if("object"===typeof c)for(e in c)u.call(c,e)&&b.removeQuery(a,e,c[e]);else if("string"===typeof c)if(void 0!==d)if(a[c]===d)a[c]=void 0;else{if(p(a[c])){e=a[c];var f={},h,g;if(p(d))for(h=0,g=d.length;h<g;h++)f[d[h]]=!0;else f[d]=!0;h=0;for(g=e.length;h<g;h++)void 0!==f[e[h]]&&(e.splice(h,1),g--,h--);a[c]=e}}else a[c]=void 0;else throw new TypeError("URI.addQuery() accepts an object, string as the first parameter");};b.hasQuery=function(a,c,d,e){if("object"===typeof c){for(var f in c)if(u.call(c,
42
+ f)&&!b.hasQuery(a,f,c[f]))return!1;return!0}if("string"!==typeof c)throw new TypeError("URI.hasQuery() accepts an object, string as the name parameter");switch(y(d)){case "Undefined":return c in a;case "Boolean":return a=Boolean(p(a[c])?a[c].length:a[c]),d===a;case "Function":return!!d(a[c],c,a);case "Array":return p(a[c])?(e?h:r)(a[c],d):!1;case "RegExp":return p(a[c])?e?h(a[c],d):!1:Boolean(a[c]&&a[c].match(d));case "Number":d=String(d);case "String":return p(a[c])?e?h(a[c],d):!1:a[c]===d;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter");
43
+ }};b.commonPath=function(a,c){var d=Math.min(a.length,c.length),b;for(b=0;b<d;b++)if(a.charAt(b)!==c.charAt(b)){b--;break}if(1>b)return a.charAt(0)===c.charAt(0)&&"/"===a.charAt(0)?"/":"";if("/"!==a.charAt(b)||"/"!==c.charAt(b))b=a.substring(0,b).lastIndexOf("/");return a.substring(0,b+1)};b.withinString=function(a,c,d){d||(d={});var e=d.start||b.findUri.start,f=d.end||b.findUri.end,h=d.trim||b.findUri.trim,g=/[a-z0-9-]=["']?$/i;for(e.lastIndex=0;;){var r=e.exec(a);if(!r)break;r=r.index;if(d.ignoreHtml){var k=
44
+ a.slice(Math.max(r-3,0),r);if(k&&g.test(k))continue}var k=r+a.slice(r).search(f),m=a.slice(r,k).replace(h,"");d.ignore&&d.ignore.test(m)||(k=r+m.length,m=c(m,r,k,a),a=a.slice(0,r)+m+a.slice(k),e.lastIndex=r+m.length)}e.lastIndex=0;return a};b.ensureValidHostname=function(a){if(a.match(b.invalid_hostname_characters)){if(!f)throw new TypeError('Hostname "'+a+'" contains characters other than [A-Z0-9.-] and Punycode.js is not available');if(f.toASCII(a).match(b.invalid_hostname_characters))throw new TypeError('Hostname "'+
45
+ a+'" contains characters other than [A-Z0-9.-]');}};b.noConflict=function(a){if(a)return a={URI:this.noConflict()},m.URITemplate&&"function"===typeof m.URITemplate.noConflict&&(a.URITemplate=m.URITemplate.noConflict()),m.IPv6&&"function"===typeof m.IPv6.noConflict&&(a.IPv6=m.IPv6.noConflict()),m.SecondLevelDomains&&"function"===typeof m.SecondLevelDomains.noConflict&&(a.SecondLevelDomains=m.SecondLevelDomains.noConflict()),a;m.URI===this&&(m.URI=n);return this};e.build=function(a){if(!0===a)this._deferred_build=
46
+ !0;else if(void 0===a||this._deferred_build)this._string=b.build(this._parts),this._deferred_build=!1;return this};e.clone=function(){return new b(this)};e.valueOf=e.toString=function(){return this.build(!1)._string};e.protocol=z("protocol");e.username=z("username");e.password=z("password");e.hostname=z("hostname");e.port=z("port");e.query=s("query","?");e.fragment=s("fragment","#");e.search=function(a,c){var d=this.query(a,c);return"string"===typeof d&&d.length?"?"+d:d};e.hash=function(a,c){var d=
47
+ this.fragment(a,c);return"string"===typeof d&&d.length?"#"+d:d};e.pathname=function(a,c){if(void 0===a||!0===a){var d=this._parts.path||(this._parts.hostname?"/":"");return a?b.decodePath(d):d}this._parts.path=a?b.recodePath(a):"/";this.build(!c);return this};e.path=e.pathname;e.href=function(a,c){var d;if(void 0===a)return this.toString();this._string="";this._parts=b._parts();var e=a instanceof b,f="object"===typeof a&&(a.hostname||a.path||a.pathname);a.nodeName&&(f=b.getDomAttribute(a),a=a[f]||
48
+ "",f=!1);!e&&f&&void 0!==a.pathname&&(a=a.toString());if("string"===typeof a||a instanceof String)this._parts=b.parse(String(a),this._parts);else if(e||f)for(d in e=e?a._parts:a,e)u.call(this._parts,d)&&(this._parts[d]=e[d]);else throw new TypeError("invalid input");this.build(!c);return this};e.is=function(a){var c=!1,d=!1,e=!1,f=!1,h=!1,r=!1,k=!1,m=!this._parts.urn;this._parts.hostname&&(m=!1,d=b.ip4_expression.test(this._parts.hostname),e=b.ip6_expression.test(this._parts.hostname),c=d||e,h=(f=
49
+ !c)&&g&&g.has(this._parts.hostname),r=f&&b.idn_expression.test(this._parts.hostname),k=f&&b.punycode_expression.test(this._parts.hostname));switch(a.toLowerCase()){case "relative":return m;case "absolute":return!m;case "domain":case "name":return f;case "sld":return h;case "ip":return c;case "ip4":case "ipv4":case "inet4":return d;case "ip6":case "ipv6":case "inet6":return e;case "idn":return r;case "url":return!this._parts.urn;case "urn":return!!this._parts.urn;case "punycode":return k}return null};
50
+ var D=e.protocol,E=e.port,F=e.hostname;e.protocol=function(a,c){if(void 0!==a&&a&&(a=a.replace(/:(\/\/)?$/,""),!a.match(b.protocol_expression)))throw new TypeError('Protocol "'+a+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return D.call(this,a,c)};e.scheme=e.protocol;e.port=function(a,c){if(this._parts.urn)return void 0===a?"":this;if(void 0!==a&&(0===a&&(a=null),a&&(a+="",":"===a.charAt(0)&&(a=a.substring(1)),a.match(/[^0-9]/))))throw new TypeError('Port "'+a+'" contains characters other than [0-9]');
51
+ return E.call(this,a,c)};e.hostname=function(a,c){if(this._parts.urn)return void 0===a?"":this;if(void 0!==a){var d={};b.parseHost(a,d);a=d.hostname}return F.call(this,a,c)};e.host=function(a,c){if(this._parts.urn)return void 0===a?"":this;if(void 0===a)return this._parts.hostname?b.buildHost(this._parts):"";b.parseHost(a,this._parts);this.build(!c);return this};e.authority=function(a,c){if(this._parts.urn)return void 0===a?"":this;if(void 0===a)return this._parts.hostname?b.buildAuthority(this._parts):
52
+ "";b.parseAuthority(a,this._parts);this.build(!c);return this};e.userinfo=function(a,c){if(this._parts.urn)return void 0===a?"":this;if(void 0===a){if(!this._parts.username)return"";var d=b.buildUserinfo(this._parts);return d.substring(0,d.length-1)}"@"!==a[a.length-1]&&(a+="@");b.parseUserinfo(a,this._parts);this.build(!c);return this};e.resource=function(a,c){var d;if(void 0===a)return this.path()+this.search()+this.hash();d=b.parse(a);this._parts.path=d.path;this._parts.query=d.query;this._parts.fragment=
53
+ d.fragment;this.build(!c);return this};e.subdomain=function(a,c){if(this._parts.urn)return void 0===a?"":this;if(void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var d=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,d)||""}d=this._parts.hostname.length-this.domain().length;d=this._parts.hostname.substring(0,d);d=new RegExp("^"+k(d));a&&"."!==a.charAt(a.length-1)&&(a+=".");a&&b.ensureValidHostname(a);this._parts.hostname=this._parts.hostname.replace(d,
54
+ a);this.build(!c);return this};e.domain=function(a,c){if(this._parts.urn)return void 0===a?"":this;"boolean"===typeof a&&(c=a,a=void 0);if(void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var d=this._parts.hostname.match(/\./g);if(d&&2>d.length)return this._parts.hostname;d=this._parts.hostname.length-this.tld(c).length-1;d=this._parts.hostname.lastIndexOf(".",d-1)+1;return this._parts.hostname.substring(d)||""}if(!a)throw new TypeError("cannot set domain empty");b.ensureValidHostname(a);
55
+ !this._parts.hostname||this.is("IP")?this._parts.hostname=a:(d=new RegExp(k(this.domain())+"$"),this._parts.hostname=this._parts.hostname.replace(d,a));this.build(!c);return this};e.tld=function(a,c){if(this._parts.urn)return void 0===a?"":this;"boolean"===typeof a&&(c=a,a=void 0);if(void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var d=this._parts.hostname.lastIndexOf("."),d=this._parts.hostname.substring(d+1);return!0!==c&&g&&g.list[d.toLowerCase()]?g.get(this._parts.hostname)||d:d}if(a)if(a.match(/[^a-zA-Z0-9-]/))if(g&&
56
+ g.is(a))d=new RegExp(k(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(d,a);else throw new TypeError('TLD "'+a+'" contains characters other than [A-Z0-9]');else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");d=new RegExp(k(this.tld())+"$");this._parts.hostname=this._parts.hostname.replace(d,a)}else throw new TypeError("cannot set TLD empty");this.build(!c);return this};e.directory=function(a,c){if(this._parts.urn)return void 0===
57
+ a?"":this;if(void 0===a||!0===a){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var d=this._parts.path.length-this.filename().length-1,d=this._parts.path.substring(0,d)||(this._parts.hostname?"/":"");return a?b.decodePath(d):d}d=this._parts.path.length-this.filename().length;d=this._parts.path.substring(0,d);d=new RegExp("^"+k(d));this.is("relative")||(a||(a="/"),"/"!==a.charAt(0)&&(a="/"+a));a&&"/"!==a.charAt(a.length-1)&&(a+="/");a=b.recodePath(a);this._parts.path=
58
+ this._parts.path.replace(d,a);this.build(!c);return this};e.filename=function(a,c){if(this._parts.urn)return void 0===a?"":this;if(void 0===a||!0===a){if(!this._parts.path||"/"===this._parts.path)return"";var d=this._parts.path.lastIndexOf("/"),d=this._parts.path.substring(d+1);return a?b.decodePathSegment(d):d}d=!1;"/"===a.charAt(0)&&(a=a.substring(1));a.match(/\.?\//)&&(d=!0);var e=new RegExp(k(this.filename())+"$");a=b.recodePath(a);this._parts.path=this._parts.path.replace(e,a);d?this.normalizePath(c):
59
+ this.build(!c);return this};e.suffix=function(a,c){if(this._parts.urn)return void 0===a?"":this;if(void 0===a||!0===a){if(!this._parts.path||"/"===this._parts.path)return"";var d=this.filename(),e=d.lastIndexOf(".");if(-1===e)return"";d=d.substring(e+1);d=/^[a-z0-9%]+$/i.test(d)?d:"";return a?b.decodePathSegment(d):d}"."===a.charAt(0)&&(a=a.substring(1));if(d=this.suffix())e=a?new RegExp(k(d)+"$"):new RegExp(k("."+d)+"$");else{if(!a)return this;this._parts.path+="."+b.recodePath(a)}e&&(a=b.recodePath(a),
60
+ this._parts.path=this._parts.path.replace(e,a));this.build(!c);return this};e.segment=function(a,c,d){var b=this._parts.urn?":":"/",e=this.path(),f="/"===e.substring(0,1),e=e.split(b);void 0!==a&&"number"!==typeof a&&(d=c,c=a,a=void 0);if(void 0!==a&&"number"!==typeof a)throw Error('Bad segment "'+a+'", must be 0-based integer');f&&e.shift();0>a&&(a=Math.max(e.length+a,0));if(void 0===c)return void 0===a?e:e[a];if(null===a||void 0===e[a])if(p(c)){e=[];a=0;for(var h=c.length;a<h;a++)if(c[a].length||
61
+ e.length&&e[e.length-1].length)e.length&&!e[e.length-1].length&&e.pop(),e.push(c[a])}else{if(c||"string"===typeof c)""===e[e.length-1]?e[e.length-1]=c:e.push(c)}else c?e[a]=c:e.splice(a,1);f&&e.unshift("");return this.path(e.join(b),d)};e.segmentCoded=function(a,c,d){var e,f;"number"!==typeof a&&(d=c,c=a,a=void 0);if(void 0===c){a=this.segment(a,c,d);if(p(a))for(e=0,f=a.length;e<f;e++)a[e]=b.decode(a[e]);else a=void 0!==a?b.decode(a):void 0;return a}if(p(c))for(e=0,f=c.length;e<f;e++)c[e]=b.decode(c[e]);
62
+ else c="string"===typeof c||c instanceof String?b.encode(c):c;return this.segment(a,c,d)};var G=e.query;e.query=function(a,c){if(!0===a)return b.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"===typeof a){var d=b.parseQuery(this._parts.query,this._parts.escapeQuerySpace),e=a.call(this,d);this._parts.query=b.buildQuery(e||d,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);this.build(!c);return this}return void 0!==a&&"string"!==typeof a?(this._parts.query=
63
+ b.buildQuery(a,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!c),this):G.call(this,a,c)};e.setQuery=function(a,c,d){var e=b.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("string"===typeof a||a instanceof String)e[a]=void 0!==c?c:null;else if("object"===typeof a)for(var f in a)u.call(a,f)&&(e[f]=a[f]);else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");this._parts.query=b.buildQuery(e,this._parts.duplicateQueryParameters,
64
+ this._parts.escapeQuerySpace);"string"!==typeof a&&(d=c);this.build(!d);return this};e.addQuery=function(a,c,d){var e=b.parseQuery(this._parts.query,this._parts.escapeQuerySpace);b.addQuery(e,a,void 0===c?null:c);this._parts.query=b.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);"string"!==typeof a&&(d=c);this.build(!d);return this};e.removeQuery=function(a,c,d){var e=b.parseQuery(this._parts.query,this._parts.escapeQuerySpace);b.removeQuery(e,a,c);this._parts.query=
65
+ b.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);"string"!==typeof a&&(d=c);this.build(!d);return this};e.hasQuery=function(a,c,d){var e=b.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return b.hasQuery(e,a,c,d)};e.setSearch=e.setQuery;e.addSearch=e.addQuery;e.removeSearch=e.removeQuery;e.hasSearch=e.hasQuery;e.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()};
66
+ e.normalizeProtocol=function(a){"string"===typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!a));return this};e.normalizeHostname=function(a){this._parts.hostname&&(this.is("IDN")&&f?this._parts.hostname=f.toASCII(this._parts.hostname):this.is("IPv6")&&l&&(this._parts.hostname=l.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!a));return this};e.normalizePort=function(a){"string"===typeof this._parts.protocol&&
67
+ this._parts.port===b.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!a));return this};e.normalizePath=function(a){if(this._parts.urn||!this._parts.path||"/"===this._parts.path)return this;var c,d=this._parts.path,e="",f,h;"/"!==d.charAt(0)&&(c=!0,d="/"+d);d=d.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/");c&&(e=d.substring(1).match(/^(\.\.\/)+/)||"")&&(e=e[0]);for(;;){f=d.indexOf("/..");if(-1===f)break;else if(0===f){d=d.substring(3);continue}h=d.substring(0,f).lastIndexOf("/");
68
+ -1===h&&(h=f);d=d.substring(0,h)+d.substring(f+3)}c&&this.is("relative")&&(d=e+d.substring(1));d=b.recodePath(d);this._parts.path=d;this.build(!a);return this};e.normalizePathname=e.normalizePath;e.normalizeQuery=function(a){"string"===typeof this._parts.query&&(this._parts.query.length?this.query(b.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!a));return this};e.normalizeFragment=function(a){this._parts.fragment||(this._parts.fragment=null,this.build(!a));
69
+ return this};e.normalizeSearch=e.normalizeQuery;e.normalizeHash=e.normalizeFragment;e.iso8859=function(){var a=b.encode,c=b.decode;b.encode=escape;b.decode=decodeURIComponent;this.normalize();b.encode=a;b.decode=c;return this};e.unicode=function(){var a=b.encode,c=b.decode;b.encode=C;b.decode=unescape;this.normalize();b.encode=a;b.decode=c;return this};e.readable=function(){var a=this.clone();a.username("").password("").normalize();var c="";a._parts.protocol&&(c+=a._parts.protocol+"://");a._parts.hostname&&
70
+ (a.is("punycode")&&f?(c+=f.toUnicode(a._parts.hostname),a._parts.port&&(c+=":"+a._parts.port)):c+=a.host());a._parts.hostname&&a._parts.path&&"/"!==a._parts.path.charAt(0)&&(c+="/");c+=a.path(!0);if(a._parts.query){for(var d="",e=0,h=a._parts.query.split("&"),g=h.length;e<g;e++){var r=(h[e]||"").split("="),d=d+("&"+b.decodeQuery(r[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"));void 0!==r[1]&&(d+="="+b.decodeQuery(r[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}c+="?"+d.substring(1)}return c+=
71
+ b.decodeQuery(a.hash(),!0)};e.absoluteTo=function(a){var c=this.clone(),d=["protocol","username","password","hostname","port"],e,f;if(this._parts.urn)throw Error("URNs do not have any generally defined hierarchical components");a instanceof b||(a=new b(a));c._parts.protocol||(c._parts.protocol=a._parts.protocol);if(this._parts.hostname)return c;for(e=0;f=d[e];e++)c._parts[f]=a._parts[f];c._parts.path?".."===c._parts.path.substring(-2)&&(c._parts.path+="/"):(c._parts.path=a._parts.path,c._parts.query||
72
+ (c._parts.query=a._parts.query));"/"!==c.path().charAt(0)&&(a=a.directory(),c._parts.path=(a?a+"/":"")+c._parts.path,c.normalizePath());c.build();return c};e.relativeTo=function(a){var c=this.clone().normalize(),d,e,f,h;if(c._parts.urn)throw Error("URNs do not have any generally defined hierarchical components");a=(new b(a)).normalize();d=c._parts;e=a._parts;f=c.path();h=a.path();if("/"!==f.charAt(0))throw Error("URI is already relative");if("/"!==h.charAt(0))throw Error("Cannot calculate a URI relative to another relative URI");
73
+ d.protocol===e.protocol&&(d.protocol=null);if(d.username===e.username&&d.password===e.password&&null===d.protocol&&null===d.username&&null===d.password&&d.hostname===e.hostname&&d.port===e.port)d.hostname=null,d.port=null;else return c.build();if(f===h)return d.path="",c.build();a=b.commonPath(c.path(),a.path());if(!a)return c.build();e=e.path.substring(a.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");d.path=e+d.path.substring(a.length);return c.build()};e.equals=function(a){var c=this.clone();
74
+ a=new b(a);var d={},e={},f={},h;c.normalize();a.normalize();if(c.toString()===a.toString())return!0;d=c.query();e=a.query();c.query("");a.query("");if(c.toString()!==a.toString()||d.length!==e.length)return!1;d=b.parseQuery(d,this._parts.escapeQuerySpace);e=b.parseQuery(e,this._parts.escapeQuerySpace);for(h in d)if(u.call(d,h)){if(!p(d[h])){if(d[h]!==e[h])return!1}else if(!r(d[h],e[h]))return!1;f[h]=!0}for(h in e)if(u.call(e,h)&&!f[h])return!1;return!0};e.duplicateQueryParameters=function(a){this._parts.duplicateQueryParameters=
75
+ !!a;return this};e.escapeQuerySpace=function(a){this._parts.escapeQuerySpace=!!a;return this};return b});
76
+ (function(f,l){"object"===typeof exports?module.exports=l(require("./URI")):"function"===typeof define&&define.amd?define(["./URI"],l):f.URITemplate=l(f.URI,f)})(this,function(f,l){function g(b){if(g._cache[b])return g._cache[b];if(!(this instanceof g))return new g(b);this.expression=b;g._cache[b]=this;return this}function m(b){this.data=b;this.cache={}}var b=l&&l.URITemplate,k=Object.prototype.hasOwnProperty,y=g.prototype,p={"":{prefix:"",separator:",",named:!1,empty_name_separator:!1,encode:"encode"},
77
+ "+":{prefix:"",separator:",",named:!1,empty_name_separator:!1,encode:"encodeReserved"},"#":{prefix:"#",separator:",",named:!1,empty_name_separator:!1,encode:"encodeReserved"},".":{prefix:".",separator:".",named:!1,empty_name_separator:!1,encode:"encode"},"/":{prefix:"/",separator:"/",named:!1,empty_name_separator:!1,encode:"encode"},";":{prefix:";",separator:";",named:!0,empty_name_separator:!1,encode:"encode"},"?":{prefix:"?",separator:"&",named:!0,empty_name_separator:!0,encode:"encode"},"&":{prefix:"&",
78
+ separator:"&",named:!0,empty_name_separator:!0,encode:"encode"}};g._cache={};g.EXPRESSION_PATTERN=/\{([^a-zA-Z0-9%_]?)([^\}]+)(\}|$)/g;g.VARIABLE_PATTERN=/^([^*:]+)((\*)|:(\d+))?$/;g.VARIABLE_NAME_PATTERN=/[^a-zA-Z0-9%_]/;g.expand=function(b,f){var k=p[b.operator],m=k.named?"Named":"Unnamed",l=b.variables,s=[],n,e,u;for(u=0;e=l[u];u++)n=f.get(e.name),n.val.length?s.push(g["expand"+m](n,k,e.explode,e.explode&&k.separator||",",e.maxlength,e.name)):n.type&&s.push("");return s.length?k.prefix+s.join(k.separator):
79
+ ""};g.expandNamed=function(b,g,k,m,l,s){var n="",e=g.encode;g=g.empty_name_separator;var u=!b[e].length,v=2===b.type?"":f[e](s),q,p,y;p=0;for(y=b.val.length;p<y;p++)l?(q=f[e](b.val[p][1].substring(0,l)),2===b.type&&(v=f[e](b.val[p][0].substring(0,l)))):u?(q=f[e](b.val[p][1]),2===b.type?(v=f[e](b.val[p][0]),b[e].push([v,q])):b[e].push([void 0,q])):(q=b[e][p][1],2===b.type&&(v=b[e][p][0])),n&&(n+=m),k?n+=v+(g||q?"=":"")+q:(p||(n+=f[e](s)+(g||q?"=":"")),2===b.type&&(n+=v+","),n+=q);return n};g.expandUnnamed=
80
+ function(b,g,k,m,l){var s="",n=g.encode;g=g.empty_name_separator;var e=!b[n].length,p,v,q,y;q=0;for(y=b.val.length;q<y;q++)l?v=f[n](b.val[q][1].substring(0,l)):e?(v=f[n](b.val[q][1]),b[n].push([2===b.type?f[n](b.val[q][0]):void 0,v])):v=b[n][q][1],s&&(s+=m),2===b.type&&(p=l?f[n](b.val[q][0].substring(0,l)):b[n][q][0],s+=p,s=k?s+(g||v?"=":""):s+","),s+=v;return s};g.noConflict=function(){l.URITemplate===g&&(l.URITemplate=b);return g};y.expand=function(b){var f="";this.parts&&this.parts.length||this.parse();
81
+ b instanceof m||(b=new m(b));for(var k=0,l=this.parts.length;k<l;k++)f+="string"===typeof this.parts[k]?this.parts[k]:g.expand(this.parts[k],b);return f};y.parse=function(){var b=this.expression,f=g.EXPRESSION_PATTERN,k=g.VARIABLE_PATTERN,m=g.VARIABLE_NAME_PATTERN,l=[],s=0,n,e,u;for(f.lastIndex=0;;){e=f.exec(b);if(null===e){l.push(b.substring(s));break}else l.push(b.substring(s,e.index)),s=e.index+e[0].length;if(!p[e[1]])throw Error('Unknown Operator "'+e[1]+'" in "'+e[0]+'"');if(!e[3])throw Error('Unclosed Expression "'+
82
+ e[0]+'"');n=e[2].split(",");for(var v=0,q=n.length;v<q;v++){u=n[v].match(k);if(null===u)throw Error('Invalid Variable "'+n[v]+'" in "'+e[0]+'"');if(u[1].match(m))throw Error('Invalid Variable Name "'+u[1]+'" in "'+e[0]+'"');n[v]={name:u[1],explode:!!u[3],maxlength:u[4]&&parseInt(u[4],10)}}if(!n.length)throw Error('Expression Missing Variable(s) "'+e[0]+'"');l.push({expression:e[0],operator:e[1],variables:n})}l.length||l.push(b);this.parts=l;return this};m.prototype.get=function(b){var f=this.data,
83
+ g={type:0,val:[],encode:[],encodeReserved:[]},l;if(void 0!==this.cache[b])return this.cache[b];this.cache[b]=g;f="[object Function]"===String(Object.prototype.toString.call(f))?f(b):"[object Function]"===String(Object.prototype.toString.call(f[b]))?f[b](b):f[b];if(void 0!==f&&null!==f)if("[object Array]"===String(Object.prototype.toString.call(f))){l=0;for(b=f.length;l<b;l++)void 0!==f[l]&&null!==f[l]&&g.val.push([void 0,String(f[l])]);g.val.length&&(g.type=3)}else if("[object Object]"===String(Object.prototype.toString.call(f))){for(l in f)k.call(f,
84
+ l)&&void 0!==f[l]&&null!==f[l]&&g.val.push([l,String(f[l])]);g.val.length&&(g.type=2)}else g.type=1,g.val.push([void 0,String(f)]);return g};f.expand=function(b,k){var l=(new g(b)).expand(k);return new f(l)};return g});
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.53.0
4
+ version: 2.54.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bethany Skurrie
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-05-12 00:00:00.000000000 Z
13
+ date: 2020-05-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -130,20 +130,14 @@ dependencies:
130
130
  requirements:
131
131
  - - "~>"
132
132
  - !ruby/object:Gem::Version
133
- version: '2.0'
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- version: 2.0.8
133
+ version: '2.2'
137
134
  type: :runtime
138
135
  prerelease: false
139
136
  version_requirements: !ruby/object:Gem::Requirement
140
137
  requirements:
141
138
  - - "~>"
142
139
  - !ruby/object:Gem::Version
143
- version: '2.0'
144
- - - ">="
145
- - !ruby/object:Gem::Version
146
- version: 2.0.8
140
+ version: '2.2'
147
141
  - !ruby/object:Gem::Dependency
148
142
  name: redcarpet
149
143
  requirement: !ruby/object:Gem::Requirement
@@ -1585,7 +1579,7 @@ files:
1585
1579
  - tasks/test_db.rake
1586
1580
  - vendor/hal-browser/.gitignore
1587
1581
  - vendor/hal-browser/MIT-LICENSE.txt
1588
- - vendor/hal-browser/README.md
1582
+ - vendor/hal-browser/README.adoc
1589
1583
  - vendor/hal-browser/browser.html
1590
1584
  - vendor/hal-browser/js/hal.js
1591
1585
  - vendor/hal-browser/js/hal/browser.js
@@ -1608,12 +1602,14 @@ files:
1608
1602
  - vendor/hal-browser/js/hal/views/response.js
1609
1603
  - vendor/hal-browser/js/hal/views/response_body.js
1610
1604
  - vendor/hal-browser/js/hal/views/response_headers.js
1605
+ - vendor/hal-browser/login.html
1611
1606
  - vendor/hal-browser/styles.css
1612
1607
  - vendor/hal-browser/vendor/css/bootstrap-responsive.css
1613
1608
  - vendor/hal-browser/vendor/css/bootstrap.css
1614
1609
  - vendor/hal-browser/vendor/img/ajax-loader.gif
1615
1610
  - vendor/hal-browser/vendor/img/glyphicons-halflings-white.png
1616
1611
  - vendor/hal-browser/vendor/img/glyphicons-halflings.png
1612
+ - vendor/hal-browser/vendor/js/URI.min.js
1617
1613
  - vendor/hal-browser/vendor/js/backbone.js
1618
1614
  - vendor/hal-browser/vendor/js/bootstrap.js
1619
1615
  - vendor/hal-browser/vendor/js/jquery-1.10.2.js
@@ -1,41 +0,0 @@
1
- HAL-browser
2
- ===========
3
- An API browser for the hal+json media type
4
-
5
- Example Usage
6
- =============
7
- Here is an example of a hal+json API using the browser:
8
-
9
- [http://haltalk.herokuapp.com/explorer/browser.html](http://haltalk.herokuapp.com/explorer/browser.html)
10
-
11
- About HAL
12
- ========
13
- HAL is a format based on json that establishes conventions for
14
- representing links. For example:
15
-
16
- ```javascript
17
- {
18
- "_links": {
19
- "self": { "href": "/orders" },
20
- "next": { "href": "/orders?page=2" }
21
- }
22
- }
23
- ```
24
-
25
- More detail about HAL can be found at
26
- [http://stateless.co/hal_specification.html](http://stateless.co/hal_specification.html).
27
-
28
- Instructions
29
- ============
30
- All you should need to do is copy the files into your webroot.
31
- It is OK to put it in a subdirectory; it does not need to be in the root.
32
-
33
- All the JS and CSS dependencies come included in the vendor directory.
34
-
35
-
36
- TODO
37
- ===========
38
- * Make Location and Content-Location headers clickable links
39
- * Provide feedback to user when there are issues with response (missing
40
- self link, wrong media type identifier)
41
- * Give 'self' and 'curies' links special treatment