EFINED_TYPE:'undefined',
NULL_TYPE:'null',
BOOLEAN_TYPE:'boolean',
NUMBER_TYPE:'number',
STRING_TYPE:'string',
SYMBOL_TYPE:'symbol',
OBJECT_TYPE:'object',
FUNCTION_TYPE:'function',
REGEXP_TYPE:'regexp',
ERROR_TYPE:'error',
PROPERTY_TYPE:'property',
INTERNAL_PROPERTY_TYPE:'internalProperty',
FRAME_TYPE:'frame',
SCRIPT_TYPE:'script',
CONTEXT_TYPE:'context',
SCOPE_TYPE:'scope',
PROMISE_TYPE:'promise',
MAP_TYPE:'map',
SET_TYPE:'set',
ITERATOR_TYPE:'iterator',
GENERATOR_TYPE:'generator',
}
function MakeMirror(k){
var l;
if((k===(void 0))){
l=new UndefinedMirror();
}else if((k===null)){
l=new NullMirror();
}else if((typeof(k)==='boolean')){
l=new BooleanMirror(k);
}else if((typeof(k)==='number')){
l=new NumberMirror(k);
}else if((typeof(k)==='string')){
l=new StringMirror(k);
}else if((typeof(k)==='symbol')){
l=new SymbolMirror(k);
}else if((%_IsArray(k))){
l=new ArrayMirror(k);
}else if((%IsDate(k))){
l=new DateMirror(k);
}else if((%IsFunction(k))){
l=new FunctionMirror(k);
}else if(%IsRegExp(k)){
l=new RegExpMirror(k);
}else if((%_ClassOf(k)==='Error')){
l=new ErrorMirror(k);
}else if((%_ClassOf(k)==='Script')){
l=new ScriptMirror(k);
}else if((%_IsJSMap(k))||(%_IsJSWeakMap(k))){
l=new MapMirror(k);
}else if((%_IsJSSet(k))||(%_IsJSWeakSet(k))){
l=new SetMirror(k);
}else if((%_ClassOf(k)==='Map Iterator')||(%_ClassOf(k)==='Set Iterator')){
l=new IteratorMirror(k);
}else if(%is_promise(k)){
l=new PromiseMirror(k);
}else if((%_ClassOf(k)==='Generator')){
l=new GeneratorMirror(k);
}else{
l=new ObjectMirror(k,j.OBJECT_TYPE);
}
return l;
}
function GetUndefinedMirror(){
return MakeMirror((void 0));
}
function inherits(m,n){
var o=function(){};
o.prototype=n.prototype;
m.super_=n.prototype;
m.prototype=new o();
m.prototype.constructor=m;
}
var p=80;
var q={};
q.Data=0;
q.Accessor=1;
var r={};
r.None=0;
r.ReadOnly=1;
r.DontEnum=2;
r.DontDelete=4;
var s={Global:0,
Local:1,
With:2,
Closure:3,
Catch:4,
Block:5,
Script:6,
Eval:7,
Module:8,
};
function Mirror(t){
this.type_=t;
}
Mirror.prototype.type=function(){
return this.type_;
};
Mirror.prototype.isValue=function(){
return this instanceof ValueMirror;
};
Mirror.prototype.isUndefined=function(){
return this instanceof UndefinedMirror;
};
Mirror.prototype.isNull=function(){
return this instanceof NullMirror;
};
Mirror.prototype.isBoolean=function(){
return this instanceof BooleanMirror;
};
Mirror.prototype.isNumber=function(){
return this instanceof NumberMirror;
};
Mirror.prototype.isString=function(){
return this instanceof StringMirror;
};
Mirror.prototype.isSymbol=function(){
return this instanceof SymbolMirror;
};
Mirror.prototype.isObject=function(){
return this instanceof ObjectMirror;
};
Mirror.prototype.isFunction=function(){
return this instanceof FunctionMirror;
};
Mirror.prototype.isUnresolvedFunction=function(){
return this instanceof UnresolvedFunctionMirror;
};
Mirror.prototype.isArray=function(){
return this instanceof ArrayMirror;
};
Mirror.prototype.isDate=function(){
return this instanceof DateMirror;
};
Mirror.prototype.isRegExp=function(){
return this instanceof RegExpMirror;
};
Mirror.prototype.isError=function(){
return this instanceof ErrorMirror;
};
Mirror.prototype.isPromise=function(){
return this instanceof PromiseMirror;
};
Mirror.prototype.isGenerator=function(){
return this instanceof GeneratorMirror;
};
Mirror.prototype.isProperty=function(){
return this instanceof PropertyMirror;
};
Mirror.prototype.isInternalProperty=function(){
return this instanceof InternalPropertyMirror;
};
Mirror.prototype.isFrame=function(){
return this instanceof FrameMirror;
};
Mirror.prototype.isScript=function(){
return this instanceof ScriptMirror;
};
Mirror.prototype.isContext=function(){
return this instanceof ContextMirror;
};
Mirror.prototype.isScope=function(){
return this instanceof ScopeMirror;
};
Mirror.prototype.isMap=function(){
return this instanceof MapMirror;
};
Mirror.prototype.isSet=function(){
return this instanceof SetMirror;
};
Mirror.prototype.isIterator=function(){
return this instanceof IteratorMirror;
};
Mirror.prototype.toText=function(){
return"#<"+this.constructor.name+">";
};
function ValueMirror(t,k){
%_Call(Mirror,this,t);
this.value_=k;
}
inherits(ValueMirror,Mirror);
ValueMirror.prototype.isPrimitive=function(){
var t=this.type();
return t==='undefined'||
t==='null'||
t==='boolean'||
t==='number'||
t==='string'||
t==='symbol';
};
ValueMirror.prototype.value=function(){
return this.value_;
};
function UndefinedMirror(){
%_Call(ValueMirror,this,j.UNDEFINED_TYPE,(void 0));
}
inherits(UndefinedMirror,ValueMirror);
UndefinedMirror.prototype.toText=function(){
return'undefined';
};
function NullMirror(){
%_Call(ValueMirror,this,j.NULL_TYPE,null);
}
inherits(NullMirror,ValueMirror);
NullMirror.prototype.toText=function(){
return'null';
};
function BooleanMirror(k){
%_Call(ValueMirror,this,j.BOOLEAN_TYPE,k);
}
inherits(BooleanMirror,ValueMirror);
BooleanMirror.prototype.toText=function(){
return this.value_?'true':'false';
};
function NumberMirror(k){
%_Call(ValueMirror,this,j.NUMBER_TYPE,k);
}
inherits(NumberMirror,ValueMirror);
NumberMirror.prototype.toText=function(){
return %NumberToString(this.value_);
};
function StringMirror(k){
%_Call(ValueMirror,this,j.STRING_TYPE,k);
}
inherits(StringMirror,ValueMirror);
StringMirror.prototype.length=function(){
return this.value_.length;
};
StringMirror.prototype.getTruncatedValue=function(u){
if(u!=-1&&this.length()>u){
return this.value_.substring(0,u)+
'... (length: '+this.length()+')';
}
return this.value_;
};
StringMirror.prototype.toText=function(){
return this.getTruncatedValue(p);
};
function SymbolMirror(k){
%_Call(ValueMirror,this,j.SYMBOL_TYPE,k);
}
inherits(SymbolMirror,ValueMirror);
SymbolMirror.prototype.description=function(){
return %SymbolDescription(%ValueOf(this.value_));
}
SymbolMirror.prototype.toText=function(){
return %SymbolDescriptiveString(%ValueOf(this.value_));
}
function ObjectMirror(k,t){
t=t||j.OBJECT_TYPE;
%_Call(ValueMirror,this,t,k);
}
inherits(ObjectMirror,ValueMirror);
ObjectMirror.prototype.className=function(){
return %_ClassOf(this.value_);
};
ObjectMirror.prototype.constructorFunction=function(){
return MakeMirror(%DebugGetProperty(this.value_,'constructor'));
};
ObjectMirror.prototype.prototypeObject=function(){
return MakeMirror(%DebugGetProperty(this.value_,'prototype'));
};
ObjectMirror.prototype.protoObject=function(){
return MakeMirror(%DebugGetPrototype(this.value_));
};
ObjectMirror.prototype.hasNamedInterceptor=function(){
var v=%GetInterceptorInfo(this.value_);
return(v&2)!=0;
};
ObjectMirror.prototype.hasIndexedInterceptor=function(){
var v=%GetInterceptorInfo(this.value_);
return(v&1)!=0;
};
ObjectMirror.prototype.propertyNames=function(){
return %GetOwnPropertyKeys(this.value_,0);
};
ObjectMirror.prototype.properties=function(){
var w=this.propertyNames();
var x=new c(w.length);
for(var y=0;y<w.length;y++){
x[y]=this.property(w[y]);
}
return x;
};
ObjectMirror.prototype.internalProperties=function(){
return ObjectMirror.GetInternalProperties(this.value_);
}
ObjectMirror.prototype.property=function(z){
var A=%DebugGetPropertyDetails(this.value_,z);
if(A){
return new PropertyMirror(this,z,A);
}
return GetUndefinedMirror();
};
ObjectMirror.prototype.lookupProperty=function(k){
var x=this.properties();
for(var y=0;y<x.length;y++){
var B=x[y];
if(B.propertyType()==q.Data){
if(B.value_===k.value_){
return B;
}
}
}
return GetUndefinedMirror();
};
ObjectMirror.prototype.referencedBy=function(C){
var D=%DebugReferencedBy(this.value_,
Mirror.prototype,C||0);
for(var y=0;y<D.length;y++){
D[y]=MakeMirror(D[y]);
}
return D;
};
ObjectMirror.prototype.toText=function(){
var z;
var m=this.constructorFunction();
if(!m.isFunction()){
z=this.className();
}else{
z=m.name();
if(!z){
z=this.className();
}
}
return'#<'+z+'>';
};
ObjectMirror.GetInternalProperties=function(k){
var x=%DebugGetInternalProperties(k);
var D=[];
for(var y=0;y<x.length;y+=2){
D.push(new InternalPropertyMirror(x[y],x[y+1]));
}
return D;
}
function FunctionMirror(k){
%_Call(ObjectMirror,this,k,j.FUNCTION_TYPE);
this.resolved_=true;
}
inherits(FunctionMirror,ObjectMirror);
FunctionMirror.prototype.resolved=function(){
return this.resolved_;
};
FunctionMirror.prototype.name=function(){
return %FunctionGetName(this.value_);
};
FunctionMirror.prototype.debugName=function(){
return %FunctionGetDebugName(this.value_);
}
FunctionMirror.prototype.inferredName=function(){
return %FunctionGetInferredName(this.value_);
};
FunctionMirror.prototype.source=function(){
if(this.resolved()){
return %FunctionToString(this.value_);
}
};
FunctionMirror.prototype.script=function(){
if(this.resolved()){
if(this.script_){
return this.script_;
}
var E=%FunctionGetScript(this.value_);
if(E){
return this.script_=MakeMirror(E);
}
}
};
FunctionMirror.prototype.sourcePosition_=function(){
if(this.resolved()){
return %FunctionGetScriptSourcePosition(this.value_);
}
};
FunctionMirror.prototype.sourceLocation=function(){
if(this.resolved()){
var E=this.script();
if(E){
return E.locationFromPosition(this.sourcePosition_(),true);
}
}
};
FunctionMirror.prototype.constructedBy=function(F){
if(this.resolved()){
var D=%DebugConstructedBy(this.value_,F||0);
for(var y=0;y<D.length;y++){
D[y]=MakeMirror(D[y]);
}
return D;
}else{
return[];
}
};
FunctionMirror.prototype.scopeCount=function(){
if(this.resolved()){
if((this.scopeCount_===(void 0))){
this.scopeCount_=%GetFunctionScopeCount(this.value());
}
return this.scopeCount_;
}else{
return 0;
}
};
FunctionMirror.prototype.scope=function(G){
if(this.resolved()){
return new ScopeMirror((void 0),this,(void 0),G);
}
};
FunctionMirror.prototype.toText=function(){
return this.source();
};
FunctionMirror.prototype.context=function(){
if(this.resolved()){
if(!this._context)
this._context=new ContextMirror(%FunctionGetContextData(this.value_));
return this._context;
}
};
function UnresolvedFunctionMirror(k){
%_Call(ValueMirror,this,j.FUNCTION_TYPE,k);
this.propertyCount_=0;
this.elementCount_=0;
this.resolved_=false;
}
inherits(UnresolvedFunctionMirror,FunctionMirror);
UnresolvedFunctionMirror.prototype.className=function(){
return'Function';
};
UnresolvedFunctionMirror.prototype.constructorFunction=function(){
return GetUndefinedMirror();
};
UnresolvedFunctionMirror.prototype.prototypeObject=function(){
return GetUndefinedMirror();
};
UnresolvedFunctionMirror.prototype.protoObject=function(){
return GetUndefinedMirror();
};
UnresolvedFunctionMirror.prototype.name=function(){
return this.value_;
};
UnresolvedFunctionMirror.prototype.debugName=function(){
return this.value_;
};
UnresolvedFunctionMirror.prototype.inferredName=function(){
return(void 0);
};
UnresolvedFunctionMirror.prototype.propertyNames=function(H,I){
return[];
};
function ArrayMirror(k){
%_Call(ObjectMirror,this,k);
}
inherits(ArrayMirror,ObjectMirror);
ArrayMirror.prototype.length=function(){
return this.value_.length;
};
ArrayMirror.prototype.indexedPropertiesFromRange=function(opt_from_index,
opt_to_index){
var J=opt_from_index||0;
var K=opt_to_index||this.length()-1;
if(J>K)return new c();
var L=new c(K-J+1);
for(var y=J;y<=K;y++){
var A=%DebugGetPropertyDetails(this.value_,(%_ToString(y)));
var k;
if(A){
k=new PropertyMirror(this,y,A);
}else{
k=GetUndefinedMirror();
}
L[y-J]=k;
}
return L;
};
function DateMirror(k){
%_Call(ObjectMirror,this,k);
}
inherits(DateMirror,ObjectMirror);
DateMirror.prototype.toText=function(){
var M=e(this.value_);
return M.substring(1,M.length-1);
};
function RegExpMirror(k){
%_Call(ObjectMirror,this,k,j.REGEXP_TYPE);
}
inherits(RegExpMirror,ObjectMirror);
RegExpMirror.prototype.source=function(){
return this.value_.source;
};
RegExpMirror.prototype.global=function(){
return this.value_.global;
};
RegExpMirror.prototype.ignoreCase=function(){
return this.value_.ignoreCase;
};
RegExpMirror.prototype.multiline=function(){
return this.value_.multiline;
};
RegExpMirror.prototype.sticky=function(){
return this.value_.sticky;
};
RegExpMirror.prototype.unicode=function(){
return this.value_.unicode;
};
RegExpMirror.prototype.toText=function(){
return"/"+this.source()+"/";
};
function ErrorMirror(k){
%_Call(ObjectMirror,this,k,j.ERROR_TYPE);
}
inherits(ErrorMirror,ObjectMirror);
ErrorMirror.prototype.message=function(){
return this.value_.message;
};
ErrorMirror.prototype.toText=function(){
var N;
try{
N=%ErrorToString(this.value_);
}catch(e){
N='#<Error>';
}
return N;
};
function PromiseMirror(k){
%_Call(ObjectMirror,this,k,j.PROMISE_TYPE);
}
inherits(PromiseMirror,ObjectMirror);
function PromiseGetStatus_(k){
var O=%PromiseStatus(k);
if(O==0)return"pending";
if(O==1)return"resolved";
return"rejected";
}
function PromiseGetValue_(k){
return %PromiseResult(k);
}
PromiseMirror.prototype.status=function(){
return PromiseGetStatus_(this.value_);
};
PromiseMirror.prototype.promiseValue=function(){
return MakeMirror(PromiseGetValue_(this.value_));
};
function MapMirror(k){
%_Call(ObjectMirror,this,k,j.MAP_TYPE);
}
inherits(MapMirror,ObjectMirror);
MapMirror.prototype.entries=function(P){
var D=[];
if((%_IsJSWeakMap(this.value_))){
var Q=%GetWeakMapEntries(this.value_,P||0);
for(var y=0;y<Q.length;y+=2){
D.push({
key:Q[y],
value:Q[y+1]
});
}
return D;
}
var R=%_Call(f,this.value_);
var S;
while((!P||D.length<P)&&
!(S=R.next()).done){
D.push({
key:S.value[0],
value:S.value[1]
});
}
return D;
};
function SetMirror(k){
%_Call(ObjectMirror,this,k,j.SET_TYPE);
}
inherits(SetMirror,ObjectMirror);
function IteratorGetValues_(R,T,P){
var D=[];
var S;
while((!P||D.length<P)&&
!(S=%_Call(T,R)).done){
D.push(S.value);
}
return D;
}
SetMirror.prototype.values=function(P){
if((%_IsJSWeakSet(this.value_))){
return %GetWeakSetValues(this.value_,P||0);
}
var R=%_Call(i,this.value_);
return IteratorGetValues_(R,h,P);
};
function IteratorMirror(k){
%_Call(ObjectMirror,this,k,j.ITERATOR_TYPE);
}
inherits(IteratorMirror,ObjectMirror);
IteratorMirror.prototype.preview=function(P){
if((%_ClassOf(this.value_)==='Map Iterator')){
return IteratorGetValues_(%MapIteratorClone(this.value_),
g,
P);
}else if((%_ClassOf(this.value_)==='Set Iterator')){
return IteratorGetValues_(%SetIteratorClone(this.value_),
h,
P);
}
};
function GeneratorMirror(k){
%_Call(ObjectMirror,this,k,j.GENERATOR_TYPE);
}
inherits(GeneratorMirror,ObjectMirror);
function GeneratorGetStatus_(k){
var U=%GeneratorGetContinuation(k);
if(U<-1)return"running";
if(U==-1)return"closed";
return"suspended";
}
GeneratorMirror.prototype.status=function(){
return GeneratorGetStatus_(this.value_);
};
GeneratorMirror.prototype.sourcePosition_=function(){
return %GeneratorGetSourcePosition(this.value_);
};
GeneratorMirror.prototype.sourceLocation=function(){
var V=this.sourcePosition_();
if(!(V===(void 0))){
var E=this.func().script();
if(E){
return E.locationFromPosition(V,true);
}
}
};
GeneratorMirror.prototype.func=function(){
if(!this.func_){
this.func_=MakeMirror(%GeneratorGetFunction(this.value_));
}
return this.func_;
};
GeneratorMirror.prototype.receiver=function(){
if(!this.receiver_){
this.receiver_=MakeMirror(%GeneratorGetReceiver(this.value_));
}
return this.receiver_;
};
GeneratorMirror.prototype.scopeCount=function(){
return %GetGeneratorScopeCount(this.value());
};
GeneratorMirror.prototype.scope=function(G){
return new ScopeMirror((void 0),(void 0),this,G);
};
GeneratorMirror.prototype.allScopes=function(){
var W=[];
for(let y=0;y<this.scopeCount();y++){
W.push(this.scope(y));
}
return W;
};
function PropertyMirror(l,z,A){
%_Call(Mirror,this,j.PROPERTY_TYPE);
this.mirror_=l;
this.name_=z;
this.value_=A[0];
this.details_=A[1];
this.is_interceptor_=A[2];
if(A.length>3){
this.exception_=A[3];
this.getter_=A[4];
this.setter_=A[5];
}
}
inherits(PropertyMirror,Mirror);
PropertyMirror.prototype.isReadOnly=function(){
return(this.attributes()&r.ReadOnly)!=0;
};
PropertyMirror.prototype.isEnum=function(){
return(this.attributes()&r.DontEnum)==0;
};
PropertyMirror.prototype.canDelete=function(){
return(this.attributes()&r.DontDelete)==0;
};
PropertyMirror.prototype.name=function(){
return this.name_;
};
PropertyMirror.prototype.toText=function(){
if((typeof(this.name_)==='symbol'))return %SymbolDescriptiveString(this.name_);
return this.name_;
};
PropertyMirror.prototype.isIndexed=function(){
for(var y=0;y<this.name_.length;y++){
if(this.name_[y]<'0'||'9'<this.name_[y]){
return false;
}
}
return true;
};
PropertyMirror.prototype.value=function(){
return MakeMirror(this.value_,false);
};
PropertyMirror.prototype.isException=function(){
return this.exception_?true:false;
};
PropertyMirror.prototype.attributes=function(){
return %DebugPropertyAttributesFromDetails(this.details_);
};
PropertyMirror.prototype.propertyType=function(){
return %DebugPropertyKindFromDetails(this.details_);
};
PropertyMirror.prototype.hasGetter=function(){
return this.getter_?true:false;
};
PropertyMirror.prototype.hasSetter=function(){
return this.setter_?true:false;
};
PropertyMirror.prototype.getter=function(){
if(this.hasGetter()){
return MakeMirror(this.getter_);
}else{
return GetUndefinedMirror();
}
};
PropertyMirror.prototype.setter=function(){
if(this.hasSetter()){
return MakeMirror(this.setter_);
}else{
return GetUndefinedMirror();
}
};
PropertyMirror.prototype.isNative=function(){
return this.is_interceptor_||
((this.propertyType()==q.Accessor)&&
!this.hasGetter()&&!this.hasSetter());
};
function InternalPropertyMirror(z,k){
%_Call(Mirror,this,j.INTERNAL_PROPERTY_TYPE);
this.name_=z;
this.value_=k;
}
inherits(InternalPropertyMirror,Mirror);
InternalPropertyMirror.prototype.name=function(){
return this.name_;
};
InternalPropertyMirror.prototype.value=function(){
return MakeMirror(this.value_,false);
};
var X=0;
var Y=1;
var Z=2;
var aa=3;
var ab=4;
var ac=5;
var ad=6;
var ae=7;
var af=8;
var ag=9;
var ah=10;
var ai=0;
var aj=1;
var ak=2;
var al=1<<0;
var am=1<<1;
var an=7<<2;
function FrameDetails(ao,G){
this.break_id_=ao;
this.details_=%GetFrameDetails(ao,G);
}
FrameDetails.prototype.frameId=function(){
%CheckExecutionState(this.break_id_);
return this.details_[X];
};
FrameDetails.prototype.receiver=function(){
%CheckExecutionState(this.break_id_);
return this.details_[Y];
};
FrameDetails.prototype.func=function(){
%CheckExecutionState(this.break_id_);
return this.details_[Z];
};
FrameDetails.prototype.script=function(){
%CheckExecutionState(this.break_id_);
return this.details_[aa];
};
FrameDetails.prototype.isConstructCall=function(){
%CheckExecutionState(this.break_id_);
return this.details_[ae];
};
FrameDetails.prototype.isAtReturn=function(){
%CheckExecutionState(this.break_id_);
return this.details_[af];
};
FrameDetails.prototype.isDebuggerFrame=function(){
%CheckExecutionState(this.break_id_);
var ap=al;
return(this.details_[ag]&ap)==ap;
};
FrameDetails.prototype.isOptimizedFrame=function(){
%CheckExecutionState(this.break_id_);
var ap=am;
return(this.details_[ag]&ap)==ap;
};
FrameDetails.prototype.isInlinedFrame=function(){
return this.inlinedFrameIndex()>0;
};
FrameDetails.prototype.inlinedFrameIndex=function(){
%CheckExecutionState(this.break_id_);
var ap=an;
return(this.details_[ag]&ap)>>2;
};
FrameDetails.prototype.argumentCount=function(){
%CheckExecutionState(this.break_id_);
return this.details_[ab];
};
FrameDetails.prototype.argumentName=function(G){
%CheckExecutionState(this.break_id_);
if(G>=0&&G<this.argumentCount()){
return this.details_[ah+
G*ak+
ai];
}
};
FrameDetails.prototype.argumentValue=function(G){
%CheckExecutionState(this.break_id_);
if(G>=0&&G<this.argumentCount()){
return this.details_[ah+
G*ak+
aj];
}
};
FrameDetails.prototype.localCount=function(){
%CheckExecutionState(this.break_id_);
return this.details_[ac];
};
FrameDetails.prototype.sourcePosition=function(){
%CheckExecutionState(this.break_id_);
return this.details_[ad];
};
FrameDetails.prototype.localName=function(G){
%CheckExecutionState(this.break_id_);
if(G>=0&&G<this.localCount()){
var aq=ah+
this.argumentCount()*ak;
return this.details_[aq+
G*ak+
ai];
}
};
FrameDetails.prototype.localValue=function(G){
%CheckExecutionState(this.break_id_);
if(G>=0&&G<this.localCount()){
var aq=ah+
this.argumentCount()*ak;
return this.details_[aq+
G*ak+
aj];
}
};
FrameDetails.prototype.returnValue=function(){
%CheckExecutionState(this.break_id_);
var ar=
ah+
(this.argumentCount()+this.localCount())*ak;
if(this.details_[af]){
return this.details_[ar];
}
};
FrameDetails.prototype.scopeCount=function(){
if((this.scopeCount_===(void 0))){
this.scopeCount_=%GetScopeCount(this.break_id_,this.frameId());
}
return this.scopeCount_;
};
function FrameMirror(ao,G){
%_Call(Mirror,this,j.FRAME_TYPE);
this.break_id_=ao;
this.index_=G;
this.details_=new FrameDetails(ao,G);
}
inherits(FrameMirror,Mirror);
FrameMirror.prototype.details=function(){
return this.details_;
};
FrameMirror.prototype.index=function(){
return this.index_;
};
FrameMirror.prototype.func=function(){
if(this.func_){
return this.func_;
}
var ap=this.details_.func();
if((%IsFunction(ap))){
return this.func_=MakeMirror(ap);
}else{
return new UnresolvedFunctionMirror(ap);
}
};
FrameMirror.prototype.script=function(){
if(!this.script_){
this.script_=MakeMirror(this.details_.script());
}
return this.script_;
}
FrameMirror.prototype.receiver=function(){
return MakeMirror(this.details_.receiver());
};
FrameMirror.prototype.isConstructCall=function(){
return this.details_.isConstructCall();
};
FrameMirror.prototype.isAtReturn=function(){
return this.details_.isAtReturn();
};
FrameMirror.prototype.isDebuggerFrame=function(){
return this.details_.isDebuggerFrame();
};
FrameMirror.prototype.isOptimizedFrame=function(){
return this.details_.isOptimizedFrame();
};
FrameMirror.prototype.isInlinedFrame=function(){
return this.details_.isInlinedFrame();
};
FrameMirror.prototype.inlinedFrameIndex=function(){
return this.details_.inlinedFrameIndex();
};
FrameMirror.prototype.argumentCount=function(){
return this.details_.argumentCount();
};
FrameMirror.prototype.argumentName=function(G){
return this.details_.argumentName(G);
};
FrameMirror.prototype.argumentValue=function(G){
return MakeMirror(this.details_.argumentValue(G));
};
FrameMirror.prototype.localCount=function(){
return this.details_.localCount();
};
FrameMirror.prototype.localName=function(G){
return this.details_.localName(G);
};
FrameMirror.prototype.localValue=function(G){
return MakeMirror(this.details_.localValue(G));
};
FrameMirror.prototype.returnValue=function(){
return MakeMirror(this.details_.returnValue());
};
FrameMirror.prototype.sourcePosition=function(){
return this.details_.sourcePosition();
};
FrameMirror.prototype.sourceLocation=function(){
var E=this.script();
if(E){
return E.locationFromPosition(this.sourcePosition(),true);
}
};
FrameMirror.prototype.sourceLine=function(){
var as=this.sourceLocation();
if(as){
return as.line;
}
};
FrameMirror.prototype.sourceColumn=function(){
var as=this.sourceLocation();
if(as){
return as.column;
}
};
FrameMirror.prototype.sourceLineText=function(){
var as=this.sourceLocation();
if(as){
return as.sourceText;
}
};
FrameMirror.prototype.scopeCount=function(){
return this.details_.scopeCount();
};
FrameMirror.prototype.scope=function(G){
return new ScopeMirror(this,(void 0),(void 0),G);
};
FrameMirror.prototype.allScopes=function(at){
var au=%GetAllScopesDetails(this.break_id_,
this.details_.frameId(),
this.details_.inlinedFrameIndex(),
!!at);
var D=[];
for(var y=0;y<au.length;++y){
D.push(new ScopeMirror(this,(void 0),(void 0),y,
au[y]));
}
return D;
};
FrameMirror.prototype.evaluate=function(source,throw_on_side_effect=false){
return MakeMirror(%DebugEvaluate(this.break_id_,
this.details_.frameId(),
this.details_.inlinedFrameIndex(),
source,
throw_on_side_effect));
};
FrameMirror.prototype.invocationText=function(){
var D='';
var av=this.func();
var aw=this.receiver();
if(this.isConstructCall()){
D+='new ';
D+=av.name()?av.name():'[anonymous]';
}else if(this.isDebuggerFrame()){
D+='[debugger]';
}else{
var ax=
!aw.className||(aw.className()!='global');
if(ax){
D+=aw.toText();
}
var B=GetUndefinedMirror();
if(aw.isObject()){
for(var ay=aw;
!ay.isNull()&&B.isUndefined();
ay=ay.protoObject()){
B=ay.lookupProperty(av);
}
}
if(!B.isUndefined()){
if(!B.isIndexed()){
if(ax){
D+='.';
}
D+=B.toText();
}else{
D+='[';
D+=B.toText();
D+=']';
}
if(av.name()&&av.name()!=B.name()){
D+='(aka '+av.name()+')';
}
}else{
if(ax){
D+='.';
}
D+=av.name()?av.name():'[anonymous]';
}
}
if(!this.isDebuggerFrame()){
D+='(';
for(var y=0;y<this.argumentCount();y++){
if(y!=0)D+=', ';
if(this.argumentName(y)){
D+=this.argumentName(y);
D+='=';
}
D+=this.argumentValue(y).toText();
}
D+=')';
}
if(this.isAtReturn()){
D+=' returning ';
D+=this.returnValue().toText();
}
return D;
};
FrameMirror.prototype.sourceAndPositionText=function(){
var D='';
var av=this.func();
if(av.resolved()){
var E=av.script();
if(E){
if(E.name()){
D+=E.name();
}else{
D+='[unnamed]';
}
if(!this.isDebuggerFrame()){
var as=this.sourceLocation();
D+=' line ';
D+=!(as===(void 0))?(as.line+1):'?';
D+=' column ';
D+=!(as===(void 0))?(as.column+1):'?';
if(!(this.sourcePosition()===(void 0))){
D+=' (position '+(this.sourcePosition()+1)+')';
}
}
}else{
D+='[no source]';
}
}else{
D+='[unresolved]';
}
return D;
};
FrameMirror.prototype.localsText=function(){
var D='';
var az=this.localCount();
if(az>0){
for(var y=0;y<az;++y){
D+='      var ';
D+=this.localName(y);
D+=' = ';
D+=this.localValue(y).toText();
if(y<az-1)D+='\n';
}
}
return D;
};
FrameMirror.prototype.restart=function(){
var D=%LiveEditRestartFrame(this.break_id_,this.index_);
if((D===(void 0))){
D="Failed to find requested frame";
}
return D;
};
FrameMirror.prototype.toText=function(aA){
var D='';
D+='#'+(this.index()<=9?'0':'')+this.index();
D+=' ';
D+=this.invocationText();
D+=' ';
D+=this.sourceAndPositionText();
if(aA){
D+='\n';
D+=this.localsText();
}
return D;
};
var aB=0;
var aC=1;
var aD=2;
var aE=3;
var aF=4;
var aG=5;
function ScopeDetails(aH,aI,aJ,G,aK){
if(aH){
this.break_id_=aH.break_id_;
this.details_=aK||
%GetScopeDetails(aH.break_id_,
aH.details_.frameId(),
aH.details_.inlinedFrameIndex(),
G);
this.frame_id_=aH.details_.frameId();
this.inlined_frame_id_=aH.details_.inlinedFrameIndex();
}else if(aI){
this.details_=aK||%GetFunctionScopeDetails(aI.value(),G);
this.fun_value_=aI.value();
this.break_id_=(void 0);
}else{
this.details_=
aK||%GetGeneratorScopeDetails(aJ.value(),G);
this.gen_value_=aJ.value();
this.break_id_=(void 0);
}
this.index_=G;
}
ScopeDetails.prototype.type=function(){
if(!(this.break_id_===(void 0))){
%CheckExecutionState(this.break_id_);
}
return this.details_[aB];
};
ScopeDetails.prototype.object=function(){
if(!(this.break_id_===(void 0))){
%CheckExecutionState(this.break_id_);
}
return this.details_[aC];
};
ScopeDetails.prototype.name=function(){
if(!(this.break_id_===(void 0))){
%CheckExecutionState(this.break_id_);
}
return this.details_[aD];
};
ScopeDetails.prototype.startPosition=function(){
if(!(this.break_id_===(void 0))){
%CheckExecutionState(this.break_id_);
}
return this.details_[aE];
}
ScopeDetails.prototype.endPosition=function(){
if(!(this.break_id_===(void 0))){
%CheckExecutionState(this.break_id_);
}
return this.details_[aF];
}
ScopeDetails.prototype.func=function(){
if(!(this.break_id_===(void 0))){
%CheckExecutionState(this.break_id_);
}
return this.details_[aG];
}
ScopeDetails.prototype.setVariableValueImpl=function(z,aL){
var aM;
if(!(this.break_id_===(void 0))){
%CheckExecutionState(this.break_id_);
aM=%SetScopeVariableValue(this.break_id_,this.frame_id_,
this.inlined_frame_id_,this.index_,z,aL);
}else if(!(this.fun_value_===(void 0))){
aM=%SetScopeVariableValue(this.fun_value_,null,null,this.index_,
z,aL);
}else{
aM=%SetScopeVariableValue(this.gen_value_,null,null,this.index_,
z,aL);
}
if(!aM)throw %make_error(2,"Failed to set variable value");
};
function ScopeMirror(aH,aI,aJ,G,aK){
%_Call(Mirror,this,j.SCOPE_TYPE);
if(aH){
this.frame_index_=aH.index_;
}else{
this.frame_index_=(void 0);
}
this.scope_index_=G;
this.details_=new ScopeDetails(aH,aI,aJ,G,aK);
}
inherits(ScopeMirror,Mirror);
ScopeMirror.prototype.details=function(){
return this.details_;
};
ScopeMirror.prototype.frameIndex=function(){
return this.frame_index_;
};
ScopeMirror.prototype.scopeIndex=function(){
return this.scope_index_;
};
ScopeMirror.prototype.scopeType=function(){
return this.details_.type();
};
ScopeMirror.prototype.scopeObject=function(){
return MakeMirror(this.details_.object());
};
ScopeMirror.prototype.setVariableValue=function(z,aL){
this.details_.setVariableValueImpl(z,aL);
};
function ScriptMirror(E){
%_Call(Mirror,this,j.SCRIPT_TYPE);
this.script_=E;
this.context_=new ContextMirror(E.context_data);
}
inherits(ScriptMirror,Mirror);
ScriptMirror.prototype.value=function(){
return this.script_;
};
ScriptMirror.prototype.name=function(){
return this.script_.name||this.script_.nameOrSourceURL();
};
ScriptMirror.prototype.id=function(){
return this.script_.id;
};
ScriptMirror.prototype.source=function(){
return this.script_.source;
};
ScriptMirror.prototype.setSource=function(aN){
if(!(typeof(aN)==='string'))throw %make_error(2,"Source is not a string");
%DebugSetScriptSource(this.script_,aN);
};
ScriptMirror.prototype.lineOffset=function(){
return this.script_.line_offset;
};
ScriptMirror.prototype.columnOffset=function(){
return this.script_.column_offset;
};
ScriptMirror.prototype.data=function(){
return this.script_.data;
};
ScriptMirror.prototype.scriptType=function(){
return this.script_.type;
};
ScriptMirror.prototype.compilationType=function(){
return this.script_.compilation_type;
};
ScriptMirror.prototype.lineCount=function(){
return %ScriptLineCount(this.script_);
};
ScriptMirror.prototype.locationFromPosition=function(
position,include_resource_offset){
return this.script_.locationFromPosition(position,include_resource_offset);
};
ScriptMirror.prototype.context=function(){
return this.context_;
};
ScriptMirror.prototype.evalFromScript=function(){
return MakeMirror(this.script_.eval_from_script);
};
ScriptMirror.prototype.evalFromFunctionName=function(){
return MakeMirror(this.script_.eval_from_function_name);
};
ScriptMirror.prototype.evalFromLocation=function(){
var aO=this.evalFromScript();
if(!aO.isUndefined()){
var aP=this.script_.eval_from_script_position;
return aO.locationFromPosition(aP,true);
}
};
ScriptMirror.prototype.toText=function(){
var D='';
D+=this.name();
D+=' (lines: ';
if(this.lineOffset()>0){
D+=this.lineOffset();
D+='-';
D+=this.lineOffset()+this.lineCount()-1;
}else{
D+=this.lineCount();
}
D+=')';
return D;
};
function ContextMirror(aQ){
%_Call(Mirror,this,j.CONTEXT_TYPE);
this.data_=aQ;
}
inherits(ContextMirror,Mirror);
ContextMirror.prototype.data=function(){
return this.data_;
};
b.InstallConstants(a,[
"MakeMirror",MakeMirror,
"ScopeType",s,
"PropertyType",q,
"PropertyAttribute",r,
"Mirror",Mirror,
"ValueMirror",ValueMirror,
"UndefinedMirror",UndefinedMirror,
"NullMirror",NullMirror,
"BooleanMirror",BooleanMirror,
"NumberMirror",NumberMirror,
"StringMirror",StringMirror,
"SymbolMirror",SymbolMirror,
"ObjectMirror",ObjectMirror,
"FunctionMirror",FunctionMirror,
"UnresolvedFunctionMirror",UnresolvedFunctionMirror,
"ArrayMirror",ArrayMirror,
"DateMirror",DateMirror,
"RegExpMirror",RegExpMirror,
"ErrorMirror",ErrorMirror,
"PromiseMirror",PromiseMirror,
"MapMirror",MapMirror,
"SetMirror",SetMirror,
"IteratorMirror",IteratorMirror,
"GeneratorMirror",GeneratorMirror,
"PropertyMirror",PropertyMirror,
"InternalPropertyMirror",InternalPropertyMirror,
"FrameMirror",FrameMirror,
"ScriptMirror",ScriptMirror,
"ScopeMirror",ScopeMirror,
"FrameDetails",FrameDetails,
]);
})


