Skip to content

Instantly share code, notes, and snippets.

@homam
Last active June 23, 2017 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save homam/9fb52653f8552d09b8b3a8a09ac77843 to your computer and use it in GitHub Desktop.
Save homam/9fb52653f8552d09b8b3a8a09ac77843 to your computer and use it in GitHub Desktop.
TextTable = function (rows_, opts) {
if (!opts) opts = {};
var hsep = opts.hsep === undefined ? ' ' : opts.hsep;
var align = opts.align || [];
var stringLength = opts.stringLength
|| function (s) { return String(s).length; }
;
var dotsizes = reduce(rows_, function (acc, row) {
forEach(row, function (c, ix) {
var n = dotindex(c);
if (!acc[ix] || n > acc[ix]) acc[ix] = n;
});
return acc;
}, []);
var rows = map(rows_, function (row) {
return map(row, function (c_, ix) {
var c = String(c_);
if (align[ix] === '.') {
var index = dotindex(c);
var size = dotsizes[ix] + (/\./.test(c) ? 1 : 2)
- (stringLength(c) - index)
;
return c + Array(size).join(' ');
}
else return c;
});
});
var sizes = reduce(rows, function (acc, row) {
forEach(row, function (c, ix) {
var n = stringLength(c);
if (!acc[ix] || n > acc[ix]) acc[ix] = n;
});
return acc;
}, []);
return map(rows, function (row) {
return map(row, function (c, ix) {
var n = (sizes[ix] - stringLength(c)) || 0;
var s = Array(Math.max(n + 1, 1)).join(' ');
if (align[ix] === 'r' || align[ix] === '.') {
return s + c;
}
if (align[ix] === 'c') {
return Array(Math.ceil(n / 2 + 1)).join(' ')
+ c + Array(Math.floor(n / 2 + 1)).join(' ')
;
}
return c + s;
}).join(hsep).replace(/\s+$/, '');
}).join('\n');
};
function dotindex (c) {
var m = /\.[^.]*$/.exec(c);
return m ? m.index + 1 : c.length;
}
function reduce (xs, f, init) {
if (xs.reduce) return xs.reduce(f, init);
var i = 0;
var acc = arguments.length >= 3 ? init : xs[i++];
for (; i < xs.length; i++) {
f(acc, xs[i], i);
}
return acc;
}
function forEach (xs, f) {
if (xs.forEach) return xs.forEach(f);
for (var i = 0; i < xs.length; i++) {
f.call(xs, xs[i], i);
}
}
function map (xs, f) {
if (xs.map) return xs.map(f);
var res = [];
for (var i = 0; i < xs.length; i++) {
res.push(f.call(xs, xs[i], i));
}
return res;
}
.nvd3 .nv-axis line,.nvd3 .nv-axis path{fill:none;shape-rendering:crispEdges}.nv-brush .extent,.nvd3 .background path,.nvd3 .nv-axis line,.nvd3 .nv-axis path{shape-rendering:crispEdges}.nv-distx,.nv-disty,.nv-noninteractive,.nvd3 .nv-axis,.nvd3.nv-pie .nv-label,.nvd3.nv-sparklineplus g.nv-hoverValue{pointer-events:none}.nvtooltip,svg.nvd3-svg{display:block;-webkit-touch-callout:none;-khtml-user-select:none}.nvd3 .nv-axis{opacity:1}.nvd3 .nv-axis.nv-disabled,.nvd3 .nv-controlsWrap .nv-legend .nv-check-box .nv-check{opacity:0}.nvd3 .nv-axis path{stroke:#000;stroke-opacity:.75}.nvd3 .nv-axis path.domain{stroke-opacity:.75}.nvd3 .nv-axis.nv-x path.domain{stroke-opacity:0}.nvd3 .nv-axis line{stroke:#e5e5e5}.nvd3 .nv-axis .zero line, .nvd3 .nv-axis line.zero{stroke-opacity:.75}.nvd3 .nv-axis .nv-axisMaxMin text{font-weight:700}.nvd3 .x .nv-axis .nv-axisMaxMin text,.nvd3 .x2 .nv-axis .nv-axisMaxMin text,.nvd3 .x3 .nv-axis .nv-axisMaxMin text{text-anchor:middle}.nvd3 .nv-bars rect{fill-opacity:.75;transition:fill-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear}.nvd3 .nv-bars rect.hover{fill-opacity:1}.nvd3 .nv-bars .hover rect{fill:#add8e6}.nvd3 .nv-bars text{fill:transparent}.nvd3 .nv-bars .hover text{fill:rgba(0,0,0,1)}.nvd3 .nv-discretebar .nv-groups rect,.nvd3 .nv-multibar .nv-groups rect,.nvd3 .nv-multibarHorizontal .nv-groups rect{stroke-opacity:0;transition:fill-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear}.nvd3 .nv-candlestickBar .nv-ticks rect:hover,.nvd3 .nv-discretebar .nv-groups rect:hover,.nvd3 .nv-multibar .nv-groups rect:hover,.nvd3 .nv-multibarHorizontal .nv-groups rect:hover{fill-opacity:1}.nvd3 .nv-discretebar .nv-groups text,.nvd3 .nv-multibarHorizontal .nv-groups text{font-weight:700;fill:rgba(0,0,0,1);stroke:transparent}.nvd3 .nv-boxplot circle{fill-opacity:.5}.nvd3 .nv-boxplot circle:hover,.nvd3 .nv-boxplot rect:hover{fill-opacity:1}.nvd3 line.nv-boxplot-median{stroke:#000}.nv-boxplot-tick:hover{stroke-width:2.5px}.nvd3.nv-bullet{font:10px sans-serif}.nvd3.nv-bullet .nv-measure{fill-opacity:.8}.nvd3.nv-bullet .nv-measure:hover{fill-opacity:1}.nvd3.nv-bullet .nv-marker{stroke:#000;stroke-width:2px}.nvd3.nv-bullet .nv-markerTriangle{stroke:#000;fill:#fff;stroke-width:1.5px}.nvd3.nv-bullet .nv-tick line{stroke:#666;stroke-width:.5px}.nvd3.nv-bullet .nv-range.nv-s0{fill:#eee}.nvd3.nv-bullet .nv-range.nv-s1{fill:#ddd}.nvd3.nv-bullet .nv-range.nv-s2{fill:#ccc}.nvd3.nv-bullet .nv-title{font-size:14px;font-weight:700}.nvd3.nv-bullet .nv-subtitle{fill:#999}.nvd3.nv-bullet .nv-range{fill:#bababa;fill-opacity:.4}.nvd3.nv-bullet .nv-range:hover{fill-opacity:.7}.nvd3.nv-candlestickBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.positive rect{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.negative rect{stroke:#d62728;fill:#d62728}.with-transitions .nv-candlestickBar .nv-ticks .nv-tick{transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-moz-transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-webkit-transition:stroke-width 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-candlestickBar .nv-ticks line{stroke:#333}.nvd3 .nv-check-box .nv-box{fill-opacity:0;stroke-width:2}.nvd3 .nv-check-box .nv-check{fill-opacity:0;stroke-width:4}.nvd3 .nv-series.nv-disabled .nv-check-box .nv-check{fill-opacity:0;stroke-opacity:0}.nvd3.nv-linePlusBar .nv-bar rect{fill-opacity:.75}.nvd3.nv-linePlusBar .nv-bar rect:hover{fill-opacity:1}.nvd3 .nv-groups path.nv-line{fill:none}.nvd3 .nv-groups path.nv-area{stroke:none}.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point{fill-opacity:0;stroke-opacity:0}.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point{fill-opacity:.5!important;stroke-opacity:.5!important}.with-transitions .nvd3 .nv-groups .nv-point{transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-moz-transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-webkit-transition:stroke-width 250ms linear,stroke-opacity 250ms linear}.nvd3 .nv-groups .nv-point.hover,.nvd3.nv-scatter .nv-groups .nv-point.hover{stroke-width:7px;fill-opacity:.95!important;stroke-opacity:.95!important}.nvd3 .nv-point-paths path{stroke:#aaa;stroke-opacity:0;fill:#eee;fill-opacity:0}.nvd3 .nv-indexLine{cursor:ew-resize}svg.nvd3-svg{-webkit-user-select:none;-ms-user-select:none;-moz-user-select:none;user-select:none;width:100%;height:100%}.nvtooltip.with-3d-shadow,.with-3d-shadow .nvtooltip{-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.nvd3 text{font:400 12px Arial}.nvd3 .title{font:700 14px Arial}.nvd3 .nv-background{fill:#fff;fill-opacity:0}.nvd3.nv-noData{font-size:18px;font-weight:700}.nv-brush .extent{fill-opacity:.125}.nv-brush .resize path{fill:#eee;stroke:#666}.nvd3 .nv-legend .nv-series{cursor:pointer}.nvd3 .nv-legend .nv-disabled circle{fill-opacity:0}.nvd3 .nv-brush .extent{fill-opacity:0!important}.nvd3 .nv-brushBackground rect{stroke:#000;stroke-width:.4;fill:#fff;fill-opacity:.7}.nvd3.nv-ohlcBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive{stroke:#2ca02c}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative{stroke:#d62728}.nvd3 .background path{fill:none;stroke:#EEE;stroke-opacity:.4}.nvd3 .foreground path{fill:none;stroke-opacity:.7}.nvd3 .nv-parallelCoordinates-brush .extent{fill:#fff;fill-opacity:.6;stroke:gray;shape-rendering:crispEdges}.nvd3 .nv-parallelCoordinates .hover{fill-opacity:1;stroke-width:3px}.nvd3 .missingValuesline line{fill:none;stroke:#000;stroke-width:1;stroke-opacity:1;stroke-dasharray:5,5}.nvd3.nv-pie .nv-pie-title{font-size:24px;fill:rgba(19,196,249,.59)}.nvd3.nv-pie .nv-slice text{stroke:#000;stroke-width:0}.nvd3.nv-pie path{transition:fill-opacity 250ms linear,stroke-width 250ms linear,stroke-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear,stroke-width 250ms linear,stroke-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear,stroke-width 250ms linear,stroke-opacity 250ms linear;stroke:#fff;stroke-width:1px;stroke-opacity:1;fill-opacity:.7}.nvd3.nv-pie .hover path{fill-opacity:1}.nvd3.nv-pie .nv-label rect{fill-opacity:0;stroke-opacity:0}.nvd3 .nv-groups .nv-point.hover{stroke-width:20px;stroke-opacity:.5}.nvd3 .nv-scatter .nv-point.hover{fill-opacity:1}.nvd3.nv-sparkline path{fill:none}.nvd3.nv-sparklineplus .nv-hoverValue line{stroke:#333;stroke-width:1.5px}.nvd3.nv-sparklineplus,.nvd3.nv-sparklineplus g{pointer-events:all}.nvd3 .nv-interactiveGuideLine,.nvtooltip{pointer-events:none}.nvd3 .nv-hoverArea{fill-opacity:0;stroke-opacity:0}.nvd3.nv-sparklineplus .nv-xValue,.nvd3.nv-sparklineplus .nv-yValue{stroke-width:0;font-size:.9em;font-weight:400}.nvd3.nv-sparklineplus .nv-yValue{stroke:#f66}.nvd3.nv-sparklineplus .nv-maxValue{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-sparklineplus .nv-minValue{stroke:#d62728;fill:#d62728}.nvd3.nv-sparklineplus .nv-currentValue{font-weight:700;font-size:1.1em}.nvtooltip h3,.nvtooltip table td.key{font-weight:400}.nvd3.nv-stackedarea path.nv-area{fill-opacity:.7;stroke-opacity:0;transition:fill-opacity 250ms linear,stroke-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear,stroke-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-stackedarea path.nv-area.hover{fill-opacity:.9}.nvd3.nv-stackedarea .nv-groups .nv-point{stroke-opacity:0;fill-opacity:0}.nvtooltip{position:absolute;color:rgba(0,0,0,1);padding:1px;z-index:10000;font-family:Arial;font-size:13px;text-align:left;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:rgba(255,255,255,.8);border:1px solid rgba(0,0,0,.5);border-radius:4px}.nvtooltip h3,.nvtooltip p{margin:0;text-align:center}.nvtooltip.with-transitions,.with-transitions .nvtooltip{transition:opacity 50ms linear;-moz-transition:opacity 50ms linear;-webkit-transition:opacity 50ms linear;transition-delay:200ms;-moz-transition-delay:200ms;-webkit-transition-delay:200ms}.nvtooltip.x-nvtooltip,.nvtooltip.y-nvtooltip{padding:8px}.nvtooltip h3{padding:4px 14px;line-height:18px;background-color:rgba(247,247,247,.75);color:rgba(0,0,0,1);border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.nvtooltip p{padding:5px 14px}.nvtooltip span{display:inline-block;margin:2px 0}.nvtooltip table{margin:6px;border-spacing:0}.nvtooltip table td{padding:2px 9px 2px 0;vertical-align:middle}.nvtooltip table td.key.total{font-weight:700}.nvtooltip table td.value{text-align:right;font-weight:700}.nvtooltip table tr.highlight td{padding:1px 9px 1px 0;border-bottom-style:solid;border-bottom-width:1px;border-top-style:solid;border-top-width:1px}.nvtooltip table td.legend-color-guide div{vertical-align:middle;width:12px;height:12px;border:1px solid #999}.nvtooltip .footer{padding:3px;text-align:center}.nvtooltip-pending-removal{pointer-events:none;display:none}.nvd3 line.nv-guideline{stroke:#ccc}
/*# sourceMappingURL=nv.d3.min.css.map */
.radar-chart .level {
stroke: grey;
stroke-width: 0.5;
}
.radar-chart .axis line {
stroke: grey;
stroke-width: 1;
}
.radar-chart .axis .legend {
font-family: sans-serif;
font-size: 10px;
}
.radar-chart .axis .legend.top {
dy:1em;
}
.radar-chart .axis .legend.left {
text-anchor: start;
}
.radar-chart .axis .legend.middle {
text-anchor: middle;
}
.radar-chart .axis .legend.right {
text-anchor: end;
}
.radar-chart .tooltip {
font-family: sans-serif;
font-size: 13px;
transition: opacity 200ms;
opacity: 0;
}
.radar-chart .tooltip.visible {
opacity: 1;
}
/* area transition when hovering */
.radar-chart .area {
stroke-width: 2;
fill-opacity: 0.5;
}
.radar-chart.focus .area {
fill-opacity: 0.1;
}
.radar-chart.focus .area.focused {
fill-opacity: 0.7;
}
.radar-chart .circle {
fill-opacity: 0.9;
}
/* transitions */
.radar-chart .area, .radar-chart .circle {
transition: opacity 300ms, fill-opacity 200ms;
opacity: 1;
}
.radar-chart .d3-enter, .radar-chart .d3-exit {
opacity: 0;
}
.presentation {
background-color: #1a1b13;
color: #c4c5b4;
position: absolute;
font-family: "Andale Mono", monospace;
margin: 0px !important;
font-size: 1em;
}
.presentation pre {
font-family: "Andale Mono", monospace;
margin: 0px !important;
}
.presentation table.plottable {
color: #c4c5b4;
border-spacing: 0px;
border-collapse: collapse;
}
.presentation table.plottable td {
padding: 0.25em;
border: solid 1px #333;
}
.presentation svg {
background-color: #fff;
}
.presentation svg.correlation-matrix {
font: 10px sans-serif;
padding: 10px;
}
.presentation svg.correlation-matrix .axis,
.presentation svg.correlation-matrix .frame {
shape-rendering: crispEdges;
}
.presentation svg.correlation-matrix .axis line {
stroke: #ddd;
}
.presentation svg.correlation-matrix .axis path {
display: none;
}
.presentation svg.correlation-matrix .frame {
fill: none;
stroke: #aaa;
}
.presentation svg.correlation-matrix circle {
fill-opacity: 0.7;
}
.presentation svg.correlation-matrix circle.hidden {
fill: #ccc !important;
}
.presentation svg.correlation-matrix .extent {
fill: #000;
fill-opacity: 0.125;
stroke: #fff;
}
.presentation svg .multi-chart .hide-y2 .y2 line,
.presentation svg .multi-chart .hide-y1 .y1 line {
display: none;
}
.presentation .d3-tip {
background: rgba(0,0,0,0.8);
-webkit-border-radius: 2px;
border-radius: 2px;
color: #fff;
line-height: 1;
padding: 12px;
}
.presentation .horizontal,
.presentation .vertical {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.presentation .horizontal {
border-right: 1px solid #ccc;
}
.presentation .regression .axis line {
stroke: #000;
stroke-width: 1;
}
.presentation .regression .domain {
fill: none;
shape-rendering: inherit;
stroke: #000;
}
.presentation .vertical {
border-bottom: 1px solid #ccc;
}
<!-- saved from url=(0125)http://127.0.0.1:4081/apis/projects/575422b0156bf736d3b6fb59/documents/qnmXBUp/execute/true/presentation?from_date=2017-01-01 -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="./underscore-min.js"></script>
<link rel="stylesheet" type="text/css" href="./index.css">
<style>
body {
background-color: #1A1B13;
margin: 0px;
padding: 0px;
}
.presentation {
width: 100%;
height: 100%;
}
</style>
<!-- document here refers to a Pipe document (not the js document object) -->
<!-- presentation code (LiveScript), safer/easier to store inside script tag rather than a variable like parameters & transformedResult -->
<script type="text/plain" id="transformation">R.pipe(
R.groupBy(x => {
const key = (x.operator_code || '').indexOf('_') > 0 ? x.operator_code : `${x.country_code}-${x.operator_code}`
return key
})
, R.map(R.map(x => [new Date(x.year_code, x.month_code - 1, 1).valueOf(), x.revenue]))
, R.toPairs
, R.map(([key, values]) => ({key, values}))
, R.sortBy(x => R.sum(x.values.map(x => x[1])) * -1)
)</script>
<script type="text/plain" id="presentation">// json
plot(withOptions(stackedArea, {
useInteractiveGuideline: true,
showControls: true,
showLegend: !true,
margin: {
left: 80,
right: 40
},
xAxis: {
label: 'time',
format: timestamp =>
d3.time.format('%a %b %d')(new Date(timestamp))
},
yAxis: {
label: 'growth'
, format: d3.format(',')
}
}))</script>
<script type="text/javascript">
window.transpilation = {"query":"babel","transformation":"babel","presentation":"babel"};
// obtained from query-string
window.compiledParameters = {"from_date":"2017-01-01"};
// obtained by executing the query on server side
window.queryResult = [{"country_code":"AE","operator_code":"AE_DU","year_code":2017,"month_code":1,"revenue":16186,"cost":941,"sales":351,"pixels":176},{"country_code":"AE","operator_code":"AE_DU","year_code":2017,"month_code":2,"revenue":12830,"cost":1062,"sales":400,"pixels":200},{"country_code":"AE","operator_code":"AE_DU","year_code":2017,"month_code":3,"revenue":11575,"cost":5253,"sales":1290,"pixels":956},{"country_code":"AE","operator_code":"AE_DU","year_code":2017,"month_code":4,"revenue":11132,"cost":12688,"sales":3817,"pixels":3356},{"country_code":"AE","operator_code":"AE_DU","year_code":2017,"month_code":5,"revenue":10108,"cost":1662,"sales":878,"pixels":621},{"country_code":"AE","operator_code":"AE_DU","year_code":2017,"month_code":6,"revenue":6665,"cost":3371,"sales":992,"pixels":817},{"country_code":"AE","operator_code":"AE_ETISALAT","year_code":2017,"month_code":1,"revenue":45519,"cost":5352,"sales":1225,"pixels":998},{"country_code":"AE","operator_code":"AE_ETISALAT","year_code":2017,"month_code":2,"revenue":42421,"cost":27808,"sales":7329,"pixels":5066},{"country_code":"AE","operator_code":"AE_ETISALAT","year_code":2017,"month_code":3,"revenue":50199,"cost":19954,"sales":6867,"pixels":3644},{"country_code":"AE","operator_code":"AE_ETISALAT","year_code":2017,"month_code":4,"revenue":45793,"cost":14159,"sales":4574,"pixels":3694},{"country_code":"AE","operator_code":"AE_ETISALAT","year_code":2017,"month_code":5,"revenue":44674,"cost":4622,"sales":1931,"pixels":1290},{"country_code":"AE","operator_code":"AE_ETISALAT","year_code":2017,"month_code":6,"revenue":30385,"cost":4264,"sales":1819,"pixels":1053},{"country_code":"AE","operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"AE","operator_code":null,"year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"AT","operator_code":"AT_DRIE","year_code":2017,"month_code":1,"revenue":19,"cost":0,"sales":0,"pixels":0},{"country_code":"AT","operator_code":"AT_DRIE","year_code":2017,"month_code":2,"revenue":16,"cost":0,"sales":0,"pixels":0},{"country_code":"AT","operator_code":"AT_DRIE","year_code":2017,"month_code":3,"revenue":11,"cost":0,"sales":0,"pixels":0},{"country_code":"AT","operator_code":"AT_DRIE","year_code":2017,"month_code":4,"revenue":13,"cost":0,"sales":0,"pixels":0},{"country_code":"AT","operator_code":"AT_DRIE","year_code":2017,"month_code":5,"revenue":13,"cost":0,"sales":0,"pixels":0},{"country_code":"AT","operator_code":"AT_DRIE","year_code":2017,"month_code":6,"revenue":11,"cost":0,"sales":0,"pixels":0},{"country_code":"AT","operator_code":"AT_TMOBILE","year_code":2017,"month_code":1,"revenue":14,"cost":0,"sales":0,"pixels":0},{"country_code":"AT","operator_code":"AT_TMOBILE","year_code":2017,"month_code":2,"revenue":8,"cost":0,"sales":0,"pixels":0},{"country_code":"AT","operator_code":"AT_TMOBILE","year_code":2017,"month_code":3,"revenue":8,"cost":0,"sales":0,"pixels":0},{"country_code":"AT","operator_code":"AT_TMOBILE","year_code":2017,"month_code":4,"revenue":5,"cost":0,"sales":0,"pixels":0},{"country_code":"AT","operator_code":"AT_TMOBILE","year_code":2017,"month_code":5,"revenue":5,"cost":0,"sales":0,"pixels":0},{"country_code":"AT","operator_code":"AT_TMOBILE","year_code":2017,"month_code":6,"revenue":5,"cost":0,"sales":0,"pixels":0},{"country_code":"AU","operator_code":"AU_OPTUS","year_code":2017,"month_code":1,"revenue":195,"cost":483,"sales":26,"pixels":22},{"country_code":"AU","operator_code":"AU_OPTUS","year_code":2017,"month_code":2,"revenue":1648,"cost":9087,"sales":480,"pixels":401},{"country_code":"AU","operator_code":"AU_OPTUS","year_code":2017,"month_code":3,"revenue":693,"cost":1467,"sales":133,"pixels":63},{"country_code":"AU","operator_code":"AU_OPTUS","year_code":2017,"month_code":4,"revenue":0,"cost":46,"sales":9,"pixels":2},{"country_code":"AU","operator_code":"AU_OPTUS","year_code":2017,"month_code":5,"revenue":471,"cost":0,"sales":13,"pixels":2},{"country_code":"AU","operator_code":"AU_OPTUS","year_code":2017,"month_code":6,"revenue":403,"cost":0,"sales":2,"pixels":0},{"country_code":"AU","operator_code":"AU_TELSTRA","year_code":2017,"month_code":1,"revenue":1490,"cost":5231,"sales":301,"pixels":217},{"country_code":"AU","operator_code":"AU_TELSTRA","year_code":2017,"month_code":2,"revenue":5253,"cost":13635,"sales":763,"pixels":583},{"country_code":"AU","operator_code":"AU_TELSTRA","year_code":2017,"month_code":3,"revenue":2574,"cost":5276,"sales":265,"pixels":228},{"country_code":"AU","operator_code":"AU_TELSTRA","year_code":2017,"month_code":4,"revenue":855,"cost":391,"sales":45,"pixels":17},{"country_code":"AU","operator_code":"AU_TELSTRA","year_code":2017,"month_code":5,"revenue":2078,"cost":173,"sales":21,"pixels":9},{"country_code":"AU","operator_code":"AU_TELSTRA","year_code":2017,"month_code":6,"revenue":1211,"cost":0,"sales":0,"pixels":0},{"country_code":"AU","operator_code":"AU_VIRGIN","year_code":2017,"month_code":1,"revenue":191,"cost":719,"sales":41,"pixels":30},{"country_code":"AU","operator_code":"AU_VIRGIN","year_code":2017,"month_code":2,"revenue":698,"cost":1345,"sales":77,"pixels":57},{"country_code":"AU","operator_code":"AU_VIRGIN","year_code":2017,"month_code":3,"revenue":248,"cost":236,"sales":10,"pixels":10},{"country_code":"AU","operator_code":"AU_VIRGIN","year_code":2017,"month_code":4,"revenue":110,"cost":47,"sales":4,"pixels":3},{"country_code":"AU","operator_code":"AU_VIRGIN","year_code":2017,"month_code":5,"revenue":224,"cost":57,"sales":6,"pixels":3},{"country_code":"AU","operator_code":"AU_VIRGIN","year_code":2017,"month_code":6,"revenue":90,"cost":0,"sales":0,"pixels":0},{"country_code":"AU","operator_code":"UNKNOWN","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"AU","operator_code":"UNKNOWN","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"AU","operator_code":"UNKNOWN","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"AU","operator_code":"UNKNOWN","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"AU","operator_code":"UNKNOWN","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"AU","operator_code":"UNKNOWN","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"AU","operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"AU","operator_code":null,"year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"BE","operator_code":"Base 20620","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"BE","operator_code":"Base 20620","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"BE","operator_code":"Base 20620","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"BE","operator_code":"Base 20620","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"BE","operator_code":"Base 20620","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"BE","operator_code":"Base 20620","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"BE","operator_code":"BE_MOBISTAR","year_code":2017,"month_code":1,"revenue":1078,"cost":382,"sales":62,"pixels":28},{"country_code":"BE","operator_code":"BE_MOBISTAR","year_code":2017,"month_code":2,"revenue":866,"cost":238,"sales":54,"pixels":17},{"country_code":"BE","operator_code":"BE_MOBISTAR","year_code":2017,"month_code":3,"revenue":879,"cost":244,"sales":60,"pixels":19},{"country_code":"BE","operator_code":"BE_MOBISTAR","year_code":2017,"month_code":4,"revenue":1083,"cost":1326,"sales":159,"pixels":109},{"country_code":"BE","operator_code":"BE_MOBISTAR","year_code":2017,"month_code":5,"revenue":1383,"cost":611,"sales":82,"pixels":50},{"country_code":"BE","operator_code":"BE_MOBISTAR","year_code":2017,"month_code":6,"revenue":561,"cost":0,"sales":0,"pixels":0},{"country_code":"BE","operator_code":"BE_PROXIMUS","year_code":2017,"month_code":1,"revenue":3434,"cost":160,"sales":54,"pixels":12},{"country_code":"BE","operator_code":"BE_PROXIMUS","year_code":2017,"month_code":2,"revenue":1961,"cost":306,"sales":72,"pixels":22},{"country_code":"BE","operator_code":"BE_PROXIMUS","year_code":2017,"month_code":3,"revenue":2263,"cost":282,"sales":83,"pixels":23},{"country_code":"BE","operator_code":"BE_PROXIMUS","year_code":2017,"month_code":4,"revenue":2542,"cost":1849,"sales":260,"pixels":149},{"country_code":"BE","operator_code":"BE_PROXIMUS","year_code":2017,"month_code":5,"revenue":3063,"cost":1007,"sales":123,"pixels":82},{"country_code":"BE","operator_code":"BE_PROXIMUS","year_code":2017,"month_code":6,"revenue":1485,"cost":0,"sales":0,"pixels":0},{"country_code":"BE","operator_code":"BE_TELENET","year_code":2017,"month_code":1,"revenue":562,"cost":436,"sales":54,"pixels":33},{"country_code":"BE","operator_code":"BE_TELENET","year_code":2017,"month_code":2,"revenue":449,"cost":166,"sales":20,"pixels":12},{"country_code":"BE","operator_code":"BE_TELENET","year_code":2017,"month_code":3,"revenue":448,"cost":128,"sales":22,"pixels":10},{"country_code":"BE","operator_code":"BE_TELENET","year_code":2017,"month_code":4,"revenue":748,"cost":846,"sales":79,"pixels":67},{"country_code":"BE","operator_code":"BE_TELENET","year_code":2017,"month_code":5,"revenue":809,"cost":466,"sales":48,"pixels":39},{"country_code":"BE","operator_code":"BE_TELENET","year_code":2017,"month_code":6,"revenue":305,"cost":0,"sales":0,"pixels":0},{"country_code":"BH","operator_code":"BH_VIVA","year_code":2017,"month_code":1,"revenue":64,"cost":143,"sales":87,"pixels":71},{"country_code":"BH","operator_code":"BH_VIVA","year_code":2017,"month_code":2,"revenue":112,"cost":75,"sales":49,"pixels":34},{"country_code":"BH","operator_code":"BH_VIVA","year_code":2017,"month_code":3,"revenue":357,"cost":931,"sales":430,"pixels":404},{"country_code":"BH","operator_code":"BH_VIVA","year_code":2017,"month_code":4,"revenue":1007,"cost":1472,"sales":702,"pixels":661},{"country_code":"BH","operator_code":"BH_VIVA","year_code":2017,"month_code":5,"revenue":1778,"cost":5360,"sales":1431,"pixels":1362},{"country_code":"BH","operator_code":"BH_VIVA","year_code":2017,"month_code":6,"revenue":2698,"cost":7533,"sales":2297,"pixels":2081},{"country_code":"BH","operator_code":"BH_ZAIN","year_code":2017,"month_code":1,"revenue":13,"cost":0,"sales":15,"pixels":0},{"country_code":"BH","operator_code":"BH_ZAIN","year_code":2017,"month_code":2,"revenue":26,"cost":0,"sales":6,"pixels":1},{"country_code":"BH","operator_code":"BH_ZAIN","year_code":2017,"month_code":3,"revenue":28,"cost":0,"sales":0,"pixels":0},{"country_code":"BH","operator_code":"BH_ZAIN","year_code":2017,"month_code":4,"revenue":25,"cost":0,"sales":0,"pixels":0},{"country_code":"BH","operator_code":"BH_ZAIN","year_code":2017,"month_code":5,"revenue":22,"cost":0,"sales":0,"pixels":0},{"country_code":"BH","operator_code":"BH_ZAIN","year_code":2017,"month_code":6,"revenue":15,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_DEBITEL","year_code":2017,"month_code":1,"revenue":1663,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_DEBITEL","year_code":2017,"month_code":2,"revenue":443,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_DEBITEL","year_code":2017,"month_code":3,"revenue":938,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_DEBITEL","year_code":2017,"month_code":4,"revenue":2858,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_DEBITEL","year_code":2017,"month_code":5,"revenue":1842,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_DEBITEL","year_code":2017,"month_code":6,"revenue":317,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_EPLUS","year_code":2017,"month_code":1,"revenue":1579,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_EPLUS","year_code":2017,"month_code":2,"revenue":1473,"cost":218,"sales":15,"pixels":13},{"country_code":"DE","operator_code":"DE_EPLUS","year_code":2017,"month_code":3,"revenue":1385,"cost":135,"sales":8,"pixels":8},{"country_code":"DE","operator_code":"DE_EPLUS","year_code":2017,"month_code":4,"revenue":1266,"cost":67,"sales":6,"pixels":4},{"country_code":"DE","operator_code":"DE_EPLUS","year_code":2017,"month_code":5,"revenue":1232,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_EPLUS","year_code":2017,"month_code":6,"revenue":915,"cost":16,"sales":1,"pixels":1},{"country_code":"DE","operator_code":"DE_MOBILCOMDEBITEL","year_code":2017,"month_code":1,"revenue":577,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_MOBILCOMDEBITEL","year_code":2017,"month_code":2,"revenue":431,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_MOBILCOMDEBITEL","year_code":2017,"month_code":3,"revenue":458,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_MOBILCOMDEBITEL","year_code":2017,"month_code":4,"revenue":428,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_MOBILCOMDEBITEL","year_code":2017,"month_code":5,"revenue":545,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_MOBILCOMDEBITEL","year_code":2017,"month_code":6,"revenue":279,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_O2","year_code":2017,"month_code":1,"revenue":55099,"cost":51080,"sales":3494,"pixels":2973},{"country_code":"DE","operator_code":"DE_O2","year_code":2017,"month_code":2,"revenue":23269,"cost":6096,"sales":394,"pixels":342},{"country_code":"DE","operator_code":"DE_O2","year_code":2017,"month_code":3,"revenue":23609,"cost":473,"sales":32,"pixels":28},{"country_code":"DE","operator_code":"DE_O2","year_code":2017,"month_code":4,"revenue":17611,"cost":1090,"sales":62,"pixels":55},{"country_code":"DE","operator_code":"DE_O2","year_code":2017,"month_code":5,"revenue":15763,"cost":1215,"sales":85,"pixels":64},{"country_code":"DE","operator_code":"DE_O2","year_code":2017,"month_code":6,"revenue":9944,"cost":459,"sales":37,"pixels":27},{"country_code":"DE","operator_code":"DE_TELEKOM","year_code":2017,"month_code":1,"revenue":18418,"cost":10945,"sales":544,"pixels":493},{"country_code":"DE","operator_code":"DE_TELEKOM","year_code":2017,"month_code":2,"revenue":14285,"cost":2181,"sales":152,"pixels":122},{"country_code":"DE","operator_code":"DE_TELEKOM","year_code":2017,"month_code":3,"revenue":17966,"cost":473,"sales":36,"pixels":28},{"country_code":"DE","operator_code":"DE_TELEKOM","year_code":2017,"month_code":4,"revenue":14780,"cost":194,"sales":16,"pixels":11},{"country_code":"DE","operator_code":"DE_TELEKOM","year_code":2017,"month_code":5,"revenue":10222,"cost":502,"sales":32,"pixels":28},{"country_code":"DE","operator_code":"DE_TELEKOM","year_code":2017,"month_code":6,"revenue":10679,"cost":1848,"sales":126,"pixels":101},{"country_code":"DE","operator_code":"DE_TMOBILE","year_code":2017,"month_code":1,"revenue":921,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_TMOBILE","year_code":2017,"month_code":2,"revenue":838,"cost":144,"sales":11,"pixels":9},{"country_code":"DE","operator_code":"DE_TMOBILE","year_code":2017,"month_code":3,"revenue":838,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_TMOBILE","year_code":2017,"month_code":4,"revenue":726,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_TMOBILE","year_code":2017,"month_code":5,"revenue":780,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_TMOBILE","year_code":2017,"month_code":6,"revenue":429,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"DE_VODAFONE","year_code":2017,"month_code":1,"revenue":23107,"cost":8776,"sales":882,"pixels":424},{"country_code":"DE","operator_code":"DE_VODAFONE","year_code":2017,"month_code":2,"revenue":16213,"cost":3102,"sales":308,"pixels":150},{"country_code":"DE","operator_code":"DE_VODAFONE","year_code":2017,"month_code":3,"revenue":16619,"cost":140,"sales":12,"pixels":8},{"country_code":"DE","operator_code":"DE_VODAFONE","year_code":2017,"month_code":4,"revenue":12948,"cost":82,"sales":7,"pixels":5},{"country_code":"DE","operator_code":"DE_VODAFONE","year_code":2017,"month_code":5,"revenue":13011,"cost":796,"sales":56,"pixels":44},{"country_code":"DE","operator_code":"DE_VODAFONE","year_code":2017,"month_code":6,"revenue":9303,"cost":610,"sales":45,"pixels":34},{"country_code":"DE","operator_code":"%fixed_payment_operatorid%","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"unknown","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"unknown","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"UNKNOWN","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"UNKNOWN","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"UNKNOWN","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"DE","operator_code":"UNKNOWN","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"EE","operator_code":"EE_ELISA","year_code":2017,"month_code":1,"revenue":5900,"cost":2535,"sales":614,"pixels":614},{"country_code":"EE","operator_code":"EE_ELISA","year_code":2017,"month_code":2,"revenue":5509,"cost":3919,"sales":993,"pixels":976},{"country_code":"EE","operator_code":"EE_ELISA","year_code":2017,"month_code":3,"revenue":5483,"cost":2416,"sales":647,"pixels":604},{"country_code":"EE","operator_code":"EE_ELISA","year_code":2017,"month_code":4,"revenue":5816,"cost":2396,"sales":602,"pixels":484},{"country_code":"EE","operator_code":"EE_ELISA","year_code":2017,"month_code":5,"revenue":7557,"cost":2787,"sales":699,"pixels":559},{"country_code":"EE","operator_code":"EE_ELISA","year_code":2017,"month_code":6,"revenue":5037,"cost":1686,"sales":427,"pixels":338},{"country_code":"EE","operator_code":"EE_EMT","year_code":2017,"month_code":1,"revenue":4738,"cost":2190,"sales":525,"pixels":525},{"country_code":"EE","operator_code":"EE_EMT","year_code":2017,"month_code":2,"revenue":5898,"cost":3858,"sales":975,"pixels":953},{"country_code":"EE","operator_code":"EE_EMT","year_code":2017,"month_code":3,"revenue":5667,"cost":2040,"sales":554,"pixels":517},{"country_code":"EE","operator_code":"EE_EMT","year_code":2017,"month_code":4,"revenue":5880,"cost":1822,"sales":459,"pixels":367},{"country_code":"EE","operator_code":"EE_EMT","year_code":2017,"month_code":5,"revenue":7249,"cost":2177,"sales":545,"pixels":436},{"country_code":"EE","operator_code":"EE_EMT","year_code":2017,"month_code":6,"revenue":5049,"cost":1993,"sales":504,"pixels":398},{"country_code":"EE","operator_code":"EE_TELE2","year_code":2017,"month_code":1,"revenue":4604,"cost":1459,"sales":348,"pixels":347},{"country_code":"EE","operator_code":"EE_TELE2","year_code":2017,"month_code":2,"revenue":4767,"cost":3054,"sales":775,"pixels":758},{"country_code":"EE","operator_code":"EE_TELE2","year_code":2017,"month_code":3,"revenue":4466,"cost":1507,"sales":406,"pixels":381},{"country_code":"EE","operator_code":"EE_TELE2","year_code":2017,"month_code":4,"revenue":4606,"cost":1533,"sales":404,"pixels":309},{"country_code":"EE","operator_code":"EE_TELE2","year_code":2017,"month_code":5,"revenue":5434,"cost":1936,"sales":484,"pixels":389},{"country_code":"EE","operator_code":"EE_TELE2","year_code":2017,"month_code":6,"revenue":3755,"cost":1638,"sales":393,"pixels":328},{"country_code":"EE","operator_code":"Undefined","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"EE","operator_code":"Undefined","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"EE","operator_code":"Undefined","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"EE","operator_code":"Undefined","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"EE","operator_code":"Undefined","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"EE","operator_code":"Undefined","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"EE","operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"EE","operator_code":null,"year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"EE","operator_code":null,"year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"EE","operator_code":null,"year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"EE","operator_code":null,"year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"EE","operator_code":null,"year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"EG","operator_code":"EG_VODAFONE","year_code":2017,"month_code":1,"revenue":452,"cost":1112,"sales":5195,"pixels":4562},{"country_code":"EG","operator_code":"EG_VODAFONE","year_code":2017,"month_code":2,"revenue":305,"cost":0,"sales":0,"pixels":0},{"country_code":"EG","operator_code":"EG_VODAFONE","year_code":2017,"month_code":3,"revenue":222,"cost":0,"sales":0,"pixels":0},{"country_code":"EG","operator_code":"EG_VODAFONE","year_code":2017,"month_code":4,"revenue":182,"cost":0,"sales":62,"pixels":0},{"country_code":"EG","operator_code":"EG_VODAFONE","year_code":2017,"month_code":5,"revenue":136,"cost":0,"sales":16,"pixels":0},{"country_code":"EG","operator_code":"EG_VODAFONE","year_code":2017,"month_code":6,"revenue":83,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"DigiMobil 21422","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"DigiMobil 21422","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"ES_MOVISTAR","year_code":2017,"month_code":1,"revenue":2594,"cost":0,"sales":1,"pixels":0},{"country_code":"ES","operator_code":"ES_MOVISTAR","year_code":2017,"month_code":2,"revenue":2042,"cost":0,"sales":1,"pixels":0},{"country_code":"ES","operator_code":"ES_MOVISTAR","year_code":2017,"month_code":3,"revenue":2297,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"ES_MOVISTAR","year_code":2017,"month_code":4,"revenue":1970,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"ES_MOVISTAR","year_code":2017,"month_code":5,"revenue":1925,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"ES_MOVISTAR","year_code":2017,"month_code":6,"revenue":1091,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"ES_ORANGE","year_code":2017,"month_code":1,"revenue":87416,"cost":19840,"sales":3175,"pixels":2991},{"country_code":"ES","operator_code":"ES_ORANGE","year_code":2017,"month_code":2,"revenue":67869,"cost":29027,"sales":5383,"pixels":4189},{"country_code":"ES","operator_code":"ES_ORANGE","year_code":2017,"month_code":3,"revenue":121015,"cost":50191,"sales":11935,"pixels":7174},{"country_code":"ES","operator_code":"ES_ORANGE","year_code":2017,"month_code":4,"revenue":95748,"cost":108,"sales":17,"pixels":16},{"country_code":"ES","operator_code":"ES_ORANGE","year_code":2017,"month_code":5,"revenue":80303,"cost":7164,"sales":1225,"pixels":993},{"country_code":"ES","operator_code":"ES_ORANGE","year_code":2017,"month_code":6,"revenue":73316,"cost":77924,"sales":12048,"pixels":11152},{"country_code":"ES","operator_code":"ES_VODAFONE","year_code":2017,"month_code":1,"revenue":2731,"cost":0,"sales":176,"pixels":0},{"country_code":"ES","operator_code":"ES_VODAFONE","year_code":2017,"month_code":2,"revenue":2325,"cost":0,"sales":159,"pixels":0},{"country_code":"ES","operator_code":"ES_VODAFONE","year_code":2017,"month_code":3,"revenue":2500,"cost":0,"sales":1,"pixels":0},{"country_code":"ES","operator_code":"ES_VODAFONE","year_code":2017,"month_code":4,"revenue":2286,"cost":0,"sales":2,"pixels":0},{"country_code":"ES","operator_code":"ES_VODAFONE","year_code":2017,"month_code":5,"revenue":2190,"cost":0,"sales":6,"pixels":0},{"country_code":"ES","operator_code":"ES_VODAFONE","year_code":2017,"month_code":6,"revenue":1400,"cost":0,"sales":2,"pixels":0},{"country_code":"ES","operator_code":"ES_YOIGO","year_code":2017,"month_code":1,"revenue":65,"cost":14,"sales":4,"pixels":2},{"country_code":"ES","operator_code":"ES_YOIGO","year_code":2017,"month_code":2,"revenue":24,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"ES_YOIGO","year_code":2017,"month_code":3,"revenue":30,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"ES_YOIGO","year_code":2017,"month_code":4,"revenue":25,"cost":0,"sales":2,"pixels":0},{"country_code":"ES","operator_code":"ES_YOIGO","year_code":2017,"month_code":5,"revenue":17,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"ES_YOIGO","year_code":2017,"month_code":6,"revenue":13,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"Lycamobile 21425","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"Lycamobile 21425","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"Lycamobile 21425","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"Lycamobile 21425","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"Lycamobile 21425","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"Lycamobile 21425","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"Undefined","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"Undefined","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"Undefined","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"Undefined","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"Undefined","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ES","operator_code":"Undefined","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"FR_BOUYGUE","year_code":2017,"month_code":1,"revenue":1933,"cost":0,"sales":12,"pixels":0},{"country_code":"FR","operator_code":"FR_BOUYGUE","year_code":2017,"month_code":2,"revenue":1456,"cost":0,"sales":2,"pixels":0},{"country_code":"FR","operator_code":"FR_BOUYGUE","year_code":2017,"month_code":3,"revenue":1568,"cost":658,"sales":48,"pixels":47},{"country_code":"FR","operator_code":"FR_BOUYGUE","year_code":2017,"month_code":4,"revenue":1803,"cost":292,"sales":21,"pixels":21},{"country_code":"FR","operator_code":"FR_BOUYGUE","year_code":2017,"month_code":5,"revenue":2072,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"FR_BOUYGUE","year_code":2017,"month_code":6,"revenue":1487,"cost":832,"sales":52,"pixels":52},{"country_code":"FR","operator_code":"FR_FREE","year_code":2017,"month_code":3,"revenue":1023,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"FR_FREE","year_code":2017,"month_code":4,"revenue":7461,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"FR_FREE","year_code":2017,"month_code":5,"revenue":8453,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"FR_FREE","year_code":2017,"month_code":6,"revenue":5389,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"FR_ORANGE","year_code":2017,"month_code":1,"revenue":2071,"cost":48,"sales":9,"pixels":3},{"country_code":"FR","operator_code":"FR_ORANGE","year_code":2017,"month_code":2,"revenue":1509,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"FR_ORANGE","year_code":2017,"month_code":3,"revenue":1553,"cost":518,"sales":37,"pixels":37},{"country_code":"FR","operator_code":"FR_ORANGE","year_code":2017,"month_code":4,"revenue":1496,"cost":296,"sales":22,"pixels":22},{"country_code":"FR","operator_code":"FR_ORANGE","year_code":2017,"month_code":5,"revenue":2304,"cost":439,"sales":47,"pixels":28},{"country_code":"FR","operator_code":"FR_ORANGE","year_code":2017,"month_code":6,"revenue":3053,"cost":3208,"sales":423,"pixels":215},{"country_code":"FR","operator_code":"FR_SFR","year_code":2017,"month_code":1,"revenue":2437,"cost":176,"sales":13,"pixels":11},{"country_code":"FR","operator_code":"FR_SFR","year_code":2017,"month_code":2,"revenue":1270,"cost":0,"sales":2,"pixels":2},{"country_code":"FR","operator_code":"FR_SFR","year_code":2017,"month_code":3,"revenue":1445,"cost":994,"sales":71,"pixels":71},{"country_code":"FR","operator_code":"FR_SFR","year_code":2017,"month_code":4,"revenue":2213,"cost":687,"sales":51,"pixels":51},{"country_code":"FR","operator_code":"FR_SFR","year_code":2017,"month_code":5,"revenue":2171,"cost":33,"sales":3,"pixels":3},{"country_code":"FR","operator_code":"FR_SFR","year_code":2017,"month_code":6,"revenue":948,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"unknown","year_code":2017,"month_code":1,"revenue":7553,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"unknown","year_code":2017,"month_code":2,"revenue":7070,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"unknown","year_code":2017,"month_code":3,"revenue":6549,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"UNKNOWN","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"UNKNOWN","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"UNKNOWN","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"UNKNOWN","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"UNKNOWN","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"FR","operator_code":"UNKNOWN","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":"","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":"","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":"","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":"","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":"GH_AIRTEL","year_code":2017,"month_code":1,"revenue":2176,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":"GH_AIRTEL","year_code":2017,"month_code":2,"revenue":1450,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":"GH_AIRTEL","year_code":2017,"month_code":3,"revenue":1823,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":"GH_AIRTEL","year_code":2017,"month_code":4,"revenue":1616,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":"GH_AIRTEL","year_code":2017,"month_code":5,"revenue":1629,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":"GH_AIRTEL","year_code":2017,"month_code":6,"revenue":1050,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":"GH_MTN","year_code":2017,"month_code":1,"revenue":51681,"cost":28047,"sales":87161,"pixels":80264},{"country_code":"GH","operator_code":"GH_MTN","year_code":2017,"month_code":2,"revenue":45440,"cost":29641,"sales":97829,"pixels":84722},{"country_code":"GH","operator_code":"GH_MTN","year_code":2017,"month_code":3,"revenue":66529,"cost":49942,"sales":165937,"pixels":142795},{"country_code":"GH","operator_code":"GH_MTN","year_code":2017,"month_code":4,"revenue":62772,"cost":31716,"sales":134549,"pixels":90707},{"country_code":"GH","operator_code":"GH_MTN","year_code":2017,"month_code":5,"revenue":61665,"cost":33574,"sales":141972,"pixels":96062},{"country_code":"GH","operator_code":"GH_MTN","year_code":2017,"month_code":6,"revenue":30878,"cost":6816,"sales":32611,"pixels":19495},{"country_code":"GH","operator_code":"GH_VODAFONE","year_code":2017,"month_code":1,"revenue":7592,"cost":2665,"sales":8932,"pixels":7637},{"country_code":"GH","operator_code":"GH_VODAFONE","year_code":2017,"month_code":2,"revenue":8461,"cost":2171,"sales":8138,"pixels":6205},{"country_code":"GH","operator_code":"GH_VODAFONE","year_code":2017,"month_code":3,"revenue":9439,"cost":1538,"sales":7946,"pixels":4404},{"country_code":"GH","operator_code":"GH_VODAFONE","year_code":2017,"month_code":4,"revenue":8045,"cost":1051,"sales":7287,"pixels":3008},{"country_code":"GH","operator_code":"GH_VODAFONE","year_code":2017,"month_code":5,"revenue":8110,"cost":1328,"sales":9647,"pixels":3795},{"country_code":"GH","operator_code":"GH_VODAFONE","year_code":2017,"month_code":6,"revenue":6730,"cost":452,"sales":2676,"pixels":1292},{"country_code":"GH","operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":null,"year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":null,"year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":null,"year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":null,"year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"GH","operator_code":null,"year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"GR","operator_code":"GR_COSMOTE","year_code":2017,"month_code":3,"revenue":5,"cost":10,"sales":2,"pixels":1},{"country_code":"GR","operator_code":"GR_COSMOTE","year_code":2017,"month_code":4,"revenue":97,"cost":3169,"sales":287,"pixels":244},{"country_code":"GR","operator_code":"GR_COSMOTE","year_code":2017,"month_code":5,"revenue":649,"cost":1960,"sales":842,"pixels":151},{"country_code":"GR","operator_code":"GR_COSMOTE","year_code":2017,"month_code":6,"revenue":416,"cost":72,"sales":173,"pixels":41},{"country_code":"GR","operator_code":"GR_VODAFONE","year_code":2017,"month_code":4,"revenue":84,"cost":1251,"sales":119,"pixels":99},{"country_code":"GR","operator_code":"GR_VODAFONE","year_code":2017,"month_code":5,"revenue":301,"cost":858,"sales":345,"pixels":66},{"country_code":"GR","operator_code":"GR_VODAFONE","year_code":2017,"month_code":6,"revenue":187,"cost":72,"sales":68,"pixels":20},{"country_code":"GR","operator_code":"GR_WIND","year_code":2017,"month_code":4,"revenue":79,"cost":791,"sales":98,"pixels":62},{"country_code":"GR","operator_code":"GR_WIND","year_code":2017,"month_code":5,"revenue":267,"cost":572,"sales":275,"pixels":44},{"country_code":"GR","operator_code":"GR_WIND","year_code":2017,"month_code":6,"revenue":131,"cost":50,"sales":51,"pixels":18},{"country_code":"HK","operator_code":"HK_HUTCHINSON","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"HK","operator_code":"HK_PEOPLES","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"HK","operator_code":"HK_PEOPLES","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"HK","operator_code":"HK_PEOPLES","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ID","operator_code":"ID_XL","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":10,"pixels":3},{"country_code":"IE","operator_code":"Carphone Warehouse 27216","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Carphone Warehouse 27216","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Carphone Warehouse 27216","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Eircom 27207","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Eircom 27207","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"IE_METEOR","year_code":2017,"month_code":1,"revenue":1301,"cost":1953,"sales":175,"pixels":152},{"country_code":"IE","operator_code":"IE_METEOR","year_code":2017,"month_code":2,"revenue":1769,"cost":2111,"sales":233,"pixels":204},{"country_code":"IE","operator_code":"IE_METEOR","year_code":2017,"month_code":3,"revenue":1346,"cost":132,"sales":13,"pixels":10},{"country_code":"IE","operator_code":"IE_METEOR","year_code":2017,"month_code":4,"revenue":109,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"IE_METEOR","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"IE_METEOR","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"IE_O2","year_code":2017,"month_code":1,"revenue":486,"cost":189,"sales":15,"pixels":14},{"country_code":"IE","operator_code":"IE_O2","year_code":2017,"month_code":2,"revenue":568,"cost":305,"sales":30,"pixels":26},{"country_code":"IE","operator_code":"IE_O2","year_code":2017,"month_code":3,"revenue":632,"cost":90,"sales":8,"pixels":7},{"country_code":"IE","operator_code":"IE_O2","year_code":2017,"month_code":4,"revenue":581,"cost":11,"sales":2,"pixels":1},{"country_code":"IE","operator_code":"IE_O2","year_code":2017,"month_code":5,"revenue":522,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"IE_O2","year_code":2017,"month_code":6,"revenue":287,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"IE_VODAFONE","year_code":2017,"month_code":1,"revenue":1044,"cost":817,"sales":71,"pixels":67},{"country_code":"IE","operator_code":"IE_VODAFONE","year_code":2017,"month_code":2,"revenue":1244,"cost":1106,"sales":131,"pixels":114},{"country_code":"IE","operator_code":"IE_VODAFONE","year_code":2017,"month_code":3,"revenue":1213,"cost":437,"sales":43,"pixels":35},{"country_code":"IE","operator_code":"IE_VODAFONE","year_code":2017,"month_code":4,"revenue":854,"cost":270,"sales":26,"pixels":22},{"country_code":"IE","operator_code":"IE_VODAFONE","year_code":2017,"month_code":5,"revenue":701,"cost":24,"sales":4,"pixels":2},{"country_code":"IE","operator_code":"IE_VODAFONE","year_code":2017,"month_code":6,"revenue":438,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Lycamobile 27213","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Lycamobile 27213","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Lycamobile 27213","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Lycamobile 27213","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Lycamobile 27213","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Lycamobile 27213","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Tesco 27211","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Tesco 27211","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Tesco 27211","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Tesco 27211","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Tesco 27211","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Tesco 27211","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Undefined","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Undefined","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Undefined","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Undefined","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Undefined","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"Undefined","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"UPC 27215","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"UPC 27215","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"UPC 27215","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":"UPC 27215","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IE","operator_code":null,"year_code":2017,"month_code":2,"revenue":0,"cost":327,"sales":37,"pixels":32},{"country_code":"IE","operator_code":null,"year_code":2017,"month_code":3,"revenue":0,"cost":500,"sales":42,"pixels":42},{"country_code":"IE","operator_code":null,"year_code":2017,"month_code":4,"revenue":0,"cost":128,"sales":9,"pixels":9},{"country_code":"IE","operator_code":null,"year_code":2017,"month_code":5,"revenue":0,"cost":24,"sales":2,"pixels":2},{"country_code":"IE","operator_code":null,"year_code":2017,"month_code":6,"revenue":0,"cost":24,"sales":2,"pixels":2},{"country_code":"IN","operator_code":"IN_AIRTEL","year_code":2017,"month_code":1,"revenue":1,"cost":0,"sales":0,"pixels":0},{"country_code":"IN","operator_code":"IN_AIRTEL","year_code":2017,"month_code":2,"revenue":1,"cost":0,"sales":0,"pixels":0},{"country_code":"IN","operator_code":"IN_AIRTEL","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IN","operator_code":"IN_AIRTEL","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IN","operator_code":"IN_AIRTEL","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IN","operator_code":"IN_AIRTEL","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IN","operator_code":"IN_VODAFONE","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IN","operator_code":"IN_VODAFONE","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IN","operator_code":"IN_VODAFONE","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IN","operator_code":"IN_VODAFONE","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"100","year_code":2017,"month_code":5,"revenue":0,"cost":139,"sales":124,"pixels":116},{"country_code":"IQ","operator_code":"100","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"101","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"101","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"101","year_code":2017,"month_code":3,"revenue":0,"cost":1,"sales":1,"pixels":1},{"country_code":"IQ","operator_code":"101","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"101","year_code":2017,"month_code":5,"revenue":0,"cost":490,"sales":428,"pixels":408},{"country_code":"IQ","operator_code":"101","year_code":2017,"month_code":6,"revenue":0,"cost":7,"sales":6,"pixels":6},{"country_code":"IQ","operator_code":"102","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"102","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"102","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"102","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"102","year_code":2017,"month_code":5,"revenue":0,"cost":5,"sales":5,"pixels":4},{"country_code":"IQ","operator_code":"102","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"asiacell","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"asiacell","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"asiacell","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"asiacell","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"asiacell","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"IQ_ASIACELL","year_code":2017,"month_code":1,"revenue":168981,"cost":47686,"sales":50996,"pixels":38113},{"country_code":"IQ","operator_code":"IQ_ASIACELL","year_code":2017,"month_code":2,"revenue":149658,"cost":36139,"sales":47018,"pixels":29668},{"country_code":"IQ","operator_code":"IQ_ASIACELL","year_code":2017,"month_code":3,"revenue":174368,"cost":38267,"sales":45438,"pixels":31701},{"country_code":"IQ","operator_code":"IQ_ASIACELL","year_code":2017,"month_code":4,"revenue":160767,"cost":25354,"sales":38745,"pixels":21788},{"country_code":"IQ","operator_code":"IQ_ASIACELL","year_code":2017,"month_code":5,"revenue":160287,"cost":29670,"sales":44119,"pixels":25623},{"country_code":"IQ","operator_code":"IQ_ASIACELL","year_code":2017,"month_code":6,"revenue":106907,"cost":45902,"sales":58742,"pixels":38342},{"country_code":"IQ","operator_code":"IQ_KOREK","year_code":2017,"month_code":1,"revenue":3175,"cost":1655,"sales":1501,"pixels":1381},{"country_code":"IQ","operator_code":"IQ_KOREK","year_code":2017,"month_code":2,"revenue":3296,"cost":1684,"sales":1619,"pixels":1414},{"country_code":"IQ","operator_code":"IQ_KOREK","year_code":2017,"month_code":3,"revenue":4840,"cost":1300,"sales":1286,"pixels":1085},{"country_code":"IQ","operator_code":"IQ_KOREK","year_code":2017,"month_code":4,"revenue":4219,"cost":410,"sales":638,"pixels":346},{"country_code":"IQ","operator_code":"IQ_KOREK","year_code":2017,"month_code":5,"revenue":3766,"cost":206,"sales":289,"pixels":180},{"country_code":"IQ","operator_code":"IQ_KOREK","year_code":2017,"month_code":6,"revenue":2419,"cost":592,"sales":620,"pixels":508},{"country_code":"IQ","operator_code":"IQ_ZAIN","year_code":2017,"month_code":1,"revenue":74560,"cost":11858,"sales":25908,"pixels":8986},{"country_code":"IQ","operator_code":"IQ_ZAIN","year_code":2017,"month_code":2,"revenue":84625,"cost":9088,"sales":19542,"pixels":7174},{"country_code":"IQ","operator_code":"IQ_ZAIN","year_code":2017,"month_code":3,"revenue":100792,"cost":9427,"sales":15899,"pixels":7780},{"country_code":"IQ","operator_code":"IQ_ZAIN","year_code":2017,"month_code":4,"revenue":90576,"cost":13023,"sales":12931,"pixels":11447},{"country_code":"IQ","operator_code":"IQ_ZAIN","year_code":2017,"month_code":5,"revenue":95242,"cost":13969,"sales":14055,"pixels":12495},{"country_code":"IQ","operator_code":"IQ_ZAIN","year_code":2017,"month_code":6,"revenue":60826,"cost":16102,"sales":15949,"pixels":14093},{"country_code":"IQ","operator_code":"korek","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"korek","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"korek","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"korek","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"MY_CELCOM","year_code":2017,"month_code":1,"revenue":0,"cost":30,"sales":25,"pixels":25},{"country_code":"IQ","operator_code":"MY_CELCOM","year_code":2017,"month_code":2,"revenue":0,"cost":284,"sales":293,"pixels":256},{"country_code":"IQ","operator_code":"MY_CELCOM","year_code":2017,"month_code":3,"revenue":0,"cost":900,"sales":787,"pixels":745},{"country_code":"IQ","operator_code":"MY_CELCOM","year_code":2017,"month_code":4,"revenue":0,"cost":54,"sales":45,"pixels":45},{"country_code":"IQ","operator_code":"MY_CELCOM","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":"MY_CELCOM","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":null,"year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":null,"year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":null,"year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":null,"year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IQ","operator_code":null,"year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_THREE","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_THREE","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_THREE","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_THREE","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_THREE","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_THREE","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_TIM","year_code":2017,"month_code":1,"revenue":1027,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_TIM","year_code":2017,"month_code":2,"revenue":776,"cost":10,"sales":5,"pixels":1},{"country_code":"IT","operator_code":"IT_TIM","year_code":2017,"month_code":3,"revenue":743,"cost":162,"sales":82,"pixels":27},{"country_code":"IT","operator_code":"IT_TIM","year_code":2017,"month_code":4,"revenue":630,"cost":10,"sales":2,"pixels":1},{"country_code":"IT","operator_code":"IT_TIM","year_code":2017,"month_code":5,"revenue":510,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_TIM","year_code":2017,"month_code":6,"revenue":306,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_VODAFONE","year_code":2017,"month_code":1,"revenue":623,"cost":0,"sales":9,"pixels":0},{"country_code":"IT","operator_code":"IT_VODAFONE","year_code":2017,"month_code":2,"revenue":517,"cost":34,"sales":14,"pixels":5},{"country_code":"IT","operator_code":"IT_VODAFONE","year_code":2017,"month_code":3,"revenue":672,"cost":258,"sales":235,"pixels":42},{"country_code":"IT","operator_code":"IT_VODAFONE","year_code":2017,"month_code":4,"revenue":472,"cost":8,"sales":1,"pixels":1},{"country_code":"IT","operator_code":"IT_VODAFONE","year_code":2017,"month_code":5,"revenue":411,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_VODAFONE","year_code":2017,"month_code":6,"revenue":277,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_WIND","year_code":2017,"month_code":1,"revenue":804,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_WIND","year_code":2017,"month_code":2,"revenue":640,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_WIND","year_code":2017,"month_code":3,"revenue":690,"cost":10,"sales":2,"pixels":1},{"country_code":"IT","operator_code":"IT_WIND","year_code":2017,"month_code":4,"revenue":623,"cost":0,"sales":4,"pixels":0},{"country_code":"IT","operator_code":"IT_WIND","year_code":2017,"month_code":5,"revenue":605,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":"IT_WIND","year_code":2017,"month_code":6,"revenue":381,"cost":10,"sales":2,"pixels":1},{"country_code":"IT","operator_code":null,"year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"IT","operator_code":null,"year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_ORANGE","year_code":2017,"month_code":1,"revenue":786,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_ORANGE","year_code":2017,"month_code":2,"revenue":654,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_ORANGE","year_code":2017,"month_code":3,"revenue":629,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_ORANGE","year_code":2017,"month_code":4,"revenue":544,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_ORANGE","year_code":2017,"month_code":5,"revenue":3676,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_ORANGE","year_code":2017,"month_code":6,"revenue":1012,"cost":0,"sales":2,"pixels":0},{"country_code":"JO","operator_code":"JO_UMNIAH","year_code":2017,"month_code":1,"revenue":1676,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_UMNIAH","year_code":2017,"month_code":2,"revenue":1510,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_UMNIAH","year_code":2017,"month_code":3,"revenue":900,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_UMNIAH","year_code":2017,"month_code":4,"revenue":1027,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_UMNIAH","year_code":2017,"month_code":5,"revenue":858,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_UMNIAH","year_code":2017,"month_code":6,"revenue":729,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_ZAIN","year_code":2017,"month_code":1,"revenue":10898,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_ZAIN","year_code":2017,"month_code":2,"revenue":8537,"cost":0,"sales":1,"pixels":0},{"country_code":"JO","operator_code":"JO_ZAIN","year_code":2017,"month_code":3,"revenue":9490,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_ZAIN","year_code":2017,"month_code":4,"revenue":8526,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_ZAIN","year_code":2017,"month_code":5,"revenue":8873,"cost":0,"sales":0,"pixels":0},{"country_code":"JO","operator_code":"JO_ZAIN","year_code":2017,"month_code":6,"revenue":5406,"cost":0,"sales":0,"pixels":0},{"country_code":"KE","operator_code":"KE_AIRTEL","year_code":2017,"month_code":1,"revenue":264,"cost":0,"sales":570,"pixels":0},{"country_code":"KE","operator_code":"KE_AIRTEL","year_code":2017,"month_code":2,"revenue":343,"cost":0,"sales":390,"pixels":0},{"country_code":"KE","operator_code":"KE_AIRTEL","year_code":2017,"month_code":3,"revenue":414,"cost":46,"sales":1371,"pixels":31},{"country_code":"KE","operator_code":"KE_AIRTEL","year_code":2017,"month_code":4,"revenue":363,"cost":3,"sales":2405,"pixels":2},{"country_code":"KE","operator_code":"KE_AIRTEL","year_code":2017,"month_code":5,"revenue":362,"cost":240,"sales":3542,"pixels":160},{"country_code":"KE","operator_code":"KE_AIRTEL","year_code":2017,"month_code":6,"revenue":236,"cost":0,"sales":415,"pixels":0},{"country_code":"KE","operator_code":"KE_SAFARICOM","year_code":2017,"month_code":1,"revenue":12979,"cost":1486,"sales":3830,"pixels":1011},{"country_code":"KE","operator_code":"KE_SAFARICOM","year_code":2017,"month_code":2,"revenue":14899,"cost":4932,"sales":8710,"pixels":3293},{"country_code":"KE","operator_code":"KE_SAFARICOM","year_code":2017,"month_code":3,"revenue":21908,"cost":15275,"sales":23755,"pixels":10192},{"country_code":"KE","operator_code":"KE_SAFARICOM","year_code":2017,"month_code":4,"revenue":21786,"cost":8649,"sales":15197,"pixels":5773},{"country_code":"KE","operator_code":"KE_SAFARICOM","year_code":2017,"month_code":5,"revenue":18842,"cost":10682,"sales":16194,"pixels":7128},{"country_code":"KE","operator_code":"KE_SAFARICOM","year_code":2017,"month_code":6,"revenue":13681,"cost":2970,"sales":5161,"pixels":2000},{"country_code":"KW","operator_code":"KW_OOREDOO","year_code":2017,"month_code":1,"revenue":17,"cost":0,"sales":8,"pixels":3},{"country_code":"KW","operator_code":"KW_OOREDOO","year_code":2017,"month_code":2,"revenue":5,"cost":0,"sales":2,"pixels":0},{"country_code":"KW","operator_code":"KW_OOREDOO","year_code":2017,"month_code":5,"revenue":14,"cost":0,"sales":8,"pixels":1},{"country_code":"KW","operator_code":"KW_OOREDOO","year_code":2017,"month_code":6,"revenue":18,"cost":0,"sales":11,"pixels":0},{"country_code":"KW","operator_code":"KW_ZAIN","year_code":2017,"month_code":1,"revenue":1,"cost":0,"sales":0,"pixels":0},{"country_code":"KW","operator_code":"KW_ZAIN","year_code":2017,"month_code":2,"revenue":1,"cost":0,"sales":0,"pixels":0},{"country_code":"KW","operator_code":"KW_ZAIN","year_code":2017,"month_code":3,"revenue":1,"cost":0,"sales":0,"pixels":0},{"country_code":"KW","operator_code":"KW_ZAIN","year_code":2017,"month_code":4,"revenue":1,"cost":0,"sales":0,"pixels":0},{"country_code":"KW","operator_code":"KW_ZAIN","year_code":2017,"month_code":5,"revenue":1,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"101","year_code":2017,"month_code":1,"revenue":0,"cost":20,"sales":8,"pixels":7},{"country_code":"MY","operator_code":"101","year_code":2017,"month_code":2,"revenue":0,"cost":6,"sales":3,"pixels":2},{"country_code":"MY","operator_code":"101","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"101","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"101","year_code":2017,"month_code":5,"revenue":0,"cost":27,"sales":48,"pixels":11},{"country_code":"MY","operator_code":"101","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"103","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"103","year_code":2017,"month_code":5,"revenue":0,"cost":15,"sales":16,"pixels":7},{"country_code":"MY","operator_code":"106","year_code":2017,"month_code":5,"revenue":0,"cost":33,"sales":21,"pixels":13},{"country_code":"MY","operator_code":"106","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"2","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"2","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"2","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"2","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"2","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"2","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"224","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"CC","year_code":2017,"month_code":1,"revenue":3,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"DG","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"DG","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"DG","year_code":2017,"month_code":3,"revenue":0,"cost":18,"sales":16,"pixels":10},{"country_code":"MY","operator_code":"DG","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"DG","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"DG","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"digi","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"digi","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"digi","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"digi","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"digi","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"digi","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"maxis","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"maxis","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"MX","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"MX","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"MX","year_code":2017,"month_code":3,"revenue":0,"cost":22,"sales":26,"pixels":12},{"country_code":"MY","operator_code":"MX","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"MX","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"MX","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"MY_CELCOM","year_code":2017,"month_code":1,"revenue":4432,"cost":13283,"sales":18239,"pixels":6666},{"country_code":"MY","operator_code":"MY_CELCOM","year_code":2017,"month_code":2,"revenue":8956,"cost":9217,"sales":10859,"pixels":4627},{"country_code":"MY","operator_code":"MY_CELCOM","year_code":2017,"month_code":3,"revenue":5279,"cost":4563,"sales":1916,"pixels":1696},{"country_code":"MY","operator_code":"MY_CELCOM","year_code":2017,"month_code":4,"revenue":4967,"cost":8329,"sales":4179,"pixels":3726},{"country_code":"MY","operator_code":"MY_CELCOM","year_code":2017,"month_code":5,"revenue":4189,"cost":11739,"sales":5713,"pixels":4440},{"country_code":"MY","operator_code":"MY_CELCOM","year_code":2017,"month_code":6,"revenue":329,"cost":1058,"sales":369,"pixels":357},{"country_code":"MY","operator_code":"MY_DIGI","year_code":2017,"month_code":1,"revenue":93154,"cost":91459,"sales":42971,"pixels":32981},{"country_code":"MY","operator_code":"MY_DIGI","year_code":2017,"month_code":2,"revenue":80036,"cost":38720,"sales":22966,"pixels":14030},{"country_code":"MY","operator_code":"MY_DIGI","year_code":2017,"month_code":3,"revenue":85765,"cost":60451,"sales":36250,"pixels":25612},{"country_code":"MY","operator_code":"MY_DIGI","year_code":2017,"month_code":4,"revenue":82746,"cost":86393,"sales":54138,"pixels":31434},{"country_code":"MY","operator_code":"MY_DIGI","year_code":2017,"month_code":5,"revenue":136113,"cost":116523,"sales":66644,"pixels":42202},{"country_code":"MY","operator_code":"MY_DIGI","year_code":2017,"month_code":6,"revenue":56487,"cost":13066,"sales":7700,"pixels":5270},{"country_code":"MY","operator_code":"MY_MAXIS","year_code":2017,"month_code":1,"revenue":14241,"cost":6874,"sales":8626,"pixels":2629},{"country_code":"MY","operator_code":"MY_MAXIS","year_code":2017,"month_code":2,"revenue":15855,"cost":13283,"sales":12334,"pixels":4891},{"country_code":"MY","operator_code":"MY_MAXIS","year_code":2017,"month_code":3,"revenue":23628,"cost":26014,"sales":19832,"pixels":10062},{"country_code":"MY","operator_code":"MY_MAXIS","year_code":2017,"month_code":4,"revenue":23520,"cost":27607,"sales":19939,"pixels":10012},{"country_code":"MY","operator_code":"MY_MAXIS","year_code":2017,"month_code":5,"revenue":13629,"cost":3,"sales":11,"pixels":1},{"country_code":"MY","operator_code":"MY_MAXIS","year_code":2017,"month_code":6,"revenue":11015,"cost":0,"sales":13,"pixels":5},{"country_code":"MY","operator_code":"MY_TUNE","year_code":2017,"month_code":1,"revenue":217,"cost":76,"sales":38,"pixels":27},{"country_code":"MY","operator_code":"MY_TUNE","year_code":2017,"month_code":2,"revenue":298,"cost":165,"sales":74,"pixels":60},{"country_code":"MY","operator_code":"MY_TUNE","year_code":2017,"month_code":3,"revenue":256,"cost":25,"sales":10,"pixels":9},{"country_code":"MY","operator_code":"MY_TUNE","year_code":2017,"month_code":4,"revenue":181,"cost":11,"sales":8,"pixels":4},{"country_code":"MY","operator_code":"MY_TUNE","year_code":2017,"month_code":5,"revenue":1058,"cost":971,"sales":559,"pixels":420},{"country_code":"MY","operator_code":"MY_TUNE","year_code":2017,"month_code":6,"revenue":671,"cost":365,"sales":271,"pixels":199},{"country_code":"MY","operator_code":"MY_UMOBILE","year_code":2017,"month_code":1,"revenue":7598,"cost":2848,"sales":1191,"pixels":1031},{"country_code":"MY","operator_code":"MY_UMOBILE","year_code":2017,"month_code":2,"revenue":3501,"cost":888,"sales":455,"pixels":328},{"country_code":"MY","operator_code":"MY_UMOBILE","year_code":2017,"month_code":3,"revenue":2532,"cost":1503,"sales":967,"pixels":759},{"country_code":"MY","operator_code":"MY_UMOBILE","year_code":2017,"month_code":4,"revenue":1571,"cost":185,"sales":136,"pixels":70},{"country_code":"MY","operator_code":"MY_UMOBILE","year_code":2017,"month_code":5,"revenue":2289,"cost":476,"sales":714,"pixels":225},{"country_code":"MY","operator_code":"MY_UMOBILE","year_code":2017,"month_code":6,"revenue":1238,"cost":632,"sales":587,"pixels":355},{"country_code":"MY","operator_code":"MY_XOX","year_code":2017,"month_code":1,"revenue":1,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"MY_XOX","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"MY_XOX","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"MY_XOX","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"MY_XOX","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"MY_XOX","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"UM","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"UM","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"UM","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"UM","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"UM","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"UM","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"umobile","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"umobile","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"umobile","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"umobile","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"umobile","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":"umobile","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":null,"year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":null,"year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":1,"pixels":0},{"country_code":"MY","operator_code":null,"year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":22,"pixels":6},{"country_code":"MY","operator_code":null,"year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"MY","operator_code":null,"year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":1,"pixels":1},{"country_code":"NL","operator_code":"Lycamobile 20409","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"Lycamobile 20409","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"Lycamobile 20409","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"Lycamobile 20409","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"Lycamobile 20409","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"Lycamobile 20409","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_KPN","year_code":2017,"month_code":1,"revenue":11268,"cost":147,"sales":64,"pixels":7},{"country_code":"NL","operator_code":"NL_KPN","year_code":2017,"month_code":2,"revenue":9575,"cost":1241,"sales":114,"pixels":90},{"country_code":"NL","operator_code":"NL_KPN","year_code":2017,"month_code":3,"revenue":9993,"cost":2632,"sales":211,"pixels":190},{"country_code":"NL","operator_code":"NL_KPN","year_code":2017,"month_code":4,"revenue":8806,"cost":143,"sales":20,"pixels":8},{"country_code":"NL","operator_code":"NL_KPN","year_code":2017,"month_code":5,"revenue":8960,"cost":66,"sales":11,"pixels":5},{"country_code":"NL","operator_code":"NL_KPN","year_code":2017,"month_code":6,"revenue":5883,"cost":0,"sales":4,"pixels":0},{"country_code":"NL","operator_code":"NL_SIMPEL","year_code":2017,"month_code":1,"revenue":-21,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_SIMPEL","year_code":2017,"month_code":2,"revenue":-15,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_SIMPEL","year_code":2017,"month_code":3,"revenue":-15,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_SIMPEL","year_code":2017,"month_code":4,"revenue":-4,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_SIMPEL","year_code":2017,"month_code":5,"revenue":-2,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_SIMPEL","year_code":2017,"month_code":6,"revenue":-2,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TEELENA","year_code":2017,"month_code":1,"revenue":143,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TEELENA","year_code":2017,"month_code":2,"revenue":118,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TEELENA","year_code":2017,"month_code":3,"revenue":119,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TEELENA","year_code":2017,"month_code":4,"revenue":112,"cost":0,"sales":1,"pixels":0},{"country_code":"NL","operator_code":"NL_TEELENA","year_code":2017,"month_code":5,"revenue":140,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TEELENA","year_code":2017,"month_code":6,"revenue":71,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TELE2","year_code":2017,"month_code":1,"revenue":1277,"cost":330,"sales":19,"pixels":15},{"country_code":"NL","operator_code":"NL_TELE2","year_code":2017,"month_code":2,"revenue":913,"cost":39,"sales":5,"pixels":3},{"country_code":"NL","operator_code":"NL_TELE2","year_code":2017,"month_code":3,"revenue":972,"cost":282,"sales":21,"pixels":17},{"country_code":"NL","operator_code":"NL_TELE2","year_code":2017,"month_code":4,"revenue":907,"cost":55,"sales":6,"pixels":3},{"country_code":"NL","operator_code":"NL_TELE2","year_code":2017,"month_code":5,"revenue":924,"cost":22,"sales":2,"pixels":1},{"country_code":"NL","operator_code":"NL_TELE2","year_code":2017,"month_code":6,"revenue":567,"cost":0,"sales":2,"pixels":0},{"country_code":"NL","operator_code":"NL_TELE2NEDERLAND","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TELE2NEDERLAND","year_code":2017,"month_code":2,"revenue":0,"cost":156,"sales":15,"pixels":12},{"country_code":"NL","operator_code":"NL_TELE2NEDERLAND","year_code":2017,"month_code":3,"revenue":0,"cost":442,"sales":43,"pixels":34},{"country_code":"NL","operator_code":"NL_TELE2NEDERLAND","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TELE2NEDERLAND","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TELE2NEDERLAND","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TELEENA","year_code":2017,"month_code":1,"revenue":122,"cost":15,"sales":1,"pixels":1},{"country_code":"NL","operator_code":"NL_TELEENA","year_code":2017,"month_code":2,"revenue":173,"cost":143,"sales":11,"pixels":11},{"country_code":"NL","operator_code":"NL_TELEENA","year_code":2017,"month_code":3,"revenue":192,"cost":130,"sales":10,"pixels":10},{"country_code":"NL","operator_code":"NL_TELEENA","year_code":2017,"month_code":4,"revenue":98,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TELEENA","year_code":2017,"month_code":5,"revenue":77,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TELEENA","year_code":2017,"month_code":6,"revenue":57,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TELFORT","year_code":2017,"month_code":1,"revenue":536,"cost":0,"sales":4,"pixels":0},{"country_code":"NL","operator_code":"NL_TELFORT","year_code":2017,"month_code":2,"revenue":375,"cost":165,"sales":16,"pixels":12},{"country_code":"NL","operator_code":"NL_TELFORT","year_code":2017,"month_code":3,"revenue":411,"cost":352,"sales":34,"pixels":27},{"country_code":"NL","operator_code":"NL_TELFORT","year_code":2017,"month_code":4,"revenue":299,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TELFORT","year_code":2017,"month_code":5,"revenue":266,"cost":0,"sales":1,"pixels":0},{"country_code":"NL","operator_code":"NL_TELFORT","year_code":2017,"month_code":6,"revenue":167,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_TMOBILE","year_code":2017,"month_code":1,"revenue":18231,"cost":5702,"sales":486,"pixels":236},{"country_code":"NL","operator_code":"NL_TMOBILE","year_code":2017,"month_code":2,"revenue":13347,"cost":1836,"sales":165,"pixels":121},{"country_code":"NL","operator_code":"NL_TMOBILE","year_code":2017,"month_code":3,"revenue":13934,"cost":13283,"sales":1274,"pixels":658},{"country_code":"NL","operator_code":"NL_TMOBILE","year_code":2017,"month_code":4,"revenue":19843,"cost":19655,"sales":2193,"pixels":914},{"country_code":"NL","operator_code":"NL_TMOBILE","year_code":2017,"month_code":5,"revenue":28320,"cost":13222,"sales":2719,"pixels":1100},{"country_code":"NL","operator_code":"NL_TMOBILE","year_code":2017,"month_code":6,"revenue":26716,"cost":11798,"sales":2092,"pixels":846},{"country_code":"NL","operator_code":"NL_UPC","year_code":2017,"month_code":1,"revenue":-5,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_UPC","year_code":2017,"month_code":2,"revenue":-3,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_UPC","year_code":2017,"month_code":3,"revenue":-3,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_UPC","year_code":2017,"month_code":4,"revenue":-3,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_UPC","year_code":2017,"month_code":5,"revenue":-3,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_UPC","year_code":2017,"month_code":6,"revenue":-1,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_VODAFONE","year_code":2017,"month_code":1,"revenue":13143,"cost":429,"sales":37,"pixels":19},{"country_code":"NL","operator_code":"NL_VODAFONE","year_code":2017,"month_code":2,"revenue":11186,"cost":962,"sales":78,"pixels":68},{"country_code":"NL","operator_code":"NL_VODAFONE","year_code":2017,"month_code":3,"revenue":12093,"cost":1311,"sales":102,"pixels":92},{"country_code":"NL","operator_code":"NL_VODAFONE","year_code":2017,"month_code":4,"revenue":10519,"cost":69,"sales":5,"pixels":3},{"country_code":"NL","operator_code":"NL_VODAFONE","year_code":2017,"month_code":5,"revenue":10523,"cost":149,"sales":10,"pixels":7},{"country_code":"NL","operator_code":"NL_VODAFONE","year_code":2017,"month_code":6,"revenue":6692,"cost":24,"sales":3,"pixels":1},{"country_code":"NL","operator_code":"NL_VOICEWORKS","year_code":2017,"month_code":1,"revenue":-3,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_VOICEWORKS","year_code":2017,"month_code":2,"revenue":-3,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_VOICEWORKS","year_code":2017,"month_code":3,"revenue":-3,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_VOICEWORKS","year_code":2017,"month_code":4,"revenue":-3,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_VOICEWORKS","year_code":2017,"month_code":5,"revenue":-3,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"NL_VOICEWORKS","year_code":2017,"month_code":6,"revenue":-2,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"Private Mobility 20424","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"Private Mobility 20424","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"Private Mobility 20424","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"Undefined","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"UNKNOWN","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"UNKNOWN","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":"UNKNOWN","year_code":2017,"month_code":3,"revenue":0,"cost":217,"sales":9,"pixels":10},{"country_code":"NL","operator_code":"UNKNOWN","year_code":2017,"month_code":4,"revenue":0,"cost":271,"sales":19,"pixels":12},{"country_code":"NL","operator_code":"UNKNOWN","year_code":2017,"month_code":5,"revenue":0,"cost":11,"sales":1,"pixels":1},{"country_code":"NL","operator_code":"UNKNOWN","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":null,"year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"NL","operator_code":null,"year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"OM","operator_code":"OM_OOREDOO","year_code":2017,"month_code":1,"revenue":73,"cost":984,"sales":524,"pixels":492},{"country_code":"OM","operator_code":"OM_OOREDOO","year_code":2017,"month_code":2,"revenue":319,"cost":2864,"sales":2351,"pixels":1436},{"country_code":"OM","operator_code":"OM_OOREDOO","year_code":2017,"month_code":3,"revenue":6061,"cost":18634,"sales":19347,"pixels":9318},{"country_code":"OM","operator_code":"OM_OOREDOO","year_code":2017,"month_code":4,"revenue":4583,"cost":0,"sales":11,"pixels":4},{"country_code":"OM","operator_code":"OM_OOREDOO","year_code":2017,"month_code":5,"revenue":2838,"cost":38,"sales":35,"pixels":25},{"country_code":"OM","operator_code":"OM_OOREDOO","year_code":2017,"month_code":6,"revenue":2104,"cost":791,"sales":444,"pixels":376},{"country_code":"PL","operator_code":"PL_ORANGE","year_code":2017,"month_code":1,"revenue":7783,"cost":5873,"sales":2733,"pixels":1048},{"country_code":"PL","operator_code":"PL_ORANGE","year_code":2017,"month_code":2,"revenue":6168,"cost":2877,"sales":1909,"pixels":676},{"country_code":"PL","operator_code":"PL_ORANGE","year_code":2017,"month_code":3,"revenue":6853,"cost":3069,"sales":1434,"pixels":642},{"country_code":"PL","operator_code":"PL_ORANGE","year_code":2017,"month_code":4,"revenue":5001,"cost":305,"sales":403,"pixels":67},{"country_code":"PL","operator_code":"PL_ORANGE","year_code":2017,"month_code":5,"revenue":4463,"cost":284,"sales":464,"pixels":75},{"country_code":"PL","operator_code":"PL_ORANGE","year_code":2017,"month_code":6,"revenue":2982,"cost":310,"sales":453,"pixels":136},{"country_code":"PL","operator_code":"PL_PLAY","year_code":2017,"month_code":1,"revenue":6737,"cost":5513,"sales":2610,"pixels":1000},{"country_code":"PL","operator_code":"PL_PLAY","year_code":2017,"month_code":2,"revenue":5185,"cost":2970,"sales":2072,"pixels":735},{"country_code":"PL","operator_code":"PL_PLAY","year_code":2017,"month_code":3,"revenue":5718,"cost":4011,"sales":2026,"pixels":848},{"country_code":"PL","operator_code":"PL_PLAY","year_code":2017,"month_code":4,"revenue":4199,"cost":517,"sales":642,"pixels":110},{"country_code":"PL","operator_code":"PL_PLAY","year_code":2017,"month_code":5,"revenue":3911,"cost":504,"sales":839,"pixels":134},{"country_code":"PL","operator_code":"PL_PLAY","year_code":2017,"month_code":6,"revenue":2841,"cost":419,"sales":743,"pixels":209},{"country_code":"PL","operator_code":"PL_PLUS","year_code":2017,"month_code":1,"revenue":9293,"cost":3990,"sales":1699,"pixels":700},{"country_code":"PL","operator_code":"PL_PLUS","year_code":2017,"month_code":2,"revenue":7370,"cost":1645,"sales":1208,"pixels":414},{"country_code":"PL","operator_code":"PL_PLUS","year_code":2017,"month_code":3,"revenue":7822,"cost":2382,"sales":1110,"pixels":498},{"country_code":"PL","operator_code":"PL_PLUS","year_code":2017,"month_code":4,"revenue":6028,"cost":502,"sales":384,"pixels":108},{"country_code":"PL","operator_code":"PL_PLUS","year_code":2017,"month_code":5,"revenue":5659,"cost":352,"sales":455,"pixels":92},{"country_code":"PL","operator_code":"PL_PLUS","year_code":2017,"month_code":6,"revenue":4186,"cost":267,"sales":396,"pixels":137},{"country_code":"PL","operator_code":"PL_TMOBILE","year_code":2017,"month_code":1,"revenue":7747,"cost":2810,"sales":1347,"pixels":533},{"country_code":"PL","operator_code":"PL_TMOBILE","year_code":2017,"month_code":2,"revenue":6227,"cost":1827,"sales":1244,"pixels":472},{"country_code":"PL","operator_code":"PL_TMOBILE","year_code":2017,"month_code":3,"revenue":6520,"cost":2146,"sales":1063,"pixels":451},{"country_code":"PL","operator_code":"PL_TMOBILE","year_code":2017,"month_code":4,"revenue":4980,"cost":385,"sales":343,"pixels":83},{"country_code":"PL","operator_code":"PL_TMOBILE","year_code":2017,"month_code":5,"revenue":4652,"cost":398,"sales":506,"pixels":105},{"country_code":"PL","operator_code":"PL_TMOBILE","year_code":2017,"month_code":6,"revenue":3474,"cost":345,"sales":441,"pixels":147},{"country_code":"PL","operator_code":"Plus 26001","year_code":2017,"month_code":1,"revenue":140,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":"Plus 26001","year_code":2017,"month_code":2,"revenue":122,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":"Plus 26001","year_code":2017,"month_code":3,"revenue":139,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":"Plus 26001","year_code":2017,"month_code":4,"revenue":114,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":"Plus 26001","year_code":2017,"month_code":5,"revenue":123,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":"Plus 26001","year_code":2017,"month_code":6,"revenue":73,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":"T-Mobile 26002","year_code":2017,"month_code":1,"revenue":222,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":"T-Mobile 26002","year_code":2017,"month_code":2,"revenue":179,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":"T-Mobile 26002","year_code":2017,"month_code":3,"revenue":219,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":"T-Mobile 26002","year_code":2017,"month_code":4,"revenue":177,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":"T-Mobile 26002","year_code":2017,"month_code":5,"revenue":164,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":"T-Mobile 26002","year_code":2017,"month_code":6,"revenue":110,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":"Undefined","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PL","operator_code":null,"year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"Lycamobile 26804","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"Lycamobile 26804","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"Lycamobile 26804","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"Lycamobile 26804","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"Lycamobile 26804","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"Lycamobile 26804","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"PT_MEO","year_code":2017,"month_code":1,"revenue":3089,"cost":2060,"sales":252,"pixels":233},{"country_code":"PT","operator_code":"PT_MEO","year_code":2017,"month_code":2,"revenue":2267,"cost":1133,"sales":181,"pixels":127},{"country_code":"PT","operator_code":"PT_MEO","year_code":2017,"month_code":3,"revenue":4841,"cost":3850,"sales":1320,"pixels":430},{"country_code":"PT","operator_code":"PT_MEO","year_code":2017,"month_code":4,"revenue":5990,"cost":2597,"sales":792,"pixels":291},{"country_code":"PT","operator_code":"PT_MEO","year_code":2017,"month_code":5,"revenue":8223,"cost":1165,"sales":345,"pixels":136},{"country_code":"PT","operator_code":"PT_MEO","year_code":2017,"month_code":6,"revenue":3975,"cost":0,"sales":4,"pixels":0},{"country_code":"PT","operator_code":"PT_NOS","year_code":2017,"month_code":1,"revenue":350,"cost":0,"sales":86,"pixels":0},{"country_code":"PT","operator_code":"PT_NOS","year_code":2017,"month_code":2,"revenue":332,"cost":239,"sales":60,"pixels":27},{"country_code":"PT","operator_code":"PT_NOS","year_code":2017,"month_code":3,"revenue":1884,"cost":3095,"sales":1062,"pixels":345},{"country_code":"PT","operator_code":"PT_NOS","year_code":2017,"month_code":4,"revenue":2877,"cost":3104,"sales":883,"pixels":349},{"country_code":"PT","operator_code":"PT_NOS","year_code":2017,"month_code":5,"revenue":3692,"cost":1284,"sales":360,"pixels":150},{"country_code":"PT","operator_code":"PT_NOS","year_code":2017,"month_code":6,"revenue":1830,"cost":0,"sales":2,"pixels":1},{"country_code":"PT","operator_code":"PT_VODAFONE","year_code":2017,"month_code":1,"revenue":1656,"cost":2000,"sales":239,"pixels":229},{"country_code":"PT","operator_code":"PT_VODAFONE","year_code":2017,"month_code":2,"revenue":1466,"cost":972,"sales":144,"pixels":109},{"country_code":"PT","operator_code":"PT_VODAFONE","year_code":2017,"month_code":3,"revenue":5419,"cost":7069,"sales":2118,"pixels":791},{"country_code":"PT","operator_code":"PT_VODAFONE","year_code":2017,"month_code":4,"revenue":5523,"cost":5841,"sales":1652,"pixels":655},{"country_code":"PT","operator_code":"PT_VODAFONE","year_code":2017,"month_code":5,"revenue":4430,"cost":2017,"sales":561,"pixels":240},{"country_code":"PT","operator_code":"PT_VODAFONE","year_code":2017,"month_code":6,"revenue":1608,"cost":10,"sales":3,"pixels":2},{"country_code":"PT","operator_code":"TMN 26880","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"TMN 26880","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"Undefined","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"UNKNOWN","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"UNKNOWN","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"UNKNOWN","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"UNKNOWN","year_code":2017,"month_code":4,"revenue":0,"cost":9,"sales":3,"pixels":1},{"country_code":"PT","operator_code":"UNKNOWN","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"UNKNOWN","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"Vectone Mobile 26807","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"Vectone Mobile 26807","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"Vectone Mobile 26807","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"Vectone Mobile 26807","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":"Vectone Mobile 26807","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":null,"year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":null,"year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":null,"year_code":2017,"month_code":4,"revenue":0,"cost":27,"sales":15,"pixels":3},{"country_code":"PT","operator_code":null,"year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"PT","operator_code":null,"year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"QA","operator_code":"QA_QTEL","year_code":2017,"month_code":1,"revenue":28581,"cost":4742,"sales":2507,"pixels":1832},{"country_code":"QA","operator_code":"QA_QTEL","year_code":2017,"month_code":2,"revenue":27186,"cost":1154,"sales":777,"pixels":450},{"country_code":"QA","operator_code":"QA_QTEL","year_code":2017,"month_code":3,"revenue":27517,"cost":1504,"sales":1290,"pixels":587},{"country_code":"QA","operator_code":"QA_QTEL","year_code":2017,"month_code":4,"revenue":24893,"cost":525,"sales":773,"pixels":209},{"country_code":"QA","operator_code":"QA_QTEL","year_code":2017,"month_code":5,"revenue":25279,"cost":5592,"sales":2267,"pixels":1872},{"country_code":"QA","operator_code":"QA_QTEL","year_code":2017,"month_code":6,"revenue":12102,"cost":3792,"sales":1537,"pixels":1471},{"country_code":"QA","operator_code":"QA_VODAFONE","year_code":2017,"month_code":1,"revenue":5984,"cost":3575,"sales":1945,"pixels":1394},{"country_code":"QA","operator_code":"QA_VODAFONE","year_code":2017,"month_code":2,"revenue":5664,"cost":7355,"sales":4811,"pixels":2852},{"country_code":"QA","operator_code":"QA_VODAFONE","year_code":2017,"month_code":3,"revenue":24349,"cost":111487,"sales":109983,"pixels":43009},{"country_code":"QA","operator_code":"QA_VODAFONE","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"QA","operator_code":"QA_VODAFONE","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"QA","operator_code":"QA_VODAFONE","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"100","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"100","year_code":2017,"month_code":5,"revenue":0,"cost":40,"sales":12,"pixels":11},{"country_code":"RS","operator_code":"100","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"101","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"101","year_code":2017,"month_code":5,"revenue":0,"cost":35,"sales":10,"pixels":10},{"country_code":"RS","operator_code":"101","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"102","year_code":2017,"month_code":5,"revenue":0,"cost":66,"sales":20,"pixels":18},{"country_code":"RS","operator_code":"102","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"2","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"2","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"2","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"2","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"AE_DU","year_code":2017,"month_code":3,"revenue":0,"cost":24,"sales":6,"pixels":6},{"country_code":"RS","operator_code":"AE_DU","year_code":2017,"month_code":4,"revenue":0,"cost":332,"sales":83,"pixels":83},{"country_code":"RS","operator_code":"AE_DU","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"AE_DU","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"mts","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"RS_MTS","year_code":2017,"month_code":1,"revenue":291,"cost":15,"sales":12,"pixels":5},{"country_code":"RS","operator_code":"RS_MTS","year_code":2017,"month_code":2,"revenue":528,"cost":755,"sales":788,"pixels":239},{"country_code":"RS","operator_code":"RS_MTS","year_code":2017,"month_code":3,"revenue":1258,"cost":1292,"sales":1156,"pixels":382},{"country_code":"RS","operator_code":"RS_MTS","year_code":2017,"month_code":4,"revenue":1270,"cost":549,"sales":595,"pixels":152},{"country_code":"RS","operator_code":"RS_MTS","year_code":2017,"month_code":5,"revenue":1470,"cost":479,"sales":564,"pixels":134},{"country_code":"RS","operator_code":"RS_MTS","year_code":2017,"month_code":6,"revenue":910,"cost":260,"sales":193,"pixels":61},{"country_code":"RS","operator_code":"RS_TELENOR","year_code":2017,"month_code":1,"revenue":531,"cost":12,"sales":23,"pixels":4},{"country_code":"RS","operator_code":"RS_TELENOR","year_code":2017,"month_code":2,"revenue":925,"cost":834,"sales":1024,"pixels":269},{"country_code":"RS","operator_code":"RS_TELENOR","year_code":2017,"month_code":3,"revenue":2040,"cost":936,"sales":1158,"pixels":285},{"country_code":"RS","operator_code":"RS_TELENOR","year_code":2017,"month_code":4,"revenue":1987,"cost":500,"sales":506,"pixels":142},{"country_code":"RS","operator_code":"RS_TELENOR","year_code":2017,"month_code":5,"revenue":1930,"cost":401,"sales":452,"pixels":119},{"country_code":"RS","operator_code":"RS_TELENOR","year_code":2017,"month_code":6,"revenue":1274,"cost":95,"sales":125,"pixels":31},{"country_code":"RS","operator_code":"RS_VIP","year_code":2017,"month_code":1,"revenue":31,"cost":9,"sales":18,"pixels":3},{"country_code":"RS","operator_code":"RS_VIP","year_code":2017,"month_code":2,"revenue":288,"cost":728,"sales":1130,"pixels":239},{"country_code":"RS","operator_code":"RS_VIP","year_code":2017,"month_code":3,"revenue":697,"cost":887,"sales":1267,"pixels":270},{"country_code":"RS","operator_code":"RS_VIP","year_code":2017,"month_code":4,"revenue":612,"cost":250,"sales":471,"pixels":72},{"country_code":"RS","operator_code":"RS_VIP","year_code":2017,"month_code":5,"revenue":585,"cost":252,"sales":489,"pixels":71},{"country_code":"RS","operator_code":"RS_VIP","year_code":2017,"month_code":6,"revenue":355,"cost":65,"sales":115,"pixels":20},{"country_code":"RS","operator_code":"telenor","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"telenor","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":"vip","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":null,"year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":null,"year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":1,"pixels":0},{"country_code":"RS","operator_code":null,"year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":2,"pixels":0},{"country_code":"RS","operator_code":null,"year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"RS","operator_code":null,"year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SA","operator_code":"SA_ZAIN","year_code":2017,"month_code":1,"revenue":1573,"cost":0,"sales":0,"pixels":0},{"country_code":"SA","operator_code":"SA_ZAIN","year_code":2017,"month_code":2,"revenue":8,"cost":0,"sales":0,"pixels":0},{"country_code":"SA","operator_code":"SA_ZAIN","year_code":2017,"month_code":3,"revenue":9,"cost":0,"sales":0,"pixels":0},{"country_code":"SA","operator_code":"SA_ZAIN","year_code":2017,"month_code":4,"revenue":8,"cost":0,"sales":0,"pixels":0},{"country_code":"SA","operator_code":"SA_ZAIN","year_code":2017,"month_code":5,"revenue":6,"cost":0,"sales":0,"pixels":0},{"country_code":"SA","operator_code":"SA_ZAIN","year_code":2017,"month_code":6,"revenue":4,"cost":0,"sales":0,"pixels":0},{"country_code":"SG","operator_code":"M1","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SG","operator_code":"M1","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SG","operator_code":"M1","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SG","operator_code":"SG_M1","year_code":2017,"month_code":1,"revenue":2638,"cost":1442,"sales":152,"pixels":152},{"country_code":"SG","operator_code":"SG_M1","year_code":2017,"month_code":2,"revenue":2921,"cost":1184,"sales":131,"pixels":124},{"country_code":"SG","operator_code":"SG_M1","year_code":2017,"month_code":3,"revenue":2951,"cost":1119,"sales":138,"pixels":133},{"country_code":"SG","operator_code":"SG_M1","year_code":2017,"month_code":4,"revenue":2727,"cost":575,"sales":62,"pixels":54},{"country_code":"SG","operator_code":"SG_M1","year_code":2017,"month_code":5,"revenue":2777,"cost":1496,"sales":154,"pixels":150},{"country_code":"SG","operator_code":"SG_M1","year_code":2017,"month_code":6,"revenue":2185,"cost":801,"sales":93,"pixels":87},{"country_code":"SG","operator_code":"SG_SINGTEL","year_code":2017,"month_code":1,"revenue":1894,"cost":606,"sales":504,"pixels":63},{"country_code":"SG","operator_code":"SG_SINGTEL","year_code":2017,"month_code":2,"revenue":1913,"cost":397,"sales":568,"pixels":43},{"country_code":"SG","operator_code":"SG_SINGTEL","year_code":2017,"month_code":3,"revenue":2029,"cost":417,"sales":334,"pixels":47},{"country_code":"SG","operator_code":"SG_SINGTEL","year_code":2017,"month_code":4,"revenue":1943,"cost":665,"sales":157,"pixels":63},{"country_code":"SG","operator_code":"SG_SINGTEL","year_code":2017,"month_code":5,"revenue":2064,"cost":1484,"sales":620,"pixels":150},{"country_code":"SG","operator_code":"SG_SINGTEL","year_code":2017,"month_code":6,"revenue":1679,"cost":770,"sales":194,"pixels":80},{"country_code":"SG","operator_code":"SINGTEL","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SG","operator_code":"SINGTEL","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SG","operator_code":"SINGTEL","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SG","operator_code":"STARHUB","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SG","operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SK","operator_code":"SK_O2","year_code":2017,"month_code":1,"revenue":1,"cost":0,"sales":0,"pixels":0},{"country_code":"SK","operator_code":"SK_O2","year_code":2017,"month_code":2,"revenue":208,"cost":543,"sales":385,"pixels":267},{"country_code":"SK","operator_code":"SK_O2","year_code":2017,"month_code":3,"revenue":724,"cost":1263,"sales":1042,"pixels":542},{"country_code":"SK","operator_code":"SK_O2","year_code":2017,"month_code":4,"revenue":821,"cost":624,"sales":951,"pixels":262},{"country_code":"SK","operator_code":"SK_O2","year_code":2017,"month_code":5,"revenue":477,"cost":284,"sales":337,"pixels":103},{"country_code":"SK","operator_code":"SK_O2","year_code":2017,"month_code":6,"revenue":227,"cost":185,"sales":169,"pixels":49},{"country_code":"SK","operator_code":"SK_ORANGE","year_code":2017,"month_code":1,"revenue":1770,"cost":323,"sales":282,"pixels":281},{"country_code":"SK","operator_code":"SK_ORANGE","year_code":2017,"month_code":2,"revenue":574,"cost":629,"sales":442,"pixels":288},{"country_code":"SK","operator_code":"SK_ORANGE","year_code":2017,"month_code":3,"revenue":1439,"cost":1337,"sales":897,"pixels":576},{"country_code":"SK","operator_code":"SK_ORANGE","year_code":2017,"month_code":4,"revenue":1593,"cost":1019,"sales":807,"pixels":438},{"country_code":"SK","operator_code":"SK_ORANGE","year_code":2017,"month_code":5,"revenue":1329,"cost":468,"sales":348,"pixels":180},{"country_code":"SK","operator_code":"SK_ORANGE","year_code":2017,"month_code":6,"revenue":604,"cost":239,"sales":173,"pixels":70},{"country_code":"SK","operator_code":"SK_TMOBILE","year_code":2017,"month_code":1,"revenue":2351,"cost":480,"sales":418,"pixels":417},{"country_code":"SK","operator_code":"SK_TMOBILE","year_code":2017,"month_code":2,"revenue":1947,"cost":670,"sales":495,"pixels":373},{"country_code":"SK","operator_code":"SK_TMOBILE","year_code":2017,"month_code":3,"revenue":2199,"cost":1420,"sales":920,"pixels":591},{"country_code":"SK","operator_code":"SK_TMOBILE","year_code":2017,"month_code":4,"revenue":2083,"cost":882,"sales":674,"pixels":378},{"country_code":"SK","operator_code":"SK_TMOBILE","year_code":2017,"month_code":5,"revenue":2000,"cost":465,"sales":295,"pixels":172},{"country_code":"SK","operator_code":"SK_TMOBILE","year_code":2017,"month_code":6,"revenue":1057,"cost":289,"sales":158,"pixels":74},{"country_code":"SK","operator_code":"Undefined","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SK","operator_code":"Undefined","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SK","operator_code":"Undefined","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SK","operator_code":"Undefined","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SK","operator_code":"Undefined","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SK","operator_code":"Undefined","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SK","operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SK","operator_code":null,"year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"SK","operator_code":null,"year_code":2017,"month_code":3,"revenue":0,"cost":2,"sales":1,"pixels":1},{"country_code":"SK","operator_code":null,"year_code":2017,"month_code":4,"revenue":0,"cost":2,"sales":1,"pixels":1},{"country_code":"SK","operator_code":null,"year_code":2017,"month_code":5,"revenue":0,"cost":3,"sales":2,"pixels":1},{"country_code":"SK","operator_code":null,"year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"AIS","year_code":2017,"month_code":1,"revenue":53624,"cost":30843,"sales":49940,"pixels":48600},{"country_code":"TH","operator_code":"AIS","year_code":2017,"month_code":2,"revenue":43803,"cost":19931,"sales":25240,"pixels":23060},{"country_code":"TH","operator_code":"AIS","year_code":2017,"month_code":3,"revenue":48501,"cost":46010,"sales":66891,"pixels":51140},{"country_code":"TH","operator_code":"AIS","year_code":2017,"month_code":4,"revenue":48199,"cost":25031,"sales":49779,"pixels":32507},{"country_code":"TH","operator_code":"AIS","year_code":2017,"month_code":5,"revenue":39888,"cost":17054,"sales":22702,"pixels":17115},{"country_code":"TH","operator_code":"AIS","year_code":2017,"month_code":6,"revenue":24255,"cost":17721,"sales":18607,"pixels":13782},{"country_code":"TH","operator_code":"DTAC","year_code":2017,"month_code":1,"revenue":37660,"cost":6974,"sales":10930,"pixels":10701},{"country_code":"TH","operator_code":"DTAC","year_code":2017,"month_code":2,"revenue":31896,"cost":7951,"sales":11830,"pixels":10762},{"country_code":"TH","operator_code":"DTAC","year_code":2017,"month_code":3,"revenue":29603,"cost":7504,"sales":9566,"pixels":5389},{"country_code":"TH","operator_code":"DTAC","year_code":2017,"month_code":4,"revenue":27622,"cost":8435,"sales":7073,"pixels":6209},{"country_code":"TH","operator_code":"DTAC","year_code":2017,"month_code":5,"revenue":35536,"cost":80169,"sales":86910,"pixels":66455},{"country_code":"TH","operator_code":"DTAC","year_code":2017,"month_code":6,"revenue":25684,"cost":46907,"sales":55236,"pixels":49017},{"country_code":"TH","operator_code":"HUT/TRUEMOVE","year_code":2017,"month_code":1,"revenue":1871,"cost":0,"sales":8,"pixels":0},{"country_code":"TH","operator_code":"HUT/TRUEMOVE","year_code":2017,"month_code":2,"revenue":1497,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"HUT/TRUEMOVE","year_code":2017,"month_code":3,"revenue":1521,"cost":0,"sales":1,"pixels":0},{"country_code":"TH","operator_code":"HUT/TRUEMOVE","year_code":2017,"month_code":4,"revenue":1461,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"HUT/TRUEMOVE","year_code":2017,"month_code":5,"revenue":1458,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"HUT/TRUEMOVE","year_code":2017,"month_code":6,"revenue":941,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"TAO/TRUEMOVE","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"TAO/TRUEMOVE","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"TAO/TRUEMOVE","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"TAO/TRUEMOVE","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"TAO/TRUEMOVE","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TH","operator_code":"TAO/TRUEMOVE","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TR","operator_code":"TR_AVEA","year_code":2017,"month_code":1,"revenue":90791,"cost":42825,"sales":59811,"pixels":8010},{"country_code":"TR","operator_code":"TR_AVEA","year_code":2017,"month_code":2,"revenue":57523,"cost":25162,"sales":54789,"pixels":18471},{"country_code":"TR","operator_code":"TR_AVEA","year_code":2017,"month_code":3,"revenue":76017,"cost":39942,"sales":53842,"pixels":13965},{"country_code":"TR","operator_code":"TR_AVEA","year_code":2017,"month_code":4,"revenue":104509,"cost":65762,"sales":66215,"pixels":29013},{"country_code":"TR","operator_code":"TR_AVEA","year_code":2017,"month_code":5,"revenue":171794,"cost":88696,"sales":92900,"pixels":42474},{"country_code":"TR","operator_code":"TR_AVEA","year_code":2017,"month_code":6,"revenue":152198,"cost":112212,"sales":115781,"pixels":39588},{"country_code":"TR","operator_code":"TR_TURKCELL","year_code":2017,"month_code":1,"revenue":1635,"cost":1759,"sales":8637,"pixels":1141},{"country_code":"TR","operator_code":"TR_TURKCELL","year_code":2017,"month_code":2,"revenue":6996,"cost":3272,"sales":38132,"pixels":8139},{"country_code":"TR","operator_code":"TR_TURKCELL","year_code":2017,"month_code":3,"revenue":7446,"cost":456,"sales":4129,"pixels":290},{"country_code":"TR","operator_code":"TR_TURKCELL","year_code":2017,"month_code":4,"revenue":32652,"cost":43469,"sales":76082,"pixels":39745},{"country_code":"TR","operator_code":"TR_TURKCELL","year_code":2017,"month_code":5,"revenue":43470,"cost":23066,"sales":45456,"pixels":7743},{"country_code":"TR","operator_code":"TR_TURKCELL","year_code":2017,"month_code":6,"revenue":56825,"cost":39939,"sales":99796,"pixels":21287},{"country_code":"TR","operator_code":"TR_VODAFONE","year_code":2017,"month_code":1,"revenue":292946,"cost":280964,"sales":150347,"pixels":48070},{"country_code":"TR","operator_code":"TR_VODAFONE","year_code":2017,"month_code":2,"revenue":388467,"cost":329966,"sales":195059,"pixels":52241},{"country_code":"TR","operator_code":"TR_VODAFONE","year_code":2017,"month_code":3,"revenue":522634,"cost":252631,"sales":164713,"pixels":47713},{"country_code":"TR","operator_code":"TR_VODAFONE","year_code":2017,"month_code":4,"revenue":445038,"cost":318138,"sales":174114,"pixels":49927},{"country_code":"TR","operator_code":"TR_VODAFONE","year_code":2017,"month_code":5,"revenue":609112,"cost":349887,"sales":184645,"pixels":55730},{"country_code":"TR","operator_code":"TR_VODAFONE","year_code":2017,"month_code":6,"revenue":438082,"cost":296787,"sales":164613,"pixels":55524},{"country_code":"TW","operator_code":"TW_APBW","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_APBW","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_APBW","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_APBW","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_CHT","year_code":2017,"month_code":1,"revenue":174,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_CHT","year_code":2017,"month_code":2,"revenue":181,"cost":0,"sales":1,"pixels":0},{"country_code":"TW","operator_code":"TW_CHT","year_code":2017,"month_code":3,"revenue":226,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_CHT","year_code":2017,"month_code":4,"revenue":181,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_CHT","year_code":2017,"month_code":5,"revenue":193,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_CHT","year_code":2017,"month_code":6,"revenue":124,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_FET","year_code":2017,"month_code":1,"revenue":189,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_FET","year_code":2017,"month_code":2,"revenue":178,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_FET","year_code":2017,"month_code":3,"revenue":208,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_FET","year_code":2017,"month_code":4,"revenue":148,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_FET","year_code":2017,"month_code":5,"revenue":153,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_FET","year_code":2017,"month_code":6,"revenue":94,"cost":0,"sales":0,"pixels":0},{"country_code":"TW","operator_code":"TW_TCC","year_code":2017,"month_code":1,"revenue":473,"cost":316,"sales":262,"pixels":243},{"country_code":"TW","operator_code":"TW_TCC","year_code":2017,"month_code":2,"revenue":521,"cost":341,"sales":289,"pixels":262},{"country_code":"TW","operator_code":"TW_TCC","year_code":2017,"month_code":3,"revenue":301,"cost":185,"sales":155,"pixels":142},{"country_code":"TW","operator_code":"TW_TCC","year_code":2017,"month_code":4,"revenue":727,"cost":458,"sales":373,"pixels":352},{"country_code":"TW","operator_code":"TW_TCC","year_code":2017,"month_code":5,"revenue":895,"cost":615,"sales":497,"pixels":473},{"country_code":"TW","operator_code":"TW_TCC","year_code":2017,"month_code":6,"revenue":622,"cost":398,"sales":326,"pixels":308},{"country_code":"TW","operator_code":"VIBO","year_code":2017,"month_code":1,"revenue":66,"cost":34,"sales":27,"pixels":26},{"country_code":"TW","operator_code":"VIBO","year_code":2017,"month_code":2,"revenue":111,"cost":51,"sales":44,"pixels":39},{"country_code":"TW","operator_code":"VIBO","year_code":2017,"month_code":3,"revenue":74,"cost":29,"sales":28,"pixels":22},{"country_code":"TW","operator_code":"VIBO","year_code":2017,"month_code":4,"revenue":109,"cost":56,"sales":44,"pixels":43},{"country_code":"TW","operator_code":"VIBO","year_code":2017,"month_code":5,"revenue":324,"cost":160,"sales":131,"pixels":123},{"country_code":"TW","operator_code":"VIBO","year_code":2017,"month_code":6,"revenue":188,"cost":87,"sales":76,"pixels":67},{"country_code":"UG","operator_code":"UG_MTN","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UG","operator_code":"UG_MTN","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UG","operator_code":"UG_MTN","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UG","operator_code":"UG_MTN","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UG","operator_code":"UG_MTN","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UG","operator_code":"UG_MTN","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_EE","year_code":2017,"month_code":1,"revenue":8118,"cost":8529,"sales":1481,"pixels":939},{"country_code":"UK","operator_code":"UK_EE","year_code":2017,"month_code":2,"revenue":22359,"cost":33400,"sales":6085,"pixels":3714},{"country_code":"UK","operator_code":"UK_EE","year_code":2017,"month_code":3,"revenue":36219,"cost":22154,"sales":4766,"pixels":2535},{"country_code":"UK","operator_code":"UK_EE","year_code":2017,"month_code":4,"revenue":38739,"cost":9757,"sales":3425,"pixels":2167},{"country_code":"UK","operator_code":"UK_EE","year_code":2017,"month_code":5,"revenue":41320,"cost":31508,"sales":6276,"pixels":5759},{"country_code":"UK","operator_code":"UK_EE","year_code":2017,"month_code":6,"revenue":37136,"cost":42904,"sales":9367,"pixels":6536},{"country_code":"UK","operator_code":"UK_O2","year_code":2017,"month_code":1,"revenue":30428,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_O2","year_code":2017,"month_code":2,"revenue":21470,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_O2","year_code":2017,"month_code":3,"revenue":19837,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_O2","year_code":2017,"month_code":4,"revenue":17164,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_O2","year_code":2017,"month_code":5,"revenue":15407,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_O2","year_code":2017,"month_code":6,"revenue":9621,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_ORANGE","year_code":2017,"month_code":1,"revenue":1440,"cost":836,"sales":140,"pixels":89},{"country_code":"UK","operator_code":"UK_ORANGE","year_code":2017,"month_code":2,"revenue":1341,"cost":4701,"sales":873,"pixels":527},{"country_code":"UK","operator_code":"UK_ORANGE","year_code":2017,"month_code":3,"revenue":1448,"cost":638,"sales":268,"pixels":69},{"country_code":"UK","operator_code":"UK_ORANGE","year_code":2017,"month_code":4,"revenue":1238,"cost":0,"sales":195,"pixels":0},{"country_code":"UK","operator_code":"UK_ORANGE","year_code":2017,"month_code":5,"revenue":1218,"cost":0,"sales":68,"pixels":0},{"country_code":"UK","operator_code":"UK_ORANGE","year_code":2017,"month_code":6,"revenue":812,"cost":0,"sales":71,"pixels":0},{"country_code":"UK","operator_code":"UK_THREE","year_code":2017,"month_code":1,"revenue":8308,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_THREE","year_code":2017,"month_code":2,"revenue":5644,"cost":0,"sales":1,"pixels":0},{"country_code":"UK","operator_code":"UK_THREE","year_code":2017,"month_code":3,"revenue":5351,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_THREE","year_code":2017,"month_code":4,"revenue":4452,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_THREE","year_code":2017,"month_code":5,"revenue":4047,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_THREE","year_code":2017,"month_code":6,"revenue":2384,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_TMOBILE","year_code":2017,"month_code":1,"revenue":22836,"cost":671,"sales":111,"pixels":72},{"country_code":"UK","operator_code":"UK_TMOBILE","year_code":2017,"month_code":2,"revenue":16498,"cost":2953,"sales":576,"pixels":332},{"country_code":"UK","operator_code":"UK_TMOBILE","year_code":2017,"month_code":3,"revenue":15689,"cost":353,"sales":216,"pixels":39},{"country_code":"UK","operator_code":"UK_TMOBILE","year_code":2017,"month_code":4,"revenue":13457,"cost":0,"sales":124,"pixels":0},{"country_code":"UK","operator_code":"UK_TMOBILE","year_code":2017,"month_code":5,"revenue":12390,"cost":0,"sales":226,"pixels":0},{"country_code":"UK","operator_code":"UK_TMOBILE","year_code":2017,"month_code":6,"revenue":7757,"cost":0,"sales":228,"pixels":0},{"country_code":"UK","operator_code":"UK_VIRGIN","year_code":2017,"month_code":1,"revenue":1367,"cost":0,"sales":1,"pixels":0},{"country_code":"UK","operator_code":"UK_VIRGIN","year_code":2017,"month_code":2,"revenue":959,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_VIRGIN","year_code":2017,"month_code":3,"revenue":888,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_VIRGIN","year_code":2017,"month_code":4,"revenue":759,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_VIRGIN","year_code":2017,"month_code":5,"revenue":669,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_VIRGIN","year_code":2017,"month_code":6,"revenue":410,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_VODAFONE","year_code":2017,"month_code":1,"revenue":20860,"cost":0,"sales":1,"pixels":0},{"country_code":"UK","operator_code":"UK_VODAFONE","year_code":2017,"month_code":2,"revenue":15178,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_VODAFONE","year_code":2017,"month_code":3,"revenue":12444,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_VODAFONE","year_code":2017,"month_code":4,"revenue":10617,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_VODAFONE","year_code":2017,"month_code":5,"revenue":9884,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":"UK_VODAFONE","year_code":2017,"month_code":6,"revenue":6066,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":null,"year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":null,"year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":null,"year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"UK","operator_code":null,"year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"VN","operator_code":"VN_VIETNAM_MOBILE","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":3,"pixels":0},{"country_code":"VN","operator_code":"VN_VIETNAM_MOBILE","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":1,"pixels":0},{"country_code":"VN","operator_code":"VN_VIETNAM_MOBILE","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":1,"pixels":0},{"country_code":"VN","operator_code":"VN_VIETNAM_MOBILE","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"VN","operator_code":"VN_VIETNAM_MOBILE","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"VN","operator_code":"VN_VIETNAM_MOBILE","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"VN","operator_code":"VN_VIETTEL","year_code":2017,"month_code":1,"revenue":1,"cost":0,"sales":6,"pixels":0},{"country_code":"VN","operator_code":"VN_VIETTEL","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"VN","operator_code":"VN_VIETTEL","year_code":2017,"month_code":3,"revenue":13,"cost":0,"sales":235,"pixels":0},{"country_code":"VN","operator_code":"VN_VIETTEL","year_code":2017,"month_code":4,"revenue":7,"cost":0,"sales":118,"pixels":17},{"country_code":"VN","operator_code":"VN_VIETTEL","year_code":2017,"month_code":5,"revenue":9,"cost":3,"sales":80,"pixels":14},{"country_code":"VN","operator_code":"VN_VIETTEL","year_code":2017,"month_code":6,"revenue":25,"cost":87,"sales":132,"pixels":71},{"country_code":"VN","operator_code":"VN_VINAPHONE","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"VN","operator_code":"VN_VINAPHONE","year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":1,"pixels":0},{"country_code":"VN","operator_code":"VN_VINAPHONE","year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"VN","operator_code":"VN_VINAPHONE","year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"VN","operator_code":"VN_VINAPHONE","year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"VN","operator_code":"VN_VINAPHONE","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ZA","operator_code":"ZA_CELLC","year_code":2017,"month_code":2,"revenue":0,"cost":107,"sales":95,"pixels":22},{"country_code":"ZA","operator_code":"ZA_CELLC","year_code":2017,"month_code":3,"revenue":0,"cost":46,"sales":39,"pixels":9},{"country_code":"ZA","operator_code":"ZA_CELLC","year_code":2017,"month_code":4,"revenue":0,"cost":5,"sales":4,"pixels":1},{"country_code":"ZA","operator_code":"ZA_CELLC","year_code":2017,"month_code":5,"revenue":0,"cost":20,"sales":14,"pixels":4},{"country_code":"ZA","operator_code":"ZA_CELLC","year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":"ZA","operator_code":"ZA_MTN","year_code":2017,"month_code":2,"revenue":0,"cost":16826,"sales":12204,"pixels":3324},{"country_code":"ZA","operator_code":"ZA_MTN","year_code":2017,"month_code":3,"revenue":304,"cost":25391,"sales":14229,"pixels":5047},{"country_code":"ZA","operator_code":"ZA_MTN","year_code":2017,"month_code":4,"revenue":1483,"cost":6389,"sales":5062,"pixels":1265},{"country_code":"ZA","operator_code":"ZA_MTN","year_code":2017,"month_code":5,"revenue":158,"cost":1537,"sales":3294,"pixels":474},{"country_code":"ZA","operator_code":"ZA_MTN","year_code":2017,"month_code":6,"revenue":7,"cost":30,"sales":3,"pixels":3},{"country_code":"ZA","operator_code":"ZA_VODACOM","year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":2,"pixels":0},{"country_code":"ZA","operator_code":"ZA_VODACOM","year_code":2017,"month_code":2,"revenue":0,"cost":5609,"sales":3709,"pixels":1121},{"country_code":"ZA","operator_code":"ZA_VODACOM","year_code":2017,"month_code":3,"revenue":3491,"cost":13979,"sales":12791,"pixels":2789},{"country_code":"ZA","operator_code":"ZA_VODACOM","year_code":2017,"month_code":4,"revenue":83883,"cost":117897,"sales":98702,"pixels":23471},{"country_code":"ZA","operator_code":"ZA_VODACOM","year_code":2017,"month_code":5,"revenue":185020,"cost":205948,"sales":183972,"pixels":41543},{"country_code":"ZA","operator_code":"ZA_VODACOM","year_code":2017,"month_code":6,"revenue":131225,"cost":51410,"sales":53060,"pixels":10595},{"country_code":"ZA","operator_code":null,"year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":null,"operator_code":null,"year_code":2017,"month_code":1,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":null,"operator_code":null,"year_code":2017,"month_code":2,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":null,"operator_code":null,"year_code":2017,"month_code":3,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":null,"operator_code":null,"year_code":2017,"month_code":4,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":null,"operator_code":null,"year_code":2017,"month_code":5,"revenue":0,"cost":0,"sales":0,"pixels":0},{"country_code":null,"operator_code":null,"year_code":2017,"month_code":6,"revenue":0,"cost":0,"sales":0,"pixels":0}];
</script>
<!-- executes the presentation code using the parameters & transformedResult -->
<script type="text/javascript" src="./presentation.js"></script>
</head>
<body>
<div class="presentation"></div>
<script type="text/javascript" src="./ramda.min.js"></script>
<script type="text/javascript" src="./gistfile1.js"></script>
</body></html>
This file has been truncated, but you can view the full file.
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
// Generated by LiveScript 1.3.1
var Promise, ref$, keys, map, pairsToObj, Str, webClient, compileTransformation, compilePresentation, toString$ = {}.toString;
Promise = require('bluebird').Promise;
require('prelude-ls');
ref$ = require('prelude-ls'), keys = ref$.keys, map = ref$.map, pairsToObj = ref$.pairsToObj, Str = ref$.Str;
webClient = require('pipe-web-client')({
endPoint: "http://" + window.location.host
}), compileTransformation = webClient.compileTransformation, compilePresentation = webClient.compilePresentation;
window.addEventListener('load', function(){
var ref$, transformation, presentation, view;
ref$ = pairsToObj(
map(function(it){
return [it, document.getElementById(it).innerHTML.replace(/\t/g, " ")];
})(
['transformation', 'presentation'])), transformation = ref$.transformation, presentation = ref$.presentation;
view = document.getElementsByClassName('presentation')[0];
return new Promise(function(resolve, reject){
return compileTransformation(transformation, window.transpilation.transformation).then(function(transformationFunction){
return compilePresentation(presentation, window.transpilation.presentation).then(function(presentationFunction){
var transformedResult, ex;
try {
transformedResult = transformationFunction(queryResult, compiledParameters);
if ('Function' === toString$.call(transformedResult.subscribe).slice(8, -1)) {
transformedResult.subscribe(function(e){
return presentationFunction(view, e, compiledParameters);
});
} else {
presentationFunction(view, transformedResult, compiledParameters);
}
} catch (e$) {
ex = e$;
reject(ex);
}
return resolve("done!");
});
});
})['catch'](function(it){
return view.innerHTML = "<div style='color: red'>" + it.toString() + "</div>";
});
});
},{"bluebird":11,"pipe-web-client":88,"prelude-ls":114}],2:[function(require,module,exports){
(function (process,Buffer){
'use strict'
var Parser = require('jsonparse')
, through = require('through')
/*
the value of this.stack that creationix's jsonparse has is weird.
it makes this code ugly, but his problem is way harder that mine,
so i'll forgive him.
*/
exports.parse = function (path, map) {
var parser = new Parser()
var stream = through(function (chunk) {
if('string' === typeof chunk)
chunk = new Buffer(chunk)
parser.write(chunk)
},
function (data) {
if(data)
stream.write(data)
stream.queue(null)
})
if('string' === typeof path)
path = path.split('.').map(function (e) {
if (e === '$*')
return {emitKey: true}
else if (e === '*')
return true
else if (e === '') // '..'.split('.') returns an empty string
return {recurse: true}
else
return e
})
var count = 0, _key
if(!path || !path.length)
path = null
parser.onValue = function (value) {
if (!this.root)
stream.root = value
if(! path) return
var i = 0 // iterates on path
var j = 0 // iterates on stack
var emitKey = false;
while (i < path.length) {
var key = path[i]
var c
j++
if (key && !key.recurse) {
c = (j === this.stack.length) ? this : this.stack[j]
if (!c) return
if (! check(key, c.key)) return
emitKey = !!key.emitKey;
i++
} else {
i++
var nextKey = path[i]
if (! nextKey) return
while (true) {
c = (j === this.stack.length) ? this : this.stack[j]
if (!c) return
if (check(nextKey, c.key)) {
i++;
this.stack[j].value = null
break
}
j++
}
}
}
if (j !== this.stack.length) return
count ++
var actualPath = this.stack.slice(1).map(function(element) { return element.key }).concat([this.key])
var data = this.value[this.key]
if(null != data)
if(null != (data = map ? map(data, actualPath) : data)) {
data = emitKey ? { value: data, key: this.key } : data;
stream.queue(data)
}
delete this.value[this.key]
for(var k in this.stack)
this.stack[k].value = null
}
parser._onToken = parser.onToken;
parser.onToken = function (token, value) {
parser._onToken(token, value);
if (this.stack.length === 0) {
if (stream.root) {
if(!path)
stream.queue(stream.root)
count = 0;
stream.root = null;
}
}
}
parser.onError = function (err) {
if(err.message.indexOf("at position") > -1)
err.message = "Invalid JSON (" + err.message + ")";
stream.emit('error', err)
}
return stream
}
function check (x, y) {
if ('string' === typeof x)
return y == x
else if (x && 'function' === typeof x.exec)
return x.exec(y)
else if ('boolean' === typeof x || 'object' === typeof x)
return x
else if ('function' === typeof x)
return x(y)
return false
}
exports.stringify = function (op, sep, cl, indent) {
indent = indent || 0
if (op === false){
op = ''
sep = '\n'
cl = ''
} else if (op == null) {
op = '[\n'
sep = '\n,\n'
cl = '\n]\n'
}
//else, what ever you like
var stream
, first = true
, anyData = false
stream = through(function (data) {
anyData = true
var json = JSON.stringify(data, null, indent)
if(first) { first = false ; stream.queue(op + json)}
else stream.queue(sep + json)
},
function (data) {
if(!anyData)
stream.queue(op)
stream.queue(cl)
stream.queue(null)
})
return stream
}
exports.stringifyObject = function (op, sep, cl, indent) {
indent = indent || 0
if (op === false){
op = ''
sep = '\n'
cl = ''
} else if (op == null) {
op = '{\n'
sep = '\n,\n'
cl = '\n}\n'
}
//else, what ever you like
var first = true
var anyData = false
var stream = through(function (data) {
anyData = true
var json = JSON.stringify(data[0]) + ':' + JSON.stringify(data[1], null, indent)
if(first) { first = false ; this.queue(op + json)}
else this.queue(sep + json)
},
function (data) {
if(!anyData) this.queue(op)
this.queue(cl)
this.queue(null)
})
return stream
}
if(!module.parent && process.title !== 'browser') {
process.stdin
.pipe(exports.parse(process.argv[2]))
.pipe(exports.stringify('[', ',\n', ']\n', 2))
.pipe(process.stdout)
}
}).call(this,require('_process'),require("buffer").Buffer)
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9KU09OU3RyZWFtL2luZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXNDb250ZW50IjpbIlxuXG4ndXNlIHN0cmljdCdcblxudmFyIFBhcnNlciA9IHJlcXVpcmUoJ2pzb25wYXJzZScpXG4gICwgdGhyb3VnaCA9IHJlcXVpcmUoJ3Rocm91Z2gnKVxuXG4vKlxuXG4gIHRoZSB2YWx1ZSBvZiB0aGlzLnN0YWNrIHRoYXQgY3JlYXRpb25peCdzIGpzb25wYXJzZSBoYXMgaXMgd2VpcmQuXG5cbiAgaXQgbWFrZXMgdGhpcyBjb2RlIHVnbHksIGJ1dCBoaXMgcHJvYmxlbSBpcyB3YXkgaGFyZGVyIHRoYXQgbWluZSxcbiAgc28gaSdsbCBmb3JnaXZlIGhpbS5cblxuKi9cblxuZXhwb3J0cy5wYXJzZSA9IGZ1bmN0aW9uIChwYXRoLCBtYXApIHtcblxuICB2YXIgcGFyc2VyID0gbmV3IFBhcnNlcigpXG4gIHZhciBzdHJlYW0gPSB0aHJvdWdoKGZ1bmN0aW9uIChjaHVuaykge1xuICAgIGlmKCdzdHJpbmcnID09PSB0eXBlb2YgY2h1bmspXG4gICAgICBjaHVuayA9IG5ldyBCdWZmZXIoY2h1bmspXG4gICAgcGFyc2VyLndyaXRlKGNodW5rKVxuICB9LFxuICBmdW5jdGlvbiAoZGF0YSkge1xuICAgIGlmKGRhdGEpXG4gICAgICBzdHJlYW0ud3JpdGUoZGF0YSlcbiAgICBzdHJlYW0ucXVldWUobnVsbClcbiAgfSlcblxuICBpZignc3RyaW5nJyA9PT0gdHlwZW9mIHBhdGgpXG4gICAgcGF0aCA9IHBhdGguc3BsaXQoJy4nKS5tYXAoZnVuY3Rpb24gKGUpIHtcbiAgICAgIGlmIChlID09PSAnJConKVxuICAgICAgICByZXR1cm4ge2VtaXRLZXk6IHRydWV9XG4gICAgICBlbHNlIGlmIChlID09PSAnKicpXG4gICAgICAgIHJldHVybiB0cnVlXG4gICAgICBlbHNlIGlmIChlID09PSAnJykgLy8gJy4uJy5zcGxpdCgnLicpIHJldHVybnMgYW4gZW1wdHkgc3RyaW5nXG4gICAgICAgIHJldHVybiB7cmVjdXJzZTogdHJ1ZX1cbiAgICAgIGVsc2VcbiAgICAgICAgcmV0dXJuIGVcbiAgICB9KVxuXG5cbiAgdmFyIGNvdW50ID0gMCwgX2tleVxuICBpZighcGF0aCB8fCAhcGF0aC5sZW5ndGgpXG4gICAgcGF0aCA9IG51bGxcblxuICBwYXJzZXIub25WYWx1ZSA9IGZ1bmN0aW9uICh2YWx1ZSkge1xuICAgIGlmICghdGhpcy5yb290KVxuICAgICAgc3RyZWFtLnJvb3QgPSB2YWx1ZVxuXG4gICAgaWYoISBwYXRoKSByZXR1cm5cblxuICAgIHZhciBpID0gMCAvLyBpdGVyYXRlcyBvbiBwYXRoXG4gICAgdmFyIGogID0gMCAvLyBpdGVyYXRlcyBvbiBzdGFja1xuICAgIHZhciBlbWl0S2V5ID0gZmFsc2U7XG4gICAgd2hpbGUgKGkgPCBwYXRoLmxlbmd0aCkge1xuICAgICAgdmFyIGtleSA9IHBhdGhbaV1cbiAgICAgIHZhciBjXG4gICAgICBqKytcblxuICAgICAgaWYgKGtleSAmJiAha2V5LnJlY3Vyc2UpIHtcbiAgICAgICAgYyA9IChqID09PSB0aGlzLnN0YWNrLmxlbmd0aCkgPyB0aGlzIDogdGhpcy5zdGFja1tqXVxuICAgICAgICBpZiAoIWMpIHJldHVyblxuICAgICAgICBpZiAoISBjaGVjayhrZXksIGMua2V5KSkgcmV0dXJuXG4gICAgICAgIGVtaXRLZXkgPSAhIWtleS5lbWl0S2V5O1xuICAgICAgICBpKytcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIGkrK1xuICAgICAgICB2YXIgbmV4dEtleSA9IHBhdGhbaV1cbiAgICAgICAgaWYgKCEgbmV4dEtleSkgcmV0dXJuXG4gICAgICAgIHdoaWxlICh0cnVlKSB7XG4gICAgICAgICAgYyA9IChqID09PSB0aGlzLnN0YWNrLmxlbmd0aCkgPyB0aGlzIDogdGhpcy5zdGFja1tqXVxuICAgICAgICAgIGlmICghYykgcmV0dXJuXG4gICAgICAgICAgaWYgKGNoZWNrKG5leHRLZXksIGMua2V5KSkge1xuICAgICAgICAgICAgaSsrO1xuICAgICAgICAgICAgdGhpcy5zdGFja1tqXS52YWx1ZSA9IG51bGxcbiAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgfVxuICAgICAgICAgIGorK1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICB9XG4gICAgaWYgKGogIT09IHRoaXMuc3RhY2subGVuZ3RoKSByZXR1cm5cblxuICAgIGNvdW50ICsrXG4gICAgdmFyIGFjdHVhbFBhdGggPSB0aGlzLnN0YWNrLnNsaWNlKDEpLm1hcChmdW5jdGlvbihlbGVtZW50KSB7IHJldHVybiBlbGVtZW50LmtleSB9KS5jb25jYXQoW3RoaXMua2V5XSlcbiAgICB2YXIgZGF0YSA9IHRoaXMudmFsdWVbdGhpcy5rZXldXG4gICAgaWYobnVsbCAhPSBkYXRhKVxuICAgICAgaWYobnVsbCAhPSAoZGF0YSA9IG1hcCA/IG1hcChkYXRhLCBhY3R1YWxQYXRoKSA6IGRhdGEpKSB7XG4gICAgICAgIGRhdGEgPSBlbWl0S2V5ID8geyB2YWx1ZTogZGF0YSwga2V5OiB0aGlzLmtleSB9IDogZGF0YTtcbiAgICAgICAgc3RyZWFtLnF1ZXVlKGRhdGEpXG4gICAgICB9XG4gICAgZGVsZXRlIHRoaXMudmFsdWVbdGhpcy5rZXldXG4gICAgZm9yKHZhciBrIGluIHRoaXMuc3RhY2spXG4gICAgICB0aGlzLnN0YWNrW2tdLnZhbHVlID0gbnVsbFxuICB9XG4gIHBhcnNlci5fb25Ub2tlbiA9IHBhcnNlci5vblRva2VuO1xuXG4gIHBhcnNlci5vblRva2VuID0gZnVuY3Rpb24gKHRva2VuLCB2YWx1ZSkge1xuICAgIHBhcnNlci5fb25Ub2tlbih0b2tlbiwgdmFsdWUpO1xuICAgIGlmICh0aGlzLnN0YWNrLmxlbmd0aCA9PT0gMCkge1xuICAgICAgaWYgKHN0cmVhbS5yb290KSB7XG4gICAgICAgIGlmKCFwYXRoKVxuICAgICAgICAgIHN0cmVhbS5xdWV1ZShzdHJlYW0ucm9vdClcbiAgICAgICAgY291bnQgPSAwO1xuICAgICAgICBzdHJlYW0ucm9vdCA9IG51bGw7XG4gICAgICB9XG4gICAgfVxuICB9XG4gIFxuICBwYXJzZXIub25FcnJvciA9IGZ1bmN0aW9uIChlcnIpIHtcbiAgICBpZihlcnIubWVzc2FnZS5pbmRleE9mKFwiYXQgcG9zaXRpb25cIikgPiAtMSlcbiAgICAgIGVyci5tZXNzYWdlID0gXCJJbnZhbGlkIEpTT04gKFwiICsgZXJyLm1lc3NhZ2UgKyBcIilcIjtcbiAgICBzdHJlYW0uZW1pdCgnZXJyb3InLCBlcnIpXG4gIH1cblxuXG4gIHJldHVybiBzdHJlYW1cbn1cblxuZnVuY3Rpb24gY2hlY2sgKHgsIHkpIHtcbiAgaWYgKCdzdHJpbmcnID09PSB0eXBlb2YgeClcbiAgICByZXR1cm4geSA9PSB4XG4gIGVsc2UgaWYgKHggJiYgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIHguZXhlYylcbiAgICByZXR1cm4geC5leGVjKHkpXG4gIGVsc2UgaWYgKCdib29sZWFuJyA9PT0gdHlwZW9mIHggfHwgJ29iamVjdCcgPT09IHR5cGVvZiB4KVxuICAgIHJldHVybiB4XG4gIGVsc2UgaWYgKCdmdW5jdGlvbicgPT09IHR5cGVvZiB4KVxuICAgIHJldHVybiB4KHkpXG4gIHJldHVybiBmYWxzZVxufVxuXG5leHBvcnRzLnN0cmluZ2lmeSA9IGZ1bmN0aW9uIChvcCwgc2VwLCBjbCwgaW5kZW50KSB7XG4gIGluZGVudCA9IGluZGVudCB8fCAwXG4gIGlmIChvcCA9PT0gZmFsc2Upe1xuICAgIG9wID0gJydcbiAgICBzZXAgPSAnXFxuJ1xuICAgIGNsID0gJydcbiAgfSBlbHNlIGlmIChvcCA9PSBudWxsKSB7XG5cbiAgICBvcCA9ICdbXFxuJ1xuICAgIHNlcCA9ICdcXG4sXFxuJ1xuICAgIGNsID0gJ1xcbl1cXG4nXG5cbiAgfVxuXG4gIC8vZWxzZSwgd2hhdCBldmVyIHlvdSBsaWtlXG5cbiAgdmFyIHN0cmVhbVxuICAgICwgZmlyc3QgPSB0cnVlXG4gICAgLCBhbnlEYXRhID0gZmFsc2VcbiAgc3RyZWFtID0gdGhyb3VnaChmdW5jdGlvbiAoZGF0YSkge1xuICAgIGFueURhdGEgPSB0cnVlXG4gICAgdmFyIGpzb24gPSBKU09OLnN0cmluZ2lmeShkYXRhLCBudWxsLCBpbmRlbnQpXG4gICAgaWYoZmlyc3QpIHsgZmlyc3QgPSBmYWxzZSA7IHN0cmVhbS5xdWV1ZShvcCArIGpzb24pfVxuICAgIGVsc2Ugc3RyZWFtLnF1ZXVlKHNlcCArIGpzb24pXG4gIH0sXG4gIGZ1bmN0aW9uIChkYXRhKSB7XG4gICAgaWYoIWFueURhdGEpXG4gICAgICBzdHJlYW0ucXVldWUob3ApXG4gICAgc3RyZWFtLnF1ZXVlKGNsKVxuICAgIHN0cmVhbS5xdWV1ZShudWxsKVxuICB9KVxuXG4gIHJldHVybiBzdHJlYW1cbn1cblxuZXhwb3J0cy5zdHJpbmdpZnlPYmplY3QgPSBmdW5jdGlvbiAob3AsIHNlcCwgY2wsIGluZGVudCkge1xuICBpbmRlbnQgPSBpbmRlbnQgfHwgMFxuICBpZiAob3AgPT09IGZhbHNlKXtcbiAgICBvcCA9ICcnXG4gICAgc2VwID0gJ1xcbidcbiAgICBjbCA9ICcnXG4gIH0gZWxzZSBpZiAob3AgPT0gbnVsbCkge1xuXG4gICAgb3AgPSAne1xcbidcbiAgICBzZXAgPSAnXFxuLFxcbidcbiAgICBjbCA9ICdcXG59XFxuJ1xuXG4gIH1cblxuICAvL2Vsc2UsIHdoYXQgZXZlciB5b3UgbGlrZVxuXG4gIHZhciBmaXJzdCA9IHRydWVcbiAgdmFyIGFueURhdGEgPSBmYWxzZVxuICB2YXIgc3RyZWFtID0gdGhyb3VnaChmdW5jdGlvbiAoZGF0YSkge1xuICAgIGFueURhdGEgPSB0cnVlXG4gICAgdmFyIGpzb24gPSBKU09OLnN0cmluZ2lmeShkYXRhWzBdKSArICc6JyArIEpTT04uc3RyaW5naWZ5KGRhdGFbMV0sIG51bGwsIGluZGVudClcbiAgICBpZihmaXJzdCkgeyBmaXJzdCA9IGZhbHNlIDsgdGhpcy5xdWV1ZShvcCArIGpzb24pfVxuICAgIGVsc2UgdGhpcy5xdWV1ZShzZXAgKyBqc29uKVxuICB9LFxuICBmdW5jdGlvbiAoZGF0YSkge1xuICAgIGlmKCFhbnlEYXRhKSB0aGlzLnF1ZXVlKG9wKVxuICAgIHRoaXMucXVldWUoY2wpXG5cbiAgICB0aGlzLnF1ZXVlKG51bGwpXG4gIH0pXG5cbiAgcmV0dXJuIHN0cmVhbVxufVxuXG5pZighbW9kdWxlLnBhcmVudCAmJiBwcm9jZXNzLnRpdGxlICE9PSAnYnJvd3NlcicpIHtcbiAgcHJvY2Vzcy5zdGRpblxuICAgIC5waXBlKGV4cG9ydHMucGFyc2UocHJvY2Vzcy5hcmd2WzJdKSlcbiAgICAucGlwZShleHBvcnRzLnN0cmluZ2lmeSgnWycsICcsXFxuJywgJ11cXG4nLCAyKSlcbiAgICAucGlwZShwcm9jZXNzLnN0ZG91dClcbn1cbiJdfQ==
},{"_process":115,"buffer":13,"jsonparse":78,"through":268}],3:[function(require,module,exports){
module.exports = after
function after(count, callback, err_cb) {
var bail = false
err_cb = err_cb || noop
proxy.count = count
return (count === 0) ? callback() : proxy
function proxy(err, result) {
if (proxy.count <= 0) {
throw new Error('after called too many times')
}
--proxy.count
// after first error, rest are passed to err_cb
if (err) {
bail = true
callback(err)
// future error callbacks will go to error handler
callback = err_cb
} else if (proxy.count === 0 && !bail) {
callback(null, result)
}
}
}
function noop() {}
},{}],4:[function(require,module,exports){
/**
* An abstraction for slicing an arraybuffer even when
* ArrayBuffer.prototype.slice is not supported
*
* @api public
*/
module.exports = function(arraybuffer, start, end) {
var bytes = arraybuffer.byteLength;
start = start || 0;
end = end || bytes;
if (arraybuffer.slice) { return arraybuffer.slice(start, end); }
if (start < 0) { start += bytes; }
if (end < 0) { end += bytes; }
if (end > bytes) { end = bytes; }
if (start >= bytes || start >= end || bytes === 0) {
return new ArrayBuffer(0);
}
var abv = new Uint8Array(arraybuffer);
var result = new Uint8Array(end - start);
for (var i = start, ii = 0; i < end; i++, ii++) {
result[ii] = abv[i];
}
return result.buffer;
};
},{}],5:[function(require,module,exports){
(function (global){
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["Babel"] = factory();
else
root["Babel"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ((function(modules) {
// Check all modules for deduplicated modules
for(var i in modules) {
if(Object.prototype.hasOwnProperty.call(modules, i)) {
switch(typeof modules[i]) {
case "function": break;
case "object":
// Module can be created from a template
modules[i] = (function(_m) {
var args = _m.slice(1), fn = modules[_m[0]];
return function (a,b,c) {
fn.apply(this, [a,b,c].concat(args));
};
}(modules[i]));
break;
default:
// Module is a copy of another module
modules[i] = modules[modules[i]];
break;
}
}
}
return modules;
}([
/* 0 */
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.version = exports.availablePresets = exports.availablePlugins = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.transform = transform;
exports.transformFromAst = transformFromAst;
var _babelCore = __webpack_require__(/*! babel-core */ 244);
var Babel = _interopRequireWildcard(_babelCore);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
/**
* Parses plugin names and presets from the specified options.
*/
function processOptions(options) {
// Parse preset names
var presets = (options.presets || []).map(function (presetName) {
if (typeof presetName === 'string') {
var preset = availablePresets[presetName];
if (!preset) {
throw new Error('Invalid preset specified in Babel options: "' + presetName + '"');
}
return preset;
} else {
// Could be an actual preset module
return presetName;
}
});
// Parse plugin names
var plugins = (options.plugins || []).map(function (pluginName) {
if (typeof pluginName === 'string') {
var plugin = availablePlugins[pluginName];
if (!plugin) {
throw new Error('Invalid plugin specified in Babel options: "' + pluginName + '"');
}
return plugin;
} else {
// Could be an actual plugin module
return pluginName;
}
});
return _extends({}, options, {
presets: presets,
plugins: plugins
});
}
function transform(code, options) {
return Babel.transform(code, processOptions(options));
}
function transformFromAst(ast, code, options) {
return Babel.transformFromAst(code, processOptions(options));
}
// All the plugins we should bundle
var availablePlugins = exports.availablePlugins = {
'check-es2015-constants': __webpack_require__(/*! babel-plugin-check-es2015-constants */ 73),
'external-helpers-2': __webpack_require__(/*! babel-plugin-external-helpers-2 */ 300),
'syntax-async-functions': __webpack_require__(/*! babel-plugin-syntax-async-functions */ 74),
'syntax-async-generators': __webpack_require__(/*! babel-plugin-syntax-async-generators */ 301),
'syntax-class-constructor-call': __webpack_require__(/*! babel-plugin-syntax-class-constructor-call */ 161),
'syntax-class-properties': __webpack_require__(/*! babel-plugin-syntax-class-properties */ 162),
'syntax-decorators': __webpack_require__(/*! babel-plugin-syntax-decorators */ 110),
'syntax-do-expressions': __webpack_require__(/*! babel-plugin-syntax-do-expressions */ 163),
'syntax-exponentiation-operator': __webpack_require__(/*! babel-plugin-syntax-exponentiation-operator */ 164),
'syntax-export-extensions': __webpack_require__(/*! babel-plugin-syntax-export-extensions */ 165),
'syntax-flow': __webpack_require__(/*! babel-plugin-syntax-flow */ 111),
'syntax-function-bind': __webpack_require__(/*! babel-plugin-syntax-function-bind */ 166),
'syntax-jsx': __webpack_require__(/*! babel-plugin-syntax-jsx */ 112),
'syntax-object-rest-spread': __webpack_require__(/*! babel-plugin-syntax-object-rest-spread */ 167),
'syntax-trailing-function-commas': __webpack_require__(/*! babel-plugin-syntax-trailing-function-commas */ 168),
'transform-async-functions': __webpack_require__(/*! babel-plugin-transform-async-functions */ 302),
'transform-async-to-generator': __webpack_require__(/*! babel-plugin-transform-async-to-generator */ 169),
'transform-async-to-module-method': __webpack_require__(/*! babel-plugin-transform-async-to-module-method */ 303),
'transform-class-constructor-call': __webpack_require__(/*! babel-plugin-transform-class-constructor-call */ 170),
'transform-class-properties': __webpack_require__(/*! babel-plugin-transform-class-properties */ 171),
'transform-decorators': __webpack_require__(/*! babel-plugin-transform-decorators */ 172),
'transform-decorators-legacy': __webpack_require__(/*! babel-plugin-transform-decorators-legacy */ 304).default, // <- No clue. Nope.
'transform-do-expressions': __webpack_require__(/*! babel-plugin-transform-do-expressions */ 173),
'transform-es2015-arrow-functions': __webpack_require__(/*! babel-plugin-transform-es2015-arrow-functions */ 75),
'transform-es2015-block-scoped-functions': __webpack_require__(/*! babel-plugin-transform-es2015-block-scoped-functions */ 76),
'transform-es2015-block-scoping': __webpack_require__(/*! babel-plugin-transform-es2015-block-scoping */ 77),
'transform-es2015-classes': __webpack_require__(/*! babel-plugin-transform-es2015-classes */ 78),
'transform-es2015-computed-properties': __webpack_require__(/*! babel-plugin-transform-es2015-computed-properties */ 79),
'transform-es2015-destructuring': __webpack_require__(/*! babel-plugin-transform-es2015-destructuring */ 80),
'transform-es2015-for-of': __webpack_require__(/*! babel-plugin-transform-es2015-for-of */ 81),
'transform-es2015-function-name': __webpack_require__(/*! babel-plugin-transform-es2015-function-name */ 82),
'transform-es2015-instanceof': __webpack_require__(/*! babel-plugin-transform-es2015-instanceof */ 319),
'transform-es2015-literals': __webpack_require__(/*! babel-plugin-transform-es2015-literals */ 83),
'transform-es2015-modules-amd': __webpack_require__(/*! babel-plugin-transform-es2015-modules-amd */ 176),
'transform-es2015-modules-commonjs': __webpack_require__(/*! babel-plugin-transform-es2015-modules-commonjs */ 114),
'transform-es2015-modules-systemjs': __webpack_require__(/*! babel-plugin-transform-es2015-modules-systemjs */ 331),
'transform-es2015-modules-umd': __webpack_require__(/*! babel-plugin-transform-es2015-modules-umd */ 332),
'transform-es2015-object-super': __webpack_require__(/*! babel-plugin-transform-es2015-object-super */ 84),
'transform-es2015-parameters': __webpack_require__(/*! babel-plugin-transform-es2015-parameters */ 85),
'transform-es2015-shorthand-properties': __webpack_require__(/*! babel-plugin-transform-es2015-shorthand-properties */ 86),
'transform-es2015-spread': __webpack_require__(/*! babel-plugin-transform-es2015-spread */ 87),
'transform-es2015-sticky-regex': __webpack_require__(/*! babel-plugin-transform-es2015-sticky-regex */ 88),
'transform-es2015-template-literals': __webpack_require__(/*! babel-plugin-transform-es2015-template-literals */ 89),
'transform-es2015-typeof-symbol': __webpack_require__(/*! babel-plugin-transform-es2015-typeof-symbol */ 90),
'transform-es2015-unicode-regex': __webpack_require__(/*! babel-plugin-transform-es2015-unicode-regex */ 91),
'transform-es3-member-expression-literals': __webpack_require__(/*! babel-plugin-transform-es3-member-expression-literals */ 336),
'transform-es3-property-literals': __webpack_require__(/*! babel-plugin-transform-es3-property-literals */ 337),
'transform-es5-property-mutators': __webpack_require__(/*! babel-plugin-transform-es5-property-mutators */ 338),
'transform-eval': __webpack_require__(/*! babel-plugin-transform-eval */ 339),
'transform-exponentiation-operator': __webpack_require__(/*! babel-plugin-transform-exponentiation-operator */ 178),
'transform-export-extensions': __webpack_require__(/*! babel-plugin-transform-export-extensions */ 179),
'transform-flow-strip-types': __webpack_require__(/*! babel-plugin-transform-flow-strip-types */ 180),
'transform-function-bind': __webpack_require__(/*! babel-plugin-transform-function-bind */ 181),
'transform-inline-environment-variables': __webpack_require__(/*! babel-plugin-transform-inline-environment-variables */ 340),
'transform-jscript': __webpack_require__(/*! babel-plugin-transform-jscript */ 341),
'transform-member-expression-literals': __webpack_require__(/*! babel-plugin-transform-member-expression-literals */ 342),
'transform-merge-sibling-variables': __webpack_require__(/*! babel-plugin-transform-merge-sibling-variables */ 343),
'transform-minify-booleans': __webpack_require__(/*! babel-plugin-transform-minify-booleans */ 344),
'transform-node-env-inline': __webpack_require__(/*! babel-plugin-transform-node-env-inline */ 345),
'transform-object-assign': __webpack_require__(/*! babel-plugin-transform-object-assign */ 346),
'transform-object-rest-spread': __webpack_require__(/*! babel-plugin-transform-object-rest-spread */ 182),
'transform-object-set-prototype-of-to-assign': __webpack_require__(/*! babel-plugin-transform-object-set-prototype-of-to-assign */ 347),
'transform-property-literals': __webpack_require__(/*! babel-plugin-transform-property-literals */ 348),
'transform-proto-to-assign': __webpack_require__(/*! babel-plugin-transform-proto-to-assign */ 349),
'transform-react-constant-elements': __webpack_require__(/*! babel-plugin-transform-react-constant-elements */ 350),
'transform-react-display-name': __webpack_require__(/*! babel-plugin-transform-react-display-name */ 183),
'transform-react-inline-elements': __webpack_require__(/*! babel-plugin-transform-react-inline-elements */ 351),
'transform-react-jsx': __webpack_require__(/*! babel-plugin-transform-react-jsx */ 184),
'transform-react-jsx-compat': __webpack_require__(/*! babel-plugin-transform-react-jsx-compat */ 352),
'transform-react-jsx-source': __webpack_require__(/*! babel-plugin-transform-react-jsx-source */ 353),
'transform-regenerator': __webpack_require__(/*! babel-plugin-transform-regenerator */ 92),
'transform-remove-console': __webpack_require__(/*! babel-plugin-transform-remove-console */ 358),
'transform-remove-debugger': __webpack_require__(/*! babel-plugin-transform-remove-debugger */ 359),
'transform-runtime': __webpack_require__(/*! babel-plugin-transform-runtime */ 361),
'transform-simplify-comparison-operators': __webpack_require__(/*! babel-plugin-transform-simplify-comparison-operators */ 362),
'transform-strict-mode': __webpack_require__(/*! babel-plugin-transform-strict-mode */ 116),
'transform-undefined-to-void': __webpack_require__(/*! babel-plugin-transform-undefined-to-void */ 363),
'undeclared-variables-check': __webpack_require__(/*! babel-plugin-undeclared-variables-check */ 364)
};
// All the presets we should bundle
var availablePresets = exports.availablePresets = {
es2015: __webpack_require__(/*! babel-preset-es2015 */ 365),
react: __webpack_require__(/*! babel-preset-react */ 366),
'stage-0': __webpack_require__(/*! babel-preset-stage-0 */ 367),
'stage-1': __webpack_require__(/*! babel-preset-stage-1 */ 187),
'stage-2': __webpack_require__(/*! babel-preset-stage-2 */ 188),
'stage-3': __webpack_require__(/*! babel-preset-stage-3 */ 189),
// ES2015 preset with es2015-modules-commonjs removed
// Plugin list copied from babel-preset-es2015/index.js
'es2015-no-commonjs': {
plugins: [__webpack_require__(/*! babel-plugin-transform-es2015-template-literals */ 89), __webpack_require__(/*! babel-plugin-transform-es2015-literals */ 83), __webpack_require__(/*! babel-plugin-transform-es2015-function-name */ 82), __webpack_require__(/*! babel-plugin-transform-es2015-arrow-functions */ 75), __webpack_require__(/*! babel-plugin-transform-es2015-block-scoped-functions */ 76), __webpack_require__(/*! babel-plugin-transform-es2015-classes */ 78), __webpack_require__(/*! babel-plugin-transform-es2015-object-super */ 84), __webpack_require__(/*! babel-plugin-transform-es2015-shorthand-properties */ 86), __webpack_require__(/*! babel-plugin-transform-es2015-computed-properties */ 79), __webpack_require__(/*! babel-plugin-transform-es2015-for-of */ 81), __webpack_require__(/*! babel-plugin-transform-es2015-sticky-regex */ 88), __webpack_require__(/*! babel-plugin-transform-es2015-unicode-regex */ 91), __webpack_require__(/*! babel-plugin-check-es2015-constants */ 73), __webpack_require__(/*! babel-plugin-transform-es2015-spread */ 87), __webpack_require__(/*! babel-plugin-transform-es2015-parameters */ 85), __webpack_require__(/*! babel-plugin-transform-es2015-destructuring */ 80), __webpack_require__(/*! babel-plugin-transform-es2015-block-scoping */ 77), __webpack_require__(/*! babel-plugin-transform-es2015-typeof-symbol */ 90), [__webpack_require__(/*! babel-plugin-transform-regenerator */ 92), { async: false, asyncGenerators: false }]]
},
// ES2015 preset with plugins set to loose mode and es2015-modules-commonjs
// removed.
// Based off https://github.com/bkonkle/babel-preset-es2015-loose/blob/master/index.js
'es2015-loose': {
plugins: [[__webpack_require__(/*! babel-plugin-transform-es2015-template-literals */ 89), { loose: true }], __webpack_require__(/*! babel-plugin-transform-es2015-literals */ 83), __webpack_require__(/*! babel-plugin-transform-es2015-function-name */ 82), __webpack_require__(/*! babel-plugin-transform-es2015-arrow-functions */ 75), __webpack_require__(/*! babel-plugin-transform-es2015-block-scoped-functions */ 76), [__webpack_require__(/*! babel-plugin-transform-es2015-classes */ 78), { loose: true }], __webpack_require__(/*! babel-plugin-transform-es2015-object-super */ 84), __webpack_require__(/*! babel-plugin-transform-es2015-shorthand-properties */ 86), [__webpack_require__(/*! babel-plugin-transform-es2015-computed-properties */ 79), { loose: true }], [__webpack_require__(/*! babel-plugin-transform-es2015-for-of */ 81), { loose: true }], __webpack_require__(/*! babel-plugin-transform-es2015-sticky-regex */ 88), __webpack_require__(/*! babel-plugin-transform-es2015-unicode-regex */ 91), __webpack_require__(/*! babel-plugin-check-es2015-constants */ 73), [__webpack_require__(/*! babel-plugin-transform-es2015-spread */ 87), { loose: true }], __webpack_require__(/*! babel-plugin-transform-es2015-parameters */ 85), [__webpack_require__(/*! babel-plugin-transform-es2015-destructuring */ 80), { loose: true }], __webpack_require__(/*! babel-plugin-transform-es2015-block-scoping */ 77), __webpack_require__(/*! babel-plugin-transform-es2015-typeof-symbol */ 90), [__webpack_require__(/*! babel-plugin-transform-regenerator */ 92), { async: false, asyncGenerators: false }]]
}
};
var version = exports.version = Babel.version;
/***/ },
/* 1 */
/*!************************************************************!*\
!*** ./~/babel-runtime/helpers/interop-require-default.js ***!
\************************************************************/
/***/ function(module, exports) {
"use strict";
exports["default"] = function (obj) {
return obj && obj.__esModule ? obj : {
"default": obj
};
};
exports.__esModule = true;
/***/ },
/* 2 */
/*!*************************************************************!*\
!*** ./~/babel-runtime/helpers/interop-require-wildcard.js ***!
\*************************************************************/
/***/ function(module, exports) {
"use strict";
exports["default"] = function (obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
}
}
newObj["default"] = obj;
return newObj;
}
};
exports.__esModule = true;
/***/ },
/* 3 */
/*!************************************!*\
!*** ./~/babel-types/lib/index.js ***!
\************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _Object$keys = __webpack_require__(/*! babel-runtime/core-js/object/keys */ 14)["default"];
var _getIterator = __webpack_require__(/*! babel-runtime/core-js/get-iterator */ 4)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
var _defaults = __webpack_require__(/*! babel-runtime/helpers/defaults */ 54)["default"];
var _interopExportWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-export-wildcard */ 55)["default"];
exports.__esModule = true;
exports.is = is;
exports.isType = isType;
exports.validate = validate;
exports.shallowEqual = shallowEqual;
exports.appendToMemberExpression = appendToMemberExpression;
exports.prependToMemberExpression = prependToMemberExpression;
exports.ensureBlock = ensureBlock;
exports.clone = clone;
exports.cloneWithoutLoc = cloneWithoutLoc;
exports.cloneDeep = cloneDeep;
exports.buildMatchMemberExpression = buildMatchMemberExpression;
exports.removeComments = removeComments;
exports.inheritsComments = inheritsComments;
exports.inheritTrailingComments = inheritTrailingComments;
exports.inheritLeadingComments = inheritLeadingComments;
exports.inheritInnerComments = inheritInnerComments;
exports.inherits = inherits;
exports.assertNode = assertNode;
exports.isNode = isNode;
var _toFastProperties = __webpack_require__(/*! to-fast-properties */ 69);
var _toFastProperties2 = _interopRequireDefault(_toFastProperties);
var _lodashArrayCompact = __webpack_require__(/*! lodash/array/compact */ 62);
var _lodashArrayCompact2 = _interopRequireDefault(_lodashArrayCompact);
var _lodashLangClone = __webpack_require__(/*! lodash/lang/clone */ 34);
var _lodashLangClone2 = _interopRequireDefault(_lodashLangClone);
var _lodashCollectionEach = __webpack_require__(/*! lodash/collection/each */ 31);
var _lodashCollectionEach2 = _interopRequireDefault(_lodashCollectionEach);
var _lodashArrayUniq = __webpack_require__(/*! lodash/array/uniq */ 63);
var _lodashArrayUniq2 = _interopRequireDefault(_lodashArrayUniq);
__webpack_require__(/*! ./definitions/init */ 398);
var _definitions = __webpack_require__(/*! ./definitions */ 28);
var _react2 = __webpack_require__(/*! ./react */ 402);
var _react = _interopRequireWildcard(_react2);
var t = exports;
/**
* Registers `is[Type]` and `assert[Type]` generated functions for a given `type`.
* Pass `skipAliasCheck` to force it to directly compare `node.type` with `type`.
*/
function registerType(type) {
var is = t["is" + type] = function (node, opts) {
return t.is(type, node, opts);
};
t["assert" + type] = function (node, opts) {
opts = opts || {};
if (!is(node, opts)) {
throw new Error("Expected type " + JSON.stringify(type) + " with option " + JSON.stringify(opts));
}
};
}
//
var _constants = __webpack_require__(/*! ./constants */ 120);
_defaults(exports, _interopExportWildcard(_constants, _defaults));
exports.VISITOR_KEYS = _definitions.VISITOR_KEYS;
exports.ALIAS_KEYS = _definitions.ALIAS_KEYS;
exports.NODE_FIELDS = _definitions.NODE_FIELDS;
exports.BUILDER_KEYS = _definitions.BUILDER_KEYS;
exports.DEPRECATED_KEYS = _definitions.DEPRECATED_KEYS;
exports.react = _react;
/**
* Registers `is[Type]` and `assert[Type]` for all types.
*/
for (var type in t.VISITOR_KEYS) {
registerType(type);
}
/**
* Flip `ALIAS_KEYS` for faster access in the reverse direction.
*/
t.FLIPPED_ALIAS_KEYS = {};
_lodashCollectionEach2["default"](t.ALIAS_KEYS, function (aliases, type) {
_lodashCollectionEach2["default"](aliases, function (alias) {
var types = t.FLIPPED_ALIAS_KEYS[alias] = t.FLIPPED_ALIAS_KEYS[alias] || [];
types.push(type);
});
});
/**
* Registers `is[Alias]` and `assert[Alias]` functions for all aliases.
*/
_lodashCollectionEach2["default"](t.FLIPPED_ALIAS_KEYS, function (types, type) {
t[type.toUpperCase() + "_TYPES"] = types;
registerType(type);
});
var TYPES = _Object$keys(t.VISITOR_KEYS).concat(_Object$keys(t.FLIPPED_ALIAS_KEYS)).concat(_Object$keys(t.DEPRECATED_KEYS));
exports.TYPES = TYPES;
/**
* Returns whether `node` is of given `type`.
*
* For better performance, use this instead of `is[Type]` when `type` is unknown.
* Optionally, pass `skipAliasCheck` to directly compare `node.type` with `type`.
*/
function is(type, node, opts) {
if (!node) return false;
var matches = isType(node.type, type);
if (!matches) return false;
if (typeof opts === "undefined") {
return true;
} else {
return t.shallowEqual(node, opts);
}
}
/**
* Test if a `nodeType` is a `targetType` or if `targetType` is an alias of `nodeType`.
*/
function isType(nodeType, targetType) {
if (nodeType === targetType) return true;
var aliases = t.FLIPPED_ALIAS_KEYS[targetType];
if (aliases) {
if (aliases[0] === nodeType) return true;
for (var _iterator = aliases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var alias = _ref;
if (nodeType === alias) return true;
}
}
return false;
}
/**
* Description
*/
_lodashCollectionEach2["default"](t.BUILDER_KEYS, function (keys, type) {
function builder() {
if (arguments.length > keys.length) {
throw new Error("t." + type + ": Too many arguments passed. Received " + arguments.length + " but can receive " + ("no more than " + keys.length));
}
var node = {};
node.type = type;
var i = 0;
var _arr = keys;
for (var _i2 = 0; _i2 < _arr.length; _i2++) {
var key = _arr[_i2];
var field = t.NODE_FIELDS[type][key];
var arg = arguments[i++];
if (arg === undefined) arg = _lodashLangClone2["default"](field["default"]);
node[key] = arg;
}
for (var key in node) {
validate(node, key, node[key]);
}
return node;
}
t[type] = builder;
t[type[0].toLowerCase() + type.slice(1)] = builder;
});
/**
* Description
*/
var _loop = function (type) {
var proxy = function proxy(fn) {
return function () {
console.trace("The node type " + type + " has been renamed to " + newType);
return fn.apply(this, arguments);
};
};
var newType = t.DEPRECATED_KEYS[type];
t[type] = t[type[0].toLowerCase() + type.slice(1)] = proxy(t[newType]);
t["is" + type] = proxy(t["is" + newType]);
t["assert" + type] = proxy(t["assert" + newType]);
};
for (var type in t.DEPRECATED_KEYS) {
_loop(type);
}
/**
* Description
*/
function validate(node, key, val) {
if (!node) return;
var fields = t.NODE_FIELDS[node.type];
if (!fields) return;
var field = fields[key];
if (!field || !field.validate) return;
if (field.optional && val == null) return;
field.validate(node, key, val);
}
/**
* Test if an object is shallowly equal.
*/
function shallowEqual(actual, expected) {
var keys = _Object$keys(expected);
var _arr2 = keys;
for (var _i3 = 0; _i3 < _arr2.length; _i3++) {
var key = _arr2[_i3];
if (actual[key] !== expected[key]) {
return false;
}
}
return true;
}
/**
* Append a node to a member expression.
*/
function appendToMemberExpression(member, append, computed) {
member.object = t.memberExpression(member.object, member.property, member.computed);
member.property = append;
member.computed = !!computed;
return member;
}
/**
* Prepend a node to a member expression.
*/
function prependToMemberExpression(member, prepend) {
member.object = t.memberExpression(prepend, member.object);
return member;
}
/**
* Ensure the `key` (defaults to "body") of a `node` is a block.
* Casting it to a block if it is not.
*/
function ensureBlock(node) {
var key = arguments.length <= 1 || arguments[1] === undefined ? "body" : arguments[1];
return node[key] = t.toBlock(node[key], node);
}
/**
* Create a shallow clone of a `node` excluding `_private` properties.
*/
function clone(node) {
var newNode = {};
for (var key in node) {
if (key[0] === "_") continue;
newNode[key] = node[key];
}
return newNode;
}
/**
* Create a shallow clone of a `node` excluding `_private` and location properties.
*/
function cloneWithoutLoc(node) {
var newNode = clone(node);
delete newNode.loc;
return newNode;
}
/**
* Create a deep clone of a `node` and all of it's child nodes
* exluding `_private` properties.
*/
function cloneDeep(node) {
var newNode = {};
for (var key in node) {
if (key[0] === "_") continue;
var val = node[key];
if (val) {
if (val.type) {
val = t.cloneDeep(val);
} else if (Array.isArray(val)) {
val = val.map(t.cloneDeep);
}
}
newNode[key] = val;
}
return newNode;
}
/**
* Build a function that when called will return whether or not the
* input `node` `MemberExpression` matches the input `match`.
*
* For example, given the match `React.createClass` it would match the
* parsed nodes of `React.createClass` and `React["createClass"]`.
*/
function buildMatchMemberExpression(match, allowPartial) {
var parts = match.split(".");
return function (member) {
// not a member expression
if (!t.isMemberExpression(member)) return false;
var search = [member];
var i = 0;
while (search.length) {
var node = search.shift();
if (allowPartial && i === parts.length) {
return true;
}
if (t.isIdentifier(node)) {
// this part doesn't match
if (parts[i] !== node.name) return false;
} else if (t.isStringLiteral(node)) {
// this part doesn't match
if (parts[i] !== node.value) return false;
} else if (t.isMemberExpression(node)) {
if (node.computed && !t.isStringLiteral(node.property)) {
// we can't deal with this
return false;
} else {
search.push(node.object);
search.push(node.property);
continue;
}
} else {
// we can't deal with this
return false;
}
// too many parts
if (++i > parts.length) {
return false;
}
}
return true;
};
}
/**
* Remove comment properties from a node.
*/
function removeComments(node) {
for (var _iterator2 = t.COMMENT_KEYS, _isArray2 = Array.isArray(_iterator2), _i4 = 0, _iterator2 = _isArray2 ? _iterator2 : _getIterator(_iterator2);;) {
var _ref2;
if (_isArray2) {
if (_i4 >= _iterator2.length) break;
_ref2 = _iterator2[_i4++];
} else {
_i4 = _iterator2.next();
if (_i4.done) break;
_ref2 = _i4.value;
}
var key = _ref2;
delete node[key];
}
return node;
}
/**
* Inherit all unique comments from `parent` node to `child` node.
*/
function inheritsComments(child, parent) {
inheritTrailingComments(child, parent);
inheritLeadingComments(child, parent);
inheritInnerComments(child, parent);
return child;
}
function inheritTrailingComments(child, parent) {
_inheritComments("trailingComments", child, parent);
}
function inheritLeadingComments(child, parent) {
_inheritComments("leadingComments", child, parent);
}
function inheritInnerComments(child, parent) {
_inheritComments("innerComments", child, parent);
}
function _inheritComments(key, child, parent) {
if (child && parent) {
child[key] = _lodashArrayUniq2["default"](_lodashArrayCompact2["default"]([].concat(child[key], parent[key])));
}
}
// Can't use import because of cyclic dependency between babel-traverse
// and this module (babel-types). This require needs to appear after
// we export the TYPES constant.
var traverse = __webpack_require__(/*! babel-traverse */ 6)["default"];
/**
* Inherit all contextual properties from `parent` node to `child` node.
*/
function inherits(child, parent) {
if (!child || !parent) return child;
// optionally inherit specific properties if not null
var _arr3 = t.INHERIT_KEYS.optional;
for (var _i5 = 0; _i5 < _arr3.length; _i5++) {
var key = _arr3[_i5];
if (child[key] == null) {
child[key] = parent[key];
}
}
// force inherit "private" properties
for (var key in parent) {
if (key[0] === "_") child[key] = parent[key];
}
// force inherit select properties
var _arr4 = t.INHERIT_KEYS.force;
for (var _i6 = 0; _i6 < _arr4.length; _i6++) {
var key = _arr4[_i6];
child[key] = parent[key];
}
t.inheritsComments(child, parent);
traverse.copyCache(parent, child);
return child;
}
/**
* TODO
*/
function assertNode(node) {
if (!isNode(node)) {
// $FlowFixMe
throw new TypeError("Not a valid node " + (node && node.type));
}
}
/**
* TODO
*/
function isNode(node) {
return !!(node && _definitions.VISITOR_KEYS[node.type]);
}
// Optimize property access.
_toFastProperties2["default"](t);
_toFastProperties2["default"](t.VISITOR_KEYS);
//
var _retrievers = __webpack_require__(/*! ./retrievers */ 194);
_defaults(exports, _interopExportWildcard(_retrievers, _defaults));
var _validators = __webpack_require__(/*! ./validators */ 403);
_defaults(exports, _interopExportWildcard(_validators, _defaults));
var _converters = __webpack_require__(/*! ./converters */ 393);
_defaults(exports, _interopExportWildcard(_converters, _defaults));
var _flow = __webpack_require__(/*! ./flow */ 401);
_defaults(exports, _interopExportWildcard(_flow, _defaults));
/***/ },
/* 4 */
/*!*************************************************!*\
!*** ./~/babel-runtime/core-js/get-iterator.js ***!
\*************************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(/*! core-js/library/fn/get-iterator */ 410), __esModule: true };
/***/ },
/* 5 */
/*!*****************************************************!*\
!*** ./~/babel-runtime/helpers/class-call-check.js ***!
\*****************************************************/
/***/ function(module, exports) {
"use strict";
exports["default"] = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
exports.__esModule = true;
/***/ },
/* 6 */
/*!***************************************!*\
!*** ./~/babel-traverse/lib/index.js ***!
\***************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _getIterator = __webpack_require__(/*! babel-runtime/core-js/get-iterator */ 4)["default"];
var _Symbol = __webpack_require__(/*! babel-runtime/core-js/symbol */ 16)["default"];
var _Object$getOwnPropertySymbols = __webpack_require__(/*! babel-runtime/core-js/object/get-own-property-symbols */ 371)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
var _interopRequire = __webpack_require__(/*! babel-runtime/helpers/interop-require */ 118)["default"];
exports.__esModule = true;
exports["default"] = traverse;
var _context = __webpack_require__(/*! ./context */ 375);
var _context2 = _interopRequireDefault(_context);
var _visitors = __webpack_require__(/*! ./visitors */ 392);
var visitors = _interopRequireWildcard(_visitors);
var _babelMessages = __webpack_require__(/*! babel-messages */ 19);
var messages = _interopRequireWildcard(_babelMessages);
var _lodashCollectionIncludes = __webpack_require__(/*! lodash/collection/includes */ 99);
var _lodashCollectionIncludes2 = _interopRequireDefault(_lodashCollectionIncludes);
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
var _cache = __webpack_require__(/*! ./cache */ 93);
var cache = _interopRequireWildcard(_cache);
var _path = __webpack_require__(/*! ./path */ 36);
exports.NodePath = _interopRequire(_path);
var _scope = __webpack_require__(/*! ./scope */ 119);
exports.Scope = _interopRequire(_scope);
var _hub = __webpack_require__(/*! ./hub */ 191);
exports.Hub = _interopRequire(_hub);
exports.visitors = visitors;
function traverse(parent, opts, scope, state, parentPath) {
if (!parent) return;
if (!opts) opts = {};
if (!opts.noScope && !scope) {
if (parent.type !== "Program" && parent.type !== "File") {
throw new Error(messages.get("traverseNeedsParent", parent.type));
}
}
visitors.explode(opts);
traverse.node(parent, opts, scope, state, parentPath);
}
traverse.visitors = visitors;
traverse.verify = visitors.verify;
traverse.explode = visitors.explode;
traverse.NodePath = __webpack_require__(/*! ./path */ 36);
traverse.Scope = __webpack_require__(/*! ./scope */ 119);
traverse.Hub = __webpack_require__(/*! ./hub */ 191);
traverse.cheap = function (node, enter) {
if (!node) return;
var keys = t.VISITOR_KEYS[node.type];
if (!keys) return;
enter(node);
for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var key = _ref;
var subNode = node[key];
if (Array.isArray(subNode)) {
for (var _iterator2 = subNode, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _getIterator(_iterator2);;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var _node = _ref2;
traverse.cheap(_node, enter);
}
} else {
traverse.cheap(subNode, enter);
}
}
};
traverse.node = function (node, opts, scope, state, parentPath, skipKeys) {
var keys = t.VISITOR_KEYS[node.type];
if (!keys) return;
var context = new _context2["default"](scope, opts, state, parentPath);
for (var _i3 = 0; _i3 < keys.length; _i3++) {
var key = keys[_i3];
if (skipKeys && skipKeys[key]) continue;
if (context.visit(node, key)) return;
}
};
var CLEAR_KEYS = t.COMMENT_KEYS.concat(["tokens", "comments", "start", "end", "loc", "raw", "rawValue"]);
traverse.clearNode = function (node) {
for (var _i4 = 0; _i4 < CLEAR_KEYS.length; _i4++) {
var key = CLEAR_KEYS[_i4];
if (node[key] != null) node[key] = undefined;
}
for (var key in node) {
if (key[0] === "_" && node[key] != null) node[key] = undefined;
}
cache.path["delete"](node);
var syms = _Object$getOwnPropertySymbols(node);
for (var _i5 = 0; _i5 < syms.length; _i5++) {
var sym = syms[_i5];
node[sym] = null;
}
};
traverse.removeProperties = function (tree) {
traverse.cheap(tree, traverse.clearNode);
return tree;
};
function hasBlacklistedType(path, state) {
if (path.node.type === state.type) {
state.has = true;
path.stop();
}
}
traverse.hasType = function (tree, scope, type, blacklistTypes) {
// the node we're searching in is blacklisted
if (_lodashCollectionIncludes2["default"](blacklistTypes, tree.type)) return false;
// the type we're looking for is the same as the passed node
if (tree.type === type) return true;
var state = {
has: false,
type: type
};
traverse(tree, {
blacklist: blacklistTypes,
enter: hasBlacklistedType
}, scope, state);
return state.has;
};
traverse.clearCache = function () {
cache.clear();
};
traverse.copyCache = function (source, destination) {
if (cache.path.has(source)) {
cache.path.set(destination, cache.path.get(source));
}
};
/***/ },
/* 7 */
/*!****************************************!*\
!*** ./~/core-js/library/modules/$.js ***!
\****************************************/
/***/ function(module, exports) {
var $Object = Object;
module.exports = {
create: $Object.create,
getProto: $Object.getPrototypeOf,
isEnum: {}.propertyIsEnumerable,
getDesc: $Object.getOwnPropertyDescriptor,
setDesc: $Object.defineProperty,
setDescs: $Object.defineProperties,
getKeys: $Object.keys,
getNames: $Object.getOwnPropertyNames,
getSymbols: $Object.getOwnPropertySymbols,
each: [].forEach
};
/***/ },
/* 8 */
/*!******************************************************!*\
!*** ./~/babel-generator/~/babel-types/lib/index.js ***!
\******************************************************/
[548, 288, 24, 292, 109, 151, 293, 283, 291],
/* 9 */
/*!***************************************!*\
!*** ./~/babel-template/lib/index.js ***!
\***************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _Symbol = __webpack_require__(/*! babel-runtime/core-js/symbol */ 16)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _lodashLangCloneDeep = __webpack_require__(/*! lodash/lang/cloneDeep */ 228);
var _lodashLangCloneDeep2 = _interopRequireDefault(_lodashLangCloneDeep);
var _lodashObjectAssign = __webpack_require__(/*! lodash/object/assign */ 67);
var _lodashObjectAssign2 = _interopRequireDefault(_lodashObjectAssign);
var _lodashObjectHas = __webpack_require__(/*! lodash/object/has */ 232);
var _lodashObjectHas2 = _interopRequireDefault(_lodashObjectHas);
var _babelTraverse = __webpack_require__(/*! babel-traverse */ 6);
var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
var _babylon = __webpack_require__(/*! babylon */ 121);
var babylon = _interopRequireWildcard(_babylon);
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
var FROM_TEMPLATE = "_fromTemplate"; //Symbol(); // todo: probably wont get copied over
var TEMPLATE_SKIP = _Symbol();
exports["default"] = function (code, opts) {
// since we lazy parse the template, we get the current stack so we have the
// original stack to append if it errors when parsing
var stack = undefined;
try {
// error stack gets populated in IE only on throw (https://msdn.microsoft.com/en-us/library/hh699850(v=vs.94).aspx)
throw new Error();
} catch (error) {
if (error.stack) {
// error.stack does not exists in IE <= 9
stack = error.stack.split("\n").slice(1).join("\n");
}
}
var _getAst = function getAst() {
var ast = undefined;
try {
ast = babylon.parse(code, _lodashObjectAssign2["default"]({
allowReturnOutsideFunction: true,
allowSuperOutsideMethod: true
}, opts));
ast = _babelTraverse2["default"].removeProperties(ast);
_babelTraverse2["default"].cheap(ast, function (node) {
node[FROM_TEMPLATE] = true;
});
} catch (err) {
err.stack = err.stack + "from\n" + stack;
throw err;
}
_getAst = function () {
return ast;
};
return ast;
};
return function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return useTemplate(_getAst(), args);
};
};
function useTemplate(ast, nodes) {
ast = _lodashLangCloneDeep2["default"](ast);
var _ast = ast;
var program = _ast.program;
if (nodes.length) {
_babelTraverse2["default"](ast, templateVisitor, null, nodes);
}
if (program.body.length > 1) {
return program.body;
} else {
return program.body[0];
}
}
var templateVisitor = {
// 360
noScope: true,
enter: function enter(path, args) {
var node = path.node;
if (node[TEMPLATE_SKIP]) return path.skip();
if (t.isExpressionStatement(node)) {
node = node.expression;
}
var replacement = undefined;
if (t.isIdentifier(node) && node[FROM_TEMPLATE]) {
if (_lodashObjectHas2["default"](args[0], node.name)) {
replacement = args[0][node.name];
} else if (node.name[0] === "$") {
var i = +node.name.slice(1);
if (args[i]) replacement = args[i];
}
}
if (replacement === null) {
path.remove();
}
if (replacement) {
replacement[TEMPLATE_SKIP] = true;
path.replaceInline(replacement);
}
},
exit: function exit(_ref) {
var node = _ref.node;
if (!node.loc) _babelTraverse2["default"].clearNode(node);
}
};
module.exports = exports["default"];
/***/ },
/* 10 */
/*!**************************************************!*\
!*** ./~/babel-runtime/core-js/object/create.js ***!
\**************************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(/*! core-js/library/fn/object/create */ 414), __esModule: true };
/***/ },
/* 11 */
/*!*************************************************!*\
!*** ./~/babel-core/~/babel-types/lib/index.js ***!
\*************************************************/
[548, 261, 23, 265, 108, 147, 266, 256, 264],
/* 12 */
/*!*********************************************!*\
!*** ./~/core-js/library/modules/$.core.js ***!
\*********************************************/
/***/ function(module, exports) {
var core = module.exports = {version: '1.2.6'};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
/***/ },
/* 13 */
/*!**********************************!*\
!*** ./~/lodash/lang/isArray.js ***!
\**********************************/
/***/ function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(/*! ../internal/getNative */ 100),
isLength = __webpack_require__(/*! ../internal/isLength */ 32),
isObjectLike = __webpack_require__(/*! ../internal/isObjectLike */ 17);
/** `Object#toString` result references. */
var arrayTag = '[object Array]';
/** Used for native method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/* Native method references for those with the same name as other `lodash` methods. */
var nativeIsArray = getNative(Array, 'isArray');
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(function() { return arguments; }());
* // => false
*/
var isArray = nativeIsArray || function(value) {
return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
};
module.exports = isArray;
/***/ },
/* 14 */
/*!************************************************!*\
!*** ./~/babel-runtime/core-js/object/keys.js ***!
\************************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(/*! core-js/library/fn/object/keys */ 419), __esModule: true };
/***/ },
/* 15 */
/*!***********************************!*\
!*** ./~/lodash/lang/isObject.js ***!
\***********************************/
/***/ function(module, exports) {
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
module.exports = isObject;
/***/ },
/* 16 */
/*!*******************************************!*\
!*** ./~/babel-runtime/core-js/symbol.js ***!
\*******************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(/*! core-js/library/fn/symbol */ 422), __esModule: true };
/***/ },
/* 17 */
/*!*******************************************!*\
!*** ./~/lodash/internal/isObjectLike.js ***!
\*******************************************/
/***/ function(module, exports) {
/**
* Checks if `value` is object-like.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
module.exports = isObjectLike;
/***/ },
/* 18 */
/*!******************************!*\
!*** ./~/process/browser.js ***!
\******************************/
/***/ function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = setTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
clearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
setTimeout(drainQueue, 0);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ },
/* 19 */
/*!***************************************!*\
!*** ./~/babel-messages/lib/index.js ***!
\***************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
exports.get = get;
exports.parseArgs = parseArgs;
var _util = __webpack_require__(/*! util */ 70);
var util = _interopRequireWildcard(_util);
/**
* Mapping of messages to be used in Babel.
* Messages can include $0-style placeholders.
*/
var MESSAGES = {
tailCallReassignmentDeopt: "Function reference has been reassigned, so it will probably be dereferenced, therefore we can't optimise this with confidence",
classesIllegalBareSuper: "Illegal use of bare super",
classesIllegalSuperCall: "Direct super call is illegal in non-constructor, use super.$1() instead",
scopeDuplicateDeclaration: "Duplicate declaration $1",
settersNoRest: "Setters aren't allowed to have a rest",
noAssignmentsInForHead: "No assignments allowed in for-in/of head",
expectedMemberExpressionOrIdentifier: "Expected type MemberExpression or Identifier",
invalidParentForThisNode: "We don't know how to handle this node within the current parent - please open an issue",
readOnly: "$1 is read-only",
unknownForHead: "Unknown node type $1 in ForStatement",
didYouMean: "Did you mean $1?",
codeGeneratorDeopt: "Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.",
missingTemplatesDirectory: "no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues",
unsupportedOutputType: "Unsupported output type $1",
illegalMethodName: "Illegal method name $1",
lostTrackNodePath: "We lost track of this node's position, likely because the AST was directly manipulated",
modulesIllegalExportName: "Illegal export $1",
modulesDuplicateDeclarations: "Duplicate module declarations with the same source but in different scopes",
undeclaredVariable: "Reference to undeclared variable $1",
undeclaredVariableType: "Referencing a type alias outside of a type annotation",
undeclaredVariableSuggestion: "Reference to undeclared variable $1 - did you mean $2?",
traverseNeedsParent: "You must pass a scope and parentPath unless traversing a Program/File. Instead of that you tried to traverse a $1 node without passing scope and parentPath.",
traverseVerifyRootFunction: "You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?",
traverseVerifyVisitorProperty: "You passed `traverse()` a visitor object with the property $1 that has the invalid property $2",
traverseVerifyNodeType: "You gave us a visitor for the node type $1 but it's not a valid type",
pluginNotObject: "Plugin $2 specified in $1 was expected to return an object when invoked but returned $3",
pluginNotFunction: "Plugin $2 specified in $1 was expected to return a function but returned $3",
pluginUnknown: "Unknown plugin $1 specified in $2 at $3, attempted to resolve relative to $4",
pluginInvalidProperty: "Plugin $2 specified in $1 provided an invalid property of $3"
};
exports.MESSAGES = MESSAGES;
/**
* Get a message with $0 placeholders replaced by arguments.
*/
function get(key) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var msg = MESSAGES[key];
if (!msg) throw new ReferenceError("Unknown message " + JSON.stringify(key));
// stringify args
args = parseArgs(args);
// replace $0 placeholders with args
return msg.replace(/\$(\d+)/g, function (str, i) {
return args[i - 1];
});
}
/**
* Stingify arguments to be used inside messages.
*/
function parseArgs(args) {
return args.map(function (val) {
if (val != null && val.inspect) {
return val.inspect();
} else {
try {
return JSON.stringify(val) || val + "";
} catch (e) {
return util.inspect(val);
}
}
});
}
/***/ },
/* 20 */
/*!****************************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-classes/~/babel-types/lib/index.js ***!
\****************************************************************************/
[548, 312, 25, 316, 113, 175, 317, 307, 315],
/* 21 */
/*!********************************************!*\
!*** ./~/core-js/library/modules/$.wks.js ***!
\********************************************/
/***/ function(module, exports, __webpack_require__) {
var store = __webpack_require__(/*! ./$.shared */ 203)('wks')
, uid = __webpack_require__(/*! ./$.uid */ 98)
, Symbol = __webpack_require__(/*! ./$.global */ 59).Symbol;
module.exports = function(name){
return store[name] || (store[name] =
Symbol && Symbol[name] || (Symbol || uid)('Symbol.' + name));
};
/***/ },
/* 22 */
/*!************************************!*\
!*** ./~/path-browserify/index.js ***!
\************************************/
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// resolves . and .. elements in a path array with directory names there
// must be no slashes, empty elements, or device names (c:\) in the array
// (so also no leading and trailing slashes - it does not distinguish
// relative and absolute paths)
function normalizeArray(parts, allowAboveRoot) {
// if the path tries to go above the root, `up` ends up > 0
var up = 0;
for (var i = parts.length - 1; i >= 0; i--) {
var last = parts[i];
if (last === '.') {
parts.splice(i, 1);
} else if (last === '..') {
parts.splice(i, 1);
up++;
} else if (up) {
parts.splice(i, 1);
up--;
}
}
// if the path is allowed to go above the root, restore leading ..s
if (allowAboveRoot) {
for (; up--; up) {
parts.unshift('..');
}
}
return parts;
}
// Split a filename into [root, dir, basename, ext], unix version
// 'root' is just a slash, or nothing.
var splitPathRe =
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
var splitPath = function(filename) {
return splitPathRe.exec(filename).slice(1);
};
// path.resolve([from ...], to)
// posix version
exports.resolve = function() {
var resolvedPath = '',
resolvedAbsolute = false;
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path = (i >= 0) ? arguments[i] : process.cwd();
// Skip empty and invalid entries
if (typeof path !== 'string') {
throw new TypeError('Arguments to path.resolve must be strings');
} else if (!path) {
continue;
}
resolvedPath = path + '/' + resolvedPath;
resolvedAbsolute = path.charAt(0) === '/';
}
// At this point the path should be resolved to a full absolute path, but
// handle relative paths to be safe (might happen when process.cwd() fails)
// Normalize the path
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
return !!p;
}), !resolvedAbsolute).join('/');
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
};
// path.normalize(path)
// posix version
exports.normalize = function(path) {
var isAbsolute = exports.isAbsolute(path),
trailingSlash = substr(path, -1) === '/';
// Normalize the path
path = normalizeArray(filter(path.split('/'), function(p) {
return !!p;
}), !isAbsolute).join('/');
if (!path && !isAbsolute) {
path = '.';
}
if (path && trailingSlash) {
path += '/';
}
return (isAbsolute ? '/' : '') + path;
};
// posix version
exports.isAbsolute = function(path) {
return path.charAt(0) === '/';
};
// posix version
exports.join = function() {
var paths = Array.prototype.slice.call(arguments, 0);
return exports.normalize(filter(paths, function(p, index) {
if (typeof p !== 'string') {
throw new TypeError('Arguments to path.join must be strings');
}
return p;
}).join('/'));
};
// path.relative(from, to)
// posix version
exports.relative = function(from, to) {
from = exports.resolve(from).substr(1);
to = exports.resolve(to).substr(1);
function trim(arr) {
var start = 0;
for (; start < arr.length; start++) {
if (arr[start] !== '') break;
}
var end = arr.length - 1;
for (; end >= 0; end--) {
if (arr[end] !== '') break;
}
if (start > end) return [];
return arr.slice(start, end - start + 1);
}
var fromParts = trim(from.split('/'));
var toParts = trim(to.split('/'));
var length = Math.min(fromParts.length, toParts.length);
var samePartsLength = length;
for (var i = 0; i < length; i++) {
if (fromParts[i] !== toParts[i]) {
samePartsLength = i;
break;
}
}
var outputParts = [];
for (var i = samePartsLength; i < fromParts.length; i++) {
outputParts.push('..');
}
outputParts = outputParts.concat(toParts.slice(samePartsLength));
return outputParts.join('/');
};
exports.sep = '/';
exports.delimiter = ':';
exports.dirname = function(path) {
var result = splitPath(path),
root = result[0],
dir = result[1];
if (!root && !dir) {
// No dirname whatsoever
return '.';
}
if (dir) {
// It has a dirname, strip trailing slash
dir = dir.substr(0, dir.length - 1);
}
return root + dir;
};
exports.basename = function(path, ext) {
var f = splitPath(path)[2];
// TODO: make this comparison case-insensitive on windows?
if (ext && f.substr(-1 * ext.length) === ext) {
f = f.substr(0, f.length - ext.length);
}
return f;
};
exports.extname = function(path) {
return splitPath(path)[3];
};
function filter (xs, f) {
if (xs.filter) return xs.filter(f);
var res = [];
for (var i = 0; i < xs.length; i++) {
if (f(xs[i], i, xs)) res.push(xs[i]);
}
return res;
}
// String.prototype.substr - negative index don't work in IE8
var substr = 'ab'.substr(-1) === 'b'
? function (str, start, len) { return str.substr(start, len) }
: function (str, start, len) {
if (start < 0) start = str.length + start;
return str.substr(start, len);
}
;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./~/process/browser.js */ 18)))
/***/ },
/* 23 */
/*!*************************************************************!*\
!*** ./~/babel-core/~/babel-types/lib/definitions/index.js ***!
\*************************************************************/
[543, 11],
/* 24 */
/*!******************************************************************!*\
!*** ./~/babel-generator/~/babel-types/lib/definitions/index.js ***!
\******************************************************************/
[543, 8],
/* 25 */
/*!****************************************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-classes/~/babel-types/lib/definitions/index.js ***!
\****************************************************************************************/
[543, 20],
/* 26 */
/*!*************************************************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-modules-commonjs/~/babel-types/lib/definitions/index.js ***!
\*************************************************************************************************/
[543, 27],
/* 27 */
/*!*************************************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-modules-commonjs/~/babel-types/lib/index.js ***!
\*************************************************************************************/
[548, 325, 26, 329, 115, 177, 330, 320, 328],
/* 28 */
/*!************************************************!*\
!*** ./~/babel-types/lib/definitions/index.js ***!
\************************************************/
[543, 3],
/* 29 */
/*!***********************************************!*\
!*** ./~/core-js/library/modules/$.export.js ***!
\***********************************************/
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ./$.global */ 59)
, core = __webpack_require__(/*! ./$.core */ 12)
, ctx = __webpack_require__(/*! ./$.ctx */ 56)
, PROTOTYPE = 'prototype';
var $export = function(type, name, source){
var IS_FORCED = type & $export.F
, IS_GLOBAL = type & $export.G
, IS_STATIC = type & $export.S
, IS_PROTO = type & $export.P
, IS_BIND = type & $export.B
, IS_WRAP = type & $export.W
, exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
, target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
, key, own, out;
if(IS_GLOBAL)source = name;
for(key in source){
// contains in native
own = !IS_FORCED && target && key in target;
if(own && key in exports)continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? ctx(out, global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function(C){
var F = function(param){
return this instanceof C ? new C(param) : C(param);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out;
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
module.exports = $export;
/***/ },
/* 30 */
/*!********************************!*\
!*** ./~/esutils/lib/utils.js ***!
\********************************/
/***/ function(module, exports, __webpack_require__) {
/*
Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function () {
'use strict';
exports.ast = __webpack_require__(/*! ./ast */ 455);
exports.code = __webpack_require__(/*! ./code */ 209);
exports.keyword = __webpack_require__(/*! ./keyword */ 456);
}());
/* vim: set sw=4 ts=4 et tw=80 : */
/***/ },
/* 31 */
/*!*************************************!*\
!*** ./~/lodash/collection/each.js ***!
\*************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(/*! ./forEach */ 469);
/***/ },
/* 32 */
/*!***************************************!*\
!*** ./~/lodash/internal/isLength.js ***!
\***************************************/
/***/ function(module, exports) {
/**
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
* of an array-like value.
*/
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
*/
function isLength(value) {
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
module.exports = isLength;
/***/ },
/* 33 */
/*!***************************************!*\
!*** ./~/lodash/internal/toObject.js ***!
\***************************************/
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(/*! ../lang/isObject */ 15);
/**
* Converts `value` to an object if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Object} Returns the object.
*/
function toObject(value) {
return isObject(value) ? value : Object(value);
}
module.exports = toObject;
/***/ },
/* 34 */
/*!********************************!*\
!*** ./~/lodash/lang/clone.js ***!
\********************************/
/***/ function(module, exports, __webpack_require__) {
var baseClone = __webpack_require__(/*! ../internal/baseClone */ 217),
bindCallback = __webpack_require__(/*! ../internal/bindCallback */ 64),
isIterateeCall = __webpack_require__(/*! ../internal/isIterateeCall */ 65);
/**
* Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,
* otherwise they are assigned by reference. If `customizer` is provided it's
* invoked to produce the cloned values. If `customizer` returns `undefined`
* cloning is handled by the method instead. The `customizer` is bound to
* `thisArg` and invoked with up to three argument; (value [, index|key, object]).
*
* **Note:** This method is loosely based on the
* [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
* The enumerable properties of `arguments` objects and objects created by
* constructors other than `Object` are cloned to plain `Object` objects. An
* empty object is returned for uncloneable values such as functions, DOM nodes,
* Maps, Sets, and WeakMaps.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @param {Function} [customizer] The function to customize cloning values.
* @param {*} [thisArg] The `this` binding of `customizer`.
* @returns {*} Returns the cloned value.
* @example
*
* var users = [
* { 'user': 'barney' },
* { 'user': 'fred' }
* ];
*
* var shallow = _.clone(users);
* shallow[0] === users[0];
* // => true
*
* var deep = _.clone(users, true);
* deep[0] === users[0];
* // => false
*
* // using a customizer callback
* var el = _.clone(document.body, function(value) {
* if (_.isElement(value)) {
* return value.cloneNode(false);
* }
* });
*
* el === document.body
* // => false
* el.nodeName
* // => BODY
* el.childNodes.length;
* // => 0
*/
function clone(value, isDeep, customizer, thisArg) {
if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {
isDeep = false;
}
else if (typeof isDeep == 'function') {
thisArg = customizer;
customizer = isDeep;
isDeep = false;
}
return typeof customizer == 'function'
? baseClone(value, isDeep, bindCallback(customizer, thisArg, 3))
: baseClone(value, isDeep);
}
module.exports = clone;
/***/ },
/* 35 */
/*!*********************************************!*\
!*** ./~/babel-runtime/helpers/inherits.js ***!
\*********************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _Object$create = __webpack_require__(/*! babel-runtime/core-js/object/create */ 10)["default"];
var _Object$setPrototypeOf = __webpack_require__(/*! babel-runtime/core-js/object/set-prototype-of */ 372)["default"];
exports["default"] = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = _Object$create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) _Object$setPrototypeOf ? _Object$setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
exports.__esModule = true;
/***/ },
/* 36 */
/*!********************************************!*\
!*** ./~/babel-traverse/lib/path/index.js ***!
\********************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _classCallCheck = __webpack_require__(/*! babel-runtime/helpers/class-call-check */ 5)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
var _libVirtualTypes = __webpack_require__(/*! ./lib/virtual-types */ 192);
var virtualTypes = _interopRequireWildcard(_libVirtualTypes);
var _debug2 = __webpack_require__(/*! debug */ 451);
var _debug3 = _interopRequireDefault(_debug2);
var _invariant = __webpack_require__(/*! invariant */ 461);
var _invariant2 = _interopRequireDefault(_invariant);
var _index = __webpack_require__(/*! ../index */ 6);
var _index2 = _interopRequireDefault(_index);
var _lodashObjectAssign = __webpack_require__(/*! lodash/object/assign */ 67);
var _lodashObjectAssign2 = _interopRequireDefault(_lodashObjectAssign);
var _scope = __webpack_require__(/*! ../scope */ 119);
var _scope2 = _interopRequireDefault(_scope);
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
var _cache = __webpack_require__(/*! ../cache */ 93);
var _debug = _debug3["default"]("babel");
var NodePath = (function () {
function NodePath(hub, parent) {
_classCallCheck(this, NodePath);
this.parent = parent;
this.hub = hub;
this.contexts = [];
this.data = {};
this.shouldSkip = false;
this.shouldStop = false;
this.removed = false;
this.state = null;
this.opts = null;
this.skipKeys = null;
this.parentPath = null;
this.context = null;
this.container = null;
this.listKey = null;
this.inList = false;
this.parentKey = null;
this.key = null;
this.node = null;
this.scope = null;
this.type = null;
this.typeAnnotation = null;
}
NodePath.get = function get(_ref) {
var hub = _ref.hub;
var parentPath = _ref.parentPath;
var parent = _ref.parent;
var container = _ref.container;
var listKey = _ref.listKey;
var key = _ref.key;
if (!hub && parentPath) {
hub = parentPath.hub;
}
_invariant2["default"](parent, "To get a node path the parent needs to exist");
var targetNode = container[key];
var paths = _cache.path.get(parent) || [];
if (!_cache.path.has(parent)) {
_cache.path.set(parent, paths);
}
var path = undefined;
for (var i = 0; i < paths.length; i++) {
var pathCheck = paths[i];
if (pathCheck.node === targetNode) {
path = pathCheck;
break;
}
}
if (!path) {
path = new NodePath(hub, parent);
paths.push(path);
}
path.setup(parentPath, container, listKey, key);
return path;
};
NodePath.prototype.getScope = function getScope(scope) {
var ourScope = scope;
// we're entering a new scope so let's construct it!
if (this.isScope()) {
ourScope = new _scope2["default"](this, scope);
}
return ourScope;
};
NodePath.prototype.setData = function setData(key, val) {
return this.data[key] = val;
};
NodePath.prototype.getData = function getData(key, def) {
var val = this.data[key];
if (!val && def) val = this.data[key] = def;
return val;
};
NodePath.prototype.buildCodeFrameError = function buildCodeFrameError(msg) {
var Error = arguments.length <= 1 || arguments[1] === undefined ? SyntaxError : arguments[1];
return this.hub.file.buildCodeFrameError(this.node, msg, Error);
};
NodePath.prototype.traverse = function traverse(visitor, state) {
_index2["default"](this.node, visitor, this.scope, state, this);
};
NodePath.prototype.mark = function mark(type, message) {
this.hub.file.metadata.marked.push({
type: type,
message: message,
loc: this.node.loc
});
};
NodePath.prototype.set = function set(key, node) {
t.validate(this.node, key, node);
this.node[key] = node;
};
NodePath.prototype.getPathLocation = function getPathLocation() {
var parts = [];
var path = this;
do {
var key = path.key;
if (path.inList) key = path.listKey + "[" + key + "]";
parts.unshift(key);
} while (path = path.parentPath);
return parts.join(".");
};
NodePath.prototype.debug = function debug(buildMessage) {
if (!_debug.enabled) return;
_debug(this.getPathLocation() + " " + this.type + ": " + buildMessage());
};
return NodePath;
})();
exports["default"] = NodePath;
_lodashObjectAssign2["default"](NodePath.prototype, __webpack_require__(/*! ./ancestry */ 376));
_lodashObjectAssign2["default"](NodePath.prototype, __webpack_require__(/*! ./inference */ 382));
_lodashObjectAssign2["default"](NodePath.prototype, __webpack_require__(/*! ./replacement */ 390));
_lodashObjectAssign2["default"](NodePath.prototype, __webpack_require__(/*! ./evaluation */ 380));
_lodashObjectAssign2["default"](NodePath.prototype, __webpack_require__(/*! ./conversion */ 379));
_lodashObjectAssign2["default"](NodePath.prototype, __webpack_require__(/*! ./introspection */ 385));
_lodashObjectAssign2["default"](NodePath.prototype, __webpack_require__(/*! ./context */ 378));
_lodashObjectAssign2["default"](NodePath.prototype, __webpack_require__(/*! ./removal */ 389));
_lodashObjectAssign2["default"](NodePath.prototype, __webpack_require__(/*! ./modification */ 388));
_lodashObjectAssign2["default"](NodePath.prototype, __webpack_require__(/*! ./family */ 381));
_lodashObjectAssign2["default"](NodePath.prototype, __webpack_require__(/*! ./comments */ 377));
var _arr = t.TYPES;
var _loop = function () {
var type = _arr[_i];
var typeKey = "is" + type;
NodePath.prototype[typeKey] = function (opts) {
return t[typeKey](this.node, opts);
};
NodePath.prototype["assert" + type] = function (opts) {
if (!this[typeKey](opts)) {
throw new TypeError("Expected node path of type " + type);
}
};
};
for (var _i = 0; _i < _arr.length; _i++) {
_loop();
}
var _loop2 = function (type) {
if (type[0] === "_") return "continue";
if (t.TYPES.indexOf(type) < 0) t.TYPES.push(type);
var virtualType = virtualTypes[type];
NodePath.prototype["is" + type] = function (opts) {
return virtualType.checkPath(this, opts);
};
};
for (var type in virtualTypes) {
var _ret2 = _loop2(type);
// istanbul ignore next
if (_ret2 === "continue") continue;
}
module.exports = exports["default"];
/***/ },
/* 37 */
/*!**************************************************!*\
!*** ./~/core-js/library/modules/$.is-object.js ***!
\**************************************************/
/***/ function(module, exports) {
module.exports = function(it){
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ },
/* 38 */
/*!***********************************!*\
!*** ./~/lodash/lang/isString.js ***!
\***********************************/
/***/ function(module, exports, __webpack_require__) {
var isObjectLike = __webpack_require__(/*! ../internal/isObjectLike */ 17);
/** `Object#toString` result references. */
var stringTag = '[object String]';
/** Used for native method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* Checks if `value` is classified as a `String` primitive or object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isString('abc');
* // => true
*
* _.isString(1);
* // => false
*/
function isString(value) {
return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
}
module.exports = isString;
/***/ },
/* 39 */
/*!*********************************!*\
!*** ./~/lodash/object/keys.js ***!
\*********************************/
/***/ function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(/*! ../internal/getNative */ 100),
isArrayLike = __webpack_require__(/*! ../internal/isArrayLike */ 44),
isObject = __webpack_require__(/*! ../lang/isObject */ 15),
shimKeys = __webpack_require__(/*! ../internal/shimKeys */ 507);
/* Native method references for those with the same name as other `lodash` methods. */
var nativeKeys = getNative(Object, 'keys');
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
* for more details.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
var keys = !nativeKeys ? shimKeys : function(object) {
var Ctor = object == null ? undefined : object.constructor;
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
(typeof object != 'function' && isArrayLike(object))) {
return shimKeys(object);
}
return isObject(object) ? nativeKeys(object) : [];
};
module.exports = keys;
/***/ },
/* 40 */
/*!*******************************************!*\
!*** ./~/node-libs-browser/mock/empty.js ***!
\*******************************************/
/***/ function(module, exports) {
/***/ },
/* 41 */
/*!**************************************************!*\
!*** ./~/core-js/library/modules/$.an-object.js ***!
\**************************************************/
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(/*! ./$.is-object */ 37);
module.exports = function(it){
if(!isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
/***/ },
/* 42 */
/*!********************************************!*\
!*** ./~/core-js/library/modules/$.has.js ***!
\********************************************/
/***/ function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function(it, key){
return hasOwnProperty.call(it, key);
};
/***/ },
/* 43 */
/*!*********************************************!*\
!*** ./~/core-js/library/modules/$.hide.js ***!
\*********************************************/
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(/*! ./$ */ 7)
, createDesc = __webpack_require__(/*! ./$.property-desc */ 126);
module.exports = __webpack_require__(/*! ./$.descriptors */ 57) ? function(object, key, value){
return $.setDesc(object, key, createDesc(1, value));
} : function(object, key, value){
object[key] = value;
return object;
};
/***/ },
/* 44 */
/*!******************************************!*\
!*** ./~/lodash/internal/isArrayLike.js ***!
\******************************************/
/***/ function(module, exports, __webpack_require__) {
var getLength = __webpack_require__(/*! ./getLength */ 138),
isLength = __webpack_require__(/*! ./isLength */ 32);
/**
* Checks if `value` is array-like.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
*/
function isArrayLike(value) {
return value != null && isLength(getLength(value));
}
module.exports = isArrayLike;
/***/ },
/* 45 */
/*!***********************************!*\
!*** ./~/lodash/lang/isNumber.js ***!
\***********************************/
/***/ function(module, exports, __webpack_require__) {
var isObjectLike = __webpack_require__(/*! ../internal/isObjectLike */ 17);
/** `Object#toString` result references. */
var numberTag = '[object Number]';
/** Used for native method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* Checks if `value` is classified as a `Number` primitive or object.
*
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
* as numbers, use the `_.isFinite` method.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isNumber(8.4);
* // => true
*
* _.isNumber(NaN);
* // => true
*
* _.isNumber('8.4');
* // => false
*/
function isNumber(value) {
return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);
}
module.exports = isNumber;
/***/ },
/* 46 */
/*!****************************************!*\
!*** ./~/lodash/lang/isPlainObject.js ***!
\****************************************/
/***/ function(module, exports, __webpack_require__) {
var baseForIn = __webpack_require__(/*! ../internal/baseForIn */ 478),
isArguments = __webpack_require__(/*! ./isArguments */ 66),
isObjectLike = __webpack_require__(/*! ../internal/isObjectLike */ 17);
/** `Object#toString` result references. */
var objectTag = '[object Object]';
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* **Note:** This method assumes objects created by the `Object` constructor
* have no inherited enumerable properties.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
var Ctor;
// Exit early for non `Object` objects.
if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||
(!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
return false;
}
// IE < 9 iterates inherited properties before own properties. If the first
// iterated property is an object's own property then there are no inherited
// enumerable properties.
var result;
// In most environments an object's own properties are iterated before
// its inherited properties. If the last iterated property is an object's
// own property then there are no inherited enumerable properties.
baseForIn(value, function(subValue, key) {
result = key;
});
return result === undefined || hasOwnProperty.call(value, result);
}
module.exports = isPlainObject;
/***/ },
/* 47 */
/*!***********************************!*\
!*** ./~/lodash/lang/isRegExp.js ***!
\***********************************/
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(/*! ./isObject */ 15);
/** `Object#toString` result references. */
var regexpTag = '[object RegExp]';
/** Used for native method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* Checks if `value` is classified as a `RegExp` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isRegExp(/abc/);
* // => true
*
* _.isRegExp('/abc/');
* // => false
*/
function isRegExp(value) {
return isObject(value) && objToString.call(value) == regexpTag;
}
module.exports = isRegExp;
/***/ },
/* 48 */
/*!******************************!*\
!*** ./~/repeating/index.js ***!
\******************************/
/***/ function(module, exports, __webpack_require__) {
'use strict';
var isFinite = __webpack_require__(/*! is-finite */ 210);
module.exports = function (str, n) {
if (typeof str !== 'string') {
throw new TypeError('Expected a string as the first argument');
}
if (n < 0 || !isFinite(n)) {
throw new TypeError('Expected a finite positive number');
}
var ret = '';
do {
if (n & 1) {
ret += str;
}
str += str;
} while (n = n >> 1);
return ret;
};
/***/ },
/* 49 */
/*!****************************************************************!*\
!*** ./~/babel-core/lib/transformation/file/options/config.js ***!
\****************************************************************/
/***/ function(module, exports) {
/* eslint max-len: 0 */
"use strict";
module.exports = {
filename: {
type: "filename",
description: "filename to use when reading from stdin - this will be used in source-maps, errors etc",
"default": "unknown",
shorthand: "f"
},
filenameRelative: {
hidden: true,
type: "string"
},
inputSourceMap: {
hidden: true
},
env: {
hidden: true,
"default": {}
},
mode: {
description: "",
hidden: true
},
retainLines: {
type: "boolean",
"default": false,
description: "retain line numbers - will result in really ugly code"
},
highlightCode: {
description: "enable/disable ANSI syntax highlighting of code frames (on by default)",
type: "boolean",
"default": true
},
suppressDeprecationMessages: {
type: "boolean",
"default": false,
hidden: true
},
presets: {
type: "list",
description: "",
"default": []
},
plugins: {
type: "list",
"default": [],
description: ""
},
ignore: {
type: "list",
description: "list of glob paths to **not** compile",
"default": []
},
only: {
type: "list",
description: "list of glob paths to **only** compile"
},
code: {
hidden: true,
"default": true,
type: "boolean"
},
metadata: {
hidden: true,
"default": true,
type: "boolean"
},
ast: {
hidden: true,
"default": true,
type: "boolean"
},
"extends": {
type: "string",
hidden: true
},
comments: {
type: "boolean",
"default": true,
description: "write comments to generated output (true by default)"
},
shouldPrintComment: {
hidden: true,
description: "optional callback to control whether a comment should be inserted, when this is used the comments option is ignored"
},
compact: {
type: "booleanString",
"default": "auto",
description: "do not include superfluous whitespace characters and line terminators [true|false|auto]"
},
minified: {
type: "boolean",
"default": false,
description: "save as much bytes when printing [true|false]"
},
sourceMap: {
alias: "sourceMaps",
hidden: true
},
sourceMaps: {
type: "booleanString",
description: "[true|false|inline]",
"default": false,
shorthand: "s"
},
sourceMapTarget: {
type: "string",
description: "set `file` on returned source map"
},
sourceFileName: {
type: "string",
description: "set `sources[0]` on returned source map"
},
sourceRoot: {
type: "filename",
description: "the root from which all sources are relative"
},
babelrc: {
description: "Whether or not to look up .babelrc and .babelignore files",
type: "boolean",
"default": true
},
sourceType: {
description: "",
"default": "module"
},
auxiliaryCommentBefore: {
type: "string",
description: "print a comment before any injected non-user code"
},
auxiliaryCommentAfter: {
type: "string",
description: "print a comment after any injected non-user code"
},
resolveModuleSource: {
hidden: true
},
getModuleId: {
hidden: true
},
moduleRoot: {
type: "filename",
description: "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"
},
moduleIds: {
type: "boolean",
"default": false,
shorthand: "M",
description: "insert an explicit id for modules"
},
moduleId: {
description: "specify a custom name for module ids",
type: "string"
},
passPerPreset: {
description: "Whether to spawn a traversal pass per a preset. By default all presets are merged.",
type: "boolean",
"default": false,
hidden: true
}
};
/***/ },
/* 50 */
/*!************************************************************************!*\
!*** ./~/babel-core/lib/transformation/file/options/option-manager.js ***!
\************************************************************************/
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/* eslint max-len: 0 */
"use strict";
var _classCallCheck = __webpack_require__(/*! babel-runtime/helpers/class-call-check */ 5)["default"];
var _Object$assign = __webpack_require__(/*! babel-runtime/core-js/object/assign */ 117)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
var _apiNode = __webpack_require__(/*! ../../../api/node */ 145);
var context = _interopRequireWildcard(_apiNode);
var _plugin2 = __webpack_require__(/*! ../../plugin */ 72);
var _plugin3 = _interopRequireDefault(_plugin2);
var _babelMessages = __webpack_require__(/*! babel-messages */ 19);
var messages = _interopRequireWildcard(_babelMessages);
var _index = __webpack_require__(/*! ./index */ 104);
var _helpersResolve = __webpack_require__(/*! ../../../helpers/resolve */ 247);
var _helpersResolve2 = _interopRequireDefault(_helpersResolve);
var _json5 = __webpack_require__(/*! json5 */ 466);
var _json52 = _interopRequireDefault(_json5);
var _pathIsAbsolute = __webpack_require__(/*! path-is-absolute */ 521);
var _pathIsAbsolute2 = _interopRequireDefault(_pathIsAbsolute);
var _pathExists = __webpack_require__(/*! path-exists */ 520);
var _pathExists2 = _interopRequireDefault(_pathExists);
var _lodashLangCloneDeep = __webpack_require__(/*! lodash/lang/cloneDeep */ 228);
var _lodashLangCloneDeep2 = _interopRequireDefault(_lodashLangCloneDeep);
var _lodashLangClone = __webpack_require__(/*! lodash/lang/clone */ 34);
var _lodashLangClone2 = _interopRequireDefault(_lodashLangClone);
var _helpersMerge = __webpack_require__(/*! ../../../helpers/merge */ 245);
var _helpersMerge2 = _interopRequireDefault(_helpersMerge);
var _config = __webpack_require__(/*! ./config */ 49);
var _config2 = _interopRequireDefault(_config);
var _removed = __webpack_require__(/*! ./removed */ 106);
var _removed2 = _interopRequireDefault(_removed);
var _path = __webpack_require__(/*! path */ 22);
var _path2 = _interopRequireDefault(_path);
var _fs = __webpack_require__(/*! fs */ 40);
var _fs2 = _interopRequireDefault(_fs);
var existsCache = {};
var jsonCache = {};
var BABELIGNORE_FILENAME = ".babelignore";
var BABELRC_FILENAME = ".babelrc";
var PACKAGE_FILENAME = "package.json";
function exists(filename) {
var cached = existsCache[filename];
if (cached == null) {
return existsCache[filename] = _pathExists2["default"].sync(filename);
} else {
return cached;
}
}
var OptionManager = (function () {
function OptionManager(log) {
_classCallCheck(this, OptionManager);
this.resolvedConfigs = [];
this.options = OptionManager.createBareOptions();
this.log = log;
}
OptionManager.memoisePluginContainer = function memoisePluginContainer(fn, loc, i, alias) {
var _arr = OptionManager.memoisedPlugins;
for (var _i = 0; _i < _arr.length; _i++) {
var cache = _arr[_i];
if (cache.container === fn) return cache.plugin;
}
var obj = undefined;
if (typeof fn === "function") {
obj = fn(context);
} else {
obj = fn;
}
if (typeof obj === "object") {
var _plugin = new _plugin3["default"](obj, alias);
OptionManager.memoisedPlugins.push({
container: fn,
plugin: _plugin
});
return _plugin;
} else {
throw new TypeError(messages.get("pluginNotObject", loc, i, typeof obj) + loc + i);
}
};
OptionManager.createBareOptions = function createBareOptions() {
var opts = {};
for (var _key in _config2["default"]) {
var opt = _config2["default"][_key];
opts[_key] = _lodashLangClone2["default"](opt["default"]);
}
return opts;
};
OptionManager.normalisePlugin = function normalisePlugin(plugin, loc, i, alias) {
plugin = plugin.__esModule ? plugin["default"] : plugin;
if (!(plugin instanceof _plugin3["default"])) {
// allow plugin containers to be specified so they don't have to manually require
if (typeof plugin === "function" || typeof plugin === "object") {
plugin = OptionManager.memoisePluginContainer(plugin, loc, i, alias);
} else {
throw new TypeError(messages.get("pluginNotFunction", loc, i, typeof plugin));
}
}
plugin.init(loc, i);
return plugin;
};
OptionManager.normalisePlugins = function normalisePlugins(loc, dirname, plugins) {
return plugins.map(function (val, i) {
var plugin = undefined,
options = undefined;
if (!val) {
throw new TypeError("Falsy value found in plugins");
}
// destructure plugins
if (Array.isArray(val)) {
plugin = val[0];
options = val[1];
} else {
plugin = val;
}
var alias = typeof plugin === "string" ? plugin : loc + "$" + i;
// allow plugins to be specified as strings
if (typeof plugin === "string") {
var pluginLoc = _helpersResolve2["default"]("babel-plugin-" + plugin, dirname) || _helpersResolve2["default"](plugin, dirname);
if (pluginLoc) {
plugin = __webpack_require__(/*! . */ 146)(pluginLoc);
} else {
throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname));
}
}
plugin = OptionManager.normalisePlugin(plugin, loc, i, alias);
return [plugin, options];
});
};
OptionManager.prototype.addConfig = function addConfig(loc, key) {
var json = arguments.length <= 2 || arguments[2] === undefined ? _json52["default"] : arguments[2];
if (this.resolvedConfigs.indexOf(loc) >= 0) {
return false;
}
var content = _fs2["default"].readFileSync(loc, "utf8");
var opts = undefined;
try {
opts = jsonCache[content] = jsonCache[content] || json.parse(content);
if (key) opts = opts[key];
} catch (err) {
err.message = loc + ": Error while parsing JSON - " + err.message;
throw err;
}
this.mergeOptions({
options: opts,
alias: loc,
dirname: _path2["default"].dirname(loc)
});
this.resolvedConfigs.push(loc);
return !!opts;
};
/**
* This is called when we want to merge the input `opts` into the
* base options (passed as the `extendingOpts`: at top-level it's the
* main options, at presets level it's presets options).
*
* - `alias` is used to output pretty traces back to the original source.
* - `loc` is used to point to the original config.
* - `dirname` is used to resolve plugins relative to it.
*/
OptionManager.prototype.mergeOptions = function mergeOptions(_ref) {
// istanbul ignore next
var _this = this;
var rawOpts = _ref.options;
var extendingOpts = _ref.extending;
var alias = _ref.alias;
var loc = _ref.loc;
var dirname = _ref.dirname;
alias = alias || "foreign";
if (!rawOpts) return;
//
if (typeof rawOpts !== "object" || Array.isArray(rawOpts)) {
this.log.error("Invalid options type for " + alias, TypeError);
}
//
var opts = _lodashLangCloneDeep2["default"](rawOpts, function (val) {
if (val instanceof _plugin3["default"]) {
return val;
}
});
//
dirname = dirname || process.cwd();
loc = loc || alias;
for (var _key2 in opts) {
var option = _config2["default"][_key2];
// check for an unknown option
if (!option && this.log) {
var pluginOptsInfo = "Check out http://babeljs.io/docs/usage/options/ for more info";
if (_removed2["default"][_key2]) {
this.log.error("Using removed Babel 5 option: " + alias + "." + _key2 + " - " + _removed2["default"][_key2].message, ReferenceError);
} else {
this.log.error("Unknown option: " + alias + "." + _key2 + ". " + pluginOptsInfo, ReferenceError);
}
}
}
// normalise options
_index.normaliseOptions(opts);
// resolve plugins
if (opts.plugins) {
opts.plugins = OptionManager.normalisePlugins(loc, dirname, opts.plugins);
}
// add extends clause
if (opts["extends"]) {
var extendsLoc = _helpersResolve2["default"](opts["extends"], dirname);
if (extendsLoc) {
this.addConfig(extendsLoc);
} else {
if (this.log) this.log.error("Couldn't resolve extends clause of " + opts["extends"] + " in " + alias);
}
delete opts["extends"];
}
// resolve presets
if (opts.presets) {
// If we're in the "pass per preset" mode, we resolve the presets
// and keep them for further execution to calculate the options.
if (opts.passPerPreset) {
opts.presets = this.resolvePresets(opts.presets, dirname, function (preset, presetLoc) {
_this.mergeOptions({
options: preset,
extending: preset,
alias: presetLoc,
loc: presetLoc,
dirname: dirname
});
});
} else {
// Otherwise, just merge presets options into the main options.
this.mergePresets(opts.presets, dirname);
delete opts.presets;
}
}
// env
var envOpts = undefined;
var envKey = process.env.BABEL_ENV || ("production") || "development";
if (opts.env) {
envOpts = opts.env[envKey];
delete opts.env;
}
// Merge them into current extending options in case of top-level
// options. In case of presets, just re-assign options which are got
// normalized during the `mergeOptions`.
if (rawOpts === extendingOpts) {
_Object$assign(extendingOpts, opts);
} else {
_helpersMerge2["default"](extendingOpts || this.options, opts);
}
// merge in env options
this.mergeOptions({
options: envOpts,
extending: extendingOpts,
alias: alias + ".env." + envKey,
dirname: dirname
});
};
/**
* Merges all presets into the main options in case we are not in the
* "pass per preset" mode. Otherwise, options are calculated per preset.
*/
OptionManager.prototype.mergePresets = function mergePresets(presets, dirname) {
// istanbul ignore next
var _this2 = this;
this.resolvePresets(presets, dirname, function (presetOpts, presetLoc) {
_this2.mergeOptions({
options: presetOpts,
alias: presetLoc,
loc: presetLoc,
dirname: _path2["default"].dirname(presetLoc || "")
});
});
};
/**
* Resolves presets options which can be either direct object data,
* or a module name to require.
*/
OptionManager.prototype.resolvePresets = function resolvePresets(presets, dirname, onResolve) {
return presets.map(function (val) {
if (typeof val === "string") {
var presetLoc = _helpersResolve2["default"]("babel-preset-" + val, dirname) || _helpersResolve2["default"](val, dirname);
if (presetLoc) {
var _val = __webpack_require__(/*! . */ 146)(presetLoc);
onResolve && onResolve(_val, presetLoc);
return _val;
} else {
throw new Error("Couldn't find preset " + JSON.stringify(val) + " relative to directory " + JSON.stringify(dirname));
}
} else if (typeof val === "object") {
onResolve && onResolve(val);
return val;
} else {
throw new Error("Unsupported preset format: " + val + ".");
}
});
};
OptionManager.prototype.addIgnoreConfig = function addIgnoreConfig(loc) {
var file = _fs2["default"].readFileSync(loc, "utf8");
var lines = file.split("\n");
lines = lines.map(function (line) {
return line.replace(/#(.*?)$/, "").trim();
}).filter(function (line) {
return !!line;
});
this.mergeOptions({
options: { ignore: lines },
loc: loc
});
};
OptionManager.prototype.findConfigs = function findConfigs(loc) {
if (!loc) return;
if (!_pathIsAbsolute2["default"](loc)) {
loc = _path2["default"].join(process.cwd(), loc);
}
var foundConfig = false;
var foundIgnore = false;
while (loc !== (loc = _path2["default"].dirname(loc))) {
if (!foundConfig) {
var configLoc = _path2["default"].join(loc, BABELRC_FILENAME);
if (exists(configLoc)) {
this.addConfig(configLoc);
foundConfig = true;
}
var pkgLoc = _path2["default"].join(loc, PACKAGE_FILENAME);
if (!foundConfig && exists(pkgLoc)) {
foundConfig = this.addConfig(pkgLoc, "babel", JSON);
}
}
if (!foundIgnore) {
var ignoreLoc = _path2["default"].join(loc, BABELIGNORE_FILENAME);
if (exists(ignoreLoc)) {
this.addIgnoreConfig(ignoreLoc);
foundIgnore = true;
}
}
if (foundIgnore && foundConfig) return;
}
};
OptionManager.prototype.normaliseOptions = function normaliseOptions() {
var opts = this.options;
for (var _key3 in _config2["default"]) {
var option = _config2["default"][_key3];
var val = opts[_key3];
// optional
if (!val && option.optional) continue;
// aliases
if (option.alias) {
opts[option.alias] = opts[option.alias] || val;
} else {
opts[_key3] = val;
}
}
};
OptionManager.prototype.init = function init() {
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var filename = opts.filename;
// resolve all .babelrc files
if (opts.babelrc !== false) {
this.findConfigs(filename);
}
// merge in base options
this.mergeOptions({
options: opts,
alias: "base",
dirname: filename && _path2["default"].dirname(filename)
});
// normalise
this.normaliseOptions(opts);
return this.options;
};
return OptionManager;
})();
exports["default"] = OptionManager;
OptionManager.memoisedPlugins = [];
module.exports = exports["default"];
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./~/process/browser.js */ 18)))
/***/ },
/* 51 */
/*!***************************************************!*\
!*** ./~/babel-helper-function-name/lib/index.js ***!
\***************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelHelperGetFunctionArity = __webpack_require__(/*! babel-helper-get-function-arity */ 154);
var _babelHelperGetFunctionArity2 = _interopRequireDefault(_babelHelperGetFunctionArity);
var _babelTemplate = __webpack_require__(/*! babel-template */ 9);
var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
var buildPropertyMethodAssignmentWrapper = _babelTemplate2["default"]("\n (function (FUNCTION_KEY) {\n function FUNCTION_ID() {\n return FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n }\n\n return FUNCTION_ID;\n })(FUNCTION)\n");
var buildGeneratorPropertyMethodAssignmentWrapper = _babelTemplate2["default"]("\n (function (FUNCTION_KEY) {\n function* FUNCTION_ID() {\n return yield* FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n };\n\n return FUNCTION_ID;\n })(FUNCTION)\n");
var visitor = {
"ReferencedIdentifier|BindingIdentifier": function ReferencedIdentifierBindingIdentifier(path, state) {
// check if this node matches our function id
if (path.node.name !== state.name) return;
// check that we don't have a local variable declared as that removes the need
// for the wrapper
var localDeclar = path.scope.getBindingIdentifier(state.name);
if (localDeclar !== state.outerDeclar) return;
state.selfReference = true;
path.stop();
}
};
function wrap(state, method, id, scope) {
if (state.selfReference) {
if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) {
// we can just munge the local binding
scope.rename(id.name);
} else {
// we don't currently support wrapping class expressions
if (!t.isFunction(method)) return;
// need to add a wrapper since we can't change the references
var build = buildPropertyMethodAssignmentWrapper;
if (method.generator) build = buildGeneratorPropertyMethodAssignmentWrapper;
var _template = build({
FUNCTION: method,
FUNCTION_ID: id,
FUNCTION_KEY: scope.generateUidIdentifier(id.name)
}).expression;
_template.callee._skipModulesRemap = true;
// shim in dummy params to retain function arity, if you try to read the
// source then you'll get the original since it's proxied so it's all good
var params = _template.callee.body.body[0].params;
for (var i = 0, len = _babelHelperGetFunctionArity2["default"](method); i < len; i++) {
params.push(scope.generateUidIdentifier("x"));
}
return _template;
}
}
method.id = id;
scope.getProgramParent().references[id.name] = true;
}
function visit(node, name, scope) {
var state = {
selfAssignment: false,
selfReference: false,
outerDeclar: scope.getBindingIdentifier(name),
references: [],
name: name
};
// check to see if we have a local binding of the id we're setting inside of
// the function, this is important as there are caveats associated
var binding = scope.getOwnBinding(name);
if (binding) {
if (binding.kind === "param") {
// safari will blow up in strict mode with code like:
//
// let t = function t(t) {};
//
// with the error:
//
// Cannot declare a parameter named 't' as it shadows the name of a
// strict mode function.
//
// this isn't to the spec and they've invented this behaviour which is
// **extremely** annoying so we avoid setting the name if it has a param
// with the same id
state.selfReference = true;
} else {
// otherwise it's defined somewhere in scope like:
//
// let t = function () {
// let t = 2;
// };
//
// so we can safely just set the id and move along as it shadows the
// bound function id
}
} else if (state.outerDeclar || scope.hasGlobal(name)) {
scope.traverse(node, visitor, state);
}
return state;
}
exports["default"] = function (_ref) {
var node = _ref.node;
var parent = _ref.parent;
var scope = _ref.scope;
var id = _ref.id;
// has an `id` so we don't need to infer one
if (node.id) return;
if ((t.isObjectProperty(parent) || t.isObjectMethod(parent, { kind: "method" })) && (!parent.computed || t.isLiteral(parent.key))) {
// { foo() {} };
id = parent.key;
} else if (t.isVariableDeclarator(parent)) {
// let foo = function () {};
id = parent.id;
if (t.isIdentifier(id)) {
var binding = scope.parent.getBinding(id.name);
if (binding && binding.constant && scope.getBinding(id.name) === binding) {
// always going to reference this method
node.id = id;
node.id[t.NOT_LOCAL_BINDING] = true;
return;
}
}
} else if (t.isAssignmentExpression(parent)) {
// foo = function () {};
id = parent.left;
} else if (!id) {
return;
}
var name = undefined;
if (id && t.isLiteral(id)) {
name = id.value;
} else if (id && t.isIdentifier(id)) {
name = id.name;
} else {
return;
}
name = t.toBindingIdentifierName(name);
id = t.identifier(name);
// The id shouldn't be considered a local binding to the function because
// we are simply trying to set the function name and not actually create
// a local binding.
id[t.NOT_LOCAL_BINDING] = true;
var state = visit(node, name, scope);
return wrap(state, node, id, scope) || node;
};
module.exports = exports["default"];
/***/ },
/* 52 */
/*!************************************************************!*\
!*** ./~/babel-runtime/core-js/number/max-safe-integer.js ***!
\************************************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(/*! core-js/library/fn/number/max-safe-integer */ 412), __esModule: true };
/***/ },
/* 53 */
/*!***********************************************!*\
!*** ./~/babel-runtime/core-js/symbol/for.js ***!
\***********************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(/*! core-js/library/fn/symbol/for */ 421), __esModule: true };
/***/ },
/* 54 */
/*!*********************************************!*\
!*** ./~/babel-runtime/helpers/defaults.js ***!
\*********************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _Object$getOwnPropertyNames = __webpack_require__(/*! babel-runtime/core-js/object/get-own-property-names */ 370)["default"];
var _Object$getOwnPropertyDescriptor = __webpack_require__(/*! babel-runtime/core-js/object/get-own-property-descriptor */ 369)["default"];
var _Object$defineProperty = __webpack_require__(/*! babel-runtime/core-js/object/define-property */ 190)["default"];
exports["default"] = function (obj, defaults) {
var keys = _Object$getOwnPropertyNames(defaults);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var value = _Object$getOwnPropertyDescriptor(defaults, key);
if (value && value.configurable && obj[key] === undefined) {
_Object$defineProperty(obj, key, value);
}
}
return obj;
};
exports.__esModule = true;
/***/ },
/* 55 */
/*!************************************************************!*\
!*** ./~/babel-runtime/helpers/interop-export-wildcard.js ***!
\************************************************************/
/***/ function(module, exports) {
"use strict";
exports["default"] = function (obj, defaults) {
var newObj = defaults({}, obj);
delete newObj["default"];
return newObj;
};
exports.__esModule = true;
/***/ },
/* 56 */
/*!********************************************!*\
!*** ./~/core-js/library/modules/$.ctx.js ***!
\********************************************/
/***/ function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(/*! ./$.a-function */ 424);
module.exports = function(fn, that, length){
aFunction(fn);
if(that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
}
return function(/* ...args */){
return fn.apply(that, arguments);
};
};
/***/ },
/* 57 */
/*!****************************************************!*\
!*** ./~/core-js/library/modules/$.descriptors.js ***!
\****************************************************/
/***/ function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(/*! ./$.fails */ 58)(function(){
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
});
/***/ },
/* 58 */
/*!**********************************************!*\
!*** ./~/core-js/library/modules/$.fails.js ***!
\**********************************************/
/***/ function(module, exports) {
module.exports = function(exec){
try {
return !!exec();
} catch(e){
return true;
}
};
/***/ },
/* 59 */
/*!***********************************************!*\
!*** ./~/core-js/library/modules/$.global.js ***!
\***********************************************/
/***/ function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
/***/ },
/* 60 */
/*!**************************************************!*\
!*** ./~/core-js/library/modules/$.iterators.js ***!
\**************************************************/
/***/ function(module, exports) {
module.exports = {};
/***/ },
/* 61 */
/*!***************************************************!*\
!*** ./~/core-js/library/modules/$.to-iobject.js ***!
\***************************************************/
/***/ function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(/*! ./$.iobject */ 123)
, defined = __webpack_require__(/*! ./$.defined */ 94);
module.exports = function(it){
return IObject(defined(it));
};
/***/ },
/* 62 */
/*!***********************************!*\
!*** ./~/lodash/array/compact.js ***!
\***********************************/
/***/ function(module, exports) {
/**
* Creates an array with all falsey values removed. The values `false`, `null`,
* `0`, `""`, `undefined`, and `NaN` are falsey.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to compact.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* _.compact([0, 1, false, 2, '', 3]);
* // => [1, 2, 3]
*/
function compact(array) {
var index = -1,
length = array ? array.length : 0,
resIndex = -1,
result = [];
while (++index < length) {
var value = array[index];
if (value) {
result[++resIndex] = value;
}
}
return result;
}
module.exports = compact;
/***/ },
/* 63 */
/*!********************************!*\
!*** ./~/lodash/array/uniq.js ***!
\********************************/
/***/ function(module, exports, __webpack_require__) {
var baseCallback = __webpack_require__(/*! ../internal/baseCallback */ 134),
baseUniq = __webpack_require__(/*! ../internal/baseUniq */ 487),
isIterateeCall = __webpack_require__(/*! ../internal/isIterateeCall */ 65),
sortedUniq = __webpack_require__(/*! ../internal/sortedUniq */ 508);
/**
* Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons, in which only the first occurence of each element
* is kept. Providing `true` for `isSorted` performs a faster search algorithm
* for sorted arrays. If an iteratee function is provided it's invoked for
* each element in the array to generate the criterion by which uniqueness
* is computed. The `iteratee` is bound to `thisArg` and invoked with three
* arguments: (value, index, array).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `iteratee` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @alias unique
* @category Array
* @param {Array} array The array to inspect.
* @param {boolean} [isSorted] Specify the array is sorted.
* @param {Function|Object|string} [iteratee] The function invoked per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Array} Returns the new duplicate-value-free array.
* @example
*
* _.uniq([2, 1, 2]);
* // => [2, 1]
*
* // using `isSorted`
* _.uniq([1, 1, 2], true);
* // => [1, 2]
*
* // using an iteratee function
* _.uniq([1, 2.5, 1.5, 2], function(n) {
* return this.floor(n);
* }, Math);
* // => [1, 2.5]
*
* // using the `_.property` callback shorthand
* _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
* // => [{ 'x': 1 }, { 'x': 2 }]
*/
function uniq(array, isSorted, iteratee, thisArg) {
var length = array ? array.length : 0;
if (!length) {
return [];
}
if (isSorted != null && typeof isSorted != 'boolean') {
thisArg = iteratee;
iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted;
isSorted = false;
}
iteratee = iteratee == null ? iteratee : baseCallback(iteratee, thisArg, 3);
return (isSorted)
? sortedUniq(array, iteratee)
: baseUniq(array, iteratee);
}
module.exports = uniq;
/***/ },
/* 64 */
/*!*******************************************!*\
!*** ./~/lodash/internal/bindCallback.js ***!
\*******************************************/
/***/ function(module, exports, __webpack_require__) {
var identity = __webpack_require__(/*! ../utility/identity */ 234);
/**
* A specialized version of `baseCallback` which only supports `this` binding
* and specifying the number of arguments to provide to `func`.
*
* @private
* @param {Function} func The function to bind.
* @param {*} thisArg The `this` binding of `func`.
* @param {number} [argCount] The number of arguments to provide to `func`.
* @returns {Function} Returns the callback.
*/
function bindCallback(func, thisArg, argCount) {
if (typeof func != 'function') {
return identity;
}
if (thisArg === undefined) {
return func;
}
switch (argCount) {
case 1: return function(value) {
return func.call(thisArg, value);
};
case 3: return function(value, index, collection) {
return func.call(thisArg, value, index, collection);
};
case 4: return function(accumulator, value, index, collection) {
return func.call(thisArg, accumulator, value, index, collection);
};
case 5: return function(value, other, key, object, source) {
return func.call(thisArg, value, other, key, object, source);
};
}
return function() {
return func.apply(thisArg, arguments);
};
}
module.exports = bindCallback;
/***/ },
/* 65 */
/*!*********************************************!*\
!*** ./~/lodash/internal/isIterateeCall.js ***!
\*********************************************/
/***/ function(module, exports, __webpack_require__) {
var isArrayLike = __webpack_require__(/*! ./isArrayLike */ 44),
isIndex = __webpack_require__(/*! ./isIndex */ 101),
isObject = __webpack_require__(/*! ../lang/isObject */ 15);
/**
* Checks if the provided arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)) {
var other = object[index];
return value === value ? (value === other) : (other !== other);
}
return false;
}
module.exports = isIterateeCall;
/***/ },
/* 66 */
/*!**************************************!*\
!*** ./~/lodash/lang/isArguments.js ***!
\**************************************/
/***/ function(module, exports, __webpack_require__) {
var isArrayLike = __webpack_require__(/*! ../internal/isArrayLike */ 44),
isObjectLike = __webpack_require__(/*! ../internal/isObjectLike */ 17);
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Native method references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/**
* Checks if `value` is classified as an `arguments` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
return isObjectLike(value) && isArrayLike(value) &&
hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
}
module.exports = isArguments;
/***/ },
/* 67 */
/*!***********************************!*\
!*** ./~/lodash/object/assign.js ***!
\***********************************/
/***/ function(module, exports, __webpack_require__) {
var assignWith = __webpack_require__(/*! ../internal/assignWith */ 476),
baseAssign = __webpack_require__(/*! ../internal/baseAssign */ 216),
createAssigner = __webpack_require__(/*! ../internal/createAssigner */ 226);
/**
* Assigns own enumerable properties of source object(s) to the destination
* object. Subsequent sources overwrite property assignments of previous sources.
* If `customizer` is provided it's invoked to produce the assigned values.
* The `customizer` is bound to `thisArg` and invoked with five arguments:
* (objectValue, sourceValue, key, object, source).
*
* **Note:** This method mutates `object` and is based on
* [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
*
* @static
* @memberOf _
* @alias extend
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @param {Function} [customizer] The function to customize assigned values.
* @param {*} [thisArg] The `this` binding of `customizer`.
* @returns {Object} Returns `object`.
* @example
*
* _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });
* // => { 'user': 'fred', 'age': 40 }
*
* // using a customizer callback
* var defaults = _.partialRight(_.assign, function(value, other) {
* return _.isUndefined(value) ? other : value;
* });
*
* defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
* // => { 'user': 'barney', 'age': 36 }
*/
var assign = createAssigner(function(object, source, customizer) {
return customizer
? assignWith(object, source, customizer)
: baseAssign(object, source);
});
module.exports = assign;
/***/ },
/* 68 */
/*!**********************************!*\
!*** ./~/source-map/lib/util.js ***!
\**********************************/
/***/ function(module, exports) {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
{
/**
* This is a helper function for getting values from parameter/options
* objects.
*
* @param args The object we are extracting values from
* @param name The name of the property we are getting.
* @param defaultValue An optional value to return if the property is missing
* from the object. If this is not specified and the property is missing, an
* error will be thrown.
*/
function getArg(aArgs, aName, aDefaultValue) {
if (aName in aArgs) {
return aArgs[aName];
} else if (arguments.length === 3) {
return aDefaultValue;
} else {
throw new Error('"' + aName + '" is a required argument.');
}
}
exports.getArg = getArg;
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;
var dataUrlRegexp = /^data:.+\,.+$/;
function urlParse(aUrl) {
var match = aUrl.match(urlRegexp);
if (!match) {
return null;
}
return {
scheme: match[1],
auth: match[2],
host: match[3],
port: match[4],
path: match[5]
};
}
exports.urlParse = urlParse;
function urlGenerate(aParsedUrl) {
var url = '';
if (aParsedUrl.scheme) {
url += aParsedUrl.scheme + ':';
}
url += '//';
if (aParsedUrl.auth) {
url += aParsedUrl.auth + '@';
}
if (aParsedUrl.host) {
url += aParsedUrl.host;
}
if (aParsedUrl.port) {
url += ":" + aParsedUrl.port
}
if (aParsedUrl.path) {
url += aParsedUrl.path;
}
return url;
}
exports.urlGenerate = urlGenerate;
/**
* Normalizes a path, or the path portion of a URL:
*
* - Replaces consequtive slashes with one slash.
* - Removes unnecessary '.' parts.
* - Removes unnecessary '<dir>/..' parts.
*
* Based on code in the Node.js 'path' core module.
*
* @param aPath The path or url to normalize.
*/
function normalize(aPath) {
var path = aPath;
var url = urlParse(aPath);
if (url) {
if (!url.path) {
return aPath;
}
path = url.path;
}
var isAbsolute = exports.isAbsolute(path);
var parts = path.split(/\/+/);
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
part = parts[i];
if (part === '.') {
parts.splice(i, 1);
} else if (part === '..') {
up++;
} else if (up > 0) {
if (part === '') {
// The first part is blank if the path is absolute. Trying to go
// above the root is a no-op. Therefore we can remove all '..' parts
// directly after the root.
parts.splice(i + 1, up);
up = 0;
} else {
parts.splice(i, 2);
up--;
}
}
}
path = parts.join('/');
if (path === '') {
path = isAbsolute ? '/' : '.';
}
if (url) {
url.path = path;
return urlGenerate(url);
}
return path;
}
exports.normalize = normalize;
/**
* Joins two paths/URLs.
*
* @param aRoot The root path or URL.
* @param aPath The path or URL to be joined with the root.
*
* - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
* scheme-relative URL: Then the scheme of aRoot, if any, is prepended
* first.
* - Otherwise aPath is a path. If aRoot is a URL, then its path portion
* is updated with the result and aRoot is returned. Otherwise the result
* is returned.
* - If aPath is absolute, the result is aPath.
* - Otherwise the two paths are joined with a slash.
* - Joining for example 'http://' and 'www.example.com' is also supported.
*/
function join(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
if (aPath === "") {
aPath = ".";
}
var aPathUrl = urlParse(aPath);
var aRootUrl = urlParse(aRoot);
if (aRootUrl) {
aRoot = aRootUrl.path || '/';
}
// `join(foo, '//www.example.org')`
if (aPathUrl && !aPathUrl.scheme) {
if (aRootUrl) {
aPathUrl.scheme = aRootUrl.scheme;
}
return urlGenerate(aPathUrl);
}
if (aPathUrl || aPath.match(dataUrlRegexp)) {
return aPath;
}
// `join('http://', 'www.example.com')`
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
aRootUrl.host = aPath;
return urlGenerate(aRootUrl);
}
var joined = aPath.charAt(0) === '/'
? aPath
: normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
if (aRootUrl) {
aRootUrl.path = joined;
return urlGenerate(aRootUrl);
}
return joined;
}
exports.join = join;
exports.isAbsolute = function (aPath) {
return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);
};
/**
* Make a path relative to a URL or another path.
*
* @param aRoot The root path or URL.
* @param aPath The path or URL to be made relative to aRoot.
*/
function relative(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
aRoot = aRoot.replace(/\/$/, '');
// It is possible for the path to be above the root. In this case, simply
// checking whether the root is a prefix of the path won't work. Instead, we
// need to remove components from the root one by one, until either we find
// a prefix that fits, or we run out of components to remove.
var level = 0;
while (aPath.indexOf(aRoot + '/') !== 0) {
var index = aRoot.lastIndexOf("/");
if (index < 0) {
return aPath;
}
// If the only part of the root that is left is the scheme (i.e. http://,
// file:///, etc.), one or more slashes (/), or simply nothing at all, we
// have exhausted all components, so the path is not relative to the root.
aRoot = aRoot.slice(0, index);
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
return aPath;
}
++level;
}
// Make sure we add a "../" for each component we removed from the root.
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
}
exports.relative = relative;
/**
* Because behavior goes wacky when you set `__proto__` on objects, we
* have to prefix all the strings in our set with an arbitrary character.
*
* See https://github.com/mozilla/source-map/pull/31 and
* https://github.com/mozilla/source-map/issues/30
*
* @param String aStr
*/
function toSetString(aStr) {
return '$' + aStr;
}
exports.toSetString = toSetString;
function fromSetString(aStr) {
return aStr.substr(1);
}
exports.fromSetString = fromSetString;
/**
* Comparator between two mappings where the original positions are compared.
*
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
* mappings with the same original source/line/column, but different generated
* line and column the same. Useful when searching for a mapping with a
* stubbed out mapping.
*/
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
var cmp = mappingA.source - mappingB.source;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0 || onlyCompareOriginal) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
return mappingA.name - mappingB.name;
}
exports.compareByOriginalPositions = compareByOriginalPositions;
/**
* Comparator between two mappings with deflated source and name indices where
* the generated positions are compared.
*
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
* mappings with the same generated line and column, but different
* source/name/original line and column the same. Useful when searching for a
* mapping with a stubbed out mapping.
*/
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0 || onlyCompareGenerated) {
return cmp;
}
cmp = mappingA.source - mappingB.source;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return mappingA.name - mappingB.name;
}
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
function strcmp(aStr1, aStr2) {
if (aStr1 === aStr2) {
return 0;
}
if (aStr1 > aStr2) {
return 1;
}
return -1;
}
/**
* Comparator between two mappings with inflated source and name strings where
* the generated positions are compared.
*/
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
}
/***/ },
/* 69 */
/*!***************************************!*\
!*** ./~/to-fast-properties/index.js ***!
\***************************************/
/***/ function(module, exports) {
'use strict';
module.exports = function toFastProperties(obj) {
function f() {}
f.prototype = obj;
new f();
return;
eval(obj);
};
/***/ },
/* 70 */
/*!************************!*\
!*** ./~/util/util.js ***!
\************************/
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var formatRegExp = /%[sdj%]/g;
exports.format = function(f) {
if (!isString(f)) {
var objects = [];
for (var i = 0; i < arguments.length; i++) {
objects.push(inspect(arguments[i]));
}
return objects.join(' ');
}
var i = 1;
var args = arguments;
var len = args.length;
var str = String(f).replace(formatRegExp, function(x) {
if (x === '%%') return '%';
if (i >= len) return x;
switch (x) {
case '%s': return String(args[i++]);
case '%d': return Number(args[i++]);
case '%j':
try {
return JSON.stringify(args[i++]);
} catch (_) {
return '[Circular]';
}
default:
return x;
}
});
for (var x = args[i]; i < len; x = args[++i]) {
if (isNull(x) || !isObject(x)) {
str += ' ' + x;
} else {
str += ' ' + inspect(x);
}
}
return str;
};
// Mark that a method should not be used.
// Returns a modified function which warns once by default.
// If --no-deprecation is set, then it is a no-op.
exports.deprecate = function(fn, msg) {
// Allow for deprecating things in the process of starting up.
if (isUndefined(global.process)) {
return function() {
return exports.deprecate(fn, msg).apply(this, arguments);
};
}
if (process.noDeprecation === true) {
return fn;
}
var warned = false;
function deprecated() {
if (!warned) {
if (process.throwDeprecation) {
throw new Error(msg);
} else if (process.traceDeprecation) {
console.trace(msg);
} else {
console.error(msg);
}
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
};
var debugs = {};
var debugEnviron;
exports.debuglog = function(set) {
if (isUndefined(debugEnviron))
debugEnviron = process.env.NODE_DEBUG || '';
set = set.toUpperCase();
if (!debugs[set]) {
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
var pid = process.pid;
debugs[set] = function() {
var msg = exports.format.apply(exports, arguments);
console.error('%s %d: %s', set, pid, msg);
};
} else {
debugs[set] = function() {};
}
}
return debugs[set];
};
/**
* Echos the value of a value. Trys to print the value out
* in the best way possible given the different types.
*
* @param {Object} obj The object to print out.
* @param {Object} opts Optional options object that alters the output.
*/
/* legacy: obj, showHidden, depth, colors*/
function inspect(obj, opts) {
// default options
var ctx = {
seen: [],
stylize: stylizeNoColor
};
// legacy...
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
// legacy...
ctx.showHidden = opts;
} else if (opts) {
// got an "options" object
exports._extend(ctx, opts);
}
// set default options
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
if (isUndefined(ctx.depth)) ctx.depth = 2;
if (isUndefined(ctx.colors)) ctx.colors = false;
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
if (ctx.colors) ctx.stylize = stylizeWithColor;
return formatValue(ctx, obj, ctx.depth);
}
exports.inspect = inspect;
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
inspect.colors = {
'bold' : [1, 22],
'italic' : [3, 23],
'underline' : [4, 24],
'inverse' : [7, 27],
'white' : [37, 39],
'grey' : [90, 39],
'black' : [30, 39],
'blue' : [34, 39],
'cyan' : [36, 39],
'green' : [32, 39],
'magenta' : [35, 39],
'red' : [31, 39],
'yellow' : [33, 39]
};
// Don't use 'blue' not visible on cmd.exe
inspect.styles = {
'special': 'cyan',
'number': 'yellow',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
'string': 'green',
'date': 'magenta',
// "name": intentionally not styling
'regexp': 'red'
};
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
'\u001b[' + inspect.colors[style][1] + 'm';
} else {
return str;
}
}
function stylizeNoColor(str, styleType) {
return str;
}
function arrayToHash(array) {
var hash = {};
array.forEach(function(val, idx) {
hash[val] = true;
});
return hash;
}
function formatValue(ctx, value, recurseTimes) {
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it
if (ctx.customInspect &&
value &&
isFunction(value.inspect) &&
// Filter out the util module, it's inspect function is special
value.inspect !== exports.inspect &&
// Also filter out any prototype objects using the circular check.
!(value.constructor && value.constructor.prototype === value)) {
var ret = value.inspect(recurseTimes, ctx);
if (!isString(ret)) {
ret = formatValue(ctx, ret, recurseTimes);
}
return ret;
}
// Primitive types cannot have properties
var primitive = formatPrimitive(ctx, value);
if (primitive) {
return primitive;
}
// Look up the keys of the object.
var keys = Object.keys(value);
var visibleKeys = arrayToHash(keys);
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
// IE doesn't make error fields non-enumerable
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
if (isError(value)
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
return formatError(value);
}
// Some type of object without properties can be shortcutted.
if (keys.length === 0) {
if (isFunction(value)) {
var name = value.name ? ': ' + value.name : '';
return ctx.stylize('[Function' + name + ']', 'special');
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
}
if (isDate(value)) {
return ctx.stylize(Date.prototype.toString.call(value), 'date');
}
if (isError(value)) {
return formatError(value);
}
}
var base = '', array = false, braces = ['{', '}'];
// Make Array say that they are Array
if (isArray(value)) {
array = true;
braces = ['[', ']'];
}
// Make functions say that they are functions
if (isFunction(value)) {
var n = value.name ? ': ' + value.name : '';
base = ' [Function' + n + ']';
}
// Make RegExps say that they are RegExps
if (isRegExp(value)) {
base = ' ' + RegExp.prototype.toString.call(value);
}
// Make dates with properties first say the date
if (isDate(value)) {
base = ' ' + Date.prototype.toUTCString.call(value);
}
// Make error with message first say the error
if (isError(value)) {
base = ' ' + formatError(value);
}
if (keys.length === 0 && (!array || value.length == 0)) {
return braces[0] + base + braces[1];
}
if (recurseTimes < 0) {
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
} else {
return ctx.stylize('[Object]', 'special');
}
}
ctx.seen.push(value);
var output;
if (array) {
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
} else {
output = keys.map(function(key) {
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
});
}
ctx.seen.pop();
return reduceToSingleString(output, base, braces);
}
function formatPrimitive(ctx, value) {
if (isUndefined(value))
return ctx.stylize('undefined', 'undefined');
if (isString(value)) {
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
.replace(/'/g, "\\'")
.replace(/\\"/g, '"') + '\'';
return ctx.stylize(simple, 'string');
}
if (isNumber(value))
return ctx.stylize('' + value, 'number');
if (isBoolean(value))
return ctx.stylize('' + value, 'boolean');
// For some reason typeof null is "object", so special case here.
if (isNull(value))
return ctx.stylize('null', 'null');
}
function formatError(value) {
return '[' + Error.prototype.toString.call(value) + ']';
}
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
String(i), true));
} else {
output.push('');
}
}
keys.forEach(function(key) {
if (!key.match(/^\d+$/)) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
key, true));
}
});
return output;
}
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
var name, str, desc;
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
if (desc.get) {
if (desc.set) {
str = ctx.stylize('[Getter/Setter]', 'special');
} else {
str = ctx.stylize('[Getter]', 'special');
}
} else {
if (desc.set) {
str = ctx.stylize('[Setter]', 'special');
}
}
if (!hasOwnProperty(visibleKeys, key)) {
name = '[' + key + ']';
}
if (!str) {
if (ctx.seen.indexOf(desc.value) < 0) {
if (isNull(recurseTimes)) {
str = formatValue(ctx, desc.value, null);
} else {
str = formatValue(ctx, desc.value, recurseTimes - 1);
}
if (str.indexOf('\n') > -1) {
if (array) {
str = str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n').substr(2);
} else {
str = '\n' + str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n');
}
}
} else {
str = ctx.stylize('[Circular]', 'special');
}
}
if (isUndefined(name)) {
if (array && key.match(/^\d+$/)) {
return str;
}
name = JSON.stringify('' + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
name = name.substr(1, name.length - 2);
name = ctx.stylize(name, 'name');
} else {
name = name.replace(/'/g, "\\'")
.replace(/\\"/g, '"')
.replace(/(^"|"$)/g, "'");
name = ctx.stylize(name, 'string');
}
}
return name + ': ' + str;
}
function reduceToSingleString(output, base, braces) {
var numLinesEst = 0;
var length = output.reduce(function(prev, cur) {
numLinesEst++;
if (cur.indexOf('\n') >= 0) numLinesEst++;
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
}, 0);
if (length > 60) {
return braces[0] +
(base === '' ? '' : base + '\n ') +
' ' +
output.join(',\n ') +
' ' +
braces[1];
}
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
}
// NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.
function isArray(ar) {
return Array.isArray(ar);
}
exports.isArray = isArray;
function isBoolean(arg) {
return typeof arg === 'boolean';
}
exports.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === 'number';
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === 'string';
}
exports.isString = isString;
function isSymbol(arg) {
return typeof arg === 'symbol';
}
exports.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined;
function isRegExp(re) {
return isObject(re) && objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
exports.isObject = isObject;
function isDate(d) {
return isObject(d) && objectToString(d) === '[object Date]';
}
exports.isDate = isDate;
function isError(e) {
return isObject(e) &&
(objectToString(e) === '[object Error]' || e instanceof Error);
}
exports.isError = isError;
function isFunction(arg) {
return typeof arg === 'function';
}
exports.isFunction = isFunction;
function isPrimitive(arg) {
return arg === null ||
typeof arg === 'boolean' ||
typeof arg === 'number' ||
typeof arg === 'string' ||
typeof arg === 'symbol' || // ES6 symbol
typeof arg === 'undefined';
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = __webpack_require__(/*! ./support/isBuffer */ 537);
function objectToString(o) {
return Object.prototype.toString.call(o);
}
function pad(n) {
return n < 10 ? '0' + n.toString(10) : n.toString(10);
}
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
'Oct', 'Nov', 'Dec'];
// 26 Feb 16:19:34
function timestamp() {
var d = new Date();
var time = [pad(d.getHours()),
pad(d.getMinutes()),
pad(d.getSeconds())].join(':');
return [d.getDate(), months[d.getMonth()], time].join(' ');
}
// log is just a thin wrapper to console.log that prepends a timestamp
exports.log = function() {
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
};
/**
* Inherit the prototype methods from one constructor into another.
*
* The Function.prototype.inherits from lang.js rewritten as a standalone
* function (not on Function.prototype). NOTE: If this file is to be loaded
* during bootstrapping this function needs to be rewritten using some native
* functions as prototype setup using normal JavaScript does not work as
* expected during bootstrapping (see mirror.js in r114903).
*
* @param {function} ctor Constructor function which needs to inherit the
* prototype.
* @param {function} superCtor Constructor function to inherit prototype from.
*/
exports.inherits = __webpack_require__(/*! inherits */ 460);
exports._extend = function(origin, add) {
// Don't do anything if add isn't an object
if (!add || !isObject(add)) return origin;
var keys = Object.keys(add);
var i = keys.length;
while (i--) {
origin[keys[i]] = add[keys[i]];
}
return origin;
};
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(/*! ./~/process/browser.js */ 18)))
/***/ },
/* 71 */
/*!****************************!*\
!*** ./~/assert/assert.js ***!
\****************************/
/***/ function(module, exports, __webpack_require__) {
// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
//
// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
//
// Originally from narwhal.js (http://narwhaljs.org)
// Copyright (c) 2009 Thomas Robinson <280north.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// when used in node, this will actually load the util module we depend on
// versus loading the builtin util module as happens otherwise
// this is a bug in node module loading as far as I am concerned
var util = __webpack_require__(/*! util/ */ 70);
var pSlice = Array.prototype.slice;
var hasOwn = Object.prototype.hasOwnProperty;
// 1. The assert module provides functions that throw
// AssertionError's when particular conditions are not met. The
// assert module must conform to the following interface.
var assert = module.exports = ok;
// 2. The AssertionError is defined in assert.
// new assert.AssertionError({ message: message,
// actual: actual,
// expected: expected })
assert.AssertionError = function AssertionError(options) {
this.name = 'AssertionError';
this.actual = options.actual;
this.expected = options.expected;
this.operator = options.operator;
if (options.message) {
this.message = options.message;
this.generatedMessage = false;
} else {
this.message = getMessage(this);
this.generatedMessage = true;
}
var stackStartFunction = options.stackStartFunction || fail;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, stackStartFunction);
}
else {
// non v8 browsers so we can have a stacktrace
var err = new Error();
if (err.stack) {
var out = err.stack;
// try to strip useless frames
var fn_name = stackStartFunction.name;
var idx = out.indexOf('\n' + fn_name);
if (idx >= 0) {
// once we have located the function frame
// we need to strip out everything before it (and its line)
var next_line = out.indexOf('\n', idx + 1);
out = out.substring(next_line + 1);
}
this.stack = out;
}
}
};
// assert.AssertionError instanceof Error
util.inherits(assert.AssertionError, Error);
function replacer(key, value) {
if (util.isUndefined(value)) {
return '' + value;
}
if (util.isNumber(value) && !isFinite(value)) {
return value.toString();
}
if (util.isFunction(value) || util.isRegExp(value)) {
return value.toString();
}
return value;
}
function truncate(s, n) {
if (util.isString(s)) {
return s.length < n ? s : s.slice(0, n);
} else {
return s;
}
}
function getMessage(self) {
return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' +
self.operator + ' ' +
truncate(JSON.stringify(self.expected, replacer), 128);
}
// At present only the three keys mentioned above are used and
// understood by the spec. Implementations or sub modules can pass
// other keys to the AssertionError's constructor - they will be
// ignored.
// 3. All of the following functions must throw an AssertionError
// when a corresponding condition is not met, with a message that
// may be undefined if not provided. All assertion methods provide
// both the actual and expected values to the assertion error for
// display purposes.
function fail(actual, expected, message, operator, stackStartFunction) {
throw new assert.AssertionError({
message: message,
actual: actual,
expected: expected,
operator: operator,
stackStartFunction: stackStartFunction
});
}
// EXTENSION! allows for well behaved errors defined elsewhere.
assert.fail = fail;
// 4. Pure assertion tests whether a value is truthy, as determined
// by !!guard.
// assert.ok(guard, message_opt);
// This statement is equivalent to assert.equal(true, !!guard,
// message_opt);. To test strictly for the value true, use
// assert.strictEqual(true, guard, message_opt);.
function ok(value, message) {
if (!value) fail(value, true, message, '==', assert.ok);
}
assert.ok = ok;
// 5. The equality assertion tests shallow, coercive equality with
// ==.
// assert.equal(actual, expected, message_opt);
assert.equal = function equal(actual, expected, message) {
if (actual != expected) fail(actual, expected, message, '==', assert.equal);
};
// 6. The non-equality assertion tests for whether two objects are not equal
// with != assert.notEqual(actual, expected, message_opt);
assert.notEqual = function notEqual(actual, expected, message) {
if (actual == expected) {
fail(actual, expected, message, '!=', assert.notEqual);
}
};
// 7. The equivalence assertion tests a deep equality relation.
// assert.deepEqual(actual, expected, message_opt);
assert.deepEqual = function deepEqual(actual, expected, message) {
if (!_deepEqual(actual, expected)) {
fail(actual, expected, message, 'deepEqual', assert.deepEqual);
}
};
function _deepEqual(actual, expected) {
// 7.1. All identical values are equivalent, as determined by ===.
if (actual === expected) {
return true;
} else if (util.isBuffer(actual) && util.isBuffer(expected)) {
if (actual.length != expected.length) return false;
for (var i = 0; i < actual.length; i++) {
if (actual[i] !== expected[i]) return false;
}
return true;
// 7.2. If the expected value is a Date object, the actual value is
// equivalent if it is also a Date object that refers to the same time.
} else if (util.isDate(actual) && util.isDate(expected)) {
return actual.getTime() === expected.getTime();
// 7.3 If the expected value is a RegExp object, the actual value is
// equivalent if it is also a RegExp object with the same source and
// properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
} else if (util.isRegExp(actual) && util.isRegExp(expected)) {
return actual.source === expected.source &&
actual.global === expected.global &&
actual.multiline === expected.multiline &&
actual.lastIndex === expected.lastIndex &&
actual.ignoreCase === expected.ignoreCase;
// 7.4. Other pairs that do not both pass typeof value == 'object',
// equivalence is determined by ==.
} else if (!util.isObject(actual) && !util.isObject(expected)) {
return actual == expected;
// 7.5 For all other Object pairs, including Array objects, equivalence is
// determined by having the same number of owned properties (as verified
// with Object.prototype.hasOwnProperty.call), the same set of keys
// (although not necessarily the same order), equivalent values for every
// corresponding key, and an identical 'prototype' property. Note: this
// accounts for both named and indexed properties on Arrays.
} else {
return objEquiv(actual, expected);
}
}
function isArguments(object) {
return Object.prototype.toString.call(object) == '[object Arguments]';
}
function objEquiv(a, b) {
if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))
return false;
// an identical 'prototype' property.
if (a.prototype !== b.prototype) return false;
// if one is a primitive, the other must be same
if (util.isPrimitive(a) || util.isPrimitive(b)) {
return a === b;
}
var aIsArgs = isArguments(a),
bIsArgs = isArguments(b);
if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
return false;
if (aIsArgs) {
a = pSlice.call(a);
b = pSlice.call(b);
return _deepEqual(a, b);
}
var ka = objectKeys(a),
kb = objectKeys(b),
key, i;
// having the same number of owned properties (keys incorporates
// hasOwnProperty)
if (ka.length != kb.length)
return false;
//the same set of keys (although not necessarily the same order),
ka.sort();
kb.sort();
//~~~cheap key test
for (i = ka.length - 1; i >= 0; i--) {
if (ka[i] != kb[i])
return false;
}
//equivalent values for every corresponding key, and
//~~~possibly expensive deep test
for (i = ka.length - 1; i >= 0; i--) {
key = ka[i];
if (!_deepEqual(a[key], b[key])) return false;
}
return true;
}
// 8. The non-equivalence assertion tests for any deep inequality.
// assert.notDeepEqual(actual, expected, message_opt);
assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
if (_deepEqual(actual, expected)) {
fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
}
};
// 9. The strict equality assertion tests strict equality, as determined by ===.
// assert.strictEqual(actual, expected, message_opt);
assert.strictEqual = function strictEqual(actual, expected, message) {
if (actual !== expected) {
fail(actual, expected, message, '===', assert.strictEqual);
}
};
// 10. The strict non-equality assertion tests for strict inequality, as
// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
if (actual === expected) {
fail(actual, expected, message, '!==', assert.notStrictEqual);
}
};
function expectedException(actual, expected) {
if (!actual || !expected) {
return false;
}
if (Object.prototype.toString.call(expected) == '[object RegExp]') {
return expected.test(actual);
} else if (actual instanceof expected) {
return true;
} else if (expected.call({}, actual) === true) {
return true;
}
return false;
}
function _throws(shouldThrow, block, expected, message) {
var actual;
if (util.isString(expected)) {
message = expected;
expected = null;
}
try {
block();
} catch (e) {
actual = e;
}
message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
(message ? ' ' + message : '.');
if (shouldThrow && !actual) {
fail(actual, expected, 'Missing expected exception' + message);
}
if (!shouldThrow && expectedException(actual, expected)) {
fail(actual, expected, 'Got unwanted exception' + message);
}
if ((shouldThrow && actual && expected &&
!expectedException(actual, expected)) || (!shouldThrow && actual)) {
throw actual;
}
}
// 11. Expected to throw an error:
// assert.throws(block, Error_opt, message_opt);
assert.throws = function(block, /*optional*/error, /*optional*/message) {
_throws.apply(this, [true].concat(pSlice.call(arguments)));
};
// EXTENSION! This is annoying to write outside this module.
assert.doesNotThrow = function(block, /*optional*/message) {
_throws.apply(this, [false].concat(pSlice.call(arguments)));
};
assert.ifError = function(err) { if (err) {throw err;}};
var objectKeys = Object.keys || function (obj) {
var keys = [];
for (var key in obj) {
if (hasOwn.call(obj, key)) keys.push(key);
}
return keys;
};
/***/ },
/* 72 */
/*!***************************************************!*\
!*** ./~/babel-core/lib/transformation/plugin.js ***!
\***************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _inherits = __webpack_require__(/*! babel-runtime/helpers/inherits */ 35)["default"];
var _classCallCheck = __webpack_require__(/*! babel-runtime/helpers/class-call-check */ 5)["default"];
var _getIterator = __webpack_require__(/*! babel-runtime/core-js/get-iterator */ 4)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _fileOptionsOptionManager = __webpack_require__(/*! ./file/options/option-manager */ 50);
var _fileOptionsOptionManager2 = _interopRequireDefault(_fileOptionsOptionManager);
var _babelMessages = __webpack_require__(/*! babel-messages */ 19);
var messages = _interopRequireWildcard(_babelMessages);
var _store = __webpack_require__(/*! ../store */ 102);
var _store2 = _interopRequireDefault(_store);
var _babelTraverse = __webpack_require__(/*! babel-traverse */ 6);
var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
var _lodashObjectAssign = __webpack_require__(/*! lodash/object/assign */ 67);
var _lodashObjectAssign2 = _interopRequireDefault(_lodashObjectAssign);
var _lodashLangClone = __webpack_require__(/*! lodash/lang/clone */ 34);
var _lodashLangClone2 = _interopRequireDefault(_lodashLangClone);
var GLOBAL_VISITOR_PROPS = ["enter", "exit"];
var Plugin = (function (_Store) {
_inherits(Plugin, _Store);
function Plugin(plugin, key) {
_classCallCheck(this, Plugin);
_Store.call(this);
this.initialized = false;
this.raw = _lodashObjectAssign2["default"]({}, plugin);
this.key = key;
this.manipulateOptions = this.take("manipulateOptions");
this.post = this.take("post");
this.pre = this.take("pre");
this.visitor = this.normaliseVisitor(_lodashLangClone2["default"](this.take("visitor")) || {});
}
Plugin.prototype.take = function take(key) {
var val = this.raw[key];
delete this.raw[key];
return val;
};
Plugin.prototype.chain = function chain(target, key) {
if (!target[key]) return this[key];
if (!this[key]) return target[key];
var fns = [target[key], this[key]];
return function () {
var val = undefined;
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
for (var _i = 0; _i < fns.length; _i++) {
var fn = fns[_i];
if (fn) {
var ret = fn.apply(this, args);
if (ret != null) val = ret;
}
}
return val;
};
};
Plugin.prototype.maybeInherit = function maybeInherit(loc) {
var inherits = this.take("inherits");
if (!inherits) return;
inherits = _fileOptionsOptionManager2["default"].normalisePlugin(inherits, loc, "inherits");
this.manipulateOptions = this.chain(inherits, "manipulateOptions");
this.post = this.chain(inherits, "post");
this.pre = this.chain(inherits, "pre");
this.visitor = _babelTraverse2["default"].visitors.merge([inherits.visitor, this.visitor]);
};
/**
* We lazy initialise parts of a plugin that rely on contextual information such as
* position on disk and how it was specified.
*/
Plugin.prototype.init = function init(loc, i) {
if (this.initialized) return;
this.initialized = true;
this.maybeInherit(loc);
for (var key in this.raw) {
throw new Error(messages.get("pluginInvalidProperty", loc, i, key));
}
};
Plugin.prototype.normaliseVisitor = function normaliseVisitor(visitor) {
for (var _iterator = GLOBAL_VISITOR_PROPS, _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) {
var _ref;
if (_isArray) {
if (_i2 >= _iterator.length) break;
_ref = _iterator[_i2++];
} else {
_i2 = _iterator.next();
if (_i2.done) break;
_ref = _i2.value;
}
var key = _ref;
if (visitor[key]) {
throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. Please target individual nodes.");
}
}
_babelTraverse2["default"].explode(visitor);
return visitor;
};
return Plugin;
})(_store2["default"]);
exports["default"] = Plugin;
module.exports = exports["default"];
/***/ },
/* 73 */
/*!************************************************************!*\
!*** ./~/babel-plugin-check-es2015-constants/lib/index.js ***!
\************************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function (_ref) {
var messages = _ref.messages;
return {
visitor: {
Scope: function Scope(_ref2) {
var scope = _ref2.scope;
for (var _name in scope.bindings) {
var binding = scope.bindings[_name];
if (binding.kind !== "const" && binding.kind !== "module") continue;
var _arr = binding.constantViolations;
for (var _i = 0; _i < _arr.length; _i++) {
var violation = _arr[_i];
throw violation.buildCodeFrameError(messages.get("readOnly", _name));
}
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 74 */
/*!************************************************************!*\
!*** ./~/babel-plugin-syntax-async-functions/lib/index.js ***!
\************************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("asyncFunctions");
}
};
};
module.exports = exports["default"];
/***/ },
/* 75 */
/*!**********************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-arrow-functions/lib/index.js ***!
\**********************************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function (_ref) {
var t = _ref.types;
return {
visitor: {
ArrowFunctionExpression: function ArrowFunctionExpression(path, state) {
if (state.opts.spec) {
var node = path.node;
if (node.shadow) return;
node.shadow = { "this": false };
node.type = "FunctionExpression";
var boundThis = t.thisExpression();
boundThis._forceShadow = path;
// make sure that arrow function won't be instantiated
path.ensureBlock();
path.get("body").unshiftContainer("body", t.expressionStatement(t.callExpression(state.addHelper("newArrowCheck"), [t.thisExpression(), boundThis])));
path.replaceWith(t.callExpression(t.memberExpression(node, t.identifier("bind")), [t.thisExpression()]));
} else {
path.arrowFunctionToShadowed();
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 76 */
/*!*****************************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-block-scoped-functions/lib/index.js ***!
\*****************************************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function (_ref) {
var t = _ref.types;
function statementList(key, path) {
var paths = path.get(key);
for (var _i = 0; _i < paths.length; _i++) {
var _path = paths[_i];
var func = _path.node;
if (!_path.isFunctionDeclaration()) continue;
var declar = t.variableDeclaration("let", [t.variableDeclarator(func.id, t.toExpression(func))]);
// hoist it up above everything else
declar._blockHoist = 2;
// todo: name this
func.id = null;
_path.replaceWith(declar);
}
}
return {
visitor: {
BlockStatement: function BlockStatement(path) {
var node = path.node;
var parent = path.parent;
if (t.isFunction(parent, { body: node }) || t.isExportDeclaration(parent)) {
return;
}
statementList("body", path);
},
SwitchCase: function SwitchCase(path) {
statementList("consequent", path);
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 77 */
/*!********************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-block-scoping/lib/index.js ***!
\********************************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _classCallCheck = __webpack_require__(/*! babel-runtime/helpers/class-call-check */ 5)["default"];
var _Object$create = __webpack_require__(/*! babel-runtime/core-js/object/create */ 10)["default"];
var _Symbol = __webpack_require__(/*! babel-runtime/core-js/symbol */ 16)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelTraverse = __webpack_require__(/*! babel-traverse */ 6);
var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
var _tdz = __webpack_require__(/*! ./tdz */ 305);
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
var _lodashObjectValues = __webpack_require__(/*! lodash/object/values */ 233);
var _lodashObjectValues2 = _interopRequireDefault(_lodashObjectValues);
var _lodashObjectExtend = __webpack_require__(/*! lodash/object/extend */ 511);
var _lodashObjectExtend2 = _interopRequireDefault(_lodashObjectExtend);
var _babelTemplate = __webpack_require__(/*! babel-template */ 9);
var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
exports["default"] = function () {
return {
visitor: {
VariableDeclaration: function VariableDeclaration(path, file) {
var node = path.node;
var parent = path.parent;
var scope = path.scope;
if (!isBlockScoped(node)) return;
convertBlockScopedToVar(path, parent, scope, true);
if (node._tdzThis) {
var nodes = [node];
for (var i = 0; i < node.declarations.length; i++) {
var decl = node.declarations[i];
if (decl.init) {
var assign = t.assignmentExpression("=", decl.id, decl.init);
assign._ignoreBlockScopingTDZ = true;
nodes.push(t.expressionStatement(assign));
}
decl.init = file.addHelper("temporalUndefined");
}
node._blockHoist = 2;
if (path.isCompletionRecord()) {
// ensure we don't break completion record semantics by returning
// the initialiser of the last declarator
nodes.push(t.expressionStatement(scope.buildUndefinedNode()));
}
path.replaceWithMultiple(nodes);
}
},
Loop: function Loop(path, file) {
var node = path.node;
var parent = path.parent;
var scope = path.scope;
t.ensureBlock(node);
var blockScoping = new BlockScoping(path, path.get("body"), parent, scope, file);
var replace = blockScoping.run();
if (replace) path.replaceWith(replace);
},
"BlockStatement|Program": function BlockStatementProgram(path, file) {
if (!t.isLoop(path.parent)) {
var blockScoping = new BlockScoping(null, path, path.parent, path.scope, file);
blockScoping.run();
}
}
}
};
};
var buildRetCheck = _babelTemplate2["default"]("\n if (typeof RETURN === \"object\") return RETURN.v;\n");
function isBlockScoped(node) {
if (!t.isVariableDeclaration(node)) return false;
if (node[t.BLOCK_SCOPED_SYMBOL]) return true;
if (node.kind !== "let" && node.kind !== "const") return false;
return true;
}
function convertBlockScopedToVar(path, parent, scope) {
var moveBindingsToParent = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
var node = path.node;
// https://github.com/babel/babel/issues/255
if (!t.isFor(parent)) {
for (var i = 0; i < node.declarations.length; i++) {
var declar = node.declarations[i];
declar.init = declar.init || scope.buildUndefinedNode();
}
}
node[t.BLOCK_SCOPED_SYMBOL] = true;
node.kind = "var";
// Move bindings from current block scope to function scope.
if (moveBindingsToParent) {
var parentScope = scope.getFunctionParent();
var ids = path.getBindingIdentifiers();
for (var _name in ids) {
var binding = scope.getOwnBinding(_name);
if (binding) binding.kind = "var";
scope.moveBindingTo(_name, parentScope);
}
}
}
function isVar(node) {
return t.isVariableDeclaration(node, { kind: "var" }) && !isBlockScoped(node);
}
function replace(path, node, scope, remaps) {
var remap = remaps[node.name];
if (!remap) return;
var ownBinding = scope.getBindingIdentifier(node.name);
if (ownBinding === remap.binding) {
scope.rename(node.name, remap.uid);
} else {
// scope already has it's own binding that doesn't
// match the one we have a stored replacement for
if (path) path.skip();
}
}
var replaceVisitor = {
ReferencedIdentifier: function ReferencedIdentifier(path, remaps) {
replace(path, path.node, path.scope, remaps);
},
AssignmentExpression: function AssignmentExpression(path, remaps) {
var ids = path.getBindingIdentifiers();
for (var _name2 in ids) {
replace(null, ids[_name2], path.scope, remaps);
}
}
};
function traverseReplace(node, parent, scope, remaps) {
if (t.isIdentifier(node)) {
replace(node, parent, scope, remaps);
}
if (t.isAssignmentExpression(node)) {
var ids = t.getBindingIdentifiers(node);
for (var _name3 in ids) {
replace(ids[_name3], parent, scope, remaps);
}
}
scope.traverse(node, replaceVisitor, remaps);
}
var letReferenceBlockVisitor = _babelTraverse2["default"].visitors.merge([{
Function: function Function(path, state) {
path.traverse(letReferenceFunctionVisitor, state);
return path.skip();
}
}, _tdz.visitor]);
var letReferenceFunctionVisitor = _babelTraverse2["default"].visitors.merge([{
ReferencedIdentifier: function ReferencedIdentifier(path, state) {
var ref = state.letReferences[path.node.name];
// not a part of our scope
if (!ref) return;
// this scope has a variable with the same name so it couldn't belong
// to our let scope
var localBinding = path.scope.getBindingIdentifier(path.node.name);
if (localBinding && localBinding !== ref) return;
state.closurify = true;
}
}, _tdz.visitor]);
var hoistVarDeclarationsVisitor = {
enter: function enter(path, self) {
var node = path.node;
var parent = path.parent;
if (path.isForStatement()) {
if (isVar(node.init, node)) {
var nodes = self.pushDeclar(node.init);
if (nodes.length === 1) {
node.init = nodes[0];
} else {
node.init = t.sequenceExpression(nodes);
}
}
} else if (path.isFor()) {
if (isVar(node.left, node)) {
self.pushDeclar(node.left);
node.left = node.left.declarations[0].id;
}
} else if (isVar(node, parent)) {
path.replaceWithMultiple(self.pushDeclar(node).map(function (expr) {
return t.expressionStatement(expr);
}));
} else if (path.isFunction()) {
return path.skip();
}
}
};
var loopLabelVisitor = {
LabeledStatement: function LabeledStatement(_ref, state) {
var node = _ref.node;
state.innerLabels.push(node.label.name);
}
};
var continuationVisitor = {
enter: function enter(path, state) {
if (path.isAssignmentExpression() || path.isUpdateExpression()) {
var bindings = path.getBindingIdentifiers();
for (var _name4 in bindings) {
if (state.outsideReferences[_name4] !== path.scope.getBindingIdentifier(_name4)) continue;
state.reassignments[_name4] = true;
}
}
}
};
function loopNodeTo(node) {
if (t.isBreakStatement(node)) {
return "break";
} else if (t.isContinueStatement(node)) {
return "continue";
}
}
var loopVisitor = {
Loop: function Loop(path, state) {
var oldIgnoreLabeless = state.ignoreLabeless;
state.ignoreLabeless = true;
path.traverse(loopVisitor, state);
state.ignoreLabeless = oldIgnoreLabeless;
path.skip();
},
Function: function Function(path) {
path.skip();
},
SwitchCase: function SwitchCase(path, state) {
var oldInSwitchCase = state.inSwitchCase;
state.inSwitchCase = true;
path.traverse(loopVisitor, state);
state.inSwitchCase = oldInSwitchCase;
path.skip();
},
"BreakStatement|ContinueStatement|ReturnStatement": function BreakStatementContinueStatementReturnStatement(path, state) {
var node = path.node;
var parent = path.parent;
var scope = path.scope;
if (node[this.LOOP_IGNORE]) return;
var replace = undefined;
var loopText = loopNodeTo(node);
if (loopText) {
if (node.label) {
// we shouldn't be transforming this because it exists somewhere inside
if (state.innerLabels.indexOf(node.label.name) >= 0) {
return;
}
loopText = loopText + "|" + node.label.name;
} else {
// we shouldn't be transforming these statements because
// they don't refer to the actual loop we're scopifying
if (state.ignoreLabeless) return;
//
if (state.inSwitchCase) return;
// break statements mean something different in this context
if (t.isBreakStatement(node) && t.isSwitchCase(parent)) return;
}
state.hasBreakContinue = true;
state.map[loopText] = node;
replace = t.stringLiteral(loopText);
}
if (path.isReturnStatement()) {
state.hasReturn = true;
replace = t.objectExpression([t.objectProperty(t.identifier("v"), node.argument || scope.buildUndefinedNode())]);
}
if (replace) {
replace = t.returnStatement(replace);
replace[this.LOOP_IGNORE] = true;
path.skip();
path.replaceWith(t.inherits(replace, node));
}
}
};
var BlockScoping = (function () {
function BlockScoping(loopPath, blockPath, parent, scope, file) {
_classCallCheck(this, BlockScoping);
this.parent = parent;
this.scope = scope;
this.file = file;
this.blockPath = blockPath;
this.block = blockPath.node;
this.outsideLetReferences = _Object$create(null);
this.hasLetReferences = false;
this.letReferences = _Object$create(null);
this.body = [];
if (loopPath) {
this.loopParent = loopPath.parent;
this.loopLabel = t.isLabeledStatement(this.loopParent) && this.loopParent.label;
this.loopPath = loopPath;
this.loop = loopPath.node;
}
}
/**
* Start the ball rolling.
*/
BlockScoping.prototype.run = function run() {
var block = this.block;
if (block._letDone) return;
block._letDone = true;
var needsClosure = this.getLetReferences();
// this is a block within a `Function/Program` so we can safely leave it be
if (t.isFunction(this.parent) || t.isProgram(this.block)) {
this.updateScopeInfo();
return;
}
// we can skip everything
if (!this.hasLetReferences) return;
if (needsClosure) {
this.wrapClosure();
} else {
this.remap();
}
this.updateScopeInfo();
if (this.loopLabel && !t.isLabeledStatement(this.loopParent)) {
return t.labeledStatement(this.loopLabel, this.loop);
}
};
BlockScoping.prototype.updateScopeInfo = function updateScopeInfo() {
var scope = this.scope;
var parentScope = scope.getFunctionParent();
var letRefs = this.letReferences;
for (var key in letRefs) {
var ref = letRefs[key];
var binding = scope.getBinding(ref.name);
if (!binding) continue;
if (binding.kind === "let" || binding.kind === "const") {
binding.kind = "var";
scope.moveBindingTo(ref.name, parentScope);
}
}
};
BlockScoping.prototype.remap = function remap() {
var hasRemaps = false;
var letRefs = this.letReferences;
var scope = this.scope;
// alright, so since we aren't wrapping this block in a closure
// we have to check if any of our let variables collide with
// those in upper scopes and then if they do, generate a uid
// for them and replace all references with it
var remaps = _Object$create(null);
for (var key in letRefs) {
// just an Identifier node we collected in `getLetReferences`
// this is the defining identifier of a declaration
var ref = letRefs[key];
// todo: could skip this if the colliding binding is in another function
if (scope.parentHasBinding(key) || scope.hasGlobal(key)) {
var uid = scope.generateUidIdentifier(ref.name).name;
ref.name = uid;
hasRemaps = true;
remaps[key] = remaps[uid] = {
binding: ref,
uid: uid
};
}
}
if (!hasRemaps) return;
//
var loop = this.loop;
if (loop) {
traverseReplace(loop.right, loop, scope, remaps);
traverseReplace(loop.test, loop, scope, remaps);
traverseReplace(loop.update, loop, scope, remaps);
}
this.blockPath.traverse(replaceVisitor, remaps);
};
BlockScoping.prototype.wrapClosure = function wrapClosure() {
var block = this.block;
var outsideRefs = this.outsideLetReferences;
// remap loop heads with colliding variables
if (this.loop) {
for (var _name5 in outsideRefs) {
var id = outsideRefs[_name5];
if (this.scope.hasGlobal(id.name) || this.scope.parentHasBinding(id.name)) {
delete outsideRefs[id.name];
delete this.letReferences[id.name];
this.scope.rename(id.name);
this.letReferences[id.name] = id;
outsideRefs[id.name] = id;
}
}
}
// if we're inside of a for loop then we search to see if there are any
// `break`s, `continue`s, `return`s etc
this.has = this.checkLoop();
// hoist let references to retain scope
this.hoistVarDeclarations();
// turn outsideLetReferences into an array
var params = _lodashObjectValues2["default"](outsideRefs);
var args = _lodashObjectValues2["default"](outsideRefs);
// build the closure that we're going to wrap the block with
var fn = t.functionExpression(null, params, t.blockStatement(block.body));
fn.shadow = true;
// continuation
this.addContinuations(fn);
// replace the current block body with the one we're going to build
block.body = this.body;
var ref = fn;
if (this.loop) {
ref = this.scope.generateUidIdentifier("loop");
this.loopPath.insertBefore(t.variableDeclaration("var", [t.variableDeclarator(ref, fn)]));
}
// build a call and a unique id that we can assign the return value to
var call = t.callExpression(ref, args);
var ret = this.scope.generateUidIdentifier("ret");
// handle generators
var hasYield = _babelTraverse2["default"].hasType(fn.body, this.scope, "YieldExpression", t.FUNCTION_TYPES);
if (hasYield) {
fn.generator = true;
call = t.yieldExpression(call, true);
}
// handlers async functions
var hasAsync = _babelTraverse2["default"].hasType(fn.body, this.scope, "AwaitExpression", t.FUNCTION_TYPES);
if (hasAsync) {
fn.async = true;
call = t.awaitExpression(call);
}
this.buildClosure(ret, call);
};
/**
* Push the closure to the body.
*/
BlockScoping.prototype.buildClosure = function buildClosure(ret, call) {
var has = this.has;
if (has.hasReturn || has.hasBreakContinue) {
this.buildHas(ret, call);
} else {
this.body.push(t.expressionStatement(call));
}
};
/**
* If any of the outer let variables are reassigned then we need to rename them in
* the closure so we can get direct access to the outer variable to continue the
* iteration with bindings based on each iteration.
*
* Reference: https://github.com/babel/babel/issues/1078
*/
BlockScoping.prototype.addContinuations = function addContinuations(fn) {
var state = {
reassignments: {},
outsideReferences: this.outsideLetReferences
};
this.scope.traverse(fn, continuationVisitor, state);
for (var i = 0; i < fn.params.length; i++) {
var param = fn.params[i];
if (!state.reassignments[param.name]) continue;
var newParam = this.scope.generateUidIdentifier(param.name);
fn.params[i] = newParam;
this.scope.rename(param.name, newParam.name, fn);
// assign outer reference as it's been modified internally and needs to be retained
fn.body.body.push(t.expressionStatement(t.assignmentExpression("=", param, newParam)));
}
};
BlockScoping.prototype.getLetReferences = function getLetReferences() {
var block = this.block;
var declarators = [];
if (this.loop) {
var init = this.loop.left || this.loop.init;
if (isBlockScoped(init)) {
declarators.push(init);
_lodashObjectExtend2["default"](this.outsideLetReferences, t.getBindingIdentifiers(init));
}
}
//
if (block.body) {
for (var i = 0; i < block.body.length; i++) {
var declar = block.body[i];
if (t.isClassDeclaration(declar) || t.isFunctionDeclaration(declar) || isBlockScoped(declar)) {
var declarPath = this.blockPath.get("body")[i];
if (isBlockScoped(declar)) {
convertBlockScopedToVar(declarPath, block, this.scope);
}
declarators = declarators.concat(declar.declarations || declar);
}
}
}
//
for (var i = 0; i < declarators.length; i++) {
var declar = declarators[i];
var keys = t.getBindingIdentifiers(declar);
_lodashObjectExtend2["default"](this.letReferences, keys);
this.hasLetReferences = true;
}
// no let references so we can just quit
if (!this.hasLetReferences) return;
var state = {
letReferences: this.letReferences,
closurify: false,
file: this.file
};
// traverse through this block, stopping on functions and checking if they
// contain any local let references
this.blockPath.traverse(letReferenceBlockVisitor, state);
return state.closurify;
};
/**
* If we're inside of a loop then traverse it and check if it has one of
* the following node types `ReturnStatement`, `BreakStatement`,
* `ContinueStatement` and replace it with a return value that we can track
* later on.
*/
BlockScoping.prototype.checkLoop = function checkLoop() {
var state = {
hasBreakContinue: false,
ignoreLabeless: false,
inSwitchCase: false,
innerLabels: [],
hasReturn: false,
isLoop: !!this.loop,
map: {},
LOOP_IGNORE: _Symbol()
};
this.blockPath.traverse(loopLabelVisitor, state);
this.blockPath.traverse(loopVisitor, state);
return state;
};
/**
* Hoist all let declarations in this block to before it so they retain scope
* once we wrap everything in a closure.
*/
BlockScoping.prototype.hoistVarDeclarations = function hoistVarDeclarations() {
this.blockPath.traverse(hoistVarDeclarationsVisitor, this);
};
/**
* Turn a `VariableDeclaration` into an array of `AssignmentExpressions` with
* their declarations hoisted to before the closure wrapper.
*/
BlockScoping.prototype.pushDeclar = function pushDeclar(node) {
var declars = [];
var names = t.getBindingIdentifiers(node);
for (var _name6 in names) {
declars.push(t.variableDeclarator(names[_name6]));
}
this.body.push(t.variableDeclaration(node.kind, declars));
var replace = [];
for (var i = 0; i < node.declarations.length; i++) {
var declar = node.declarations[i];
if (!declar.init) continue;
var expr = t.assignmentExpression("=", declar.id, declar.init);
replace.push(t.inherits(expr, declar));
}
return replace;
};
BlockScoping.prototype.buildHas = function buildHas(ret, call) {
var body = this.body;
body.push(t.variableDeclaration("var", [t.variableDeclarator(ret, call)]));
var retCheck = undefined;
var has = this.has;
var cases = [];
if (has.hasReturn) {
// typeof ret === "object"
retCheck = buildRetCheck({
RETURN: ret
});
}
if (has.hasBreakContinue) {
for (var key in has.map) {
cases.push(t.switchCase(t.stringLiteral(key), [has.map[key]]));
}
if (has.hasReturn) {
cases.push(t.switchCase(null, [retCheck]));
}
if (cases.length === 1) {
var single = cases[0];
body.push(t.ifStatement(t.binaryExpression("===", ret, single.test), single.consequent[0]));
} else {
// https://github.com/babel/babel/issues/998
for (var i = 0; i < cases.length; i++) {
var caseConsequent = cases[i].consequent[0];
if (t.isBreakStatement(caseConsequent) && !caseConsequent.label) {
caseConsequent.label = this.loopLabel = this.loopLabel || this.scope.generateUidIdentifier("loop");
}
}
body.push(t.switchStatement(ret, cases));
}
} else {
if (has.hasReturn) {
body.push(retCheck);
}
}
};
return BlockScoping;
})();
module.exports = exports["default"];
/***/ },
/* 78 */
/*!**************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-classes/lib/index.js ***!
\**************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _Symbol = __webpack_require__(/*! babel-runtime/core-js/symbol */ 16)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
var _loose = __webpack_require__(/*! ./loose */ 306);
var _loose2 = _interopRequireDefault(_loose);
var _vanilla = __webpack_require__(/*! ./vanilla */ 174);
var _vanilla2 = _interopRequireDefault(_vanilla);
var _babelHelperFunctionName = __webpack_require__(/*! babel-helper-function-name */ 51);
var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName);
exports["default"] = function (_ref) {
var t = _ref.types;
// todo: investigate traversal requeueing
var VISITED = _Symbol();
return {
visitor: {
ExportDefaultDeclaration: function ExportDefaultDeclaration(path) {
if (!path.get("declaration").isClassDeclaration()) return;
var node = path.node;
var ref = node.declaration.id || path.scope.generateUidIdentifier("class");
node.declaration.id = ref;
// Split the class declaration and the export into two separate statements.
path.replaceWith(node.declaration);
path.insertAfter(t.exportDefaultDeclaration(ref));
},
ClassDeclaration: function ClassDeclaration(path) {
var node = path.node;
var ref = node.id || path.scope.generateUidIdentifier("class");
path.replaceWith(t.variableDeclaration("let", [t.variableDeclarator(ref, t.toExpression(node))]));
},
ClassExpression: function ClassExpression(path, state) {
var node = path.node;
if (node[VISITED]) return;
var inferred = _babelHelperFunctionName2["default"](path);
if (inferred && inferred !== node) return path.replaceWith(inferred);
node[VISITED] = true;
var Constructor = _vanilla2["default"];
if (state.opts.loose) Constructor = _loose2["default"];
path.replaceWith(new Constructor(path, state.file).run());
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 79 */
/*!**************************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-computed-properties/lib/index.js ***!
\**************************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _getIterator = __webpack_require__(/*! babel-runtime/core-js/get-iterator */ 4)["default"];
exports.__esModule = true;
exports["default"] = function (_ref4) {
var t = _ref4.types;
var template = _ref4.template;
var buildMutatorMapAssign = template("\n MUTATOR_MAP_REF[KEY] = MUTATOR_MAP_REF[KEY] || {};\n MUTATOR_MAP_REF[KEY].KIND = VALUE;\n ");
function getValue(prop) {
if (t.isObjectProperty(prop)) {
return prop.value;
} else if (t.isObjectMethod(prop)) {
return t.functionExpression(null, prop.params, prop.body, prop.generator, prop.async);
}
}
function pushAssign(objId, prop, body) {
if (prop.kind === "get" && prop.kind === "set") {
pushMutatorDefine(objId, prop, body);
} else {
body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(objId, prop.key, prop.computed || t.isLiteral(prop.key)), getValue(prop))));
}
}
function pushMutatorDefine(_ref5, prop) {
var objId = _ref5.objId;
var body = _ref5.body;
var getMutatorId = _ref5.getMutatorId;
var scope = _ref5.scope;
var key = !prop.computed && t.isIdentifier(prop.key) ? t.stringLiteral(prop.key.name) : prop.key;
var maybeMemoise = scope.maybeGenerateMemoised(key);
if (maybeMemoise) {
body.push(t.expressionStatement(t.assignmentExpression("=", maybeMemoise, key)));
key = maybeMemoise;
}
body.push.apply(body, buildMutatorMapAssign({
MUTATOR_MAP_REF: getMutatorId(),
KEY: key,
VALUE: getValue(prop),
KIND: t.identifier(prop.kind)
}));
}
function loose(info) {
for (var _iterator = info.computedProps, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var prop = _ref;
if (prop.kind === "get" || prop.kind === "set") {
pushMutatorDefine(info, prop);
} else {
pushAssign(info.objId, prop, info.body);
}
}
}
function spec(info) {
var objId = info.objId;
var body = info.body;
var computedProps = info.computedProps;
var state = info.state;
for (var _iterator2 = computedProps, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _getIterator(_iterator2);;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var prop = _ref2;
var key = t.toComputedKey(prop);
if (prop.kind === "get" || prop.kind === "set") {
pushMutatorDefine(info, prop);
} else if (t.isStringLiteral(key, { value: "__proto__" })) {
pushAssign(objId, prop, body);
} else {
if (computedProps.length === 1) {
return t.callExpression(state.addHelper("defineProperty"), [info.initPropExpression, key, getValue(prop)]);
} else {
body.push(t.expressionStatement(t.callExpression(state.addHelper("defineProperty"), [objId, key, getValue(prop)])));
}
}
}
}
return {
visitor: {
ObjectExpression: {
exit: function exit(path, state) {
var node = path.node;
var parent = path.parent;
var scope = path.scope;
var hasComputed = false;
var _arr = node.properties;
for (var _i3 = 0; _i3 < _arr.length; _i3++) {
var prop = _arr[_i3];
hasComputed = prop.computed === true;
if (hasComputed) break;
}
if (!hasComputed) return;
// put all getters/setters into the first object expression as well as all initialisers up
// to the first computed property
var initProps = [];
var computedProps = [];
var foundComputed = false;
for (var _iterator3 = node.properties, _isArray3 = Array.isArray(_iterator3), _i4 = 0, _iterator3 = _isArray3 ? _iterator3 : _getIterator(_iterator3);;) {
var _ref3;
if (_isArray3) {
if (_i4 >= _iterator3.length) break;
_ref3 = _iterator3[_i4++];
} else {
_i4 = _iterator3.next();
if (_i4.done) break;
_ref3 = _i4.value;
}
var prop = _ref3;
if (prop.computed) {
foundComputed = true;
}
if (foundComputed) {
computedProps.push(prop);
} else {
initProps.push(prop);
}
}
var objId = scope.generateUidIdentifierBasedOnNode(parent);
var initPropExpression = t.objectExpression(initProps);
var body = [];
body.push(t.variableDeclaration("var", [t.variableDeclarator(objId, initPropExpression)]));
var callback = spec;
if (state.opts.loose) callback = loose;
var mutatorRef = undefined;
var getMutatorId = function getMutatorId() {
if (!mutatorRef) {
mutatorRef = scope.generateUidIdentifier("mutatorMap");
body.push(t.variableDeclaration("var", [t.variableDeclarator(mutatorRef, t.objectExpression([]))]));
}
return mutatorRef;
};
var single = callback({
scope: scope,
objId: objId,
body: body,
computedProps: computedProps,
initPropExpression: initPropExpression,
getMutatorId: getMutatorId,
state: state
});
if (mutatorRef) {
body.push(t.expressionStatement(t.callExpression(state.addHelper("defineEnumerableProperties"), [objId, mutatorRef])));
}
if (single) {
path.replaceWith(single);
} else {
body.push(t.expressionStatement(objId));
path.replaceWithMultiple(body);
}
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 80 */
/*!********************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-destructuring/lib/index.js ***!
\********************************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _classCallCheck = __webpack_require__(/*! babel-runtime/helpers/class-call-check */ 5)["default"];
exports.__esModule = true;
exports["default"] = function (_ref) {
var t = _ref.types;
/**
* Test if a VariableDeclaration's declarations contains any Patterns.
*/
function variableDeclarationHasPattern(node) {
var _arr = node.declarations;
for (var _i = 0; _i < _arr.length; _i++) {
var declar = _arr[_i];
if (t.isPattern(declar.id)) {
return true;
}
}
return false;
}
/**
* Test if an ArrayPattern's elements contain any RestElements.
*/
function hasRest(pattern) {
var _arr2 = pattern.elements;
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
var elem = _arr2[_i2];
if (t.isRestElement(elem)) {
return true;
}
}
return false;
}
var arrayUnpackVisitor = {
ReferencedIdentifier: function ReferencedIdentifier(path, state) {
if (state.bindings[path.node.name]) {
state.deopt = true;
path.stop();
}
}
};
var DestructuringTransformer = (function () {
function DestructuringTransformer(opts) {
_classCallCheck(this, DestructuringTransformer);
this.blockHoist = opts.blockHoist;
this.operator = opts.operator;
this.arrays = {};
this.nodes = opts.nodes || [];
this.scope = opts.scope;
this.file = opts.file;
this.kind = opts.kind;
}
DestructuringTransformer.prototype.buildVariableAssignment = function buildVariableAssignment(id, init) {
var op = this.operator;
if (t.isMemberExpression(id)) op = "=";
var node = undefined;
if (op) {
node = t.expressionStatement(t.assignmentExpression(op, id, init));
} else {
node = t.variableDeclaration(this.kind, [t.variableDeclarator(id, init)]);
}
node._blockHoist = this.blockHoist;
return node;
};
DestructuringTransformer.prototype.buildVariableDeclaration = function buildVariableDeclaration(id, init) {
var declar = t.variableDeclaration("var", [t.variableDeclarator(id, init)]);
declar._blockHoist = this.blockHoist;
return declar;
};
DestructuringTransformer.prototype.push = function push(id, init) {
if (t.isObjectPattern(id)) {
this.pushObjectPattern(id, init);
} else if (t.isArrayPattern(id)) {
this.pushArrayPattern(id, init);
} else if (t.isAssignmentPattern(id)) {
this.pushAssignmentPattern(id, init);
} else {
this.nodes.push(this.buildVariableAssignment(id, init));
}
};
DestructuringTransformer.prototype.toArray = function toArray(node, count) {
if (this.file.opts.loose || t.isIdentifier(node) && this.arrays[node.name]) {
return node;
} else {
return this.scope.toArray(node, count);
}
};
DestructuringTransformer.prototype.pushAssignmentPattern = function pushAssignmentPattern(pattern, valueRef) {
// we need to assign the current value of the assignment to avoid evaluating
// it more than once
var tempValueRef = this.scope.generateUidIdentifierBasedOnNode(valueRef);
var declar = t.variableDeclaration("var", [t.variableDeclarator(tempValueRef, valueRef)]);
declar._blockHoist = this.blockHoist;
this.nodes.push(declar);
//
var tempConditional = t.conditionalExpression(t.binaryExpression("===", tempValueRef, t.identifier("undefined")), pattern.right, tempValueRef);
var left = pattern.left;
if (t.isPattern(left)) {
var tempValueDefault = t.expressionStatement(t.assignmentExpression("=", tempValueRef, tempConditional));
tempValueDefault._blockHoist = this.blockHoist;
this.nodes.push(tempValueDefault);
this.push(left, tempValueRef);
} else {
this.nodes.push(this.buildVariableAssignment(left, tempConditional));
}
};
DestructuringTransformer.prototype.pushObjectRest = function pushObjectRest(pattern, objRef, spreadProp, spreadPropIndex) {
// get all the keys that appear in this object before the current spread
var keys = [];
for (var i = 0; i < pattern.properties.length; i++) {
var prop = pattern.properties[i];
// we've exceeded the index of the spread property to all properties to the
// right need to be ignored
if (i >= spreadPropIndex) break;
// ignore other spread properties
if (t.isRestProperty(prop)) continue;
var key = prop.key;
if (t.isIdentifier(key) && !prop.computed) key = t.stringLiteral(prop.key.name);
keys.push(key);
}
keys = t.arrayExpression(keys);
//
var value = t.callExpression(this.file.addHelper("objectWithoutProperties"), [objRef, keys]);
this.nodes.push(this.buildVariableAssignment(spreadProp.argument, value));
};
DestructuringTransformer.prototype.pushObjectProperty = function pushObjectProperty(prop, propRef) {
if (t.isLiteral(prop.key)) prop.computed = true;
var pattern = prop.value;
var objRef = t.memberExpression(propRef, prop.key, prop.computed);
if (t.isPattern(pattern)) {
this.push(pattern, objRef);
} else {
this.nodes.push(this.buildVariableAssignment(pattern, objRef));
}
};
DestructuringTransformer.prototype.pushObjectPattern = function pushObjectPattern(pattern, objRef) {
// https://github.com/babel/babel/issues/681
if (!pattern.properties.length) {
this.nodes.push(t.expressionStatement(t.callExpression(this.file.addHelper("objectDestructuringEmpty"), [objRef])));
}
// if we have more than one properties in this pattern and the objectRef is a
// member expression then we need to assign it to a temporary variable so it's
// only evaluated once
if (pattern.properties.length > 1 && !this.scope.isStatic(objRef)) {
var temp = this.scope.generateUidIdentifierBasedOnNode(objRef);
this.nodes.push(this.buildVariableDeclaration(temp, objRef));
objRef = temp;
}
//
for (var i = 0; i < pattern.properties.length; i++) {
var prop = pattern.properties[i];
if (t.isRestProperty(prop)) {
this.pushObjectRest(pattern, objRef, prop, i);
} else {
this.pushObjectProperty(prop, objRef);
}
}
};
DestructuringTransformer.prototype.canUnpackArrayPattern = function canUnpackArrayPattern(pattern, arr) {
// not an array so there's no way we can deal with this
if (!t.isArrayExpression(arr)) return false;
// pattern has less elements than the array and doesn't have a rest so some
// elements wont be evaluated
if (pattern.elements.length > arr.elements.length) return;
if (pattern.elements.length < arr.elements.length && !hasRest(pattern)) return false;
var _arr3 = pattern.elements;
for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
var elem = _arr3[_i3];
// deopt on holes
if (!elem) return false;
// deopt on member expressions as they may be included in the RHS
if (t.isMemberExpression(elem)) return false;
}
var _arr4 = arr.elements;
for (var _i4 = 0; _i4 < _arr4.length; _i4++) {
var elem = _arr4[_i4];
// deopt on spread elements
if (t.isSpreadElement(elem)) return false;
}
// deopt on reference to left side identifiers
var bindings = t.getBindingIdentifiers(pattern);
var state = { deopt: false, bindings: bindings };
this.scope.traverse(arr, arrayUnpackVisitor, state);
return !state.deopt;
};
DestructuringTransformer.prototype.pushUnpackedArrayPattern = function pushUnpackedArrayPattern(pattern, arr) {
for (var i = 0; i < pattern.elements.length; i++) {
var elem = pattern.elements[i];
if (t.isRestElement(elem)) {
this.push(elem.argument, t.arrayExpression(arr.elements.slice(i)));
} else {
this.push(elem, arr.elements[i]);
}
}
};
DestructuringTransformer.prototype.pushArrayPattern = function pushArrayPattern(pattern, arrayRef) {
if (!pattern.elements) return;
// optimise basic array destructuring of an array expression
//
// we can't do this to a pattern of unequal size to it's right hand
// array expression as then there will be values that wont be evaluated
//
// eg: let [a, b] = [1, 2];
if (this.canUnpackArrayPattern(pattern, arrayRef)) {
return this.pushUnpackedArrayPattern(pattern, arrayRef);
}
// if we have a rest then we need all the elements so don't tell
// `scope.toArray` to only get a certain amount
var count = !hasRest(pattern) && pattern.elements.length;
// so we need to ensure that the `arrayRef` is an array, `scope.toArray` will
// return a locally bound identifier if it's been inferred to be an array,
// otherwise it'll be a call to a helper that will ensure it's one
var toArray = this.toArray(arrayRef, count);
if (t.isIdentifier(toArray)) {
// we've been given an identifier so it must have been inferred to be an
// array
arrayRef = toArray;
} else {
arrayRef = this.scope.generateUidIdentifierBasedOnNode(arrayRef);
this.arrays[arrayRef.name] = true;
this.nodes.push(this.buildVariableDeclaration(arrayRef, toArray));
}
//
for (var i = 0; i < pattern.elements.length; i++) {
var elem = pattern.elements[i];
// hole
if (!elem) continue;
var elemRef = undefined;
if (t.isRestElement(elem)) {
elemRef = this.toArray(arrayRef);
if (i > 0) {
elemRef = t.callExpression(t.memberExpression(elemRef, t.identifier("slice")), [t.numericLiteral(i)]);
}
// set the element to the rest element argument since we've dealt with it
// being a rest already
elem = elem.argument;
} else {
elemRef = t.memberExpression(arrayRef, t.numericLiteral(i), true);
}
this.push(elem, elemRef);
}
};
DestructuringTransformer.prototype.init = function init(pattern, ref) {
// trying to destructure a value that we can't evaluate more than once so we
// need to save it to a variable
if (!t.isArrayExpression(ref) && !t.isMemberExpression(ref)) {
var memo = this.scope.maybeGenerateMemoised(ref, true);
if (memo) {
this.nodes.push(this.buildVariableDeclaration(memo, ref));
ref = memo;
}
}
//
this.push(pattern, ref);
return this.nodes;
};
return DestructuringTransformer;
})();
return {
visitor: {
ExportNamedDeclaration: function ExportNamedDeclaration(path) {
var declaration = path.get("declaration");
if (!declaration.isVariableDeclaration()) return;
if (!variableDeclarationHasPattern(declaration.node)) return;
var specifiers = [];
for (var _name in path.getOuterBindingIdentifiers(path)) {
var id = t.identifier(_name);
specifiers.push(t.exportSpecifier(id, id));
}
// Split the declaration and export list into two declarations so that the variable
// declaration can be split up later without needing to worry about not being a
// top-level statement.
path.replaceWith(declaration.node);
path.insertAfter(t.exportNamedDeclaration(null, specifiers));
},
ForXStatement: function ForXStatement(path, file) {
var node = path.node;
var scope = path.scope;
var left = node.left;
if (t.isPattern(left)) {
// for ({ length: k } in { abc: 3 });
var temp = scope.generateUidIdentifier("ref");
node.left = t.variableDeclaration("var", [t.variableDeclarator(temp)]);
path.ensureBlock();
node.body.body.unshift(t.variableDeclaration("var", [t.variableDeclarator(left, temp)]));
return;
}
if (!t.isVariableDeclaration(left)) return;
var pattern = left.declarations[0].id;
if (!t.isPattern(pattern)) return;
var key = scope.generateUidIdentifier("ref");
node.left = t.variableDeclaration(left.kind, [t.variableDeclarator(key, null)]);
var nodes = [];
var destructuring = new DestructuringTransformer({
kind: left.kind,
file: file,
scope: scope,
nodes: nodes
});
destructuring.init(pattern, key);
path.ensureBlock();
var block = node.body;
block.body = nodes.concat(block.body);
},
CatchClause: function CatchClause(_ref2, file) {
var node = _ref2.node;
var scope = _ref2.scope;
var pattern = node.param;
if (!t.isPattern(pattern)) return;
var ref = scope.generateUidIdentifier("ref");
node.param = ref;
var nodes = [];
var destructuring = new DestructuringTransformer({
kind: "let",
file: file,
scope: scope,
nodes: nodes
});
destructuring.init(pattern, ref);
node.body.body = nodes.concat(node.body.body);
},
AssignmentExpression: function AssignmentExpression(path, file) {
var node = path.node;
var scope = path.scope;
if (!t.isPattern(node.left)) return;
var nodes = [];
var destructuring = new DestructuringTransformer({
operator: node.operator,
file: file,
scope: scope,
nodes: nodes
});
var ref = undefined;
if (path.isCompletionRecord() || !path.parentPath.isExpressionStatement()) {
ref = scope.generateUidIdentifierBasedOnNode(node.right, "ref");
nodes.push(t.variableDeclaration("var", [t.variableDeclarator(ref, node.right)]));
if (t.isArrayExpression(node.right)) {
destructuring.arrays[ref.name] = true;
}
}
destructuring.init(node.left, ref || node.right);
if (ref) {
nodes.push(t.expressionStatement(ref));
}
path.replaceWithMultiple(nodes);
},
VariableDeclaration: function VariableDeclaration(path, file) {
var node = path.node;
var scope = path.scope;
var parent = path.parent;
if (t.isForXStatement(parent)) return;
if (!parent || !path.container) return; // i don't know why this is necessary - TODO
if (!variableDeclarationHasPattern(node)) return;
var nodes = [];
var declar = undefined;
for (var i = 0; i < node.declarations.length; i++) {
declar = node.declarations[i];
var patternId = declar.init;
var pattern = declar.id;
var destructuring = new DestructuringTransformer({
blockHoist: node._blockHoist,
nodes: nodes,
scope: scope,
kind: node.kind,
file: file
});
if (t.isPattern(pattern)) {
destructuring.init(pattern, patternId);
if (+i !== node.declarations.length - 1) {
// we aren't the last declarator so let's just make the
// last transformed node inherit from us
t.inherits(nodes[nodes.length - 1], declar);
}
} else {
nodes.push(t.inherits(destructuring.buildVariableAssignment(declar.id, declar.init), declar));
}
}
path.replaceWithMultiple(nodes);
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 81 */
/*!*************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-for-of/lib/index.js ***!
\*************************************************************/
/***/ function(module, exports) {
/* eslint max-len: 0 */
"use strict";
exports.__esModule = true;
exports["default"] = function (_ref) {
var messages = _ref.messages;
var template = _ref.template;
var t = _ref.types;
var buildForOfArray = template("\n for (var KEY = 0; KEY < ARR.length; KEY++) BODY;\n ");
var buildForOfLoose = template("\n for (var LOOP_OBJECT = OBJECT,\n IS_ARRAY = Array.isArray(LOOP_OBJECT),\n INDEX = 0,\n LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) {\n var ID;\n if (IS_ARRAY) {\n if (INDEX >= LOOP_OBJECT.length) break;\n ID = LOOP_OBJECT[INDEX++];\n } else {\n INDEX = LOOP_OBJECT.next();\n if (INDEX.done) break;\n ID = INDEX.value;\n }\n }\n ");
var buildForOf = template("\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY; !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done); ITERATOR_COMPLETION = true) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return) {\n ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n ");
function _ForOfStatementArray(path) {
var node = path.node;
var scope = path.scope;
var nodes = [];
var right = node.right;
if (!t.isIdentifier(right) || !scope.hasBinding(right.name)) {
var uid = scope.generateUidIdentifier("arr");
nodes.push(t.variableDeclaration("var", [t.variableDeclarator(uid, right)]));
right = uid;
}
var iterationKey = scope.generateUidIdentifier("i");
var loop = buildForOfArray({
BODY: node.body,
KEY: iterationKey,
ARR: right
});
t.inherits(loop, node);
t.ensureBlock(loop);
var iterationValue = t.memberExpression(right, iterationKey, true);
var left = node.left;
if (t.isVariableDeclaration(left)) {
left.declarations[0].init = iterationValue;
loop.body.body.unshift(left);
} else {
loop.body.body.unshift(t.expressionStatement(t.assignmentExpression("=", left, iterationValue)));
}
if (path.parentPath.isLabeledStatement()) {
loop = t.labeledStatement(path.parentPath.node.label, loop);
}
nodes.push(loop);
return nodes;
}
return {
visitor: {
ForOfStatement: function ForOfStatement(path, state) {
if (path.get("right").isArrayExpression()) {
return path.replaceWithMultiple(_ForOfStatementArray.call(this, path, state));
}
var callback = spec;
if (state.opts.loose) callback = loose;
var node = path.node;
var build = callback(path, state);
var declar = build.declar;
var loop = build.loop;
var block = loop.body;
// ensure that it's a block so we can take all its statements
path.ensureBlock();
// add the value declaration to the new loop body
if (declar) {
block.body.push(declar);
}
// push the rest of the original loop body onto our new body
block.body = block.body.concat(node.body.body);
t.inherits(loop, node);
t.inherits(loop.body, node.body);
if (build.replaceParent) {
path.parentPath.replaceWithMultiple(build.node);
path.remove();
} else {
path.replaceWithMultiple(build.node);
}
}
}
};
function loose(path, file) {
var node = path.node;
var scope = path.scope;
var left = node.left;
var declar = undefined,
id = undefined;
if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) {
// for (i of test), for ({ i } of test)
id = left;
} else if (t.isVariableDeclaration(left)) {
// for (let i of test)
id = scope.generateUidIdentifier("ref");
declar = t.variableDeclaration(left.kind, [t.variableDeclarator(left.declarations[0].id, id)]);
} else {
throw file.buildCodeFrameError(left, messages.get("unknownForHead", left.type));
}
var iteratorKey = scope.generateUidIdentifier("iterator");
var isArrayKey = scope.generateUidIdentifier("isArray");
var loop = buildForOfLoose({
LOOP_OBJECT: iteratorKey,
IS_ARRAY: isArrayKey,
OBJECT: node.right,
INDEX: scope.generateUidIdentifier("i"),
ID: id
});
if (!declar) {
// no declaration so we need to remove the variable declaration at the top of
// the for-of-loose template
loop.body.body.shift();
}
//
return {
declar: declar,
node: loop,
loop: loop
};
}
function spec(path, file) {
var node = path.node;
var scope = path.scope;
var parent = path.parent;
var left = node.left;
var declar = undefined;
var stepKey = scope.generateUidIdentifier("step");
var stepValue = t.memberExpression(stepKey, t.identifier("value"));
if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) {
// for (i of test), for ({ i } of test)
declar = t.expressionStatement(t.assignmentExpression("=", left, stepValue));
} else if (t.isVariableDeclaration(left)) {
// for (let i of test)
declar = t.variableDeclaration(left.kind, [t.variableDeclarator(left.declarations[0].id, stepValue)]);
} else {
throw file.buildCodeFrameError(left, messages.get("unknownForHead", left.type));
}
//
var iteratorKey = scope.generateUidIdentifier("iterator");
var template = buildForOf({
ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"),
ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"),
ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"),
ITERATOR_KEY: iteratorKey,
STEP_KEY: stepKey,
OBJECT: node.right,
BODY: null
});
var isLabeledParent = t.isLabeledStatement(parent);
var tryBody = template[3].block.body;
var loop = tryBody[0];
if (isLabeledParent) {
tryBody[0] = t.labeledStatement(parent.label, loop);
}
//
return {
replaceParent: isLabeledParent,
declar: declar,
loop: loop,
node: template
};
}
};
module.exports = exports["default"];
/***/ },
/* 82 */
/*!********************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-function-name/lib/index.js ***!
\********************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
var _babelHelperFunctionName = __webpack_require__(/*! babel-helper-function-name */ 51);
var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName);
exports["default"] = function () {
return {
visitor: {
"ArrowFunctionExpression|FunctionExpression": {
exit: function exit(path) {
if (path.key !== "value" && !path.parentPath.isObjectProperty()) {
var replacement = _babelHelperFunctionName2["default"](path);
if (replacement) path.replaceWith(replacement);
}
}
},
ObjectProperty: function ObjectProperty(path) {
var value = path.get("value");
if (value.isFunction()) {
var newNode = _babelHelperFunctionName2["default"](value);
if (newNode) value.replaceWith(newNode);
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 83 */
/*!***************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-literals/lib/index.js ***!
\***************************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
visitor: {
NumericLiteral: function NumericLiteral(_ref) {
var node = _ref.node;
// number octal like 0b10 or 0o70
if (node.extra && /^0[ob]/i.test(node.extra.raw)) {
node.extra = undefined;
}
},
StringLiteral: function StringLiteral(_ref2) {
var node = _ref2.node;
// unicode escape
if (node.extra && /\\[u]/gi.test(node.extra.raw)) {
node.extra = undefined;
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 84 */
/*!*******************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-object-super/lib/index.js ***!
\*******************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _Symbol = __webpack_require__(/*! babel-runtime/core-js/symbol */ 16)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
var _babelHelperReplaceSupers = __webpack_require__(/*! babel-helper-replace-supers */ 159);
var _babelHelperReplaceSupers2 = _interopRequireDefault(_babelHelperReplaceSupers);
exports["default"] = function (_ref) {
var t = _ref.types;
function Property(path, node, scope, getObjectRef, file) {
var replaceSupers = new _babelHelperReplaceSupers2["default"]({
getObjectRef: getObjectRef,
methodNode: node,
methodPath: path,
isStatic: true,
scope: scope,
file: file
});
replaceSupers.replace();
}
var CONTAINS_SUPER = _Symbol();
return {
visitor: {
Super: function Super(path) {
var parentObj = path.findParent(function (path) {
return path.isObjectExpression();
});
if (parentObj) parentObj.node[CONTAINS_SUPER] = true;
},
ObjectExpression: {
exit: function exit(path, file) {
if (!path.node[CONTAINS_SUPER]) return;
var objectRef = undefined;
var getObjectRef = function getObjectRef() {
return objectRef = objectRef || path.scope.generateUidIdentifier("obj");
};
var propPaths = path.get("properties");
for (var _i = 0; _i < propPaths.length; _i++) {
var propPath = propPaths[_i];
if (propPath.isObjectProperty()) propPath = propPath.get("value");
Property(propPath, propPath.node, path.scope, getObjectRef, file);
}
if (objectRef) {
path.scope.push({ id: objectRef });
path.replaceWith(t.assignmentExpression("=", objectRef, path.node));
}
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 85 */
/*!*****************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-parameters/lib/index.js ***!
\*****************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelTraverse = __webpack_require__(/*! babel-traverse */ 6);
var _destructuring = __webpack_require__(/*! ./destructuring */ 334);
var destructuring = _interopRequireWildcard(_destructuring);
var _default = __webpack_require__(/*! ./default */ 333);
var def = _interopRequireWildcard(_default);
var _rest = __webpack_require__(/*! ./rest */ 335);
var rest = _interopRequireWildcard(_rest);
exports["default"] = function () {
return {
visitor: _babelTraverse.visitors.merge([{
ArrowFunctionExpression: function ArrowFunctionExpression(path) {
// default/rest visitors require access to `arguments`
var params = path.get("params");
for (var _i = 0; _i < params.length; _i++) {
var param = params[_i];
if (param.isRestElement() || param.isAssignmentPattern()) {
path.arrowFunctionToShadowed();
break;
}
}
}
}, destructuring.visitor, rest.visitor, def.visitor])
};
};
module.exports = exports["default"];
/***/ },
/* 86 */
/*!***************************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-shorthand-properties/lib/index.js ***!
\***************************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
exports["default"] = function () {
return {
visitor: {
ObjectMethod: function ObjectMethod(path) {
var node = path.node;
if (node.kind === "method") {
path.replaceWith(t.objectProperty(node.key, t.functionExpression(null, node.params, node.body, node.generator, node.async), node.computed));
}
},
ObjectProperty: function ObjectProperty(_ref) {
var node = _ref.node;
if (node.shorthand) {
node.shorthand = false;
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 87 */
/*!*************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-spread/lib/index.js ***!
\*************************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function (_ref) {
var t = _ref.types;
function getSpreadLiteral(spread, scope, state) {
if (state.opts.loose && !t.isIdentifier(spread.argument, { name: "arguments" })) {
return spread.argument;
} else {
return scope.toArray(spread.argument, true);
}
}
function hasSpread(nodes) {
for (var i = 0; i < nodes.length; i++) {
if (t.isSpreadElement(nodes[i])) {
return true;
}
}
return false;
}
function build(props, scope, state) {
var nodes = [];
var _props = [];
function push() {
if (!_props.length) return;
nodes.push(t.arrayExpression(_props));
_props = [];
}
for (var _i = 0; _i < props.length; _i++) {
var prop = props[_i];
if (t.isSpreadElement(prop)) {
push();
nodes.push(getSpreadLiteral(prop, scope, state));
} else {
_props.push(prop);
}
}
push();
return nodes;
}
return {
visitor: {
ArrayExpression: function ArrayExpression(path, state) {
var node = path.node;
var scope = path.scope;
var elements = node.elements;
if (!hasSpread(elements)) return;
var nodes = build(elements, scope, state);
var first = nodes.shift();
if (!t.isArrayExpression(first)) {
nodes.unshift(first);
first = t.arrayExpression([]);
}
path.replaceWith(t.callExpression(t.memberExpression(first, t.identifier("concat")), nodes));
},
CallExpression: function CallExpression(path, state) {
var node = path.node;
var scope = path.scope;
var args = node.arguments;
if (!hasSpread(args)) return;
var calleePath = path.get("callee");
if (calleePath.isSuper()) return;
var contextLiteral = t.identifier("undefined");
node.arguments = [];
var nodes = undefined;
if (args.length === 1 && args[0].argument.name === "arguments") {
nodes = [args[0].argument];
} else {
nodes = build(args, scope, state);
}
var first = nodes.shift();
if (nodes.length) {
node.arguments.push(t.callExpression(t.memberExpression(first, t.identifier("concat")), nodes));
} else {
node.arguments.push(first);
}
var callee = node.callee;
if (calleePath.isMemberExpression()) {
var temp = scope.maybeGenerateMemoised(callee.object);
if (temp) {
callee.object = t.assignmentExpression("=", temp, callee.object);
contextLiteral = temp;
} else {
contextLiteral = callee.object;
}
t.appendToMemberExpression(callee, t.identifier("apply"));
} else {
node.callee = t.memberExpression(node.callee, t.identifier("apply"));
}
if (t.isSuper(contextLiteral)) {
contextLiteral = t.thisExpression();
}
node.arguments.unshift(contextLiteral);
},
NewExpression: function NewExpression(path, state) {
var node = path.node;
var scope = path.scope;
var args = node.arguments;
if (!hasSpread(args)) return;
var nodes = build(args, scope, state);
var context = t.arrayExpression([t.nullLiteral()]);
args = t.callExpression(t.memberExpression(context, t.identifier("concat")), nodes);
path.replaceWith(t.newExpression(t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.identifier("Function"), t.identifier("prototype")), t.identifier("bind")), t.identifier("apply")), [node.callee, args]), []));
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 88 */
/*!*******************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-sticky-regex/lib/index.js ***!
\*******************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelHelperRegex = __webpack_require__(/*! babel-helper-regex */ 157);
var regex = _interopRequireWildcard(_babelHelperRegex);
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
exports["default"] = function () {
return {
visitor: {
RegExpLiteral: function RegExpLiteral(path) {
var node = path.node;
if (!regex.is(node, "y")) return;
path.replaceWith(t.newExpression(t.identifier("RegExp"), [t.stringLiteral(node.pattern), t.stringLiteral(node.flags)]));
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 89 */
/*!************************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-template-literals/lib/index.js ***!
\************************************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function (_ref) {
var t = _ref.types;
function isString(node) {
return t.isLiteral(node) && typeof node.value === "string";
}
function buildBinaryExpression(left, right) {
return t.binaryExpression("+", left, right);
}
return {
visitor: {
TaggedTemplateExpression: function TaggedTemplateExpression(path, state) {
var node = path.node;
var quasi = node.quasi;
var args = [];
var strings = [];
var raw = [];
var _arr = quasi.quasis;
for (var _i = 0; _i < _arr.length; _i++) {
var elem = _arr[_i];
strings.push(t.stringLiteral(elem.value.cooked));
raw.push(t.stringLiteral(elem.value.raw));
}
strings = t.arrayExpression(strings);
raw = t.arrayExpression(raw);
var templateName = "taggedTemplateLiteral";
if (state.opts.loose) templateName += "Loose";
var templateObject = state.file.addTemplateObject(templateName, strings, raw);
args.push(templateObject);
args = args.concat(quasi.expressions);
path.replaceWith(t.callExpression(node.tag, args));
},
TemplateLiteral: function TemplateLiteral(path, state) {
var nodes = [];
var expressions = path.get("expressions");
var _arr2 = path.node.quasis;
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
var elem = _arr2[_i2];
nodes.push(t.stringLiteral(elem.value.cooked));
var expr = expressions.shift();
if (expr) {
if (state.opts.spec && !expr.isBaseType("string") && !expr.isBaseType("number")) {
nodes.push(t.callExpression(t.identifier("String"), [expr.node]));
} else {
nodes.push(expr.node);
}
}
}
// filter out empty string literals
nodes = nodes.filter(function (n) {
return !t.isLiteral(n, { value: "" });
});
// since `+` is left-to-right associative
// ensure the first node is a string if first/second isn't
if (!isString(nodes[0]) && !isString(nodes[1])) {
nodes.unshift(t.stringLiteral(""));
}
if (nodes.length > 1) {
var root = buildBinaryExpression(nodes.shift(), nodes.shift());
for (var _i3 = 0; _i3 < nodes.length; _i3++) {
var node = nodes[_i3];
root = buildBinaryExpression(root, node);
}
path.replaceWith(root);
} else {
path.replaceWith(nodes[0]);
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 90 */
/*!********************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-typeof-symbol/lib/index.js ***!
\********************************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _Symbol = __webpack_require__(/*! babel-runtime/core-js/symbol */ 16)["default"];
exports.__esModule = true;
exports["default"] = function (_ref) {
var t = _ref.types;
var IGNORE = _Symbol();
return {
visitor: {
Scope: function Scope(_ref2) {
var scope = _ref2.scope;
if (!scope.getBinding("Symbol")) {
return;
}
scope.rename("Symbol");
},
UnaryExpression: function UnaryExpression(path) {
var node = path.node;
var parent = path.parent;
if (node[IGNORE]) return;
if (path.find(function (path) {
return path.node && !!path.node._generated;
})) return;
if (path.parentPath.isBinaryExpression() && t.EQUALITY_BINARY_OPERATORS.indexOf(parent.operator) >= 0) {
// optimise `typeof foo === "string"` since we can determine that they'll never need to handle symbols
var opposite = path.getOpposite();
if (opposite.isLiteral() && opposite.node.value !== "symbol" && opposite.node.value !== "object") {
return;
}
}
if (node.operator === "typeof") {
var call = t.callExpression(this.addHelper("typeof"), [node.argument]);
if (path.get("argument").isIdentifier()) {
var undefLiteral = t.stringLiteral("undefined");
var unary = t.unaryExpression("typeof", node.argument);
unary[IGNORE] = true;
path.replaceWith(t.conditionalExpression(t.binaryExpression("===", unary, undefLiteral), undefLiteral, call));
} else {
path.replaceWith(call);
}
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 91 */
/*!********************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-unicode-regex/lib/index.js ***!
\********************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _regexpuCore = __webpack_require__(/*! regexpu-core */ 523);
var _regexpuCore2 = _interopRequireDefault(_regexpuCore);
var _babelHelperRegex = __webpack_require__(/*! babel-helper-regex */ 157);
var regex = _interopRequireWildcard(_babelHelperRegex);
exports["default"] = function () {
return {
visitor: {
RegExpLiteral: function RegExpLiteral(_ref) {
var node = _ref.node;
if (!regex.is(node, "u")) return;
node.pattern = _regexpuCore2["default"](node.pattern, node.flags);
regex.pullFlag(node, "u");
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 92 */
/*!***********************************************************!*\
!*** ./~/babel-plugin-transform-regenerator/lib/index.js ***!
\***********************************************************/
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* https://raw.github.com/facebook/regenerator/master/LICENSE file. An
* additional grant of patent rights can be found in the PATENTS file in
* the same directory.
*/
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return __webpack_require__(/*! ./visit */ 357);
};
module.exports = exports["default"];
/***/ },
/* 93 */
/*!***************************************!*\
!*** ./~/babel-traverse/lib/cache.js ***!
\***************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _WeakMap = __webpack_require__(/*! babel-runtime/core-js/weak-map */ 373)["default"];
exports.__esModule = true;
exports.clear = clear;
var path = new _WeakMap();
exports.path = path;
var scope = new _WeakMap();
exports.scope = scope;
function clear() {
exports.path = path = new _WeakMap();
exports.scope = scope = new _WeakMap();
}
/***/ },
/* 94 */
/*!************************************************!*\
!*** ./~/core-js/library/modules/$.defined.js ***!
\************************************************/
/***/ function(module, exports) {
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function(it){
if(it == undefined)throw TypeError("Can't call method on " + it);
return it;
};
/***/ },
/* 95 */
/*!***********************************************!*\
!*** ./~/core-js/library/modules/$.for-of.js ***!
\***********************************************/
/***/ function(module, exports, __webpack_require__) {
var ctx = __webpack_require__(/*! ./$.ctx */ 56)
, call = __webpack_require__(/*! ./$.iter-call */ 433)
, isArrayIter = __webpack_require__(/*! ./$.is-array-iter */ 432)
, anObject = __webpack_require__(/*! ./$.an-object */ 41)
, toLength = __webpack_require__(/*! ./$.to-length */ 205)
, getIterFn = __webpack_require__(/*! ./core.get-iterator-method */ 206);
module.exports = function(iterable, entries, fn, that){
var iterFn = getIterFn(iterable)
, f = ctx(fn, that, entries ? 2 : 1)
, index = 0
, length, step, iterator;
if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
// fast case for arrays with default iterator
if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
} else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
call(iterator, f, step.value, entries);
}
};
/***/ },
/* 96 */
/*!*************************************************!*\
!*** ./~/core-js/library/modules/$.redefine.js ***!
\*************************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(/*! ./$.hide */ 43);
/***/ },
/* 97 */
/*!**********************************************************!*\
!*** ./~/core-js/library/modules/$.set-to-string-tag.js ***!
\**********************************************************/
/***/ function(module, exports, __webpack_require__) {
var def = __webpack_require__(/*! ./$ */ 7).setDesc
, has = __webpack_require__(/*! ./$.has */ 42)
, TAG = __webpack_require__(/*! ./$.wks */ 21)('toStringTag');
module.exports = function(it, tag, stat){
if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
};
/***/ },
/* 98 */
/*!********************************************!*\
!*** ./~/core-js/library/modules/$.uid.js ***!
\********************************************/
/***/ function(module, exports) {
var id = 0
, px = Math.random();
module.exports = function(key){
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
/***/ },
/* 99 */
/*!*****************************************!*\
!*** ./~/lodash/collection/includes.js ***!
\*****************************************/
/***/ function(module, exports, __webpack_require__) {
var baseIndexOf = __webpack_require__(/*! ../internal/baseIndexOf */ 136),
getLength = __webpack_require__(/*! ../internal/getLength */ 138),
isArray = __webpack_require__(/*! ../lang/isArray */ 13),
isIterateeCall = __webpack_require__(/*! ../internal/isIterateeCall */ 65),
isLength = __webpack_require__(/*! ../internal/isLength */ 32),
isString = __webpack_require__(/*! ../lang/isString */ 38),
values = __webpack_require__(/*! ../object/values */ 233);
/* Native method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* Checks if `target` is in `collection` using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons. If `fromIndex` is negative, it's used as the offset
* from the end of `collection`.
*
* @static
* @memberOf _
* @alias contains, include
* @category Collection
* @param {Array|Object|string} collection The collection to search.
* @param {*} target The value to search for.
* @param {number} [fromIndex=0] The index to search from.
* @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
* @returns {boolean} Returns `true` if a matching element is found, else `false`.
* @example
*
* _.includes([1, 2, 3], 1);
* // => true
*
* _.includes([1, 2, 3], 1, 2);
* // => false
*
* _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
* // => true
*
* _.includes('pebbles', 'eb');
* // => true
*/
function includes(collection, target, fromIndex, guard) {
var length = collection ? getLength(collection) : 0;
if (!isLength(length)) {
collection = values(collection);
length = collection.length;
}
if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
fromIndex = 0;
} else {
fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
}
return (typeof collection == 'string' || !isArray(collection) && isString(collection))
? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1)
: (!!length && baseIndexOf(collection, target, fromIndex) > -1);
}
module.exports = includes;
/***/ },
/* 100 */
/*!****************************************!*\
!*** ./~/lodash/internal/getNative.js ***!
\****************************************/
/***/ function(module, exports, __webpack_require__) {
var isNative = __webpack_require__(/*! ../lang/isNative */ 509);
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = object == null ? undefined : object[key];
return isNative(value) ? value : undefined;
}
module.exports = getNative;
/***/ },
/* 101 */
/*!**************************************!*\
!*** ./~/lodash/internal/isIndex.js ***!
\**************************************/
/***/ function(module, exports) {
/** Used to detect unsigned integer values. */
var reIsUint = /^\d+$/;
/**
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
* of an array-like value.
*/
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
length = length == null ? MAX_SAFE_INTEGER : length;
return value > -1 && value % 1 == 0 && value < length;
}
module.exports = isIndex;
/***/ },
/* 102 */
/*!***********************************!*\
!*** ./~/babel-core/lib/store.js ***!
\***********************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _inherits = __webpack_require__(/*! babel-runtime/helpers/inherits */ 35)["default"];
var _classCallCheck = __webpack_require__(/*! babel-runtime/helpers/class-call-check */ 5)["default"];
var _Map2 = __webpack_require__(/*! babel-runtime/core-js/map */ 368)["default"];
exports.__esModule = true;
var Store = (function (_Map) {
_inherits(Store, _Map);
function Store() {
_classCallCheck(this, Store);
_Map.call(this);
this.dynamicData = {};
}
Store.prototype.setDynamic = function setDynamic(key, fn) {
this.dynamicData[key] = fn;
};
Store.prototype.get = function get(key) {
if (this.has(key)) {
return _Map.prototype.get.call(this, key);
} else {
if (Object.prototype.hasOwnProperty.call(this.dynamicData, key)) {
var val = this.dynamicData[key]();
this.set(key, val);
return val;
}
}
};
return Store;
})(_Map2);
exports["default"] = Store;
module.exports = exports["default"];
/***/ },
/* 103 */
/*!*******************************************************!*\
!*** ./~/babel-core/lib/transformation/file/index.js ***!
\*******************************************************/
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/* global BabelFileResult, BabelParserOptions, BabelFileMetadata */
/* eslint max-len: 0 */
"use strict";
var _inherits = __webpack_require__(/*! babel-runtime/helpers/inherits */ 35)["default"];
var _classCallCheck = __webpack_require__(/*! babel-runtime/helpers/class-call-check */ 5)["default"];
var _Object$assign = __webpack_require__(/*! babel-runtime/core-js/object/assign */ 117)["default"];
var _Object$create = __webpack_require__(/*! babel-runtime/core-js/object/create */ 10)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelHelpers = __webpack_require__(/*! babel-helpers */ 160);
var _babelHelpers2 = _interopRequireDefault(_babelHelpers);
var _metadata = __webpack_require__(/*! ./metadata */ 250);
var metadataVisitor = _interopRequireWildcard(_metadata);
var _convertSourceMap = __webpack_require__(/*! convert-source-map */ 409);
var _convertSourceMap2 = _interopRequireDefault(_convertSourceMap);
var _optionsOptionManager = __webpack_require__(/*! ./options/option-manager */ 50);
var _optionsOptionManager2 = _interopRequireDefault(_optionsOptionManager);
var _pluginPass = __webpack_require__(/*! ../plugin-pass */ 254);
var _pluginPass2 = _interopRequireDefault(_pluginPass);
var _shebangRegex = __webpack_require__(/*! shebang-regex */ 526);
var _shebangRegex2 = _interopRequireDefault(_shebangRegex);
var _babelTraverse = __webpack_require__(/*! babel-traverse */ 6);
var _sourceMap = __webpack_require__(/*! source-map */ 241);
var _sourceMap2 = _interopRequireDefault(_sourceMap);
var _babelGenerator = __webpack_require__(/*! babel-generator */ 149);
var _babelGenerator2 = _interopRequireDefault(_babelGenerator);
var _babelCodeFrame = __webpack_require__(/*! babel-code-frame */ 255);
var _babelCodeFrame2 = _interopRequireDefault(_babelCodeFrame);
var _lodashObjectDefaults = __webpack_require__(/*! lodash/object/defaults */ 231);
var _lodashObjectDefaults2 = _interopRequireDefault(_lodashObjectDefaults);
var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
var _logger = __webpack_require__(/*! ./logger */ 249);
var _logger2 = _interopRequireDefault(_logger);
var _store = __webpack_require__(/*! ../../store */ 102);
var _store2 = _interopRequireDefault(_store);
var _babylon = __webpack_require__(/*! babylon */ 121);
var _util = __webpack_require__(/*! ../../util */ 107);
var util = _interopRequireWildcard(_util);
var _path = __webpack_require__(/*! path */ 22);
var _path2 = _interopRequireDefault(_path);
var _babelTypes = __webpack_require__(/*! babel-types */ 11);
var t = _interopRequireWildcard(_babelTypes);
var _internalPluginsBlockHoist = __webpack_require__(/*! ../internal-plugins/block-hoist */ 251);
var _internalPluginsBlockHoist2 = _interopRequireDefault(_internalPluginsBlockHoist);
var _internalPluginsShadowFunctions = __webpack_require__(/*! ../internal-plugins/shadow-functions */ 252);
var _internalPluginsShadowFunctions2 = _interopRequireDefault(_internalPluginsShadowFunctions);
var INTERNAL_PLUGINS = [[_internalPluginsBlockHoist2["default"]], [_internalPluginsShadowFunctions2["default"]]];
var errorVisitor = {
enter: function enter(path, state) {
var loc = path.node.loc;
if (loc) {
state.loc = loc;
path.stop();
}
}
};
var File = (function (_Store) {
_inherits(File, _Store);
function File(opts, pipeline) {
// istanbul ignore next
var _this = this;
if (opts === undefined) opts = {};
_classCallCheck(this, File);
_Store.call(this);
this.pipeline = pipeline;
this.log = new _logger2["default"](this, opts.filename || "unknown");
this.opts = this.initOptions(opts);
this.parserOpts = {
highlightCode: this.opts.highlightCode,
nonStandard: this.opts.nonStandard,
sourceType: this.opts.sourceType,
filename: this.opts.filename,
plugins: []
};
this.pluginVisitors = [];
this.pluginPasses = [];
// Plugins for top-level options.
this.buildPluginsForOptions(this.opts);
// If we are in the "pass per preset" mode, build
// also plugins for each preset.
if (this.opts.passPerPreset) {
// All the "per preset" options are inherited from the main options.
this.perPresetOpts = [];
this.opts.presets.forEach(function (presetOpts) {
var perPresetOpts = _Object$assign(_Object$create(_this.opts), presetOpts);
_this.perPresetOpts.push(perPresetOpts);
_this.buildPluginsForOptions(perPresetOpts);
});
}
this.metadata = {
usedHelpers: [],
marked: [],
modules: {
imports: [],
exports: {
exported: [],
specifiers: []
}
}
};
this.dynamicImportTypes = {};
this.dynamicImportIds = {};
this.dynamicImports = [];
this.declarations = {};
this.usedHelpers = {};
this.path = null;
this.ast = {};
this.code = "";
this.shebang = "";
this.hub = new _babelTraverse.Hub(this);
}
File.prototype.getMetadata = function getMetadata() {
var has = false;
var _arr = this.ast.program.body;
for (var _i = 0; _i < _arr.length; _i++) {
var node = _arr[_i];
if (t.isModuleDeclaration(node)) {
has = true;
break;
}
}
if (has) {
this.path.traverse(metadataVisitor, this);
}
};
File.prototype.initOptions = function initOptions(opts) {
opts = new _optionsOptionManager2["default"](this.log, this.pipeline).init(opts);
if (opts.inputSourceMap) {
opts.sourceMaps = true;
}
if (opts.moduleId) {
opts.moduleIds = true;
}
opts.basename = _path2["default"].basename(opts.filename, _path2["default"].extname(opts.filename));
opts.ignore = util.arrayify(opts.ignore, util.regexify);
if (opts.only) opts.only = util.arrayify(opts.only, util.regexify);
_lodashObjectDefaults2["default"](opts, {
moduleRoot: opts.sourceRoot
});
_lodashObjectDefaults2["default"](opts, {
sourceRoot: opts.moduleRoot
});
_lodashObjectDefaults2["default"](opts, {
filenameRelative: opts.filename
});
var basenameRelative = _path2["default"].basename(opts.filenameRelative);
_lodashObjectDefaults2["default"](opts, {
sourceFileName: basenameRelative,
sourceMapTarget: basenameRelative
});
return opts;
};
File.prototype.buildPluginsForOptions = function buildPluginsForOptions(opts) {
if (!Array.isArray(opts.plugins)) {
return;
}
var plugins = opts.plugins.concat(INTERNAL_PLUGINS);
var currentPluginVisitors = [];
var currentPluginPasses = [];
// init plugins!
for (var _i2 = 0; _i2 < plugins.length; _i2++) {
var ref = plugins[_i2];var plugin = ref[0];
var pluginOpts = ref[1];
// todo: fix - can't embed in loop head because of flow bug
currentPluginVisitors.push(plugin.visitor);
currentPluginPasses.push(new _pluginPass2["default"](this, plugin, pluginOpts));
if (plugin.manipulateOptions) {
plugin.manipulateOptions(opts, this.parserOpts, this);
}
}
this.pluginVisitors.push(currentPluginVisitors);
this.pluginPasses.push(currentPluginPasses);
};
File.prototype.getModuleName = function getModuleName() {
var opts = this.opts;
if (!opts.moduleIds) {
return null;
}
// moduleId is n/a if a `getModuleId()` is provided
if (opts.moduleId != null && !opts.getModuleId) {
return opts.moduleId;
}
var filenameRelative = opts.filenameRelative;
var moduleName = "";
if (opts.moduleRoot != null) {
moduleName = opts.moduleRoot + "/";
}
if (!opts.filenameRelative) {
return moduleName + opts.filename.replace(/^\//, "");
}
if (opts.sourceRoot != null) {
// remove sourceRoot from filename
var sourceRootRegEx = new RegExp("^" + opts.sourceRoot + "\/?");
filenameRelative = filenameRelative.replace(sourceRootRegEx, "");
}
// remove extension
filenameRelative = filenameRelative.replace(/\.(\w*?)$/, "");
moduleName += filenameRelative;
// normalize path separators
moduleName = moduleName.replace(/\\/g, "/");
if (opts.getModuleId) {
// If return is falsy, assume they want us to use our generated default name
return opts.getModuleId(moduleName) || moduleName;
} else {
return moduleName;
}
};
File.prototype.resolveModuleSource = function resolveModuleSource(source) {
var resolveModuleSource = this.opts.resolveModuleSource;
if (resolveModuleSource) source = resolveModuleSource(source, this.opts.filename);
return source;
};
File.prototype.addImport = function addImport(source, imported) {
var name = arguments.length <= 2 || arguments[2] === undefined ? imported : arguments[2];
return (function () {
var alias = source + ":" + imported;
var id = this.dynamicImportIds[alias];
if (!id) {
source = this.resolveModuleSource(source);
id = this.dynamicImportIds[alias] = this.scope.generateUidIdentifier(name);
var specifiers = [];
if (imported === "*") {
specifiers.push(t.importNamespaceSpecifier(id));
} else if (imported === "default") {
specifiers.push(t.importDefaultSpecifier(id));
} else {
specifiers.push(t.importSpecifier(id, t.identifier(imported)));
}
var declar = t.importDeclaration(specifiers, t.stringLiteral(source));
declar._blockHoist = 3;
this.path.unshiftContainer("body", declar);
}
return id;
}).apply(this, arguments);
};
File.prototype.addHelper = function addHelper(name) {
var declar = this.declarations[name];
if (declar) return declar;
if (!this.usedHelpers[name]) {
this.metadata.usedHelpers.push(name);
this.usedHelpers[name] = true;
}
var generator = this.get("helperGenerator");
var runtime = this.get("helpersNamespace");
if (generator) {
var res = generator(name);
if (res) return res;
} else if (runtime) {
return t.memberExpression(runtime, t.identifier(name));
}
var ref = _babelHelpers2["default"](name);
var uid = this.declarations[name] = this.scope.generateUidIdentifier(name);
if (t.isFunctionExpression(ref) && !ref.id) {
ref.body._compact = true;
ref._generated = true;
ref.id = uid;
ref.type = "FunctionDeclaration";
this.path.unshiftContainer("body", ref);
} else {
ref._compact = true;
this.scope.push({
id: uid,
init: ref,
unique: true
});
}
return uid;
};
File.prototype.addTemplateObject = function addTemplateObject(helperName, strings, raw) {
// Generate a unique name based on the string literals so we dedupe
// identical strings used in the program.
var stringIds = raw.elements.map(function (string) {
return string.value;
});
var name = helperName + "_" + raw.elements.length + "_" + stringIds.join(",");
var declar = this.declarations[name];
if (declar) return declar;
var uid = this.declarations[name] = this.scope.generateUidIdentifier("templateObject");
var helperId = this.addHelper(helperName);
var init = t.callExpression(helperId, [strings, raw]);
init._compact = true;
this.scope.push({
id: uid,
init: init,
_blockHoist: 1.9 // This ensures that we don't fail if not using function expression helpers
});
return uid;
};
File.prototype.buildCodeFrameError = function buildCodeFrameError(node, msg) {
var Error = arguments.length <= 2 || arguments[2] === undefined ? SyntaxError : arguments[2];
var loc = node && (node.loc || node._loc);
var err = new Error(msg);
if (loc) {
err.loc = loc.start;
} else {
_babelTraverse2["default"](node, errorVisitor, this.scope, err);
err.message += " (This is an error on an internal node. Probably an internal error";
if (err.loc) {
err.message += ". Location has been estimated.";
}
err.message += ")";
}
return err;
};
File.prototype.mergeSourceMap = function mergeSourceMap(map) {
var inputMap = this.opts.inputSourceMap;
if (inputMap) {
var _ret = (function () {
var inputMapConsumer = new _sourceMap2["default"].SourceMapConsumer(inputMap);
var outputMapConsumer = new _sourceMap2["default"].SourceMapConsumer(map);
var mergedGenerator = new _sourceMap2["default"].SourceMapGenerator({
file: inputMapConsumer.file,
sourceRoot: inputMapConsumer.sourceRoot
});
// This assumes the output map always has a single source, since Babel always compiles a single source file to a
// single output file.
var source = outputMapConsumer.sources[0];
inputMapConsumer.eachMapping(function (mapping) {
var generatedPosition = outputMapConsumer.generatedPositionFor({
line: mapping.generatedLine,
column: mapping.generatedColumn,
source: source
});
if (generatedPosition.column != null) {
mergedGenerator.addMapping({
source: mapping.source,
original: mapping.source == null ? null : {
line: mapping.originalLine,
column: mapping.originalColumn
},
generated: generatedPosition
});
}
});
var mergedMap = mergedGenerator.toJSON();
inputMap.mappings = mergedMap.mappings;
return {
v: inputMap
};
})();
// istanbul ignore next
if (typeof _ret === "object") return _ret.v;
} else {
return map;
}
};
File.prototype.parse = function parse(code) {
this.log.debug("Parse start");
var ast = _babylon.parse(code, this.parserOpts);
this.log.debug("Parse stop");
return ast;
};
File.prototype._addAst = function _addAst(ast) {
this.path = _babelTraverse.NodePath.get({
hub: this.hub,
parentPath: null,
parent: ast,
container: ast,
key: "program"
}).setContext();
this.scope = this.path.scope;
this.ast = ast;
this.getMetadata();
};
File.prototype.addAst = function addAst(ast) {
this.log.debug("Start set AST");
this._addAst(ast);
this.log.debug("End set AST");
};
File.prototype.transform = function transform() {
// istanbul ignore next
var _this2 = this;
// In the "pass per preset" mode, we have grouped passes.
// Otherwise, there is only one plain pluginPasses array.
this.pluginPasses.forEach(function (pluginPasses, index) {
_this2.call("pre", pluginPasses);
_this2.log.debug("Start transform traverse");
_babelTraverse2["default"](_this2.ast, _babelTraverse2["default"].visitors.merge(_this2.pluginVisitors[index], pluginPasses), _this2.scope);
_this2.log.debug("End transform traverse");
_this2.call("post", pluginPasses);
});
return this.generate();
};
File.prototype.wrap = function wrap(code, callback) {
code = code + "";
try {
if (this.shouldIgnore()) {
return this.makeResult({ code: code, ignored: true });
} else {
return callback();
}
} catch (err) {
if (err._babel) {
throw err;
} else {
err._babel = true;
}
var message = err.message = this.opts.filename + ": " + err.message;
var loc = err.loc;
if (loc) {
err.codeFrame = _babelCodeFrame2["default"](code, loc.line, loc.column + 1, this.opts);
message += "\n" + err.codeFrame;
}
if (process.browser) {
// chrome has it's own pretty stringifier which doesn't use the stack property
// https://github.com/babel/babel/issues/2175
err.message = message;
}
if (err.stack) {
var newStack = err.stack.replace(err.message, message);
err.stack = newStack;
}
throw err;
}
};
File.prototype.addCode = function addCode(code) {
code = (code || "") + "";
code = this.parseInputSourceMap(code);
this.code = code;
};
File.prototype.parseCode = function parseCode() {
this.parseShebang();
var ast = this.parse(this.code);
this.addAst(ast);
};
File.prototype.shouldIgnore = function shouldIgnore() {
var opts = this.opts;
return util.shouldIgnore(opts.filename, opts.ignore, opts.only);
};
File.prototype.call = function call(key, pluginPasses) {
for (var _i3 = 0; _i3 < pluginPasses.length; _i3++) {
var pass = pluginPasses[_i3];
var plugin = pass.plugin;
var fn = plugin[key];
if (fn) fn.call(pass, this);
}
};
File.prototype.parseInputSourceMap = function parseInputSourceMap(code) {
var opts = this.opts;
if (opts.inputSourceMap !== false) {
var inputMap = _convertSourceMap2["default"].fromSource(code);
if (inputMap) {
opts.inputSourceMap = inputMap.toObject();
code = _convertSourceMap2["default"].removeComments(code);
}
}
return code;
};
File.prototype.parseShebang = function parseShebang() {
var shebangMatch = _shebangRegex2["default"].exec(this.code);
if (shebangMatch) {
this.shebang = shebangMatch[0];
this.code = this.code.replace(_shebangRegex2["default"], "");
}
};
File.prototype.makeResult = function makeResult(_ref) {
var code = _ref.code;
var map = _ref.map;
var ast = _ref.ast;
var ignored = _ref.ignored;
var result = {
metadata: null,
options: this.opts,
ignored: !!ignored,
code: null,
ast: null,
map: map || null
};
if (this.opts.code) {
result.code = code;
}
if (this.opts.ast) {
result.ast = ast;
}
if (this.opts.metadata) {
result.metadata = this.metadata;
}
return result;
};
File.prototype.generate = function generate() {
var opts = this.opts;
var ast = this.ast;
var result = { ast: ast };
if (!opts.code) return this.makeResult(result);
this.log.debug("Generation start");
var _result = _babelGenerator2["default"](ast, opts, this.code);
result.code = _result.code;
result.map = _result.map;
this.log.debug("Generation end");
if (this.shebang) {
// add back shebang
result.code = this.shebang + "\n" + result.code;
}
if (result.map) {
result.map = this.mergeSourceMap(result.map);
}
if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") {
result.code += "\n" + _convertSourceMap2["default"].fromObject(result.map).toComment();
}
if (opts.sourceMaps === "inline") {
result.map = null;
}
return this.makeResult(result);
};
return File;
})(_store2["default"]);
exports["default"] = File;
exports.File = File;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./~/process/browser.js */ 18)))
/***/ },
/* 104 */
/*!***************************************************************!*\
!*** ./~/babel-core/lib/transformation/file/options/index.js ***!
\***************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
exports.normaliseOptions = normaliseOptions;
var _parsers = __webpack_require__(/*! ./parsers */ 105);
var parsers = _interopRequireWildcard(_parsers);
var _config = __webpack_require__(/*! ./config */ 49);
var _config2 = _interopRequireDefault(_config);
exports.config = _config2["default"];
function normaliseOptions() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
for (var key in options) {
var val = options[key];
if (val == null) continue;
var opt = _config2["default"][key];
if (opt && opt.alias) opt = _config2["default"][opt.alias];
if (!opt) continue;
var parser = parsers[opt.type];
if (parser) val = parser(val);
options[key] = val;
}
return options;
}
/***/ },
/* 105 */
/*!*****************************************************************!*\
!*** ./~/babel-core/lib/transformation/file/options/parsers.js ***!
\*****************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
exports.boolean = boolean;
exports.booleanString = booleanString;
exports.list = list;
var _slash = __webpack_require__(/*! slash */ 237);
var _slash2 = _interopRequireDefault(_slash);
var _util = __webpack_require__(/*! ../../../util */ 107);
var util = _interopRequireWildcard(_util);
var filename = _slash2["default"];
exports.filename = filename;
function boolean(val) {
return !!val;
}
function booleanString(val) {
return util.booleanify(val);
}
function list(val) {
return util.list(val);
}
/***/ },
/* 106 */
/*!*****************************************************************!*\
!*** ./~/babel-core/lib/transformation/file/options/removed.js ***!
\*****************************************************************/
/***/ function(module, exports) {
/* eslint max-len: 0 */
"use strict";
module.exports = {
"auxiliaryComment": {
"message": "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"
},
"blacklist": {
"message": "Put the specific transforms you want in the `plugins` option"
},
"breakConfig": {
"message": "This is not a necessary option in Babel 6"
},
"experimental": {
"message": "Put the specific transforms you want in the `plugins` option"
},
"externalHelpers": {
"message": "Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/"
},
"extra": {
"message": ""
},
"jsxPragma": {
"message": "use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/"
},
// "keepModuleIdExtensions": {
// "message": ""
// },
"loose": {
"message": "Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option."
},
"metadataUsedHelpers": {
"message": "Not required anymore as this is enabled by default"
},
"modules": {
"message": "Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules"
},
"nonStandard": {
"message": "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"
},
"optional": {
"message": "Put the specific transforms you want in the `plugins` option"
},
"sourceMapName": {
"message": "Use the `sourceMapTarget` option"
},
"stage": {
"message": "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"
},
"whitelist": {
"message": "Put the specific transforms you want in the `plugins` option"
}
};
/***/ },
/* 107 */
/*!**********************************!*\
!*** ./~/babel-core/lib/util.js ***!
\**********************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
exports.canCompile = canCompile;
exports.list = list;
exports.regexify = regexify;
exports.arrayify = arrayify;
exports.booleanify = booleanify;
exports.shouldIgnore = shouldIgnore;
var _lodashStringEscapeRegExp = __webpack_require__(/*! lodash/string/escapeRegExp */ 514);
var _lodashStringEscapeRegExp2 = _interopRequireDefault(_lodashStringEscapeRegExp);
var _lodashStringStartsWith = __webpack_require__(/*! lodash/string/startsWith */ 515);
var _lodashStringStartsWith2 = _interopRequireDefault(_lodashStringStartsWith);
var _lodashLangIsBoolean = __webpack_require__(/*! lodash/lang/isBoolean */ 229);
var _lodashLangIsBoolean2 = _interopRequireDefault(_lodashLangIsBoolean);
var _minimatch = __webpack_require__(/*! minimatch */ 517);
var _minimatch2 = _interopRequireDefault(_minimatch);
var _lodashCollectionContains = __webpack_require__(/*! lodash/collection/contains */ 468);
var _lodashCollectionContains2 = _interopRequireDefault(_lodashCollectionContains);
var _lodashLangIsString = __webpack_require__(/*! lodash/lang/isString */ 38);
var _lodashLangIsString2 = _interopRequireDefault(_lodashLangIsString);
var _lodashLangIsRegExp = __webpack_require__(/*! lodash/lang/isRegExp */ 47);
var _lodashLangIsRegExp2 = _interopRequireDefault(_lodashLangIsRegExp);
var _path = __webpack_require__(/*! path */ 22);
var _path2 = _interopRequireDefault(_path);
var _slash = __webpack_require__(/*! slash */ 237);
var _slash2 = _interopRequireDefault(_slash);
var _util = __webpack_require__(/*! util */ 70);
exports.inherits = _util.inherits;
exports.inspect = _util.inspect;
/**
* Test if a filename ends with a compilable extension.
*/
function canCompile(filename, altExts) {
var exts = altExts || canCompile.EXTENSIONS;
var ext = _path2["default"].extname(filename);
return _lodashCollectionContains2["default"](exts, ext);
}
/**
* Default set of compilable extensions.
*/
canCompile.EXTENSIONS = [".js", ".jsx", ".es6", ".es"];
/**
* Create an array from any value, splitting strings by ",".
*/
function list(val) {
if (!val) {
return [];
} else if (Array.isArray(val)) {
return val;
} else if (typeof val === "string") {
return val.split(",");
} else {
return [val];
}
}
/**
* Create a RegExp from a string, array, or regexp.
*/
function regexify(val) {
if (!val) {
return new RegExp(/.^/);
}
if (Array.isArray(val)) {
val = new RegExp(val.map(_lodashStringEscapeRegExp2["default"]).join("|"), "i");
}
if (typeof val === "string") {
// normalise path separators
val = _slash2["default"](val);
// remove starting wildcards or relative separator if present
if (_lodashStringStartsWith2["default"](val, "./") || _lodashStringStartsWith2["default"](val, "*/")) val = val.slice(2);
if (_lodashStringStartsWith2["default"](val, "**/")) val = val.slice(3);
var regex = _minimatch2["default"].makeRe(val, { nocase: true });
return new RegExp(regex.source.slice(1, -1), "i");
}
if (_lodashLangIsRegExp2["default"](val)) {
return val;
}
throw new TypeError("illegal type for regexify");
}
/**
* Create an array from a boolean, string, or array, mapped by and optional function.
*/
function arrayify(val, mapFn) {
if (!val) return [];
if (_lodashLangIsBoolean2["default"](val)) return arrayify([val], mapFn);
if (_lodashLangIsString2["default"](val)) return arrayify(list(val), mapFn);
if (Array.isArray(val)) {
if (mapFn) val = val.map(mapFn);
return val;
}
return [val];
}
/**
* Makes boolean-like strings into booleans.
*/
function booleanify(val) {
if (val === "true" || val == 1) {
return true;
}
if (val === "false" || val == 0 || !val) {
return false;
}
return val;
}
/**
* Tests if a filename should be ignored based on "ignore" and "only" options.
*/
function shouldIgnore(filename, ignore, only) {
if (ignore === undefined) ignore = [];
filename = _slash2["default"](filename);
if (only) {
for (var _i = 0; _i < only.length; _i++) {
var pattern = only[_i];
if (_shouldIgnore(pattern, filename)) return false;
}
return true;
} else if (ignore.length) {
for (var _i2 = 0; _i2 < ignore.length; _i2++) {
var pattern = ignore[_i2];
if (_shouldIgnore(pattern, filename)) return true;
}
}
return false;
}
/**
* Returns result of calling function with filename if pattern is a function.
* Otherwise returns result of matching pattern Regex with filename.
*/
function _shouldIgnore(pattern, filename) {
if (typeof pattern === "function") {
return pattern(filename);
} else {
return pattern.test(filename);
}
}
/***/ },
/* 108 */
/*!*****************************************************!*\
!*** ./~/babel-core/~/babel-types/lib/constants.js ***!
\*****************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _Symbol$for = __webpack_require__(/*! babel-runtime/core-js/symbol/for */ 53)["default"];
exports.__esModule = true;
var STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"];
exports.STATEMENT_OR_BLOCK_KEYS = STATEMENT_OR_BLOCK_KEYS;
var FLATTENABLE_KEYS = ["body", "expressions"];
exports.FLATTENABLE_KEYS = FLATTENABLE_KEYS;
var FOR_INIT_KEYS = ["left", "init"];
exports.FOR_INIT_KEYS = FOR_INIT_KEYS;
var COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"];
exports.COMMENT_KEYS = COMMENT_KEYS;
var LOGICAL_OPERATORS = ["||", "&&"];
exports.LOGICAL_OPERATORS = LOGICAL_OPERATORS;
var UPDATE_OPERATORS = ["++", "--"];
exports.UPDATE_OPERATORS = UPDATE_OPERATORS;
var BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="];
exports.BOOLEAN_NUMBER_BINARY_OPERATORS = BOOLEAN_NUMBER_BINARY_OPERATORS;
var EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="];
exports.EQUALITY_BINARY_OPERATORS = EQUALITY_BINARY_OPERATORS;
var COMPARISON_BINARY_OPERATORS = [].concat(EQUALITY_BINARY_OPERATORS, ["in", "instanceof"]);
exports.COMPARISON_BINARY_OPERATORS = COMPARISON_BINARY_OPERATORS;
var BOOLEAN_BINARY_OPERATORS = [].concat(COMPARISON_BINARY_OPERATORS, BOOLEAN_NUMBER_BINARY_OPERATORS);
exports.BOOLEAN_BINARY_OPERATORS = BOOLEAN_BINARY_OPERATORS;
var NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"];
exports.NUMBER_BINARY_OPERATORS = NUMBER_BINARY_OPERATORS;
var BINARY_OPERATORS = ["+"].concat(NUMBER_BINARY_OPERATORS, BOOLEAN_BINARY_OPERATORS);
exports.BINARY_OPERATORS = BINARY_OPERATORS;
var BOOLEAN_UNARY_OPERATORS = ["delete", "!"];
exports.BOOLEAN_UNARY_OPERATORS = BOOLEAN_UNARY_OPERATORS;
var NUMBER_UNARY_OPERATORS = ["+", "-", "++", "--", "~"];
exports.NUMBER_UNARY_OPERATORS = NUMBER_UNARY_OPERATORS;
var STRING_UNARY_OPERATORS = ["typeof"];
exports.STRING_UNARY_OPERATORS = STRING_UNARY_OPERATORS;
var UNARY_OPERATORS = ["void"].concat(BOOLEAN_UNARY_OPERATORS, NUMBER_UNARY_OPERATORS, STRING_UNARY_OPERATORS);
exports.UNARY_OPERATORS = UNARY_OPERATORS;
var INHERIT_KEYS = {
optional: ["typeAnnotation", "typeParameters", "returnType"],
force: ["start", "loc", "end"]
};
exports.INHERIT_KEYS = INHERIT_KEYS;
var BLOCK_SCOPED_SYMBOL = _Symbol$for("var used to be block scoped");
exports.BLOCK_SCOPED_SYMBOL = BLOCK_SCOPED_SYMBOL;
var NOT_LOCAL_BINDING = _Symbol$for("should not be considered a local binding");
exports.NOT_LOCAL_BINDING = NOT_LOCAL_BINDING;
/***/ },
/* 109 */
/*!**********************************************************!*\
!*** ./~/babel-generator/~/babel-types/lib/constants.js ***!
\**********************************************************/
108,
/* 110 */
/*!*******************************************************!*\
!*** ./~/babel-plugin-syntax-decorators/lib/index.js ***!
\*******************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("decorators");
}
};
};
module.exports = exports["default"];
/***/ },
/* 111 */
/*!*************************************************!*\
!*** ./~/babel-plugin-syntax-flow/lib/index.js ***!
\*************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("flow");
}
};
};
module.exports = exports["default"];
/***/ },
/* 112 */
/*!************************************************!*\
!*** ./~/babel-plugin-syntax-jsx/lib/index.js ***!
\************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("jsx");
}
};
};
module.exports = exports["default"];
/***/ },
/* 113 */
/*!********************************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-classes/~/babel-types/lib/constants.js ***!
\********************************************************************************/
108,
/* 114 */
/*!***********************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-modules-commonjs/lib/index.js ***!
\***********************************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _Symbol = __webpack_require__(/*! babel-runtime/core-js/symbol */ 16)["default"];
var _getIterator = __webpack_require__(/*! babel-runtime/core-js/get-iterator */ 4)["default"];
var _Object$create = __webpack_require__(/*! babel-runtime/core-js/object/create */ 10)["default"];
var _Object$keys = __webpack_require__(/*! babel-runtime/core-js/object/keys */ 14)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _path2 = __webpack_require__(/*! path */ 22);
var _babelTemplate = __webpack_require__(/*! babel-template */ 9);
var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
var _babelTypes = __webpack_require__(/*! babel-types */ 27);
var t = _interopRequireWildcard(_babelTypes);
var buildRequire = _babelTemplate2["default"]("\n require($0);\n");
var buildExportsModuleDeclaration = _babelTemplate2["default"]("\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n");
var buildExportsFrom = _babelTemplate2["default"]("\n Object.defineProperty(exports, $0, {\n enumerable: true,\n get: function () {\n return $1;\n }\n });\n");
var buildLooseExportsModuleDeclaration = _babelTemplate2["default"]("\n exports.__esModule = true;\n");
var buildExportsAssignment = _babelTemplate2["default"]("\n exports.$0 = $1;\n");
var buildExportAll = _babelTemplate2["default"]("\n Object.keys(OBJECT).forEach(function (key) {\n if (key === \"default\") return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function () {\n return OBJECT[key];\n }\n });\n });\n");
var THIS_BREAK_KEYS = ["FunctionExpression", "FunctionDeclaration", "ClassProperty", "ClassMethod", "ObjectMethod"];
exports["default"] = function () {
var REASSIGN_REMAP_SKIP = _Symbol();
var reassignmentVisitor = {
ReferencedIdentifier: function ReferencedIdentifier(path) {
var name = path.node.name;
var remap = this.remaps[name];
if (!remap) return;
// redeclared in this scope
if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;
if (path.parentPath.isCallExpression({ callee: path.node })) {
path.replaceWith(t.sequenceExpression([t.numericLiteral(0), remap]));
} else {
path.replaceWith(remap);
}
this.requeueInParent(path);
},
AssignmentExpression: function AssignmentExpression(path) {
var node = path.node;
if (node[REASSIGN_REMAP_SKIP]) return;
var left = path.get("left");
if (!left.isIdentifier()) return;
var name = left.node.name;
var exports = this.exports[name];
if (!exports) return;
// redeclared in this scope
if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;
node[REASSIGN_REMAP_SKIP] = true;
for (var _iterator = exports, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var reid = _ref;
node = buildExportsAssignment(reid, node).expression;
}
path.replaceWith(node);
this.requeueInParent(path);
},
UpdateExpression: function UpdateExpression(path) {
var arg = path.get("argument");
if (!arg.isIdentifier()) return;
var name = arg.node.name;
var exports = this.exports[name];
if (!exports) return;
// redeclared in this scope
if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;
var node = t.assignmentExpression(path.node.operator[0] + "=", arg.node, t.numericLiteral(1));
if (path.parentPath.isExpressionStatement() && !path.isCompletionRecord() || path.node.prefix) {
path.replaceWith(node);
this.requeueInParent(path);
return;
}
var nodes = [];
nodes.push(node);
var operator = undefined;
if (path.node.operator === "--") {
operator = "+";
} else {
// "++"
operator = "-";
}
nodes.push(t.binaryExpression(operator, arg.node, t.numericLiteral(1)));
var newPaths = path.replaceWithMultiple(t.sequenceExpression(nodes));
for (var _iterator2 = newPaths, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _getIterator(_iterator2);;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var newPath = _ref2;
this.requeueInParent(newPath);
}
}
};
return {
inherits: __webpack_require__(/*! babel-plugin-transform-strict-mode */ 116),
visitor: {
ThisExpression: function ThisExpression(path, state) {
// If other plugins run after this plugin's Program#exit handler, we allow them to
// insert top-level `this` values. This allows the AMD and UMD plugins to
// function properly.
if (this.ranCommonJS) return;
if (state.opts.allowTopLevelThis !== true && !path.findParent(function (path) {
return !path.is("shadow") && THIS_BREAK_KEYS.indexOf(path.type) >= 0;
})) {
path.replaceWith(t.identifier("undefined"));
}
},
Program: {
exit: function exit(path) {
this.ranCommonJS = true;
var strict = !!this.opts.strict;
var scope = path.scope;
// rename these commonjs variables if they're declared in the file
scope.rename("module");
scope.rename("exports");
scope.rename("require");
var hasExports = false;
var hasImports = false;
var body = path.get("body");
var imports = _Object$create(null);
var exports = _Object$create(null);
var nonHoistedExportNames = _Object$create(null);
var topNodes = [];
var remaps = _Object$create(null);
var requires = _Object$create(null);
function addRequire(source, blockHoist) {
var cached = requires[source];
if (cached) return cached;
var ref = path.scope.generateUidIdentifier(_path2.basename(source, _path2.extname(source)));
var varDecl = t.variableDeclaration("var", [t.variableDeclarator(ref, buildRequire(t.stringLiteral(source)).expression)]);
// Copy location from the original import statement for sourcemap
// generation.
if (imports[source]) {
varDecl.loc = imports[source].loc;
}
if (typeof blockHoist === "number" && blockHoist > 0) {
varDecl._blockHoist = blockHoist;
}
topNodes.push(varDecl);
return requires[source] = ref;
}
function addTo(obj, key, arr) {
var existing = obj[key] || [];
obj[key] = existing.concat(arr);
}
for (var _i3 = 0; _i3 < body.length; _i3++) {
var _path = body[_i3];
if (_path.isExportDeclaration()) {
hasExports = true;
var specifiers = [].concat(_path.get("declaration"), _path.get("specifiers"));
for (var _iterator4 = specifiers, _isArray4 = Array.isArray(_iterator4), _i5 = 0, _iterator4 = _isArray4 ? _iterator4 : _getIterator(_iterator4);;) {
var _ref4;
if (_isArray4) {
if (_i5 >= _iterator4.length) break;
_ref4 = _iterator4[_i5++];
} else {
_i5 = _iterator4.next();
if (_i5.done) break;
_ref4 = _i5.value;
}
var specifier = _ref4;
var ids = specifier.getBindingIdentifiers();
if (ids.__esModule) {
throw specifier.buildCodeFrameError("Illegal export \"__esModule\"");
}
}
}
if (_path.isImportDeclaration()) {
// istanbul ignore next
var _importsEntry$specifiers;
hasImports = true;
var key = _path.node.source.value;
var importsEntry = imports[key] || {
specifiers: [],
maxBlockHoist: 0,
loc: _path.node.loc
};
(_importsEntry$specifiers = importsEntry.specifiers).push.apply(_importsEntry$specifiers, _path.node.specifiers);
if (typeof _path.node._blockHoist === "number") {
importsEntry.maxBlockHoist = Math.max(_path.node._blockHoist, importsEntry.maxBlockHoist);
}
imports[key] = importsEntry;
_path.remove();
} else if (_path.isExportDefaultDeclaration()) {
var declaration = _path.get("declaration");
if (declaration.isFunctionDeclaration()) {
var id = declaration.node.id;
var defNode = t.identifier("default");
if (id) {
addTo(exports, id.name, defNode);
topNodes.push(buildExportsAssignment(defNode, id));
_path.replaceWith(declaration.node);
} else {
topNodes.push(buildExportsAssignment(defNode, t.toExpression(declaration.node)));
_path.remove();
}
} else if (declaration.isClassDeclaration()) {
var id = declaration.node.id;
var defNode = t.identifier("default");
if (id) {
addTo(exports, id.name, defNode);
_path.replaceWithMultiple([declaration.node, buildExportsAssignment(defNode, id)]);
} else {
_path.replaceWith(buildExportsAssignment(defNode, t.toExpression(declaration.node)));
}
} else {
_path.replaceWith(buildExportsAssignment(t.identifier("default"), declaration.node));
// Manualy re-queue `export default foo;` expressions so that the ES3 transform
// has an opportunity to convert them. Ideally this would happen automatically from the
// replaceWith above. See T7166 for more info.
_path.parentPath.requeue(_path.get("expression.left"));
}
} else if (_path.isExportNamedDeclaration()) {
var declaration = _path.get("declaration");
if (declaration.node) {
if (declaration.isFunctionDeclaration()) {
var id = declaration.node.id;
addTo(exports, id.name, id);
topNodes.push(buildExportsAssignment(id, id));
_path.replaceWith(declaration.node);
} else if (declaration.isClassDeclaration()) {
var id = declaration.node.id;
addTo(exports, id.name, id);
_path.replaceWithMultiple([declaration.node, buildExportsAssignment(id, id)]);
nonHoistedExportNames[id.name] = true;
} else if (declaration.isVariableDeclaration()) {
var declarators = declaration.get("declarations");
for (var _iterator5 = declarators, _isArray5 = Array.isArray(_iterator5), _i6 = 0, _iterator5 = _isArray5 ? _iterator5 : _getIterator(_iterator5);;) {
var _ref5;
if (_isArray5) {
if (_i6 >= _iterator5.length) break;
_ref5 = _iterator5[_i6++];
} else {
_i6 = _iterator5.next();
if (_i6.done) break;
_ref5 = _i6.value;
}
var decl = _ref5;
var id = decl.get("id");
var init = decl.get("init");
if (!init.node) init.replaceWith(t.identifier("undefined"));
if (id.isIdentifier()) {
addTo(exports, id.node.name, id.node);
init.replaceWith(buildExportsAssignment(id.node, init.node).expression);
nonHoistedExportNames[id.node.name] = true;
} else {
// todo
}
}
_path.replaceWith(declaration.node);
}
continue;
}
var specifiers = _path.get("specifiers");
if (specifiers.length) {
var nodes = [];
var source = _path.node.source;
if (source) {
var ref = addRequire(source.value, _path.node._blockHoist);
for (var _iterator6 = specifiers, _isArray6 = Array.isArray(_iterator6), _i7 = 0, _iterator6 = _isArray6 ? _iterator6 : _getIterator(_iterator6);;) {
var _ref6;
if (_isArray6) {
if (_i7 >= _iterator6.length) break;
_ref6 = _iterator6[_i7++];
} else {
_i7 = _iterator6.next();
if (_i7.done) break;
_ref6 = _i7.value;
}
var specifier = _ref6;
if (specifier.isExportNamespaceSpecifier()) {
// todo
} else if (specifier.isExportDefaultSpecifier()) {
// todo
} else if (specifier.isExportSpecifier()) {
if (specifier.node.local.name === "default") {
topNodes.push(buildExportsFrom(t.stringLiteral(specifier.node.exported.name), t.memberExpression(t.callExpression(this.addHelper("interopRequireDefault"), [ref]), specifier.node.local)));
} else {
topNodes.push(buildExportsFrom(t.stringLiteral(specifier.node.exported.name), t.memberExpression(ref, specifier.node.local)));
}
nonHoistedExportNames[specifier.node.exported.name] = true;
}
}
} else {
for (var _iterator7 = specifiers, _isArray7 = Array.isArray(_iterator7), _i8 = 0, _iterator7 = _isArray7 ? _iterator7 : _getIterator(_iterator7);;) {
var _ref7;
if (_isArray7) {
if (_i8 >= _iterator7.length) break;
_ref7 = _iterator7[_i8++];
} else {
_i8 = _iterator7.next();
if (_i8.done) break;
_ref7 = _i8.value;
}
var specifier = _ref7;
if (specifier.isExportSpecifier()) {
addTo(exports, specifier.node.local.name, specifier.node.exported);
nonHoistedExportNames[specifier.node.exported.name] = true;
nodes.push(buildExportsAssignment(specifier.node.exported, specifier.node.local));
}
}
}
_path.replaceWithMultiple(nodes);
}
} else if (_path.isExportAllDeclaration()) {
var exportNode = buildExportAll({
OBJECT: addRequire(_path.node.source.value, _path.node._blockHoist)
});
exportNode.loc = _path.node.loc;
topNodes.push(exportNode);
_path.remove();
}
}
for (var source in imports) {
var _imports$source = imports[source];
var specifiers = _imports$source.specifiers;
var maxBlockHoist = _imports$source.maxBlockHoist;
if (specifiers.length) {
var uid = addRequire(source, maxBlockHoist);
var wildcard = undefined;
for (var i = 0; i < specifiers.length; i++) {
var specifier = specifiers[i];
if (t.isImportNamespaceSpecifier(specifier)) {
if (strict) {
remaps[specifier.local.name] = uid;
} else {
var varDecl = t.variableDeclaration("var", [t.variableDeclarator(specifier.local, t.callExpression(this.addHelper("interopRequireWildcard"), [uid]))]);
if (maxBlockHoist > 0) {
varDecl._blockHoist = maxBlockHoist;
}
topNodes.push(varDecl);
}
wildcard = specifier.local;
} else if (t.isImportDefaultSpecifier(specifier)) {
specifiers[i] = t.importSpecifier(specifier.local, t.identifier("default"));
}
}
for (var _iterator3 = specifiers, _isArray3 = Array.isArray(_iterator3), _i4 = 0, _iterator3 = _isArray3 ? _iterator3 : _getIterator(_iterator3);;) {
var _ref3;
if (_isArray3) {
if (_i4 >= _iterator3.length) break;
_ref3 = _iterator3[_i4++];
} else {
_i4 = _iterator3.next();
if (_i4.done) break;
_ref3 = _i4.value;
}
var specifier = _ref3;
if (t.isImportSpecifier(specifier)) {
var target = uid;
if (specifier.imported.name === "default") {
if (wildcard) {
target = wildcard;
} else {
target = wildcard = path.scope.generateUidIdentifier(uid.name);
var varDecl = t.variableDeclaration("var", [t.variableDeclarator(target, t.callExpression(this.addHelper("interopRequireDefault"), [uid]))]);
if (maxBlockHoist > 0) {
varDecl._blockHoist = maxBlockHoist;
}
topNodes.push(varDecl);
}
}
remaps[specifier.local.name] = t.memberExpression(target, t.cloneWithoutLoc(specifier.imported));
}
}
} else {
// bare import
var requireNode = buildRequire(t.stringLiteral(source));
requireNode.loc = imports[source].loc;
topNodes.push(requireNode);
}
}
if (hasImports && _Object$keys(nonHoistedExportNames).length) {
var hoistedExportsNode = t.identifier("undefined");
for (var _name in nonHoistedExportNames) {
hoistedExportsNode = buildExportsAssignment(t.identifier(_name), hoistedExportsNode).expression;
}
var node = t.expressionStatement(hoistedExportsNode);
node._blockHoist = 3;
topNodes.unshift(node);
}
// add __esModule declaration if this file has any exports
if (hasExports && !strict) {
var buildTemplate = buildExportsModuleDeclaration;
if (this.opts.loose) buildTemplate = buildLooseExportsModuleDeclaration;
var declar = buildTemplate();
declar._blockHoist = 3;
topNodes.unshift(declar);
}
path.unshiftContainer("body", topNodes);
path.traverse(reassignmentVisitor, {
remaps: remaps,
scope: scope,
exports: exports,
requeueInParent: function requeueInParent(newPath) {
return path.requeue(newPath);
}
});
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 115 */
/*!*****************************************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-modules-commonjs/~/babel-types/lib/constants.js ***!
\*****************************************************************************************/
108,
/* 116 */
/*!***********************************************************!*\
!*** ./~/babel-plugin-transform-strict-mode/lib/index.js ***!
\***********************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
exports["default"] = function () {
return {
visitor: {
Program: function Program(path, state) {
if (state.opts.strict === false) return;
var node = path.node;
var _arr = node.directives;
for (var _i = 0; _i < _arr.length; _i++) {
var directive = _arr[_i];
if (directive.value.value === "use strict") return;
}
path.unshiftContainer("directives", t.directive(t.directiveLiteral("use strict")));
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 117 */
/*!**************************************************!*\
!*** ./~/babel-runtime/core-js/object/assign.js ***!
\**************************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(/*! core-js/library/fn/object/assign */ 413), __esModule: true };
/***/ },
/* 118 */
/*!****************************************************!*\
!*** ./~/babel-runtime/helpers/interop-require.js ***!
\****************************************************/
/***/ function(module, exports) {
"use strict";
exports["default"] = function (obj) {
return obj && obj.__esModule ? obj["default"] : obj;
};
exports.__esModule = true;
/***/ },
/* 119 */
/*!*********************************************!*\
!*** ./~/babel-traverse/lib/scope/index.js ***!
\*********************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _createClass = __webpack_require__(/*! babel-runtime/helpers/create-class */ 374)["default"];
var _classCallCheck = __webpack_require__(/*! babel-runtime/helpers/class-call-check */ 5)["default"];
var _getIterator = __webpack_require__(/*! babel-runtime/core-js/get-iterator */ 4)["default"];
var _Object$create = __webpack_require__(/*! babel-runtime/core-js/object/create */ 10)["default"];
var _Object$keys = __webpack_require__(/*! babel-runtime/core-js/object/keys */ 14)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _lodashCollectionIncludes = __webpack_require__(/*! lodash/collection/includes */ 99);
var _lodashCollectionIncludes2 = _interopRequireDefault(_lodashCollectionIncludes);
var _repeating = __webpack_require__(/*! repeating */ 48);
var _repeating2 = _interopRequireDefault(_repeating);
var _libRenamer = __webpack_require__(/*! ./lib/renamer */ 391);
var _libRenamer2 = _interopRequireDefault(_libRenamer);
var _index = __webpack_require__(/*! ../index */ 6);
var _index2 = _interopRequireDefault(_index);
var _lodashObjectDefaults = __webpack_require__(/*! lodash/object/defaults */ 231);
var _lodashObjectDefaults2 = _interopRequireDefault(_lodashObjectDefaults);
var _babelMessages = __webpack_require__(/*! babel-messages */ 19);
var messages = _interopRequireWildcard(_babelMessages);
var _binding = __webpack_require__(/*! ./binding */ 193);
var _binding2 = _interopRequireDefault(_binding);
var _globals = __webpack_require__(/*! globals */ 457);
var _globals2 = _interopRequireDefault(_globals);
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
var _cache = __webpack_require__(/*! ../cache */ 93);
// Number of calls to the crawl method to figure out whether we're
// somewhere inside a call that was trigerred by call. This is meant
// to be used to figure out whether a warning should be trigerred.
// See `warnOnFlowBinding`.
var _crawlCallsCount = 0;
/**
* To avoid creating a new Scope instance for each traversal, we maintain a cache on the
* node itself containing all scopes it has been associated with.
*/
function getCache(path, parentScope, self) {
var scopes = _cache.scope.get(path.node) || [];
for (var _i = 0; _i < scopes.length; _i++) {
var scope = scopes[_i];
if (scope.parent === parentScope && scope.path === path) return scope;
}
scopes.push(self);
if (!_cache.scope.has(path.node)) {
_cache.scope.set(path.node, scopes);
}
}
//
var collectorVisitor = {
For: function For(path) {
var _arr = t.FOR_INIT_KEYS;
for (var _i2 = 0; _i2 < _arr.length; _i2++) {
var key = _arr[_i2];
var declar = path.get(key);
if (declar.isVar()) path.scope.getFunctionParent().registerBinding("var", declar);
}
},
Declaration: function Declaration(path) {
// delegate block scope handling to the `blockVariableVisitor`
if (path.isBlockScoped()) return;
// this will be hit again once we traverse into it after this iteration
if (path.isExportDeclaration() && path.get("declaration").isDeclaration()) return;
// TODO(amasad): remove support for flow as bindings (See warning below).
//if (path.isFlow()) return;
// we've ran into a declaration!
path.scope.getFunctionParent().registerDeclaration(path);
},
ReferencedIdentifier: function ReferencedIdentifier(path, state) {
state.references.push(path);
},
ForXStatement: function ForXStatement(path, state) {
var left = path.get("left");
if (left.isPattern() || left.isIdentifier()) {
state.constantViolations.push(left);
}
},
ExportDeclaration: {
exit: function exit(_ref5) {
var node = _ref5.node;
var scope = _ref5.scope;
var declar = node.declaration;
if (t.isClassDeclaration(declar) || t.isFunctionDeclaration(declar)) {
var _id = declar.id;
if (!_id) return;
var binding = scope.getBinding(_id.name);
if (binding) binding.reference();
} else if (t.isVariableDeclaration(declar)) {
var _arr2 = declar.declarations;
for (var _i3 = 0; _i3 < _arr2.length; _i3++) {
var decl = _arr2[_i3];
var ids = t.getBindingIdentifiers(decl);
for (var _name in ids) {
var binding = scope.getBinding(_name);
if (binding) binding.reference();
}
}
}
}
},
LabeledStatement: function LabeledStatement(path) {
path.scope.getProgramParent().addGlobal(path.node);
path.scope.getBlockParent().registerDeclaration(path);
},
AssignmentExpression: function AssignmentExpression(path, state) {
state.assignments.push(path);
},
UpdateExpression: function UpdateExpression(path, state) {
state.constantViolations.push(path.get("argument"));
},
UnaryExpression: function UnaryExpression(path, state) {
if (path.node.operator === "delete") {
state.constantViolations.push(path.get("argument"));
}
},
BlockScoped: function BlockScoped(path) {
var scope = path.scope;
if (scope.path === path) scope = scope.parent;
scope.getBlockParent().registerDeclaration(path);
},
ClassDeclaration: function ClassDeclaration(path) {
var id = path.node.id;
if (!id) return;
var name = id.name;
path.scope.bindings[name] = path.scope.getBinding(name);
},
Block: function Block(path) {
var paths = path.get("body");
var _arr3 = paths;
for (var _i4 = 0; _i4 < _arr3.length; _i4++) {
var bodyPath = _arr3[_i4];
if (bodyPath.isFunctionDeclaration()) {
path.scope.getBlockParent().registerDeclaration(bodyPath);
}
}
}
};
var uid = 0;
var Scope = (function () {
/**
* This searches the current "scope" and collects all references/bindings
* within.
*/
function Scope(path, parentScope) {
_classCallCheck(this, Scope);
if (parentScope && parentScope.block === path.node) {
return parentScope;
}
var cached = getCache(path, parentScope, this);
if (cached) return cached;
this.uid = uid++;
this.parent = parentScope;
this.hub = path.hub;
this.parentBlock = path.parent;
this.block = path.node;
this.path = path;
}
/**
* Globals.
*/
/**
* Traverse node with current scope and path.
*/
Scope.prototype.traverse = function traverse(node, opts, state) {
_index2["default"](node, opts, this, state, this.path);
};
/**
* Generate a unique identifier and add it to the current scope.
*/
Scope.prototype.generateDeclaredUidIdentifier = function generateDeclaredUidIdentifier() {
var name = arguments.length <= 0 || arguments[0] === undefined ? "temp" : arguments[0];
var id = this.generateUidIdentifier(name);
this.push({ id: id });
return id;
};
/**
* Generate a unique identifier.
*/
Scope.prototype.generateUidIdentifier = function generateUidIdentifier() {
var name = arguments.length <= 0 || arguments[0] === undefined ? "temp" : arguments[0];
return t.identifier(this.generateUid(name));
};
/**
* Generate a unique `_id1` binding.
*/
Scope.prototype.generateUid = function generateUid() {
var name = arguments.length <= 0 || arguments[0] === undefined ? "temp" : arguments[0];
name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
var uid = undefined;
var i = 0;
do {
uid = this._generateUid(name, i);
i++;
} while (this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid));
var program = this.getProgramParent();
program.references[uid] = true;
program.uids[uid] = true;
return uid;
};
/**
* Generate an `_id1`.
*/
Scope.prototype._generateUid = function _generateUid(name, i) {
var id = name;
if (i > 1) id += i;
return "_" + id;
};
/**
* Generate a unique identifier based on a node.
*/
Scope.prototype.generateUidIdentifierBasedOnNode = function generateUidIdentifierBasedOnNode(parent, defaultName) {
var node = parent;
if (t.isAssignmentExpression(parent)) {
node = parent.left;
} else if (t.isVariableDeclarator(parent)) {
node = parent.id;
} else if (t.isObjectProperty(node) || t.isObjectMethod(node)) {
node = node.key;
}
var parts = [];
var add = function add(node) {
if (t.isModuleDeclaration(node)) {
if (node.source) {
add(node.source);
} else if (node.specifiers && node.specifiers.length) {
var _arr4 = node.specifiers;
for (var _i5 = 0; _i5 < _arr4.length; _i5++) {
var specifier = _arr4[_i5];
add(specifier);
}
} else if (node.declaration) {
add(node.declaration);
}
} else if (t.isModuleSpecifier(node)) {
add(node.local);
} else if (t.isMemberExpression(node)) {
add(node.object);
add(node.property);
} else if (t.isIdentifier(node)) {
parts.push(node.name);
} else if (t.isLiteral(node)) {
parts.push(node.value);
} else if (t.isCallExpression(node)) {
add(node.callee);
} else if (t.isObjectExpression(node) || t.isObjectPattern(node)) {
var _arr5 = node.properties;
for (var _i6 = 0; _i6 < _arr5.length; _i6++) {
var prop = _arr5[_i6];
add(prop.key || prop.argument);
}
}
};
add(node);
var id = parts.join("$");
id = id.replace(/^_/, "") || defaultName || "ref";
return this.generateUidIdentifier(id.slice(0, 20));
};
/**
* Determine whether evaluating the specific input `node` is a consequenceless reference. ie.
* evaluating it wont result in potentially arbitrary code from being ran. The following are
* whitelisted and determined not to cause side effects:
*
* - `this` expressions
* - `super` expressions
* - Bound identifiers
*/
Scope.prototype.isStatic = function isStatic(node) {
if (t.isThisExpression(node) || t.isSuper(node)) {
return true;
}
if (t.isIdentifier(node)) {
var binding = this.getBinding(node.name);
if (binding) {
return binding.constant;
} else {
return this.hasBinding(node.name);
}
}
return false;
};
/**
* Possibly generate a memoised identifier if it is not static and has consequences.
*/
Scope.prototype.maybeGenerateMemoised = function maybeGenerateMemoised(node, dontPush) {
if (this.isStatic(node)) {
return null;
} else {
var _id2 = this.generateUidIdentifierBasedOnNode(node);
if (!dontPush) this.push({ id: _id2 });
return _id2;
}
};
Scope.prototype.checkBlockScopedCollisions = function checkBlockScopedCollisions(local, kind, name, id) {
// ignore parameters
if (kind === "param") return;
// ignore hoisted functions if there's also a local let
if (kind === "hoisted" && local.kind === "let") return;
var duplicate = false;
// don't allow duplicate bindings to exist alongside
if (!duplicate) duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module";
// don't allow a local of param with a kind of let
if (!duplicate) duplicate = local.kind === "param" && (kind === "let" || kind === "const");
if (duplicate) {
throw this.hub.file.buildCodeFrameError(id, messages.get("scopeDuplicateDeclaration", name), TypeError);
}
};
Scope.prototype.rename = function rename(oldName, newName, block) {
var binding = this.getBinding(oldName);
if (binding) {
newName = newName || this.generateUidIdentifier(oldName).name;
return new _libRenamer2["default"](binding, oldName, newName).rename(block);
}
};
Scope.prototype._renameFromMap = function _renameFromMap(map, oldName, newName, value) {
if (map[oldName]) {
map[newName] = value;
map[oldName] = null;
}
};
Scope.prototype.dump = function dump() {
var sep = _repeating2["default"]("-", 60);
console.log(sep);
var scope = this;
do {
console.log("#", scope.block.type);
for (var _name2 in scope.bindings) {
var binding = scope.bindings[_name2];
console.log(" -", _name2, {
constant: binding.constant,
references: binding.references,
violations: binding.constantViolations.length,
kind: binding.kind
});
}
} while (scope = scope.parent);
console.log(sep);
};
Scope.prototype.toArray = function toArray(node, i) {
var file = this.hub.file;
if (t.isIdentifier(node)) {
var binding = this.getBinding(node.name);
if (binding && binding.constant && binding.path.isGenericType("Array")) return node;
}
if (t.isArrayExpression(node)) {
return node;
}
if (t.isIdentifier(node, { name: "arguments" })) {
return t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.identifier("Array"), t.identifier("prototype")), t.identifier("slice")), t.identifier("call")), [node]);
}
var helperName = "toArray";
var args = [node];
if (i === true) {
helperName = "toConsumableArray";
} else if (i) {
args.push(t.numericLiteral(i));
helperName = "slicedToArray";
// TODO if (this.hub.file.isLoose("es6.forOf")) helperName += "-loose";
}
return t.callExpression(file.addHelper(helperName), args);
};
Scope.prototype.registerDeclaration = function registerDeclaration(path) {
if (path.isLabeledStatement()) {
this.registerBinding("label", path);
} else if (path.isFunctionDeclaration()) {
this.registerBinding("hoisted", path.get("id"), path);
} else if (path.isVariableDeclaration()) {
var declarations = path.get("declarations");
var _arr6 = declarations;
for (var _i7 = 0; _i7 < _arr6.length; _i7++) {
var declar = _arr6[_i7];
this.registerBinding(path.node.kind, declar);
}
} else if (path.isClassDeclaration()) {
this.registerBinding("let", path);
} else if (path.isImportDeclaration()) {
var specifiers = path.get("specifiers");
var _arr7 = specifiers;
for (var _i8 = 0; _i8 < _arr7.length; _i8++) {
var specifier = _arr7[_i8];
this.registerBinding("module", specifier);
}
} else if (path.isExportDeclaration()) {
var declar = path.get("declaration");
if (declar.isClassDeclaration() || declar.isFunctionDeclaration() || declar.isVariableDeclaration()) {
this.registerDeclaration(declar);
}
} else {
this.registerBinding("unknown", path);
}
};
Scope.prototype.buildUndefinedNode = function buildUndefinedNode() {
if (this.hasBinding("undefined")) {
return t.unaryExpression("void", t.numericLiteral(0), true);
} else {
return t.identifier("undefined");
}
};
Scope.prototype.registerConstantViolation = function registerConstantViolation(path) {
var ids = path.getBindingIdentifiers();
for (var _name3 in ids) {
var binding = this.getBinding(_name3);
if (binding) binding.reassign(path);
}
};
Scope.prototype.registerBinding = function registerBinding(kind, path) {
var bindingPath = arguments.length <= 2 || arguments[2] === undefined ? path : arguments[2];
return (function () {
if (!kind) throw new ReferenceError("no `kind`");
if (path.isVariableDeclaration()) {
var declarators = path.get("declarations");
for (var _i9 = 0; _i9 < declarators.length; _i9++) {
var declar = declarators[_i9];
this.registerBinding(kind, declar);
}
return;
}
var parent = this.getProgramParent();
var ids = path.getBindingIdentifiers(true);
for (var _name4 in ids) {
var _arr8 = ids[_name4];
for (var _i10 = 0; _i10 < _arr8.length; _i10++) {
var _id3 = _arr8[_i10];
var local = this.getOwnBinding(_name4);
if (local) {
// same identifier so continue safely as we're likely trying to register it
// multiple times
if (local.identifier === _id3) continue;
this.checkBlockScopedCollisions(local, kind, _name4, _id3);
}
// It's erroneous that we currently consider flow a binding, however, we can't
// remove it because people might be depending on it. See warning section
// in `warnOnFlowBinding`.
if (local && local.path.isFlow()) local = null;
parent.references[_name4] = true;
this.bindings[_name4] = new _binding2["default"]({
identifier: _id3,
existing: local,
scope: this,
path: bindingPath,
kind: kind
});
}
}
}).apply(this, arguments);
};
Scope.prototype.addGlobal = function addGlobal(node) {
this.globals[node.name] = node;
};
Scope.prototype.hasUid = function hasUid(name) {
var scope = this;
do {
if (scope.uids[name]) return true;
} while (scope = scope.parent);
return false;
};
Scope.prototype.hasGlobal = function hasGlobal(name) {
var scope = this;
do {
if (scope.globals[name]) return true;
} while (scope = scope.parent);
return false;
};
Scope.prototype.hasReference = function hasReference(name) {
var scope = this;
do {
if (scope.references[name]) return true;
} while (scope = scope.parent);
return false;
};
Scope.prototype.isPure = function isPure(node, constantsOnly) {
if (t.isIdentifier(node)) {
var binding = this.getBinding(node.name);
if (!binding) return false;
if (constantsOnly) return binding.constant;
return true;
} else if (t.isClass(node)) {
if (node.superClass && !this.isPure(node.superClass, constantsOnly)) return false;
return this.isPure(node.body, constantsOnly);
} else if (t.isClassBody(node)) {
for (var _iterator = node.body, _isArray = Array.isArray(_iterator), _i11 = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) {
var _ref;
if (_isArray) {
if (_i11 >= _iterator.length) break;
_ref = _iterator[_i11++];
} else {
_i11 = _iterator.next();
if (_i11.done) break;
_ref = _i11.value;
}
var method = _ref;
if (!this.isPure(method, constantsOnly)) return false;
}
return true;
} else if (t.isBinary(node)) {
return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly);
} else if (t.isArrayExpression(node)) {
var _arr9 = node.elements;
for (var _i12 = 0; _i12 < _arr9.length; _i12++) {
var elem = _arr9[_i12];
if (!this.isPure(elem, constantsOnly)) return false;
}
return true;
} else if (t.isObjectExpression(node)) {
var _arr10 = node.properties;
for (var _i13 = 0; _i13 < _arr10.length; _i13++) {
var prop = _arr10[_i13];
if (!this.isPure(prop, constantsOnly)) return false;
}
return true;
} else if (t.isClassMethod(node)) {
if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
if (node.kind === "get" || node.kind === "set") return false;
return true;
} else if (t.isClassProperty(node) || t.isObjectProperty(node)) {
if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
return this.isPure(node.value, constantsOnly);
} else if (t.isUnaryExpression(node)) {
return this.isPure(node.argument, constantsOnly);
} else {
return t.isPureish(node);
}
};
/**
* Set some arbitrary data on the current scope.
*/
Scope.prototype.setData = function setData(key, val) {
return this.data[key] = val;
};
/**
* Recursively walk up scope tree looking for the data `key`.
*/
Scope.prototype.getData = function getData(key) {
var scope = this;
do {
var data = scope.data[key];
if (data != null) return data;
} while (scope = scope.parent);
};
/**
* Recursively walk up scope tree looking for the data `key` and if it exists,
* remove it.
*/
Scope.prototype.removeData = function removeData(key) {
var scope = this;
do {
var data = scope.data[key];
if (data != null) scope.data[key] = null;
} while (scope = scope.parent);
};
Scope.prototype.init = function init() {
if (!this.references) this.crawl();
};
Scope.prototype.crawl = function crawl() {
_crawlCallsCount++;
this._crawl();
_crawlCallsCount--;
};
Scope.prototype._crawl = function _crawl() {
var path = this.path;
//
this.references = _Object$create(null);
this.bindings = _Object$create(null);
this.globals = _Object$create(null);
this.uids = _Object$create(null);
this.data = _Object$create(null);
// ForStatement - left, init
if (path.isLoop()) {
var _arr11 = t.FOR_INIT_KEYS;
for (var _i14 = 0; _i14 < _arr11.length; _i14++) {
var key = _arr11[_i14];
var node = path.get(key);
if (node.isBlockScoped()) this.registerBinding(node.node.kind, node);
}
}
// FunctionExpression - id
if (path.isFunctionExpression() && path.has("id")) {
if (!path.get("id").node[t.NOT_LOCAL_BINDING]) {
this.registerBinding("local", path.get("id"), path);
}
}
// Class
if (path.isClassExpression() && path.has("id")) {
if (!path.get("id").node[t.NOT_LOCAL_BINDING]) {
this.registerBinding("local", path);
}
}
// Function - params, rest
if (path.isFunction()) {
var params = path.get("params");
for (var _i15 = 0; _i15 < params.length; _i15++) {
var param = params[_i15];
this.registerBinding("param", param);
}
}
// CatchClause - param
if (path.isCatchClause()) {
this.registerBinding("let", path);
}
// Program
var parent = this.getProgramParent();
if (parent.crawling) return;
var state = {
references: [],
constantViolations: [],
assignments: []
};
this.crawling = true;
path.traverse(collectorVisitor, state);
this.crawling = false;
// register assignments
for (var _iterator2 = state.assignments, _isArray2 = Array.isArray(_iterator2), _i16 = 0, _iterator2 = _isArray2 ? _iterator2 : _getIterator(_iterator2);;) {
var _ref2;
if (_isArray2) {
if (_i16 >= _iterator2.length) break;
_ref2 = _iterator2[_i16++];
} else {
_i16 = _iterator2.next();
if (_i16.done) break;
_ref2 = _i16.value;
}
var _path = _ref2;
// register undeclared bindings as globals
var ids = _path.getBindingIdentifiers();
var programParent = undefined;
for (var _name5 in ids) {
if (_path.scope.getBinding(_name5)) continue;
programParent = programParent || _path.scope.getProgramParent();
programParent.addGlobal(ids[_name5]);
}
// register as constant violation
_path.scope.registerConstantViolation(_path);
}
// register references
for (var _iterator3 = state.references, _isArray3 = Array.isArray(_iterator3), _i17 = 0, _iterator3 = _isArray3 ? _iterator3 : _getIterator(_iterator3);;) {
var _ref3;
if (_isArray3) {
if (_i17 >= _iterator3.length) break;
_ref3 = _iterator3[_i17++];
} else {
_i17 = _iterator3.next();
if (_i17.done) break;
_ref3 = _i17.value;
}
var ref = _ref3;
var binding = ref.scope.getBinding(ref.node.name);
if (binding) {
binding.reference(ref);
} else {
ref.scope.getProgramParent().addGlobal(ref.node);
}
}
// register constant violations
for (var _iterator4 = state.constantViolations, _isArray4 = Array.isArray(_iterator4), _i18 = 0, _iterator4 = _isArray4 ? _iterator4 : _getIterator(_iterator4);;) {
var _ref4;
if (_isArray4) {
if (_i18 >= _iterator4.length) break;
_ref4 = _iterator4[_i18++];
} else {
_i18 = _iterator4.next();
if (_i18.done) break;
_ref4 = _i18.value;
}
var _path2 = _ref4;
_path2.scope.registerConstantViolation(_path2);
}
};
Scope.prototype.push = function push(opts) {
var path = this.path;
if (!path.isBlockStatement() && !path.isProgram()) {
path = this.getBlockParent().path;
}
if (path.isSwitchStatement()) {
path = this.getFunctionParent().path;
}
if (path.isLoop() || path.isCatchClause() || path.isFunction()) {
t.ensureBlock(path.node);
path = path.get("body");
}
var unique = opts.unique;
var kind = opts.kind || "var";
var blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist;
var dataKey = "declaration:" + kind + ":" + blockHoist;
var declarPath = !unique && path.getData(dataKey);
if (!declarPath) {
var declar = t.variableDeclaration(kind, []);
declar._generated = true;
declar._blockHoist = blockHoist;
var _path$unshiftContainer = path.unshiftContainer("body", [declar]);
declarPath = _path$unshiftContainer[0];
if (!unique) path.setData(dataKey, declarPath);
}
var declarator = t.variableDeclarator(opts.id, opts.init);
declarPath.node.declarations.push(declarator);
this.registerBinding(kind, declarPath.get("declarations").pop());
};
/**
* Walk up to the top of the scope tree and get the `Program`.
*/
Scope.prototype.getProgramParent = function getProgramParent() {
var scope = this;
do {
if (scope.path.isProgram()) {
return scope;
}
} while (scope = scope.parent);
throw new Error("We couldn't find a Function or Program...");
};
/**
* Walk up the scope tree until we hit either a Function or reach the
* very top and hit Program.
*/
Scope.prototype.getFunctionParent = function getFunctionParent() {
var scope = this;
do {
if (scope.path.isFunctionParent()) {
return scope;
}
} while (scope = scope.parent);
throw new Error("We couldn't find a Function or Program...");
};
/**
* Walk up the scope tree until we hit either a BlockStatement/Loop/Program/Function/Switch or reach the
* very top and hit Program.
*/
Scope.prototype.getBlockParent = function getBlockParent() {
var scope = this;
do {
if (scope.path.isBlockParent()) {
return scope;
}
} while (scope = scope.parent);
throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...");
};
/**
* Walks the scope tree and gathers **all** bindings.
*/
Scope.prototype.getAllBindings = function getAllBindings() {
var ids = _Object$create(null);
var scope = this;
do {
_lodashObjectDefaults2["default"](ids, scope.bindings);
scope = scope.parent;
} while (scope);
return ids;
};
/**
* Walks the scope tree and gathers all declarations of `kind`.
*/
Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind() {
var ids = _Object$create(null);
var _arr12 = arguments;
for (var _i19 = 0; _i19 < _arr12.length; _i19++) {
var kind = _arr12[_i19];
var scope = this;
do {
for (var _name6 in scope.bindings) {
var binding = scope.bindings[_name6];
if (binding.kind === kind) ids[_name6] = binding;
}
scope = scope.parent;
} while (scope);
}
return ids;
};
Scope.prototype.bindingIdentifierEquals = function bindingIdentifierEquals(name, node) {
return this.getBindingIdentifier(name) === node;
};
Scope.prototype.warnOnFlowBinding = function warnOnFlowBinding(binding) {
if (_crawlCallsCount === 0 && binding && binding.path.isFlow()) {
console.warn("\n You or one of the Babel plugins you are using are using Flow declarations as bindings.\n Support for this will be removed in version 6.8. To find out the caller, grep for this\n message and change it to a `console.trace()`.\n ");
}
return binding;
};
Scope.prototype.getBinding = function getBinding(name) {
var scope = this;
do {
var binding = scope.getOwnBinding(name);
if (binding) return this.warnOnFlowBinding(binding);
} while (scope = scope.parent);
};
Scope.prototype.getOwnBinding = function getOwnBinding(name) {
return this.warnOnFlowBinding(this.bindings[name]);
};
Scope.prototype.getBindingIdentifier = function getBindingIdentifier(name) {
var info = this.getBinding(name);
return info && info.identifier;
};
Scope.prototype.getOwnBindingIdentifier = function getOwnBindingIdentifier(name) {
var binding = this.bindings[name];
return binding && binding.identifier;
};
Scope.prototype.hasOwnBinding = function hasOwnBinding(name) {
return !!this.getOwnBinding(name);
};
Scope.prototype.hasBinding = function hasBinding(name, noGlobals) {
if (!name) return false;
if (this.hasOwnBinding(name)) return true;
if (this.parentHasBinding(name, noGlobals)) return true;
if (this.hasUid(name)) return true;
if (!noGlobals && _lodashCollectionIncludes2["default"](Scope.globals, name)) return true;
if (!noGlobals && _lodashCollectionIncludes2["default"](Scope.contextVariables, name)) return true;
return false;
};
Scope.prototype.parentHasBinding = function parentHasBinding(name, noGlobals) {
return this.parent && this.parent.hasBinding(name, noGlobals);
};
/**
* Move a binding of `name` to another `scope`.
*/
Scope.prototype.moveBindingTo = function moveBindingTo(name, scope) {
var info = this.getBinding(name);
if (info) {
info.scope.removeOwnBinding(name);
info.scope = scope;
scope.bindings[name] = info;
}
};
Scope.prototype.removeOwnBinding = function removeOwnBinding(name) {
delete this.bindings[name];
};
Scope.prototype.removeBinding = function removeBinding(name) {
// clear literal binding
var info = this.getBinding(name);
if (info) {
info.scope.removeOwnBinding(name);
}
// clear uids with this name - https://github.com/babel/babel/issues/2101
var scope = this;
do {
if (scope.uids[name]) {
scope.uids[name] = false;
}
} while (scope = scope.parent);
};
_createClass(Scope, null, [{
key: "globals",
value: _Object$keys(_globals2["default"].builtin),
/**
* Variables available in current context.
*/
enumerable: true
}, {
key: "contextVariables",
value: ["arguments", "undefined", "Infinity", "NaN"],
enumerable: true
}]);
return Scope;
})();
exports["default"] = Scope;
module.exports = exports["default"];
/***/ },
/* 120 */
/*!****************************************!*\
!*** ./~/babel-types/lib/constants.js ***!
\****************************************/
108,
/* 121 */
/*!****************************!*\
!*** ./~/babylon/index.js ***!
\****************************/
/***/ function(module, exports, __webpack_require__) {
var require;var require;(function(f){if(true){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.babylon = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return require(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
"use strict";
var _interopRequireDefault = _dereq_(25)["default"];
exports.__esModule = true;
exports.parse = parse;
var _parser = _dereq_(5);
var _parser2 = _interopRequireDefault(_parser);
_dereq_(10);
_dereq_(9);
_dereq_(7);
_dereq_(4);
_dereq_(8);
_dereq_(6);
_dereq_(3);
var _tokenizerTypes = _dereq_(17);
_dereq_(15);
_dereq_(14);
var _pluginsFlow = _dereq_(11);
var _pluginsFlow2 = _interopRequireDefault(_pluginsFlow);
var _pluginsJsx = _dereq_(12);
var _pluginsJsx2 = _interopRequireDefault(_pluginsJsx);
_parser.plugins.flow = _pluginsFlow2["default"];
_parser.plugins.jsx = _pluginsJsx2["default"];
function parse(input, options) {
return new _parser2["default"](options, input).parse();
}
exports.tokTypes = _tokenizerTypes.types;
},{"10":10,"11":11,"12":12,"14":14,"15":15,"17":17,"25":25,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9}],2:[function(_dereq_,module,exports){
// A second optional argument can be given to further configure
"use strict";
exports.__esModule = true;
exports.getOptions = getOptions;
var defaultOptions = {
// Source type ("script" or "module") for different semantics
sourceType: "script",
// Source filename.
sourceFilename: undefined,
// When enabled, a return at the top level is not considered an
// error.
allowReturnOutsideFunction: false,
// When enabled, import/export statements are not constrained to
// appearing at the top of the program.
allowImportExportEverywhere: false,
// TODO
allowSuperOutsideMethod: false,
// An array of plugins to enable
plugins: [],
// TODO
strictMode: null
};
exports.defaultOptions = defaultOptions;
// Interpret and default an options object
function getOptions(opts) {
var options = {};
for (var key in defaultOptions) {
options[key] = opts && key in opts ? opts[key] : defaultOptions[key];
}
return options;
}
// the parser process. These options are recognized:
},{}],3:[function(_dereq_,module,exports){
/* eslint max-len: 0 */
/**
* Based on the comment attachment algorithm used in espree and estraverse.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
"use strict";
var _interopRequireDefault = _dereq_(25)["default"];
var _index = _dereq_(5);
var _index2 = _interopRequireDefault(_index);
function last(stack) {
return stack[stack.length - 1];
}
var pp = _index2["default"].prototype;
pp.addComment = function (comment) {
this.state.trailingComments.push(comment);
this.state.leadingComments.push(comment);
};
pp.processComment = function (node) {
if (node.type === "Program" && node.body.length > 0) return;
var stack = this.state.commentStack;
var lastChild = undefined,
trailingComments = undefined,
i = undefined;
if (this.state.trailingComments.length > 0) {
// If the first comment in trailingComments comes after the
// current node, then we're good - all comments in the array will
// come after the node and so it's safe to add them as official
// trailingComments.
if (this.state.trailingComments[0].start >= node.end) {
trailingComments = this.state.trailingComments;
this.state.trailingComments = [];
} else {
// Otherwise, if the first comment doesn't come after the
// current node, that means we have a mix of leading and trailing
// comments in the array and that leadingComments contains the
// same items as trailingComments. Reset trailingComments to
// zero items and we'll handle this by evaluating leadingComments
// later.
this.state.trailingComments.length = 0;
}
} else {
var lastInStack = last(stack);
if (stack.length > 0 && lastInStack.trailingComments && lastInStack.trailingComments[0].start >= node.end) {
trailingComments = lastInStack.trailingComments;
lastInStack.trailingComments = null;
}
}
// Eating the stack.
while (stack.length > 0 && last(stack).start >= node.start) {
lastChild = stack.pop();
}
if (lastChild) {
if (lastChild.leadingComments) {
if (lastChild !== node && last(lastChild.leadingComments).end <= node.start) {
node.leadingComments = lastChild.leadingComments;
lastChild.leadingComments = null;
} else {
// A leading comment for an anonymous class had been stolen by its first ClassMethod,
// so this takes back the leading comment.
// See also: https://github.com/eslint/espree/issues/158
for (i = lastChild.leadingComments.length - 2; i >= 0; --i) {
if (lastChild.leadingComments[i].end <= node.start) {
node.leadingComments = lastChild.leadingComments.splice(0, i + 1);
break;
}
}
}
}
} else if (this.state.leadingComments.length > 0) {
if (last(this.state.leadingComments).end <= node.start) {
node.leadingComments = this.state.leadingComments;
this.state.leadingComments = [];
} else {
// https://github.com/eslint/espree/issues/2
//
// In special cases, such as return (without a value) and
// debugger, all comments will end up as leadingComments and
// will otherwise be eliminated. This step runs when the
// commentStack is empty and there are comments left
// in leadingComments.
//
// This loop figures out the stopping point between the actual
// leading and trailing comments by finding the location of the
// first comment that comes after the given node.
for (i = 0; i < this.state.leadingComments.length; i++) {
if (this.state.leadingComments[i].end > node.start) {
break;
}
}
// Split the array based on the location of the first comment
// that comes after the node. Keep in mind that this could
// result in an empty array, and if so, the array must be
// deleted.
node.leadingComments = this.state.leadingComments.slice(0, i);
if (node.leadingComments.length === 0) {
node.leadingComments = null;
}
// Similarly, trailing comments are attached later. The variable
// must be reset to null if there are no trailing comments.
trailingComments = this.state.leadingComments.slice(i);
if (trailingComments.length === 0) {
trailingComments = null;
}
}
}
if (trailingComments) {
if (trailingComments.length && trailingComments[0].start >= node.start && last(trailingComments).end <= node.end) {
node.innerComments = trailingComments;
} else {
node.trailingComments = trailingComments;
}
}
stack.push(node);
};
},{"25":25,"5":5}],4:[function(_dereq_,module,exports){
/* eslint indent: 0 */
/* eslint max-len: 0 */
// A recursive descent parser operates by defining functions for all
// syntactic elements, and recursively calling those, each function
// advancing the input stream and returning an AST node. Precedence
// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
// instead of `(!x)[1]` is handled by the fact that the parser
// function that parses unary prefix operators is called first, and
// in turn calls the function that parses `[]` subscripts — that
// way, it'll receive the node for `x[1]` already parsed, and wraps
// *that* in the unary operator node.
//
// Acorn uses an [operator precedence parser][opp] to handle binary
// operator precedence, because it is much more compact than using
// the technique outlined above, which uses different, nesting
// functions to specify precedence, for all of the ten binary
// precedence levels that JavaScript defines.
//
// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
"use strict";
var _Object$create = _dereq_(21)["default"];
var _interopRequireDefault = _dereq_(25)["default"];
var _tokenizerTypes = _dereq_(17);
var _index = _dereq_(5);
var _index2 = _interopRequireDefault(_index);
var _utilIdentifier = _dereq_(18);
var pp = _index2["default"].prototype;
// Check if property name clashes with already added.
// Object/class getters and setters are not allowed to clash —
// either with each other or with an init property — and in
// strict mode, init properties are also not allowed to be repeated.
pp.checkPropClash = function (prop, propHash) {
if (prop.computed) return;
var key = prop.key;
var name = undefined;
switch (key.type) {
case "Identifier":
name = key.name;
break;
case "StringLiteral":
case "NumericLiteral":
name = String(key.value);
break;
default:
return;
}
if (name === "__proto__" && prop.kind === "init") {
if (propHash.proto) this.raise(key.start, "Redefinition of __proto__ property");
propHash.proto = true;
}
};
// ### Expression parsing
// These nest, from the most general expression type at the top to
// 'atomic', nondivisible expression types at the bottom. Most of
// the functions will simply let the function (s) below them parse,
// and, *if* the syntactic construct they handle is present, wrap
// the AST node that the inner parser gave them in another node.
// Parse a full expression. The optional arguments are used to
// forbid the `in` operator (in for loops initalization expressions)
// and provide reference for storing '=' operator inside shorthand
// property assignment in contexts where both object expression
// and object pattern might appear (so it's possible to raise
// delayed syntax error at correct position).
pp.parseExpression = function (noIn, refShorthandDefaultPos) {
var startPos = this.state.start,
startLoc = this.state.startLoc;
var expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos);
if (this.match(_tokenizerTypes.types.comma)) {
var node = this.startNodeAt(startPos, startLoc);
node.expressions = [expr];
while (this.eat(_tokenizerTypes.types.comma)) {
node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos));
}
this.toReferencedList(node.expressions);
return this.finishNode(node, "SequenceExpression");
}
return expr;
};
// Parse an assignment expression. This includes applications of
// operators like `+=`.
pp.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse) {
if (this.match(_tokenizerTypes.types._yield) && this.state.inGenerator) {
return this.parseYield();
}
var failOnShorthandAssign = undefined;
if (refShorthandDefaultPos) {
failOnShorthandAssign = false;
} else {
refShorthandDefaultPos = { start: 0 };
failOnShorthandAssign = true;
}
var startPos = this.state.start;
var startLoc = this.state.startLoc;
if (this.match(_tokenizerTypes.types.parenL) || this.match(_tokenizerTypes.types.name)) {
this.state.potentialArrowAt = this.state.start;
}
var left = this.parseMaybeConditional(noIn, refShorthandDefaultPos);
if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc);
if (this.state.type.isAssign) {
var node = this.startNodeAt(startPos, startLoc);
node.operator = this.state.value;
node.left = this.match(_tokenizerTypes.types.eq) ? this.toAssignable(left) : left;
refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly
this.checkLVal(left);
if (left.extra && left.extra.parenthesized) {
var errorMsg = undefined;
if (left.type === "ObjectPattern") {
errorMsg = "`({a}) = 0` use `({a} = 0)`";
} else if (left.type === "ArrayPattern") {
errorMsg = "`([a]) = 0` use `([a] = 0)`";
}
if (errorMsg) {
this.raise(left.start, "You're trying to assign to a parenthesized expression, eg. instead of " + errorMsg);
}
}
this.next();
node.right = this.parseMaybeAssign(noIn);
return this.finishNode(node, "AssignmentExpression");
} else if (failOnShorthandAssign && refShorthandDefaultPos.start) {
this.unexpected(refShorthandDefaultPos.start);
}
return left;
};
// Parse a ternary conditional (`?:`) operator.
pp.parseMaybeConditional = function (noIn, refShorthandDefaultPos) {
var startPos = this.state.start,
startLoc = this.state.startLoc;
var expr = this.parseExprOps(noIn, refShorthandDefaultPos);
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
if (this.eat(_tokenizerTypes.types.question)) {
var node = this.startNodeAt(startPos, startLoc);
node.test = expr;
node.consequent = this.parseMaybeAssign();
this.expect(_tokenizerTypes.types.colon);
node.alternate = this.parseMaybeAssign(noIn);
return this.finishNode(node, "ConditionalExpression");
}
return expr;
};
// Start the precedence parser.
pp.parseExprOps = function (noIn, refShorthandDefaultPos) {
var startPos = this.state.start,
startLoc = this.state.startLoc;
var expr = this.parseMaybeUnary(refShorthandDefaultPos);
if (refShorthandDefaultPos && refShorthandDefaultPos.start) {
return expr;
} else {
return this.parseExprOp(expr, startPos, startLoc, -1, noIn);
}
};
// Parse binary operators with the operator precedence parsing
// algorithm. `left` is the left-hand side of the operator.
// `minPrec` provides context that allows the function to stop and
// defer further parser to one of its callers when it encounters an
// operator that has a lower precedence than the set it is parsing.
pp.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) {
var prec = this.state.type.binop;
if (prec != null && (!noIn || !this.match(_tokenizerTypes.types._in))) {
if (prec > minPrec) {
var node = this.startNodeAt(leftStartPos, leftStartLoc);
node.left = left;
node.operator = this.state.value;
if (node.operator === "**" && left.type === "UnaryExpression" && left.extra && !left.extra.parenthesizedArgument) {
this.raise(left.argument.start, "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.");
}
var op = this.state.type;
this.next();
var startPos = this.state.start;
var startLoc = this.state.startLoc;
node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, op.rightAssociative ? prec - 1 : prec, noIn);
this.finishNode(node, op === _tokenizerTypes.types.logicalOR || op === _tokenizerTypes.types.logicalAND ? "LogicalExpression" : "BinaryExpression");
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn);
}
}
return left;
};
// Parse unary operators, both prefix and postfix.
pp.parseMaybeUnary = function (refShorthandDefaultPos) {
if (this.state.type.prefix) {
var node = this.startNode();
var update = this.match(_tokenizerTypes.types.incDec);
node.operator = this.state.value;
node.prefix = true;
this.next();
var argType = this.state.type;
this.addExtra(node, "parenthesizedArgument", argType === _tokenizerTypes.types.parenL);
node.argument = this.parseMaybeUnary();
if (refShorthandDefaultPos && refShorthandDefaultPos.start) {
this.unexpected(refShorthandDefaultPos.start);
}
if (update) {
this.checkLVal(node.argument);
} else if (this.state.strict && node.operator === "delete" && node.argument.type === "Identifier") {
this.raise(node.start, "Deleting local variable in strict mode");
}
return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
}
var startPos = this.state.start,
startLoc = this.state.startLoc;
var expr = this.parseExprSubscripts(refShorthandDefaultPos);
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
while (this.state.type.postfix && !this.canInsertSemicolon()) {
var node = this.startNodeAt(startPos, startLoc);
node.operator = this.state.value;
node.prefix = false;
node.argument = expr;
this.checkLVal(expr);
this.next();
expr = this.finishNode(node, "UpdateExpression");
}
return expr;
};
// Parse call, dot, and `[]`-subscript expressions.
pp.parseExprSubscripts = function (refShorthandDefaultPos) {
var startPos = this.state.start,
startLoc = this.state.startLoc;
var potentialArrowAt = this.state.potentialArrowAt;
var expr = this.parseExprAtom(refShorthandDefaultPos);
if (expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt) {
return expr;
}
if (refShorthandDefaultPos && refShorthandDefaultPos.start) {
return expr;
}
return this.parseSubscripts(expr, startPos, startLoc);
};
pp.parseSubscripts = function (base, startPos, startLoc, noCalls) {
for (;;) {
if (!noCalls && this.eat(_tokenizerTypes.types.doubleColon)) {
var node = this.startNodeAt(startPos, startLoc);
node.object = base;
node.callee = this.parseNoCallExpr();
return this.parseSubscripts(this.finishNode(node, "BindExpression"), startPos, startLoc, noCalls);
} else if (this.eat(_tokenizerTypes.types.dot)) {
var node = this.startNodeAt(startPos, startLoc);
node.object = base;
node.property = this.parseIdentifier(true);
node.computed = false;
base = this.finishNode(node, "MemberExpression");
} else if (this.eat(_tokenizerTypes.types.bracketL)) {
var node = this.startNodeAt(startPos, startLoc);
node.object = base;
node.property = this.parseExpression();
node.computed = true;
this.expect(_tokenizerTypes.types.bracketR);
base = this.finishNode(node, "MemberExpression");
} else if (!noCalls && this.match(_tokenizerTypes.types.parenL)) {
var possibleAsync = this.state.potentialArrowAt === base.start && base.type === "Identifier" && base.name === "async" && !this.canInsertSemicolon();
this.next();
var node = this.startNodeAt(startPos, startLoc);
node.callee = base;
node.arguments = this.parseCallExpressionArguments(_tokenizerTypes.types.parenR, this.hasPlugin("trailingFunctionCommas"), possibleAsync);
base = this.finishNode(node, "CallExpression");
if (possibleAsync && this.shouldParseAsyncArrow()) {
return this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), node);
} else {
this.toReferencedList(node.arguments);
}
} else if (this.match(_tokenizerTypes.types.backQuote)) {
var node = this.startNodeAt(startPos, startLoc);
node.tag = base;
node.quasi = this.parseTemplate();
base = this.finishNode(node, "TaggedTemplateExpression");
} else {
return base;
}
}
};
pp.parseCallExpressionArguments = function (close, allowTrailingComma, possibleAsyncArrow) {
var innerParenStart = undefined;
var elts = [],
first = true;
while (!this.eat(close)) {
if (first) {
first = false;
} else {
this.expect(_tokenizerTypes.types.comma);
if (allowTrailingComma && this.eat(close)) break;
}
// we need to make sure that if this is an async arrow functions, that we don't allow inner parens inside the params
if (this.match(_tokenizerTypes.types.parenL) && !innerParenStart) {
innerParenStart = this.state.start;
}
elts.push(this.parseExprListItem());
}
// we found an async arrow function so let's not allow any inner parens
if (possibleAsyncArrow && innerParenStart && this.shouldParseAsyncArrow()) {
this.unexpected();
}
return elts;
};
pp.shouldParseAsyncArrow = function () {
return this.match(_tokenizerTypes.types.arrow);
};
pp.parseAsyncArrowFromCallExpression = function (node, call) {
if (!this.hasPlugin("asyncFunctions")) this.unexpected();
this.expect(_tokenizerTypes.types.arrow);
return this.parseArrowExpression(node, call.arguments, true);
};
// Parse a no-call expression (like argument of `new` or `::` operators).
pp.parseNoCallExpr = function () {
var startPos = this.state.start,
startLoc = this.state.startLoc;
return this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
};
// Parse an atomic expression — either a single token that is an
// expression, an expression started by a keyword like `function` or
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
// or `{}`.
pp.parseExprAtom = function (refShorthandDefaultPos) {
var node = undefined,
canBeArrow = this.state.potentialArrowAt === this.state.start;
switch (this.state.type) {
case _tokenizerTypes.types._super:
if (!this.state.inMethod && !this.options.allowSuperOutsideMethod) {
this.raise(this.state.start, "'super' outside of function or class");
}
node = this.startNode();
this.next();
if (!this.match(_tokenizerTypes.types.parenL) && !this.match(_tokenizerTypes.types.bracketL) && !this.match(_tokenizerTypes.types.dot)) {
this.unexpected();
}
if (this.match(_tokenizerTypes.types.parenL) && this.state.inMethod !== "constructor" && !this.options.allowSuperOutsideMethod) {
this.raise(node.start, "super() outside of class constructor");
}
return this.finishNode(node, "Super");
case _tokenizerTypes.types._this:
node = this.startNode();
this.next();
return this.finishNode(node, "ThisExpression");
case _tokenizerTypes.types._yield:
if (this.state.inGenerator) this.unexpected();
case _tokenizerTypes.types.name:
node = this.startNode();
var allowAwait = this.hasPlugin("asyncFunctions") && this.state.value === "await" && this.state.inAsync;
var allowYield = this.shouldAllowYieldIdentifier();
var id = this.parseIdentifier(allowAwait || allowYield);
if (this.hasPlugin("asyncFunctions")) {
if (id.name === "await") {
if (this.state.inAsync || this.inModule) {
return this.parseAwait(node);
}
} else if (id.name === "async" && this.match(_tokenizerTypes.types._function) && !this.canInsertSemicolon()) {
this.next();
return this.parseFunction(node, false, false, true);
} else if (canBeArrow && id.name === "async" && this.match(_tokenizerTypes.types.name)) {
var params = [this.parseIdentifier()];
this.expect(_tokenizerTypes.types.arrow);
// let foo = bar => {};
return this.parseArrowExpression(node, params, true);
}
}
if (canBeArrow && !this.canInsertSemicolon() && this.eat(_tokenizerTypes.types.arrow)) {
return this.parseArrowExpression(node, [id]);
}
return id;
case _tokenizerTypes.types._do:
if (this.hasPlugin("doExpressions")) {
var _node = this.startNode();
this.next();
var oldInFunction = this.state.inFunction;
var oldLabels = this.state.labels;
this.state.labels = [];
this.state.inFunction = false;
_node.body = this.parseBlock(false, true);
this.state.inFunction = oldInFunction;
this.state.labels = oldLabels;
return this.finishNode(_node, "DoExpression");
}
case _tokenizerTypes.types.regexp:
var value = this.state.value;
node = this.parseLiteral(value.value, "RegExpLiteral");
node.pattern = value.pattern;
node.flags = value.flags;
return node;
case _tokenizerTypes.types.num:
return this.parseLiteral(this.state.value, "NumericLiteral");
case _tokenizerTypes.types.string:
return this.parseLiteral(this.state.value, "StringLiteral");
case _tokenizerTypes.types._null:
node = this.startNode();
this.next();
return this.finishNode(node, "NullLiteral");
case _tokenizerTypes.types._true:case _tokenizerTypes.types._false:
node = this.startNode();
node.value = this.match(_tokenizerTypes.types._true);
this.next();
return this.finishNode(node, "BooleanLiteral");
case _tokenizerTypes.types.parenL:
return this.parseParenAndDistinguishExpression(null, null, canBeArrow);
case _tokenizerTypes.types.bracketL:
node = this.startNode();
this.next();
node.elements = this.parseExprList(_tokenizerTypes.types.bracketR, true, true, refShorthandDefaultPos);
this.toReferencedList(node.elements);
return this.finishNode(node, "ArrayExpression");
case _tokenizerTypes.types.braceL:
return this.parseObj(false, refShorthandDefaultPos);
case _tokenizerTypes.types._function:
return this.parseFunctionExpression();
case _tokenizerTypes.types.at:
this.parseDecorators();
case _tokenizerTypes.types._class:
node = this.startNode();
this.takeDecorators(node);
return this.parseClass(node, false);
case _tokenizerTypes.types._new:
return this.parseNew();
case _tokenizerTypes.types.backQuote:
return this.parseTemplate();
case _tokenizerTypes.types.doubleColon:
node = this.startNode();
this.next();
node.object = null;
var callee = node.callee = this.parseNoCallExpr();
if (callee.type === "MemberExpression") {
return this.finishNode(node, "BindExpression");
} else {
this.raise(callee.start, "Binding should be performed on object property.");
}
default:
this.unexpected();
}
};
pp.parseFunctionExpression = function () {
var node = this.startNode();
var meta = this.parseIdentifier(true);
if (this.state.inGenerator && this.eat(_tokenizerTypes.types.dot) && this.hasPlugin("functionSent")) {
return this.parseMetaProperty(node, meta, "sent");
} else {
return this.parseFunction(node, false);
}
};
pp.parseMetaProperty = function (node, meta, propertyName) {
node.meta = meta;
node.property = this.parseIdentifier(true);
if (node.property.name !== propertyName) {
this.raise(node.property.start, "The only valid meta property for new is " + meta.name + "." + propertyName);
}
return this.finishNode(node, "MetaProperty");
};
pp.parseLiteral = function (value, type) {
var node = this.startNode();
this.addExtra(node, "rawValue", value);
this.addExtra(node, "raw", this.input.slice(this.state.start, this.state.end));
node.value = value;
this.next();
return this.finishNode(node, type);
};
pp.parseParenExpression = function () {
this.expect(_tokenizerTypes.types.parenL);
var val = this.parseExpression();
this.expect(_tokenizerTypes.types.parenR);
return val;
};
pp.parseParenAndDistinguishExpression = function (startPos, startLoc, canBeArrow, isAsync, allowOptionalCommaStart) {
startPos = startPos || this.state.start;
startLoc = startLoc || this.state.startLoc;
var val = undefined;
this.next();
var innerStartPos = this.state.start,
innerStartLoc = this.state.startLoc;
var exprList = [],
first = true;
var refShorthandDefaultPos = { start: 0 },
spreadStart = undefined,
optionalCommaStart = undefined;
while (!this.match(_tokenizerTypes.types.parenR)) {
if (first) {
first = false;
} else {
this.expect(_tokenizerTypes.types.comma);
if (this.match(_tokenizerTypes.types.parenR) && this.hasPlugin("trailingFunctionCommas")) {
optionalCommaStart = this.state.start;
break;
}
}
if (this.match(_tokenizerTypes.types.ellipsis)) {
var spreadNodeStartPos = this.state.start,
spreadNodeStartLoc = this.state.startLoc;
spreadStart = this.state.start;
exprList.push(this.parseParenItem(this.parseRest(), spreadNodeStartLoc, spreadNodeStartPos));
break;
} else {
exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem));
}
}
var innerEndPos = this.state.start;
var innerEndLoc = this.state.startLoc;
this.expect(_tokenizerTypes.types.parenR);
if (canBeArrow && !this.canInsertSemicolon() && this.eat(_tokenizerTypes.types.arrow)) {
for (var _i = 0; _i < exprList.length; _i++) {
var param = exprList[_i];
if (param.extra && param.extra.parenthesized) this.unexpected(param.extra.parenStart);
}
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, isAsync);
}
if (!exprList.length) {
if (isAsync) {
return;
} else {
this.unexpected(this.state.lastTokStart);
}
}
if (optionalCommaStart && !allowOptionalCommaStart) this.unexpected(optionalCommaStart);
if (spreadStart) this.unexpected(spreadStart);
if (refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start);
if (exprList.length > 1) {
val = this.startNodeAt(innerStartPos, innerStartLoc);
val.expressions = exprList;
this.toReferencedList(val.expressions);
this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
} else {
val = exprList[0];
}
this.addExtra(val, "parenthesized", true);
this.addExtra(val, "parenStart", startPos);
return val;
};
pp.parseParenItem = function (node) {
return node;
};
// New's precedence is slightly tricky. It must allow its argument
// to be a `[]` or dot subscript expression, but not a call — at
// least, not without wrapping it in parentheses. Thus, it uses the
pp.parseNew = function () {
var node = this.startNode();
var meta = this.parseIdentifier(true);
if (this.eat(_tokenizerTypes.types.dot)) {
return this.parseMetaProperty(node, meta, "target");
}
node.callee = this.parseNoCallExpr();
if (this.eat(_tokenizerTypes.types.parenL)) {
node.arguments = this.parseExprList(_tokenizerTypes.types.parenR, this.hasPlugin("trailingFunctionCommas"));
this.toReferencedList(node.arguments);
} else {
node.arguments = [];
}
return this.finishNode(node, "NewExpression");
};
// Parse template expression.
pp.parseTemplateElement = function () {
var elem = this.startNode();
elem.value = {
raw: this.input.slice(this.state.start, this.state.end).replace(/\r\n?/g, "\n"),
cooked: this.state.value
};
this.next();
elem.tail = this.match(_tokenizerTypes.types.backQuote);
return this.finishNode(elem, "TemplateElement");
};
pp.parseTemplate = function () {
var node = this.startNode();
this.next();
node.expressions = [];
var curElt = this.parseTemplateElement();
node.quasis = [curElt];
while (!curElt.tail) {
this.expect(_tokenizerTypes.types.dollarBraceL);
node.expressions.push(this.parseExpression());
this.expect(_tokenizerTypes.types.braceR);
node.quasis.push(curElt = this.parseTemplateElement());
}
this.next();
return this.finishNode(node, "TemplateLiteral");
};
// Parse an object literal or binding pattern.
pp.parseObj = function (isPattern, refShorthandDefaultPos) {
var decorators = [];
var propHash = _Object$create(null);
var first = true;
var node = this.startNode();
node.properties = [];
this.next();
while (!this.eat(_tokenizerTypes.types.braceR)) {
if (first) {
first = false;
} else {
this.expect(_tokenizerTypes.types.comma);
if (this.eat(_tokenizerTypes.types.braceR)) break;
}
while (this.match(_tokenizerTypes.types.at)) {
decorators.push(this.parseDecorator());
}
var prop = this.startNode(),
isGenerator = false,
isAsync = false,
startPos = undefined,
startLoc = undefined;
if (decorators.length) {
prop.decorators = decorators;
decorators = [];
}
if (this.hasPlugin("objectRestSpread") && this.match(_tokenizerTypes.types.ellipsis)) {
prop = this.parseSpread();
prop.type = isPattern ? "RestProperty" : "SpreadProperty";
node.properties.push(prop);
continue;
}
prop.method = false;
prop.shorthand = false;
if (isPattern || refShorthandDefaultPos) {
startPos = this.state.start;
startLoc = this.state.startLoc;
}
if (!isPattern) {
isGenerator = this.eat(_tokenizerTypes.types.star);
}
if (!isPattern && this.hasPlugin("asyncFunctions") && this.isContextual("async")) {
if (isGenerator) this.unexpected();
var asyncId = this.parseIdentifier();
if (this.match(_tokenizerTypes.types.colon) || this.match(_tokenizerTypes.types.parenL) || this.match(_tokenizerTypes.types.braceR)) {
prop.key = asyncId;
} else {
isAsync = true;
if (this.hasPlugin("asyncGenerators")) isGenerator = this.eat(_tokenizerTypes.types.star);
this.parsePropertyName(prop);
}
} else {
this.parsePropertyName(prop);
}
this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos);
this.checkPropClash(prop, propHash);
if (prop.shorthand) {
this.addExtra(prop, "shorthand", true);
}
node.properties.push(prop);
}
if (decorators.length) {
this.raise(this.state.start, "You have trailing decorators with no property");
}
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
};
pp.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos) {
if (isAsync || isGenerator || this.match(_tokenizerTypes.types.parenL)) {
if (isPattern) this.unexpected();
prop.kind = "method";
prop.method = true;
this.parseMethod(prop, isGenerator, isAsync);
return this.finishNode(prop, "ObjectMethod");
}
if (this.eat(_tokenizerTypes.types.colon)) {
prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos);
return this.finishNode(prop, "ObjectProperty");
}
if (!prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && !this.match(_tokenizerTypes.types.comma) && !this.match(_tokenizerTypes.types.braceR)) {
if (isGenerator || isAsync || isPattern) this.unexpected();
prop.kind = prop.key.name;
this.parsePropertyName(prop);
this.parseMethod(prop, false);
var paramCount = prop.kind === "get" ? 0 : 1;
if (prop.params.length !== paramCount) {
var start = prop.start;
if (prop.kind === "get") {
this.raise(start, "getter should have no params");
} else {
this.raise(start, "setter should have exactly one param");
}
}
return this.finishNode(prop, "ObjectMethod");
}
if (!prop.computed && prop.key.type === "Identifier") {
if (isPattern) {
var illegalBinding = this.isKeyword(prop.key.name);
if (!illegalBinding && this.state.strict) {
illegalBinding = _utilIdentifier.reservedWords.strictBind(prop.key.name) || _utilIdentifier.reservedWords.strict(prop.key.name);
}
if (illegalBinding) {
this.raise(prop.key.start, "Binding " + prop.key.name);
}
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone());
} else if (this.match(_tokenizerTypes.types.eq) && refShorthandDefaultPos) {
if (!refShorthandDefaultPos.start) {
refShorthandDefaultPos.start = this.state.start;
}
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone());
} else {
prop.value = prop.key.__clone();
}
prop.shorthand = true;
return this.finishNode(prop, "ObjectProperty");
}
this.unexpected();
};
pp.parsePropertyName = function (prop) {
if (this.eat(_tokenizerTypes.types.bracketL)) {
prop.computed = true;
prop.key = this.parseMaybeAssign();
this.expect(_tokenizerTypes.types.bracketR);
return prop.key;
} else {
prop.computed = false;
return prop.key = this.match(_tokenizerTypes.types.num) || this.match(_tokenizerTypes.types.string) ? this.parseExprAtom() : this.parseIdentifier(true);
}
};
// Initialize empty function node.
pp.initFunction = function (node, isAsync) {
node.id = null;
node.generator = false;
node.expression = false;
if (this.hasPlugin("asyncFunctions")) {
node.async = !!isAsync;
}
};
// Parse object or class method.
pp.parseMethod = function (node, isGenerator, isAsync) {
var oldInMethod = this.state.inMethod;
this.state.inMethod = node.kind || true;
this.initFunction(node, isAsync);
this.expect(_tokenizerTypes.types.parenL);
node.params = this.parseBindingList(_tokenizerTypes.types.parenR, false, this.hasPlugin("trailingFunctionCommas"));
node.generator = isGenerator;
this.parseFunctionBody(node);
this.state.inMethod = oldInMethod;
return node;
};
// Parse arrow function expression with given parameters.
pp.parseArrowExpression = function (node, params, isAsync) {
this.initFunction(node, isAsync);
node.params = this.toAssignableList(params, true);
this.parseFunctionBody(node, true);
return this.finishNode(node, "ArrowFunctionExpression");
};
// Parse function body and check parameters.
pp.parseFunctionBody = function (node, allowExpression) {
var isExpression = allowExpression && !this.match(_tokenizerTypes.types.braceL);
var oldInAsync = this.state.inAsync;
this.state.inAsync = node.async;
if (isExpression) {
node.body = this.parseMaybeAssign();
node.expression = true;
} else {
// Start a new scope with regard to labels and the `inFunction`
// flag (restore them to their old value afterwards).
var oldInFunc = this.state.inFunction,
oldInGen = this.state.inGenerator,
oldLabels = this.state.labels;
this.state.inFunction = true;this.state.inGenerator = node.generator;this.state.labels = [];
node.body = this.parseBlock(true);
node.expression = false;
this.state.inFunction = oldInFunc;this.state.inGenerator = oldInGen;this.state.labels = oldLabels;
}
this.state.inAsync = oldInAsync;
// If this is a strict mode function, verify that argument names
// are not repeated, and it does not try to bind the words `eval`
// or `arguments`.
var checkLVal = this.state.strict;
var checkLValStrict = false;
var isStrict = false;
// arrow function
if (allowExpression) checkLVal = true;
// normal function
if (!isExpression && node.body.directives.length) {
var _arr = node.body.directives;
for (var _i2 = 0; _i2 < _arr.length; _i2++) {
var directive = _arr[_i2];
if (directive.value.value === "use strict") {
isStrict = true;
checkLVal = true;
checkLValStrict = true;
break;
}
}
}
//
if (isStrict && node.id && node.id.type === "Identifier" && node.id.name === "yield") {
this.raise(node.id.start, "Binding yield in strict mode");
}
if (checkLVal) {
var nameHash = _Object$create(null);
var oldStrict = this.state.strict;
if (checkLValStrict) this.state.strict = true;
if (node.id) {
this.checkLVal(node.id, true);
}
var _arr2 = node.params;
for (var _i3 = 0; _i3 < _arr2.length; _i3++) {
var param = _arr2[_i3];
this.checkLVal(param, true, nameHash);
}
this.state.strict = oldStrict;
}
};
// Parses a comma-separated list of expressions, and returns them as
// an array. `close` is the token type that ends the list, and
// `allowEmpty` can be turned on to allow subsequent commas with
// nothing in between them to be parsed as `null` (which is needed
// for array literals).
pp.parseExprList = function (close, allowTrailingComma, allowEmpty, refShorthandDefaultPos) {
var elts = [],
first = true;
while (!this.eat(close)) {
if (first) {
first = false;
} else {
this.expect(_tokenizerTypes.types.comma);
if (allowTrailingComma && this.eat(close)) break;
}
elts.push(this.parseExprListItem(allowEmpty, refShorthandDefaultPos));
}
return elts;
};
pp.parseExprListItem = function (allowEmpty, refShorthandDefaultPos) {
var elt = undefined;
if (allowEmpty && this.match(_tokenizerTypes.types.comma)) {
elt = null;
} else if (this.match(_tokenizerTypes.types.ellipsis)) {
elt = this.parseSpread(refShorthandDefaultPos);
} else {
elt = this.parseMaybeAssign(false, refShorthandDefaultPos);
}
return elt;
};
// Parse the next token as an identifier. If `liberal` is true (used
// when parsing properties), it will also convert keywords into
// identifiers.
pp.parseIdentifier = function (liberal) {
var node = this.startNode();
if (this.match(_tokenizerTypes.types.name)) {
if (!liberal && this.state.strict && _utilIdentifier.reservedWords.strict(this.state.value)) {
this.raise(this.state.start, "The keyword '" + this.state.value + "' is reserved");
}
node.name = this.state.value;
} else if (liberal && this.state.type.keyword) {
node.name = this.state.type.keyword;
} else {
this.unexpected();
}
if (!liberal && node.name === "await" && this.state.inAsync) {
this.raise(node.start, "invalid use of await inside of an async function");
}
this.next();
return this.finishNode(node, "Identifier");
};
// Parses await expression inside async function.
pp.parseAwait = function (node) {
if (!this.state.inAsync) {
this.unexpected();
}
if (this.isLineTerminator()) {
this.unexpected();
}
if (this.match(_tokenizerTypes.types.star)) {
this.raise(node.start, "await* has been removed from the async functions proposal. Use Promise.all() instead.");
}
node.argument = this.parseMaybeUnary();
return this.finishNode(node, "AwaitExpression");
};
// Parses yield expression inside generator.
pp.parseYield = function () {
var node = this.startNode();
this.next();
if (this.match(_tokenizerTypes.types.semi) || this.canInsertSemicolon() || !this.match(_tokenizerTypes.types.star) && !this.state.type.startsExpr) {
node.delegate = false;
node.argument = null;
} else {
node.delegate = this.eat(_tokenizerTypes.types.star);
node.argument = this.parseMaybeAssign();
}
return this.finishNode(node, "YieldExpression");
};
},{"17":17,"18":18,"21":21,"25":25,"5":5}],5:[function(_dereq_,module,exports){
"use strict";
var _inherits = _dereq_(24)["default"];
var _classCallCheck = _dereq_(23)["default"];
var _interopRequireDefault = _dereq_(25)["default"];
exports.__esModule = true;
var _utilIdentifier = _dereq_(18);
var _options = _dereq_(2);
var _tokenizer = _dereq_(15);
var _tokenizer2 = _interopRequireDefault(_tokenizer);
var plugins = {};
exports.plugins = plugins;
var Parser = (function (_Tokenizer) {
_inherits(Parser, _Tokenizer);
function Parser(options, input) {
_classCallCheck(this, Parser);
options = _options.getOptions(options);
_Tokenizer.call(this, options, input);
this.options = options;
this.inModule = this.options.sourceType === "module";
this.isReservedWord = _utilIdentifier.reservedWords[6];
this.input = input;
this.plugins = this.loadPlugins(this.options.plugins);
this.filename = options.sourceFilename;
// If enabled, skip leading hashbang line.
if (this.state.pos === 0 && this.input[0] === "#" && this.input[1] === "!") {
this.skipLineComment(2);
}
}
Parser.prototype.hasPlugin = function hasPlugin(name) {
return !!(this.plugins["*"] || this.plugins[name]);
};
Parser.prototype.extend = function extend(name, f) {
this[name] = f(this[name]);
};
Parser.prototype.loadPlugins = function loadPlugins(plugins) {
var pluginMap = {};
if (plugins.indexOf("flow") >= 0) {
// ensure flow plugin loads last
plugins = plugins.filter(function (plugin) {
return plugin !== "flow";
});
plugins.push("flow");
}
for (var _i = 0; _i < plugins.length; _i++) {
var _name = plugins[_i];
if (!pluginMap[_name]) {
pluginMap[_name] = true;
var plugin = exports.plugins[_name];
if (plugin) plugin(this);
}
}
return pluginMap;
};
Parser.prototype.parse = function parse() {
var file = this.startNode();
var program = this.startNode();
this.nextToken();
return this.parseTopLevel(file, program);
};
return Parser;
})(_tokenizer2["default"]);
exports["default"] = Parser;
},{"15":15,"18":18,"2":2,"23":23,"24":24,"25":25}],6:[function(_dereq_,module,exports){
"use strict";
var _interopRequireDefault = _dereq_(25)["default"];
var _utilLocation = _dereq_(19);
var _index = _dereq_(5);
var _index2 = _interopRequireDefault(_index);
var pp = _index2["default"].prototype;
// This function is used to raise exceptions on parse errors. It
// takes an offset integer (into the current `input`) to indicate
// the location of the error, attaches the position to the end
// of the error message, and then raises a `SyntaxError` with that
// message.
pp.raise = function (pos, message) {
var loc = _utilLocation.getLineInfo(this.input, pos);
message += " (" + loc.line + ":" + loc.column + ")";
var err = new SyntaxError(message);
err.pos = pos;
err.loc = loc;
throw err;
};
},{"19":19,"25":25,"5":5}],7:[function(_dereq_,module,exports){
/* eslint indent: 0 */
"use strict";
var _interopRequireDefault = _dereq_(25)["default"];
var _tokenizerTypes = _dereq_(17);
var _index = _dereq_(5);
var _index2 = _interopRequireDefault(_index);
var _utilIdentifier = _dereq_(18);
var pp = _index2["default"].prototype;
// Convert existing expression atom to assignable pattern
// if possible.
pp.toAssignable = function (node, isBinding) {
if (node) {
switch (node.type) {
case "Identifier":
case "ObjectPattern":
case "ArrayPattern":
case "AssignmentPattern":
break;
case "ObjectExpression":
node.type = "ObjectPattern";
var _arr = node.properties;
for (var _i = 0; _i < _arr.length; _i++) {
var prop = _arr[_i];
if (prop.type === "ObjectMethod") {
if (prop.kind === "get" || prop.kind === "set") {
this.raise(prop.key.start, "Object pattern can't contain getter or setter");
} else {
this.raise(prop.key.start, "Object pattern can't contain methods");
}
} else {
this.toAssignable(prop, isBinding);
}
}
break;
case "ObjectProperty":
this.toAssignable(node.value, isBinding);
break;
case "SpreadProperty":
node.type = "RestProperty";
break;
case "ArrayExpression":
node.type = "ArrayPattern";
this.toAssignableList(node.elements, isBinding);
break;
case "AssignmentExpression":
if (node.operator === "=") {
node.type = "AssignmentPattern";
delete node.operator;
} else {
this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
}
break;
case "MemberExpression":
if (!isBinding) break;
default:
this.raise(node.start, "Assigning to rvalue");
}
}
return node;
};
// Convert list of expression atoms to binding list.
pp.toAssignableList = function (exprList, isBinding) {
var end = exprList.length;
if (end) {
var last = exprList[end - 1];
if (last && last.type === "RestElement") {
--end;
} else if (last && last.type === "SpreadElement") {
last.type = "RestElement";
var arg = last.argument;
this.toAssignable(arg, isBinding);
if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern") {
this.unexpected(arg.start);
}
--end;
}
}
for (var i = 0; i < end; i++) {
var elt = exprList[i];
if (elt) this.toAssignable(elt, isBinding);
}
return exprList;
};
// Convert list of expression atoms to a list of
pp.toReferencedList = function (exprList) {
return exprList;
};
// Parses spread element.
pp.parseSpread = function (refShorthandDefaultPos) {
var node = this.startNode();
this.next();
node.argument = this.parseMaybeAssign(refShorthandDefaultPos);
return this.finishNode(node, "SpreadElement");
};
pp.parseRest = function () {
var node = this.startNode();
this.next();
node.argument = this.parseBindingIdentifier();
return this.finishNode(node, "RestElement");
};
pp.shouldAllowYieldIdentifier = function () {
return this.match(_tokenizerTypes.types._yield) && !this.state.strict && !this.state.inGenerator;
};
pp.parseBindingIdentifier = function () {
return this.parseIdentifier(this.shouldAllowYieldIdentifier());
};
// Parses lvalue (assignable) atom.
pp.parseBindingAtom = function () {
switch (this.state.type) {
case _tokenizerTypes.types._yield:
if (this.state.strict || this.state.inGenerator) this.unexpected();
case _tokenizerTypes.types.name:
return this.parseIdentifier(true);
case _tokenizerTypes.types.bracketL:
var node = this.startNode();
this.next();
node.elements = this.parseBindingList(_tokenizerTypes.types.bracketR, true, true);
return this.finishNode(node, "ArrayPattern");
case _tokenizerTypes.types.braceL:
return this.parseObj(true);
default:
this.unexpected();
}
};
pp.parseBindingList = function (close, allowEmpty, allowTrailingComma) {
var elts = [];
var first = true;
while (!this.eat(close)) {
if (first) {
first = false;
} else {
this.expect(_tokenizerTypes.types.comma);
}
if (allowEmpty && this.match(_tokenizerTypes.types.comma)) {
elts.push(null);
} else if (allowTrailingComma && this.eat(close)) {
break;
} else if (this.match(_tokenizerTypes.types.ellipsis)) {
elts.push(this.parseAssignableListItemTypes(this.parseRest()));
this.expect(close);
break;
} else {
var left = this.parseMaybeDefault();
this.parseAssignableListItemTypes(left);
elts.push(this.parseMaybeDefault(null, null, left));
}
}
return elts;
};
pp.parseAssignableListItemTypes = function (param) {
return param;
};
// Parses assignment pattern around given atom if possible.
pp.parseMaybeDefault = function (startPos, startLoc, left) {
startLoc = startLoc || this.state.startLoc;
startPos = startPos || this.state.start;
left = left || this.parseBindingAtom();
if (!this.eat(_tokenizerTypes.types.eq)) return left;
var node = this.startNodeAt(startPos, startLoc);
node.left = left;
node.right = this.parseMaybeAssign();
return this.finishNode(node, "AssignmentPattern");
};
// Verify that a node is an lval — something that can be assigned
// to.
pp.checkLVal = function (expr, isBinding, checkClashes) {
switch (expr.type) {
case "Identifier":
if (this.state.strict && (_utilIdentifier.reservedWords.strictBind(expr.name) || _utilIdentifier.reservedWords.strict(expr.name))) {
this.raise(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode");
}
if (checkClashes) {
// we need to prefix this with an underscore for the cases where we have a key of
// `__proto__`. there's a bug in old V8 where the following wouldn't work:
//
// > var obj = Object.create(null);
// undefined
// > obj.__proto__
// null
// > obj.__proto__ = true;
// true
// > obj.__proto__
// null
var key = "_" + expr.name;
if (checkClashes[key]) {
this.raise(expr.start, "Argument name clash in strict mode");
} else {
checkClashes[key] = true;
}
}
break;
case "MemberExpression":
if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression");
break;
case "ObjectPattern":
var _arr2 = expr.properties;
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
var prop = _arr2[_i2];
if (prop.type === "ObjectProperty") prop = prop.value;
this.checkLVal(prop, isBinding, checkClashes);
}
break;
case "ArrayPattern":
var _arr3 = expr.elements;
for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
var elem = _arr3[_i3];
if (elem) this.checkLVal(elem, isBinding, checkClashes);
}
break;
case "AssignmentPattern":
this.checkLVal(expr.left, isBinding, checkClashes);
break;
case "RestProperty":
case "RestElement":
this.checkLVal(expr.argument, isBinding, checkClashes);
break;
default:
this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue");
}
};
},{"17":17,"18":18,"25":25,"5":5}],8:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = _dereq_(23)["default"];
var _interopRequireDefault = _dereq_(25)["default"];
var _index = _dereq_(5);
var _index2 = _interopRequireDefault(_index);
var _utilLocation = _dereq_(19);
// Start an AST node, attaching a start offset.
var pp = _index2["default"].prototype;
var Node = (function () {
function Node(pos, loc, filename) {
_classCallCheck(this, Node);
this.type = "";
this.start = pos;
this.end = 0;
this.loc = new _utilLocation.SourceLocation(loc);
if (filename) this.loc.filename = filename;
}
Node.prototype.__clone = function __clone() {
var node2 = new Node();
for (var key in this) {
node2[key] = this[key];
}return node2;
};
return Node;
})();
pp.startNode = function () {
return new Node(this.state.start, this.state.startLoc, this.filename);
};
pp.startNodeAt = function (pos, loc) {
return new Node(pos, loc, this.filename);
};
function finishNodeAt(node, type, pos, loc) {
node.type = type;
node.end = pos;
node.loc.end = loc;
this.processComment(node);
return node;
}
// Finish an AST node, adding `type` and `end` properties.
pp.finishNode = function (node, type) {
return finishNodeAt.call(this, node, type, this.state.lastTokEnd, this.state.lastTokEndLoc);
};
// Finish node at given position
pp.finishNodeAt = function (node, type, pos, loc) {
return finishNodeAt.call(this, node, type, pos, loc);
};
},{"19":19,"23":23,"25":25,"5":5}],9:[function(_dereq_,module,exports){
/* eslint indent: 0 */
/* eslint max-len: 0 */
"use strict";
var _Object$create = _dereq_(21)["default"];
var _interopRequireDefault = _dereq_(25)["default"];
var _tokenizerTypes = _dereq_(17);
var _index = _dereq_(5);
var _index2 = _interopRequireDefault(_index);
var _utilWhitespace = _dereq_(20);
var pp = _index2["default"].prototype;
// ### Statement parsing
// Parse a program. Initializes the parser, reads any number of
// statements, and wraps them in a Program node. Optionally takes a
// `program` argument. If present, the statements will be appended
// to its body instead of creating a new node.
pp.parseTopLevel = function (file, program) {
program.sourceType = this.options.sourceType;
this.parseBlockBody(program, true, true, _tokenizerTypes.types.eof);
file.program = this.finishNode(program, "Program");
file.comments = this.state.comments;
file.tokens = this.state.tokens;
return this.finishNode(file, "File");
};
var loopLabel = { kind: "loop" },
switchLabel = { kind: "switch" };
// TODO
pp.stmtToDirective = function (stmt) {
var expr = stmt.expression;
var directiveLiteral = this.startNodeAt(expr.start, expr.loc.start);
var directive = this.startNodeAt(stmt.start, stmt.loc.start);
var raw = this.input.slice(expr.start, expr.end);
var val = directiveLiteral.value = raw.slice(1, -1); // remove quotes
this.addExtra(directiveLiteral, "raw", raw);
this.addExtra(directiveLiteral, "rawValue", val);
directive.value = this.finishNodeAt(directiveLiteral, "DirectiveLiteral", expr.end, expr.loc.end);
return this.finishNodeAt(directive, "Directive", stmt.end, stmt.loc.end);
};
// Parse a single statement.
//
// If expecting a statement and finding a slash operator, parse a
// regular expression literal. This is to handle cases like
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
// does not help.
pp.parseStatement = function (declaration, topLevel) {
if (this.match(_tokenizerTypes.types.at)) {
this.parseDecorators(true);
}
var starttype = this.state.type,
node = this.startNode();
// Most types of statements are recognized by the keyword they
// start with. Many are trivial to parse, some require a bit of
// complexity.
switch (starttype) {
case _tokenizerTypes.types._break:case _tokenizerTypes.types._continue:
return this.parseBreakContinueStatement(node, starttype.keyword);
case _tokenizerTypes.types._debugger:
return this.parseDebuggerStatement(node);
case _tokenizerTypes.types._do:
return this.parseDoStatement(node);
case _tokenizerTypes.types._for:
return this.parseForStatement(node);
case _tokenizerTypes.types._function:
if (!declaration) this.unexpected();
return this.parseFunctionStatement(node);
case _tokenizerTypes.types._class:
if (!declaration) this.unexpected();
this.takeDecorators(node);
return this.parseClass(node, true);
case _tokenizerTypes.types._if:
return this.parseIfStatement(node);
case _tokenizerTypes.types._return:
return this.parseReturnStatement(node);
case _tokenizerTypes.types._switch:
return this.parseSwitchStatement(node);
case _tokenizerTypes.types._throw:
return this.parseThrowStatement(node);
case _tokenizerTypes.types._try:
return this.parseTryStatement(node);
case _tokenizerTypes.types._let:
case _tokenizerTypes.types._const:
if (!declaration) this.unexpected(); // NOTE: falls through to _var
case _tokenizerTypes.types._var:
return this.parseVarStatement(node, starttype);
case _tokenizerTypes.types._while:
return this.parseWhileStatement(node);
case _tokenizerTypes.types._with:
return this.parseWithStatement(node);
case _tokenizerTypes.types.braceL:
return this.parseBlock();
case _tokenizerTypes.types.semi:
return this.parseEmptyStatement(node);
case _tokenizerTypes.types._export:
case _tokenizerTypes.types._import:
if (!this.options.allowImportExportEverywhere) {
if (!topLevel) {
this.raise(this.state.start, "'import' and 'export' may only appear at the top level");
}
if (!this.inModule) {
this.raise(this.state.start, "'import' and 'export' may appear only with 'sourceType: module'");
}
}
return starttype === _tokenizerTypes.types._import ? this.parseImport(node) : this.parseExport(node);
case _tokenizerTypes.types.name:
if (this.hasPlugin("asyncFunctions") && this.state.value === "async") {
// peek ahead and see if next token is a function
var state = this.state.clone();
this.next();
if (this.match(_tokenizerTypes.types._function) && !this.canInsertSemicolon()) {
this.expect(_tokenizerTypes.types._function);
return this.parseFunction(node, true, false, true);
} else {
this.state = state;
}
}
}
// If the statement does not start with a statement keyword or a
// brace, it's an ExpressionStatement or LabeledStatement. We
// simply start parsing an expression, and afterwards, if the
// next token is a colon and the expression was a simple
// Identifier node, we switch to interpreting it as a label.
var maybeName = this.state.value;
var expr = this.parseExpression();
if (starttype === _tokenizerTypes.types.name && expr.type === "Identifier" && this.eat(_tokenizerTypes.types.colon)) {
return this.parseLabeledStatement(node, maybeName, expr);
} else {
return this.parseExpressionStatement(node, expr);
}
};
pp.takeDecorators = function (node) {
if (this.state.decorators.length) {
node.decorators = this.state.decorators;
this.state.decorators = [];
}
};
pp.parseDecorators = function (allowExport) {
while (this.match(_tokenizerTypes.types.at)) {
this.state.decorators.push(this.parseDecorator());
}
if (allowExport && this.match(_tokenizerTypes.types._export)) {
return;
}
if (!this.match(_tokenizerTypes.types._class)) {
this.raise(this.state.start, "Leading decorators must be attached to a class declaration");
}
};
pp.parseDecorator = function () {
if (!this.hasPlugin("decorators")) {
this.unexpected();
}
var node = this.startNode();
this.next();
node.expression = this.parseMaybeAssign();
return this.finishNode(node, "Decorator");
};
pp.parseBreakContinueStatement = function (node, keyword) {
var isBreak = keyword === "break";
this.next();
if (this.isLineTerminator()) {
node.label = null;
} else if (!this.match(_tokenizerTypes.types.name)) {
this.unexpected();
} else {
node.label = this.parseIdentifier();
this.semicolon();
}
// Verify that there is an actual destination to break or
// continue to.
var i = undefined;
for (i = 0; i < this.state.labels.length; ++i) {
var lab = this.state.labels[i];
if (node.label == null || lab.name === node.label.name) {
if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
if (node.label && isBreak) break;
}
}
if (i === this.state.labels.length) this.raise(node.start, "Unsyntactic " + keyword);
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
};
pp.parseDebuggerStatement = function (node) {
this.next();
this.semicolon();
return this.finishNode(node, "DebuggerStatement");
};
pp.parseDoStatement = function (node) {
this.next();
this.state.labels.push(loopLabel);
node.body = this.parseStatement(false);
this.state.labels.pop();
this.expect(_tokenizerTypes.types._while);
node.test = this.parseParenExpression();
this.eat(_tokenizerTypes.types.semi);
return this.finishNode(node, "DoWhileStatement");
};
// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
// loop is non-trivial. Basically, we have to parse the init `var`
// statement or expression, disallowing the `in` operator (see
// the second parameter to `parseExpression`), and then check
// whether the next token is `in` or `of`. When there is no init
// part (semicolon immediately after the opening parenthesis), it
// is a regular `for` loop.
pp.parseForStatement = function (node) {
this.next();
this.state.labels.push(loopLabel);
this.expect(_tokenizerTypes.types.parenL);
if (this.match(_tokenizerTypes.types.semi)) {
return this.parseFor(node, null);
}
if (this.match(_tokenizerTypes.types._var) || this.match(_tokenizerTypes.types._let) || this.match(_tokenizerTypes.types._const)) {
var _init = this.startNode(),
varKind = this.state.type;
this.next();
this.parseVar(_init, true, varKind);
this.finishNode(_init, "VariableDeclaration");
if (this.match(_tokenizerTypes.types._in) || this.isContextual("of")) {
if (_init.declarations.length === 1 && !_init.declarations[0].init) {
return this.parseForIn(node, _init);
}
}
return this.parseFor(node, _init);
}
var refShorthandDefaultPos = { start: 0 };
var init = this.parseExpression(true, refShorthandDefaultPos);
if (this.match(_tokenizerTypes.types._in) || this.isContextual("of")) {
this.toAssignable(init);
this.checkLVal(init);
return this.parseForIn(node, init);
} else if (refShorthandDefaultPos.start) {
this.unexpected(refShorthandDefaultPos.start);
}
return this.parseFor(node, init);
};
pp.parseFunctionStatement = function (node) {
this.next();
return this.parseFunction(node, true);
};
pp.parseIfStatement = function (node) {
this.next();
node.test = this.parseParenExpression();
node.consequent = this.parseStatement(false);
node.alternate = this.eat(_tokenizerTypes.types._else) ? this.parseStatement(false) : null;
return this.finishNode(node, "IfStatement");
};
pp.parseReturnStatement = function (node) {
if (!this.state.inFunction && !this.options.allowReturnOutsideFunction) {
this.raise(this.state.start, "'return' outside of function");
}
this.next();
// In `return` (and `break`/`continue`), the keywords with
// optional arguments, we eagerly look for a semicolon or the
// possibility to insert one.
if (this.isLineTerminator()) {
node.argument = null;
} else {
node.argument = this.parseExpression();
this.semicolon();
}
return this.finishNode(node, "ReturnStatement");
};
pp.parseSwitchStatement = function (node) {
this.next();
node.discriminant = this.parseParenExpression();
node.cases = [];
this.expect(_tokenizerTypes.types.braceL);
this.state.labels.push(switchLabel);
// Statements under must be grouped (by label) in SwitchCase
// nodes. `cur` is used to keep the node that we are currently
// adding statements to.
var cur = undefined;
for (var sawDefault = undefined; !this.match(_tokenizerTypes.types.braceR);) {
if (this.match(_tokenizerTypes.types._case) || this.match(_tokenizerTypes.types._default)) {
var isCase = this.match(_tokenizerTypes.types._case);
if (cur) this.finishNode(cur, "SwitchCase");
node.cases.push(cur = this.startNode());
cur.consequent = [];
this.next();
if (isCase) {
cur.test = this.parseExpression();
} else {
if (sawDefault) this.raise(this.state.lastTokStart, "Multiple default clauses");
sawDefault = true;
cur.test = null;
}
this.expect(_tokenizerTypes.types.colon);
} else {
if (cur) {
cur.consequent.push(this.parseStatement(true));
} else {
this.unexpected();
}
}
}
if (cur) this.finishNode(cur, "SwitchCase");
this.next(); // Closing brace
this.state.labels.pop();
return this.finishNode(node, "SwitchStatement");
};
pp.parseThrowStatement = function (node) {
this.next();
if (_utilWhitespace.lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start))) this.raise(this.state.lastTokEnd, "Illegal newline after throw");
node.argument = this.parseExpression();
this.semicolon();
return this.finishNode(node, "ThrowStatement");
};
// Reused empty array added for node fields that are always empty.
var empty = [];
pp.parseTryStatement = function (node) {
this.next();
node.block = this.parseBlock();
node.handler = null;
if (this.match(_tokenizerTypes.types._catch)) {
var clause = this.startNode();
this.next();
this.expect(_tokenizerTypes.types.parenL);
clause.param = this.parseBindingAtom();
this.checkLVal(clause.param, true, _Object$create(null));
this.expect(_tokenizerTypes.types.parenR);
clause.body = this.parseBlock();
node.handler = this.finishNode(clause, "CatchClause");
}
node.guardedHandlers = empty;
node.finalizer = this.eat(_tokenizerTypes.types._finally) ? this.parseBlock() : null;
if (!node.handler && !node.finalizer) {
this.raise(node.start, "Missing catch or finally clause");
}
return this.finishNode(node, "TryStatement");
};
pp.parseVarStatement = function (node, kind) {
this.next();
this.parseVar(node, false, kind);
this.semicolon();
return this.finishNode(node, "VariableDeclaration");
};
pp.parseWhileStatement = function (node) {
this.next();
node.test = this.parseParenExpression();
this.state.labels.push(loopLabel);
node.body = this.parseStatement(false);
this.state.labels.pop();
return this.finishNode(node, "WhileStatement");
};
pp.parseWithStatement = function (node) {
if (this.state.strict) this.raise(this.state.start, "'with' in strict mode");
this.next();
node.object = this.parseParenExpression();
node.body = this.parseStatement(false);
return this.finishNode(node, "WithStatement");
};
pp.parseEmptyStatement = function (node) {
this.next();
return this.finishNode(node, "EmptyStatement");
};
pp.parseLabeledStatement = function (node, maybeName, expr) {
var _arr = this.state.labels;
for (var _i = 0; _i < _arr.length; _i++) {
var label = _arr[_i];
if (label.name === maybeName) {
this.raise(expr.start, "Label '" + maybeName + "' is already declared");
}
}
var kind = this.state.type.isLoop ? "loop" : this.match(_tokenizerTypes.types._switch) ? "switch" : null;
for (var i = this.state.labels.length - 1; i >= 0; i--) {
var label = this.state.labels[i];
if (label.statementStart === node.start) {
label.statementStart = this.state.start;
label.kind = kind;
} else {
break;
}
}
this.state.labels.push({ name: maybeName, kind: kind, statementStart: this.state.start });
node.body = this.parseStatement(true);
this.state.labels.pop();
node.label = expr;
return this.finishNode(node, "LabeledStatement");
};
pp.parseExpressionStatement = function (node, expr) {
node.expression = expr;
this.semicolon();
return this.finishNode(node, "ExpressionStatement");
};
// Parse a semicolon-enclosed block of statements, handling `"use
// strict"` declarations when `allowStrict` is true (used for
// function bodies).
pp.parseBlock = function (allowDirectives) {
var node = this.startNode();
this.expect(_tokenizerTypes.types.braceL);
this.parseBlockBody(node, allowDirectives, false, _tokenizerTypes.types.braceR);
return this.finishNode(node, "BlockStatement");
};
// TODO
pp.parseBlockBody = function (node, allowDirectives, topLevel, end) {
node.body = [];
node.directives = [];
var parsedNonDirective = false;
var oldStrict = undefined;
var octalPosition = undefined;
while (!this.eat(end)) {
if (!parsedNonDirective && this.state.containsOctal && !octalPosition) {
octalPosition = this.state.octalPosition;
}
var stmt = this.parseStatement(true, topLevel);
if (allowDirectives && !parsedNonDirective && stmt.type === "ExpressionStatement" && stmt.expression.type === "StringLiteral" && !stmt.expression.extra.parenthesized) {
var directive = this.stmtToDirective(stmt);
node.directives.push(directive);
if (oldStrict === undefined && directive.value.value === "use strict") {
oldStrict = this.state.strict;
this.setStrict(true);
if (octalPosition) {
this.raise(octalPosition, "Octal literal in strict mode");
}
}
continue;
}
parsedNonDirective = true;
node.body.push(stmt);
}
if (oldStrict === false) {
this.setStrict(false);
}
};
// Parse a regular `for` loop. The disambiguation code in
// `parseStatement` will already have parsed the init statement or
// expression.
pp.parseFor = function (node, init) {
node.init = init;
this.expect(_tokenizerTypes.types.semi);
node.test = this.match(_tokenizerTypes.types.semi) ? null : this.parseExpression();
this.expect(_tokenizerTypes.types.semi);
node.update = this.match(_tokenizerTypes.types.parenR) ? null : this.parseExpression();
this.expect(_tokenizerTypes.types.parenR);
node.body = this.parseStatement(false);
this.state.labels.pop();
return this.finishNode(node, "ForStatement");
};
// Parse a `for`/`in` and `for`/`of` loop, which are almost
// same from parser's perspective.
pp.parseForIn = function (node, init) {
var type = this.match(_tokenizerTypes.types._in) ? "ForInStatement" : "ForOfStatement";
this.next();
node.left = init;
node.right = this.parseExpression();
this.expect(_tokenizerTypes.types.parenR);
node.body = this.parseStatement(false);
this.state.labels.pop();
return this.finishNode(node, type);
};
// Parse a list of variable declarations.
pp.parseVar = function (node, isFor, kind) {
node.declarations = [];
node.kind = kind.keyword;
for (;;) {
var decl = this.startNode();
this.parseVarHead(decl);
if (this.eat(_tokenizerTypes.types.eq)) {
decl.init = this.parseMaybeAssign(isFor);
} else if (kind === _tokenizerTypes.types._const && !(this.match(_tokenizerTypes.types._in) || this.isContextual("of"))) {
this.unexpected();
} else if (decl.id.type !== "Identifier" && !(isFor && (this.match(_tokenizerTypes.types._in) || this.isContextual("of")))) {
this.raise(this.state.lastTokEnd, "Complex binding patterns require an initialization value");
} else {
decl.init = null;
}
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
if (!this.eat(_tokenizerTypes.types.comma)) break;
}
return node;
};
pp.parseVarHead = function (decl) {
decl.id = this.parseBindingAtom();
this.checkLVal(decl.id, true);
};
// Parse a function declaration or literal (depending on the
// `isStatement` parameter).
pp.parseFunction = function (node, isStatement, allowExpressionBody, isAsync, optionalId) {
var oldInMethod = this.state.inMethod;
this.state.inMethod = false;
this.initFunction(node, isAsync);
if (this.match(_tokenizerTypes.types.star)) {
if (node.async && !this.hasPlugin("asyncGenerators")) {
this.unexpected();
} else {
node.generator = true;
this.next();
}
}
if (isStatement && !optionalId && !this.match(_tokenizerTypes.types.name) && !this.match(_tokenizerTypes.types._yield)) {
this.unexpected();
}
if (this.match(_tokenizerTypes.types.name) || this.match(_tokenizerTypes.types._yield)) {
node.id = this.parseBindingIdentifier();
}
this.parseFunctionParams(node);
this.parseFunctionBody(node, allowExpressionBody);
this.state.inMethod = oldInMethod;
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
};
pp.parseFunctionParams = function (node) {
this.expect(_tokenizerTypes.types.parenL);
node.params = this.parseBindingList(_tokenizerTypes.types.parenR, false, this.hasPlugin("trailingFunctionCommas"));
};
// Parse a class declaration or literal (depending on the
// `isStatement` parameter).
pp.parseClass = function (node, isStatement, optionalId) {
this.next();
this.parseClassId(node, isStatement, optionalId);
this.parseClassSuper(node);
this.parseClassBody(node);
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
};
pp.isClassProperty = function () {
return this.match(_tokenizerTypes.types.eq) || this.isLineTerminator();
};
pp.parseClassBody = function (node) {
// class bodies are implicitly strict
var oldStrict = this.state.strict;
this.state.strict = true;
var hadConstructorCall = false;
var hadConstructor = false;
var decorators = [];
var classBody = this.startNode();
classBody.body = [];
this.expect(_tokenizerTypes.types.braceL);
while (!this.eat(_tokenizerTypes.types.braceR)) {
if (this.eat(_tokenizerTypes.types.semi)) {
continue;
}
if (this.match(_tokenizerTypes.types.at)) {
decorators.push(this.parseDecorator());
continue;
}
var method = this.startNode();
// steal the decorators if there are any
if (decorators.length) {
method.decorators = decorators;
decorators = [];
}
var isConstructorCall = false;
var isMaybeStatic = this.match(_tokenizerTypes.types.name) && this.state.value === "static";
var isGenerator = this.eat(_tokenizerTypes.types.star);
var isGetSet = false;
var isAsync = false;
this.parsePropertyName(method);
method["static"] = isMaybeStatic && !this.match(_tokenizerTypes.types.parenL);
if (method["static"]) {
if (isGenerator) this.unexpected();
isGenerator = this.eat(_tokenizerTypes.types.star);
this.parsePropertyName(method);
}
if (!isGenerator && method.key.type === "Identifier" && !method.computed) {
if (this.isClassProperty()) {
classBody.body.push(this.parseClassProperty(method));
continue;
}
if (this.hasPlugin("classConstructorCall") && method.key.name === "call" && this.match(_tokenizerTypes.types.name) && this.state.value === "constructor") {
isConstructorCall = true;
this.parsePropertyName(method);
}
}
var isAsyncMethod = this.hasPlugin("asyncFunctions") && !this.match(_tokenizerTypes.types.parenL) && !method.computed && method.key.type === "Identifier" && method.key.name === "async";
if (isAsyncMethod) {
if (this.hasPlugin("asyncGenerators") && this.eat(_tokenizerTypes.types.star)) isGenerator = true;
isAsync = true;
this.parsePropertyName(method);
}
method.kind = "method";
if (!method.computed) {
var key = method.key;
// handle get/set methods
// eg. class Foo { get bar() {} set bar() {} }
if (!isAsync && !isGenerator && key.type === "Identifier" && !this.match(_tokenizerTypes.types.parenL) && (key.name === "get" || key.name === "set")) {
isGetSet = true;
method.kind = key.name;
key = this.parsePropertyName(method);
}
// disallow invalid constructors
var isConstructor = !isConstructorCall && !method["static"] && (key.type === "Identifier" && key.name === "constructor" || key.type === "StringLiteral" && key.value === "constructor");
if (isConstructor) {
if (hadConstructor) this.raise(key.start, "Duplicate constructor in the same class");
if (isGetSet) this.raise(key.start, "Constructor can't have get/set modifier");
if (isGenerator) this.raise(key.start, "Constructor can't be a generator");
if (isAsync) this.raise(key.start, "Constructor can't be an async function");
method.kind = "constructor";
hadConstructor = true;
}
// disallow static prototype method
var isStaticPrototype = method["static"] && (key.type === "Identifier" && key.name === "prototype" || key.type === "StringLiteral" && key.value === "prototype");
if (isStaticPrototype) {
this.raise(key.start, "Classes may not have static property named prototype");
}
}
// convert constructor to a constructor call
if (isConstructorCall) {
if (hadConstructorCall) this.raise(method.start, "Duplicate constructor call in the same class");
method.kind = "constructorCall";
hadConstructorCall = true;
}
// disallow decorators on class constructors
if ((method.kind === "constructor" || method.kind === "constructorCall") && method.decorators) {
this.raise(method.start, "You can't attach decorators to a class constructor");
}
this.parseClassMethod(classBody, method, isGenerator, isAsync);
// get methods aren't allowed to have any parameters
// set methods must have exactly 1 parameter
if (isGetSet) {
var paramCount = method.kind === "get" ? 0 : 1;
if (method.params.length !== paramCount) {
var start = method.start;
if (method.kind === "get") {
this.raise(start, "getter should have no params");
} else {
this.raise(start, "setter should have exactly one param");
}
}
}
}
if (decorators.length) {
this.raise(this.state.start, "You have trailing decorators with no method");
}
node.body = this.finishNode(classBody, "ClassBody");
this.state.strict = oldStrict;
};
pp.parseClassProperty = function (node) {
if (this.match(_tokenizerTypes.types.eq)) {
if (!this.hasPlugin("classProperties")) this.unexpected();
this.next();
node.value = this.parseMaybeAssign();
} else {
node.value = null;
}
this.semicolon();
return this.finishNode(node, "ClassProperty");
};
pp.parseClassMethod = function (classBody, method, isGenerator, isAsync) {
this.parseMethod(method, isGenerator, isAsync);
classBody.body.push(this.finishNode(method, "ClassMethod"));
};
pp.parseClassId = function (node, isStatement, optionalId) {
if (this.match(_tokenizerTypes.types.name)) {
node.id = this.parseIdentifier();
} else {
if (optionalId || !isStatement) {
node.id = null;
} else {
this.unexpected();
}
}
};
pp.parseClassSuper = function (node) {
node.superClass = this.eat(_tokenizerTypes.types._extends) ? this.parseExprSubscripts() : null;
};
// Parses module export declaration.
pp.parseExport = function (node) {
this.next();
// export * from '...'
if (this.match(_tokenizerTypes.types.star)) {
var specifier = this.startNode();
this.next();
if (this.hasPlugin("exportExtensions") && this.eatContextual("as")) {
specifier.exported = this.parseIdentifier();
node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")];
this.parseExportSpecifiersMaybe(node);
this.parseExportFrom(node, true);
} else {
this.parseExportFrom(node, true);
return this.finishNode(node, "ExportAllDeclaration");
}
} else if (this.hasPlugin("exportExtensions") && this.isExportDefaultSpecifier()) {
var specifier = this.startNode();
specifier.exported = this.parseIdentifier(true);
node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
if (this.match(_tokenizerTypes.types.comma) && this.lookahead().type === _tokenizerTypes.types.star) {
this.expect(_tokenizerTypes.types.comma);
var _specifier = this.startNode();
this.expect(_tokenizerTypes.types.star);
this.expectContextual("as");
_specifier.exported = this.parseIdentifier();
node.specifiers.push(this.finishNode(_specifier, "ExportNamespaceSpecifier"));
} else {
this.parseExportSpecifiersMaybe(node);
}
this.parseExportFrom(node, true);
} else if (this.eat(_tokenizerTypes.types._default)) {
// export default ...
var expr = this.startNode();
var needsSemi = false;
if (this.eat(_tokenizerTypes.types._function)) {
expr = this.parseFunction(expr, true, false, false, true);
} else if (this.match(_tokenizerTypes.types._class)) {
expr = this.parseClass(expr, true, true);
} else {
needsSemi = true;
expr = this.parseMaybeAssign();
}
node.declaration = expr;
if (needsSemi) this.semicolon();
this.checkExport(node);
return this.finishNode(node, "ExportDefaultDeclaration");
} else if (this.state.type.keyword || this.shouldParseExportDeclaration()) {
node.specifiers = [];
node.source = null;
node.declaration = this.parseExportDeclaration(node);
} else {
// export { x, y as z } [from '...']
node.declaration = null;
node.specifiers = this.parseExportSpecifiers();
this.parseExportFrom(node);
}
this.checkExport(node);
return this.finishNode(node, "ExportNamedDeclaration");
};
pp.parseExportDeclaration = function () {
return this.parseStatement(true);
};
pp.isExportDefaultSpecifier = function () {
if (this.match(_tokenizerTypes.types.name)) {
return this.state.value !== "type" && this.state.value !== "async" && this.state.value !== "interface";
}
if (!this.match(_tokenizerTypes.types._default)) {
return false;
}
var lookahead = this.lookahead();
return lookahead.type === _tokenizerTypes.types.comma || lookahead.type === _tokenizerTypes.types.name && lookahead.value === "from";
};
pp.parseExportSpecifiersMaybe = function (node) {
if (this.eat(_tokenizerTypes.types.comma)) {
node.specifiers = node.specifiers.concat(this.parseExportSpecifiers());
}
};
pp.parseExportFrom = function (node, expect) {
if (this.eatContextual("from")) {
node.source = this.match(_tokenizerTypes.types.string) ? this.parseExprAtom() : this.unexpected();
this.checkExport(node);
} else {
if (expect) {
this.unexpected();
} else {
node.source = null;
}
}
this.semicolon();
};
pp.shouldParseExportDeclaration = function () {
return this.hasPlugin("asyncFunctions") && this.isContextual("async");
};
pp.checkExport = function (node) {
if (this.state.decorators.length) {
var isClass = node.declaration && (node.declaration.type === "ClassDeclaration" || node.declaration.type === "ClassExpression");
if (!node.declaration || !isClass) {
this.raise(node.start, "You can only use decorators on an export when exporting a class");
}
this.takeDecorators(node.declaration);
}
};
// Parses a comma-separated list of module exports.
pp.parseExportSpecifiers = function () {
var nodes = [];
var first = true;
var needsFrom = undefined;
// export { x, y as z } [from '...']
this.expect(_tokenizerTypes.types.braceL);
while (!this.eat(_tokenizerTypes.types.braceR)) {
if (first) {
first = false;
} else {
this.expect(_tokenizerTypes.types.comma);
if (this.eat(_tokenizerTypes.types.braceR)) break;
}
var isDefault = this.match(_tokenizerTypes.types._default);
if (isDefault && !needsFrom) needsFrom = true;
var node = this.startNode();
node.local = this.parseIdentifier(isDefault);
node.exported = this.eatContextual("as") ? this.parseIdentifier(true) : node.local.__clone();
nodes.push(this.finishNode(node, "ExportSpecifier"));
}
// https://github.com/ember-cli/ember-cli/pull/3739
if (needsFrom && !this.isContextual("from")) {
this.unexpected();
}
return nodes;
};
// Parses import declaration.
pp.parseImport = function (node) {
this.next();
// import '...'
if (this.match(_tokenizerTypes.types.string)) {
node.specifiers = [];
node.source = this.parseExprAtom();
} else {
node.specifiers = [];
this.parseImportSpecifiers(node);
this.expectContextual("from");
node.source = this.match(_tokenizerTypes.types.string) ? this.parseExprAtom() : this.unexpected();
}
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
};
// Parses a comma-separated list of module imports.
pp.parseImportSpecifiers = function (node) {
var first = true;
if (this.match(_tokenizerTypes.types.name)) {
// import defaultObj, { x, y as z } from '...'
var startPos = this.state.start,
startLoc = this.state.startLoc;
node.specifiers.push(this.parseImportSpecifierDefault(this.parseIdentifier(), startPos, startLoc));
if (!this.eat(_tokenizerTypes.types.comma)) return;
}
if (this.match(_tokenizerTypes.types.star)) {
var specifier = this.startNode();
this.next();
this.expectContextual("as");
specifier.local = this.parseIdentifier();
this.checkLVal(specifier.local, true);
node.specifiers.push(this.finishNode(specifier, "ImportNamespaceSpecifier"));
return;
}
this.expect(_tokenizerTypes.types.braceL);
while (!this.eat(_tokenizerTypes.types.braceR)) {
if (first) {
first = false;
} else {
this.expect(_tokenizerTypes.types.comma);
if (this.eat(_tokenizerTypes.types.braceR)) break;
}
var specifier = this.startNode();
specifier.imported = this.parseIdentifier(true);
specifier.local = this.eatContextual("as") ? this.parseIdentifier() : specifier.imported.__clone();
this.checkLVal(specifier.local, true);
node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
}
};
pp.parseImportSpecifierDefault = function (id, startPos, startLoc) {
var node = this.startNodeAt(startPos, startLoc);
node.local = id;
this.checkLVal(node.local, true);
return this.finishNode(node, "ImportDefaultSpecifier");
};
},{"17":17,"20":20,"21":21,"25":25,"5":5}],10:[function(_dereq_,module,exports){
"use strict";
var _interopRequireDefault = _dereq_(25)["default"];
var _tokenizerTypes = _dereq_(17);
var _index = _dereq_(5);
var _index2 = _interopRequireDefault(_index);
var _utilWhitespace = _dereq_(20);
var pp = _index2["default"].prototype;
// ## Parser utilities
// TODO
pp.addExtra = function (node, key, val) {
if (!node) return;
var extra = node.extra = node.extra || {};
extra[key] = val;
};
// TODO
pp.isRelational = function (op) {
return this.match(_tokenizerTypes.types.relational) && this.state.value === op;
};
// TODO
pp.expectRelational = function (op) {
if (this.isRelational(op)) {
this.next();
} else {
this.unexpected();
}
};
// Tests whether parsed token is a contextual keyword.
pp.isContextual = function (name) {
return this.match(_tokenizerTypes.types.name) && this.state.value === name;
};
// Consumes contextual keyword if possible.
pp.eatContextual = function (name) {
return this.state.value === name && this.eat(_tokenizerTypes.types.name);
};
// Asserts that following token is given contextual keyword.
pp.expectContextual = function (name) {
if (!this.eatContextual(name)) this.unexpected();
};
// Test whether a semicolon can be inserted at the current position.
pp.canInsertSemicolon = function () {
return this.match(_tokenizerTypes.types.eof) || this.match(_tokenizerTypes.types.braceR) || _utilWhitespace.lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
};
// TODO
pp.isLineTerminator = function () {
return this.eat(_tokenizerTypes.types.semi) || this.canInsertSemicolon();
};
// Consume a semicolon, or, failing that, see if we are allowed to
// pretend that there is a semicolon at this position.
pp.semicolon = function () {
if (!this.isLineTerminator()) this.unexpected();
};
// Expect a token of a given type. If found, consume it, otherwise,
// raise an unexpected token error.
pp.expect = function (type) {
return this.eat(type) || this.unexpected();
};
// Raise an unexpected token error.
pp.unexpected = function (pos) {
this.raise(pos != null ? pos : this.state.start, "Unexpected token");
};
},{"17":17,"20":20,"25":25,"5":5}],11:[function(_dereq_,module,exports){
/* eslint indent: 0 */
/* eslint max-len: 0 */
"use strict";
var _interopRequireDefault = _dereq_(25)["default"];
exports.__esModule = true;
var _tokenizerTypes = _dereq_(17);
var _parser = _dereq_(5);
var _parser2 = _interopRequireDefault(_parser);
var pp = _parser2["default"].prototype;
pp.flowParseTypeInitialiser = function (tok, allowLeadingPipeOrAnd) {
var oldInType = this.state.inType;
this.state.inType = true;
this.expect(tok || _tokenizerTypes.types.colon);
if (allowLeadingPipeOrAnd) {
if (this.match(_tokenizerTypes.types.bitwiseAND) || this.match(_tokenizerTypes.types.bitwiseOR)) {
this.next();
}
}
var type = this.flowParseType();
this.state.inType = oldInType;
return type;
};
pp.flowParseDeclareClass = function (node) {
this.next();
this.flowParseInterfaceish(node, true);
return this.finishNode(node, "DeclareClass");
};
pp.flowParseDeclareFunction = function (node) {
this.next();
var id = node.id = this.parseIdentifier();
var typeNode = this.startNode();
var typeContainer = this.startNode();
if (this.isRelational("<")) {
typeNode.typeParameters = this.flowParseTypeParameterDeclaration();
} else {
typeNode.typeParameters = null;
}
this.expect(_tokenizerTypes.types.parenL);
var tmp = this.flowParseFunctionTypeParams();
typeNode.params = tmp.params;
typeNode.rest = tmp.rest;
this.expect(_tokenizerTypes.types.parenR);
typeNode.returnType = this.flowParseTypeInitialiser();
typeContainer.typeAnnotation = this.finishNode(typeNode, "FunctionTypeAnnotation");
id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation");
this.finishNode(id, id.type);
this.semicolon();
return this.finishNode(node, "DeclareFunction");
};
pp.flowParseDeclare = function (node) {
if (this.match(_tokenizerTypes.types._class)) {
return this.flowParseDeclareClass(node);
} else if (this.match(_tokenizerTypes.types._function)) {
return this.flowParseDeclareFunction(node);
} else if (this.match(_tokenizerTypes.types._var)) {
return this.flowParseDeclareVariable(node);
} else if (this.isContextual("module")) {
return this.flowParseDeclareModule(node);
} else if (this.isContextual("type")) {
return this.flowParseDeclareTypeAlias(node);
} else if (this.isContextual("interface")) {
return this.flowParseDeclareInterface(node);
} else {
this.unexpected();
}
};
pp.flowParseDeclareVariable = function (node) {
this.next();
node.id = this.flowParseTypeAnnotatableIdentifier();
this.semicolon();
return this.finishNode(node, "DeclareVariable");
};
pp.flowParseDeclareModule = function (node) {
this.next();
if (this.match(_tokenizerTypes.types.string)) {
node.id = this.parseExprAtom();
} else {
node.id = this.parseIdentifier();
}
var bodyNode = node.body = this.startNode();
var body = bodyNode.body = [];
this.expect(_tokenizerTypes.types.braceL);
while (!this.match(_tokenizerTypes.types.braceR)) {
var node2 = this.startNode();
// todo: declare check
this.next();
body.push(this.flowParseDeclare(node2));
}
this.expect(_tokenizerTypes.types.braceR);
this.finishNode(bodyNode, "BlockStatement");
return this.finishNode(node, "DeclareModule");
};
pp.flowParseDeclareTypeAlias = function (node) {
this.next();
this.flowParseTypeAlias(node);
return this.finishNode(node, "DeclareTypeAlias");
};
pp.flowParseDeclareInterface = function (node) {
this.next();
this.flowParseInterfaceish(node);
return this.finishNode(node, "DeclareInterface");
};
// Interfaces
pp.flowParseInterfaceish = function (node, allowStatic) {
node.id = this.parseIdentifier();
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterDeclaration();
} else {
node.typeParameters = null;
}
node["extends"] = [];
node.mixins = [];
if (this.eat(_tokenizerTypes.types._extends)) {
do {
node["extends"].push(this.flowParseInterfaceExtends());
} while (this.eat(_tokenizerTypes.types.comma));
}
if (this.isContextual("mixins")) {
this.next();
do {
node.mixins.push(this.flowParseInterfaceExtends());
} while (this.eat(_tokenizerTypes.types.comma));
}
node.body = this.flowParseObjectType(allowStatic);
};
pp.flowParseInterfaceExtends = function () {
var node = this.startNode();
node.id = this.parseIdentifier();
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterInstantiation();
} else {
node.typeParameters = null;
}
return this.finishNode(node, "InterfaceExtends");
};
pp.flowParseInterface = function (node) {
this.flowParseInterfaceish(node, false);
return this.finishNode(node, "InterfaceDeclaration");
};
// Type aliases
pp.flowParseTypeAlias = function (node) {
node.id = this.parseIdentifier();
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterDeclaration();
} else {
node.typeParameters = null;
}
node.right = this.flowParseTypeInitialiser(_tokenizerTypes.types.eq,
/*allowLeadingPipeOrAnd*/true);
this.semicolon();
return this.finishNode(node, "TypeAlias");
};
// Type annotations
pp.flowParseTypeParameterDeclaration = function () {
var node = this.startNode();
node.params = [];
this.expectRelational("<");
while (!this.isRelational(">")) {
node.params.push(this.flowParseExistentialTypeParam() || this.flowParseTypeAnnotatableIdentifier());
if (!this.isRelational(">")) {
this.expect(_tokenizerTypes.types.comma);
}
}
this.expectRelational(">");
return this.finishNode(node, "TypeParameterDeclaration");
};
pp.flowParseExistentialTypeParam = function () {
if (this.match(_tokenizerTypes.types.star)) {
var node = this.startNode();
this.next();
return this.finishNode(node, "ExistentialTypeParam");
}
};
pp.flowParseTypeParameterInstantiation = function () {
var node = this.startNode(),
oldInType = this.state.inType;
node.params = [];
this.state.inType = true;
this.expectRelational("<");
while (!this.isRelational(">")) {
node.params.push(this.flowParseExistentialTypeParam() || this.flowParseType());
if (!this.isRelational(">")) {
this.expect(_tokenizerTypes.types.comma);
}
}
this.expectRelational(">");
this.state.inType = oldInType;
return this.finishNode(node, "TypeParameterInstantiation");
};
pp.flowParseObjectPropertyKey = function () {
return this.match(_tokenizerTypes.types.num) || this.match(_tokenizerTypes.types.string) ? this.parseExprAtom() : this.parseIdentifier(true);
};
pp.flowParseObjectTypeIndexer = function (node, isStatic) {
node["static"] = isStatic;
this.expect(_tokenizerTypes.types.bracketL);
node.id = this.flowParseObjectPropertyKey();
node.key = this.flowParseTypeInitialiser();
this.expect(_tokenizerTypes.types.bracketR);
node.value = this.flowParseTypeInitialiser();
this.flowObjectTypeSemicolon();
return this.finishNode(node, "ObjectTypeIndexer");
};
pp.flowParseObjectTypeMethodish = function (node) {
node.params = [];
node.rest = null;
node.typeParameters = null;
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterDeclaration();
}
this.expect(_tokenizerTypes.types.parenL);
while (this.match(_tokenizerTypes.types.name)) {
node.params.push(this.flowParseFunctionTypeParam());
if (!this.match(_tokenizerTypes.types.parenR)) {
this.expect(_tokenizerTypes.types.comma);
}
}
if (this.eat(_tokenizerTypes.types.ellipsis)) {
node.rest = this.flowParseFunctionTypeParam();
}
this.expect(_tokenizerTypes.types.parenR);
node.returnType = this.flowParseTypeInitialiser();
return this.finishNode(node, "FunctionTypeAnnotation");
};
pp.flowParseObjectTypeMethod = function (startPos, startLoc, isStatic, key) {
var node = this.startNodeAt(startPos, startLoc);
node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(startPos, startLoc));
node["static"] = isStatic;
node.key = key;
node.optional = false;
this.flowObjectTypeSemicolon();
return this.finishNode(node, "ObjectTypeProperty");
};
pp.flowParseObjectTypeCallProperty = function (node, isStatic) {
var valueNode = this.startNode();
node["static"] = isStatic;
node.value = this.flowParseObjectTypeMethodish(valueNode);
this.flowObjectTypeSemicolon();
return this.finishNode(node, "ObjectTypeCallProperty");
};
pp.flowParseObjectType = function (allowStatic) {
var nodeStart = this.startNode();
var node = undefined;
var propertyKey = undefined;
var isStatic = undefined;
nodeStart.callProperties = [];
nodeStart.properties = [];
nodeStart.indexers = [];
this.expect(_tokenizerTypes.types.braceL);
while (!this.match(_tokenizerTypes.types.braceR)) {
var optional = false;
var startPos = this.state.start,
startLoc = this.state.startLoc;
node = this.startNode();
if (allowStatic && this.isContextual("static")) {
this.next();
isStatic = true;
}
if (this.match(_tokenizerTypes.types.bracketL)) {
nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic));
} else if (this.match(_tokenizerTypes.types.parenL) || this.isRelational("<")) {
nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, allowStatic));
} else {
if (isStatic && this.match(_tokenizerTypes.types.colon)) {
propertyKey = this.parseIdentifier();
} else {
propertyKey = this.flowParseObjectPropertyKey();
}
if (this.isRelational("<") || this.match(_tokenizerTypes.types.parenL)) {
// This is a method property
nodeStart.properties.push(this.flowParseObjectTypeMethod(startPos, startLoc, isStatic, propertyKey));
} else {
if (this.eat(_tokenizerTypes.types.question)) {
optional = true;
}
node.key = propertyKey;
node.value = this.flowParseTypeInitialiser();
node.optional = optional;
node["static"] = isStatic;
this.flowObjectTypeSemicolon();
nodeStart.properties.push(this.finishNode(node, "ObjectTypeProperty"));
}
}
}
this.expect(_tokenizerTypes.types.braceR);
return this.finishNode(nodeStart, "ObjectTypeAnnotation");
};
pp.flowObjectTypeSemicolon = function () {
if (!this.eat(_tokenizerTypes.types.semi) && !this.eat(_tokenizerTypes.types.comma) && !this.match(_tokenizerTypes.types.braceR)) {
this.unexpected();
}
};
pp.flowParseGenericType = function (startPos, startLoc, id) {
var node = this.startNodeAt(startPos, startLoc);
node.typeParameters = null;
node.id = id;
while (this.eat(_tokenizerTypes.types.dot)) {
var node2 = this.startNodeAt(startPos, startLoc);
node2.qualification = node.id;
node2.id = this.parseIdentifier();
node.id = this.finishNode(node2, "QualifiedTypeIdentifier");
}
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterInstantiation();
}
return this.finishNode(node, "GenericTypeAnnotation");
};
pp.flowParseTypeofType = function () {
var node = this.startNode();
this.expect(_tokenizerTypes.types._typeof);
node.argument = this.flowParsePrimaryType();
return this.finishNode(node, "TypeofTypeAnnotation");
};
pp.flowParseTupleType = function () {
var node = this.startNode();
node.types = [];
this.expect(_tokenizerTypes.types.bracketL);
// We allow trailing commas
while (this.state.pos < this.input.length && !this.match(_tokenizerTypes.types.bracketR)) {
node.types.push(this.flowParseType());
if (this.match(_tokenizerTypes.types.bracketR)) break;
this.expect(_tokenizerTypes.types.comma);
}
this.expect(_tokenizerTypes.types.bracketR);
return this.finishNode(node, "TupleTypeAnnotation");
};
pp.flowParseFunctionTypeParam = function () {
var optional = false;
var node = this.startNode();
node.name = this.parseIdentifier();
if (this.eat(_tokenizerTypes.types.question)) {
optional = true;
}
node.optional = optional;
node.typeAnnotation = this.flowParseTypeInitialiser();
return this.finishNode(node, "FunctionTypeParam");
};
pp.flowParseFunctionTypeParams = function () {
var ret = { params: [], rest: null };
while (this.match(_tokenizerTypes.types.name)) {
ret.params.push(this.flowParseFunctionTypeParam());
if (!this.match(_tokenizerTypes.types.parenR)) {
this.expect(_tokenizerTypes.types.comma);
}
}
if (this.eat(_tokenizerTypes.types.ellipsis)) {
ret.rest = this.flowParseFunctionTypeParam();
}
return ret;
};
pp.flowIdentToTypeAnnotation = function (startPos, startLoc, node, id) {
switch (id.name) {
case "any":
return this.finishNode(node, "AnyTypeAnnotation");
case "void":
return this.finishNode(node, "VoidTypeAnnotation");
case "bool":
case "boolean":
return this.finishNode(node, "BooleanTypeAnnotation");
case "mixed":
return this.finishNode(node, "MixedTypeAnnotation");
case "number":
return this.finishNode(node, "NumberTypeAnnotation");
case "string":
return this.finishNode(node, "StringTypeAnnotation");
default:
return this.flowParseGenericType(startPos, startLoc, id);
}
};
// The parsing of types roughly parallels the parsing of expressions, and
// primary types are kind of like primary expressions...they're the
// primitives with which other types are constructed.
pp.flowParsePrimaryType = function () {
var startPos = this.state.start,
startLoc = this.state.startLoc;
var node = this.startNode();
var tmp = undefined;
var type = undefined;
var isGroupedType = false;
switch (this.state.type) {
case _tokenizerTypes.types.name:
return this.flowIdentToTypeAnnotation(startPos, startLoc, node, this.parseIdentifier());
case _tokenizerTypes.types.braceL:
return this.flowParseObjectType();
case _tokenizerTypes.types.bracketL:
return this.flowParseTupleType();
case _tokenizerTypes.types.relational:
if (this.state.value === "<") {
node.typeParameters = this.flowParseTypeParameterDeclaration();
this.expect(_tokenizerTypes.types.parenL);
tmp = this.flowParseFunctionTypeParams();
node.params = tmp.params;
node.rest = tmp.rest;
this.expect(_tokenizerTypes.types.parenR);
this.expect(_tokenizerTypes.types.arrow);
node.returnType = this.flowParseType();
return this.finishNode(node, "FunctionTypeAnnotation");
}
case _tokenizerTypes.types.parenL:
this.next();
// Check to see if this is actually a grouped type
if (!this.match(_tokenizerTypes.types.parenR) && !this.match(_tokenizerTypes.types.ellipsis)) {
if (this.match(_tokenizerTypes.types.name)) {
var token = this.lookahead().type;
isGroupedType = token !== _tokenizerTypes.types.question && token !== _tokenizerTypes.types.colon;
} else {
isGroupedType = true;
}
}
if (isGroupedType) {
type = this.flowParseType();
this.expect(_tokenizerTypes.types.parenR);
// If we see a => next then someone was probably confused about
// function types, so we can provide a better error message
if (this.eat(_tokenizerTypes.types.arrow)) {
this.raise(node, "Unexpected token =>. It looks like " + "you are trying to write a function type, but you ended up " + "writing a grouped type followed by an =>, which is a syntax " + "error. Remember, function type parameters are named so function " + "types look like (name1: type1, name2: type2) => returnType. You " + "probably wrote (type1) => returnType");
}
return type;
}
tmp = this.flowParseFunctionTypeParams();
node.params = tmp.params;
node.rest = tmp.rest;
this.expect(_tokenizerTypes.types.parenR);
this.expect(_tokenizerTypes.types.arrow);
node.returnType = this.flowParseType();
node.typeParameters = null;
return this.finishNode(node, "FunctionTypeAnnotation");
case _tokenizerTypes.types.string:
node.value = this.state.value;
this.addExtra(node, "rawValue", node.value);
this.addExtra(node, "raw", this.input.slice(this.state.start, this.state.end));
this.next();
return this.finishNode(node, "StringLiteralTypeAnnotation");
case _tokenizerTypes.types._true:case _tokenizerTypes.types._false:
node.value = this.match(_tokenizerTypes.types._true);
this.next();
return this.finishNode(node, "BooleanLiteralTypeAnnotation");
case _tokenizerTypes.types.num:
node.value = this.state.value;
this.addExtra(node, "rawValue", node.value);
this.addExtra(node, "raw", this.input.slice(this.state.start, this.state.end));
this.next();
return this.finishNode(node, "NumericLiteralTypeAnnotation");
case _tokenizerTypes.types._null:
node.value = this.match(_tokenizerTypes.types._null);
this.next();
return this.finishNode(node, "NullLiteralTypeAnnotation");
case _tokenizerTypes.types._this:
node.value = this.match(_tokenizerTypes.types._this);
this.next();
return this.finishNode(node, "ThisTypeAnnotation");
default:
if (this.state.type.keyword === "typeof") {
return this.flowParseTypeofType();
}
}
this.unexpected();
};
pp.flowParsePostfixType = function () {
var node = this.startNode();
var type = node.elementType = this.flowParsePrimaryType();
if (this.match(_tokenizerTypes.types.bracketL)) {
this.expect(_tokenizerTypes.types.bracketL);
this.expect(_tokenizerTypes.types.bracketR);
return this.finishNode(node, "ArrayTypeAnnotation");
} else {
return type;
}
};
pp.flowParsePrefixType = function () {
var node = this.startNode();
if (this.eat(_tokenizerTypes.types.question)) {
node.typeAnnotation = this.flowParsePrefixType();
return this.finishNode(node, "NullableTypeAnnotation");
} else {
return this.flowParsePostfixType();
}
};
pp.flowParseIntersectionType = function () {
var node = this.startNode();
var type = this.flowParsePrefixType();
node.types = [type];
while (this.eat(_tokenizerTypes.types.bitwiseAND)) {
node.types.push(this.flowParsePrefixType());
}
return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation");
};
pp.flowParseUnionType = function () {
var node = this.startNode();
var type = this.flowParseIntersectionType();
node.types = [type];
while (this.eat(_tokenizerTypes.types.bitwiseOR)) {
node.types.push(this.flowParseIntersectionType());
}
return node.types.length === 1 ? type : this.finishNode(node, "UnionTypeAnnotation");
};
pp.flowParseType = function () {
var oldInType = this.state.inType;
this.state.inType = true;
var type = this.flowParseUnionType();
this.state.inType = oldInType;
return type;
};
pp.flowParseTypeAnnotation = function () {
var node = this.startNode();
node.typeAnnotation = this.flowParseTypeInitialiser();
return this.finishNode(node, "TypeAnnotation");
};
pp.flowParseTypeAnnotatableIdentifier = function (requireTypeAnnotation, canBeOptionalParam) {
var variance = undefined;
if (this.match(_tokenizerTypes.types.plusMin)) {
if (this.state.value === "+") {
variance = "plus";
} else if (this.state.value === "-") {
variance = "minus";
}
this.eat(_tokenizerTypes.types.plusMin);
}
var ident = this.parseIdentifier();
var isOptionalParam = false;
if (variance) {
ident.variance = variance;
}
if (canBeOptionalParam && this.eat(_tokenizerTypes.types.question)) {
this.expect(_tokenizerTypes.types.question);
isOptionalParam = true;
}
if (requireTypeAnnotation || this.match(_tokenizerTypes.types.colon)) {
ident.typeAnnotation = this.flowParseTypeAnnotation();
this.finishNode(ident, ident.type);
}
if (isOptionalParam) {
ident.optional = true;
this.finishNode(ident, ident.type);
}
return ident;
};
exports["default"] = function (instance) {
// plain function return types: function name(): string {}
instance.extend("parseFunctionBody", function (inner) {
return function (node, allowExpression) {
if (this.match(_tokenizerTypes.types.colon) && !allowExpression) {
// if allowExpression is true then we're parsing an arrow function and if
// there's a return type then it's been handled elsewhere
node.returnType = this.flowParseTypeAnnotation();
}
return inner.call(this, node, allowExpression);
};
});
// interfaces
instance.extend("parseStatement", function (inner) {
return function (declaration, topLevel) {
// strict mode handling of `interface` since it's a reserved word
if (this.state.strict && this.match(_tokenizerTypes.types.name) && this.state.value === "interface") {
var node = this.startNode();
this.next();
return this.flowParseInterface(node);
} else {
return inner.call(this, declaration, topLevel);
}
};
});
// declares, interfaces and type aliases
instance.extend("parseExpressionStatement", function (inner) {
return function (node, expr) {
if (expr.type === "Identifier") {
if (expr.name === "declare") {
if (this.match(_tokenizerTypes.types._class) || this.match(_tokenizerTypes.types.name) || this.match(_tokenizerTypes.types._function) || this.match(_tokenizerTypes.types._var)) {
return this.flowParseDeclare(node);
}
} else if (this.match(_tokenizerTypes.types.name)) {
if (expr.name === "interface") {
return this.flowParseInterface(node);
} else if (expr.name === "type") {
return this.flowParseTypeAlias(node);
}
}
}
return inner.call(this, node, expr);
};
});
// export type
instance.extend("shouldParseExportDeclaration", function (inner) {
return function () {
return this.isContextual("type") || this.isContextual("interface") || inner.call(this);
};
});
instance.extend("parseParenItem", function () {
return function (node, startLoc, startPos, forceArrow) {
var canBeArrow = this.state.potentialArrowAt = startPos;
if (this.match(_tokenizerTypes.types.colon)) {
var typeCastNode = this.startNodeAt(startLoc, startPos);
typeCastNode.expression = node;
typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
if (forceArrow && !this.match(_tokenizerTypes.types.arrow)) {
this.unexpected();
}
if (canBeArrow && this.eat(_tokenizerTypes.types.arrow)) {
// ((lol): number => {});
var params = node.type === "SequenceExpression" ? node.expressions : [node];
var func = this.parseArrowExpression(this.startNodeAt(startLoc, startPos), params);
func.returnType = typeCastNode.typeAnnotation;
return func;
} else {
return this.finishNode(typeCastNode, "TypeCastExpression");
}
} else {
return node;
}
};
});
instance.extend("parseExport", function (inner) {
return function (node) {
node = inner.call(this, node);
if (node.type === "ExportNamedDeclaration") {
node.exportKind = node.exportKind || "value";
}
return node;
};
});
instance.extend("parseExportDeclaration", function (inner) {
return function (node) {
if (this.isContextual("type")) {
node.exportKind = "type";
var declarationNode = this.startNode();
this.next();
if (this.match(_tokenizerTypes.types.braceL)) {
// export type { foo, bar };
node.specifiers = this.parseExportSpecifiers();
this.parseExportFrom(node);
return null;
} else {
// export type Foo = Bar;
return this.flowParseTypeAlias(declarationNode);
}
} else if (this.isContextual("interface")) {
node.exportKind = "type";
var declarationNode = this.startNode();
this.next();
return this.flowParseInterface(declarationNode);
} else {
return inner.call(this, node);
}
};
});
instance.extend("parseClassId", function (inner) {
return function (node) {
inner.apply(this, arguments);
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterDeclaration();
}
};
});
// don't consider `void` to be a keyword as then it'll use the void token type
// and set startExpr
instance.extend("isKeyword", function (inner) {
return function (name) {
if (this.state.inType && name === "void") {
return false;
} else {
return inner.call(this, name);
}
};
});
// ensure that inside flow types, we bypass the jsx parser plugin
instance.extend("readToken", function (inner) {
return function (code) {
if (this.state.inType && (code === 62 || code === 60)) {
return this.finishOp(_tokenizerTypes.types.relational, 1);
} else {
return inner.call(this, code);
}
};
});
// don't lex any token as a jsx one inside a flow type
instance.extend("jsx_readToken", function (inner) {
return function () {
if (!this.state.inType) return inner.call(this);
};
});
function typeCastToParameter(node) {
node.expression.typeAnnotation = node.typeAnnotation;
return node.expression;
}
instance.extend("toAssignable", function (inner) {
return function (node) {
if (node.type === "TypeCastExpression") {
return typeCastToParameter(node);
} else {
return inner.apply(this, arguments);
}
};
});
// turn type casts that we found in function parameter head into type annotated params
instance.extend("toAssignableList", function (inner) {
return function (exprList, isBinding) {
for (var i = 0; i < exprList.length; i++) {
var expr = exprList[i];
if (expr && expr.type === "TypeCastExpression") {
exprList[i] = typeCastToParameter(expr);
}
}
return inner.call(this, exprList, isBinding);
};
});
// this is a list of nodes, from something like a call expression, we need to filter the
// type casts that we've found that are illegal in this context
instance.extend("toReferencedList", function () {
return function (exprList) {
for (var i = 0; i < exprList.length; i++) {
var expr = exprList[i];
if (expr && expr._exprListItem && expr.type === "TypeCastExpression") {
this.raise(expr.start, "Unexpected type cast");
}
}
return exprList;
};
});
// parse an item inside a expression list eg. `(NODE, NODE)` where NODE represents
// the position where this function is cal;ed
instance.extend("parseExprListItem", function (inner) {
return function (allowEmpty, refShorthandDefaultPos) {
var container = this.startNode();
var node = inner.call(this, allowEmpty, refShorthandDefaultPos);
if (this.match(_tokenizerTypes.types.colon)) {
container._exprListItem = true;
container.expression = node;
container.typeAnnotation = this.flowParseTypeAnnotation();
return this.finishNode(container, "TypeCastExpression");
} else {
return node;
}
};
});
instance.extend("checkLVal", function (inner) {
return function (node) {
if (node.type !== "TypeCastExpression") {
return inner.apply(this, arguments);
}
};
});
// parse class property type annotations
instance.extend("parseClassProperty", function (inner) {
return function (node) {
if (this.match(_tokenizerTypes.types.colon)) {
node.typeAnnotation = this.flowParseTypeAnnotation();
}
return inner.call(this, node);
};
});
// determine whether or not we're currently in the position where a class property would appear
instance.extend("isClassProperty", function (inner) {
return function () {
return this.match(_tokenizerTypes.types.colon) || inner.call(this);
};
});
// parse type parameters for class methods
instance.extend("parseClassMethod", function () {
return function (classBody, method, isGenerator, isAsync) {
if (this.isRelational("<")) {
method.typeParameters = this.flowParseTypeParameterDeclaration();
}
this.parseMethod(method, isGenerator, isAsync);
classBody.body.push(this.finishNode(method, "ClassMethod"));
};
});
// parse a the super class type parameters and implements
instance.extend("parseClassSuper", function (inner) {
return function (node, isStatement) {
inner.call(this, node, isStatement);
if (node.superClass && this.isRelational("<")) {
node.superTypeParameters = this.flowParseTypeParameterInstantiation();
}
if (this.isContextual("implements")) {
this.next();
var implemented = node["implements"] = [];
do {
var _node = this.startNode();
_node.id = this.parseIdentifier();
if (this.isRelational("<")) {
_node.typeParameters = this.flowParseTypeParameterInstantiation();
} else {
_node.typeParameters = null;
}
implemented.push(this.finishNode(_node, "ClassImplements"));
} while (this.eat(_tokenizerTypes.types.comma));
}
};
});
// parse type parameters for object method shorthand
instance.extend("parseObjPropValue", function (inner) {
return function (prop) {
var typeParameters = undefined;
// method shorthand
if (this.isRelational("<")) {
typeParameters = this.flowParseTypeParameterDeclaration();
if (!this.match(_tokenizerTypes.types.parenL)) this.unexpected();
}
inner.apply(this, arguments);
// add typeParameters if we found them
if (typeParameters) {
(prop.value || prop).typeParameters = typeParameters;
}
};
});
instance.extend("parseAssignableListItemTypes", function () {
return function (param) {
if (this.eat(_tokenizerTypes.types.question)) {
param.optional = true;
}
if (this.match(_tokenizerTypes.types.colon)) {
param.typeAnnotation = this.flowParseTypeAnnotation();
}
this.finishNode(param, param.type);
return param;
};
});
// parse typeof and type imports
instance.extend("parseImportSpecifiers", function (inner) {
return function (node) {
node.importKind = "value";
var kind = null;
if (this.match(_tokenizerTypes.types._typeof)) {
kind = "typeof";
} else if (this.isContextual("type")) {
kind = "type";
}
if (kind) {
var lh = this.lookahead();
if (lh.type === _tokenizerTypes.types.name && lh.value !== "from" || lh.type === _tokenizerTypes.types.braceL || lh.type === _tokenizerTypes.types.star) {
this.next();
node.importKind = kind;
}
}
inner.call(this, node);
};
});
// parse function type parameters - function foo<T>() {}
instance.extend("parseFunctionParams", function (inner) {
return function (node) {
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterDeclaration();
}
inner.call(this, node);
};
});
// parse flow type annotations on variable declarator heads - let foo: string = bar
instance.extend("parseVarHead", function (inner) {
return function (decl) {
inner.call(this, decl);
if (this.match(_tokenizerTypes.types.colon)) {
decl.id.typeAnnotation = this.flowParseTypeAnnotation();
this.finishNode(decl.id, decl.id.type);
}
};
});
// parse the return type of an async arrow function - let foo = (async (): number => {});
instance.extend("parseAsyncArrowFromCallExpression", function (inner) {
return function (node, call) {
if (this.match(_tokenizerTypes.types.colon)) {
node.returnType = this.flowParseTypeAnnotation();
}
return inner.call(this, node, call);
};
});
// todo description
instance.extend("shouldParseAsyncArrow", function (inner) {
return function () {
return this.match(_tokenizerTypes.types.colon) || inner.call(this);
};
});
// handle return types for arrow functions
instance.extend("parseParenAndDistinguishExpression", function (inner) {
return function (startPos, startLoc, canBeArrow, isAsync) {
startPos = startPos || this.state.start;
startLoc = startLoc || this.state.startLoc;
if (canBeArrow && this.lookahead().type === _tokenizerTypes.types.parenR) {
// let foo = (): number => {};
this.expect(_tokenizerTypes.types.parenL);
this.expect(_tokenizerTypes.types.parenR);
var node = this.startNodeAt(startPos, startLoc);
if (this.match(_tokenizerTypes.types.colon)) node.returnType = this.flowParseTypeAnnotation();
this.expect(_tokenizerTypes.types.arrow);
return this.parseArrowExpression(node, [], isAsync);
} else {
// let foo = (foo): number => {};
var node = inner.call(this, startPos, startLoc, canBeArrow, isAsync, this.hasPlugin("trailingFunctionCommas"));
if (this.match(_tokenizerTypes.types.colon)) {
var state = this.state.clone();
try {
return this.parseParenItem(node, startPos, startLoc, true);
} catch (err) {
if (err instanceof SyntaxError) {
this.state = state;
return node;
} else {
throw err;
}
}
} else {
return node;
}
}
};
});
};
module.exports = exports["default"];
},{"17":17,"25":25,"5":5}],12:[function(_dereq_,module,exports){
/* eslint indent: 0 */
"use strict";
var _interopRequireDefault = _dereq_(25)["default"];
exports.__esModule = true;
var _xhtml = _dereq_(13);
var _xhtml2 = _interopRequireDefault(_xhtml);
var _tokenizerTypes = _dereq_(17);
var _tokenizerContext = _dereq_(14);
var _parser = _dereq_(5);
var _parser2 = _interopRequireDefault(_parser);
var _utilIdentifier = _dereq_(18);
var _utilWhitespace = _dereq_(20);
var HEX_NUMBER = /^[\da-fA-F]+$/;
var DECIMAL_NUMBER = /^\d+$/;
_tokenizerContext.types.j_oTag = new _tokenizerContext.TokContext("<tag", false);
_tokenizerContext.types.j_cTag = new _tokenizerContext.TokContext("</tag", false);
_tokenizerContext.types.j_expr = new _tokenizerContext.TokContext("<tag>...</tag>", true, true);
_tokenizerTypes.types.jsxName = new _tokenizerTypes.TokenType("jsxName");
_tokenizerTypes.types.jsxText = new _tokenizerTypes.TokenType("jsxText", { beforeExpr: true });
_tokenizerTypes.types.jsxTagStart = new _tokenizerTypes.TokenType("jsxTagStart");
_tokenizerTypes.types.jsxTagEnd = new _tokenizerTypes.TokenType("jsxTagEnd");
_tokenizerTypes.types.jsxTagStart.updateContext = function () {
this.state.context.push(_tokenizerContext.types.j_expr); // treat as beginning of JSX expression
this.state.context.push(_tokenizerContext.types.j_oTag); // start opening tag context
this.state.exprAllowed = false;
};
_tokenizerTypes.types.jsxTagEnd.updateContext = function (prevType) {
var out = this.state.context.pop();
if (out === _tokenizerContext.types.j_oTag && prevType === _tokenizerTypes.types.slash || out === _tokenizerContext.types.j_cTag) {
this.state.context.pop();
this.state.exprAllowed = this.curContext() === _tokenizerContext.types.j_expr;
} else {
this.state.exprAllowed = true;
}
};
var pp = _parser2["default"].prototype;
// Reads inline JSX contents token.
pp.jsxReadToken = function () {
var out = "";
var chunkStart = this.state.pos;
for (;;) {
if (this.state.pos >= this.input.length) {
this.raise(this.state.start, "Unterminated JSX contents");
}
var ch = this.input.charCodeAt(this.state.pos);
switch (ch) {
case 60: // "<"
case 123:
// "{"
if (this.state.pos === this.state.start) {
if (ch === 60 && this.state.exprAllowed) {
++this.state.pos;
return this.finishToken(_tokenizerTypes.types.jsxTagStart);
}
return this.getTokenFromCode(ch);
}
out += this.input.slice(chunkStart, this.state.pos);
return this.finishToken(_tokenizerTypes.types.jsxText, out);
case 38:
// "&"
out += this.input.slice(chunkStart, this.state.pos);
out += this.jsxReadEntity();
chunkStart = this.state.pos;
break;
default:
if (_utilWhitespace.isNewLine(ch)) {
out += this.input.slice(chunkStart, this.state.pos);
out += this.jsxReadNewLine(true);
chunkStart = this.state.pos;
} else {
++this.state.pos;
}
}
}
};
pp.jsxReadNewLine = function (normalizeCRLF) {
var ch = this.input.charCodeAt(this.state.pos);
var out = undefined;
++this.state.pos;
if (ch === 13 && this.input.charCodeAt(this.state.pos) === 10) {
++this.state.pos;
out = normalizeCRLF ? "\n" : "\r\n";
} else {
out = String.fromCharCode(ch);
}
++this.state.curLine;
this.state.lineStart = this.state.pos;
return out;
};
pp.jsxReadString = function (quote) {
var out = "";
var chunkStart = ++this.state.pos;
for (;;) {
if (this.state.pos >= this.input.length) {
this.raise(this.state.start, "Unterminated string constant");
}
var ch = this.input.charCodeAt(this.state.pos);
if (ch === quote) break;
if (ch === 38) {
// "&"
out += this.input.slice(chunkStart, this.state.pos);
out += this.jsxReadEntity();
chunkStart = this.state.pos;
} else if (_utilWhitespace.isNewLine(ch)) {
out += this.input.slice(chunkStart, this.state.pos);
out += this.jsxReadNewLine(false);
chunkStart = this.state.pos;
} else {
++this.state.pos;
}
}
out += this.input.slice(chunkStart, this.state.pos++);
return this.finishToken(_tokenizerTypes.types.string, out);
};
pp.jsxReadEntity = function () {
var str = "";
var count = 0;
var entity = undefined;
var ch = this.input[this.state.pos];
var startPos = ++this.state.pos;
while (this.state.pos < this.input.length && count++ < 10) {
ch = this.input[this.state.pos++];
if (ch === ";") {
if (str[0] === "#") {
if (str[1] === "x") {
str = str.substr(2);
if (HEX_NUMBER.test(str)) entity = String.fromCharCode(parseInt(str, 16));
} else {
str = str.substr(1);
if (DECIMAL_NUMBER.test(str)) entity = String.fromCharCode(parseInt(str, 10));
}
} else {
entity = _xhtml2["default"][str];
}
break;
}
str += ch;
}
if (!entity) {
this.state.pos = startPos;
return "&";
}
return entity;
};
// Read a JSX identifier (valid tag or attribute name).
//
// Optimized version since JSX identifiers can"t contain
// escape characters and so can be read as single slice.
// Also assumes that first character was already checked
// by isIdentifierStart in readToken.
pp.jsxReadWord = function () {
var ch = undefined;
var start = this.state.pos;
do {
ch = this.input.charCodeAt(++this.state.pos);
} while (_utilIdentifier.isIdentifierChar(ch) || ch === 45); // "-"
return this.finishToken(_tokenizerTypes.types.jsxName, this.input.slice(start, this.state.pos));
};
// Transforms JSX element name to string.
function getQualifiedJSXName(object) {
if (object.type === "JSXIdentifier") {
return object.name;
}
if (object.type === "JSXNamespacedName") {
return object.namespace.name + ":" + object.name.name;
}
if (object.type === "JSXMemberExpression") {
return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property);
}
}
// Parse next token as JSX identifier
pp.jsxParseIdentifier = function () {
var node = this.startNode();
if (this.match(_tokenizerTypes.types.jsxName)) {
node.name = this.state.value;
} else if (this.state.type.keyword) {
node.name = this.state.type.keyword;
} else {
this.unexpected();
}
this.next();
return this.finishNode(node, "JSXIdentifier");
};
// Parse namespaced identifier.
pp.jsxParseNamespacedName = function () {
var startPos = this.state.start,
startLoc = this.state.startLoc;
var name = this.jsxParseIdentifier();
if (!this.eat(_tokenizerTypes.types.colon)) return name;
var node = this.startNodeAt(startPos, startLoc);
node.namespace = name;
node.name = this.jsxParseIdentifier();
return this.finishNode(node, "JSXNamespacedName");
};
// Parses element name in any form - namespaced, member
// or single identifier.
pp.jsxParseElementName = function () {
var startPos = this.state.start,
startLoc = this.state.startLoc;
var node = this.jsxParseNamespacedName();
while (this.eat(_tokenizerTypes.types.dot)) {
var newNode = this.startNodeAt(startPos, startLoc);
newNode.object = node;
newNode.property = this.jsxParseIdentifier();
node = this.finishNode(newNode, "JSXMemberExpression");
}
return node;
};
// Parses any type of JSX attribute value.
pp.jsxParseAttributeValue = function () {
var node = undefined;
switch (this.state.type) {
case _tokenizerTypes.types.braceL:
node = this.jsxParseExpressionContainer();
if (node.expression.type === "JSXEmptyExpression") {
this.raise(node.start, "JSX attributes must only be assigned a non-empty expression");
} else {
return node;
}
case _tokenizerTypes.types.jsxTagStart:
case _tokenizerTypes.types.string:
node = this.parseExprAtom();
node.extra = null;
return node;
default:
this.raise(this.state.start, "JSX value should be either an expression or a quoted JSX text");
}
};
// JSXEmptyExpression is unique type since it doesn't actually parse anything,
// and so it should start at the end of last read token (left brace) and finish
// at the beginning of the next one (right brace).
pp.jsxParseEmptyExpression = function () {
var node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);
return this.finishNodeAt(node, "JSXEmptyExpression", this.start, this.startLoc);
};
// Parses JSX expression enclosed into curly brackets.
pp.jsxParseExpressionContainer = function () {
var node = this.startNode();
this.next();
if (this.match(_tokenizerTypes.types.braceR)) {
node.expression = this.jsxParseEmptyExpression();
} else {
node.expression = this.parseExpression();
}
this.expect(_tokenizerTypes.types.braceR);
return this.finishNode(node, "JSXExpressionContainer");
};
// Parses following JSX attribute name-value pair.
pp.jsxParseAttribute = function () {
var node = this.startNode();
if (this.eat(_tokenizerTypes.types.braceL)) {
this.expect(_tokenizerTypes.types.ellipsis);
node.argument = this.parseMaybeAssign();
this.expect(_tokenizerTypes.types.braceR);
return this.finishNode(node, "JSXSpreadAttribute");
}
node.name = this.jsxParseNamespacedName();
node.value = this.eat(_tokenizerTypes.types.eq) ? this.jsxParseAttributeValue() : null;
return this.finishNode(node, "JSXAttribute");
};
// Parses JSX opening tag starting after "<".
pp.jsxParseOpeningElementAt = function (startPos, startLoc) {
var node = this.startNodeAt(startPos, startLoc);
node.attributes = [];
node.name = this.jsxParseElementName();
while (!this.match(_tokenizerTypes.types.slash) && !this.match(_tokenizerTypes.types.jsxTagEnd)) {
node.attributes.push(this.jsxParseAttribute());
}
node.selfClosing = this.eat(_tokenizerTypes.types.slash);
this.expect(_tokenizerTypes.types.jsxTagEnd);
return this.finishNode(node, "JSXOpeningElement");
};
// Parses JSX closing tag starting after "</".
pp.jsxParseClosingElementAt = function (startPos, startLoc) {
var node = this.startNodeAt(startPos, startLoc);
node.name = this.jsxParseElementName();
this.expect(_tokenizerTypes.types.jsxTagEnd);
return this.finishNode(node, "JSXClosingElement");
};
// Parses entire JSX element, including it"s opening tag
// (starting after "<"), attributes, contents and closing tag.
pp.jsxParseElementAt = function (startPos, startLoc) {
var node = this.startNodeAt(startPos, startLoc);
var children = [];
var openingElement = this.jsxParseOpeningElementAt(startPos, startLoc);
var closingElement = null;
if (!openingElement.selfClosing) {
contents: for (;;) {
switch (this.state.type) {
case _tokenizerTypes.types.jsxTagStart:
startPos = this.state.start;startLoc = this.state.startLoc;
this.next();
if (this.eat(_tokenizerTypes.types.slash)) {
closingElement = this.jsxParseClosingElementAt(startPos, startLoc);
break contents;
}
children.push(this.jsxParseElementAt(startPos, startLoc));
break;
case _tokenizerTypes.types.jsxText:
children.push(this.parseExprAtom());
break;
case _tokenizerTypes.types.braceL:
children.push(this.jsxParseExpressionContainer());
break;
default:
this.unexpected();
}
}
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">");
}
}
node.openingElement = openingElement;
node.closingElement = closingElement;
node.children = children;
if (this.match(_tokenizerTypes.types.relational) && this.state.value === "<") {
this.raise(this.state.start, "Adjacent JSX elements must be wrapped in an enclosing tag");
}
return this.finishNode(node, "JSXElement");
};
// Parses entire JSX element from current position.
pp.jsxParseElement = function () {
var startPos = this.state.start,
startLoc = this.state.startLoc;
this.next();
return this.jsxParseElementAt(startPos, startLoc);
};
exports["default"] = function (instance) {
instance.extend("parseExprAtom", function (inner) {
return function (refShortHandDefaultPos) {
if (this.match(_tokenizerTypes.types.jsxText)) {
var node = this.parseLiteral(this.state.value, "JSXText");
// https://github.com/babel/babel/issues/2078
node.extra = null;
return node;
} else if (this.match(_tokenizerTypes.types.jsxTagStart)) {
return this.jsxParseElement();
} else {
return inner.call(this, refShortHandDefaultPos);
}
};
});
instance.extend("readToken", function (inner) {
return function (code) {
var context = this.curContext();
if (context === _tokenizerContext.types.j_expr) {
return this.jsxReadToken();
}
if (context === _tokenizerContext.types.j_oTag || context === _tokenizerContext.types.j_cTag) {
if (_utilIdentifier.isIdentifierStart(code)) {
return this.jsxReadWord();
}
if (code === 62) {
++this.state.pos;
return this.finishToken(_tokenizerTypes.types.jsxTagEnd);
}
if ((code === 34 || code === 39) && context === _tokenizerContext.types.j_oTag) {
return this.jsxReadString(code);
}
}
if (code === 60 && this.state.exprAllowed) {
++this.state.pos;
return this.finishToken(_tokenizerTypes.types.jsxTagStart);
}
return inner.call(this, code);
};
});
instance.extend("updateContext", function (inner) {
return function (prevType) {
if (this.match(_tokenizerTypes.types.braceL)) {
var curContext = this.curContext();
if (curContext === _tokenizerContext.types.j_oTag) {
this.state.context.push(_tokenizerContext.types.b_expr);
} else if (curContext === _tokenizerContext.types.j_expr) {
this.state.context.push(_tokenizerContext.types.b_tmpl);
} else {
inner.call(this, prevType);
}
this.state.exprAllowed = true;
} else if (this.match(_tokenizerTypes.types.slash) && prevType === _tokenizerTypes.types.jsxTagStart) {
this.state.context.length -= 2; // do not consider JSX expr -> JSX open tag -> ... anymore
this.state.context.push(_tokenizerContext.types.j_cTag); // reconsider as closing tag context
this.state.exprAllowed = false;
} else {
return inner.call(this, prevType);
}
};
});
};
module.exports = exports["default"];
},{"13":13,"14":14,"17":17,"18":18,"20":20,"25":25,"5":5}],13:[function(_dereq_,module,exports){
"use strict";
exports.__esModule = true;
exports["default"] = {
quot: "\"",
amp: "&",
apos: "'",
lt: "<",
gt: ">",
nbsp: " ",
iexcl: "¡",
cent: "¢",
pound: "£",
curren: "¤",
yen: "¥",
brvbar: "¦",
sect: "§",
uml: "¨",
copy: "©",
ordf: "ª",
laquo: "«",
not: "¬",
shy: "­",
reg: "®",
macr: "¯",
deg: "°",
plusmn: "±",
sup2: "²",
sup3: "³",
acute: "´",
micro: "µ",
para: "¶",
middot: "·",
cedil: "¸",
sup1: "¹",
ordm: "º",
raquo: "»",
frac14: "¼",
frac12: "½",
frac34: "¾",
iquest: "¿",
Agrave: "À",
Aacute: "Á",
Acirc: "Â",
Atilde: "Ã",
Auml: "Ä",
Aring: "Å",
AElig: "Æ",
Ccedil: "Ç",
Egrave: "È",
Eacute: "É",
Ecirc: "Ê",
Euml: "Ë",
Igrave: "Ì",
Iacute: "Í",
Icirc: "Î",
Iuml: "Ï",
ETH: "Ð",
Ntilde: "Ñ",
Ograve: "Ò",
Oacute: "Ó",
Ocirc: "Ô",
Otilde: "Õ",
Ouml: "Ö",
times: "×",
Oslash: "Ø",
Ugrave: "Ù",
Uacute: "Ú",
Ucirc: "Û",
Uuml: "Ü",
Yacute: "Ý",
THORN: "Þ",
szlig: "ß",
agrave: "à",
aacute: "á",
acirc: "â",
atilde: "ã",
auml: "ä",
aring: "å",
aelig: "æ",
ccedil: "ç",
egrave: "è",
eacute: "é",
ecirc: "ê",
euml: "ë",
igrave: "ì",
iacute: "í",
icirc: "î",
iuml: "ï",
eth: "ð",
ntilde: "ñ",
ograve: "ò",
oacute: "ó",
ocirc: "ô",
otilde: "õ",
ouml: "ö",
divide: "÷",
oslash: "ø",
ugrave: "ù",
uacute: "ú",
ucirc: "û",
uuml: "ü",
yacute: "ý",
thorn: "þ",
yuml: "ÿ",
OElig: "Œ",
oelig: "œ",
Scaron: "Š",
scaron: "š",
Yuml: "Ÿ",
fnof: "ƒ",
circ: "ˆ",
tilde: "˜",
Alpha: "Α",
Beta: "Β",
Gamma: "Γ",
Delta: "Δ",
Epsilon: "Ε",
Zeta: "Ζ",
Eta: "Η",
Theta: "Θ",
Iota: "Ι",
Kappa: "Κ",
Lambda: "Λ",
Mu: "Μ",
Nu: "Ν",
Xi: "Ξ",
Omicron: "Ο",
Pi: "Π",
Rho: "Ρ",
Sigma: "Σ",
Tau: "Τ",
Upsilon: "Υ",
Phi: "Φ",
Chi: "Χ",
Psi: "Ψ",
Omega: "Ω",
alpha: "α",
beta: "β",
gamma: "γ",
delta: "δ",
epsilon: "ε",
zeta: "ζ",
eta: "η",
theta: "θ",
iota: "ι",
kappa: "κ",
lambda: "λ",
mu: "μ",
nu: "ν",
xi: "ξ",
omicron: "ο",
pi: "π",
rho: "ρ",
sigmaf: "ς",
sigma: "σ",
tau: "τ",
upsilon: "υ",
phi: "φ",
chi: "χ",
psi: "ψ",
omega: "ω",
thetasym: "ϑ",
upsih: "ϒ",
piv: "ϖ",
ensp: " ",
emsp: " ",
thinsp: " ",
zwnj: "‌",
zwj: "‍",
lrm: "‎",
rlm: "‏",
ndash: "–",
mdash: "—",
lsquo: "‘",
rsquo: "’",
sbquo: "‚",
ldquo: "“",
rdquo: "”",
bdquo: "„",
dagger: "†",
Dagger: "‡",
bull: "•",
hellip: "…",
permil: "‰",
prime: "′",
Prime: "″",
lsaquo: "‹",
rsaquo: "›",
oline: "‾",
frasl: "⁄",
euro: "€",
image: "ℑ",
weierp: "℘",
real: "ℜ",
trade: "™",
alefsym: "ℵ",
larr: "←",
uarr: "↑",
rarr: "→",
darr: "↓",
harr: "↔",
crarr: "↵",
lArr: "⇐",
uArr: "⇑",
rArr: "⇒",
dArr: "⇓",
hArr: "⇔",
forall: "∀",
part: "∂",
exist: "∃",
empty: "∅",
nabla: "∇",
isin: "∈",
notin: "∉",
ni: "∋",
prod: "∏",
sum: "∑",
minus: "−",
lowast: "∗",
radic: "√",
prop: "∝",
infin: "∞",
ang: "∠",
and: "∧",
or: "∨",
cap: "∩",
cup: "∪",
"int": "∫",
there4: "∴",
sim: "∼",
cong: "≅",
asymp: "≈",
ne: "≠",
equiv: "≡",
le: "≤",
ge: "≥",
sub: "⊂",
sup: "⊃",
nsub: "⊄",
sube: "⊆",
supe: "⊇",
oplus: "⊕",
otimes: "⊗",
perp: "⊥",
sdot: "⋅",
lceil: "⌈",
rceil: "⌉",
lfloor: "⌊",
rfloor: "⌋",
lang: "〈",
rang: "〉",
loz: "◊",
spades: "♠",
clubs: "♣",
hearts: "♥",
diams: "♦"
};
module.exports = exports["default"];
},{}],14:[function(_dereq_,module,exports){
// The algorithm used to determine whether a regexp can appear at a
// given point in the program is loosely based on sweet.js' approach.
// See https://github.com/mozilla/sweet.js/wiki/design
"use strict";
var _classCallCheck = _dereq_(23)["default"];
exports.__esModule = true;
var _types = _dereq_(17);
var _utilWhitespace = _dereq_(20);
var TokContext = function TokContext(token, isExpr, preserveSpace, override) {
_classCallCheck(this, TokContext);
this.token = token;
this.isExpr = !!isExpr;
this.preserveSpace = !!preserveSpace;
this.override = override;
};
exports.TokContext = TokContext;
var types = {
b_stat: new TokContext("{", false),
b_expr: new TokContext("{", true),
b_tmpl: new TokContext("${", true),
p_stat: new TokContext("(", false),
p_expr: new TokContext("(", true),
q_tmpl: new TokContext("`", true, true, function (p) {
return p.readTmplToken();
}),
f_expr: new TokContext("function", true)
};
exports.types = types;
// Token-specific context update code
_types.types.parenR.updateContext = _types.types.braceR.updateContext = function () {
if (this.state.context.length === 1) {
this.state.exprAllowed = true;
return;
}
var out = this.state.context.pop();
if (out === types.b_stat && this.curContext() === types.f_expr) {
this.state.context.pop();
this.state.exprAllowed = false;
} else if (out === types.b_tmpl) {
this.state.exprAllowed = true;
} else {
this.state.exprAllowed = !out.isExpr;
}
};
_types.types.name.updateContext = function (prevType) {
this.state.exprAllowed = false;
if (prevType === _types.types._let || prevType === _types.types._const || prevType === _types.types._var) {
if (_utilWhitespace.lineBreak.test(this.input.slice(this.state.end))) {
this.state.exprAllowed = true;
}
}
};
_types.types.braceL.updateContext = function (prevType) {
this.state.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
this.state.exprAllowed = true;
};
_types.types.dollarBraceL.updateContext = function () {
this.state.context.push(types.b_tmpl);
this.state.exprAllowed = true;
};
_types.types.parenL.updateContext = function (prevType) {
var statementParens = prevType === _types.types._if || prevType === _types.types._for || prevType === _types.types._with || prevType === _types.types._while;
this.state.context.push(statementParens ? types.p_stat : types.p_expr);
this.state.exprAllowed = true;
};
_types.types.incDec.updateContext = function () {
// tokExprAllowed stays unchanged
};
_types.types._function.updateContext = function () {
if (this.curContext() !== types.b_stat) {
this.state.context.push(types.f_expr);
}
this.state.exprAllowed = false;
};
_types.types.backQuote.updateContext = function () {
if (this.curContext() === types.q_tmpl) {
this.state.context.pop();
} else {
this.state.context.push(types.q_tmpl);
}
this.state.exprAllowed = false;
};
},{"17":17,"20":20,"23":23}],15:[function(_dereq_,module,exports){
/* eslint max-len: 0 */
/* eslint indent: 0 */
"use strict";
var _classCallCheck = _dereq_(23)["default"];
var _interopRequireDefault = _dereq_(25)["default"];
exports.__esModule = true;
var _utilIdentifier = _dereq_(18);
var _types = _dereq_(17);
var _context = _dereq_(14);
var _utilLocation = _dereq_(19);
var _utilWhitespace = _dereq_(20);
var _state = _dereq_(16);
var _state2 = _interopRequireDefault(_state);
// Object type used to represent tokens. Note that normally, tokens
// simply exist as properties on the parser object. This is only
// used for the onToken callback and the external tokenizer.
var Token = function Token(state) {
_classCallCheck(this, Token);
this.type = state.type;
this.value = state.value;
this.start = state.start;
this.end = state.end;
this.loc = new _utilLocation.SourceLocation(state.startLoc, state.endLoc);
}
// ## Tokenizer
;
exports.Token = Token;
function codePointToString(code) {
// UTF-16 Decoding
if (code <= 0xFFFF) {
return String.fromCharCode(code);
} else {
return String.fromCharCode((code - 0x10000 >> 10) + 0xD800, (code - 0x10000 & 1023) + 0xDC00);
}
}
var Tokenizer = (function () {
function Tokenizer(options, input) {
_classCallCheck(this, Tokenizer);
this.state = new _state2["default"]();
this.state.init(options, input);
}
// Move to the next token
Tokenizer.prototype.next = function next() {
if (!this.isLookahead) {
this.state.tokens.push(new Token(this.state));
}
this.state.lastTokEnd = this.state.end;
this.state.lastTokStart = this.state.start;
this.state.lastTokEndLoc = this.state.endLoc;
this.state.lastTokStartLoc = this.state.startLoc;
this.nextToken();
};
// TODO
Tokenizer.prototype.eat = function eat(type) {
if (this.match(type)) {
this.next();
return true;
} else {
return false;
}
};
// TODO
Tokenizer.prototype.match = function match(type) {
return this.state.type === type;
};
// TODO
Tokenizer.prototype.isKeyword = function isKeyword(word) {
return _utilIdentifier.isKeyword(word);
};
// TODO
Tokenizer.prototype.lookahead = function lookahead() {
var old = this.state;
this.state = old.clone(true);
this.isLookahead = true;
this.next();
this.isLookahead = false;
var curr = this.state.clone(true);
this.state = old;
return curr;
};
// Toggle strict mode. Re-reads the next number or string to please
// pedantic tests (`"use strict"; 010;` should fail).
Tokenizer.prototype.setStrict = function setStrict(strict) {
this.state.strict = strict;
if (!this.match(_types.types.num) && !this.match(_types.types.string)) return;
this.state.pos = this.state.start;
while (this.state.pos < this.state.lineStart) {
this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1;
--this.state.curLine;
}
this.nextToken();
};
Tokenizer.prototype.curContext = function curContext() {
return this.state.context[this.state.context.length - 1];
};
// Read a single token, updating the parser object's token-related
// properties.
Tokenizer.prototype.nextToken = function nextToken() {
var curContext = this.curContext();
if (!curContext || !curContext.preserveSpace) this.skipSpace();
this.state.containsOctal = false;
this.state.octalPosition = null;
this.state.start = this.state.pos;
this.state.startLoc = this.state.curPosition();
if (this.state.pos >= this.input.length) return this.finishToken(_types.types.eof);
if (curContext.override) {
return curContext.override(this);
} else {
return this.readToken(this.fullCharCodeAtPos());
}
};
Tokenizer.prototype.readToken = function readToken(code) {
// Identifier or keyword. '\uXXXX' sequences are allowed in
// identifiers, so '\' also dispatches to that.
if (_utilIdentifier.isIdentifierStart(code) || code === 92 /* '\' */) {
return this.readWord();
} else {
return this.getTokenFromCode(code);
}
};
Tokenizer.prototype.fullCharCodeAtPos = function fullCharCodeAtPos() {
var code = this.input.charCodeAt(this.state.pos);
if (code <= 0xd7ff || code >= 0xe000) return code;
var next = this.input.charCodeAt(this.state.pos + 1);
return (code << 10) + next - 0x35fdc00;
};
Tokenizer.prototype.pushComment = function pushComment(block, text, start, end, startLoc, endLoc) {
var comment = {
type: block ? "CommentBlock" : "CommentLine",
value: text,
start: start,
end: end,
loc: new _utilLocation.SourceLocation(startLoc, endLoc)
};
if (!this.isLookahead) {
this.state.tokens.push(comment);
this.state.comments.push(comment);
}
this.addComment(comment);
};
Tokenizer.prototype.skipBlockComment = function skipBlockComment() {
var startLoc = this.state.curPosition();
var start = this.state.pos,
end = this.input.indexOf("*/", this.state.pos += 2);
if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment");
this.state.pos = end + 2;
_utilWhitespace.lineBreakG.lastIndex = start;
var match = undefined;
while ((match = _utilWhitespace.lineBreakG.exec(this.input)) && match.index < this.state.pos) {
++this.state.curLine;
this.state.lineStart = match.index + match[0].length;
}
this.pushComment(true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition());
};
Tokenizer.prototype.skipLineComment = function skipLineComment(startSkip) {
var start = this.state.pos;
var startLoc = this.state.curPosition();
var ch = this.input.charCodeAt(this.state.pos += startSkip);
while (this.state.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) {
++this.state.pos;
ch = this.input.charCodeAt(this.state.pos);
}
this.pushComment(false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition());
};
// Called at the start of the parse and after every token. Skips
// whitespace and comments, and.
Tokenizer.prototype.skipSpace = function skipSpace() {
loop: while (this.state.pos < this.input.length) {
var ch = this.input.charCodeAt(this.state.pos);
switch (ch) {
case 32:case 160:
// ' '
++this.state.pos;
break;
case 13:
if (this.input.charCodeAt(this.state.pos + 1) === 10) {
++this.state.pos;
}
case 10:case 8232:case 8233:
++this.state.pos;
++this.state.curLine;
this.state.lineStart = this.state.pos;
break;
case 47:
// '/'
switch (this.input.charCodeAt(this.state.pos + 1)) {
case 42:
// '*'
this.skipBlockComment();
break;
case 47:
this.skipLineComment(2);
break;
default:
break loop;
}
break;
default:
if (ch > 8 && ch < 14 || ch >= 5760 && _utilWhitespace.nonASCIIwhitespace.test(String.fromCharCode(ch))) {
++this.state.pos;
} else {
break loop;
}
}
}
};
// Called at the end of every token. Sets `end`, `val`, and
// maintains `context` and `exprAllowed`, and skips the space after
// the token, so that the next one's `start` will point at the
// right position.
Tokenizer.prototype.finishToken = function finishToken(type, val) {
this.state.end = this.state.pos;
this.state.endLoc = this.state.curPosition();
var prevType = this.state.type;
this.state.type = type;
this.state.value = val;
this.updateContext(prevType);
};
// ### Token reading
// This is the function that is called to fetch the next token. It
// is somewhat obscure, because it works in character codes rather
// than characters, and because operator parsing has been inlined
// into it.
//
// All in the name of speed.
//
Tokenizer.prototype.readToken_dot = function readToken_dot() {
var next = this.input.charCodeAt(this.state.pos + 1);
if (next >= 48 && next <= 57) {
return this.readNumber(true);
}
var next2 = this.input.charCodeAt(this.state.pos + 2);
if (next === 46 && next2 === 46) {
// 46 = dot '.'
this.state.pos += 3;
return this.finishToken(_types.types.ellipsis);
} else {
++this.state.pos;
return this.finishToken(_types.types.dot);
}
};
Tokenizer.prototype.readToken_slash = function readToken_slash() {
// '/'
if (this.state.exprAllowed) {
++this.state.pos;
return this.readRegexp();
}
var next = this.input.charCodeAt(this.state.pos + 1);
if (next === 61) {
return this.finishOp(_types.types.assign, 2);
} else {
return this.finishOp(_types.types.slash, 1);
}
};
Tokenizer.prototype.readToken_mult_modulo = function readToken_mult_modulo(code) {
// '%*'
var type = code === 42 ? _types.types.star : _types.types.modulo;
var width = 1;
var next = this.input.charCodeAt(this.state.pos + 1);
if (next === 42 && this.hasPlugin("exponentiationOperator")) {
// '*'
width++;
next = this.input.charCodeAt(this.state.pos + 2);
type = _types.types.exponent;
}
if (next === 61) {
width++;
type = _types.types.assign;
}
return this.finishOp(type, width);
};
Tokenizer.prototype.readToken_pipe_amp = function readToken_pipe_amp(code) {
// '|&'
var next = this.input.charCodeAt(this.state.pos + 1);
if (next === code) return this.finishOp(code === 124 ? _types.types.logicalOR : _types.types.logicalAND, 2);
if (next === 61) return this.finishOp(_types.types.assign, 2);
return this.finishOp(code === 124 ? _types.types.bitwiseOR : _types.types.bitwiseAND, 1);
};
Tokenizer.prototype.readToken_caret = function readToken_caret() {
// '^'
var next = this.input.charCodeAt(this.state.pos + 1);
if (next === 61) {
return this.finishOp(_types.types.assign, 2);
} else {
return this.finishOp(_types.types.bitwiseXOR, 1);
}
};
Tokenizer.prototype.readToken_plus_min = function readToken_plus_min(code) {
// '+-'
var next = this.input.charCodeAt(this.state.pos + 1);
if (next === code) {
if (next === 45 && this.input.charCodeAt(this.state.pos + 2) === 62 && _utilWhitespace.lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos))) {
// A `-->` line comment
this.skipLineComment(3);
this.skipSpace();
return this.nextToken();
}
return this.finishOp(_types.types.incDec, 2);
}
if (next === 61) {
return this.finishOp(_types.types.assign, 2);
} else {
return this.finishOp(_types.types.plusMin, 1);
}
};
Tokenizer.prototype.readToken_lt_gt = function readToken_lt_gt(code) {
// '<>'
var next = this.input.charCodeAt(this.state.pos + 1);
var size = 1;
if (next === code) {
size = code === 62 && this.input.charCodeAt(this.state.pos + 2) === 62 ? 3 : 2;
if (this.input.charCodeAt(this.state.pos + size) === 61) return this.finishOp(_types.types.assign, size + 1);
return this.finishOp(_types.types.bitShift, size);
}
if (next === 33 && code === 60 && this.input.charCodeAt(this.state.pos + 2) === 45 && this.input.charCodeAt(this.state.pos + 3) === 45) {
if (this.inModule) this.unexpected();
// `<!--`, an XML-style comment that should be interpreted as a line comment
this.skipLineComment(4);
this.skipSpace();
return this.nextToken();
}
if (next === 61) {
// <= | >=
size = 2;
}
return this.finishOp(_types.types.relational, size);
};
Tokenizer.prototype.readToken_eq_excl = function readToken_eq_excl(code) {
// '=!'
var next = this.input.charCodeAt(this.state.pos + 1);
if (next === 61) return this.finishOp(_types.types.equality, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2);
if (code === 61 && next === 62) {
// '=>'
this.state.pos += 2;
return this.finishToken(_types.types.arrow);
}
return this.finishOp(code === 61 ? _types.types.eq : _types.types.prefix, 1);
};
Tokenizer.prototype.getTokenFromCode = function getTokenFromCode(code) {
switch (code) {
// The interpretation of a dot depends on whether it is followed
// by a digit or another two dots.
case 46:
// '.'
return this.readToken_dot();
// Punctuation tokens.
case 40:
++this.state.pos;return this.finishToken(_types.types.parenL);
case 41:
++this.state.pos;return this.finishToken(_types.types.parenR);
case 59:
++this.state.pos;return this.finishToken(_types.types.semi);
case 44:
++this.state.pos;return this.finishToken(_types.types.comma);
case 91:
++this.state.pos;return this.finishToken(_types.types.bracketL);
case 93:
++this.state.pos;return this.finishToken(_types.types.bracketR);
case 123:
++this.state.pos;return this.finishToken(_types.types.braceL);
case 125:
++this.state.pos;return this.finishToken(_types.types.braceR);
case 58:
if (this.hasPlugin("functionBind") && this.input.charCodeAt(this.state.pos + 1) === 58) {
return this.finishOp(_types.types.doubleColon, 2);
} else {
++this.state.pos;
return this.finishToken(_types.types.colon);
}
case 63:
++this.state.pos;return this.finishToken(_types.types.question);
case 64:
++this.state.pos;return this.finishToken(_types.types.at);
case 96:
// '`'
++this.state.pos;
return this.finishToken(_types.types.backQuote);
case 48:
// '0'
var next = this.input.charCodeAt(this.state.pos + 1);
if (next === 120 || next === 88) return this.readRadixNumber(16); // '0x', '0X' - hex number
if (next === 111 || next === 79) return this.readRadixNumber(8); // '0o', '0O' - octal number
if (next === 98 || next === 66) return this.readRadixNumber(2); // '0b', '0B' - binary number
// Anything else beginning with a digit is an integer, octal
// number, or float.
case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:
// 1-9
return this.readNumber(false);
// Quotes produce strings.
case 34:case 39:
// '"', "'"
return this.readString(code);
// Operators are parsed inline in tiny state machines. '=' (61) is
// often referred to. `finishOp` simply skips the amount of
// characters it is given as second argument, and returns a token
// of the type given by its first argument.
case 47:
// '/'
return this.readToken_slash();
case 37:case 42:
// '%*'
return this.readToken_mult_modulo(code);
case 124:case 38:
// '|&'
return this.readToken_pipe_amp(code);
case 94:
// '^'
return this.readToken_caret();
case 43:case 45:
// '+-'
return this.readToken_plus_min(code);
case 60:case 62:
// '<>'
return this.readToken_lt_gt(code);
case 61:case 33:
// '=!'
return this.readToken_eq_excl(code);
case 126:
// '~'
return this.finishOp(_types.types.prefix, 1);
}
this.raise(this.state.pos, "Unexpected character '" + codePointToString(code) + "'");
};
Tokenizer.prototype.finishOp = function finishOp(type, size) {
var str = this.input.slice(this.state.pos, this.state.pos + size);
this.state.pos += size;
return this.finishToken(type, str);
};
Tokenizer.prototype.readRegexp = function readRegexp() {
var escaped = undefined,
inClass = undefined,
start = this.state.pos;
for (;;) {
if (this.state.pos >= this.input.length) this.raise(start, "Unterminated regular expression");
var ch = this.input.charAt(this.state.pos);
if (_utilWhitespace.lineBreak.test(ch)) {
this.raise(start, "Unterminated regular expression");
}
if (escaped) {
escaped = false;
} else {
if (ch === "[") {
inClass = true;
} else if (ch === "]" && inClass) {
inClass = false;
} else if (ch === "/" && !inClass) {
break;
}
escaped = ch === "\\";
}
++this.state.pos;
}
var content = this.input.slice(start, this.state.pos);
++this.state.pos;
// Need to use `readWord1` because '\uXXXX' sequences are allowed
// here (don't ask).
var mods = this.readWord1();
if (mods) {
var validFlags = /^[gmsiyu]*$/;
if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag");
}
return this.finishToken(_types.types.regexp, {
pattern: content,
flags: mods
});
};
// Read an integer in the given radix. Return null if zero digits
// were read, the integer value otherwise. When `len` is given, this
// will return `null` unless the integer has exactly `len` digits.
Tokenizer.prototype.readInt = function readInt(radix, len) {
var start = this.state.pos,
total = 0;
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
var code = this.input.charCodeAt(this.state.pos),
val = undefined;
if (code >= 97) {
val = code - 97 + 10; // a
} else if (code >= 65) {
val = code - 65 + 10; // A
} else if (code >= 48 && code <= 57) {
val = code - 48; // 0-9
} else {
val = Infinity;
}
if (val >= radix) break;
++this.state.pos;
total = total * radix + val;
}
if (this.state.pos === start || len != null && this.state.pos - start !== len) return null;
return total;
};
Tokenizer.prototype.readRadixNumber = function readRadixNumber(radix) {
this.state.pos += 2; // 0x
var val = this.readInt(radix);
if (val == null) this.raise(this.state.start + 2, "Expected number in radix " + radix);
if (_utilIdentifier.isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.state.pos, "Identifier directly after number");
return this.finishToken(_types.types.num, val);
};
// Read an integer, octal integer, or floating-point number.
Tokenizer.prototype.readNumber = function readNumber(startsWithDot) {
var start = this.state.pos,
isFloat = false,
octal = this.input.charCodeAt(this.state.pos) === 48;
if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number");
var next = this.input.charCodeAt(this.state.pos);
if (next === 46) {
// '.'
++this.state.pos;
this.readInt(10);
isFloat = true;
next = this.input.charCodeAt(this.state.pos);
}
if (next === 69 || next === 101) {
// 'eE'
next = this.input.charCodeAt(++this.state.pos);
if (next === 43 || next === 45) ++this.state.pos; // '+-'
if (this.readInt(10) === null) this.raise(start, "Invalid number");
isFloat = true;
}
if (_utilIdentifier.isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.state.pos, "Identifier directly after number");
var str = this.input.slice(start, this.state.pos),
val = undefined;
if (isFloat) {
val = parseFloat(str);
} else if (!octal || str.length === 1) {
val = parseInt(str, 10);
} else if (/[89]/.test(str) || this.state.strict) {
this.raise(start, "Invalid number");
} else {
val = parseInt(str, 8);
}
return this.finishToken(_types.types.num, val);
};
// Read a string value, interpreting backslash-escapes.
Tokenizer.prototype.readCodePoint = function readCodePoint() {
var ch = this.input.charCodeAt(this.state.pos),
code = undefined;
if (ch === 123) {
var codePos = ++this.state.pos;
code = this.readHexChar(this.input.indexOf("}", this.state.pos) - this.state.pos);
++this.state.pos;
if (code > 0x10FFFF) this.raise(codePos, "Code point out of bounds");
} else {
code = this.readHexChar(4);
}
return code;
};
Tokenizer.prototype.readString = function readString(quote) {
var out = "",
chunkStart = ++this.state.pos;
for (;;) {
if (this.state.pos >= this.input.length) this.raise(this.state.start, "Unterminated string constant");
var ch = this.input.charCodeAt(this.state.pos);
if (ch === quote) break;
if (ch === 92) {
// '\'
out += this.input.slice(chunkStart, this.state.pos);
out += this.readEscapedChar(false);
chunkStart = this.state.pos;
} else {
if (_utilWhitespace.isNewLine(ch)) this.raise(this.state.start, "Unterminated string constant");
++this.state.pos;
}
}
out += this.input.slice(chunkStart, this.state.pos++);
return this.finishToken(_types.types.string, out);
};
// Reads template string tokens.
Tokenizer.prototype.readTmplToken = function readTmplToken() {
var out = "",
chunkStart = this.state.pos;
for (;;) {
if (this.state.pos >= this.input.length) this.raise(this.state.start, "Unterminated template");
var ch = this.input.charCodeAt(this.state.pos);
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) {
// '`', '${'
if (this.state.pos === this.state.start && this.match(_types.types.template)) {
if (ch === 36) {
this.state.pos += 2;
return this.finishToken(_types.types.dollarBraceL);
} else {
++this.state.pos;
return this.finishToken(_types.types.backQuote);
}
}
out += this.input.slice(chunkStart, this.state.pos);
return this.finishToken(_types.types.template, out);
}
if (ch === 92) {
// '\'
out += this.input.slice(chunkStart, this.state.pos);
out += this.readEscapedChar(true);
chunkStart = this.state.pos;
} else if (_utilWhitespace.isNewLine(ch)) {
out += this.input.slice(chunkStart, this.state.pos);
++this.state.pos;
switch (ch) {
case 13:
if (this.input.charCodeAt(this.state.pos) === 10) ++this.state.pos;
case 10:
out += "\n";
break;
default:
out += String.fromCharCode(ch);
break;
}
++this.state.curLine;
this.state.lineStart = this.state.pos;
chunkStart = this.state.pos;
} else {
++this.state.pos;
}
}
};
// Used to read escaped characters
Tokenizer.prototype.readEscapedChar = function readEscapedChar(inTemplate) {
var ch = this.input.charCodeAt(++this.state.pos);
++this.state.pos;
switch (ch) {
case 110:
return "\n"; // 'n' -> '\n'
case 114:
return "\r"; // 'r' -> '\r'
case 120:
return String.fromCharCode(this.readHexChar(2)); // 'x'
case 117:
return codePointToString(this.readCodePoint()); // 'u'
case 116:
return "\t"; // 't' -> '\t'
case 98:
return "\b"; // 'b' -> '\b'
case 118:
return "\u000b"; // 'v' -> '\u000b'
case 102:
return "\f"; // 'f' -> '\f'
case 13:
if (this.input.charCodeAt(this.state.pos) === 10) ++this.state.pos; // '\r\n'
case 10:
// ' \n'
this.state.lineStart = this.state.pos;
++this.state.curLine;
return "";
default:
if (ch >= 48 && ch <= 55) {
var octalStr = this.input.substr(this.state.pos - 1, 3).match(/^[0-7]+/)[0];
var octal = parseInt(octalStr, 8);
if (octal > 255) {
octalStr = octalStr.slice(0, -1);
octal = parseInt(octalStr, 8);
}
if (octal > 0) {
if (!this.state.containsOctal) {
this.state.containsOctal = true;
this.state.octalPosition = this.state.pos - 2;
}
if (this.state.strict || inTemplate) {
this.raise(this.state.pos - 2, "Octal literal in strict mode");
}
}
this.state.pos += octalStr.length - 1;
return String.fromCharCode(octal);
}
return String.fromCharCode(ch);
}
};
// Used to read character escape sequences ('\x', '\u', '\U').
Tokenizer.prototype.readHexChar = function readHexChar(len) {
var codePos = this.state.pos;
var n = this.readInt(16, len);
if (n === null) this.raise(codePos, "Bad character escape sequence");
return n;
};
// Read an identifier, and return it as a string. Sets `this.state.containsEsc`
// to whether the word contained a '\u' escape.
//
// Incrementally adds only escaped chars, adding other chunks as-is
// as a micro-optimization.
Tokenizer.prototype.readWord1 = function readWord1() {
this.state.containsEsc = false;
var word = "",
first = true,
chunkStart = this.state.pos;
while (this.state.pos < this.input.length) {
var ch = this.fullCharCodeAtPos();
if (_utilIdentifier.isIdentifierChar(ch)) {
this.state.pos += ch <= 0xffff ? 1 : 2;
} else if (ch === 92) {
// "\"
this.state.containsEsc = true;
word += this.input.slice(chunkStart, this.state.pos);
var escStart = this.state.pos;
if (this.input.charCodeAt(++this.state.pos) !== 117) {
// "u"
this.raise(this.state.pos, "Expecting Unicode escape sequence \\uXXXX");
}
++this.state.pos;
var esc = this.readCodePoint();
if (!(first ? _utilIdentifier.isIdentifierStart : _utilIdentifier.isIdentifierChar)(esc, true)) {
this.raise(escStart, "Invalid Unicode escape");
}
word += codePointToString(esc);
chunkStart = this.state.pos;
} else {
break;
}
first = false;
}
return word + this.input.slice(chunkStart, this.state.pos);
};
// Read an identifier or keyword token. Will check for reserved
// words when necessary.
Tokenizer.prototype.readWord = function readWord() {
var word = this.readWord1();
var type = _types.types.name;
if (!this.state.containsEsc && this.isKeyword(word)) {
type = _types.keywords[word];
}
return this.finishToken(type, word);
};
Tokenizer.prototype.braceIsBlock = function braceIsBlock(prevType) {
if (prevType === _types.types.colon) {
var _parent = this.curContext();
if (_parent === _context.types.b_stat || _parent === _context.types.b_expr) {
return !_parent.isExpr;
}
}
if (prevType === _types.types._return) {
return _utilWhitespace.lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
}
if (prevType === _types.types._else || prevType === _types.types.semi || prevType === _types.types.eof || prevType === _types.types.parenR) {
return true;
}
if (prevType === _types.types.braceL) {
return this.curContext() === _context.types.b_stat;
}
return !this.state.exprAllowed;
};
Tokenizer.prototype.updateContext = function updateContext(prevType) {
var update = undefined,
type = this.state.type;
if (type.keyword && prevType === _types.types.dot) {
this.state.exprAllowed = false;
} else if (update = type.updateContext) {
update.call(this, prevType);
} else {
this.state.exprAllowed = type.beforeExpr;
}
};
return Tokenizer;
})();
exports["default"] = Tokenizer;
},{"14":14,"16":16,"17":17,"18":18,"19":19,"20":20,"23":23,"25":25}],16:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = _dereq_(23)["default"];
exports.__esModule = true;
var _utilLocation = _dereq_(19);
var _context = _dereq_(14);
var _types = _dereq_(17);
var State = (function () {
function State() {
_classCallCheck(this, State);
}
State.prototype.init = function init(options, input) {
this.strict = options.strictMode === false ? false : options.sourceType === "module";
this.input = input;
this.potentialArrowAt = -1;
this.inMethod = this.inFunction = this.inGenerator = this.inAsync = false;
this.labels = [];
this.decorators = [];
this.tokens = [];
this.comments = [];
this.trailingComments = [];
this.leadingComments = [];
this.commentStack = [];
this.pos = this.lineStart = 0;
this.curLine = 1;
this.type = _types.types.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 = [_context.types.b_stat];
this.exprAllowed = true;
this.containsEsc = this.containsOctal = false;
this.octalPosition = null;
return this;
};
// TODO
State.prototype.curPosition = function curPosition() {
return new _utilLocation.Position(this.curLine, this.pos - this.lineStart);
};
State.prototype.clone = function clone(skipArrays) {
var state = new State();
for (var key in this) {
var val = this[key];
if ((!skipArrays || key === "context") && Array.isArray(val)) {
val = val.slice();
}
state[key] = val;
}
return state;
};
return State;
})();
exports["default"] = State;
module.exports = exports["default"];
// TODO
// Used to signify the start of a potential arrow function
// Flags to track whether we are in a function, a generator.
// Labels in scope.
// Leading decorators.
// Token store.
// Comment store.
// Comment attachment store
// The current position of the tokenizer in the input.
// Properties of the current token:
// Its type
// For tokens that include more information than their type, the value
// Its start and end offset
// And, if locations are used, the {line, column} object
// corresponding to those offsets
// Position information for the previous token
// The context stack is used to superficially track syntactic
// context to predict whether a regular expression is allowed in a
// given position.
// Used to signal to callers of `readWord1` whether the word
// contained any escape sequences. This is needed because words with
// escape sequences must not be interpreted as keywords.
// TODO
},{"14":14,"17":17,"19":19,"23":23}],17:[function(_dereq_,module,exports){
// ## Token types
// The assignment of fine-grained, information-carrying type objects
// allows the tokenizer to store the information it has about a
// token in a way that is very cheap for the parser to look up.
// All token type variables start with an underscore, to make them
// easy to recognize.
// The `beforeExpr` property is used to disambiguate between regular
// expressions and divisions. It is set on all token types that can
// be followed by an expression (thus, a slash after them would be a
// regular expression).
//
// `isLoop` marks a keyword as starting a loop, which is important
// to know when parsing a label, in order to allow or disallow
// continue jumps to that label.
"use strict";
var _classCallCheck = _dereq_(23)["default"];
exports.__esModule = true;
var TokenType = function TokenType(label) {
var conf = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, TokenType);
this.label = label;
this.keyword = conf.keyword;
this.beforeExpr = !!conf.beforeExpr;
this.startsExpr = !!conf.startsExpr;
this.rightAssociative = !!conf.rightAssociative;
this.isLoop = !!conf.isLoop;
this.isAssign = !!conf.isAssign;
this.prefix = !!conf.prefix;
this.postfix = !!conf.postfix;
this.binop = conf.binop || null;
this.updateContext = null;
};
exports.TokenType = TokenType;
function binop(name, prec) {
return new TokenType(name, { beforeExpr: true, binop: prec });
}
var beforeExpr = { beforeExpr: true },
startsExpr = { startsExpr: true };
var types = {
num: new TokenType("num", startsExpr),
regexp: new TokenType("regexp", startsExpr),
string: new TokenType("string", startsExpr),
name: new TokenType("name", startsExpr),
eof: new TokenType("eof"),
// Punctuation token types.
bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }),
bracketR: new TokenType("]"),
braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }),
braceR: new TokenType("}"),
parenL: new TokenType("(", { beforeExpr: true, startsExpr: true }),
parenR: new TokenType(")"),
comma: new TokenType(",", beforeExpr),
semi: new TokenType(";", beforeExpr),
colon: new TokenType(":", beforeExpr),
doubleColon: new TokenType("::", beforeExpr),
dot: new TokenType("."),
question: new TokenType("?", beforeExpr),
arrow: new TokenType("=>", beforeExpr),
template: new TokenType("template"),
ellipsis: new TokenType("...", beforeExpr),
backQuote: new TokenType("`", startsExpr),
dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }),
at: new TokenType("@"),
// Operators. These carry several kinds of properties to help the
// parser use them properly (the presence of these properties is
// what categorizes them as operators).
//
// `binop`, when present, specifies that this operator is a binary
// operator, and will refer to its precedence.
//
// `prefix` and `postfix` mark the operator as a prefix or postfix
// unary operator.
//
// `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
// binary operators with a very low precedence, that should result
// in AssignmentExpression nodes.
eq: new TokenType("=", { beforeExpr: true, isAssign: true }),
assign: new TokenType("_=", { beforeExpr: true, isAssign: true }),
incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }),
prefix: new TokenType("prefix", { beforeExpr: true, prefix: true, startsExpr: true }),
logicalOR: binop("||", 1),
logicalAND: binop("&&", 2),
bitwiseOR: binop("|", 3),
bitwiseXOR: binop("^", 4),
bitwiseAND: binop("&", 5),
equality: binop("==/!=", 6),
relational: binop("</>", 7),
bitShift: binop("<</>>", 8),
plusMin: new TokenType("+/-", { beforeExpr: true, binop: 9, prefix: true, startsExpr: true }),
modulo: binop("%", 10),
star: binop("*", 10),
slash: binop("/", 10),
exponent: new TokenType("**", { beforeExpr: true, binop: 11, rightAssociative: true })
};
exports.types = types;
// Map keyword names to token types.
var keywords = {};
exports.keywords = keywords;
// Succinct definitions of keyword token types
function kw(name) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
options.keyword = name;
keywords[name] = types["_" + name] = new TokenType(name, options);
}
kw("break");
kw("case", beforeExpr);
kw("catch");
kw("continue");
kw("debugger");
kw("default", beforeExpr);
kw("do", { isLoop: true, beforeExpr: true });
kw("else", beforeExpr);
kw("finally");
kw("for", { isLoop: true });
kw("function", startsExpr);
kw("if");
kw("return", beforeExpr);
kw("switch");
kw("throw", beforeExpr);
kw("try");
kw("var");
kw("let");
kw("const");
kw("while", { isLoop: true });
kw("with");
kw("new", { beforeExpr: true, startsExpr: true });
kw("this", startsExpr);
kw("super", startsExpr);
kw("class");
kw("extends", beforeExpr);
kw("export");
kw("import");
kw("yield", { beforeExpr: true, startsExpr: true });
kw("null", startsExpr);
kw("true", startsExpr);
kw("false", startsExpr);
kw("in", { beforeExpr: true, binop: 7 });
kw("instanceof", { beforeExpr: true, binop: 7 });
kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true });
kw("void", { beforeExpr: true, prefix: true, startsExpr: true });
kw("delete", { beforeExpr: true, prefix: true, startsExpr: true });
},{"23":23}],18:[function(_dereq_,module,exports){
/* eslint max-len: 0 */
// This is a trick taken from Esprima. It turns out that, on
// non-Chrome browsers, to check whether a string is in a set, a
// predicate containing a big ugly `switch` statement is faster than
// a regular expression, and on Chrome the two are about on par.
// This function uses `eval` (non-lexical) to produce such a
// predicate from a space-separated string of words.
//
// It starts by sorting the words by length.
"use strict";
exports.__esModule = true;
exports.isIdentifierStart = isIdentifierStart;
exports.isIdentifierChar = isIdentifierChar;
function makePredicate(words) {
words = words.split(" ");
return function (str) {
return words.indexOf(str) >= 0;
};
}
// Reserved word lists for various dialects of the language
var reservedWords = {
6: makePredicate("enum await"),
strict: makePredicate("implements interface let package private protected public static yield"),
strictBind: makePredicate("eval arguments")
};
exports.reservedWords = reservedWords;
// And the keywords
var isKeyword = makePredicate("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 let const class extends export import yield super");
exports.isKeyword = isKeyword;
// ## Character categories
// Big ugly regular expressions that match characters in the
// whitespace, identifier, and identifier-start categories. These
// are only applied when a character is found to actually have a
// code point above 128.
// Generated by `tools/generate-identifier-regex.js`.
var nonASCIIidentifierStartChars = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";
var nonASCIIidentifierChars = "‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_";
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
// These are a run-length and offset encoded representation of the
// >0xffff code points that are a valid part of identifiers. The
// offset starts at 0x10000, and each pair of numbers represents an
// offset to the next range, and then a size of the range. They were
// generated by tools/generate-identifier-regex.js
var astralIdentifierStartCodes = [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, 99, 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, 98, 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, 955, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 38, 17, 2, 24, 133, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 32, 4, 287, 47, 21, 1, 2, 0, 185, 46, 82, 47, 21, 0, 60, 42, 502, 63, 32, 0, 449, 56, 1288, 920, 104, 110, 2962, 1070, 13266, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 16481, 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, 1340, 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, 16355, 541];
var astralIdentifierCodes = [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, 16, 9, 83, 11, 168, 11, 6, 9, 8, 2, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 316, 19, 13, 9, 214, 6, 3, 8, 112, 16, 16, 9, 82, 12, 9, 9, 535, 9, 20855, 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, 4305, 6, 792618, 239];
// This has a complexity linear to the value of the code. The
// assumption is that looking up astral identifier characters is
// rare.
function isInAstralSet(code, set) {
var pos = 0x10000;
for (var i = 0; i < set.length; i += 2) {
pos += set[i];
if (pos > code) return false;
pos += set[i + 1];
if (pos >= code) return true;
}
}
// Test whether a given character code starts an identifier.
function isIdentifierStart(code) {
if (code < 65) return code === 36;
if (code < 91) return true;
if (code < 97) return code === 95;
if (code < 123) return true;
if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
return isInAstralSet(code, astralIdentifierStartCodes);
}
// Test whether a given character is part of an identifier.
function isIdentifierChar(code) {
if (code < 48) return code === 36;
if (code < 58) return true;
if (code < 65) return false;
if (code < 91) return true;
if (code < 97) return code === 95;
if (code < 123) return true;
if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
}
},{}],19:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = _dereq_(23)["default"];
exports.__esModule = true;
exports.getLineInfo = getLineInfo;
var _whitespace = _dereq_(20);
// These are used when `options.locations` is on, for the
// `startLoc` and `endLoc` properties.
var Position = function Position(line, col) {
_classCallCheck(this, Position);
this.line = line;
this.column = col;
};
exports.Position = Position;
var SourceLocation = function SourceLocation(start, end) {
_classCallCheck(this, SourceLocation);
this.start = start;
this.end = end;
}
// The `getLineInfo` function is mostly useful when the
// `locations` option is off (for performance reasons) and you
// want to find the line/column position for a given character
// offset. `input` should be the code string that the offset refers
// into.
;
exports.SourceLocation = SourceLocation;
function getLineInfo(input, offset) {
for (var line = 1, cur = 0;;) {
_whitespace.lineBreakG.lastIndex = cur;
var match = _whitespace.lineBreakG.exec(input);
if (match && match.index < offset) {
++line;
cur = match.index + match[0].length;
} else {
return new Position(line, offset - cur);
}
}
}
},{"20":20,"23":23}],20:[function(_dereq_,module,exports){
// Matches a whole line break (where CRLF is considered a single
// line break). Used to count lines.
"use strict";
exports.__esModule = true;
exports.isNewLine = isNewLine;
var lineBreak = /\r\n?|\n|\u2028|\u2029/;
exports.lineBreak = lineBreak;
var lineBreakG = new RegExp(lineBreak.source, "g");
exports.lineBreakG = lineBreakG;
function isNewLine(code) {
return code === 10 || code === 13 || code === 0x2028 || code === 0x2029;
}
var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
exports.nonASCIIwhitespace = nonASCIIwhitespace;
},{}],21:[function(_dereq_,module,exports){
module.exports = { "default": _dereq_(26), __esModule: true };
},{"26":26}],22:[function(_dereq_,module,exports){
module.exports = { "default": _dereq_(27), __esModule: true };
},{"27":27}],23:[function(_dereq_,module,exports){
"use strict";
exports["default"] = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
exports.__esModule = true;
},{}],24:[function(_dereq_,module,exports){
"use strict";
var _Object$create = _dereq_(21)["default"];
var _Object$setPrototypeOf = _dereq_(22)["default"];
exports["default"] = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = _Object$create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) _Object$setPrototypeOf ? _Object$setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
exports.__esModule = true;
},{"21":21,"22":22}],25:[function(_dereq_,module,exports){
"use strict";
exports["default"] = function (obj) {
return obj && obj.__esModule ? obj : {
"default": obj
};
};
exports.__esModule = true;
},{}],26:[function(_dereq_,module,exports){
var $ = _dereq_(35);
module.exports = function create(P, D){
return $.create(P, D);
};
},{"35":35}],27:[function(_dereq_,module,exports){
_dereq_(37);
module.exports = _dereq_(30).Object.setPrototypeOf;
},{"30":30,"37":37}],28:[function(_dereq_,module,exports){
module.exports = function(it){
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
return it;
};
},{}],29:[function(_dereq_,module,exports){
var isObject = _dereq_(34);
module.exports = function(it){
if(!isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
},{"34":34}],30:[function(_dereq_,module,exports){
var core = module.exports = {version: '1.2.6'};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
},{}],31:[function(_dereq_,module,exports){
// optional / simple context binding
var aFunction = _dereq_(28);
module.exports = function(fn, that, length){
aFunction(fn);
if(that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
}
return function(/* ...args */){
return fn.apply(that, arguments);
};
};
},{"28":28}],32:[function(_dereq_,module,exports){
var global = _dereq_(33)
, core = _dereq_(30)
, ctx = _dereq_(31)
, PROTOTYPE = 'prototype';
var $export = function(type, name, source){
var IS_FORCED = type & $export.F
, IS_GLOBAL = type & $export.G
, IS_STATIC = type & $export.S
, IS_PROTO = type & $export.P
, IS_BIND = type & $export.B
, IS_WRAP = type & $export.W
, exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
, target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
, key, own, out;
if(IS_GLOBAL)source = name;
for(key in source){
// contains in native
own = !IS_FORCED && target && key in target;
if(own && key in exports)continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? ctx(out, global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function(C){
var F = function(param){
return this instanceof C ? new C(param) : C(param);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out;
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
module.exports = $export;
},{"30":30,"31":31,"33":33}],33:[function(_dereq_,module,exports){
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
},{}],34:[function(_dereq_,module,exports){
module.exports = function(it){
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
},{}],35:[function(_dereq_,module,exports){
var $Object = Object;
module.exports = {
create: $Object.create,
getProto: $Object.getPrototypeOf,
isEnum: {}.propertyIsEnumerable,
getDesc: $Object.getOwnPropertyDescriptor,
setDesc: $Object.defineProperty,
setDescs: $Object.defineProperties,
getKeys: $Object.keys,
getNames: $Object.getOwnPropertyNames,
getSymbols: $Object.getOwnPropertySymbols,
each: [].forEach
};
},{}],36:[function(_dereq_,module,exports){
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var getDesc = _dereq_(35).getDesc
, isObject = _dereq_(34)
, anObject = _dereq_(29);
var check = function(O, proto){
anObject(O);
if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
};
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
function(test, buggy, set){
try {
set = _dereq_(31)(Function.call, getDesc(Object.prototype, '__proto__').set, 2);
set(test, []);
buggy = !(test instanceof Array);
} catch(e){ buggy = true; }
return function setPrototypeOf(O, proto){
check(O, proto);
if(buggy)O.__proto__ = proto;
else set(O, proto);
return O;
};
}({}, false) : undefined),
check: check
};
},{"29":29,"31":31,"34":34,"35":35}],37:[function(_dereq_,module,exports){
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $export = _dereq_(32);
$export($export.S, 'Object', {setPrototypeOf: _dereq_(36).set});
},{"32":32,"36":36}]},{},[1])(1)
});
/***/ },
/* 122 */
/*!********************************************!*\
!*** ./~/core-js/library/modules/$.cof.js ***!
\********************************************/
/***/ function(module, exports) {
var toString = {}.toString;
module.exports = function(it){
return toString.call(it).slice(8, -1);
};
/***/ },
/* 123 */
/*!************************************************!*\
!*** ./~/core-js/library/modules/$.iobject.js ***!
\************************************************/
/***/ function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(/*! ./$.cof */ 122);
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
return cof(it) == 'String' ? it.split('') : Object(it);
};
/***/ },
/* 124 */
/*!****************************************************!*\
!*** ./~/core-js/library/modules/$.iter-define.js ***!
\****************************************************/
/***/ function(module, exports, __webpack_require__) {
'use strict';
var LIBRARY = __webpack_require__(/*! ./$.library */ 202)
, $export = __webpack_require__(/*! ./$.export */ 29)
, redefine = __webpack_require__(/*! ./$.redefine */ 96)
, hide = __webpack_require__(/*! ./$.hide */ 43)
, has = __webpack_require__(/*! ./$.has */ 42)
, Iterators = __webpack_require__(/*! ./$.iterators */ 60)
, $iterCreate = __webpack_require__(/*! ./$.iter-create */ 434)
, setToStringTag = __webpack_require__(/*! ./$.set-to-string-tag */ 97)
, getProto = __webpack_require__(/*! ./$ */ 7).getProto
, ITERATOR = __webpack_require__(/*! ./$.wks */ 21)('iterator')
, BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
, FF_ITERATOR = '@@iterator'
, KEYS = 'keys'
, VALUES = 'values';
var returnThis = function(){ return this; };
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
$iterCreate(Constructor, NAME, next);
var getMethod = function(kind){
if(!BUGGY && kind in proto)return proto[kind];
switch(kind){
case KEYS: return function keys(){ return new Constructor(this, kind); };
case VALUES: return function values(){ return new Constructor(this, kind); };
} return function entries(){ return new Constructor(this, kind); };
};
var TAG = NAME + ' Iterator'
, DEF_VALUES = DEFAULT == VALUES
, VALUES_BUG = false
, proto = Base.prototype
, $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
, $default = $native || getMethod(DEFAULT)
, methods, key;
// Fix native
if($native){
var IteratorPrototype = getProto($default.call(new Base));
// Set @@toStringTag to native iterators
setToStringTag(IteratorPrototype, TAG, true);
// FF fix
if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
// fix Array#{values, @@iterator}.name in V8 / FF
if(DEF_VALUES && $native.name !== VALUES){
VALUES_BUG = true;
$default = function values(){ return $native.call(this); };
}
}
// Define iterator
if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
hide(proto, ITERATOR, $default);
}
// Plug for library
Iterators[NAME] = $default;
Iterators[TAG] = returnThis;
if(DEFAULT){
methods = {
values: DEF_VALUES ? $default : getMethod(VALUES),
keys: IS_SET ? $default : getMethod(KEYS),
entries: !DEF_VALUES ? $default : getMethod('entries')
};
if(FORCED)for(key in methods){
if(!(key in proto))redefine(proto, key, methods[key]);
} else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
}
return methods;
};
/***/ },
/* 125 */
/*!***************************************************!*\
!*** ./~/core-js/library/modules/$.object-sap.js ***!
\***************************************************/
/***/ function(module, exports, __webpack_require__) {
// most Object methods by ES6 should accept primitives
var $export = __webpack_require__(/*! ./$.export */ 29)
, core = __webpack_require__(/*! ./$.core */ 12)
, fails = __webpack_require__(/*! ./$.fails */ 58);
module.exports = function(KEY, exec){
var fn = (core.Object || {})[KEY] || Object[KEY]
, exp = {};
exp[KEY] = exec(fn);
$export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
};
/***/ },
/* 126 */
/*!******************************************************!*\
!*** ./~/core-js/library/modules/$.property-desc.js ***!
\******************************************************/
/***/ function(module, exports) {
module.exports = function(bitmap, value){
return {
enumerable : !(bitmap & 1),
configurable: !(bitmap & 2),
writable : !(bitmap & 4),
value : value
};
};
/***/ },
/* 127 */
/*!*****************************************************!*\
!*** ./~/core-js/library/modules/$.redefine-all.js ***!
\*****************************************************/
/***/ function(module, exports, __webpack_require__) {
var redefine = __webpack_require__(/*! ./$.redefine */ 96);
module.exports = function(target, src){
for(var key in src)redefine(target, key, src[key]);
return target;
};
/***/ },
/* 128 */
/*!***************************************************!*\
!*** ./~/core-js/library/modules/$.strict-new.js ***!
\***************************************************/
/***/ function(module, exports) {
module.exports = function(it, Constructor, name){
if(!(it instanceof Constructor))throw TypeError(name + ": use the 'new' operator!");
return it;
};
/***/ },
/* 129 */
/*!**************************************************!*\
!*** ./~/core-js/library/modules/$.to-object.js ***!
\**************************************************/
/***/ function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(/*! ./$.defined */ 94);
module.exports = function(it){
return Object(defined(it));
};
/***/ },
/* 130 */
/*!***********************************************************!*\
!*** ./~/core-js/library/modules/es6.object.to-string.js ***!
\***********************************************************/
40,
/* 131 */
/*!*************************************************!*\
!*** ./~/core-js/library/modules/es6.symbol.js ***!
\*************************************************/
/***/ function(module, exports, __webpack_require__) {
'use strict';
// ECMAScript 6 symbols shim
var $ = __webpack_require__(/*! ./$ */ 7)
, global = __webpack_require__(/*! ./$.global */ 59)
, has = __webpack_require__(/*! ./$.has */ 42)
, DESCRIPTORS = __webpack_require__(/*! ./$.descriptors */ 57)
, $export = __webpack_require__(/*! ./$.export */ 29)
, redefine = __webpack_require__(/*! ./$.redefine */ 96)
, $fails = __webpack_require__(/*! ./$.fails */ 58)
, shared = __webpack_require__(/*! ./$.shared */ 203)
, setToStringTag = __webpack_require__(/*! ./$.set-to-string-tag */ 97)
, uid = __webpack_require__(/*! ./$.uid */ 98)
, wks = __webpack_require__(/*! ./$.wks */ 21)
, keyOf = __webpack_require__(/*! ./$.keyof */ 435)
, $names = __webpack_require__(/*! ./$.get-names */ 199)
, enumKeys = __webpack_require__(/*! ./$.enum-keys */ 431)
, isArray = __webpack_require__(/*! ./$.is-array */ 200)
, anObject = __webpack_require__(/*! ./$.an-object */ 41)
, toIObject = __webpack_require__(/*! ./$.to-iobject */ 61)
, createDesc = __webpack_require__(/*! ./$.property-desc */ 126)
, getDesc = $.getDesc
, setDesc = $.setDesc
, _create = $.create
, getNames = $names.get
, $Symbol = global.Symbol
, $JSON = global.JSON
, _stringify = $JSON && $JSON.stringify
, setter = false
, HIDDEN = wks('_hidden')
, isEnum = $.isEnum
, SymbolRegistry = shared('symbol-registry')
, AllSymbols = shared('symbols')
, useNative = typeof $Symbol == 'function'
, ObjectProto = Object.prototype;
// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
var setSymbolDesc = DESCRIPTORS && $fails(function(){
return _create(setDesc({}, 'a', {
get: function(){ return setDesc(this, 'a', {value: 7}).a; }
})).a != 7;
}) ? function(it, key, D){
var protoDesc = getDesc(ObjectProto, key);
if(protoDesc)delete ObjectProto[key];
setDesc(it, key, D);
if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc);
} : setDesc;
var wrap = function(tag){
var sym = AllSymbols[tag] = _create($Symbol.prototype);
sym._k = tag;
DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, {
configurable: true,
set: function(value){
if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
setSymbolDesc(this, tag, createDesc(1, value));
}
});
return sym;
};
var isSymbol = function(it){
return typeof it == 'symbol';
};
var $defineProperty = function defineProperty(it, key, D){
if(D && has(AllSymbols, key)){
if(!D.enumerable){
if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {}));
it[HIDDEN][key] = true;
} else {
if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
D = _create(D, {enumerable: createDesc(0, false)});
} return setSymbolDesc(it, key, D);
} return setDesc(it, key, D);
};
var $defineProperties = function defineProperties(it, P){
anObject(it);
var keys = enumKeys(P = toIObject(P))
, i = 0
, l = keys.length
, key;
while(l > i)$defineProperty(it, key = keys[i++], P[key]);
return it;
};
var $create = function create(it, P){
return P === undefined ? _create(it) : $defineProperties(_create(it), P);
};
var $propertyIsEnumerable = function propertyIsEnumerable(key){
var E = isEnum.call(this, key);
return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key]
? E : true;
};
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
var D = getDesc(it = toIObject(it), key);
if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
return D;
};
var $getOwnPropertyNames = function getOwnPropertyNames(it){
var names = getNames(toIObject(it))
, result = []
, i = 0
, key;
while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key);
return result;
};
var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
var names = getNames(toIObject(it))
, result = []
, i = 0
, key;
while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]);
return result;
};
var $stringify = function stringify(it){
if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
var args = [it]
, i = 1
, $$ = arguments
, replacer, $replacer;
while($$.length > i)args.push($$[i++]);
replacer = args[1];
if(typeof replacer == 'function')$replacer = replacer;
if($replacer || !isArray(replacer))replacer = function(key, value){
if($replacer)value = $replacer.call(this, key, value);
if(!isSymbol(value))return value;
};
args[1] = replacer;
return _stringify.apply($JSON, args);
};
var buggyJSON = $fails(function(){
var S = $Symbol();
// MS Edge converts symbol values to JSON as {}
// WebKit converts symbol values to JSON as null
// V8 throws on boxed symbols
return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
});
// 19.4.1.1 Symbol([description])
if(!useNative){
$Symbol = function Symbol(){
if(isSymbol(this))throw TypeError('Symbol is not a constructor');
return wrap(uid(arguments.length > 0 ? arguments[0] : undefined));
};
redefine($Symbol.prototype, 'toString', function toString(){
return this._k;
});
isSymbol = function(it){
return it instanceof $Symbol;
};
$.create = $create;
$.isEnum = $propertyIsEnumerable;
$.getDesc = $getOwnPropertyDescriptor;
$.setDesc = $defineProperty;
$.setDescs = $defineProperties;
$.getNames = $names.get = $getOwnPropertyNames;
$.getSymbols = $getOwnPropertySymbols;
if(DESCRIPTORS && !__webpack_require__(/*! ./$.library */ 202)){
redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
}
}
var symbolStatics = {
// 19.4.2.1 Symbol.for(key)
'for': function(key){
return has(SymbolRegistry, key += '')
? SymbolRegistry[key]
: SymbolRegistry[key] = $Symbol(key);
},
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: function keyFor(key){
return keyOf(SymbolRegistry, key);
},
useSetter: function(){ setter = true; },
useSimple: function(){ setter = false; }
};
// 19.4.2.2 Symbol.hasInstance
// 19.4.2.3 Symbol.isConcatSpreadable
// 19.4.2.4 Symbol.iterator
// 19.4.2.6 Symbol.match
// 19.4.2.8 Symbol.replace
// 19.4.2.9 Symbol.search
// 19.4.2.10 Symbol.species
// 19.4.2.11 Symbol.split
// 19.4.2.12 Symbol.toPrimitive
// 19.4.2.13 Symbol.toStringTag
// 19.4.2.14 Symbol.unscopables
$.each.call((
'hasInstance,isConcatSpreadable,iterator,match,replace,search,' +
'species,split,toPrimitive,toStringTag,unscopables'
).split(','), function(it){
var sym = wks(it);
symbolStatics[it] = useNative ? sym : wrap(sym);
});
setter = true;
$export($export.G + $export.W, {Symbol: $Symbol});
$export($export.S, 'Symbol', symbolStatics);
$export($export.S + $export.F * !useNative, 'Object', {
// 19.1.2.2 Object.create(O [, Properties])
create: $create,
// 19.1.2.4 Object.defineProperty(O, P, Attributes)
defineProperty: $defineProperty,
// 19.1.2.3 Object.defineProperties(O, Properties)
defineProperties: $defineProperties,
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
// 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames: $getOwnPropertyNames,
// 19.1.2.8 Object.getOwnPropertySymbols(O)
getOwnPropertySymbols: $getOwnPropertySymbols
});
// 24.3.2 JSON.stringify(value [, replacer [, space]])
$JSON && $export($export.S + $export.F * (!useNative || buggyJSON), 'JSON', {stringify: $stringify});
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setToStringTag($Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, 'JSON', true);
/***/ },
/* 132 */
/*!*******************************************************!*\
!*** ./~/core-js/library/modules/web.dom.iterable.js ***!
\*******************************************************/
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(/*! ./es6.array.iterator */ 441);
var Iterators = __webpack_require__(/*! ./$.iterators */ 60);
Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array;
/***/ },
/* 133 */
/*!****************************************!*\
!*** ./~/lodash/internal/arrayEach.js ***!
\****************************************/
/***/ function(module, exports) {
/**
* A specialized version of `_.forEach` for arrays without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
module.exports = arrayEach;
/***/ },
/* 134 */
/*!*******************************************!*\
!*** ./~/lodash/internal/baseCallback.js ***!
\*******************************************/
/***/ function(module, exports, __webpack_require__) {
var baseMatches = __webpack_require__(/*! ./baseMatches */ 481),
baseMatchesProperty = __webpack_require__(/*! ./baseMatchesProperty */ 482),
bindCallback = __webpack_require__(/*! ./bindCallback */ 64),
identity = __webpack_require__(/*! ../utility/identity */ 234),
property = __webpack_require__(/*! ../utility/property */ 516);
/**
* The base implementation of `_.callback` which supports specifying the
* number of arguments to provide to `func`.
*
* @private
* @param {*} [func=_.identity] The value to convert to a callback.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {number} [argCount] The number of arguments to provide to `func`.
* @returns {Function} Returns the callback.
*/
function baseCallback(func, thisArg, argCount) {
var type = typeof func;
if (type == 'function') {
return thisArg === undefined
? func
: bindCallback(func, thisArg, argCount);
}
if (func == null) {
return identity;
}
if (type == 'object') {
return baseMatches(func);
}
return thisArg === undefined
? property(func)
: baseMatchesProperty(func, thisArg);
}
module.exports = baseCallback;
/***/ },
/* 135 */
/*!**************************************!*\
!*** ./~/lodash/internal/baseGet.js ***!
\**************************************/
/***/ function(module, exports, __webpack_require__) {
var toObject = __webpack_require__(/*! ./toObject */ 33);
/**
* The base implementation of `get` without support for string paths
* and default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array} path The path of the property to get.
* @param {string} [pathKey] The key representation of path.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path, pathKey) {
if (object == null) {
return;
}
if (pathKey !== undefined && pathKey in toObject(object)) {
path = [pathKey];
}
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[path[index++]];
}
return (index && index == length) ? object : undefined;
}
module.exports = baseGet;
/***/ },
/* 136 */
/*!******************************************!*\
!*** ./~/lodash/internal/baseIndexOf.js ***!
\******************************************/
/***/ function(module, exports, __webpack_require__) {
var indexOfNaN = __webpack_require__(/*! ./indexOfNaN */ 503);
/**
* The base implementation of `_.indexOf` without support for binary searches.
*
* @private
* @param {Array} array The array to search.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOf(array, value, fromIndex) {
if (value !== value) {
return indexOfNaN(array, fromIndex);
}
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
module.exports = baseIndexOf;
/***/ },
/* 137 */
/*!*******************************************!*\
!*** ./~/lodash/internal/baseToString.js ***!
\*******************************************/
/***/ function(module, exports) {
/**
* Converts `value` to a string if it's not one. An empty string is returned
* for `null` or `undefined` values.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
return value == null ? '' : (value + '');
}
module.exports = baseToString;
/***/ },
/* 138 */
/*!****************************************!*\
!*** ./~/lodash/internal/getLength.js ***!
\****************************************/
/***/ function(module, exports, __webpack_require__) {
var baseProperty = __webpack_require__(/*! ./baseProperty */ 224);
/**
* Gets the "length" property value of `object`.
*
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
* that affects Safari on at least iOS 8.1-8.3 ARM64.
*
* @private
* @param {Object} object The object to query.
* @returns {*} Returns the "length" value.
*/
var getLength = baseProperty('length');
module.exports = getLength;
/***/ },
/* 139 */
/*!************************************!*\
!*** ./~/lodash/internal/isKey.js ***!
\************************************/
/***/ function(module, exports, __webpack_require__) {
var isArray = __webpack_require__(/*! ../lang/isArray */ 13),
toObject = __webpack_require__(/*! ./toObject */ 33);
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/;
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
var type = typeof value;
if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
return true;
}
if (isArray(value)) {
return false;
}
var result = !reIsDeepProp.test(value);
return result || (object != null && value in toObject(object));
}
module.exports = isKey;
/***/ },
/* 140 */
/*!*************************************!*\
!*** ./~/lodash/internal/toPath.js ***!
\*************************************/
/***/ function(module, exports, __webpack_require__) {
var baseToString = __webpack_require__(/*! ./baseToString */ 137),
isArray = __webpack_require__(/*! ../lang/isArray */ 13);
/** Used to match property names within property paths. */
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
/**
* Converts `value` to property path array if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Array} Returns the property path array.
*/
function toPath(value) {
if (isArray(value)) {
return value;
}
var result = [];
baseToString(value).replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;
}
module.exports = toPath;
/***/ },
/* 141 */
/*!***************************************!*\
!*** ./~/lodash/lang/isTypedArray.js ***!
\***************************************/
/***/ function(module, exports, __webpack_require__) {
var isLength = __webpack_require__(/*! ../internal/isLength */ 32),
isObjectLike = __webpack_require__(/*! ../internal/isObjectLike */ 17);
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dateTag] = typedArrayTags[errorTag] =
typedArrayTags[funcTag] = typedArrayTags[mapTag] =
typedArrayTags[numberTag] = typedArrayTags[objectTag] =
typedArrayTags[regexpTag] = typedArrayTags[setTag] =
typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
/** Used for native method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
function isTypedArray(value) {
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
}
module.exports = isTypedArray;
/***/ },
/* 142 */
/*!***********************************!*\
!*** ./~/lodash/object/keysIn.js ***!
\***********************************/
/***/ function(module, exports, __webpack_require__) {
var isArguments = __webpack_require__(/*! ../lang/isArguments */ 66),
isArray = __webpack_require__(/*! ../lang/isArray */ 13),
isIndex = __webpack_require__(/*! ../internal/isIndex */ 101),
isLength = __webpack_require__(/*! ../internal/isLength */ 32),
isObject = __webpack_require__(/*! ../lang/isObject */ 15);
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Creates an array of the own and inherited enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keysIn(new Foo);
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/
function keysIn(object) {
if (object == null) {
return [];
}
if (!isObject(object)) {
object = Object(object);
}
var length = object.length;
length = (length && isLength(length) &&
(isArray(object) || isArguments(object)) && length) || 0;
var Ctor = object.constructor,
index = -1,
isProto = typeof Ctor == 'function' && Ctor.prototype === object,
result = Array(length),
skipIndexes = length > 0;
while (++index < length) {
result[index] = (index + '');
}
for (var key in object) {
if (!(skipIndexes && isIndex(key, length)) &&
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
}
return result;
}
module.exports = keysIn;
/***/ },
/* 143 */
/*!***********************************!*\
!*** (webpack)/buildin/module.js ***!
\***********************************/
/***/ function(module, exports) {
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
module.children = [];
module.webpackPolyfill = 1;
}
return module;
}
/***/ },
/* 144 */
/*!*******************************!*\
!*** ./~/ansi-regex/index.js ***!
\*******************************/
/***/ function(module, exports) {
'use strict';
module.exports = function () {
return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
};
/***/ },
/* 145 */
/*!**************************************!*\
!*** ./~/babel-core/lib/api/node.js ***!
\**************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
var _interopRequire = __webpack_require__(/*! babel-runtime/helpers/interop-require */ 118)["default"];
exports.__esModule = true;
exports.Plugin = Plugin;
exports.transformFile = transformFile;
exports.transformFileSync = transformFileSync;
var _lodashLangIsFunction = __webpack_require__(/*! lodash/lang/isFunction */ 230);
var _lodashLangIsFunction2 = _interopRequireDefault(_lodashLangIsFunction);
var _fs = __webpack_require__(/*! fs */ 40);
var _fs2 = _interopRequireDefault(_fs);
//
//
var _util = __webpack_require__(/*! ../util */ 107);
var util = _interopRequireWildcard(_util);
var _babelMessages = __webpack_require__(/*! babel-messages */ 19);
var messages = _interopRequireWildcard(_babelMessages);
var _babelTypes = __webpack_require__(/*! babel-types */ 11);
var t = _interopRequireWildcard(_babelTypes);
var _babelTraverse = __webpack_require__(/*! babel-traverse */ 6);
var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
var _transformationFileOptionsOptionManager = __webpack_require__(/*! ../transformation/file/options/option-manager */ 50);
var _transformationFileOptionsOptionManager2 = _interopRequireDefault(_transformationFileOptionsOptionManager);
//
var _transformationPipeline = __webpack_require__(/*! ../transformation/pipeline */ 253);
var _transformationPipeline2 = _interopRequireDefault(_transformationPipeline);
var _transformationFile = __webpack_require__(/*! ../transformation/file */ 103);
exports.File = _interopRequire(_transformationFile);
var _transformationFileOptionsConfig = __webpack_require__(/*! ../transformation/file/options/config */ 49);
exports.options = _interopRequire(_transformationFileOptionsConfig);
var _toolsBuildExternalHelpers = __webpack_require__(/*! ../tools/build-external-helpers */ 248);
exports.buildExternalHelpers = _interopRequire(_toolsBuildExternalHelpers);
var _babelTemplate = __webpack_require__(/*! babel-template */ 9);
exports.template = _interopRequire(_babelTemplate);
var _package = __webpack_require__(/*! ../../package */ 463);
exports.version = _package.version;
exports.util = util;
exports.messages = messages;
exports.types = t;
exports.traverse = _babelTraverse2["default"];
exports.OptionManager = _transformationFileOptionsOptionManager2["default"];
function Plugin(alias) {
throw new Error("The (" + alias + ") Babel 5 plugin is being run with Babel 6.");
}
exports.Pipeline = _transformationPipeline2["default"];
var pipeline = new _transformationPipeline2["default"]();
var analyse = pipeline.analyse.bind(pipeline);
exports.analyse = analyse;
var transform = pipeline.transform.bind(pipeline);
exports.transform = transform;
var transformFromAst = pipeline.transformFromAst.bind(pipeline);
exports.transformFromAst = transformFromAst;
//
function transformFile(filename, opts, callback) {
if (_lodashLangIsFunction2["default"](opts)) {
callback = opts;
opts = {};
}
opts.filename = filename;
_fs2["default"].readFile(filename, function (err, code) {
var result = undefined;
if (!err) {
try {
result = transform(code, opts);
} catch (_err) {
err = _err;
}
}
if (err) {
callback(err);
} else {
callback(null, result);
}
});
}
function transformFileSync(filename) {
var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
opts.filename = filename;
return transform(_fs2["default"].readFileSync(filename, "utf8"), opts);
}
/***/ },
/* 146 */
/*!***************************************************************!*\
!*** ./~/babel-core/lib/transformation/file/options ^\.\/.*$ ***!
\***************************************************************/
/***/ function(module, exports, __webpack_require__) {
var map = {
"./config": 49,
"./config.js": 49,
"./index": 104,
"./index.js": 104,
"./option-manager": 50,
"./option-manager.js": 50,
"./parsers": 105,
"./parsers.js": 105,
"./removed": 106,
"./removed.js": 106
};
function webpackContext(req) {
return __webpack_require__(webpackContextResolve(req));
};
function webpackContextResolve(req) {
return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }());
};
webpackContext.keys = function webpackContextKeys() {
return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
webpackContext.id = 146;
/***/ },
/* 147 */
/*!******************************************************!*\
!*** ./~/babel-core/~/babel-types/lib/retrievers.js ***!
\******************************************************/
[550, 11],
/* 148 */
/*!***************************************************!*\
!*** ./~/babel-generator/lib/generators/types.js ***!
\***************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
/* eslint quotes: 0 */
"use strict";
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
exports.Identifier = Identifier;
exports.RestElement = RestElement;
exports.ObjectExpression = ObjectExpression;
exports.ObjectMethod = ObjectMethod;
exports.ObjectProperty = ObjectProperty;
exports.ArrayExpression = ArrayExpression;
exports.RegExpLiteral = RegExpLiteral;
exports.BooleanLiteral = BooleanLiteral;
exports.NullLiteral = NullLiteral;
exports.NumericLiteral = NumericLiteral;
exports.StringLiteral = StringLiteral;
exports._stringLiteral = _stringLiteral;
var _babelTypes = __webpack_require__(/*! babel-types */ 8);
var t = _interopRequireWildcard(_babelTypes);
function Identifier(node) {
// FIXME: We hang variance off Identifer to support Flow's def-site variance.
// This is a terrible hack, but changing type annotations to use a new,
// dedicated node would be a breaking change. This should be cleaned up in
// the next major.
if (node.variance === "plus") {
this.push("+");
} else if (node.variance === "minus") {
this.push("-");
}
this.push(node.name);
}
function RestElement(node) {
this.push("...");
this.print(node.argument, node);
}
exports.SpreadElement = RestElement;
exports.SpreadProperty = RestElement;
exports.RestProperty = RestElement;
function ObjectExpression(node) {
var props = node.properties;
this.push("{");
this.printInnerComments(node);
if (props.length) {
this.space();
this.printList(props, node, { indent: true });
this.space();
}
this.push("}");
}
exports.ObjectPattern = ObjectExpression;
function ObjectMethod(node) {
this.printJoin(node.decorators, node, { separator: "" });
this._method(node);
}
function ObjectProperty(node) {
this.printJoin(node.decorators, node, { separator: "" });
if (node.computed) {
this.push("[");
this.print(node.key, node);
this.push("]");
} else {
// print `({ foo: foo = 5 } = {})` as `({ foo = 5 } = {});`
if (t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && node.key.name === node.value.left.name) {
this.print(node.value, node);
return;
}
this.print(node.key, node);
// shorthand!
if (node.shorthand && t.isIdentifier(node.key) && t.isIdentifier(node.value) && node.key.name === node.value.name) {
return;
}
}
this.push(":");
this.space();
this.print(node.value, node);
}
function ArrayExpression(node) {
var elems = node.elements;
var len = elems.length;
this.push("[");
this.printInnerComments(node);
for (var i = 0; i < elems.length; i++) {
var elem = elems[i];
if (elem) {
if (i > 0) this.space();
this.print(elem, node);
if (i < len - 1) this.push(",");
} else {
// If the array expression ends with a hole, that hole
// will be ignored by the interpreter, but if it ends with
// two (or more) holes, we need to write out two (or more)
// commas so that the resulting code is interpreted with
// both (all) of the holes.
this.push(",");
}
}
this.push("]");
}
exports.ArrayPattern = ArrayExpression;
function RegExpLiteral(node) {
this.push("/" + node.pattern + "/" + node.flags);
}
function BooleanLiteral(node) {
this.push(node.value ? "true" : "false");
}
function NullLiteral() {
this.push("null");
}
function NumericLiteral(node) {
this.push(node.value + "");
}
function StringLiteral(node, parent) {
this.push(this._stringLiteral(node.value, parent));
}
function _stringLiteral(val, parent) {
val = JSON.stringify(val);
// escape illegal js but valid json unicode characters
val = val.replace(/[\u000A\u000D\u2028\u2029]/g, function (c) {
return "\\u" + ("0000" + c.charCodeAt(0).toString(16)).slice(-4);
});
if (this.format.quotes === "single" && !t.isJSX(parent)) {
// remove double quotes
val = val.slice(1, -1);
// unescape double quotes
val = val.replace(/\\"/g, '"');
// escape single quotes
val = val.replace(/'/g, "\\'");
// add single quotes
val = "'" + val + "'";
}
return val;
}
/***/ },
/* 149 */
/*!****************************************!*\
!*** ./~/babel-generator/lib/index.js ***!
\****************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _inherits = __webpack_require__(/*! babel-runtime/helpers/inherits */ 35)["default"];
var _classCallCheck = __webpack_require__(/*! babel-runtime/helpers/class-call-check */ 5)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _detectIndent = __webpack_require__(/*! detect-indent */ 453);
var _detectIndent2 = _interopRequireDefault(_detectIndent);
var _whitespace = __webpack_require__(/*! ./whitespace */ 282);
var _whitespace2 = _interopRequireDefault(_whitespace);
var _sourceMap = __webpack_require__(/*! ./source-map */ 281);
var _sourceMap2 = _interopRequireDefault(_sourceMap);
var _position = __webpack_require__(/*! ./position */ 279);
var _position2 = _interopRequireDefault(_position);
var _babelMessages = __webpack_require__(/*! babel-messages */ 19);
var messages = _interopRequireWildcard(_babelMessages);
var _printer = __webpack_require__(/*! ./printer */ 280);
var _printer2 = _interopRequireDefault(_printer);
/**
* Babel's code generator, turns an ast into code, maintaining sourcemaps,
* user preferences, and valid output.
*/
var CodeGenerator = (function (_Printer) {
_inherits(CodeGenerator, _Printer);
function CodeGenerator(ast, opts, code) {
_classCallCheck(this, CodeGenerator);
opts = opts || {};
var comments = ast.comments || [];
var tokens = ast.tokens || [];
var format = CodeGenerator.normalizeOptions(code, opts, tokens);
var position = new _position2["default"]();
_Printer.call(this, position, format);
this.comments = comments;
this.position = position;
this.tokens = tokens;
this.format = format;
this.opts = opts;
this.ast = ast;
this._inForStatementInitCounter = 0;
this.whitespace = new _whitespace2["default"](tokens);
this.map = new _sourceMap2["default"](position, opts, code);
}
/**
* Normalize generator options, setting defaults.
*
* - Detects code indentation.
* - If `opts.compact = "auto"` and the code is over 100KB, `compact` will be set to `true`.
*/
CodeGenerator.normalizeOptions = function normalizeOptions(code, opts, tokens) {
var style = " ";
if (code && typeof code === "string") {
var _indent = _detectIndent2["default"](code).indent;
if (_indent && _indent !== " ") style = _indent;
}
var format = {
auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
shouldPrintComment: opts.shouldPrintComment,
retainLines: opts.retainLines,
comments: opts.comments == null || opts.comments,
compact: opts.compact,
minified: opts.minified,
concise: opts.concise,
quotes: opts.quotes || CodeGenerator.findCommonStringDelimiter(code, tokens),
indent: {
adjustMultilineComment: true,
style: style,
base: 0
}
};
if (format.minified) {
format.compact = true;
}
if (format.compact === "auto") {
format.compact = code.length > 100000; // 100KB
if (format.compact) {
console.error("[BABEL] " + messages.get("codeGeneratorDeopt", opts.filename, "100KB"));
}
}
if (format.compact) {
format.indent.adjustMultilineComment = false;
}
return format;
};
/**
* Determine if input code uses more single or double quotes.
*/
CodeGenerator.findCommonStringDelimiter = function findCommonStringDelimiter(code, tokens) {
var occurences = {
single: 0,
double: 0
};
var checked = 0;
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
if (token.type.label !== "string") continue;
var raw = code.slice(token.start, token.end);
if (raw[0] === "'") {
occurences.single++;
} else {
occurences.double++;
}
checked++;
if (checked >= 3) break;
}
if (occurences.single > occurences.double) {
return "single";
} else {
return "double";
}
};
/**
* Generate code and sourcemap from ast.
*
* Appends comments that weren't attached to any node to the end of the generated output.
*/
CodeGenerator.prototype.generate = function generate() {
this.print(this.ast);
this.printAuxAfterComment();
return {
map: this.map.get(),
code: this.get()
};
};
return CodeGenerator;
})(_printer2["default"]);
exports.CodeGenerator = CodeGenerator;
exports["default"] = function (ast, opts, code) {
var gen = new CodeGenerator(ast, opts, code);
return gen.generate();
};
/***/ },
/* 150 */
/*!*********************************************!*\
!*** ./~/babel-generator/lib/node/index.js ***!
\*********************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _Object$keys = __webpack_require__(/*! babel-runtime/core-js/object/keys */ 14)["default"];
var _getIterator = __webpack_require__(/*! babel-runtime/core-js/get-iterator */ 4)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
exports.isUserWhitespacable = isUserWhitespacable;
exports.needsWhitespace = needsWhitespace;
exports.needsWhitespaceBefore = needsWhitespaceBefore;
exports.needsWhitespaceAfter = needsWhitespaceAfter;
exports.needsParens = needsParens;
var _whitespace = __webpack_require__(/*! ./whitespace */ 278);
var _whitespace2 = _interopRequireDefault(_whitespace);
var _parentheses = __webpack_require__(/*! ./parentheses */ 277);
var parens = _interopRequireWildcard(_parentheses);
var _babelTypes = __webpack_require__(/*! babel-types */ 8);
var t = _interopRequireWildcard(_babelTypes);
function expandAliases(obj) {
var newObj = {};
function add(type, func) {
var fn = newObj[type];
newObj[type] = fn ? function (node, parent, stack) {
var result = fn(node, parent, stack);
return result == null ? func(node, parent, stack) : result;
} : func;
}
for (var _iterator = _Object$keys(obj), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var type = _ref;
var aliases = t.FLIPPED_ALIAS_KEYS[type];
if (aliases) {
for (var _iterator2 = aliases, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _getIterator(_iterator2);;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var alias = _ref2;
add(alias, obj[type]);
}
} else {
add(type, obj[type]);
}
}
return newObj;
}
// Rather than using `t.is` on each object property, we pre-expand any type aliases
// into concrete types so that the 'find' call below can be as fast as possible.
var expandedParens = expandAliases(parens);
var expandedWhitespaceNodes = expandAliases(_whitespace2["default"].nodes);
var expandedWhitespaceList = expandAliases(_whitespace2["default"].list);
function find(obj, node, parent, printStack) {
var fn = obj[node.type];
return fn ? fn(node, parent, printStack) : null;
}
function isOrHasCallExpression(node) {
if (t.isCallExpression(node)) {
return true;
}
if (t.isMemberExpression(node)) {
return isOrHasCallExpression(node.object) || !node.computed && isOrHasCallExpression(node.property);
} else {
return false;
}
}
function isUserWhitespacable(node) {
return t.isUserWhitespacable(node);
}
function needsWhitespace(node, parent, type) {
if (!node) return 0;
if (t.isExpressionStatement(node)) {
node = node.expression;
}
var linesInfo = find(expandedWhitespaceNodes, node, parent);
if (!linesInfo) {
var items = find(expandedWhitespaceList, node, parent);
if (items) {
for (var i = 0; i < items.length; i++) {
linesInfo = needsWhitespace(items[i], node, type);
if (linesInfo) break;
}
}
}
return linesInfo && linesInfo[type] || 0;
}
function needsWhitespaceBefore(node, parent) {
return needsWhitespace(node, parent, "before");
}
function needsWhitespaceAfter(node, parent) {
return needsWhitespace(node, parent, "after");
}
function needsParens(node, parent, printStack) {
if (!parent) return false;
if (t.isNewExpression(parent) && parent.callee === node) {
if (isOrHasCallExpression(node)) return true;
}
return find(expandedParens, node, parent, printStack);
}
/***/ },
/* 151 */
/*!***********************************************************!*\
!*** ./~/babel-generator/~/babel-types/lib/retrievers.js ***!
\***********************************************************/
[550, 8],
/* 152 */
/*!*******************************************************!*\
!*** ./~/babel-helper-builder-react-jsx/lib/index.js ***!
\*******************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _esutils = __webpack_require__(/*! esutils */ 30);
var _esutils2 = _interopRequireDefault(_esutils);
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
// function called with (state: ElementState) after building attribs
exports["default"] = function (opts) {
var visitor = {};
visitor.JSXNamespacedName = function (path) {
throw path.buildCodeFrameError("Namespace tags are not supported. ReactJSX is not XML.");
};
visitor.JSXElement = {
exit: function exit(path, file) {
var callExpr = buildElementCall(path.get("openingElement"), file);
callExpr.arguments = callExpr.arguments.concat(path.node.children);
if (callExpr.arguments.length >= 3) {
callExpr._prettyCall = true;
}
path.replaceWith(t.inherits(callExpr, path.node));
}
};
return visitor;
function convertJSXIdentifier(node, parent) {
if (t.isJSXIdentifier(node)) {
if (node.name === "this" && t.isReferenced(node, parent)) {
return t.thisExpression();
} else if (_esutils2["default"].keyword.isIdentifierNameES6(node.name)) {
node.type = "Identifier";
} else {
return t.stringLiteral(node.name);
}
} else if (t.isJSXMemberExpression(node)) {
return t.memberExpression(convertJSXIdentifier(node.object, node), convertJSXIdentifier(node.property, node));
}
return node;
}
function convertAttributeValue(node) {
if (t.isJSXExpressionContainer(node)) {
return node.expression;
} else {
return node;
}
}
function convertAttribute(node) {
var value = convertAttributeValue(node.value || t.booleanLiteral(true));
if (t.isStringLiteral(value) && !t.isJSXExpressionContainer(node.value)) {
value.value = value.value.replace(/\n\s+/g, " ");
}
if (t.isValidIdentifier(node.name.name)) {
node.name.type = "Identifier";
} else {
node.name = t.stringLiteral(node.name.name);
}
return t.inherits(t.objectProperty(node.name, value), node);
}
function buildElementCall(path, file) {
path.parent.children = t.react.buildChildren(path.parent);
var tagExpr = convertJSXIdentifier(path.node.name, path.node);
var args = [];
var tagName = undefined;
if (t.isIdentifier(tagExpr)) {
tagName = tagExpr.name;
} else if (t.isLiteral(tagExpr)) {
tagName = tagExpr.value;
}
var state = {
tagExpr: tagExpr,
tagName: tagName,
args: args
};
if (opts.pre) {
opts.pre(state, file);
}
var attribs = path.node.attributes;
if (attribs.length) {
attribs = buildOpeningElementAttributes(attribs, file);
} else {
attribs = t.nullLiteral();
}
args.push(attribs);
if (opts.post) {
opts.post(state, file);
}
return state.call || t.callExpression(state.callee, args);
}
/**
* The logic for this is quite terse. It's because we need to
* support spread elements. We loop over all attributes,
* breaking on spreads, we then push a new object containg
* all prior attributes to an array for later processing.
*/
function buildOpeningElementAttributes(attribs, file) {
var _props = [];
var objs = [];
function pushProps() {
if (!_props.length) return;
objs.push(t.objectExpression(_props));
_props = [];
}
while (attribs.length) {
var prop = attribs.shift();
if (t.isJSXSpreadAttribute(prop)) {
pushProps();
objs.push(prop.argument);
} else {
_props.push(convertAttribute(prop));
}
}
pushProps();
if (objs.length === 1) {
// only one object
attribs = objs[0];
} else {
// looks like we have multiple objects
if (!t.isObjectExpression(objs[0])) {
objs.unshift(t.objectExpression([]));
}
// spread it
attribs = t.callExpression(file.addHelper("extends"), objs);
}
return attribs;
}
};
module.exports = exports["default"];
// tag node
// raw string tag name
// array of call arguments
// optional call property that can be set to override the call expression returned
// function called with (state: ElementState) before building attribs
/***/ },
/* 153 */
/*!************************************************!*\
!*** ./~/babel-helper-define-map/lib/index.js ***!
\************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
exports.push = push;
exports.hasComputed = hasComputed;
exports.toComputedObjectFromClass = toComputedObjectFromClass;
exports.toClassObject = toClassObject;
exports.toDefineObject = toDefineObject;
var _babelHelperFunctionName = __webpack_require__(/*! babel-helper-function-name */ 51);
var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName);
var _lodashCollectionEach = __webpack_require__(/*! lodash/collection/each */ 31);
var _lodashCollectionEach2 = _interopRequireDefault(_lodashCollectionEach);
var _lodashObjectHas = __webpack_require__(/*! lodash/object/has */ 232);
var _lodashObjectHas2 = _interopRequireDefault(_lodashObjectHas);
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
function toKind(node) {
if (t.isClassMethod(node) || t.isObjectMethod(node)) {
if (node.kind === "get" || node.kind === "set") {
return node.kind;
}
}
return "value";
}
function push(mutatorMap, node, kind, file, scope) {
var alias = t.toKeyAlias(node);
//
var map = {};
if (_lodashObjectHas2["default"](mutatorMap, alias)) map = mutatorMap[alias];
mutatorMap[alias] = map;
//
map._inherits = map._inherits || [];
map._inherits.push(node);
map._key = node.key;
if (node.computed) {
map._computed = true;
}
if (node.decorators) {
var decorators = map.decorators = map.decorators || t.arrayExpression([]);
decorators.elements = decorators.elements.concat(node.decorators.map(function (dec) {
return dec.expression;
}).reverse());
}
if (map.value || map.initializer) {
throw file.buildCodeFrameError(node, "Key conflict with sibling node");
}
var key = undefined,
value = undefined;
// save the key so we can possibly do function name inferences
if (t.isObjectProperty(node) || t.isObjectMethod(node) || t.isClassMethod(node)) {
key = t.toComputedKey(node, node.key);
}
if (t.isObjectProperty(node) || t.isClassProperty(node)) {
value = node.value;
} else if (t.isObjectMethod(node) || t.isClassMethod(node)) {
value = t.functionExpression(null, node.params, node.body, node.generator, node.async);
}
var inheritedKind = toKind(node);
if (!kind || inheritedKind !== "value") {
kind = inheritedKind;
}
// infer function name
if (scope && t.isStringLiteral(key) && (kind === "value" || kind === "initializer") && t.isFunctionExpression(value)) {
value = _babelHelperFunctionName2["default"]({ id: key, node: value, scope: scope });
}
if (value) {
t.inheritsComments(value, node);
map[kind] = value;
}
return map;
}
function hasComputed(mutatorMap) {
for (var key in mutatorMap) {
if (mutatorMap[key]._computed) {
return true;
}
}
return false;
}
function toComputedObjectFromClass(obj) {
var objExpr = t.arrayExpression([]);
for (var i = 0; i < obj.properties.length; i++) {
var prop = obj.properties[i];
var val = prop.value;
val.properties.unshift(t.objectProperty(t.identifier("key"), t.toComputedKey(prop)));
objExpr.elements.push(val);
}
return objExpr;
}
function toClassObject(mutatorMap) {
var objExpr = t.objectExpression([]);
_lodashCollectionEach2["default"](mutatorMap, function (map) {
var mapNode = t.objectExpression([]);
var propNode = t.objectProperty(map._key, mapNode, map._computed);
_lodashCollectionEach2["default"](map, function (node, key) {
if (key[0] === "_") return;
var inheritNode = node;
if (t.isClassMethod(node) || t.isClassProperty(node)) node = node.value;
var prop = t.objectProperty(t.identifier(key), node);
t.inheritsComments(prop, inheritNode);
t.removeComments(inheritNode);
mapNode.properties.push(prop);
});
objExpr.properties.push(propNode);
});
return objExpr;
}
function toDefineObject(mutatorMap) {
_lodashCollectionEach2["default"](mutatorMap, function (map) {
if (map.value) map.writable = t.booleanLiteral(true);
map.configurable = t.booleanLiteral(true);
map.enumerable = t.booleanLiteral(true);
});
return toClassObject(mutatorMap);
}
/***/ },
/* 154 */
/*!********************************************************!*\
!*** ./~/babel-helper-get-function-arity/lib/index.js ***!
\********************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
exports["default"] = function (node) {
var params = node.params;
for (var i = 0; i < params.length; i++) {
var param = params[i];
if (t.isAssignmentPattern(param) || t.isRestElement(param)) {
return i;
}
}
return params.length;
};
module.exports = exports["default"];
/***/ },
/* 155 */
/*!*****************************************************!*\
!*** ./~/babel-helper-hoist-variables/lib/index.js ***!
\*****************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
var visitor = {
Scope: function Scope(path, state) {
if (state.kind === "let") path.skip();
},
Function: function Function(path) {
path.skip();
},
VariableDeclaration: function VariableDeclaration(path, state) {
if (state.kind && path.node.kind !== state.kind) return;
var nodes = [];
var declarations = path.get("declarations");
var firstId = undefined;
for (var _i = 0; _i < declarations.length; _i++) {
var declar = declarations[_i];
firstId = declar.node.id;
if (declar.node.init) {
nodes.push(t.expressionStatement(t.assignmentExpression("=", declar.node.id, declar.node.init)));
}
for (var _name in declar.getBindingIdentifiers()) {
state.emit(t.identifier(_name), _name);
}
}
// for (var i in test)
if (path.parentPath.isFor({ left: path.node })) {
path.replaceWith(firstId);
} else {
path.replaceWithMultiple(nodes);
}
}
};
exports["default"] = function (path, emit) {
var kind = arguments.length <= 2 || arguments[2] === undefined ? "var" : arguments[2];
path.traverse(visitor, { kind: kind, emit: emit });
};
module.exports = exports["default"];
/***/ },
/* 156 */
/*!**************************************************************!*\
!*** ./~/babel-helper-optimise-call-expression/lib/index.js ***!
\**************************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
exports["default"] = function (callee, thisNode, args) {
if (args.length === 1 && t.isSpreadElement(args[0]) && t.isIdentifier(args[0].argument, { name: "arguments" })) {
// eg. super(...arguments);
return t.callExpression(t.memberExpression(callee, t.identifier("apply")), [thisNode, args[0].argument]);
} else {
return t.callExpression(t.memberExpression(callee, t.identifier("call")), [thisNode].concat(args));
}
};
module.exports = exports["default"];
/***/ },
/* 157 */
/*!*******************************************!*\
!*** ./~/babel-helper-regex/lib/index.js ***!
\*******************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
exports.is = is;
exports.pullFlag = pullFlag;
var _lodashArrayPull = __webpack_require__(/*! lodash/array/pull */ 213);
var _lodashArrayPull2 = _interopRequireDefault(_lodashArrayPull);
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
function is(node, flag) {
return t.isRegExpLiteral(node) && node.flags.indexOf(flag) >= 0;
}
function pullFlag(node, flag) {
var flags = node.flags.split("");
if (node.flags.indexOf(flag) < 0) return;
_lodashArrayPull2["default"](flags, flag);
node.flags = flags.join("");
}
/***/ },
/* 158 */
/*!**************************************************************!*\
!*** ./~/babel-helper-remap-async-to-generator/lib/index.js ***!
\**************************************************************/
/***/ function(module, exports, __webpack_require__) {
/* @noflow */
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelHelperFunctionName = __webpack_require__(/*! babel-helper-function-name */ 51);
var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName);
var _babelTemplate = __webpack_require__(/*! babel-template */ 9);
var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
var buildWrapper = _babelTemplate2["default"]("\n (() => {\n var ref = FUNCTION;\n return function NAME(PARAMS) {\n return ref.apply(this, arguments);\n };\n })\n");
var namedBuildWrapper = _babelTemplate2["default"]("\n (() => {\n var ref = FUNCTION;\n function NAME(PARAMS) {\n return ref.apply(this, arguments);\n }\n return NAME;\n })\n");
var awaitVisitor = {
ArrowFunctionExpression: function ArrowFunctionExpression(path) {
if (!path.node.async) {
path.arrowFunctionToShadowed();
}
},
AwaitExpression: function AwaitExpression(_ref) {
var node = _ref.node;
node.type = "YieldExpression";
}
};
function classOrObjectMethod(path, callId) {
var node = path.node;
var body = node.body;
node.async = false;
var container = t.functionExpression(null, [], t.blockStatement(body.body), true);
container.shadow = true;
body.body = [t.returnStatement(t.callExpression(t.callExpression(callId, [container]), []))];
}
function plainFunction(path, callId) {
var node = path.node;
var isDeclaration = path.isFunctionDeclaration();
var asyncFnId = node.id;
var wrapper = buildWrapper;
if (path.isArrowFunctionExpression()) {
path.arrowFunctionToShadowed();
} else if (!isDeclaration && asyncFnId) {
wrapper = namedBuildWrapper;
}
node.async = false;
node.generator = true;
node.id = null;
if (isDeclaration) {
node.type = "FunctionExpression";
}
var built = t.callExpression(callId, [node]);
var container = wrapper({
NAME: asyncFnId,
FUNCTION: built,
PARAMS: node.params.map(function () {
return path.scope.generateUidIdentifier("x");
})
}).expression;
if (isDeclaration) {
var declar = t.variableDeclaration("let", [t.variableDeclarator(t.identifier(asyncFnId.name), t.callExpression(container, []))]);
declar._blockHoist = true;
path.replaceWith(declar);
} else {
var retFunction = container.body.body[1].argument;
if (!asyncFnId) {
_babelHelperFunctionName2["default"]({
node: retFunction,
parent: path.parent,
scope: path.scope
});
}
if (!retFunction || retFunction.id || node.params.length) {
// we have an inferred function id or params so we need this wrapper
path.replaceWith(t.callExpression(container, []));
} else {
// we can omit this wrapper as the conditions it protects for do not apply
path.replaceWith(built);
}
}
}
exports["default"] = function (path, callId) {
var node = path.node;
if (node.generator) return;
path.traverse(awaitVisitor);
if (path.isClassMethod() || path.isObjectMethod()) {
return classOrObjectMethod(path, callId);
} else {
return plainFunction(path, callId);
}
};
module.exports = exports["default"];
/***/ },
/* 159 */
/*!****************************************************!*\
!*** ./~/babel-helper-replace-supers/lib/index.js ***!
\****************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _classCallCheck = __webpack_require__(/*! babel-runtime/helpers/class-call-check */ 5)["default"];
var _Symbol = __webpack_require__(/*! babel-runtime/core-js/symbol */ 16)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelHelperOptimiseCallExpression = __webpack_require__(/*! babel-helper-optimise-call-expression */ 156);
var _babelHelperOptimiseCallExpression2 = _interopRequireDefault(_babelHelperOptimiseCallExpression);
var _babelMessages = __webpack_require__(/*! babel-messages */ 19);
var messages = _interopRequireWildcard(_babelMessages);
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
// ✌️
var HARDCORE_THIS_REF = _Symbol();
function isIllegalBareSuper(node, parent) {
if (!t.isSuper(node)) return false;
if (t.isMemberExpression(parent, { computed: false })) return false;
if (t.isCallExpression(parent, { callee: node })) return false;
return true;
}
function isMemberExpressionSuper(node) {
return t.isMemberExpression(node) && t.isSuper(node.object);
}
var visitor = {
Function: function Function(path) {
if (!path.inShadow("this")) {
path.skip();
}
},
ReturnStatement: function ReturnStatement(path, state) {
if (!path.inShadow("this")) {
state.returns.push(path);
}
},
ThisExpression: function ThisExpression(path, state) {
if (!path.node[HARDCORE_THIS_REF]) {
state.thises.push(path);
}
},
enter: function enter(path, state) {
var callback = state.specHandle;
if (state.isLoose) callback = state.looseHandle;
var isBareSuper = path.isCallExpression() && path.get("callee").isSuper();
var result = callback.call(state, path);
if (result) {
state.hasSuper = true;
}
if (isBareSuper) {
state.bareSupers.push(path);
}
if (result === true) {
path.requeue();
}
if (result !== true && result) {
if (Array.isArray(result)) {
path.replaceWithMultiple(result);
} else {
path.replaceWith(result);
}
}
}
};
var ReplaceSupers = (function () {
function ReplaceSupers(opts) {
var inClass = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
_classCallCheck(this, ReplaceSupers);
this.forceSuperMemoisation = opts.forceSuperMemoisation;
this.methodPath = opts.methodPath;
this.methodNode = opts.methodNode;
this.superRef = opts.superRef;
this.isStatic = opts.isStatic;
this.hasSuper = false;
this.inClass = inClass;
this.isLoose = opts.isLoose;
this.scope = this.methodPath.scope;
this.file = opts.file;
this.opts = opts;
this.bareSupers = [];
this.returns = [];
this.thises = [];
}
ReplaceSupers.prototype.getObjectRef = function getObjectRef() {
return this.opts.objectRef || this.opts.getObjectRef();
};
/**
* Sets a super class value of the named property.
*
* @example
*
* _set(Object.getPrototypeOf(CLASS.prototype), "METHOD", "VALUE", this)
*
*/
ReplaceSupers.prototype.setSuperProperty = function setSuperProperty(property, value, isComputed) {
return t.callExpression(this.file.addHelper("set"), [t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")), [this.isStatic ? this.getObjectRef() : t.memberExpression(this.getObjectRef(), t.identifier("prototype"))]), isComputed ? property : t.stringLiteral(property.name), value, t.thisExpression()]);
};
/**
* Gets a node representing the super class value of the named property.
*
* @example
*
* _get(Object.getPrototypeOf(CLASS.prototype), "METHOD", this)
*
*/
ReplaceSupers.prototype.getSuperProperty = function getSuperProperty(property, isComputed) {
return t.callExpression(this.file.addHelper("get"), [t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")), [this.isStatic ? this.getObjectRef() : t.memberExpression(this.getObjectRef(), t.identifier("prototype"))]), isComputed ? property : t.stringLiteral(property.name), t.thisExpression()]);
};
ReplaceSupers.prototype.replace = function replace() {
this.methodPath.traverse(visitor, this);
};
ReplaceSupers.prototype.getLooseSuperProperty = function getLooseSuperProperty(id, parent) {
var methodNode = this.methodNode;
var superRef = this.superRef || t.identifier("Function");
if (parent.property === id) {
return;
} else if (t.isCallExpression(parent, { callee: id })) {
return;
} else if (t.isMemberExpression(parent) && !methodNode["static"]) {
// super.test -> objectRef.prototype.test
return t.memberExpression(superRef, t.identifier("prototype"));
} else {
return superRef;
}
};
ReplaceSupers.prototype.looseHandle = function looseHandle(path) {
var node = path.node;
if (path.isSuper()) {
return this.getLooseSuperProperty(node, path.parent);
} else if (path.isCallExpression()) {
var callee = node.callee;
if (!t.isMemberExpression(callee)) return;
if (!t.isSuper(callee.object)) return;
// super.test(); -> objectRef.prototype.MethodName.call(this);
t.appendToMemberExpression(callee, t.identifier("call"));
node.arguments.unshift(t.thisExpression());
return true;
}
};
ReplaceSupers.prototype.specHandleAssignmentExpression = function specHandleAssignmentExpression(ref, path, node) {
if (node.operator === "=") {
// super.name = "val"; -> _set(Object.getPrototypeOf(objectRef.prototype), "name", this);
return this.setSuperProperty(node.left.property, node.right, node.left.computed);
} else {
// super.age += 2; -> let _ref = super.age; super.age = _ref + 2;
ref = ref || path.scope.generateUidIdentifier("ref");
return [t.variableDeclaration("var", [t.variableDeclarator(ref, node.left)]), t.expressionStatement(t.assignmentExpression("=", node.left, t.binaryExpression(node.operator[0], ref, node.right)))];
}
};
ReplaceSupers.prototype.specHandle = function specHandle(path) {
var property = undefined;
var computed = undefined;
var args = undefined;
var thisReference = undefined;
var parent = path.parent;
var node = path.node;
if (isIllegalBareSuper(node, parent)) {
throw path.buildCodeFrameError(messages.get("classesIllegalBareSuper"));
}
if (t.isCallExpression(node)) {
var callee = node.callee;
if (t.isSuper(callee)) {
return;
} else if (isMemberExpressionSuper(callee)) {
// super.test(); -> _get(Object.getPrototypeOf(objectRef.prototype), "test", this).call(this);
property = callee.property;
computed = callee.computed;
args = node.arguments;
}
} else if (t.isMemberExpression(node) && t.isSuper(node.object)) {
// super.name; -> _get(Object.getPrototypeOf(objectRef.prototype), "name", this);
property = node.property;
computed = node.computed;
} else if (t.isUpdateExpression(node) && isMemberExpressionSuper(node.argument)) {
var binary = t.binaryExpression(node.operator[0], node.argument, t.numericLiteral(1));
if (node.prefix) {
// ++super.foo; -> super.foo += 1;
return this.specHandleAssignmentExpression(null, path, binary);
} else {
// super.foo++; -> let _ref = super.foo; super.foo = _ref + 1;
var ref = path.scope.generateUidIdentifier("ref");
return this.specHandleAssignmentExpression(ref, path, binary).concat(t.expressionStatement(ref));
}
} else if (t.isAssignmentExpression(node) && isMemberExpressionSuper(node.left)) {
return this.specHandleAssignmentExpression(null, path, node);
}
if (!property) return;
var superProperty = this.getSuperProperty(property, computed, thisReference);
if (args) {
return this.optimiseCall(superProperty, args);
} else {
return superProperty;
}
};
ReplaceSupers.prototype.optimiseCall = function optimiseCall(callee, args) {
var thisNode = t.thisExpression();
thisNode[HARDCORE_THIS_REF] = true;
return _babelHelperOptimiseCallExpression2["default"](callee, thisNode, args);
};
return ReplaceSupers;
})();
exports["default"] = ReplaceSupers;
module.exports = exports["default"];
/***/ },
/* 160 */
/*!**************************************!*\
!*** ./~/babel-helpers/lib/index.js ***!
\**************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint no-confusing-arrow: 0 */
"use strict";
var _Object$keys = __webpack_require__(/*! babel-runtime/core-js/object/keys */ 14)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
exports.get = get;
var _helpers = __webpack_require__(/*! ./helpers */ 299);
var _helpers2 = _interopRequireDefault(_helpers);
function get(name) {
var fn = _helpers2["default"][name];
if (!fn) throw new ReferenceError("Unknown helper " + name);
return fn().expression;
}
var list = _Object$keys(_helpers2["default"]).map(function (name) {
return name[0] === "_" ? name.slice(1) : name;
}).filter(function (name) {
return name !== "__esModule";
});
exports.list = list;
exports["default"] = get;
/***/ },
/* 161 */
/*!*******************************************************************!*\
!*** ./~/babel-plugin-syntax-class-constructor-call/lib/index.js ***!
\*******************************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("classConstructorCall");
}
};
};
module.exports = exports["default"];
/***/ },
/* 162 */
/*!*************************************************************!*\
!*** ./~/babel-plugin-syntax-class-properties/lib/index.js ***!
\*************************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("classProperties");
}
};
};
module.exports = exports["default"];
/***/ },
/* 163 */
/*!***********************************************************!*\
!*** ./~/babel-plugin-syntax-do-expressions/lib/index.js ***!
\***********************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("doExpressions");
}
};
};
module.exports = exports["default"];
/***/ },
/* 164 */
/*!********************************************************************!*\
!*** ./~/babel-plugin-syntax-exponentiation-operator/lib/index.js ***!
\********************************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("exponentiationOperator");
}
};
};
module.exports = exports["default"];
/***/ },
/* 165 */
/*!**************************************************************!*\
!*** ./~/babel-plugin-syntax-export-extensions/lib/index.js ***!
\**************************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("exportExtensions");
}
};
};
module.exports = exports["default"];
/***/ },
/* 166 */
/*!**********************************************************!*\
!*** ./~/babel-plugin-syntax-function-bind/lib/index.js ***!
\**********************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("functionBind");
}
};
};
module.exports = exports["default"];
/***/ },
/* 167 */
/*!***************************************************************!*\
!*** ./~/babel-plugin-syntax-object-rest-spread/lib/index.js ***!
\***************************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("objectRestSpread");
}
};
};
module.exports = exports["default"];
/***/ },
/* 168 */
/*!*********************************************************************!*\
!*** ./~/babel-plugin-syntax-trailing-function-commas/lib/index.js ***!
\*********************************************************************/
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("trailingFunctionCommas");
}
};
};
module.exports = exports["default"];
/***/ },
/* 169 */
/*!******************************************************************!*\
!*** ./~/babel-plugin-transform-async-to-generator/lib/index.js ***!
\******************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
var _babelHelperRemapAsyncToGenerator = __webpack_require__(/*! babel-helper-remap-async-to-generator */ 158);
var _babelHelperRemapAsyncToGenerator2 = _interopRequireDefault(_babelHelperRemapAsyncToGenerator);
exports["default"] = function () {
return {
inherits: __webpack_require__(/*! babel-plugin-syntax-async-functions */ 74),
visitor: {
Function: function Function(path, state) {
if (!path.node.async || path.node.generator) return;
_babelHelperRemapAsyncToGenerator2["default"](path, state.addHelper("asyncToGenerator"));
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 170 */
/*!**********************************************************************!*\
!*** ./~/babel-plugin-transform-class-constructor-call/lib/index.js ***!
\**********************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _Symbol = __webpack_require__(/*! babel-runtime/core-js/symbol */ 16)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
var _babelTemplate = __webpack_require__(/*! babel-template */ 9);
var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
var buildWrapper = _babelTemplate2["default"]("\n let CLASS_REF = CLASS;\n var CALL_REF = CALL;\n var WRAPPER_REF = function (...args) {\n if (this instanceof WRAPPER_REF) {\n return Reflect.construct(CLASS_REF, args);\n } else {\n return CALL_REF.apply(this, args);\n }\n };\n WRAPPER_REF.__proto__ = CLASS_REF;\n WRAPPER_REF;\n");
exports["default"] = function (_ref) {
var t = _ref.types;
var ALREADY_VISITED = _Symbol();
function findConstructorCall(path) {
var methods = path.get("body.body");
for (var _i = 0; _i < methods.length; _i++) {
var method = methods[_i];
if (method.node.kind === "constructorCall") {
return method;
}
}
return null;
}
function handleClassWithCall(constructorCall, classPath) {
var _classPath = classPath;
var node = _classPath.node;
var ref = node.id || classPath.scope.generateUidIdentifier("class");
if (classPath.parentPath.isExportDefaultDeclaration()) {
classPath = classPath.parentPath;
classPath.insertAfter(t.exportDefaultDeclaration(ref));
}
classPath.replaceWithMultiple(buildWrapper({
CLASS_REF: classPath.scope.generateUidIdentifier(ref.name),
CALL_REF: classPath.scope.generateUidIdentifier(ref.name + "Call"),
CALL: t.functionExpression(null, constructorCall.node.params, constructorCall.node.body),
CLASS: t.toExpression(node),
WRAPPER_REF: ref
}));
constructorCall.remove();
}
return {
inherits: __webpack_require__(/*! babel-plugin-syntax-class-constructor-call */ 161),
visitor: {
Class: function Class(path) {
if (path.node[ALREADY_VISITED]) return;
path.node[ALREADY_VISITED] = true;
var constructorCall = findConstructorCall(path);
if (constructorCall) {
handleClassWithCall(constructorCall, path);
} else {
return;
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 171 */
/*!****************************************************************!*\
!*** ./~/babel-plugin-transform-class-properties/lib/index.js ***!
\****************************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _getIterator = __webpack_require__(/*! babel-runtime/core-js/get-iterator */ 4)["default"];
exports.__esModule = true;
exports["default"] = function (_ref2) {
var t = _ref2.types;
var findBareSupers = {
Super: function Super(path) {
if (path.parentPath.isCallExpression({ callee: path.node })) {
this.push(path.parentPath);
}
}
};
var referenceVisitor = {
ReferencedIdentifier: function ReferencedIdentifier(path) {
if (this.scope.hasOwnBinding(path.node.name)) {
this.collision = true;
path.skip();
}
}
};
return {
inherits: __webpack_require__(/*! babel-plugin-syntax-class-properties */ 162),
visitor: {
Class: function Class(path) {
var isDerived = !!path.node.superClass;
var constructor = undefined;
var props = [];
var body = path.get("body");
for (var _iterator = body.get("body"), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var _path = _ref;
if (_path.isClassProperty()) {
props.push(_path);
} else if (_path.isClassMethod({ kind: "constructor" })) {
constructor = _path;
}
}
if (!props.length) return;
var nodes = [];
var ref = undefined;
if (path.isClassExpression() || !path.node.id) {
ref = path.scope.generateUidIdentifier("class");
} else {
// path.isClassDeclaration() && path.node.id
ref = path.node.id;
}
var instanceBody = [];
for (var _i2 = 0; _i2 < props.length; _i2++) {
var prop = props[_i2];
var propNode = prop.node;
if (propNode.decorators && propNode.decorators.length > 0) continue;
if (!propNode.value) continue;
var isStatic = propNode["static"];
if (isStatic) {
nodes.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(ref, propNode.key), propNode.value)));
} else {
instanceBody.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(t.thisExpression(), propNode.key), propNode.value)));
}
}
if (instanceBody.length) {
if (!constructor) {
var newConstructor = t.classMethod("constructor", t.identifier("constructor"), [], t.blockStatement([]));
if (isDerived) {
newConstructor.params = [t.restElement(t.identifier("args"))];
newConstructor.body.body.push(t.returnStatement(t.callExpression(t["super"](), [t.spreadElement(t.identifier("args"))])));
}
var _body$unshiftContainer = body.unshiftContainer("body", newConstructor);
constructor = _body$unshiftContainer[0];
}
var collisionState = {
collision: false,
scope: constructor.scope
};
for (var _i3 = 0; _i3 < props.length; _i3++) {
var prop = props[_i3];
prop.traverse(referenceVisitor, collisionState);
if (collisionState.collision) break;
}
if (collisionState.collision) {
var initialisePropsRef = path.scope.generateUidIdentifier("initialiseProps");
nodes.push(t.variableDeclaration("var", [t.variableDeclarator(initialisePropsRef, t.functionExpression(null, [], t.blockStatement(instanceBody)))]));
instanceBody = [t.expressionStatement(t.callExpression(t.memberExpression(initialisePropsRef, t.identifier("call")), [t.thisExpression()]))];
}
//
if (isDerived) {
var bareSupers = [];
constructor.traverse(findBareSupers, bareSupers);
for (var _i4 = 0; _i4 < bareSupers.length; _i4++) {
var bareSuper = bareSupers[_i4];
bareSuper.insertAfter(instanceBody);
}
} else {
constructor.get("body").unshiftContainer("body", instanceBody);
}
}
for (var _i5 = 0; _i5 < props.length; _i5++) {
var prop = props[_i5];
prop.remove();
}
if (!nodes.length) return;
if (path.isClassExpression()) {
path.scope.push({ id: ref });
path.replaceWith(t.assignmentExpression("=", ref, path.node));
} else {
// path.isClassDeclaration()
if (!path.node.id) {
path.node.id = ref;
}
if (path.parentPath.isExportDeclaration()) {
path = path.parentPath;
}
}
path.insertAfter(nodes);
}
}
};
};
module.exports = exports["default"];
// todo: define instead of assign
/***/ },
/* 172 */
/*!**********************************************************!*\
!*** ./~/babel-plugin-transform-decorators/lib/index.js ***!
\**********************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _getIterator = __webpack_require__(/*! babel-runtime/core-js/get-iterator */ 4)["default"];
var _Object$create = __webpack_require__(/*! babel-runtime/core-js/object/create */ 10)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
var _babelTemplate = __webpack_require__(/*! babel-template */ 9);
var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
var _babelHelperExplodeClass = __webpack_require__(/*! babel-helper-explode-class */ 298);
var _babelHelperExplodeClass2 = _interopRequireDefault(_babelHelperExplodeClass);
var buildClassDecorator = _babelTemplate2["default"]("\n CLASS_REF = DECORATOR(CLASS_REF) || CLASS_REF;\n");
exports["default"] = function (_ref3) {
var t = _ref3.types;
function cleanDecorators(decorators) {
return decorators.reverse().map(function (dec) {
return dec.expression;
});
}
function transformClass(path, ref, state) {
var nodes = [];
state;
var classDecorators = path.node.decorators;
if (classDecorators) {
path.node.decorators = null;
classDecorators = cleanDecorators(classDecorators);
for (var _iterator = classDecorators, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var decorator = _ref;
nodes.push(buildClassDecorator({
CLASS_REF: ref,
DECORATOR: decorator
}));
}
}
var map = _Object$create(null);
for (var _iterator2 = path.get("body.body"), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _getIterator(_iterator2);;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var method = _ref2;
var decorators = method.node.decorators;
if (!decorators) continue;
var alias = t.toKeyAlias(method.node);
map[alias] = map[alias] || [];
map[alias].push(method.node);
method.remove();
}
for (var alias in map) {
var items = map[alias];
items;
}
return nodes;
}
function hasDecorators(path) {
if (path.isClass()) {
if (path.node.decorators) return true;
var _arr = path.node.body.body;
for (var _i3 = 0; _i3 < _arr.length; _i3++) {
var method = _arr[_i3];
if (method.decorators) {
return true;
}
}
} else if (path.isObjectExpression()) {
var _arr2 = path.node.properties;
for (var _i4 = 0; _i4 < _arr2.length; _i4++) {
var prop = _arr2[_i4];
if (prop.decorators) {
return true;
}
}
}
return false;
}
function doError(path) {
throw path.buildCodeFrameError("Decorators are not supported yet in 6.x pending proposal update.");
}
return {
inherits: __webpack_require__(/*! babel-plugin-syntax-decorators */ 110),
visitor: {
ClassExpression: function ClassExpression(path) {
if (!hasDecorators(path)) return;
doError(path);
_babelHelperExplodeClass2["default"](path);
var ref = path.scope.generateDeclaredUidIdentifier("ref");
var nodes = [];
nodes.push(t.assignmentExpression("=", ref, path.node));
nodes = nodes.concat(transformClass(path, ref, this));
nodes.push(ref);
path.replaceWith(t.sequenceExpression(nodes));
},
ClassDeclaration: function ClassDeclaration(path) {
if (!hasDecorators(path)) return;
doError(path);
_babelHelperExplodeClass2["default"](path);
var ref = path.node.id;
var nodes = [];
nodes = nodes.concat(transformClass(path, ref, this).map(function (expr) {
return t.expressionStatement(expr);
}));
nodes.push(t.expressionStatement(ref));
path.insertAfter(nodes);
},
ObjectExpression: function ObjectExpression(path) {
if (!hasDecorators(path)) return;
doError(path);
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 173 */
/*!**************************************************************!*\
!*** ./~/babel-plugin-transform-do-expressions/lib/index.js ***!
\**************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports["default"] = function () {
return {
inherits: __webpack_require__(/*! babel-plugin-syntax-do-expressions */ 163),
visitor: {
DoExpression: function DoExpression(path) {
var body = path.node.body.body;
if (body.length) {
path.replaceWithMultiple(body);
} else {
path.replaceWith(path.scope.buildUndefinedNode());
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 174 */
/*!****************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-classes/lib/vanilla.js ***!
\****************************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
var _classCallCheck = __webpack_require__(/*! babel-runtime/helpers/class-call-check */ 5)["default"];
var _getIterator = __webpack_require__(/*! babel-runtime/core-js/get-iterator */ 4)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelTraverse = __webpack_require__(/*! babel-traverse */ 6);
var _babelHelperReplaceSupers = __webpack_require__(/*! babel-helper-replace-supers */ 159);
var _babelHelperReplaceSupers2 = _interopRequireDefault(_babelHelperReplaceSupers);
var _babelHelperOptimiseCallExpression = __webpack_require__(/*! babel-helper-optimise-call-expression */ 156);
var _babelHelperOptimiseCallExpression2 = _interopRequireDefault(_babelHelperOptimiseCallExpression);
var _babelHelperDefineMap = __webpack_require__(/*! babel-helper-define-map */ 153);
var defineMap = _interopRequireWildcard(_babelHelperDefineMap);
var _babelTemplate = __webpack_require__(/*! babel-template */ 9);
var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
var _babelTypes = __webpack_require__(/*! babel-types */ 20);
var t = _interopRequireWildcard(_babelTypes);
var buildDerivedConstructor = _babelTemplate2["default"]("\n (function () {\n super(...arguments);\n })\n");
var noMethodVisitor = {
"FunctionExpression|FunctionDeclaration": function FunctionExpressionFunctionDeclaration(path) {
if (!path.is("shadow")) {
path.skip();
}
},
Method: function Method(path) {
path.skip();
}
};
var verifyConstructorVisitor = _babelTraverse.visitors.merge([noMethodVisitor, {
Super: function Super(path) {
if (this.isDerived && !this.hasBareSuper && !path.parentPath.isCallExpression({ callee: path.node })) {
throw path.buildCodeFrameError("'super.*' is not allowed before super()");
}
},
CallExpression: {
exit: function exit(path) {
if (path.get("callee").isSuper()) {
this.hasBareSuper = true;
if (!this.isDerived) {
throw path.buildCodeFrameError("super() is only allowed in a derived constructor");
}
}
}
},
ThisExpression: function ThisExpression(path) {
if (this.isDerived && !this.hasBareSuper) {
if (!path.inShadow("this")) {
throw path.buildCodeFrameError("'this' is not allowed before super()");
}
}
}
}]);
var findThisesVisitor = _babelTraverse.visitors.merge([noMethodVisitor, {
ThisExpression: function ThisExpression(path) {
this.superThises.push(path);
}
}]);
var ClassTransformer = (function () {
function ClassTransformer(path, file) {
_classCallCheck(this, ClassTransformer);
this.parent = path.parent;
this.scope = path.scope;
this.node = path.node;
this.path = path;
this.file = file;
this.clearDescriptors();
this.instancePropBody = [];
this.instancePropRefs = {};
this.staticPropBody = [];
this.body = [];
this.bareSuperAfter = [];
this.bareSupers = [];
this.pushedConstructor = false;
this.pushedInherits = false;
this.isLoose = false;
this.superThises = [];
// class id
this.classId = this.node.id;
// this is the name of the binding that will **always** reference the class we've constructed
this.classRef = this.node.id ? t.identifier(this.node.id.name) : this.scope.generateUidIdentifier("class");
this.superName = this.node.superClass || t.identifier("Function");
this.isDerived = !!this.node.superClass;
}
ClassTransformer.prototype.run = function run() {
// istanbul ignore next
var _this = this;
var superName = this.superName;
var file = this.file;
var body = this.body;
//
var constructorBody = this.constructorBody = t.blockStatement([]);
this.constructor = this.buildConstructor();
//
var closureParams = [];
var closureArgs = [];
//
if (this.isDerived) {
closureArgs.push(superName);
superName = this.scope.generateUidIdentifierBasedOnNode(superName);
closureParams.push(superName);
this.superName = superName;
}
//
this.buildBody();
// make sure this class isn't directly called
constructorBody.body.unshift(t.expressionStatement(t.callExpression(file.addHelper("classCallCheck"), [t.thisExpression(), this.classRef])));
body = body.concat(this.staticPropBody.map(function (fn) {
return fn(_this.classRef);
}));
if (this.classId) {
// named class with only a constructor
if (body.length === 1) return t.toExpression(body[0]);
}
//
body.push(t.returnStatement(this.classRef));
var container = t.functionExpression(null, closureParams, t.blockStatement(body));
container.shadow = true;
return t.callExpression(container, closureArgs);
};
ClassTransformer.prototype.buildConstructor = function buildConstructor() {
var func = t.functionDeclaration(this.classRef, [], this.constructorBody);
t.inherits(func, this.node);
return func;
};
ClassTransformer.prototype.pushToMap = function pushToMap(node, enumerable, kind, scope) {
if (kind === undefined) kind = "value";
var mutatorMap = undefined;
if (node["static"]) {
this.hasStaticDescriptors = true;
mutatorMap = this.staticMutatorMap;
} else {
this.hasInstanceDescriptors = true;
mutatorMap = this.instanceMutatorMap;
}
var map = defineMap.push(mutatorMap, node, kind, this.file, scope);
if (enumerable) {
map.enumerable = t.booleanLiteral(true);
}
return map;
};
/**
* [Please add a description.]
* https://www.youtube.com/watch?v=fWNaR-rxAic
*/
ClassTransformer.prototype.constructorMeMaybe = function constructorMeMaybe() {
var hasConstructor = false;
var paths = this.path.get("body.body");
var _arr = paths;
for (var _i = 0; _i < _arr.length; _i++) {
var path = _arr[_i];
hasConstructor = path.equals("kind", "constructor");
if (hasConstructor) break;
}
if (hasConstructor) return;
var params = undefined,
body = undefined;
if (this.isDerived) {
var _constructor = buildDerivedConstructor().expression;
params = _constructor.params;
body = _constructor.body;
} else {
params = [];
body = t.blockStatement([]);
}
this.path.get("body").unshiftContainer("body", t.classMethod("constructor", t.identifier("constructor"), params, body));
};
ClassTransformer.prototype.buildBody = function buildBody() {
this.constructorMeMaybe();
this.pushBody();
this.verifyConstructor();
if (this.userConstructor) {
var constructorBody = this.constructorBody;
constructorBody.body = constructorBody.body.concat(this.userConstructor.body.body);
t.inherits(this.constructor, this.userConstructor);
t.inherits(constructorBody, this.userConstructor.body);
}
this.pushDescriptors();
};
ClassTransformer.prototype.pushBody = function pushBody() {
var classBodyPaths = this.path.get("body.body");
for (var _i2 = 0; _i2 < classBodyPaths.length; _i2++) {
var path = classBodyPaths[_i2];
var node = path.node;
if (path.isClassProperty()) {
throw path.buildCodeFrameError("Missing class properties transform.");
}
if (node.decorators) {
throw path.buildCodeFrameError("Method has decorators, put the decorator plugin before the classes one.");
}
if (t.isClassMethod(node)) {
var isConstructor = node.kind === "constructor";
if (isConstructor) {
path.traverse(verifyConstructorVisitor, this);
if (!this.hasBareSuper && this.isDerived) {
throw path.buildCodeFrameError("missing super() call in constructor");
}
}
var replaceSupers = new _babelHelperReplaceSupers2["default"]({
forceSuperMemoisation: isConstructor,
methodPath: path,
methodNode: node,
objectRef: this.classRef,
superRef: this.superName,
isStatic: node["static"],
isLoose: this.isLoose,
scope: this.scope,
file: this.file
}, true);
replaceSupers.replace();
if (isConstructor) {
this.pushConstructor(replaceSupers, node, path);
} else {
this.pushMethod(node, path);
}
}
}
};
ClassTransformer.prototype.clearDescriptors = function clearDescriptors() {
this.hasInstanceDescriptors = false;
this.hasStaticDescriptors = false;
this.instanceMutatorMap = {};
this.staticMutatorMap = {};
};
ClassTransformer.prototype.pushDescriptors = function pushDescriptors() {
this.pushInherits();
var body = this.body;
var instanceProps = undefined;
var staticProps = undefined;
if (this.hasInstanceDescriptors) {
instanceProps = defineMap.toClassObject(this.instanceMutatorMap);
}
if (this.hasStaticDescriptors) {
staticProps = defineMap.toClassObject(this.staticMutatorMap);
}
if (instanceProps || staticProps) {
if (instanceProps) instanceProps = defineMap.toComputedObjectFromClass(instanceProps);
if (staticProps) staticProps = defineMap.toComputedObjectFromClass(staticProps);
var nullNode = t.nullLiteral();
// (Constructor, instanceDescriptors, staticDescriptors, instanceInitializers, staticInitializers)
var args = [this.classRef, nullNode, nullNode, nullNode, nullNode];
if (instanceProps) args[1] = instanceProps;
if (staticProps) args[2] = staticProps;
if (this.instanceInitializersId) {
args[3] = this.instanceInitializersId;
body.unshift(this.buildObjectAssignment(this.instanceInitializersId));
}
if (this.staticInitializersId) {
args[4] = this.staticInitializersId;
body.unshift(this.buildObjectAssignment(this.staticInitializersId));
}
var lastNonNullIndex = 0;
for (var i = 0; i < args.length; i++) {
if (args[i] !== nullNode) lastNonNullIndex = i;
}
args = args.slice(0, lastNonNullIndex + 1);
body.push(t.expressionStatement(t.callExpression(this.file.addHelper("createClass"), args)));
}
this.clearDescriptors();
};
ClassTransformer.prototype.buildObjectAssignment = function buildObjectAssignment(id) {
return t.variableDeclaration("var", [t.variableDeclarator(id, t.objectExpression([]))]);
};
ClassTransformer.prototype.wrapSuperCall = function wrapSuperCall(bareSuper, superRef, thisRef, body) {
var bareSuperNode = bareSuper.node;
if (this.isLoose) {
bareSuperNode.arguments.unshift(t.thisExpression());
if (bareSuperNode.arguments.length === 2 && t.isSpreadElement(bareSuperNode.arguments[1]) && t.isIdentifier(bareSuperNode.arguments[1].argument, { name: "arguments" })) {
// special case single arguments spread
bareSuperNode.arguments[1] = bareSuperNode.arguments[1].argument;
bareSuperNode.callee = t.memberExpression(superRef, t.identifier("apply"));
} else {
bareSuperNode.callee = t.memberExpression(superRef, t.identifier("call"));
}
} else {
bareSuperNode = _babelHelperOptimiseCallExpression2["default"](t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")), [this.classRef]), t.thisExpression(), bareSuperNode.arguments);
}
var call = t.callExpression(this.file.addHelper("possibleConstructorReturn"), [t.thisExpression(), bareSuperNode]);
var bareSuperAfter = this.bareSuperAfter.map(function (fn) {
return fn(thisRef);
});
if (bareSuper.parentPath.isExpressionStatement() && bareSuper.parentPath.container === body.node.body && body.node.body.length - 1 === bareSuper.parentPath.key) {
// this super call is the last statement in the body so we can just straight up
// turn it into a return
if (this.superThises.length || bareSuperAfter.length) {
bareSuper.scope.push({ id: thisRef });
call = t.assignmentExpression("=", thisRef, call);
}
if (bareSuperAfter.length) {
call = t.toSequenceExpression([call].concat(bareSuperAfter, [thisRef]));
}
bareSuper.parentPath.replaceWith(t.returnStatement(call));
} else {
bareSuper.replaceWithMultiple([t.variableDeclaration("var", [t.variableDeclarator(thisRef, call)])].concat(bareSuperAfter, [t.expressionStatement(thisRef)]));
}
};
ClassTransformer.prototype.verifyConstructor = function verifyConstructor() {
// istanbul ignore next
var _this2 = this;
if (!this.isDerived) return;
var path = this.userConstructorPath;
var body = path.get("body");
path.traverse(findThisesVisitor, this);
var guaranteedSuperBeforeFinish = !!this.bareSupers.length;
var superRef = this.superName || t.identifier("Function");
var thisRef = path.scope.generateUidIdentifier("this");
for (var _iterator = this.bareSupers, _isArray = Array.isArray(_iterator), _i3 = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) {
var _ref;
if (_isArray) {
if (_i3 >= _iterator.length) break;
_ref = _iterator[_i3++];
} else {
_i3 = _iterator.next();
if (_i3.done) break;
_ref = _i3.value;
}
var bareSuper = _ref;
this.wrapSuperCall(bareSuper, superRef, thisRef, body);
if (guaranteedSuperBeforeFinish) {
bareSuper.find(function (parentPath) {
// hit top so short circuit
if (parentPath === path) {
return true;
}
if (parentPath.isLoop() || parentPath.isConditional()) {
guaranteedSuperBeforeFinish = false;
return true;
}
});
}
}
for (var _iterator2 = this.superThises, _isArray2 = Array.isArray(_iterator2), _i4 = 0, _iterator2 = _isArray2 ? _iterator2 : _getIterator(_iterator2);;) {
var _ref2;
if (_isArray2) {
if (_i4 >= _iterator2.length) break;
_ref2 = _iterator2[_i4++];
} else {
_i4 = _iterator2.next();
if (_i4.done) break;
_ref2 = _i4.value;
}
var thisPath = _ref2;
thisPath.replaceWith(thisRef);
}
var wrapReturn = function wrapReturn(returnArg) {
return t.callExpression(_this2.file.addHelper("possibleConstructorReturn"), [thisRef].concat(returnArg || []));
};
// if we have a return as the last node in the body then we've already caught that
// return
var bodyPaths = body.get("body");
if (bodyPaths.length && !bodyPaths.pop().isReturnStatement()) {
body.pushContainer("body", t.returnStatement(guaranteedSuperBeforeFinish ? thisRef : wrapReturn()));
}
for (var _iterator3 = this.superReturns, _isArray3 = Array.isArray(_iterator3), _i5 = 0, _iterator3 = _isArray3 ? _iterator3 : _getIterator(_iterator3);;) {
var _ref3;
if (_isArray3) {
if (_i5 >= _iterator3.length) break;
_ref3 = _iterator3[_i5++];
} else {
_i5 = _iterator3.next();
if (_i5.done) break;
_ref3 = _i5.value;
}
var returnPath = _ref3;
if (returnPath.node.argument) {
var ref = returnPath.scope.generateDeclaredUidIdentifier("ret");
returnPath.get("argument").replaceWithMultiple([t.assignmentExpression("=", ref, returnPath.node.argument), wrapReturn(ref)]);
} else {
returnPath.get("argument").replaceWith(wrapReturn());
}
}
};
/**
* Push a method to its respective mutatorMap.
*/
ClassTransformer.prototype.pushMethod = function pushMethod(node, path) {
var scope = path ? path.scope : this.scope;
if (node.kind === "method") {
if (this._processMethod(node, scope)) return;
}
this.pushToMap(node, false, null, scope);
};
ClassTransformer.prototype._processMethod = function _processMethod() {
return false;
};
/**
* Replace the constructor body of our class.
*/
ClassTransformer.prototype.pushConstructor = function pushConstructor(replaceSupers, method, path) {
this.bareSupers = replaceSupers.bareSupers;
this.superReturns = replaceSupers.returns;
// https://github.com/babel/babel/issues/1077
if (path.scope.hasOwnBinding(this.classRef.name)) {
path.scope.rename(this.classRef.name);
}
var construct = this.constructor;
this.userConstructorPath = path;
this.userConstructor = method;
this.hasConstructor = true;
t.inheritsComments(construct, method);
construct._ignoreUserWhitespace = true;
construct.params = method.params;
t.inherits(construct.body, method.body);
construct.body.directives = method.body.directives;
// push constructor to body
this._pushConstructor();
};
ClassTransformer.prototype._pushConstructor = function _pushConstructor() {
if (this.pushedConstructor) return;
this.pushedConstructor = true;
// we haven't pushed any descriptors yet
if (this.hasInstanceDescriptors || this.hasStaticDescriptors) {
this.pushDescriptors();
}
this.body.push(this.constructor);
this.pushInherits();
};
/**
* Push inherits helper to body.
*/
ClassTransformer.prototype.pushInherits = function pushInherits() {
if (!this.isDerived || this.pushedInherits) return;
// Unshift to ensure that the constructor inheritance is set up before
// any properties can be assigned to the prototype.
this.pushedInherits = true;
this.body.unshift(t.expressionStatement(t.callExpression(this.file.addHelper("inherits"), [this.classRef, this.superName])));
};
return ClassTransformer;
})();
exports["default"] = ClassTransformer;
module.exports = exports["default"];
/***/ },
/* 175 */
/*!*********************************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-classes/~/babel-types/lib/retrievers.js ***!
\*********************************************************************************/
[550, 20],
/* 176 */
/*!******************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-modules-amd/lib/index.js ***!
\******************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _Object$create = __webpack_require__(/*! babel-runtime/core-js/object/create */ 10)["default"];
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
var _babelTemplate = __webpack_require__(/*! babel-template */ 9);
var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
var buildDefine = _babelTemplate2["default"]("\n define(MODULE_NAME, [SOURCES], FACTORY);\n");
var buildFactory = _babelTemplate2["default"]("\n (function (PARAMS) {\n BODY;\n })\n");
exports["default"] = function (_ref) {
var t = _ref.types;
function isValidRequireCall(path) {
if (!path.isCallExpression()) return false;
if (!path.get("callee").isIdentifier({ name: "require" })) return false;
if (path.scope.getBinding("require")) return false;
var args = path.get("arguments");
if (args.length !== 1) return false;
var arg = args[0];
if (!arg.isStringLiteral()) return false;
return true;
}
var amdVisitor = {
ReferencedIdentifier: function ReferencedIdentifier(_ref2) {
var node = _ref2.node;
var scope = _ref2.scope;
if (node.name === "exports" && !scope.getBinding("exports")) {
this.hasExports = true;
}
if (node.name === "module" && !scope.getBinding("module")) {
this.hasModule = true;
}
},
CallExpression: function CallExpression(path) {
if (!isValidRequireCall(path)) return;
this.bareSources.push(path.node.arguments[0]);
path.remove();
},
VariableDeclarator: function VariableDeclarator(path) {
var id = path.get("id");
if (!id.isIdentifier()) return;
var init = path.get("init");
if (!isValidRequireCall(init)) return;
var source = init.node.arguments[0];
this.sourceNames[source.value] = true;
this.sources.push([id.node, source]);
path.remove();
}
};
return {
inherits: __webpack_require__(/*! babel-plugin-transform-es2015-modules-commonjs */ 114),
pre: function pre() {
// source strings
this.sources = [];
this.sourceNames = _Object$create(null);
// bare sources
this.bareSources = [];
this.hasExports = false;
this.hasModule = false;
},
visitor: {
Program: {
exit: function exit(path) {
// istanbul ignore next
var _this = this;
if (this.ran) return;
this.ran = true;
path.traverse(amdVisitor, this);
var params = this.sources.map(function (source) {
return source[0];
});
var sources = this.sources.map(function (source) {
return source[1];
});
sources = sources.concat(this.bareSources.filter(function (str) {
return !_this.sourceNames[str.value];
}));
var moduleName = this.getModuleName();
if (moduleName) moduleName = t.stringLiteral(moduleName);
if (this.hasExports) {
sources.unshift(t.stringLiteral("exports"));
params.unshift(t.identifier("exports"));
}
if (this.hasModule) {
sources.unshift(t.stringLiteral("module"));
params.unshift(t.identifier("module"));
}
var node = path.node;
var factory = buildFactory({
PARAMS: params,
BODY: node.body
});
factory.expression.body.directives = node.directives;
node.directives = [];
node.body = [buildDefine({
MODULE_NAME: moduleName,
SOURCES: sources,
FACTORY: factory
})];
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 177 */
/*!******************************************************************************************!*\
!*** ./~/babel-plugin-transform-es2015-modules-commonjs/~/babel-types/lib/retrievers.js ***!
\******************************************************************************************/
[550, 27],
/* 178 */
/*!***********************************************************************!*\
!*** ./~/babel-plugin-transform-exponentiation-operator/lib/index.js ***!
\***********************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
var _babelHelperBuilderBinaryAssignmentOperatorVisitor = __webpack_require__(/*! babel-helper-builder-binary-assignment-operator-visitor */ 295);
var _babelHelperBuilderBinaryAssignmentOperatorVisitor2 = _interopRequireDefault(_babelHelperBuilderBinaryAssignmentOperatorVisitor);
exports["default"] = function (_ref) {
var t = _ref.types;
return {
inherits: __webpack_require__(/*! babel-plugin-syntax-exponentiation-operator */ 164),
visitor: _babelHelperBuilderBinaryAssignmentOperatorVisitor2["default"]({
operator: "**",
build: function build(left, right) {
return t.callExpression(t.memberExpression(t.identifier("Math"), t.identifier("pow")), [left, right]);
}
})
};
};
module.exports = exports["default"];
/***/ },
/* 179 */
/*!*****************************************************************!*\
!*** ./~/babel-plugin-transform-export-extensions/lib/index.js ***!
\*****************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports["default"] = function (_ref) {
var t = _ref.types;
function build(node, nodes, scope) {
var first = node.specifiers[0];
if (!t.isExportNamespaceSpecifier(first) && !t.isExportDefaultSpecifier(first)) return;
var specifier = node.specifiers.shift();
var uid = scope.generateUidIdentifier(specifier.exported.name);
var newSpecifier = undefined;
if (t.isExportNamespaceSpecifier(specifier)) {
newSpecifier = t.importNamespaceSpecifier(uid);
} else {
newSpecifier = t.importDefaultSpecifier(uid);
}
nodes.push(t.importDeclaration([newSpecifier], node.source));
nodes.push(t.exportNamedDeclaration(null, [t.exportSpecifier(uid, specifier.exported)]));
build(node, nodes, scope);
}
return {
inherits: __webpack_require__(/*! babel-plugin-syntax-export-extensions */ 165),
visitor: {
ExportNamedDeclaration: function ExportNamedDeclaration(path) {
var node = path.node;
var scope = path.scope;
var nodes = [];
build(node, nodes, scope);
if (!nodes.length) return;
if (node.specifiers.length >= 1) {
nodes.push(node);
}
path.replaceWithMultiple(nodes);
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 180 */
/*!****************************************************************!*\
!*** ./~/babel-plugin-transform-flow-strip-types/lib/index.js ***!
\****************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports["default"] = function (_ref) {
var t = _ref.types;
var FLOW_DIRECTIVE = "@flow";
return {
inherits: __webpack_require__(/*! babel-plugin-syntax-flow */ 111),
visitor: {
Program: function Program(path, _ref2) {
var comments = _ref2.file.ast.comments;
var _arr = comments;
for (var _i = 0; _i < _arr.length; _i++) {
var comment = _arr[_i];
if (comment.value.indexOf(FLOW_DIRECTIVE) >= 0) {
// remove flow directive
comment.value = comment.value.replace(FLOW_DIRECTIVE, "");
// remove the comment completely if it only consists of whitespace and/or stars
if (!comment.value.replace(/\*/g, "").trim()) comment.ignore = true;
}
}
},
Flow: function Flow(path) {
path.remove();
},
ClassProperty: function ClassProperty(path) {
path.node.typeAnnotation = null;
if (!path.node.value) path.remove();
},
Class: function Class(_ref3) {
var node = _ref3.node;
node["implements"] = null;
},
Function: function Function(_ref4) {
var node = _ref4.node;
for (var i = 0; i < node.params.length; i++) {
var param = node.params[i];
param.optional = false;
}
},
TypeCastExpression: function TypeCastExpression(path) {
var node = path.node;
do {
node = node.expression;
} while (t.isTypeCastExpression(node));
path.replaceWith(node);
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 181 */
/*!*************************************************************!*\
!*** ./~/babel-plugin-transform-function-bind/lib/index.js ***!
\*************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports["default"] = function (_ref) {
var t = _ref.types;
function getTempId(scope) {
var id = scope.path.getData("functionBind");
if (id) return id;
id = scope.generateDeclaredUidIdentifier("context");
return scope.path.setData("functionBind", id);
}
function getStaticContext(bind, scope) {
var object = bind.object || bind.callee.object;
return scope.isStatic(object) && object;
}
function inferBindContext(bind, scope) {
var staticContext = getStaticContext(bind, scope);
if (staticContext) return staticContext;
var tempId = getTempId(scope);
if (bind.object) {
bind.callee = t.sequenceExpression([t.assignmentExpression("=", tempId, bind.object), bind.callee]);
} else {
bind.callee.object = t.assignmentExpression("=", tempId, bind.callee.object);
}
return tempId;
}
return {
inherits: __webpack_require__(/*! babel-plugin-syntax-function-bind */ 166),
visitor: {
CallExpression: function CallExpression(_ref2) {
var node = _ref2.node;
var scope = _ref2.scope;
var bind = node.callee;
if (!t.isBindExpression(bind)) return;
var context = inferBindContext(bind, scope);
node.callee = t.memberExpression(bind.callee, t.identifier("call"));
node.arguments.unshift(context);
},
BindExpression: function BindExpression(path) {
var node = path.node;
var scope = path.scope;
var context = inferBindContext(node, scope);
path.replaceWith(t.callExpression(t.memberExpression(node.callee, t.identifier("bind")), [context]));
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 182 */
/*!******************************************************************!*\
!*** ./~/babel-plugin-transform-object-rest-spread/lib/index.js ***!
\******************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports["default"] = function (_ref) {
var t = _ref.types;
function hasSpread(node) {
var _arr = node.properties;
for (var _i = 0; _i < _arr.length; _i++) {
var prop = _arr[_i];
if (t.isSpreadProperty(prop)) {
return true;
}
}
return false;
}
return {
inherits: __webpack_require__(/*! babel-plugin-syntax-object-rest-spread */ 167),
visitor: {
ObjectExpression: function ObjectExpression(path, file) {
if (!hasSpread(path.node)) return;
var args = [];
var props = [];
function push() {
if (!props.length) return;
args.push(t.objectExpression(props));
props = [];
}
var _arr2 = path.node.properties;
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
var prop = _arr2[_i2];
if (t.isSpreadProperty(prop)) {
push();
args.push(prop.argument);
} else {
props.push(prop);
}
}
push();
if (!t.isObjectExpression(args[0])) {
args.unshift(t.objectExpression([]));
}
path.replaceWith(t.callExpression(file.addHelper("extends"), args));
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 183 */
/*!******************************************************************!*\
!*** ./~/babel-plugin-transform-react-display-name/lib/index.js ***!
\******************************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
exports.__esModule = true;
var _path = __webpack_require__(/*! path */ 22);
var _path2 = _interopRequireDefault(_path);
exports["default"] = function (_ref) {
var t = _ref.types;
function addDisplayName(id, call) {
var props = call.arguments[0].properties;
var safe = true;
for (var i = 0; i < props.length; i++) {
var prop = props[i];
var key = t.toComputedKey(prop);
if (t.isLiteral(key, { value: "displayName" })) {
safe = false;
break;
}
}
if (safe) {
props.unshift(t.objectProperty(t.identifier("displayName"), t.stringLiteral(id)));
}
}
var isCreateClassCallExpression = t.buildMatchMemberExpression("React.createClass");
function isCreateClass(node) {
if (!node || !t.isCallExpression(node)) return false;
// not React.createClass call member object
if (!isCreateClassCallExpression(node.callee)) return false;
// no call arguments
var args = node.arguments;
if (args.length !== 1) return false;
// first node arg is not an object
var first = args[0];
if (!t.isObjectExpression(first)) return false;
return true;
}
return {
visitor: {
ExportDefaultDeclaration: function ExportDefaultDeclaration(_ref2, state) {
var node = _ref2.node;
if (isCreateClass(node.declaration)) {
var displayName = state.file.opts.basename;
// ./{module name}/index.js
if (displayName === "index") {
displayName = _path2["default"].basename(_path2["default"].dirname(state.file.opts.filename));
}
addDisplayName(displayName, node.declaration);
}
},
CallExpression: function CallExpression(path) {
var node = path.node;
if (!isCreateClass(node)) return;
var id = undefined;
// crawl up the ancestry looking for possible candidates for displayName inference
path.find(function (path) {
if (path.isAssignmentExpression()) {
id = path.node.left;
} else if (path.isObjectProperty()) {
id = path.node.key;
} else if (path.isVariableDeclarator()) {
id = path.node.id;
} else if (path.isStatement()) {
// we've hit a statement, we should stop crawling up
return true;
}
// we've got an id! no need to continue
if (id) return true;
});
// ensure that we have an identifier we can inherit from
if (!id) return;
// foo.bar -> bar
if (t.isMemberExpression(id)) {
id = id.property;
}
// identifiers are the only thing we can reliably get a name from
if (t.isIdentifier(id)) {
addDisplayName(id.name, node);
}
}
}
};
};
module.exports = exports["default"];
/***/ },
/* 184 */
/*!*********************************************************!*\
!*** ./~/babel-plugin-transform-react-jsx/lib/index.js ***!
\*********************************************************/
/***/ function(module, exports, __webpack_require__) {
/* eslint max-len: 0 */
"use strict";
exports.__esModule = true;
exports["default"] = function (_ref) {
var t = _ref.types;
var JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;
var visitor = __webpack_require__(/*! babel-helper-builder-react-jsx */ 152)({
pre: function pre(state) {
var tagName = state.tagName;
var args = state.args;
if (t.react.isCompatTag(tagName)) {
args.push(t.stringLiteral(tagName));
} else {
args.push(state.tagExpr);
}
},
post: function post(state, pass) {
state.callee = pass.get("jsxIdentifier")();
}
});
visitor.Program = function (path, state) {
var file = state.file;
var id = state.opts.pragma || "React.createElement";
var _arr = file.ast.comments;
for (var _i = 0; _i < _arr.length; _i++) {
var comment = _arr[_i];
var matches = JSX_ANNOTATION_REGEX.exec(comment.value);
if (matches) {
id = matches[1];
if (id === "React.DOM") {
throw file.buildCodeFrameError(comment, "The @jsx React.DOM pragma has been deprecated as of React 0.12");
} else {
break;
}
}
}
state.set("jsxIdentifier", function () {
return id.split(".").map(function (name) {
return t.identifier(name);
}).reduce(function (object, property) {
return t.memberExpression(object, property);
});
});
};
return {
inherits: __webpack_require__(/*! babel-plugin-syntax-jsx */ 112),
visitor: visitor
};
};
module.exports = exports["default"];
/***/ },
/* 185 */
/*!**********************************************************!*\
!*** ./~/babel-plugin-transform-regenerator/lib/emit.js ***!
\**********************************************************/
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* https://raw.github.com/facebook/regenerator/master/LICENSE file. An
* additional grant of patent rights can be found in the PATENTS file in
* the same directory.
*/
"use strict";
var _interopRequireDefault = __webpack_require__(/*! babel-runtime/helpers/interop-require-default */ 1)["default"];
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
var _assert = __webpack_require__(/*! assert */ 71);
var _assert2 = _interopRequireDefault(_assert);
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
var _leap = __webpack_require__(/*! ./leap */ 355);
var leap = _interopRequireWildcard(_leap);
var _meta = __webpack_require__(/*! ./meta */ 356);
var meta = _interopRequireWildcard(_meta);
var _util = __webpack_require__(/*! ./util */ 186);
var util = _interopRequireWildcard(_util);
var hasOwn = Object.prototype.hasOwnProperty;
function Emitter(contextId) {
_assert2["default"].ok(this instanceof Emitter);
t.assertIdentifier(contextId);
// Used to generate unique temporary names.
this.nextTempId = 0;
// In order to make sure the context object does not collide with
// anything in the local scope, we might have to rename it, so we
// refer to it symbolically instead of just assuming that it will be
// called "context".
this.contextId = contextId;
// An append-only list of Statements that grows each time this.emit is
// called.
this.listing = [];
// A sparse array whose keys correspond to locations in this.listing
// that have been marked as branch/jump targets.
this.marked = [true];
// The last location will be marked when this.getDispatchLoop is
// called.
this.finalLoc = loc();
// A list of all leap.TryEntry statements emitted.
this.tryEntries = [];
// Each time we evaluate the body of a loop, we tell this.leapManager
// to enter a nested loop context that determines the meaning of break
// and continue statements therein.
this.leapManager = new leap.LeapManager(this);
}
var Ep = Emitter.prototype;
exports.Emitter = Emitter;
// Offsets into this.listing that could be used as targets for branches or
// jumps are represented as numeric Literal nodes. This representation has
// the amazingly convenient benefit of allowing the exact value of the
// location to be determined at any time, even after generating code that
// refers to the location.
function loc() {
return t.numericLiteral(-1);
}
// Sets the exact value of the given location to the offset of the next
// Statement emitted.
Ep.mark = function (loc) {
t.assertLiteral(loc);
var index = this.listing.length;
if (loc.value === -1) {
loc.value = index;
} else {
// Locations can be marked redundantly, but their values cannot change
// once set the first time.
_assert2["default"].strictEqual(loc.value, index);
}
this.marked[index] = true;
return loc;
};
Ep.emit = function (node) {
if (t.isExpression(node)) {
node = t.expressionStatement(node);
}
t.assertStatement(node);
this.listing.push(node);
};
// Shorthand for emitting assignment statements. This will come in handy
// for assignments to temporary variables.
Ep.emitAssign = function (lhs, rhs) {
this.emit(this.assign(lhs, rhs));
return lhs;
};
// Shorthand for an assignment statement.
Ep.assign = function (lhs, rhs) {
return t.expressionStatement(t.assignmentExpression("=", lhs, rhs));
};
// Convenience function for generating expressions like context.next,
// context.sent, and context.rval.
Ep.contextProperty = function (name, computed) {
return t.memberExpression(this.contextId, computed ? t.stringLiteral(name) : t.identifier(name), !!computed);
};
// Shorthand for setting context.rval and jumping to `context.stop()`.
Ep.stop = function (rval) {
if (rval) {
this.setReturnValue(rval);
}
this.jump(this.finalLoc);
};
Ep.setReturnValue = function (valuePath) {
t.assertExpression(valuePath.value);
this.emitAssign(this.contextProperty("rval"), this.explodeExpression(valuePath));
};
Ep.clearPendingException = function (tryLoc, assignee) {
t.assertLiteral(tryLoc);
var catchCall = t.callExpression(this.contextProperty("catch", true), [tryLoc]);
if (assignee) {
this.emitAssign(assignee, catchCall);
} else {
this.emit(catchCall);
}
};
// Emits code for an unconditional jump to the given location, even if the
// exact value of the location is not yet known.
Ep.jump = function (toLoc) {
this.emitAssign(this.contextProperty("next"), toLoc);
this.emit(t.breakStatement());
};
// Conditional jump.
Ep.jumpIf = function (test, toLoc) {
t.assertExpression(test);
t.assertLiteral(toLoc);
this.emit(t.ifStatement(test, t.blockStatement([this.assign(this.contextProperty("next"), toLoc), t.breakStatement()])));
};
// Conditional jump, with the condition negated.
Ep.jumpIfNot = function (test, toLoc) {
t.assertExpression(test);
t.assertLiteral(toLoc);
var negatedTest = undefined;
if (t.isUnaryExpression(test) && test.operator === "!") {
// Avoid double negation.
negatedTest = test.argument;
} else {
negatedTest = t.unaryExpression("!", test);
}
this.emit(t.ifStatement(negatedTest, t.blockStatement([this.assign(this.contextProperty("next"), toLoc), t.breakStatement()])));
};
// Returns a unique MemberExpression that can be used to store and
// retrieve temporary values. Since the object of the member expression is
// the context object, which is presumed to coexist peacefully with all
// other local variables, and since we just increment `nextTempId`
// monotonically, uniqueness is assured.
Ep.makeTempVar = function () {
return this.contextProperty("t" + this.nextTempId++);
};
Ep.getContextFunction = function (id) {
return t.functionExpression(id || null, /*Anonymous*/
[this.contextId], t.blockStatement([this.getDispatchLoop()]), false, // Not a generator anymore!
false // Nor an expression.
);
};
// Turns this.listing into a loop of the form
//
// while (1) switch (context.next) {
// case 0:
// ...
// case n:
// return context.stop();
// }
//
// Each marked location in this.listing will correspond to one generated
// case statement.
Ep.getDispatchLoop = function () {
var self = this;
var cases = [];
var current = undefined;
// If we encounter a break, continue, or return statement in a switch
// case, we can skip the rest of the statements until the next case.
var alreadyEnded = false;
self.listing.forEach(function (stmt, i) {
if (self.marked.hasOwnProperty(i)) {
cases.push(t.switchCase(t.numericLiteral(i), current = []));
alreadyEnded = false;
}
if (!alreadyEnded) {
current.push(stmt);
if (t.isCompletionStatement(stmt)) alreadyEnded = true;
}
});
// Now that we know how many statements there will be in this.listing,
// we can finally resolve this.finalLoc.value.
this.finalLoc.value = this.listing.length;
cases.push(t.switchCase(this.finalLoc, [
// Intentionally fall through to the "end" case...
]),
// So that the runtime can jump to the final location without having
// to know its offset, we provide the "end" case as a synonym.
t.switchCase(t.stringLiteral("end"), [
// This will check/clear both context.thrown and context.rval.
t.returnStatement(t.callExpression(this.contextProperty("stop"), []))]));
return t.whileStatement(t.numericLiteral(1), t.switchStatement(t.assignmentExpression("=", this.contextProperty("prev"), this.contextProperty("next")), cases));
};
Ep.getTryLocsList = function () {
if (this.tryEntries.length === 0) {
// To avoid adding a needless [] to the majority of runtime.wrap
// argument lists, force the caller to handle this case specially.
return null;
}
var lastLocValue = 0;
return t.arrayExpression(this.tryEntries.map(function (tryEntry) {
var thisLocValue = tryEntry.firstLoc.value;
_assert2["default"].ok(thisLocValue >= lastLocValue, "try entries out of order");
lastLocValue = thisLocValue;
var ce = tryEntry.catchEntry;
var fe = tryEntry.finallyEntry;
var locs = [tryEntry.firstLoc,
// The null here makes a hole in the array.
ce ? ce.firstLoc : null];
if (fe) {
locs[2] = fe.firstLoc;
locs[3] = fe.afterLoc;
}
return t.arrayExpression(locs);
}));
};
// All side effects must be realized in order.
// If any subexpression harbors a leap, all subexpressions must be
// neutered of side effects.
// No destructive modification of AST nodes.
Ep.explode = function (path, ignoreResult) {
var node = path.node;
var self = this;
t.assertNode(node);
if (t.isDeclaration(node)) throw getDeclError(node);
if (t.isStatement(node)) return self.explodeStatement(path);
if (t.isExpression(node)) return self.explodeExpression(path, ignoreResult);
switch (node.type) {
case "Program":
return path.get("body").map(self.explodeStatement, self);
case "VariableDeclarator":
throw getDeclError(node);
// These node types should be handled by their parent nodes
// (ObjectExpression, SwitchStatement, and TryStatement, respectively).
case "Property":
case "SwitchCase":
case "CatchClause":
throw new Error(node.type + " nodes should be handled by their parents");
default:
throw new Error("unknown Node of type " + JSON.stringify(node.type));
}
};
function getDeclError(node) {
return new Error("all declarations should have been transformed into " + "assignments before the Exploder began its work: " + JSON.stringify(node));
}
Ep.explodeStatement = function (path, labelId) {
var stmt = path.node;
var self = this;
var before = undefined,
after = undefined,
head = undefined;
t.assertStatement(stmt);
if (labelId) {
t.assertIdentifier(labelId);
} else {
labelId = null;
}
// Explode BlockStatement nodes even if they do not contain a yield,
// because we don't want or need the curly braces.
if (t.isBlockStatement(stmt)) {
path.get("body").forEach(function (path) {
self.explodeStatement(path);
});
return;
}
if (!meta.containsLeap(stmt)) {
// Technically we should be able to avoid emitting the statement
// altogether if !meta.hasSideEffects(stmt), but that leads to
// confusing generated code (for instance, `while (true) {}` just
// disappears) and is probably a more appropriate job for a dedicated
// dead code elimination pass.
self.emit(stmt);
return;
}
switch (stmt.type) {
case "ExpressionStatement":
self.explodeExpression(path.get("expression"), true);
break;
case "LabeledStatement":
after = loc();
// Did you know you can break from any labeled block statement or
// control structure? Well, you can! Note: when a labeled loop is
// encountered, the leap.LabeledEntry created here will immediately
// enclose a leap.LoopEntry on the leap manager's stack, and both
// entries will have the same label. Though this works just fine, it
// may seem a bit redundant. In theory, we could check here to
// determine if stmt knows how to handle its own label; for example,
// stmt happens to be a WhileStatement and so we know it's going to
// establish its own LoopEntry when we explode it (below). Then this
// LabeledEntry would be unnecessary. Alternatively, we might be
// tempted not to pass stmt.label down into self.explodeStatement,
// because we've handled the label here, but that's a mistake because
// labeled loops may contain labeled continue statements, which is not
// something we can handle in this generic case. All in all, I think a
// little redundancy greatly simplifies the logic of this case, since
// it's clear that we handle all possible LabeledStatements correctly
// here, regardless of whether they interact with the leap manager
// themselves. Also remember that labels and break/continue-to-label
// statements are rare, and all of this logic happens at transform
// time, so it has no additional runtime cost.
self.leapManager.withEntry(new leap.LabeledEntry(after, stmt.label), function () {
self.explodeStatement(path.get("body"), stmt.label);
});
self.mark(after);
break;
case "WhileStatement":
before = loc();
after = loc();
self.mark(before);
self.jumpIfNot(self.explodeExpression(path.get("test")), after);
self.leapManager.withEntry(new leap.LoopEntry(after, before, labelId), function () {
self.explodeStatement(path.get("body"));
});
self.jump(before);
self.mark(after);
break;
case "DoWhileStatement":
var first = loc();
var test = loc();
after = loc();
self.mark(first);
self.leapManager.withEntry(new leap.LoopEntry(after, test, labelId), function () {
self.explode(path.get("body"));
});
self.mark(test);
self.jumpIf(self.explodeExpression(path.get("test")), first);
self.mark(after);
break;
case "ForStatement":
head = loc();
var update = loc();
after = loc();
if (stmt.init) {
// We pass true here to indicate that if stmt.init is an expression
// then we do not care about its result.
self.explode(path.get("init"), true);
}
self.mark(head);
if (stmt.test) {
self.jumpIfNot(self.explodeExpression(path.get("test")), after);
} else {
// No test means continue unconditionally.
}
self.leapManager.withEntry(new leap.LoopEntry(after, update, labelId), function () {
self.explodeStatement(path.get("body"));
});
self.mark(update);
if (stmt.update) {
// We pass true here to indicate that if stmt.update is an
// expression then we do not care about its result.
self.explode(path.get("update"), true);
}
self.jump(head);
self.mark(after);
break;
case "TypeCastExpression":
return self.explodeExpression(path.get("expression"));
case "ForInStatement":
head = loc();
after = loc();
var keyIterNextFn = self.makeTempVar();
self.emitAssign(keyIterNextFn, t.callExpression(util.runtimeProperty("keys"), [self.explodeExpression(path.get("right"))]));
self.mark(head);
var keyInfoTmpVar = self.makeTempVar();
self.jumpIf(t.memberExpression(t.assignmentExpression("=", keyInfoTmpVar, t.callExpression(keyIterNextFn, [])), t.identifier("done"), false), after);
self.emitAssign(stmt.left, t.memberExpression(keyInfoTmpVar, t.identifier("value"), false));
self.leapManager.withEntry(new leap.LoopEntry(after, head, labelId), function () {
self.explodeStatement(path.get("body"));
});
self.jump(head);
self.mark(after);
break;
case "BreakStatement":
self.emitAbruptCompletion({
type: "break",
target: self.leapManager.getBreakLoc(stmt.label)
});
break;
case "ContinueStatement":
self.emitAbruptCompletion({
type: "continue",
target: self.leapManager.getContinueLoc(stmt.label)
});
break;
case "SwitchStatement":
// Always save the discriminant into a temporary variable in case the
// test expressions overwrite values like context.sent.
var disc = self.emitAssign(self.makeTempVar(), self.explodeExpression(path.get("discriminant")));
after = loc();
var defaultLoc = loc();
var condition = defaultLoc;
var caseLocs = [];
// If there are no cases, .cases might be undefined.
var cases = stmt.cases || [];
for (var i = cases.length - 1; i >= 0; --i) {
var c = cases[i];
t.assertSwitchCase(c);
if (c.test) {
condition = t.conditionalExpression(t.binaryExpression("===", disc, c.test), caseLocs[i] = loc(), condition);
} else {
caseLocs[i] = defaultLoc;
}
}
var discriminant = path.get("discriminant");
discriminant.replaceWith(condition);
self.jump(self.explodeExpression(discriminant));
self.leapManager.withEntry(new leap.SwitchEntry(after), function () {
path.get("cases").forEach(function (casePath) {
var i = casePath.key;
self.mark(caseLocs[i]);
casePath.get("consequent").forEach(function (path) {
self.explodeStatement(path);
});
});
});
self.mark(after);
if (defaultLoc.value === -1) {
self.mark(defaultLoc);
_assert2["default"].strictEqual(after.value, defaultLoc.value);
}
break;
case "IfStatement":
var elseLoc = stmt.alternate && loc();
after = loc();
self.jumpIfNot(self.explodeExpression(path.get("test")), elseLoc || after);
self.explodeStatement(path.get("consequent"));
if (elseLoc) {
self.jump(after);
self.mark(elseLoc);
self.explodeStatement(path.get("alternate"));
}
self.mark(after);
break;
case "ReturnStatement":
self.emitAbruptCompletion({
type: "return",
value: self.explodeExpression(path.get("argument"))
});
break;
case "WithStatement":
throw new Error("WithStatement not supported in generator functions.");
case "TryStatement":
after = loc();
var handler = stmt.handler;
var catchLoc = handler && loc();
var catchEntry = catchLoc && new leap.CatchEntry(catchLoc, handler.param);
var finallyLoc = stmt.finalizer && loc();
var finallyEntry = finallyLoc && new leap.FinallyEntry(finallyLoc, after);
var tryEntry = new leap.TryEntry(self.getUnmarkedCurrentLoc(), catchEntry, finallyEntry);
self.tryEntries.push(tryEntry);
self.updateContextPrevLoc(tryEntry.firstLoc);
self.leapManager.withEntry(tryEntry, function () {
self.explodeStatement(path.get("block"));
if (catchLoc) {
(function () {
if (finallyLoc) {
// If we have both a catch block and a finally block, then
// because we emit the catch block first, we need to jump over
// it to the finally block.
self.jump(finallyLoc);
} else {
// If there is no finally block, then we need to jump over the
// catch block to the fall-through location.
self.jump(after);
}
self.updateContextPrevLoc(self.mark(catchLoc));
var bodyPath = path.get("handler.body");
var safeParam = self.makeTempVar();
self.clearPendingException(tryEntry.firstLoc, safeParam);
bodyPath.traverse(catchParamVisitor, {
safeParam: safeParam,
catchParamName: handler.param.name
});
self.leapManager.withEntry(catchEntry, function () {
self.explodeStatement(bodyPath);
});
})();
}
if (finallyLoc) {
self.updateContextPrevLoc(self.mark(finallyLoc));
self.leapManager.withEntry(finallyEntry, function () {
self.explodeStatement(path.get("finalizer"));
});
self.emit(t.returnStatement(t.callExpression(self.contextProperty("finish"), [finallyEntry.firstLoc])));
}
});
self.mark(after);
break;
case "ThrowStatement":
self.emit(t.throwStatement(self.explodeExpression(path.get("argument"))));
break;
default:
throw new Error("unknown Statement of type " + JSON.stringify(stmt.type));
}
};
var catchParamVisitor = {
Identifier: function Identifier(path, state) {
if (path.node.name === state.catchParamName && util.isReference(path)) {
path.replaceWith(state.safeParam);
}
},
Scope: function Scope(path, state) {
if (path.scope.hasOwnBinding(state.catchParamName)) {
// Don't descend into nested scopes that shadow the catch
// parameter with their own declarations.
path.skip();
}
}
};
Ep.emitAbruptCompletion = function (record) {
if (!isValidCompletion(record)) {
_assert2["default"].ok(false, "invalid completion record: " + JSON.stringify(record));
}
_assert2["default"].notStrictEqual(record.type, "normal", "normal completions are not abrupt");
var abruptArgs = [t.stringLiteral(record.type)];
if (record.type === "break" || record.type === "continue") {
t.assertLiteral(record.target);
abruptArgs[1] = record.target;
} else if (record.type === "return" || record.type === "throw") {
if (record.value) {
t.assertExpression(record.value);
abruptArgs[1] = record.value;
}
}
this.emit(t.returnStatement(t.callExpression(this.contextProperty("abrupt"), abruptArgs)));
};
function isValidCompletion(record) {
var type = record.type;
if (type === "normal") {
return !hasOwn.call(record, "target");
}
if (type === "break" || type === "continue") {
return !hasOwn.call(record, "value") && t.isLiteral(record.target);
}
if (type === "return" || type === "throw") {
return hasOwn.call(record, "value") && !hasOwn.call(record, "target");
}
return false;
}
// Not all offsets into emitter.listing are potential jump targets. For
// example, execution typically falls into the beginning of a try block
// without jumping directly there. This method returns the current offset
// without marking it, so that a switch case will not necessarily be
// generated for this offset (I say "not necessarily" because the same
// location might end up being marked in the process of emitting other
// statements). There's no logical harm in marking such locations as jump
// targets, but minimizing the number of switch cases keeps the generated
// code shorter.
Ep.getUnmarkedCurrentLoc = function () {
return t.numericLiteral(this.listing.length);
};
// The context.prev property takes the value of context.next whenever we
// evaluate the switch statement discriminant, which is generally good
// enough for tracking the last location we jumped to, but sometimes
// context.prev needs to be more precise, such as when we fall
// successfully out of a try block and into a finally block without
// jumping. This method exists to update context.prev to the freshest
// available location. If we were implementing a full interpreter, we
// would know the location of the current instruction with complete
// precision at all times, but we don't have that luxury here, as it would
// be costly and verbose to set context.prev before every statement.
Ep.updateContextPrevLoc = function (loc) {
if (loc) {
t.assertLiteral(loc);
if (loc.value === -1) {
// If an uninitialized location literal was passed in, set its value
// to the current this.listing.length.
loc.value = this.listing.length;
} else {
// Otherwise assert that the location matches the current offset.
_assert2["default"].strictEqual(loc.value, this.listing.length);
}
} else {
loc = this.getUnmarkedCurrentLoc();
}
// Make sure context.prev is up to date in case we fell into this try
// statement without jumping to it. TODO Consider avoiding this
// assignment when we know control must have jumped here.
this.emitAssign(this.contextProperty("prev"), loc);
};
Ep.explodeExpression = function (path, ignoreResult) {
var expr = path.node;
if (expr) {
t.assertExpression(expr);
} else {
return expr;
}
var self = this;
var result = undefined; // Used optionally by several cases below.
var after = undefined;
function finish(expr) {
t.assertExpression(expr);
if (ignoreResult) {
self.emit(expr);
} else {
return expr;
}
}
// If the expression does not contain a leap, then we either emit the
// expression as a standalone statement or return it whole.
if (!meta.containsLeap(expr)) {
return finish(expr);
}
// If any child contains a leap (such as a yield or labeled continue or
// break statement), then any sibling subexpressions will almost
// certainly have to be exploded in order to maintain the order of their
// side effects relative to the leaping child(ren).
var hasLeapingChildren = meta.containsLeap.onlyChildren(expr);
// In order to save the rest of explodeExpression from a combinatorial
// trainwreck of special cases, explodeViaTempVar is responsible for
// deciding when a subexpression needs to be "exploded," which is my
// very technical term for emitting the subexpression as an assignment
// to a temporary variable and the substituting the temporary variable
// for the original subexpression. Think of exploded view diagrams, not
// Michael Bay movies. The point of exploding subexpressions is to
// control the precise order in which the generated code realizes the
// side effects of those subexpressions.
function explodeViaTempVar(tempVar, childPath, ignoreChildResult) {
_assert2["default"].ok(!ignoreChildResult || !tempVar, "Ignoring the result of a child expression but forcing it to " + "be assigned to a temporary variable?");
var result = self.explodeExpression(childPath, ignoreChildResult);
if (ignoreChildResult) {
// Side effects already emitted above.
} else if (tempVar || hasLeapingChildren && !t.isLiteral(result)) {
// If tempVar was provided, then the result will always be assigned
// to it, even if the result does not otherwise need to be assigned
// to a temporary variable. When no tempVar is provided, we have
// the flexibility to decide whether a temporary variable is really
// necessary. Unfortunately, in general, a temporary variable is
// required whenever any child contains a yield expression, since it
// is difficult to prove (at all, let alone efficiently) whether
// this result would evaluate to the same value before and after the
// yield (see #206). One narrow case where we can prove it doesn't
// matter (and thus we do not need a temporary variable) is when the
// result in question is a Literal value.
result = self.emitAssign(tempVar || self.makeTempVar(), result);
}
return result;
}
// If ignoreResult is true, then we must take full responsibility for
// emitting the expression with all its side effects, and we should not
// return a result.
switch (expr.type) {
case "MemberExpression":
return finish(t.memberExpression(self.explodeExpression(path.get("object")), expr.computed ? explodeViaTempVar(null, path.get("property")) : expr.property, expr.computed));
case "CallExpression":
var calleePath = path.get("callee");
var argsPath = path.get("arguments");
var newCallee = undefined;
var newArgs = [];
var hasLeapingArgs = false;
argsPath.forEach(function (argPath) {
hasLeapingArgs = hasLeapingArgs || meta.containsLeap(argPath.node);
});
if (t.isMemberExpression(calleePath.node)) {
if (hasLeapingArgs) {
// If the arguments of the CallExpression contained any yield
// expressions, then we need to be sure to evaluate the callee
// before evaluating the arguments, but if the callee was a member
// expression, then we must be careful that the object of the
// member expression still gets bound to `this` for the call.
var newObject = explodeViaTempVar(
// Assign the exploded callee.object expression to a temporary
// variable so that we can use it twice without reevaluating it.
self.makeTempVar(), calleePath.get("object"));
var newProperty = calleePath.node.computed ? explodeViaTempVar(null, calleePath.get("property")) : calleePath.node.property;
newArgs.unshift(newObject);
newCallee = t.memberExpression(t.memberExpression(newObject, newProperty, calleePath.node.computed), t.identifier("call"), false);
} else {
newCallee = self.explodeExpression(calleePath);
}
} else {
newCallee = self.explodeExpression(calleePath);
if (t.isMemberExpression(newCallee)) {
// If the callee was not previously a MemberExpression, then the
// CallExpression was "unqualified," meaning its `this` object
// should be the global object. If the exploded expression has
// become a MemberExpression (e.g. a context property, probably a
// temporary variable), then we need to force it to be unqualified
// by using the (0, object.property)(...) trick; otherwise, it
// will receive the object of the MemberExpression as its `this`
// object.
newCallee = t.sequenceExpression([t.numericLiteral(0), newCallee]);
}
}
argsPath.forEach(function (argPath) {
newArgs.push(explodeViaTempVar(null, argPath));
});
return finish(t.callExpression(newCallee, newArgs));
case "NewExpression":
return finish(t.newExpression(explodeViaTempVar(null, path.get("callee")), path.get("arguments").map(function (argPath) {
return explodeViaTempVar(null, argPath);
})));
case "ObjectExpression":
return finish(t.objectExpression(path.get("properties").map(function (propPath) {
if (propPath.isObjectProperty()) {
return t.objectProperty(propPath.node.key, explodeViaTempVar(null, propPath.get("value")), propPath.node.computed);
} else {
return propPath.node;
}
})));
case "ArrayExpression":
return finish(t.arrayExpression(path.get("elements").map(function (elemPath) {
return explodeViaTempVar(null, elemPath);
})));
case "SequenceExpression":
var lastIndex = expr.expressions.length - 1;
path.get("expressions").forEach(function (exprPath) {
if (exprPath.key === lastIndex) {
result = self.explodeExpression(exprPath, ignoreResult);
} else {
self.explodeExpression(exprPath, true);
}
});
return result;
case "LogicalExpression":
after = loc();
if (!ignoreResult) {
result = self.makeTempVar();
}
var left = explodeViaTempVar(result, path.get("left"));
if (expr.operator === "&&") {
self.jumpIfNot(left, after);
} else {
_assert2["default"].strictEqual(expr.operator, "||");
self.jumpIf(left, after);
}
explodeViaTempVar(result, path.get("right"), ignoreResult);
self.mark(after);
return result;
case "ConditionalExpression":
var elseLoc = loc();
after = loc();
var test = self.explodeExpression(path.get("test"));
self.jumpIfNot(test, elseLoc);
if (!ignoreResult) {
result = self.makeTempVar();
}
explodeViaTempVar(result, path.get("consequent"), ignoreResult);
self.jump(after);
self.mark(elseLoc);
explodeViaTempVar(result, path.get("alternate"), ignoreResult);
self.mark(after);
return result;
case "UnaryExpression":
return finish(t.unaryExpression(expr.operator,
// Can't (and don't need to) break up the syntax of the argument.
// Think about delete a[b].
self.explodeExpression(path.get("argument")), !!expr.prefix));
case "BinaryExpression":
return finish(t.binaryExpression(expr.operator, explodeViaTempVar(null, path.get("left")), explodeViaTempVar(null, path.get("right"))));
case "AssignmentExpression":
return finish(t.assignmentExpression(expr.operator, self.explodeExpression(path.get("left")), self.explodeExpression(path.get("right"))));
case "UpdateExpression":
return finish(t.updateExpression(expr.operator, self.explodeExpression(path.get("argument")), expr.prefix));
case "YieldExpression":
after = loc();
var arg = expr.argument && self.explodeExpression(path.get("argument"));
if (arg && expr.delegate) {
var _result = self.makeTempVar();
self.emit(t.returnStatement(t.callExpression(self.contextProperty("delegateYield"), [arg, t.stringLiteral(_result.property.name), after])));
self.mark(after);
return _result;
}
self.emitAssign(self.contextProperty("next"), after);
self.emit(t.returnStatement(arg || null));
self.mark(after);
return self.contextProperty("sent");
default:
throw new Error("unknown Expression of type " + JSON.stringify(expr.type));
}
};
/***/ },
/* 186 */
/*!**********************************************************!*\
!*** ./~/babel-plugin-transform-regenerator/lib/util.js ***!
\**********************************************************/
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* https://raw.github.com/facebook/regenerator/master/LICENSE file. An
* additional grant of patent rights can be found in the PATENTS file in
* the same directory.
*/
"use strict";
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
exports.runtimeProperty = runtimeProperty;
exports.isReference = isReference;
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
function runtimeProperty(name) {
return t.memberExpression(t.identifier("regeneratorRuntime"), t.identifier(name), false);
}
function isReference(path) {
return path.isReferenced() || path.parentPath.isAssignmentExpression({ left: path.node });
}
/***/ },
/* 187 */
/*!*****************************************!*\
!*** ./~/babel-preset-stage-1/index.js ***!
\*****************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = {
presets: [
__webpack_require__(/*! babel-preset-stage-2 */ 188)
],
plugins: [
__webpack_require__(/*! babel-plugin-transform-class-constructor-call */ 170),
__webpack_require__(/*! babel-plugin-transform-class-properties */ 171),
__webpack_require__(/*! babel-plugin-transform-decorators */ 172),
__webpack_require__(/*! babel-plugin-transform-export-extensions */ 179)
]
};
/***/ },
/* 188 */
/*!*****************************************!*\
!*** ./~/babel-preset-stage-2/index.js ***!
\*****************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = {
presets: [
__webpack_require__(/*! babel-preset-stage-3 */ 189)
],
plugins: [
__webpack_require__(/*! babel-plugin-syntax-trailing-function-commas */ 168),
__webpack_require__(/*! babel-plugin-transform-object-rest-spread */ 182)
]
};
/***/ },
/* 189 */
/*!*****************************************!*\
!*** ./~/babel-preset-stage-3/index.js ***!
\*****************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = {
plugins: [
__webpack_require__(/*! babel-plugin-transform-async-to-generator */ 169),
__webpack_require__(/*! babel-plugin-transform-exponentiation-operator */ 178)
]
};
/***/ },
/* 190 */
/*!***********************************************************!*\
!*** ./~/babel-runtime/core-js/object/define-property.js ***!
\***********************************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(/*! core-js/library/fn/object/define-property */ 415), __esModule: true };
/***/ },
/* 191 */
/*!*************************************!*\
!*** ./~/babel-traverse/lib/hub.js ***!
\*************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _classCallCheck = __webpack_require__(/*! babel-runtime/helpers/class-call-check */ 5)["default"];
exports.__esModule = true;
var Hub = function Hub(file, options) {
_classCallCheck(this, Hub);
this.file = file;
this.options = options;
};
exports["default"] = Hub;
module.exports = exports["default"];
/***/ },
/* 192 */
/*!********************************************************!*\
!*** ./~/babel-traverse/lib/path/lib/virtual-types.js ***!
\********************************************************/
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(/*! babel-runtime/helpers/interop-require-wildcard */ 2)["default"];
exports.__esModule = true;
var _babelTypes = __webpack_require__(/*! babel-types */ 3);
var t = _interopRequireWildcard(_babelTypes);
var ReferencedIdentifier = {
types: ["Identifier", "JSXIdentifier"],
checkPath: function checkPath(_ref, opts) {
var node = _ref.node;
var parent = _ref.parent;
if (!t.isIdentifier(node, opts)) {
if (t.isJSXIdentifier(node, opts)) {
if (_babelTypes.react.isCompatTag(node.name)) return false;
} else {
// not a JSXIdentifier or an Identifier
return false;
}
}
// check if node is referenced
return t.isReferenced(node, parent);
}
};
exports.ReferencedIdentifier = ReferencedIdentifier;
var ReferencedMemberExpression = {
types: ["MemberExpression"],
checkPath: function checkPath(_ref2) {
var node = _ref2.node;
var parent = _ref2.parent;
return t.isMemberExpression(node) && t.isReferenced(node, parent);
}
};
exports.ReferencedMemberExpression = ReferencedMemberExpression;
var BindingIdentifier = {
types: ["Identifier"],
checkPath: function checkPath(_ref3) {
var node = _ref3.node;
var parent = _ref3.parent;
return t.isIdentifier(node) && t.isBinding(node, parent);
}
};
exports.BindingIdentifier = BindingIdentifier;
var Statement = {
types: ["Statement"],
checkPath: function checkPath(_ref4) {
var node = _ref4.node;
var parent = _ref4.parent;
if (t.isStatement(node)) {
if (t.isVariableDeclaration(node)) {
if (t.isForXStatement(parent, { left: node })) return false;
if (t.isForStatement(parent, { init: node })) return false;
}
return true;
} else {
return false;
}
}
};
exports.Statement = Statement;
var Expression = {
types: ["Expression"],
checkPath: function checkPath(path) {
if (path.isIdentifier()) {
return path.isReferencedIdentifier();
} else {
return t.isExpression(path.node);
}
}
};
exports.Expression = Expression;
var Scope = {
types: ["Scopable"],
checkPath: function checkPath(path) {
return t.isScope(path.node, path.parent);
}
};
exports.Scope = Scope;
var Referenced = {
checkPath: function checkPath(path) {
return t.isReferenced(path.node, path.parent);
}
};
exports.Referenced = Referenced;
var BlockScoped = {
checkPath: function checkPath(path) {
return t.isBlockScoped(path.node);
}
};
exports.BlockScoped = BlockScoped;
var Var = {
types: ["VariableDeclaration"],
checkPath: function checkPath(path) {
return t.isVar(path.node);
}
};
exports.Var = Var;
var User = {
checkPath: function checkPath(path) {
return path.node && !!path.node.loc;
}
};
exports.User = User;
var Generated = {
checkPath: function checkPath(path) {
return !path.isUser();
}
};
exports.Generated = Generated;
var Pure = {
checkPath: function checkPath(path, opts) {
return path.scope.isPure(path.node, opts);
}
};
exports.Pure = Pure;
var Flow = {
types: ["Flow", "ImportDeclaration", "ExportDeclaration"],
checkPath: function checkPath(_ref5) {
var node = _ref5.node;
if (t.isFlow(node)) {
return true;
} else if (t.isImportDeclaration(node)) {
return node.importKind === "type" || node.importKind === "typeof";
} else if (t.isExportDeclaration(node)) {
return node.exportKind === "type";
} else {
return false;
}
}
};
exports.Flow = Flow;
/***/ },
/* 193 */
/*!***********************************************!*\
!*** ./~/babel-traverse/lib/scope/binding.js ***!
\***********************************************/
/***/ function(module, exports, __webpack_require__) {
/**
* This class is responsible for a binding inside of a scope.
*
* It tracks the following:
*
* * Node path.
* * Amount of times referenced by other nodes.
* * Paths to nodes that reassign or modify this binding.
* * The kind of binding. (Is it a parameter, declaration etc)
*/
"use strict";
var _classCallCheck = __webpack_require__(/*! babel-runtime/helpers/class-call-check */ 5)["default"];
exports.__esModule = true;
var Binding = (function () {
function Binding(_ref) {
var existing = _ref.existing;
var identifier = _ref.identifier;
var scope = _ref.scope;
var path = _ref.path;
var kind = _ref.kind;
_classCallCheck(this, Binding);
this.identifier = identifier;
this.scope = scope;
this.path = path;
this.kind = kind;
this.constantViolations = [];
this.constant = true;
this.referencePaths = [];
this.referenced = false;
this.references = 0;
this.clearValue();
if (existing) {
this.constantViolations = [].concat(existing.path, existing.constantViolations, this.constantViolations);
}
}
Binding.prototype.deoptValue = function deoptValue() {
this.clearValue();
this.hasDeoptedValue = true;
};
Binding.prototype.setValue = function setValue(value) {
if (this.hasDeoptedValue) return;
this.hasValue = true;
this.value = value;
};
Binding.prototype.clearValue = function clearValue() {
this.hasDeoptedValue = false;
this.hasValue = false;
this.value = null;
};
/**
* Register a constant violation with the provided `path`.
*/
Binding.prototype.reassign = function reassign(path) {
this.constant = false;
if (this.constantViolations.indexOf(path) !== -1) {
return;
}
this.constantViolations.push(path);
};
/**
* Increment the amount of references to this binding.
*/
Binding.prototype.reference = function reference(path) {
this.referenced = true;
this.references++;
this.referencePaths.push(path);
};
/**
* Decrement the amount of references to this binding.
*/
Binding.prototype.dereference = function dereference() {
this.references--;
this.referenced = !!this.references;
};
return Binding;
})();
exports["default"] = Binding;
module.exports = exports["default"];
/***/ },
/* 194 */
/*!*****************************************!*\
!*** ./~/babel-types/lib/retrievers.js ***!
\*****************************************/
[550, 3],
/* 195 */
/*!***************************!*\
!*** ./~/buffer/index.js ***!
\***************************/
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer, global) {/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
/* eslint-disable no-proto */
'use strict'
var base64 = __webpack_require__(/*! base64-js */ 405)
var ieee754 = __webpack_require__(/*! ieee754 */ 459)
var isArray = __webpack_require__(/*! isarray */ 407)
exports.Buffer = Buffer
exports.SlowBuffer = SlowBuffer
exports.INSPECT_MAX_BYTES = 50
Buffer.poolSize = 8192 // not used by this implementation
var rootParent = {}
/**
* If `Buffer.TYPED_ARRAY_SUPPORT`:
* === true Use Uint8Array implementation (fastest)
* === false Use Object implementation (most compatible, even IE6)
*
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
* Opera 11.6+, iOS 4.2+.
*
* Due to various browser bugs, sometimes the Object implementation will be used even
* when the browser supports typed arrays.
*
* Note:
*
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
*
* - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property
* on objects.
*
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
*
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
* incorrect length in some situations.
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
* get the Object implementation, which is slower but behaves correctly.
*/
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
? global.TYPED_ARRAY_SUPPORT
: typedArraySupport()
function typedArraySupport () {
function Bar () {}
try {
var arr = new Uint8Array(1)
arr.foo = function () { return 42 }
arr.constructor = Bar
return arr.foo() === 42 && // typed array instances can be augmented
arr.constructor === Bar && // constructor can be set
typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
} catch (e) {
return false
}
}
function kMaxLength () {
return Buffer.TYPED_ARRAY_SUPPORT
? 0x7fffffff
: 0x3fffffff
}
/**
* Class: Buffer
* =============
*
* The Buffer constructor returns instances of `Uint8Array` that are augmented
* with function properties for all the node `Buffer` API functions. We use
* `Uint8Array` so that square bracket notation works as expected -- it returns
* a single octet.
*
* By augmenting the instances, we can avoid modifying the `Uint8Array`
* prototype.
*/
function Buffer (arg) {
if (!(this instanceof Buffer)) {
// Avoid going through an ArgumentsAdaptorTrampoline in the common case.
if (arguments.length > 1) return new Buffer(arg, arguments[1])
return new Buffer(arg)
}
if (!Buffer.TYPED_ARRAY_SUPPORT) {
this.length = 0
this.parent = undefined
}
// Common case.
if (typeof arg === 'number') {
return fromNumber(this, arg)
}
// Slightly less common case.
if (typeof arg === 'string') {
return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')
}
// Unusual.
return fromObject(this, arg)
}
function fromNumber (that, length) {
that = allocate(that, length < 0 ? 0 : checked(length) | 0)
if (!Buffer.TYPED_ARRAY_SUPPORT) {
for (var i = 0; i < length; i++) {
that[i] = 0
}
}
return that
}
function fromString (that, string, encoding) {
if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'
// Assumption: byteLength() return value is always < kMaxLength.
var length = byteLength(string, encoding) | 0
that = allocate(that, length)
that.write(string, encoding)
return that
}
function fromObject (that, object) {
if (Buffer.isBuffer(object)) return fromBuffer(that, object)
if (isArray(object)) return fromArray(that, object)
if (object == null) {
throw new TypeError('must start with number, buffer, array or string')
}
if (typeof ArrayBuffer !== 'undefined') {
if (object.buffer instanceof ArrayBuffer) {
return fromTypedArray(that, object)
}
if (object instanceof ArrayBuffer) {
return fromArrayBuffer(that, object)
}
}
if (object.length) return fromArrayLike(that, object)
return fromJsonObject(that, object)
}
function fromBuffer (that, buffer) {
var length = checked(buffer.length) | 0
that = allocate(that, length)
buffer.copy(that, 0, 0, length)
return that
}
function fromArray (that, array) {
var length = checked(array.length) | 0
that = allocate(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
}
// Duplicate of fromArray() to keep fromArray() monomorphic.
function fromTypedArray (that, array) {
var length = checked(array.length) | 0
that = allocate(that, length)
// Truncating the elements is probably not what people expect from typed
// arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior
// of the old Buffer constructor.
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
}
function fromArrayBuffer (that, array) {
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
array.byteLength
that = Buffer._augment(new Uint8Array(array))
} else {
// Fallback: Return an object instance of the Buffer class
that = fromTypedArray(that, new Uint8Array(array))
}
return that
}
function fromArrayLike (that, array) {
var length = checked(array.length) | 0
that = allocate(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
}
// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.
// Returns a zero-length buffer for inputs that don't conform to the spec.
function fromJsonObject (that, object) {
var array
var length = 0
if (object.type === 'Buffer' && isArray(object.data)) {
array = object.data
length = checked(array.length) | 0
}
that = allocate(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
Buffer.prototype.__proto__ = Uint8Array.prototype
Buffer.__proto__ = Uint8Array
} else {
// pre-set for values that may exist in the future
Buffer.prototype.length = undefined
Buffer.prototype.parent = undefined
}
function allocate (that, length) {
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = Buffer._augment(new Uint8Array(length))
that.__proto__ = Buffer.prototype
} else {
// Fallback: Return an object instance of the Buffer class
that.length = length
that._isBuffer = true
}
var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1
if (fromPool) that.parent = rootParent
return that
}
function checked (length) {
// Note: cannot use `length < kMaxLength` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if (length >= kMaxLength()) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + kMaxLength().toString(16) + ' bytes')
}
return length | 0
}
function SlowBuffer (subject, encoding) {
if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)
var buf = new Buffer(subject, encoding)
delete buf.parent
return buf
}
Buffer.isBuffer = function isBuffer (b) {
return !!(b != null && b._isBuffer)
}
Buffer.compare = function compare (a, b) {
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
throw new TypeError('Arguments must be Buffers')
}
if (a === b) return 0
var x = a.length
var y = b.length
var i = 0
var len = Math.min(x, y)
while (i < len) {
if (a[i] !== b[i]) break
++i
}
if (i !== len) {
x = a[i]
y = b[i]
}
if (x < y) return -1
if (y < x) return 1
return 0
}
Buffer.isEncoding = function isEncoding (encoding) {
switch (String(encoding).toLowerCase()) {
case 'hex':
case 'utf8':
case 'utf-8':
case 'ascii':
case 'binary':
case 'base64':
case 'raw':
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return true
default:
return false
}
}
Buffer.concat = function concat (list, length) {
if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')
if (list.length === 0) {
return new Buffer(0)
}
var i
if (length === undefined) {
length = 0
for (i = 0; i < list.length; i++) {
length += list[i].length
}
}
var buf = new Buffer(length)
var pos = 0
for (i = 0; i < list.length; i++) {
var item = list[i]
item.copy(buf, pos)
pos += item.length
}
return buf
}
function byteLength (string, encoding) {
if (typeof string !== 'string') string = '' + string
var len = string.length
if (len === 0) return 0
// Use a for loop to avoid recursion
var loweredCase = false
for (;;) {
switch (encoding) {
case 'ascii':
case 'binary':
// Deprecated
case 'raw':
case 'raws':
return len
case 'utf8':
case 'utf-8':
return utf8ToBytes(string).length
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return len * 2
case 'hex':
return len >>> 1
case 'base64':
return base64ToBytes(string).length
default:
if (loweredCase) return utf8ToBytes(string).length // assume utf8
encoding = ('' + encoding).toLowerCase()
loweredCase = true
}
}
}
Buffer.byteLength = byteLength
function slowToString (encoding, start, end) {
var loweredCase = false
start = start | 0
end = end === undefined || end === Infinity ? this.length : end | 0
if (!encoding) encoding = 'utf8'
if (start < 0) start = 0
if (end > this.length) end = this.length
if (end <= start) return ''
while (true) {
switch (encoding) {
case 'hex':
return hexSlice(this, start, end)
case 'utf8':
case 'utf-8':
return utf8Slice(this, start, end)
case 'ascii':
return asciiSlice(this, start, end)
case 'binary':
return binarySlice(this, start, end)
case 'base64':
return base64Slice(this, start, end)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return utf16leSlice(this, start, end)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = (encoding + '').toLowerCase()
loweredCase = true
}
}
}
Buffer.prototype.toString = function toString () {
var length = this.length | 0
if (length === 0) return ''
if (arguments.length === 0) return utf8Slice(this, 0, length)
return slowToString.apply(this, arguments)
}
Buffer.prototype.equals = function equals (b) {
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
if (this === b) return true
return Buffer.compare(this, b) === 0
}
Buffer.prototype.inspect = function inspect () {
var str = ''
var max = exports.INSPECT_MAX_BYTES
if (this.length > 0) {
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
if (this.length > max) str += ' ... '
}
return '<Buffer ' + str + '>'
}
Buffer.prototype.compare = function compare (b) {
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
if (this === b) return 0
return Buffer.compare(this, b)
}
Buffer.prototype.indexOf = function indexOf (val, byteOffset) {
if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff
else if (byteOffset < -0x80000000) byteOffset = -0x80000000
byteOffset >>= 0
if (this.length === 0) return -1
if (byteOffset >= this.length) return -1
// Negative offsets start from the end of the buffer
if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)
if (typeof val === 'string') {
if (val.length === 0) return -1 // special case: looking for empty string always fails
return String.prototype.indexOf.call(this, val, byteOffset)
}
if (Buffer.isBuffer(val)) {
return arrayIndexOf(this, val, byteOffset)
}
if (typeof val === 'number') {
if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {
return Uint8Array.prototype.indexOf.call(this, val, byteOffset)
}
return arrayIndexOf(this, [ val ], byteOffset)
}
function arrayIndexOf (arr, val, byteOffset) {
var foundIndex = -1
for (var i = 0; byteOffset + i < arr.length; i++) {
if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {
if (foundIndex === -1) foundIndex = i
if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex
} else {
foundIndex = -1
}
}
return -1
}
throw new TypeError('val must be string, number or Buffer')
}
// `get` is deprecated
Buffer.prototype.get = function get (offset) {
console.log('.get() is deprecated. Access using array indexes instead.')
return this.readUInt8(offset)
}
// `set` is deprecated
Buffer.prototype.set = function set (v, offset) {
console.log('.set() is deprecated. Access using array indexes instead.')
return this.writeUInt8(v, offset)
}
function hexWrite (buf, string, offset, length) {
offset = Number(offset) || 0
var remaining = buf.length - offset
if (!length) {
length = remaining
} else {
length = Number(length)
if (length > remaining) {
length = remaining
}
}
// must be an even number of digits
var strLen = string.length
if (strLen % 2 !== 0) throw new Error('Invalid hex string')
if (length > strLen / 2) {
length = strLen / 2
}
for (var i = 0; i < length; i++) {
var parsed = parseInt(string.substr(i * 2, 2), 16)
if (isNaN(parsed)) throw new Error('Invalid hex string')
buf[offset + i] = parsed
}
return i
}
function utf8Write (buf, string, offset, length) {
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
}
function asciiWrite (buf, string, offset, length) {
return blitBuffer(asciiToBytes(string), buf, offset, length)
}
function binaryWrite (buf, string, offset, length) {
return asciiWrite(buf, string, offset, length)
}
function base64Write (buf, string, offset, length) {
return blitBuffer(base64ToBytes(string), buf, offset, length)
}
function ucs2Write (buf, string, offset, length) {
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
}
Buffer.prototype.write = function write (string, offset, length, encoding) {
// Buffer#write(string)
if (offset === undefined) {
encoding = 'utf8'
length = this.length
offset = 0
// Buffer#write(string, encoding)
} else if (length === undefined && typeof offset === 'string') {
encoding = offset
length = this.length
offset = 0
// Buffer#write(string, offset[, length][, encoding])
} else if (isFinite(offset)) {
offset = offset | 0
if (isFinite(length)) {
length = length | 0
if (encoding === undefined) encoding = 'utf8'
} else {
encoding = length
length = undefined
}
// legacy write(string, encoding, offset, length) - remove in v0.13
} else {
var swap = encoding
encoding = offset
offset = length | 0
length = swap
}
var remaining = this.length - offset
if (length === undefined || length > remaining) length = remaining
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
throw new RangeError('attempt to write outside buffer bounds')
}
if (!encoding) encoding = 'utf8'
var loweredCase = false
for (;;) {
switch (encoding) {
case 'hex':
return hexWrite(this, string, offset, length)
case 'utf8':
case 'utf-8':
return utf8Write(this, string, offset, length)
case 'ascii':
return asciiWrite(this, string, offset, length)
case 'binary':
return binaryWrite(this, string, offset, length)
case 'base64':
// Warning: maxLength not taken into account in base64Write
return base64Write(this, string, offset, length)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return ucs2Write(this, string, offset, length)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = ('' + encoding).toLowerCase()
loweredCase = true
}
}
}
Buffer.prototype.toJSON = function toJSON () {
return {
type: 'Buffer',
data: Array.prototype.slice.call(this._arr || this, 0)
}
}
function base64Slice (buf, start, end) {
if (start === 0 && end === buf.length) {
return base64.fromByteArray(buf)
} else {
return base64.fromByteArray(buf.slice(start, end))
}
}
function utf8Slice (buf, start, end) {
end = Math.min(buf.length, end)
var res = []
var i = start
while (i < end) {
var firstByte = buf[i]
var codePoint = null
var bytesPerSequence = (firstByte > 0xEF) ? 4
: (firstByte > 0xDF) ? 3
: (firstByte > 0xBF) ? 2
: 1
if (i + bytesPerSequence <= end) {
var secondByte, thirdByte, fourthByte, tempCodePoint
switch (bytesPerSequence) {
case 1:
if (firstByte < 0x80) {
codePoint = firstByte
}
break
case 2:
secondByte = buf[i + 1]
if ((secondByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
if (tempCodePoint > 0x7F) {
codePoint = tempCodePoint
}
}
break
case 3:
secondByte = buf[i + 1]
thirdByte = buf[i + 2]
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
codePoint = tempCodePoint
}
}
break
case 4:
secondByte = buf[i + 1]
thirdByte = buf[i + 2]
fourthByte = buf[i + 3]
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
codePoint = tempCodePoint
}
}
}
}
if (codePoint === null) {
// we did not generate a valid codePoint so insert a
// replacement char (U+FFFD) and advance only 1 byte
codePoint = 0xFFFD
bytesPerSequence = 1
} else if (codePoint > 0xFFFF) {
// encode to utf16 (surrogate pair dance)
codePoint -= 0x10000
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
codePoint = 0xDC00 | codePoint & 0x3FF
}
res.push(codePoint)
i += bytesPerSequence
}
return decodeCodePointsArray(res)
}
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
// the lowest limit is Chrome, with 0x10000 args.
// We go 1 magnitude less, for safety
var MAX_ARGUMENTS_LENGTH = 0x1000
f
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment