ru.Bee 1.3.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rubee +36 -4
  3. data/lib/app/views/app.tsx +27 -0
  4. data/lib/app/views/index.html +47 -0
  5. data/lib/app/views/layout.erb +3 -3
  6. data/lib/app/views/utils/redirectToBackend.tsx +9 -0
  7. data/lib/app/views/welcome_show.erb +1 -1
  8. data/lib/config/base_configuration.rb +9 -0
  9. data/lib/config/routes.rb +1 -0
  10. data/lib/esbuild.config.js +33 -0
  11. data/lib/js/app.js +13 -0
  12. data/lib/js/app.js.map +7 -0
  13. data/lib/js/bundle.js +26157 -0
  14. data/lib/js/bundle.js.map +7 -0
  15. data/lib/node_modules/@types/cookie/LICENSE +21 -0
  16. data/lib/node_modules/@types/cookie/README.md +15 -0
  17. data/lib/node_modules/@types/cookie/index.d.ts +154 -0
  18. data/lib/node_modules/@types/cookie/package.json +30 -0
  19. data/lib/node_modules/cookie/LICENSE +24 -0
  20. data/lib/node_modules/cookie/README.md +248 -0
  21. data/lib/node_modules/cookie/dist/index.d.ts +114 -0
  22. data/lib/node_modules/cookie/dist/index.js +239 -0
  23. data/lib/node_modules/cookie/dist/index.js.map +1 -0
  24. data/lib/node_modules/cookie/package.json +42 -0
  25. data/lib/node_modules/js-tokens/CHANGELOG.md +151 -0
  26. data/lib/node_modules/js-tokens/LICENSE +21 -0
  27. data/lib/node_modules/js-tokens/README.md +240 -0
  28. data/lib/node_modules/js-tokens/index.js +23 -0
  29. data/lib/node_modules/js-tokens/package.json +30 -0
  30. data/lib/node_modules/loose-envify/LICENSE +21 -0
  31. data/lib/node_modules/loose-envify/README.md +45 -0
  32. data/lib/node_modules/loose-envify/cli.js +16 -0
  33. data/lib/node_modules/loose-envify/custom.js +4 -0
  34. data/lib/node_modules/loose-envify/index.js +3 -0
  35. data/lib/node_modules/loose-envify/loose-envify.js +36 -0
  36. data/lib/node_modules/loose-envify/package.json +36 -0
  37. data/lib/node_modules/loose-envify/replace.js +65 -0
  38. data/lib/node_modules/react/LICENSE +21 -0
  39. data/lib/node_modules/react/README.md +37 -0
  40. data/lib/node_modules/react/cjs/react-jsx-dev-runtime.development.js +1315 -0
  41. data/lib/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +10 -0
  42. data/lib/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js +10 -0
  43. data/lib/node_modules/react/cjs/react-jsx-runtime.development.js +1333 -0
  44. data/lib/node_modules/react/cjs/react-jsx-runtime.production.min.js +11 -0
  45. data/lib/node_modules/react/cjs/react-jsx-runtime.profiling.min.js +11 -0
  46. data/lib/node_modules/react/cjs/react.development.js +2740 -0
  47. data/lib/node_modules/react/cjs/react.production.min.js +26 -0
  48. data/lib/node_modules/react/cjs/react.shared-subset.development.js +20 -0
  49. data/lib/node_modules/react/cjs/react.shared-subset.production.min.js +10 -0
  50. data/lib/node_modules/react/index.js +7 -0
  51. data/lib/node_modules/react/jsx-dev-runtime.js +7 -0
  52. data/lib/node_modules/react/jsx-runtime.js +7 -0
  53. data/lib/node_modules/react/package.json +47 -0
  54. data/lib/node_modules/react/react.shared-subset.js +7 -0
  55. data/lib/node_modules/react/umd/react.development.js +3343 -0
  56. data/lib/node_modules/react/umd/react.production.min.js +31 -0
  57. data/lib/node_modules/react/umd/react.profiling.min.js +31 -0
  58. data/lib/node_modules/react-dom/LICENSE +21 -0
  59. data/lib/node_modules/react-dom/README.md +60 -0
  60. data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +7029 -0
  61. data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +93 -0
  62. data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js +7093 -0
  63. data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js +101 -0
  64. data/lib/node_modules/react-dom/cjs/react-dom-server.browser.development.js +7014 -0
  65. data/lib/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js +96 -0
  66. data/lib/node_modules/react-dom/cjs/react-dom-server.node.development.js +7070 -0
  67. data/lib/node_modules/react-dom/cjs/react-dom-server.node.production.min.js +102 -0
  68. data/lib/node_modules/react-dom/cjs/react-dom-test-utils.development.js +1763 -0
  69. data/lib/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js +40 -0
  70. data/lib/node_modules/react-dom/cjs/react-dom.development.js +29923 -0
  71. data/lib/node_modules/react-dom/cjs/react-dom.production.min.js +322 -0
  72. data/lib/node_modules/react-dom/cjs/react-dom.profiling.min.js +366 -0
  73. data/lib/node_modules/react-dom/client.js +25 -0
  74. data/lib/node_modules/react-dom/index.js +38 -0
  75. data/lib/node_modules/react-dom/package.json +62 -0
  76. data/lib/node_modules/react-dom/profiling.js +38 -0
  77. data/lib/node_modules/react-dom/server.browser.js +17 -0
  78. data/lib/node_modules/react-dom/server.js +3 -0
  79. data/lib/node_modules/react-dom/server.node.js +17 -0
  80. data/lib/node_modules/react-dom/test-utils.js +7 -0
  81. data/lib/node_modules/react-dom/umd/react-dom-server-legacy.browser.development.js +7026 -0
  82. data/lib/node_modules/react-dom/umd/react-dom-server-legacy.browser.production.min.js +75 -0
  83. data/lib/node_modules/react-dom/umd/react-dom-server.browser.development.js +7011 -0
  84. data/lib/node_modules/react-dom/umd/react-dom-server.browser.production.min.js +76 -0
  85. data/lib/node_modules/react-dom/umd/react-dom-test-utils.development.js +1759 -0
  86. data/lib/node_modules/react-dom/umd/react-dom-test-utils.production.min.js +33 -0
  87. data/lib/node_modules/react-dom/umd/react-dom.development.js +29924 -0
  88. data/lib/node_modules/react-dom/umd/react-dom.production.min.js +267 -0
  89. data/lib/node_modules/react-dom/umd/react-dom.profiling.min.js +285 -0
  90. data/lib/node_modules/react-router/CHANGELOG.md +1526 -0
  91. data/lib/node_modules/react-router/LICENSE.md +23 -0
  92. data/lib/node_modules/react-router/README.md +7 -0
  93. data/lib/node_modules/react-router/dist/development/chunk-KNED5TY2.mjs +10476 -0
  94. data/lib/node_modules/react-router/dist/development/dom-export.d.mts +23 -0
  95. data/lib/node_modules/react-router/dist/development/dom-export.d.ts +23 -0
  96. data/lib/node_modules/react-router/dist/development/dom-export.js +6111 -0
  97. data/lib/node_modules/react-router/dist/development/dom-export.mjs +234 -0
  98. data/lib/node_modules/react-router/dist/development/fog-of-war-1hWhK5ey.d.mts +1690 -0
  99. data/lib/node_modules/react-router/dist/development/fog-of-war-oa9CGk10.d.ts +1690 -0
  100. data/lib/node_modules/react-router/dist/development/future-ldDp5FKH.d.mts +21 -0
  101. data/lib/node_modules/react-router/dist/development/future-ldDp5FKH.d.ts +21 -0
  102. data/lib/node_modules/react-router/dist/development/index.d.mts +841 -0
  103. data/lib/node_modules/react-router/dist/development/index.d.ts +841 -0
  104. data/lib/node_modules/react-router/dist/development/index.js +10624 -0
  105. data/lib/node_modules/react-router/dist/development/index.mjs +242 -0
  106. data/lib/node_modules/react-router/dist/development/lib/types/route-module.d.mts +209 -0
  107. data/lib/node_modules/react-router/dist/development/lib/types/route-module.d.ts +209 -0
  108. data/lib/node_modules/react-router/dist/development/lib/types/route-module.js +28 -0
  109. data/lib/node_modules/react-router/dist/development/lib/types/route-module.mjs +10 -0
  110. data/lib/node_modules/react-router/dist/development/route-data-5OzAzQtT.d.mts +1716 -0
  111. data/lib/node_modules/react-router/dist/development/route-data-5OzAzQtT.d.ts +1716 -0
  112. data/lib/node_modules/react-router/dist/production/chunk-ZIM7OIE3.mjs +10476 -0
  113. data/lib/node_modules/react-router/dist/production/dom-export.d.mts +23 -0
  114. data/lib/node_modules/react-router/dist/production/dom-export.d.ts +23 -0
  115. data/lib/node_modules/react-router/dist/production/dom-export.js +6111 -0
  116. data/lib/node_modules/react-router/dist/production/dom-export.mjs +234 -0
  117. data/lib/node_modules/react-router/dist/production/fog-of-war-1hWhK5ey.d.mts +1690 -0
  118. data/lib/node_modules/react-router/dist/production/fog-of-war-oa9CGk10.d.ts +1690 -0
  119. data/lib/node_modules/react-router/dist/production/future-ldDp5FKH.d.mts +21 -0
  120. data/lib/node_modules/react-router/dist/production/future-ldDp5FKH.d.ts +21 -0
  121. data/lib/node_modules/react-router/dist/production/index.d.mts +841 -0
  122. data/lib/node_modules/react-router/dist/production/index.d.ts +841 -0
  123. data/lib/node_modules/react-router/dist/production/index.js +10624 -0
  124. data/lib/node_modules/react-router/dist/production/index.mjs +242 -0
  125. data/lib/node_modules/react-router/dist/production/lib/types/route-module.d.mts +209 -0
  126. data/lib/node_modules/react-router/dist/production/lib/types/route-module.d.ts +209 -0
  127. data/lib/node_modules/react-router/dist/production/lib/types/route-module.js +28 -0
  128. data/lib/node_modules/react-router/dist/production/lib/types/route-module.mjs +10 -0
  129. data/lib/node_modules/react-router/dist/production/route-data-5OzAzQtT.d.mts +1716 -0
  130. data/lib/node_modules/react-router/dist/production/route-data-5OzAzQtT.d.ts +1716 -0
  131. data/lib/node_modules/react-router/package.json +116 -0
  132. data/lib/node_modules/react-router-dom/LICENSE.md +23 -0
  133. data/lib/node_modules/react-router-dom/README.md +6 -0
  134. data/lib/node_modules/react-router-dom/dist/index.d.mts +2 -0
  135. data/lib/node_modules/react-router-dom/dist/index.d.ts +2 -0
  136. data/lib/node_modules/react-router-dom/dist/index.js +45 -0
  137. data/lib/node_modules/react-router-dom/dist/index.mjs +18 -0
  138. data/lib/node_modules/react-router-dom/package.json +82 -0
  139. data/lib/node_modules/scheduler/LICENSE +21 -0
  140. data/lib/node_modules/scheduler/README.md +9 -0
  141. data/lib/node_modules/scheduler/cjs/scheduler-unstable_mock.development.js +700 -0
  142. data/lib/node_modules/scheduler/cjs/scheduler-unstable_mock.production.min.js +20 -0
  143. data/lib/node_modules/scheduler/cjs/scheduler-unstable_post_task.development.js +207 -0
  144. data/lib/node_modules/scheduler/cjs/scheduler-unstable_post_task.production.min.js +14 -0
  145. data/lib/node_modules/scheduler/cjs/scheduler.development.js +634 -0
  146. data/lib/node_modules/scheduler/cjs/scheduler.production.min.js +19 -0
  147. data/lib/node_modules/scheduler/index.js +7 -0
  148. data/lib/node_modules/scheduler/package.json +36 -0
  149. data/lib/node_modules/scheduler/umd/scheduler-unstable_mock.development.js +699 -0
  150. data/lib/node_modules/scheduler/umd/scheduler-unstable_mock.production.min.js +19 -0
  151. data/lib/node_modules/scheduler/umd/scheduler.development.js +152 -0
  152. data/lib/node_modules/scheduler/umd/scheduler.production.min.js +146 -0
  153. data/lib/node_modules/scheduler/umd/scheduler.profiling.min.js +146 -0
  154. data/lib/node_modules/scheduler/unstable_mock.js +7 -0
  155. data/lib/node_modules/scheduler/unstable_post_task.js +7 -0
  156. data/lib/node_modules/set-cookie-parser/LICENSE +21 -0
  157. data/lib/node_modules/set-cookie-parser/README.md +202 -0
  158. data/lib/node_modules/set-cookie-parser/lib/set-cookie.js +224 -0
  159. data/lib/node_modules/set-cookie-parser/package.json +45 -0
  160. data/lib/node_modules/turbo-stream/LICENSE +7 -0
  161. data/lib/node_modules/turbo-stream/README.md +31 -0
  162. data/lib/node_modules/turbo-stream/dist/flatten.d.ts +2 -0
  163. data/lib/node_modules/turbo-stream/dist/flatten.js +203 -0
  164. data/lib/node_modules/turbo-stream/dist/turbo-stream.d.ts +13 -0
  165. data/lib/node_modules/turbo-stream/dist/turbo-stream.js +207 -0
  166. data/lib/node_modules/turbo-stream/dist/turbo-stream.mjs +673 -0
  167. data/lib/node_modules/turbo-stream/dist/unflatten.d.ts +2 -0
  168. data/lib/node_modules/turbo-stream/dist/unflatten.js +243 -0
  169. data/lib/node_modules/turbo-stream/dist/utils.d.ts +44 -0
  170. data/lib/node_modules/turbo-stream/dist/utils.js +55 -0
  171. data/lib/node_modules/turbo-stream/package.json +50 -0
  172. data/lib/package-lock.json +133 -0
  173. data/lib/package.json +12 -0
  174. data/lib/rubee/controllers/base_controller.rb +14 -0
  175. data/lib/rubee.rb +58 -19
  176. data/lib/tests/rubeeapp_test.rb +17 -0
  177. data/lib/tests/test.db +0 -0
  178. data/lib/tests/user_model_test.rb +1 -0
  179. data/readme.md +104 -2
  180. metadata +170 -3