(function(a,b){
"use strict";
var c=a.FrameMirror;
var d=a.Array;
var e=a.RegExp;
var f=a.isNaN;
var g=a.MakeMirror;
var h=a.Math.min;
var i=a.Mirror;
var j=a.ValueMirror;
var k=10;
var l={};
var m=/^(?:\s*(?:\/\*.*?\*\/)*)*/;
l.DebugEvent={Break:1,
Exception:2,
AfterCompile:3,
CompileError:4,
AsyncTaskEvent:5};
l.ExceptionBreak={Caught:0,
Uncaught:1};
l.StepAction={StepOut:0,
StepNext:1,
StepIn:2};
l.ScriptType={Native:0,
Extension:1,
Normal:2,
Wasm:3};
l.ScriptCompilationType={Host:0,
Eval:1,
JSON:2};
l.ScriptBreakPointType={ScriptId:0,
ScriptName:1,
ScriptRegExp:2};
function ScriptTypeFlag(n){
return(1<<n);
}
var o=0;
var p=1;
var q=[];
var r=[];
var s={
breakPointsActive:{
value:true,
getValue:function(){return this.value;},
setValue:function(t){
this.value=!!t;
%SetBreakPointsActive(this.value);
}
},
breakOnCaughtException:{
getValue:function(){return l.isBreakOnException();},
setValue:function(t){
if(t){
l.setBreakOnException();
}else{
l.clearBreakOnException();
}
}
},
breakOnUncaughtException:{
getValue:function(){return l.isBreakOnUncaughtException();},
setValue:function(t){
if(t){
l.setBreakOnUncaughtException();
}else{
l.clearBreakOnUncaughtException();
}
}
},
};
function MakeBreakPoint(u,v){
var w=new BreakPoint(u,v);
q.push(w);
return w;
}
function BreakPoint(u,v){
this.source_position_=u;
if(v){
this.script_break_point_=v;
}else{
this.number_=p++;
}
this.active_=true;
this.condition_=null;
}
BreakPoint.prototype.number=function(){
return this.number_;
};
BreakPoint.prototype.func=function(){
return this.func_;
};
BreakPoint.prototype.source_position=function(){
return this.source_position_;
};
BreakPoint.prototype.active=function(){
if(this.script_break_point()){
return this.script_break_point().active();
}
return this.active_;
};
BreakPoint.prototype.condition=function(){
if(this.script_break_point()&&this.script_break_point().condition()){
return this.script_break_point().condition();
}
return this.condition_;
};
BreakPoint.prototype.script_break_point=function(){
return this.script_break_point_;
};
BreakPoint.prototype.enable=function(){
this.active_=true;
};
BreakPoint.prototype.disable=function(){
this.active_=false;
};
BreakPoint.prototype.setCondition=function(x){
this.condition_=x;
};
BreakPoint.prototype.isTriggered=function(y){
if(!this.active())return false;
if(this.condition()){
try{
var z=y.frame(0).evaluate(this.condition());
if(!(z instanceof j)||!z.value_){
return false;
}
}catch(e){
return false;
}
}
return true;
};
function IsBreakPointTriggered(A,w){
return w.isTriggered(MakeExecutionState(A));
}
function ScriptBreakPoint(n,script_id_or_name,opt_line,opt_column,
opt_groupId){
this.type_=n;
if(n==l.ScriptBreakPointType.ScriptId){
this.script_id_=script_id_or_name;
}else if(n==l.ScriptBreakPointType.ScriptName){
this.script_name_=script_id_or_name;
}else if(n==l.ScriptBreakPointType.ScriptRegExp){
this.script_regexp_object_=new e(script_id_or_name);
}else{
throw %make_error(2,"Unexpected breakpoint type "+n);
}
this.line_=opt_line||0;
this.column_=opt_column;
this.groupId_=opt_groupId;
this.active_=true;
this.condition_=null;
this.break_points_=[];
}
ScriptBreakPoint.prototype.number=function(){
return this.number_;
};
ScriptBreakPoint.prototype.groupId=function(){
return this.groupId_;
};
ScriptBreakPoint.prototype.type=function(){
return this.type_;
};
ScriptBreakPoint.prototype.script_id=function(){
return this.script_id_;
};
ScriptBreakPoint.prototype.script_name=function(){
return this.script_name_;
};
ScriptBreakPoint.prototype.script_regexp_object=function(){
return this.script_regexp_object_;
};
ScriptBreakPoint.prototype.line=function(){
return this.line_;
};
ScriptBreakPoint.prototype.column=function(){
return this.column_;
};
ScriptBreakPoint.prototype.actual_locations=function(){
var B=[];
for(var C=0;C<this.break_points_.length;C++){
B.push(this.break_points_[C].actual_location);
}
return B;
};
ScriptBreakPoint.prototype.update_positions=function(D,E){
this.line_=D;
this.column_=E;
};
ScriptBreakPoint.prototype.active=function(){
return this.active_;
};
ScriptBreakPoint.prototype.condition=function(){
return this.condition_;
};
ScriptBreakPoint.prototype.enable=function(){
this.active_=true;
};
ScriptBreakPoint.prototype.disable=function(){
this.active_=false;
};
ScriptBreakPoint.prototype.setCondition=function(x){
this.condition_=x;
};
ScriptBreakPoint.prototype.matchesScript=function(F){
if(this.type_==l.ScriptBreakPointType.ScriptId){
return this.script_id_==F.id;
}else{
if(!(F.line_offset<=this.line_&&
this.line_<F.line_offset+%ScriptLineCount(F))){
return false;
}
if(this.type_==l.ScriptBreakPointType.ScriptName){
return this.script_name_==F.nameOrSourceURL();
}else if(this.type_==l.ScriptBreakPointType.ScriptRegExp){
return this.script_regexp_object_.test(F.nameOrSourceURL());
}else{
throw %make_error(2,"Unexpected breakpoint type "+this.type_);
}
}
};
ScriptBreakPoint.prototype.set=function(F){
var E=this.column();
var D=this.line();
if((E===(void 0))){
var G=%ScriptSourceLine(F,D||F.line_offset);
if(!F.sourceColumnStart_){
F.sourceColumnStart_=new d(%ScriptLineCount(F));
}
if((F.sourceColumnStart_[D]===(void 0))){
F.sourceColumnStart_[D]=
G.match(m)[0].length;
}
E=F.sourceColumnStart_[D];
}
var H=l.findScriptSourcePosition(F,this.line(),E);
if((H===null))return;
var w=MakeBreakPoint(H,this);
var I=%SetScriptBreakPoint(F,H,
w);
if((I===(void 0))){
I=H;
}
var J=F.locationFromPosition(I,true);
w.actual_location={line:J.line,
column:J.column,
script_id:F.id};
this.break_points_.push(w);
return w;
};
ScriptBreakPoint.prototype.clear=function(){
var K=[];
for(var C=0;C<q.length;C++){
if(q[C].script_break_point()&&
q[C].script_break_point()===this){
%ClearBreakPoint(q[C]);
}else{
K.push(q[C]);
}
}
q=K;
this.break_points_=[];
};
l.setListener=function(L,M){
if(!(%IsFunction(L))&&!(L===(void 0))&&!(L===null)){
throw %make_type_error(37);
}
%SetDebugEventListener(L,M);
};
l.findScript=function(N){
if((%IsFunction(N))){
return %FunctionGetScript(N);
}else if(%IsRegExp(N)){
var O=this.scripts();
var P=null;
var Q=0;
for(var C in O){
var F=O[C];
if(N.test(F.name)){
P=F;
Q++;
}
}
if(Q==1){
return P;
}else{
return(void 0);
}
}else{
return %GetScript(N);
}
};
l.scriptSource=function(N){
return this.findScript(N).source;
};
l.source=function(R){
if(!(%IsFunction(R)))throw %make_type_error(37);
return %FunctionGetSourceCode(R);
};
l.sourcePosition=function(R){
if(!(%IsFunction(R)))throw %make_type_error(37);
return %FunctionGetScriptSourcePosition(R);
};
l.findFunctionSourceLocation=function(S,T,U){
var F=%FunctionGetScript(S);
var V=%FunctionGetScriptSourcePosition(S);
return %ScriptLocationFromLine(F,T,U,V);
};
l.findScriptSourcePosition=function(F,T,U){
var W=%ScriptLocationFromLine(F,T,U,0);
return W?W.position:null;
};
l.findBreakPoint=function(X,Y){
var w;
for(var C=0;C<q.length;C++){
if(q[C].number()==X){
w=q[C];
if(Y){
q.splice(C,1);
}
break;
}
}
if(w){
return w;
}else{
return this.findScriptBreakPoint(X,Y);
}
};
l.findBreakPointActualLocations=function(X){
for(var C=0;C<r.length;C++){
if(r[C].number()==X){
return r[C].actual_locations();
}
}
for(var C=0;C<q.length;C++){
if(q[C].number()==X){
return[q[C].actual_location];
}
}
return[];
};
l.setBreakPoint=function(S,T,U,Z){
if(!(%IsFunction(S)))throw %make_type_error(37);
if(%FunctionIsAPIFunction(S)){
throw %make_error(2,'Cannot set break point in native code.');
}
var u=
this.findFunctionSourceLocation(S,T,U).position;
var F=%FunctionGetScript(S);
if(F.type==l.ScriptType.Native){
throw %make_error(2,'Cannot set break point in native code.');
}
if(F&&F.id){
var W=F.locationFromPosition(u,false);
return this.setScriptBreakPointById(F.id,
W.line,W.column,
Z);
}else{
var w=MakeBreakPoint(u);
var I=
%SetFunctionBreakPoint(S,u,w);
var J=F.locationFromPosition(I,true);
w.actual_location={line:J.line,
column:J.column,
script_id:F.id};
w.setCondition(Z);
return w.number();
}
};
l.setBreakPointByScriptIdAndPosition=function(script_id,H,
x,enabled)
{
var w=MakeBreakPoint(H);
w.setCondition(x);
if(!enabled){
w.disable();
}
var F=scriptById(script_id);
if(F){
w.actual_position=%SetScriptBreakPoint(F,H,w);
}
return w;
};
l.enableBreakPoint=function(X){
var w=this.findBreakPoint(X,false);
if(w){
w.enable();
}
};
l.disableBreakPoint=function(X){
var w=this.findBreakPoint(X,false);
if(w){
w.disable();
}
};
l.changeBreakPointCondition=function(X,x){
var w=this.findBreakPoint(X,false);
w.setCondition(x);
};
l.clearBreakPoint=function(X){
var w=this.findBreakPoint(X,true);
if(w){
return %ClearBreakPoint(w);
}else{
w=this.findScriptBreakPoint(X,true);
if(!w)throw %make_error(2,'Invalid breakpoint');
}
};
l.clearAllBreakPoints=function(){
for(var C=0;C<q.length;C++){
var w=q[C];
%ClearBreakPoint(w);
}
q=[];
};
l.disableAllBreakPoints=function(){
for(var C=1;C<p;C++){
l.disableBreakPoint(C);
}
%ChangeBreakOnException(l.ExceptionBreak.Caught,false);
%ChangeBreakOnException(l.ExceptionBreak.Uncaught,false);
};
l.findScriptBreakPoint=function(X,Y){
var aa;
for(var C=0;C<r.length;C++){
if(r[C].number()==X){
aa=r[C];
if(Y){
aa.clear();
r.splice(C,1);
}
break;
}
}
return aa;
};
l.setScriptBreakPoint=function(n,script_id_or_name,
T,U,Z,
opt_groupId){
var aa=
new ScriptBreakPoint(n,script_id_or_name,T,U,
opt_groupId);
aa.number_=p++;
aa.setCondition(Z);
r.push(aa);
var O=this.scripts();
for(var C=0;C<O.length;C++){
if(aa.matchesScript(O[C])){
aa.set(O[C]);
}
}
return aa.number();
};
l.setScriptBreakPointById=function(script_id,
T,U,
Z,opt_groupId){
return this.setScriptBreakPoint(l.ScriptBreakPointType.ScriptId,
script_id,T,U,
Z,opt_groupId);
};
l.setScriptBreakPointByName=function(script_name,
T,U,
Z,opt_groupId){
return this.setScriptBreakPoint(l.ScriptBreakPointType.ScriptName,
script_name,T,U,
Z,opt_groupId);
};
l.setScriptBreakPointByRegExp=function(script_regexp,
T,U,
Z,opt_groupId){
return this.setScriptBreakPoint(l.ScriptBreakPointType.ScriptRegExp,
script_regexp,T,U,
Z,opt_groupId);
};
l.enableScriptBreakPoint=function(X){
var aa=this.findScriptBreakPoint(X,false);
aa.enable();
};
l.disableScriptBreakPoint=function(X){
var aa=this.findScriptBreakPoint(X,false);
aa.disable();
};
l.changeScriptBreakPointCondition=function(
X,x){
var aa=this.findScriptBreakPoint(X,false);
aa.setCondition(x);
};
l.scriptBreakPoints=function(){
return r;
};
l.clearStepping=function(){
%ClearStepping();
};
l.setBreakOnException=function(){
return %ChangeBreakOnException(l.ExceptionBreak.Caught,true);
};
l.clearBreakOnException=function(){
return %ChangeBreakOnException(l.ExceptionBreak.Caught,false);
};
l.isBreakOnException=function(){
return!!%IsBreakOnException(l.ExceptionBreak.Caught);
};
l.setBreakOnUncaughtException=function(){
return %ChangeBreakOnException(l.ExceptionBreak.Uncaught,true);
};
l.clearBreakOnUncaughtException=function(){
return %ChangeBreakOnException(l.ExceptionBreak.Uncaught,false);
};
l.isBreakOnUncaughtException=function(){
return!!%IsBreakOnException(l.ExceptionBreak.Uncaught);
};
l.showBreakPoints=function(R,ab){
if(!(%IsFunction(R)))throw %make_error(37);
var ac=ab?this.scriptSource(R):this.source(R);
var ad=ab?0:this.sourcePosition(R);
var B=%GetBreakLocations(R);
if(!B)return ac;
B.sort(function(ae,af){return ae-af;});
var ag="";
var ah=0;
var ai;
for(var C=0;C<B.length;C++){
ai=B[C]-ad;
ag+=ac.slice(ah,ai);
ag+="[B"+C+"]";
ah=ai;
}
ai=ac.length;
ag+=ac.substring(ah,ai);
return ag;
};
l.scripts=function(){
return %DebugGetLoadedScripts();
};
function scriptById(aj){
var O=l.scripts();
for(var F of O){
if(F.id==aj)return F;
}
return(void 0);
};
l.debuggerFlags=function(){
return s;
};
l.MakeMirror=g;
function MakeExecutionState(A){
return new ExecutionState(A);
}
function ExecutionState(A){
this.break_id=A;
this.selected_frame=0;
}
ExecutionState.prototype.prepareStep=function(ak){
if(ak===l.StepAction.StepIn||
ak===l.StepAction.StepOut||
ak===l.StepAction.StepNext){
return %PrepareStep(this.break_id,ak);
}
throw %make_type_error(37);
};
ExecutionState.prototype.evaluateGlobal=function(ac){
return g(%DebugEvaluateGlobal(this.break_id,ac));
};
ExecutionState.prototype.frameCount=function(){
return %GetFrameCount(this.break_id);
};
ExecutionState.prototype.frame=function(al){
if(al==null)al=this.selected_frame;
if(al<0||al>=this.frameCount()){
throw %make_type_error(36);
}
return new c(this.break_id,al);
};
ExecutionState.prototype.setSelectedFrame=function(am){
var C=(%_ToNumber(am));
if(C<0||C>=this.frameCount()){
throw %make_type_error(36);
}
this.selected_frame=C;
};
ExecutionState.prototype.selectedFrame=function(){
return this.selected_frame;
};
function MakeBreakEvent(A,an){
return new BreakEvent(A,an);
}
function BreakEvent(A,an){
this.frame_=new c(A,0);
this.break_points_hit_=an;
}
BreakEvent.prototype.eventType=function(){
return l.DebugEvent.Break;
};
BreakEvent.prototype.func=function(){
return this.frame_.func();
};
BreakEvent.prototype.sourceLine=function(){
return this.frame_.sourceLine();
};
BreakEvent.prototype.sourceColumn=function(){
return this.frame_.sourceColumn();
};
BreakEvent.prototype.sourceLineText=function(){
return this.frame_.sourceLineText();
};
BreakEvent.prototype.breakPointsHit=function(){
return this.break_points_hit_;
};
function MakeExceptionEvent(A,ao,ap,aq){
return new ExceptionEvent(A,ao,ap,aq);
}
function ExceptionEvent(A,ao,ap,aq){
this.exec_state_=new ExecutionState(A);
this.exception_=ao;
this.uncaught_=ap;
this.promise_=aq;
}
ExceptionEvent.prototype.eventType=function(){
return l.DebugEvent.Exception;
};
ExceptionEvent.prototype.exception=function(){
return this.exception_;
};
ExceptionEvent.prototype.uncaught=function(){
return this.uncaught_;
};
ExceptionEvent.prototype.promise=function(){
return this.promise_;
};
ExceptionEvent.prototype.func=function(){
return this.exec_state_.frame(0).func();
};
ExceptionEvent.prototype.sourceLine=function(){
return this.exec_state_.frame(0).sourceLine();
};
ExceptionEvent.prototype.sourceColumn=function(){
return this.exec_state_.frame(0).sourceColumn();
};
ExceptionEvent.prototype.sourceLineText=function(){
return this.exec_state_.frame(0).sourceLineText();
};
function MakeCompileEvent(F,n){
return new CompileEvent(F,n);
}
function CompileEvent(F,n){
this.script_=g(F);
this.type_=n;
}
CompileEvent.prototype.eventType=function(){
return this.type_;
};
CompileEvent.prototype.script=function(){
return this.script_;
};
function MakeScriptObject_(F,ar){
var as={id:F.id(),
name:F.name(),
lineOffset:F.lineOffset(),
columnOffset:F.columnOffset(),
lineCount:F.lineCount(),
};
if(!(F.data()===(void 0))){
as.data=F.data();
}
if(ar){
as.source=F.source();
}
return as;
}
function MakeAsyncTaskEvent(n,at){
return new AsyncTaskEvent(n,at);
}
function AsyncTaskEvent(n,at){
this.type_=n;
this.id_=at;
}
AsyncTaskEvent.prototype.type=function(){
return this.type_;
}
AsyncTaskEvent.prototype.id=function(){
return this.id_;
}
b.InstallConstants(a,[
"Debug",l,
"BreakEvent",BreakEvent,
"CompileEvent",CompileEvent,
"BreakPoint",BreakPoint,
]);
b.InstallConstants(b,[
"MakeExecutionState",MakeExecutionState,
"MakeExceptionEvent",MakeExceptionEvent,
"MakeBreakEvent",MakeBreakEvent,
"MakeCompileEvent",MakeCompileEvent,
"MakeAsyncTaskEvent",MakeAsyncTaskEvent,
"IsBreakPointTriggered",IsBreakPointTriggered,
]);
})


