optimize-js 1.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.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.travis.yml +16 -0
- data/Gemfile +6 -0
- data/LICENCE +21 -0
- data/OPTIMIZE-JS-LICENCE +202 -0
- data/README.md +71 -0
- data/Rakefile +49 -0
- data/lib/optimize-js.rb +28 -0
- data/lib/optimize-js/railtie.rb +23 -0
- data/lib/optimize-js/sprockets-processor.rb +30 -0
- data/lib/optimize-js/version.rb +7 -0
- data/optimize-js.gemspec +26 -0
- data/optimize-js.web.min.js +5 -0
- data/test/test-optimize-js.rb +11 -0
- metadata +101 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 5818833f98f2c2c005c3ae8c322ac3c0556c4ee6
|
|
4
|
+
data.tar.gz: 4ac707ea5c764dc4bce01f7f976a8d98f78ac73b
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 535cd9fa59a2a1685e8d68e65fa397f8b49b3dd4294cdac991d0562578c22ea6c28967ebf716148c94fae6af8b6740f09681c4ea69fa21675e3b258855c6efe4
|
|
7
|
+
data.tar.gz: e41be5673b6d16878d5bcd9e725b45e3f6c0b729e9773d5c3a59d4d557e81dbf023e5177353ac69884b33e382b15023059df93496460363a11ea16840d8e8712
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENCE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Yaroslav Konoplov
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
data/OPTIMIZE-JS-LICENCE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
data/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
## Ruby wrapper and Rails asset pipeline integration for [optimize-js](https://github.com/nolanlawson/optimize-js).
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/yivo/optimize-js)
|
|
4
|
+
|
|
5
|
+
## About
|
|
6
|
+
This gem is ruby wrapper for [optimize-js](https://github.com/nolanlawson/optimize-js). It allows you to invoke optimize-js from ruby. For Rails users this gem automatically integrates optimize-js into sprockets.
|
|
7
|
+
|
|
8
|
+
## Installing gem
|
|
9
|
+
|
|
10
|
+
**If you are using bundler.**
|
|
11
|
+
<br>
|
|
12
|
+
Add to your Gemfile:
|
|
13
|
+
```ruby
|
|
14
|
+
gem 'optimize-js', '~> 1.0'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**If you are not using bundler.**
|
|
18
|
+
<br>
|
|
19
|
+
Run in your terminal:
|
|
20
|
+
```
|
|
21
|
+
gem install optimize-js
|
|
22
|
+
```
|
|
23
|
+
Require gem in your ruby sources:
|
|
24
|
+
```ruby
|
|
25
|
+
require 'optimize-js'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Using gem
|
|
29
|
+
API is quite simple.
|
|
30
|
+
```ruby
|
|
31
|
+
# OptimizeJS.perform(javascript_source, optimize_js_options)
|
|
32
|
+
|
|
33
|
+
OptimizeJS.perform('!function() {}()') # => !(function() {})()
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Using in Rails
|
|
37
|
+
There is no need to do anything.
|
|
38
|
+
<br>
|
|
39
|
+
Gem will automatically register `OptimizeJS::SprocketsProcessor` using `register_bundle_processor` so all your JavaScript assets will be optimized.
|
|
40
|
+
|
|
41
|
+
## Updating optimize-js to the latest version
|
|
42
|
+
1. Install gem dependencies: `bundle install`
|
|
43
|
+
2. Run: `bundle exec rake optimize_js`
|
|
44
|
+
|
|
45
|
+
This rake task will do several things:
|
|
46
|
+
1. Clone latest git tag
|
|
47
|
+
2. Install npm dependencies
|
|
48
|
+
3. Install browserify
|
|
49
|
+
4. Install uglifyjs
|
|
50
|
+
5. Make web-version
|
|
51
|
+
6. Minify web-version
|
|
52
|
+
7. Write version to optimize-js/version.rb
|
|
53
|
+
8. Cleanup
|
|
54
|
+
|
|
55
|
+
## Running tests
|
|
56
|
+
1. Install gem dependencies: `bundle install`
|
|
57
|
+
2. Run tests: `bundle exec rake test`
|
|
58
|
+
|
|
59
|
+
## Things to work on
|
|
60
|
+
1. Write integration tests.
|
|
61
|
+
2. Test on different versions of sprockets.
|
|
62
|
+
3. Test on different versions of rails.
|
|
63
|
+
4. Test on different versions of ruby.
|
|
64
|
+
5. Sprockets without Rails.
|
|
65
|
+
6. Typos in README.
|
|
66
|
+
|
|
67
|
+
## Licence
|
|
68
|
+
[JavaScript Library Licence](https://github.com/yivo/optimize-js/blob/master/OPTIMIZE-JS-LICENCE)
|
|
69
|
+
<br>
|
|
70
|
+
[Ruby Gem Licence](https://github.com/yivo/optimize-js/blob/master/LICENCE)
|
|
71
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'bundler'
|
|
5
|
+
require 'bundler/setup'
|
|
6
|
+
require 'json'
|
|
7
|
+
require 'rake/testtask'
|
|
8
|
+
|
|
9
|
+
Rake::TestTask.new { |t| t.libs << 'test' }
|
|
10
|
+
|
|
11
|
+
task :optimize_js do
|
|
12
|
+
def cmd(description, command)
|
|
13
|
+
puts description
|
|
14
|
+
puts " => #{command}"
|
|
15
|
+
ret = `#{command}`
|
|
16
|
+
puts
|
|
17
|
+
ret
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
cmd 'Remove optimize-js repository', 'rm -rf optimize-js-repo'
|
|
21
|
+
|
|
22
|
+
tags = cmd 'Requesting optimize-js git tags...',
|
|
23
|
+
'curl https://api.github.com/repos/nolanlawson/optimize-js/tags'
|
|
24
|
+
|
|
25
|
+
cmd 'Cloning optimize-js repository...',
|
|
26
|
+
"git clone --single-branch --branch #{JSON.parse(tags)[0]['name']} --depth 1 --no-hardlinks https://github.com/nolanlawson/optimize-js.git optimize-js-repo"
|
|
27
|
+
|
|
28
|
+
version = JSON.parse(File.read('optimize-js-repo/package.json'))['version']
|
|
29
|
+
puts "optimize-js version: #{version}"
|
|
30
|
+
|
|
31
|
+
Dir.chdir 'optimize-js-repo' do
|
|
32
|
+
cmd 'Installing optimize-js dependencies...', 'npm install'
|
|
33
|
+
cmd 'Installing browserify...', 'npm install browserify'
|
|
34
|
+
cmd 'Installing uglifyjs...', 'npm install uglifyjs'
|
|
35
|
+
|
|
36
|
+
cmd 'Making web-version',
|
|
37
|
+
'node_modules/browserify/bin/cmd.js --standalone optimizeJS lib/index.js -o ../optimize-js.web.js'
|
|
38
|
+
|
|
39
|
+
cmd 'Minifying web-version',
|
|
40
|
+
'node_modules/uglifyjs/bin/uglifyjs ../optimize-js.web.js --compress --mangle --output ../optimize-js.web.min.js'
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
puts 'Writing version...'
|
|
44
|
+
content = File.read('lib/optimize-js/version.rb')
|
|
45
|
+
content = content.gsub(/JS_VERSION.*/, "JS_VERSION = '#{version}'")
|
|
46
|
+
File.open('lib/optimize-js/version.rb', 'w') { |f| f.write(content) }
|
|
47
|
+
|
|
48
|
+
cmd 'Cleaning out...', 'rm -rf optimize-js-repo optimize-js.web.js'
|
|
49
|
+
end
|
data/lib/optimize-js.rb
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'execjs'
|
|
5
|
+
|
|
6
|
+
module OptimizeJS
|
|
7
|
+
class << self
|
|
8
|
+
def perform(js, options = {})
|
|
9
|
+
@optimize_js ||= ExecJS.runtime.compile(js_path)
|
|
10
|
+
raise OptimizeJS::CompileError unless @optimize_js
|
|
11
|
+
@optimize_js.call(js_function, js, options)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def js_path
|
|
15
|
+
File.read(File.expand_path('../optimize-js.web.min.js', File.dirname(__FILE__)))
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def js_function
|
|
19
|
+
'optimizeJS'
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class CompileError < StandardError
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
require 'optimize-js/railtie' if defined?(Rails)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'optimize-js/sprockets-processor'
|
|
5
|
+
|
|
6
|
+
class OptimizeJS::Railtie < Rails::Railtie
|
|
7
|
+
def configure_assets(app)
|
|
8
|
+
if config.respond_to?(:assets) && config.assets.respond_to?(:configure)
|
|
9
|
+
# Rails 4.x, 5.x
|
|
10
|
+
config.assets.configure { |env| yield(env) }
|
|
11
|
+
else
|
|
12
|
+
# Rails 3.2
|
|
13
|
+
yield(app.assets)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
initializer 'sprockets.optimize_js', group: :all, after: 'sprockets.environment' do |app|
|
|
18
|
+
configure_assets(app) do |env|
|
|
19
|
+
# Sprockets 2, 3, and 4
|
|
20
|
+
env.register_bundle_processor 'application/javascript', OptimizeJS::SprocketsProcessor
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# Sprockets 2, 3 & 4 interface
|
|
5
|
+
# https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#registering-all-versions-of-sprockets-in-processors
|
|
6
|
+
class OptimizeJS::SprocketsProcessor
|
|
7
|
+
def initialize(filename, &block)
|
|
8
|
+
@filename = filename
|
|
9
|
+
@source = block.call
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def render(context, empty_hash_wtf)
|
|
13
|
+
self.class.run(@filename, @source, context)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class << self
|
|
17
|
+
def run(filename, source, context)
|
|
18
|
+
OptimizeJS.perform(source)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def call(input)
|
|
22
|
+
filename = input[:filename]
|
|
23
|
+
source = input[:data]
|
|
24
|
+
context = input[:environment].context_class.new(input)
|
|
25
|
+
|
|
26
|
+
result = run(filename, source, context)
|
|
27
|
+
context.metadata.merge(data: result)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/optimize-js.gemspec
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
$:.push File.expand_path('../lib', __FILE__)
|
|
5
|
+
require 'optimize-js/version'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |s|
|
|
8
|
+
s.name = 'optimize-js'
|
|
9
|
+
s.version = OptimizeJS::GEM_VERSION
|
|
10
|
+
s.author = 'Yaroslav Konoplov'
|
|
11
|
+
s.email = 'eahome00@gmail.com'
|
|
12
|
+
s.summary = 'Ruby wrapper and Rails asset pipeline integration for optimize-js.'
|
|
13
|
+
s.description = 'optimize-js makes JavaScript files load faster. This gem provider Ruby and Rails asset pipeline integration for optimize-js.'
|
|
14
|
+
s.homepage = 'https://github.com/yivo/optimize-js'
|
|
15
|
+
s.license = 'MIT'
|
|
16
|
+
|
|
17
|
+
s.executables = `git ls-files -z -- bin/*`.split("\x0").map{ |f| File.basename(f) }
|
|
18
|
+
s.files = `git ls-files -z`.split("\x0")
|
|
19
|
+
s.files += ['optimize-js.web.min.js']
|
|
20
|
+
s.test_files = `git ls-files -z -- {test,spec,features}/*`.split("\x0")
|
|
21
|
+
s.require_paths = ['lib']
|
|
22
|
+
|
|
23
|
+
s.add_dependency 'execjs', '>= 1'
|
|
24
|
+
s.add_development_dependency 'bundler', '~> 1.7'
|
|
25
|
+
s.add_development_dependency 'rake', '~> 10.0'
|
|
26
|
+
end
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.optimizeJS=t()}}(function(){var t;return function e(t,r,i){function n(o,a){if(!r[o]){if(!t[o]){var h="function"==typeof require&&require;if(!a&&h)return h(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var p=r[o]={exports:{}};t[o][0].call(p.exports,function(e){var r=t[o][1][e];return n(r?r:e)},p,p.exports,e,t,r,i)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o<i.length;o++)n(i[o]);return n}({1:[function(t,e){"use strict";function r(t,e){e=e||{};var r=i.parse(t),o=new n(t);s(r,{enter:function(e,r){function i(t){var e=r.arguments.indexOf(t);if(0===e){if("("===n&&"("===s&&")"===a)return!0}else if(e===r.arguments.length-1){if("("===s&&")"===a&&")"===h)return!0}else if("("===s&&")"===a)return!0;return!1}if("FunctionExpression"===e.type){var n=t.charAt(e.start-2),s=t.charAt(e.start-1),a=t.charAt(e.end),h=t.charAt(e.end+1);r&&"CallExpression"===r.type&&(r.arguments&&-1!==r.arguments.indexOf(e)?i(e)||(o=o.insertLeft(e.start,"(").insertRight(e.end,")")):r.callee===e&&"("!==s&&o.insertLeft(e.start,"(").insertRight(e.end,")"))}}});var a=o.toString();return e.sourceMap&&(a+="\n//# sourceMappingURL="+o.generateMap().toUrl()),a}var i=t("acorn"),n=t("magic-string"),s=t("estree-walker").walk;e.exports=r},{acorn:2,"estree-walker":5,"magic-string":8}],2:[function(e,r,i){!function(e,n){"object"==typeof i&&"undefined"!=typeof r?n(i):"function"==typeof t&&t.amd?t(["exports"],n):n(e.acorn=e.acorn||{})}(this,function(t){"use strict";function e(t,e){for(var r=65536,i=0;i<e.length;i+=2){if(r+=e[i],r>t)return!1;if(r+=e[i+1],r>=t)return!0}}function r(t,r){return 65>t?36===t:91>t?!0:97>t?95===t:123>t?!0:65535>=t?t>=170&&S.test(String.fromCharCode(t)):r===!1?!1:e(t,A)}function i(t,r){return 48>t?36===t:58>t?!0:65>t?!1:91>t?!0:97>t?95===t:123>t?!0:65535>=t?t>=170&&C.test(String.fromCharCode(t)):r===!1?!1:e(t,A)||e(t,_)}function n(t,e){return new L(t,{beforeExpr:!0,binop:e})}function s(t,e){return void 0===e&&(e={}),e.keyword=t,N[t]=new L(t,e)}function o(t){return 10===t||13===t||8232===t||8233==t}function a(t){return"[object Array]"===Object.prototype.toString.call(t)}function h(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function u(t,e){for(var r=1,i=0;;){B.lastIndex=i;var n=B.exec(t);if(!(n&&n.index<e))return new U(r,e-i);++r,i=n.index+n[0].length}}function p(t){var e={};for(var r in D)e[r]=t&&h(t,r)?t[r]:D[r];if(null==e.allowReserved&&(e.allowReserved=e.ecmaVersion<5),a(e.onToken)){var i=e.onToken;e.onToken=function(t){return i.push(t)}}return a(e.onComment)&&(e.onComment=c(e,e.onComment)),e}function c(t,e){return function(r,i,n,s,o,a){var h={type:r?"Block":"Line",value:i,start:n,end:s};t.locations&&(h.loc=new F(this,o,a)),t.ranges&&(h.range=[n,s]),e.push(h)}}function l(t){return new RegExp("^("+t.replace(/ /g,"|")+")$")}function f(t,e,r,i){return t.type=e,t.end=r,this.options.locations&&(t.loc.end=i),this.options.ranges&&(t.range[1]=r),t}function d(t,e,r,i){try{return new RegExp(t,e)}catch(n){if(void 0!==r)throw n instanceof SyntaxError&&i.raise(r,"Error parsing regular expression: "+n.message),n}}function m(t){return 65535>=t?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(1023&t)+56320))}function g(t,e){return new j(e,t).parse()}function v(t,e,r){var i=new j(r,t,e);return i.nextToken(),i.parseExpression()}function y(t,e){return new j(e,t)}var x={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",7:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},b="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",w={5:b,6:b+" const class extends export import super"},E="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿕ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞮꞰ-ꞷꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭥꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",k="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",S=new RegExp("["+E+"]"),C=new RegExp("["+E+k+"]");E=k=null;var A=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,10591,541],_=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239],L=function(t,e){void 0===e&&(e={}),this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop||null,this.updateContext=null},R={beforeExpr:!0},T={startsExpr:!0},N={},I={num:new L("num",T),regexp:new L("regexp",T),string:new L("string",T),name:new L("name",T),eof:new L("eof"),bracketL:new L("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new L("]"),braceL:new L("{",{beforeExpr:!0,startsExpr:!0}),braceR:new L("}"),parenL:new L("(",{beforeExpr:!0,startsExpr:!0}),parenR:new L(")"),comma:new L(",",R),semi:new L(";",R),colon:new L(":",R),dot:new L("."),question:new L("?",R),arrow:new L("=>",R),template:new L("template"),ellipsis:new L("...",R),backQuote:new L("`",T),dollarBraceL:new L("${",{beforeExpr:!0,startsExpr:!0}),eq:new L("=",{beforeExpr:!0,isAssign:!0}),assign:new L("_=",{beforeExpr:!0,isAssign:!0}),incDec:new L("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new L("prefix",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:n("||",1),logicalAND:n("&&",2),bitwiseOR:n("|",3),bitwiseXOR:n("^",4),bitwiseAND:n("&",5),equality:n("==/!=",6),relational:n("</>",7),bitShift:n("<</>>",8),plusMin:new L("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:n("%",10),star:n("*",10),slash:n("/",10),starstar:new L("**",{beforeExpr:!0}),_break:s("break"),_case:s("case",R),_catch:s("catch"),_continue:s("continue"),_debugger:s("debugger"),_default:s("default",R),_do:s("do",{isLoop:!0,beforeExpr:!0}),_else:s("else",R),_finally:s("finally"),_for:s("for",{isLoop:!0}),_function:s("function",T),_if:s("if"),_return:s("return",R),_switch:s("switch"),_throw:s("throw",R),_try:s("try"),_var:s("var"),_const:s("const"),_while:s("while",{isLoop:!0}),_with:s("with"),_new:s("new",{beforeExpr:!0,startsExpr:!0}),_this:s("this",T),_super:s("super",T),_class:s("class"),_extends:s("extends",R),_export:s("export"),_import:s("import"),_null:s("null",T),_true:s("true",T),_false:s("false",T),_in:s("in",{beforeExpr:!0,binop:7}),_instanceof:s("instanceof",{beforeExpr:!0,binop:7}),_typeof:s("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:s("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:s("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},P=/\r\n?|\n|\u2028|\u2029/,B=new RegExp(P.source,"g"),O=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,M=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,U=function(t,e){this.line=t,this.column=e};U.prototype.offset=function(t){return new U(this.line,this.column+t)};var F=function(t,e,r){this.start=e,this.end=r,null!==t.sourceFile&&(this.source=t.sourceFile)},D={ecmaVersion:6,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1,plugins:{}},V={},j=function(t,e,r){this.options=t=p(t),this.sourceFile=t.sourceFile,this.keywords=l(w[t.ecmaVersion>=6?6:5]);var i=t.allowReserved?"":x[t.ecmaVersion]+("module"==t.sourceType?" await":"");this.reservedWords=l(i);var n=(i?i+" ":"")+x.strict;this.reservedWordsStrict=l(n),this.reservedWordsStrictBind=l(n+" "+x.strictBind),this.input=String(e),this.containsEsc=!1,this.loadPlugins(t.plugins),r?(this.pos=r,this.lineStart=Math.max(0,this.input.lastIndexOf("\n",r)),this.curLine=this.input.slice(0,this.lineStart).split(P).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=I.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.strict=this.inModule="module"===t.sourceType,this.potentialArrowAt=-1,this.inFunction=this.inGenerator=!1,this.labels=[],0===this.pos&&t.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2)};j.prototype.isKeyword=function(t){return this.keywords.test(t)},j.prototype.isReservedWord=function(t){return this.reservedWords.test(t)},j.prototype.extend=function(t,e){this[t]=e(this[t])},j.prototype.loadPlugins=function(t){var e=this;for(var r in t){var i=V[r];if(!i)throw new Error("Plugin '"+r+"' not found");i(e,t[r])}},j.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};var Y=j.prototype;Y.isUseStrict=function(t){return this.options.ecmaVersion>=5&&"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"use strict"===t.expression.raw.slice(1,-1)},Y.eat=function(t){return this.type===t?(this.next(),!0):!1},Y.isContextual=function(t){return this.type===I.name&&this.value===t},Y.eatContextual=function(t){return this.value===t&&this.eat(I.name)},Y.expectContextual=function(t){this.eatContextual(t)||this.unexpected()},Y.canInsertSemicolon=function(){return this.type===I.eof||this.type===I.braceR||P.test(this.input.slice(this.lastTokEnd,this.start))},Y.insertSemicolon=function(){return this.canInsertSemicolon()?(this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0):void 0},Y.semicolon=function(){this.eat(I.semi)||this.insertSemicolon()||this.unexpected()},Y.afterTrailingComma=function(t){return this.type==t?(this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),this.next(),!0):void 0},Y.expect=function(t){this.eat(t)||this.unexpected()},Y.unexpected=function(t){this.raise(null!=t?t:this.start,"Unexpected token")};var q=function(){this.shorthandAssign=0,this.trailingComma=0};Y.checkPatternErrors=function(t,e){var r=t&&t.trailingComma;return e?void(r&&this.raise(r,"Comma is not permitted after the rest element")):!!r},Y.checkExpressionErrors=function(t,e){var r=t&&t.shorthandAssign;return e?void(r&&this.raise(r,"Shorthand property assignments are valid only in destructuring patterns")):!!r};var W=j.prototype;W.parseTopLevel=function(t){var e=this,r=!0;for(t.body||(t.body=[]);this.type!==I.eof;){var i=e.parseStatement(!0,!0);t.body.push(i),r&&(e.isUseStrict(i)&&e.setStrict(!0),r=!1)}return this.next(),this.options.ecmaVersion>=6&&(t.sourceType=this.options.sourceType),this.finishNode(t,"Program")};var z={kind:"loop"},G={kind:"switch"};W.isLet=function(){if(this.type!==I.name||this.options.ecmaVersion<6||"let"!=this.value)return!1;M.lastIndex=this.pos;var t=M.exec(this.input),e=this.pos+t[0].length,n=this.input.charCodeAt(e);if(91===n||123==n)return!0;if(r(n,!0)){for(var s=e+1;i(this.input.charCodeAt(s),!0);++s);var o=this.input.slice(e,s);if(!this.isKeyword(o))return!0}return!1},W.parseStatement=function(t,e){var r,i=this.type,n=this.startNode();switch(this.isLet()&&(i=I._var,r="let"),i){case I._break:case I._continue:return this.parseBreakContinueStatement(n,i.keyword);case I._debugger:return this.parseDebuggerStatement(n);case I._do:return this.parseDoStatement(n);case I._for:return this.parseForStatement(n);case I._function:return!t&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(n);case I._class:return t||this.unexpected(),this.parseClass(n,!0);case I._if:return this.parseIfStatement(n);case I._return:return this.parseReturnStatement(n);case I._switch:return this.parseSwitchStatement(n);case I._throw:return this.parseThrowStatement(n);case I._try:return this.parseTryStatement(n);case I._const:case I._var:return r=r||this.value,t||"var"==r||this.unexpected(),this.parseVarStatement(n,r);case I._while:return this.parseWhileStatement(n);case I._with:return this.parseWithStatement(n);case I.braceL:return this.parseBlock();case I.semi:return this.parseEmptyStatement(n);case I._export:case I._import:return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===I._import?this.parseImport(n):this.parseExport(n);default:var s=this.value,o=this.parseExpression();return i===I.name&&"Identifier"===o.type&&this.eat(I.colon)?this.parseLabeledStatement(n,s,o):this.parseExpressionStatement(n,o)}},W.parseBreakContinueStatement=function(t,e){var r=this,i="break"==e;this.next(),this.eat(I.semi)||this.insertSemicolon()?t.label=null:this.type!==I.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var n=0;n<this.labels.length;++n){var s=r.labels[n];if(null==t.label||s.name===t.label.name){if(null!=s.kind&&(i||"loop"===s.kind))break;if(t.label&&i)break}}return n===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,i?"BreakStatement":"ContinueStatement")},W.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")},W.parseDoStatement=function(t){return this.next(),this.labels.push(z),t.body=this.parseStatement(!1),this.labels.pop(),this.expect(I._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(I.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")},W.parseForStatement=function(t){if(this.next(),this.labels.push(z),this.expect(I.parenL),this.type===I.semi)return this.parseFor(t,null);var e=this.isLet();if(this.type===I._var||this.type===I._const||e){var r=this.startNode(),i=e?"let":this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,"VariableDeclaration"),!(this.type===I._in||this.options.ecmaVersion>=6&&this.isContextual("of"))||1!==r.declarations.length||"var"!==i&&r.declarations[0].init?this.parseFor(t,r):this.parseForIn(t,r)}var n=new q,s=this.parseExpression(!0,n);return this.type===I._in||this.options.ecmaVersion>=6&&this.isContextual("of")?(this.checkPatternErrors(n,!0),this.toAssignable(s),this.checkLVal(s),this.parseForIn(t,s)):(this.checkExpressionErrors(n,!0),this.parseFor(t,s))},W.parseFunctionStatement=function(t){return this.next(),this.parseFunction(t,!0)},W.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement(!1),t.alternate=this.eat(I._else)?this.parseStatement(!1):null,this.finishNode(t,"IfStatement")},W.parseReturnStatement=function(t){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(I.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")},W.parseSwitchStatement=function(t){var e=this;this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(I.braceL),this.labels.push(G);for(var r,i=!1;this.type!=I.braceR;)if(e.type===I._case||e.type===I._default){var n=e.type===I._case;r&&e.finishNode(r,"SwitchCase"),t.cases.push(r=e.startNode()),r.consequent=[],e.next(),n?r.test=e.parseExpression():(i&&e.raiseRecoverable(e.lastTokStart,"Multiple default clauses"),i=!0,r.test=null),e.expect(I.colon)}else r||e.unexpected(),r.consequent.push(e.parseStatement(!0));return r&&this.finishNode(r,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")},W.parseThrowStatement=function(t){return this.next(),P.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var X=[];W.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===I._catch){var e=this.startNode();this.next(),this.expect(I.parenL),e.param=this.parseBindingAtom(),this.checkLVal(e.param,!0),this.expect(I.parenR),e.body=this.parseBlock(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(I._finally)?this.parseBlock():null,t.handler||t.finalizer||this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")},W.parseVarStatement=function(t,e){return this.next(),this.parseVar(t,!1,e),this.semicolon(),this.finishNode(t,"VariableDeclaration")},W.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(z),t.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(t,"WhileStatement")},W.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement(!1),this.finishNode(t,"WithStatement")},W.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")},W.parseLabeledStatement=function(t,e,r){for(var i=this,n=0;n<this.labels.length;++n)i.labels[n].name===e&&i.raise(r.start,"Label '"+e+"' is already declared");for(var s=this.type.isLoop?"loop":this.type===I._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var a=i.labels[o];if(a.statementStart!=t.start)break;a.statementStart=i.start,a.kind=s}return this.labels.push({name:e,kind:s,statementStart:this.start}),t.body=this.parseStatement(!0),this.labels.pop(),t.label=r,this.finishNode(t,"LabeledStatement")},W.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")},W.parseBlock=function(t){var e,r=this,i=this.startNode(),n=!0;for(i.body=[],this.expect(I.braceL);!this.eat(I.braceR);){var s=r.parseStatement(!0);i.body.push(s),n&&t&&r.isUseStrict(s)&&(e=r.strict,r.setStrict(r.strict=!0)),n=!1}return e===!1&&this.setStrict(!1),this.finishNode(i,"BlockStatement")},W.parseFor=function(t,e){return t.init=e,this.expect(I.semi),t.test=this.type===I.semi?null:this.parseExpression(),this.expect(I.semi),t.update=this.type===I.parenR?null:this.parseExpression(),this.expect(I.parenR),t.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(t,"ForStatement")},W.parseForIn=function(t,e){var r=this.type===I._in?"ForInStatement":"ForOfStatement";return this.next(),t.left=e,t.right=this.parseExpression(),this.expect(I.parenR),t.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(t,r)},W.parseVar=function(t,e,r){var i=this;for(t.declarations=[],t.kind=r;;){var n=i.startNode();if(i.parseVarId(n),i.eat(I.eq)?n.init=i.parseMaybeAssign(e):"const"!==r||i.type===I._in||i.options.ecmaVersion>=6&&i.isContextual("of")?"Identifier"==n.id.type||e&&(i.type===I._in||i.isContextual("of"))?n.init=null:i.raise(i.lastTokEnd,"Complex binding patterns require an initialization value"):i.unexpected(),t.declarations.push(i.finishNode(n,"VariableDeclarator")),!i.eat(I.comma))break}return t},W.parseVarId=function(t){t.id=this.parseBindingAtom(),this.checkLVal(t.id,!0)},W.parseFunction=function(t,e,r){this.initFunction(t),this.options.ecmaVersion>=6&&(t.generator=this.eat(I.star));var i=this.inGenerator;return this.inGenerator=t.generator,(e||this.type===I.name)&&(t.id=this.parseIdent()),this.parseFunctionParams(t),this.parseFunctionBody(t,r),this.inGenerator=i,this.finishNode(t,e?"FunctionDeclaration":"FunctionExpression")},W.parseFunctionParams=function(t){this.expect(I.parenL),t.params=this.parseBindingList(I.parenR,!1,!1,!0)},W.parseClass=function(t,e){var r=this;this.next(),this.parseClassId(t,e),this.parseClassSuper(t);var i=this.startNode(),n=!1;for(i.body=[],this.expect(I.braceL);!this.eat(I.braceR);)if(!r.eat(I.semi)){var s=r.startNode(),o=r.eat(I.star),a=r.type===I.name&&"static"===r.value;r.parsePropertyName(s),s["static"]=a&&r.type!==I.parenL,s["static"]&&(o&&r.unexpected(),o=r.eat(I.star),r.parsePropertyName(s)),s.kind="method";var h=!1;if(!s.computed){var u=s.key;o||"Identifier"!==u.type||r.type===I.parenL||"get"!==u.name&&"set"!==u.name||(h=!0,s.kind=u.name,u=r.parsePropertyName(s)),!s["static"]&&("Identifier"===u.type&&"constructor"===u.name||"Literal"===u.type&&"constructor"===u.value)&&(n&&r.raise(u.start,"Duplicate constructor in the same class"),h&&r.raise(u.start,"Constructor can't have get/set modifier"),o&&r.raise(u.start,"Constructor can't be a generator"),s.kind="constructor",n=!0)}if(r.parseClassMethod(i,s,o),h){var p="get"===s.kind?0:1;if(s.value.params.length!==p){var c=s.value.start;"get"===s.kind?r.raiseRecoverable(c,"getter should have no params"):r.raiseRecoverable(c,"setter should have exactly one param")}"set"===s.kind&&"RestElement"===s.value.params[0].type&&r.raise(s.value.params[0].start,"Setter cannot use rest params")}}return t.body=this.finishNode(i,"ClassBody"),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")},W.parseClassMethod=function(t,e,r){e.value=this.parseMethod(r),t.body.push(this.finishNode(e,"MethodDefinition"))},W.parseClassId=function(t,e){t.id=this.type===I.name?this.parseIdent():e?this.unexpected():null},W.parseClassSuper=function(t){t.superClass=this.eat(I._extends)?this.parseExprSubscripts():null},W.parseExport=function(t){var e=this;if(this.next(),this.eat(I.star))return this.expectContextual("from"),t.source=this.type===I.string?this.parseExprAtom():this.unexpected(),this.semicolon(),this.finishNode(t,"ExportAllDeclaration");if(this.eat(I._default)){var r=this.type==I.parenL,i=this.parseMaybeAssign(),n=!0;return r||"FunctionExpression"!=i.type&&"ClassExpression"!=i.type||(n=!1,i.id&&(i.type="FunctionExpression"==i.type?"FunctionDeclaration":"ClassDeclaration")),t.declaration=i,n&&this.semicolon(),this.finishNode(t,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement())t.declaration=this.parseStatement(!0),t.specifiers=[],t.source=null;else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(),this.eatContextual("from"))t.source=this.type===I.string?this.parseExprAtom():this.unexpected();else{for(var s=0;s<t.specifiers.length;s++)(e.keywords.test(t.specifiers[s].local.name)||e.reservedWords.test(t.specifiers[s].local.name))&&e.unexpected(t.specifiers[s].local.start);t.source=null}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")},W.shouldParseExportStatement=function(){return this.type.keyword||this.isLet()},W.parseExportSpecifiers=function(){var t=this,e=[],r=!0;for(this.expect(I.braceL);!this.eat(I.braceR);){if(r)r=!1;else if(t.expect(I.comma),t.afterTrailingComma(I.braceR))break;var i=t.startNode();i.local=t.parseIdent(t.type===I._default),i.exported=t.eatContextual("as")?t.parseIdent(!0):i.local,e.push(t.finishNode(i,"ExportSpecifier"))}return e},W.parseImport=function(t){return this.next(),this.type===I.string?(t.specifiers=X,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===I.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(t,"ImportDeclaration")},W.parseImportSpecifiers=function(){var t=this,e=[],r=!0;if(this.type===I.name){var i=this.startNode();if(i.local=this.parseIdent(),this.checkLVal(i.local,!0),e.push(this.finishNode(i,"ImportDefaultSpecifier")),!this.eat(I.comma))return e}if(this.type===I.star){var n=this.startNode();return this.next(),this.expectContextual("as"),n.local=this.parseIdent(),this.checkLVal(n.local,!0),e.push(this.finishNode(n,"ImportNamespaceSpecifier")),e}for(this.expect(I.braceL);!this.eat(I.braceR);){if(r)r=!1;else if(t.expect(I.comma),t.afterTrailingComma(I.braceR))break;var s=t.startNode();s.imported=t.parseIdent(!0),t.eatContextual("as")?s.local=t.parseIdent():(s.local=s.imported,t.isKeyword(s.local.name)&&t.unexpected(s.local.start),t.reservedWordsStrict.test(s.local.name)&&t.raise(s.local.start,"The keyword '"+s.local.name+"' is reserved")),t.checkLVal(s.local,!0),e.push(t.finishNode(s,"ImportSpecifier"))}return e};var $=j.prototype;$.toAssignable=function(t,e){var r=this;if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":break;case"ObjectExpression":t.type="ObjectPattern";for(var i=0;i<t.properties.length;i++){var n=t.properties[i];"init"!==n.kind&&r.raise(n.key.start,"Object pattern can't contain getter or setter"),r.toAssignable(n.value,e)}break;case"ArrayExpression":t.type="ArrayPattern",this.toAssignableList(t.elements,e);break;case"AssignmentExpression":if("="!==t.operator){this.raise(t.left.end,"Only '=' operator can be used for specifying default value.");break}t.type="AssignmentPattern",delete t.operator;case"AssignmentPattern":"YieldExpression"===t.right.type&&this.raise(t.right.start,"Yield expression cannot be a default value");break;case"ParenthesizedExpression":t.expression=this.toAssignable(t.expression,e);break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}return t},$.toAssignableList=function(t,e){var r=this,i=t.length;if(i){var n=t[i-1];if(n&&"RestElement"==n.type)--i;else if(n&&"SpreadElement"==n.type){n.type="RestElement";var s=n.argument;this.toAssignable(s,e),"Identifier"!==s.type&&"MemberExpression"!==s.type&&"ArrayPattern"!==s.type&&this.unexpected(s.start),--i}e&&n&&"RestElement"===n.type&&"Identifier"!==n.argument.type&&this.unexpected(n.argument.start)}for(var o=0;i>o;o++){var a=t[o];a&&r.toAssignable(a,e)}return t},$.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")},$.parseRest=function(t){var e=this.startNode();return this.next(),e.argument=t?this.type===I.name?this.parseIdent():this.unexpected():this.type===I.name||this.type===I.bracketL?this.parseBindingAtom():this.unexpected(),this.finishNode(e,"RestElement")},$.parseBindingAtom=function(){if(this.options.ecmaVersion<6)return this.parseIdent();switch(this.type){case I.name:return this.parseIdent();case I.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(I.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case I.braceL:return this.parseObj(!0);default:this.unexpected()}},$.parseBindingList=function(t,e,r,i){for(var n=this,s=[],o=!0;!this.eat(t);)if(o?o=!1:n.expect(I.comma),e&&n.type===I.comma)s.push(null);else{if(r&&n.afterTrailingComma(t))break;if(n.type===I.ellipsis){var a=n.parseRest(i);n.parseBindingListItem(a),s.push(a),n.type===I.comma&&n.raise(n.start,"Comma is not permitted after the rest element"),n.expect(t);break}var h=n.parseMaybeDefault(n.start,n.startLoc);n.parseBindingListItem(h),s.push(h)}return s},$.parseBindingListItem=function(t){return t},$.parseMaybeDefault=function(t,e,r){if(r=r||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(I.eq))return r;var i=this.startNodeAt(t,e);return i.left=r,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")},$.checkLVal=function(t,e,r){var i=this;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(e?"Binding ":"Assigning to ")+t.name+" in strict mode"),r&&(h(r,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),r[t.name]=!0);break;case"MemberExpression":e&&this.raiseRecoverable(t.start,(e?"Binding":"Assigning to")+" member expression");break;case"ObjectPattern":for(var n=0;n<t.properties.length;n++)i.checkLVal(t.properties[n].value,e,r);break;case"ArrayPattern":for(var s=0;s<t.elements.length;s++){var o=t.elements[s];o&&i.checkLVal(o,e,r)}break;case"AssignmentPattern":this.checkLVal(t.left,e,r);break;case"RestElement":this.checkLVal(t.argument,e,r);break;case"ParenthesizedExpression":this.checkLVal(t.expression,e,r);break;default:this.raise(t.start,(e?"Binding":"Assigning to")+" rvalue")}};var Q=j.prototype;Q.checkPropClash=function(t,e){if(!(this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var r,i=t.key;switch(i.type){case"Identifier":r=i.name;break;case"Literal":r=String(i.value);break;default:return}var n=t.kind;if(this.options.ecmaVersion>=6)return void("__proto__"===r&&"init"===n&&(e.proto&&this.raiseRecoverable(i.start,"Redefinition of __proto__ property"),e.proto=!0));r="$"+r;var s=e[r];if(s){var o="init"!==n;((this.strict||o)&&s[n]||!(o^s.init))&&this.raiseRecoverable(i.start,"Redefinition of property")}else s=e[r]={init:!1,get:!1,set:!1};s[n]=!0}},Q.parseExpression=function(t,e){var r=this,i=this.start,n=this.startLoc,s=this.parseMaybeAssign(t,e);if(this.type===I.comma){var o=this.startNodeAt(i,n);for(o.expressions=[s];this.eat(I.comma);)o.expressions.push(r.parseMaybeAssign(t,e));return this.finishNode(o,"SequenceExpression")}return s},Q.parseMaybeAssign=function(t,e,r){if(this.inGenerator&&this.isContextual("yield"))return this.parseYield();var i=!1;e||(e=new q,i=!0);var n=this.start,s=this.startLoc;(this.type==I.parenL||this.type==I.name)&&(this.potentialArrowAt=this.start);var o=this.parseMaybeConditional(t,e);if(r&&(o=r.call(this,o,n,s)),this.type.isAssign){this.checkPatternErrors(e,!0),i||q.call(e);var a=this.startNodeAt(n,s);return a.operator=this.value,a.left=this.type===I.eq?this.toAssignable(o):o,e.shorthandAssign=0,this.checkLVal(o),
|
|
2
|
+
this.next(),a.right=this.parseMaybeAssign(t),this.finishNode(a,"AssignmentExpression")}return i&&this.checkExpressionErrors(e,!0),o},Q.parseMaybeConditional=function(t,e){var r=this.start,i=this.startLoc,n=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return n;if(this.eat(I.question)){var s=this.startNodeAt(r,i);return s.test=n,s.consequent=this.parseMaybeAssign(),this.expect(I.colon),s.alternate=this.parseMaybeAssign(t),this.finishNode(s,"ConditionalExpression")}return n},Q.parseExprOps=function(t,e){var r=this.start,i=this.startLoc,n=this.parseMaybeUnary(e,!1);return this.checkExpressionErrors(e)?n:this.parseExprOp(n,r,i,-1,t)},Q.parseExprOp=function(t,e,r,i,n){var s=this.type.binop;if(null!=s&&(!n||this.type!==I._in)&&s>i){var o=this.type===I.logicalOR||this.type===I.logicalAND,a=this.value;this.next();var h=this.start,u=this.startLoc,p=this.parseExprOp(this.parseMaybeUnary(null,!1),h,u,s,n),c=this.buildBinary(e,r,t,p,a,o);return this.parseExprOp(c,e,r,i,n)}return t},Q.buildBinary=function(t,e,r,i,n,s){var o=this.startNodeAt(t,e);return o.left=r,o.operator=n,o.right=i,this.finishNode(o,s?"LogicalExpression":"BinaryExpression")},Q.parseMaybeUnary=function(t,e){var r,i=this,n=this.start,s=this.startLoc;if(this.type.prefix){var o=this.startNode(),a=this.type===I.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(t,!0),a?this.checkLVal(o.argument):this.strict&&"delete"===o.operator&&"Identifier"===o.argument.type?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):e=!0,r=this.finishNode(o,a?"UpdateExpression":"UnaryExpression")}else{if(r=this.parseExprSubscripts(t),this.checkExpressionErrors(t))return r;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=i.startNodeAt(n,s);h.operator=i.value,h.prefix=!1,h.argument=r,i.checkLVal(r),i.next(),r=i.finishNode(h,"UpdateExpression")}}return!e&&this.eat(I.starstar)?this.buildBinary(n,s,r,this.parseMaybeUnary(null,!1),"**",!1):r},Q.parseExprSubscripts=function(t){var e=this.start,r=this.startLoc,i=this.parseExprAtom(t),n="ArrowFunctionExpression"===i.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd);return this.checkExpressionErrors(t)||n?i:this.parseSubscripts(i,e,r)},Q.parseSubscripts=function(t,e,r,i){for(var n=this;;)if(n.eat(I.dot)){var s=n.startNodeAt(e,r);s.object=t,s.property=n.parseIdent(!0),s.computed=!1,t=n.finishNode(s,"MemberExpression")}else if(n.eat(I.bracketL)){var o=n.startNodeAt(e,r);o.object=t,o.property=n.parseExpression(),o.computed=!0,n.expect(I.bracketR),t=n.finishNode(o,"MemberExpression")}else if(!i&&n.eat(I.parenL)){var a=n.startNodeAt(e,r);a.callee=t,a.arguments=n.parseExprList(I.parenR,!1),t=n.finishNode(a,"CallExpression")}else{if(n.type!==I.backQuote)return t;var h=n.startNodeAt(e,r);h.tag=t,h.quasi=n.parseTemplate(),t=n.finishNode(h,"TaggedTemplateExpression")}},Q.parseExprAtom=function(t){var e,r=this.potentialArrowAt==this.start;switch(this.type){case I._super:this.inFunction||this.raise(this.start,"'super' outside of function or class");case I._this:var i=this.type===I._this?"ThisExpression":"Super";return e=this.startNode(),this.next(),this.finishNode(e,i);case I.name:var n=this.start,s=this.startLoc,o=this.parseIdent(this.type!==I.name);return r&&!this.canInsertSemicolon()&&this.eat(I.arrow)?this.parseArrowExpression(this.startNodeAt(n,s),[o]):o;case I.regexp:var a=this.value;return e=this.parseLiteral(a.value),e.regex={pattern:a.pattern,flags:a.flags},e;case I.num:case I.string:return this.parseLiteral(this.value);case I._null:case I._true:case I._false:return e=this.startNode(),e.value=this.type===I._null?null:this.type===I._true,e.raw=this.type.keyword,this.next(),this.finishNode(e,"Literal");case I.parenL:return this.parseParenAndDistinguishExpression(r);case I.bracketL:return e=this.startNode(),this.next(),e.elements=this.parseExprList(I.bracketR,!0,!0,t),this.finishNode(e,"ArrayExpression");case I.braceL:return this.parseObj(!1,t);case I._function:return e=this.startNode(),this.next(),this.parseFunction(e,!1);case I._class:return this.parseClass(this.startNode(),!1);case I._new:return this.parseNew();case I.backQuote:return this.parseTemplate();default:this.unexpected()}},Q.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),this.next(),this.finishNode(e,"Literal")},Q.parseParenExpression=function(){this.expect(I.parenL);var t=this.parseExpression();return this.expect(I.parenR),t},Q.parseParenAndDistinguishExpression=function(t){var e,r=this,i=this.start,n=this.startLoc;if(this.options.ecmaVersion>=6){this.next();for(var s,o,a=this.start,h=this.startLoc,u=[],p=!0,c=new q;this.type!==I.parenR;){if(p?p=!1:r.expect(I.comma),r.type===I.ellipsis){s=r.start,u.push(r.parseParenItem(r.parseRest()));break}r.type!==I.parenL||o||(o=r.start),u.push(r.parseMaybeAssign(!1,c,r.parseParenItem))}var l=this.start,f=this.startLoc;if(this.expect(I.parenR),t&&!this.canInsertSemicolon()&&this.eat(I.arrow))return this.checkPatternErrors(c,!0),o&&this.unexpected(o),this.parseParenArrowList(i,n,u);u.length||this.unexpected(this.lastTokStart),s&&this.unexpected(s),this.checkExpressionErrors(c,!0),u.length>1?(e=this.startNodeAt(a,h),e.expressions=u,this.finishNodeAt(e,"SequenceExpression",l,f)):e=u[0]}else e=this.parseParenExpression();if(this.options.preserveParens){var d=this.startNodeAt(i,n);return d.expression=e,this.finishNode(d,"ParenthesizedExpression")}return e},Q.parseParenItem=function(t){return t},Q.parseParenArrowList=function(t,e,r){return this.parseArrowExpression(this.startNodeAt(t,e),r)};var H=[];Q.parseNew=function(){var t=this.startNode(),e=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(I.dot))return t.meta=e,t.property=this.parseIdent(!0),"target"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is new.target"),this.inFunction||this.raiseRecoverable(t.start,"new.target can only be used in functions"),this.finishNode(t,"MetaProperty");var r=this.start,i=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(),r,i,!0),t.arguments=this.eat(I.parenL)?this.parseExprList(I.parenR,!1):H,this.finishNode(t,"NewExpression")},Q.parseTemplateElement=function(){var t=this.startNode();return t.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),t.tail=this.type===I.backQuote,this.finishNode(t,"TemplateElement")},Q.parseTemplate=function(){var t=this,e=this.startNode();this.next(),e.expressions=[];var r=this.parseTemplateElement();for(e.quasis=[r];!r.tail;)t.expect(I.dollarBraceL),e.expressions.push(t.parseExpression()),t.expect(I.braceR),e.quasis.push(r=t.parseTemplateElement());return this.next(),this.finishNode(e,"TemplateLiteral")},Q.parseObj=function(t,e){var r=this,i=this.startNode(),n=!0,s={};for(i.properties=[],this.next();!this.eat(I.braceR);){if(n)n=!1;else if(r.expect(I.comma),r.afterTrailingComma(I.braceR))break;var o,a,h,u=r.startNode();r.options.ecmaVersion>=6&&(u.method=!1,u.shorthand=!1,(t||e)&&(a=r.start,h=r.startLoc),t||(o=r.eat(I.star))),r.parsePropertyName(u),r.parsePropertyValue(u,t,o,a,h,e),r.checkPropClash(u,s),i.properties.push(r.finishNode(u,"Property"))}return this.finishNode(i,t?"ObjectPattern":"ObjectExpression")},Q.parsePropertyValue=function(t,e,r,i,n,s){if(this.eat(I.colon))t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,s),t.kind="init";else if(this.options.ecmaVersion>=6&&this.type===I.parenL)e&&this.unexpected(),t.kind="init",t.method=!0,t.value=this.parseMethod(r);else if(this.options.ecmaVersion>=5&&!t.computed&&"Identifier"===t.key.type&&("get"===t.key.name||"set"===t.key.name)&&this.type!=I.comma&&this.type!=I.braceR){(r||e)&&this.unexpected(),t.kind=t.key.name,this.parsePropertyName(t),t.value=this.parseMethod(!1);var o="get"===t.kind?0:1;if(t.value.params.length!==o){var a=t.value.start;"get"===t.kind?this.raiseRecoverable(a,"getter should have no params"):this.raiseRecoverable(a,"setter should have exactly one param")}"set"===t.kind&&"RestElement"===t.value.params[0].type&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")}else this.options.ecmaVersion>=6&&!t.computed&&"Identifier"===t.key.type?((this.keywords.test(t.key.name)||(this.strict?this.reservedWordsStrictBind:this.reservedWords).test(t.key.name)||this.inGenerator&&"yield"==t.key.name)&&this.raiseRecoverable(t.key.start,"'"+t.key.name+"' can not be used as shorthand property"),t.kind="init",e?t.value=this.parseMaybeDefault(i,n,t.key):this.type===I.eq&&s?(s.shorthandAssign||(s.shorthandAssign=this.start),t.value=this.parseMaybeDefault(i,n,t.key)):t.value=t.key,t.shorthand=!0):this.unexpected()},Q.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(I.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(I.bracketR),t.key;t.computed=!1}return t.key=this.type===I.num||this.type===I.string?this.parseExprAtom():this.parseIdent(!0)},Q.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=!1,t.expression=!1)},Q.parseMethod=function(t){var e=this.startNode(),r=this.inGenerator;return this.inGenerator=t,this.initFunction(e),this.expect(I.parenL),e.params=this.parseBindingList(I.parenR,!1,!1),this.options.ecmaVersion>=6&&(e.generator=t),this.parseFunctionBody(e,!1),this.inGenerator=r,this.finishNode(e,"FunctionExpression")},Q.parseArrowExpression=function(t,e){var r=this.inGenerator;return this.inGenerator=!1,this.initFunction(t),t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0),this.inGenerator=r,this.finishNode(t,"ArrowFunctionExpression")},Q.parseFunctionBody=function(t,e){var r=e&&this.type!==I.braceL;if(r)t.body=this.parseMaybeAssign(),t.expression=!0;else{var i=this.inFunction,n=this.labels;this.inFunction=!0,this.labels=[],t.body=this.parseBlock(!0),t.expression=!1,this.inFunction=i,this.labels=n}var s=!r&&t.body.body.length&&this.isUseStrict(t.body.body[0])?t.body.body[0]:null;if(this.strict||s){var o=this.strict;this.strict=!0,t.id&&this.checkLVal(t.id,!0),this.checkParams(t,s),this.strict=o}else e&&this.checkParams(t,s)},Q.checkParams=function(t,e){for(var r=this,i={},n=0;n<t.params.length;n++)e&&r.options.ecmaVersion>=7&&"Identifier"!==t.params[n].type&&r.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"),r.checkLVal(t.params[n],!0,i)},Q.parseExprList=function(t,e,r,i){for(var n=this,s=[],o=!0;!this.eat(t);){if(o)o=!1;else if(n.expect(I.comma),e&&n.afterTrailingComma(t))break;var a;r&&n.type===I.comma?a=null:n.type===I.ellipsis?(a=n.parseSpread(i),n.type===I.comma&&i&&!i.trailingComma&&(i.trailingComma=n.lastTokStart)):a=n.parseMaybeAssign(!1,i),s.push(a)}return s},Q.parseIdent=function(t){var e=this.startNode();return t&&"never"==this.options.allowReserved&&(t=!1),this.type===I.name?(!t&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(this.value)&&(this.options.ecmaVersion>=6||-1==this.input.slice(this.start,this.end).indexOf("\\"))&&this.raiseRecoverable(this.start,"The keyword '"+this.value+"' is reserved"),!t&&this.inGenerator&&"yield"===this.value&&this.raiseRecoverable(this.start,"Can not use 'yield' as identifier inside a generator"),e.name=this.value):t&&this.type.keyword?e.name=this.type.keyword:this.unexpected(),this.next(),this.finishNode(e,"Identifier")},Q.parseYield=function(){var t=this.startNode();return this.next(),this.type==I.semi||this.canInsertSemicolon()||this.type!=I.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(I.star),t.argument=this.parseMaybeAssign()),this.finishNode(t,"YieldExpression")};var J=j.prototype;J.raise=function(t,e){var r=u(this.input,t);e+=" ("+r.line+":"+r.column+")";var i=new SyntaxError(e);throw i.pos=t,i.loc=r,i.raisedAt=this.pos,i},J.raiseRecoverable=J.raise,J.curPosition=function(){return this.options.locations?new U(this.curLine,this.pos-this.lineStart):void 0};var K=function(t,e,r){this.type="",this.start=e,this.end=0,t.options.locations&&(this.loc=new F(t,r)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[e,0])},Z=j.prototype;Z.startNode=function(){return new K(this,this.start,this.startLoc)},Z.startNodeAt=function(t,e){return new K(this,t,e)},Z.finishNode=function(t,e){return f.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)},Z.finishNodeAt=function(t,e,r,i){return f.call(this,t,e,r,i)};var tt=function(t,e,r,i){this.token=t,this.isExpr=!!e,this.preserveSpace=!!r,this.override=i},et={b_stat:new tt("{",!1),b_expr:new tt("{",!0),b_tmpl:new tt("${",!0),p_stat:new tt("(",!1),p_expr:new tt("(",!0),q_tmpl:new tt("`",!0,!0,function(t){return t.readTmplToken()}),f_expr:new tt("function",!0)},rt=j.prototype;rt.initialContext=function(){return[et.b_stat]},rt.braceIsBlock=function(t){if(t===I.colon){var e=this.curContext();if(e===et.b_stat||e===et.b_expr)return!e.isExpr}return t===I._return?P.test(this.input.slice(this.lastTokEnd,this.start)):t===I._else||t===I.semi||t===I.eof||t===I.parenR?!0:t==I.braceL?this.curContext()===et.b_stat:!this.exprAllowed},rt.updateContext=function(t){var e,r=this.type;r.keyword&&t==I.dot?this.exprAllowed=!1:(e=r.updateContext)?e.call(this,t):this.exprAllowed=r.beforeExpr},I.parenR.updateContext=I.braceR.updateContext=function(){if(1==this.context.length)return void(this.exprAllowed=!0);var t=this.context.pop();t===et.b_stat&&this.curContext()===et.f_expr?(this.context.pop(),this.exprAllowed=!1):this.exprAllowed=t===et.b_tmpl?!0:!t.isExpr},I.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?et.b_stat:et.b_expr),this.exprAllowed=!0},I.dollarBraceL.updateContext=function(){this.context.push(et.b_tmpl),this.exprAllowed=!0},I.parenL.updateContext=function(t){var e=t===I._if||t===I._for||t===I._with||t===I._while;this.context.push(e?et.p_stat:et.p_expr),this.exprAllowed=!0},I.incDec.updateContext=function(){},I._function.updateContext=function(t){t.beforeExpr&&t!==I.semi&&t!==I._else&&(t!==I.colon&&t!==I.braceL||this.curContext()!==et.b_stat)&&this.context.push(et.f_expr),this.exprAllowed=!1},I.backQuote.updateContext=function(){this.curContext()===et.q_tmpl?this.context.pop():this.context.push(et.q_tmpl),this.exprAllowed=!1};var it=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new F(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},nt=j.prototype,st="object"==typeof Packages&&"[object JavaPackage]"==Object.prototype.toString.call(Packages);nt.next=function(){this.options.onToken&&this.options.onToken(new it(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},nt.getToken=function(){return this.next(),new it(this)},"undefined"!=typeof Symbol&&(nt[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===I.eof,value:e}}}}),nt.setStrict=function(t){var e=this;if(this.strict=t,this.type===I.num||this.type===I.string){if(this.pos=this.start,this.options.locations)for(;this.pos<this.lineStart;)e.lineStart=e.input.lastIndexOf("\n",e.lineStart-2)+1,--e.curLine;this.nextToken()}},nt.curContext=function(){return this.context[this.context.length-1]},nt.nextToken=function(){var t=this.curContext();return t&&t.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(I.eof):t.override?t.override(this):void this.readToken(this.fullCharCodeAtPos())},nt.readToken=function(t){return r(t,this.options.ecmaVersion>=6)||92===t?this.readWord():this.getTokenFromCode(t)},nt.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(55295>=t||t>=57344)return t;var e=this.input.charCodeAt(this.pos+1);return(t<<10)+e-56613888},nt.skipBlockComment=function(){var t=this,e=this.options.onComment&&this.curPosition(),r=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(-1===i&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations){B.lastIndex=r;for(var n;(n=B.exec(this.input))&&n.index<this.pos;)++t.curLine,t.lineStart=n.index+n[0].length}this.options.onComment&&this.options.onComment(!0,this.input.slice(r+2,i),r,this.pos,e,this.curPosition())},nt.skipLineComment=function(t){for(var e=this,r=this.pos,i=this.options.onComment&&this.curPosition(),n=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&10!==n&&13!==n&&8232!==n&&8233!==n;)++e.pos,n=e.input.charCodeAt(e.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(r+t,this.pos),r,this.pos,i,this.curPosition())},nt.skipSpace=function(){var t=this;t:for(;this.pos<this.input.length;){var e=t.input.charCodeAt(t.pos);switch(e){case 32:case 160:++t.pos;break;case 13:10===t.input.charCodeAt(t.pos+1)&&++t.pos;case 10:case 8232:case 8233:++t.pos,t.options.locations&&(++t.curLine,t.lineStart=t.pos);break;case 47:switch(t.input.charCodeAt(t.pos+1)){case 42:t.skipBlockComment();break;case 47:t.skipLineComment(2);break;default:break t}break;default:if(!(e>8&&14>e||e>=5760&&O.test(String.fromCharCode(e))))break t;++t.pos}}},nt.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var r=this.type;this.type=t,this.value=e,this.updateContext(r)},nt.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&57>=t)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===t&&46===e?(this.pos+=3,this.finishToken(I.ellipsis)):(++this.pos,this.finishToken(I.dot))},nt.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===t?this.finishOp(I.assign,2):this.finishOp(I.slash,1)},nt.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),r=1,i=42===t?I.star:I.modulo;return this.options.ecmaVersion>=7&&42===e&&(++r,i=I.starstar,e=this.input.charCodeAt(this.pos+2)),61===e?this.finishOp(I.assign,r+1):this.finishOp(i,r)},nt.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?this.finishOp(124===t?I.logicalOR:I.logicalAND,2):61===e?this.finishOp(I.assign,2):this.finishOp(124===t?I.bitwiseOR:I.bitwiseAND,1)},nt.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(I.assign,2):this.finishOp(I.bitwiseXOR,1)},nt.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?45==e&&62==this.input.charCodeAt(this.pos+2)&&P.test(this.input.slice(this.lastTokEnd,this.pos))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(I.incDec,2):61===e?this.finishOp(I.assign,2):this.finishOp(I.plusMin,1)},nt.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),r=1;return e===t?(r=62===t&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+r)?this.finishOp(I.assign,r+1):this.finishOp(I.bitShift,r)):33==e&&60==t&&45==this.input.charCodeAt(this.pos+2)&&45==this.input.charCodeAt(this.pos+3)?(this.inModule&&this.unexpected(),this.skipLineComment(4),this.skipSpace(),this.nextToken()):(61===e&&(r=2),this.finishOp(I.relational,r))},nt.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return 61===e?this.finishOp(I.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===t&&62===e&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(I.arrow)):this.finishOp(61===t?I.eq:I.prefix,1)},nt.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(I.parenL);case 41:return++this.pos,this.finishToken(I.parenR);case 59:return++this.pos,this.finishToken(I.semi);case 44:return++this.pos,this.finishToken(I.comma);case 91:return++this.pos,this.finishToken(I.bracketL);case 93:return++this.pos,this.finishToken(I.bracketR);case 123:return++this.pos,this.finishToken(I.braceL);case 125:return++this.pos,this.finishToken(I.braceR);case 58:return++this.pos,this.finishToken(I.colon);case 63:return++this.pos,this.finishToken(I.question);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(I.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(120===e||88===e)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===e||79===e)return this.readRadixNumber(8);if(98===e||66===e)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 126:return this.finishOp(I.prefix,1)}this.raise(this.pos,"Unexpected character '"+m(t)+"'")},nt.finishOp=function(t,e){var r=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,r)};var ot=!!d("","u");nt.readRegexp=function(){for(var t,e,r=this,i=this.pos;;){r.pos>=r.input.length&&r.raise(i,"Unterminated regular expression");var n=r.input.charAt(r.pos);if(P.test(n)&&r.raise(i,"Unterminated regular expression"),t)t=!1;else{if("["===n)e=!0;else if("]"===n&&e)e=!1;else if("/"===n&&!e)break;t="\\"===n}++r.pos}var s=this.input.slice(i,this.pos);++this.pos;var o=this.readWord1(),a=s,h="";if(o){var u=/^[gim]*$/;this.options.ecmaVersion>=6&&(u=/^[gimuy]*$/),u.test(o)||this.raise(i,"Invalid regular expression flag"),o.indexOf("u")>=0&&(ot?h="u":(a=a.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(t,e,n){return e=Number("0x"+e),e>1114111&&r.raise(i+n+3,"Code point out of bounds"),"x"}),a=a.replace(/\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"),h=h.replace("u","")))}var p=null;return st||(d(a,h,i,this),p=d(s,o)),this.finishToken(I.regexp,{pattern:s,flags:o,value:p})},nt.readInt=function(t,e){for(var r=this,i=this.pos,n=0,s=0,o=null==e?1/0:e;o>s;++s){var a,h=r.input.charCodeAt(r.pos);if(a=h>=97?h-97+10:h>=65?h-65+10:h>=48&&57>=h?h-48:1/0,a>=t)break;++r.pos,n=n*t+a}return this.pos===i||null!=e&&this.pos-i!==e?null:n},nt.readRadixNumber=function(t){this.pos+=2;var e=this.readInt(t);return null==e&&this.raise(this.start+2,"Expected number in radix "+t),r(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(I.num,e)},nt.readNumber=function(t){var e=this.pos,i=!1,n=48===this.input.charCodeAt(this.pos);t||null!==this.readInt(10)||this.raise(e,"Invalid number");var s=this.input.charCodeAt(this.pos);46===s&&(++this.pos,this.readInt(10),i=!0,s=this.input.charCodeAt(this.pos)),(69===s||101===s)&&(s=this.input.charCodeAt(++this.pos),(43===s||45===s)&&++this.pos,null===this.readInt(10)&&this.raise(e,"Invalid number"),i=!0),r(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var o,a=this.input.slice(e,this.pos);return i?o=parseFloat(a):n&&1!==a.length?/[89]/.test(a)||this.strict?this.raise(e,"Invalid number"):o=parseInt(a,8):o=parseInt(a,10),this.finishToken(I.num,o)},nt.readCodePoint=function(){var t,e=this.input.charCodeAt(this.pos);if(123===e){this.options.ecmaVersion<6&&this.unexpected();var r=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.raise(r,"Code point out of bounds")}else t=this.readHexChar(4);return t},nt.readString=function(t){for(var e=this,r="",i=++this.pos;;){e.pos>=e.input.length&&e.raise(e.start,"Unterminated string constant");var n=e.input.charCodeAt(e.pos);if(n===t)break;92===n?(r+=e.input.slice(i,e.pos),r+=e.readEscapedChar(!1),i=e.pos):(o(n)&&e.raise(e.start,"Unterminated string constant"),++e.pos)}return r+=this.input.slice(i,this.pos++),this.finishToken(I.string,r)},nt.readTmplToken=function(){for(var t=this,e="",r=this.pos;;){t.pos>=t.input.length&&t.raise(t.start,"Unterminated template");var i=t.input.charCodeAt(t.pos);if(96===i||36===i&&123===t.input.charCodeAt(t.pos+1))return t.pos===t.start&&t.type===I.template?36===i?(t.pos+=2,t.finishToken(I.dollarBraceL)):(++t.pos,t.finishToken(I.backQuote)):(e+=t.input.slice(r,t.pos),t.finishToken(I.template,e));if(92===i)e+=t.input.slice(r,t.pos),e+=t.readEscapedChar(!0),r=t.pos;else if(o(i)){switch(e+=t.input.slice(r,t.pos),++t.pos,i){case 13:10===t.input.charCodeAt(t.pos)&&++t.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(i)}t.options.locations&&(++t.curLine,t.lineStart=t.pos),r=t.pos}else++t.pos}},nt.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return m(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";default:if(e>=48&&55>=e){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),"0"!==r&&(this.strict||t)&&this.raise(this.pos-2,"Octal literal in strict mode"),this.pos+=r.length-1,String.fromCharCode(i)}return String.fromCharCode(e)}},nt.readHexChar=function(t){var e=this.pos,r=this.readInt(16,t);return null===r&&this.raise(e,"Bad character escape sequence"),r},nt.readWord1=function(){var t=this;this.containsEsc=!1;for(var e="",n=!0,s=this.pos,o=this.options.ecmaVersion>=6;this.pos<this.input.length;){var a=t.fullCharCodeAtPos();if(i(a,o))t.pos+=65535>=a?1:2;else{if(92!==a)break;t.containsEsc=!0,e+=t.input.slice(s,t.pos);var h=t.pos;117!=t.input.charCodeAt(++t.pos)&&t.raise(t.pos,"Expecting Unicode escape sequence \\uXXXX"),++t.pos;var u=t.readCodePoint();(n?r:i)(u,o)||t.raise(h,"Invalid Unicode escape"),e+=m(u),s=t.pos}n=!1}return e+this.input.slice(s,this.pos)},nt.readWord=function(){var t=this.readWord1(),e=I.name;return(this.options.ecmaVersion>=6||!this.containsEsc)&&this.keywords.test(t)&&(e=N[t]),this.finishToken(e,t)};var at="3.3.0";t.version=at,t.parse=g,t.parseExpressionAt=v,t.tokenizer=y,t.Parser=j,t.plugins=V,t.defaultOptions=D,t.Position=U,t.SourceLocation=F,t.getLineInfo=u,t.Node=K,t.TokenType=L,t.tokTypes=I,t.TokContext=tt,t.tokContexts=et,t.isIdentifierChar=i,t.isIdentifierStart=r,t.Token=it,t.isNewLine=o,t.lineBreak=P,t.lineBreakG=B,Object.defineProperty(t,"__esModule",{value:!0})})},{}],3:[function(t,e,r){"use strict";function i(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function n(t){return 3*t.length/4-i(t)}function s(t){var e,r,n,s,o,a,h=t.length;o=i(t),a=new c(3*h/4-o),n=o>0?h-4:h;var u=0;for(e=0,r=0;n>e;e+=4,r+=3)s=p[t.charCodeAt(e)]<<18|p[t.charCodeAt(e+1)]<<12|p[t.charCodeAt(e+2)]<<6|p[t.charCodeAt(e+3)],a[u++]=s>>16&255,a[u++]=s>>8&255,a[u++]=255&s;return 2===o?(s=p[t.charCodeAt(e)]<<2|p[t.charCodeAt(e+1)]>>4,a[u++]=255&s):1===o&&(s=p[t.charCodeAt(e)]<<10|p[t.charCodeAt(e+1)]<<4|p[t.charCodeAt(e+2)]>>2,a[u++]=s>>8&255,a[u++]=255&s),a}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function a(t,e,r){for(var i,n=[],s=e;r>s;s+=3)i=(t[s]<<16)+(t[s+1]<<8)+t[s+2],n.push(o(i));return n.join("")}function h(t){for(var e,r=t.length,i=r%3,n="",s=[],o=16383,h=0,p=r-i;p>h;h+=o)s.push(a(t,h,h+o>p?p:h+o));return 1===i?(e=t[r-1],n+=u[e>>2],n+=u[e<<4&63],n+="=="):2===i&&(e=(t[r-2]<<8)+t[r-1],n+=u[e>>10],n+=u[e>>4&63],n+=u[e<<2&63],n+="="),s.push(n),s.join("")}r.byteLength=n,r.toByteArray=s,r.fromByteArray=h;for(var u=[],p=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,d=l.length;d>f;++f)u[f]=l[f],p[l.charCodeAt(f)]=f;p["-".charCodeAt(0)]=62,p["_".charCodeAt(0)]=63},{}],4:[function(t,e,r){(function(e){"use strict";function i(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}function n(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(n()<e)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=o.prototype):(null===t&&(t=new o(e)),t.length=e),t}function o(t,e,r){if(!(o.TYPED_ARRAY_SUPPORT||this instanceof o))return new o(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return p(this,t)}return a(this,t,e,r)}function a(t,e,r,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?f(t,e,r,i):"string"==typeof e?c(t,e,r):d(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(0>t)throw new RangeError('"size" argument must not be negative')}function u(t,e,r,i){return h(e),0>=e?s(t,e):void 0!==r?"string"==typeof i?s(t,e).fill(r,i):s(t,e).fill(r):s(t,e)}function p(t,e){if(h(e),t=s(t,0>e?0:0|m(e)),!o.TYPED_ARRAY_SUPPORT)for(var r=0;e>r;++r)t[r]=0;return t}function c(t,e,r){if(("string"!=typeof r||""===r)&&(r="utf8"),!o.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|v(e,r);t=s(t,i);var n=t.write(e,r);return n!==i&&(t=t.slice(0,n)),t}function l(t,e){var r=e.length<0?0:0|m(e.length);t=s(t,r);for(var i=0;r>i;i+=1)t[i]=255&e[i];return t}function f(t,e,r,i){if(e.byteLength,0>r||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");return e=void 0===r&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,r):new Uint8Array(e,r,i),o.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=o.prototype):t=l(t,e),t}function d(t,e){if(o.isBuffer(e)){var r=0|m(e.length);return t=s(t,r),0===t.length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||H(e.length)?s(t,0):l(t,e);if("Buffer"===e.type&&Z(e.data))return l(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function m(t){if(t>=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|t}function g(t){return+t!=t&&(t=0),o.alloc(+t)}function v(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(t).length;default:if(i)return z(t).length;e=(""+e).toLowerCase(),i=!0}}function y(t,e,r){var i=!1;if((void 0===e||0>e)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),0>=r)return"";if(r>>>=0,e>>>=0,e>=r)return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return R(this,e,r);case"ascii":return N(this,e,r);case"latin1":case"binary":return I(this,e,r);case"base64":return L(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function x(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function b(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:-2147483648>r&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),0>r&&(r=t.length+r),r>=t.length){if(n)return-1;
|
|
3
|
+
|
|
4
|
+
r=t.length-1}else if(0>r){if(!n)return-1;r=0}if("string"==typeof e&&(e=o.from(e,i)),o.isBuffer(e))return 0===e.length?-1:w(t,e,r,i,n);if("number"==typeof e)return e=255&e,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,i,n){function s(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,a=t.length,h=e.length;if(void 0!==i&&(i=String(i).toLowerCase(),"ucs2"===i||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,a/=2,h/=2,r/=2}var u;if(n){var p=-1;for(u=r;a>u;u++)if(s(t,u)===s(e,-1===p?0:u-p)){if(-1===p&&(p=u),u-p+1===h)return p*o}else-1!==p&&(u-=u-p),p=-1}else for(r+h>a&&(r=a-h),u=r;u>=0;u--){for(var c=!0,l=0;h>l;l++)if(s(t,u+l)!==s(e,l)){c=!1;break}if(c)return u}return-1}function E(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;var s=e.length;if(s%2!==0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var o=0;i>o;++o){var a=parseInt(e.substr(2*o,2),16);if(isNaN(a))return o;t[r+o]=a}return o}function k(t,e,r,i){return Q(z(e,t.length-r),t,r,i)}function S(t,e,r,i){return Q(G(e),t,r,i)}function C(t,e,r,i){return S(t,e,r,i)}function A(t,e,r,i){return Q($(e),t,r,i)}function _(t,e,r,i){return Q(X(e,t.length-r),t,r,i)}function L(t,e,r){return J.fromByteArray(0===e&&r===t.length?t:t.slice(e,r))}function R(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;r>n;){var s=t[n],o=null,a=s>239?4:s>223?3:s>191?2:1;if(r>=n+a){var h,u,p,c;switch(a){case 1:128>s&&(o=s);break;case 2:h=t[n+1],128===(192&h)&&(c=(31&s)<<6|63&h,c>127&&(o=c));break;case 3:h=t[n+1],u=t[n+2],128===(192&h)&&128===(192&u)&&(c=(15&s)<<12|(63&h)<<6|63&u,c>2047&&(55296>c||c>57343)&&(o=c));break;case 4:h=t[n+1],u=t[n+2],p=t[n+3],128===(192&h)&&128===(192&u)&&128===(192&p)&&(c=(15&s)<<18|(63&h)<<12|(63&u)<<6|63&p,c>65535&&1114112>c&&(o=c))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),n+=a}return T(i)}function T(t){var e=t.length;if(tt>=e)return String.fromCharCode.apply(String,t);for(var r="",i=0;e>i;)r+=String.fromCharCode.apply(String,t.slice(i,i+=tt));return r}function N(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;r>n;++n)i+=String.fromCharCode(127&t[n]);return i}function I(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;r>n;++n)i+=String.fromCharCode(t[n]);return i}function P(t,e,r){var i=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>i)&&(r=i);for(var n="",s=e;r>s;++s)n+=W(t[s]);return n}function B(t,e,r){for(var i=t.slice(e,r),n="",s=0;s<i.length;s+=2)n+=String.fromCharCode(i[s]+256*i[s+1]);return n}function O(t,e,r){if(t%1!==0||0>t)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,i,n,s){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||s>e)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function U(t,e,r,i){0>e&&(e=65535+e+1);for(var n=0,s=Math.min(t.length-r,2);s>n;++n)t[r+n]=(e&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function F(t,e,r,i){0>e&&(e=4294967295+e+1);for(var n=0,s=Math.min(t.length-r,4);s>n;++n)t[r+n]=e>>>8*(i?n:3-n)&255}function D(t,e,r,i){if(r+i>t.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("Index out of range")}function V(t,e,r,i,n){return n||D(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,e,r,i,23,4),r+4}function j(t,e,r,i,n){return n||D(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,e,r,i,52,8),r+8}function Y(t){if(t=q(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function q(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function W(t){return 16>t?"0"+t.toString(16):t.toString(16)}function z(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],o=0;i>o;++o){if(r=t.charCodeAt(o),r>55295&&57344>r){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(56320>r){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,128>r){if((e-=1)<0)break;s.push(r)}else if(2048>r){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(65536>r){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function G(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function X(t,e){for(var r,i,n,s=[],o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),i=r>>8,n=r%256,s.push(n),s.push(i);return s}function $(t){return J.toByteArray(Y(t))}function Q(t,e,r,i){for(var n=0;i>n&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function H(t){return t!==t}var J=t("base64-js"),K=t("ieee754"),Z=t("isarray");r.Buffer=o,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:i(),r.kMaxLength=n(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,r){return a(null,t,e,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,r){return u(null,t,e,r)},o.allocUnsafe=function(t){return p(null,t)},o.allocUnsafeSlow=function(t){return p(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,n=0,s=Math.min(r,i);s>n;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return i>r?-1:r>i?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Z(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=o.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var s=t[r];if(!o.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,n),n+=s.length}return i},o.byteLength=v,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;t>e;e+=2)x(this,e,e+1);return this},o.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;t>e;e+=4)x(this,e,e+3),x(this,e+1,e+2);return this},o.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;t>e;e+=8)x(this,e,e+7),x(this,e+1,e+6),x(this,e+2,e+5),x(this,e+3,e+4);return this},o.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?R(this,0,t):y.apply(this,arguments)},o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:0===o.compare(this,t)},o.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},o.prototype.compare=function(t,e,r,i,n){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),0>e||r>t.length||0>i||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,n>>>=0,this===t)return 0;for(var s=n-i,a=r-e,h=Math.min(s,a),u=this.slice(i,n),p=t.slice(e,r),c=0;h>c;++c)if(u[c]!==p[c]){s=u[c],a=p[c];break}return a>s?-1:s>a?1:0},o.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},o.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},o.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},o.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e=0|e,isFinite(r)?(r=0|r,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(0>r||0>e)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return E(this,t,e,r);case"utf8":case"utf-8":return k(this,t,e,r);case"ascii":return S(this,t,e,r);case"latin1":case"binary":return C(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),t>e&&(e=t);var i;if(o.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=o.prototype;else{var n=e-t;i=new o(n,void 0);for(var s=0;n>s;++s)i[s]=this[s+t]}return i},o.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||O(t,e,this.length);for(var i=this[t],n=1,s=0;++s<e&&(n*=256);)i+=this[t+s]*n;return i},o.prototype.readUIntBE=function(t,e,r){t=0|t,e=0|e,r||O(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},o.prototype.readUInt8=function(t,e){return e||O(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||O(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||O(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||O(t,e,this.length);for(var i=this[t],n=1,s=0;++s<e&&(n*=256);)i+=this[t+s]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*e)),i},o.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||O(t,e,this.length);for(var i=e,n=1,s=this[t+--i];i>0&&(n*=256);)s+=this[t+--i]*n;return n*=128,s>=n&&(s-=Math.pow(2,8*e)),s},o.prototype.readInt8=function(t,e){return e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||O(t,4,this.length),K.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||O(t,4,this.length),K.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||O(t,8,this.length),K.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||O(t,8,this.length),K.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=0|e,r=0|r,!i){var n=Math.pow(2,8*r)-1;M(this,t,e,r,n,0)}var s=1,o=0;for(this[e]=255&t;++o<r&&(s*=256);)this[e+o]=t/s&255;return e+r},o.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=0|e,r=0|r,!i){var n=Math.pow(2,8*r)-1;M(this,t,e,r,n,0)}var s=r-1,o=1;for(this[e+s]=255&t;--s>=0&&(o*=256);)this[e+s]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e=0|e,r||M(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=0|e,r||M(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):U(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=0|e,r||M(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):U(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=0|e,r||M(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):F(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=0|e,r||M(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=0|e,!i){var n=Math.pow(2,8*r-1);M(this,t,e,r,n-1,-n)}var s=0,o=1,a=0;for(this[e]=255&t;++s<r&&(o*=256);)0>t&&0===a&&0!==this[e+s-1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},o.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=0|e,!i){var n=Math.pow(2,8*r-1);M(this,t,e,r,n-1,-n)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)0>t&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e=0|e,r||M(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e=0|e,r||M(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):U(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e=0|e,r||M(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):U(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e=0|e,r||M(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):F(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e=0|e,r||M(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return V(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return V(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return j(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return j(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&r>i&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>i)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var n,s=i-r;if(this===t&&e>r&&i>e)for(n=s-1;n>=0;--n)t[n+e]=this[n+r];else if(1e3>s||!o.TYPED_ARRAY_SUPPORT)for(n=0;s>n;++n)t[n+e]=this[n+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+s),e);return s},o.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===t.length){var n=t.charCodeAt(0);256>n&&(t=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!o.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t=255&t);if(0>e||this.length<e||this.length<r)throw new RangeError("Out of range index");if(e>=r)return this;e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;r>s;++s)this[s]=t;else{var a=o.isBuffer(t)?t:z(new o(t,i).toString()),h=a.length;for(s=0;r-e>s;++s)this[s+e]=a[s%h]}return this};var et=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":3,ieee754:6,isarray:7}],5:[function(e,r,i){!function(e,n){"object"==typeof i&&"undefined"!=typeof r?n(i):"function"==typeof t&&t.amd?t(["exports"],n):n(e.estreeWalker=e.estreeWalker||{})}(this,function(t){"use strict";function e(t,e){var r=e.enter,n=e.leave;i(t,null,r,n)}function r(t){return"[object Array]"===o.call(t)}function i(t,e,o,a,h,u){if(t&&(!o||(n.shouldSkip=!1,o.call(n,t,e,h,u),!n.shouldSkip))){for(var p=s[t.type]||(s[t.type]=Object.keys(t).filter(function(e){return"object"==typeof t[e]})),c=0;c<p.length;c+=1){var l=p[c],f=t[l];if(r(f))for(var d=0;d<f.length;d+=1)i(f[d],t,o,a,l,d);else f&&f.type&&i(f,t,o,a,l,null)}a&&a(t,e,h,u)}}var n={skip:function(){return n.shouldSkip=!0},shouldSkip:!1},s={},o=Object.prototype.toString;t.walk=e,Object.defineProperty(t,"__esModule",{value:!0})})},{}],6:[function(t,e,r){r.read=function(t,e,r,i,n){var s,o,a=8*n-i-1,h=(1<<a)-1,u=h>>1,p=-7,c=r?n-1:0,l=r?-1:1,f=t[e+c];for(c+=l,s=f&(1<<-p)-1,f>>=-p,p+=a;p>0;s=256*s+t[e+c],c+=l,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=i;p>0;o=256*o+t[e+c],c+=l,p-=8);if(0===s)s=1-u;else{if(s===h)return o?0/0:(f?-1:1)*(1/0);o+=Math.pow(2,i),s-=u}return(f?-1:1)*o*Math.pow(2,s-i)},r.write=function(t,e,r,i,n,s){var o,a,h,u=8*s-n-1,p=(1<<u)-1,c=p>>1,l=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:s-1,d=i?1:-1,m=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),e+=o+c>=1?l/h:l*Math.pow(2,1-c),e*h>=2&&(o++,h/=2),o+c>=p?(a=0,o=p):o+c>=1?(a=(e*h-1)*Math.pow(2,n),o+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;t[r+f]=255&a,f+=d,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;t[r+f]=255&o,f+=d,o/=256,u-=8);t[r+f-d]|=128*m}},{}],7:[function(t,e){var r={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},{}],8:[function(t,e){(function(r){"use strict";function i(t,e,r){this.start=t,this.end=e,this.original=r,this.intro="",this.outro="",this.content=r,this.storeName=!1,this.edited=!1,Object.defineProperties(this,{previous:{writable:!0,value:null},next:{writable:!0,value:null}})}function n(t){this.version=3,this.file=t.file,this.sources=t.sources,this.sourcesContent=t.sourcesContent,this.names=t.names,this.mappings=t.mappings}function s(t){var e=t.split("\n"),r=e.filter(function(t){return/^\t+/.test(t)}),i=e.filter(function(t){return/^ {2,}/.test(t)});if(0===r.length&&0===i.length)return null;if(r.length>=i.length)return" ";var n=i.reduce(function(t,e){var r=/^ +/.exec(e)[0].length;return Math.min(r,t)},1/0);return new Array(n+1).join(" ")}function o(t){return new Array(t.split("\n").length).join(";")}function a(t){function e(t,e){return t.start<=e&&e<t.end}function r(t,e){return{line:t.line,column:e-t.start}}var i=t.split("\n"),n=0,s=i.map(function(t,e){var r=n+t.length+1,i={start:n,end:r,line:e};return n=r,i}),o=0;return function(t){for(var i=s[o],n=t>=i.end?1:-1;i;){if(e(i,t))return r(i,t);o+=n,i=s[o]}}}function h(t,e,r,i,n,s,h,u,p){function c(t,e,r,i,n){(n||t.length&&g.test(t))&&v.push({generatedCodeLine:m,generatedCodeColumn:y,sourceCodeLine:r.line,sourceCodeColumn:r.column,sourceCodeName:i,sourceIndex:h});var s=t.split("\n"),o=s.pop();s.length?(m+=s.length,d[m]=v=[],y=o.length):y+=o.length,s=e.split("\n"),o=s.pop(),s.length?(r.line+=s.length,r.column=o.length):r.column+=o.length}function l(e,r){for(var i=e.start,o=!0;i<e.end;)(n||o||s[i])&&v.push({generatedCodeLine:m,generatedCodeColumn:y,sourceCodeLine:r.line,sourceCodeColumn:r.column,sourceCodeName:-1,sourceIndex:h}),"\n"===t[i]?(r.line+=1,r.column=0,m+=1,d[m]=v=[],y=0):(r.column+=1,y+=1),i+=1,o=!1}for(var d=[],m=e.split("\n").length-1,v=d[m]=[],y=0,x=a(t),b=!1;i;){var w=x(i.start);i.intro.length&&c(i.intro,"",w,-1,b),i.edited?c(i.content,i.original,w,i.storeName?p.indexOf(i.original):-1,b):l(i,w),i.outro.length&&c(i.outro,"",w,-1,b),(i.content||i.intro||i.outro)&&(b=!0);var E=i.next;i=E}return u.sourceIndex=u.sourceIndex||0,u.sourceCodeLine=u.sourceCodeLine||0,u.sourceCodeColumn=u.sourceCodeColumn||0,u.sourceCodeName=u.sourceCodeName||0,d.map(function(t){var e=0;return t.map(function(t){var r=[t.generatedCodeColumn-e,t.sourceIndex-u.sourceIndex,t.sourceCodeLine-u.sourceCodeLine,t.sourceCodeColumn-u.sourceCodeColumn];return e=t.generatedCodeColumn,u.sourceIndex=t.sourceIndex,u.sourceCodeLine=t.sourceCodeLine,u.sourceCodeColumn=t.sourceCodeColumn,~t.sourceCodeName&&(r.push(t.sourceCodeName-u.sourceCodeName),u.sourceCodeName=t.sourceCodeName),f.encode(r)}).join(",")}).join(";")+o(r)}function u(t,e){var r=t.split(/[\/\\]/),i=e.split(/[\/\\]/);for(r.pop();r[0]===i[0];)r.shift(),i.shift();if(r.length)for(var n=r.length;n--;)r[n]="..";return r.concat(i).join("/")}function p(t){return"[object Object]"===v.call(t)}function c(t,e){void 0===e&&(e={});var r=new i(0,t.length,t);Object.defineProperties(this,{original:{writable:!0,value:t},outro:{writable:!0,value:""},intro:{writable:!0,value:""},firstChunk:{writable:!0,value:r},lastChunk:{writable:!0,value:r},lastSearchedChunk:{writable:!0,value:r},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:e.filename},indentExclusionRanges:{writable:!0,value:e.indentExclusionRanges},sourcemapLocations:{writable:!0,value:{}},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:s(t)}}),this.byStart[0]=r,this.byEnd[t.length]=r}function l(t){void 0===t&&(t={}),this.intro=t.intro||"",this.separator=void 0!==t.separator?t.separator:"\n",this.sources=[],this.uniqueSources=[],this.uniqueSourceIndexByFilename={}}var f=t("vlq");i.prototype={append:function(t){this.outro+=t},clone:function(){var t=new i(this.start,this.end,this.original);return t.intro=this.intro,t.outro=this.outro,t.content=this.content,t.storeName=this.storeName,t.edited=this.edited,t},contains:function(t){return this.start<t&&t<this.end},eachNext:function(t){for(var e=this;e;)t(e),e=e.next},eachPrevious:function(t){for(var e=this;e;)t(e),e=e.previous},edit:function(t,e){return this.content=t,this.intro="",this.outro="",this.storeName=e,this.edited=!0,this},prepend:function(t){this.intro=t+this.intro},split:function(t){var e=t-this.start,r=this.original.slice(0,e),n=this.original.slice(e);this.original=r;var s=new i(t,this.end,n);return s.outro=this.outro,this.outro="",this.end=t,this.edited?(s.edit("",!1),this.content=""):this.content=r,s.next=this.next,s.next&&(s.next.previous=s),s.previous=this,this.next=s,s},toString:function(){return this.intro+this.content+this.outro},trimEnd:function(t){if(this.outro=this.outro.replace(t,""),this.outro.length)return!0;var e=this.content.replace(t,"");return e.length?(e!==this.content&&this.split(this.start+e.length).edit("",!1),!0):(this.edit("",!1),this.intro=this.intro.replace(t,""),this.intro.length?!0:void 0)},trimStart:function(t){if(this.intro=this.intro.replace(t,""),this.intro.length)return!0;var e=this.content.replace(t,"");return e.length?(e!==this.content&&(this.split(this.end-e.length),this.edit("",!1)),!0):(this.edit("",!1),this.outro=this.outro.replace(t,""),this.outro.length?!0:void 0)}};var d;d="undefined"!=typeof window&&"function"==typeof window.btoa?window.btoa:"function"==typeof r?function(t){return new r(t).toString("base64")}:function(){throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")};var m=d;n.prototype={toString:function(){return JSON.stringify(this)},toUrl:function(){return"data:application/json;charset=utf-8;base64,"+m(this.toString())}};var g=/\S/,v=Object.prototype.toString;c.prototype={addSourcemapLocation:function(t){this.sourcemapLocations[t]=!0},append:function(t){if("string"!=typeof t)throw new TypeError("outro content must be a string");return this.outro+=t,this},clone:function(){for(var t=new c(this.original,{filename:this.filename}),e=this.firstChunk,r=t.firstChunk=t.lastSearchedChunk=e.clone();e;){t.byStart[r.start]=r,t.byEnd[r.end]=r;var i=e.next,n=i&&i.clone();n&&(r.next=n,n.previous=r,r=n),e=i}return t.lastChunk=r,this.indentExclusionRanges&&(t.indentExclusionRanges="number"==typeof this.indentExclusionRanges[0]?[this.indentExclusionRanges[0],this.indentExclusionRanges[1]]:this.indentExclusionRanges.map(function(t){return[t.start,t.end]})),Object.keys(this.sourcemapLocations).forEach(function(e){t.sourcemapLocations[e]=!0}),t},generateMap:function(t){t=t||{};var e=Object.keys(this.storedNames),r=new n({file:t.file?t.file.split(/[\/\\]/).pop():null,sources:[t.source?u(t.file||"",t.source):null],sourcesContent:t.includeContent?[this.original]:[null],names:e,mappings:this.getMappings(t.hires,0,{},e)});return r},getIndentString:function(){return null===this.indentStr?" ":this.indentStr},getMappings:function(t,e,r,i){return h(this.original,this.intro,this.outro,this.firstChunk,t,this.sourcemapLocations,e,r,i)},indent:function(t,e){var r=this,i=/^[^\r\n]/gm;if(p(t)&&(e=t,t=void 0),t=void 0!==t?t:this.indentStr||" ",""===t)return this;e=e||{};var n={};if(e.exclude){var s="number"==typeof e.exclude[0]?[e.exclude]:e.exclude;s.forEach(function(t){for(var e=t[0];e<t[1];e+=1)n[e]=!0})}var o=e.indentStart!==!1,a=function(e){return o?""+t+e:(o=!0,e)};this.intro=this.intro.replace(i,a);for(var h=0,u=this.firstChunk;u;){var c=u.end;if(u.edited)n[h]||(u.content=u.content.replace(i,a),u.content.length&&(o="\n"===u.content[u.content.length-1]));else for(h=u.start;c>h;){if(!n[h]){var l=r.original[h];if("\n"===l)o=!0;else if("\r"!==l&&o)if(o=!1,h===u.start)u.prepend(t);else{var f=u.split(h);f.prepend(t),r.byStart[h]=f,r.byEnd[h]=u,u=f}}h+=1}h=u.end,u=u.next}return this.outro=this.outro.replace(i,a),this},insert:function(){throw new Error("magicString.insert(...) is deprecated. Use insertRight(...) or insertLeft(...)")},insertLeft:function(t,e){if("string"!=typeof e)throw new TypeError("inserted content must be a string");this._split(t);var r=this.byEnd[t];return r?r.append(e):this.intro+=e,this},insertRight:function(t,e){if("string"!=typeof e)throw new TypeError("inserted content must be a string");this._split(t);var r=this.byStart[t];return r?r.prepend(e):this.outro+=e,this},move:function(t,e,r){if(r>=t&&e>=r)throw new Error("Cannot move a selection inside itself");this._split(t),this._split(e),this._split(r);var i=this.byStart[t],n=this.byEnd[e],s=i.previous,o=n.next,a=this.byStart[r];if(!a&&n===this.lastChunk)return this;var h=a?a.previous:this.lastChunk;return s&&(s.next=o),o&&(o.previous=s),h&&(h.next=i),a&&(a.previous=n),i.previous||(this.firstChunk=n.next),n.next||(this.lastChunk=i.previous,this.lastChunk.next=null),i.previous=h,n.next=a,h||(this.firstChunk=i),a||(this.lastChunk=n),this},overwrite:function(t,e,r,n){var s=this;if("string"!=typeof r)throw new TypeError("replacement content must be a string");for(;0>t;)t+=s.original.length;for(;0>e;)e+=s.original.length;if(e>this.original.length)throw new Error("end is out of bounds");if(t===e)throw new Error("Cannot overwrite a zero-length range – use insertLeft or insertRight instead");if(this._split(t),this._split(e),n){var o=this.original.slice(t,e);this.storedNames[o]=!0}var a=this.byStart[t],h=this.byEnd[e];if(a){if(a.edit(r,n),a!==h){for(var u=a.next;u!==h;)u.edit("",!1),u=u.next;u.edit("",!1)}}else{var p=new i(t,e,"").edit(r,n);h.next=p,p.previous=h}return this},prepend:function(t){if("string"!=typeof t)throw new TypeError("outro content must be a string");return this.intro=t+this.intro,this},remove:function(t,e){for(var r=this;0>t;)t+=r.original.length;for(;0>e;)e+=r.original.length;if(t===e)return this;if(0>t||e>this.original.length)throw new Error("Character is out of bounds");if(t>e)throw new Error("end must be greater than start");return this.overwrite(t,e,"",!1)},slice:function(t,e){var r=this;for(void 0===t&&(t=0),void 0===e&&(e=this.original.length);0>t;)t+=r.original.length;for(;0>e;)e+=r.original.length;for(var i="",n=this.firstChunk;n&&(n.start>t||n.end<=t);){if(n.start<e&&n.end>=e)return i;n=n.next}if(n&&n.edited&&n.start!==t)throw new Error("Cannot use replaced character "+t+" as slice start anchor.");for(var s=n;n;){!n.intro||s===n&&n.start!==t||(i+=n.intro);var o=n.start<e&&n.end>=e;if(o&&n.edited&&n.end!==e)throw new Error("Cannot use replaced character "+e+" as slice end anchor.");var a=s===n?t-n.start:0,h=o?n.content.length+e-n.end:n.content.length;if(i+=n.content.slice(a,h),!n.outro||o&&n.end!==e||(i+=n.outro),o)break;n=n.next}return i},snip:function(t,e){var r=this.clone();return r.remove(0,t),r.remove(e,r.original.length),r},_split:function(t){var e=this;if(!this.byStart[t]&&!this.byEnd[t])for(var r=this.lastSearchedChunk,i=t>r.end;;){if(r.contains(t))return e._splitChunk(r,t);r=i?e.byStart[r.end]:e.byEnd[r.start]}},_splitChunk:function(t,e){if(t.edited&&t.content.length){var r=a(this.original)(e);throw new Error("Cannot split a chunk that has already been edited ("+r.line+":"+r.column+' – "'+t.original+'")')}var i=t.split(e);return this.byEnd[e]=t,this.byStart[e]=i,this.byEnd[i.end]=i,t===this.lastChunk&&(this.lastChunk=i),this.lastSearchedChunk=t,!0},toString:function(){for(var t=this.intro,e=this.firstChunk;e;)t+=e.toString(),e=e.next;return t+this.outro},trimLines:function(){return this.trim("[\\r\\n]")},trim:function(t){return this.trimStart(t).trimEnd(t)},trimEnd:function(t){var e=this,r=new RegExp((t||"\\s")+"+$");if(this.outro=this.outro.replace(r,""),this.outro.length)return this;var i=this.lastChunk;do{var n=i.end,s=i.trimEnd(r);if(i.end!==n&&(e.lastChunk=i.next,e.byEnd[i.end]=i,e.byStart[i.next.start]=i.next),s)return e;i=i.previous}while(i);return this},trimStart:function(t){var e=this,r=new RegExp("^"+(t||"\\s")+"+");if(this.intro=this.intro.replace(r,""),this.intro.length)return this;var i=this.firstChunk;do{var n=i.end,s=i.trimStart(r);if(i.end!==n&&(i===e.lastChunk&&(e.lastChunk=i.next),e.byEnd[i.end]=i,e.byStart[i.next.start]=i.next),s)return e;i=i.next}while(i);return this}};var y=Object.prototype.hasOwnProperty;l.prototype={addSource:function(t){if(t instanceof c)return this.addSource({content:t,filename:t.filename,separator:this.separator});if(!p(t)||!t.content)throw new Error("bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`");if(["filename","indentExclusionRanges","separator"].forEach(function(e){y.call(t,e)||(t[e]=t.content[e])}),void 0===t.separator&&(t.separator=this.separator),t.filename)if(y.call(this.uniqueSourceIndexByFilename,t.filename)){var e=this.uniqueSources[this.uniqueSourceIndexByFilename[t.filename]];if(t.content.original!==e.content)throw new Error("Illegal source: same filename ("+t.filename+"), different contents")}else this.uniqueSourceIndexByFilename[t.filename]=this.uniqueSources.length,this.uniqueSources.push({filename:t.filename,content:t.content.original});return this.sources.push(t),this},append:function(t,e){return this.addSource({content:new c(t),separator:e&&e.separator||""}),this},clone:function(){var t=new l({intro:this.intro,separator:this.separator});return this.sources.forEach(function(e){t.addSource({filename:e.filename,content:e.content.clone(),separator:e.separator})}),t},generateMap:function(t){var e=this;t=t||{};var r={},i=[];this.sources.forEach(function(t){Object.keys(t.content.storedNames).forEach(function(t){~i.indexOf(t)||i.push(t)})});var s=o(this.intro)+this.sources.map(function(n,s){var a,h=s>0?o(n.separator)||",":"";if(n.filename){var u=e.uniqueSourceIndexByFilename[n.filename];a=n.content.getMappings(t.hires,u,r,i)}else a=o(n.content.toString());return h+a}).join("");return new n({file:t.file?t.file.split(/[\/\\]/).pop():null,sources:this.uniqueSources.map(function(e){return t.file?u(t.file,e.filename):e.filename}),sourcesContent:this.uniqueSources.map(function(e){return t.includeContent?e.content:null}),names:i,mappings:s})},getIndentString:function(){var t={};return this.sources.forEach(function(e){var r=e.content.indentStr;null!==r&&(t[r]||(t[r]=0),t[r]+=1)}),Object.keys(t).sort(function(e,r){return t[e]-t[r]})[0]||" "},
|
|
5
|
+
indent:function(t){var e=this;if(arguments.length||(t=this.getIndentString()),""===t)return this;var r=!this.intro||"\n"===this.intro.slice(-1);return this.sources.forEach(function(i,n){var s=void 0!==i.separator?i.separator:e.separator,o=r||n>0&&/\r?\n$/.test(s);i.content.indent(t,{exclude:i.indentExclusionRanges,indentStart:o}),r="\n"===i.content.toString().slice(0,-1)}),this.intro&&(this.intro=t+this.intro.replace(/^[^\n]/gm,function(e,r){return r>0?t+e:e})),this},prepend:function(t){return this.intro=t+this.intro,this},toString:function(){var t=this,e=this.sources.map(function(e,r){var i=void 0!==e.separator?e.separator:t.separator,n=(r>0?i:"")+e.content.toString();return n}).join("");return this.intro+e},trimLines:function(){return this.trim("[\\r\\n]")},trim:function(t){return this.trimStart(t).trimEnd(t)},trimStart:function(t){var e=this,r=new RegExp("^"+(t||"\\s")+"+");if(this.intro=this.intro.replace(r,""),!this.intro){var i,n=0;do{if(i=e.sources[n],!i)break;i.content.trimStart(t),n+=1}while(""===i.content.toString())}return this},trimEnd:function(t){var e,r=this,i=new RegExp((t||"\\s")+"+$"),n=this.sources.length-1;do{if(e=r.sources[n],!e){r.intro=r.intro.replace(i,"");break}e.content.trimEnd(t),n-=1}while(""===e.content.toString());return this}},c.Bundle=l,e.exports=c}).call(this,t("buffer").Buffer)},{buffer:4,vlq:9}],9:[function(e,r,i){!function(e,n){"object"==typeof i&&"undefined"!=typeof r?n(i):"function"==typeof t&&t.amd?t(["exports"],n):n(e.vlq={})}(this,function(t){"use strict";function e(t){var e,r,i,s,o=[],a=t.length,h=0,u=0;for(e=0;a>e;e+=1){if(i=n[t[e]],void 0===i)throw new Error("Invalid character ("+t[e]+")");r=32&i,i&=31,u+=i<<h,r?h+=5:(s=1&u,u>>=1,o.push(s?-u:u),u=h=0)}return o}function r(t){var e,r;if("number"==typeof t)e=i(t);else for(e="",r=0;r<t.length;r+=1)e+=i(t[r]);return e}function i(t){var e,r="";0>t?t=-t<<1|1:t<<=1;do e=31&t,t>>=5,t>0&&(e|=32),r+=s[e];while(t>0);return r}t.decode=e,t.encode=r;var n={},s={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split("").forEach(function(t,e){n[t]=e,s[e]=t})})},{}]},{},[1])(1)});
|
metadata
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: optimize-js
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: '1.0'
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Yaroslav Konoplov
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-12-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: execjs
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: bundler
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '1.7'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '1.7'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '10.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '10.0'
|
|
55
|
+
description: optimize-js makes JavaScript files load faster. This gem provider Ruby
|
|
56
|
+
and Rails asset pipeline integration for optimize-js.
|
|
57
|
+
email: eahome00@gmail.com
|
|
58
|
+
executables: []
|
|
59
|
+
extensions: []
|
|
60
|
+
extra_rdoc_files: []
|
|
61
|
+
files:
|
|
62
|
+
- ".gitignore"
|
|
63
|
+
- ".travis.yml"
|
|
64
|
+
- Gemfile
|
|
65
|
+
- LICENCE
|
|
66
|
+
- OPTIMIZE-JS-LICENCE
|
|
67
|
+
- README.md
|
|
68
|
+
- Rakefile
|
|
69
|
+
- lib/optimize-js.rb
|
|
70
|
+
- lib/optimize-js/railtie.rb
|
|
71
|
+
- lib/optimize-js/sprockets-processor.rb
|
|
72
|
+
- lib/optimize-js/version.rb
|
|
73
|
+
- optimize-js.gemspec
|
|
74
|
+
- optimize-js.web.min.js
|
|
75
|
+
- test/test-optimize-js.rb
|
|
76
|
+
homepage: https://github.com/yivo/optimize-js
|
|
77
|
+
licenses:
|
|
78
|
+
- MIT
|
|
79
|
+
metadata: {}
|
|
80
|
+
post_install_message:
|
|
81
|
+
rdoc_options: []
|
|
82
|
+
require_paths:
|
|
83
|
+
- lib
|
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0'
|
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
|
+
requirements:
|
|
91
|
+
- - ">="
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '0'
|
|
94
|
+
requirements: []
|
|
95
|
+
rubyforge_project:
|
|
96
|
+
rubygems_version: 2.5.1
|
|
97
|
+
signing_key:
|
|
98
|
+
specification_version: 4
|
|
99
|
+
summary: Ruby wrapper and Rails asset pipeline integration for optimize-js.
|
|
100
|
+
test_files:
|
|
101
|
+
- test/test-optimize-js.rb
|