feat(es/minifier): Remove duplicate control flow in nested blocks (#4569)

This commit is contained in:
Austaras 2022-05-08 12:07:58 +08:00 committed by GitHub
parent 1071e6b75a
commit b3b6fd448c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 740 additions and 769 deletions

View File

@ -9,8 +9,8 @@ use swc_common::{
};
use swc_ecma_ast::*;
use swc_ecma_utils::{
extract_var_ids, ident::IdentLike, prepend_stmts, undefined, ExprExt, ExprFactory, Id, IsEmpty,
ModuleItemLike, StmtLike, Type, Value,
ident::IdentLike, prepend_stmts, undefined, ExprExt, ExprFactory, Id, IsEmpty, ModuleItemLike,
StmtLike, Type, Value,
};
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith, VisitWith};
use tracing::{debug, span, Level};
@ -2526,77 +2526,6 @@ where
if cfg!(debug_assertions) {
stmts.visit_with(&mut AssertValid);
}
if self.options.dead_code {
// copy from [Remover]
// TODO: make it better
let orig_len = stmts.len();
let mut new_stmts = Vec::with_capacity(stmts.len());
let mut iter = stmts.take().into_iter();
while let Some(stmt) = iter.next() {
let stmt = match stmt {
// Remove empty statements.
Stmt::Empty(..) => continue,
// Control flow
Stmt::Throw(..)
| Stmt::Return { .. }
| Stmt::Continue { .. }
| Stmt::Break { .. } => {
// Hoist function and `var` declarations above return.
let mut decls = vec![];
let mut hoisted_fns = vec![];
for t in iter {
match t.try_into_stmt() {
Ok(Stmt::Decl(Decl::Fn(f))) => {
hoisted_fns.push(Stmt::Decl(Decl::Fn(f)));
}
Ok(t) => {
let ids =
extract_var_ids(&t).into_iter().map(|i| VarDeclarator {
span: i.span,
name: i.into(),
init: None,
definite: false,
});
decls.extend(ids);
}
Err(item) => new_stmts.push(item),
}
}
if !decls.is_empty() {
new_stmts.push(Stmt::Decl(Decl::Var(VarDecl {
span: DUMMY_SP,
kind: VarDeclKind::Var,
decls,
declare: false,
})));
}
new_stmts.push(stmt);
new_stmts.extend(hoisted_fns);
*stmts = new_stmts;
if stmts.len() != orig_len {
self.changed = true;
report_change!("Dropping statements after a control keyword");
}
return;
}
_ => stmt,
};
new_stmts.push(stmt);
}
*stmts = new_stmts;
}
}
fn visit_mut_str(&mut self, s: &mut Str) {

View File

@ -445,6 +445,42 @@ fn remove_last_break(stmt: &mut Vec<Stmt>) -> bool {
stmt.pop();
true
}
Some(Stmt::If(i)) => {
let mut changed = false;
match &mut *i.cons {
Stmt::Break(BreakStmt { label: None, .. }) => {
report_change!("switches: Removing `break` at the end");
i.cons.take();
changed = true
}
Stmt::Block(b) => changed |= remove_last_break(&mut b.stmts),
_ => (),
};
if let Some(alt) = i.alt.as_mut() {
match &mut **alt {
Stmt::Break(BreakStmt { label: None, .. }) => {
report_change!("switches: Removing `break` at the end");
alt.take();
changed = true
}
Stmt::Block(b) => changed |= remove_last_break(&mut b.stmts),
_ => (),
};
}
changed
}
Some(Stmt::Try(t)) => {
let mut changed = false;
changed |= remove_last_break(&mut t.block.stmts);
if let Some(h) = t.handler.as_mut() {
changed |= remove_last_break(&mut h.body.stmts);
}
if let Some(f) = t.finalizer.as_mut() {
changed |= remove_last_break(&mut f.stmts);
}
changed
}
Some(Stmt::Block(BlockStmt { stmts, .. })) => remove_last_break(stmts),
_ => false,
}

View File