(function(a,b){
"use strict";
var c=a.Debug.findScriptSourcePosition;
var d=a.Array;
var e=a.Math.floor;
var f=a.Math.max;
var g=a.SyntaxError;
var h;
function ApplyPatchMultiChunk(script,diff_array,new_source,preview_only,
change_log){
var i=script.source;
var j=GatherCompileInfo(i,script);
var k=BuildCodeInfoTree(j);
var l=new PosTranslator(diff_array);
MarkChangedFunctions(k,l.GetChunks());
FindLiveSharedInfos(k,script);
var m;
try{
m=GatherCompileInfo(new_source,script);
}catch(e){
var n=
new Failure("Failed to compile new version of script: "+e);
if(e instanceof g){
var o={
type:"liveedit_compile_error",
syntaxErrorMessage:e.message
};
CopyErrorPositionToDetails(e,o);
n.details=o;
}
throw n;
}
var p=m.reduce(
(max,info)=>f(max,info.function_literal_id),0);
var q=BuildCodeInfoTree(m);
FindCorrespondingFunctions(k,q);
var r=new d();
var s=new d();
var t=new d();
var u=new d();
function HarvestTodo(v){
function CollectDamaged(w){
s.push(w);
for(var x=0;x<w.children.length;x++){
CollectDamaged(w.children[x]);
}
}
function CollectNew(y){
for(var x=0;x<y.length;x++){
t.push(y[x]);
CollectNew(y[x].children);
}
}
if(v.status==h.DAMAGED){
CollectDamaged(v);
return;
}
if(v.status==h.UNCHANGED){
u.push(v);
}else if(v.status==h.SOURCE_CHANGED){
u.push(v);
}else if(v.status==h.CHANGED){
r.push(v);
CollectNew(v.unmatched_new_nodes);
}
for(var x=0;x<v.children.length;x++){
HarvestTodo(v.children[x]);
}
}
var z={
change_tree:DescribeChangeTree(k),
textual_diff:{
old_len:i.length,
new_len:new_source.length,
chunks:diff_array
},
updated:false
};
if(preview_only){
return z;
}
HarvestTodo(k);
var A=new d();
var B=new d();
for(var x=0;x<r.length;x++){
var C=r[x].live_shared_function_infos;
var D=
r[x].corresponding_node.info.shared_function_info;
if(C){
for(var E=0;E<C.length;E++){
A.push(C[E]);
B.push(D);
}
}
}
var F=
CheckStackActivations(A,
B,
change_log);
z.stack_modified=F!=0;
var G;
if(s.length==0){
%LiveEditReplaceScript(script,new_source,null);
G=(void 0);
}else{
var H=CreateNameForOldScript(script);
G=%LiveEditReplaceScript(script,new_source,H);
var I=new d();
change_log.push({linked_to_old_script:I});
for(var x=0;x<s.length;x++){
LinkToOldScript(s[x],G,
I);
}
z.created_script_name=H;
}
for(var x=0;x<r.length;x++){
PatchFunctionCode(r[x],change_log);
}
var J=new d();
change_log.push({position_patched:J});
for(var x=0;x<u.length;x++){
PatchPositions(u[x],diff_array,
J);
if(u[x].live_shared_function_infos){
var K=
u[x]
.corresponding_node.info.function_literal_id;
u[x].live_shared_function_infos.forEach(function(
info){
%LiveEditFunctionSourceUpdated(
info.raw_array,K);
});
}
}
%LiveEditFixupScript(script,p);
for(var x=0;x<t.length;x++){
%LiveEditFunctionSetScript(
t[x].info.shared_function_info,script);
}
z.updated=true;
return z;
}
function GatherCompileInfo(L,M){
var N=%LiveEditGatherCompileInfo(M,L);
var O=new d();
var P=new d();
for(var x=0;x<N.length;x++){
var Q=new FunctionCompileInfo(N[x]);
%LiveEditFunctionSetScript(Q.shared_function_info,(void 0));
O.push(Q);
P.push(x);
}
for(var x=0;x<O.length;x++){
var R=x;
for(var E=x+1;E<O.length;E++){
if(O[R].start_position>O[E].start_position){
R=E;
}
}
if(R!=x){
var S=O[R];
var T=P[R];
O[R]=O[x];
P[R]=P[x];
O[x]=S;
P[x]=T;
}
}
var U=0;
function ResetIndexes(V,W){
var X=-1;
while(U<O.length&&
O[U].outer_index==W){
var Y=U;
O[Y].outer_index=V;
if(X!=-1){
O[X].next_sibling_index=Y;
}
X=Y;
U++;
ResetIndexes(Y,P[Y]);
}
if(X!=-1){
O[X].next_sibling_index=-1;
}
}
ResetIndexes(-1,-1);
Assert(U==O.length);
return O;
}
function PatchFunctionCode(v,Z){
var D=v.corresponding_node.info;
if(v.live_shared_function_infos){
v.live_shared_function_infos.forEach(function(aa){
%LiveEditReplaceFunctionCode(D.raw_array,
aa.raw_array);
for(var x=0;x<v.children.length;x++){
if(v.children[x].corresponding_node){
var ab=
v.children[x].corresponding_node.info.
shared_function_info;
if(v.children[x].live_shared_function_infos){
v.children[x].live_shared_function_infos.
forEach(function(ac){
%LiveEditReplaceRefToNestedFunction(
aa.info,
ab,
ac.info);
});
}
}
}
});
Z.push({function_patched:D.function_name});
}else{
Z.push({function_patched:D.function_name,
function_info_not_found:true});
}
}
function LinkToOldScript(ad,G,ae){
if(ad.live_shared_function_infos){
ad.live_shared_function_infos.
forEach(function(Q){
%LiveEditFunctionSetScript(Q.info,G);
});
ae.push({name:ad.info.function_name});
}else{
ae.push(
{name:ad.info.function_name,not_found:true});
}
}
function Assert(af,ag){
if(!af){
if(ag){
throw"Assert "+ag;
}else{
throw"Assert";
}
}
}
function DiffChunk(ah,ai,aj,ak){
this.pos1=ah;
this.pos2=ai;
this.len1=aj;
this.len2=ak;
}
function PosTranslator(al){
var am=new d();
var an=0;
for(var x=0;x<al.length;x+=3){
var ao=al[x];
var ap=ao+an;
var aq=al[x+1];
var ar=al[x+2];
am.push(new DiffChunk(ao,ap,aq-ao,
ar-ap));
an=ar-aq;
}
this.chunks=am;
}
PosTranslator.prototype.GetChunks=function(){
return this.chunks;
};
PosTranslator.prototype.Translate=function(as,at){
var au=this.chunks;
if(au.length==0||as<au[0].pos1){
return as;
}
var av=0;
var aw=au.length-1;
while(av<aw){
var ax=e((av+aw)/2);
if(as<au[ax+1].pos1){
aw=ax;
}else{
av=ax+1;
}
}
var ay=au[av];
if(as>=ay.pos1+ay.len1){
return as+ay.pos2+ay.len2-ay.pos1-ay.len1;
}
if(!at){
at=PosTranslator.DefaultInsideChunkHandler;
}
return at(as,ay);
};
PosTranslator.DefaultInsideChunkHandler=function(as,az){
Assert(false,"Cannot translate position in changed area");
};
PosTranslator.ShiftWithTopInsideChunkHandler=
function(as,az){
return as-az.pos1+az.pos2;
};
var h={
UNCHANGED:"unchanged",
SOURCE_CHANGED:"source changed",
CHANGED:"changed",
DAMAGED:"damaged"
};
function CodeInfoTreeNode(aA,aB,aC){
this.info=aA;
this.children=aB;
this.array_index=aC;
this.parent=(void 0);
this.status=h.UNCHANGED;
this.status_explanation=(void 0);
this.new_start_pos=(void 0);
this.new_end_pos=(void 0);
this.corresponding_node=(void 0);
this.unmatched_new_nodes=(void 0);
this.textual_corresponding_node=(void 0);
this.textually_unmatched_new_nodes=(void 0);
this.live_shared_function_infos=(void 0);
}
function BuildCodeInfoTree(aD){
var aE=0;
function BuildNode(){
var aF=aE;
aE++;
var aG=new d();
while(aE<aD.length&&
aD[aE].outer_index==aF){
aG.push(BuildNode());
}
var w=new CodeInfoTreeNode(aD[aF],aG,
aF);
for(var x=0;x<aG.length;x++){
aG[x].parent=w;
}
return w;
}
var aH=BuildNode();
Assert(aE==aD.length);
return aH;
}
function MarkChangedFunctions(aI,am){
var aJ=new function(){
var aK=0;
var aL=0;
this.current=function(){return am[aK];};
this.next=function(){
var ay=am[aK];
aL=ay.pos2+ay.len2-(ay.pos1+ay.len1);
aK++;
};
this.done=function(){return aK>=am.length;};
this.TranslatePos=function(as){return as+aL;};
};
function ProcessInternals(aM){
aM.new_start_pos=aJ.TranslatePos(
aM.info.start_position);
var aN=0;
var aO=false;
var aP=false;
while(!aJ.done()&&
aJ.current().pos1<aM.info.end_position){
if(aN<aM.children.length){
var aQ=aM.children[aN];
if(aQ.info.end_position<=aJ.current().pos1){
ProcessUnchangedChild(aQ);
aN++;
continue;
}else if(aQ.info.start_position>=
aJ.current().pos1+aJ.current().len1){
aO=true;
aJ.next();
continue;
}else if(aQ.info.start_position<=aJ.current().pos1&&
aQ.info.end_position>=aJ.current().pos1+
aJ.current().len1){
ProcessInternals(aQ);
aP=aP||
(aQ.status!=h.UNCHANGED);
aO=aO||
(aQ.status==h.DAMAGED);
aN++;
continue;
}else{
aO=true;
aQ.status=h.DAMAGED;
aQ.status_explanation=
"Text diff overlaps with function boundary";
aN++;
continue;
}
}else{
if(aJ.current().pos1+aJ.current().len1<=
aM.info.end_position){
aM.status=h.CHANGED;
aJ.next();
continue;
}else{
aM.status=h.DAMAGED;
aM.status_explanation=
"Text diff overlaps with function boundary";
return;
}
}
Assert("Unreachable",false);
}
while(aN<aM.children.length){
var aQ=aM.children[aN];
ProcessUnchangedChild(aQ);
aN++;
}
if(aO){
aM.status=h.CHANGED;
}else if(aP){
aM.status=h.SOURCE_CHANGED;
}
aM.new_end_pos=
aJ.TranslatePos(aM.info.end_position);
}
function ProcessUnchangedChild(w){
w.new_start_pos=aJ.TranslatePos(w.info.start_position);
w.new_end_pos=aJ.TranslatePos(w.info.end_position);
}
ProcessInternals(aI);
}
function FindCorrespondingFunctions(aR,aS){
function ProcessNode(v,aT){
var aU=
IsFunctionContextLocalsChanged(v.info,aT.info);
if(aU){
v.status=h.CHANGED;
}
var aV=v.children;
var aW=aT.children;
var aX=[];
var aY=[];
var aZ=0;
var ba=0;
while(aZ<aV.length){
if(aV[aZ].status==h.DAMAGED){
aZ++;
}else if(ba<aW.length){
if(aW[ba].info.start_position<
aV[aZ].new_start_pos){
aX.push(aW[ba]);
aY.push(aW[ba]);
ba++;
}else if(aW[ba].info.start_position==
aV[aZ].new_start_pos){
if(aW[ba].info.end_position==
aV[aZ].new_end_pos){
aV[aZ].corresponding_node=
aW[ba];
aV[aZ].textual_corresponding_node=
aW[ba];
if(aU){
aV[aZ].status=h.DAMAGED;
aV[aZ].status_explanation=
"Enclosing function is now incompatible. "+
aU;
aV[aZ].corresponding_node=(void 0);
}else if(aV[aZ].status!=
h.UNCHANGED){
ProcessNode(aV[aZ],
aW[ba]);
if(aV[aZ].status==h.DAMAGED){
aX.push(
aV[aZ].corresponding_node);
aV[aZ].corresponding_node=(void 0);
v.status=h.CHANGED;
}
}else{
ProcessNode(aV[aZ],aW[ba]);
}
}else{
aV[aZ].status=h.DAMAGED;
aV[aZ].status_explanation=
"No corresponding function in new script found";
v.status=h.CHANGED;
aX.push(aW[ba]);
aY.push(aW[ba]);
}
ba++;
aZ++;
}else{
aV[aZ].status=h.DAMAGED;
aV[aZ].status_explanation=
"No corresponding function in new script found";
v.status=h.CHANGED;
aZ++;
}
}else{
aV[aZ].status=h.DAMAGED;
aV[aZ].status_explanation=
"No corresponding function in new script found";
v.status=h.CHANGED;
aZ++;
}
}
while(ba<aW.length){
aX.push(aW[ba]);
aY.push(aW[ba]);
ba++;
}
if(v.status==h.CHANGED){
if(v.info.param_num!=aT.info.param_num){
v.status=h.DAMAGED;
v.status_explanation="Changed parameter number: "+
v.info.param_num+" and "+aT.info.param_num;
}
}
v.unmatched_new_nodes=aX;
v.textually_unmatched_new_nodes=
aY;
}
ProcessNode(aR,aS);
aR.corresponding_node=aS;
aR.textual_corresponding_node=aS;
Assert(aR.status!=h.DAMAGED,
"Script became damaged");
}
function FindLiveSharedInfos(aR,M){
var bb=%LiveEditFindSharedFunctionInfosForScript(M);
var bc=new d();
for(var x=0;x<bb.length;x++){
bc.push(new SharedInfoWrapper(bb[x]));
}
function FindFunctionInfos(O){
var bd=[];
for(var x=0;x<bc.length;x++){
var be=bc[x];
if(be.start_position==O.start_position&&
be.end_position==O.end_position){
bd.push(be);
}
}
if(bd.length>0){
return bd;
}
}
function TraverseTree(w){
w.live_shared_function_infos=FindFunctionInfos(w.info);
for(var x=0;x<w.children.length;x++){
TraverseTree(w.children[x]);
}
}
TraverseTree(aR);
}
function FunctionCompileInfo(bf){
this.function_name=bf[0];
this.start_position=bf[1];
this.end_position=bf[2];
this.param_num=bf[3];
this.scope_info=bf[4];
this.outer_index=bf[5];
this.shared_function_info=bf[6];
this.function_literal_id=bf[7];
this.next_sibling_index=null;
this.raw_array=bf;
}
function SharedInfoWrapper(bf){
this.function_name=bf[0];
this.start_position=bf[1];
this.end_position=bf[2];
this.info=bf[3];
this.raw_array=bf;
}
function PatchPositions(ad,al,ae){
if(ad.live_shared_function_infos){
ad.live_shared_function_infos.forEach(function(Q){
%LiveEditPatchFunctionPositions(Q.raw_array,
al);
});
ae.push({name:ad.info.function_name});
}else{
ae.push(
{name:ad.info.function_name,info_not_found:true});
}
}
function CreateNameForOldScript(M){
return M.name+" (old)";
}
function IsFunctionContextLocalsChanged(bg,bh){
var bi=bg.scope_info;
var bj=bh.scope_info;
var bk;
var bl;
if(bi){
bk=bi.toString();
}else{
bk="";
}
if(bj){
bl=bj.toString();
}else{
bl="";
}
if(bk!=bl){
return"Variable map changed: ["+bk+
"] => ["+bl+"]";
}
return;
}
var bm;
function CheckStackActivations(old_shared_wrapper_list,
new_shared_list,
Z){
var bn=new d();
for(var x=0;x<old_shared_wrapper_list.length;x++){
bn[x]=old_shared_wrapper_list[x].info;
}
var bo=%LiveEditCheckAndDropActivations(
bn,new_shared_list,true);
if(bo[old_shared_wrapper_list.length]){
throw new Failure(bo[old_shared_wrapper_list.length]);
}
var bp=new d();
var bq=new d();
for(var x=0;x<bn.length;x++){
var br=old_shared_wrapper_list[x];
if(bo[x]==bm.REPLACED_ON_ACTIVE_STACK){
bq.push({name:br.function_name});
}else if(bo[x]!=bm.AVAILABLE_FOR_PATCH){
var bs={
name:br.function_name,
start_pos:br.start_position,
end_pos:br.end_position,
replace_problem:
bm.SymbolName(bo[x])
};
bp.push(bs);
}
}
if(bq.length>0){
Z.push({dropped_from_stack:bq});
}
if(bp.length>0){
Z.push({functions_on_stack:bp});
throw new Failure("Blocked by functions on stack");
}
return bq.length;
}
var bm={
AVAILABLE_FOR_PATCH:1,
BLOCKED_ON_ACTIVE_STACK:2,
BLOCKED_ON_OTHER_STACK:3,
BLOCKED_UNDER_NATIVE_CODE:4,
REPLACED_ON_ACTIVE_STACK:5,
BLOCKED_UNDER_GENERATOR:6,
BLOCKED_ACTIVE_GENERATOR:7,
BLOCKED_NO_NEW_TARGET_ON_RESTART:8
};
bm.SymbolName=function(bt){
var bu=bm;
for(var bv in bu){
if(bu[bv]==bt){
return bv;
}
}
};
function Failure(ag){
this.message=ag;
}
Failure.prototype.toString=function(){
return"LiveEdit Failure: "+this.message;
};
function CopyErrorPositionToDetails(bw,o){
function createPositionStruct(M,bx){
if(bx==-1)return;
var by=M.locationFromPosition(bx,true);
if(by==null)return;
return{
line:by.line+1,
column:by.column+1,
position:bx
};
}
if(!("scriptObject"in bw)||!("startPosition"in bw)){
return;
}
var M=bw.scriptObject;
var bz={
start:createPositionStruct(M,bw.startPosition),
end:createPositionStruct(M,bw.endPosition)
};
o.position=bz;
}
function SetScriptSource(M,bA,bB,Z){
var i=M.source;
var bC=CompareStrings(i,bA);
return ApplyPatchMultiChunk(M,bC,bA,bB,
Z);
}
function CompareStrings(bD,bE){
return %LiveEditCompareStrings(bD,bE);
}
function ApplySingleChunkPatch(M,change_pos,change_len,new_str,
Z){
var i=M.source;
var bA=i.substring(0,change_pos)+
new_str+i.substring(change_pos+change_len);
return ApplyPatchMultiChunk(M,
[change_pos,change_pos+change_len,change_pos+new_str.length],
bA,false,Z);
}
function DescribeChangeTree(aR){
function ProcessOldNode(w){
var bF=[];
for(var x=0;x<w.children.length;x++){
var aQ=w.children[x];
if(aQ.status!=h.UNCHANGED){
bF.push(ProcessOldNode(aQ));
}
}
var bG=[];
if(w.textually_unmatched_new_nodes){
for(var x=0;x<w.textually_unmatched_new_nodes.length;x++){
var aQ=w.textually_unmatched_new_nodes[x];
bG.push(ProcessNewNode(aQ));
}
}
var bH={
name:w.info.function_name,
positions:DescribePositions(w),
status:w.status,
children:bF,
new_children:bG
};
if(w.status_explanation){
bH.status_explanation=w.status_explanation;
}
if(w.textual_corresponding_node){
bH.new_positions=DescribePositions(w.textual_corresponding_node);
}
return bH;
}
function ProcessNewNode(w){
var bF=[];
if(false){
for(var x=0;x<w.children.length;x++){
bF.push(ProcessNewNode(w.children[x]));
}
}
var bH={
name:w.info.function_name,
positions:DescribePositions(w),
children:bF,
};
return bH;
}
function DescribePositions(w){
return{
start_position:w.info.start_position,
end_position:w.info.end_position
};
}
return ProcessOldNode(aR);
}
var bI={};
bI.SetScriptSource=SetScriptSource;
bI.ApplyPatchMultiChunk=ApplyPatchMultiChunk;
bI.Failure=Failure;
bI.TestApi={
PosTranslator:PosTranslator,
CompareStrings:CompareStrings,
ApplySingleChunkPatch:ApplySingleChunkPatch
};
b.InstallConstants(b,[
"SetScriptSource",bI.SetScriptSource,
]);
a.Debug.LiveEdit=bI;
})