@@ -0,0 +1,239 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parse = parse;
4
+ exports.serialize = serialize;
5
+ /**
6
+ * RegExp to match cookie-name in RFC 6265 sec 4.1.1
7
+ * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
8
+ * which has been replaced by the token definition in RFC 7230 appendix B.
9
+ *
10
+ * cookie-name = token
11
+ * token = 1*tchar
12
+ * tchar = "!" / "#" / "$" / "%" / "&" / "'" /
13
+ * "*" / "+" / "-" / "." / "^" / "_" /
14
+ * "`" / "|" / "~" / DIGIT / ALPHA
15
+ *
16
+ * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
17
+ * Allow same range as cookie value, except `=`, which delimits end of name.
18
+ */
19
+ const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
20
+ /**
21
+ * RegExp to match cookie-value in RFC 6265 sec 4.1.1
22
+ *
23
+ * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
24
+ * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
25
+ * ; US-ASCII characters excluding CTLs,
26
+ * ; whitespace DQUOTE, comma, semicolon,
27
+ * ; and backslash
28
+ *
29
+ * Allowing more characters: https://github.com/jshttp/cookie/issues/191
30
+ * Comma, backslash, and DQUOTE are not part of the parsing algorithm.
31
+ */
32
+ const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
33
+ /**
34
+ * RegExp to match domain-value in RFC 6265 sec 4.1.1
35
+ *
36
+ * domain-value = <subdomain>
37
+ * ; defined in [RFC1034], Section 3.5, as
38
+ * ; enhanced by [RFC1123], Section 2.1
39
+ * <subdomain> = <label> | <subdomain> "." <label>
40
+ * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
41
+ * Labels must be 63 characters or less.
42
+ * 'let-dig' not 'letter' in the first char, per RFC1123
43
+ * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
44
+ * <let-dig-hyp> = <let-dig> | "-"
45
+ * <let-dig> = <letter> | <digit>
46
+ * <letter> = any one of the 52 alphabetic characters A through Z in
47
+ * upper case and a through z in lower case
48
+ * <digit> = any one of the ten digits 0 through 9
49
+ *
50
+ * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
51
+ *
52
+ * > (Note that a leading %x2E ("."), if present, is ignored even though that
53
+ * character is not permitted, but a trailing %x2E ("."), if present, will
54
+ * cause the user agent to ignore the attribute.)
55
+ */
56
+ const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
57
+ /**
58
+ * RegExp to match path-value in RFC 6265 sec 4.1.1
59
+ *
60
+ * path-value = <any CHAR except CTLs or ";">
61
+ * CHAR = %x01-7F
62
+ * ; defined in RFC 5234 appendix B.1
63
+ */
64
+ const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
65
+ const __toString = Object.prototype.toString;
66
+ const NullObject = /* @__PURE__ */ (() => {
67
+ const C = function () { };
68
+ C.prototype = Object.create(null);
69
+ return C;
70
+ })();
71
+ /**
72
+ * Parse a cookie header.
73
+ *
74
+ * Parse the given cookie header string into an object
75
+ * The object has the various cookies as keys(names) => values
76
+ */
77
+ function parse(str, options) {
78
+ const obj = new NullObject();
79
+ const len = str.length;
80
+ // RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
81
+ if (len < 2)
82
+ return obj;
83
+ const dec = options?.decode || decode;
84
+ let index = 0;
85
+ do {
86
+ const eqIdx = str.indexOf("=", index);
87
+ if (eqIdx === -1)
88
+ break; // No more cookie pairs.
89
+ const colonIdx = str.indexOf(";", index);
90
+ const endIdx = colonIdx === -1 ? len : colonIdx;
91
+ if (eqIdx > endIdx) {
92
+ // backtrack on prior semicolon
93
+ index = str.lastIndexOf(";", eqIdx - 1) + 1;
94
+ continue;
95
+ }
96
+ const keyStartIdx = startIndex(str, index, eqIdx);
97
+ const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
98
+ const key = str.slice(keyStartIdx, keyEndIdx);
99
+ // only assign once
100
+ if (obj[key] === undefined) {
101
+ let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
102
+ let valEndIdx = endIndex(str, endIdx, valStartIdx);
103
+ const value = dec(str.slice(valStartIdx, valEndIdx));
104
+ obj[key] = value;
105
+ }
106
+ index = endIdx + 1;
107
+ } while (index < len);
108
+ return obj;
109
+ }
110
+ function startIndex(str, index, max) {
111
+ do {
112
+ const code = str.charCodeAt(index);
113
+ if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
114
+ return index;
115
+ } while (++index < max);
116
+ return max;
117
+ }
118
+ function endIndex(str, index, min) {
119
+ while (index > min) {
120
+ const code = str.charCodeAt(--index);
121
+ if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
122
+ return index + 1;
123
+ }
124
+ return min;
125
+ }
126
+ /**
127
+ * Serialize data into a cookie header.
128
+ *
129
+ * Serialize a name value pair into a cookie string suitable for
130
+ * http headers. An optional options object specifies cookie parameters.
131
+ *
132
+ * serialize('foo', 'bar', { httpOnly: true })
133
+ * => "foo=bar; httpOnly"
134
+ */
135
+ function serialize(name, val, options) {
136
+ const enc = options?.encode || encodeURIComponent;
137
+ if (!cookieNameRegExp.test(name)) {
138
+ throw new TypeError(`argument name is invalid: ${name}`);
139
+ }
140
+ const value = enc(val);
141
+ if (!cookieValueRegExp.test(value)) {
142
+ throw new TypeError(`argument val is invalid: ${val}`);
143
+ }
144
+ let str = name + "=" + value;
145
+ if (!options)
146
+ return str;
147
+ if (options.maxAge !== undefined) {
148
+ if (!Number.isInteger(options.maxAge)) {
149
+ throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
150
+ }
151
+ str += "; Max-Age=" + options.maxAge;
152
+ }
153
+ if (options.domain) {
154
+ if (!domainValueRegExp.test(options.domain)) {
155
+ throw new TypeError(`option domain is invalid: ${options.domain}`);
156
+ }
157
+ str += "; Domain=" + options.domain;
158
+ }
159
+ if (options.path) {
160
+ if (!pathValueRegExp.test(options.path)) {
161
+ throw new TypeError(`option path is invalid: ${options.path}`);
162
+ }
163
+ str += "; Path=" + options.path;
164
+ }
165
+ if (options.expires) {
166
+ if (!isDate(options.expires) ||
167
+ !Number.isFinite(options.expires.valueOf())) {
168
+ throw new TypeError(`option expires is invalid: ${options.expires}`);
169
+ }
170
+ str += "; Expires=" + options.expires.toUTCString();
171
+ }
172
+ if (options.httpOnly) {
173
+ str += "; HttpOnly";
174
+ }
175
+ if (options.secure) {
176
+ str += "; Secure";
177
+ }
178
+ if (options.partitioned) {
179
+ str += "; Partitioned";
180
+ }
181
+ if (options.priority) {
182
+ const priority = typeof options.priority === "string"
183
+ ? options.priority.toLowerCase()
184
+ : undefined;
185
+ switch (priority) {
186
+ case "low":
187
+ str += "; Priority=Low";
188
+ break;
189
+ case "medium":
190
+ str += "; Priority=Medium";
191
+ break;
192
+ case "high":
193
+ str += "; Priority=High";
194
+ break;
195
+ default:
196
+ throw new TypeError(`option priority is invalid: ${options.priority}`);
197
+ }
198
+ }
199
+ if (options.sameSite) {
200
+ const sameSite = typeof options.sameSite === "string"
201
+ ? options.sameSite.toLowerCase()
202
+ : options.sameSite;
203
+ switch (sameSite) {
204
+ case true:
205
+ case "strict":
206
+ str += "; SameSite=Strict";
207
+ break;
208
+ case "lax":
209
+ str += "; SameSite=Lax";
210
+ break;
211
+ case "none":
212
+ str += "; SameSite=None";
213
+ break;
214
+ default:
215
+ throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
216
+ }
217
+ }
218
+ return str;
219
+ }
220
+ /**
221
+ * URL-decode string value. Optimized to skip native call when no %.
222
+ */
223
+ function decode(str) {
224
+ if (str.indexOf("%") === -1)
225
+ return str;
226
+ try {
227
+ return decodeURIComponent(str);
228
+ }
229
+ catch (e) {
230
+ return str;
231
+ }
232
+ }
233
+ /**
234
+ * Determine if value is a Date.
235
+ */
236
+ function isDate(val) {
237
+ return __toString.call(val) === "[object Date]";
238
+ }
239
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAiGA,sBA0CC;AA4GD,8BA6GC;AApWD;;;;;;;;;;;;;GAaG;AACH,MAAM,gBAAgB,GAAG,uCAAuC,CAAC;AAEjE;;;;;;;;;;;GAWG;AACH,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,iBAAiB,GACrB,qFAAqF,CAAC;AAExF;;;;;;GAMG;AACH,MAAM,eAAe,GAAG,iCAAiC,CAAC;AAE1D,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;AAE7C,MAAM,UAAU,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE;IACvC,MAAM,CAAC,GAAG,cAAa,CAAC,CAAC;IACzB,CAAC,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClC,OAAO,CAAC,CAAC;AACX,CAAC,CAAC,EAAgC,CAAC;AAoBnC;;;;;GAKG;AACH,SAAgB,KAAK,CACnB,GAAW,EACX,OAAsB;IAEtB,MAAM,GAAG,GAAuC,IAAI,UAAU,EAAE,CAAC;IACjE,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC;IACvB,iGAAiG;IACjG,IAAI,GAAG,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IAExB,MAAM,GAAG,GAAG,OAAO,EAAE,MAAM,IAAI,MAAM,CAAC;IACtC,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,GAAG,CAAC;QACF,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACtC,IAAI,KAAK,KAAK,CAAC,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AAC;AACb,CAAC;AAED;;GAEG;AACH,SAAS,MAAM,CAAC,GAAW;IACzB,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAAE,OAAO,GAAG,CAAC;IAExC,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,MAAM,CAAC,GAAQ;IACtB,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,eAAe,CAAC;AAClD,CAAC","sourcesContent":["/**\n * RegExp to match cookie-name in RFC 6265 sec 4.1.1\n * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2\n * which has been replaced by the token definition in RFC 7230 appendix B.\n *\n * cookie-name = token\n * token = 1*tchar\n * tchar = \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" /\n * \"*\" / \"+\" / \"-\" / \".\" / \"^\" / \"_\" /\n * \"`\" / \"|\" / \"~\" / DIGIT / ALPHA\n *\n * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191\n * Allow same range as cookie value, except `=`, which delimits end of name.\n */\nconst cookieNameRegExp = /^[\\u0021-\\u003A\\u003C\\u003E-\\u007E]+$/;\n\n/**\n * RegExp to match cookie-value in RFC 6265 sec 4.1.1\n *\n * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )\n * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E\n * ; US-ASCII characters excluding CTLs,\n * ; whitespace DQUOTE, comma, semicolon,\n * ; and backslash\n *\n * Allowing more characters: https://github.com/jshttp/cookie/issues/191\n * Comma, backslash, and DQUOTE are not part of the parsing algorithm.\n */\nconst cookieValueRegExp = /^[\\u0021-\\u003A\\u003C-\\u007E]*$/;\n\n/**\n * RegExp to match domain-value in RFC 6265 sec 4.1.1\n *\n * domain-value = <subdomain>\n * ; defined in [RFC1034], Section 3.5, as\n * ; enhanced by [RFC1123], Section 2.1\n * <subdomain> = <label> | <subdomain> \".\" <label>\n * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]\n * Labels must be 63 characters or less.\n * 'let-dig' not 'letter' in the first char, per RFC1123\n * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>\n * <let-dig-hyp> = <let-dig> | \"-\"\n * <let-dig> = <letter> | <digit>\n * <letter> = any one of the 52 alphabetic characters A through Z in\n * upper case and a through z in lower case\n * <digit> = any one of the ten digits 0 through 9\n *\n * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173\n *\n * > (Note that a leading %x2E (\".\"), if present, is ignored even though that\n * character is not permitted, but a trailing %x2E (\".\"), if present, will\n * cause the user agent to ignore the attribute.)\n */\nconst domainValueRegExp =\n /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;\n\n/**\n * RegExp to match path-value in RFC 6265 sec 4.1.1\n *\n * path-value = <any CHAR except CTLs or \";\">\n * CHAR = %x01-7F\n * ; defined in RFC 5234 appendix B.1\n */\nconst pathValueRegExp = /^[\\u0020-\\u003A\\u003D-\\u007E]*$/;\n\nconst __toString = Object.prototype.toString;\n\nconst NullObject = /* @__PURE__ */ (() => {\n const C = function () {};\n C.prototype = Object.create(null);\n return C;\n})() as unknown as { new (): any };\n\n/**\n * Parse options.\n */\nexport interface ParseOptions {\n /**\n * Specifies a function that will be used to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).\n * Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode\n * a previously-encoded cookie value into a JavaScript string.\n *\n * The default function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error\n * is thrown it will return the cookie's original value. If you provide your own encode/decode\n * scheme you must ensure errors are appropriately handled.\n *\n * @default decode\n */\n decode?: (str: string) => string | undefined;\n}\n\n/**\n * Parse a cookie header.\n *\n * Parse the given cookie header string into an object\n * The object has the various cookies as keys(names) => values\n */\nexport function parse(\n str: string,\n options?: ParseOptions,\n): Record<string, string | undefined> {\n const obj: Record<string, string | undefined> = new NullObject();\n const len = str.length;\n // RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.\n if (len < 2) return obj;\n\n const dec = options?.decode || decode;\n let index = 0;\n\n do {\n const eqIdx = str.indexOf(\"=\", index);\n if (eqIdx === -1) break; // No more cookie pairs.\n\n const colonIdx = str.indexOf(\";\", index);\n const endIdx = colonIdx === -1 ? len : colonIdx;\n\n if (eqIdx > endIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(\";\", eqIdx - 1) + 1;\n continue;\n }\n\n const keyStartIdx = startIndex(str, index, eqIdx);\n const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);\n const key = str.slice(keyStartIdx, keyEndIdx);\n\n // only assign once\n if (obj[key] === undefined) {\n let valStartIdx = startIndex(str, eqIdx + 1, endIdx);\n let valEndIdx = endIndex(str, endIdx, valStartIdx);\n\n const value = dec(str.slice(valStartIdx, valEndIdx));\n obj[key] = value;\n }\n\n index = endIdx + 1;\n } while (index < len);\n\n return obj;\n}\n\nfunction startIndex(str: string, index: number, max: number) {\n do {\n const code = str.charCodeAt(index);\n if (code !== 0x20 /* */ && code !== 0x09 /* \\t */) return index;\n } while (++index < max);\n return max;\n}\n\nfunction endIndex(str: string, index: number, min: number) {\n while (index > min) {\n const code = str.charCodeAt(--index);\n if (code !== 0x20 /* */ && code !== 0x09 /* \\t */) return index + 1;\n }\n return min;\n}\n\n/**\n * Serialize options.\n */\nexport interface SerializeOptions {\n /**\n * Specifies a function that will be used to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).\n * Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode\n * a value into a string suited for a cookie's value, and should mirror `decode` when parsing.\n *\n * @default encodeURIComponent\n */\n encode?: (str: string) => string;\n /**\n * Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2).\n *\n * The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and\n * `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,\n * so if both are set, they should point to the same date and time.\n */\n maxAge?: number;\n /**\n * Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1).\n * When no expiration is set clients consider this a \"non-persistent cookie\" and delete it the current session is over.\n *\n * The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and\n * `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,\n * so if both are set, they should point to the same date and time.\n */\n expires?: Date;\n /**\n * Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3).\n * When no domain is set clients consider the cookie to apply to the current domain only.\n */\n domain?: string;\n /**\n * Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4).\n * When no path is set, the path is considered the [\"default path\"](https://tools.ietf.org/html/rfc6265#section-5.1.4).\n */\n path?: string;\n /**\n * Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6).\n * When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`.\n */\n httpOnly?: boolean;\n /**\n * Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5).\n * When enabled, clients will only send the cookie back if the browser has a HTTPS connection.\n */\n secure?: boolean;\n /**\n * Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/).\n * When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches.\n *\n * This is an attribute that has not yet been fully standardized, and may change in the future.\n * This also means clients may ignore this attribute until they understand it. More information\n * about can be found in [the proposal](https://github.com/privacycg/CHIPS).\n */\n partitioned?: boolean;\n /**\n * Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).\n *\n * - `'low'` will set the `Priority` attribute to `Low`.\n * - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.\n * - `'high'` will set the `Priority` attribute to `High`.\n *\n * More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).\n */\n priority?: \"low\" | \"medium\" | \"high\";\n /**\n * Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).\n *\n * - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.\n * - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.\n * - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.\n * - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.\n *\n * More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).\n */\n sameSite?: boolean | \"lax\" | \"strict\" | \"none\";\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize a name value pair into a cookie string suitable for\n * http headers. An optional options object specifies cookie parameters.\n *\n * serialize('foo', 'bar', { httpOnly: true })\n * => \"foo=bar; httpOnly\"\n */\nexport function serialize(\n name: string,\n val: string,\n options?: SerializeOptions,\n): string {\n const enc = options?.encode || encodeURIComponent;\n\n if (!cookieNameRegExp.test(name)) {\n throw new TypeError(`argument name is invalid: ${name}`);\n }\n\n const value = enc(val);\n\n if (!cookieValueRegExp.test(value)) {\n throw new TypeError(`argument val is invalid: ${val}`);\n }\n\n let str = name + \"=\" + value;\n if (!options) return str;\n\n if (options.maxAge !== undefined) {\n if (!Number.isInteger(options.maxAge)) {\n throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);\n }\n\n str += \"; Max-Age=\" + options.maxAge;\n }\n\n if (options.domain) {\n if (!domainValueRegExp.test(options.domain)) {\n throw new TypeError(`option domain is invalid: ${options.domain}`);\n }\n\n str += \"; Domain=\" + options.domain;\n }\n\n if (options.path) {\n if (!pathValueRegExp.test(options.path)) {\n throw new TypeError(`option path is invalid: ${options.path}`);\n }\n\n str += \"; Path=\" + options.path;\n }\n\n if (options.expires) {\n if (\n !isDate(options.expires) ||\n !Number.isFinite(options.expires.valueOf())\n ) {\n throw new TypeError(`option expires is invalid: ${options.expires}`);\n }\n\n str += \"; Expires=\" + options.expires.toUTCString();\n }\n\n if (options.httpOnly) {\n str += \"; HttpOnly\";\n }\n\n if (options.secure) {\n str += \"; Secure\";\n }\n\n if (options.partitioned) {\n str += \"; Partitioned\";\n }\n\n if (options.priority) {\n const priority =\n typeof options.priority === \"string\"\n ? options.priority.toLowerCase()\n : undefined;\n switch (priority) {\n case \"low\":\n str += \"; Priority=Low\";\n break;\n case \"medium\":\n str += \"; Priority=Medium\";\n break;\n case \"high\":\n str += \"; Priority=High\";\n break;\n default:\n throw new TypeError(`option priority is invalid: ${options.priority}`);\n }\n }\n\n if (options.sameSite) {\n const sameSite =\n typeof options.sameSite === \"string\"\n ? options.sameSite.toLowerCase()\n : options.sameSite;\n switch (sameSite) {\n case true:\n case \"strict\":\n str += \"; SameSite=Strict\";\n break;\n case \"lax\":\n str += \"; SameSite=Lax\";\n break;\n case \"none\":\n str += \"; SameSite=None\";\n break;\n default:\n throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);\n }\n }\n\n return str;\n}\n\n/**\n * URL-decode string value. Optimized to skip native call when no %.\n */\nfunction decode(str: string): string {\n if (str.indexOf(\"%\") === -1) return str;\n\n try {\n return decodeURIComponent(str);\n } catch (e) {\n return str;\n }\n}\n\n/**\n * Determine if value is a Date.\n */\nfunction isDate(val: any): val is Date {\n return __toString.call(val) === \"[object Date]\";\n}\n"]}
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "cookie",
3
+ "version": "1.0.2",
4
+ "description": "HTTP server cookie parsing and serialization",
5
+ "keywords": [
6
+ "cookie",
7
+ "cookies"
8
+ ],
9
+ "repository": "jshttp/cookie",
10
+ "license": "MIT",
11
+ "author": "Roman Shtylman <shtylman@gmail.com>",
12
+ "contributors": [
13
+ "Douglas Christopher Wilson <doug@somethingdoug.com>"
14
+ ],
15
+ "main": "dist/index.js",
16
+ "types": "dist/index.d.ts",
17
+ "files": [
18
+ "dist/"
19
+ ],
20
+ "scripts": {
21
+ "bench": "vitest bench",
22
+ "build": "ts-scripts build",
23
+ "format": "ts-scripts format",
24
+ "prepare": "ts-scripts install",
25
+ "prepublishOnly": "npm run build",
26
+ "specs": "ts-scripts specs",
27
+ "test": "ts-scripts test"
28
+ },
29
+ "devDependencies": {
30
+ "@borderless/ts-scripts": "^0.15.0",
31
+ "@vitest/coverage-v8": "^2.1.2",
32
+ "top-sites": "1.1.194",
33
+ "typescript": "^5.6.2",
34
+ "vitest": "^2.1.2"
35
+ },
36
+ "engines": {
37
+ "node": ">=18"
38
+ },
39
+ "ts-scripts": {
40
+ "project": "tsconfig.build.json"
41
+ }
42
+ }
@@ -0,0 +1,151 @@
1
+ ### Version 4.0.0 (2018-01-28) ###
2
+
3
+ - Added: Support for ES2018. The only change needed was recognizing the `s`
4
+ regex flag.
5
+ - Changed: _All_ tokens returned by the `matchToToken` function now have a
6
+ `closed` property. It is set to `undefined` for the tokens where “closed”
7
+ doesn’t make sense. This means that all tokens objects have the same shape,
8
+ which might improve performance.
9
+
10
+ These are the breaking changes:
11
+
12
+ - `'/a/s'.match(jsTokens)` no longer returns `['/', 'a', '/', 's']`, but
13
+ `['/a/s']`. (There are of course other variations of this.)
14
+ - Code that rely on some token objects not having the `closed` property could
15
+ now behave differently.
16
+
17
+
18
+ ### Version 3.0.2 (2017-06-28) ###
19
+
20
+ - No code changes. Just updates to the readme.
21
+
22
+
23
+ ### Version 3.0.1 (2017-01-30) ###
24
+
25
+ - Fixed: ES2015 unicode escapes with more than 6 hex digits are now matched
26
+ correctly.
27
+
28
+
29
+ ### Version 3.0.0 (2017-01-11) ###
30
+
31
+ This release contains one breaking change, that should [improve performance in
32
+ V8][v8-perf]:
33
+
34
+ > So how can you, as a JavaScript developer, ensure that your RegExps are fast?
35
+ > If you are not interested in hooking into RegExp internals, make sure that
36
+ > neither the RegExp instance, nor its prototype is modified in order to get the
37
+ > best performance:
38
+ >
39
+ > ```js
40
+ > var re = /./g;
41
+ > re.exec(''); // Fast path.
42
+ > re.new_property = 'slow';
43
+ > ```
44
+
45
+ This module used to export a single regex, with `.matchToToken` bolted
46
+ on, just like in the above example. This release changes the exports of
47
+ the module to avoid this issue.
48
+
49
+ Before:
50
+
51
+ ```js
52
+ import jsTokens from "js-tokens"
53
+ // or:
54
+ var jsTokens = require("js-tokens")
55
+ var matchToToken = jsTokens.matchToToken
56
+ ```
57
+
58
+ After:
59
+
60
+ ```js
61
+ import jsTokens, {matchToToken} from "js-tokens"
62
+ // or:
63
+ var jsTokens = require("js-tokens").default
64
+ var matchToToken = require("js-tokens").matchToToken
65
+ ```
66
+
67
+ [v8-perf]: http://v8project.blogspot.se/2017/01/speeding-up-v8-regular-expressions.html
68
+
69
+
70
+ ### Version 2.0.0 (2016-06-19) ###
71
+
72
+ - Added: Support for ES2016. In other words, support for the `**` exponentiation
73
+ operator.
74
+
75
+ These are the breaking changes:
76
+
77
+ - `'**'.match(jsTokens)` no longer returns `['*', '*']`, but `['**']`.
78
+ - `'**='.match(jsTokens)` no longer returns `['*', '*=']`, but `['**=']`.
79
+
80
+
81
+ ### Version 1.0.3 (2016-03-27) ###
82
+
83
+ - Improved: Made the regex ever so slightly smaller.
84
+ - Updated: The readme.
85
+
86
+
87
+ ### Version 1.0.2 (2015-10-18) ###
88
+
89
+ - Improved: Limited npm package contents for a smaller download. Thanks to
90
+ @zertosh!
91
+
92
+
93
+ ### Version 1.0.1 (2015-06-20) ###
94
+
95
+ - Fixed: Declared an undeclared variable.
96
+
97
+
98
+ ### Version 1.0.0 (2015-02-26) ###
99
+
100
+ - Changed: Merged the 'operator' and 'punctuation' types into 'punctuator'. That
101
+ type is now equivalent to the Punctuator token in the ECMAScript
102
+ specification. (Backwards-incompatible change.)
103
+ - Fixed: A `-` followed by a number is now correctly matched as a punctuator
104
+ followed by a number. It used to be matched as just a number, but there is no
105
+ such thing as negative number literals. (Possibly backwards-incompatible
106
+ change.)
107
+
108
+
109
+ ### Version 0.4.1 (2015-02-21) ###
110
+
111
+ - Added: Support for the regex `u` flag.
112
+
113
+
114
+ ### Version 0.4.0 (2015-02-21) ###
115
+
116
+ - Improved: `jsTokens.matchToToken` performance.
117
+ - Added: Support for octal and binary number literals.
118
+ - Added: Support for template strings.
119
+
120
+
121
+ ### Version 0.3.1 (2015-01-06) ###
122
+
123
+ - Fixed: Support for unicode spaces. They used to be allowed in names (which is
124
+ very confusing), and some unicode newlines were wrongly allowed in strings and
125
+ regexes.
126
+
127
+
128
+ ### Version 0.3.0 (2014-12-19) ###
129
+
130
+ - Changed: The `jsTokens.names` array has been replaced with the
131
+ `jsTokens.matchToToken` function. The capturing groups of `jsTokens` are no
132
+ longer part of the public API; instead use said function. See this [gist] for
133
+ an example. (Backwards-incompatible change.)
134
+ - Changed: The empty string is now considered an “invalid” token, instead an
135
+ “empty” token (its own group). (Backwards-incompatible change.)
136
+ - Removed: component support. (Backwards-incompatible change.)
137
+
138
+ [gist]: https://gist.github.com/lydell/be49dbf80c382c473004
139
+
140
+
141
+ ### Version 0.2.0 (2014-06-19) ###
142
+
143
+ - Changed: Match ES6 function arrows (`=>`) as an operator, instead of its own
144
+ category (“functionArrow”), for simplicity. (Backwards-incompatible change.)
145
+ - Added: ES6 splats (`...`) are now matched as an operator (instead of three
146
+ punctuations). (Backwards-incompatible change.)
147
+
148
+
149
+ ### Version 0.1.0 (2014-03-08) ###
150
+
151
+ - Initial release.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014, 2015, 2016, 2017, 2018 Simon Lydell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.