@ -1,6 +1,6 @@
use swc_common::{util::take::Take, EqIgnoreSpan, DUMMY_SP};
use swc_common::{util::take::Take, EqIgnoreSpan, Spanned, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_utils::{ExprExt, StmtExt, StmtLike, Value};
use swc_ecma_utils::{extract_var_ids, ExprExt, StmtExt, StmtLike, Value};
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
use super::Pure;
@ -193,44 +193,160 @@ impl Pure<'_> {
where
T: StmtLike + ModuleItemExt + Take,
{
if !self.options.side_effects {
if !self.options.dead_code {
return;
}
let idx = stmts
.iter()
.enumerate()
.find(|(_, stmt)| match stmt.as_stmt() {
Some(s) => s.terminates(),
_ => false,
});
let idx = stmts.iter().position(|stmt| match stmt.as_stmt() {
Some(s) => s.terminates(),
_ => false,
});
if let Some((idx, _)) = idx {
stmts.iter_mut().skip(idx + 1).for_each(|stmt| {
match stmt.as_stmt() {
Some(Stmt::Decl(
Decl::Var(VarDecl {
kind: VarDeclKind::Var,
..
})
| Decl::Fn(..),
)) => {
// Preserve
// TODO: let chain
if let Some(idx) = idx {
self.drop_duplicate_terminate(&mut stmts[..=idx]);
if idx == stmts.len() - 1 {
return;
}
self.changed = true;
report_change!("Dropping statements after a control keyword");
let mut new_stmts = Vec::with_capacity(stmts.len());
let mut decls = vec![];
let mut hoisted_fns = vec![];
// Hoist function and `var` declarations above return.
stmts
.iter_mut()
.skip(idx + 1)
.for_each(|stmt| match stmt.take().try_into_stmt() {
Ok(Stmt::Decl(Decl::Fn(f))) => {
hoisted_fns.push(Stmt::Decl(Decl::Fn(f)).into());
}
Some(Stmt::Empty(..)) => {
// noop
Ok(t) => {
let ids = extract_var_ids(&t).into_iter().map(|i| VarDeclarator {
span: i.span,
name: i.into(),
init: None,
definite: false,
});
decls.extend(ids);
}
Err(item) => new_stmts.push(item),
});
Some(..) => {
report_change!("Removing unreachable statements");
self.changed = true;
stmt.take();
if !decls.is_empty() {
new_stmts.push(
Stmt::Decl(Decl::Var(VarDecl {
span: DUMMY_SP,
kind: VarDeclKind::Var,
decls,
declare: false,
}))
.into(),
);
}
new_stmts.extend(hoisted_fns);
new_stmts.extend(stmts.drain(..=idx));
*stmts = new_stmts;
}
}
fn drop_duplicate_terminate<T: StmtLike>(&mut self, stmts: &mut [T]) {
let (last, stmts) = stmts.split_last_mut().unwrap();
let last = match last.as_stmt() {
Some(s @ (Stmt::Break(_) | Stmt::Continue(_) | Stmt::Return(_) | Stmt::Throw(_))) => s,
_ => return,
};
fn drop<T: StmtLike>(stmt: &mut T, last: &Stmt, need_break: bool) -> bool {
match stmt.as_stmt_mut() {
Some(s) if s.eq_ignore_span(last) => {
if need_break {
*s = Stmt::Break(BreakStmt {
label: None,
span: s.span(),
});
} else {
s.take();
}
_ => {}
true
}
});
Some(Stmt::If(i)) => {
let mut changed = false;
changed |= drop(&mut *i.cons, last, need_break);
if let Some(alt) = i.alt.as_mut() {
changed |= drop(&mut **alt, last, need_break);
}
changed
}
Some(Stmt::Try(t)) if !last.is_throw() => {
let mut changed = false;
if let Some(stmt) = t.block.stmts.last_mut() {
changed |= drop(stmt, last, need_break)
}
// TODO: let chain
if let Some(h) = t.handler.as_mut() {
if let Some(stmt) = h.body.stmts.last_mut() {
changed |= drop(stmt, last, need_break);
}
}
if let Some(f) = t.finalizer.as_mut() {
if let Some(stmt) = f.stmts.last_mut() {
changed |= drop(stmt, last, need_break);
}
}
changed
}
Some(Stmt::Switch(s)) if !last.is_break_stmt() && !need_break => {
let mut changed = false;
for case in s.cases.iter_mut() {
for stmt in case.cons.iter_mut() {
changed |= drop(stmt, last, true);
}
}
changed
}
Some(
Stmt::For(ForStmt { body, .. })
| Stmt::ForIn(ForInStmt { body, .. })
| Stmt::ForOf(ForOfStmt { body, .. })
| Stmt::While(WhileStmt { body, .. })
| Stmt::DoWhile(DoWhileStmt { body, .. }),
) if !last.is_break_stmt() && !last.is_continue_stmt() && !need_break => {
if let Stmt::Block(b) = &mut **body {
let mut changed = false;
for stmt in b.stmts.iter_mut() {
changed |= drop(stmt, last, true);
}
changed
} else {
drop(&mut **body, last, true)
}
}
Some(Stmt::Block(b)) => {
if let Some(stmt) = b.stmts.last_mut() {
drop(stmt, last, need_break)
} else {
false
}
}
_ => false,
}
}
if let Some(before_last) = stmts.last_mut() {
if drop(before_last, last, false) {
self.changed = true;
report_change!("Dropping control keyword in nested block");
}
}
}

View File

@ -1,7 +1,7 @@
use std::{fmt::Write, num::FpCategory};
use swc_atoms::js_word;
use swc_common::{iter::IdentifyLast, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
use swc_common::{iter::IdentifyLast, util::take::Take, Span, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_utils::ident::IdentLike;
@ -215,83 +215,8 @@ impl Pure<'_> {
}
}
pub(super) fn remove_duplicate_returns(&mut self, stmts: &mut Vec<Stmt>) {
fn drop_if_identical(last: &Stmt, check: &mut Stmt) -> bool {
if check.eq_ignore_span(last) {
check.take();
return true;
}
match check {
Stmt::Try(TryStmt {
finalizer: Some(finalizer),
..
}) => {
if let Some(check) = finalizer.stmts.last_mut() {
if drop_if_identical(last, check) {
return true;
}
}
}
Stmt::Try(TryStmt {
handler: Some(CatchClause { body, .. }),
finalizer: None,
..
}) => {
if let Some(check) = body.stmts.last_mut() {
if drop_if_identical(last, check) {
return true;
}
}
}
Stmt::If(IfStmt { cons, alt, .. }) => {
let mut changed = drop_if_identical(last, cons);
if let Some(alt) = alt {
if drop_if_identical(last, alt) {
changed = true;
}
}
return changed;
}
Stmt::Switch(SwitchStmt { cases, .. }) => {
for case in cases {
if let Some(check) = case.cons.last_mut() {
if drop_if_identical(last, check) {
return true;
}
}
}
}
_ => {}
}
false
}
if stmts.is_empty() {
return;
}
let orig_len = stmts.len();
let (a, b) = stmts.split_at_mut(orig_len - 1);
if let Some(last @ Stmt::Return(..)) = b.last() {
if let Some(stmt_before_last) = a.last_mut() {
if drop_if_identical(last, stmt_before_last) {
self.changed = true;
report_change!("Dropped duplicate return");
}
}
}
}
pub(super) fn remove_useless_return(&mut self, stmts: &mut Vec<Stmt>) {
if !self.options.dead_code && !self.options.reduce_vars {
if !self.options.dead_code {
return;
}

View File

@ -140,8 +140,6 @@ impl Pure<'_> {
}
}
self.remove_duplicate_returns(stmts);
self.remove_useless_return(stmts);
self.negate_if_terminate(stmts, true, false);

View File

@ -39,8 +39,6 @@ pub trait ModuleItemExt:
}
fn into_module_decl(self) -> Result<ModuleDecl, Stmt>;
fn as_stmt_mut(&mut self) -> Option<&mut Stmt>;
}
impl ModuleItemExt for Stmt {
@ -55,10 +53,6 @@ impl ModuleItemExt for Stmt {
fn into_module_decl(self) -> Result<ModuleDecl, Stmt> {
Err(self)
}
fn as_stmt_mut(&mut self) -> Option<&mut Stmt> {
Some(self)
}
}
impl ModuleItemExt for ModuleItem {
@ -79,13 +73,6 @@ impl ModuleItemExt for ModuleItem {
ModuleItem::Stmt(v) => Err(v),
}
}
fn as_stmt_mut(&mut self) -> Option<&mut Stmt> {
match self {
ModuleItem::ModuleDecl(_) => None,
ModuleItem::Stmt(s) => Some(s),
}
}
}
///

View File

@ -2497,7 +2497,7 @@
function isOlderVersion(version, thanVersion) {
for(var pkgVersionArr = thanVersion ? thanVersion.split(".") : currentVerArr, destVer = version.split("."), i = 0; i < 3; i++){
if (pkgVersionArr[i] > destVer[i]) return !0;
if (pkgVersionArr[i] < destVer[i]) return !1;
if (pkgVersionArr[i] < destVer[i]) break;
}
return !1;
}
@ -10594,22 +10594,6 @@
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}, __generator = this && this.__generator || function(thisArg, body) {
var f, y, t, g, _ = {
label: 0,
sent: function() {
if (1 & t[0]) throw t[1];
return t[1];
},
trys: [],
ops: []
};
return g = {
next: verb(0),
throw: verb(1),
return: verb(2)
}, "function" == typeof Symbol && (g[Symbol.iterator] = function() {
return this;
}), g;
function verb(n) {
return function(v) {
return step([
@ -10678,6 +10662,22 @@
done: !0
};
}
var f, y, t, g, _ = {
label: 0,
sent: function() {
if (1 & t[0]) throw t[1];
return t[1];
},
trys: [],
ops: []
};
return g = {
next: verb(0),
throw: verb(1),
return: verb(2)
}, "function" == typeof Symbol && (g[Symbol.iterator] = function() {
return this;
}), g;
};
Object.defineProperty(exports, "__esModule", {
value: !0
@ -12760,10 +12760,7 @@
}
var kg = ra.ReactCurrentBatchConfig;
function lg(a, b) {
if (a && a.defaultProps) {
for(var c in b = m({}, b), a = a.defaultProps)void 0 === b[c] && (b[c] = a[c]);
return b;
}
if (a && a.defaultProps) for(var c in b = m({}, b), a = a.defaultProps)void 0 === b[c] && (b[c] = a[c]);
return b;
}
var mg = Bf(null), ng = null, og = null, pg = null;

View File

@ -2999,7 +2999,7 @@
path = castPath(path, object);
for(var index = -1, length = path.length, lastIndex = length - 1, nested = object; null != nested && ++index < length;){
var key = toKey(path[index]), newValue = value;
if ("__proto__" === key || "constructor" === key || "prototype" === key) return object;
if ("__proto__" === key || "constructor" === key || "prototype" === key) break;
if (index != lastIndex) {
var objValue = nested[key];
void 0 === (newValue = customizer ? customizer(objValue, key, nested) : void 0) && (newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {});
@ -4700,8 +4700,7 @@
{
key: "_findStart",
value: function() {
for(var offset = this._nextSet(this._row), startInfo = null; !startInfo;){
if (!(startInfo = this._findPattern(START_PATTERN, offset, !1, !0))) return null;
for(var offset = this._nextSet(this._row), startInfo = null; !startInfo && (startInfo = this._findPattern(START_PATTERN, offset, !1, !0));){
var leadingWhitespaceStart = startInfo.start - (startInfo.end - startInfo.start);
if (leadingWhitespaceStart >= 0 && this._matchRange(leadingWhitespaceStart, startInfo.start, 0)) return startInfo;
offset = startInfo.end, startInfo = null;
@ -5790,8 +5789,7 @@
{
key: "_findStart",
value: function() {
for(var leadingWhitespaceStart = 0, offset = this._nextSet(this._row), startInfo = null, narrowBarWidth = 1; !startInfo;){
if (!(startInfo = this._findPattern(this.START_PATTERN, offset, !1, !0))) return null;
for(var leadingWhitespaceStart = 0, offset = this._nextSet(this._row), startInfo = null, narrowBarWidth = 1; !startInfo && (startInfo = this._findPattern(this.START_PATTERN, offset, !1, !0));){
if (narrowBarWidth = Math.floor((startInfo.end - startInfo.start) / 4), leadingWhitespaceStart = startInfo.start - 10 * narrowBarWidth, leadingWhitespaceStart >= 0 && this._matchRange(leadingWhitespaceStart, startInfo.start, 0)) return startInfo;
offset = startInfo.end, startInfo = null;
}
@ -6041,7 +6039,7 @@
value: function() {
for(var startInfo = null, offset = this._nextSet(this._row), narrowBarWidth = 1, leadingWhitespaceStart = 0; !startInfo;){
if (!(startInfo = this._findPattern(_2of5_reader_START_PATTERN, offset, !1, !0))) return null;
if (narrowBarWidth = Math.floor((startInfo.end - startInfo.start) / START_PATTERN_LENGTH), leadingWhitespaceStart = startInfo.start - 5 * narrowBarWidth, leadingWhitespaceStart >= 0 && this._matchRange(leadingWhitespaceStart, startInfo.start, 0)) return startInfo;
if (narrowBarWidth = Math.floor((startInfo.end - startInfo.start) / START_PATTERN_LENGTH), leadingWhitespaceStart = startInfo.start - 5 * narrowBarWidth, leadingWhitespaceStart >= 0 && this._matchRange(leadingWhitespaceStart, startInfo.start, 0)) break;
offset = startInfo.end, startInfo = null;
}
return startInfo;
@ -6936,8 +6934,7 @@
return exifTag && (result[exifTag] = selectedTag), result;
}, {}), offset = 2;
if (0xff !== dataView.getUint8(0) || 0xd8 !== dataView.getUint8(1)) return !1;
for(; offset < length;){
if (0xff !== dataView.getUint8(offset)) return !1;
for(; offset < length && 0xff === dataView.getUint8(offset);){
if (0xe1 === dataView.getUint8(offset + 1)) return readEXIFData(dataView, offset + 4, exifTags);
offset += 2 + dataView.getUint16(offset + 2);
}

View File

@ -9965,7 +9965,7 @@
var frameStart, frameSize, frame;
frameStart = 10, 0x40 & packet[5] && (frameStart += 4, frameStart += parseSyncSafeInteger(packet.subarray(10, 14)));
do {
if ((frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8))) < 1) return null;
if ((frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8))) < 1) break;
if ("PRIV" === String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3])) {
frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10);
for(var i = 0; i < frame.byteLength; i++)if (0 === frame[i]) {
@ -12584,7 +12584,7 @@
}, nextQueueIndexOfType = function(type, queue) {
for(var i = 0; i < queue.length; i++){
var queueEntry = queue[i];
if ("mediaSource" === queueEntry.type) return null;
if ("mediaSource" === queueEntry.type) break;
if (queueEntry.type === type) return i;
}
return null;

View File

@ -2096,20 +2096,23 @@
}
function parseDCC(source, start, domBuilder, errorHandler) {
if ("-" === source.charAt(start + 2)) {
if ("-" !== source.charAt(start + 3)) return -1;
var end = source.indexOf("-->", start + 4);
return end > start ? (domBuilder.comment(source, start + 4, end - start - 4), end + 3) : (errorHandler.error("Unclosed comment"), -1);
}
if ("CDATA[" == source.substr(start + 3, 6)) {
var end = source.indexOf("]]>", start + 9);
return domBuilder.startCDATA(), domBuilder.characters(source, start + 9, end - start - 9), domBuilder.endCDATA(), end + 3;
}
var matchs = split(source, start), len = matchs.length;
if (len > 1 && /!doctype/i.test(matchs[0][0])) {
var name = matchs[1][0], pubid = !1, sysid = !1;
len > 3 && (/^public$/i.test(matchs[2][0]) ? (pubid = matchs[3][0], sysid = len > 4 && matchs[4][0]) : /^system$/i.test(matchs[2][0]) && (sysid = matchs[3][0]));
var lastMatch = matchs[len - 1];
return domBuilder.startDTD(name, pubid, sysid), domBuilder.endDTD(), lastMatch.index + lastMatch[0].length;
if ("-" === source.charAt(start + 3)) {
var end = source.indexOf("-->", start + 4);
if (end > start) return domBuilder.comment(source, start + 4, end - start - 4), end + 3;
errorHandler.error("Unclosed comment");
}
} else {
if ("CDATA[" == source.substr(start + 3, 6)) {
var end = source.indexOf("]]>", start + 9);
return domBuilder.startCDATA(), domBuilder.characters(source, start + 9, end - start - 9), domBuilder.endCDATA(), end + 3;
}
var matchs = split(source, start), len = matchs.length;
if (len > 1 && /!doctype/i.test(matchs[0][0])) {
var name = matchs[1][0], pubid = !1, sysid = !1;
len > 3 && (/^public$/i.test(matchs[2][0]) ? (pubid = matchs[3][0], sysid = len > 4 && matchs[4][0]) : /^system$/i.test(matchs[2][0]) && (sysid = matchs[3][0]));
var lastMatch = matchs[len - 1];
return domBuilder.startDTD(name, pubid, sysid), domBuilder.endDTD(), lastMatch.index + lastMatch[0].length;
}
}
return -1;
}
@ -2117,7 +2120,7 @@
var end = source.indexOf("?>", start);
if (end) {
var match = source.substring(start, end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
return match ? (match[0].length, domBuilder.processingInstruction(match[1], match[2]), end + 2) : -1;
if (match) return match[0].length, domBuilder.processingInstruction(match[1], match[2]), end + 2;
}
return -1;
}
@ -4827,52 +4830,49 @@
if (!m || !m[0]) throw new ParsingError(ParsingError.Errors.BadSignature);
self.state = "HEADER";
}
for(var alreadyCollectedLine = !1; self.buffer;){
if (!/\r\n|\n/.test(self.buffer)) return this;
switch(alreadyCollectedLine ? alreadyCollectedLine = !1 : line1 = collectNextLine(), self.state){
case "HEADER":
/:/.test(line1) ? parseHeader(line1) : line1 || (self.state = "ID");
for(var alreadyCollectedLine = !1; self.buffer && /\r\n|\n/.test(self.buffer);)switch(alreadyCollectedLine ? alreadyCollectedLine = !1 : line1 = collectNextLine(), self.state){
case "HEADER":
/:/.test(line1) ? parseHeader(line1) : line1 || (self.state = "ID");
continue;
case "NOTE":
line1 || (self.state = "ID");
continue;
case "ID":
if (/^NOTE($|[ \t])/.test(line1)) {
self.state = "NOTE";
break;
}
if (!line1) continue;
self.cue = new (self.vttjs.VTTCue || self.window.VTTCue)(0, 0, "");
try {
self.cue.align = "center";
} catch (e) {
self.cue.align = "middle";
}
if (self.state = "CUE", -1 === line1.indexOf("-->")) {
self.cue.id = line1;
continue;
case "NOTE":
line1 || (self.state = "ID");
}
case "CUE":
try {
parseCue(line1, self.cue, self.regionList);
} catch (e3) {
self.reportOrThrowError(e3), self.cue = null, self.state = "BADCUE";
continue;
case "ID":
if (/^NOTE($|[ \t])/.test(line1)) {
self.state = "NOTE";
break;
}
if (!line1) continue;
self.cue = new (self.vttjs.VTTCue || self.window.VTTCue)(0, 0, "");
try {
self.cue.align = "center";
} catch (e) {
self.cue.align = "middle";
}
if (self.state = "CUE", -1 === line1.indexOf("-->")) {
self.cue.id = line1;
continue;
}
case "CUE":
try {
parseCue(line1, self.cue, self.regionList);
} catch (e3) {
self.reportOrThrowError(e3), self.cue = null, self.state = "BADCUE";
continue;
}
self.state = "CUETEXT";
}
self.state = "CUETEXT";
continue;
case "CUETEXT":
var hasSubstring = -1 !== line1.indexOf("-->");
if (!line1 || hasSubstring && (alreadyCollectedLine = !0)) {
self.oncue && self.oncue(self.cue), self.cue = null, self.state = "ID";
continue;
case "CUETEXT":
var hasSubstring = -1 !== line1.indexOf("-->");
if (!line1 || hasSubstring && (alreadyCollectedLine = !0)) {
self.oncue && self.oncue(self.cue), self.cue = null, self.state = "ID";
continue;
}
self.cue.text && (self.cue.text += "\n"), self.cue.text += line1.replace(/\u2028/g, "\n").replace(/u2029/g, "\n");
continue;
case "BADCUE":
line1 || (self.state = "ID");
continue;
}
}
self.cue.text && (self.cue.text += "\n"), self.cue.text += line1.replace(/\u2028/g, "\n").replace(/u2029/g, "\n");
continue;
case "BADCUE":
line1 || (self.state = "ID");
continue;
}
} catch (e) {
self.reportOrThrowError(e), "CUETEXT" === self.state && self.cue && self.oncue && self.oncue(self.cue), self.cue = null, self.state = "INITIAL" === self.state ? "BADWEBVTT" : "BADCUE";
@ -5340,7 +5340,7 @@
length > strLen / 2 && (length = strLen / 2);
for(var i = 0; i < length; ++i){
var obj, parsed = parseInt(string.substr(2 * i, 2), 16);
if ((obj = parsed) != obj) return i;
if ((obj = parsed) != obj) break;
buf[offset + i] = parsed;
}
return i;

View File

@ -303,7 +303,7 @@
f > i / 2 && (f = i / 2);
for(var o = 0; o < f; ++o){
var e7, u = parseInt(r.substr(2 * o, 2), 16);
if ((e7 = u) != e7) return o;
if ((e7 = u) != e7) break;
e[t + o] = u;
}
return o;

View File

@ -581,11 +581,11 @@
}, this.setEnd = function(row, column) {
"object" == typeof row ? (this.end.column = row.column, this.end.row = row.row) : (this.end.row = row, this.end.column = column);
}, this.inside = function(row, column) {
return 0 == this.compare(row, column) && !(this.isEnd(row, column) || this.isStart(row, column));
return !(0 != this.compare(row, column) || this.isEnd(row, column) || this.isStart(row, column));
}, this.insideStart = function(row, column) {
return 0 == this.compare(row, column) && !this.isEnd(row, column);
return !(0 != this.compare(row, column) || this.isEnd(row, column));
}, this.insideEnd = function(row, column) {
return 0 == this.compare(row, column) && !this.isStart(row, column);
return !(0 != this.compare(row, column) || this.isStart(row, column));
}, this.compare = function(row, column) {
return this.isMultiLine() || row !== this.start.row ? row < this.start.row ? -1 : row > this.end.row ? 1 : this.start.row === row ? column >= this.start.column ? 0 : -1 : this.end.row === row ? column <= this.end.column ? 0 : 1 : 0 : column < this.start.column ? -1 : column > this.end.column ? 1 : 0;
}, this.compareStart = function(row, column) {
@ -5018,7 +5018,7 @@
var cmpStart = comparePoints(pos, range.start);
if (0 === cmpEnd) return excludeEdges && 0 !== cmpStart ? -i - 2 : i;
if (cmpStart > 0 || 0 === cmpStart && !excludeEdges) return i;
return -i - 1;
break;
}
}
return -i - 1;
@ -5218,7 +5218,7 @@
for(startFoldLine && (i = foldData.indexOf(startFoldLine)), -1 == i && (i = 0); i < foldData.length; i++){
var foldLine = foldData[i];
if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) return foldLine;
if (foldLine.end.row > docRow) return null;
if (foldLine.end.row > docRow) break;
}
return null;
}, this.getNextFoldLine = function(docRow, startFoldLine) {
@ -5261,10 +5261,7 @@
if (startRow == foldLine.end.row) {
if (foldLine.addFold(fold), added = !0, !fold.sameRow) {
var foldLineNext = foldData[i + 1];
if (foldLineNext && foldLineNext.start.row == endRow) {
foldLine.merge(foldLineNext);
break;
}
foldLineNext && foldLineNext.start.row == endRow && foldLine.merge(foldLineNext);
}
break;
}
@ -11848,6 +11845,12 @@ margin: 0 10px;\
}, lines.join("\n") + "\n"), guessRange || (range.start.column = 0, range.end.column = lines[lines.length - 1].length), this.selection.setRange(range);
}
}, this.$reAlignText = function(lines, forceLeft) {
function spaces(n) {
return lang.stringRepeat(" ", n);
}
function alignLeft(m) {
return m[2] ? spaces(startW) + m[2] + spaces(textW - m[2].length + endW) + m[4].replace(/^([=:])\s+/, "$1 ") : m[0];
}
var startW, textW, endW, isLeftAligned = !0, isRightAligned = !0;
return lines.map(function(line) {
var m = line.match(/(\s*)(.*?)(\s*)([=:].*)/);
@ -11859,12 +11862,6 @@ margin: 0 10px;\
} : alignLeft : function(m) {
return m[2] ? spaces(startW) + m[2] + spaces(endW) + m[4].replace(/^([=:])\s+/, "$1 ") : m[0];
});
function spaces(n) {
return lang.stringRepeat(" ", n);
}
function alignLeft(m) {
return m[2] ? spaces(startW) + m[2] + spaces(textW - m[2].length + endW) + m[4].replace(/^([=:])\s+/, "$1 ") : m[0];
}
};
}).call(Editor.prototype), exports.onSessionChange = function(e) {
var session = e.session;

View File

@ -2078,10 +2078,7 @@
}
var jg = ta.ReactCurrentBatchConfig;
function kg(a, b) {
if (a && a.defaultProps) {
for(var c in b = A({}, b), a = a.defaultProps)void 0 === b[c] && (b[c] = a[c]);
return b;
}
if (a && a.defaultProps) for(var c in b = A({}, b), a = a.defaultProps)void 0 === b[c] && (b[c] = a[c]);
return b;
}
var lg = Tf(null), mg = null, ng = null, og = null;
@ -3679,74 +3676,68 @@
transitions: null
};
}
function uj(a, b) {
return {
baseLanes: a.baseLanes | b,
cachePool: null,
transitions: a.transitions
};
}
function vj(a, b, c) {
var h, d = b.pendingProps, e = K.current, f = !1, g = 0 != (128 & b.flags);
var a14, b11, h, d = b.pendingProps, e = K.current, f = !1, g = 0 != (128 & b.flags);
if ((h = g) || (h = (null === a || null !== a.memoizedState) && 0 != (2 & e)), h ? (f = !0, b.flags &= -129) : (null === a || null !== a.memoizedState) && (e |= 1), G(K, 1 & e), null === a) return (kh(b), null !== (a = b.memoizedState) && null !== (a = a.dehydrated)) ? (0 == (1 & b.mode) ? b.lanes = 1 : "$!" === a.data ? b.lanes = 8 : b.lanes = 1073741824, null) : (e = d.children, a = d.fallback, f ? (d = b.mode, f = b.child, e = {
mode: "hidden",
children: e
}, 0 == (1 & d) && null !== f ? (f.childLanes = 0, f.pendingProps = e) : f = wj(e, d, 0, null), a = xh(a, d, c, null), f.return = b, a.return = b, f.sibling = a, b.child = f, b.child.memoizedState = tj(c), b.memoizedState = sj, a) : xj(b, e));
if (null !== (e = a.memoizedState)) {
if (null !== (h = e.dehydrated)) {
if (g) return 256 & b.flags ? (b.flags &= -257, yj(a, b, c, Error(p(422)))) : null !== b.memoizedState ? (b.child = a.child, b.flags |= 128, null) : (f = d.fallback, e = b.mode, d = wj({
mode: "visible",
children: d.children
}, e, 0, null), f = xh(f, e, c, null), f.flags |= 2, d.return = b, f.return = b, d.sibling = f, b.child = d, 0 != (1 & b.mode) && yh(b, a.child, null, c), b.child.memoizedState = tj(c), b.memoizedState = sj, f);
if (0 == (1 & b.mode)) b = yj(a, b, c, null);
else if ("$!" === h.data) b = yj(a, b, c, Error(p(419)));
else if (d = 0 != (c & a.childLanes), tg || d) {
if (null !== (d = P)) {
switch(c & -c){
case 4:
f = 2;
break;
case 16:
f = 8;
break;
case 64:
case 128:
case 256:
case 512:
case 1024:
case 2048:
case 4096:
case 8192:
case 16384:
case 32768:
case 65536:
case 131072:
case 262144:
case 524288:
case 1048576:
case 2097152:
case 4194304:
case 8388608:
case 16777216:
case 33554432:
case 67108864:
f = 32;
break;
case 536870912:
f = 268435456;
break;
default:
f = 0;
}
0 !== (d = 0 != (f & (d.suspendedLanes | c)) ? 0 : f) && d !== e.retryLane && (e.retryLane = d, Lg(a, d, -1));
if (null !== (e = a.memoizedState) && null !== (h = e.dehydrated)) {
if (g) return 256 & b.flags ? (b.flags &= -257, yj(a, b, c, Error(p(422)))) : null !== b.memoizedState ? (b.child = a.child, b.flags |= 128, null) : (f = d.fallback, e = b.mode, d = wj({
mode: "visible",
children: d.children
}, e, 0, null), f = xh(f, e, c, null), f.flags |= 2, d.return = b, f.return = b, d.sibling = f, b.child = d, 0 != (1 & b.mode) && yh(b, a.child, null, c), b.child.memoizedState = tj(c), b.memoizedState = sj, f);
if (0 == (1 & b.mode)) b = yj(a, b, c, null);
else if ("$!" === h.data) b = yj(a, b, c, Error(p(419)));
else if (d = 0 != (c & a.childLanes), tg || d) {
if (null !== (d = P)) {
switch(c & -c){
case 4:
f = 2;
break;
case 16:
f = 8;
break;
case 64:
case 128:
case 256:
case 512:
case 1024:
case 2048:
case 4096:
case 8192:
case 16384:
case 32768:
case 65536:
case 131072:
case 262144:
case 524288:
case 1048576:
case 2097152:
case 4194304:
case 8388608:
case 16777216:
case 33554432:
case 67108864:
f = 32;
break;
case 536870912:
f = 268435456;
break;
default:
f = 0;
}
$i(), b = yj(a, b, c, Error(p(421)));
} else "$?" === h.data ? (b.flags |= 128, b.child = a.child, b = zj.bind(null, a), h._reactRetry = b, b = null) : (c = e.treeContext, eh = Kf(h.nextSibling), dh = b, I = !0, fh = null, null !== c && (Vg[Wg++] = Yg, Vg[Wg++] = Zg, Vg[Wg++] = Xg, Yg = c.id, Zg = c.overflow, Xg = b), b = xj(b, b.pendingProps.children), b.flags |= 4096);
return b;
}
return f ? (d = Aj(a, b, d.children, d.fallback, c), f = b.child, e = a.child.memoizedState, f.memoizedState = null === e ? tj(c) : uj(e, c), f.childLanes = a.childLanes & ~c, b.memoizedState = sj, d) : (c = Bj(a, b, d.children, c), b.memoizedState = null, c);
0 !== (d = 0 != (f & (d.suspendedLanes | c)) ? 0 : f) && d !== e.retryLane && (e.retryLane = d, Lg(a, d, -1));
}
$i(), b = yj(a, b, c, Error(p(421)));
} else "$?" === h.data ? (b.flags |= 128, b.child = a.child, b = zj.bind(null, a), h._reactRetry = b, b = null) : (c = e.treeContext, eh = Kf(h.nextSibling), dh = b, I = !0, fh = null, null !== c && (Vg[Wg++] = Yg, Vg[Wg++] = Zg, Vg[Wg++] = Xg, Yg = c.id, Zg = c.overflow, Xg = b), b = xj(b, b.pendingProps.children), b.flags |= 4096);
return b;
}
return f ? (d = Aj(a, b, d.children, d.fallback, c), f = b.child, e = a.child.memoizedState, f.memoizedState = null === e ? tj(c) : uj(e, c), f.childLanes = a.childLanes & ~c, b.memoizedState = sj, d) : (c = Bj(a, b, d.children, c), b.memoizedState = null, c);
return f ? (d = Aj(a, b, d.children, d.fallback, c), f = b.child, e = a.child.memoizedState, f.memoizedState = null === e ? tj(c) : (a14 = e, b11 = c, {
baseLanes: a14.baseLanes | b11,
cachePool: null,
transitions: a14.transitions
}), f.childLanes = a.childLanes & ~c, b.memoizedState = sj, d) : (c = Bj(a, b, d.children, c), b.memoizedState = null, c);
}
function xj(a, b) {
return (b = wj({
@ -4003,11 +3994,11 @@
}
}
function Yj(a) {
var b11 = a.updateQueue;
if (null !== b11) {
var b12 = a.updateQueue;
if (null !== b12) {
a.updateQueue = null;
var c = a.stateNode;
null === c && (c = a.stateNode = new Ij()), b11.forEach(function(b) {
null === c && (c = a.stateNode = new Ij()), b12.forEach(function(b) {
var d = Zj.bind(null, a, b);
c.has(b) || (c.add(b), b.then(d, d));
});
@ -4431,18 +4422,18 @@
function Bg(a) {
return (null !== P || null !== vg) && 0 != (1 & a.mode) && 0 == (2 & W);
}
function Ck(a15, b12) {
var a14, c6 = a15.callbackNode;
function Ck(a16, b13) {
var a15, c6 = a16.callbackNode;
!function(a, b) {
for(var c = a.suspendedLanes, d = a.pingedLanes, e = a.expirationTimes, f = a.pendingLanes; 0 < f;){
var g = 31 - nc(f), h = 1 << g, k = e[g];
-1 === k ? (0 == (h & c) || 0 != (h & d)) && (e[g] = uc(h, b)) : k <= b && (a.expiredLanes |= h), f &= ~h;
}
}(a15, b12);
var d6 = tc(a15, a15 === P ? Y : 0);
if (0 === d6) null !== c6 && ac(c6), a15.callbackNode = null, a15.callbackPriority = 0;
else if (b12 = d6 & -d6, a15.callbackPriority !== b12) {
if (null != c6 && ac(c6), 1 === b12) 0 === a15.tag ? (a14 = Dk.bind(null, a15), eg = !0, gg(a14)) : gg(Dk.bind(null, a15)), If(function() {
}(a16, b13);
var d6 = tc(a16, a16 === P ? Y : 0);
if (0 === d6) null !== c6 && ac(c6), a16.callbackNode = null, a16.callbackPriority = 0;
else if (b13 = d6 & -d6, a16.callbackPriority !== b13) {
if (null != c6 && ac(c6), 1 === b13) 0 === a16.tag ? (a15 = Dk.bind(null, a16), eg = !0, gg(a15)) : gg(Dk.bind(null, a16)), If(function() {
0 === W && ig();
}), c6 = null;
else {
@ -4460,9 +4451,9 @@
case 536870912:
c6 = ic;
}
c6 = Ek(c6, Fk.bind(null, a15));
c6 = Ek(c6, Fk.bind(null, a16));
}
a15.callbackPriority = b12, a15.callbackNode = c6;
a16.callbackPriority = b13, a16.callbackNode = c6;
}
}
function Fk(a, b) {
@ -4793,15 +4784,15 @@
}
return null;
}
function Vk(a17, b14, c8, d7) {
function Vk(a18, b15, c8, d7) {
do Gk();
while (null !== uk)
if (0 != (6 & W)) throw Error(p(327));
c8 = a17.finishedWork;
var e5 = a17.finishedLanes;
c8 = a18.finishedWork;
var e5 = a18.finishedLanes;
if (null === c8) return null;
if (a17.finishedWork = null, a17.finishedLanes = 0, c8 === a17.current) throw Error(p(177));
a17.callbackNode = null, a17.callbackPriority = 0;
if (a18.finishedWork = null, a18.finishedLanes = 0, c8 === a18.current) throw Error(p(177));
a18.callbackNode = null, a18.callbackPriority = 0;
var f4 = c8.lanes | c8.childLanes;
if (!function(a, b) {
var c = a.pendingLanes & ~b;
@ -4811,13 +4802,13 @@
var e = 31 - nc(c), f = 1 << e;
b[e] = 0, d[e] = -1, a[e] = -1, c &= ~f;
}
}(a17, f4), a17 === P && (X = P = null, Y = 0), 0 == (2064 & c8.subtreeFlags) && 0 == (2064 & c8.flags) || tk || (tk = !0, Ek(gc, function() {
}(a18, f4), a18 === P && (X = P = null, Y = 0), 0 == (2064 & c8.subtreeFlags) && 0 == (2064 & c8.flags) || tk || (tk = !0, Ek(gc, function() {
return Gk(), null;
})), f4 = 0 != (15990 & c8.flags), 0 != (15990 & c8.subtreeFlags) || f4) {
f4 = mk.transition, mk.transition = null;
var g2 = C;
C = 1;
var a16, b13, c7, h4 = W;
var a17, b14, c7, h4 = W;
W |= 4, lk.current = null, function(a, b) {
if (Bf = cd, Me(a = Le())) {
if ("selectionStart" in a) var c = {
@ -4901,7 +4892,7 @@
T = b.return;
}
m = Lj, Lj = !1;
}(a17, c8), bk(c8, a17), function(a) {
}(a18, c8), bk(c8, a18), function(a) {
var b = Le(), c = a.focusedElem, d = a.selectionRange;
if (b !== c && c && c.ownerDocument && Ke(c.ownerDocument.documentElement, c)) {
if (null !== d && Me(c)) {
@ -4921,15 +4912,15 @@
});
for("function" == typeof c.focus && c.focus(), c = 0; c < b.length; c++)(a = b[c]).element.scrollLeft = a.left, a.element.scrollTop = a.top;
}
}(Cf), cd = !!Bf, Cf = Bf = null, a17.current = c8, a16 = c8, b13 = a17, c7 = e5, T = a16, gk(a16, b13, c7), cc(), W = h4, C = g2, mk.transition = f4;
} else a17.current = c8;
if (tk && (tk = !1, uk = a17, vk = e5), 0 === (f4 = a17.pendingLanes) && (Oi = null), !function(a) {
}(Cf), cd = !!Bf, Cf = Bf = null, a18.current = c8, a17 = c8, b14 = a18, c7 = e5, T = a17, gk(a17, b14, c7), cc(), W = h4, C = g2, mk.transition = f4;
} else a18.current = c8;
if (tk && (tk = !1, uk = a18, vk = e5), 0 === (f4 = a18.pendingLanes) && (Oi = null), !function(a) {
if (kc && "function" == typeof kc.onCommitFiberRoot) try {
kc.onCommitFiberRoot(jc, a, void 0, 128 == (128 & a.current.flags));
} catch (b) {}
}(c8.stateNode, d7), Ck(a17, B()), null !== b14) for(d7 = a17.onRecoverableError, c8 = 0; c8 < b14.length; c8++)d7(b14[c8]);
if (Li) throw Li = !1, a17 = Mi, Mi = null, a17;
return 0 != (1 & vk) && 0 !== a17.tag && Gk(), 0 != (1 & (f4 = a17.pendingLanes)) ? a17 === xk ? wk++ : (wk = 0, xk = a17) : wk = 0, ig(), null;
}(c8.stateNode, d7), Ck(a18, B()), null !== b15) for(d7 = a18.onRecoverableError, c8 = 0; c8 < b15.length; c8++)d7(b15[c8]);
if (Li) throw Li = !1, a18 = Mi, Mi = null, a18;
return 0 != (1 & vk) && 0 !== a18.tag && Gk(), 0 != (1 & (f4 = a18.pendingLanes)) ? a18 === xk ? wk++ : (wk = 0, xk = a18) : wk = 0, ig(), null;
}
function Gk() {
if (null !== uk) {
@ -5225,11 +5216,11 @@
function il() {
return null;
}
Uk = function(a18, b15, c9) {
if (null !== a18) {
if (a18.memoizedProps !== b15.pendingProps || Vf.current) tg = !0;
Uk = function(a19, b16, c9) {
if (null !== a19) {
if (a19.memoizedProps !== b16.pendingProps || Vf.current) tg = !0;
else {
if (0 == (a18.lanes & c9) && 0 == (128 & b15.flags)) return tg = !1, function(a, b, c) {
if (0 == (a19.lanes & c9) && 0 == (128 & b16.flags)) return tg = !1, function(a, b, c) {
switch(b.tag){
case 3:
qj(b), nh();
@ -5267,54 +5258,54 @@
return b.lanes = 0, lj(a, b, c);
}
return gj(a, b, c);
}(a18, b15, c9);
tg = 0 != (131072 & a18.flags);
}(a19, b16, c9);
tg = 0 != (131072 & a19.flags);
}
} else tg = !1, I && 0 != (1048576 & b15.flags) && ah(b15, Ug, b15.index);
switch(b15.lanes = 0, b15.tag){
} else tg = !1, I && 0 != (1048576 & b16.flags) && ah(b16, Ug, b16.index);
switch(b16.lanes = 0, b16.tag){
case 2:
var d8 = b15.type;
null !== a18 && (a18.alternate = null, b15.alternate = null, b15.flags |= 2), a18 = b15.pendingProps;
var e6 = Xf(b15, H.current);
sg(b15, c9), e6 = Uh(null, b15, d8, a18, e6, c9);
var d8 = b16.type;
null !== a19 && (a19.alternate = null, b16.alternate = null, b16.flags |= 2), a19 = b16.pendingProps;
var e6 = Xf(b16, H.current);
sg(b16, c9), e6 = Uh(null, b16, d8, a19, e6, c9);
var f = Zh();
return b15.flags |= 1, "object" == typeof e6 && null !== e6 && "function" == typeof e6.render && void 0 === e6.$$typeof ? (b15.tag = 1, b15.memoizedState = null, b15.updateQueue = null, Yf(d8) ? (f = !0, bg(b15)) : f = !1, b15.memoizedState = null !== e6.state && void 0 !== e6.state ? e6.state : null, xg(b15), e6.updater = Mg, b15.stateNode = e6, e6._reactInternals = b15, Qg(b15, d8, a18, c9), b15 = pj(null, b15, d8, !0, f, c9)) : (b15.tag = 0, I && f && bh(b15), ej(null, b15, e6, c9), b15 = b15.child), b15;
return b16.flags |= 1, "object" == typeof e6 && null !== e6 && "function" == typeof e6.render && void 0 === e6.$$typeof ? (b16.tag = 1, b16.memoizedState = null, b16.updateQueue = null, Yf(d8) ? (f = !0, bg(b16)) : f = !1, b16.memoizedState = null !== e6.state && void 0 !== e6.state ? e6.state : null, xg(b16), e6.updater = Mg, b16.stateNode = e6, e6._reactInternals = b16, Qg(b16, d8, a19, c9), b16 = pj(null, b16, d8, !0, f, c9)) : (b16.tag = 0, I && f && bh(b16), ej(null, b16, e6, c9), b16 = b16.child), b16;
case 16:
d8 = b15.elementType;
d8 = b16.elementType;
a: {
switch(null !== a18 && (a18.alternate = null, b15.alternate = null, b15.flags |= 2), a18 = b15.pendingProps, d8 = (e6 = d8._init)(d8._payload), b15.type = d8, e6 = b15.tag = function(a) {
switch(null !== a19 && (a19.alternate = null, b16.alternate = null, b16.flags |= 2), a19 = b16.pendingProps, d8 = (e6 = d8._init)(d8._payload), b16.type = d8, e6 = b16.tag = function(a) {
if ("function" == typeof a) return ij(a) ? 1 : 0;
if (null != a) {
if ((a = a.$$typeof) === Ca) return 11;
if (a === Fa) return 14;
}
return 2;
}(d8), a18 = kg(d8, a18), e6){
}(d8), a19 = kg(d8, a19), e6){
case 0:
b15 = kj(null, b15, d8, a18, c9);
b16 = kj(null, b16, d8, a19, c9);
break a;
case 1:
b15 = oj(null, b15, d8, a18, c9);
b16 = oj(null, b16, d8, a19, c9);
break a;
case 11:
b15 = fj(null, b15, d8, a18, c9);
b16 = fj(null, b16, d8, a19, c9);
break a;
case 14:
b15 = hj(null, b15, d8, kg(d8.type, a18), c9);
b16 = hj(null, b16, d8, kg(d8.type, a19), c9);
break a;
}
throw Error(p(306, d8, ""));
}
return b15;
return b16;
case 0:
return d8 = b15.type, e6 = b15.pendingProps, e6 = b15.elementType === d8 ? e6 : kg(d8, e6), kj(a18, b15, d8, e6, c9);
return d8 = b16.type, e6 = b16.pendingProps, e6 = b16.elementType === d8 ? e6 : kg(d8, e6), kj(a19, b16, d8, e6, c9);
case 1:
return d8 = b15.type, e6 = b15.pendingProps, e6 = b15.elementType === d8 ? e6 : kg(d8, e6), oj(a18, b15, d8, e6, c9);
return d8 = b16.type, e6 = b16.pendingProps, e6 = b16.elementType === d8 ? e6 : kg(d8, e6), oj(a19, b16, d8, e6, c9);
case 3:
a: {
if (qj(b15), null === a18) throw Error(p(387));
d8 = b15.pendingProps, f = b15.memoizedState, e6 = f.element, yg(a18, b15), Eg(b15, d8, null, c9);
var g = b15.memoizedState;
if (qj(b16), null === a19) throw Error(p(387));
d8 = b16.pendingProps, f = b16.memoizedState, e6 = f.element, yg(a19, b16), Eg(b16, d8, null, c9);
var g = b16.memoizedState;
if (d8 = g.element, f.isDehydrated) {
if (f = {
element: d8,
@ -5322,49 +5313,49 @@
cache: g.cache,
pendingSuspenseBoundaries: g.pendingSuspenseBoundaries,
transitions: g.transitions
}, b15.updateQueue.baseState = f, b15.memoizedState = f, 256 & b15.flags) {
b15 = rj(a18, b15, d8, c9, e6 = Error(p(423)));
}, b16.updateQueue.baseState = f, b16.memoizedState = f, 256 & b16.flags) {
b16 = rj(a19, b16, d8, c9, e6 = Error(p(423)));
break a;
}
if (d8 !== e6) {
b15 = rj(a18, b15, d8, c9, e6 = Error(p(424)));
b16 = rj(a19, b16, d8, c9, e6 = Error(p(424)));
break a;
}
for(eh = Kf(b15.stateNode.containerInfo.firstChild), dh = b15, I = !0, fh = null, c9 = zh(b15, null, d8, c9), b15.child = c9; c9;)c9.flags = -3 & c9.flags | 4096, c9 = c9.sibling;
for(eh = Kf(b16.stateNode.containerInfo.firstChild), dh = b16, I = !0, fh = null, c9 = zh(b16, null, d8, c9), b16.child = c9; c9;)c9.flags = -3 & c9.flags | 4096, c9 = c9.sibling;
} else {
if (nh(), d8 === e6) {
b15 = gj(a18, b15, c9);
b16 = gj(a19, b16, c9);
break a;
}
ej(a18, b15, d8, c9);
ej(a19, b16, d8, c9);
}
b15 = b15.child;
b16 = b16.child;
}
return b15;
return b16;
case 5:
return Hh(b15), null === a18 && kh(b15), d8 = b15.type, e6 = b15.pendingProps, f = null !== a18 ? a18.memoizedProps : null, g = e6.children, Df(d8, e6) ? g = null : null !== f && Df(d8, f) && (b15.flags |= 32), nj(a18, b15), ej(a18, b15, g, c9), b15.child;
return Hh(b16), null === a19 && kh(b16), d8 = b16.type, e6 = b16.pendingProps, f = null !== a19 ? a19.memoizedProps : null, g = e6.children, Df(d8, e6) ? g = null : null !== f && Df(d8, f) && (b16.flags |= 32), nj(a19, b16), ej(a19, b16, g, c9), b16.child;
case 6:
return null === a18 && kh(b15), null;
return null === a19 && kh(b16), null;
case 13:
return vj(a18, b15, c9);
return vj(a19, b16, c9);
case 4:
return Fh(b15, b15.stateNode.containerInfo), d8 = b15.pendingProps, null === a18 ? b15.child = yh(b15, null, d8, c9) : ej(a18, b15, d8, c9), b15.child;
return Fh(b16, b16.stateNode.containerInfo), d8 = b16.pendingProps, null === a19 ? b16.child = yh(b16, null, d8, c9) : ej(a19, b16, d8, c9), b16.child;
case 11:
return d8 = b15.type, e6 = b15.pendingProps, e6 = b15.elementType === d8 ? e6 : kg(d8, e6), fj(a18, b15, d8, e6, c9);
return d8 = b16.type, e6 = b16.pendingProps, e6 = b16.elementType === d8 ? e6 : kg(d8, e6), fj(a19, b16, d8, e6, c9);
case 7:
return ej(a18, b15, b15.pendingProps, c9), b15.child;
return ej(a19, b16, b16.pendingProps, c9), b16.child;
case 8:
case 12:
return ej(a18, b15, b15.pendingProps.children, c9), b15.child;
return ej(a19, b16, b16.pendingProps.children, c9), b16.child;
case 10:
a: {
if (d8 = b15.type._context, e6 = b15.pendingProps, f = b15.memoizedProps, g = e6.value, G(lg, d8._currentValue), d8._currentValue = g, null !== f) {
if (d8 = b16.type._context, e6 = b16.pendingProps, f = b16.memoizedProps, g = e6.value, G(lg, d8._currentValue), d8._currentValue = g, null !== f) {
if (Ge(f.value, g)) {
if (f.children === e6.children && !Vf.current) {
b15 = gj(a18, b15, c9);
b16 = gj(a19, b16, c9);
break a;
}
} else for(null !== (f = b15.child) && (f.return = b15); null !== f;){
} else for(null !== (f = b16.child) && (f.return = b16); null !== f;){
var h = f.dependencies;
if (null !== h) {
g = f.child;
@ -5378,19 +5369,19 @@
null === n ? k.next = k : (k.next = n.next, n.next = k), l.pending = k;
}
}
f.lanes |= c9, null !== (k = f.alternate) && (k.lanes |= c9), rg(f.return, c9, b15), h.lanes |= c9;
f.lanes |= c9, null !== (k = f.alternate) && (k.lanes |= c9), rg(f.return, c9, b16), h.lanes |= c9;
break;
}
k = k.next;
}
} else if (10 === f.tag) g = f.type === b15.type ? null : f.child;
} else if (10 === f.tag) g = f.type === b16.type ? null : f.child;
else if (18 === f.tag) {
if (null === (g = f.return)) throw Error(p(341));
g.lanes |= c9, null !== (h = g.alternate) && (h.lanes |= c9), rg(g, c9, b15), g = f.sibling;
g.lanes |= c9, null !== (h = g.alternate) && (h.lanes |= c9), rg(g, c9, b16), g = f.sibling;
} else g = f.child;
if (null !== g) g.return = f;
else for(g = f; null !== g;){
if (g === b15) {
if (g === b16) {
g = null;
break;
}
@ -5403,23 +5394,23 @@
f = g;
}
}
ej(a18, b15, e6.children, c9), b15 = b15.child;
ej(a19, b16, e6.children, c9), b16 = b16.child;
}
return b15;
return b16;
case 9:
return e6 = b15.type, d8 = b15.pendingProps.children, sg(b15, c9), e6 = ug(e6), d8 = d8(e6), b15.flags |= 1, ej(a18, b15, d8, c9), b15.child;
return e6 = b16.type, d8 = b16.pendingProps.children, sg(b16, c9), e6 = ug(e6), d8 = d8(e6), b16.flags |= 1, ej(a19, b16, d8, c9), b16.child;
case 14:
return e6 = kg(d8 = b15.type, b15.pendingProps), e6 = kg(d8.type, e6), hj(a18, b15, d8, e6, c9);
return e6 = kg(d8 = b16.type, b16.pendingProps), e6 = kg(d8.type, e6), hj(a19, b16, d8, e6, c9);
case 15:
return jj(a18, b15, b15.type, b15.pendingProps, c9);
return jj(a19, b16, b16.type, b16.pendingProps, c9);
case 17:
return d8 = b15.type, e6 = b15.pendingProps, e6 = b15.elementType === d8 ? e6 : kg(d8, e6), null !== a18 && (a18.alternate = null, b15.alternate = null, b15.flags |= 2), b15.tag = 1, Yf(d8) ? (a18 = !0, bg(b15)) : a18 = !1, sg(b15, c9), Og(b15, d8, e6), Qg(b15, d8, e6, c9), pj(null, b15, d8, !0, a18, c9);
return d8 = b16.type, e6 = b16.pendingProps, e6 = b16.elementType === d8 ? e6 : kg(d8, e6), null !== a19 && (a19.alternate = null, b16.alternate = null, b16.flags |= 2), b16.tag = 1, Yf(d8) ? (a19 = !0, bg(b16)) : a19 = !1, sg(b16, c9), Og(b16, d8, e6), Qg(b16, d8, e6, c9), pj(null, b16, d8, !0, a19, c9);
case 19:
return Ej(a18, b15, c9);
return Ej(a19, b16, c9);
case 22:
return lj(a18, b15, c9);
return lj(a19, b16, c9);
}
throw Error(p(156, b15.tag));
throw Error(p(156, b16.tag));
};
var jl = "function" == typeof reportError ? reportError : function(a) {
console.error(a);
@ -5437,7 +5428,7 @@
return !(!a || 1 !== a.nodeType && 9 !== a.nodeType && 11 !== a.nodeType && (8 !== a.nodeType || " react-mount-point-unstable " !== a.nodeValue));
}
function ol() {}
function ql(a19, b16, c10, d9, e7) {
function ql(a20, b17, c10, d9, e7) {
var f5 = c10._reactRootContainer;
if (f5) {
var g = f5;
@ -5448,8 +5439,8 @@
h.call(a);
};
}
el(b16, g, a19, e7);
} else g = function(a20, b, c, d, e) {
el(b17, g, a20, e7);
} else g = function(a21, b, c, d, e) {
if (e) {
if ("function" == typeof d) {
var f = d;
@ -5458,10 +5449,10 @@
f.call(a);
};
}
var g = dl(b, d, a20, 0, null, !1, !1, "", ol);
return a20._reactRootContainer = g, a20[tf] = g.current, rf(8 === a20.nodeType ? a20.parentNode : a20), Qk(), g;
var g = dl(b, d, a21, 0, null, !1, !1, "", ol);
return a21._reactRootContainer = g, a21[tf] = g.current, rf(8 === a21.nodeType ? a21.parentNode : a21), Qk(), g;
}
for(; e = a20.lastChild;)a20.removeChild(e);
for(; e = a21.lastChild;)a21.removeChild(e);
if ("function" == typeof d) {
var h = d;
d = function() {
@ -5469,11 +5460,11 @@
h.call(a);
};
}
var k = al(a20, 0, !1, null, null, !1, !1, "", ol);
return a20._reactRootContainer = k, a20[tf] = k.current, rf(8 === a20.nodeType ? a20.parentNode : a20), Qk(function() {
var k = al(a21, 0, !1, null, null, !1, !1, "", ol);
return a21._reactRootContainer = k, a21[tf] = k.current, rf(8 === a21.nodeType ? a21.parentNode : a21), Qk(function() {
el(b, k, c, d);
}), k;
}(c10, b16, a19, e7, d9);
}(c10, b17, a20, e7, d9);
return fl(g);
}
ll.prototype.render = kl.prototype.render = function(a) {
@ -5600,9 +5591,9 @@
Eb,
Pk
]
}, exports.createPortal = function(a21, b17) {
}, exports.createPortal = function(a22, b18) {
var c = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
if (!ml(b17)) throw Error(p(200));
if (!ml(b18)) throw Error(p(200));
return function(a, b, c) {
var d = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
return {
@ -5612,7 +5603,7 @@
containerInfo: b,
implementation: null
};
}(a21, b17, null, c);
}(a22, b18, null, c);
}, exports.createRoot = function(a, b) {
if (!ml(a)) throw Error(p(299));
var c = !1, d = "", e = jl;
@ -5952,65 +5943,65 @@
return "object" == typeof a && null !== a && a.$$typeof === l;
}
var P = /\/+/g;
function Q(a23, b) {
var a22, b18;
return "object" == typeof a23 && null !== a23 && null != a23.key ? (a22 = "" + a23.key, b18 = {
function Q(a24, b) {
var a23, b19;
return "object" == typeof a24 && null !== a24 && null != a24.key ? (a23 = "" + a24.key, b19 = {
"=": "=0",
":": "=2"
}, "$" + a22.replace(/[=:]/g, function(a) {
return b18[a];
}, "$" + a23.replace(/[=:]/g, function(a) {
return b19[a];
})) : b.toString(36);
}
function R(a26, b, e, d, c) {
var a24, b19, a25, k = typeof a26;
("undefined" === k || "boolean" === k) && (a26 = null);
function R(a27, b, e, d, c) {
var a25, b20, a26, k = typeof a27;
("undefined" === k || "boolean" === k) && (a27 = null);
var h = !1;
if (null === a26) h = !0;
if (null === a27) h = !0;
else switch(k){
case "string":
case "number":
h = !0;
break;
case "object":
switch(a26.$$typeof){
switch(a27.$$typeof){
case l:
case n:
h = !0;
}
}
if (h) return c = c(h = a26), a26 = "" === d ? "." + Q(h, 0) : d, I(c) ? (e = "", null != a26 && (e = a26.replace(P, "$&/") + "/"), R(c, b, e, "", function(a) {
if (h) return c = c(h = a27), a27 = "" === d ? "." + Q(h, 0) : d, I(c) ? (e = "", null != a27 && (e = a27.replace(P, "$&/") + "/"), R(c, b, e, "", function(a) {
return a;
})) : null != c && (O(c) && (c = (a24 = c, b19 = e + (!c.key || h && h.key === c.key ? "" : ("" + c.key).replace(P, "$&/") + "/") + a26, {
})) : null != c && (O(c) && (c = (a25 = c, b20 = e + (!c.key || h && h.key === c.key ? "" : ("" + c.key).replace(P, "$&/") + "/") + a27, {
$$typeof: l,
type: a24.type,
key: b19,
ref: a24.ref,
props: a24.props,
_owner: a24._owner
type: a25.type,
key: b20,
ref: a25.ref,
props: a25.props,
_owner: a25._owner
})), b.push(c)), 1;
if (h = 0, d = "" === d ? "." : d + ":", I(a26)) for(var g = 0; g < a26.length; g++){
var f = d + Q(k = a26[g], g);
if (h = 0, d = "" === d ? "." : d + ":", I(a27)) for(var g = 0; g < a27.length; g++){
var f = d + Q(k = a27[g], g);
h += R(k, b, e, f, c);
}
else if ("function" == typeof (f = null === (a25 = a26) || "object" != typeof a25 ? null : "function" == typeof (a25 = z && a25[z] || a25["@@iterator"]) ? a25 : null)) for(a26 = f.call(a26), g = 0; !(k = a26.next()).done;)f = d + Q(k = k.value, g++), h += R(k, b, e, f, c);
else if ("object" === k) throw Error("Objects are not valid as a React child (found: " + ("[object Object]" === (b = String(a26)) ? "object with keys {" + Object.keys(a26).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead.");
else if ("function" == typeof (f = null === (a26 = a27) || "object" != typeof a26 ? null : "function" == typeof (a26 = z && a26[z] || a26["@@iterator"]) ? a26 : null)) for(a27 = f.call(a27), g = 0; !(k = a27.next()).done;)f = d + Q(k = k.value, g++), h += R(k, b, e, f, c);
else if ("object" === k) throw Error("Objects are not valid as a React child (found: " + ("[object Object]" === (b = String(a27)) ? "object with keys {" + Object.keys(a27).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead.");
return h;
}
function S(a27, b, e) {
if (null == a27) return a27;
function S(a28, b, e) {
if (null == a28) return a28;
var d = [], c = 0;
return R(a27, d, "", "", function(a) {
return R(a28, d, "", "", function(a) {
return b.call(e, a, c++);
}), d;
}
function T(a) {
if (-1 === a._status) {
var b20 = a._result;
(b20 = b20()).then(function(b) {
var b21 = a._result;
(b21 = b21()).then(function(b) {
(0 === a._status || -1 === a._status) && (a._status = 1, a._result = b);
}, function(b) {
(0 === a._status || -1 === a._status) && (a._status = 2, a._result = b);
}), -1 === a._status && (a._status = 0, a._result = b20);
}), -1 === a._status && (a._status = 0, a._result = b21);
}
if (1 === a._status) return a._result.default;
throw a._result;
@ -6033,8 +6024,8 @@
b++;
}), b;
},
toArray: function(a28) {
return S(a28, function(a) {
toArray: function(a29) {
return S(a29, function(a) {
return a;
}) || [];
},

File diff suppressed because one or more lines are too long

View File

@ -527,13 +527,13 @@
element[name] = value;
},
text: function() {
var NODE_TYPE_TEXT_PROPERTY = [];
return msie < 9 ? (NODE_TYPE_TEXT_PROPERTY[1] = "innerText", NODE_TYPE_TEXT_PROPERTY[3] = "nodeValue") : NODE_TYPE_TEXT_PROPERTY[1] = NODE_TYPE_TEXT_PROPERTY[3] = "textContent", getText.$dv = "", getText;
function getText(element, value) {
var textProp = NODE_TYPE_TEXT_PROPERTY[element.nodeType];
if (isUndefined(value)) return textProp ? element[textProp] : "";
element[textProp] = value;
}
var NODE_TYPE_TEXT_PROPERTY = [];
return msie < 9 ? (NODE_TYPE_TEXT_PROPERTY[1] = "innerText", NODE_TYPE_TEXT_PROPERTY[3] = "nodeValue") : NODE_TYPE_TEXT_PROPERTY[1] = NODE_TYPE_TEXT_PROPERTY[3] = "textContent", getText.$dv = "", getText;
}(),
val: function(element, value) {
if (isUndefined(value)) {
@ -722,43 +722,6 @@
}), fn.$inject = $inject) : isArray(fn) ? (last = fn.length - 1, assertArgFn(fn[last], "fn"), $inject = fn.slice(0, last)) : assertArgFn(fn, "fn", !0), $inject;
}
function createInjector(modulesToLoad1) {
var INSTANTIATING = {}, providerSuffix = "Provider", path = [], loadedModules = new HashMap(), providerCache = {
$provide: {
provider: supportObject(provider1),
factory: supportObject(factory1),
service: supportObject(function(name, constructor) {
return factory1(name, [
"$injector",
function($injector) {
return $injector.instantiate(constructor);
},
]);
}),
value: supportObject(function(name, val) {
return factory1(name, valueFn1(val));
}),
constant: supportObject(function(name, value) {
assertNotHasOwnProperty(name, "constant"), providerCache[name] = value, instanceCache[name] = value;
}),
decorator: function(serviceName, decorFn) {
var origProvider = providerInjector.get(serviceName + providerSuffix), orig$get = origProvider.$get;
origProvider.$get = function() {
var origInstance = instanceInjector.invoke(orig$get, origProvider);
return instanceInjector.invoke(decorFn, null, {
$delegate: origInstance
});
};
}
}
}, providerInjector = providerCache.$injector = createInternalInjector(providerCache, function() {
throw $injectorMinErr1("unpr", "Unknown provider: {0}", path.join(" <- "));
}), instanceCache = {}, instanceInjector = instanceCache.$injector = createInternalInjector(instanceCache, function(servicename) {
var provider = providerInjector.get(servicename + providerSuffix);
return instanceInjector.invoke(provider.$get, provider);
});
return forEach(loadModules(modulesToLoad1), function(fn) {
instanceInjector.invoke(fn || noop);
}), instanceInjector;
function supportObject(delegate) {
return function(key, value) {
if (!isObject(key)) return delegate(key, value);
@ -824,6 +787,43 @@
}
};
}
var INSTANTIATING = {}, providerSuffix = "Provider", path = [], loadedModules = new HashMap(), providerCache = {
$provide: {
provider: supportObject(provider1),
factory: supportObject(factory1),
service: supportObject(function(name, constructor) {
return factory1(name, [
"$injector",
function($injector) {
return $injector.instantiate(constructor);
},
]);
}),
value: supportObject(function(name, val) {
return factory1(name, valueFn1(val));
}),
constant: supportObject(function(name, value) {
assertNotHasOwnProperty(name, "constant"), providerCache[name] = value, instanceCache[name] = value;
}),
decorator: function(serviceName, decorFn) {
var origProvider = providerInjector.get(serviceName + providerSuffix), orig$get = origProvider.$get;
origProvider.$get = function() {
var origInstance = instanceInjector.invoke(orig$get, origProvider);
return instanceInjector.invoke(decorFn, null, {
$delegate: origInstance
});
};
}
}
}, providerInjector = providerCache.$injector = createInternalInjector(providerCache, function() {
throw $injectorMinErr1("unpr", "Unknown provider: {0}", path.join(" <- "));
}), instanceCache = {}, instanceInjector = instanceCache.$injector = createInternalInjector(instanceCache, function(servicename) {
var provider = providerInjector.get(servicename + providerSuffix);
return instanceInjector.invoke(provider.$get, provider);
});
return forEach(loadModules(modulesToLoad1), function(fn) {
instanceInjector.invoke(fn || noop);
}), instanceInjector;
}
function $AnchorScrollProvider() {
var autoScrollingEnabled = !0;
@ -962,6 +962,12 @@
this.$get = function() {
var caches = {};
function cacheFactory(cacheId, options) {
function refresh(entry) {
entry != freshEnd && (staleEnd ? staleEnd == entry && (staleEnd = entry.n) : staleEnd = entry, link(entry.n, entry.p), link(entry, freshEnd), (freshEnd = entry).n = null);
}
function link(nextEntry, prevEntry) {
nextEntry != prevEntry && (nextEntry && (nextEntry.p = prevEntry), prevEntry && (prevEntry.n = nextEntry));
}
if (cacheId in caches) throw minErr("$cacheFactory")("iid", "CacheId '{0}' is already taken!", cacheId);
var size = 0, stats = extend({}, options, {
id: cacheId
@ -992,12 +998,6 @@
});
}
};
function refresh(entry) {
entry != freshEnd && (staleEnd ? staleEnd == entry && (staleEnd = entry.n) : staleEnd = entry, link(entry.n, entry.p), link(entry, freshEnd), (freshEnd = entry).n = null);
}
function link(nextEntry, prevEntry) {
nextEntry != prevEntry && (nextEntry && (nextEntry.p = prevEntry), prevEntry && (prevEntry.n = nextEntry));
}
}
return cacheFactory.info = function() {
var info = {};
@ -1056,43 +1056,6 @@
"$animate",
"$$sanitizeUri",
function($injector, $interpolate, $exceptionHandler, $http, $templateCache, $parse, $controller, $rootScope, $document, $sce, $animate, $$sanitizeUri) {
var Attributes = function(element, attr) {
this.$$element = element, this.$attr = attr || {};
};
Attributes.prototype = {
$normalize: directiveNormalize,
$addClass: function(classVal) {
classVal && classVal.length > 0 && $animate.addClass(this.$$element, classVal);
},
$removeClass: function(classVal) {
classVal && classVal.length > 0 && $animate.removeClass(this.$$element, classVal);
},
$updateClass: function(newClasses, oldClasses) {
this.$removeClass(tokenDifference(oldClasses, newClasses)), this.$addClass(tokenDifference(newClasses, oldClasses));
},
$set: function(key, value, writeAttr, attrName) {
var nodeName, booleanKey = getBooleanAttrName(this.$$element[0], key);
booleanKey && (this.$$element.prop(key, value), attrName = booleanKey), this[key] = value, attrName ? this.$attr[key] = attrName : (attrName = this.$attr[key]) || (this.$attr[key] = attrName = snake_case(key, "-")), ("A" === (nodeName = nodeName_(this.$$element)) && "href" === key || "IMG" === nodeName && "src" === key) && (this[key] = value = $$sanitizeUri(value, "src" === key)), !1 !== writeAttr && (null === value || value === undefined ? this.$$element.removeAttr(attrName) : this.$$element.attr(attrName, value));
var $$observers = this.$$observers;
$$observers && forEach($$observers[key], function(fn) {
try {
fn(value);
} catch (e) {
$exceptionHandler(e);
}
});
},
$observe: function(key, fn) {
var attrs = this, $$observers = attrs.$$observers || (attrs.$$observers = {}), listeners = $$observers[key] || ($$observers[key] = []);
return listeners.push(fn), $rootScope.$evalAsync(function() {
listeners.$$inter || fn(attrs[key]);
}), fn;
}
};
var startSymbol = $interpolate.startSymbol(), endSymbol = $interpolate.endSymbol(), denormalizeTemplate = "{{" == startSymbol || "}}" == endSymbol ? identity : function(template) {
return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
}, NG_ATTR_BINDING = /^ngAttr[A-Z]/;
return compile;
function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) {
$compileNodes instanceof jqLite || ($compileNodes = jqLite($compileNodes)), forEach($compileNodes, function(node, index) {
3 == node.nodeType && node.nodeValue.match(/\S+/) && ($compileNodes[index] = node = jqLite(node).wrap("<span></span>").parent()[0]);
@ -1172,34 +1135,6 @@
};
}
function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn1, jqCollection, originalReplaceDirective, preLinkFns, postLinkFns, previousCompileContext) {
previousCompileContext = previousCompileContext || {};
for(var newScopeDirective, directive1, directiveName, $template, linkFn1, directiveValue, terminalPriority = -Number.MAX_VALUE, controllerDirectives = previousCompileContext.controllerDirectives, newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, templateDirective = previousCompileContext.templateDirective, nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective, hasTranscludeDirective = !1, hasElementTranscludeDirective = !1, $compileNode = templateAttrs.$$element = jqLite(compileNode), replaceDirective = originalReplaceDirective, childTranscludeFn = transcludeFn1, i2 = 0, ii1 = directives.length; i2 < ii1; i2++){
var attrStart = (directive1 = directives[i2]).$$start, attrEnd = directive1.$$end;
if (attrStart && ($compileNode = groupScan(compileNode, attrStart, attrEnd)), $template = undefined, terminalPriority > directive1.priority) break;
if ((directiveValue = directive1.scope) && (newScopeDirective = newScopeDirective || directive1, !directive1.templateUrl && (assertNoDuplicate("new/isolated scope", newIsolateScopeDirective, directive1, $compileNode), isObject(directiveValue) && (newIsolateScopeDirective = directive1))), directiveName = directive1.name, !directive1.templateUrl && directive1.controller && (directiveValue = directive1.controller, assertNoDuplicate("'" + directiveName + "' controller", (controllerDirectives = controllerDirectives || {})[directiveName], directive1, $compileNode), controllerDirectives[directiveName] = directive1), (directiveValue = directive1.transclude) && (hasTranscludeDirective = !0, directive1.$$tlb || (assertNoDuplicate("transclusion", nonTlbTranscludeDirective, directive1, $compileNode), nonTlbTranscludeDirective = directive1), "element" == directiveValue ? (hasElementTranscludeDirective = !0, terminalPriority = directive1.priority, $template = groupScan(compileNode, attrStart, attrEnd), compileNode = ($compileNode = templateAttrs.$$element = jqLite(document1.createComment(" " + directiveName + ": " + templateAttrs[directiveName] + " ")))[0], replaceWith(jqCollection, jqLite(sliceArgs($template)), compileNode), childTranscludeFn = compile($template, transcludeFn1, terminalPriority, replaceDirective && replaceDirective.name, {
nonTlbTranscludeDirective: nonTlbTranscludeDirective
})) : ($template = jqLite(jqLiteClone(compileNode)).contents(), $compileNode.empty(), childTranscludeFn = compile($template, transcludeFn1))), directive1.template) if (assertNoDuplicate("template", templateDirective, directive1, $compileNode), templateDirective = directive1, directiveValue = isFunction(directive1.template) ? directive1.template($compileNode, templateAttrs) : directive1.template, directiveValue = denormalizeTemplate(directiveValue), directive1.replace) {
if (replaceDirective = directive1, compileNode = ($template = jqLite("<div>" + trim1(directiveValue) + "</div>").contents())[0], 1 != $template.length || 1 !== compileNode.nodeType) throw $compileMinErr("tplrt", "Template for directive '{0}' must have exactly one root element. {1}", directiveName, "");
replaceWith(jqCollection, $compileNode, compileNode);
var newTemplateAttrs = {
$attr: {}
}, templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs), unprocessedDirectives = directives.splice(i2 + 1, directives.length - (i2 + 1));
newIsolateScopeDirective && markDirectivesAsIsolate(templateDirectives), directives = directives.concat(templateDirectives).concat(unprocessedDirectives), mergeTemplateAttributes(templateAttrs, newTemplateAttrs), ii1 = directives.length;
} else $compileNode.html(directiveValue);
if (directive1.templateUrl) assertNoDuplicate("template", templateDirective, directive1, $compileNode), templateDirective = directive1, directive1.replace && (replaceDirective = directive1), nodeLinkFn = compileTemplateUrl(directives.splice(i2, directives.length - i2), $compileNode, templateAttrs, jqCollection, childTranscludeFn, preLinkFns, postLinkFns, {
controllerDirectives: controllerDirectives,
newIsolateScopeDirective: newIsolateScopeDirective,
templateDirective: templateDirective,
nonTlbTranscludeDirective: nonTlbTranscludeDirective
}), ii1 = directives.length;
else if (directive1.compile) try {
linkFn1 = directive1.compile($compileNode, templateAttrs, childTranscludeFn), isFunction(linkFn1) ? addLinkFns(null, linkFn1, attrStart, attrEnd) : linkFn1 && addLinkFns(linkFn1.pre, linkFn1.post, attrStart, attrEnd);
} catch (e) {
$exceptionHandler(e, startingTag($compileNode));
}
directive1.terminal && (nodeLinkFn.terminal = !0, terminalPriority = Math.max(terminalPriority, directive1.priority));
}
return nodeLinkFn.scope = newScopeDirective && !0 === newScopeDirective.scope, nodeLinkFn.transclude = hasTranscludeDirective && childTranscludeFn, nodeLinkFn;
function addLinkFns(pre, post, attrStart, attrEnd) {
pre && (attrStart && (pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd)), pre.require = directive1.require, (newIsolateScopeDirective === directive1 || directive1.$$isolateScope) && (pre = cloneAndAnnotateFn(pre, {
isolateScope: !0
@ -1212,11 +1147,10 @@
if (isString(require1)) {
for(; "^" == (value = require1.charAt(0)) || "?" == value;)require1 = require1.substr(1), "^" == value && (retrievalMethod = "inheritedData"), optional = optional || "?" == value;
if (value = null, elementControllers && "data" === retrievalMethod && (value = elementControllers[require1]), !(value = value || $element[retrievalMethod]("$" + require1 + "Controller")) && !optional) throw $compileMinErr("ctreq", "Controller '{0}', required by directive '{1}', can't be found!", require1, directiveName);
return value;
}
return isArray(require1) && (value = [], forEach(require1, function(require) {
} else isArray(require1) && (value = [], forEach(require1, function(require) {
value.push(getControllers(require, $element, elementControllers));
})), value;
}));
return value;
}
function nodeLinkFn(childLinkFn, scope1, linkNode, $rootElement, boundTranscludeFn) {
var attrs, $element, i, ii, linkFn, controller, isolateScope, transcludeFn, elementControllers = {};
@ -1277,6 +1211,36 @@
$exceptionHandler(e2, startingTag($element));
}
}
previousCompileContext = previousCompileContext || {};
for(var newScopeDirective, directive1, directiveName, $template, linkFn1, directiveValue, terminalPriority = -Number.MAX_VALUE, controllerDirectives = previousCompileContext.controllerDirectives, newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, templateDirective = previousCompileContext.templateDirective, nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective, hasTranscludeDirective = !1, hasElementTranscludeDirective = !1, $compileNode = templateAttrs.$$element = jqLite(compileNode), replaceDirective = originalReplaceDirective, childTranscludeFn = transcludeFn1, i2 = 0, ii1 = directives.length; i2 < ii1; i2++){
var attrStart1 = (directive1 = directives[i2]).$$start, attrEnd1 = directive1.$$end;
if (attrStart1 && ($compileNode = groupScan(compileNode, attrStart1, attrEnd1)), $template = undefined, terminalPriority > directive1.priority) break;
if ((directiveValue = directive1.scope) && (newScopeDirective = newScopeDirective || directive1, !directive1.templateUrl && (assertNoDuplicate("new/isolated scope", newIsolateScopeDirective, directive1, $compileNode), isObject(directiveValue) && (newIsolateScopeDirective = directive1))), directiveName = directive1.name, !directive1.templateUrl && directive1.controller && (directiveValue = directive1.controller, assertNoDuplicate("'" + directiveName + "' controller", (controllerDirectives = controllerDirectives || {})[directiveName], directive1, $compileNode), controllerDirectives[directiveName] = directive1), (directiveValue = directive1.transclude) && (hasTranscludeDirective = !0, directive1.$$tlb || (assertNoDuplicate("transclusion", nonTlbTranscludeDirective, directive1, $compileNode), nonTlbTranscludeDirective = directive1), "element" == directiveValue ? (hasElementTranscludeDirective = !0, terminalPriority = directive1.priority, $template = groupScan(compileNode, attrStart1, attrEnd1), compileNode = ($compileNode = templateAttrs.$$element = jqLite(document1.createComment(" " + directiveName + ": " + templateAttrs[directiveName] + " ")))[0], replaceWith(jqCollection, jqLite(sliceArgs($template)), compileNode), childTranscludeFn = compile($template, transcludeFn1, terminalPriority, replaceDirective && replaceDirective.name, {
nonTlbTranscludeDirective: nonTlbTranscludeDirective
})) : ($template = jqLite(jqLiteClone(compileNode)).contents(), $compileNode.empty(), childTranscludeFn = compile($template, transcludeFn1))), directive1.template) {
if (assertNoDuplicate("template", templateDirective, directive1, $compileNode), templateDirective = directive1, directiveValue = isFunction(directive1.template) ? directive1.template($compileNode, templateAttrs) : directive1.template, directiveValue = denormalizeTemplate(directiveValue), directive1.replace) {
if (replaceDirective = directive1, compileNode = ($template = jqLite("<div>" + trim1(directiveValue) + "</div>").contents())[0], 1 != $template.length || 1 !== compileNode.nodeType) throw $compileMinErr("tplrt", "Template for directive '{0}' must have exactly one root element. {1}", directiveName, "");
replaceWith(jqCollection, $compileNode, compileNode);
var newTemplateAttrs = {
$attr: {}
}, templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs), unprocessedDirectives = directives.splice(i2 + 1, directives.length - (i2 + 1));
newIsolateScopeDirective && markDirectivesAsIsolate(templateDirectives), directives = directives.concat(templateDirectives).concat(unprocessedDirectives), mergeTemplateAttributes(templateAttrs, newTemplateAttrs), ii1 = directives.length;
} else $compileNode.html(directiveValue);
}
if (directive1.templateUrl) assertNoDuplicate("template", templateDirective, directive1, $compileNode), templateDirective = directive1, directive1.replace && (replaceDirective = directive1), nodeLinkFn = compileTemplateUrl(directives.splice(i2, directives.length - i2), $compileNode, templateAttrs, jqCollection, childTranscludeFn, preLinkFns, postLinkFns, {
controllerDirectives: controllerDirectives,
newIsolateScopeDirective: newIsolateScopeDirective,
templateDirective: templateDirective,
nonTlbTranscludeDirective: nonTlbTranscludeDirective
}), ii1 = directives.length;
else if (directive1.compile) try {
linkFn1 = directive1.compile($compileNode, templateAttrs, childTranscludeFn), isFunction(linkFn1) ? addLinkFns(null, linkFn1, attrStart1, attrEnd1) : linkFn1 && addLinkFns(linkFn1.pre, linkFn1.post, attrStart1, attrEnd1);
} catch (e) {
$exceptionHandler(e, startingTag($compileNode));
}
directive1.terminal && (nodeLinkFn.terminal = !0, terminalPriority = Math.max(terminalPriority, directive1.priority));
}
return nodeLinkFn.scope = newScopeDirective && !0 === newScopeDirective.scope, nodeLinkFn.transclude = hasTranscludeDirective && childTranscludeFn, nodeLinkFn;
}
function markDirectivesAsIsolate(directives) {
for(var j = 0, jj = directives.length; j < jj; j++)directives[j] = inherit(directives[j], {
@ -1403,6 +1367,43 @@
return fn.apply(null, arguments);
}, fn, annotation);
}
var Attributes = function(element, attr) {
this.$$element = element, this.$attr = attr || {};
};
Attributes.prototype = {
$normalize: directiveNormalize,
$addClass: function(classVal) {
classVal && classVal.length > 0 && $animate.addClass(this.$$element, classVal);
},
$removeClass: function(classVal) {
classVal && classVal.length > 0 && $animate.removeClass(this.$$element, classVal);
},
$updateClass: function(newClasses, oldClasses) {
this.$removeClass(tokenDifference(oldClasses, newClasses)), this.$addClass(tokenDifference(newClasses, oldClasses));
},
$set: function(key, value, writeAttr, attrName) {
var nodeName, booleanKey = getBooleanAttrName(this.$$element[0], key);
booleanKey && (this.$$element.prop(key, value), attrName = booleanKey), this[key] = value, attrName ? this.$attr[key] = attrName : (attrName = this.$attr[key]) || (this.$attr[key] = attrName = snake_case(key, "-")), ("A" === (nodeName = nodeName_(this.$$element)) && "href" === key || "IMG" === nodeName && "src" === key) && (this[key] = value = $$sanitizeUri(value, "src" === key)), !1 !== writeAttr && (null === value || value === undefined ? this.$$element.removeAttr(attrName) : this.$$element.attr(attrName, value));
var $$observers = this.$$observers;
$$observers && forEach($$observers[key], function(fn) {
try {
fn(value);
} catch (e) {
$exceptionHandler(e);
}
});
},
$observe: function(key, fn) {
var attrs = this, $$observers = attrs.$$observers || (attrs.$$observers = {}), listeners = $$observers[key] || ($$observers[key] = []);
return listeners.push(fn), $rootScope.$evalAsync(function() {
listeners.$$inter || fn(attrs[key]);
}), fn;
}
};
var startSymbol = $interpolate.startSymbol(), endSymbol = $interpolate.endSymbol(), denormalizeTemplate = "{{" == startSymbol || "}}" == endSymbol ? identity : function(template) {
return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
}, NG_ATTR_BINDING = /^ngAttr[A-Z]/;
return compile;
},
];
}
@ -1515,10 +1516,22 @@
function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector) {
var defaultCache = $cacheFactory("$http"), reversedInterceptors = [];
function $http(requestConfig) {
function transformResponse(response) {
var resp = extend({}, response, {
data: transformData(response.data, response.headers, config1.transformResponse)
});
return isSuccess(response.status) ? resp : $q.reject(resp);
}
var config1 = {
transformRequest: defaults.transformRequest,
transformResponse: defaults.transformResponse
}, headers1 = function(config) {
function execHeaders(headers) {
var headerContent;
forEach(headers, function(headerFn, header) {
isFunction(headerFn) && (null != (headerContent = headerFn()) ? headers[header] = headerContent : delete headers[header]);
});
}
var defHeaderName, lowercaseDefHeaderName, reqHeaderName, defHeaders = defaults.headers, reqHeaders = extend({}, config.headers);
execHeaders(defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)])), execHeaders(reqHeaders);
defaultHeadersIteration: for(defHeaderName in defHeaders){
@ -1526,47 +1539,74 @@
reqHeaders[defHeaderName] = defHeaders[defHeaderName];
}
return reqHeaders;
function execHeaders(headers) {
var headerContent;
forEach(headers, function(headerFn, header) {
isFunction(headerFn) && (null != (headerContent = headerFn()) ? headers[header] = headerContent : delete headers[header]);
});
}
}(requestConfig);
extend(config1, requestConfig), config1.headers = headers1, config1.method = uppercase(config1.method);
var xsrfValue = urlIsSameOrigin(config1.url) ? $browser.cookies()[config1.xsrfCookieName || defaults.xsrfCookieName] : undefined;
xsrfValue && (headers1[config1.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue);
var chain = [
function(config) {
headers1 = config.headers;
var reqData = transformData(config.data, headersGetter(headers1), config.transformRequest);
return isUndefined(config.data) && forEach(headers1, function(value, header) {
function(config2) {
headers1 = config2.headers;
var reqData1 = transformData(config2.data, headersGetter(headers1), config2.transformRequest);
return isUndefined(config2.data) && forEach(headers1, function(value, header) {
"content-type" === lowercase(header) && delete headers1[header];
}), isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials) && (config.withCredentials = defaults.withCredentials), sendReq(config, reqData, headers1).then(transformResponse, transformResponse);
}), isUndefined(config2.withCredentials) && !isUndefined(defaults.withCredentials) && (config2.withCredentials = defaults.withCredentials), (function(config, reqData, reqHeaders) {
function resolvePromise(response, status, headers) {
(isSuccess(status = Math.max(status, 0)) ? deferred.resolve : deferred.reject)({
data: response,
status: status,
headers: headersGetter(headers),
config: config
});
}
function removePendingReq() {
var idx = indexOf($http.pendingRequests, config);
-1 !== idx && $http.pendingRequests.splice(idx, 1);
}
var cache, cachedResp, deferred = $q.defer(), promise = deferred.promise, url1 = function(url, params) {
if (!params) return url;
var parts = [];
return function(obj, iterator, context) {
for(var keys = sortedKeys(obj), i = 0; i < keys.length; i++)iterator.call(void 0, obj[keys[i]], keys[i]);
}(params, function(value, key) {
null === value || isUndefined(value) || (isArray(value) || (value = [
value
]), forEach(value, function(v) {
isObject(v) && (v = toJson(v)), parts.push(encodeUriQuery(key) + "=" + encodeUriQuery(v));
}));
}), url + (-1 == url.indexOf("?") ? "?" : "&") + parts.join("&");
}(config.url, config.params);
if ($http.pendingRequests.push(config), promise.then(removePendingReq, removePendingReq), (config.cache || defaults.cache) && !1 !== config.cache && "GET" == config.method && (cache = isObject(config.cache) ? config.cache : isObject(defaults.cache) ? defaults.cache : defaultCache), cache) {
if (isDefined(cachedResp = cache.get(url1))) {
if (cachedResp.then) return cachedResp.then(removePendingReq, removePendingReq), cachedResp;
isArray(cachedResp) ? resolvePromise(cachedResp[1], cachedResp[0], copy(cachedResp[2])) : resolvePromise(cachedResp, 200, {});
} else cache.put(url1, promise);
}
return isUndefined(cachedResp) && $httpBackend(config.method, url1, reqData, function(status, response, headersString) {
cache && (isSuccess(status) ? cache.put(url1, [
status,
response,
parseHeaders(headersString)
]) : cache.remove(url1)), resolvePromise(response, status, headersString), $rootScope.$$phase || $rootScope.$apply();
}, reqHeaders, config.timeout, config.withCredentials, config.responseType), promise;
})(config2, reqData1, headers1).then(transformResponse, transformResponse);
},
undefined
], promise = $q.when(config1);
], promise1 = $q.when(config1);
for(forEach(reversedInterceptors, function(interceptor) {
(interceptor.request || interceptor.requestError) && chain.unshift(interceptor.request, interceptor.requestError), (interceptor.response || interceptor.responseError) && chain.push(interceptor.response, interceptor.responseError);
}); chain.length;){
var thenFn = chain.shift(), rejectFn = chain.shift();
promise = promise.then(thenFn, rejectFn);
promise1 = promise1.then(thenFn, rejectFn);
}
return promise.success = function(fn) {
return promise.then(function(response) {
return promise1.success = function(fn) {
return promise1.then(function(response) {
fn(response.data, response.status, response.headers, config1);
}), promise;
}, promise.error = function(fn) {
return promise.then(null, function(response) {
}), promise1;
}, promise1.error = function(fn) {
return promise1.then(null, function(response) {
fn(response.data, response.status, response.headers, config1);
}), promise;
}, promise;
function transformResponse(response) {
var resp = extend({}, response, {
data: transformData(response.data, response.headers, config1.transformResponse)
});
return isSuccess(response.status) ? resp : $q.reject(resp);
}
}), promise1;
}, promise1;
}
return forEach(interceptorFactories, function(interceptorFactory) {
reversedInterceptors.unshift(isString(interceptorFactory) ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));
@ -1600,45 +1640,6 @@
};
});
}("post", "put"), $http.defaults = defaults, $http;
function sendReq(config, reqData, reqHeaders) {
var cache, cachedResp, deferred = $q.defer(), promise = deferred.promise, url = buildUrl(config.url, config.params);
if ($http.pendingRequests.push(config), promise.then(removePendingReq, removePendingReq), (config.cache || defaults.cache) && !1 !== config.cache && "GET" == config.method && (cache = isObject(config.cache) ? config.cache : isObject(defaults.cache) ? defaults.cache : defaultCache), cache) if (isDefined(cachedResp = cache.get(url))) {
if (cachedResp.then) return cachedResp.then(removePendingReq, removePendingReq), cachedResp;
isArray(cachedResp) ? resolvePromise(cachedResp[1], cachedResp[0], copy(cachedResp[2])) : resolvePromise(cachedResp, 200, {});
} else cache.put(url, promise);
return isUndefined(cachedResp) && $httpBackend(config.method, url, reqData, function(status, response, headersString) {
cache && (isSuccess(status) ? cache.put(url, [
status,
response,
parseHeaders(headersString)
]) : cache.remove(url)), resolvePromise(response, status, headersString), $rootScope.$$phase || $rootScope.$apply();
}, reqHeaders, config.timeout, config.withCredentials, config.responseType), promise;
function resolvePromise(response, status, headers) {
(isSuccess(status = Math.max(status, 0)) ? deferred.resolve : deferred.reject)({
data: response,
status: status,
headers: headersGetter(headers),
config: config
});
}
function removePendingReq() {
var idx = indexOf($http.pendingRequests, config);
-1 !== idx && $http.pendingRequests.splice(idx, 1);
}
}
function buildUrl(url, params) {
if (!params) return url;
var parts = [];
return function(obj, iterator, context) {
for(var keys = sortedKeys(obj), i = 0; i < keys.length; i++)iterator.call(void 0, obj[keys[i]], keys[i]);
}(params, function(value, key) {
null === value || isUndefined(value) || (isArray(value) || (value = [
value
]), forEach(value, function(v) {
isObject(v) && (v = toJson(v)), parts.push(encodeUriQuery(key) + "=" + encodeUriQuery(v));
}));
}), url + (-1 == url.indexOf("?") ? "?" : "&") + parts.join("&");
}
},
];
}
@ -1665,19 +1666,28 @@
];
}
function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument) {
return function(method, url, post, callback1, headers, timeout, withCredentials, responseType) {
return function(method, url2, post, callback1, headers, timeout, withCredentials, responseType) {
var status1;
if ($browser.$$incOutstandingRequestCount(), url = url || $browser.url(), "jsonp" == lowercase(method)) {
if ($browser.$$incOutstandingRequestCount(), url2 = url2 || $browser.url(), "jsonp" == lowercase(method)) {
var callbackId = "_" + (callbacks.counter++).toString(36);
callbacks[callbackId] = function(data) {
callbacks[callbackId].data = data;
};
var jsonpDone = jsonpReq(url.replace("JSON_CALLBACK", "angular.callbacks." + callbackId), function() {
var jsonpDone = function(url, done) {
var script = rawDocument.createElement("script"), doneWrapper = function() {
script.onreadystatechange = script.onload = script.onerror = null, rawDocument.body.removeChild(script), done && done();
};
return script.type = "text/javascript", script.src = url, msie && msie <= 8 ? script.onreadystatechange = function() {
/loaded|complete/.test(script.readyState) && doneWrapper();
} : script.onload = script.onerror = function() {
doneWrapper();
}, rawDocument.body.appendChild(script), doneWrapper;
}(url2.replace("JSON_CALLBACK", "angular.callbacks." + callbackId), function() {
callbacks[callbackId].data ? completeRequest(callback1, 200, callbacks[callbackId].data) : completeRequest(callback1, status1 || -2), delete callbacks[callbackId];
});
} else {
var xhr = new XHR();
xhr.open(method, url, !0), forEach(headers, function(value, key) {
xhr.open(method, url2, !0), forEach(headers, function(value, key) {
isDefined(value) && xhr.setRequestHeader(key, value);
}), xhr.onreadystatechange = function() {
if (4 == xhr.readyState) {
@ -1692,20 +1702,10 @@
status1 = -1, jsonpDone && jsonpDone(), xhr && xhr.abort();
}
function completeRequest(callback, status, response, headersString) {
var protocol = urlResolve(url).protocol;
var protocol = urlResolve(url2).protocol;
timeoutId && $browserDefer.cancel(timeoutId), jsonpDone = xhr = null, callback(status = 1223 == (status = "file" == protocol && 0 === status ? response ? 200 : 404 : status) ? 204 : status, response, headersString), $browser.$$completeOutstandingRequest(noop);
}
};
function jsonpReq(url, done) {
var script = rawDocument.createElement("script"), doneWrapper = function() {
script.onreadystatechange = script.onload = script.onerror = null, rawDocument.body.removeChild(script), done && done();
};
return script.type = "text/javascript", script.src = url, msie && msie <= 8 ? script.onreadystatechange = function() {
/loaded|complete/.test(script.readyState) && doneWrapper();
} : script.onload = script.onerror = function() {
doneWrapper();
}, rawDocument.body.appendChild(script), doneWrapper;
}
}
var $interpolateMinErr = minErr("$interpolate");
function $InterpolateProvider() {
@ -1863,9 +1863,9 @@
function LocationHashbangUrl(appBase, hashPrefix) {
var appBaseNoFile = stripFile(appBase);
parseAbsoluteUrl(appBase, this, appBase), this.$$parse = function(url) {
var path, url1, base, firstPathSegmentMatch, windowsFilePathExp, withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url), withoutHashUrl = "#" == withoutBaseUrl.charAt(0) ? beginsWith(hashPrefix, withoutBaseUrl) : this.$$html5 ? withoutBaseUrl : "";
var path, url3, base, firstPathSegmentMatch, windowsFilePathExp, withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url), withoutHashUrl = "#" == withoutBaseUrl.charAt(0) ? beginsWith(hashPrefix, withoutBaseUrl) : this.$$html5 ? withoutBaseUrl : "";
if (!isString(withoutHashUrl)) throw $locationMinErr("ihshprfx", 'Invalid url "{0}", missing hash prefix "{1}".', url, hashPrefix);
parseAppUrl(withoutHashUrl, this, appBase), this.$$path = (path = this.$$path, url1 = withoutHashUrl, base = appBase, windowsFilePathExp = /^\/?.*?:(\/.*)/, (0 === url1.indexOf(base) && (url1 = url1.replace(base, "")), windowsFilePathExp.exec(url1)) ? path : (firstPathSegmentMatch = windowsFilePathExp.exec(path)) ? firstPathSegmentMatch[1] : path), this.$$compose();
parseAppUrl(withoutHashUrl, this, appBase), this.$$path = (path = this.$$path, url3 = withoutHashUrl, base = appBase, windowsFilePathExp = /^\/?.*?:(\/.*)/, (0 === url3.indexOf(base) && (url3 = url3.replace(base, "")), windowsFilePathExp.exec(url3)) ? path : (firstPathSegmentMatch = windowsFilePathExp.exec(path)) ? firstPathSegmentMatch[1] : path), this.$$compose();
}, this.$$compose = function() {
var search = toKeyValue(this.$$search), hash = this.$$hash ? "#" + encodeUriSegment(this.$$hash) : "";
this.$$url = encodePath(this.$$path) + (search ? "?" + search : "") + hash, this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : "");
@ -1903,6 +1903,9 @@
"$sniffer",
"$rootElement",
function($rootScope, $browser, $sniffer, $rootElement) {
function afterLocationChange(oldUrl) {
$rootScope.$broadcast("$locationChangeSuccess", $location.absUrl(), oldUrl);
}
var url, $location, LocationMode, appBase, baseHref = $browser.baseHref(), initialUrl = $browser.url();
html5Mode ? (appBase = (url = initialUrl).substring(0, url.indexOf("/", url.indexOf("//") + 2)) + (baseHref || "/"), LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url) : (appBase = stripHash(initialUrl), LocationMode = LocationHashbangUrl), ($location = new LocationMode(appBase, "#" + hashPrefix)).$$parse($location.$$rewrite(initialUrl)), $rootElement.on("click", function(event) {
if (!event.ctrlKey && !event.metaKey && 2 != event.which) {
@ -1929,9 +1932,6 @@
$rootScope.$broadcast("$locationChangeStart", $location.absUrl(), oldUrl).defaultPrevented ? $location.$$parse(oldUrl) : ($browser.url($location.absUrl(), currentReplace), afterLocationChange(oldUrl));
})), $location.$$replace = !1, changeCounter;
}), $location;
function afterLocationChange(oldUrl) {
$rootScope.$broadcast("$locationChangeSuccess", $location.absUrl(), oldUrl);
}
},
];
}
@ -1943,15 +1943,6 @@
"$window",
function($window) {
var fn;
return {
log: consoleLog("log"),
info: consoleLog("info"),
warn: consoleLog("warn"),
error: consoleLog("error"),
debug: (fn = consoleLog("debug"), function() {
debug && fn.apply(self, arguments);
})
};
function consoleLog(type) {
var console = $window.console || {}, logFn = console[type] || console.log || noop;
return logFn.apply ? function() {
@ -1964,6 +1955,15 @@
logFn(arg1, null == arg2 ? "" : arg2);
};
}
return {
log: consoleLog("log"),
info: consoleLog("info"),
warn: consoleLog("warn"),
error: consoleLog("error"),
debug: (fn = consoleLog("debug"), function() {
debug && fn.apply(self, arguments);
})
};
},
];
}
@ -2722,6 +2722,18 @@
"$parse",
"$browser",
function($injector, $exceptionHandler, $parse, $browser) {
function beginPhase(phase) {
if ($rootScope.$$phase) throw $rootScopeMinErr("inprog", "{0} already in progress", $rootScope.$$phase);
$rootScope.$$phase = phase;
}
function clearPhase() {
$rootScope.$$phase = null;
}
function compileToFn(exp, name) {
var fn = $parse(exp);
return assertArgFn(fn, name), fn;
}
function initWatchVal() {}
function Scope() {
this.$id = nextUid(), this.$$phase = this.$parent = this.$$watchers = this.$$nextSibling = this.$$prevSibling = this.$$childHead = this.$$childTail = null, this.this = this.$root = this, this.$$destroyed = !1, this.$$asyncQueue = [], this.$$postDigestQueue = [], this.$$listeners = {}, this.$$isolateBindings = {};
}
@ -2873,7 +2885,7 @@
$exceptionHandler(e);
}
}
if (stopPropagation) return event;
if (stopPropagation) break;
scope = scope.$parent;
}while (scope)
return event;
@ -2908,18 +2920,6 @@
};
var $rootScope = new Scope();
return $rootScope;
function beginPhase(phase) {
if ($rootScope.$$phase) throw $rootScopeMinErr("inprog", "{0} already in progress", $rootScope.$$phase);
$rootScope.$$phase = phase;
}
function clearPhase() {
$rootScope.$$phase = null;
}
function compileToFn(exp, name) {
var fn = $parse(exp);
return assertArgFn(fn, name), fn;
}
function initWatchVal() {}
},
];
}
@ -3358,6 +3358,11 @@
}
function orderByFilter($parse) {
return function(array, sortPredicate, reverseOrder) {
function reverseComparator(comp, descending) {
return toBoolean(descending) ? function(a, b) {
return comp(b, a);
} : comp;
}
if (!isArray(array)) return array;
if (!sortPredicate) return array;
sortPredicate = function(obj, iterator, context) {
@ -3370,7 +3375,8 @@
], function(predicate) {
var descending = !1, get = predicate || identity;
return isString(predicate) && (("+" == predicate.charAt(0) || "-" == predicate.charAt(0)) && (descending = "-" == predicate.charAt(0), predicate = predicate.substring(1)), get = $parse(predicate)), reverseComparator(function(a, b) {
return compare(get(a), get(b));
var v1, v2, t1, t2;
return v1 = get(a), v2 = get(b), t1 = typeof v1, t2 = typeof v2, t1 != t2 ? t1 < t2 ? -1 : 1 : ("string" == t1 && (v1 = v1.toLowerCase(), v2 = v2.toLowerCase()), v1 === v2) ? 0 : v1 < v2 ? -1 : 1;
}, descending);
});
for(var arrayCopy = [], i3 = 0; i3 < array.length; i3++)arrayCopy.push(array[i3]);
@ -3381,15 +3387,6 @@
}
return 0;
}, reverseOrder));
function reverseComparator(comp, descending) {
return toBoolean(descending) ? function(a, b) {
return comp(b, a);
} : comp;
}
function compare(v1, v2) {
var t1 = typeof v1, t2 = typeof v2;
return t1 != t2 ? t1 < t2 ? -1 : 1 : ("string" == t1 && (v1 = v1.toLowerCase(), v2 = v2.toLowerCase()), v1 === v2) ? 0 : v1 < v2 ? -1 : 1;
}
};
}
function ngDirective(directive) {
@ -3970,6 +3967,12 @@
"$parse",
"$animate",
function($parse, $animate) {
function getBlockStart(block) {
return block.clone[0];
}
function getBlockEnd(block) {
return block.clone[block.clone.length - 1];
}
var NG_REMOVED = "$$NG_REMOVED", ngRepeatMinErr = minErr("ngRepeat");
return {
transclude: "element",
@ -4022,12 +4025,6 @@
});
}
};
function getBlockStart(block) {
return block.clone[0];
}
function getBlockEnd(block) {
return block.clone[block.clone.length - 1];
}
},
], ngShowDirective = [
"$animate",
@ -4371,6 +4368,15 @@
return function(name, context) {
if ("hasOwnProperty" === name) throw ngMinErr("badname", "hasOwnProperty is not a valid {0} name", context);
}(name2, "module"), requires && modules.hasOwnProperty(name2) && (modules[name2] = null), ensure(modules, name2, function() {
function invokeLater(provider, method, insertMethod) {
return function() {
return invokeQueue[insertMethod || "push"]([
provider,
method,
arguments,
]), moduleInstance;
};
}
if (!requires) throw $injectorMinErr("nomod", "Module '{0}' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.", name2);
var invokeQueue = [], runBlocks = [], config = invokeLater("$injector", "invoke"), moduleInstance = {
_invokeQueue: invokeQueue,
@ -4392,15 +4398,6 @@
}
};
return configFn && config(configFn), moduleInstance;
function invokeLater(provider, method, insertMethod) {
return function() {
return invokeQueue[insertMethod || "push"]([
provider,
method,
arguments,
]), moduleInstance;
};
}
});
};
});