(function(a,b,c){
"use strict";
%CheckIsBootstrapping();
var d=(void 0);
var e=%ExportFromRuntime({});
function Export(f){
f(e);
}
function Import(f){
f.next=d;
d=f;
}
function ImportNow(g){
return e[g];
}
function InstallConstants(h,i){
%CheckIsBootstrapping();
%OptimizeObjectForAddingMultipleProperties(h,i.length>>1);
var j=2|4|1;
for(var k=0;k<i.length;k+=2){
var g=i[k];
var l=i[k+1];
%AddNamedProperty(h,g,l,j);
}
%ToFastProperties(h);
}
function SetUpLockedPrototype(
constructor,fields,methods){
%CheckIsBootstrapping();
var m=constructor.prototype;
var n=(methods.length>>1)+(fields?fields.length:0);
if(n>=4){
%OptimizeObjectForAddingMultipleProperties(m,n);
}
if(fields){
for(var k=0;k<fields.length;k++){
%AddNamedProperty(m,fields[k],
(void 0),2|4);
}
}
for(var k=0;k<methods.length;k+=2){
var o=methods[k];
var f=methods[k+1];
%AddNamedProperty(m,o,f,2|4|1);
%SetNativeFlag(f);
}
%InternalSetPrototype(m,null);
%ToFastProperties(m);
}
function PostNatives(b){
%CheckIsBootstrapping();
for(;!(d===(void 0));d=d.next){
d(e);
}
e=(void 0);
b.Export=(void 0);
b.Import=(void 0);
b.ImportNow=(void 0);
b.PostNatives=(void 0);
}
%OptimizeObjectForAddingMultipleProperties(b,14);
b.Import=Import;
b.ImportNow=ImportNow;
b.Export=Export;
b.InstallConstants=InstallConstants;
b.SetUpLockedPrototype=SetUpLockedPrototype;
b.PostNatives=PostNatives;
%ToFastProperties(b);
%OptimizeObjectForAddingMultipleProperties(c,11);
c.logStackTrace=function logStackTrace(){
%DebugTrace();
};
c.log=function log(){
let message='';
for(const arg of arguments){
message+=arg;
}
%GlobalPrint(message);
};
c.createPrivateSymbol=function createPrivateSymbol(g){
return %CreatePrivateSymbol(g);
};
c.simpleBind=function simpleBind(p,q){
return function(...args){
return %reflect_apply(p,q,args);
};
};
c.uncurryThis=function uncurryThis(p){
return function(q,...args){
return %reflect_apply(p,q,args);
};
};
c.rejectPromise=function rejectPromise(r,s){
%promise_internal_reject(r,s,true);
}
c.markPromiseAsHandled=function markPromiseAsHandled(r){
%PromiseMarkAsHandled(r);
};
c.promiseState=function promiseState(r){
return %PromiseStatus(r);
};
c.kPROMISE_PENDING=0;
c.kPROMISE_FULFILLED=1;
c.kPROMISE_REJECTED=2;
%ToFastProperties(c);
})


(function(a,b){
"use strict";
%CheckIsBootstrapping();
function MaxSimple(c,d){
return c>d?c:d;
}
function MinSimple(c,d){
return c>d?d:c;
}
%SetForceInlineFlag(MaxSimple);
%SetForceInlineFlag(MinSimple);
b.Export(function(e){
e.MaxSimple=MaxSimple;
e.MinSimple=MinSimple;
});
})


(function(a,b){
"use strict";
%CheckIsBootstrapping();
var c=a.Object;
var d=b.ImportNow("iterator_symbol");
%DefineMethodsInternal(c.prototype,class{
toLocaleString(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Object.prototype.toLocaleString");
return this.toString();
}},-1);
function GetMethod(e,f){
var g=e[f];
if((g==null))return(void 0);
if((typeof(g)==='function'))return g;
throw %make_type_error(16,typeof g);
}
function ObjectConstructor(h){
if(c!=new.target&&!(new.target===(void 0))){
return this;
}
if((h===null)||(h===(void 0)))return{};
return(%_ToObject(h));
}
%SetNativeFlag(c);
%SetCode(c,ObjectConstructor);
function GetIterator(e,i){
if((i===(void 0))){
i=e[d];
}
if(!(typeof(i)==='function')){
throw %make_type_error(76,e);
}
var j=%_Call(i,e);
if(!(%_IsJSReceiver(j))){
throw %make_type_error(69,j);
}
return j;
}
b.Export(function(k){
k.GetIterator=GetIterator;
k.GetMethod=GetMethod;
});
})


(function(a,b,c){
"use strict";
%CheckIsBootstrapping();
var d;
var e;
var f=a.Array;
var g=b.InternalArray;
var h;
var i;
var j=a.Object.prototype.hasOwnProperty;
var k=a.Object.prototype.toString;
var l=b.ImportNow("iterator_symbol");
var m=b.ImportNow("unscopables_symbol");
b.Import(function(n){
d=n.GetIterator;
e=n.GetMethod;
h=n.MaxSimple;
i=n.MinSimple;
});
function ArraySpeciesCreate(o,p){
p=((p)+0);
var q=%ArraySpeciesConstructor(o);
return new q(p);
}
function KeySortCompare(r,s){
return r-s;
}
function GetSortedArrayKeys(o,t){
if((typeof(t)==='number')){
var u=t;
var v=new g();
for(var w=0;w<u;++w){
var x=o[w];
if(!(x===(void 0))||w in o){
v.push(w);
}
}
return v;
}
return InnerArraySort(t,t.length,KeySortCompare);
}
function SparseJoinWithSeparatorJS(o,v,p,y,z){
var A=v.length;
var B=new g(A*2);
for(var w=0;w<A;w++){
var C=v[w];
B[w*2]=C;
B[w*2+1]=ConvertToString(y,o[C]);
}
return %SparseJoinWithSeparator(B,p,z);
}
function SparseJoin(o,v,y){
var A=v.length;
var B=new g(A);
for(var w=0;w<A;w++){
B[w]=ConvertToString(y,o[v[w]]);
}
return %StringBuilderConcat(B,A,'');
}
function UseSparseVariant(o,p,D,E){
if(!D||p<1000||%HasComplexElements(o)){
return false;
}
if(!%_IsSmi(p)){
return true;
}
var F=p>>2;
var G=%EstimateNumberOfElements(o);
return(G<F)&&
(E>G*4);
}
function Stack(){
this.length=0;
this.values=new g();
}
Stack.prototype.length=null;
Stack.prototype.values=null;
function StackPush(H,I){
H.values[H.length++]=I;
}
function StackPop(H){
H.values[--H.length]=null
}
function StackHas(H,J){
var p=H.length;
var K=H.values;
for(var w=0;w<p;w++){
if(K[w]===J)return true;
}
return false;
}
var L=new Stack();
function DoJoin(o,p,D,z,y){
if(UseSparseVariant(o,p,D,p)){
%NormalizeElements(o);
var v=GetSortedArrayKeys(o,%GetArrayKeys(o,p));
if(z===''){
if(v.length===0)return'';
return SparseJoin(o,v,y);
}else{
return SparseJoinWithSeparatorJS(
o,v,p,y,z);
}
}
if(p===1){
return ConvertToString(y,o[0]);
}
var B=new g(p);
for(var w=0;w<p;w++){
B[w]=ConvertToString(y,o[w]);
}
if(z===''){
return %StringBuilderConcat(B,p,'');
}else{
return %StringBuilderJoin(B,p,z);
}
}
function Join(o,p,z,y){
if(p===0)return'';
var D=(%_IsArray(o));
if(D){
if(StackHas(L,o))return'';
StackPush(L,o);
}
try{
return DoJoin(o,p,D,z,y);
}finally{
if(D)StackPop(L);
}
}
function ConvertToString(y,M){
if((M==null))return'';
return(%_ToString(y?M.toLocaleString():M));
}
function SparseSlice(o,N,O,P,Q){
var t=%GetArrayKeys(o,N+O);
if((typeof(t)==='number')){
var u=t;
for(var w=N;w<u;++w){
var R=o[w];
if(!(R===(void 0))||w in o){
%CreateDataProperty(Q,w-N,R);
}
}
}else{
var p=t.length;
for(var S=0;S<p;++S){
var C=t[S];
if(C>=N){
var R=o[C];
if(!(R===(void 0))||C in o){
%CreateDataProperty(Q,C-N,R);
}
}
}
}
}
function SparseMove(o,N,O,P,T){
if(T===O)return;
var U=new g(
i(P-O+T,0xffffffff));
var V;
var t=%GetArrayKeys(o,P);
if((typeof(t)==='number')){
var u=t;
for(var w=0;w<N&&w<u;++w){
var R=o[w];
if(!(R===(void 0))||w in o){
U[w]=R;
}
}
for(var w=N+O;w<u;++w){
var R=o[w];
if(!(R===(void 0))||w in o){
U[w-O+T]=R;
}
}
}else{
var p=t.length;
for(var S=0;S<p;++S){
var C=t[S];
if(C<N){
var R=o[C];
if(!(R===(void 0))||C in o){
U[C]=R;
}
}else if(C>=N+O){
var R=o[C];
if(!(R===(void 0))||C in o){
var W=C-O+T;
U[W]=R;
if(W>0xfffffffe){
V=V||new g();
V.push(W);
}
}
}
}
}
%MoveArrayContents(U,o);
if(!(V===(void 0))){
var p=V.length;
for(var w=0;w<p;++w){
var C=V[w];
o[C]=U[C];
}
}
}
function SimpleSlice(o,N,O,P,Q){
for(var w=0;w<O;w++){
var X=N+w;
if(X in o){
var R=o[X];
%CreateDataProperty(Q,w,R);
}
}
}
function SimpleMove(o,N,O,P,T){
if(T!==O){
if(T>O){
for(var w=P-O;w>N;w--){
var Y=w+O-1;
var Z=w+T-1;
if(Y in o){
o[Z]=o[Y];
}else{
delete o[Z];
}
}
}else{
for(var w=N;w<P-O;w++){
var Y=w+O;
var Z=w+T;
if(Y in o){
o[Z]=o[Y];
}else{
delete o[Z];
}
}
for(var w=P;w>P-O+T;w--){
delete o[w-1];
}
}
}
}
var aa;
%DefineMethodsInternal(f.prototype,class{toString(){
var o;
var ab;
if((%_IsArray(this))){
ab=this.join;
if(ab===aa){
return Join(this,this.length,',',false);
}
o=this;
}else{
o=(%_ToObject(this));
ab=o.join;
}
if(!(typeof(ab)==='function')){
return %_Call(k,o);
}
return %_Call(ab,o);
}},-1);
function InnerArrayToLocaleString(o,p){
return Join(o,(%_ToLength(p)),',',true);
}
%DefineMethodsInternal(f.prototype,class{toLocaleString(){
var o=(%_ToObject(this));
var ac=o.length;
return InnerArrayToLocaleString(o,ac);
}},-1);
function InnerArrayJoin(z,o,p){
if((z===(void 0))){
z=',';
}else{
z=(%_ToString(z));
}
if(p===1){
var x=o[0];
if((x==null))return'';
return(%_ToString(x));
}
return Join(o,p,z,false);
}
%DefineMethodsInternal(f.prototype,class{join(z){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.join");
var o=(%_ToObject(this));
var p=(%_ToLength(o.length));
return InnerArrayJoin(z,o,p);
}},-1);
function ArrayPopFallback(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.pop");
var o=(%_ToObject(this));
var ad=(%_ToLength(o.length));
if(ad==0){
o.length=ad;
return;
}
ad--;
var I=o[ad];
delete o[ad];
o.length=ad;
return I;
}
function ArrayPushFallback(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.push");
var o=(%_ToObject(this));
var ad=(%_ToLength(o.length));
var ae=arguments.length;
if(ae>9007199254740991-ad)throw %make_type_error(237,ae,ad);
for(var w=0;w<ae;w++){
o[w+ad]=arguments[w];
}
var af=ad+ae;
o.length=af;
return af;
}
function SparseReverse(o,P){
var v=GetSortedArrayKeys(o,%GetArrayKeys(o,P));
var ag=v.length-1;
var ah=0;
while(ah<=ag){
var w=v[ah];
var ai=v[ag];
var aj=P-ai-1;
var ak,al;
if(aj<=w){
al=ai;
while(v[--ag]==ai){}
ak=aj;
}
if(aj>=w){
ak=w;
while(v[++ah]==w){}
al=P-w-1;
}
var am=o[ak];
if(!(am===(void 0))||ak in o){
var an=o[al];
if(!(an===(void 0))||al in o){
o[ak]=an;
o[al]=am;
}else{
o[al]=am;
delete o[ak];
}
}else{
var an=o[al];
if(!(an===(void 0))||al in o){
o[ak]=an;
delete o[al];
}
}
}
}
function PackedArrayReverse(o,P){
var ai=P-1;
for(var w=0;w<ai;w++,ai--){
var am=o[w];
var an=o[ai];
o[w]=an;
o[ai]=am;
}
return o;
}
function GenericArrayReverse(o,P){
var ai=P-1;
for(var w=0;w<ai;w++,ai--){
if(w in o){
var am=o[w];
if(ai in o){
var an=o[ai];
o[w]=an;
o[ai]=am;
}else{
o[ai]=am;
delete o[w];
}
}else{
if(ai in o){
var an=o[ai];
o[w]=an;
delete o[ai];
}
}
}
return o;
}
%DefineMethodsInternal(f.prototype,class{reverse(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.reverse");
var o=(%_ToObject(this));
var P=(%_ToLength(o.length));
var ao=(%_IsArray(o));
if(UseSparseVariant(o,P,ao,P)){
%NormalizeElements(o);
SparseReverse(o,P);
return o;
}else if(ao&&%_HasFastPackedElements(o)){
return PackedArrayReverse(o,P);
}else{
return GenericArrayReverse(o,P);
}
}},-1);
function ArrayShiftFallback(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.shift");
var o=(%_ToObject(this));
var P=(%_ToLength(o.length));
if(P===0){
o.length=0;
return;
}
if(%object_is_sealed(o))throw %make_type_error(13);
var ap=o[0];
if(UseSparseVariant(o,P,(%_IsArray(o)),P)){
SparseMove(o,0,1,P,0);
}else{
SimpleMove(o,0,1,P,0);
}
o.length=P-1;
return ap;
}
function ArrayUnshiftFallback(aq){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.unshift");
var o=(%_ToObject(this));
var P=(%_ToLength(o.length));
var ar=arguments.length;
if(P>0&&UseSparseVariant(o,P,(%_IsArray(o)),P)&&
!%object_is_sealed(o)){
SparseMove(o,0,0,P,ar);
}else{
SimpleMove(o,0,0,P,ar);
}
for(var w=0;w<ar;w++){
o[w]=arguments[w];
}
var af=P+ar;
o.length=af;
return af;
}
function ArraySliceFallback(as,at){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.slice");
var o=(%_ToObject(this));
var P=(%_ToLength(o.length));
var N=(%_ToInteger(as));
var au=P;
if(!(at===(void 0)))au=(%_ToInteger(at));
if(N<0){
N+=P;
if(N<0)N=0;
}else{
if(N>P)N=P;
}
if(au<0){
au+=P;
if(au<0)au=0;
}else{
if(au>P)au=P;
}
var av=ArraySpeciesCreate(o,h(au-N,0));
if(au<N)return av;
if(UseSparseVariant(o,P,(%_IsArray(o)),au-N)){
%NormalizeElements(o);
if((%_IsArray(av)))%NormalizeElements(av);
SparseSlice(o,N,au-N,P,av);
}else{
SimpleSlice(o,N,au-N,P,av);
}
av.length=au-N;
return av;
}
function ComputeSpliceStartIndex(N,P){
if(N<0){
N+=P;
return N<0?0:N;
}
return N>P?P:N;
}
function ComputeSpliceDeleteCount(aw,ar,P,N){
var O=0;
if(ar==1)
return P-N;
O=(%_ToInteger(aw));
if(O<0)
return 0;
if(O>P-N)
return P-N;
return O;
}
function ArraySpliceFallback(as,aw){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.splice");
var ar=arguments.length;
var o=(%_ToObject(this));
var P=(%_ToLength(o.length));
var N=ComputeSpliceStartIndex((%_ToInteger(as)),P);
var O=ComputeSpliceDeleteCount(aw,ar,P,
N);
var Q=ArraySpeciesCreate(o,O);
Q.length=O;
var ax=ar>2?ar-2:0;
if(O!=ax&&%object_is_sealed(o)){
throw %make_type_error(13);
}else if(O>0&&%object_is_frozen(o)){
throw %make_type_error(12);
}
var ay=O;
if(ax!=O){
ay+=P-N-O;
}
if(UseSparseVariant(o,P,(%_IsArray(o)),ay)){
%NormalizeElements(o);
if((%_IsArray(Q)))%NormalizeElements(Q);
SparseSlice(o,N,O,P,Q);
SparseMove(o,N,O,P,ax);
}else{
SimpleSlice(o,N,O,P,Q);
SimpleMove(o,N,O,P,ax);
}
var w=N;
var az=2;
var aA=arguments.length;
while(az<aA){
o[w++]=arguments[az++];
}
o.length=P-O+ax;
return Q;
}
function InnerArraySort(o,p,aB){
if(!(typeof(aB)==='function')){
aB=function(M,aC){
if(M===aC)return 0;
if(%_IsSmi(M)&&%_IsSmi(aC)){
return %SmiLexicographicCompare(M,aC);
}
M=(%_ToString(M));
aC=(%_ToString(aC));
if(M==aC)return 0;
else return M<aC?-1:1;
};
}
function InsertionSort(r,n,aD){
for(var w=n+1;w<aD;w++){
var aE=r[w];
for(var ai=w-1;ai>=n;ai--){
var aF=r[ai];
var aG=aB(aF,aE);
if(aG>0){
r[ai+1]=aF;
}else{
break;
}
}
r[ai+1]=aE;
}
};
function GetThirdIndex(r,n,aD){
var aH=new g();
var aI=200+((aD-n)&15);
var ai=0;
n+=1;
aD-=1;
for(var w=n;w<aD;w+=aI){
aH[ai]=[w,r[w]];
ai++;
}
aH.sort(function(r,s){
return aB(r[1],s[1]);
});
var aJ=aH[aH.length>>1][0];
return aJ;
}
function QuickSort(r,n,aD){
var aJ=0;
while(true){
if(aD-n<=10){
InsertionSort(r,n,aD);
return;
}
if(aD-n>1000){
aJ=GetThirdIndex(r,n,aD);
}else{
aJ=n+((aD-n)>>1);
}
var aK=r[n];
var aL=r[aD-1];
var aM=r[aJ];
var aN=aB(aK,aL);
if(aN>0){
var aF=aK;
aK=aL;
aL=aF;
}
var aO=aB(aK,aM);
if(aO>=0){
var aF=aK;
aK=aM;
aM=aL;
aL=aF;
}else{
var aP=aB(aL,aM);
if(aP>0){
var aF=aL;
aL=aM;
aM=aF;
}
}
r[n]=aK;
r[aD-1]=aM;
var aQ=aL;
var aR=n+1;
var aS=aD-1;
r[aJ]=r[aR];
r[aR]=aQ;
partition:for(var w=aR+1;w<aS;w++){
var aE=r[w];
var aG=aB(aE,aQ);
if(aG<0){
r[w]=r[aR];
r[aR]=aE;
aR++;
}else if(aG>0){
do{
aS--;
if(aS==w)break partition;
var aT=r[aS];
aG=aB(aT,aQ);
}while(aG>0);
r[w]=r[aS];
r[aS]=aE;
if(aG<0){
aE=r[w];
r[w]=r[aR];
r[aR]=aE;
aR++;
}
}
}
if(aD-aS<aR-n){
QuickSort(r,aS,aD);
aD=aR;
}else{
QuickSort(r,n,aR);
n=aS;
}
}
};
function CopyFromPrototype(aU,p){
var aV=0;
for(var aW=%object_get_prototype_of(aU);aW;
aW=%object_get_prototype_of(aW)){
var t=(%_IsJSProxy(aW))?p:%GetArrayKeys(aW,p);
if((typeof(t)==='number')){
var aX=t;
for(var w=0;w<aX;w++){
if(!(%_Call(j,aU,w))&&(%_Call(j,aW,w))){
aU[w]=aW[w];
if(w>=aV){aV=w+1;}
}
}
}else{
for(var w=0;w<t.length;w++){
var X=t[w];
if(!(%_Call(j,aU,X))&&(%_Call(j,aW,X))){
aU[X]=aW[X];
if(X>=aV){aV=X+1;}
}
}
}
}
return aV;
};
function ShadowPrototypeElements(aU,n,aD){
for(var aW=%object_get_prototype_of(aU);aW;
aW=%object_get_prototype_of(aW)){
var t=(%_IsJSProxy(aW))?aD:%GetArrayKeys(aW,aD);
if((typeof(t)==='number')){
var aX=t;
for(var w=n;w<aX;w++){
if((%_Call(j,aW,w))){
aU[w]=(void 0);
}
}
}else{
for(var w=0;w<t.length;w++){
var X=t[w];
if(n<=X&&(%_Call(j,aW,X))){
aU[X]=(void 0);
}
}
}
}
};
function SafeRemoveArrayHoles(aU){
var aY=0;
var aZ=p-1;
var ba=0;
while(aY<aZ){
while(aY<aZ&&
!(aU[aY]===(void 0))){
aY++;
}
if(!(%_Call(j,aU,aY))){
ba++;
}
while(aY<aZ&&
(aU[aZ]===(void 0))){
if(!(%_Call(j,aU,aZ))){
ba++;
}
aZ--;
}
if(aY<aZ){
aU[aY]=aU[aZ];
aU[aZ]=(void 0);
}
}
if(!(aU[aY]===(void 0)))aY++;
var w;
for(w=aY;w<p-ba;w++){
aU[w]=(void 0);
}
for(w=p-ba;w<p;w++){
if(w in %object_get_prototype_of(aU)){
aU[w]=(void 0);
}else{
delete aU[w];
}
}
return aY;
};
if(p<2)return o;
var D=(%_IsArray(o));
var bb;
if(!D){
bb=CopyFromPrototype(o,p);
}
var bc=%RemoveArrayHoles(o,p);
if(bc==-1){
bc=SafeRemoveArrayHoles(o);
}
QuickSort(o,0,bc);
if(!D&&(bc+1<bb)){
ShadowPrototypeElements(o,bc,bb);
}
return o;
}
%DefineMethodsInternal(f.prototype,class{sort(aB){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.sort");
var o=(%_ToObject(this));
var p=(%_ToLength(o.length));
return InnerArraySort(o,p,aB);
}},-1);
%DefineMethodsInternal(f.prototype,class{lastIndexOf(aE,X){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.lastIndexOf");
var o=this;
var p=(%_ToLength(this.length));
if(p==0)return-1;
if(arguments.length<2){
X=p-1;
}else{
X=(((%_ToInteger(X)))+0);
if(X<0)X+=p;
if(X<0)return-1;
else if(X>=p)X=p-1;
}
var bd=0;
var aV=X;
if(UseSparseVariant(o,p,(%_IsArray(o)),X)){
%NormalizeElements(o);
var t=%GetArrayKeys(o,X+1);
if((typeof(t)==='number')){
aV=t;
}else{
if(t.length==0)return-1;
var be=GetSortedArrayKeys(o,t);
var w=be.length-1;
while(w>=0){
var C=be[w];
if(o[C]===aE)return C;
w--;
}
return-1;
}
}
if(!(aE===(void 0))){
for(var w=aV;w>=bd;w--){
if(o[w]===aE)return w;
}
return-1;
}
for(var w=aV;w>=bd;w--){
if((o[w]===(void 0))&&w in o){
return w;
}
}
return-1;
}},1);
%DefineMethodsInternal(f.prototype,class{copyWithin(target,as,at){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.copyWithin");
var o=(%_ToObject(this));
var p=(%_ToLength(o.length));
target=(%_ToInteger(target));
var aD;
if(target<0){
aD=h(p+target,0);
}else{
aD=i(target,p);
}
as=(%_ToInteger(as));
var n;
if(as<0){
n=h(p+as,0);
}else{
n=i(as,p);
}
at=(at===(void 0))?p:(%_ToInteger(at));
var bf;
if(at<0){
bf=h(p+at,0);
}else{
bf=i(at,p);
}
var bg=i(bf-n,p-aD);
var bh=1;
if(n<aD&&aD<(n+bg)){
bh=-1;
n=n+bg-1;
aD=aD+bg-1;
}
while(bg>0){
if(n in o){
o[aD]=o[n];
}else{
delete o[aD];
}
n=n+bh;
aD=aD+bh;
bg--;
}
return o;
}},2);
function InnerArrayFind(bi,bj,o,p){
if(!(typeof(bi)==='function')){
throw %make_type_error(16,bi);
}
for(var w=0;w<p;w++){
var aE=o[w];
if(%_Call(bi,bj,aE,w,o)){
return aE;
}
}
return;
}
%DefineMethodsInternal(f.prototype,class{find(bi,bj){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.find");
var o=(%_ToObject(this));
var p=(%_ToInteger(o.length));
return InnerArrayFind(bi,bj,o,p);
}},1);
function InnerArrayFindIndex(bi,bj,o,p){
if(!(typeof(bi)==='function')){
throw %make_type_error(16,bi);
}
for(var w=0;w<p;w++){
var aE=o[w];
if(%_Call(bi,bj,aE,w,o)){
return w;
}
}
return-1;
}
%DefineMethodsInternal(f.prototype,class{findIndex(bi,bj){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.findIndex");
var o=(%_ToObject(this));
var p=(%_ToInteger(o.length));
return InnerArrayFindIndex(bi,bj,o,p);
}},1);
%DefineMethodsInternal(f.prototype,class{fill(I,as,at){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Array.prototype.fill");
var o=(%_ToObject(this));
var p=(%_ToLength(o.length));
var w=(as===(void 0))?0:(%_ToInteger(as));
var at=(at===(void 0))?p:(%_ToInteger(at));
if(w<0){
w+=p;
if(w<0)w=0;
}else{
if(w>p)w=p;
}
if(at<0){
at+=p;
if(at<0)at=0;
}else{
if(at>p)at=p;
}
if((at-w)>0&&%object_is_frozen(o)){
throw %make_type_error(12);
}
for(;w<at;w++)
o[w]=I;
return o;
}},1);
%DefineMethodsInternal(f,class{'from'(arrayLike,mapfn,receiver){
var bk=(%_ToObject(arrayLike));
var bl=!(mapfn===(void 0));
if(bl){
if(!(typeof(mapfn)==='function')){
throw %make_type_error(16,mapfn);
}
}
var bm=e(bk,l);
var S;
var av;
var bn;
var bo;
if(!(bm===(void 0))){
av=%IsConstructor(this)?new this():[];
S=0;
for(bo of
{[l](){return d(bk,bm)}}){
if(bl){
bn=%_Call(mapfn,receiver,bo,S);
}else{
bn=bo;
}
%CreateDataProperty(av,S,bn);
S++;
}
av.length=S;
return av;
}else{
var P=(%_ToLength(bk.length));
av=%IsConstructor(this)?new this(P):new f(P);
for(S=0;S<P;++S){
bo=bk[S];
if(bl){
bn=%_Call(mapfn,receiver,bo,S);
}else{
bn=bo;
}
%CreateDataProperty(av,S,bn);
}
av.length=S;
return av;
}
}},1);
%DefineMethodsInternal(f,class{of(...args){
var p=args.length;
var q=this;
var o=%IsConstructor(q)?new q(p):[];
for(var w=0;w<p;w++){
%CreateDataProperty(o,w,args[w]);
}
o.length=p;
return o;
}},-1);
var bp={
__proto__:null,
copyWithin:true,
entries:true,
fill:true,
find:true,
findIndex:true,
includes:true,
keys:true,
};
%ToFastProperties(bp);
%AddNamedProperty(f.prototype,m,bp,
2|1);
var bq=f.prototype.indexOf;
var aa=f.prototype.join;
var br=f.prototype.pop;
var bs=f.prototype.push;
var bt=f.prototype.slice;
var bu=f.prototype.shift;
var bv=f.prototype.sort;
var bw=f.prototype.splice;
var bx=f.prototype.toString;
var by=f.prototype.unshift;
var bz=f.prototype.entries;
var bA=f.prototype.forEach;
var bB=f.prototype.keys;
var bC=f.prototype[l];
b.SetUpLockedPrototype(g,f(),[
"indexOf",bq,
"join",aa,
"pop",br,
"push",bs,
"shift",bu,
"sort",bv,
"splice",bw
]);
b.SetUpLockedPrototype(c.InternalPackedArray,f(),[
"push",bs,
"pop",br,
"shift",bu,
"unshift",by,
"splice",bw,
"slice",bt
]);
b.Export(function(aD){
aD.ArrayJoin=aa;
aD.ArrayPush=bs;
aD.ArrayToString=bx;
aD.ArrayValues=bC;
aD.InnerArrayFind=InnerArrayFind;
aD.InnerArrayFindIndex=InnerArrayFindIndex;
aD.InnerArrayJoin=InnerArrayJoin;
aD.InnerArraySort=InnerArraySort;
aD.InnerArrayToLocaleString=InnerArrayToLocaleString;
});
%InstallToContext([
"array_entries_iterator",bz,
"array_for_each_iterator",bA,
"array_keys_iterator",bB,
"array_values_iterator",bC,
"array_pop",ArrayPopFallback,
"array_push",ArrayPushFallback,
"array_shift",ArrayShiftFallback,
"array_splice",ArraySpliceFallback,
"array_slice",ArraySliceFallback,
"array_unshift",ArrayUnshiftFallback,
]);
});


