This repository has been archived by the owner on Feb 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
raml-json-enhance.html
318 lines (305 loc) · 106 KB
/
raml-json-enhance.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<!--
@license
Copyright 2016 The Advanced REST client authors <arc@mulesoft.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
-->
<link rel="import" href="../polymer/polymer.html">
<!--
The `<raml-json-enhance>` enhaces the JSON output from the RAML parser so it can
be used in the ARC elements (which expects enhanced data structure).
The work is asynchronous. After the `json` property is set/changed it will call the
worker automatically and report the result via the `raml-json-enhance-ready` event.
Polymer application can bind to the `result` property which will notify the change.
### Example
```
<raml-json-enhance json="{...}"></raml-json-enhance>
window.addEventListener('raml-json-enhance-ready', function(e) {
console.log(e.detail.json);
// equals to
console.log(e.target.result);
});
```
**Note** This element MUST be used to enhance parser JSON output in order to use
any RAML related ARC element. Enhancer creates common data structure and
expands RAML types. Element expects the JSON object to contain complete data
about method / endpoint / type / security scheme and so on. It will not look for
the data in the root of raml definition. Thanks to this, you can push just a part
of the JSON object to a specific element to make it work.
For example, the `<raml-docs-method-viewer>` viewer expects the `raml` propety to
be a method definition only (without of the rest of the RAML structure). If
enhanced with the library, the JSON object describing the method will contain
all required information to render the view.
The element contains a set of Polyfills so it will work in IE11+ browsers.
### Biuld process
This element uses web workers to expand JSON result (normalize it).
The element will attempty to load following scitps from the same location where
this script resides:
- polyfills.js
- browser/index.js
- raml2object.js
Build scripts should ensure that this resources are included in the final build.
## Affected properties
- `types`, `traits`, `resourceTypes`, `annotationTypes`, `securitySchemes` - Becomes an object instead of array, keys are object name (with library variable name if applicable)
- `responses`, `body`, `queryParameters`, `headers`, `properties`, `baseUriParameters`, `annotations`, `uriParameters` are recusively transformed into the arrays
- types/{object} - Expanded form for a RAML type and a canonical form with computed inheritance and pushed unions to the top level of the type structure. See documantaion for the [expansion library](https://github.com/raml-org/raml-parser-toolbelt/tree/master/tools/datatype-expansion).
- resource/parentUrl - a full URL of the parent resource
- resource/allUriParameters - list of all URI parameters that apply to this resource (computed from the root down to current resource)
- resource/securedBy - Replaces security schema name with schema's definition.
- method/allUriParameters - The same as for a resource but applied to a method that is direct child of the resource.
- method/absoluteUri - Full, absolute URL to the method containg URI parametes in their RAML's form, eg `/{fileId}`
- method/securedBy - The same as for the resource
- method/*/headers - Full list of all possible headers compured from traits, security schemes etc
- method/*/queryParameters - Full list of all possible queryParameters compured from traits, security schemes etc
- method/responses - Full list of all possible response compured from traits, security schemes etc
- type/properties/items - replaces type name with type definition
- */example(s) - always produces `examples` as an array of example contents
- */structuredExample - content is moved to the *.example array
## Developing this element
Unlike other web components this component has to be build. Make any
changes to the `raml-json-enhance-template.html`. After making a change call
`npm run build`. It will concatenate all required files
and insert generated web worker contentnt into the element's body.
The `raml-json-enhance.html` will be regenerated each time you call build
script.
@group RAML Elements
@element raml-json-enhance
@demo demo/index.html
-->
<dom-module id="raml-json-enhance">
<template>
<style>
:host {
display: none;
}
</style>
<script id="normalizer" type="javascript/worker">"function"!=typeof Object.assign&&(Object.assign=function(t){"use strict";if(null===t)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(t),e=1;e<arguments.length;e++){var n=arguments[e];if(null!==n)for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])}return r}),Object.keys||(Object.keys=function(){"use strict";var o=Object.prototype.hasOwnProperty,i=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=c.length;return function(t){if("function"!=typeof t&&("object"!=typeof t||null===t))throw new TypeError("Object.keys called on non-object");var r,e,n=[];for(r in t)o.call(t,r)&&n.push(r);if(i)for(e=0;e<l;e++)o.call(t,c[e])&&n.push(c[e]);return n}}()),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),String.prototype.endsWith||(String.prototype.endsWith=function(t,r){return r<this.length?r|=0:r=this.length,this.substr(r-t.length,t.length)===t});
function MakePromise(t){function o(t){if("object"!=typeof this||"function"!=typeof t)throw new TypeError;this._state=null,this._value=null,this._deferreds=[],u(t,function t(e){try{if(e===this)throw new TypeError;if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if("function"==typeof n)return void u(n.bind(e),t.bind(this),i.bind(this))}this._state=!0,this._value=e,r.call(this)}catch(t){i.call(this,t)}}.bind(this),i.bind(this))}function s(n){var i=this;null!==this._state?t(function(){var t=i._state?n.onFulfilled:n.onRejected;if("function"==typeof t){var e;try{e=t(i._value)}catch(t){return void n.reject(t)}n.resolve(e)}else(i._state?n.resolve:n.reject)(i._value)}):this._deferreds.push(n)}function i(t){this._state=!1,this._value=t,r.call(this)}function r(){for(var t=0,e=this._deferreds.length;t<e;t++)s.call(this,this._deferreds[t]);this._deferreds=null}function u(t,e,n){var i=!1;try{t(function(t){i||(i=!0,e(t))},function(t){i||(i=!0,n(t))})}catch(t){if(i)return;i=!0,n(t)}}return o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(n,i){var r=this;return new o(function(t,e){s.call(r,{onFulfilled:n,onRejected:i,resolve:t,reject:e})})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(t){t(e)})},o.reject=function(n){return new o(function(t,e){e(n)})},o}"undefined"!=typeof module&&(module.exports=MakePromise);
"use strict";function _defineProperty(n,t,r){return t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r,n}function _typeof(n){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}!function i(o,a,f){function c(t,n){if(!a[t]){if(!o[t]){var r="function"==typeof require&&require;if(!n&&r)return r(t,!0);if(l)return l(t,!0);var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}var u=a[t]={exports:{}};o[t][0].call(u.exports,function(n){return c(o[t][1][n]||n)},u,u.exports,i,o,a,f)}return a[t].exports}for(var l="function"==typeof require&&require,n=0;n<f.length;n++)c(f[n]);return c}({1:[function(n,t,r){var e=n("../node_modules/datatype-expansion/src/index.js");"undefined"==typeof window?self.expansion=e:window.expansion=e},{"../node_modules/datatype-expansion/src/index.js":4}],2:[function(n,t,r){var c=n("lodash"),o=n("./minType"),l=n("./util").consistencyCheck,s=n("./util").isOpaqueType;function p(a,t){var n=(a=c.cloneDeep(a)).type;if(s(n))return l(a);if("array"===n)return a.items=p(a.items||{type:"any"},t),l(a);if("object"===n){var r=a.properties,f=[c.cloneDeep(a)];if(f[0].properties={},c.each(r,function(n,u){var i=p(n,t);if("union"===i.type&&!1!==t.hoistUnions){var o=[];i.anyOf.forEach(function(n){"boolean"==typeof a.required&&(n.required=i.required);for(var t=0;t<f.length;t++){var r=f[t];r=c.cloneDeep(r);var e=Object.assign({},i,n);delete e.anyOf,r.properties[u]=e,o.push(r)}}),f=o}else f=f.map(function(n){return n.properties[u]=i,n})}),1===f.length)return l(f[0]);if(1<f.length)return a.type="union",delete a.properties,delete a.additionalProperties,a.anyOf=f,l(a)}else{if("union"===n)return a.anyOf=a.anyOf.map(function(n){return p("type"in n?n:{type:n},t)}),l(a);if("object"===_typeof(n)){var e=function t(n){if(void 0!==n.properties)return"object";if(void 0!==n.items)return"array";if("string"==typeof n.type)return n.type;if("object"===_typeof(n.type)){if(!Array.isArray(n.type))return t(n.type);var r=n.type.map(function(n){try{return t(n)}catch(n){return null}}).filter(function(n){return null!==n})[0];if(void 0!==r)return r}throw new Error("Cannot find top level class for node, not in expanded form")}(a),u=c.cloneDeep(a);switch(u.type=e){case"object":u.properties=u.properties||{};break;case"array":u.items=u.items||{type:"any"};break;case"union":u.anyOf=u.anyOf||[]}if(Array.isArray(n))return u=c.cloneDeep(n).map(function(n){return p(n,t)}).reduce(function(n,t){return o(t,n)},p(u,t));var i=p(n,t);return o(i,p(u,t))}}return a}t.exports.canonicalForm=function(t,r){var e={};if("object"===_typeof(r)&&(r=(e=r).callback),null==r)return p(t,e);setTimeout(function(){var n;try{n=p(t,e)}catch(n){return void r(n,null)}r(null,n)},0)}},{"./minType":5,"./util":6,lodash:7}],3:[function(n,t,r){var o=n("lodash"),a=n("./util").isOpaqueType;function f(r,e,u,i){if("string"==typeof r)try{JSON.parse(r),r={type:"json",content:r}}catch(n){}if("string"==typeof r){if(/^\(.+\)$/.test(r)&&(r=r.match(/^\((.+)\)$/)[1]),a(r)||"object"===r||"array"===r)return{type:r};if(r.endsWith("?")&&a(r.replace("?","")))return p({type:"union",anyOf:[{type:r.replace("?","")},{type:"nil"}]},e,u,i);if(r.endsWith("[]"))return{type:"array",items:f(r.match(/^(.+)\[]$/)[1],e,u,i)};if(/^[^|\s]+(?:\|[^|\s]+)+$/.test(r.replace(/\s+/g,"")))return p({anyOf:r.split("|").map(function(n){return n.trim()}),type:"union"},e,u,i);if(r in e){if(r in u)return{type:"$recur"};u=Object.assign(_defineProperty({},r,!0),u);var n=e[r];return i.trackOriginalType&&"object"!==_typeof(n)&&(n={type:n}),n=f(n,e,u,i),i.trackOriginalType&&(n.originalType=r),n}throw new Error("could not resolve: "+r)}if("object"!==_typeof(r))throw new Error("form can only be a string or an object");if(r=o.cloneDeep(r),Array.isArray(r)&&(r={type:r}),r.type=r.type||r.properties&&"object"||r.items&&"array"||i.topLevel||"any","string"==typeof r.type){if("array"===r.type)return l(r,e,u,i);if("object"===r.type)return s(r,e,u,i);if("union"===r.type)return p(r,e,u,i);r.type in e?(r=c(r,e,u,i)).type=f(r.type,e,u,i):r=Object.assign(r,f(r.type,e,u,i))}else Array.isArray(r.type)?(r=c(r,e,u,i)).type=r.type.map(function(n){return f(n,e,u,i)}):"object"===_typeof(r.type)?(r=c(r,e,u,i)).type=f(r.type,e,u,i):r=Object.assign(r,f(r.type,e,u,i));return null!=r.facets&&o.each(r.facets,function(n,t){r.facets[t]=f(n,e,u,i)}),r}function c(n,t,r,e){return void 0!==n.properties&&(n=s(n,t,r,e)),void 0!==n.anyOf&&(n=p(n,t,r,e)),void 0!==n.items&&(n=l(n,t,r,e)),n}function l(n,t,r,e){return n.items=f(n.items||"any",t,r,e),n}function s(n,t,r,e){var u=n.properties;for(var i in u)if(u.hasOwnProperty(i)){var o=f(u[i]||"any",t,r,e);i.endsWith("?")&&(delete u[i],i=i.slice(0,-1),o.required=!1),void 0===o.required&&(o.required=!0),u[i]=o}return void 0===n.additionalProperties&&(n.additionalProperties=!0),n}function p(n,t,r,e){return n.anyOf=n.anyOf.map(function(n){return f(n,t,r,e)}),n}t.exports.expandedForm=function(t,r,e){var u={};"object"===_typeof(e)&&(e=(u=e).callback);var i={};for(var n in r)if(r[n]===t){i[n]=!0;break}if(null==e)return f(t,r,i,u);setTimeout(function(){var n;try{n=f(t,r,i,u)}catch(n){return void e(n,null)}e(null,n)},0)}},{"./util":6,lodash:7}],4:[function(n,t,r){var e=n("./expanded"),u=n("./canonical");t.exports={expandedForm:e.expandedForm,canonicalForm:u.canonicalForm}},{"./canonical":2,"./expanded":3}],5:[function(n,t,r){var q=n("./util").isOpaqueType,P=n("./util").consistencyCheck,$={minProperties:function(n,t){if(n<=t)return Math.max(n,t);throw new Error("sub type has a weaker constraint for min-properties than base type")},maxProperties:function(n,t){if(t<=n)return Math.min(n,t);throw new Error("sub type has a weaker constraint for max-properties than base type")},minLength:function(n,t){if(n<=t)return Math.max(n,t);throw new Error("sub type has a weaker constraint for min-length than base type")},maxLength:function(n,t){if(t<=n)return Math.min(n,t);throw new Error("sub type has a weaker constraint for max-length than base type")},minimum:function(n,t){if(n<=t)return Math.max(n,t);throw new Error("sub type has a weaker constraint for minimum than base type")},maximum:function(n,t){if(t<=n)return Math.min(n,t);throw new Error("sub type has a weaker constraint for maximum than base type")},minItems:function(n,t){if(n<=t)return Math.max(n,t);throw new Error("sub type has a weaker constraint for min-items than base type")},maxItems:function(n,t){if(t<=n)return Math.min(n,t);throw new Error("sub type has a weaker constraint for max-items than base type")},format:function(n,t){if(null===n||n===t)return n||t;throw new Error("Different values for format constraint [".concat(n," ").concat(t,"]"))},pattern:function(n,t){if(null===n||n===t)return n||t;throw new Error("Different values for pattern constraint [".concat(n," ").concat(t,"]"))},discriminator:function(n,t){if(null===n||n===t)return n||t;throw new Error("Different values for discriminator constraint [".concat(n," ").concat(t,"]"))},discriminatorValue:function(n,t){if(null===n||n===t)return n||t;throw new Error("Different values for discriminator-value constraint [".concat(n," ").concat(t,"]"))},enumValues:function(t,n){if(0===n.filter(function(n){return-1===t.indexOf(n)}).length)return n;throw new Error("sub type has a weaker constraint for enum-values than base type")},uniqueItems:function(n,t){if(!n||n===t)return n&&t;throw new Error("sub type has a weaker constraint for unique-items than base type")},required:function(n,t){if(!n||n===t)return n||t;throw new Error("Error in required property, making optional base class required property")},additionalProperties:function(n,t){if(!n||n===t)return n&&t;throw new Error("sub type has a weaker constraint for additional-properties than base type")}};var o={type:!0,properties:!0,items:!0,anyOf:!0};function B(n,t){for(var r={},e=Object.keys(t),u=0;u<e.length;u++){var i=e[u];i in o||i in $?r[i]=t[i]:n[i]=t[i]}return r}t.exports=function t(r,e){var n=r.type,u=e.type;if(n===u&&q(n)){var i=Object.assign({},r,e);for(var o in $)void 0!==r[o]&&void 0!==e[o]?i[o]=$[o](r[o],e[o]):void 0===r[o]&&void 0===e[o]||(i[o]=r[o]||e[o]);return P(i)}if("any"===n?"any"!==u:"any"===u){var a="any"===n?r:e,f="any"===n?e:r,c=Object.assign({},r,e);for(var l in c.type=f.type,$)void 0!==a[l]&&void 0!==f[l]?c[l]=$[l](a[l],f[l]):void 0!==a[l]&&(c[l]=a[l]);return P(c)}if("number"===n&&"integer"===u){var s=Object.assign({},r,e);for(var p in $)void 0!==r[p]&&void 0!==e[p]?s[p]=$[p](r[p],e[p]):void 0!==r[p]&&(s[p]=r[p]);return P(s)}if("array"===n&&"array"===u){var h=Object.assign({},r,e);for(var v in h.items=t(r.items,e.items),$)void 0!==r[v]&&void 0!==e[v]?h[v]=$[v](r[v],e[v]):void 0!==r[v]&&(h[v]=r[v]);return P(h)}if("object"===n&&"object"===u){var _=Object.assign({},r,e),y={},g=r.properties||{},d=e.properties||{},m=Object.keys(g),b=Object.keys(d);for(var w in m.filter(function(n){return n in d}).forEach(function(n){y[n]=t(r.properties[n],e.properties[n])}),m.filter(function(n){return!(n in d)}).forEach(function(n){y[n]=r.properties[n]}),b.filter(function(n){return!(n in g)}).forEach(function(n){y[n]=e.properties[n]}),$)void 0!==r[w]&&void 0!==e[w]?_[w]=$[w](r[w],e[w]):void 0!==r[w]&&(_[w]=r[w]);return _.properties=y,P(_)}if("union"!==n&&"union"!==u)throw new Error("incompatible types: [".concat(u,", ").concat(n,"]"));var x,j,O={};if(x="union"===n?(Object.assign(O,r),r.anyOf):[r=B(O,r)],j="union"===u?(Object.assign(O,e),e.anyOf):[e=B(O,e)],O.anyOf=[],0<x.length)if(0<j.length){var k=!0,A=!1,E=void 0;try{for(var I,S=x[Symbol.iterator]();!(k=(I=S.next()).done);k=!0){var R=I.value,z=!0,L=!1,C=void 0;try{for(var T,W=j[Symbol.iterator]();!(z=(T=W.next()).done);z=!0){var D=t(R,T.value);"union"===D.type?O.anyOf.concat(D.anyOf):O.anyOf.push(D)}}catch(r){L=!0,C=r}finally{try{z||null==W.return||W.return()}finally{if(L)throw C}}}}catch(r){A=!0,E=r}finally{try{k||null==S.return||S.return()}finally{if(A)throw E}}}else O.anyOf=x;else O.anyOf=j;for(var U in $)void 0!==r[U]&&"union"===n?void 0!==e[U]&&"union"===u?O[U]=$[U](r[U],e[U]):O[U]=r[U]:void 0!==e[U]&&"union"===u&&(O[U]=e[U]);return P(O)}},{"./util":6}],6:[function(n,t,r){var e=n("lodash").keyBy(["any","boolean","date-only","datetime","datetime-only","time-only","number","integer","string","nil","file","xml","json"]);t.exports.isOpaqueType=function(n){return n in e},t.exports.consistencyCheck=function(n){var t=function(n,t,r){throw new Error("Consistency check failure for property ".concat(n," and values [").concat(t," ").concat(r,"]"))};return void 0!==n.minProperties&&void 0!==n.maxProperties&&n.minProperties>n.maxProperties&&t("numProperties",n.minProperties,n.maxProperties),void 0!==n.minLength&&void 0!==n.maxLength&&n.minLength>n.maxLength&&t("length",n.minLength,n.maxLength),void 0!==n.minimum&&void 0!==n.maximum&&n.minimum>n.maximum&&t("size",n.minimum,n.maximum),void 0!==n.minItems&&void 0!==n.maxItems&&n.minItems>n.maxItems&&t("numItems",n.minItems,n.maxItems),n}},{lodash:7}],7:[function(n,M,F){(function(B){(function(){var no,to="Expected a function",ro="__lodash_hash_undefined__",eo="__lodash_placeholder__",uo=128,io=9007199254740991,oo=NaN,ao=4294967295,fo=[["ary",uo],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],co="[object Arguments]",lo="[object Array]",so="[object Boolean]",po="[object Date]",ho="[object Error]",vo="[object Function]",_o="[object GeneratorFunction]",yo="[object Map]",go="[object Number]",mo="[object Object]",bo="[object Promise]",wo="[object RegExp]",xo="[object Set]",jo="[object String]",Oo="[object Symbol]",ko="[object WeakMap]",Ao="[object ArrayBuffer]",Eo="[object DataView]",Io="[object Float32Array]",So="[object Float64Array]",Ro="[object Int8Array]",zo="[object Int16Array]",Lo="[object Int32Array]",Co="[object Uint8Array]",To="[object Uint8ClampedArray]",Wo="[object Uint16Array]",Do="[object Uint32Array]",Uo=/\b__p \+= '';/g,qo=/\b(__p \+=) '' \+/g,Po=/(__e\(.*?\)|\b__t\)) \+\n'';/g,$o=/&(?:amp|lt|gt|quot|#39);/g,Bo=/[&<>"']/g,Mo=RegExp($o.source),Fo=RegExp(Bo.source),No=/<%-([\s\S]+?)%>/g,Zo=/<%([\s\S]+?)%>/g,Vo=/<%=([\s\S]+?)%>/g,Ko=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Go=/^\w*$/,Jo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ho=/[\\^$.*+?()[\]{}|]/g,Yo=RegExp(Ho.source),Qo=/^\s+|\s+$/g,Xo=/^\s+/,na=/\s+$/,ta=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ra=/\{\n\/\* \[wrapped with (.+)\] \*/,ea=/,? & /,ua=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ia=/\\(\\)?/g,oa=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,aa=/\w*$/,fa=/^[-+]0x[0-9a-f]+$/i,ca=/^0b[01]+$/i,la=/^\[object .+?Constructor\]$/,sa=/^0o[0-7]+$/i,pa=/^(?:0|[1-9]\d*)$/,ha=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,va=/($^)/,_a=/['\n\r\u2028\u2029\\]/g,n="\\ud800-\\udfff",t="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",r="\\u2700-\\u27bf",e="a-z\\xdf-\\xf6\\xf8-\\xff",u="A-Z\\xc0-\\xd6\\xd8-\\xde",i="\\ufe0e\\ufe0f",o="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",a="['’]",f="["+n+"]",c="["+o+"]",l="["+t+"]",s="\\d+",p="["+r+"]",h="["+e+"]",v="[^"+n+o+s+r+e+u+"]",_="\\ud83c[\\udffb-\\udfff]",y="[^"+n+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",m="["+u+"]",b="\\u200d",w="(?:"+h+"|"+v+")",x="(?:"+m+"|"+v+")",j="(?:['’](?:d|ll|m|re|s|t|ve))?",O="(?:['’](?:D|LL|M|RE|S|T|VE))?",k="(?:"+l+"|"+_+")"+"?",A="["+i+"]?",E=A+k+("(?:"+b+"(?:"+[y,g,d].join("|")+")"+A+k+")*"),I="(?:"+[p,g,d].join("|")+")"+E,S="(?:"+[y+l+"?",l,g,d,f].join("|")+")",ya=RegExp(a,"g"),ga=RegExp(l,"g"),R=RegExp(_+"(?="+_+")|"+S+E,"g"),da=RegExp([m+"?"+h+"+"+j+"(?="+[c,m,"$"].join("|")+")",x+"+"+O+"(?="+[c,m+w,"$"].join("|")+")",m+"?"+w+"+"+j,m+"+"+O,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",s,I].join("|"),"g"),z=RegExp("["+b+n+t+i+"]"),ma=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ba=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],wa=-1,xa={};xa[Io]=xa[So]=xa[Ro]=xa[zo]=xa[Lo]=xa[Co]=xa[To]=xa[Wo]=xa[Do]=!0,xa[co]=xa[lo]=xa[Ao]=xa[so]=xa[Eo]=xa[po]=xa[ho]=xa[vo]=xa[yo]=xa[go]=xa[mo]=xa[wo]=xa[xo]=xa[jo]=xa[ko]=!1;var ja={};ja[co]=ja[lo]=ja[Ao]=ja[Eo]=ja[so]=ja[po]=ja[Io]=ja[So]=ja[Ro]=ja[zo]=ja[Lo]=ja[yo]=ja[go]=ja[mo]=ja[wo]=ja[xo]=ja[jo]=ja[Oo]=ja[Co]=ja[To]=ja[Wo]=ja[Do]=!0,ja[ho]=ja[vo]=ja[ko]=!1;var L={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Oa=parseFloat,ka=parseInt,C="object"==_typeof(B)&&B&&B.Object===Object&&B,T="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,Aa=C||T||Function("return this")(),W="object"==_typeof(F)&&F&&!F.nodeType&&F,D=W&&"object"==_typeof(M)&&M&&!M.nodeType&&M,Ea=D&&D.exports===W,U=Ea&&C.process,q=function(){try{var n=D&&D.require&&D.require("util").types;return n||U&&U.binding&&U.binding("util")}catch(n){}}(),Ia=q&&q.isArrayBuffer,Sa=q&&q.isDate,Ra=q&&q.isMap,za=q&&q.isRegExp,La=q&&q.isSet,Ca=q&&q.isTypedArray;function Ta(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function Wa(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n)}return e}function Da(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&!1!==t(n[r],r,n););return n}function Ua(n,t){for(var r=null==n?0:n.length;r--&&!1!==t(n[r],r,n););return n}function qa(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return!1;return!0}function Pa(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function $a(n,t){return!!(null==n?0:n.length)&&-1<Ja(n,t,0)}function Ba(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function Ma(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function Fa(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function Na(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);return r}function Za(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function Va(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}var P=Xa("length");function Ka(n,e,t){var u;return t(n,function(n,t,r){if(e(n,t,r))return u=t,!1}),u}function Ga(n,t,r,e){for(var u=n.length,i=r+(e?1:-1);e?i--:++i<u;)if(t(n[i],i,n))return i;return-1}function Ja(n,t,r){return t==t?function(n,t,r){var e=r-1,u=n.length;for(;++e<u;)if(n[e]===t)return e;return-1}(n,t,r):Ga(n,Ya,r)}function Ha(n,t,r,e){for(var u=r-1,i=n.length;++u<i;)if(e(n[u],t))return u;return-1}function Ya(n){return n!=n}function Qa(n,t){var r=null==n?0:n.length;return r?tf(n,t)/r:oo}function Xa(t){return function(n){return null==n?no:n[t]}}function $(t){return function(n){return null==t?no:t[n]}}function nf(n,e,u,i,t){return t(n,function(n,t,r){u=i?(i=!1,n):e(u,n,t,r)}),u}function tf(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);i!==no&&(r=r===no?i:r+i)}return r}function rf(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function ef(t){return function(n){return t(n)}}function uf(t,n){return Ma(n,function(n){return t[n]})}function of(n,t){return n.has(t)}function af(n,t){for(var r=-1,e=n.length;++r<e&&-1<Ja(t,n[r],0););return r}function ff(n,t){for(var r=n.length;r--&&-1<Ja(t,n[r],0););return r}var cf=$({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),lf=$({"&":"&","<":"<",">":">",'"':""","'":"'"});function sf(n){return"\\"+L[n]}function pf(n){return z.test(n)}function hf(n){var r=-1,e=Array(n.size);return n.forEach(function(n,t){e[++r]=[t,n]}),e}function vf(t,r){return function(n){return t(r(n))}}function _f(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&o!==eo||(n[r]=eo,i[u++]=r)}return i}function yf(n,t){return"__proto__"==t?no:n[t]}function gf(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=n}),r}function df(n){return pf(n)?function(n){var t=R.lastIndex=0;for(;R.test(n);)++t;return t}(n):P(n)}function mf(n){return pf(n)?n.match(R)||[]:n.split("")}var bf=$({"&":"&","<":"<",">":">",""":'"',"'":"'"});var wf=function n(t){var r,I=(t=null==t?Aa:wf.defaults(Aa.Object(),t,wf.pick(Aa,ba))).Array,e=t.Date,u=t.Error,y=t.Function,i=t.Math,O=t.Object,g=t.RegExp,l=t.String,S=t.TypeError,o=I.prototype,a=y.prototype,s=O.prototype,f=t["__core-js_shared__"],c=a.toString,k=s.hasOwnProperty,p=0,h=(r=/[^.]+$/.exec(f&&f.keys&&f.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",v=s.toString,_=c.call(O),d=Aa._,m=g("^"+c.call(k).replace(Ho,"\\{{RAML2OBJ_CONTENT}}").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),b=Ea?t.Buffer:no,w=t.Symbol,x=t.Uint8Array,j=b?b.allocUnsafe:no,A=vf(O.getPrototypeOf,O),E=O.create,R=s.propertyIsEnumerable,z=o.splice,L=w?w.isConcatSpreadable:no,C=w?w.iterator:no,T=w?w.toStringTag:no,W=function(){try{var n=$r(O,"defineProperty");return n({},"",{}),n}catch(n){}}(),D=t.clearTimeout!==Aa.clearTimeout&&t.clearTimeout,U=e&&e.now!==Aa.Date.now&&e.now,q=t.setTimeout!==Aa.setTimeout&&t.setTimeout,P=i.ceil,$=i.floor,B=O.getOwnPropertySymbols,M=b?b.isBuffer:no,F=t.isFinite,N=o.join,Z=vf(O.keys,O),V=i.max,K=i.min,G=e.now,J=t.parseInt,H=i.random,Y=o.reverse,Q=$r(t,"DataView"),X=$r(t,"Map"),nn=$r(t,"Promise"),tn=$r(t,"Set"),rn=$r(t,"WeakMap"),en=$r(O,"create"),un=rn&&new rn,on={},an=he(Q),fn=he(X),cn=he(nn),ln=he(tn),sn=he(rn),pn=w?w.prototype:no,hn=pn?pn.valueOf:no,vn=pn?pn.toString:no;function _n(n){if(Ru(n)&&!mu(n)&&!(n instanceof mn)){if(n instanceof dn)return n;if(k.call(n,"__wrapped__"))return ve(n)}return new dn(n)}var yn=function(){function r(){}return function(n){if(!Su(n))return{};if(E)return E(n);r.prototype=n;var t=new r;return r.prototype=no,t}}();function gn(){}function dn(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=no}function mn(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ao,this.__views__=[]}function bn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function wn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function xn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function jn(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new xn;++t<r;)this.add(n[t])}function On(n){var t=this.__data__=new wn(n);this.size=t.size}function kn(n,t){var r=mu(n),e=!r&&du(n),u=!r&&!e&&ju(n),i=!r&&!e&&!u&&qu(n),o=r||e||u||i,a=o?rf(n.length,l):[],f=a.length;for(var c in n)!t&&!k.call(n,c)||o&&("length"==c||u&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Kr(c,f))||a.push(c);return a}function An(n){var t=n.length;return t?n[jt(0,t-1)]:no}function En(n,t){return fe(ur(n),Dn(t,0,n.length))}function In(n){return fe(ur(n))}function Sn(n,t,r){(r===no||_u(n[t],r))&&(r!==no||t in n)||Tn(n,t,r)}function Rn(n,t,r){var e=n[t];k.call(n,t)&&_u(e,r)&&(r!==no||t in n)||Tn(n,t,r)}function zn(n,t){for(var r=n.length;r--;)if(_u(n[r][0],t))return r;return-1}function Ln(n,e,u,i){return Bn(n,function(n,t,r){e(i,n,u(n),r)}),i}function Cn(n,t){return n&&ir(t,oi(t),n)}function Tn(n,t,r){"__proto__"==t&&W?W(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}function Wn(n,t){for(var r=-1,e=t.length,u=I(e),i=null==n;++r<e;)u[r]=i?no:ti(n,t[r]);return u}function Dn(n,t,r){return n==n&&(r!==no&&(n=n<=r?n:r),t!==no&&(n=t<=n?n:t)),n}function Un(r,e,u,n,t,i){var o,a=1&e,f=2&e,c=4&e;if(u&&(o=t?u(r,n,t,i):u(r)),o!==no)return o;if(!Su(r))return r;var l,s,p,h,v,_,y,g,d,m=mu(r);if(m){if(g=(y=r).length,d=new y.constructor(g),g&&"string"==typeof y[0]&&k.call(y,"index")&&(d.index=y.index,d.input=y.input),o=d,!a)return ur(r,o)}else{var b=Fr(r),w=b==vo||b==_o;if(ju(r))return Qt(r,a);if(b==mo||b==co||w&&!t){if(o=f||w?{}:Zr(r),!a)return f?(_=p=r,h=(v=o)&&ir(_,ai(_),v),ir(p,Mr(p),h)):(s=Cn(o,l=r),ir(l,Br(l),s))}else{if(!ja[b])return t?r:{};o=function(n,t,r){var e,u,i,o,a,f=n.constructor;switch(t){case Ao:return Xt(n);case so:case po:return new f(+n);case Eo:return o=n,a=r?Xt(o.buffer):o.buffer,new o.constructor(a,o.byteOffset,o.byteLength);case Io:case So:case Ro:case zo:case Lo:case Co:case To:case Wo:case Do:return nr(n,r);case yo:return new f;case go:case jo:return new f(n);case wo:return(i=new(u=n).constructor(u.source,aa.exec(u))).lastIndex=u.lastIndex,i;case xo:return new f;case Oo:return e=n,hn?O(hn.call(e)):{}}}(r,b,a)}}i||(i=new On);var x=i.get(r);if(x)return x;if(i.set(r,o),Wu(r))return r.forEach(function(n){o.add(Un(n,e,u,n,r,i))}),o;if(zu(r))return r.forEach(function(n,t){o.set(t,Un(n,e,u,t,r,i))}),o;var j=m?no:(c?f?Cr:Lr:f?ai:oi)(r);return Da(j||r,function(n,t){j&&(n=r[t=n]),Rn(o,t,Un(n,e,u,t,r,i))}),o}function qn(n,t,r){var e=r.length;if(null==n)return!e;for(n=O(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===no&&!(u in n)||!i(o))return!1}return!0}function Pn(n,t,r){if("function"!=typeof n)throw new S(to);return ue(function(){n.apply(no,r)},t)}function $n(n,t,r,e){var u=-1,i=$a,o=!0,a=n.length,f=[],c=t.length;if(!a)return f;r&&(t=Ma(t,ef(r))),e?(i=Ba,o=!1):200<=t.length&&(i=of,o=!1,t=new jn(t));n:for(;++u<a;){var l=n[u],s=null==r?l:r(l);if(l=e||0!==l?l:0,o&&s==s){for(var p=c;p--;)if(t[p]===s)continue n;f.push(l)}else i(t,s,e)||f.push(l)}return f}_n.templateSettings={escape:No,evaluate:Zo,interpolate:Vo,variable:"",imports:{_:_n}},(_n.prototype=gn.prototype).constructor=_n,(dn.prototype=yn(gn.prototype)).constructor=dn,(mn.prototype=yn(gn.prototype)).constructor=mn,bn.prototype.clear=function(){this.__data__=en?en(null):{},this.size=0},bn.prototype.delete=function(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t},bn.prototype.get=function(n){var t=this.__data__;if(en){var r=t[n];return r===ro?no:r}return k.call(t,n)?t[n]:no},bn.prototype.has=function(n){var t=this.__data__;return en?t[n]!==no:k.call(t,n)},bn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=en&&t===no?ro:t,this},wn.prototype.clear=function(){this.__data__=[],this.size=0},wn.prototype.delete=function(n){var t=this.__data__,r=zn(t,n);return!(r<0||(r==t.length-1?t.pop():z.call(t,r,1),--this.size,0))},wn.prototype.get=function(n){var t=this.__data__,r=zn(t,n);return r<0?no:t[r][1]},wn.prototype.has=function(n){return-1<zn(this.__data__,n)},wn.prototype.set=function(n,t){var r=this.__data__,e=zn(r,n);return e<0?(++this.size,r.push([n,t])):r[e][1]=t,this},xn.prototype.clear=function(){this.size=0,this.__data__={hash:new bn,map:new(X||wn),string:new bn}},xn.prototype.delete=function(n){var t=qr(this,n).delete(n);return this.size-=t?1:0,t},xn.prototype.get=function(n){return qr(this,n).get(n)},xn.prototype.has=function(n){return qr(this,n).has(n)},xn.prototype.set=function(n,t){var r=qr(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},jn.prototype.add=jn.prototype.push=function(n){return this.__data__.set(n,ro),this},jn.prototype.has=function(n){return this.__data__.has(n)},On.prototype.clear=function(){this.__data__=new wn,this.size=0},On.prototype.delete=function(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r},On.prototype.get=function(n){return this.__data__.get(n)},On.prototype.has=function(n){return this.__data__.has(n)},On.prototype.set=function(n,t){var r=this.__data__;if(r instanceof wn){var e=r.__data__;if(!X||e.length<199)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new xn(e)}return r.set(n,t),this.size=r.size,this};var Bn=fr(Jn),Mn=fr(Hn,!0);function Fn(n,e){var u=!0;return Bn(n,function(n,t,r){return u=!!e(n,t,r)}),u}function Nn(n,t,r){for(var e=-1,u=n.length;++e<u;){var i=n[e],o=t(i);if(null!=o&&(a===no?o==o&&!Uu(o):r(o,a)))var a=o,f=i}return f}function Zn(n,e){var u=[];return Bn(n,function(n,t,r){e(n,t,r)&&u.push(n)}),u}function Vn(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=Vr),u||(u=[]);++i<o;){var a=n[i];0<t&&r(a)?1<t?Vn(a,t-1,r,e,u):Fa(u,a):e||(u[u.length]=a)}return u}var Kn=cr(),Gn=cr(!0);function Jn(n,t){return n&&Kn(n,t,oi)}function Hn(n,t){return n&&Gn(n,t,oi)}function Yn(t,n){return Pa(n,function(n){return Au(t[n])})}function Qn(n,t){for(var r=0,e=(t=Gt(t,n)).length;null!=n&&r<e;)n=n[pe(t[r++])];return r&&r==e?n:no}function Xn(n,t,r){var e=t(n);return mu(n)?e:Fa(e,r(n))}function nt(n){return null==n?n===no?"[object Undefined]":"[object Null]":T&&T in O(n)?function(n){var t=k.call(n,T),r=n[T];try{n[T]=no;var e=!0}catch(t){}var u=v.call(n);return e&&(t?n[T]=r:delete n[T]),u}(n):(t=n,v.call(t));var t}function tt(n,t){return t<n}function rt(n,t){return null!=n&&k.call(n,t)}function et(n,t){return null!=n&&t in O(n)}function ut(n,t,r){for(var e=r?Ba:$a,u=n[0].length,i=n.length,o=i,a=I(i),f=1/0,c=[];o--;){var l=n[o];o&&t&&(l=Ma(l,ef(t))),f=K(l.length,f),a[o]=!r&&(t||120<=u&&120<=l.length)?new jn(o&&l):no}l=n[0];var s=-1,p=a[0];n:for(;++s<u&&c.length<f;){var h=l[s],v=t?t(h):h;if(h=r||0!==h?h:0,!(p?of(p,v):e(c,v,r))){for(o=i;--o;){var _=a[o];if(!(_?of(_,v):e(n[o],v,r)))continue n}p&&p.push(v),c.push(h)}}return c}function it(n,t,r){var e=null==(n=re(n,t=Gt(t,n)))?n:n[pe(ke(t))];return null==e?no:Ta(e,n,r)}function ot(n){return Ru(n)&&nt(n)==co}function at(n,t,r,e,u){return n===t||(null==n||null==t||!Ru(n)&&!Ru(t)?n!=n&&t!=t:function(n,t,r,e,u,i){var o=mu(n),a=mu(t),f=o?lo:Fr(n),c=a?lo:Fr(t),l=(f=f==co?mo:f)==mo,s=(c=c==co?mo:c)==mo,p=f==c;if(p&&ju(n)){if(!ju(t))return!1;l=!(o=!0)}if(p&&!l)return i||(i=new On),o||qu(n)?Rr(n,t,r,e,u,i):function(n,t,r,e,u,i,o){switch(r){case Eo:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;n=n.buffer,t=t.buffer;case Ao:return!(n.byteLength!=t.byteLength||!i(new x(n),new x(t)));case so:case po:case go:return _u(+n,+t);case ho:return n.name==t.name&&n.message==t.message;case wo:case jo:return n==t+"";case yo:var a=hf;case xo:var f=1&e;if(a||(a=gf),n.size!=t.size&&!f)return!1;var c=o.get(n);if(c)return c==t;e|=2,o.set(n,t);var l=Rr(a(n),a(t),e,u,i,o);return o.delete(n),l;case Oo:if(hn)return hn.call(n)==hn.call(t)}return!1}(n,t,f,r,e,u,i);if(!(1&r)){var h=l&&k.call(n,"__wrapped__"),v=s&&k.call(t,"__wrapped__");if(h||v){var _=h?n.value():n,y=v?t.value():t;return i||(i=new On),u(_,y,r,e,i)}}return!!p&&(i||(i=new On),function(n,t,r,e,u,i){var o=1&r,a=Lr(n),f=a.length,c=Lr(t).length;if(f!=c&&!o)return!1;for(var l=f;l--;){var s=a[l];if(!(o?s in t:k.call(t,s)))return!1}var p=i.get(n);if(p&&i.get(t))return p==t;var h=!0;i.set(n,t),i.set(t,n);for(var v=o;++l<f;){s=a[l];var _=n[s],y=t[s];if(e)var g=o?e(y,_,s,t,n,i):e(_,y,s,n,t,i);if(!(g===no?_===y||u(_,y,r,e,i):g)){h=!1;break}v||(v="constructor"==s)}if(h&&!v){var d=n.constructor,m=t.constructor;d!=m&&"constructor"in n&&"constructor"in t&&!("function"==typeof d&&d instanceof d&&"function"==typeof m&&m instanceof m)&&(h=!1)}return i.delete(n),i.delete(t),h}(n,t,r,e,u,i))}(n,t,r,e,at,u))}function ft(n,t,r,e){var u=r.length,i=u,o=!e;if(null==n)return!i;for(n=O(n);u--;){var a=r[u];if(o&&a[2]?a[1]!==n[a[0]]:!(a[0]in n))return!1}for(;++u<i;){var f=(a=r[u])[0],c=n[f],l=a[1];if(o&&a[2]){if(c===no&&!(f in n))return!1}else{var s=new On;if(e)var p=e(c,l,f,n,t,s);if(!(p===no?at(l,c,3,e,s):p))return!1}}return!0}function ct(n){return!(!Su(n)||(t=n,h&&h in t))&&(Au(n)?m:la).test(he(n));var t}function lt(n){return"function"==typeof n?n:null==n?Li:"object"==_typeof(n)?mu(n)?yt(n[0],n[1]):_t(n):Bi(n)}function st(n){if(!Qr(n))return Z(n);var t=[];for(var r in O(n))k.call(n,r)&&"constructor"!=r&&t.push(r);return t}function pt(n){if(!Su(n))return function(n){var t=[];if(null!=n)for(var r in O(n))t.push(r);return t}(n);var t=Qr(n),r=[];for(var e in n)("constructor"!=e||!t&&k.call(n,e))&&r.push(e);return r}function ht(n,t){return n<t}function vt(n,e){var u=-1,i=wu(n)?I(n.length):[];return Bn(n,function(n,t,r){i[++u]=e(n,t,r)}),i}function _t(t){var r=Pr(t);return 1==r.length&&r[0][2]?ne(r[0][0],r[0][1]):function(n){return n===t||ft(n,t,r)}}function yt(r,e){return Jr(r)&&Xr(e)?ne(pe(r),e):function(n){var t=ti(n,r);return t===no&&t===e?ri(n,r):at(e,t,3)}}function gt(e,u,i,o,a){e!==u&&Kn(u,function(n,t){if(Su(n))a||(a=new On),function(n,t,r,e,u,i,o){var a=yf(n,r),f=yf(t,r),c=o.get(f);if(c)return Sn(n,r,c);var l=i?i(a,f,r+"",n,t,o):no,s=l===no;if(s){var p=mu(f),h=!p&&ju(f),v=!p&&!h&&qu(f);l=f,p||h||v?l=mu(a)?a:xu(a)?ur(a):h?Qt(f,!(s=!1)):v?nr(f,!(s=!1)):[]:Cu(f)||du(f)?du(l=a)?l=Vu(a):(!Su(a)||e&&Au(a))&&(l=Zr(f)):s=!1}s&&(o.set(f,l),u(l,f,e,i,o),o.delete(f)),Sn(n,r,l)}(e,u,t,i,gt,o,a);else{var r=o?o(yf(e,t),n,t+"",e,u,a):no;r===no&&(r=n),Sn(e,t,r)}},ai)}function dt(n,t){var r=n.length;if(r)return Kr(t+=t<0?r:0,r)?n[t]:no}function mt(n,e,r){var u=-1;return e=Ma(e.length?e:[Li],ef(Ur())),function(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].value;return n}(vt(n,function(t,n,r){return{criteria:Ma(e,function(n){return n(t)}),index:++u,value:t}}),function(n,t){return function(n,t,r){for(var e=-1,u=n.criteria,i=t.criteria,o=u.length,a=r.length;++e<o;){var f=tr(u[e],i[e]);if(f){if(a<=e)return f;var c=r[e];return f*("desc"==c?-1:1)}}return n.index-t.index}(n,t,r)})}function bt(n,t,r){for(var e=-1,u=t.length,i={};++e<u;){var o=t[e],a=Qn(n,o);r(a,o)&&It(i,Gt(o,n),a)}return i}function wt(n,t,r,e){var u=e?Ha:Ja,i=-1,o=t.length,a=n;for(n===t&&(t=ur(t)),r&&(a=Ma(n,ef(r)));++i<o;)for(var f=0,c=t[i],l=r?r(c):c;-1<(f=u(a,l,f,e));)a!==n&&z.call(a,f,1),z.call(n,f,1);return n}function xt(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(r==e||u!==i){var i=u;Kr(u)?z.call(n,u,1):$t(n,u)}}return n}function jt(n,t){return n+$(H()*(t-n+1))}function Ot(n,t){var r="";if(!n||t<1||io<t)return r;for(;t%2&&(r+=n),(t=$(t/2))&&(n+=n),t;);return r}function kt(n,t){return ie(te(n,t,Li),n+"")}function At(n){return An(_i(n))}function Et(n,t){var r=_i(n);return fe(r,Dn(t,0,r.length))}function It(n,t,r,e){if(!Su(n))return n;for(var u=-1,i=(t=Gt(t,n)).length,o=i-1,a=n;null!=a&&++u<i;){var f=pe(t[u]),c=r;if(u!=o){var l=a[f];(c=e?e(l,f,a):no)===no&&(c=Su(l)?l:Kr(t[u+1])?[]:{})}Rn(a,f,c),a=a[f]}return n}var St=un?function(n,t){return un.set(n,t),n}:Li,Rt=W?function(n,t){return W(n,"toString",{configurable:!0,enumerable:!1,value:Si(t),writable:!0})}:Li;function zt(n){return fe(_i(n))}function Lt(n,t,r){var e=-1,u=n.length;t<0&&(t=u<-t?0:u+t),(r=u<r?u:r)<0&&(r+=u),u=r<t?0:r-t>>>0,t>>>=0;for(var i=I(u);++e<u;)i[e]=n[e+t];return i}function Ct(n,e){var u;return Bn(n,function(n,t,r){return!(u=e(n,t,r))}),!!u}function Tt(n,t,r){var e=0,u=null==n?e:n.length;if("number"==typeof t&&t==t&&u<=2147483647){for(;e<u;){var i=e+u>>>1,o=n[i];null!==o&&!Uu(o)&&(r?o<=t:o<t)?e=i+1:u=i}return u}return Wt(n,t,Li,r)}function Wt(n,t,r,e){t=r(t);for(var u=0,i=null==n?0:n.length,o=t!=t,a=null===t,f=Uu(t),c=t===no;u<i;){var l=$((u+i)/2),s=r(n[l]),p=s!==no,h=null===s,v=s==s,_=Uu(s);if(o)var y=e||v;else y=c?v&&(e||p):a?v&&p&&(e||!h):f?v&&p&&!h&&(e||!_):!h&&!_&&(e?s<=t:s<t);y?u=l+1:i=l}return K(i,4294967294)}function Dt(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r],a=t?t(o):o;if(!r||!_u(a,f)){var f=a;i[u++]=0===o?0:o}}return i}function Ut(n){return"number"==typeof n?n:Uu(n)?oo:+n}function qt(n){if("string"==typeof n)return n;if(mu(n))return Ma(n,qt)+"";if(Uu(n))return vn?vn.call(n):"";var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}function Pt(n,t,r){var e=-1,u=$a,i=n.length,o=!0,a=[],f=a;if(r)o=!1,u=Ba;else if(200<=i){var c=t?null:Or(n);if(c)return gf(c);o=!1,u=of,f=new jn}else f=t?[]:a;n:for(;++e<i;){var l=n[e],s=t?t(l):l;if(l=r||0!==l?l:0,o&&s==s){for(var p=f.length;p--;)if(f[p]===s)continue n;t&&f.push(s),a.push(l)}else u(f,s,r)||(f!==a&&f.push(s),a.push(l))}return a}function $t(n,t){return null==(n=re(n,t=Gt(t,n)))||delete n[pe(ke(t))]}function Bt(n,t,r,e){return It(n,t,r(Qn(n,t)),e)}function Mt(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++i<u)&&t(n[i],i,n););return r?Lt(n,e?0:i,e?i+1:u):Lt(n,e?i+1:0,e?u:i)}function Ft(n,t){var r=n;return r instanceof mn&&(r=r.value()),Na(t,function(n,t){return t.func.apply(t.thisArg,Fa([n],t.args))},r)}function Nt(n,t,r){var e=n.length;if(e<2)return e?Pt(n[0]):[];for(var u=-1,i=I(e);++u<e;)for(var o=n[u],a=-1;++a<e;)a!=u&&(i[u]=$n(i[u]||o,n[a],t,r));return Pt(Vn(i,1),t,r)}function Zt(n,t,r){for(var e=-1,u=n.length,i=t.length,o={};++e<u;){var a=e<i?t[e]:no;r(o,n[e],a)}return o}function Vt(n){return xu(n)?n:[]}function Kt(n){return"function"==typeof n?n:Li}function Gt(n,t){return mu(n)?n:Jr(n,t)?[n]:se(Ku(n))}var Jt=kt;function Ht(n,t,r){var e=n.length;return r=r===no?e:r,!t&&e<=r?n:Lt(n,t,r)}var Yt=D||function(n){return Aa.clearTimeout(n)};function Qt(n,t){if(t)return n.slice();var r=n.length,e=j?j(r):new n.constructor(r);return n.copy(e),e}function Xt(n){var t=new n.constructor(n.byteLength);return new x(t).set(new x(n)),t}function nr(n,t){var r=t?Xt(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}function tr(n,t){if(n!==t){var r=n!==no,e=null===n,u=n==n,i=Uu(n),o=t!==no,a=null===t,f=t==t,c=Uu(t);if(!a&&!c&&!i&&t<n||i&&o&&f&&!a&&!c||e&&o&&f||!r&&f||!u)return 1;if(!e&&!i&&!c&&n<t||c&&r&&u&&!e&&!i||a&&r&&u||!o&&u||!f)return-1}return 0}function rr(n,t,r,e){for(var u=-1,i=n.length,o=r.length,a=-1,f=t.length,c=V(i-o,0),l=I(f+c),s=!e;++a<f;)l[a]=t[a];for(;++u<o;)(s||u<i)&&(l[r[u]]=n[u]);for(;c--;)l[a++]=n[u++];return l}function er(n,t,r,e){for(var u=-1,i=n.length,o=-1,a=r.length,f=-1,c=t.length,l=V(i-a,0),s=I(l+c),p=!e;++u<l;)s[u]=n[u];for(var h=u;++f<c;)s[h+f]=t[f];for(;++o<a;)(p||u<i)&&(s[h+r[o]]=n[u++]);return s}function ur(n,t){var r=-1,e=n.length;for(t||(t=I(e));++r<e;)t[r]=n[r];return t}function ir(n,t,r,e){var u=!r;r||(r={});for(var i=-1,o=t.length;++i<o;){var a=t[i],f=e?e(r[a],n[a],a,r,n):no;f===no&&(f=n[a]),u?Tn(r,a,f):Rn(r,a,f)}return r}function or(u,i){return function(n,t){var r=mu(n)?Wa:Ln,e=i?i():{};return r(n,u,Ur(t,2),e)}}function ar(a){return kt(function(n,t){var r=-1,e=t.length,u=1<e?t[e-1]:no,i=2<e?t[2]:no;for(u=3<a.length&&"function"==typeof u?(e--,u):no,i&&Gr(t[0],t[1],i)&&(u=e<3?no:u,e=1),n=O(n);++r<e;){var o=t[r];o&&a(n,o,r,u)}return n})}function fr(i,o){return function(n,t){if(null==n)return n;if(!wu(n))return i(n,t);for(var r=n.length,e=o?r:-1,u=O(n);(o?e--:++e<r)&&!1!==t(u[e],e,u););return n}}function cr(f){return function(n,t,r){for(var e=-1,u=O(n),i=r(n),o=i.length;o--;){var a=i[f?o:++e];if(!1===t(u[a],a,u))break}return n}}function lr(u){return function(n){var t=pf(n=Ku(n))?mf(n):no,r=t?t[0]:n.charAt(0),e=t?Ht(t,1).join(""):n.slice(1);return r[u]()+e}}function sr(t){return function(n){return Na(Ai(di(n).replace(ya,"")),t,"")}}function pr(e){return function(){var n=arguments;switch(n.length){case 0:return new e;case 1:return new e(n[0]);case 2:return new e(n[0],n[1]);case 3:return new e(n[0],n[1],n[2]);case 4:return new e(n[0],n[1],n[2],n[3]);case 5:return new e(n[0],n[1],n[2],n[3],n[4]);case 6:return new e(n[0],n[1],n[2],n[3],n[4],n[5]);case 7:return new e(n[0],n[1],n[2],n[3],n[4],n[5],n[6])}var t=yn(e.prototype),r=e.apply(t,n);return Su(r)?r:t}}function hr(o){return function(n,t,r){var e=O(n);if(!wu(n)){var u=Ur(t,3);n=oi(n),t=function(n){return u(e[n],n,e)}}var i=o(n,t,r);return-1<i?e[u?n[i]:i]:no}}function vr(f){return zr(function(u){var i=u.length,n=i,t=dn.prototype.thru;for(f&&u.reverse();n--;){var r=u[n];if("function"!=typeof r)throw new S(to);if(t&&!o&&"wrapper"==Wr(r))var o=new dn([],!0)}for(n=o?n:i;++n<i;){var e=Wr(r=u[n]),a="wrapper"==e?Tr(r):no;o=a&&Hr(a[0])&&424==a[1]&&!a[4].length&&1==a[9]?o[Wr(a[0])].apply(o,a[3]):1==r.length&&Hr(r)?o[e]():o.thru(r)}return function(){var n=arguments,t=n[0];if(o&&1==n.length&&mu(t))return o.plant(t).value();for(var r=0,e=i?u[r].apply(this,n):t;++r<i;)e=u[r].call(this,e);return e}})}function _r(c,l,s,p,h,v,_,y,g,d){var m=l&uo,b=1&l,w=2&l,x=24&l,j=512&l,O=w?no:pr(c);return function n(){for(var t=arguments.length,r=I(t),e=t;e--;)r[e]=arguments[e];if(x)var u=Dr(n),i=function(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;return e}(r,u);if(p&&(r=rr(r,p,h,x)),v&&(r=er(r,v,_,x)),t-=i,x&&t<d){var o=_f(r,u);return xr(c,l,_r,n.placeholder,s,r,o,y,g,d-t)}var a=b?s:this,f=w?a[c]:c;return t=r.length,y?r=function(n,t){for(var r=n.length,e=K(t.length,r),u=ur(n);e--;){var i=t[e];n[e]=Kr(i,r)?u[i]:no}return n}(r,y):j&&1<t&&r.reverse(),m&&g<t&&(r.length=g),this&&this!==Aa&&this instanceof n&&(f=O||pr(f)),f.apply(a,r)}}function yr(o,a){return function(n,t){return r=n,e=o,u=a(t),i={},Jn(r,function(n,t,r){e(i,u(n),t,r)}),i;var r,e,u,i}}function gr(e,u){return function(n,t){var r;if(n===no&&t===no)return u;if(n!==no&&(r=n),t!==no){if(r===no)return t;t="string"==typeof n||"string"==typeof t?(n=qt(n),qt(t)):(n=Ut(n),Ut(t)),r=e(n,t)}return r}}function dr(e){return zr(function(n){return n=Ma(n,ef(Ur())),kt(function(t){var r=this;return e(n,function(n){return Ta(n,r,t)})})})}function mr(n,t){var r=(t=t===no?" ":qt(t)).length;if(r<2)return r?Ot(t,n):t;var e=Ot(t,P(n/df(t)));return pf(t)?Ht(mf(e),0,n).join(""):e.slice(0,n)}function br(e){return function(n,t,r){return r&&"number"!=typeof r&&Gr(n,t,r)&&(t=r=no),n=Mu(n),t===no?(t=n,n=0):t=Mu(t),function(n,t,r,e){for(var u=-1,i=V(P((t-n)/(r||1)),0),o=I(i);i--;)o[e?i:++u]=n,n+=r;return o}(n,t,r=r===no?n<t?1:-1:Mu(r),e)}}function wr(r){return function(n,t){return"string"==typeof n&&"string"==typeof t||(n=Zu(n),t=Zu(t)),r(n,t)}}function xr(n,t,r,e,u,i,o,a,f,c){var l=8&t;t|=l?32:64,4&(t&=~(l?64:32))||(t&=-4);var s=[n,t,u,l?i:no,l?o:no,l?no:i,l?no:o,a,f,c],p=r.apply(no,s);return Hr(n)&&ee(p,s),p.placeholder=e,oe(p,n,t)}function jr(n){var e=i[n];return function(n,t){if(n=Zu(n),t=null==t?0:K(Fu(t),292)){var r=(Ku(n)+"e").split("e");return+((r=(Ku(e(r[0]+"e"+(+r[1]+t)))+"e").split("e"))[0]+"e"+(+r[1]-t))}return e(n)}}var Or=tn&&1/gf(new tn([,-0]))[1]==1/0?function(n){return new tn(n)}:Ui;function kr(o){return function(n){var t,r,e,u,i=Fr(n);return i==yo?hf(n):i==xo?(t=n,r=-1,e=Array(t.size),t.forEach(function(n){e[++r]=[n,n]}),e):Ma(o(u=n),function(n){return[n,u[n]]})}}function Ar(n,t,r,e,u,i,o,a){var f=2&t;if(!f&&"function"!=typeof n)throw new S(to);var c=e?e.length:0;if(c||(t&=-97,e=u=no),o=o===no?o:V(Fu(o),0),a=a===no?a:Fu(a),c-=u?u.length:0,64&t){var l=e,s=u;e=u=no}var p,h,v,_,y,g,d,m,b,w,x,j,O,k=f?no:Tr(n),A=[n,t,r,e,u,l,s,i,o,a];if(k&&function(n,t){var r=n[1],e=t[1],u=r|e,i=u<131,o=e==uo&&8==r||e==uo&&256==r&&n[7].length<=t[8]||384==e&&t[7].length<=t[8]&&8==r;if(i||o){1&e&&(n[2]=t[2],u|=1&r?0:4);var a=t[3];if(a){var f=n[3];n[3]=f?rr(f,a,t[4]):a,n[4]=f?_f(n[3],eo):t[4]}(a=t[5])&&(f=n[5],n[5]=f?er(f,a,t[6]):a,n[6]=f?_f(n[5],eo):t[6]),(a=t[7])&&(n[7]=a),e&uo&&(n[8]=null==n[8]?t[8]:K(n[8],t[8])),null==n[9]&&(n[9]=t[9]),n[0]=t[0],n[1]=u}}(A,k),n=A[0],t=A[1],r=A[2],e=A[3],u=A[4],!(a=A[9]=A[9]===no?f?0:n.length:V(A[9]-c,0))&&24&t&&(t&=-25),t&&1!=t)E=8==t||16==t?(d=t,m=a,b=pr(g=n),function n(){for(var t=arguments.length,r=I(t),e=t,u=Dr(n);e--;)r[e]=arguments[e];var i=t<3&&r[0]!==u&&r[t-1]!==u?[]:_f(r,u);return(t-=i.length)<m?xr(g,d,_r,n.placeholder,no,r,i,no,no,m-t):Ta(this&&this!==Aa&&this instanceof n?b:g,this,r)}):32!=t&&33!=t||u.length?_r.apply(no,A):(h=r,v=e,_=1&t,y=pr(p=n),function n(){for(var t=-1,r=arguments.length,e=-1,u=v.length,i=I(u+r),o=this&&this!==Aa&&this instanceof n?y:p;++e<u;)i[e]=v[e];for(;r--;)i[e++]=arguments[++t];return Ta(o,_?h:this,i)});else var E=(x=r,j=1&t,O=pr(w=n),function n(){return(this&&this!==Aa&&this instanceof n?O:w).apply(j?x:this,arguments)});return oe((k?St:ee)(E,A),n,t)}function Er(n,t,r,e){return n===no||_u(n,s[r])&&!k.call(e,r)?t:n}function Ir(n,t,r,e,u,i){return Su(n)&&Su(t)&&(i.set(t,n),gt(n,t,no,Ir,i),i.delete(t)),n}function Sr(n){return Cu(n)?no:n}function Rr(n,t,r,e,u,i){var o=1&r,a=n.length,f=t.length;if(a!=f&&!(o&&a<f))return!1;var c=i.get(n);if(c&&i.get(t))return c==t;var l=-1,s=!0,p=2&r?new jn:no;for(i.set(n,t),i.set(t,n);++l<a;){var h=n[l],v=t[l];if(e)var _=o?e(v,h,l,t,n,i):e(h,v,l,n,t,i);if(_!==no){if(_)continue;s=!1;break}if(p){if(!Va(t,function(n,t){if(!of(p,t)&&(h===n||u(h,n,r,e,i)))return p.push(t)})){s=!1;break}}else if(h!==v&&!u(h,v,r,e,i)){s=!1;break}}return i.delete(n),i.delete(t),s}function zr(n){return ie(te(n,no,be),n+"")}function Lr(n){return Xn(n,oi,Br)}function Cr(n){return Xn(n,ai,Mr)}var Tr=un?function(n){return un.get(n)}:Ui;function Wr(n){for(var t=n.name+"",r=on[t],e=k.call(on,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function Dr(n){return(k.call(_n,"placeholder")?_n:n).placeholder}function Ur(){var n=_n.iteratee||Ci;return n=n===Ci?lt:n,arguments.length?n(arguments[0],arguments[1]):n}function qr(n,t){var r,e,u=n.__data__;return("string"==(e=_typeof(r=t))||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==r:null===r)?u["string"==typeof t?"string":"hash"]:u.map}function Pr(n){for(var t=oi(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,Xr(u)]}return t}function $r(n,t){var r,e,u=(e=t,null==(r=n)?no:r[e]);return ct(u)?u:no}var Br=B?function(t){return null==t?[]:(t=O(t),Pa(B(t),function(n){return R.call(t,n)}))}:Ni,Mr=B?function(n){for(var t=[];n;)Fa(t,Br(n)),n=A(n);return t}:Ni,Fr=nt;function Nr(n,t,r){for(var e=-1,u=(t=Gt(t,n)).length,i=!1;++e<u;){var o=pe(t[e]);if(!(i=null!=n&&r(n,o)))break;n=n[o]}return i||++e!=u?i:!!(u=null==n?0:n.length)&&Iu(u)&&Kr(o,u)&&(mu(n)||du(n))}function Zr(n){return"function"!=typeof n.constructor||Qr(n)?{}:yn(A(n))}function Vr(n){return mu(n)||du(n)||!!(L&&n&&n[L])}function Kr(n,t){var r=_typeof(n);return!!(t=null==t?io:t)&&("number"==r||"symbol"!=r&&pa.test(n))&&-1<n&&n%1==0&&n<t}function Gr(n,t,r){if(!Su(r))return!1;var e=_typeof(t);return!!("number"==e?wu(r)&&Kr(t,r.length):"string"==e&&t in r)&&_u(r[t],n)}function Jr(n,t){if(mu(n))return!1;var r=_typeof(n);return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!Uu(n))||Go.test(n)||!Ko.test(n)||null!=t&&n in O(t)}function Hr(n){var t=Wr(n),r=_n[t];if("function"!=typeof r||!(t in mn.prototype))return!1;if(n===r)return!0;var e=Tr(r);return!!e&&n===e[0]}(Q&&Fr(new Q(new ArrayBuffer(1)))!=Eo||X&&Fr(new X)!=yo||nn&&Fr(nn.resolve())!=bo||tn&&Fr(new tn)!=xo||rn&&Fr(new rn)!=ko)&&(Fr=function(n){var t=nt(n),r=t==mo?n.constructor:no,e=r?he(r):"";if(e)switch(e){case an:return Eo;case fn:return yo;case cn:return bo;case ln:return xo;case sn:return ko}return t});var Yr=f?Au:Zi;function Qr(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||s)}function Xr(n){return n==n&&!Su(n)}function ne(t,r){return function(n){return null!=n&&n[t]===r&&(r!==no||t in O(n))}}function te(i,o,a){return o=V(o===no?i.length-1:o,0),function(){for(var n=arguments,t=-1,r=V(n.length-o,0),e=I(r);++t<r;)e[t]=n[o+t];t=-1;for(var u=I(o+1);++t<o;)u[t]=n[t];return u[o]=a(e),Ta(i,this,u)}}function re(n,t){return t.length<2?n:Qn(n,Lt(t,0,-1))}var ee=ae(St),ue=q||function(n,t){return Aa.setTimeout(n,t)},ie=ae(Rt);function oe(n,t,r){var e,u,i,o=t+"";return ie(n,function(n,t){var r=t.length;if(!r)return n;var e=r-1;return t[e]=(1<r?"& ":"")+t[e],t=t.join(2<r?", ":" "),n.replace(ta,"{\n/* [wrapped with "+t+"] */\n")}(o,(i=o.match(ra),e=i?i[1].split(ea):[],u=r,Da(fo,function(n){var t="_."+n[0];u&n[1]&&!$a(e,t)&&e.push(t)}),e.sort())))}function ae(r){var e=0,u=0;return function(){var n=G(),t=16-(n-u);if(u=n,0<t){if(800<=++e)return arguments[0]}else e=0;return r.apply(no,arguments)}}function fe(n,t){var r=-1,e=n.length,u=e-1;for(t=t===no?e:t;++r<t;){var i=jt(r,u),o=n[i];n[i]=n[r],n[r]=o}return n.length=t,n}var ce,le,se=(le=(ce=cu(function(n){var u=[];return 46===n.charCodeAt(0)&&u.push(""),n.replace(Jo,function(n,t,r,e){u.push(r?e.replace(ia,"$1"):t||n)}),u},function(n){return 500===le.size&&le.clear(),n})).cache,ce);function pe(n){if("string"==typeof n||Uu(n))return n;var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}function he(n){if(null!=n){try{return c.call(n)}catch(n){}try{return n+""}catch(n){}}return""}function ve(n){if(n instanceof mn)return n.clone();var t=new dn(n.__wrapped__,n.__chain__);return t.__actions__=ur(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}var _e=kt(function(n,t){return xu(n)?$n(n,Vn(t,1,xu,!0)):[]}),ye=kt(function(n,t){var r=ke(t);return xu(r)&&(r=no),xu(n)?$n(n,Vn(t,1,xu,!0),Ur(r,2)):[]}),ge=kt(function(n,t){var r=ke(t);return xu(r)&&(r=no),xu(n)?$n(n,Vn(t,1,xu,!0),no,r):[]});function de(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:Fu(r);return u<0&&(u=V(e+u,0)),Ga(n,Ur(t,3),u)}function me(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==no&&(u=Fu(r),u=r<0?V(e+u,0):K(u,e-1)),Ga(n,Ur(t,3),u,!0)}function be(n){return null!=n&&n.length?Vn(n,1):[]}function we(n){return n&&n.length?n[0]:no}var xe=kt(function(n){var t=Ma(n,Vt);return t.length&&t[0]===n[0]?ut(t):[]}),je=kt(function(n){var t=ke(n),r=Ma(n,Vt);return t===ke(r)?t=no:r.pop(),r.length&&r[0]===n[0]?ut(r,Ur(t,2)):[]}),Oe=kt(function(n){var t=ke(n),r=Ma(n,Vt);return(t="function"==typeof t?t:no)&&r.pop(),r.length&&r[0]===n[0]?ut(r,no,t):[]});function ke(n){var t=null==n?0:n.length;return t?n[t-1]:no}var Ae=kt(Ee);function Ee(n,t){return n&&n.length&&t&&t.length?wt(n,t):n}var Ie=zr(function(n,t){var r=null==n?0:n.length,e=Wn(n,t);return xt(n,Ma(t,function(n){return Kr(n,r)?+n:n}).sort(tr)),e});function Se(n){return null==n?n:Y.call(n)}var Re=kt(function(n){return Pt(Vn(n,1,xu,!0))}),ze=kt(function(n){var t=ke(n);return xu(t)&&(t=no),Pt(Vn(n,1,xu,!0),Ur(t,2))}),Le=kt(function(n){var t=ke(n);return t="function"==typeof t?t:no,Pt(Vn(n,1,xu,!0),no,t)});function Ce(t){if(!t||!t.length)return[];var r=0;return t=Pa(t,function(n){if(xu(n))return r=V(n.length,r),!0}),rf(r,function(n){return Ma(t,Xa(n))})}function Te(n,t){if(!n||!n.length)return[];var r=Ce(n);return null==t?r:Ma(r,function(n){return Ta(t,no,n)})}var We=kt(function(n,t){return xu(n)?$n(n,t):[]}),De=kt(function(n){return Nt(Pa(n,xu))}),Ue=kt(function(n){var t=ke(n);return xu(t)&&(t=no),Nt(Pa(n,xu),Ur(t,2))}),qe=kt(function(n){var t=ke(n);return t="function"==typeof t?t:no,Nt(Pa(n,xu),no,t)}),Pe=kt(Ce);var $e=kt(function(n){var t=n.length,r=1<t?n[t-1]:no;return Te(n,r="function"==typeof r?(n.pop(),r):no)});function Be(n){var t=_n(n);return t.__chain__=!0,t}function Me(n,t){return t(n)}var Fe=zr(function(t){var r=t.length,n=r?t[0]:0,e=this.__wrapped__,u=function(n){return Wn(n,t)};return!(1<r||this.__actions__.length)&&e instanceof mn&&Kr(n)?((e=e.slice(n,+n+(r?1:0))).__actions__.push({func:Me,args:[u],thisArg:no}),new dn(e,this.__chain__).thru(function(n){return r&&!n.length&&n.push(no),n})):this.thru(u)});var Ne=or(function(n,t,r){k.call(n,r)?++n[r]:Tn(n,r,1)});var Ze=hr(de),Ve=hr(me);function Ke(n,t){return(mu(n)?Da:Bn)(n,Ur(t,3))}function Ge(n,t){return(mu(n)?Ua:Mn)(n,Ur(t,3))}var Je=or(function(n,t,r){k.call(n,r)?n[r].push(t):Tn(n,r,[t])});var He=kt(function(n,t,r){var e=-1,u="function"==typeof t,i=wu(n)?I(n.length):[];return Bn(n,function(n){i[++e]=u?Ta(t,n,r):it(n,t,r)}),i}),Ye=or(function(n,t,r){Tn(n,r,t)});function Qe(n,t){return(mu(n)?Ma:vt)(n,Ur(t,3))}var Xe=or(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]});var nu=kt(function(n,t){if(null==n)return[];var r=t.length;return 1<r&&Gr(n,t[0],t[1])?t=[]:2<r&&Gr(t[0],t[1],t[2])&&(t=[t[0]]),mt(n,Vn(t,1),[])}),tu=U||function(){return Aa.Date.now()};function ru(n,t,r){return t=r?no:t,t=n&&null==t?n.length:t,Ar(n,uo,no,no,no,no,t)}function eu(n,t){var r;if("function"!=typeof t)throw new S(to);return n=Fu(n),function(){return 0<--n&&(r=t.apply(this,arguments)),n<=1&&(t=no),r}}var uu=kt(function(n,t,r){var e=1;if(r.length){var u=_f(r,Dr(uu));e|=32}return Ar(n,e,t,r,u)}),iu=kt(function(n,t,r){var e=3;if(r.length){var u=_f(r,Dr(iu));e|=32}return Ar(t,e,n,r,u)});function ou(e,u,n){var i,o,a,f,c,l,s=0,p=!1,h=!1,t=!0;if("function"!=typeof e)throw new S(to);function v(n){var t=i,r=o;return i=o=no,s=n,f=e.apply(r,t)}function _(n){var t=n-l;return l===no||u<=t||t<0||h&&a<=n-s}function y(){var n,t,r=tu();if(_(r))return g(r);c=ue(y,(t=u-((n=r)-l),h?K(t,a-(n-s)):t))}function g(n){return c=no,t&&i?v(n):(i=o=no,f)}function r(){var n,t=tu(),r=_(t);if(i=arguments,o=this,l=t,r){if(c===no)return s=n=l,c=ue(y,u),p?v(n):f;if(h)return c=ue(y,u),v(l)}return c===no&&(c=ue(y,u)),f}return u=Zu(u)||0,Su(n)&&(p=!!n.leading,a=(h="maxWait"in n)?V(Zu(n.maxWait)||0,u):a,t="trailing"in n?!!n.trailing:t),r.cancel=function(){c!==no&&Yt(c),s=0,i=l=o=c=no},r.flush=function(){return c===no?f:g(tu())},r}var au=kt(function(n,t){return Pn(n,1,t)}),fu=kt(function(n,t,r){return Pn(n,Zu(t)||0,r)});function cu(u,i){if("function"!=typeof u||null!=i&&"function"!=typeof i)throw new S(to);var o=function(){var n=arguments,t=i?i.apply(this,n):n[0],r=o.cache;if(r.has(t))return r.get(t);var e=u.apply(this,n);return o.cache=r.set(t,e)||r,e};return o.cache=new(cu.Cache||xn),o}function lu(t){if("function"!=typeof t)throw new S(to);return function(){var n=arguments;switch(n.length){case 0:return!t.call(this);case 1:return!t.call(this,n[0]);case 2:return!t.call(this,n[0],n[1]);case 3:return!t.call(this,n[0],n[1],n[2])}return!t.apply(this,n)}}cu.Cache=xn;var su=Jt(function(e,u){var i=(u=1==u.length&&mu(u[0])?Ma(u[0],ef(Ur())):Ma(Vn(u,1),ef(Ur()))).length;return kt(function(n){for(var t=-1,r=K(n.length,i);++t<r;)n[t]=u[t].call(this,n[t]);return Ta(e,this,n)})}),pu=kt(function(n,t){var r=_f(t,Dr(pu));return Ar(n,32,no,t,r)}),hu=kt(function(n,t){var r=_f(t,Dr(hu));return Ar(n,64,no,t,r)}),vu=zr(function(n,t){return Ar(n,256,no,no,no,t)});function _u(n,t){return n===t||n!=n&&t!=t}var yu=wr(tt),gu=wr(function(n,t){return t<=n}),du=ot(function(){return arguments}())?ot:function(n){return Ru(n)&&k.call(n,"callee")&&!R.call(n,"callee")},mu=I.isArray,bu=Ia?ef(Ia):function(n){return Ru(n)&&nt(n)==Ao};function wu(n){return null!=n&&Iu(n.length)&&!Au(n)}function xu(n){return Ru(n)&&wu(n)}var ju=M||Zi,Ou=Sa?ef(Sa):function(n){return Ru(n)&&nt(n)==po};function ku(n){if(!Ru(n))return!1;var t=nt(n);return t==ho||"[object DOMException]"==t||"string"==typeof n.message&&"string"==typeof n.name&&!Cu(n)}function Au(n){if(!Su(n))return!1;var t=nt(n);return t==vo||t==_o||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Eu(n){return"number"==typeof n&&n==Fu(n)}function Iu(n){return"number"==typeof n&&-1<n&&n%1==0&&n<=io}function Su(n){var t=_typeof(n);return null!=n&&("object"==t||"function"==t)}function Ru(n){return null!=n&&"object"==_typeof(n)}var zu=Ra?ef(Ra):function(n){return Ru(n)&&Fr(n)==yo};function Lu(n){return"number"==typeof n||Ru(n)&&nt(n)==go}function Cu(n){if(!Ru(n)||nt(n)!=mo)return!1;var t=A(n);if(null===t)return!0;var r=k.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&c.call(r)==_}var Tu=za?ef(za):function(n){return Ru(n)&&nt(n)==wo};var Wu=La?ef(La):function(n){return Ru(n)&&Fr(n)==xo};function Du(n){return"string"==typeof n||!mu(n)&&Ru(n)&&nt(n)==jo}function Uu(n){return"symbol"==_typeof(n)||Ru(n)&&nt(n)==Oo}var qu=Ca?ef(Ca):function(n){return Ru(n)&&Iu(n.length)&&!!xa[nt(n)]};var Pu=wr(ht),$u=wr(function(n,t){return n<=t});function Bu(n){if(!n)return[];if(wu(n))return Du(n)?mf(n):ur(n);if(C&&n[C])return function(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}(n[C]());var t=Fr(n);return(t==yo?hf:t==xo?gf:_i)(n)}function Mu(n){return n?(n=Zu(n))!==1/0&&n!==-1/0?n==n?n:0:17976931348623157e292*(n<0?-1:1):0===n?n:0}function Fu(n){var t=Mu(n),r=t%1;return t==t?r?t-r:t:0}function Nu(n){return n?Dn(Fu(n),0,ao):0}function Zu(n){if("number"==typeof n)return n;if(Uu(n))return oo;if(Su(n)){var t="function"==typeof n.valueOf?n.valueOf():n;n=Su(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=n.replace(Qo,"");var r=ca.test(n);return r||sa.test(n)?ka(n.slice(2),r?2:8):fa.test(n)?oo:+n}function Vu(n){return ir(n,ai(n))}function Ku(n){return null==n?"":qt(n)}var Gu=ar(function(n,t){if(Qr(t)||wu(t))ir(t,oi(t),n);else for(var r in t)k.call(t,r)&&Rn(n,r,t[r])}),Ju=ar(function(n,t){ir(t,ai(t),n)}),Hu=ar(function(n,t,r,e){ir(t,ai(t),n,e)}),Yu=ar(function(n,t,r,e){ir(t,oi(t),n,e)}),Qu=zr(Wn);var Xu=kt(function(n,t){n=O(n);var r=-1,e=t.length,u=2<e?t[2]:no;for(u&&Gr(t[0],t[1],u)&&(e=1);++r<e;)for(var i=t[r],o=ai(i),a=-1,f=o.length;++a<f;){var c=o[a],l=n[c];(l===no||_u(l,s[c])&&!k.call(n,c))&&(n[c]=i[c])}return n}),ni=kt(function(n){return n.push(no,Ir),Ta(ci,no,n)});function ti(n,t,r){var e=null==n?no:Qn(n,t);return e===no?r:e}function ri(n,t){return null!=n&&Nr(n,t,et)}var ei=yr(function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=v.call(t)),n[t]=r},Si(Li)),ui=yr(function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=v.call(t)),k.call(n,t)?n[t].push(r):n[t]=[r]},Ur),ii=kt(it);function oi(n){return wu(n)?kn(n):st(n)}function ai(n){return wu(n)?kn(n,!0):pt(n)}var fi=ar(function(n,t,r){gt(n,t,r)}),ci=ar(function(n,t,r,e){gt(n,t,r,e)}),li=zr(function(t,n){var r={};if(null==t)return r;var e=!1;n=Ma(n,function(n){return n=Gt(n,t),e||(e=1<n.length),n}),ir(t,Cr(t),r),e&&(r=Un(r,7,Sr));for(var u=n.length;u--;)$t(r,n[u]);return r});var si=zr(function(n,t){return null==n?{}:bt(r=n,t,function(n,t){return ri(r,t)});var r});function pi(n,r){if(null==n)return{};var t=Ma(Cr(n),function(n){return[n]});return r=Ur(r),bt(n,t,function(n,t){return r(n,t[0])})}var hi=kr(oi),vi=kr(ai);function _i(n){return null==n?[]:uf(n,oi(n))}var yi=sr(function(n,t,r){return t=t.toLowerCase(),n+(r?gi(t):t)});function gi(n){return ki(Ku(n).toLowerCase())}function di(n){return(n=Ku(n))&&n.replace(ha,cf).replace(ga,"")}var mi=sr(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),bi=sr(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),wi=lr("toLowerCase");var xi=sr(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()});var ji=sr(function(n,t,r){return n+(r?" ":"")+ki(t)});var Oi=sr(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),ki=lr("toUpperCase");function Ai(n,t,r){return n=Ku(n),(t=r?no:t)===no?(e=n,ma.test(e)?n.match(da)||[]:n.match(ua)||[]):n.match(t)||[];var e}var Ei=kt(function(n,t){try{return Ta(n,no,t)}catch(t){return ku(t)?t:new u(t)}}),Ii=zr(function(t,n){return Da(n,function(n){n=pe(n),Tn(t,n,uu(t[n],t))}),t});function Si(n){return function(){return n}}var Ri=vr(),zi=vr(!0);function Li(n){return n}function Ci(n){return lt("function"==typeof n?n:Un(n,1))}var Ti=kt(function(t,r){return function(n){return it(n,t,r)}}),Wi=kt(function(t,r){return function(n){return it(t,n,r)}});function Di(e,t,n){var r=oi(t),u=Yn(t,r);null!=n||Su(t)&&(u.length||!r.length)||(n=t,t=e,e=this,u=Yn(t,oi(t)));var i=!(Su(n)&&"chain"in n&&!n.chain),o=Au(e);return Da(u,function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var n=this.__chain__;if(i||n){var t=e(this.__wrapped__);return(t.__actions__=ur(this.__actions__)).push({func:r,args:arguments,thisArg:e}),t.__chain__=n,t}return r.apply(e,Fa([this.value()],arguments))})}),e}function Ui(){}var qi=dr(Ma),Pi=dr(qa),$i=dr(Va);function Bi(n){return Jr(n)?Xa(pe(n)):(t=n,function(n){return Qn(n,t)});var t}var Mi=br(),Fi=br(!0);function Ni(){return[]}function Zi(){return!1}var Vi=gr(function(n,t){return n+t},0),Ki=jr("ceil"),Gi=gr(function(n,t){return n/t},1),Ji=jr("floor");var Hi,Yi=gr(function(n,t){return n*t},1),Qi=jr("round"),Xi=gr(function(n,t){return n-t},0);return _n.after=function(n,t){if("function"!=typeof t)throw new S(to);return n=Fu(n),function(){if(--n<1)return t.apply(this,arguments)}},_n.ary=ru,_n.assign=Gu,_n.assignIn=Ju,_n.assignInWith=Hu,_n.assignWith=Yu,_n.at=Qu,_n.before=eu,_n.bind=uu,_n.bindAll=Ii,_n.bindKey=iu,_n.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return mu(n)?n:[n]},_n.chain=Be,_n.chunk=function(n,t,r){t=(r?Gr(n,t,r):t===no)?1:V(Fu(t),0);var e=null==n?0:n.length;if(!e||t<1)return[];for(var u=0,i=0,o=I(P(e/t));u<e;)o[i++]=Lt(n,u,u+=t);return o},_n.compact=function(n){for(var t=-1,r=null==n?0:n.length,e=0,u=[];++t<r;){var i=n[t];i&&(u[e++]=i)}return u},_n.concat=function(){var n=arguments.length;if(!n)return[];for(var t=I(n-1),r=arguments[0],e=n;e--;)t[e-1]=arguments[e];return Fa(mu(r)?ur(r):[r],Vn(t,1))},_n.cond=function(e){var u=null==e?0:e.length,t=Ur();return e=u?Ma(e,function(n){if("function"!=typeof n[1])throw new S(to);return[t(n[0]),n[1]]}):[],kt(function(n){for(var t=-1;++t<u;){var r=e[t];if(Ta(r[0],this,n))return Ta(r[1],this,n)}})},_n.conforms=function(n){return t=Un(n,1),r=oi(t),function(n){return qn(n,t,r)};var t,r},_n.constant=Si,_n.countBy=Ne,_n.create=function(n,t){var r=yn(n);return null==t?r:Cn(r,t)},_n.curry=function n(t,r,e){var u=Ar(t,8,no,no,no,no,no,r=e?no:r);return u.placeholder=n.placeholder,u},_n.curryRight=function n(t,r,e){var u=Ar(t,16,no,no,no,no,no,r=e?no:r);return u.placeholder=n.placeholder,u},_n.debounce=ou,_n.defaults=Xu,_n.defaultsDeep=ni,_n.defer=au,_n.delay=fu,_n.difference=_e,_n.differenceBy=ye,_n.differenceWith=ge,_n.drop=function(n,t,r){var e=null==n?0:n.length;return e?Lt(n,(t=r||t===no?1:Fu(t))<0?0:t,e):[]},_n.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?Lt(n,0,(t=e-(t=r||t===no?1:Fu(t)))<0?0:t):[]},_n.dropRightWhile=function(n,t){return n&&n.length?Mt(n,Ur(t,3),!0,!0):[]},_n.dropWhile=function(n,t){return n&&n.length?Mt(n,Ur(t,3),!0):[]},_n.fill=function(n,t,r,e){var u=null==n?0:n.length;return u?(r&&"number"!=typeof r&&Gr(n,t,r)&&(r=0,e=u),function(n,t,r,e){var u=n.length;for((r=Fu(r))<0&&(r=u<-r?0:u+r),(e=e===no||u<e?u:Fu(e))<0&&(e+=u),e=e<r?0:Nu(e);r<e;)n[r++]=t;return n}(n,t,r,e)):[]},_n.filter=function(n,t){return(mu(n)?Pa:Zn)(n,Ur(t,3))},_n.flatMap=function(n,t){return Vn(Qe(n,t),1)},_n.flatMapDeep=function(n,t){return Vn(Qe(n,t),1/0)},_n.flatMapDepth=function(n,t,r){return r=r===no?1:Fu(r),Vn(Qe(n,t),r)},_n.flatten=be,_n.flattenDeep=function(n){return null!=n&&n.length?Vn(n,1/0):[]},_n.flattenDepth=function(n,t){return null!=n&&n.length?Vn(n,t=t===no?1:Fu(t)):[]},_n.flip=function(n){return Ar(n,512)},_n.flow=Ri,_n.flowRight=zi,_n.fromPairs=function(n){for(var t=-1,r=null==n?0:n.length,e={};++t<r;){var u=n[t];e[u[0]]=u[1]}return e},_n.functions=function(n){return null==n?[]:Yn(n,oi(n))},_n.functionsIn=function(n){return null==n?[]:Yn(n,ai(n))},_n.groupBy=Je,_n.initial=function(n){return null!=n&&n.length?Lt(n,0,-1):[]},_n.intersection=xe,_n.intersectionBy=je,_n.intersectionWith=Oe,_n.invert=ei,_n.invertBy=ui,_n.invokeMap=He,_n.iteratee=Ci,_n.keyBy=Ye,_n.keys=oi,_n.keysIn=ai,_n.map=Qe,_n.mapKeys=function(n,e){var u={};return e=Ur(e,3),Jn(n,function(n,t,r){Tn(u,e(n,t,r),n)}),u},_n.mapValues=function(n,e){var u={};return e=Ur(e,3),Jn(n,function(n,t,r){Tn(u,t,e(n,t,r))}),u},_n.matches=function(n){return _t(Un(n,1))},_n.matchesProperty=function(n,t){return yt(n,Un(t,1))},_n.memoize=cu,_n.merge=fi,_n.mergeWith=ci,_n.method=Ti,_n.methodOf=Wi,_n.mixin=Di,_n.negate=lu,_n.nthArg=function(t){return t=Fu(t),kt(function(n){return dt(n,t)})},_n.omit=li,_n.omitBy=function(n,t){return pi(n,lu(Ur(t)))},_n.once=function(n){return eu(2,n)},_n.orderBy=function(n,t,r,e){return null==n?[]:(mu(t)||(t=null==t?[]:[t]),mu(r=e?no:r)||(r=null==r?[]:[r]),mt(n,t,r))},_n.over=qi,_n.overArgs=su,_n.overEvery=Pi,_n.overSome=$i,_n.partial=pu,_n.partialRight=hu,_n.partition=Xe,_n.pick=si,_n.pickBy=pi,_n.property=Bi,_n.propertyOf=function(t){return function(n){return null==t?no:Qn(t,n)}},_n.pull=Ae,_n.pullAll=Ee,_n.pullAllBy=function(n,t,r){return n&&n.length&&t&&t.length?wt(n,t,Ur(r,2)):n},_n.pullAllWith=function(n,t,r){return n&&n.length&&t&&t.length?wt(n,t,no,r):n},_n.pullAt=Ie,_n.range=Mi,_n.rangeRight=Fi,_n.rearg=vu,_n.reject=function(n,t){return(mu(n)?Pa:Zn)(n,lu(Ur(t,3)))},_n.remove=function(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=Ur(t,3);++e<i;){var o=n[e];t(o,e,n)&&(r.push(o),u.push(e))}return xt(n,u),r},_n.rest=function(n,t){if("function"!=typeof n)throw new S(to);return kt(n,t=t===no?t:Fu(t))},_n.reverse=Se,_n.sampleSize=function(n,t,r){return t=(r?Gr(n,t,r):t===no)?1:Fu(t),(mu(n)?En:Et)(n,t)},_n.set=function(n,t,r){return null==n?n:It(n,t,r)},_n.setWith=function(n,t,r,e){return e="function"==typeof e?e:no,null==n?n:It(n,t,r,e)},_n.shuffle=function(n){return(mu(n)?In:zt)(n)},_n.slice=function(n,t,r){var e=null==n?0:n.length;return e?Lt(n,t,r=r&&"number"!=typeof r&&Gr(n,t,r)?(t=0,e):(t=null==t?0:Fu(t),r===no?e:Fu(r))):[]},_n.sortBy=nu,_n.sortedUniq=function(n){return n&&n.length?Dt(n):[]},_n.sortedUniqBy=function(n,t){return n&&n.length?Dt(n,Ur(t,2)):[]},_n.split=function(n,t,r){return r&&"number"!=typeof r&&Gr(n,t,r)&&(t=r=no),(r=r===no?ao:r>>>0)?(n=Ku(n))&&("string"==typeof t||null!=t&&!Tu(t))&&!(t=qt(t))&&pf(n)?Ht(mf(n),0,r):n.split(t,r):[]},_n.spread=function(e,u){if("function"!=typeof e)throw new S(to);return u=null==u?0:V(Fu(u),0),kt(function(n){var t=n[u],r=Ht(n,0,u);return t&&Fa(r,t),Ta(e,this,r)})},_n.tail=function(n){var t=null==n?0:n.length;return t?Lt(n,1,t):[]},_n.take=function(n,t,r){return n&&n.length?Lt(n,0,(t=r||t===no?1:Fu(t))<0?0:t):[]},_n.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?Lt(n,(t=e-(t=r||t===no?1:Fu(t)))<0?0:t,e):[]},_n.takeRightWhile=function(n,t){return n&&n.length?Mt(n,Ur(t,3),!1,!0):[]},_n.takeWhile=function(n,t){return n&&n.length?Mt(n,Ur(t,3)):[]},_n.tap=function(n,t){return t(n),n},_n.throttle=function(n,t,r){var e=!0,u=!0;if("function"!=typeof n)throw new S(to);return Su(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ou(n,t,{leading:e,maxWait:t,trailing:u})},_n.thru=Me,_n.toArray=Bu,_n.toPairs=hi,_n.toPairsIn=vi,_n.toPath=function(n){return mu(n)?Ma(n,pe):Uu(n)?[n]:ur(se(Ku(n)))},_n.toPlainObject=Vu,_n.transform=function(n,e,u){var t=mu(n),r=t||ju(n)||qu(n);if(e=Ur(e,4),null==u){var i=n&&n.constructor;u=r?t?new i:[]:Su(n)&&Au(i)?yn(A(n)):{}}return(r?Da:Jn)(n,function(n,t,r){return e(u,n,t,r)}),u},_n.unary=function(n){return ru(n,1)},_n.union=Re,_n.unionBy=ze,_n.unionWith=Le,_n.uniq=function(n){return n&&n.length?Pt(n):[]},_n.uniqBy=function(n,t){return n&&n.length?Pt(n,Ur(t,2)):[]},_n.uniqWith=function(n,t){return t="function"==typeof t?t:no,n&&n.length?Pt(n,no,t):[]},_n.unset=function(n,t){return null==n||$t(n,t)},_n.unzip=Ce,_n.unzipWith=Te,_n.update=function(n,t,r){return null==n?n:Bt(n,t,Kt(r))},_n.updateWith=function(n,t,r,e){return e="function"==typeof e?e:no,null==n?n:Bt(n,t,Kt(r),e)},_n.values=_i,_n.valuesIn=function(n){return null==n?[]:uf(n,ai(n))},_n.without=We,_n.words=Ai,_n.wrap=function(n,t){return pu(Kt(t),n)},_n.xor=De,_n.xorBy=Ue,_n.xorWith=qe,_n.zip=Pe,_n.zipObject=function(n,t){return Zt(n||[],t||[],Rn)},_n.zipObjectDeep=function(n,t){return Zt(n||[],t||[],It)},_n.zipWith=$e,_n.entries=hi,_n.entriesIn=vi,_n.extend=Ju,_n.extendWith=Hu,Di(_n,_n),_n.add=Vi,_n.attempt=Ei,_n.camelCase=yi,_n.capitalize=gi,_n.ceil=Ki,_n.clamp=function(n,t,r){return r===no&&(r=t,t=no),r!==no&&(r=(r=Zu(r))==r?r:0),t!==no&&(t=(t=Zu(t))==t?t:0),Dn(Zu(n),t,r)},_n.clone=function(n){return Un(n,4)},_n.cloneDeep=function(n){return Un(n,5)},_n.cloneDeepWith=function(n,t){return Un(n,5,t="function"==typeof t?t:no)},_n.cloneWith=function(n,t){return Un(n,4,t="function"==typeof t?t:no)},_n.conformsTo=function(n,t){return null==t||qn(n,t,oi(t))},_n.deburr=di,_n.defaultTo=function(n,t){return null==n||n!=n?t:n},_n.divide=Gi,_n.endsWith=function(n,t,r){n=Ku(n),t=qt(t);var e=n.length,u=r=r===no?e:Dn(Fu(r),0,e);return 0<=(r-=t.length)&&n.slice(r,u)==t},_n.eq=_u,_n.escape=function(n){return(n=Ku(n))&&Fo.test(n)?n.replace(Bo,lf):n},_n.escapeRegExp=function(n){return(n=Ku(n))&&Yo.test(n)?n.replace(Ho,"\\{{RAML2OBJ_CONTENT}}"):n},_n.every=function(n,t,r){var e=mu(n)?qa:Fn;return r&&Gr(n,t,r)&&(t=no),e(n,Ur(t,3))},_n.find=Ze,_n.findIndex=de,_n.findKey=function(n,t){return Ka(n,Ur(t,3),Jn)},_n.findLast=Ve,_n.findLastIndex=me,_n.findLastKey=function(n,t){return Ka(n,Ur(t,3),Hn)},_n.floor=Ji,_n.forEach=Ke,_n.forEachRight=Ge,_n.forIn=function(n,t){return null==n?n:Kn(n,Ur(t,3),ai)},_n.forInRight=function(n,t){return null==n?n:Gn(n,Ur(t,3),ai)},_n.forOwn=function(n,t){return n&&Jn(n,Ur(t,3))},_n.forOwnRight=function(n,t){return n&&Hn(n,Ur(t,3))},_n.get=ti,_n.gt=yu,_n.gte=gu,_n.has=function(n,t){return null!=n&&Nr(n,t,rt)},_n.hasIn=ri,_n.head=we,_n.identity=Li,_n.includes=function(n,t,r,e){n=wu(n)?n:_i(n),r=r&&!e?Fu(r):0;var u=n.length;return r<0&&(r=V(u+r,0)),Du(n)?r<=u&&-1<n.indexOf(t,r):!!u&&-1<Ja(n,t,r)},_n.indexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:Fu(r);return u<0&&(u=V(e+u,0)),Ja(n,t,u)},_n.inRange=function(n,t,r){return t=Mu(t),r===no?(r=t,t=0):r=Mu(r),n=Zu(n),(e=n)>=K(u=t,i=r)&&e<V(u,i);var e,u,i},_n.invoke=ii,_n.isArguments=du,_n.isArray=mu,_n.isArrayBuffer=bu,_n.isArrayLike=wu,_n.isArrayLikeObject=xu,_n.isBoolean=function(n){return!0===n||!1===n||Ru(n)&&nt(n)==so},_n.isBuffer=ju,_n.isDate=Ou,_n.isElement=function(n){return Ru(n)&&1===n.nodeType&&!Cu(n)},_n.isEmpty=function(n){if(null==n)return!0;if(wu(n)&&(mu(n)||"string"==typeof n||"function"==typeof n.splice||ju(n)||qu(n)||du(n)))return!n.length;var t=Fr(n);if(t==yo||t==xo)return!n.size;if(Qr(n))return!st(n).length;for(var r in n)if(k.call(n,r))return!1;return!0},_n.isEqual=function(n,t){return at(n,t)},_n.isEqualWith=function(n,t,r){var e=(r="function"==typeof r?r:no)?r(n,t):no;return e===no?at(n,t,no,r):!!e},_n.isError=ku,_n.isFinite=function(n){return"number"==typeof n&&F(n)},_n.isFunction=Au,_n.isInteger=Eu,_n.isLength=Iu,_n.isMap=zu,_n.isMatch=function(n,t){return n===t||ft(n,t,Pr(t))},_n.isMatchWith=function(n,t,r){return r="function"==typeof r?r:no,ft(n,t,Pr(t),r)},_n.isNaN=function(n){return Lu(n)&&n!=+n},_n.isNative=function(n){if(Yr(n))throw new u("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return ct(n)},_n.isNil=function(n){return null==n},_n.isNull=function(n){return null===n},_n.isNumber=Lu,_n.isObject=Su,_n.isObjectLike=Ru,_n.isPlainObject=Cu,_n.isRegExp=Tu,_n.isSafeInteger=function(n){return Eu(n)&&-io<=n&&n<=io},_n.isSet=Wu,_n.isString=Du,_n.isSymbol=Uu,_n.isTypedArray=qu,_n.isUndefined=function(n){return n===no},_n.isWeakMap=function(n){return Ru(n)&&Fr(n)==ko},_n.isWeakSet=function(n){return Ru(n)&&"[object WeakSet]"==nt(n)},_n.join=function(n,t){return null==n?"":N.call(n,t)},_n.kebabCase=mi,_n.last=ke,_n.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;return r!==no&&(u=(u=Fu(r))<0?V(e+u,0):K(u,e-1)),t==t?function(n,t,r){for(var e=r+1;e--;)if(n[e]===t)return e;return e}(n,t,u):Ga(n,Ya,u,!0)},_n.lowerCase=bi,_n.lowerFirst=wi,_n.lt=Pu,_n.lte=$u,_n.max=function(n){return n&&n.length?Nn(n,Li,tt):no},_n.maxBy=function(n,t){return n&&n.length?Nn(n,Ur(t,2),tt):no},_n.mean=function(n){return Qa(n,Li)},_n.meanBy=function(n,t){return Qa(n,Ur(t,2))},_n.min=function(n){return n&&n.length?Nn(n,Li,ht):no},_n.minBy=function(n,t){return n&&n.length?Nn(n,Ur(t,2),ht):no},_n.stubArray=Ni,_n.stubFalse=Zi,_n.stubObject=function(){return{}},_n.stubString=function(){return""},_n.stubTrue=function(){return!0},_n.multiply=Yi,_n.nth=function(n,t){return n&&n.length?dt(n,Fu(t)):no},_n.noConflict=function(){return Aa._===this&&(Aa._=d),this},_n.noop=Ui,_n.now=tu,_n.pad=function(n,t,r){n=Ku(n);var e=(t=Fu(t))?df(n):0;if(!t||t<=e)return n;var u=(t-e)/2;return mr($(u),r)+n+mr(P(u),r)},_n.padEnd=function(n,t,r){n=Ku(n);var e=(t=Fu(t))?df(n):0;return t&&e<t?n+mr(t-e,r):n},_n.padStart=function(n,t,r){n=Ku(n);var e=(t=Fu(t))?df(n):0;return t&&e<t?mr(t-e,r)+n:n},_n.parseInt=function(n,t,r){return r||null==t?t=0:t&&(t=+t),J(Ku(n).replace(Xo,""),t||0)},_n.random=function(n,t,r){if(r&&"boolean"!=typeof r&&Gr(n,t,r)&&(t=r=no),r===no&&("boolean"==typeof t?(r=t,t=no):"boolean"==typeof n&&(r=n,n=no)),n===no&&t===no?(n=0,t=1):(n=Mu(n),t===no?(t=n,n=0):t=Mu(t)),t<n){var e=n;n=t,t=e}if(r||n%1||t%1){var u=H();return K(n+u*(t-n+Oa("1e-"+((u+"").length-1))),t)}return jt(n,t)},_n.reduce=function(n,t,r){var e=mu(n)?Na:nf,u=arguments.length<3;return e(n,Ur(t,4),r,u,Bn)},_n.reduceRight=function(n,t,r){var e=mu(n)?Za:nf,u=arguments.length<3;return e(n,Ur(t,4),r,u,Mn)},_n.repeat=function(n,t,r){return t=(r?Gr(n,t,r):t===no)?1:Fu(t),Ot(Ku(n),t)},_n.replace=function(){var n=arguments,t=Ku(n[0]);return n.length<3?t:t.replace(n[1],n[2])},_n.result=function(n,t,r){var e=-1,u=(t=Gt(t,n)).length;for(u||(u=1,n=no);++e<u;){var i=null==n?no:n[pe(t[e])];i===no&&(e=u,i=r),n=Au(i)?i.call(n):i}return n},_n.round=Qi,_n.runInContext=n,_n.sample=function(n){return(mu(n)?An:At)(n)},_n.size=function(n){if(null==n)return 0;if(wu(n))return Du(n)?df(n):n.length;var t=Fr(n);return t==yo||t==xo?n.size:st(n).length},_n.snakeCase=xi,_n.some=function(n,t,r){var e=mu(n)?Va:Ct;return r&&Gr(n,t,r)&&(t=no),e(n,Ur(t,3))},_n.sortedIndex=function(n,t){return Tt(n,t)},_n.sortedIndexBy=function(n,t,r){return Wt(n,t,Ur(r,2))},_n.sortedIndexOf=function(n,t){var r=null==n?0:n.length;if(r){var e=Tt(n,t);if(e<r&&_u(n[e],t))return e}return-1},_n.sortedLastIndex=function(n,t){return Tt(n,t,!0)},_n.sortedLastIndexBy=function(n,t,r){return Wt(n,t,Ur(r,2),!0)},_n.sortedLastIndexOf=function(n,t){if(null!=n&&n.length){var r=Tt(n,t,!0)-1;if(_u(n[r],t))return r}return-1},_n.startCase=ji,_n.startsWith=function(n,t,r){return n=Ku(n),r=null==r?0:Dn(Fu(r),0,n.length),t=qt(t),n.slice(r,r+t.length)==t},_n.subtract=Xi,_n.sum=function(n){return n&&n.length?tf(n,Li):0},_n.sumBy=function(n,t){return n&&n.length?tf(n,Ur(t,2)):0},_n.template=function(o,n,t){var r=_n.templateSettings;t&&Gr(o,n,t)&&(n=no),o=Ku(o),n=Hu({},n,r,Er);var a,f,e=Hu({},n.imports,r.imports,Er),u=oi(e),i=uf(e,u),c=0,l=n.interpolate||va,s="__p += '",p=g((n.escape||va).source+"|"+l.source+"|"+(l===Vo?oa:va).source+"|"+(n.evaluate||va).source+"|$","g"),h="//# sourceURL="+("sourceURL"in n?n.sourceURL:"lodash.templateSources["+ ++wa+"]")+"\n";o.replace(p,function(n,t,r,e,u,i){return r||(r=e),s+=o.slice(c,i).replace(_a,sf),t&&(a=!0,s+="' +\n__e("+t+") +\n'"),u&&(f=!0,s+="';\n"+u+";\n__p += '"),r&&(s+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=i+n.length,n}),s+="';\n";var v=n.variable;v||(s="with (obj) {\n"+s+"\n}\n"),s=(f?s.replace(Uo,""):s).replace(qo,"$1").replace(Po,"$1;"),s="function("+(v||"obj")+") {\n"+(v?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(f?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+s+"return __p\n}";var _=Ei(function(){return y(u,h+"return "+s).apply(no,i)});if(_.source=s,ku(_))throw _;return _},_n.times=function(n,t){if((n=Fu(n))<1||io<n)return[];var r=ao,e=K(n,ao);t=Ur(t),n-=ao;for(var u=rf(e,t);++r<n;)t(r);return u},_n.toFinite=Mu,_n.toInteger=Fu,_n.toLength=Nu,_n.toLower=function(n){return Ku(n).toLowerCase()},_n.toNumber=Zu,_n.toSafeInteger=function(n){return n?Dn(Fu(n),-io,io):0===n?n:0},_n.toString=Ku,_n.toUpper=function(n){return Ku(n).toUpperCase()},_n.trim=function(n,t,r){if((n=Ku(n))&&(r||t===no))return n.replace(Qo,"");if(!n||!(t=qt(t)))return n;var e=mf(n),u=mf(t);return Ht(e,af(e,u),ff(e,u)+1).join("")},_n.trimEnd=function(n,t,r){if((n=Ku(n))&&(r||t===no))return n.replace(na,"");if(!n||!(t=qt(t)))return n;var e=mf(n);return Ht(e,0,ff(e,mf(t))+1).join("")},_n.trimStart=function(n,t,r){if((n=Ku(n))&&(r||t===no))return n.replace(Xo,"");if(!n||!(t=qt(t)))return n;var e=mf(n);return Ht(e,af(e,mf(t))).join("")},_n.truncate=function(n,t){var r=30,e="...";if(Su(t)){var u="separator"in t?t.separator:u;r="length"in t?Fu(t.length):r,e="omission"in t?qt(t.omission):e}var i=(n=Ku(n)).length;if(pf(n)){var o=mf(n);i=o.length}if(i<=r)return n;var a=r-df(e);if(a<1)return e;var f=o?Ht(o,0,a).join(""):n.slice(0,a);if(u===no)return f+e;if(o&&(a+=f.length-a),Tu(u)){if(n.slice(a).search(u)){var c,l=f;for(u.global||(u=g(u.source,Ku(aa.exec(u))+"g")),u.lastIndex=0;c=u.exec(l);)var s=c.index;f=f.slice(0,s===no?a:s)}}else if(n.indexOf(qt(u),a)!=a){var p=f.lastIndexOf(u);-1<p&&(f=f.slice(0,p))}return f+e},_n.unescape=function(n){return(n=Ku(n))&&Mo.test(n)?n.replace($o,bf):n},_n.uniqueId=function(n){var t=++p;return Ku(n)+t},_n.upperCase=Oi,_n.upperFirst=ki,_n.each=Ke,_n.eachRight=Ge,_n.first=we,Di(_n,(Hi={},Jn(_n,function(n,t){k.call(_n.prototype,t)||(Hi[t]=n)}),Hi),{chain:!1}),_n.VERSION="4.17.10",Da(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){_n[n].placeholder=_n}),Da(["drop","take"],function(r,e){mn.prototype[r]=function(n){n=n===no?1:V(Fu(n),0);var t=this.__filtered__&&!e?new mn(this):this.clone();return t.__filtered__?t.__takeCount__=K(n,t.__takeCount__):t.__views__.push({size:K(n,ao),type:r+(t.__dir__<0?"Right":"")}),t},mn.prototype[r+"Right"]=function(n){return this.reverse()[r](n).reverse()}}),Da(["filter","map","takeWhile"],function(n,t){var r=t+1,e=1==r||3==r;mn.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:Ur(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),Da(["head","last"],function(n,t){var r="take"+(t?"Right":"");mn.prototype[n]=function(){return this[r](1).value()[0]}}),Da(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");mn.prototype[n]=function(){return this.__filtered__?new mn(this):this[r](1)}}),mn.prototype.compact=function(){return this.filter(Li)},mn.prototype.find=function(n){return this.filter(n).head()},mn.prototype.findLast=function(n){return this.reverse().find(n)},mn.prototype.invokeMap=kt(function(t,r){return"function"==typeof t?new mn(this):this.map(function(n){return it(n,t,r)})}),mn.prototype.reject=function(n){return this.filter(lu(Ur(n)))},mn.prototype.slice=function(n,t){n=Fu(n);var r=this;return r.__filtered__&&(0<n||t<0)?new mn(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==no&&(r=(t=Fu(t))<0?r.dropRight(-t):r.take(t-n)),r)},mn.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},mn.prototype.toArray=function(){return this.take(ao)},Jn(mn.prototype,function(s,n){var p=/^(?:filter|find|map|reject)|While$/.test(n),h=/^(?:head|last)$/.test(n),v=_n[h?"take"+("last"==n?"Right":""):n],_=h||/^find/.test(n);v&&(_n.prototype[n]=function(){var n=this.__wrapped__,r=h?[1]:arguments,t=n instanceof mn,e=r[0],u=t||mu(n),i=function(n){var t=v.apply(_n,Fa([n],r));return h&&o?t[0]:t};u&&p&&"function"==typeof e&&1!=e.length&&(t=u=!1);var o=this.__chain__,a=!!this.__actions__.length,f=_&&!o,c=t&&!a;if(_||!u)return f&&c?s.apply(this,r):(l=this.thru(i),f?h?l.value()[0]:l.value():l);n=c?n:new mn(this);var l=s.apply(n,r);return l.__actions__.push({func:Me,args:[i],thisArg:no}),new dn(l,o)})}),Da(["pop","push","shift","sort","splice","unshift"],function(n){var r=o[n],e=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",u=/^(?:pop|shift)$/.test(n);_n.prototype[n]=function(){var t=arguments;if(!u||this.__chain__)return this[e](function(n){return r.apply(mu(n)?n:[],t)});var n=this.value();return r.apply(mu(n)?n:[],t)}}),Jn(mn.prototype,function(n,t){var r=_n[t];if(r){var e=r.name+"";(on[e]||(on[e]=[])).push({name:t,func:r})}}),on[_r(no,2).name]=[{name:"wrapper",func:no}],mn.prototype.clone=function(){var n=new mn(this.__wrapped__);return n.__actions__=ur(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=ur(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=ur(this.__views__),n},mn.prototype.reverse=function(){if(this.__filtered__){var n=new mn(this);n.__dir__=-1,n.__filtered__=!0}else(n=this.clone()).__dir__*=-1;return n},mn.prototype.value=function(){var n=this.__wrapped__.value(),t=this.__dir__,r=mu(n),e=t<0,u=r?n.length:0,i=function(n,t,r){for(var e=-1,u=r.length;++e<u;){var i=r[e],o=i.size;switch(i.type){case"drop":n+=o;break;case"dropRight":t-=o;break;case"take":t=K(t,n+o);break;case"takeRight":n=V(n,t-o)}}return{start:n,end:t}}(0,u,this.__views__),o=i.start,a=i.end,f=a-o,c=e?a:o-1,l=this.__iteratees__,s=l.length,p=0,h=K(f,this.__takeCount__);if(!r||!e&&u==f&&h==f)return Ft(n,this.__actions__);var v=[];n:for(;f--&&p<h;){for(var _=-1,y=n[c+=t];++_<s;){var g=l[_],d=g.iteratee,m=g.type,b=d(y);if(2==m)y=b;else if(!b){if(1==m)continue n;break n}}v[p++]=y}return v},_n.prototype.at=Fe,_n.prototype.chain=function(){return Be(this)},_n.prototype.commit=function(){return new dn(this.value(),this.__chain__)},_n.prototype.next=function(){this.__values__===no&&(this.__values__=Bu(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?no:this.__values__[this.__index__++]}},_n.prototype.plant=function(n){for(var t,r=this;r instanceof gn;){var e=ve(r);e.__index__=0,e.__values__=no,t?u.__wrapped__=e:t=e;var u=e;r=r.__wrapped__}return u.__wrapped__=n,t},_n.prototype.reverse=function(){var n=this.__wrapped__;if(n instanceof mn){var t=n;return this.__actions__.length&&(t=new mn(this)),(t=t.reverse()).__actions__.push({func:Me,args:[Se],thisArg:no}),new dn(t,this.__chain__)}return this.thru(Se)},_n.prototype.toJSON=_n.prototype.valueOf=_n.prototype.value=function(){return Ft(this.__wrapped__,this.__actions__)},_n.prototype.first=_n.prototype.head,C&&(_n.prototype[C]=function(){return this}),_n}();"function"==typeof define&&"object"==_typeof(define.amd)&&define.amd?(Aa._=wf,define(function(){return wf})):D?((D.exports=wf)._=wf,W._=wf):Aa._=wf}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),e}!function s(i,o,c){function u(r,e){if(!o[r]){if(!i[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(p)return p(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var a=o[r]={exports:{}};i[r][0].call(a.exports,function(e){return u(i[r][1][e]||e)},a,a.exports,s,i,o,c)}return o[r].exports}for(var p="function"==typeof require&&require,e=0;e<c.length;e++)u(c[e]);return u}({1:[function(e,r,t){},{}],2:[function(e,r,t){var n=e("./");"undefined"==typeof window?self.raml2obj=n:window.raml2obj=n},{"./":3}],3:[function(e,r,t){var n=e("./lib/enhencer").RamlJsonEnhancer,a=e("./lib/arrays-objects").arraysToObjects,s=e("./lib/expander").ExpansionLibrary;r.exports.parse=function(e){return(e=e||{}).json?new n(e).enhance(e.json):Promise.reject(new Error("Required `json` property not found."))},r.exports.prepareObject=function(e){var r={json:[]};return e&&(a(e),r.json=e),Promise.resolve(r)},r.exports.expandTypes=function(e){var r={types:[]};return e&&Object.keys(e).length?s.expandRootTypes(e).then(function(e){return r.types=e,r}):Promise.resolve(r)},r.exports.normalize=function(e,r){var t={json:[]};return e&&(e=(new n).normalize(e,r),t.json=e),Promise.resolve(t)}},{"./lib/arrays-objects":4,"./lib/enhencer":6,"./lib/expander":7}],4:[function(e,r,t){function s(e){return e&&e===Object(e)&&!Array.isArray(e)}var i=["responses","body","queryParameters","headers","properties","baseUriParameters","annotations","uriParameters"],n=["types","traits","resourceTypes","annotationTypes","securitySchemes"];r.exports={arraysToObjects:function(r){return n.forEach(function(e){e in r&&r[e]&&(r[e]=r[e].reduce(function(r,t){return Object.keys(t).forEach(function(e){r[e]=t[e]}),r},{}))}),r},recursiveObjectToArray:function n(a){return Array.isArray(a)?a.forEach(function(e){n(e)}):s(a)&&Object.keys(a).forEach(function(e){var r,t=a[e];-1!==i.indexOf(e)&&s(t)&&(a[e]=(r=t,Array.isArray(r)?r:Object.keys(r).map(function(e){return s(r[e])&&(r[e].key=e),r[e]}))),n(t)}),a}}},{}],5:[function(e,r,t){var n=function(){function s(){_classCallCheck(this,s)}return _createClass(s,null,[{key:"isObject",value:function(e){return e&&e===Object(e)&&!Array.isArray(e)}},{key:"makeConsistent",value:function(t,n,a){if(!t||t.__typeConsistent)return t;if(Array.isArray(t))t.forEach(function(e,r){t[r]=s.makeConsistent(e,n,a)});else if(s.isObject(t)){if((t=s.consistentExample(t)).type&&(t=s.consistentType(t,n)),t.items instanceof Array&&(t.items=t.items[0]),a||(a=[]),t.items&&n&&n[t.items]){var e=n[t.items];"object"===e.type&&-1!==a.indexOf(e.displayName)||(t.items=e)}var r="object"===t.type&&t.displayName;r&&a.push(r),Object.keys(t).forEach(function(e){t[e]=s.makeConsistent(t[e],n,a)})}return t}},{key:"consistentType",value:function(e,r){return Array.isArray(e.type)&&(e.type=e.type[0]),e.type&&e.type.type&&(1===Object.keys(e.type).length&&(e.type=e.type.type),e.type.type&&e.type.type instanceof Array&&1===e.type.type.length&&(e.type.type=e.type.type[0])),r&&r[e.type]?s.applyType(e,r[e.type]):e.type&&e.type.type&&("type"!==e.type.name||e.type.properties||e.type.items)&&s.applyType(e,e.type),e}},{key:"consistentExample",value:function(e){return e.examples&&e.examples.length&&(e.examples=e.examples.map(function(e){return e.value?e.value:e})),e.structuredExample&&(void 0===e.examples&&(e.examples=[]),e.examples.push(e.structuredExample.value),delete e.example,delete e.structuredExample),e}},{key:"applyType",value:function(r,e){var t=this,n={description:r.description,enum:r.enum,default:r.default,schema:r.schema,xml:r.xml,name:r.name},a={properties:r.properties,items:r.items},s=[];r.examples&&(s=r.examples,delete r.examples),r.example&&(s.push(r.example),delete r.example),(r=Object.assign(r,e)).type&&Array.isArray(r.type)&&(r.type=r.type[0]),r.examples||(r.examples=[]),s.length&&(r.examples=r.examples.concat(s)),Object.keys(a).forEach(function(e){void 0!==a[e]&&(r[e]&&r[e].length||(r[e]=[]),r[e]=t.mergeExcludeDusplicates(a[e],r[e]))}),n.name===n.displayName&&r.displayName!==n.displayName&&delete n.displayName,Object.keys(n).forEach(function(e){void 0!==n[e]&&(r[e]=n[e])}),r.__typeConsistent=!0}},{key:"mergeExcludeDusplicates",value:function(e,r){e&&e.length||(e=[]),r&&r.length||(r=[]);for(var t=0,n=r.length;t<n;t++){for(var a=r[t],s=a.key,i=!1,o=0,c=e.length;o<c;o++)if(e[o].key===s){i=!0;break}i||e.push(a)}return e}}]),s}();r.exports.ConsistencyHelper=n},{}],6:[function(e,r,t){var n=e("./arrays-objects"),a=n.arraysToObjects,s=n.recursiveObjectToArray,i=e("./expander").ExpansionLibrary,o=e("./consistency-helpers").ConsistencyHelper,c=e("./security-schemes").SecuritySchemesTransformer,u=!!("undefined"!=typeof performance&&performance.mark&&performance.measure&&performance.getEntriesByType),p="array-2-obj",l="expansion",m="normalization",y=function(){function r(e){_classCallCheck(this,r),e=e||{},this.takeMeasurements=e.takeMeasurements||!1}return _createClass(r,[{key:"mark",value:function(e){u&&performance.mark(e)}},{key:"_measureRersult",value:function(e,r){var t=performance.getEntriesByName(e)[0];return{duration:t.duration,name:t.name,title:r}}},{key:"getMeasurements",value:function(){if(!u)return[];performance.measure(p,p+"-start",p+"-end"),performance.measure(l,l+"-start",l+"-end"),performance.measure(m,m+"-start",m+"-end");var e=[];e.push(this._measureRersult(p,"Array to object tranformation")),e.push(this._measureRersult(l,"Datatype expansion")),e.push(this._measureRersult(m,"Data model normalization"));var r=i.getMeasurements();return e=e.concat(r),performance.clearMarks(),performance.clearMeasures(),e}},{key:"enhance",value:function(r){var t=this,n=this.takeMeasurements;return n&&this.mark(p+"-start"),a(r),n&&(this.mark(p+"-end"),this.mark(l+"-start")),i.expandRootTypes(r.types,n).then(function(e){return n&&(t.mark(l+"-end"),t.mark(m+"-start")),t.normalize(r,e)}).then(function(e){var r={json:e};return n&&(t.mark(m+"-end"),r.measurement=t.getMeasurements()),r})}},{key:"normalize",value:function(e,r){return delete e.types,this._transformTypesToArrays(r),this._transformObjectsToArrays(e),this._makeRamlConsistent(e,r),this._normalizeObject(e),r&&(e.types=r),e}},{key:"_makeRamlConsistent",value:function(e,r){r&&Object.keys(r).forEach(function(e){r[e]=o.consistentExample(r[e])}),o.makeConsistent(e,r)}},{key:"_transformObjectsToArrays",value:function(e){s(e)}},{key:"_transformTypesToArrays",value:function(e){s(e)}},{key:"_normalizeObject",value:function(e){var r={securitySchemes:e.securitySchemes},t={computeBaseUri:!this.hasProperBaseUri(e),baseUri:e.baseUri};this.enhaceJson(e,r,t)}},{key:"enhaceJson",value:function(n,a,s){var i=this;n.resources&&n.resources.forEach(function(r){r.parentUrl=s.parentUrl||"",r.allUriParameters=n.baseUriParameters?i._clone(n.baseUriParameters):[],s.computeBaseUri&&(r.absoluteUri=s.baseUri+r.relativeUri),s.allUriParameters&&(r.allUriParameters=r.allUriParameters.concat(s.allUriParameters)),r.baseUriParameters&&(r.allUriParameters=i._mergeBaseParameters(r.allUriParameters,r.baseUriParameters)),r.uriParameters&&(r.allUriParameters=r.allUriParameters.concat(r.uriParameters));var t=r.parentUrl+r.relativeUri;r.methods&&r.methods.forEach(function(e){e.allUriParameters=r.allUriParameters,e.absoluteUri=r.absoluteUri,e.relativeUri=t,e.baseUri=s.baseUri,c.addSecuritSchemes(e,a.securitySchemes)}),c.addSecuritSchemes(r,a.securitySchemes);var e=Object.assign({},s);e.parentUrl=t,e.allUriParameters=r.allUriParameters?i._clone(r.allUriParameters):[],i.enhaceJson(r,a,e)})}},{key:"hasProperBaseUri",value:function(e){if(!e||!e.resources||!e.resources[0])return!0;if(!e.baseUri)return!0;var r=e.resources[0].absoluteUri;if(!r)return!1;var t=e.baseUri;return 0===r.indexOf(t)}},{key:"_mergeBaseParameters",value:function(e,r){r=r||[],e=e?this._clone(e):[];for(var t=0,n=r.length;t<n;t++){for(var a=r[t],s=!1,i=0,o=e.length;i<o;i++)if(e[i].name===a.name){s=!0,e[i]=Object.assign(e[i],a);break}s||e.push(a)}return e}},{key:"_isArray",value:function(e){return"[object Array]"===Object.prototype.toString.apply(e)}},{key:"_clone",value:function(e){var r,t;if("object"!==_typeof(e))return e;if(!e)return e;if(this._isArray(e)){for(r=[],t=0;t<e.length;t+=1)r[t]=this._clone(e[t]);return r}for(t in r={},e)e.hasOwnProperty(t)&&(r[t]=this._clone(e[t]));return r}}]),r}();r.exports.RamlJsonEnhancer=y},{"./arrays-objects":4,"./consistency-helpers":5,"./expander":7,"./security-schemes":8}],7:[function(e,r,t){var n=e("./consistency-helpers").ConsistencyHelper,c=!0;("undefined"!=typeof window||"undefined"!=typeof self&&self.importScripts)&&(c=!1);var a=!!("undefined"!=typeof performance&&performance.mark&&performance.measure&&performance.getEntriesByType),s=function(){function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"mark",value:function(e){a&&performance.mark(e)}},{key:"getMeasurements",value:function(){if(!a)return[];var e=performance.getEntriesByType("mark"),n=[];e.forEach(function(e){if(-1!==e.name.indexOf("expanding-")&&-1!==e.name.indexOf("-start")){var r=e.name.substr(10);r=r.replace("-start",""),performance.measure(r,e.name,"expanding-"+r+"-end");var t=performance.getEntriesByName(r)[0];n.push({duration:t.duration,name:t.name,title:"Expanding type: "+r})}}),performance.measure("making-expansion-consistent","making-expansion-consistent-start","making-expansion-consistent-end");var r=performance.getEntriesByName("making-expansion-consistent")[0];return n.push({duration:r.duration,name:r.name,title:"Making expansion result consistent"}),n}},{key:"expandRootTypes",value:function(e,t){if(!e)return Promise.resolve(e);var r=Object.keys(e);return r.length?o._recursiveExpand(r,e,t).then(function(e){t&&o.mark("making-expansion-consistent-start");var r=n.makeConsistent(e);return t&&o.mark("making-expansion-consistent-end"),r}):Promise.resolve(e)}},{key:"_recursiveExpand",value:function(r,t,n){var a=r.shift();return a?o._expandType(t,a,n).then(function(e){return t[a]=e[1],o._recursiveExpand(r,t,n)}):t}},{key:"_expandType",value:function(a,s,i){return new Promise(function(t){var n=c?e("datatype-expansion"):expansion;i&&o.mark("expanding-"+s+"-start"),n.expandedForm(a[s],a,function(e,r){if(e)return i&&o.mark("expanding-"+s+"-end"),t([s,a[s]]);r?n.canonicalForm(r,{hoistUnions:!1,callback:function(e,r){if(i&&o.mark("expanding-"+s+"-end"),e)return t([s,a[s]]);t(r?[s,r]:[s,a[s]])}}):t([s,a[s]])})})}}]),o}();r.exports.ExpansionLibrary=s},{"./consistency-helpers":5,"datatype-expansion":1}],8:[function(e,r,t){var n=function(){function c(){_classCallCheck(this,c)}return _createClass(c,null,[{key:"isObject",value:function(e){return e&&e===Object(e)&&!Array.isArray(e)}},{key:"addSecuritSchemes",value:function(s,i){if(i&&Object.keys(i).length&&s&&s.securedBy&&s.securedBy.length){var o=!1;s.securedBy.forEach(function(e,r){if("string"==typeof e)e in i&&(o=!0,s.securedBy[r]=Object.assign({},i[e]));else if(c.isObject(e)){var t=Object.keys(e)[0];if(t in i){o=!0;var n=Object.assign({},i[t]),a=e[t];n.settings=Object.assign({},n.settings,a),s.securedBy[r]=n}}}),o&&c.transform(s)}}},{key:"transform",value:function(r){r.queryParameters||(r.queryParameters=[]),r.headers||(r.headers=[]),r.securedBy||(r.securedBy=[]);var t=[];r.securedBy.forEach(function(e){e&&"string"!=typeof e&&e.describedBy&&(e.describedBy.queryParameters&&(r.queryParameters=r.queryParameters.concat(e.describedBy.queryParameters)),e.describedBy.headers&&(r.headers=r.headers.concat(e.describedBy.headers)),e.describedBy.responses&&(t=t.concat(e.describedBy.responses)))}),r.responses&&(t=t.concat(r.responses)),t.sort(function(e,r){var t=Number(e.code),n=Number(r.code);return n<t?1:t<n?-1:0}),r.responses=t}}]),c}();r.exports.SecuritySchemesTransformer=n},{}]},{},[2]);
self.Promise||(self.Promise=MakePromise(function(e){e()}));
Promise.all=Promise.all||function(){var c=Array.prototype.slice.call(1===arguments.length&&Array.isArray(arguments[0])?arguments[0]:arguments);return new Promise(function(t,o){if(0===c.length)return t([]);var i=c.length;function a(n,r){try{if(r&&("object"==typeof r||"function"==typeof r)){var e=r.then;if("function"==typeof e)return void e.call(r,function(r){a(n,r)},o)}c[n]=r,0==--i&&t(c)}catch(r){o(r)}}for(var r=0;r<c.length;r++)a(r,c[r])})},Promise.race=Promise.race||function(r){var o=r;return new Promise(function(r,n){for(var e=0,t=o.length;e<t;e++)o[e].then(r,n)})};
"use strict";var Nw={reportError:function(r){self.postMessage({error:!0,message:r})},reportResult:function(r){self.postMessage({error:!1,result:r})},messageHandler:function(r){var e=r.data.payload;if(!e)return Nw.reportError("Payload not set");switch(e){case"parse":Nw.parseObject(r.data);break;default:return Nw.reportError("Unknown payload")}},parseObject:function(r){var e;try{raml2obj.parse(r).then(function(r){Nw.reportResult(r)}).catch(function(r){return e=r.message||"Unknown prepare types error",Nw.reportError(e)})}catch(r){return e=r.message||"Unknown prepare types error",Nw.reportError(e)}}};self.onmessage=Nw.messageHandler;</script>
</template>
<script>
(function() {
/**
* Making the a private propery not available in element's API.
* Contains a list of currently running workers.
*
* @type {Array}
*/
var WORKERS = [];
/**
* @param {String} name Name of the worker.
* @return {Worker} A worker object for the name.
*/
function getWorker(name) {
for (var i = 0, len = WORKERS.length; i < len; i++) {
if (WORKERS[i].name === name) {
return WORKERS[i].ref;
}
}
}
Polymer({
is: 'raml-json-enhance',
properties: {
/**
* A JSON retuned by the `toJson()` function of the RAML JS parser's
* API object.
*/
json: {
type: Object,
observer: '_jsonChnaged'
},
// The result of enhancing the `json` object.
result: {
type: Object,
notify: true,
readOnly: true
},
// Flag set to true when currently JSON is being enhanced.
expanding: {
type: Boolean,
notify: true,
readOnly: true
},
/**
* If true it will instruct `raml2obj` library to measure execution
* time. It will be printed to the console after RAML is enhanced
*/
printMeasurements: Boolean
},
// Handler for the `json` property change.
_jsonChnaged: function(json) {
if (!json) {
return this._setResult(undefined);
}
this._noSupportedError();
if (json.specification) {
json = json.specification;
}
this._killWorkers();
this.enhance(json);
},
/**
* Sends an error when running from unsupported browser.
*/
_noSupportedError: function() {
var ie10 = /msie 10/i.test(navigator.userAgent);
if (!ie10) {
return;
}
this._setResult(undefined);
this.fire('error', {
message: 'This browser is not supported.'
});
throw new Error('This browser is not supported.');
},
/**
* Terminates currently running workers.
* Thisa is helpful when another process is requested and old process is
* still running. It terminates workers so messages from them won't be
* sent to the main thread and notified outside for old api call.
*
* It also clears data URL object created by URL.createObjectURL().
*
* This resets state to 0.
*/
_killWorkers: function() {
for (var i = WORKERS.length - 1; i >= 0; i--) {
this.__terminateWorker(WORKERS[i]);
WORKERS.splice(i, 1);
}
},
/**
* Terminates the worker if it exists and is running
*
* @param {Object} workerRef An object created by `__createWorker` function
*/
__terminateWorker: function(workerRef) {
workerRef.ref.terminate();
workerRef.ref.removeEventListener('message', workerRef.data);
workerRef.ref.removeEventListener('error', workerRef.error);
this.__clearDataUrl(workerRef.url);
},
/**
* Clears a data URL created by URL.createObjectURL().
*
* @param {String} url The URL to clean
*/
__clearDataUrl: function(url) {
if (url) {
window.URL.revokeObjectURL(url);
}
},
/**
* Creates a web workers before the work starts.
*/
_createWorkers: function() {
var norm = this.__createWorker('_normalize', this.$.normalizer.textContent);
WORKERS.push(norm);
},
/**
* Creates an instance of web worker from a text content.
*
* @param {String} property Name of the worker. `this` must contains
* functions for handling data and errors named `property` + `DataHandler`
* and `property` + `ErrorHandler`
* @param {String} body Body of the worker
*/
__createWorker: function(property, body) {
var blob = new Blob([body]);
var workerUrl = window.URL.createObjectURL(blob);
var worker = new Worker(workerUrl);
var dataHandler = this[property + 'DataHandler'].bind(this);
var errorHandler = this[property + 'ErrorHandler'].bind(this);
worker.addEventListener('message', dataHandler);
worker.addEventListener('error', errorHandler);
return {
name: property,
ref: worker,
url: workerUrl,
error: errorHandler,
data: dataHandler
};
},
/**
* Enhances the JavaScript object.
*
* @param {Object} json An object returned from RAML js parser after calling
* `toJSON`.
*/
enhance: function(json) {
this._setExpanding(true);
this._createWorkers();
var worker = getWorker('_normalize');
var message = {
payload: 'parse',
json: json,
takeMeasurements: this.printMeasurements
};
worker.postMessage(message);
},
/**
* Reports results to the called by dispatching the
* `raml-json-enhance-ready` event.
*
* @param {Object} result Expanded and normalized object.
*/
_reportResult: function(result) {
this._setResult(result);
this.fire('raml-json-enhance-ready', {
json: result
});
this._killWorkers();
},
/**
* Reports an error
*
* @param {String} errorMessage Error message to report.
*/
_reportError: function(errorMessage) {
var err = new Error(errorMessage);
this.fire('error', {
message: err.message
});
this._killWorkers();
throw err;
},
/**
* Handler for a message from the normalize worker.
* Depending on current state it calls next function in the chain.
*/
_normalizeDataHandler: function(e) {
this._setExpanding(false);
var data = e.data;
if (data.error) {
this._reportError(data.message);
return;
}
var json = data.result.json;
this._reportResult(json);
if (data.result.measurement) {
console.table(data.result.measurement);
}
},
/**
* Normalize worker error handler.
*/
_normalizeErrorHandler: function(e) {
var message = (e && e.message) ? 'Normalize worker: ' + e.message :
'Unknown normalize worker error.';
this._reportError(message);
}
});
})();
</script>
</dom-module>