View File

@ -826,7 +826,7 @@
},
find: function(url, stack, earlyReturn) {
var entry, i, index, length = (stack = stack || this.stack).length;
for(i = 0; i < length; i++)if (entry = stack[i], (decodeURIComponent(url) === decodeURIComponent(entry.url) || decodeURIComponent(url) === decodeURIComponent(entry.hash)) && (index = i, earlyReturn)) return index;
for(i = 0; i < length && (entry = stack[i], decodeURIComponent(url) !== decodeURIComponent(entry.url) && decodeURIComponent(url) !== decodeURIComponent(entry.hash) || (index = i, !earlyReturn)); i++);
return index;
},
closest: function(url) {

View File

@ -1840,7 +1840,7 @@
if (rARIA.test(name)) {
var lowerCasedName = name.toLowerCase(), standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
if (null == standardName) return warnedProperties[name] = !0, !1;
if (name !== standardName) return error1("Unknown ARIA attribute `%s`. Did you mean `%s`?", name, standardName), warnedProperties[name] = !0, !0;
name !== standardName && (error1("Unknown ARIA attribute `%s`. Did you mean `%s`?", name, standardName), warnedProperties[name] = !0);
}
return !0;
}
@ -1866,7 +1866,7 @@
var standardName = possibleStandardNames[lowerCasedName];
if (standardName !== name) return error1("Invalid DOM property `%s`. Did you mean `%s`?", name, standardName), warnedProperties$1[name] = !0, !0;
} else if (!isReserved && name !== lowerCasedName) return error1("React does not recognize the `%s` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `%s` instead. If you accidentally passed it from a parent component, remove it from the DOM element.", name, lowerCasedName), warnedProperties$1[name] = !0, !0;
return "boolean" == typeof value && shouldRemoveAttributeWithWarning(name, value, propertyInfo, !1) ? (value ? error1('Received `%s` for a non-boolean attribute `%s`.\n\nIf you want to write it to the DOM, pass a string instead: %s="%s" or %s={value.toString()}.', value, name, name, value, name) : error1('Received `%s` for a non-boolean attribute `%s`.\n\nIf you want to write it to the DOM, pass a string instead: %s="%s" or %s={value.toString()}.\n\nIf you used to conditionally omit it with %s={condition && value}, pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name), warnedProperties$1[name] = !0, !0) : !!isReserved || (shouldRemoveAttributeWithWarning(name, value, propertyInfo, !1) ? (warnedProperties$1[name] = !0, !1) : "false" !== value && "true" !== value || null === propertyInfo || 3 !== propertyInfo.type || (error1("Received the string `%s` for the boolean attribute `%s`. %s Did you mean %s={%s}?", value, name, "false" === value ? "The browser will interpret it as a truthy value." : 'Although this works, it will not work as expected if you pass the string "false".', name, value), warnedProperties$1[name] = !0, !0));
return "boolean" == typeof value && shouldRemoveAttributeWithWarning(name, value, propertyInfo, !1) ? (value ? error1('Received `%s` for a non-boolean attribute `%s`.\n\nIf you want to write it to the DOM, pass a string instead: %s="%s" or %s={value.toString()}.', value, name, name, value, name) : error1('Received `%s` for a non-boolean attribute `%s`.\n\nIf you want to write it to the DOM, pass a string instead: %s="%s" or %s={value.toString()}.\n\nIf you used to conditionally omit it with %s={condition && value}, pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name), warnedProperties$1[name] = !0, !0) : !!isReserved || (shouldRemoveAttributeWithWarning(name, value, propertyInfo, !1) ? (warnedProperties$1[name] = !0, !1) : (("false" === value || "true" === value) && null !== propertyInfo && 3 === propertyInfo.type && (error1("Received the string `%s` for the boolean attribute `%s`. %s Did you mean %s={%s}?", value, name, "false" === value ? "The browser will interpret it as a truthy value." : 'Although this works, it will not work as expected if you pass the string "false".', name, value), warnedProperties$1[name] = !0), !0));
};
var warnUnknownProperties = function(type, props, eventRegistry) {
var unknownProps = [];
@ -2097,7 +2097,7 @@
node.child.return = node, node = node.child;
continue;
}
if (node === currentParent) return null;
if (node === currentParent) break;
for(; !node.sibling;){
if (!node.return || node.return === currentParent) return null;
node = node.return;
@ -2902,10 +2902,7 @@
}
}
function getActiveElementDeep() {
for(var win = window, element = getActiveElement(); element instanceof win.HTMLIFrameElement;){
if (!isSameOriginFrame(element)) return element;
element = getActiveElement((win = element.contentWindow).document);
}
for(var win = window, element = getActiveElement(); element instanceof win.HTMLIFrameElement && isSameOriginFrame(element);)element = getActiveElement((win = element.contentWindow).document);
return element;
}
function hasSelectionCapabilities(elem) {
@ -4498,7 +4495,7 @@
}
exitDisallowedContextReadInDEV();
} else partialState = _payload;
if (null == partialState) return prevState;
if (null == partialState) break;
return _assign({}, prevState, partialState);
case 2:
hasForceUpdate = !0;
@ -5111,7 +5108,7 @@
node.child.return = node, node = node.child;
continue;
}
if (node === row) return null;
if (node === row) break;
for(; null === node.sibling;){
if (null === node.return || node.return === row) return null;
node = node.return;
@ -9179,7 +9176,7 @@
node.child.return = node, node = node.child;
continue;
}
if (node === currentParent) return null;
if (node === currentParent) break;
for(; !node.sibling;){
if (!node.return || node.return === currentParent) return null;
node = node.return;

View File

@ -1,7 +1,7 @@
function f(a) {
return (a = g);
function g() {
return a;
}
return a = g;
}
console.log(typeof f()());

View File

@ -1,3 +1 @@
const undef = (a)=>{
};
console.log(1, 2, undef(3), undef(4));
console.log(1, 2, void 0, void 0);

View File

@ -233,6 +233,7 @@ pub trait ModuleItemLike: StmtLike {
pub trait StmtLike: Sized + 'static + Send + Sync {
fn try_into_stmt(self) -> Result<Stmt, Self>;
fn as_stmt(&self) -> Option<&Stmt>;
fn as_stmt_mut(&mut self) -> Option<&mut Stmt>;
fn from_stmt(stmt: Stmt) -> Self;
}
@ -249,6 +250,11 @@ impl StmtLike for Stmt {
Some(self)
}
#[inline]
fn as_stmt_mut(&mut self) -> Option<&mut Stmt> {
Some(self)
}
#[inline]
fn from_stmt(stmt: Stmt) -> Self {
stmt
@ -280,8 +286,16 @@ impl StmtLike for ModuleItem {
#[inline]
fn as_stmt(&self) -> Option<&Stmt> {
match *self {
ModuleItem::Stmt(ref stmt) => Some(stmt),
match &*self {
ModuleItem::Stmt(stmt) => Some(stmt),
_ => None,
}
}
#[inline]
fn as_stmt_mut(&mut self) -> Option<&mut Stmt> {
match &mut *self {
ModuleItem::Stmt(stmt) => Some(stmt),
_ => None,
}
}
@ -386,17 +400,15 @@ impl StmtExt for Stmt {
fn terminates(&self) -> bool {
match self {
Stmt::Break(_) | Stmt::Continue(_) | Stmt::Throw(_) | Stmt::Return(_) => return true,
Stmt::Block(block) if block.stmts.terminates() => return true,
Stmt::Break(_) | Stmt::Continue(_) | Stmt::Throw(_) | Stmt::Return(_) => true,
Stmt::Block(block) => block.stmts.terminates(),
Stmt::If(IfStmt {
cons,
alt: Some(alt),
..
}) => return cons.terminates() && alt.terminates(),
_ => (),
}) => cons.terminates() && alt.terminates(),
_ => false,
}
false
}
}
@ -416,13 +428,7 @@ impl StmtExt for Vec<Stmt> {
}
fn terminates(&self) -> bool {
for s in self {
if s.terminates() {
return true;
}
}
false
self.iter().rev().any(|s| s.terminates())
}
}