(function(a,b){
"use strict";
%CheckIsBootstrapping();
var c=a.String;
var d=b.ImportNow("match_symbol");
var e=b.ImportNow("search_symbol");
function HtmlEscape(f){
return %RegExpInternalReplace(/"/g,(%_ToString(f)),"&quot;");
}
%DefineMethodsInternal(c.prototype,class{
match(pattern){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.match");
if(!(pattern==null)){
var g=pattern[d];
if(!(g===(void 0))){
return %_Call(g,pattern,this);
}
}
var h=(%_ToString(this));
var i=%RegExpCreate(pattern);
return i[d](h);
}
search(pattern){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.search");
if(!(pattern==null)){
var j=pattern[e];
if(!(j===(void 0))){
return %_Call(j,pattern,this);
}
}
var h=(%_ToString(this));
var i=%RegExpCreate(pattern);
return %_Call(i[e],i,h);
}
anchor(name){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.anchor");
return"<a name=\""+HtmlEscape(name)+"\">"+(%_ToString(this))+
"</a>";
}
big(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.big");
return"<big>"+(%_ToString(this))+"</big>";
}
blink(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.blink");
return"<blink>"+(%_ToString(this))+"</blink>";
}
bold(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.bold");
return"<b>"+(%_ToString(this))+"</b>";
}
fixed(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.fixed");
return"<tt>"+(%_ToString(this))+"</tt>";
}
fontcolor(color){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.fontcolor");
return"<font color=\""+HtmlEscape(color)+"\">"+(%_ToString(this))+
"</font>";
}
fontsize(size){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.fontsize");
return"<font size=\""+HtmlEscape(size)+"\">"+(%_ToString(this))+
"</font>";
}
italics(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.italics");
return"<i>"+(%_ToString(this))+"</i>";
}
link(s){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.link");
return"<a href=\""+HtmlEscape(s)+"\">"+(%_ToString(this))+"</a>";
}
small(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.small");
return"<small>"+(%_ToString(this))+"</small>";
}
strike(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.strike");
return"<strike>"+(%_ToString(this))+"</strike>";
}
sub(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.sub");
return"<sub>"+(%_ToString(this))+"</sub>";
}
sup(){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.sup");
return"<sup>"+(%_ToString(this))+"</sup>";
}
repeat(count){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.repeat");
var k=(%_ToString(this));
var l=(%_ToInteger(count));
if(l<0||l===(1/0))throw %make_range_error(163);
if(k.length===0)return"";
if(l>%_StringMaxLength())%ThrowInvalidStringLength();
var m="";
while(true){
if(l&1)m+=k;
l>>=1;
if(l===0)return m;
k+=k;
}
}
},-1);
function StringPad(n,o,p){
o=(%_ToLength(o));
var q=n.length;
if(o<=q)return"";
if((p===(void 0))){
p=" ";
}else{
p=(%_ToString(p));
if(p===""){
return"";
}
}
var r=o-q;
var s=(r/p.length)|0;
var t=(r-p.length*s)|0;
var u="";
while(true){
if(s&1)u+=p;
s>>=1;
if(s===0)break;
p+=p;
}
if(t){
u+=%_SubString(p,0,t);
}
return u;
}
%DefineMethodsInternal(c.prototype,class{
padStart(o,p){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.padStart");
var n=(%_ToString(this));
return StringPad(n,o,p)+n;
}
padEnd(o,p){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.padEnd");
var n=(%_ToString(this));
return n+StringPad(n,o,p);
}
},1);
%DefineMethodsInternal(c,class{
raw(callSite){
var v=arguments.length;
var w=(%_ToObject(callSite));
var x=(%_ToObject(w.raw));
var y=(%_ToLength(x.length));
if(y<=0)return"";
var z=(%_ToString(x[0]));
for(var A=1;A<y;++A){
if(A<v){
z+=(%_ToString(arguments[A]));
}
z+=(%_ToString(x[A]));
}
return z;
}},-1);
})


(function(a,b){
"use strict";
%CheckIsBootstrapping();
var c=b.ImportNow("ArrayToString");
var d;
var e;
var f=a.Array;
var g=a.ArrayBuffer;
var h=g.prototype;
var i=a.Object;
var j;
var k;
var l;
var m;
var n;
var o=b.InternalArray;
var p;
var q;
var r=b.ImportNow("iterator_symbol");
var s=b.ImportNow("species_symbol");
var t=b.ImportNow("to_string_tag_symbol");
var u=a.Uint8Array;

var v=a.Int8Array;

var w=a.Uint16Array;

var x=a.Int16Array;

var y=a.Uint32Array;

var z=a.Int32Array;

var A=a.Float32Array;

var B=a.Float64Array;

var C=a.Uint8ClampedArray;


var D=%object_get_prototype_of(u);
b.Import(function(E){
d=E.GetIterator;
e=E.GetMethod;
j=E.InnerArrayFind;
k=E.InnerArrayFindIndex;
l=E.InnerArrayJoin;
m=E.InnerArraySort;
n=E.InnerArrayToLocaleString;
p=E.MaxSimple;
q=E.MinSimple;
});
function SpeciesConstructor(F,G){
var H=F.constructor;
if((H===(void 0))){
return G;
}
if(!(%_IsJSReceiver(H))){
throw %make_type_error(31);
}
var I=H[s];
if((I==null)){
return G;
}
if(%IsConstructor(I)){
return I;
}
throw %make_type_error(249);
}
function ValidateTypedArray(J,K){
if(!(%_IsTypedArray(J)))throw %make_type_error(79);
if(%_ArrayBufferViewWasNeutered(J))
throw %make_type_error(40,K);
}
function TypedArrayDefaultConstructor(L){
switch(%_ClassOf(L)){
case"Uint8Array":
return u;

case"Int8Array":
return v;

case"Uint16Array":
return w;

case"Int16Array":
return x;

case"Uint32Array":
return y;

case"Int32Array":
return z;

case"Float32Array":
return A;

case"Float64Array":
return B;

case"Uint8ClampedArray":
return C;


}
throw %make_type_error(49,
"TypedArrayDefaultConstructor",this);
}
function TypedArrayCreate(H,M,N,O){
if((N===(void 0))){
var P=new H(M);
}else{
var P=new H(M,N,O);
}
ValidateTypedArray(P,"TypedArrayCreate");
if((typeof(M)==='number')&&%_TypedArrayGetLength(P)<M){
throw %make_type_error(265);
}
return P;
}
function TypedArraySpeciesCreate(Q,M,N,O){
var G=TypedArrayDefaultConstructor(Q);
var H=SpeciesConstructor(Q,G);
return TypedArrayCreate(H,M,N,O);
}
function Uint8ArrayConstructByIterable(R,S,T){
if(%IterableToListCanBeElided(S)){
%typed_array_construct_by_array_like(
R,S,S.length,1);
}else{
var U=new o();
var V=%_Call(T,S);
var W={
__proto__:null
};
W[r]=function(){return V;}
for(var X of W){
U.push(X);
}
%typed_array_construct_by_array_like(R,U,U.length,1);
}
}
function Uint8ArrayConstructByTypedArray(R,L){
var Y=%TypedArrayGetBuffer(L);
var Z=%_TypedArrayGetLength(L);
var aa=%_ArrayBufferViewGetByteLength(L);
var ab=Z*1;
%typed_array_construct_by_array_like(R,L,Z,1);
var ac=(%_ClassOf(Y)==='SharedArrayBuffer')
?g
:SpeciesConstructor(Y,g);
var ad=ac.prototype;
if((%_IsJSReceiver(ad))&&ad!==h){
%InternalSetPrototype(%TypedArrayGetBuffer(R),ad);
}
}
function Uint8ArrayConstructor(N,O,ae){
if(!(new.target===(void 0))){
if((%_ClassOf(N)==='ArrayBuffer')||(%_ClassOf(N)==='SharedArrayBuffer')){
%typed_array_construct_by_array_buffer(
this,N,O,ae,1);
}else if((%_IsTypedArray(N))){
Uint8ArrayConstructByTypedArray(this,N);
}else if((%_IsJSReceiver(N))){
var T=N[r];
if((T===(void 0))){
%typed_array_construct_by_array_like(
this,N,N.length,1);
}else{
Uint8ArrayConstructByIterable(this,N,T);
}
}else{
%typed_array_construct_by_length(this,N,1);
}
}else{
throw %make_type_error(30,"Uint8Array")
}
}
function Uint8ArraySubArray(af,ag){
var ah=(%_ToInteger(af));
if(!(ag===(void 0))){
var ai=(%_ToInteger(ag));
var aj=%_TypedArrayGetLength(this);
}else{
var aj=%_TypedArrayGetLength(this);
var ai=aj;
}
if(ah<0){
ah=p(0,aj+ah);
}else{
ah=q(ah,aj);
}
if(ai<0){
ai=p(0,aj+ai);
}else{
ai=q(ai,aj);
}
if(ai<ah){
ai=ah;
}
var ak=ai-ah;
var al=
%_ArrayBufferViewGetByteOffset(this)+ah*1;
return TypedArraySpeciesCreate(this,%TypedArrayGetBuffer(this),
al,ak);
}

function Int8ArrayConstructByIterable(R,S,T){
if(%IterableToListCanBeElided(S)){
%typed_array_construct_by_array_like(
R,S,S.length,1);
}else{
var U=new o();
var V=%_Call(T,S);
var W={
__proto__:null
};
W[r]=function(){return V;}
for(var X of W){
U.push(X);
}
%typed_array_construct_by_array_like(R,U,U.length,1);
}
}
function Int8ArrayConstructByTypedArray(R,L){
var Y=%TypedArrayGetBuffer(L);
var Z=%_TypedArrayGetLength(L);
var aa=%_ArrayBufferViewGetByteLength(L);
var ab=Z*1;
%typed_array_construct_by_array_like(R,L,Z,1);
var ac=(%_ClassOf(Y)==='SharedArrayBuffer')
?g
:SpeciesConstructor(Y,g);
var ad=ac.prototype;
if((%_IsJSReceiver(ad))&&ad!==h){
%InternalSetPrototype(%TypedArrayGetBuffer(R),ad);
}
}
function Int8ArrayConstructor(N,O,ae){
if(!(new.target===(void 0))){
if((%_ClassOf(N)==='ArrayBuffer')||(%_ClassOf(N)==='SharedArrayBuffer')){
%typed_array_construct_by_array_buffer(
this,N,O,ae,1);
}else if((%_IsTypedArray(N))){
Int8ArrayConstructByTypedArray(this,N);
}else if((%_IsJSReceiver(N))){
var T=N[r];
if((T===(void 0))){
%typed_array_construct_by_array_like(
this,N,N.length,1);
}else{
Int8ArrayConstructByIterable(this,N,T);
}
}else{
%typed_array_construct_by_length(this,N,1);
}
}else{
throw %make_type_error(30,"Int8Array")
}
}
function Int8ArraySubArray(af,ag){
var ah=(%_ToInteger(af));
if(!(ag===(void 0))){
var ai=(%_ToInteger(ag));
var aj=%_TypedArrayGetLength(this);
}else{
var aj=%_TypedArrayGetLength(this);
var ai=aj;
}
if(ah<0){
ah=p(0,aj+ah);
}else{
ah=q(ah,aj);
}
if(ai<0){
ai=p(0,aj+ai);
}else{
ai=q(ai,aj);
}
if(ai<ah){
ai=ah;
}
var ak=ai-ah;
var al=
%_ArrayBufferViewGetByteOffset(this)+ah*1;
return TypedArraySpeciesCreate(this,%TypedArrayGetBuffer(this),
al,ak);
}

function Uint16ArrayConstructByIterable(R,S,T){
if(%IterableToListCanBeElided(S)){
%typed_array_construct_by_array_like(
R,S,S.length,2);
}else{
var U=new o();
var V=%_Call(T,S);
var W={
__proto__:null
};
W[r]=function(){return V;}
for(var X of W){
U.push(X);
}
%typed_array_construct_by_array_like(R,U,U.length,2);
}
}
function Uint16ArrayConstructByTypedArray(R,L){
var Y=%TypedArrayGetBuffer(L);
var Z=%_TypedArrayGetLength(L);
var aa=%_ArrayBufferViewGetByteLength(L);
var ab=Z*2;
%typed_array_construct_by_array_like(R,L,Z,2);
var ac=(%_ClassOf(Y)==='SharedArrayBuffer')
?g
:SpeciesConstructor(Y,g);
var ad=ac.prototype;
if((%_IsJSReceiver(ad))&&ad!==h){
%InternalSetPrototype(%TypedArrayGetBuffer(R),ad);
}
}
function Uint16ArrayConstructor(N,O,ae){
if(!(new.target===(void 0))){
if((%_ClassOf(N)==='ArrayBuffer')||(%_ClassOf(N)==='SharedArrayBuffer')){
%typed_array_construct_by_array_buffer(
this,N,O,ae,2);
}else if((%_IsTypedArray(N))){
Uint16ArrayConstructByTypedArray(this,N);
}else if((%_IsJSReceiver(N))){
var T=N[r];
if((T===(void 0))){
%typed_array_construct_by_array_like(
this,N,N.length,2);
}else{
Uint16ArrayConstructByIterable(this,N,T);
}
}else{
%typed_array_construct_by_length(this,N,2);
}
}else{
throw %make_type_error(30,"Uint16Array")
}
}
function Uint16ArraySubArray(af,ag){
var ah=(%_ToInteger(af));
if(!(ag===(void 0))){
var ai=(%_ToInteger(ag));
var aj=%_TypedArrayGetLength(this);
}else{
var aj=%_TypedArrayGetLength(this);
var ai=aj;
}
if(ah<0){
ah=p(0,aj+ah);
}else{
ah=q(ah,aj);
}
if(ai<0){
ai=p(0,aj+ai);
}else{
ai=q(ai,aj);
}
if(ai<ah){
ai=ah;
}
var ak=ai-ah;
var al=
%_ArrayBufferViewGetByteOffset(this)+ah*2;
return TypedArraySpeciesCreate(this,%TypedArrayGetBuffer(this),
al,ak);
}

function Int16ArrayConstructByIterable(R,S,T){
if(%IterableToListCanBeElided(S)){
%typed_array_construct_by_array_like(
R,S,S.length,2);
}else{
var U=new o();
var V=%_Call(T,S);
var W={
__proto__:null
};
W[r]=function(){return V;}
for(var X of W){
U.push(X);
}
%typed_array_construct_by_array_like(R,U,U.length,2);
}
}
function Int16ArrayConstructByTypedArray(R,L){
var Y=%TypedArrayGetBuffer(L);
var Z=%_TypedArrayGetLength(L);
var aa=%_ArrayBufferViewGetByteLength(L);
var ab=Z*2;
%typed_array_construct_by_array_like(R,L,Z,2);
var ac=(%_ClassOf(Y)==='SharedArrayBuffer')
?g
:SpeciesConstructor(Y,g);
var ad=ac.prototype;
if((%_IsJSReceiver(ad))&&ad!==h){
%InternalSetPrototype(%TypedArrayGetBuffer(R),ad);
}
}
function Int16ArrayConstructor(N,O,ae){
if(!(new.target===(void 0))){
if((%_ClassOf(N)==='ArrayBuffer')||(%_ClassOf(N)==='SharedArrayBuffer')){
%typed_array_construct_by_array_buffer(
this,N,O,ae,2);
}else if((%_IsTypedArray(N))){
Int16ArrayConstructByTypedArray(this,N);
}else if((%_IsJSReceiver(N))){
var T=N[r];
if((T===(void 0))){
%typed_array_construct_by_array_like(
this,N,N.length,2);
}else{
Int16ArrayConstructByIterable(this,N,T);
}
}else{
%typed_array_construct_by_length(this,N,2);
}
}else{
throw %make_type_error(30,"Int16Array")
}
}
function Int16ArraySubArray(af,ag){
var ah=(%_ToInteger(af));
if(!(ag===(void 0))){
var ai=(%_ToInteger(ag));
var aj=%_TypedArrayGetLength(this);
}else{
var aj=%_TypedArrayGetLength(this);
var ai=aj;
}
if(ah<0){
ah=p(0,aj+ah);
}else{
ah=q(ah,aj);
}
if(ai<0){
ai=p(0,aj+ai);
}else{
ai=q(ai,aj);
}
if(ai<ah){
ai=ah;
}
var ak=ai-ah;
var al=
%_ArrayBufferViewGetByteOffset(this)+ah*2;
return TypedArraySpeciesCreate(this,%TypedArrayGetBuffer(this),
al,ak);
}

function Uint32ArrayConstructByIterable(R,S,T){
if(%IterableToListCanBeElided(S)){
%typed_array_construct_by_array_like(
R,S,S.length,4);
}else{
var U=new o();
var V=%_Call(T,S);
var W={
__proto__:null
};
W[r]=function(){return V;}
for(var X of W){
U.push(X);
}
%typed_array_construct_by_array_like(R,U,U.length,4);
}
}
function Uint32ArrayConstructByTypedArray(R,L){
var Y=%TypedArrayGetBuffer(L);
var Z=%_TypedArrayGetLength(L);
var aa=%_ArrayBufferViewGetByteLength(L);
var ab=Z*4;
%typed_array_construct_by_array_like(R,L,Z,4);
var ac=(%_ClassOf(Y)==='SharedArrayBuffer')
?g
:SpeciesConstructor(Y,g);
var ad=ac.prototype;
if((%_IsJSReceiver(ad))&&ad!==h){
%InternalSetPrototype(%TypedArrayGetBuffer(R),ad);
}
}
function Uint32ArrayConstructor(N,O,ae){
if(!(new.target===(void 0))){
if((%_ClassOf(N)==='ArrayBuffer')||(%_ClassOf(N)==='SharedArrayBuffer')){
%typed_array_construct_by_array_buffer(
this,N,O,ae,4);
}else if((%_IsTypedArray(N))){
Uint32ArrayConstructByTypedArray(this,N);
}else if((%_IsJSReceiver(N))){
var T=N[r];
if((T===(void 0))){
%typed_array_construct_by_array_like(
this,N,N.length,4);
}else{
Uint32ArrayConstructByIterable(this,N,T);
}
}else{
%typed_array_construct_by_length(this,N,4);
}
}else{
throw %make_type_error(30,"Uint32Array")
}
}
function Uint32ArraySubArray(af,ag){
var ah=(%_ToInteger(af));
if(!(ag===(void 0))){
var ai=(%_ToInteger(ag));
var aj=%_TypedArrayGetLength(this);
}else{
var aj=%_TypedArrayGetLength(this);
var ai=aj;
}
if(ah<0){
ah=p(0,aj+ah);
}else{
ah=q(ah,aj);
}
if(ai<0){
ai=p(0,aj+ai);
}else{
ai=q(ai,aj);
}
if(ai<ah){
ai=ah;
}
var ak=ai-ah;
var al=
%_ArrayBufferViewGetByteOffset(this)+ah*4;
return TypedArraySpeciesCreate(this,%TypedArrayGetBuffer(this),
al,ak);
}

function Int32ArrayConstructByIterable(R,S,T){
if(%IterableToListCanBeElided(S)){
%typed_array_construct_by_array_like(
R,S,S.length,4);
}else{
var U=new o();
var V=%_Call(T,S);
var W={
__proto__:null
};
W[r]=function(){return V;}
for(var X of W){
U.push(X);
}
%typed_array_construct_by_array_like(R,U,U.length,4);
}
}
function Int32ArrayConstructByTypedArray(R,L){
var Y=%TypedArrayGetBuffer(L);
var Z=%_TypedArrayGetLength(L);
var aa=%_ArrayBufferViewGetByteLength(L);
var ab=Z*4;
%typed_array_construct_by_array_like(R,L,Z,4);
var ac=(%_ClassOf(Y)==='SharedArrayBuffer')
?g
:SpeciesConstructor(Y,g);
var ad=ac.prototype;
if((%_IsJSReceiver(ad))&&ad!==h){
%InternalSetPrototype(%TypedArrayGetBuffer(R),ad);
}
}
function Int32ArrayConstructor(N,O,ae){
if(!(new.target===(void 0))){
if((%_ClassOf(N)==='ArrayBuffer')||(%_ClassOf(N)==='SharedArrayBuffer')){
%typed_array_construct_by_array_buffer(
this,N,O,ae,4);
}else if((%_IsTypedArray(N))){
Int32ArrayConstructByTypedArray(this,N);
}else if((%_IsJSReceiver(N))){
var T=N[r];
if((T===(void 0))){
%typed_array_construct_by_array_like(
this,N,N.length,4);
}else{
Int32ArrayConstructByIterable(this,N,T);
}
}else{
%typed_array_construct_by_length(this,N,4);
}
}else{
throw %make_type_error(30,"Int32Array")
}
}
function Int32ArraySubArray(af,ag){
var ah=(%_ToInteger(af));
if(!(ag===(void 0))){
var ai=(%_ToInteger(ag));
var aj=%_TypedArrayGetLength(this);
}else{
var aj=%_TypedArrayGetLength(this);
var ai=aj;
}
if(ah<0){
ah=p(0,aj+ah);
}else{
ah=q(ah,aj);
}
if(ai<0){
ai=p(0,aj+ai);
}else{
ai=q(ai,aj);
}
if(ai<ah){
ai=ah;
}
var ak=ai-ah;
var al=
%_ArrayBufferViewGetByteOffset(this)+ah*4;
return TypedArraySpeciesCreate(this,%TypedArrayGetBuffer(this),
al,ak);
}

function Float32ArrayConstructByIterable(R,S,T){
if(%IterableToListCanBeElided(S)){
%typed_array_construct_by_array_like(
R,S,S.length,4);
}else{
var U=new o();
var V=%_Call(T,S);
var W={
__proto__:null
};
W[r]=function(){return V;}
for(var X of W){
U.push(X);
}
%typed_array_construct_by_array_like(R,U,U.length,4);
}
}
function Float32ArrayConstructByTypedArray(R,L){
var Y=%TypedArrayGetBuffer(L);
var Z=%_TypedArrayGetLength(L);
var aa=%_ArrayBufferViewGetByteLength(L);
var ab=Z*4;
%typed_array_construct_by_array_like(R,L,Z,4);
var ac=(%_ClassOf(Y)==='SharedArrayBuffer')
?g
:SpeciesConstructor(Y,g);
var ad=ac.prototype;
if((%_IsJSReceiver(ad))&&ad!==h){
%InternalSetPrototype(%TypedArrayGetBuffer(R),ad);
}
}
function Float32ArrayConstructor(N,O,ae){
if(!(new.target===(void 0))){
if((%_ClassOf(N)==='ArrayBuffer')||(%_ClassOf(N)==='SharedArrayBuffer')){
%typed_array_construct_by_array_buffer(
this,N,O,ae,4);
}else if((%_IsTypedArray(N))){
Float32ArrayConstructByTypedArray(this,N);
}else if((%_IsJSReceiver(N))){
var T=N[r];
if((T===(void 0))){
%typed_array_construct_by_array_like(
this,N,N.length,4);
}else{
Float32ArrayConstructByIterable(this,N,T);
}
}else{
%typed_array_construct_by_length(this,N,4);
}
}else{
throw %make_type_error(30,"Float32Array")
}
}
function Float32ArraySubArray(af,ag){
var ah=(%_ToInteger(af));
if(!(ag===(void 0))){
var ai=(%_ToInteger(ag));
var aj=%_TypedArrayGetLength(this);
}else{
var aj=%_TypedArrayGetLength(this);
var ai=aj;
}
if(ah<0){
ah=p(0,aj+ah);
}else{
ah=q(ah,aj);
}
if(ai<0){
ai=p(0,aj+ai);
}else{
ai=q(ai,aj);
}
if(ai<ah){
ai=ah;
}
var ak=ai-ah;
var al=
%_ArrayBufferViewGetByteOffset(this)+ah*4;
return TypedArraySpeciesCreate(this,%TypedArrayGetBuffer(this),
al,ak);
}

function Float64ArrayConstructByIterable(R,S,T){
if(%IterableToListCanBeElided(S)){
%typed_array_construct_by_array_like(
R,S,S.length,8);
}else{
var U=new o();
var V=%_Call(T,S);
var W={
__proto__:null
};
W[r]=function(){return V;}
for(var X of W){
U.push(X);
}
%typed_array_construct_by_array_like(R,U,U.length,8);
}
}
function Float64ArrayConstructByTypedArray(R,L){
var Y=%TypedArrayGetBuffer(L);
var Z=%_TypedArrayGetLength(L);
var aa=%_ArrayBufferViewGetByteLength(L);
var ab=Z*8;
%typed_array_construct_by_array_like(R,L,Z,8);
var ac=(%_ClassOf(Y)==='SharedArrayBuffer')
?g
:SpeciesConstructor(Y,g);
var ad=ac.prototype;
if((%_IsJSReceiver(ad))&&ad!==h){
%InternalSetPrototype(%TypedArrayGetBuffer(R),ad);
}
}
function Float64ArrayConstructor(N,O,ae){
if(!(new.target===(void 0))){
if((%_ClassOf(N)==='ArrayBuffer')||(%_ClassOf(N)==='SharedArrayBuffer')){
%typed_array_construct_by_array_buffer(
this,N,O,ae,8);
}else if((%_IsTypedArray(N))){
Float64ArrayConstructByTypedArray(this,N);
}else if((%_IsJSReceiver(N))){
var T=N[r];
if((T===(void 0))){
%typed_array_construct_by_array_like(
this,N,N.length,8);
}else{
Float64ArrayConstructByIterable(this,N,T);
}
}else{
%typed_array_construct_by_length(this,N,8);
}
}else{
throw %make_type_error(30,"Float64Array")
}
}
function Float64ArraySubArray(af,ag){
var ah=(%_ToInteger(af));
if(!(ag===(void 0))){
var ai=(%_ToInteger(ag));
var aj=%_TypedArrayGetLength(this);
}else{
var aj=%_TypedArrayGetLength(this);
var ai=aj;
}
if(ah<0){
ah=p(0,aj+ah);
}else{
ah=q(ah,aj);
}
if(ai<0){
ai=p(0,aj+ai);
}else{
ai=q(ai,aj);
}
if(ai<ah){
ai=ah;
}
var ak=ai-ah;
var al=
%_ArrayBufferViewGetByteOffset(this)+ah*8;
return TypedArraySpeciesCreate(this,%TypedArrayGetBuffer(this),
al,ak);
}

function Uint8ClampedArrayConstructByIterable(R,S,T){
if(%IterableToListCanBeElided(S)){
%typed_array_construct_by_array_like(
R,S,S.length,1);
}else{
var U=new o();
var V=%_Call(T,S);
var W={
__proto__:null
};
W[r]=function(){return V;}
for(var X of W){
U.push(X);
}
%typed_array_construct_by_array_like(R,U,U.length,1);
}
}
function Uint8ClampedArrayConstructByTypedArray(R,L){
var Y=%TypedArrayGetBuffer(L);
var Z=%_TypedArrayGetLength(L);
var aa=%_ArrayBufferViewGetByteLength(L);
var ab=Z*1;
%typed_array_construct_by_array_like(R,L,Z,1);
var ac=(%_ClassOf(Y)==='SharedArrayBuffer')
?g
:SpeciesConstructor(Y,g);
var ad=ac.prototype;
if((%_IsJSReceiver(ad))&&ad!==h){
%InternalSetPrototype(%TypedArrayGetBuffer(R),ad);
}
}
function Uint8ClampedArrayConstructor(N,O,ae){
if(!(new.target===(void 0))){
if((%_ClassOf(N)==='ArrayBuffer')||(%_ClassOf(N)==='SharedArrayBuffer')){
%typed_array_construct_by_array_buffer(
this,N,O,ae,1);
}else if((%_IsTypedArray(N))){
Uint8ClampedArrayConstructByTypedArray(this,N);
}else if((%_IsJSReceiver(N))){
var T=N[r];
if((T===(void 0))){
%typed_array_construct_by_array_like(
this,N,N.length,1);
}else{
Uint8ClampedArrayConstructByIterable(this,N,T);
}
}else{
%typed_array_construct_by_length(this,N,1);
}
}else{
throw %make_type_error(30,"Uint8ClampedArray")
}
}
function Uint8ClampedArraySubArray(af,ag){
var ah=(%_ToInteger(af));
if(!(ag===(void 0))){
var ai=(%_ToInteger(ag));
var aj=%_TypedArrayGetLength(this);
}else{
var aj=%_TypedArrayGetLength(this);
var ai=aj;
}
if(ah<0){
ah=p(0,aj+ah);
}else{
ah=q(ah,aj);
}
if(ai<0){
ai=p(0,aj+ai);
}else{
ai=q(ai,aj);
}
if(ai<ah){
ai=ah;
}
var ak=ai-ah;
var al=
%_ArrayBufferViewGetByteOffset(this)+ah*1;
return TypedArraySpeciesCreate(this,%TypedArrayGetBuffer(this),
al,ak);
}


%DefineMethodsInternal(D.prototype,class{subarray(af,ag){
switch(%_ClassOf(this)){
case"Uint8Array":
return %_Call(Uint8ArraySubArray,this,af,ag);

case"Int8Array":
return %_Call(Int8ArraySubArray,this,af,ag);

case"Uint16Array":
return %_Call(Uint16ArraySubArray,this,af,ag);

case"Int16Array":
return %_Call(Int16ArraySubArray,this,af,ag);

case"Uint32Array":
return %_Call(Uint32ArraySubArray,this,af,ag);

case"Int32Array":
return %_Call(Int32ArraySubArray,this,af,ag);

case"Float32Array":
return %_Call(Float32ArraySubArray,this,af,ag);

case"Float64Array":
return %_Call(Float64ArraySubArray,this,af,ag);

case"Uint8ClampedArray":
return %_Call(Uint8ClampedArraySubArray,this,af,ag);


}
throw %make_type_error(49,
"get %TypedArray%.prototype.subarray",this);
}},-1);
%SetForceInlineFlag(D.prototype.subarray);
%DefineMethodsInternal(D.prototype,class{set(R,offset){
var am=(offset===(void 0))?0:(%_ToInteger(offset));
if(am<0)throw %make_range_error(185);
if(am>%_MaxSmi()){
throw %make_range_error(186);
}
switch(%TypedArraySetFastCases(this,R,am)){
case 0:
return;
case 1:
%_TypedArraySetFromOverlapping(this,R,am);
return;
case 2:
if(am===0){
%TypedArrayCopyElements(this,R,%_TypedArrayGetLength(R));
}else{
%_TypedArraySetFromArrayLike(
this,R,%_TypedArrayGetLength(R),am);
}
return;
case 3:
var an=R.length;
if((an===(void 0))){
if((typeof(R)==='number')){
throw %make_type_error(51);
}
return;
}
an=(%_ToLength(an));
if(am+an>%_TypedArrayGetLength(this)){
throw %make_range_error(186);
}
%_TypedArraySetFromArrayLike(this,R,an,am);
return;
}
}},1);
%DefineMethodsInternal(D.prototype,class{get[t](){
if(!(%_IsTypedArray(this)))return;
var ao=%_ClassOf(this);
if((ao===(void 0)))return;
return ao;
}},-1);
function InnerTypedArrayFilter(ap,aq,J,Z,ar){
var as=0;
for(var at=0;at<Z;at++){
if(at in J){
var au=J[at];
if(%_Call(ap,aq,au,at,J)){
%CreateDataProperty(ar,as,au);
as++;
}
}
}
return ar;
}
%DefineMethodsInternal(D.prototype,class{filter(ap,thisArg){
ValidateTypedArray(this,"%TypeArray%.prototype.filter");
var Z=%_TypedArrayGetLength(this);
if(!(typeof(ap)==='function'))throw %make_type_error(16,ap);
var ar=new o();
InnerTypedArrayFilter(ap,thisArg,this,Z,ar);
var av=ar.length;
var aw=TypedArraySpeciesCreate(this,av);
for(var at=0;at<av;at++){
aw[at]=ar[at];
}
return aw;
}},1);
%DefineMethodsInternal(D.prototype,class{find(predicate,thisArg){
ValidateTypedArray(this,"%TypedArray%.prototype.find");
var Z=%_TypedArrayGetLength(this);
return j(predicate,thisArg,this,Z);
}},1);
%DefineMethodsInternal(D.prototype,class{findIndex(predicate,thisArg){
ValidateTypedArray(this,"%TypedArray%.prototype.findIndex");
var Z=%_TypedArrayGetLength(this);
return k(predicate,thisArg,this,Z);
}},1);
%DefineMethodsInternal(D.prototype,class{sort(comparefn){
ValidateTypedArray(this,"%TypedArray%.prototype.sort");
var Z=%_TypedArrayGetLength(this);
if((comparefn===(void 0))){
return %TypedArraySortFast(this);
}
return m(this,Z,comparefn);
}},-1);
%DefineMethodsInternal(D.prototype,class{toLocaleString(){
ValidateTypedArray(this,"%TypedArray%.prototype.toLocaleString");
var Z=%_TypedArrayGetLength(this);
return n(this,Z);
}},-1);
%DefineMethodsInternal(D.prototype,class{join(separator){
ValidateTypedArray(this,"%TypedArray%.prototype.join");
var Z=%_TypedArrayGetLength(this);
return l(separator,this,Z);
}},-1);
%DefineMethodsInternal(D,class{of(){
var Z=arguments.length;
var J=TypedArrayCreate(this,Z);
for(var at=0;at<Z;at++){
J[at]=arguments[at];
}
return J;
}},-1);
function IterableToArrayLike(ax){
var S=e(ax,r);
if(!(S===(void 0))){
var ay=new o();
var at=0;
for(var X of
{[r](){return d(ax,S)}}){
ay[at]=X;
at++;
}
var J=[];
%MoveArrayContents(ay,J);
return J;
}
return(%_ToObject(ax));
}
%DefineMethodsInternal(D,class{'from'(source,mapfn,thisArg){
if(!%IsConstructor(this))throw %make_type_error(71,this);
var az;
if(!(mapfn===(void 0))){
if(!(typeof(mapfn)==='function'))throw %make_type_error(16,this);
az=true;
}else{
az=false;
}
var aA=IterableToArrayLike(source);
var Z=(%_ToLength(aA.length));
var aB=TypedArrayCreate(this,Z);
var X,aC;
for(var at=0;at<Z;at++){
X=aA[at];
if(az){
aC=%_Call(mapfn,thisArg,X,at);
}else{
aC=X;
}
aB[at]=aC;
}
return aB;
}},1);
function TypedArrayConstructor(){
throw %make_type_error(27,"TypedArray");
}
%SetCode(D,TypedArrayConstructor);
%AddNamedProperty(D.prototype,"toString",c,
2);
%SetCode(u,Uint8ArrayConstructor);
%FunctionSetPrototype(u,new i());
%InternalSetPrototype(u,D);
%InternalSetPrototype(u.prototype,D.prototype);
%AddNamedProperty(u,"BYTES_PER_ELEMENT",1,
1|2|4);
%AddNamedProperty(u.prototype,
"constructor",a.Uint8Array,2);
%AddNamedProperty(u.prototype,
"BYTES_PER_ELEMENT",1,
1|2|4);

%SetCode(v,Int8ArrayConstructor);
%FunctionSetPrototype(v,new i());
%InternalSetPrototype(v,D);
%InternalSetPrototype(v.prototype,D.prototype);
%AddNamedProperty(v,"BYTES_PER_ELEMENT",1,
1|2|4);
%AddNamedProperty(v.prototype,
"constructor",a.Int8Array,2);
%AddNamedProperty(v.prototype,
"BYTES_PER_ELEMENT",1,
1|2|4);

%SetCode(w,Uint16ArrayConstructor);
%FunctionSetPrototype(w,new i());
%InternalSetPrototype(w,D);
%InternalSetPrototype(w.prototype,D.prototype);
%AddNamedProperty(w,"BYTES_PER_ELEMENT",2,
1|2|4);
%AddNamedProperty(w.prototype,
"constructor",a.Uint16Array,2);
%AddNamedProperty(w.prototype,
"BYTES_PER_ELEMENT",2,
1|2|4);

%SetCode(x,Int16ArrayConstructor);
%FunctionSetPrototype(x,new i());
%InternalSetPrototype(x,D);
%InternalSetPrototype(x.prototype,D.prototype);
%AddNamedProperty(x,"BYTES_PER_ELEMENT",2,
1|2|4);
%AddNamedProperty(x.prototype,
"constructor",a.Int16Array,2);
%AddNamedProperty(x.prototype,
"BYTES_PER_ELEMENT",2,
1|2|4);

%SetCode(y,Uint32ArrayConstructor);
%FunctionSetPrototype(y,new i());
%InternalSetPrototype(y,D);
%InternalSetPrototype(y.prototype,D.prototype);
%AddNamedProperty(y,"BYTES_PER_ELEMENT",4,
1|2|4);
%AddNamedProperty(y.prototype,
"constructor",a.Uint32Array,2);
%AddNamedProperty(y.prototype,
"BYTES_PER_ELEMENT",4,
1|2|4);

%SetCode(z,Int32ArrayConstructor);
%FunctionSetPrototype(z,new i());
%InternalSetPrototype(z,D);
%InternalSetPrototype(z.prototype,D.prototype);
%AddNamedProperty(z,"BYTES_PER_ELEMENT",4,
1|2|4);
%AddNamedProperty(z.prototype,
"constructor",a.Int32Array,2);
%AddNamedProperty(z.prototype,
"BYTES_PER_ELEMENT",4,
1|2|4);

%SetCode(A,Float32ArrayConstructor);
%FunctionSetPrototype(A,new i());
%InternalSetPrototype(A,D);
%InternalSetPrototype(A.prototype,D.prototype);
%AddNamedProperty(A,"BYTES_PER_ELEMENT",4,
1|2|4);
%AddNamedProperty(A.prototype,
"constructor",a.Float32Array,2);
%AddNamedProperty(A.prototype,
"BYTES_PER_ELEMENT",4,
1|2|4);

%SetCode(B,Float64ArrayConstructor);
%FunctionSetPrototype(B,new i());
%InternalSetPrototype(B,D);
%InternalSetPrototype(B.prototype,D.prototype);
%AddNamedProperty(B,"BYTES_PER_ELEMENT",8,
1|2|4);
%AddNamedProperty(B.prototype,
"constructor",a.Float64Array,2);
%AddNamedProperty(B.prototype,
"BYTES_PER_ELEMENT",8,
1|2|4);

%SetCode(C,Uint8ClampedArrayConstructor);
%FunctionSetPrototype(C,new i());
%InternalSetPrototype(C,D);
%InternalSetPrototype(C.prototype,D.prototype);
%AddNamedProperty(C,"BYTES_PER_ELEMENT",1,
1|2|4);
%AddNamedProperty(C.prototype,
"constructor",a.Uint8ClampedArray,2);
%AddNamedProperty(C.prototype,
"BYTES_PER_ELEMENT",1,
1|2|4);


})


(function(a,b){
"use strict";
%CheckIsBootstrapping();
var c=a.WeakMap;
var d=a.WeakSet;
var e=a.Math.random;
function WeakMapConstructor(f){
if((new.target===(void 0))){
throw %make_type_error(30,"WeakMap");
}
%WeakCollectionInitialize(this);
if(!(f==null)){
var g=this.set;
if(!(typeof(g)==='function')){
throw %make_type_error(94,g,'set',this);
}
for(var h of f){
if(!(%_IsJSReceiver(h))){
throw %make_type_error(55,h);
}
%_Call(g,this,h[0],h[1]);
}
}
}
%DefineMethodsInternal(c.prototype,class{
set(key,value){
if(!(%_IsJSWeakMap(this))){
throw %make_type_error(49,
'WeakMap.prototype.set',this);
}
if(!(%_IsJSReceiver(key)))throw %make_type_error(170);
return %WeakCollectionSet(this,key,value,%GenericHash(key));
}
delete(key){
if(!(%_IsJSWeakMap(this))){
throw %make_type_error(49,
'WeakMap.prototype.delete',this);
}
if(!(%_IsJSReceiver(key)))return false;
var i=%GetExistingHash(key);
if((i===(void 0)))return false;
return %WeakCollectionDelete(this,key,i);
}
},-1);
%SetCode(c,WeakMapConstructor);
%FunctionSetLength(c,0);
function WeakSetConstructor(f){
if((new.target===(void 0))){
throw %make_type_error(30,"WeakSet");
}
%WeakCollectionInitialize(this);
if(!(f==null)){
var g=this.add;
if(!(typeof(g)==='function')){
throw %make_type_error(94,g,'add',this);
}
for(var j of f){
%_Call(g,this,j);
}
}
}
%DefineMethodsInternal(d.prototype,class{
add(j){
if(!(%_IsJSWeakSet(this))){
throw %make_type_error(49,
'WeakSet.prototype.add',this);
}
if(!(%_IsJSReceiver(j)))throw %make_type_error(171);
return %WeakCollectionSet(this,j,true,%GenericHash(j));
}
delete(j){
if(!(%_IsJSWeakSet(this))){
throw %make_type_error(49,
'WeakSet.prototype.delete',this);
}
if(!(%_IsJSReceiver(j)))return false;
var i=%GetExistingHash(j);
if((i===(void 0)))return false;
return %WeakCollectionDelete(this,j,i);
}
},-1);
%SetCode(d,WeakSetConstructor);
%FunctionSetLength(d,0);
})


(function(a,b){
"use strict";
%CheckIsBootstrapping();
var c=b.ImportNow("Script");
function ScriptLocationFromPosition(position,
include_resource_offset){
return %ScriptPositionInfo(this,position,!!include_resource_offset);
}
function ScriptNameOrSourceURL(){
if(this.source_url)return this.source_url;
return this.name;
}
b.SetUpLockedPrototype(c,[
"source",
"name",
"source_url",
"source_mapping_url",
"line_offset",
"column_offset"
],[
"locationFromPosition",ScriptLocationFromPosition,
"nameOrSourceURL",ScriptNameOrSourceURL,
]
);
});


(function(a,b){
"use strict";
%CheckIsBootstrapping();
var c=a.Map;
var d=b.InternalArray;
var e=new c;
var f=c.prototype.get;
var g=c.prototype.set;
function SameCallSiteElements(h,i){
var j=h.length;
var i=i.raw;
if(j!==i.length)return false;
for(var k=0;k<j;++k){
if(h[k]!==i[k])return false;
}
return true;
}
function GetCachedCallSite(l,m){
var n=%_Call(f,e,m);
if((n===(void 0)))return;
var j=n.length;
for(var k=0;k<j;++k){
if(SameCallSiteElements(l,n[k]))return n[k];
}
}
function SetCachedCallSite(l,m){
var n=%_Call(f,e,m);
var o;
if((n===(void 0))){
o=new d(1);
o[0]=l;
%_Call(g,e,m,o);
}else{
n.push(l);
}
return l;
}
function GetTemplateCallSite(l,h,m){
var p=GetCachedCallSite(h,m);
if(!(p===(void 0)))return p;
%AddNamedProperty(l,"raw",%object_freeze(h),
1|2|4);
return SetCachedCallSite(%object_freeze(l),m);
}
%InstallToContext(["get_template_call_site",GetTemplateCallSite]);
})


(function(a,b){
"use strict";
var c=b.InternalArray;
function SpreadArguments(){
var d=arguments.length;
var e=new c();
for(var f=0;f<d;++f){
var g=arguments[f];
var h=g.length;
for(var i=0;i<h;++i){
e.push(g[i]);
}
}
return e;
}
function SpreadIterable(j){
if((j==null)){
throw %make_type_error(76,j);
}
var e=new c();
for(var k of j){
e.push(k);
}
return e;
}
%InstallToContext([
"spread_arguments",SpreadArguments,
"spread_iterable",SpreadIterable,
]);
})


(function(a,b){
"use strict";
%CheckIsBootstrapping();
var c=a.Proxy;
%DefineMethodsInternal(c,class{revocable(target,handler){
var d=new c(target,handler);
return{proxy:d,revoke:()=>%JSProxyRevoke(d)};
}},-1);
})


(function(a,b){
"use strict";
%CheckIsBootstrapping();
var c;
var d;
var e=a.Date;
var f=a.Intl;
var g=f.DateTimeFormat;
var h=f.NumberFormat;
var i=f.Collator;
var j=b.ImportNow("PluralRules");
var k=f.v8BreakIterator;
var l=a.Number;
var m=a.RegExp;
var n=a.String;
var o=b.ImportNow("intl_fallback_symbol");
var p=b.InternalArray;
var q;
var r=a.Object.prototype.hasOwnProperty;
var s=a.Object.keys;
var t=b.ImportNow("intl_pattern_symbol");
var u=b.ImportNow("intl_resolved_symbol");
var v=n.prototype.substr;
var w=n.prototype.substring;
b.Import(function(x){
c=x.ArrayJoin;
d=x.ArrayPush;
q=x.MaxSimple;
});
function AddBoundMethod(obj,methodName,implementation,length,typename,
compat){
%CheckIsBootstrapping();
var y=%CreatePrivateSymbol(methodName);
%DefineMethodsInternal(obj.prototype,class{get[methodName](){
var z=Unwrap(this,typename,obj,methodName,compat);
if((z[y]===(void 0))){
var A;
if((length===(void 0))||length===2){
A=
(0,((fst,snd)=>implementation(z,fst,snd)));
}else if(length===1){
A=(0,(fst=>implementation(z,fst)));
}else{
A=(0,((...args)=>{
if(args.length>0){
return implementation(z,args[0]);
}else{
return implementation(z);
}
}));
}
%SetNativeFlag(A);
z[y]=A;
}
return z[y];
}},-1);
}
function IntlConstruct(z,constructor,create,newTarget,args,
compat){
var B=args[0];
var C=args[1];
var D=create(B,C);
if(compat&&(newTarget===(void 0))&&z instanceof constructor){
%object_define_property(z,o,{value:D});
return z;
}
return D;
}
function Unwrap(z,E,F,G,H){
if(!%IsInitializedIntlObjectOfType(z,E)){
if(H&&z instanceof F){
let fallback=z[o];
if(%IsInitializedIntlObjectOfType(fallback,E)){
return fallback;
}
}
throw %make_type_error(49,G,z);
}
return z;
}
var I={
'collator':(void 0),
'numberformat':(void 0),
'dateformat':(void 0),
'breakiterator':(void 0),
'pluralrules':(void 0),
};
var J=(void 0);
function GetDefaultICULocaleJS(K){
if((J===(void 0))){
J=%GetDefaultICULocale();
}
return((K===(void 0))||
(%_Call(r,getAvailableLocalesOf(K),J)))
?J:"und";
}
var L=(void 0);
function GetUnicodeExtensionRE(){
if(((void 0)===(void 0))){
L=new m('-u(-[a-z0-9]{2,8})+','g');
}
return L;
}
var M=(void 0);
function GetAnyExtensionRE(){
if((M===(void 0))){
M=new m('-[a-z0-9]{1}-.*','g');
}
return M;
}
var N=(void 0);
function GetQuotedStringRE(){
if((N===(void 0))){
N=new m("'[^']+'",'g');
}
return N;
}
var O=(void 0);
function GetServiceRE(){
if((O===(void 0))){
O=
new m('^('+%_Call(c,s(I),'|')+')$');
}
return O;
}
var P=(void 0);
function GetLanguageTagRE(){
if((P===(void 0))){
BuildLanguageTagREs();
}
return P;
}
var Q=(void 0);
function GetLanguageVariantRE(){
if((Q===(void 0))){
BuildLanguageTagREs();
}
return Q;
}
var R=(void 0);
function GetLanguageSingletonRE(){
if((R===(void 0))){
BuildLanguageTagREs();
}
return R;
}
var S=(void 0);
function GetTimezoneNameCheckRE(){
if((S===(void 0))){
S=new m(
'^([A-Za-z]+)/([A-Za-z_-]+)((?:\/[A-Za-z_-]+)+)*$');
}
return S;
}
var T=(void 0);
function GetTimezoneNameLocationPartRE(){
if((T===(void 0))){
T=
new m('^([A-Za-z]+)((?:[_-][A-Za-z]+)+)*$');
}
return T;
}
function supportedLocalesOf(K,B,C){
if((%regexp_internal_match(GetServiceRE(),K)===null)){
throw %make_error(7,K);
}
if((C===(void 0))){
C={};
}else{
C=(%_ToObject(C));
}
var U=C.localeMatcher;
if(!(U===(void 0))){
U=(%_ToString(U));
if(U!=='lookup'&&U!=='best fit'){
throw %make_range_error(178,U);
}
}else{
U='best fit';
}
var V=initializeLocaleList(B);
var W=getAvailableLocalesOf(K);
if(U==='best fit'){
return initializeLocaleList(bestFitSupportedLocalesOf(
V,W));
}
return initializeLocaleList(lookupSupportedLocalesOf(
V,W));
}
function lookupSupportedLocalesOf(V,W){
var X=new p();
for(var Y=0;Y<V.length;++Y){
var Z=%RegExpInternalReplace(
GetUnicodeExtensionRE(),V[Y],'');
do{
if(!(W[Z]===(void 0))){
%_Call(d,X,V[Y]);
break;
}
var aa=%StringLastIndexOf(Z,'-');
if(aa===-1){
break;
}
Z=%_Call(w,Z,0,aa);
}while(true);
}
return X;
}
function bestFitSupportedLocalesOf(V,W){
return lookupSupportedLocalesOf(V,W);
}
function getGetOption(C,ab){
if((C===(void 0)))throw %make_error(4,ab);
var ac=function getOption(ad,ae,af,ag){
if(!(C[ad]===(void 0))){
var ah=C[ad];
switch(ae){
case'boolean':
ah=(!!(ah));
break;
case'string':
ah=(%_ToString(ah));
break;
case'number':
ah=(%_ToNumber(ah));
break;
default:
throw %make_error(8);
}
if(!(af===(void 0))&&%ArrayIndexOf(af,ah,0)===-1){
throw %make_range_error(188,ah,ab,ad);
}
return ah;
}
return ag;
}
return ac;
}
function resolveLocale(K,V,C){
V=initializeLocaleList(V);
var ac=getGetOption(C,K);
var U=ac('localeMatcher','string',
['lookup','best fit'],'best fit');
var ai;
if(U==='lookup'){
ai=lookupMatcher(K,V);
}else{
ai=bestFitMatcher(K,V);
}
return ai;
}
function lookupMatcher(K,V){
if((%regexp_internal_match(GetServiceRE(),K)===null)){
throw %make_error(7,K);
}
var W=getAvailableLocalesOf(K);
for(var Y=0;Y<V.length;++Y){
var Z=%RegExpInternalReplace(
GetAnyExtensionRE(),V[Y],'');
do{
if(!(W[Z]===(void 0))){
var aj=%regexp_internal_match(
GetUnicodeExtensionRE(),V[Y]);
var ak=(aj===null)?'':aj[0];
return{locale:Z,extension:ak,position:Y};
}
var aa=%StringLastIndexOf(Z,'-');
if(aa===-1){
break;
}
Z=%_Call(w,Z,0,aa);
}while(true);
}
return{
locale:GetDefaultICULocaleJS(K),
extension:'',
position:-1
};
}
function bestFitMatcher(K,V){
return lookupMatcher(K,V);
}
function parseExtension(ak){
var al=%StringSplit(ak,'-',4294967295);
if(al.length<=2||
(al[0]!==''&&al[1]!=='u')){
return{};
}
var am={};
var an=(void 0);
var ah=(void 0);
for(var Y=2;Y<al.length;++Y){
var ao=al[Y].length;
var ap=al[Y];
if(ao===2){
if(!(an===(void 0))){
if(!(an in am)){
am[an]=ah;
}
ah=(void 0);
}
an=ap;
}else if(ao>=3&&ao<=8&&!(an===(void 0))){
if((ah===(void 0))){
ah=ap;
}else{
ah=ah+"-"+ap;
}
}else{
return{};
}
}
if(!(an===(void 0))&&!(an in am)){
am[an]=ah;
}
return am;
}
function setOptions(aq,am,ar,ac,as){
var ak='';
var at=function updateExtension(an,ah){
return'-'+an+'-'+(%_ToString(ah));
}
var au=function updateProperty(ad,ae,ah){
if(ae==='boolean'&&(typeof ah==='string')){
ah=(ah==='true')?true:false;
}
if(!(ad===(void 0))){
defineWEProperty(as,ad,ah);
}
}
for(var an in ar){
if((%_Call(r,ar,an))){
var ah=(void 0);
var av=ar[an];
if(!(av.property===(void 0))){
ah=ac(av.property,av.type,av.values);
}
if(!(ah===(void 0))){
au(av.property,av.type,ah);
ak+=at(an,ah);
continue;
}
if((%_Call(r,am,an))){
ah=am[an];
if(!(ah===(void 0))){
au(av.property,av.type,ah);
ak+=at(an,ah);
}else if(av.type==='boolean'){
au(av.property,av.type,true);
ak+=at(an,true);
}
}
}
}
return ak===''?'':'-u'+ak;
}
function freezeArray(aw){
var ax=[];
var ay=aw.length;
for(var Y=0;Y<ay;Y++){
if(Y in aw){
%object_define_property(ax,Y,{value:aw[Y],
configurable:false,
writable:false,
enumerable:true});
}
}
%object_define_property(ax,'length',{value:ay,writable:false});
return ax;
}
function makeArray(aw){
var ax=[];
%MoveArrayContents(aw,ax);
return ax;
}
function getAvailableLocalesOf(K){
if(!(I[K]===(void 0))){
return I[K];
}
var az=%AvailableLocalesOf(K);
for(var Y in az){
if((%_Call(r,az,Y))){
var aA=%regexp_internal_match(
/^([a-z]{2,3})-([A-Z][a-z]{3})-([A-Z]{2})$/,Y);
if(!(aA===null)){
az[aA[1]+'-'+aA[3]]=null;
}
}
}
I[K]=az;
return az;
}
function defineWEProperty(aB,ad,ah){
%object_define_property(aB,ad,
{value:ah,writable:true,enumerable:true});
}
function addWEPropertyIfDefined(aB,ad,ah){
if(!(ah===(void 0))){
defineWEProperty(aB,ad,ah);
}
}
function defineWECProperty(aB,ad,ah){
%object_define_property(aB,ad,{value:ah,
writable:true,
enumerable:true,
configurable:true});
}
function addWECPropertyIfDefined(aB,ad,ah){
if(!(ah===(void 0))){
defineWECProperty(aB,ad,ah);
}
}
function toTitleCaseWord(aC){
return %StringToUpperCaseIntl(%_Call(v,aC,0,1))+
%StringToLowerCaseIntl(%_Call(v,aC,1));
}
function toTitleCaseTimezoneLocation(aD){
var aE=%regexp_internal_match(GetTimezoneNameLocationPartRE(),aD)
if((aE===null))throw %make_range_error(157,aD);
var aF=toTitleCaseWord(aE[1]);
if(!(aE[2]===(void 0))&&2<aE.length){
var aG=%_Call(w,aE[2],0,1);
var aA=%StringSplit(aE[2],aG,4294967295);
for(var Y=1;Y<aA.length;Y++){
var aH=aA[Y]
var aI=%StringToLowerCaseIntl(aH);
aF=aF+aG+
((aI!=='es'&&
aI!=='of'&&aI!=='au')?
toTitleCaseWord(aH):aI);
}
}
return aF;
}
function canonicalizeLanguageTag(aJ){
if((!(typeof(aJ)==='string')&&!(%_IsJSReceiver(aJ)))||
(aJ===null)){
throw %make_type_error(56);
}
if((typeof(aJ)==='string')&&
!(%regexp_internal_match(/^[a-z]{2,3}$/,aJ)===null)){
return aJ;
}
var aK=(%_ToString(aJ));
if(isStructuallyValidLanguageTag(aK)===false){
throw %make_range_error(169,aK);
}
var aL=%CanonicalizeLanguageTag(aK);
if(aL==='invalid-tag'){
throw %make_range_error(169,aK);
}
return aL;
}
function canonicalizeLocaleList(B){
var aM=new p();
if(!(B===(void 0))){
if(typeof B==='string'){
%_Call(d,aM,canonicalizeLanguageTag(B));
return aM;
}
var aN=(%_ToObject(B));
var aO=(%_ToLength(aN.length));
for(var aP=0;aP<aO;aP++){
if(aP in aN){
var ah=aN[aP];
var aL=canonicalizeLanguageTag(ah);
if(%ArrayIndexOf(aM,aL,0)===-1){
%_Call(d,aM,aL);
}
}
}
}
return aM;
}
function initializeLocaleList(B){
return freezeArray(canonicalizeLocaleList(B));
}
function isStructuallyValidLanguageTag(Z){
if((%regexp_internal_match(GetLanguageTagRE(),Z)===null)){
return false;
}
Z=%StringToLowerCaseIntl(Z);
if(%StringIndexOf(Z,'x-',0)===0){
return true;
}
Z=%StringSplit(Z,'-x-',4294967295)[0];
var aQ=new p();
var aR=new p();
var aA=%StringSplit(Z,'-',4294967295);
for(var Y=1;Y<aA.length;Y++){
var ah=aA[Y];
if(!(%regexp_internal_match(GetLanguageVariantRE(),ah)===null)&&
aR.length===0){
if(%ArrayIndexOf(aQ,ah,0)===-1){
%_Call(d,aQ,ah);
}else{
return false;
}
}
if(!(%regexp_internal_match(GetLanguageSingletonRE(),ah)===null)){
if(%ArrayIndexOf(aR,ah,0)===-1){
%_Call(d,aR,ah);
}else{
return false;
}
}
}
return true;
}
function BuildLanguageTagREs(){
var aS='[a-zA-Z]';
var aT='[0-9]';
var aU='('+aS+'|'+aT+')';
var aV='(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|'+
'zh-min|zh-min-nan|zh-xiang)';
var aW='(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|'+
'i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|'+
'i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)';
var aX='('+aW+'|'+aV+')';
var aY='(x(-'+aU+'{1,8})+)';
var aZ='('+aT+'|[A-WY-Za-wy-z])';
R=new m('^'+aZ+'$','i');
var ak='('+aZ+'(-'+aU+'{2,8})+)';
var ba='('+aU+'{5,8}|('+aT+aU+'{3}))';
Q=new m('^'+ba+'$','i');
var bb='('+aS+'{2}|'+aT+'{3})';
var bc='('+aS+'{4})';
var bd='('+aS+'{3}(-'+aS+'{3}){0,2})';
var be='('+aS+'{2,3}(-'+bd+')?|'+aS+'{4}|'+
aS+'{5,8})';
var bf=be+'(-'+bc+')?(-'+bb+')?(-'+
ba+')*(-'+ak+')*(-'+aY+')?';
var bg=
'^('+bf+'|'+aY+'|'+aX+')$';
P=new m(bg,'i');
}
%DefineMethodsInternal(f,class{getCanonicalLocales(B){
return makeArray(canonicalizeLocaleList(B));
}},-1);
function CreateCollator(B,C){
if((C===(void 0))){
C={};
}
var ac=getGetOption(C,'collator');
var bh={};
defineWEProperty(bh,'usage',ac(
'usage','string',['sort','search'],'sort'));
var bi=ac('sensitivity','string',
['base','accent','case','variant']);
if((bi===(void 0))&&bh.usage==='sort'){
bi='variant';
}
defineWEProperty(bh,'sensitivity',bi);
defineWEProperty(bh,'ignorePunctuation',ac(
'ignorePunctuation','boolean',(void 0),false));
var Z=resolveLocale('collator',B,C);
var am=parseExtension(Z.extension);
var bj={
'kn':{'property':'numeric','type':'boolean'},
'kf':{'property':'caseFirst','type':'string',
'values':['false','lower','upper']}
};
setOptions(
C,am,bj,ac,bh);
var bk='default';
var ak='';
if((%_Call(r,am,'co'))&&bh.usage==='sort'){
var bl=[
'big5han','dict','direct','ducet','gb2312','phonebk','phonetic',
'pinyin','reformed','searchjl','stroke','trad','unihan','zhuyin'
];
if(%ArrayIndexOf(bl,am.co,0)!==-1){
ak='-u-co-'+am.co;
bk=am.co;
}
}else if(bh.usage==='search'){
ak='-u-co-search';
}
defineWEProperty(bh,'collation',bk);
var bm=Z.locale+ak;
var ai=%object_define_properties({},{
caseFirst:{writable:true},
collation:{value:bh.collation,writable:true},
ignorePunctuation:{writable:true},
locale:{writable:true},
numeric:{writable:true},
requestedLocale:{value:bm,writable:true},
sensitivity:{writable:true},
strength:{writable:true},
usage:{value:bh.usage,writable:true}
});
var bn=%CreateCollator(bm,bh,ai);
%MarkAsInitializedIntlObjectOfType(bn,'collator');
bn[u]=ai;
return bn;
}
function CollatorConstructor(){
return IntlConstruct(this,i,CreateCollator,new.target,
arguments);
}
%SetCode(i,CollatorConstructor);
%DefineMethodsInternal(i.prototype,class{resolvedOptions(){
var bo=Unwrap(this,'collator',i,'resolvedOptions',
false);
return{
locale:bo[u].locale,
usage:bo[u].usage,
sensitivity:bo[u].sensitivity,
ignorePunctuation:bo[u].ignorePunctuation,
numeric:bo[u].numeric,
caseFirst:bo[u].caseFirst,
collation:bo[u].collation
};
}},-1);
%DefineMethodsInternal(i,class{supportedLocalesOf(B){
return supportedLocalesOf('collator',B,arguments[1]);
}},-1);
function compare(bn,bp,bq){
return %InternalCompare(bn,(%_ToString(bp)),(%_ToString(bq)));
};
AddBoundMethod(i,'compare',compare,2,'collator',false);
function PluralRulesConstructor(){
if((new.target===(void 0))){
throw %make_type_error(30,"PluralRules");
}
var B=arguments[0];
var C=arguments[1];
if((C===(void 0))){
C={};
}
var ac=getGetOption(C,'pluralrules');
var Z=resolveLocale('pluralrules',B,C);
var bh={};
defineWEProperty(bh,'type',ac(
'type','string',['cardinal','ordinal'],'cardinal'));
SetNumberFormatDigitOptions(bh,C,0,3);
var bm=Z.locale;
var ai=%object_define_properties({},{
type:{value:bh.type,writable:true},
locale:{writable:true},
maximumFractionDigits:{writable:true},
minimumFractionDigits:{writable:true},
minimumIntegerDigits:{writable:true},
requestedLocale:{value:bm,writable:true},
});
if((%_Call(r,bh,'minimumSignificantDigits'))){
defineWEProperty(ai,'minimumSignificantDigits',(void 0));
}
if((%_Call(r,bh,'maximumSignificantDigits'))){
defineWEProperty(ai,'maximumSignificantDigits',(void 0));
}
defineWEProperty(ai,'pluralCategories',[]);
var br=%CreatePluralRules(bm,bh,
ai);
%MarkAsInitializedIntlObjectOfType(br,'pluralrules');
br[u]=ai;
return br;
}
%SetCode(j,PluralRulesConstructor);
%DefineMethodsInternal(j.prototype,class{resolvedOptions(){
if(!%IsInitializedIntlObjectOfType(this,'pluralrules')){
throw %make_type_error(49,
'Intl.PluralRules.prototype.resolvedOptions',
this);
}
var aF={
locale:this[u].locale,
type:this[u].type,
minimumIntegerDigits:this[u].minimumIntegerDigits,
minimumFractionDigits:this[u].minimumFractionDigits,
maximumFractionDigits:this[u].maximumFractionDigits,
};
if((%_Call(r,this[u],'minimumSignificantDigits'))){
defineWECProperty(aF,'minimumSignificantDigits',
this[u].minimumSignificantDigits);
}
if((%_Call(r,this[u],'maximumSignificantDigits'))){
defineWECProperty(aF,'maximumSignificantDigits',
this[u].maximumSignificantDigits);
}
defineWECProperty(aF,'pluralCategories',
this[u].pluralCategories);
return aF;
}},-1);
%DefineMethodsInternal(j,class{supportedLocalesOf(B){
return supportedLocalesOf('pluralrules',B,arguments[1]);
}},-1);
%DefineMethodsInternal(j.prototype,class{select(ah){
if(!%IsInitializedIntlObjectOfType(this,'pluralrules')){
throw %make_type_error(49,
'Intl.PluralRules.prototype.select',
this);
}
return %PluralRulesSelect(this,(%_ToNumber(ah))+0);
}},-1);
function isWellFormedCurrencyCode(bs){
return typeof bs==="string"&&bs.length===3&&
(%regexp_internal_match(/[^A-Za-z]/,bs)===null);
}
function defaultNumberOption(ah,bt,bu,bv,ad){
if(!(ah===(void 0))){
ah=(%_ToNumber(ah));
if((%IS_VAR(ah)!==ah)||ah<bt||ah>bu){
throw %make_range_error(181,ad);
}
return %math_floor(ah);
}
return bv;
}
function getNumberOption(C,ad,bt,bu,bv){
var ah=C[ad];
return defaultNumberOption(ah,bt,bu,bv,ad);
}
function SetNumberFormatDigitOptions(bh,C,
mnfdDefault,mxfdDefault){
var bw=getNumberOption(C,'minimumIntegerDigits',1,21,1);
defineWEProperty(bh,'minimumIntegerDigits',bw);
var bx=getNumberOption(C,'minimumFractionDigits',0,20,
mnfdDefault);
defineWEProperty(bh,'minimumFractionDigits',bx);
var by=q(bx,mxfdDefault);
var bz=getNumberOption(C,'maximumFractionDigits',bx,20,
by);
defineWEProperty(bh,'maximumFractionDigits',bz);
var bA=C['minimumSignificantDigits'];
var bB=C['maximumSignificantDigits'];
if(!(bA===(void 0))||!(bB===(void 0))){
bA=defaultNumberOption(bA,1,21,1,'minimumSignificantDigits');
defineWEProperty(bh,'minimumSignificantDigits',bA);
bB=defaultNumberOption(bB,bA,21,21,'maximumSignificantDigits');
defineWEProperty(bh,'maximumSignificantDigits',bB);
}
}
function CreateNumberFormat(B,C){
if((C===(void 0))){
C={};
}
var ac=getGetOption(C,'numberformat');
var Z=resolveLocale('numberformat',B,C);
var bh={};
defineWEProperty(bh,'style',ac(
'style','string',['decimal','percent','currency'],'decimal'));
var bs=ac('currency','string');
if(!(bs===(void 0))&&!isWellFormedCurrencyCode(bs)){
throw %make_range_error(164,bs);
}
if(bh.style==='currency'&&(bs===(void 0))){
throw %make_type_error(32);
}
var bC,bD;
var bE=ac(
'currencyDisplay','string',['code','symbol','name'],'symbol');
if(bh.style==='currency'){
defineWEProperty(bh,'currency',%StringToUpperCaseIntl(bs));
defineWEProperty(bh,'currencyDisplay',bE);
bC=bD=%CurrencyDigits(bh.currency);
}else{
bC=0;
bD=bh.style==='percent'?0:3;
}
SetNumberFormatDigitOptions(bh,C,bC,
bD);
defineWEProperty(bh,'useGrouping',ac(
'useGrouping','boolean',(void 0),true));
var am=parseExtension(Z.extension);
var bF={
'nu':{'property':(void 0),'type':'string'}
};
var ak=setOptions(C,am,bF,
ac,bh);
var bm=Z.locale+ak;
var ai=%object_define_properties({},{
currency:{writable:true},
currencyDisplay:{writable:true},
locale:{writable:true},
maximumFractionDigits:{writable:true},
minimumFractionDigits:{writable:true},
minimumIntegerDigits:{writable:true},
numberingSystem:{writable:true},
requestedLocale:{value:bm,writable:true},
style:{value:bh.style,writable:true},
useGrouping:{writable:true}
});
if((%_Call(r,bh,'minimumSignificantDigits'))){
defineWEProperty(ai,'minimumSignificantDigits',(void 0));
}
if((%_Call(r,bh,'maximumSignificantDigits'))){
defineWEProperty(ai,'maximumSignificantDigits',(void 0));
}
var bG=%CreateNumberFormat(bm,bh,
ai);
if(bh.style==='currency'){
%object_define_property(ai,'currencyDisplay',
{value:bE,writable:true});
}
%MarkAsInitializedIntlObjectOfType(bG,'numberformat');
bG[u]=ai;
return bG;
}
function NumberFormatConstructor(){
return IntlConstruct(this,h,CreateNumberFormat,
new.target,arguments,true);
}
%SetCode(h,NumberFormatConstructor);
%DefineMethodsInternal(h.prototype,class{resolvedOptions(){
var bH=Unwrap(this,'numberformat',h,
'resolvedOptions',true);
var aF={
locale:bH[u].locale,
numberingSystem:bH[u].numberingSystem,
style:bH[u].style,
useGrouping:bH[u].useGrouping,
minimumIntegerDigits:bH[u].minimumIntegerDigits,
minimumFractionDigits:bH[u].minimumFractionDigits,
maximumFractionDigits:bH[u].maximumFractionDigits,
};
if(aF.style==='currency'){
defineWECProperty(aF,'currency',bH[u].currency);
defineWECProperty(aF,'currencyDisplay',
bH[u].currencyDisplay);
}
if((%_Call(r,bH[u],'minimumSignificantDigits'))){
defineWECProperty(aF,'minimumSignificantDigits',
bH[u].minimumSignificantDigits);
}
if((%_Call(r,bH[u],'maximumSignificantDigits'))){
defineWECProperty(aF,'maximumSignificantDigits',
bH[u].maximumSignificantDigits);
}
return aF;
}},-1);
%DefineMethodsInternal(h,class{supportedLocalesOf(B){
return supportedLocalesOf('numberformat',B,arguments[1]);
}},-1);
function formatNumber(bI,ah){
var bJ=(%_ToNumber(ah))+0;
return %InternalNumberFormat(bI,bJ);
}
AddBoundMethod(h,'format',formatNumber,1,
'numberformat',true);
function toLDMLString(C){
var ac=getGetOption(C,'dateformat');
var bK='';
var bL=ac('weekday','string',['narrow','short','long']);
bK+=appendToLDMLString(
bL,{narrow:'EEEEE',short:'EEE',long:'EEEE'});
bL=ac('era','string',['narrow','short','long']);
bK+=appendToLDMLString(
bL,{narrow:'GGGGG',short:'GGG',long:'GGGG'});
bL=ac('year','string',['2-digit','numeric']);
bK+=appendToLDMLString(bL,{'2-digit':'yy','numeric':'y'});
bL=ac('month','string',
['2-digit','numeric','narrow','short','long']);
bK+=appendToLDMLString(bL,{'2-digit':'MM','numeric':'M',
'narrow':'MMMMM','short':'MMM','long':'MMMM'});
bL=ac('day','string',['2-digit','numeric']);
bK+=appendToLDMLString(
bL,{'2-digit':'dd','numeric':'d'});
var bM=ac('hour12','boolean');
bL=ac('hour','string',['2-digit','numeric']);
if((bM===(void 0))){
bK+=appendToLDMLString(bL,{'2-digit':'jj','numeric':'j'});
}else if(bM===true){
bK+=appendToLDMLString(bL,{'2-digit':'hh','numeric':'h'});
}else{
bK+=appendToLDMLString(bL,{'2-digit':'HH','numeric':'H'});
}
bL=ac('minute','string',['2-digit','numeric']);
bK+=appendToLDMLString(bL,{'2-digit':'mm','numeric':'m'});
bL=ac('second','string',['2-digit','numeric']);
bK+=appendToLDMLString(bL,{'2-digit':'ss','numeric':'s'});
bL=ac('timeZoneName','string',['short','long']);
bK+=appendToLDMLString(bL,{short:'z',long:'zzzz'});
return bK;
}
function appendToLDMLString(bL,bN){
if(!(bL===(void 0))){
return bN[bL];
}else{
return'';
}
}
function fromLDMLString(bK){
bK=%RegExpInternalReplace(GetQuotedStringRE(),bK,'');
var C={};
var aE=%regexp_internal_match(/E{3,5}/,bK);
C=appendToDateTimeObject(
C,'weekday',aE,{EEEEE:'narrow',EEE:'short',EEEE:'long'});
aE=%regexp_internal_match(/G{3,5}/,bK);
C=appendToDateTimeObject(
C,'era',aE,{GGGGG:'narrow',GGG:'short',GGGG:'long'});
aE=%regexp_internal_match(/y{1,2}/,bK);
C=appendToDateTimeObject(
C,'year',aE,{y:'numeric',yy:'2-digit'});
aE=%regexp_internal_match(/M{1,5}/,bK);
C=appendToDateTimeObject(C,'month',aE,{MM:'2-digit',
M:'numeric',MMMMM:'narrow',MMM:'short',MMMM:'long'});
aE=%regexp_internal_match(/L{1,5}/,bK);
C=appendToDateTimeObject(C,'month',aE,{LL:'2-digit',
L:'numeric',LLLLL:'narrow',LLL:'short',LLLL:'long'});
aE=%regexp_internal_match(/d{1,2}/,bK);
C=appendToDateTimeObject(
C,'day',aE,{d:'numeric',dd:'2-digit'});
aE=%regexp_internal_match(/h{1,2}/,bK);
if(aE!==null){
C['hour12']=true;
}
C=appendToDateTimeObject(
C,'hour',aE,{h:'numeric',hh:'2-digit'});
aE=%regexp_internal_match(/H{1,2}/,bK);
if(aE!==null){
C['hour12']=false;
}
C=appendToDateTimeObject(
C,'hour',aE,{H:'numeric',HH:'2-digit'});
aE=%regexp_internal_match(/m{1,2}/,bK);
C=appendToDateTimeObject(
C,'minute',aE,{m:'numeric',mm:'2-digit'});
aE=%regexp_internal_match(/s{1,2}/,bK);
C=appendToDateTimeObject(
C,'second',aE,{s:'numeric',ss:'2-digit'});
aE=%regexp_internal_match(/z|zzzz/,bK);
C=appendToDateTimeObject(
C,'timeZoneName',aE,{z:'short',zzzz:'long'});
return C;
}
function appendToDateTimeObject(C,bL,aE,bN){
if((aE===null)){
if(!(%_Call(r,C,bL))){
defineWEProperty(C,bL,(void 0));
}
return C;
}
var ad=aE[0];
defineWEProperty(C,bL,bN[ad]);
return C;
}
function toDateTimeOptions(C,bO,bP){
if((C===(void 0))){
C={};
}else{
C=(%_ToObject(C));
}
C=%object_create(C);
var bQ=true;
if((bO==='date'||bO==='any')&&
(!(C.weekday===(void 0))||!(C.year===(void 0))||
!(C.month===(void 0))||!(C.day===(void 0)))){
bQ=false;
}
if((bO==='time'||bO==='any')&&
(!(C.hour===(void 0))||!(C.minute===(void 0))||
!(C.second===(void 0)))){
bQ=false;
}
if(bQ&&(bP==='date'||bP==='all')){
%object_define_property(C,'year',{value:'numeric',
writable:true,
enumerable:true,
configurable:true});
%object_define_property(C,'month',{value:'numeric',
writable:true,
enumerable:true,
configurable:true});
%object_define_property(C,'day',{value:'numeric',
writable:true,
enumerable:true,
configurable:true});
}
if(bQ&&(bP==='time'||bP==='all')){
%object_define_property(C,'hour',{value:'numeric',
writable:true,
enumerable:true,
configurable:true});
%object_define_property(C,'minute',{value:'numeric',
writable:true,
enumerable:true,
configurable:true});
%object_define_property(C,'second',{value:'numeric',
writable:true,
enumerable:true,
configurable:true});
}
return C;
}
function CreateDateTimeFormat(B,C){
if((C===(void 0))){
C={};
}
var Z=resolveLocale('dateformat',B,C);
C=toDateTimeOptions(C,'any','date');
var ac=getGetOption(C,'dateformat');
var U=ac('formatMatcher','string',
['basic','best fit'],'best fit');
var bK=toLDMLString(C);
var bR=canonicalizeTimeZoneID(C.timeZone);
var bh={};
var am=parseExtension(Z.extension);
var bS={
'ca':{'property':(void 0),'type':'string'},
'nu':{'property':(void 0),'type':'string'}
};
var ak=setOptions(C,am,bS,
ac,bh);
var bm=Z.locale+ak;
var ai=%object_define_properties({},{
calendar:{writable:true},
day:{writable:true},
era:{writable:true},
hour12:{writable:true},
hour:{writable:true},
locale:{writable:true},
minute:{writable:true},
month:{writable:true},
numberingSystem:{writable:true},
[t]:{writable:true},
requestedLocale:{value:bm,writable:true},
second:{writable:true},
timeZone:{writable:true},
timeZoneName:{writable:true},
tz:{value:bR,writable:true},
weekday:{writable:true},
year:{writable:true}
});
var bT=%CreateDateTimeFormat(
bm,{skeleton:bK,timeZone:bR},ai);
if(ai.timeZone==="Etc/Unknown"){
throw %make_range_error(187,bR);
}
%MarkAsInitializedIntlObjectOfType(bT,'dateformat');
bT[u]=ai;
return bT;
}
function DateTimeFormatConstructor(){
return IntlConstruct(this,g,CreateDateTimeFormat,
new.target,arguments,true);
}
%SetCode(g,DateTimeFormatConstructor);
%DefineMethodsInternal(g.prototype,class{resolvedOptions(){
var bH=Unwrap(this,'dateformat',g,
'resolvedOptions',true);
var bU={
'gregorian':'gregory',
'ethiopic-amete-alem':'ethioaa'
};
var bV=fromLDMLString(bH[u][t]);
var bW=bU[bH[u].calendar];
if((bW===(void 0))){
bW=bH[u].calendar;
}
var aF={
locale:bH[u].locale,
numberingSystem:bH[u].numberingSystem,
calendar:bW,
timeZone:bH[u].timeZone
};
addWECPropertyIfDefined(aF,'timeZoneName',bV.timeZoneName);
addWECPropertyIfDefined(aF,'era',bV.era);
addWECPropertyIfDefined(aF,'year',bV.year);
addWECPropertyIfDefined(aF,'month',bV.month);
addWECPropertyIfDefined(aF,'day',bV.day);
addWECPropertyIfDefined(aF,'weekday',bV.weekday);
addWECPropertyIfDefined(aF,'hour12',bV.hour12);
addWECPropertyIfDefined(aF,'hour',bV.hour);
addWECPropertyIfDefined(aF,'minute',bV.minute);
addWECPropertyIfDefined(aF,'second',bV.second);
return aF;
}},-1);
%DefineMethodsInternal(g,class{supportedLocalesOf(B){
return supportedLocalesOf('dateformat',B,arguments[1]);
}},-1);
function formatDate(bI,bX){
var bY;
if((bX===(void 0))){
bY=%DateCurrentTime();
}else{
bY=(%_ToNumber(bX));
}
if(!(%_IsSmi(%IS_VAR(bY))||((bY==bY)&&(bY!=1/0)&&(bY!=-1/0))))throw %make_range_error(155);
return %InternalDateFormat(bI,new e(bY));
}
%DefineMethodsInternal(g.prototype,class{formatToParts(bX){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"Intl.DateTimeFormat.prototype.formatToParts");
if(!(typeof(this)==='object')){
throw %make_type_error(17,this);
}
if(!%IsInitializedIntlObjectOfType(this,'dateformat')){
throw %make_type_error(49,
'Intl.DateTimeFormat.prototype.formatToParts',
this);
}
var bY;
if((bX===(void 0))){
bY=%DateCurrentTime();
}else{
bY=(%_ToNumber(bX));
}
if(!(%_IsSmi(%IS_VAR(bY))||((bY==bY)&&(bY!=1/0)&&(bY!=-1/0))))throw %make_range_error(155);
return %InternalDateFormatToParts(this,new e(bY));
}},-1);
AddBoundMethod(g,'format',formatDate,1,'dateformat',
true);
function canonicalizeTimeZoneID(bZ){
if((bZ===(void 0))){
return bZ;
}
bZ=(%_ToString(bZ));
var ca=%StringToUpperCaseIntl(bZ);
if(ca==='UTC'||ca==='GMT'||
ca==='ETC/UTC'||ca==='ETC/GMT'){
return'UTC';
}
var aE=%regexp_internal_match(GetTimezoneNameCheckRE(),bZ);
if((aE===null))throw %make_range_error(156,bZ);
var aF=toTitleCaseTimezoneLocation(aE[1])+'/'+
toTitleCaseTimezoneLocation(aE[2]);
if(!(aE[3]===(void 0))&&3<aE.length){
var cb=%StringSplit(aE[3],'/',4294967295);
for(var Y=1;Y<cb.length;Y++){
aF=aF+'/'+toTitleCaseTimezoneLocation(cb[Y]);
}
}
return aF;
}
function CreateBreakIterator(B,C){
if((C===(void 0))){
C={};
}
var ac=getGetOption(C,'breakiterator');
var bh={};
defineWEProperty(bh,'type',ac(
'type','string',['character','word','sentence','line'],'word'));
var Z=resolveLocale('breakiterator',B,C);
var ai=%object_define_properties({},{
requestedLocale:{value:Z.locale,writable:true},
type:{value:bh.type,writable:true},
locale:{writable:true}
});
var cc=%CreateBreakIterator(Z.locale,bh,ai);
%MarkAsInitializedIntlObjectOfType(cc,'breakiterator');
cc[u]=ai;
return cc;
}
function v8BreakIteratorConstructor(){
return IntlConstruct(this,k,CreateBreakIterator,
new.target,arguments);
}
%SetCode(k,v8BreakIteratorConstructor);
%DefineMethodsInternal(k.prototype,class{resolvedOptions(){
if(!(new.target===(void 0))){
throw %make_type_error(89);
}
var cd=Unwrap(this,'breakiterator',k,
'resolvedOptions',false);
return{
locale:cd[u].locale,
type:cd[u].type
};
}},-1);
%DefineMethodsInternal(k,class{supportedLocalesOf(B){
if(!(new.target===(void 0))){
throw %make_type_error(89);
}
return supportedLocalesOf('breakiterator',B,arguments[1]);
}},-1);
function adoptText(cc,ce){
%BreakIteratorAdoptText(cc,(%_ToString(ce)));
}
function first(cc){
return %BreakIteratorFirst(cc);
}
function next(cc){
return %BreakIteratorNext(cc);
}
function current(cc){
return %BreakIteratorCurrent(cc);
}
function breakType(cc){
return %BreakIteratorBreakType(cc);
}
AddBoundMethod(k,'adoptText',adoptText,1,
'breakiterator');
AddBoundMethod(k,'first',first,0,'breakiterator');
AddBoundMethod(k,'next',next,0,'breakiterator');
AddBoundMethod(k,'current',current,0,
'breakiterator');
AddBoundMethod(k,'breakType',breakType,0,
'breakiterator');
var cf={
'collator':i,
'numberformat':h,
'dateformatall':g,
'dateformatdate':g,
'dateformattime':g
};
var cg={
'collator':(void 0),
'numberformat':(void 0),
'dateformatall':(void 0),
'dateformatdate':(void 0),
'dateformattime':(void 0),
};
function clearDefaultObjects(){
cg['dateformatall']=(void 0);
cg['dateformatdate']=(void 0);
cg['dateformattime']=(void 0);
}
var ch=0;
function checkDateCacheCurrent(){
var ci=%DateCacheVersion();
if(ci==ch){
return;
}
ch=ci;
clearDefaultObjects();
}
function cachedOrNewService(K,B,C,bP){
var cj=((bP===(void 0)))?C:bP;
if((B===(void 0))&&(C===(void 0))){
checkDateCacheCurrent();
if((cg[K]===(void 0))){
cg[K]=new cf[K](B,cj);
}
return cg[K];
}
return new cf[K](B,cj);
}
function LocaleConvertCase(ck,B,cl){
var be;
if((B===(void 0))){
be=GetDefaultICULocaleJS();
}else if((typeof(B)==='string')){
be=canonicalizeLanguageTag(B);
}else{
var B=initializeLocaleList(B);
be=B.length>0?B[0]:GetDefaultICULocaleJS();
}
var aa=%StringIndexOf(be,'-',0);
if(aa!==-1){
be=%_Call(w,be,0,aa);
}
return %StringLocaleConvertCase(ck,cl,be);
}
%DefineMethodsInternal(n.prototype,class{localeCompare(that){
if((this==null)){
throw %make_type_error(58);
}
var B=arguments[1];
var C=arguments[2];
var bn=cachedOrNewService('collator',B,C);
return compare(bn,this,that);
}},-1);
var cm={};
%DefineMethodsInternal(n.prototype,class{
toLocaleLowerCase(B){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.toLocaleLowerCase");
return LocaleConvertCase((%_ToString(this)),B,false);
}
toLocaleUpperCase(B){
if((%IS_VAR(this)===null)||(this===(void 0)))throw %make_type_error(18,"String.prototype.toLocaleUpperCase");
return LocaleConvertCase((%_ToString(this)),B,true);
}
},0);
%DefineMethodsInternal(l.prototype,class{toLocaleString(){
if(!(this instanceof l)&&typeof(this)!=='number'){
throw %make_type_error(59,"Number");
}
var B=arguments[0];
var C=arguments[1];
var bG=cachedOrNewService('numberformat',B,C);
return formatNumber(bG,this);
}},-1);
function toLocaleDateTime(cn,B,C,bO,bP,K){
if(!(cn instanceof e)){
throw %make_type_error(59,"Date");
}
var bX=(%_ToNumber(cn));
if((%IS_VAR(bX)!==bX))return'Invalid Date';
var bh=toDateTimeOptions(C,bO,bP);
var bT=
cachedOrNewService(K,B,C,bh);
return formatDate(bT,cn);
}
%DefineMethodsInternal(e.prototype,class{toLocaleString(){
var B=arguments[0];
var C=arguments[1];
return toLocaleDateTime(
this,B,C,'any','all','dateformatall');
}},-1);
%DefineMethodsInternal(e.prototype,class{toLocaleDateString(){
var B=arguments[0];
var C=arguments[1];
return toLocaleDateTime(
this,B,C,'date','date','dateformatdate');
}},-1);
%DefineMethodsInternal(e.prototype,class{toLocaleTimeString(){
var B=arguments[0];
var C=arguments[1];
return toLocaleDateTime(
this,B,C,'time','time','dateformattime');
}},-1);
})

dummy