diff --git a/Shrug-darwin-x64/LICENSE b/Shrug-darwin-x64/LICENSE new file mode 100644 index 0000000..4d231b4 --- /dev/null +++ b/Shrug-darwin-x64/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2014 GitHub Inc. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Electron Framework b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Electron Framework new file mode 120000 index 0000000..b0f7c45 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Electron Framework @@ -0,0 +1 @@ +Versions/Current/Electron Framework \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Libraries b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Libraries new file mode 120000 index 0000000..bc941ee --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Libraries @@ -0,0 +1 @@ +Versions/Current/Libraries \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Resources b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework new file mode 100755 index 0000000..aeff35f Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/ffmpegsumo.so b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/ffmpegsumo.so new file mode 100644 index 0000000..385c9c2 Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/ffmpegsumo.so differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib new file mode 100755 index 0000000..589d636 Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/Info.plist b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/Info.plist new file mode 100644 index 0000000..3fbb1fd --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,26 @@ + + + + + BuildMachineOSBuild + 13F34 + CFBundleExecutable + Electron Framework Framework + CFBundleIdentifier + com.github.electron.framework + CFBundleName + Electron Framework Framework + CFBundlePackageType + FMWK + DTSDKBuild + 13C64 + DTSDKName + macosx + DTXcode + 0511 + DTXcodeBuild + 5B1008 + NSSupportsAutomaticGraphicsSwitching + + + diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib new file mode 100644 index 0000000..2c70cf8 Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/content_shell.pak b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/content_shell.pak new file mode 100644 index 0000000..7ae41aa Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/content_shell.pak differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/crashpad_handler b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/crashpad_handler new file mode 100755 index 0000000..07c4204 Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/crashpad_handler differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/icudtl.dat b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/icudtl.dat new file mode 100644 index 0000000..11e4e06 Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/icudtl.dat differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/natives_blob.bin b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/natives_blob.bin new file mode 100644 index 0000000..aba2901 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/natives_blob.bin @@ -0,0 +1,17363 @@ + debugÖ– +"use strict"; +var kDefaultBacktraceLength=10; +var Debug={}; +var sourceLineBeginningSkip=/^(?:\s*(?:\/\*.*?\*\/)*)*/; +Debug.DebugEvent={Break:1, +Exception:2, +NewFunction:3, +BeforeCompile:4, +AfterCompile:5, +CompileError:6, +PromiseEvent:7, +AsyncTaskEvent:8, +BreakForCommand:9}; +Debug.ExceptionBreak={Caught:0, +Uncaught:1}; +Debug.StepAction={StepOut:0, +StepNext:1, +StepIn:2, +StepMin:3, +StepInMin:4, +StepFrame:5}; +Debug.ScriptType={Native:0, +Extension:1, +Normal:2}; +Debug.ScriptCompilationType={Host:0, +Eval:1, +JSON:2}; +Debug.ScriptBreakPointType={ScriptId:0, +ScriptName:1, +ScriptRegExp:2}; +Debug.BreakPositionAlignment={ +Statement:0, +BreakPosition:1 +}; +function ScriptTypeFlag(a){ +return(1<0){ +this.ignoreCount_--; +return false; +} +return true; +}; +function IsBreakPointTriggered(a,b){ +return b.isTriggered(MakeExecutionState(a)); +} +function ScriptBreakPoint(type,script_id_or_name,opt_line,opt_column, +opt_groupId,opt_position_alignment){ +this.type_=type; +if(type==Debug.ScriptBreakPointType.ScriptId){ +this.script_id_=script_id_or_name; +}else if(type==Debug.ScriptBreakPointType.ScriptName){ +this.script_name_=script_id_or_name; +}else if(type==Debug.ScriptBreakPointType.ScriptRegExp){ +this.script_regexp_object_=new RegExp(script_id_or_name); +}else{ +throw new Error("Unexpected breakpoint type "+type); +} +this.line_=opt_line||0; +this.column_=opt_column; +this.groupId_=opt_groupId; +this.position_alignment_=(opt_position_alignment===(void 0)) +?Debug.BreakPositionAlignment.Statement:opt_position_alignment; +this.hit_count_=0; +this.active_=true; +this.condition_=null; +this.ignoreCount_=0; +this.break_points_=[]; +} +ScriptBreakPoint.prototype.cloneForOtherScript=function(a){ +var b=new ScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId, +a.id,this.line_,this.column_,this.groupId_, +this.position_alignment_); +b.number_=next_break_point_number++; +script_break_points.push(b); +b.hit_count_=this.hit_count_; +b.active_=this.active_; +b.condition_=this.condition_; +b.ignoreCount_=this.ignoreCount_; +return b; +}; +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 a=[]; +for(var b=0;b=this.frameCount()){ +throw new Error('Illegal frame index.'); +} +return new FrameMirror(this.break_id,a); +}; +ExecutionState.prototype.setSelectedFrame=function(a){ +var b=%ToNumber(a); +if(b<0||b>=this.frameCount())throw new Error('Illegal frame index.'); +this.selected_frame=b; +}; +ExecutionState.prototype.selectedFrame=function(){ +return this.selected_frame; +}; +ExecutionState.prototype.debugCommandProcessor=function(a){ +return new DebugCommandProcessor(this,a); +}; +function MakeBreakEvent(a,b){ +return new BreakEvent(a,b); +} +function BreakEvent(a,b){ +this.frame_=new FrameMirror(a,0); +this.break_points_hit_=b; +} +BreakEvent.prototype.eventType=function(){ +return Debug.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_; +}; +BreakEvent.prototype.toJSONProtocol=function(){ +var a={seq:next_response_seq++, +type:"event", +event:"break", +body:{invocationText:this.frame_.invocationText()} +}; +var b=this.func().script(); +if(b){ +a.body.sourceLine=this.sourceLine(), +a.body.sourceColumn=this.sourceColumn(), +a.body.sourceLineText=this.sourceLineText(), +a.body.script=MakeScriptObject_(b,false); +} +if(this.breakPointsHit()){ +a.body.breakpoints=[]; +for(var c=0;c0){ +a.body.sourceLine=this.sourceLine(); +a.body.sourceColumn=this.sourceColumn(); +a.body.sourceLineText=this.sourceLineText(); +var b=this.func().script(); +if(b){ +a.body.script=MakeScriptObject_(b,false); +} +}else{ +a.body.sourceLine=-1; +} +return a.toJSONProtocol(); +}; +function MakeCompileEvent(a,b){ +return new CompileEvent(a,b); +} +function CompileEvent(a,b){ +this.script_=MakeMirror(a); +this.type_=b; +} +CompileEvent.prototype.eventType=function(){ +return this.type_; +}; +CompileEvent.prototype.script=function(){ +return this.script_; +}; +CompileEvent.prototype.toJSONProtocol=function(){ +var a=new ProtocolMessage(); +a.running=true; +switch(this.type_){ +case Debug.DebugEvent.BeforeCompile: +a.event="beforeCompile"; +break; +case Debug.DebugEvent.AfterCompile: +a.event="afterCompile"; +break; +case Debug.DebugEvent.CompileError: +a.event="compileError"; +break; +} +a.body={}; +a.body.script=this.script_; +return a.toJSONProtocol(); +}; +function MakeScriptObject_(a,b){ +var c={id:a.id(), +name:a.name(), +lineOffset:a.lineOffset(), +columnOffset:a.columnOffset(), +lineCount:a.lineCount(), +}; +if(!(a.data()===(void 0))){ +c.data=a.data(); +} +if(b){ +c.source=a.source(); +} +return c; +} +function MakePromiseEvent(a){ +return new PromiseEvent(a); +} +function PromiseEvent(a){ +this.promise_=a.promise; +this.parentPromise_=a.parentPromise; +this.status_=a.status; +this.value_=a.value; +} +PromiseEvent.prototype.promise=function(){ +return MakeMirror(this.promise_); +} +PromiseEvent.prototype.parentPromise=function(){ +return MakeMirror(this.parentPromise_); +} +PromiseEvent.prototype.status=function(){ +return this.status_; +} +PromiseEvent.prototype.value=function(){ +return MakeMirror(this.value_); +} +function MakeAsyncTaskEvent(a){ +return new AsyncTaskEvent(a); +} +function AsyncTaskEvent(a){ +this.type_=a.type; +this.name_=a.name; +this.id_=a.id; +} +AsyncTaskEvent.prototype.type=function(){ +return this.type_; +} +AsyncTaskEvent.prototype.name=function(){ +return this.name_; +} +AsyncTaskEvent.prototype.id=function(){ +return this.id_; +} +function DebugCommandProcessor(a,b){ +this.exec_state_=a; +this.running_=b||false; +} +DebugCommandProcessor.prototype.processDebugRequest=function(a){ +return this.processDebugJSONRequest(a); +}; +function ProtocolMessage(a){ +this.seq=next_response_seq++; +if(a){ +this.type='response'; +this.request_seq=a.seq; +this.command=a.command; +}else{ +this.type='event'; +} +this.success=true; +this.running=undefined; +} +ProtocolMessage.prototype.setOption=function(a,b){ +if(!this.options_){ +this.options_={}; +} +this.options_[a]=b; +}; +ProtocolMessage.prototype.failed=function(a,b){ +this.success=false; +this.message=a; +if((%_IsObject(b))){ +this.error_details=b; +} +}; +ProtocolMessage.prototype.toJSONProtocol=function(){ +var a={}; +a.seq=this.seq; +if(this.request_seq){ +a.request_seq=this.request_seq; +} +a.type=this.type; +if(this.event){ +a.event=this.event; +} +if(this.command){ +a.command=this.command; +} +if(this.success){ +a.success=this.success; +}else{ +a.success=false; +} +if(this.body){ +var b; +var c=MakeMirrorSerializer(true,this.options_); +if(this.body instanceof Mirror){ +b=c.serializeValue(this.body); +}else if(this.body instanceof Array){ +b=[]; +for(var d=0;d=this.exec_state_.frameCount()){ +return b.failed('Invalid frame "'+d+'"'); +} +b.body=this.exec_state_.frame(m).evaluate( +c,Boolean(g),i); +return; +}else{ +b.body=this.exec_state_.frame().evaluate( +c,Boolean(g),i); +return; +} +}; +DebugCommandProcessor.prototype.lookupRequest_=function(a,b){ +if(!a.arguments){ +return b.failed('Missing arguments'); +} +var c=a.arguments.handles; +if((c===(void 0))){ +return b.failed('Argument "handles" missing'); +} +if(!(a.arguments.includeSource===(void 0))){ +var d=%ToBoolean(a.arguments.includeSource); +b.setOption('includeSource',d); +} +var e={}; +for(var g=0;g=this.exec_state_.frameCount()){ +return b.failed('Invalid frame "'+e+'"'); +} +e=this.exec_state_.frame(g); +} +} +var h=e.func().script(); +if(!h){ +return b.failed('No source'); +} +var i=h.sourceSlice(c,d); +if(!i){ +return b.failed('Invalid line interval'); +} +b.body={}; +b.body.source=i.sourceText(); +b.body.fromLine=i.from_line; +b.body.toLine=i.to_line; +b.body.fromPosition=i.from_position; +b.body.toPosition=i.to_position; +b.body.totalLines=h.lineCount(); +}; +DebugCommandProcessor.prototype.scriptsRequest_=function(a,b){ +var c=ScriptTypeFlag(Debug.ScriptType.Normal); +var d=false; +var e=null; +if(a.arguments){ +if(!(a.arguments.types===(void 0))){ +c=%ToNumber(a.arguments.types); +if(isNaN(c)||c<0){ +return b.failed('Invalid types "'+ +a.arguments.types+'"'); +} +} +if(!(a.arguments.includeSource===(void 0))){ +d=%ToBoolean(a.arguments.includeSource); +b.setOption('includeSource',d); +} +if((%_IsArray(a.arguments.ids))){ +e={}; +var g=a.arguments.ids; +for(var h=0;h=0){ +n=true; +} +} +if(!n)continue; +} +if(c&ScriptTypeFlag(l[h].type)){ +b.body.push(MakeMirror(l[h])); +} +} +}; +DebugCommandProcessor.prototype.threadsRequest_=function(a,b){ +var c=this.exec_state_.threadCount(); +var d=[]; +for(var e=0;e=this.exec_state_.frameCount()){ +return response.failed('Invalid frame "'+a+'"'); +} +b=this.exec_state_.frame(c); +}else{ +b=this.exec_state_.frame(); +} +var d=Debug.LiveEdit.RestartFrame(b); +response.body={result:d}; +}; +DebugCommandProcessor.prototype.debuggerFlagsRequest_=function(request, +response){ +if(!request.arguments){ +response.failed('Missing arguments'); +return; +} +var a=request.arguments.flags; +response.body={flags:[]}; +if(!(a===(void 0))){ +for(var b=0;b"; +}; +function ValueMirror(a,b,c){ +%_CallFunction(this,a,Mirror); +this.value_=b; +if(!c){ +this.allocateHandle_(); +}else{ +this.allocateTransientHandle_(); +} +} +inherits(ValueMirror,Mirror); +Mirror.prototype.handle=function(){ +return this.handle_; +}; +ValueMirror.prototype.isPrimitive=function(){ +var a=this.type(); +return a==='undefined'|| +a==='null'|| +a==='boolean'|| +a==='number'|| +a==='string'|| +a==='symbol'; +}; +ValueMirror.prototype.value=function(){ +return this.value_; +}; +function UndefinedMirror(){ +%_CallFunction(this,UNDEFINED_TYPE,(void 0),ValueMirror); +} +inherits(UndefinedMirror,ValueMirror); +UndefinedMirror.prototype.toText=function(){ +return'undefined'; +}; +function NullMirror(){ +%_CallFunction(this,NULL_TYPE,null,ValueMirror); +} +inherits(NullMirror,ValueMirror); +NullMirror.prototype.toText=function(){ +return'null'; +}; +function BooleanMirror(a){ +%_CallFunction(this,BOOLEAN_TYPE,a,ValueMirror); +} +inherits(BooleanMirror,ValueMirror); +BooleanMirror.prototype.toText=function(){ +return this.value_?'true':'false'; +}; +function NumberMirror(a){ +%_CallFunction(this,NUMBER_TYPE,a,ValueMirror); +} +inherits(NumberMirror,ValueMirror); +NumberMirror.prototype.toText=function(){ +return %_NumberToString(this.value_); +}; +function StringMirror(a){ +%_CallFunction(this,STRING_TYPE,a,ValueMirror); +} +inherits(StringMirror,ValueMirror); +StringMirror.prototype.length=function(){ +return this.value_.length; +}; +StringMirror.prototype.getTruncatedValue=function(a){ +if(a!=-1&&this.length()>a){ +return this.value_.substring(0,a)+ +'... (length: '+this.length()+')'; +} +return this.value_; +}; +StringMirror.prototype.toText=function(){ +return this.getTruncatedValue(kMaxProtocolStringLength); +}; +function SymbolMirror(a){ +%_CallFunction(this,SYMBOL_TYPE,a,ValueMirror); +} +inherits(SymbolMirror,ValueMirror); +SymbolMirror.prototype.description=function(){ +return %SymbolDescription(%_ValueOf(this.value_)); +} +SymbolMirror.prototype.toText=function(){ +return %_CallFunction(this.value_,builtins.$symbolToString); +} +function ObjectMirror(a,b,c){ +%_CallFunction(this,b||OBJECT_TYPE,a,c,ValueMirror); +} +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 a=%GetInterceptorInfo(this.value_); +return(a&2)!=0; +}; +ObjectMirror.prototype.hasIndexedInterceptor=function(){ +var a=%GetInterceptorInfo(this.value_); +return(a&1)!=0; +}; +function TryGetPropertyNames(a){ +try{ +return %GetOwnPropertyNames(a,32); +}catch(e){ +return[]; +} +} +ObjectMirror.prototype.propertyNames=function(a,b){ +a=a||PropertyKind.Named|PropertyKind.Indexed; +var c; +var d; +var e=0; +if(a&PropertyKind.Named){ +c=TryGetPropertyNames(this.value_); +e+=c.length; +if(this.hasNamedInterceptor()&&(a&PropertyKind.Named)){ +var g= +%GetNamedInterceptorPropertyNames(this.value_); +if(g){ +c=c.concat(g); +e+=g.length; +} +} +} +if(a&PropertyKind.Indexed){ +d=%GetOwnElementNames(this.value_); +e+=d.length; +if(this.hasIndexedInterceptor()&&(a&PropertyKind.Indexed)){ +var h= +%GetIndexedInterceptorElementNames(this.value_); +if(h){ +d=d.concat(h); +e+=h.length; +} +} +} +b=Math.min(b||e,e); +var i=new Array(b); +var j=0; +if(a&PropertyKind.Named){ +for(var k=0;j'; +}; +ObjectMirror.GetInternalProperties=function(a){ +if((%_ClassOf(a)==='String')||(%_ClassOf(a)==='Number')|| +(%_ClassOf(a)==='Boolean')){ +var b=%_ValueOf(a); +return[new InternalPropertyMirror("[[PrimitiveValue]]",b)]; +}else if((%_IsFunction(a))){ +var c=%BoundFunctionGetBindings(a); +var d=[]; +if(c&&(%_IsArray(c))){ +d.push(new InternalPropertyMirror("[[TargetFunction]]", +c[0])); +d.push(new InternalPropertyMirror("[[BoundThis]]",c[1])); +var e=[]; +for(var g=2;gb)return new Array(); +var c=new Array(b-a+1); +for(var d=a;d<=b;d++){ +var e=%DebugGetPropertyDetails(this.value_,%ToString(d)); +var g; +if(e){ +g=new PropertyMirror(this,d,e); +}else{ +g=GetUndefinedMirror(); +} +c[d-a]=g; +} +return c; +}; +function DateMirror(a){ +%_CallFunction(this,a,ObjectMirror); +} +inherits(DateMirror,ObjectMirror); +DateMirror.prototype.toText=function(){ +var a=JSON.stringify(this.value_); +return a.substring(1,a.length-1); +}; +function RegExpMirror(a){ +%_CallFunction(this,a,REGEXP_TYPE,ObjectMirror); +} +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(a){ +%_CallFunction(this,a,ERROR_TYPE,ObjectMirror); +} +inherits(ErrorMirror,ObjectMirror); +ErrorMirror.prototype.message=function(){ +return this.value_.message; +}; +ErrorMirror.prototype.toText=function(){ +var a; +try{ +a=%_CallFunction(this.value_,builtins.ErrorToString); +}catch(e){ +a='#'; +} +return a; +}; +function PromiseMirror(a){ +%_CallFunction(this,a,PROMISE_TYPE,ObjectMirror); +} +inherits(PromiseMirror,ObjectMirror); +function PromiseGetStatus_(a){ +var b=%DebugGetProperty(a,builtins.promiseStatus); +if(b==0)return"pending"; +if(b==1)return"resolved"; +return"rejected"; +} +function PromiseGetValue_(a){ +return %DebugGetProperty(a,builtins.promiseValue); +} +PromiseMirror.prototype.status=function(){ +return PromiseGetStatus_(this.value_); +}; +PromiseMirror.prototype.promiseValue=function(){ +return MakeMirror(PromiseGetValue_(this.value_)); +}; +function MapMirror(a){ +%_CallFunction(this,a,MAP_TYPE,ObjectMirror); +} +inherits(MapMirror,ObjectMirror); +MapMirror.prototype.entries=function(a){ +var b=[]; +if((%_ClassOf(this.value_)==='WeakMap')){ +var c=%GetWeakMapEntries(this.value_,a||0); +for(var d=0;d3){ +this.exception_=c[3]; +this.getter_=c[4]; +this.setter_=c[5]; +} +} +inherits(PropertyMirror,Mirror); +PropertyMirror.prototype.isReadOnly=function(){ +return(this.attributes()&PropertyAttribute.ReadOnly)!=0; +}; +PropertyMirror.prototype.isEnum=function(){ +return(this.attributes()&PropertyAttribute.DontEnum)==0; +}; +PropertyMirror.prototype.canDelete=function(){ +return(this.attributes()&PropertyAttribute.DontDelete)==0; +}; +PropertyMirror.prototype.name=function(){ +return this.name_; +}; +PropertyMirror.prototype.isIndexed=function(){ +for(var a=0;a0; +}; +FrameDetails.prototype.inlinedFrameIndex=function(){ +%CheckExecutionState(this.break_id_); +var a=kFrameDetailsFlagInlinedFrameIndexMask; +return(this.details_[kFrameDetailsFlagsIndex]&a)>>2; +}; +FrameDetails.prototype.argumentCount=function(){ +%CheckExecutionState(this.break_id_); +return this.details_[kFrameDetailsArgumentCountIndex]; +}; +FrameDetails.prototype.argumentName=function(a){ +%CheckExecutionState(this.break_id_); +if(a>=0&&a=0&&a=0&&a=0&&a0){ +for(var c=0;c0){ +a+=this.lineOffset(); +a+='-'; +a+=this.lineOffset()+this.lineCount()-1; +}else{ +a+=this.lineCount(); +} +a+=')'; +return a; +}; +function ContextMirror(a){ +%_CallFunction(this,CONTEXT_TYPE,Mirror); +this.data_=a; +this.allocateHandle_(); +} +inherits(ContextMirror,Mirror); +ContextMirror.prototype.data=function(){ +return this.data_; +}; +function MakeMirrorSerializer(a,b){ +return new JSONProtocolSerializer(a,b); +} +function JSONProtocolSerializer(a,b){ +this.details_=a; +this.options_=b; +this.mirrors_=[]; +} +JSONProtocolSerializer.prototype.serializeReference=function(a){ +return this.serialize_(a,true,true); +}; +JSONProtocolSerializer.prototype.serializeValue=function(a){ +var b=this.serialize_(a,false,true); +return b; +}; +JSONProtocolSerializer.prototype.serializeReferencedObjects=function(){ +var a=[]; +var b=this.mirrors_.length; +for(var c=0;cthis.maxStringLength_()){ +var b=mirror.getTruncatedValue(this.maxStringLength_()); +a.value=b; +a.fromIndex=0; +a.toIndex=this.maxStringLength_(); +}else{ +a.value=mirror.value(); +} +a.length=mirror.length(); +break; +case SYMBOL_TYPE: +a.description=mirror.description(); +break; +case OBJECT_TYPE: +case FUNCTION_TYPE: +case ERROR_TYPE: +case REGEXP_TYPE: +case PROMISE_TYPE: +case GENERATOR_TYPE: +this.serializeObject_(mirror,a,details); +break; +case PROPERTY_TYPE: +case INTERNAL_PROPERTY_TYPE: +throw new Error('PropertyMirror cannot be serialized independently'); +break; +case FRAME_TYPE: +this.serializeFrame_(mirror,a); +break; +case SCOPE_TYPE: +this.serializeScope_(mirror,a); +break; +case SCRIPT_TYPE: +if(mirror.name()){ +a.name=mirror.name(); +} +a.id=mirror.id(); +a.lineOffset=mirror.lineOffset(); +a.columnOffset=mirror.columnOffset(); +a.lineCount=mirror.lineCount(); +if(mirror.data()){ +a.data=mirror.data(); +} +if(this.includeSource_()){ +a.source=mirror.source(); +}else{ +var c=mirror.source().substring(0,80); +a.sourceStart=c; +} +a.sourceLength=mirror.source().length; +a.scriptType=mirror.scriptType(); +a.compilationType=mirror.compilationType(); +if(mirror.compilationType()==1&& +mirror.evalFromScript()){ +a.evalFromScript= +this.serializeReference(mirror.evalFromScript()); +var d=mirror.evalFromLocation(); +if(d){ +a.evalFromLocation={line:d.line, +column:d.column}; +} +if(mirror.evalFromFunctionName()){ +a.evalFromFunctionName=mirror.evalFromFunctionName(); +} +} +if(mirror.context()){ +a.context=this.serializeReference(mirror.context()); +} +break; +case CONTEXT_TYPE: +a.data=mirror.data(); +break; +} +a.text=mirror.toText(); +return a; +}; +JSONProtocolSerializer.prototype.serializeObject_=function(mirror,content, +details){ +content.className=mirror.className(); +content.constructorFunction= +this.serializeReference(mirror.constructorFunction()); +content.protoObject=this.serializeReference(mirror.protoObject()); +content.prototypeObject=this.serializeReference(mirror.prototypeObject()); +if(mirror.hasNamedInterceptor()){ +content.namedInterceptor=true; +} +if(mirror.hasIndexedInterceptor()){ +content.indexedInterceptor=true; +} +if(mirror.isFunction()){ +content.name=mirror.name(); +if(!(mirror.inferredName()===(void 0))){ +content.inferredName=mirror.inferredName(); +} +content.resolved=mirror.resolved(); +if(mirror.resolved()){ +content.source=mirror.source(); +} +if(mirror.script()){ +content.script=this.serializeReference(mirror.script()); +content.scriptId=mirror.script().id(); +serializeLocationFields(mirror.sourceLocation(),content); +} +content.scopes=[]; +for(var a=0;a0){ +var i=[]; +for(var a=0;a0){ +return'Infinity'; +}else{ +return'-Infinity'; +} +} +return a; +} + + liveeditÁø +"use strict"; +Debug.LiveEdit=new function(){ +var a; +var b="stack_update_needs_step_in"; +function ApplyPatchMultiChunk(script,diff_array,new_source,preview_only, +change_log){ +var c=script.source; +var d=GatherCompileInfo(c,script); +var e=BuildCodeInfoTree(d); +var g=new PosTranslator(diff_array); +MarkChangedFunctions(e,g.GetChunks()); +FindLiveSharedInfos(e,script); +var h; +try{ +h=GatherCompileInfo(new_source,script); +}catch(e){ +var i= +new Failure("Failed to compile new version of script: "+e); +if(e instanceof SyntaxError){ +var j={ +type:"liveedit_compile_error", +syntaxErrorMessage:e.message +}; +CopyErrorPositionToDetails(e,j); +i.details=j; +} +throw i; +} +var k=BuildCodeInfoTree(h); +FindCorrespondingFunctions(e,k); +var l=new Array(); +var m=new Array(); +var n=new Array(); +var o=new Array(); +function HarvestTodo(p){ +function CollectDamaged(q){ +m.push(q); +for(var r=0;rI[x].start_position){ +K=x; +} +} +if(K!=r){ +var L=I[K]; +var M=J[K]; +I[K]=I[r]; +J[K]=J[r]; +I[r]=L; +J[r]=M; +} +} +var N=0; +function ResetIndexes(O,P){ +var Q=-1; +while(N=aE.pos1+aE.len1){ +return ay+aE.pos2+aE.len2-aE.pos1-aE.len1; +} +if(!az){ +az=PosTranslator.DefaultInsideChunkHandler; +} +return az(ay,aE); +}; +PosTranslator.DefaultInsideChunkHandler=function(ay,aF){ +Assert(false,"Cannot translate position in changed area"); +}; +PosTranslator.ShiftWithTopInsideChunkHandler= +function(ay,aF){ +return ay-aF.pos1+aF.pos2; +}; +var a={ +UNCHANGED:"unchanged", +SOURCE_CHANGED:"source changed", +CHANGED:"changed", +DAMAGED:"damaged" +}; +function CodeInfoTreeNode(aG,aH,aI){ +this.info=aG; +this.children=aH; +this.array_index=aI; +this.parent=(void 0); +this.status=a.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(aJ){ +var aK=0; +function BuildNode(){ +var aL=aK; +aK++; +var aM=new Array(); +while(aK=as.length;}; +this.TranslatePos=function(ay){return ay+aR;}; +}; +function ProcessInternals(aS){ +aS.new_start_pos=aP.TranslatePos( +aS.info.start_position); +var aT=0; +var aU=false; +var aV=false; +while(!aP.done()&& +aP.current().pos1= +aP.current().pos1+aP.current().len1){ +aU=true; +aP.next(); +continue; +}else if(aW.info.start_position<=aP.current().pos1&& +aW.info.end_position>=aP.current().pos1+ +aP.current().len1){ +ProcessInternals(aW); +aV=aV|| +(aW.status!=a.UNCHANGED); +aU=aU|| +(aW.status==a.DAMAGED); +aT++; +continue; +}else{ +aU=true; +aW.status=a.DAMAGED; +aW.status_explanation= +"Text diff overlaps with function boundary"; +aT++; +continue; +} +}else{ +if(aP.current().pos1+aP.current().len1<= +aS.info.end_position){ +aS.status=a.CHANGED; +aP.next(); +continue; +}else{ +aS.status=a.DAMAGED; +aS.status_explanation= +"Text diff overlaps with function boundary"; +return; +} +} +Assert("Unreachable",false); +} +while(aT0){ +return bj; +} +} +function TraverseTree(q){ +q.live_shared_function_infos=FindFunctionInfos(q.info); +for(var r=0;r ["+br+"]"; +} +return; +} +var bs; +function CheckStackActivations(bt,S){ +var bu=new Array(); +for(var r=0;r0){ +S.push({dropped_from_stack:bx}); +} +if(bw.length>0){ +S.push({functions_on_stack:bw}); +throw new Failure("Blocked by functions on stack"); +} +return bx.length; +} +var bs={ +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 +}; +bs.SymbolName=function(bA){ +var bB=bs; +for(var bC in bB){ +if(bB[bC]==bA){ +return bC; +} +} +}; +function Failure(am){ +this.message=am; +} +this.Failure=Failure; +Failure.prototype.toString=function(){ +return"LiveEdit Failure: "+this.message; +}; +function CopyErrorPositionToDetails(bD,j){ +function createPositionStruct(G,bE){ +if(bE==-1)return; +var bF=G.locationFromPosition(bE,true); +if(bF==null)return; +return{ +line:bF.line+1, +column:bF.column+1, +position:bE +}; +} +if(!("scriptObject"in bD)||!("startPosition"in bD)){ +return; +} +var G=bD.scriptObject; +var bG={ +start:createPositionStruct(G,bD.startPosition), +end:createPositionStruct(G,bD.endPosition) +}; +j.position=bG; +} +function GetPcFromSourcePos(bH,bI){ +return %GetFunctionCodePositionFromSource(bH,bI); +} +this.GetPcFromSourcePos=GetPcFromSourcePos; +function SetScriptSource(G,bJ,bK,S){ +var c=G.source; +var bL=CompareStrings(c,bJ); +return ApplyPatchMultiChunk(G,bL,bJ,bK, +S); +} +this.SetScriptSource=SetScriptSource; +function CompareStrings(bM,bN){ +return %LiveEditCompareStrings(bM,bN); +} +function ApplySingleChunkPatch(G,change_pos,change_len,new_str, +S){ +var c=G.source; +var bJ=c.substring(0,change_pos)+ +new_str+c.substring(change_pos+change_len); +return ApplyPatchMultiChunk(G, +[change_pos,change_pos+change_len,change_pos+new_str.length], +bJ,false,S); +} +function DescribeChangeTree(aX){ +function ProcessOldNode(q){ +var bO=[]; +for(var r=0;r=0&&b<0x800000&& +(%_ClassOf(this)==='Function')){ +return b; +} +} +b=(a==null)?0:%ToUint32(a.length); +if(b>0x800000){ +throw %MakeRangeError('stack_overflow',[]); +} +if(!(%_ClassOf(this)==='Function')){ +throw %MakeTypeError('apply_non_function', +[%ToString(this),typeof this]); +} +if(a!=null&&!(%_IsSpecObject(a))){ +throw %MakeTypeError('apply_wrong_args',[]); +} +return b; +} +function REFLECT_APPLY_PREPARE(a){ +var b; +if((%_IsArray(a))){ +b=a.length; +if(%_IsSmi(b)&&b>=0&&b<0x800000&& +(%_ClassOf(this)==='Function')){ +return b; +} +} +if(!(%_ClassOf(this)==='Function')){ +throw %MakeTypeError('called_non_callable',[%ToString(this)]); +} +if(!(%_IsSpecObject(a))){ +throw %MakeTypeError('reflect_apply_wrong_args',[]); +} +b=%ToLength(a.length); +if(b>0x800000){ +throw %MakeRangeError('stack_overflow',[]); +} +return b; +} +function REFLECT_CONSTRUCT_PREPARE(a,b){ +var c; +var d=(%_ClassOf(this)==='Function')&&%IsConstructor(this); +var e=(%_ClassOf(b)==='Function')&&%IsConstructor(b); +if((%_IsArray(a))){ +c=a.length; +if(%_IsSmi(c)&&c>=0&&c<0x800000&& +d&&e){ +return c; +} +} +if(!d){ +if(!(%_ClassOf(this)==='Function')){ +throw %MakeTypeError('called_non_callable',[%ToString(this)]); +}else{ +throw %MakeTypeError('not_constructor',[%ToString(this)]); +} +} +if(!e){ +if(!(%_ClassOf(b)==='Function')){ +throw %MakeTypeError('called_non_callable',[%ToString(b)]); +}else{ +throw %MakeTypeError('not_constructor',[%ToString(b)]); +} +} +if(!(%_IsSpecObject(a))){ +throw %MakeTypeError('reflect_construct_wrong_args',[]); +} +c=%ToLength(a.length); +if(c>0x800000){ +throw %MakeRangeError('stack_overflow',[]); +} +return c; +} +function STACK_OVERFLOW(a){ +throw %MakeRangeError('stack_overflow',[]); +} +function TO_OBJECT(){ +return %ToObject(this); +} +function TO_NUMBER(){ +return %ToNumber(this); +} +function TO_STRING(){ +return %ToString(this); +} +function TO_NAME(){ +return %ToName(this); +} +function ToPrimitive(a,b){ +if((typeof(a)==='string'))return a; +if(!(%_IsSpecObject(a)))return a; +if((%_ClassOf(a)==='Symbol'))throw MakeTypeError('symbol_to_primitive',[]); +if(b==0)b=((%_ClassOf(a)==='Date'))?2:1; +return(b==1)?%DefaultNumber(a):%DefaultString(a); +} +function ToBoolean(a){ +if((typeof(a)==='boolean'))return a; +if((typeof(a)==='string'))return a.length!=0; +if(a==null)return false; +if((typeof(a)==='number'))return!((a==0)||(!%_IsSmi(%IS_VAR(a))&&!(a==a))); +return true; +} +function ToNumber(a){ +if((typeof(a)==='number'))return a; +if((typeof(a)==='string')){ +return %_HasCachedArrayIndex(a)?%_GetCachedArrayIndex(a) +:%StringToNumber(a); +} +if((typeof(a)==='boolean'))return a?1:0; +if((a===(void 0)))return $NaN; +if((typeof(a)==='symbol'))throw MakeTypeError('symbol_to_number',[]); +return((a===null))?0:ToNumber(%DefaultNumber(a)); +} +function NonNumberToNumber(a){ +if((typeof(a)==='string')){ +return %_HasCachedArrayIndex(a)?%_GetCachedArrayIndex(a) +:%StringToNumber(a); +} +if((typeof(a)==='boolean'))return a?1:0; +if((a===(void 0)))return $NaN; +if((typeof(a)==='symbol'))throw MakeTypeError('symbol_to_number',[]); +return((a===null))?0:ToNumber(%DefaultNumber(a)); +} +function ToString(a){ +if((typeof(a)==='string'))return a; +if((typeof(a)==='number'))return %_NumberToString(a); +if((typeof(a)==='boolean'))return a?'true':'false'; +if((a===(void 0)))return'undefined'; +if((typeof(a)==='symbol'))throw %MakeTypeError('symbol_to_string',[]); +return((a===null))?'null':%ToString(%DefaultString(a)); +} +function NonStringToString(a){ +if((typeof(a)==='number'))return %_NumberToString(a); +if((typeof(a)==='boolean'))return a?'true':'false'; +if((a===(void 0)))return'undefined'; +if((typeof(a)==='symbol'))throw %MakeTypeError('symbol_to_string',[]); +return((a===null))?'null':%ToString(%DefaultString(a)); +} +function ToName(a){ +return(typeof(a)==='symbol')?a:%ToString(a); +} +function ToObject(a){ +if((typeof(a)==='string'))return new $String(a); +if((typeof(a)==='number'))return new $Number(a); +if((typeof(a)==='boolean'))return new $Boolean(a); +if((typeof(a)==='symbol'))return %NewSymbolWrapper(a); +if((a==null)&&!(%_IsUndetectableObject(a))){ +throw %MakeTypeError('undefined_or_null_to_object',[]); +} +return a; +} +function ToInteger(a){ +if(%_IsSmi(a))return a; +return %NumberToInteger(ToNumber(a)); +} +function ToLength(a){ +a=ToInteger(a); +if(a<0)return 0; +return a<$Number.MAX_SAFE_INTEGER?a:$Number.MAX_SAFE_INTEGER; +} +function ToUint32(a){ +if(%_IsSmi(a)&&a>=0)return a; +return %NumberToJSUint32(ToNumber(a)); +} +function ToInt32(a){ +if(%_IsSmi(a))return a; +return %NumberToJSInt32(ToNumber(a)); +} +function SameValue(a,b){ +if(typeof a!=typeof b)return false; +if((typeof(a)==='number')){ +if((!%_IsSmi(%IS_VAR(a))&&!(a==a))&&(!%_IsSmi(%IS_VAR(b))&&!(b==b)))return true; +if(a===0&&b===0&&%_IsMinusZero(a)!=%_IsMinusZero(b)){ +return false; +} +} +return a===b; +} +function SameValueZero(a,b){ +if(typeof a!=typeof b)return false; +if((typeof(a)==='number')){ +if((!%_IsSmi(%IS_VAR(a))&&!(a==a))&&(!%_IsSmi(%IS_VAR(b))&&!(b==b)))return true; +} +return a===b; +} +function IsPrimitive(a){ +return!(%_IsSpecObject(a)); +} +function IsConcatSpreadable(a){ +if(!(%_IsSpecObject(a)))return false; +var b=a[symbolIsConcatSpreadable]; +if((b===(void 0)))return(%_IsArray(a)); +return ToBoolean(b); +} +function DefaultNumber(a){ +if(!(%_ClassOf(a)==='Symbol')){ +var b=a.valueOf; +if((%_ClassOf(b)==='Function')){ +var c=%_CallFunction(a,b); +if(%IsPrimitive(c))return c; +} +var d=a.toString; +if((%_ClassOf(d)==='Function')){ +var e=%_CallFunction(a,d); +if(%IsPrimitive(e))return e; +} +} +throw %MakeTypeError('cannot_convert_to_primitive',[]); +} +function DefaultString(a){ +if(!(%_ClassOf(a)==='Symbol')){ +var b=a.toString; +if((%_ClassOf(b)==='Function')){ +var c=%_CallFunction(a,b); +if(%IsPrimitive(c))return c; +} +var d=a.valueOf; +if((%_ClassOf(d)==='Function')){ +var e=%_CallFunction(a,d); +if(%IsPrimitive(e))return e; +} +} +throw %MakeTypeError('cannot_convert_to_primitive',[]); +} +function ToPositiveInteger(a,b){ +var c=(%_IsSmi(%IS_VAR(a))?a:%NumberToIntegerMapMinusZero(ToNumber(a))); +if(c<0)throw MakeRangeError(b); +return c; +} +%FunctionSetPrototype($Array,new $Array(0)); +function STRING_LENGTH_STUB(a){ +var b=this; +return %_StringGetLength(%_JSValueGetValue(b)); +} + +$v8natives’ø +var $isNaN=GlobalIsNaN; +var $isFinite=GlobalIsFinite; +function InstallFunctions(a,b,c){ +if(c.length>=8){ +%OptimizeObjectForAddingMultipleProperties(a,c.length>>1); +} +for(var d=0;d=4){ +%OptimizeObjectForAddingMultipleProperties(a,b.length>>1); +} +var c=2|4|1; +for(var d=0;d>1)+(b?b.length:0); +if(e>=4){ +%OptimizeObjectForAddingMultipleProperties(d,e); +} +if(b){ +for(var g=0;g>0)); +if(!(b==0||(2<=b&&b<=36))){ +return $NaN; +} +} +if(%_HasCachedArrayIndex(a)&& +(b==0||b==10)){ +return %_GetCachedArrayIndex(a); +} +return %StringParseInt(a,b); +} +function GlobalParseFloat(a){ +a=((typeof(%IS_VAR(a))==='string')?a:NonStringToString(a)); +if(%_HasCachedArrayIndex(a))return %_GetCachedArrayIndex(a); +return %StringParseFloat(a); +} +function GlobalEval(a){ +if(!(typeof(a)==='string'))return a; +var b=%GlobalProxy(global); +var c=%CompileString(a,false,0); +if(!(%_IsFunction(c)))return c; +return %_CallFunction(b,c); +} +function SetUpGlobal(){ +%CheckIsBootstrapping(); +var a=2|4|1; +%AddNamedProperty(global,"NaN",$NaN,a); +%AddNamedProperty(global,"Infinity",(1/0),a); +%AddNamedProperty(global,"undefined",(void 0),a); +InstallFunctions(global,2,$Array( +"isNaN",GlobalIsNaN, +"isFinite",GlobalIsFinite, +"parseInt",GlobalParseInt, +"parseFloat",GlobalParseFloat, +"eval",GlobalEval +)); +} +SetUpGlobal(); +var DefaultObjectToString=NoSideEffectsObjectToString; +function NoSideEffectsObjectToString(){ +if((this===(void 0))&&!(%_IsUndetectableObject(this)))return"[object Undefined]"; +if((this===null))return"[object Null]"; +return"[object "+%_ClassOf(((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)))+"]"; +} +function ObjectToLocaleString(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["Object.prototype.toLocaleString"]); +return this.toString(); +} +function ObjectValueOf(){ +return((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)); +} +function ObjectHasOwnProperty(a){ +if(%_IsJSProxy(this)){ +if((typeof(a)==='symbol'))return false; +var b=%GetHandler(this); +return CallTrap1(b,"hasOwn",DerivedHasOwnTrap,ToName(a)); +} +return %HasOwnProperty(((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)),ToName(a)); +} +function ObjectIsPrototypeOf(a){ +if(!(%_IsSpecObject(a)))return false; +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["Object.prototype.isPrototypeOf"]); +return %IsInPrototypeChain(this,a); +} +function ObjectPropertyIsEnumerable(a){ +var b=ToName(a); +if(%_IsJSProxy(this)){ +if((typeof(a)==='symbol'))return false; +var c=GetOwnPropertyJS(this,b); +return(c===(void 0))?false:c.isEnumerable(); +} +return %IsPropertyEnumerable(((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)),b); +} +function ObjectDefineGetter(a,b){ +var c=this; +if(c==null&&!(%_IsUndetectableObject(c))){ +c=%GlobalProxy(global); +} +if(!(%_ClassOf(b)==='Function')){ +throw new $TypeError( +'Object.prototype.__defineGetter__: Expecting function'); +} +var d=new PropertyDescriptor(); +d.setGet(b); +d.setEnumerable(true); +d.setConfigurable(true); +DefineOwnProperty(((%_IsSpecObject(%IS_VAR(c)))?c:ToObject(c)),ToName(a),d,false); +} +function ObjectLookupGetter(a){ +var b=this; +if(b==null&&!(%_IsUndetectableObject(b))){ +b=%GlobalProxy(global); +} +return %LookupAccessor(((%_IsSpecObject(%IS_VAR(b)))?b:ToObject(b)),ToName(a),0); +} +function ObjectDefineSetter(a,b){ +var c=this; +if(c==null&&!(%_IsUndetectableObject(c))){ +c=%GlobalProxy(global); +} +if(!(%_ClassOf(b)==='Function')){ +throw new $TypeError( +'Object.prototype.__defineSetter__: Expecting function'); +} +var d=new PropertyDescriptor(); +d.setSet(b); +d.setEnumerable(true); +d.setConfigurable(true); +DefineOwnProperty(((%_IsSpecObject(%IS_VAR(c)))?c:ToObject(c)),ToName(a),d,false); +} +function ObjectLookupSetter(a){ +var b=this; +if(b==null&&!(%_IsUndetectableObject(b))){ +b=%GlobalProxy(global); +} +return %LookupAccessor(((%_IsSpecObject(%IS_VAR(b)))?b:ToObject(b)),ToName(a),1); +} +function ObjectKeys(a){ +a=((%_IsSpecObject(%IS_VAR(a)))?a:ToObject(a)); +if(%_IsJSProxy(a)){ +var b=%GetHandler(a); +var c=CallTrap0(b,"keys",DerivedKeysTrap); +return ToNameArray(c,"keys",false); +} +return %OwnKeys(a); +} +function IsAccessorDescriptor(a){ +if((a===(void 0)))return false; +return a.hasGetter()||a.hasSetter(); +} +function IsDataDescriptor(a){ +if((a===(void 0)))return false; +return a.hasValue()||a.hasWritable(); +} +function IsGenericDescriptor(a){ +if((a===(void 0)))return false; +return!(IsAccessorDescriptor(a)||IsDataDescriptor(a)); +} +function IsInconsistentDescriptor(a){ +return IsAccessorDescriptor(a)&&IsDataDescriptor(a); +} +function FromPropertyDescriptor(a){ +if((a===(void 0)))return a; +if(IsDataDescriptor(a)){ +return{value:a.getValue(), +writable:a.isWritable(), +enumerable:a.isEnumerable(), +configurable:a.isConfigurable()}; +} +return{get:a.getGet(), +set:a.getSet(), +enumerable:a.isEnumerable(), +configurable:a.isConfigurable()}; +} +function FromGenericPropertyDescriptor(a){ +if((a===(void 0)))return a; +var b=new $Object(); +if(a.hasValue()){ +%AddNamedProperty(b,"value",a.getValue(),0); +} +if(a.hasWritable()){ +%AddNamedProperty(b,"writable",a.isWritable(),0); +} +if(a.hasGetter()){ +%AddNamedProperty(b,"get",a.getGet(),0); +} +if(a.hasSetter()){ +%AddNamedProperty(b,"set",a.getSet(),0); +} +if(a.hasEnumerable()){ +%AddNamedProperty(b,"enumerable",a.isEnumerable(),0); +} +if(a.hasConfigurable()){ +%AddNamedProperty(b,"configurable",a.isConfigurable(),0); +} +return b; +} +function ToPropertyDescriptor(a){ +if(!(%_IsSpecObject(a))){ +throw MakeTypeError("property_desc_object",[a]); +} +var b=new PropertyDescriptor(); +if("enumerable"in a){ +b.setEnumerable(ToBoolean(a.enumerable)); +} +if("configurable"in a){ +b.setConfigurable(ToBoolean(a.configurable)); +} +if("value"in a){ +b.setValue(a.value); +} +if("writable"in a){ +b.setWritable(ToBoolean(a.writable)); +} +if("get"in a){ +var c=a.get; +if(!(c===(void 0))&&!(%_ClassOf(c)==='Function')){ +throw MakeTypeError("getter_must_be_callable",[c]); +} +b.setGet(c); +} +if("set"in a){ +var d=a.set; +if(!(d===(void 0))&&!(%_ClassOf(d)==='Function')){ +throw MakeTypeError("setter_must_be_callable",[d]); +} +b.setSet(d); +} +if(IsInconsistentDescriptor(b)){ +throw MakeTypeError("value_and_accessor",[a]); +} +return b; +} +function ToCompletePropertyDescriptor(a){ +var b=ToPropertyDescriptor(a); +if(IsGenericDescriptor(b)||IsDataDescriptor(b)){ +if(!b.hasValue())b.setValue((void 0)); +if(!b.hasWritable())b.setWritable(false); +}else{ +if(!b.hasGetter())b.setGet((void 0)); +if(!b.hasSetter())b.setSet((void 0)); +} +if(!b.hasEnumerable())b.setEnumerable(false); +if(!b.hasConfigurable())b.setConfigurable(false); +return b; +} +function PropertyDescriptor(){ +this.value_=(void 0); +this.hasValue_=false; +this.writable_=false; +this.hasWritable_=false; +this.enumerable_=false; +this.hasEnumerable_=false; +this.configurable_=false; +this.hasConfigurable_=false; +this.get_=(void 0); +this.hasGetter_=false; +this.set_=(void 0); +this.hasSetter_=false; +} +SetUpLockedPrototype(PropertyDescriptor,$Array( +"value_", +"hasValue_", +"writable_", +"hasWritable_", +"enumerable_", +"hasEnumerable_", +"configurable_", +"hasConfigurable_", +"get_", +"hasGetter_", +"set_", +"hasSetter_" +),$Array( +"toString",function PropertyDescriptor_ToString(){ +return"[object PropertyDescriptor]"; +}, +"setValue",function PropertyDescriptor_SetValue(a){ +this.value_=a; +this.hasValue_=true; +}, +"getValue",function PropertyDescriptor_GetValue(){ +return this.value_; +}, +"hasValue",function PropertyDescriptor_HasValue(){ +return this.hasValue_; +}, +"setEnumerable",function PropertyDescriptor_SetEnumerable(a){ +this.enumerable_=a; +this.hasEnumerable_=true; +}, +"isEnumerable",function PropertyDescriptor_IsEnumerable(){ +return this.enumerable_; +}, +"hasEnumerable",function PropertyDescriptor_HasEnumerable(){ +return this.hasEnumerable_; +}, +"setWritable",function PropertyDescriptor_SetWritable(a){ +this.writable_=a; +this.hasWritable_=true; +}, +"isWritable",function PropertyDescriptor_IsWritable(){ +return this.writable_; +}, +"hasWritable",function PropertyDescriptor_HasWritable(){ +return this.hasWritable_; +}, +"setConfigurable", +function PropertyDescriptor_SetConfigurable(a){ +this.configurable_=a; +this.hasConfigurable_=true; +}, +"hasConfigurable",function PropertyDescriptor_HasConfigurable(){ +return this.hasConfigurable_; +}, +"isConfigurable",function PropertyDescriptor_IsConfigurable(){ +return this.configurable_; +}, +"setGet",function PropertyDescriptor_SetGetter(a){ +this.get_=a; +this.hasGetter_=true; +}, +"getGet",function PropertyDescriptor_GetGetter(){ +return this.get_; +}, +"hasGetter",function PropertyDescriptor_HasGetter(){ +return this.hasGetter_; +}, +"setSet",function PropertyDescriptor_SetSetter(a){ +this.set_=a; +this.hasSetter_=true; +}, +"getSet",function PropertyDescriptor_GetSetter(){ +return this.set_; +}, +"hasSetter",function PropertyDescriptor_HasSetter(){ +return this.hasSetter_; +})); +function ConvertDescriptorArrayToDescriptor(a){ +if((a===(void 0))){ +return(void 0); +} +var b=new PropertyDescriptor(); +if(a[0]){ +b.setGet(a[2]); +b.setSet(a[3]); +}else{ +b.setValue(a[1]); +b.setWritable(a[4]); +} +b.setEnumerable(a[5]); +b.setConfigurable(a[6]); +return b; +} +function GetTrap(a,b,c){ +var d=a[b]; +if((d===(void 0))){ +if((c===(void 0))){ +throw MakeTypeError("handler_trap_missing",[a,b]); +} +d=c; +}else if(!(%_ClassOf(d)==='Function')){ +throw MakeTypeError("handler_trap_must_be_callable",[a,b]); +} +return d; +} +function CallTrap0(a,b,c){ +return %_CallFunction(a,GetTrap(a,b,c)); +} +function CallTrap1(a,b,c,d){ +return %_CallFunction(a,d,GetTrap(a,b,c)); +} +function CallTrap2(a,b,c,d,e){ +return %_CallFunction(a,d,e,GetTrap(a,b,c)); +} +function GetOwnPropertyJS(a,b){ +var c=ToName(b); +if(%_IsJSProxy(a)){ +if((typeof(b)==='symbol'))return(void 0); +var d=%GetHandler(a); +var e=CallTrap1( +d,"getOwnPropertyDescriptor",(void 0),c); +if((e===(void 0)))return e; +var g=ToCompletePropertyDescriptor(e); +if(!g.isConfigurable()){ +throw MakeTypeError("proxy_prop_not_configurable", +[d,"getOwnPropertyDescriptor",c,e]); +} +return g; +} +var h=%GetOwnProperty(((%_IsSpecObject(%IS_VAR(a)))?a:ToObject(a)),c); +return ConvertDescriptorArrayToDescriptor(h); +} +function Delete(a,b,c){ +var d=GetOwnPropertyJS(a,b); +if((d===(void 0)))return true; +if(d.isConfigurable()){ +%DeleteProperty(a,b,0); +return true; +}else if(c){ +throw MakeTypeError("define_disallowed",[b]); +}else{ +return; +} +} +function GetMethod(a,b){ +var c=a[b]; +if((c==null))return(void 0); +if((%_ClassOf(c)==='Function'))return c; +throw MakeTypeError('called_non_callable',[typeof c]); +} +function DefineProxyProperty(a,b,c,d){ +if((typeof(b)==='symbol'))return false; +var e=%GetHandler(a); +var g=CallTrap2(e,"defineProperty",(void 0),b,c); +if(!ToBoolean(g)){ +if(d){ +throw MakeTypeError("handler_returned_false", +[e,"defineProperty"]); +}else{ +return false; +} +} +return true; +} +function DefineObjectProperty(a,b,c,d){ +var e=%GetOwnProperty(a,ToName(b)); +var g=ConvertDescriptorArrayToDescriptor(e); +var h=%IsExtensible(a); +if((g===(void 0))&&!h){ +if(d){ +throw MakeTypeError("define_disallowed",[b]); +}else{ +return false; +} +} +if(!(g===(void 0))){ +if((IsGenericDescriptor(c)|| +IsDataDescriptor(c)==IsDataDescriptor(g))&& +(!c.hasEnumerable()|| +SameValue(c.isEnumerable(),g.isEnumerable()))&& +(!c.hasConfigurable()|| +SameValue(c.isConfigurable(),g.isConfigurable()))&& +(!c.hasWritable()|| +SameValue(c.isWritable(),g.isWritable()))&& +(!c.hasValue()|| +SameValue(c.getValue(),g.getValue()))&& +(!c.hasGetter()|| +SameValue(c.getGet(),g.getGet()))&& +(!c.hasSetter()|| +SameValue(c.getSet(),g.getSet()))){ +return true; +} +if(!g.isConfigurable()){ +if(c.isConfigurable()|| +(c.hasEnumerable()&& +c.isEnumerable()!=g.isEnumerable())){ +if(d){ +throw MakeTypeError("redefine_disallowed",[b]); +}else{ +return false; +} +} +if(!IsGenericDescriptor(c)){ +if(IsDataDescriptor(g)!=IsDataDescriptor(c)){ +if(d){ +throw MakeTypeError("redefine_disallowed",[b]); +}else{ +return false; +} +} +if(IsDataDescriptor(g)&&IsDataDescriptor(c)){ +if(!g.isWritable()&&c.isWritable()){ +if(d){ +throw MakeTypeError("redefine_disallowed",[b]); +}else{ +return false; +} +} +if(!g.isWritable()&&c.hasValue()&& +!SameValue(c.getValue(),g.getValue())){ +if(d){ +throw MakeTypeError("redefine_disallowed",[b]); +}else{ +return false; +} +} +} +if(IsAccessorDescriptor(c)&&IsAccessorDescriptor(g)){ +if(c.hasSetter()&&!SameValue(c.getSet(),g.getSet())){ +if(d){ +throw MakeTypeError("redefine_disallowed",[b]); +}else{ +return false; +} +} +if(c.hasGetter()&&!SameValue(c.getGet(),g.getGet())){ +if(d){ +throw MakeTypeError("redefine_disallowed",[b]); +}else{ +return false; +} +} +} +} +} +} +var i=0; +if(c.hasEnumerable()){ +i|=c.isEnumerable()?0:2; +}else if(!(g===(void 0))){ +i|=g.isEnumerable()?0:2; +}else{ +i|=2; +} +if(c.hasConfigurable()){ +i|=c.isConfigurable()?0:4; +}else if(!(g===(void 0))){ +i|=g.isConfigurable()?0:4; +}else +i|=4; +if(IsDataDescriptor(c)|| +(IsGenericDescriptor(c)&& +((g===(void 0))||IsDataDescriptor(g)))){ +if(c.hasWritable()){ +i|=c.isWritable()?0:1; +}else if(!(g===(void 0))){ +i|=g.isWritable()?0:1; +}else{ +i|=1; +} +var j=(void 0); +if(c.hasValue()){ +j=c.getValue(); +}else if(!(g===(void 0))&&IsDataDescriptor(g)){ +j=g.getValue(); +} +%DefineDataPropertyUnchecked(a,b,j,i); +}else{ +var k=null; +if(c.hasGetter()){ +k=c.getGet(); +}else if(IsAccessorDescriptor(g)&&g.hasGetter()){ +k=g.getGet(); +} +var l=null; +if(c.hasSetter()){ +l=c.getSet(); +}else if(IsAccessorDescriptor(g)&&g.hasSetter()){ +l=g.getSet(); +} +%DefineAccessorPropertyUnchecked(a,b,k,l,i); +} +return true; +} +function DefineArrayProperty(a,b,c,d){ +if(b==="length"){ +var e=a.length; +var g=e; +if(!c.hasValue()){ +return DefineObjectProperty(a,"length",c,d); +} +var h=ToUint32(c.getValue()); +if(h!=ToNumber(c.getValue())){ +throw new $RangeError('defineProperty() array length out of range'); +} +var i=GetOwnPropertyJS(a,"length"); +if(h!=e&&!i.isWritable()){ +if(d){ +throw MakeTypeError("redefine_disallowed",[b]); +}else{ +return false; +} +} +var j=false; +var k=%IsObserved(a)&&h!==g; +var l; +if(k){ +BeginPerformSplice(a); +l=[]; +if(hg?h-g:0); +} +if(j){ +if(d){ +throw MakeTypeError("redefine_disallowed",[b]); +}else{ +return false; +} +} +return true; +} +if(!(typeof(b)==='symbol')){ +var m=ToUint32(b); +var k=false; +if(ToString(m)==b&&m!=4294967295){ +var e=a.length; +if(m>=e&&%IsObserved(a)){ +k=true; +BeginPerformSplice(a); +} +var i=GetOwnPropertyJS(a,"length"); +if((m>=e&&!i.isWritable())|| +!DefineObjectProperty(a,b,c,true)){ +if(k) +EndPerformSplice(a); +if(d){ +throw MakeTypeError("define_disallowed",[b]); +}else{ +return false; +} +} +if(m>=e){ +a.length=m+1; +} +if(k){ +EndPerformSplice(a); +EnqueueSpliceRecord(a,e,[],m+1-e); +} +return true; +} +} +return DefineObjectProperty(a,b,c,d); +} +function DefineOwnProperty(a,b,c,d){ +if(%_IsJSProxy(a)){ +if((typeof(b)==='symbol'))return false; +var e=FromGenericPropertyDescriptor(c); +return DefineProxyProperty(a,b,e,d); +}else if((%_IsArray(a))){ +return DefineArrayProperty(a,b,c,d); +}else{ +return DefineObjectProperty(a,b,c,d); +} +} +function ObjectGetPrototypeOf(a){ +if(!(%_IsSpecObject(a))){ +throw MakeTypeError("called_on_non_object",["Object.getPrototypeOf"]); +} +return %_GetPrototype(a); +} +function ObjectSetPrototypeOf(a,b){ +if((a==null)&&!(%_IsUndetectableObject(a)))throw MakeTypeError('called_on_null_or_undefined',["Object.setPrototypeOf"]); +if(b!==null&&!(%_IsSpecObject(b))){ +throw MakeTypeError("proto_object_or_null",[b]); +} +if((%_IsSpecObject(a))){ +%SetPrototype(a,b); +} +return a; +} +function ObjectGetOwnPropertyDescriptor(a,b){ +if(!(%_IsSpecObject(a))){ +throw MakeTypeError("called_on_non_object", +["Object.getOwnPropertyDescriptor"]); +} +var c=GetOwnPropertyJS(a,b); +return FromPropertyDescriptor(c); +} +function ToNameArray(a,b,c){ +if(!(%_IsSpecObject(a))){ +throw MakeTypeError("proxy_non_object_prop_names",[a,b]); +} +var d=ToUint32(a.length); +var e=new $Array(d); +var g=0; +var h={__proto__:null}; +for(var i=0;i36){ +throw new $RangeError('toString() radix argument must be between 2 and 36'); +} +return %NumberToRadixString(b,a); +} +function NumberToLocaleString(){ +return %_CallFunction(this,NumberToStringJS); +} +function NumberValueOf(){ +if(!(typeof(this)==='number')&&!(%_ClassOf(this)==='Number')){ +throw new $TypeError('Number.prototype.valueOf is not generic'); +} +return %_ValueOf(this); +} +function NumberToFixedJS(a){ +var b=this; +if(!(typeof(this)==='number')){ +if(!(%_ClassOf(this)==='Number')){ +throw MakeTypeError("incompatible_method_receiver", +["Number.prototype.toFixed",this]); +} +b=%_ValueOf(this); +} +var c=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); +if(c<0||c>20){ +throw new $RangeError("toFixed() digits argument must be between 0 and 20"); +} +if((!%_IsSmi(%IS_VAR(b))&&!(b==b)))return"NaN"; +if(b==(1/0))return"Infinity"; +if(b==-(1/0))return"-Infinity"; +return %NumberToFixed(b,c); +} +function NumberToExponentialJS(a){ +var b=this; +if(!(typeof(this)==='number')){ +if(!(%_ClassOf(this)==='Number')){ +throw MakeTypeError("incompatible_method_receiver", +["Number.prototype.toExponential",this]); +} +b=%_ValueOf(this); +} +var c=(a===(void 0))?(void 0):(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); +if((!%_IsSmi(%IS_VAR(b))&&!(b==b)))return"NaN"; +if(b==(1/0))return"Infinity"; +if(b==-(1/0))return"-Infinity"; +if((c===(void 0))){ +c=-1; +}else if(c<0||c>20){ +throw new $RangeError("toExponential() argument must be between 0 and 20"); +} +return %NumberToExponential(b,c); +} +function NumberToPrecisionJS(a){ +var b=this; +if(!(typeof(this)==='number')){ +if(!(%_ClassOf(this)==='Number')){ +throw MakeTypeError("incompatible_method_receiver", +["Number.prototype.toPrecision",this]); +} +b=%_ValueOf(this); +} +if((a===(void 0)))return ToString(%_ValueOf(this)); +var c=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); +if((!%_IsSmi(%IS_VAR(b))&&!(b==b)))return"NaN"; +if(b==(1/0))return"Infinity"; +if(b==-(1/0))return"-Infinity"; +if(c<1||c>21){ +throw new $RangeError("toPrecision() argument must be between 1 and 21"); +} +return %NumberToPrecision(b,c); +} +function NumberIsFinite(a){ +return(typeof(a)==='number')&&(%_IsSmi(%IS_VAR(a))||((a==a)&&(a!=1/0)&&(a!=-1/0))); +} +function NumberIsInteger(a){ +return NumberIsFinite(a)&&(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a)))==a; +} +function NumberIsNaN(a){ +return(typeof(a)==='number')&&(!%_IsSmi(%IS_VAR(a))&&!(a==a)); +} +function NumberIsSafeInteger(a){ +if(NumberIsFinite(a)){ +var b=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); +if(b==a)return $abs(b)<=$Number.MAX_SAFE_INTEGER; +} +return false; +} +function SetUpNumber(){ +%CheckIsBootstrapping(); +%SetCode($Number,NumberConstructor); +%FunctionSetPrototype($Number,new $Number(0)); +%OptimizeObjectForAddingMultipleProperties($Number.prototype,8); +%AddNamedProperty($Number.prototype,"constructor",$Number,2); +InstallConstants($Number,$Array( +"MAX_VALUE",1.7976931348623157e+308, +"MIN_VALUE",5e-324, +"NaN",$NaN, +"NEGATIVE_INFINITY",-(1/0), +"POSITIVE_INFINITY",(1/0), +"MAX_SAFE_INTEGER",%_MathPow(2,53)-1, +"MIN_SAFE_INTEGER",-%_MathPow(2,53)+1, +"EPSILON",%_MathPow(2,-52) +)); +InstallFunctions($Number.prototype,2,$Array( +"toString",NumberToStringJS, +"toLocaleString",NumberToLocaleString, +"valueOf",NumberValueOf, +"toFixed",NumberToFixedJS, +"toExponential",NumberToExponentialJS, +"toPrecision",NumberToPrecisionJS +)); +InstallFunctions($Number,2,$Array( +"isFinite",NumberIsFinite, +"isInteger",NumberIsInteger, +"isNaN",NumberIsNaN, +"isSafeInteger",NumberIsSafeInteger, +"parseInt",GlobalParseInt, +"parseFloat",GlobalParseFloat +)); +} +SetUpNumber(); +function FunctionSourceString(a){ +while(%IsJSFunctionProxy(a)){ +a=%GetCallTrap(a); +} +if(!(%_IsFunction(a))){ +throw new $TypeError('Function.prototype.toString is not generic'); +} +var b=%ClassGetSourceCode(a); +if((typeof(b)==='string')){ +return b; +} +var c=%FunctionGetSourceCode(a); +if(!(typeof(c)==='string')||%FunctionIsBuiltin(a)){ +var d=%FunctionGetName(a); +if(d){ +return'function '+d+'() { [native code] }'; +}else{ +return'function () { [native code] }'; +} +} +if(%FunctionIsArrow(a)){ +return c; +} +var d=%FunctionNameShouldPrintAsAnonymous(a) +?'anonymous' +:%FunctionGetName(a); +var e=%FunctionIsGenerator(a); +var g=%FunctionIsConciseMethod(a) +?(e?'*':'') +:(e?'function* ':'function '); +return g+d+c; +} +function FunctionToString(){ +return FunctionSourceString(this); +} +function FunctionBind(a){ +if(!(%_ClassOf(this)==='Function')){ +throw new $TypeError('Bind must be called on a function'); +} +var b=function(){ +"use strict"; +if(%_IsConstructCall()){ +return %NewObjectFromBound(b); +} +var c=%BoundFunctionGetBindings(b); +var d=%_ArgumentsLength(); +if(d==0){ +return %Apply(c[0],c[1],c,2,c.length-2); +} +if(c.length===2){ +return %Apply(c[0],c[1],arguments,0,d); +} +var e=c.length-2; +var g=new InternalArray(e+d); +for(var h=0;h>>0)===k)){ +var d=%_ArgumentsLength(); +if(d>0)d--; +j=k-d; +if(j<0)j=0; +} +var l=%FunctionBindArguments(b,this, +a,j); +return l; +} +function NewFunctionFromString(a,b){ +var c=a.length; +var d=''; +if(c>1){ +d=ToString(a[0]); +for(var e=1;e0)?ToString(a[c-1]):''; +var h='('+b+'('+d+') {\n'; +var i=h+g+'\n})'; +var j=%GlobalProxy(global); +var k=%_CallFunction(j,%CompileString(i,true,h.length)); +%FunctionMarkNameShouldPrintAsAnonymous(k); +return k; +} +function FunctionConstructor(a){ +return NewFunctionFromString(arguments,'function'); +} +function SetUpFunction(){ +%CheckIsBootstrapping(); +%SetCode($Function,FunctionConstructor); +%AddNamedProperty($Function.prototype,"constructor",$Function,2); +InstallFunctions($Function.prototype,2,$Array( +"bind",FunctionBind, +"toString",FunctionToString +)); +} +SetUpFunction(); +function GetIterator(a,b){ +if((b===(void 0))){ +b=a[symbolIterator]; +} +if(!(%_ClassOf(b)==='Function')){ +throw MakeTypeError('not_iterable',[a]); +} +var c=%_CallFunction(a,b); +if(!(%_IsSpecObject(c))){ +throw MakeTypeError('not_an_iterator',[c]); +} +return c; +} + +symbolY +var $symbolToString; +(function(){ +"use strict"; +%CheckIsBootstrapping(); +var a=global.Array; +var b=global.Object; +var c=global.Symbol; +function SymbolConstructor(d){ +if(%_IsConstructCall()){ +throw MakeTypeError('not_constructor',["Symbol"]); +} +return %CreateSymbol((d===(void 0))?d:ToString(d)); +} +function SymbolToString(){ +if(!((typeof(this)==='symbol')||(%_ClassOf(this)==='Symbol'))){ +throw MakeTypeError( +'incompatible_method_receiver',["Symbol.prototype.toString",this]); +} +var e=%SymbolDescription(%_ValueOf(this)); +return"Symbol("+((e===(void 0))?"":e)+")"; +} +function SymbolValueOf(){ +if(!((typeof(this)==='symbol')||(%_ClassOf(this)==='Symbol'))){ +throw MakeTypeError( +'incompatible_method_receiver',["Symbol.prototype.valueOf",this]); +} +return %_ValueOf(this); +} +function SymbolFor(g){ +g=((typeof(%IS_VAR(g))==='string')?g:NonStringToString(g)); +var h=%SymbolRegistry(); +if((h.for[g]===(void 0))){ +var i=%CreateSymbol(g); +h.for[g]=i; +h.keyFor[i]=g; +} +return h.for[g]; +} +function SymbolKeyFor(i){ +if(!(typeof(i)==='symbol'))throw MakeTypeError("not_a_symbol",[i]); +return %SymbolRegistry().keyFor[i]; +} +function ObjectGetOwnPropertySymbols(j){ +j=ToObject(j); +return ObjectGetOwnPropertyKeys(j,8); +} +%SetCode(c,SymbolConstructor); +%FunctionSetPrototype(c,new b()); +InstallConstants(c,a( +"iterator",symbolIterator, +"unscopables",symbolUnscopables +)); +InstallFunctions(c,2,a( +"for",SymbolFor, +"keyFor",SymbolKeyFor +)); +%AddNamedProperty( +c.prototype,"constructor",c,2); +%AddNamedProperty( +c.prototype,symbolToStringTag,"Symbol",2|1); +InstallFunctions(c.prototype,2,a( +"toString",SymbolToString, +"valueOf",SymbolValueOf +)); +InstallFunctions(b,2,a( +"getOwnPropertySymbols",ObjectGetOwnPropertySymbols +)); +$symbolToString=SymbolToString; +})(); + +arrayæx +"use strict"; +var visited_arrays=new InternalArray(); +function GetSortedArrayKeys(a,b){ +var c=new InternalArray(); +if((typeof(b)==='number')){ +var d=b; +for(var e=0;e>2; +var g=%EstimateNumberOfElements(a); +return(gg*4); +} +function Join(a,b,c,d){ +if(b==0)return''; +var e=(%_IsArray(a)); +if(e){ +if(!%PushIfAbsent(visited_arrays,a))return''; +} +try{ +if(UseSparseVariant(a,b,e,b)){ +%NormalizeElements(a); +if(c.length==0){ +return SparseJoin(a,b,d); +}else{ +return SparseJoinWithSeparatorJS(a,b,d,c); +} +} +if(b==1){ +var g=a[0]; +if((typeof(g)==='string'))return g; +return d(g); +} +var h=new InternalArray(b); +if(c.length==0){ +var i=0; +for(var j=0;j=b){ +var k=a[n]; +if(!(k===(void 0))||n in a){ +%AddElement(g,n-b,k,0); +} +} +} +} +} +} +function SparseMove(a,b,c,d,g){ +if(g===c)return; +var h=new InternalArray( +$min(d-c+g,0xffffffff)); +var i; +var j=%GetArrayKeys(a,d); +if((typeof(j)==='number')){ +var k=j; +for(var l=0;l=b+c){ +var m=a[q]; +if(!(m===(void 0))||q in a){ +var r=q-c+g; +h[r]=m; +if(r>0xffffffff){ +i=i||new InternalArray(); +i.push(r); +} +} +} +} +} +} +%MoveArrayContents(h,a); +if(!(i===(void 0))){ +var n=i.length; +for(var l=0;lc){ +for(var i=d-c;i>b;i--){ +var j=i+c-1; +var k=i+g-1; +if(((h&&%_HasFastPackedElements(%IS_VAR(a)))?(jd-c+g;i--){ +delete a[i-1]; +} +} +} +} +function ArrayToString(){ +var a; +var b; +if((%_IsArray(this))){ +b=this.join; +if(b===ArrayJoin){ +return Join(this,this.length,',',ConvertToString); +} +a=this; +}else{ +a=ToObject(this); +b=a.join; +} +if(!(%_ClassOf(b)==='Function')){ +return %_CallFunction(a,DefaultObjectToString); +} +return %_CallFunction(a,b); +} +function ArrayToLocaleString(){ +var a=ToObject(this); +var b=a.length; +var c=(b>>>0); +if(c===0)return""; +return Join(a,c,',',ConvertToLocaleString); +} +function ArrayJoin(a){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["Array.prototype.join"]); +var b=((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)); +var c=(b.length>>>0); +if((a===(void 0))){ +a=','; +}else if(!(typeof(a)==='string')){ +a=NonStringToString(a); +} +var d=%_FastOneByteArrayJoin(b,a); +if(!(d===(void 0)))return d; +if(c===1){ +var g=b[0]; +if((typeof(g)==='string'))return g; +if((g==null))return''; +return NonStringToString(g); +} +return Join(b,c,a,ConvertToString); +} +function ObservedArrayPop(a){ +a--; +var b=this[a]; +try{ +BeginPerformSplice(this); +delete this[a]; +this.length=a; +}finally{ +EndPerformSplice(this); +EnqueueSpliceRecord(this,a,[b],0); +} +return b; +} +function ArrayPop(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["Array.prototype.pop"]); +var a=((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)); +var b=(a.length>>>0); +if(b==0){ +a.length=b; +return; +} +if(%IsObserved(a)) +return ObservedArrayPop.call(a,b); +b--; +var c=a[b]; +Delete(a,ToName(b),true); +a.length=b; +return c; +} +function ObservedArrayPush(){ +var a=(this.length>>>0); +var b=%_ArgumentsLength(); +try{ +BeginPerformSplice(this); +for(var c=0;c>>0); +var c=%_ArgumentsLength(); +for(var d=0;d=h){ +k=h; +while(c[++g]==h){} +l=b-h-1; +} +var m=a[k]; +if(!(m===(void 0))||k in a){ +var o=a[l]; +if(!(o===(void 0))||l in a){ +a[k]=o; +a[l]=m; +}else{ +a[l]=m; +delete a[k]; +} +}else{ +var o=a[l]; +if(!(o===(void 0))||l in a){ +a[k]=o; +delete a[l]; +} +} +} +} +function ArrayReverse(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["Array.prototype.reverse"]); +var a=((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)); +var b=(a.length>>>0); +if(UseSparseVariant(a,b,(%_IsArray(a)),b)){ +%NormalizeElements(a); +SparseReverse(a,b); +return a; +} +var c=b-1; +for(var d=0;d>>0); +if(b===0){ +a.length=0; +return; +} +if(ObjectIsSealed(a)){ +throw MakeTypeError("array_functions_change_sealed", +["Array.prototype.shift"]); +} +if(%IsObserved(a)) +return ObservedArrayShift.call(a,b); +var c=a[0]; +if(UseSparseVariant(a,b,(%_IsArray(a)),b)){ +SparseMove(a,0,1,b,0); +}else{ +SimpleMove(a,0,1,b,0); +} +a.length=b-1; +return c; +} +function ObservedArrayUnshift(){ +var a=(this.length>>>0); +var b=%_ArgumentsLength(); +try{ +BeginPerformSplice(this); +SimpleMove(this,0,0,a,b); +for(var c=0;c>>0); +var d=%_ArgumentsLength(); +if(c>0&&UseSparseVariant(b,c,(%_IsArray(b)),c)&& +!ObjectIsSealed(b)){ +SparseMove(b,0,0,c,d); +}else{ +SimpleMove(b,0,0,c,d); +} +for(var g=0;g>>0); +var g=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); +var h=d; +if(!(b===(void 0)))h=(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); +if(g<0){ +g+=d; +if(g<0)g=0; +}else{ +if(g>d)g=d; +} +if(h<0){ +h+=d; +if(h<0)h=0; +}else{ +if(h>d)h=d; +} +var i=[]; +if(hb?b:a; +} +function ComputeSpliceDeleteCount(a,b,c,d){ +var g=0; +if(b==1) +return c-d; +g=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); +if(g<0) +return 0; +if(g>c-d) +return c-d; +return g; +} +function ObservedArraySplice(a,b){ +var c=%_ArgumentsLength(); +var d=(this.length>>>0); +var g=ComputeSpliceStartIndex((%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))),d); +var h=ComputeSpliceDeleteCount(b,c,d, +g); +var i=[]; +i.length=h; +var j=c>2?c-2:0; +try{ +BeginPerformSplice(this); +SimpleSlice(this,g,h,d,i); +SimpleMove(this,g,h,d,j); +var k=g; +var l=2; +var m=%_ArgumentsLength(); +while(l>>0); +var h=ComputeSpliceStartIndex((%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))),g); +var i=ComputeSpliceDeleteCount(b,c,g, +h); +var j=[]; +j.length=i; +var k=c>2?c-2:0; +if(i!=k&&ObjectIsSealed(d)){ +throw MakeTypeError("array_functions_change_sealed", +["Array.prototype.splice"]); +}else if(i>0&&ObjectIsFrozen(d)){ +throw MakeTypeError("array_functions_on_frozen", +["Array.prototype.splice"]); +} +var l=i; +if(k!=i){ +l+=g-h-i; +} +if(UseSparseVariant(d,g,(%_IsArray(d)),l)){ +%NormalizeElements(d); +%NormalizeElements(j); +SparseSlice(d,h,i,g,j); +SparseMove(d,h,i,g,k); +}else{ +SimpleSlice(d,h,i,g,j); +SimpleMove(d,h,i,g,k); +} +var m=h; +var o=2; +var q=%_ArgumentsLength(); +while(o=i;m--){ +var o=h[m]; +var q=%_CallFunction(d,o,l,a); +if(q>0){ +h[m+1]=o; +}else{ +break; +} +} +h[m+1]=l; +} +}; +var r=function(h,i,j){ +var t=[]; +var u=200+((j-i)&15); +for(var k=i+1,m=0;k>1][0]; +return z; +} +var A=function QuickSort(h,i,j){ +var z=0; +while(true){ +if(j-i<=10){ +g(h,i,j); +return; +} +if(j-i>1000){ +z=r(h,i,j); +}else{ +z=i+((j-i)>>1); +} +var B=h[i]; +var C=h[j-1]; +var D=h[z]; +var E=%_CallFunction(d,B,C,a); +if(E>0){ +var o=B; +B=C; +C=o; +} +var G=%_CallFunction(d,B,D,a); +if(G>=0){ +var o=B; +B=D; +D=C; +C=o; +}else{ +var H=%_CallFunction(d,C,D,a); +if(H>0){ +var o=C; +C=D; +D=o; +} +} +h[i]=B; +h[j-1]=D; +var I=C; +var J=i+1; +var K=j-1; +h[z]=h[J]; +h[J]=I; +partition:for(var k=J+1;k0){ +do{ +K--; +if(K==k)break partition; +var L=h[K]; +q=%_CallFunction(d,L,I,a); +}while(q>0); +h[k]=h[K]; +h[K]=l; +if(q<0){ +l=h[k]; +h[k]=h[J]; +h[J]=l; +J++; +} +} +} +if(j-K=Q){Q=k+1;} +} +} +}else{ +for(var k=0;k=Q){Q=U+1;} +} +} +} +} +return Q; +}; +var W=function(N,i,j){ +for(var R=%_GetPrototype(N);R;R=%_GetPrototype(R)){ +var S=%GetArrayKeys(R,j); +if((typeof(S)==='number')){ +var T=S; +for(var k=i;k>>0); +if(P<2)return this; +var ab=(%_IsArray(this)); +var ac; +if(!ab){ +ac=M(this,P); +} +var ad=%RemoveArrayHoles(this,P); +if(ad==-1){ +ad=X(this); +} +A(this,0,ad); +if(!ab&&(ad+1>>0); +if(!(%_ClassOf(a)==='Function')){ +throw MakeTypeError('called_non_callable',[a]); +} +var g=false; +if((b==null)){ +b=%GetDefaultReceiver(a)||b; +}else{ +g=(!(%_IsSpecObject(b))&&%IsSloppyModeFunction(a)); +} +var h=(%_IsArray(c)); +var i=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +for(var j=0;j>>0); +if(!(%_ClassOf(a)==='Function')){ +throw MakeTypeError('called_non_callable',[a]); +} +var g=false; +if((b==null)){ +b=%GetDefaultReceiver(a)||b; +}else{ +g=(!(%_IsSpecObject(b))&&%IsSloppyModeFunction(a)); +} +var h=(%_IsArray(c)); +var i=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +for(var j=0;j>>0); +if(!(%_ClassOf(a)==='Function')){ +throw MakeTypeError('called_non_callable',[a]); +} +var g=false; +if((b==null)){ +b=%GetDefaultReceiver(a)||b; +}else{ +g=(!(%_IsSpecObject(b))&&%IsSloppyModeFunction(a)); +} +var h=(%_IsArray(c)); +var i=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +for(var j=0;j>>0); +if(!(%_ClassOf(a)==='Function')){ +throw MakeTypeError('called_non_callable',[a]); +} +var g=false; +if((b==null)){ +b=%GetDefaultReceiver(a)||b; +}else{ +g=(!(%_IsSpecObject(b))&&%IsSloppyModeFunction(a)); +} +var h=new $Array(); +var i=new InternalArray(d); +var j=(%_IsArray(c)); +var k=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +for(var l=0;l>>0); +if(c==0)return-1; +if((b===(void 0))){ +b=0; +}else{ +b=(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); +if(b<0){ +b=c+b; +if(b<0)b=0; +} +} +var d=b; +var g=c; +if(UseSparseVariant(this,c,(%_IsArray(this)),g-d)){ +%NormalizeElements(this); +var h=%GetArrayKeys(this,c); +if((typeof(h)==='number')){ +g=h; +}else{ +if(h.length==0)return-1; +var i=GetSortedArrayKeys(this,h); +var j=i.length; +var k=0; +while(k>>0); +if(c==0)return-1; +if(%_ArgumentsLength()<2){ +b=c-1; +}else{ +b=(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); +if(b<0)b+=c; +if(b<0)return-1; +else if(b>=c)b=c-1; +} +var d=0; +var g=b; +if(UseSparseVariant(this,c,(%_IsArray(this)),b)){ +%NormalizeElements(this); +var h=%GetArrayKeys(this,b+1); +if((typeof(h)==='number')){ +g=h; +}else{ +if(h.length==0)return-1; +var i=GetSortedArrayKeys(this,h); +var j=i.length-1; +while(j>=0){ +var k=i[j]; +if(!(k===(void 0))&&this[k]===a)return k; +j--; +} +return-1; +} +} +if(!(a===(void 0))){ +for(var j=g;j>=d;j--){ +if(this[j]===a)return j; +} +return-1; +} +for(var j=g;j>=d;j--){ +if((this[j]===(void 0))&&j in this){ +return j; +} +} +return-1; +} +function ArrayReduce(a,b){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["Array.prototype.reduce"]); +var c=ToObject(this); +var d=ToUint32(c.length); +if(!(%_ClassOf(a)==='Function')){ +throw MakeTypeError('called_non_callable',[a]); +} +var g=(%_IsArray(c)); +var h=0; +find_initial:if(%_ArgumentsLength()<2){ +for(;h=0;h--){ +if(((g&&%_HasFastPackedElements(%IS_VAR(c)))?(h=0;h--){ +if(((g&&%_HasFastPackedElements(%IS_VAR(c)))?(h1){ +t=%_Arguments(1); +t=(%_IsSmi(%IS_VAR(t))?t:%NumberToInteger(ToNumber(t))); +if(t<0)t=0; +if(t>r.length)t=r.length; +} +return %StringIndexOf(r,q,t); +} +function StringLastIndexOfJS(u){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.lastIndexOf"]); +var w=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); +var z=w.length; +var u=((typeof(%IS_VAR(u))==='string')?u:NonStringToString(u)); +var A=u.length; +var t=z-A; +if(%_ArgumentsLength()>1){ +var B=ToNumber(%_Arguments(1)); +if(!(!%_IsSmi(%IS_VAR(B))&&!(B==B))){ +B=(%_IsSmi(%IS_VAR(B))?B:%NumberToInteger(ToNumber(B))); +if(B<0){ +B=0; +} +if(B+A0xFF&& +(typeof(K)==='string')&& +%StringIndexOf(K,'$',0)<0){ +return %StringReplaceOneCharWithString(r,J,K); +} +var P=%StringIndexOf(r,J,0); +if(P<0)return r; +var Q=P+J.length; +var h=%_SubString(r,0,P); +if((%_ClassOf(K)==='Function')){ +var R=%GetDefaultReceiver(K); +h+=%_CallFunction(R,J,P,r,K); +}else{ +I[3]=P; +I[4]=Q; +h=ExpandReplacement(((typeof(%IS_VAR(K))==='string')?K:NonStringToString(K)), +r, +I, +h); +} +return h+%_SubString(r,Q,r.length); +} +function ExpandReplacement(S,r,T,h){ +var U=S.length; +var W=%StringIndexOf(S,'$',0); +if(W<0){ +if(U>0)h+=S; +return h; +} +if(W>0)h+=%_SubString(S,0,W); +while(true){ +var X='$'; +var B=W+1; +if(B=48&&Y<=57){ +var Z=(Y-48)<<1; +var aa=1; +var ab=((T)[0]); +if(B+1=48&&W<=57){ +var ac=Z*10+((W-48)<<1); +if(ac=0){ +h+= +%_SubString(r,P,T[(3+(Z+1))]); +} +B+=aa; +}else{ +h+='$'; +} +}else{ +h+='$'; +} +}else{ +h+='$'; +} +W=%StringIndexOf(S,'$',B); +if(W<0){ +if(BB){ +h+=%_SubString(S,B,W); +} +} +return h; +} +function CaptureString(S,ad,t){ +var ae=t<<1; +var P=ad[(3+(ae))]; +if(P<0)return; +var Q=ad[(3+(ae+1))]; +return %_SubString(S,P,Q); +} +var af=new InternalArray(16); +function StringReplaceGlobalRegExpWithFunction(r,C,K){ +var ag=af; +if(ag){ +af=null; +}else{ +ag=new InternalArray(16); +} +var ah=%RegExpExecMultiple(C, +r, +$regexpLastMatchInfo, +ag); +C.lastIndex=0; +if((ah===null)){ +af=ag; +return r; +} +var j=ah.length; +if((($regexpLastMatchInfo)[0])==2){ +var ai=0; +var aj=new InternalPackedArray(null,0,r); +var R=%GetDefaultReceiver(K); +for(var m=0;m0){ +ai=(ak>>11)+(ak&0x7ff); +}else{ +ai=ah[++m]-ak; +} +}else{ +aj[0]=ak; +aj[1]=ai; +$regexpLastMatchInfoOverride=aj; +var al= +%_CallFunction(R,ak,ai,r,K); +ah[m]=((typeof(%IS_VAR(al))==='string')?al:NonStringToString(al)); +ai+=ak.length; +} +} +}else{ +var R=%GetDefaultReceiver(K); +for(var m=0;m>1; +var ao; +var R=%GetDefaultReceiver(K); +if(an==1){ +var ap=%_SubString(r,t,am); +ao=%_CallFunction(R,ap,t,r,K); +}else{ +var aq=new InternalArray(an+2); +for(var ar=0;arat){ +return''; +} +} +if(av<0){ +av+=at; +if(av<0){ +return''; +} +}else{ +if(av>at){ +av=at; +} +} +if(av<=au){ +return''; +} +return %_SubString(ap,au,av); +} +function StringSplitJS(aw,ax){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.split"]); +var r=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); +ax=((ax===(void 0)))?0xffffffff:(ax>>>0); +var U=r.length; +if(!(%_IsRegExp(aw))){ +var ay=((typeof(%IS_VAR(aw))==='string')?aw:NonStringToString(aw)); +if(ax===0)return[]; +if((aw===(void 0)))return[r]; +var az=ay.length; +if(az===0)return %StringToArray(r,ax); +var h=%StringSplit(r,ay,ax); +return h; +} +if(ax===0)return[]; +return StringSplitOnRegExp(r,aw,ax,U); +} +function StringSplitOnRegExp(r,aw,ax,U){ +if(U===0){ +if($regexpExec(aw,r,0,0)!=null){ +return[]; +} +return[r]; +} +var aA=0; +var aB=0; +var aC=0; +var h=new InternalArray(); +outer_loop: +while(true){ +if(aB===U){ +h[h.length]=%_SubString(r,aA,U); +break; +} +var T=$regexpExec(aw,r,aB); +if(T==null||U===(aC=T[3])){ +h[h.length]=%_SubString(r,aA,U); +break; +} +var aD=T[4]; +if(aB===aD&&aD===aA){ +aB++; +continue; +} +h[h.length]=%_SubString(r,aA,aC); +if(h.length===ax)break; +var aE=((T)[0])+3; +for(var m=3+2;mat){ +au=at; +} +var av=at; +if(!(Q===(void 0))){ +av=(%_IsSmi(%IS_VAR(Q))?Q:%NumberToInteger(ToNumber(Q))); +if(av>at){ +av=at; +}else{ +if(av<0)av=0; +if(au>av){ +var aG=av; +av=au; +au=aG; +} +} +} +return %_SubString(ap,au,av); +} +function StringSubstr(P,aH){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.substr"]); +var ap=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); +var j; +if((aH===(void 0))){ +j=ap.length; +}else{ +j=(%_IsSmi(%IS_VAR(aH))?aH:%NumberToInteger(ToNumber(aH))); +if(j<=0)return''; +} +if((P===(void 0))){ +P=0; +}else{ +P=(%_IsSmi(%IS_VAR(P))?P:%NumberToInteger(ToNumber(P))); +if(P>=ap.length)return''; +if(P<0){ +P+=ap.length; +if(P<0)P=0; +} +} +var Q=P+j; +if(Q>ap.length)Q=ap.length; +return %_SubString(ap,P,Q); +} +function StringToLowerCaseJS(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.toLowerCase"]); +return %StringToLowerCase(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this))); +} +function StringToLocaleLowerCase(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.toLocaleLowerCase"]); +return %StringToLowerCase(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this))); +} +function StringToUpperCaseJS(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.toUpperCase"]); +return %StringToUpperCase(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this))); +} +function StringToLocaleUpperCase(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.toLocaleUpperCase"]); +return %StringToUpperCase(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this))); +} +function StringTrimJS(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.trim"]); +return %StringTrim(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)),true,true); +} +function StringTrimLeft(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.trimLeft"]); +return %StringTrim(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)),true,false); +} +function StringTrimRight(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.trimRight"]); +return %StringTrim(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)),false,true); +} +function StringFromCharCode(aI){ +var aH=%_ArgumentsLength(); +if(aH==1){ +if(!%_IsSmi(aI))aI=ToNumber(aI); +return %_StringCharFromCode(aI&0xffff); +} +var aJ=%NewString(aH,true); +var m; +for(m=0;m0xff)break; +%_OneByteSeqStringSetChar(m,aI,aJ); +} +if(m==aH)return aJ; +aJ=%TruncateString(aJ,m); +var aK=%NewString(aH-m,false); +for(var ar=0;m"+this+""; +} +function StringBig(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.big"]); +return""+this+""; +} +function StringBlink(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.blink"]); +return""+this+""; +} +function StringBold(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.bold"]); +return""+this+""; +} +function StringFixed(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.fixed"]); +return""+this+""; +} +function StringFontcolor(aN){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.fontcolor"]); +return""+this+""; +} +function StringFontsize(aO){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.fontsize"]); +return""+this+""; +} +function StringItalics(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.italics"]); +return""+this+""; +} +function StringLink(ap){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.link"]); +return""+this+""; +} +function StringSmall(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.small"]); +return""+this+""; +} +function StringStrike(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.strike"]); +return""+this+""; +} +function StringSub(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.sub"]); +return""+this+""; +} +function StringSup(){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.sup"]); +return""+this+""; +} +function StringRepeat(aP){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.repeat"]); +var ap=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); +var aH=ToInteger(aP); +if(aH<0||aH>%_MaxSmi()){ +throw MakeRangeError("invalid_count_value",[]); +} +var aQ=""; +while(true){ +if(aH&1)aQ+=ap; +aH>>=1; +if(aH===0)return aQ; +ap+=ap; +} +} +function StringStartsWith(aR){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.startsWith"]); +var ap=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); +if((%_IsRegExp(aR))){ +throw MakeTypeError("first_argument_not_regexp", +["String.prototype.startsWith"]); +} +var aS=((typeof(%IS_VAR(aR))==='string')?aR:NonStringToString(aR)); +var g=0; +if(%_ArgumentsLength()>1){ +g=%_Arguments(1); +g=ToInteger(g); +} +var at=ap.length; +var P=$min($max(g,0),at); +var aT=aS.length; +if(aT+P>at){ +return false; +} +return %StringIndexOf(ap,aS,P)===P; +} +function StringEndsWith(aR){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.endsWith"]); +var ap=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); +if((%_IsRegExp(aR))){ +throw MakeTypeError("first_argument_not_regexp", +["String.prototype.endsWith"]); +} +var aS=((typeof(%IS_VAR(aR))==='string')?aR:NonStringToString(aR)); +var at=ap.length; +var g=at; +if(%_ArgumentsLength()>1){ +var aU=%_Arguments(1); +if(!(aU===(void 0))){ +g=ToInteger(aU); +} +} +var Q=$min($max(g,0),at); +var aT=aS.length; +var P=Q-aT; +if(P<0){ +return false; +} +return %StringLastIndexOf(ap,aS,P)===P; +} +function StringIncludes(aR){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.includes"]); +var ap=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); +if((%_IsRegExp(aR))){ +throw MakeTypeError("first_argument_not_regexp", +["String.prototype.includes"]); +} +var aS=((typeof(%IS_VAR(aR))==='string')?aR:NonStringToString(aR)); +var g=0; +if(%_ArgumentsLength()>1){ +g=%_Arguments(1); +g=ToInteger(g); +} +var at=ap.length; +var P=$min($max(g,0),at); +var aT=aS.length; +if(aT+P>at){ +return false; +} +return %StringIndexOf(ap,aS,P)!==-1; +} +function StringCodePointAt(g){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.codePointAt"]); +var S=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); +var aO=S.length; +g=(%_IsSmi(%IS_VAR(g))?g:%NumberToInteger(ToNumber(g))); +if(g<0||g>=aO){ +return(void 0); +} +var aV=%_StringCharCodeAt(S,g); +if(aV<0xD800||aV>0xDBFF||g+1==aO){ +return aV; +} +var aW=%_StringCharCodeAt(S,g+1); +if(aW<0xDC00||aW>0xDFFF){ +return aV; +} +return(aV-0xD800)*0x400+aW+0x2400; +} +function StringFromCodePoint(aX){ +var aI; +var U=%_ArgumentsLength(); +var t; +var h=""; +for(t=0;t0x10FFFF||aI!==(%_IsSmi(%IS_VAR(aI))?aI:%NumberToInteger(ToNumber(aI)))){ +throw MakeRangeError("invalid_code_point",[aI]); +} +if(aI<=0xFFFF){ +h+=%_StringCharFromCode(aI); +}else{ +aI-=0x10000; +h+=%_StringCharFromCode((aI>>>10)&0x3FF|0xD800); +h+=%_StringCharFromCode(aI&0x3FF|0xDC00); +} +} +return h; +} +function StringRaw(aY){ +var aZ=%_ArgumentsLength(); +var ba=ToObject(aY); +var bb=ToObject(ba.raw); +var bc=ToLength(bb.length); +if(bc<=0)return""; +var h=ToString(bb[0]); +for(var m=1;m=48&&a<=57)return a-48; +if(a>=65&&a<=70)return a-55; +if(a>=97&&a<=102)return a-87; +return-1; +} +function isAlphaNumeric(b){ +if(97<=b&&b<=122)return true; +if(65<=b&&b<=90)return true; +if(48<=b&&b<=57)return true; +return false; +} +var c=0; +function URIAddEncodedOctetToBuffer(d,g,h){ +g[h++]=37; +g[h++]=c[d>>4]; +g[h++]=c[d&0x0F]; +return h; +} +function URIEncodeOctets(i,g,h){ +if(c===0){ +c=[48,49,50,51,52,53,54,55,56,57, +65,66,67,68,69,70]; +} +h=URIAddEncodedOctetToBuffer(i[0],g,h); +if(i[1])h=URIAddEncodedOctetToBuffer(i[1],g,h); +if(i[2])h=URIAddEncodedOctetToBuffer(i[2],g,h); +if(i[3])h=URIAddEncodedOctetToBuffer(i[3],g,h); +return h; +} +function URIEncodeSingle(b,g,h){ +var j=(b>>12)&0xF; +var k=(b>>6)&63; +var l=b&63; +var i=new $Array(3); +if(b<=0x007F){ +i[0]=b; +}else if(b<=0x07FF){ +i[0]=k+192; +i[1]=l+128; +}else{ +i[0]=j+224; +i[1]=k+128; +i[2]=l+128; +} +return URIEncodeOctets(i,g,h); +} +function URIEncodePair(m,o,g,h){ +var q=((m>>6)&0xF)+1; +var r=(m>>2)&0xF; +var j=m&3; +var k=(o>>6)&0xF; +var l=o&63; +var i=new $Array(4); +i[0]=(q>>2)+240; +i[1]=(((q&3)<<4)|r)+128; +i[2]=((j<<4)|k)+128; +i[3]=l+128; +return URIEncodeOctets(i,g,h); +} +function URIHexCharsToCharCode(t,u){ +var w=HexValueOf(t); +var z=HexValueOf(u); +if(w==-1||z==-1){ +throw new $URIError("URI malformed"); +} +return(w<<4)|z; +} +function URIDecodeOctets(i,g,h){ +var A; +var B=i[0]; +if(B<0x80){ +A=B; +}else if(B<0xc2){ +throw new $URIError("URI malformed"); +}else{ +var C=i[1]; +if(B<0xe0){ +var D=B&0x1f; +if((C<0x80)||(C>0xbf)){ +throw new $URIError("URI malformed"); +} +var E=C&0x3f; +A=(D<<6)+E; +if(A<0x80||A>0x7ff){ +throw new $URIError("URI malformed"); +} +}else{ +var G=i[2]; +if(B<0xf0){ +var D=B&0x0f; +if((C<0x80)||(C>0xbf)){ +throw new $URIError("URI malformed"); +} +var E=C&0x3f; +if((G<0x80)||(G>0xbf)){ +throw new $URIError("URI malformed"); +} +var H=G&0x3f; +A=(D<<12)+(E<<6)+H; +if((A<0x800)||(A>0xffff)){ +throw new $URIError("URI malformed"); +} +}else{ +var I=i[3]; +if(B<0xf8){ +var D=(B&0x07); +if((C<0x80)||(C>0xbf)){ +throw new $URIError("URI malformed"); +} +var E=(C&0x3f); +if((G<0x80)||(G>0xbf)){ +throw new $URIError("URI malformed"); +} +var H=(G&0x3f); +if((I<0x80)||(I>0xbf)){ +throw new $URIError("URI malformed"); +} +var J=(I&0x3f); +A=(D<<18)+(E<<12)+(H<<6)+J; +if((A<0x10000)||(A>0x10ffff)){ +throw new $URIError("URI malformed"); +} +}else{ +throw new $URIError("URI malformed"); +} +} +} +} +if(0xD800<=A&&A<=0xDFFF){ +throw new $URIError("URI malformed"); +} +if(A<0x10000){ +%_TwoByteSeqStringSetChar(h++,A,g); +}else{ +%_TwoByteSeqStringSetChar(h++,(A>>10)+0xd7c0,g); +%_TwoByteSeqStringSetChar(h++,(A&0x3ff)+0xdc00,g); +} +return h; +} +function Encode(K,L){ +var M=K.length; +var N=new InternalArray(M); +var h=0; +for(var P=0;P=0xDC00&&m<=0xDFFF)throw new $URIError("URI malformed"); +if(m<0xD800||m>0xDBFF){ +h=URIEncodeSingle(m,N,h); +}else{ +P++; +if(P==M)throw new $URIError("URI malformed"); +var o=K.charCodeAt(P); +if(o<0xDC00||o>0xDFFF)throw new $URIError("URI malformed"); +h=URIEncodePair(m,o,N,h); +} +} +} +var g=%NewString(N.length,true); +for(var Q=0;Q=M)throw new $URIError("URI malformed"); +var b=URIHexCharsToCharCode(K.charCodeAt(P+1),K.charCodeAt(P+2)); +if(b>>7)break; +if(R(b)){ +%_OneByteSeqStringSetChar(h++,37,S); +%_OneByteSeqStringSetChar(h++,K.charCodeAt(P+1),S); +%_OneByteSeqStringSetChar(h++,K.charCodeAt(P+2),S); +}else{ +%_OneByteSeqStringSetChar(h++,b,S); +} +P+=2; +}else{ +if(a>0x7f)break; +%_OneByteSeqStringSetChar(h++,a,S); +} +} +S=%TruncateString(S,h); +if(P==M)return S; +var T=%NewString(M-P,false); +h=0; +for(;P=M)throw new $URIError("URI malformed"); +var b=URIHexCharsToCharCode(K.charCodeAt(++P),K.charCodeAt(++P)); +if(b>>7){ +var U=0; +while(((b<<++U)&0x80)!=0){} +if(U==1||U>4)throw new $URIError("URI malformed"); +var i=new $Array(U); +i[0]=b; +if(P+3*(U-1)>=M)throw new $URIError("URI malformed"); +for(var Q=1;Q0)return c; +return 0-c; +} +function MathAcosJS(c){ +return %_MathAcos(+c); +} +function MathAsinJS(c){ +return %_MathAsin(+c); +} +function MathAtanJS(c){ +return %_MathAtan(+c); +} +function MathAtan2JS(d,c){ +d=+d; +c=+c; +return %_MathAtan2(d,c); +} +function MathCeil(c){ +return-%_MathFloor(-c); +} +function MathExp(c){ +return %MathExpRT(((typeof(%IS_VAR(c))==='number')?c:NonNumberToNumber(c))); +} +function MathFloorJS(c){ +return %_MathFloor(+c); +} +function MathLog(c){ +return %_MathLogRT(((typeof(%IS_VAR(c))==='number')?c:NonNumberToNumber(c))); +} +function MathMax(g,h){ +var i=%_ArgumentsLength(); +if(i==2){ +g=((typeof(%IS_VAR(g))==='number')?g:NonNumberToNumber(g)); +h=((typeof(%IS_VAR(h))==='number')?h:NonNumberToNumber(h)); +if(h>g)return h; +if(g>h)return g; +if(g==h){ +return(g===0&&%_IsMinusZero(g))?h:g; +} +return $NaN; +} +var j=-(1/0); +for(var k=0;kj||(j===0&&l===0&&%_IsMinusZero(j))){ +j=l; +} +} +return j; +} +function MathMin(g,h){ +var i=%_ArgumentsLength(); +if(i==2){ +g=((typeof(%IS_VAR(g))==='number')?g:NonNumberToNumber(g)); +h=((typeof(%IS_VAR(h))==='number')?h:NonNumberToNumber(h)); +if(h>g)return g; +if(g>h)return h; +if(g==h){ +return(g===0&&%_IsMinusZero(g))?g:h; +} +return $NaN; +} +var j=(1/0); +for(var k=0;k>>16))|0; +rngstate[0]=m; +var o=(MathImul(36969,rngstate[1]&0xFFFF)+(rngstate[1]>>>16))|0; +rngstate[1]=o; +var c=((m<<16)+(o&0xFFFF))|0; +return(c<0?(c+0x100000000):c)*2.3283064365386962890625e-10; +} +function MathRound(c){ +return %RoundNumber(((typeof(%IS_VAR(c))==='number')?c:NonNumberToNumber(c))); +} +function MathSqrtJS(c){ +return %_MathSqrt(+c); +} +function MathImul(c,d){ +return %NumberImul(((typeof(%IS_VAR(c))==='number')?c:NonNumberToNumber(c)),((typeof(%IS_VAR(d))==='number')?d:NonNumberToNumber(d))); +} +function MathSign(c){ +c=+c; +if(c>0)return 1; +if(c<0)return-1; +return c; +} +function MathTrunc(c){ +c=+c; +if(c>0)return %_MathFloor(c); +if(c<0)return-%_MathFloor(-c); +return c; +} +function MathTanh(c){ +if(!(typeof(c)==='number'))c=NonNumberToNumber(c); +if(c===0)return c; +if(!(%_IsSmi(%IS_VAR(c))||((c==c)&&(c!=1/0)&&(c!=-1/0))))return MathSign(c); +var q=MathExp(c); +var r=MathExp(-c); +return(q-r)/(q+r); +} +function MathAsinh(c){ +if(!(typeof(c)==='number'))c=NonNumberToNumber(c); +if(c===0||!(%_IsSmi(%IS_VAR(c))||((c==c)&&(c!=1/0)&&(c!=-1/0))))return c; +if(c>0)return MathLog(c+%_MathSqrt(c*c+1)); +return-MathLog(-c+%_MathSqrt(c*c+1)); +} +function MathAcosh(c){ +if(!(typeof(c)==='number'))c=NonNumberToNumber(c); +if(c<1)return $NaN; +if(!(%_IsSmi(%IS_VAR(c))||((c==c)&&(c!=1/0)&&(c!=-1/0))))return c; +return MathLog(c+%_MathSqrt(c+1)*%_MathSqrt(c-1)); +} +function MathAtanh(c){ +if(!(typeof(c)==='number'))c=NonNumberToNumber(c); +if(c===0)return c; +if(!(%_IsSmi(%IS_VAR(c))||((c==c)&&(c!=1/0)&&(c!=-1/0))))return $NaN; +return 0.5*MathLog((1+c)/(1-c)); +} +function MathHypot(c,d){ +var i=%_ArgumentsLength(); +var t=new InternalArray(i); +var u=0; +for(var k=0;ku)u=l; +t[k]=l; +} +if(u===0)u=1; +var w=0; +var z=0; +for(var k=0;k>>0); +} +function MathCbrt(c){ +if(!(typeof(c)==='number'))c=NonNumberToNumber(c); +if(c==0||!(%_IsSmi(%IS_VAR(c))||((c==c)&&(c!=1/0)&&(c!=-1/0))))return c; +return c>=0?CubeRoot(c):-CubeRoot(-c); +} +function CubeRoot(c){ +var C=MathFloorJS(%_DoubleHi(c)/3)+0x2A9F7893; +var D=%_ConstructDouble(C,0); +D=(1.0/3.0)*(c/(D*D)+2*D); +; +D=(1.0/3.0)*(c/(D*D)+2*D); +; +D=(1.0/3.0)*(c/(D*D)+2*D); +; +return(1.0/3.0)*(c/(D*D)+2*D); +; +} +function MathConstructor(){} +var E=new MathConstructor(); +%InternalSetPrototype(E,a.prototype); +%AddNamedProperty(global,"Math",E,2); +%FunctionSetInstanceClassName(MathConstructor,'Math'); +%AddNamedProperty(E,symbolToStringTag,"Math",1|2); +InstallConstants(E,b( +"E",2.7182818284590452354, +"LN10",2.302585092994046, +"LN2",0.6931471805599453, +"LOG2E",1.4426950408889634, +"LOG10E",0.4342944819032518, +"PI",3.1415926535897932, +"SQRT1_2",0.7071067811865476, +"SQRT2",1.4142135623730951 +)); +InstallFunctions(E,2,b( +"random",MathRandom, +"abs",MathAbs, +"acos",MathAcosJS, +"asin",MathAsinJS, +"atan",MathAtanJS, +"ceil",MathCeil, +"exp",MathExp, +"floor",MathFloorJS, +"log",MathLog, +"round",MathRound, +"sqrt",MathSqrtJS, +"atan2",MathAtan2JS, +"pow",MathPowJS, +"max",MathMax, +"min",MathMin, +"imul",MathImul, +"sign",MathSign, +"trunc",MathTrunc, +"tanh",MathTanh, +"asinh",MathAsinh, +"acosh",MathAcosh, +"atanh",MathAtanh, +"hypot",MathHypot, +"fround",MathFroundJS, +"clz32",MathClz32JS, +"cbrt",MathCbrt +)); +%SetInlineBuiltinFlag(MathAbs); +%SetInlineBuiltinFlag(MathAcosJS); +%SetInlineBuiltinFlag(MathAsinJS); +%SetInlineBuiltinFlag(MathAtanJS); +%SetInlineBuiltinFlag(MathAtan2JS); +%SetInlineBuiltinFlag(MathCeil); +%SetInlineBuiltinFlag(MathClz32JS); +%SetInlineBuiltinFlag(MathFloorJS); +%SetInlineBuiltinFlag(MathRandom); +%SetInlineBuiltinFlag(MathSign); +%SetInlineBuiltinFlag(MathSqrtJS); +%SetInlineBuiltinFlag(MathTrunc); +$abs=MathAbs; +$exp=MathExp; +$floor=MathFloorJS; +$max=MathMax; +$min=MathMin; +})(); + +fdlibm¹¨ +var kMath; +var rempio2result; +(function(){ +"use strict"; +%CheckIsBootstrapping(); +var a=global.Math; +var b=global.Array; + + + + + + + + + + + + + + + + + + + + + +function KernelTan(c,d,g){ +var h; +var i; +var j=%_DoubleHi(c); +var k=j&0x7fffffff; +if(k<0x3e300000){ +if(((k|%_DoubleLo(c))|(g+1))==0){ +return 1/$abs(c); +}else{ +if(g==1){ +return c; +}else{ +var i=c+d; +var h=%_ConstructDouble(%_DoubleHi(i),0); +var l=d-(h-c); +var m=-1/i; +var o=%_ConstructDouble(%_DoubleHi(m),0); +var q=1+o*h; +return o+m*(q+o*l); +} +} +} +if(k>=0x3fe59428){ +if(c<0){ +c=-c; +d=-d; +} +h=kMath[32]-c; +i=kMath[33]-d; +c=h+i; +d=0; +} +h=c*c; +i=h*h; +var r=kMath[19+1] ++i*(kMath[19+3] ++i*(kMath[19+5] ++ +i*(kMath[19+7] ++i*(kMath[19+9] ++i*kMath[19+11] +)))); +var l=h*(kMath[19+2] ++i*(kMath[19+4] ++i*(kMath[19+6] ++ +i*(kMath[19+8] ++i*(kMath[19+10] ++i*kMath[19+12] +))))); +var q=h*c; +r=d+h*(q*(r+l)+d); +r=r+kMath[19+0] +*q; +i=c+r; +if(k>=0x3fe59428){ +return(1-((j>>30)&2))* +(g-2.0*(c-(i*i/(i+g)-r))); +} +if(g==1){ +return i; +}else{ +h=%_ConstructDouble(%_DoubleHi(i),0); +l=r-(h-c); +var m=-1/i; +var o=%_ConstructDouble(%_DoubleHi(m),0); +q=1+o*h; +return o+m*(q+o*l); +} +} +function MathSinSlow(c){ +var t,u,w; +var j=%_DoubleHi(c); +var k=j&0x7fffffff; +if(k<0x4002d97c){ +if(j>0){ +var h=c-kMath[1]; +if(k!=0x3ff921fb){ +u=h-kMath[2]; +w=(h-u)-kMath[2]; +}else{ +h-=kMath[3]; +u=h-kMath[4]; +w=(h-u)-kMath[4]; +} +t=1; +}else{ +var h=c+kMath[1]; +if(k!=0x3ff921fb){ +u=h+kMath[2]; +w=(h-u)+kMath[2]; +}else{ +h+=kMath[3]; +u=h+kMath[4]; +w=(h-u)+kMath[4]; +} +t=-1; +} +}else if(k<=0x413921fb){ +var o=$abs(c); +t=(o*kMath[0]+0.5)|0; +var r=o-t*kMath[1]; +var i=t*kMath[2]; +u=r-i; +if(k-(%_DoubleHi(u)&0x7ff00000)>0x1000000){ +o=r; +i=t*kMath[3]; +r=o-i; +i=t*kMath[4]-((o-r)-i); +u=r-i; +if(k-(%_DoubleHi(u)&0x7ff00000)>0x3100000){ +o=r; +i=t*kMath[5]; +r=o-i; +i=t*kMath[6]-((o-r)-i); +u=r-i; +} +} +w=(r-u)-i; +if(j<0){ +t=-t; +u=-u; +w=-w; +} +}else{ +t=%RemPiO2(c,rempio2result); +u=rempio2result[0]; +w=rempio2result[1]; +} +; +var z=1-(t&2); +if(t&1){ +var k=%_DoubleHi(u)&0x7fffffff; +var h=u*u; +var r=h*(4.16666666666666019037e-02+h*(-1.38888888888741095749e-03+h*(2.48015872894767294178e-05+h*(-2.75573143513906633035e-07+h*(2.08757232129817482790e-09+h*-1.13596475577881948265e-11))))); +if(k<0x3fd33333){ +return(1-(0.5*h-(h*r-u*w)))*z; +}else{ +var A; +if(k>0x3fe90000){ +A=0.28125; +}else{ +A=%_ConstructDouble(%_DoubleHi(0.25*u),0); +} +var B=0.5*h-A; +return(1-A-(B-(h*r-u*w)))*z; +} +; +}else{ +var h=u*u; +var l=h*u; +var r=8.33333333332248946124e-03+h*(-1.98412698298579493134e-04+h*(2.75573137070700676789e-06+h*(-2.50507602534068634195e-08+h*1.58969099521155010221e-10))); +return(u-((h*(0.5*w-l*r)-w)-l*-1.66666666666666324348e-01))*z; +; +} +} +function MathCosSlow(c){ +var t,u,w; +var j=%_DoubleHi(c); +var k=j&0x7fffffff; +if(k<0x4002d97c){ +if(j>0){ +var h=c-kMath[1]; +if(k!=0x3ff921fb){ +u=h-kMath[2]; +w=(h-u)-kMath[2]; +}else{ +h-=kMath[3]; +u=h-kMath[4]; +w=(h-u)-kMath[4]; +} +t=1; +}else{ +var h=c+kMath[1]; +if(k!=0x3ff921fb){ +u=h+kMath[2]; +w=(h-u)+kMath[2]; +}else{ +h+=kMath[3]; +u=h+kMath[4]; +w=(h-u)+kMath[4]; +} +t=-1; +} +}else if(k<=0x413921fb){ +var o=$abs(c); +t=(o*kMath[0]+0.5)|0; +var r=o-t*kMath[1]; +var i=t*kMath[2]; +u=r-i; +if(k-(%_DoubleHi(u)&0x7ff00000)>0x1000000){ +o=r; +i=t*kMath[3]; +r=o-i; +i=t*kMath[4]-((o-r)-i); +u=r-i; +if(k-(%_DoubleHi(u)&0x7ff00000)>0x3100000){ +o=r; +i=t*kMath[5]; +r=o-i; +i=t*kMath[6]-((o-r)-i); +u=r-i; +} +} +w=(r-u)-i; +if(j<0){ +t=-t; +u=-u; +w=-w; +} +}else{ +t=%RemPiO2(c,rempio2result); +u=rempio2result[0]; +w=rempio2result[1]; +} +; +if(t&1){ +var z=(t&2)-1; +var h=u*u; +var l=h*u; +var r=8.33333333332248946124e-03+h*(-1.98412698298579493134e-04+h*(2.75573137070700676789e-06+h*(-2.50507602534068634195e-08+h*1.58969099521155010221e-10))); +return(u-((h*(0.5*w-l*r)-w)-l*-1.66666666666666324348e-01))*z; +; +}else{ +var z=1-(t&2); +var k=%_DoubleHi(u)&0x7fffffff; +var h=u*u; +var r=h*(4.16666666666666019037e-02+h*(-1.38888888888741095749e-03+h*(2.48015872894767294178e-05+h*(-2.75573143513906633035e-07+h*(2.08757232129817482790e-09+h*-1.13596475577881948265e-11))))); +if(k<0x3fd33333){ +return(1-(0.5*h-(h*r-u*w)))*z; +}else{ +var A; +if(k>0x3fe90000){ +A=0.28125; +}else{ +A=%_ConstructDouble(%_DoubleHi(0.25*u),0); +} +var B=0.5*h-A; +return(1-A-(B-(h*r-u*w)))*z; +} +; +} +} +function MathSin(c){ +c=+c; +if((%_DoubleHi(c)&0x7fffffff)<=0x3fe921fb){ +var h=c*c; +var l=h*c; +var r=8.33333333332248946124e-03+h*(-1.98412698298579493134e-04+h*(2.75573137070700676789e-06+h*(-2.50507602534068634195e-08+h*1.58969099521155010221e-10))); +return(c-((h*(0.5*0-l*r)-0)-l*-1.66666666666666324348e-01)); +; +} +return+MathSinSlow(c); +} +function MathCos(c){ +c=+c; +if((%_DoubleHi(c)&0x7fffffff)<=0x3fe921fb){ +var k=%_DoubleHi(c)&0x7fffffff; +var h=c*c; +var r=h*(4.16666666666666019037e-02+h*(-1.38888888888741095749e-03+h*(2.48015872894767294178e-05+h*(-2.75573143513906633035e-07+h*(2.08757232129817482790e-09+h*-1.13596475577881948265e-11))))); +if(k<0x3fd33333){ +return(1-(0.5*h-(h*r-c*0))); +}else{ +var A; +if(k>0x3fe90000){ +A=0.28125; +}else{ +A=%_ConstructDouble(%_DoubleHi(0.25*c),0); +} +var B=0.5*h-A; +return(1-A-(B-(h*r-c*0))); +} +; +} +return+MathCosSlow(c); +} +function MathTan(c){ +c=c*1; +if((%_DoubleHi(c)&0x7fffffff)<=0x3fe921fb){ +return KernelTan(c,0,1); +} +var t,u,w; +var j=%_DoubleHi(c); +var k=j&0x7fffffff; +if(k<0x4002d97c){ +if(j>0){ +var h=c-kMath[1]; +if(k!=0x3ff921fb){ +u=h-kMath[2]; +w=(h-u)-kMath[2]; +}else{ +h-=kMath[3]; +u=h-kMath[4]; +w=(h-u)-kMath[4]; +} +t=1; +}else{ +var h=c+kMath[1]; +if(k!=0x3ff921fb){ +u=h+kMath[2]; +w=(h-u)+kMath[2]; +}else{ +h+=kMath[3]; +u=h+kMath[4]; +w=(h-u)+kMath[4]; +} +t=-1; +} +}else if(k<=0x413921fb){ +var o=$abs(c); +t=(o*kMath[0]+0.5)|0; +var r=o-t*kMath[1]; +var i=t*kMath[2]; +u=r-i; +if(k-(%_DoubleHi(u)&0x7ff00000)>0x1000000){ +o=r; +i=t*kMath[3]; +r=o-i; +i=t*kMath[4]-((o-r)-i); +u=r-i; +if(k-(%_DoubleHi(u)&0x7ff00000)>0x3100000){ +o=r; +i=t*kMath[5]; +r=o-i; +i=t*kMath[6]-((o-r)-i); +u=r-i; +} +} +w=(r-u)-i; +if(j<0){ +t=-t; +u=-u; +w=-w; +} +}else{ +t=%RemPiO2(c,rempio2result); +u=rempio2result[0]; +w=rempio2result[1]; +} +; +return KernelTan(u,w,(t&1)?-1:1); +} + + + + +function MathLog1p(c){ +c=c*1; +var j=%_DoubleHi(c); +var C=j&0x7fffffff; +var D=1; +var E=c; +var G=1; +var H=0; +var I=c; +if(j<0x3fda827a){ +if(C>=0x3ff00000){ +if(c===-1){ +return-(1/0); +}else{ +return $NaN; +} +}else if(C<0x3c900000){ +return c; +}else if(C<0x3e200000){ +return c-c*c*0.5; +} +if((j>0)||(j<=-0x402D413D)){ +D=0; +} +} +if(j>=0x7ff00000)return c; +if(D!==0){ +if(j<0x43400000){ +I=1+c; +G=%_DoubleHi(I); +D=(G>>20)-1023; +H=(D>0)?1-(I-c):c-(I-1); +H=H/I; +}else{ +G=%_DoubleHi(I); +D=(G>>20)-1023; +} +G=G&0xfffff; +if(G<0x6a09e){ +I=%_ConstructDouble(G|0x3ff00000,%_DoubleLo(I)); +}else{ +++D; +I=%_ConstructDouble(G|0x3fe00000,%_DoubleLo(I)); +G=(0x00100000-G)>>2; +} +E=I-1; +} +var J=0.5*E*E; +if(G===0){ +if(E===0){ +if(D===0){ +return 0.0; +}else{ +return D*kMath[34]+(H+D*kMath[35]); +} +} +var K=J*(1-kMath[36]*E); +if(D===0){ +return E-K; +}else{ +return D*kMath[34]-((K-(D*kMath[35]+H))-E); +} +} +var q=E/(2+E); +var h=q*q; +var K=h*((kMath[37+0]) ++h*((kMath[37+1]) ++h* +((kMath[37+2]) ++h*((kMath[37+3]) ++h* +((kMath[37+4]) ++h*((kMath[37+5]) ++h*(kMath[37+6]) +)))))); +if(D===0){ +return E-(J-q*(J+K)); +}else{ +return D*kMath[34]-((J-(q*(J+K)+(D*kMath[35]+H)))-E); +} +} + + +function MathExpm1(c){ +c=c*1; +var d; +var L; +var M; +var D; +var o; +var H; +var j=%_DoubleHi(c); +var N=j&0x80000000; +var d=(N===0)?c:-c; +j&=0x7fffffff; +if(j>=0x4043687a){ +if(j>=0x40862e42){ +if(j>=0x7ff00000){ +return(c===-(1/0))?-1:c; +} +if(c>kMath[44])return(1/0); +} +if(N!=0)return-1; +} +if(j>0x3fd62e42){ +if(j<0x3ff0a2b2){ +if(N===0){ +L=c-kMath[34]; +M=kMath[35]; +D=1; +}else{ +L=c+kMath[34]; +M=-kMath[35]; +D=-1; +} +}else{ +D=(kMath[45]*c+((N===0)?0.5:-0.5))|0; +o=D; +L=c-o*kMath[34]; +M=o*kMath[35]; +} +c=L-M; +H=(L-c)-M; +}else if(j<0x3c900000){ +return c; +}else{ +D=0; +} +var P=0.5*c; +var Q=c*P; +var R=1+Q*((kMath[46+0]) ++Q*((kMath[46+1]) ++Q* +((kMath[46+2]) ++Q*((kMath[46+3]) ++Q*(kMath[46+4]) +)))); +o=3-R*P; +var S=Q*((R-o)/(6-c*o)); +if(D===0){ +return c-(c*S-Q); +}else{ +S=(c*(S-H)-H); +S-=Q; +if(D===-1)return 0.5*(c-S)-0.5; +if(D===1){ +if(c<-0.25)return-2*(S-(c+0.5)); +return 1+2*(c-S); +} +if(D<=-2||D>56){ +d=1-(S-c); +d=%_ConstructDouble(%_DoubleHi(d)+(D<<20),%_DoubleLo(d)); +return d-1; +} +if(D<20){ +o=%_ConstructDouble(0x3ff00000-(0x200000>>D),0); +d=o-(S-c); +d=%_ConstructDouble(%_DoubleHi(d)+(D<<20),%_DoubleLo(d)); +}else{ +o=%_ConstructDouble((0x3ff-D)<<20,0); +d=c-(S+o); +d+=1; +d=%_ConstructDouble(%_DoubleHi(d)+(D<<20),%_DoubleLo(d)); +} +} +return d; +} + + + +function MathSinh(c){ +c=c*1; +var T=(c<0)?-0.5:0.5; +var C=$abs(c); +if(C<22){ +if(C<3.725290298461914e-9)return c; +var o=MathExpm1(C); +if(C<1)return T*(2*o-o*o/(o+1)); +return T*(o+o/(o+1)); +} +if(C<709.7822265625)return T*$exp(C); +if(C<=kMath[51]){ +var i=$exp(0.5*C); +var o=T*i; +return o*i; +} +return c*(1/0); +} + +function MathCosh(c){ +c=c*1; +var k=%_DoubleHi(c)&0x7fffffff; +if(k<0x3fd62e43){ +var o=MathExpm1($abs(c)); +var i=1+o; +if(k<0x3c800000)return i; +return 1+(o*o)/(i+i); +} +if(k<0x40360000){ +var o=$exp($abs(c)); +return 0.5*o+0.5/o; +} +if(k<0x40862e42)return 0.5*$exp($abs(c)); +if($abs(c)<=kMath[51]){ +var i=$exp(0.5*$abs(c)); +var o=0.5*i; +return o*i; +} +if((!%_IsSmi(%IS_VAR(c))&&!(c==c)))return c; +return(1/0); +} + + + +function MathLog10(c){ +c=c*1; +var j=%_DoubleHi(c); +var U=%_DoubleLo(c); +var D=0; +if(j<0x00100000){ +if(((j&0x7fffffff)|U)===0)return-(1/0); +if(j<0)return $NaN; +D-=54; +c*=18014398509481984; +j=%_DoubleHi(c); +U=%_DoubleLo(c); +} +if(j>=0x7ff00000)return c; +D+=(j>>20)-1023; +i=(D&0x80000000)>>31; +j=(j&0x000fffff)|((0x3ff-i)<<20); +d=D+i; +c=%_ConstructDouble(j,U); +h=d*kMath[54]+kMath[52]*%_MathLogRT(c); +return h+d*kMath[53]; +} + + + + + + +function MathLog2(c){ +c=c*1; +var C=$abs(c); +var j=%_DoubleHi(c); +var U=%_DoubleLo(c); +var k=j&0x7fffffff; +if((k|U)==0)return-(1/0); +if(j<0)return $NaN; +if(k>=0x7ff00000)return c; +var t=0; +if(k<0x00100000){ +C*=9007199254740992; +t-=53; +k=%_DoubleHi(C); +} +t+=(k>>20)-0x3ff; +var W=k&0x000fffff; +k=W|0x3ff00000; +var X=1; +var Y=0; +var Z=0; +if(W>0x3988e){ +if(W<0xbb67a){ +X=1.5; +Y=kMath[64]; +Z=kMath[65]; +}else{ +t+=1; +k-=0x00100000; +} +} +C=%_ConstructDouble(k,%_DoubleLo(C)); +var I=C-X; +var l=1/(C+X); +var aa=I*l; +var ab=%_ConstructDouble(%_DoubleHi(aa),0); +var ac=%_ConstructDouble(%_DoubleHi(C+X),0) +var ad=C-(ac-X); +var ae=l*((I-ab*ac)-ab*ad); +var af=aa*aa; +var r=af*af*((kMath[55+0]) ++af*((kMath[55+1]) ++af*((kMath[55+2]) ++af*( +(kMath[55+3]) ++af*((kMath[55+4]) ++af*(kMath[55+5]) +))))); +r+=ae*(ab+aa); +af=ab*ab; +ac=%_ConstructDouble(%_DoubleHi(3.0+af+r),0); +ad=r-((ac-3.0)-af); +I=ab*ac; +l=ae*ac+ad*aa; +p_h=%_ConstructDouble(%_DoubleHi(I+l),0); +p_l=l-(p_h-I); +z_h=kMath[62]*p_h; +z_l=kMath[63]*p_h+p_l*kMath[61]+Z; +var o=t; +var ag=%_ConstructDouble(%_DoubleHi(((z_h+z_l)+Y)+o),0); +var ah=z_l-(((ag-o)-Y)-z_h); +return ag+ah; +} +InstallFunctions(a,2,b( +"cos",MathCos, +"sin",MathSin, +"tan",MathTan, +"sinh",MathSinh, +"cosh",MathCosh, +"log10",MathLog10, +"log2",MathLog2, +"log1p",MathLog1p, +"expm1",MathExpm1 +)); +%SetInlineBuiltinFlag(MathSin); +%SetInlineBuiltinFlag(MathCos); +})(); + +dateEå +var $createDate; +(function(){ +"use strict"; +%CheckIsBootstrapping(); +var a=global.Date; +function ThrowDateTypeError(){ +throw new $TypeError('this is not a Date object.'); +} +var b=$NaN; +var c; +function LocalTimezone(d){ +if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return""; +CheckDateCacheCurrent(); +if(d==b){ +return c; +} +var g=%DateLocalTimezone(d); +b=d; +c=g; +return g; +} +function UTC(h){ +if((!%_IsSmi(%IS_VAR(h))&&!(h==h)))return h; +return %DateToUTC(h); +} +function MakeTime(i,j,k,l){ +if(!$isFinite(i))return $NaN; +if(!$isFinite(j))return $NaN; +if(!$isFinite(k))return $NaN; +if(!$isFinite(l))return $NaN; +return(%_IsSmi(%IS_VAR(i))?i:%NumberToInteger(ToNumber(i)))*3600000 ++(%_IsSmi(%IS_VAR(j))?j:%NumberToInteger(ToNumber(j)))*60000 ++(%_IsSmi(%IS_VAR(k))?k:%NumberToInteger(ToNumber(k)))*1000 ++(%_IsSmi(%IS_VAR(l))?l:%NumberToInteger(ToNumber(l))); +} +function TimeInYear(m){ +return DaysInYear(m)*86400000; +} +function MakeDay(m,o,q){ +if(!$isFinite(m)||!$isFinite(o)||!$isFinite(q))return $NaN; +m=(%_IsSmi(%IS_VAR(m))?m:%NumberToIntegerMapMinusZero(ToNumber(m))); +o=(%_IsSmi(%IS_VAR(o))?o:%NumberToIntegerMapMinusZero(ToNumber(o))); +q=(%_IsSmi(%IS_VAR(q))?q:%NumberToIntegerMapMinusZero(ToNumber(q))); +if(m<-1000000||m>1000000|| +o<-10000000||o>10000000){ +return $NaN; +} +return %DateMakeDay(m|0,o|0)+q-1; +} +function MakeDate(r,h){ +var h=r*86400000+h; +if($abs(h)>8640002592000000)return $NaN; +return h; +} +function TimeClip(h){ +if(!$isFinite(h))return $NaN; +if($abs(h)>8640000000000000)return $NaN; +return(%_IsSmi(%IS_VAR(h))?h:%NumberToInteger(ToNumber(h))); +} +var t={ +time:0, +string:null +}; +function DateConstructor(m,o,q,u,w,z,l){ +if(!%_IsConstructCall()){ +return(new a()).toString(); +} +var A=%_ArgumentsLength(); +var B; +if(A==0){ +B=%DateCurrentTime(); +(%DateSetValue(this,B,1)); +}else if(A==1){ +if((typeof(m)==='number')){ +B=m; +}else if((typeof(m)==='string')){ +CheckDateCacheCurrent(); +var C=t; +if(C.string===m){ +B=C.time; +}else{ +B=DateParse(m); +if(!(!%_IsSmi(%IS_VAR(B))&&!(B==B))){ +C.time=B; +C.string=m; +} +} +}else{ +var h=ToPrimitive(m,1); +B=(typeof(h)==='string')?DateParse(h):ToNumber(h); +} +(%DateSetValue(this,B,1)); +}else{ +m=ToNumber(m); +o=ToNumber(o); +q=A>2?ToNumber(q):1; +u=A>3?ToNumber(u):0; +w=A>4?ToNumber(w):0; +z=A>5?ToNumber(z):0; +l=A>6?ToNumber(l):0; +m=(!(!%_IsSmi(%IS_VAR(m))&&!(m==m))&& +0<=(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m)))&& +(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m)))<=99)?1900+(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m))):m; +var r=MakeDay(m,o,q); +var h=MakeTime(u,w,z,l); +B=MakeDate(r,h); +(%DateSetValue(this,B,0)); +} +} +var D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; +var E=['Jan','Feb','Mar','Apr','May','Jun', +'Jul','Aug','Sep','Oct','Nov','Dec']; +function TwoDigitString(B){ +return B<10?"0"+B:""+B; +} +function DateString(q){ +return D[(%_DateField(q,4))]+' ' ++E[(%_DateField(q,2))]+' ' ++TwoDigitString((%_DateField(q,3)))+' ' ++(%_DateField(q,1)); +} +var G=['Sunday','Monday','Tuesday','Wednesday', +'Thursday','Friday','Saturday']; +var H=['January','February','March','April','May','June', +'July','August','September','October','November','December']; +function LongDateString(q){ +return G[(%_DateField(q,4))]+', ' ++H[(%_DateField(q,2))]+' ' ++TwoDigitString((%_DateField(q,3)))+', ' ++(%_DateField(q,1)); +} +function TimeString(q){ +return TwoDigitString((%_DateField(q,5)))+':' ++TwoDigitString((%_DateField(q,6)))+':' ++TwoDigitString((%_DateField(q,7))); +} +function TimeStringUTC(q){ +return TwoDigitString((%_DateField(q,15)))+':' ++TwoDigitString((%_DateField(q,16)))+':' ++TwoDigitString((%_DateField(q,17))); +} +function LocalTimezoneString(q){ +var g=LocalTimezone((%_DateField(q,0))); +var I=-(%_DateField(q,21)); +var J=(I>=0)?1:-1; +var u=$floor((J*I)/60); +var j=$floor((J*I)%60); +var K=' GMT'+((J==1)?'+':'-')+ +TwoDigitString(u)+TwoDigitString(j); +return K+' ('+g+')'; +} +function DatePrintString(q){ +return DateString(q)+' '+TimeString(q); +} +var L=$Array(8); +function DateParse(M){ +var N=%DateParseString(ToString(M),L); +if((N===null))return $NaN; +var r=MakeDay(N[0],N[1],N[2]); +var h=MakeTime(N[3],N[4],N[5],N[6]); +var q=MakeDate(r,h); +if((N[7]===null)){ +return TimeClip(UTC(q)); +}else{ +return TimeClip(q-N[7]*1000); +} +} +function DateUTC(m,o,q,u,w,z,l){ +m=ToNumber(m); +o=ToNumber(o); +var A=%_ArgumentsLength(); +q=A>2?ToNumber(q):1; +u=A>3?ToNumber(u):0; +w=A>4?ToNumber(w):0; +z=A>5?ToNumber(z):0; +l=A>6?ToNumber(l):0; +m=(!(!%_IsSmi(%IS_VAR(m))&&!(m==m))&& +0<=(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m)))&& +(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m)))<=99)?1900+(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m))):m; +var r=MakeDay(m,o,q); +var h=MakeTime(u,w,z,l); +return TimeClip(MakeDate(r,h)); +} +function DateNow(){ +return %DateCurrentTime(); +} +function DateToString(){ +var d=(%_DateField(this,0)) +if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return'Invalid Date'; +var P=LocalTimezoneString(this) +return DatePrintString(this)+P; +} +function DateToDateString(){ +var d=(%_DateField(this,0)); +if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return'Invalid Date'; +return DateString(this); +} +function DateToTimeString(){ +var d=(%_DateField(this,0)); +if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return'Invalid Date'; +var P=LocalTimezoneString(this); +return TimeString(this)+P; +} +function DateToLocaleString(){ +return %_CallFunction(this,DateToString); +} +function DateToLocaleDateString(){ +var d=(%_DateField(this,0)); +if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return'Invalid Date'; +return LongDateString(this); +} +function DateToLocaleTimeString(){ +var d=(%_DateField(this,0)); +if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return'Invalid Date'; +return TimeString(this); +} +function DateValueOf(){ +return(%_DateField(this,0)); +} +function DateGetTime(){ +return(%_DateField(this,0)); +} +function DateGetFullYear(){ +return(%_DateField(this,1)); +} +function DateGetUTCFullYear(){ +return(%_DateField(this,11)); +} +function DateGetMonth(){ +return(%_DateField(this,2)); +} +function DateGetUTCMonth(){ +return(%_DateField(this,12)); +} +function DateGetDate(){ +return(%_DateField(this,3)); +} +function DateGetUTCDate(){ +return(%_DateField(this,13)); +} +function DateGetDay(){ +return(%_DateField(this,4)); +} +function DateGetUTCDay(){ +return(%_DateField(this,14)); +} +function DateGetHours(){ +return(%_DateField(this,5)); +} +function DateGetUTCHours(){ +return(%_DateField(this,15)); +} +function DateGetMinutes(){ +return(%_DateField(this,6)); +} +function DateGetUTCMinutes(){ +return(%_DateField(this,16)); +} +function DateGetSeconds(){ +return(%_DateField(this,7)); +} +function DateGetUTCSeconds(){ +return(%_DateField(this,17)) +} +function DateGetMilliseconds(){ +return(%_DateField(this,8)); +} +function DateGetUTCMilliseconds(){ +return(%_DateField(this,18)); +} +function DateGetTimezoneOffset(){ +return(%_DateField(this,21)); +} +function DateSetTime(l){ +if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); +(%DateSetValue(this,ToNumber(l),1)); +return(%_DateField(this,0)); +} +function DateSetMilliseconds(l){ +var d=(%_DateField(this,0)+%_DateField(this,21)); +l=ToNumber(l); +var h=MakeTime((%_DateField(this,5)),(%_DateField(this,6)),(%_DateField(this,7)),l); +return(%DateSetValue(this,MakeDate((%_DateField(this,9)),h),0)); +} +function DateSetUTCMilliseconds(l){ +var d=(%_DateField(this,0)); +l=ToNumber(l); +var h=MakeTime((%_DateField(this,15)), +(%_DateField(this,16)), +(%_DateField(this,17)), +l); +return(%DateSetValue(this,MakeDate((%_DateField(this,19)),h),1)); +} +function DateSetSeconds(k,l){ +var d=(%_DateField(this,0)+%_DateField(this,21)); +k=ToNumber(k); +l=%_ArgumentsLength()<2?(%_DateField(this,8)):ToNumber(l); +var h=MakeTime((%_DateField(this,5)),(%_DateField(this,6)),k,l); +return(%DateSetValue(this,MakeDate((%_DateField(this,9)),h),0)); +} +function DateSetUTCSeconds(k,l){ +var d=(%_DateField(this,0)); +k=ToNumber(k); +l=%_ArgumentsLength()<2?(%_DateField(this,18)):ToNumber(l); +var h=MakeTime((%_DateField(this,15)),(%_DateField(this,16)),k,l); +return(%DateSetValue(this,MakeDate((%_DateField(this,19)),h),1)); +} +function DateSetMinutes(j,k,l){ +var d=(%_DateField(this,0)+%_DateField(this,21)); +j=ToNumber(j); +var A=%_ArgumentsLength(); +k=A<2?(%_DateField(this,7)):ToNumber(k); +l=A<3?(%_DateField(this,8)):ToNumber(l); +var h=MakeTime((%_DateField(this,5)),j,k,l); +return(%DateSetValue(this,MakeDate((%_DateField(this,9)),h),0)); +} +function DateSetUTCMinutes(j,k,l){ +var d=(%_DateField(this,0)); +j=ToNumber(j); +var A=%_ArgumentsLength(); +k=A<2?(%_DateField(this,17)):ToNumber(k); +l=A<3?(%_DateField(this,18)):ToNumber(l); +var h=MakeTime((%_DateField(this,15)),j,k,l); +return(%DateSetValue(this,MakeDate((%_DateField(this,19)),h),1)); +} +function DateSetHours(i,j,k,l){ +var d=(%_DateField(this,0)+%_DateField(this,21)); +i=ToNumber(i); +var A=%_ArgumentsLength(); +j=A<2?(%_DateField(this,6)):ToNumber(j); +k=A<3?(%_DateField(this,7)):ToNumber(k); +l=A<4?(%_DateField(this,8)):ToNumber(l); +var h=MakeTime(i,j,k,l); +return(%DateSetValue(this,MakeDate((%_DateField(this,9)),h),0)); +} +function DateSetUTCHours(i,j,k,l){ +var d=(%_DateField(this,0)); +i=ToNumber(i); +var A=%_ArgumentsLength(); +j=A<2?(%_DateField(this,16)):ToNumber(j); +k=A<3?(%_DateField(this,17)):ToNumber(k); +l=A<4?(%_DateField(this,18)):ToNumber(l); +var h=MakeTime(i,j,k,l); +return(%DateSetValue(this,MakeDate((%_DateField(this,19)),h),1)); +} +function DateSetDate(q){ +var d=(%_DateField(this,0)+%_DateField(this,21)); +q=ToNumber(q); +var r=MakeDay((%_DateField(this,1)),(%_DateField(this,2)),q); +return(%DateSetValue(this,MakeDate(r,(%_DateField(this,10))),0)); +} +function DateSetUTCDate(q){ +var d=(%_DateField(this,0)); +q=ToNumber(q); +var r=MakeDay((%_DateField(this,11)),(%_DateField(this,12)),q); +return(%DateSetValue(this,MakeDate(r,(%_DateField(this,20))),1)); +} +function DateSetMonth(o,q){ +var d=(%_DateField(this,0)+%_DateField(this,21)); +o=ToNumber(o); +q=%_ArgumentsLength()<2?(%_DateField(this,3)):ToNumber(q); +var r=MakeDay((%_DateField(this,1)),o,q); +return(%DateSetValue(this,MakeDate(r,(%_DateField(this,10))),0)); +} +function DateSetUTCMonth(o,q){ +var d=(%_DateField(this,0)); +o=ToNumber(o); +q=%_ArgumentsLength()<2?(%_DateField(this,13)):ToNumber(q); +var r=MakeDay((%_DateField(this,11)),o,q); +return(%DateSetValue(this,MakeDate(r,(%_DateField(this,20))),1)); +} +function DateSetFullYear(m,o,q){ +var d=(%_DateField(this,0)+%_DateField(this,21)); +m=ToNumber(m); +var A=%_ArgumentsLength(); +var h; +if((!%_IsSmi(%IS_VAR(d))&&!(d==d))){ +o=A<2?0:ToNumber(o); +q=A<3?1:ToNumber(q); +h=0; +}else{ +o=A<2?(%_DateField(this,2)):ToNumber(o); +q=A<3?(%_DateField(this,3)):ToNumber(q); +h=(%_DateField(this,10)); +} +var r=MakeDay(m,o,q); +return(%DateSetValue(this,MakeDate(r,h),0)); +} +function DateSetUTCFullYear(m,o,q){ +var d=(%_DateField(this,0)); +m=ToNumber(m); +var A=%_ArgumentsLength(); +var h; +if((!%_IsSmi(%IS_VAR(d))&&!(d==d))){ +o=A<2?0:ToNumber(o); +q=A<3?1:ToNumber(q); +h=0; +}else{ +o=A<2?(%_DateField(this,12)):ToNumber(o); +q=A<3?(%_DateField(this,13)):ToNumber(q); +h=(%_DateField(this,20)); +} +var r=MakeDay(m,o,q); +return(%DateSetValue(this,MakeDate(r,h),1)); +} +function DateToUTCString(){ +var d=(%_DateField(this,0)); +if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return'Invalid Date'; +return D[(%_DateField(this,14))]+', ' ++TwoDigitString((%_DateField(this,13)))+' ' ++E[(%_DateField(this,12))]+' ' ++(%_DateField(this,11))+' ' ++TimeStringUTC(this)+' GMT'; +} +function DateGetYear(){ +return(%_DateField(this,1))-1900; +} +function DateSetYear(m){ +if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); +m=ToNumber(m); +if((!%_IsSmi(%IS_VAR(m))&&!(m==m)))return(%DateSetValue(this,$NaN,1)); +m=(0<=(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m)))&&(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m)))<=99) +?1900+(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m))):m; +var d=(%_DateField(this,0)+%_DateField(this,21)); +var o,q,h; +if((!%_IsSmi(%IS_VAR(d))&&!(d==d))){ +o=0; +q=1; +h=0; +}else{ +o=(%_DateField(this,2)); +q=(%_DateField(this,3)); +h=(%_DateField(this,10)); +} +var r=MakeDay(m,o,q); +return(%DateSetValue(this,MakeDate(r,h),0)); +} +function DateToGMTString(){ +return %_CallFunction(this,DateToUTCString); +} +function PadInt(Q,R){ +if(R==1)return Q; +return Q<%_MathPow(10,R-1)?'0'+PadInt(Q,R-1):Q; +} +function DateToISOString(){ +var d=(%_DateField(this,0)); +if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))throw MakeRangeError("invalid_time_value",[]); +var m=this.getUTCFullYear(); +var S; +if(m>=0&&m<=9999){ +S=PadInt(m,4); +}else{ +if(m<0){ +S="-"+PadInt(-m,6); +}else{ +S="+"+PadInt(m,6); +} +} +return S+ +'-'+PadInt(this.getUTCMonth()+1,2)+ +'-'+PadInt(this.getUTCDate(),2)+ +'T'+PadInt(this.getUTCHours(),2)+ +':'+PadInt(this.getUTCMinutes(),2)+ +':'+PadInt(this.getUTCSeconds(),2)+ +'.'+PadInt(this.getUTCMilliseconds(),3)+ +'Z'; +} +function DateToJSON(T){ +var U=ToObject(this); +var W=DefaultNumber(U); +if((typeof(W)==='number')&&!(%_IsSmi(%IS_VAR(W))||((W==W)&&(W!=1/0)&&(W!=-1/0)))){ +return null; +} +return U.toISOString(); +} +var X; +var Y=$NaN; +function CheckDateCacheCurrent(){ +if(!X){ +X=%DateCacheVersion(); +if(!X)return; +} +if(X[0]==Y){ +return; +} +Y=X[0]; +b=$NaN; +c=(void 0); +t.time=$NaN; +t.string=null; +} +function CreateDate(h){ +var q=new a(); +q.setTime(h); +return q; +} +%SetCode(a,DateConstructor); +%FunctionSetPrototype(a,new a($NaN)); +InstallFunctions(a,2,$Array( +"UTC",DateUTC, +"parse",DateParse, +"now",DateNow +)); +%AddNamedProperty(a.prototype,"constructor",a,2); +InstallFunctions(a.prototype,2,$Array( +"toString",DateToString, +"toDateString",DateToDateString, +"toTimeString",DateToTimeString, +"toLocaleString",DateToLocaleString, +"toLocaleDateString",DateToLocaleDateString, +"toLocaleTimeString",DateToLocaleTimeString, +"valueOf",DateValueOf, +"getTime",DateGetTime, +"getFullYear",DateGetFullYear, +"getUTCFullYear",DateGetUTCFullYear, +"getMonth",DateGetMonth, +"getUTCMonth",DateGetUTCMonth, +"getDate",DateGetDate, +"getUTCDate",DateGetUTCDate, +"getDay",DateGetDay, +"getUTCDay",DateGetUTCDay, +"getHours",DateGetHours, +"getUTCHours",DateGetUTCHours, +"getMinutes",DateGetMinutes, +"getUTCMinutes",DateGetUTCMinutes, +"getSeconds",DateGetSeconds, +"getUTCSeconds",DateGetUTCSeconds, +"getMilliseconds",DateGetMilliseconds, +"getUTCMilliseconds",DateGetUTCMilliseconds, +"getTimezoneOffset",DateGetTimezoneOffset, +"setTime",DateSetTime, +"setMilliseconds",DateSetMilliseconds, +"setUTCMilliseconds",DateSetUTCMilliseconds, +"setSeconds",DateSetSeconds, +"setUTCSeconds",DateSetUTCSeconds, +"setMinutes",DateSetMinutes, +"setUTCMinutes",DateSetUTCMinutes, +"setHours",DateSetHours, +"setUTCHours",DateSetUTCHours, +"setDate",DateSetDate, +"setUTCDate",DateSetUTCDate, +"setMonth",DateSetMonth, +"setUTCMonth",DateSetUTCMonth, +"setFullYear",DateSetFullYear, +"setUTCFullYear",DateSetUTCFullYear, +"toGMTString",DateToGMTString, +"toUTCString",DateToUTCString, +"getYear",DateGetYear, +"setYear",DateSetYear, +"toISOString",DateToISOString, +"toJSON",DateToJSON +)); +$createDate=CreateDate; +})(); + +regexp}o +var $regexpExec; +var $regexpExecNoTests; +var $regexpLastMatchInfo; +var $regexpLastMatchInfoOverride; +var harmony_regexps=false; +var harmony_unicode_regexps=false; +(function(){ +%CheckIsBootstrapping(); +var a=global.RegExp; +var b=global.Array; +$regexpLastMatchInfo=new InternalPackedArray( +2, +"", +(void 0), +0, +0 +); +$regexpLastMatchInfoOverride=null; +function DoConstructRegExp(c,d,g){ +if((%_IsRegExp(d))){ +if(!(g===(void 0))){ +throw MakeTypeError('regexp_flags',[]); +} +g=(d.global?'g':'') ++(d.ignoreCase?'i':'') ++(d.multiline?'m':''); +if(harmony_unicode_regexps) +g+=(d.unicode?'u':''); +if(harmony_regexps) +g+=(d.sticky?'y':''); +d=d.source; +} +d=(d===(void 0))?'':ToString(d); +g=(g===(void 0))?'':ToString(g); +%RegExpInitializeAndCompile(c,d,g); +} +function RegExpConstructor(d,g){ +if(%_IsConstructCall()){ +DoConstructRegExp(this,d,g); +}else{ +if((%_IsRegExp(d))&&(g===(void 0))){ +return d; +} +return new a(d,g); +} +} +function RegExpCompileJS(d,g){ +if(this==a.prototype){ +throw MakeTypeError('incompatible_method_receiver', +['RegExp.prototype.compile',this]); +} +if((d===(void 0))&&%_ArgumentsLength()!=0){ +DoConstructRegExp(this,'undefined',g); +}else{ +DoConstructRegExp(this,d,g); +} +} +function DoRegExpExec(h,i,j){ +var k=%_RegExpExec(h,i,j,$regexpLastMatchInfo); +if(k!==null)$regexpLastMatchInfoOverride=null; +return k; +} +function RegExpExecNoTests(h,i,l){ +var m=%_RegExpExec(h,i,l,$regexpLastMatchInfo); +if(m!==null){ +$regexpLastMatchInfoOverride=null; +var o=((m)[0])>>1; +var l=m[3]; +var q=m[4]; +var r=%_SubString(i,l,q); +var k=%_RegExpConstructResult(o,l,i); +k[0]=r; +if(o==1)return k; +var t=3+2; +for(var u=1;ui.length){ +this.lastIndex=0; +return null; +} +}else{ +u=0; +} +var A=%_RegExpExec(this,i,u,$regexpLastMatchInfo); +if((A===null)){ +this.lastIndex=0; +return null; +} +$regexpLastMatchInfoOverride=null; +if(z){ +this.lastIndex=$regexpLastMatchInfo[4]; +} +var o=((A)[0])>>1; +var l=A[3]; +var q=A[4]; +var r=%_SubString(i,l,q); +var k=%_RegExpConstructResult(o,l,i); +k[0]=r; +if(o==1)return k; +var t=3+2; +for(var u=1;ui.length){ +this.lastIndex=0; +return false; +} +var A=%_RegExpExec(this,i,u,$regexpLastMatchInfo); +if((A===null)){ +this.lastIndex=0; +return false; +} +$regexpLastMatchInfoOverride=null; +this.lastIndex=$regexpLastMatchInfo[4]; +return true; +}else{ +var h=this; +if(h.source.length>=3&& +%_StringCharCodeAt(h.source,0)==46&& +%_StringCharCodeAt(h.source,1)==42&& +%_StringCharCodeAt(h.source,2)!=63){ +h=TrimRegExp(h); +} +var A=%_RegExpExec(h,i,0,$regexpLastMatchInfo); +if((A===null)){ +this.lastIndex=0; +return false; +} +$regexpLastMatchInfoOverride=null; +return true; +} +} +function TrimRegExp(h){ +if(!%_ObjectEquals(B,h)){ +B=h; +C= +new a(%_SubString(h.source,2,h.source.length), +(h.ignoreCase?h.multiline?"im":"i" +:h.multiline?"m":"")); +} +return C; +} +function RegExpToString(){ +if(!(%_IsRegExp(this))){ +throw MakeTypeError('incompatible_method_receiver', +['RegExp.prototype.toString',this]); +} +var k='/'+this.source+'/'; +if(this.global)k+='g'; +if(this.ignoreCase)k+='i'; +if(this.multiline)k+='m'; +if(harmony_unicode_regexps&&this.unicode)k+='u'; +if(harmony_regexps&&this.sticky)k+='y'; +return k; +} +function RegExpGetLastMatch(){ +if($regexpLastMatchInfoOverride!==null){ +return(($regexpLastMatchInfoOverride)[0]); +} +var D=(($regexpLastMatchInfo)[1]); +return %_SubString(D, +$regexpLastMatchInfo[3], +$regexpLastMatchInfo[4]); +} +function RegExpGetLastParen(){ +if($regexpLastMatchInfoOverride){ +var E=$regexpLastMatchInfoOverride; +if(E.length<=3)return''; +return E[E.length-3]; +} +var G=(($regexpLastMatchInfo)[0]); +if(G<=2)return''; +var D=(($regexpLastMatchInfo)[1]); +var l=$regexpLastMatchInfo[(3+(G-2))]; +var q=$regexpLastMatchInfo[(3+(G-1))]; +if(l!=-1&&q!=-1){ +return %_SubString(D,l,q); +} +return""; +} +function RegExpGetLeftContext(){ +var H; +var I; +if(!$regexpLastMatchInfoOverride){ +H=$regexpLastMatchInfo[3]; +I=(($regexpLastMatchInfo)[1]); +}else{ +var E=$regexpLastMatchInfoOverride; +H=((E)[(E).length-2]); +I=((E)[(E).length-1]); +} +return %_SubString(I,0,H); +} +function RegExpGetRightContext(){ +var H; +var I; +if(!$regexpLastMatchInfoOverride){ +H=$regexpLastMatchInfo[4]; +I=(($regexpLastMatchInfo)[1]); +}else{ +var E=$regexpLastMatchInfoOverride; +I=((E)[(E).length-1]); +var J=((E)[0]); +H=((E)[(E).length-2])+J.length; +} +return %_SubString(I,H,I.length); +} +function RegExpMakeCaptureGetter(K){ +return function foo(){ +if($regexpLastMatchInfoOverride){ +if(K<$regexpLastMatchInfoOverride.length-2){ +return(($regexpLastMatchInfoOverride)[(K)]); +} +return''; +} +var j=K*2; +if(j>=(($regexpLastMatchInfo)[0]))return''; +var L=$regexpLastMatchInfo[(3+(j))]; +var M=$regexpLastMatchInfo[(3+(j+1))]; +if(L==-1||M==-1)return''; +return %_SubString((($regexpLastMatchInfo)[1]),L,M); +}; +} +%FunctionSetInstanceClassName(a,'RegExp'); +%AddNamedProperty( +a.prototype,'constructor',a,2); +%SetCode(a,RegExpConstructor); +InstallFunctions(a.prototype,2,b( +"exec",RegExpExecJS, +"test",RegExpTest, +"toString",RegExpToString, +"compile",RegExpCompileJS +)); +%FunctionSetLength(a.prototype.compile,1); +var N=function(){ +var P=(($regexpLastMatchInfo)[2]); +return(P===(void 0))?"":P; +}; +var Q=function(i){ +(($regexpLastMatchInfo)[2])=ToString(i); +}; +%OptimizeObjectForAddingMultipleProperties(a,22); +%DefineAccessorPropertyUnchecked(a,'input',N, +Q,4); +%DefineAccessorPropertyUnchecked(a,'$_',N, +Q,2|4); +var R=false; +var S=function(){return R;}; +var T=function(U){R=U?true:false;}; +%DefineAccessorPropertyUnchecked(a,'multiline',S, +T,4); +%DefineAccessorPropertyUnchecked(a,'$*',S, +T, +2|4); +var W=function(X){}; +%DefineAccessorPropertyUnchecked(a,'lastMatch',RegExpGetLastMatch, +W,4); +%DefineAccessorPropertyUnchecked(a,'$&',RegExpGetLastMatch, +W,2|4); +%DefineAccessorPropertyUnchecked(a,'lastParen',RegExpGetLastParen, +W,4); +%DefineAccessorPropertyUnchecked(a,'$+',RegExpGetLastParen, +W,2|4); +%DefineAccessorPropertyUnchecked(a,'leftContext', +RegExpGetLeftContext,W, +4); +%DefineAccessorPropertyUnchecked(a,'$`',RegExpGetLeftContext, +W,2|4); +%DefineAccessorPropertyUnchecked(a,'rightContext', +RegExpGetRightContext,W, +4); +%DefineAccessorPropertyUnchecked(a,"$'",RegExpGetRightContext, +W,2|4); +for(var u=1;u<10;++u){ +%DefineAccessorPropertyUnchecked(a,'$'+u, +RegExpMakeCaptureGetter(u),W, +4); +} +%ToFastProperties(a); +$regexpExecNoTests=RegExpExecNoTests; +$regexpExec=DoRegExpExec; +})(); + +,arraybufferi +"use strict"; +var $ArrayBuffer=global.ArrayBuffer; +function ArrayBufferConstructor(a){ +if(%_IsConstructCall()){ +var b=ToPositiveInteger(a,'invalid_array_buffer_length'); +%ArrayBufferInitialize(this,b); +}else{ +throw MakeTypeError('constructor_not_function',["ArrayBuffer"]); +} +} +function ArrayBufferGetByteLen(){ +if(!(%_ClassOf(this)==='ArrayBuffer')){ +throw MakeTypeError('incompatible_method_receiver', +['ArrayBuffer.prototype.byteLength',this]); +} +return %_ArrayBufferGetByteLength(this); +} +function ArrayBufferSlice(a,b){ +if(!(%_ClassOf(this)==='ArrayBuffer')){ +throw MakeTypeError('incompatible_method_receiver', +['ArrayBuffer.prototype.slice',this]); +} +var c=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); +if(!(b===(void 0))){ +b=(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); +} +var d; +var g=%_ArrayBufferGetByteLength(this); +if(c<0){ +d=$max(g+c,0); +}else{ +d=$min(c,g); +} +var h=(b===(void 0))?g:b; +var i; +if(h<0){ +i=$max(g+h,0); +}else{ +i=$min(h,g); +} +if(ig){ +throw MakeRangeError("invalid_typed_array_offset"); +} +} +var i; +var j; +if((d===(void 0))){ +if(g % 1!==0){ +throw MakeRangeError("invalid_typed_array_alignment", +["byte length","Uint8Array",1]); +} +i=g-h; +j=i/1; +}else{ +var j=d; +i=j*1; +} +if((h+i>g) +||(j>%_MaxSmi())){ +throw MakeRangeError("invalid_typed_array_length"); +} +%_TypedArrayInitialize(a,1,b,h,i); +} +function Uint8ArrayConstructByLength(a,b){ +var c=(b===(void 0))? +0:ToPositiveInteger(b,"invalid_typed_array_length"); +if(c>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +var d=c*1; +if(d>%_TypedArrayMaxSizeInHeap()){ +var g=new $ArrayBuffer(d); +%_TypedArrayInitialize(a,1,g,0,d); +}else{ +%_TypedArrayInitialize(a,1,null,0,d); +} +} +function Uint8ArrayConstructByArrayLike(a,b){ +var c=b.length; +var d=ToPositiveInteger(c,"invalid_typed_array_length"); +if(d>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +if(!%TypedArrayInitializeFromArrayLike(a,1,b,d)){ +for(var g=0;gg){ +throw MakeRangeError("invalid_typed_array_offset"); +} +} +var i; +var j; +if((d===(void 0))){ +if(g % 1!==0){ +throw MakeRangeError("invalid_typed_array_alignment", +["byte length","Int8Array",1]); +} +i=g-h; +j=i/1; +}else{ +var j=d; +i=j*1; +} +if((h+i>g) +||(j>%_MaxSmi())){ +throw MakeRangeError("invalid_typed_array_length"); +} +%_TypedArrayInitialize(a,2,b,h,i); +} +function Int8ArrayConstructByLength(a,b){ +var c=(b===(void 0))? +0:ToPositiveInteger(b,"invalid_typed_array_length"); +if(c>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +var d=c*1; +if(d>%_TypedArrayMaxSizeInHeap()){ +var g=new $ArrayBuffer(d); +%_TypedArrayInitialize(a,2,g,0,d); +}else{ +%_TypedArrayInitialize(a,2,null,0,d); +} +} +function Int8ArrayConstructByArrayLike(a,b){ +var c=b.length; +var d=ToPositiveInteger(c,"invalid_typed_array_length"); +if(d>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +if(!%TypedArrayInitializeFromArrayLike(a,2,b,d)){ +for(var g=0;gg){ +throw MakeRangeError("invalid_typed_array_offset"); +} +} +var i; +var j; +if((d===(void 0))){ +if(g % 2!==0){ +throw MakeRangeError("invalid_typed_array_alignment", +["byte length","Uint16Array",2]); +} +i=g-h; +j=i/2; +}else{ +var j=d; +i=j*2; +} +if((h+i>g) +||(j>%_MaxSmi())){ +throw MakeRangeError("invalid_typed_array_length"); +} +%_TypedArrayInitialize(a,3,b,h,i); +} +function Uint16ArrayConstructByLength(a,b){ +var c=(b===(void 0))? +0:ToPositiveInteger(b,"invalid_typed_array_length"); +if(c>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +var d=c*2; +if(d>%_TypedArrayMaxSizeInHeap()){ +var g=new $ArrayBuffer(d); +%_TypedArrayInitialize(a,3,g,0,d); +}else{ +%_TypedArrayInitialize(a,3,null,0,d); +} +} +function Uint16ArrayConstructByArrayLike(a,b){ +var c=b.length; +var d=ToPositiveInteger(c,"invalid_typed_array_length"); +if(d>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +if(!%TypedArrayInitializeFromArrayLike(a,3,b,d)){ +for(var g=0;gg){ +throw MakeRangeError("invalid_typed_array_offset"); +} +} +var i; +var j; +if((d===(void 0))){ +if(g % 2!==0){ +throw MakeRangeError("invalid_typed_array_alignment", +["byte length","Int16Array",2]); +} +i=g-h; +j=i/2; +}else{ +var j=d; +i=j*2; +} +if((h+i>g) +||(j>%_MaxSmi())){ +throw MakeRangeError("invalid_typed_array_length"); +} +%_TypedArrayInitialize(a,4,b,h,i); +} +function Int16ArrayConstructByLength(a,b){ +var c=(b===(void 0))? +0:ToPositiveInteger(b,"invalid_typed_array_length"); +if(c>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +var d=c*2; +if(d>%_TypedArrayMaxSizeInHeap()){ +var g=new $ArrayBuffer(d); +%_TypedArrayInitialize(a,4,g,0,d); +}else{ +%_TypedArrayInitialize(a,4,null,0,d); +} +} +function Int16ArrayConstructByArrayLike(a,b){ +var c=b.length; +var d=ToPositiveInteger(c,"invalid_typed_array_length"); +if(d>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +if(!%TypedArrayInitializeFromArrayLike(a,4,b,d)){ +for(var g=0;gg){ +throw MakeRangeError("invalid_typed_array_offset"); +} +} +var i; +var j; +if((d===(void 0))){ +if(g % 4!==0){ +throw MakeRangeError("invalid_typed_array_alignment", +["byte length","Uint32Array",4]); +} +i=g-h; +j=i/4; +}else{ +var j=d; +i=j*4; +} +if((h+i>g) +||(j>%_MaxSmi())){ +throw MakeRangeError("invalid_typed_array_length"); +} +%_TypedArrayInitialize(a,5,b,h,i); +} +function Uint32ArrayConstructByLength(a,b){ +var c=(b===(void 0))? +0:ToPositiveInteger(b,"invalid_typed_array_length"); +if(c>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +var d=c*4; +if(d>%_TypedArrayMaxSizeInHeap()){ +var g=new $ArrayBuffer(d); +%_TypedArrayInitialize(a,5,g,0,d); +}else{ +%_TypedArrayInitialize(a,5,null,0,d); +} +} +function Uint32ArrayConstructByArrayLike(a,b){ +var c=b.length; +var d=ToPositiveInteger(c,"invalid_typed_array_length"); +if(d>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +if(!%TypedArrayInitializeFromArrayLike(a,5,b,d)){ +for(var g=0;gg){ +throw MakeRangeError("invalid_typed_array_offset"); +} +} +var i; +var j; +if((d===(void 0))){ +if(g % 4!==0){ +throw MakeRangeError("invalid_typed_array_alignment", +["byte length","Int32Array",4]); +} +i=g-h; +j=i/4; +}else{ +var j=d; +i=j*4; +} +if((h+i>g) +||(j>%_MaxSmi())){ +throw MakeRangeError("invalid_typed_array_length"); +} +%_TypedArrayInitialize(a,6,b,h,i); +} +function Int32ArrayConstructByLength(a,b){ +var c=(b===(void 0))? +0:ToPositiveInteger(b,"invalid_typed_array_length"); +if(c>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +var d=c*4; +if(d>%_TypedArrayMaxSizeInHeap()){ +var g=new $ArrayBuffer(d); +%_TypedArrayInitialize(a,6,g,0,d); +}else{ +%_TypedArrayInitialize(a,6,null,0,d); +} +} +function Int32ArrayConstructByArrayLike(a,b){ +var c=b.length; +var d=ToPositiveInteger(c,"invalid_typed_array_length"); +if(d>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +if(!%TypedArrayInitializeFromArrayLike(a,6,b,d)){ +for(var g=0;gg){ +throw MakeRangeError("invalid_typed_array_offset"); +} +} +var i; +var j; +if((d===(void 0))){ +if(g % 4!==0){ +throw MakeRangeError("invalid_typed_array_alignment", +["byte length","Float32Array",4]); +} +i=g-h; +j=i/4; +}else{ +var j=d; +i=j*4; +} +if((h+i>g) +||(j>%_MaxSmi())){ +throw MakeRangeError("invalid_typed_array_length"); +} +%_TypedArrayInitialize(a,7,b,h,i); +} +function Float32ArrayConstructByLength(a,b){ +var c=(b===(void 0))? +0:ToPositiveInteger(b,"invalid_typed_array_length"); +if(c>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +var d=c*4; +if(d>%_TypedArrayMaxSizeInHeap()){ +var g=new $ArrayBuffer(d); +%_TypedArrayInitialize(a,7,g,0,d); +}else{ +%_TypedArrayInitialize(a,7,null,0,d); +} +} +function Float32ArrayConstructByArrayLike(a,b){ +var c=b.length; +var d=ToPositiveInteger(c,"invalid_typed_array_length"); +if(d>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +if(!%TypedArrayInitializeFromArrayLike(a,7,b,d)){ +for(var g=0;gg){ +throw MakeRangeError("invalid_typed_array_offset"); +} +} +var i; +var j; +if((d===(void 0))){ +if(g % 8!==0){ +throw MakeRangeError("invalid_typed_array_alignment", +["byte length","Float64Array",8]); +} +i=g-h; +j=i/8; +}else{ +var j=d; +i=j*8; +} +if((h+i>g) +||(j>%_MaxSmi())){ +throw MakeRangeError("invalid_typed_array_length"); +} +%_TypedArrayInitialize(a,8,b,h,i); +} +function Float64ArrayConstructByLength(a,b){ +var c=(b===(void 0))? +0:ToPositiveInteger(b,"invalid_typed_array_length"); +if(c>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +var d=c*8; +if(d>%_TypedArrayMaxSizeInHeap()){ +var g=new $ArrayBuffer(d); +%_TypedArrayInitialize(a,8,g,0,d); +}else{ +%_TypedArrayInitialize(a,8,null,0,d); +} +} +function Float64ArrayConstructByArrayLike(a,b){ +var c=b.length; +var d=ToPositiveInteger(c,"invalid_typed_array_length"); +if(d>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +if(!%TypedArrayInitializeFromArrayLike(a,8,b,d)){ +for(var g=0;gg){ +throw MakeRangeError("invalid_typed_array_offset"); +} +} +var i; +var j; +if((d===(void 0))){ +if(g % 1!==0){ +throw MakeRangeError("invalid_typed_array_alignment", +["byte length","Uint8ClampedArray",1]); +} +i=g-h; +j=i/1; +}else{ +var j=d; +i=j*1; +} +if((h+i>g) +||(j>%_MaxSmi())){ +throw MakeRangeError("invalid_typed_array_length"); +} +%_TypedArrayInitialize(a,9,b,h,i); +} +function Uint8ClampedArrayConstructByLength(a,b){ +var c=(b===(void 0))? +0:ToPositiveInteger(b,"invalid_typed_array_length"); +if(c>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +var d=c*1; +if(d>%_TypedArrayMaxSizeInHeap()){ +var g=new $ArrayBuffer(d); +%_TypedArrayInitialize(a,9,g,0,d); +}else{ +%_TypedArrayInitialize(a,9,null,0,d); +} +} +function Uint8ClampedArrayConstructByArrayLike(a,b){ +var c=b.length; +var d=ToPositiveInteger(c,"invalid_typed_array_length"); +if(d>%_MaxSmi()){ +throw MakeRangeError("invalid_typed_array_length"); +} +if(!%TypedArrayInitializeFromArrayLike(a,9,b,d)){ +for(var g=0;g0){ +for(var g=0;g=k&&i>=j; +l--){ +a[c+l]=b[l]; +i-=g; +j-=d; +} +return l; +} +var l=CopyRightPart(); +var m=new $Array(l+1-k); +for(var o=k;o<=l;o++){ +m[o-k]=b[o]; +} +for(o=k;o<=l;o++){ +a[c+o]=m[o-k]; +} +} +function TypedArraySet(a,b){ +var c=(b===(void 0))?0:(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); +if(c<0){ +throw MakeTypeError("typed_array_set_negative_offset"); +} +if(c>%_MaxSmi()){ +throw MakeRangeError("typed_array_set_source_too_large"); +} +switch(%TypedArraySetFastCases(this,a,c)){ +case 0: +return; +case 1: +TypedArraySetFromOverlappingTypedArray(this,a,c); +return; +case 2: +TypedArraySetFromArrayLike(this,a,a.length,c); +return; +case 3: +var d=a.length; +if((d===(void 0))){ +if((typeof(a)==='number')){ +throw MakeTypeError("invalid_argument"); +} +return; +} +if(c+d>this.length){ +throw MakeRangeError("typed_array_set_source_too_large"); +} +TypedArraySetFromArrayLike(this,a,d,c); +return; +} +} +function TypedArrayGetToStringTag(){ +if(!%IsTypedArray(this))return; +var a=%_ClassOf(this); +if((a===(void 0)))return; +return a; +} +function SetupTypedArrays(){ +%CheckIsBootstrapping(); +%SetCode(global.Uint8Array,Uint8ArrayConstructor); +%FunctionSetPrototype(global.Uint8Array,new $Object()); +%AddNamedProperty(global.Uint8Array,"BYTES_PER_ELEMENT",1, +1|2|4); +%AddNamedProperty(global.Uint8Array.prototype, +"constructor",global.Uint8Array,2); +%AddNamedProperty(global.Uint8Array.prototype, +"BYTES_PER_ELEMENT",1, +1|2|4); +InstallGetter(global.Uint8Array.prototype,"buffer",Uint8Array_GetBuffer); +InstallGetter(global.Uint8Array.prototype,"byteOffset",Uint8Array_GetByteOffset); +InstallGetter(global.Uint8Array.prototype,"byteLength",Uint8Array_GetByteLength); +InstallGetter(global.Uint8Array.prototype,"length",Uint8Array_GetLength); +InstallGetter(global.Uint8Array.prototype,symbolToStringTag, +TypedArrayGetToStringTag); +InstallFunctions(global.Uint8Array.prototype,2,$Array( +"subarray",Uint8ArraySubArray, +"set",TypedArraySet +)); + +%CheckIsBootstrapping(); +%SetCode(global.Int8Array,Int8ArrayConstructor); +%FunctionSetPrototype(global.Int8Array,new $Object()); +%AddNamedProperty(global.Int8Array,"BYTES_PER_ELEMENT",1, +1|2|4); +%AddNamedProperty(global.Int8Array.prototype, +"constructor",global.Int8Array,2); +%AddNamedProperty(global.Int8Array.prototype, +"BYTES_PER_ELEMENT",1, +1|2|4); +InstallGetter(global.Int8Array.prototype,"buffer",Int8Array_GetBuffer); +InstallGetter(global.Int8Array.prototype,"byteOffset",Int8Array_GetByteOffset); +InstallGetter(global.Int8Array.prototype,"byteLength",Int8Array_GetByteLength); +InstallGetter(global.Int8Array.prototype,"length",Int8Array_GetLength); +InstallGetter(global.Int8Array.prototype,symbolToStringTag, +TypedArrayGetToStringTag); +InstallFunctions(global.Int8Array.prototype,2,$Array( +"subarray",Int8ArraySubArray, +"set",TypedArraySet +)); + +%CheckIsBootstrapping(); +%SetCode(global.Uint16Array,Uint16ArrayConstructor); +%FunctionSetPrototype(global.Uint16Array,new $Object()); +%AddNamedProperty(global.Uint16Array,"BYTES_PER_ELEMENT",2, +1|2|4); +%AddNamedProperty(global.Uint16Array.prototype, +"constructor",global.Uint16Array,2); +%AddNamedProperty(global.Uint16Array.prototype, +"BYTES_PER_ELEMENT",2, +1|2|4); +InstallGetter(global.Uint16Array.prototype,"buffer",Uint16Array_GetBuffer); +InstallGetter(global.Uint16Array.prototype,"byteOffset",Uint16Array_GetByteOffset); +InstallGetter(global.Uint16Array.prototype,"byteLength",Uint16Array_GetByteLength); +InstallGetter(global.Uint16Array.prototype,"length",Uint16Array_GetLength); +InstallGetter(global.Uint16Array.prototype,symbolToStringTag, +TypedArrayGetToStringTag); +InstallFunctions(global.Uint16Array.prototype,2,$Array( +"subarray",Uint16ArraySubArray, +"set",TypedArraySet +)); + +%CheckIsBootstrapping(); +%SetCode(global.Int16Array,Int16ArrayConstructor); +%FunctionSetPrototype(global.Int16Array,new $Object()); +%AddNamedProperty(global.Int16Array,"BYTES_PER_ELEMENT",2, +1|2|4); +%AddNamedProperty(global.Int16Array.prototype, +"constructor",global.Int16Array,2); +%AddNamedProperty(global.Int16Array.prototype, +"BYTES_PER_ELEMENT",2, +1|2|4); +InstallGetter(global.Int16Array.prototype,"buffer",Int16Array_GetBuffer); +InstallGetter(global.Int16Array.prototype,"byteOffset",Int16Array_GetByteOffset); +InstallGetter(global.Int16Array.prototype,"byteLength",Int16Array_GetByteLength); +InstallGetter(global.Int16Array.prototype,"length",Int16Array_GetLength); +InstallGetter(global.Int16Array.prototype,symbolToStringTag, +TypedArrayGetToStringTag); +InstallFunctions(global.Int16Array.prototype,2,$Array( +"subarray",Int16ArraySubArray, +"set",TypedArraySet +)); + +%CheckIsBootstrapping(); +%SetCode(global.Uint32Array,Uint32ArrayConstructor); +%FunctionSetPrototype(global.Uint32Array,new $Object()); +%AddNamedProperty(global.Uint32Array,"BYTES_PER_ELEMENT",4, +1|2|4); +%AddNamedProperty(global.Uint32Array.prototype, +"constructor",global.Uint32Array,2); +%AddNamedProperty(global.Uint32Array.prototype, +"BYTES_PER_ELEMENT",4, +1|2|4); +InstallGetter(global.Uint32Array.prototype,"buffer",Uint32Array_GetBuffer); +InstallGetter(global.Uint32Array.prototype,"byteOffset",Uint32Array_GetByteOffset); +InstallGetter(global.Uint32Array.prototype,"byteLength",Uint32Array_GetByteLength); +InstallGetter(global.Uint32Array.prototype,"length",Uint32Array_GetLength); +InstallGetter(global.Uint32Array.prototype,symbolToStringTag, +TypedArrayGetToStringTag); +InstallFunctions(global.Uint32Array.prototype,2,$Array( +"subarray",Uint32ArraySubArray, +"set",TypedArraySet +)); + +%CheckIsBootstrapping(); +%SetCode(global.Int32Array,Int32ArrayConstructor); +%FunctionSetPrototype(global.Int32Array,new $Object()); +%AddNamedProperty(global.Int32Array,"BYTES_PER_ELEMENT",4, +1|2|4); +%AddNamedProperty(global.Int32Array.prototype, +"constructor",global.Int32Array,2); +%AddNamedProperty(global.Int32Array.prototype, +"BYTES_PER_ELEMENT",4, +1|2|4); +InstallGetter(global.Int32Array.prototype,"buffer",Int32Array_GetBuffer); +InstallGetter(global.Int32Array.prototype,"byteOffset",Int32Array_GetByteOffset); +InstallGetter(global.Int32Array.prototype,"byteLength",Int32Array_GetByteLength); +InstallGetter(global.Int32Array.prototype,"length",Int32Array_GetLength); +InstallGetter(global.Int32Array.prototype,symbolToStringTag, +TypedArrayGetToStringTag); +InstallFunctions(global.Int32Array.prototype,2,$Array( +"subarray",Int32ArraySubArray, +"set",TypedArraySet +)); + +%CheckIsBootstrapping(); +%SetCode(global.Float32Array,Float32ArrayConstructor); +%FunctionSetPrototype(global.Float32Array,new $Object()); +%AddNamedProperty(global.Float32Array,"BYTES_PER_ELEMENT",4, +1|2|4); +%AddNamedProperty(global.Float32Array.prototype, +"constructor",global.Float32Array,2); +%AddNamedProperty(global.Float32Array.prototype, +"BYTES_PER_ELEMENT",4, +1|2|4); +InstallGetter(global.Float32Array.prototype,"buffer",Float32Array_GetBuffer); +InstallGetter(global.Float32Array.prototype,"byteOffset",Float32Array_GetByteOffset); +InstallGetter(global.Float32Array.prototype,"byteLength",Float32Array_GetByteLength); +InstallGetter(global.Float32Array.prototype,"length",Float32Array_GetLength); +InstallGetter(global.Float32Array.prototype,symbolToStringTag, +TypedArrayGetToStringTag); +InstallFunctions(global.Float32Array.prototype,2,$Array( +"subarray",Float32ArraySubArray, +"set",TypedArraySet +)); + +%CheckIsBootstrapping(); +%SetCode(global.Float64Array,Float64ArrayConstructor); +%FunctionSetPrototype(global.Float64Array,new $Object()); +%AddNamedProperty(global.Float64Array,"BYTES_PER_ELEMENT",8, +1|2|4); +%AddNamedProperty(global.Float64Array.prototype, +"constructor",global.Float64Array,2); +%AddNamedProperty(global.Float64Array.prototype, +"BYTES_PER_ELEMENT",8, +1|2|4); +InstallGetter(global.Float64Array.prototype,"buffer",Float64Array_GetBuffer); +InstallGetter(global.Float64Array.prototype,"byteOffset",Float64Array_GetByteOffset); +InstallGetter(global.Float64Array.prototype,"byteLength",Float64Array_GetByteLength); +InstallGetter(global.Float64Array.prototype,"length",Float64Array_GetLength); +InstallGetter(global.Float64Array.prototype,symbolToStringTag, +TypedArrayGetToStringTag); +InstallFunctions(global.Float64Array.prototype,2,$Array( +"subarray",Float64ArraySubArray, +"set",TypedArraySet +)); + +%CheckIsBootstrapping(); +%SetCode(global.Uint8ClampedArray,Uint8ClampedArrayConstructor); +%FunctionSetPrototype(global.Uint8ClampedArray,new $Object()); +%AddNamedProperty(global.Uint8ClampedArray,"BYTES_PER_ELEMENT",1, +1|2|4); +%AddNamedProperty(global.Uint8ClampedArray.prototype, +"constructor",global.Uint8ClampedArray,2); +%AddNamedProperty(global.Uint8ClampedArray.prototype, +"BYTES_PER_ELEMENT",1, +1|2|4); +InstallGetter(global.Uint8ClampedArray.prototype,"buffer",Uint8ClampedArray_GetBuffer); +InstallGetter(global.Uint8ClampedArray.prototype,"byteOffset",Uint8ClampedArray_GetByteOffset); +InstallGetter(global.Uint8ClampedArray.prototype,"byteLength",Uint8ClampedArray_GetByteLength); +InstallGetter(global.Uint8ClampedArray.prototype,"length",Uint8ClampedArray_GetLength); +InstallGetter(global.Uint8ClampedArray.prototype,symbolToStringTag, +TypedArrayGetToStringTag); +InstallFunctions(global.Uint8ClampedArray.prototype,2,$Array( +"subarray",Uint8ClampedArraySubArray, +"set",TypedArraySet +)); + + +} +SetupTypedArrays(); +var $DataView=global.DataView; +function DataViewConstructor(a,b,c){ +if(%_IsConstructCall()){ +if(!(%_ClassOf(a)==='ArrayBuffer')){ +throw MakeTypeError('data_view_not_array_buffer',[]); +} +if(!(b===(void 0))){ +b=ToPositiveInteger(b,'invalid_data_view_offset'); +} +if(!(c===(void 0))){ +c=(%_IsSmi(%IS_VAR(c))?c:%NumberToInteger(ToNumber(c))); +} +var d=%_ArrayBufferGetByteLength(a); +var g=(b===(void 0))?0:b; +if(g>d){ +throw MakeRangeError('invalid_data_view_offset'); +} +var h=(c===(void 0)) +?d-g +:c; +if(h<0||g+h>d){ +throw new MakeRangeError('invalid_data_view_length'); +} +%_DataViewInitialize(this,a,g,h); +}else{ +throw MakeTypeError('constructor_not_function',["DataView"]); +} +} +function DataViewGetBufferJS(){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.buffer',this]); +} +return %DataViewGetBuffer(this); +} +function DataViewGetByteOffset(){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.byteOffset',this]); +} +return %_ArrayBufferViewGetByteOffset(this); +} +function DataViewGetByteLength(){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.byteLength',this]); +} +return %_ArrayBufferViewGetByteLength(this); +} +function ToPositiveDataViewOffset(a){ +return ToPositiveInteger(a,'invalid_data_view_accessor_offset'); +} +function DataViewGetInt8JS(a,b){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.getInt8',this]); +} +if(%_ArgumentsLength()<1){ +throw MakeTypeError('invalid_argument'); +} +return %DataViewGetInt8(this, +ToPositiveDataViewOffset(a), +!!b); +} +function DataViewSetInt8JS(a,b,c){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.setInt8',this]); +} +if(%_ArgumentsLength()<2){ +throw MakeTypeError('invalid_argument'); +} +%DataViewSetInt8(this, +ToPositiveDataViewOffset(a), +((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), +!!c); +} + +function DataViewGetUint8JS(a,b){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.getUint8',this]); +} +if(%_ArgumentsLength()<1){ +throw MakeTypeError('invalid_argument'); +} +return %DataViewGetUint8(this, +ToPositiveDataViewOffset(a), +!!b); +} +function DataViewSetUint8JS(a,b,c){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.setUint8',this]); +} +if(%_ArgumentsLength()<2){ +throw MakeTypeError('invalid_argument'); +} +%DataViewSetUint8(this, +ToPositiveDataViewOffset(a), +((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), +!!c); +} + +function DataViewGetInt16JS(a,b){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.getInt16',this]); +} +if(%_ArgumentsLength()<1){ +throw MakeTypeError('invalid_argument'); +} +return %DataViewGetInt16(this, +ToPositiveDataViewOffset(a), +!!b); +} +function DataViewSetInt16JS(a,b,c){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.setInt16',this]); +} +if(%_ArgumentsLength()<2){ +throw MakeTypeError('invalid_argument'); +} +%DataViewSetInt16(this, +ToPositiveDataViewOffset(a), +((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), +!!c); +} + +function DataViewGetUint16JS(a,b){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.getUint16',this]); +} +if(%_ArgumentsLength()<1){ +throw MakeTypeError('invalid_argument'); +} +return %DataViewGetUint16(this, +ToPositiveDataViewOffset(a), +!!b); +} +function DataViewSetUint16JS(a,b,c){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.setUint16',this]); +} +if(%_ArgumentsLength()<2){ +throw MakeTypeError('invalid_argument'); +} +%DataViewSetUint16(this, +ToPositiveDataViewOffset(a), +((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), +!!c); +} + +function DataViewGetInt32JS(a,b){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.getInt32',this]); +} +if(%_ArgumentsLength()<1){ +throw MakeTypeError('invalid_argument'); +} +return %DataViewGetInt32(this, +ToPositiveDataViewOffset(a), +!!b); +} +function DataViewSetInt32JS(a,b,c){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.setInt32',this]); +} +if(%_ArgumentsLength()<2){ +throw MakeTypeError('invalid_argument'); +} +%DataViewSetInt32(this, +ToPositiveDataViewOffset(a), +((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), +!!c); +} + +function DataViewGetUint32JS(a,b){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.getUint32',this]); +} +if(%_ArgumentsLength()<1){ +throw MakeTypeError('invalid_argument'); +} +return %DataViewGetUint32(this, +ToPositiveDataViewOffset(a), +!!b); +} +function DataViewSetUint32JS(a,b,c){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.setUint32',this]); +} +if(%_ArgumentsLength()<2){ +throw MakeTypeError('invalid_argument'); +} +%DataViewSetUint32(this, +ToPositiveDataViewOffset(a), +((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), +!!c); +} + +function DataViewGetFloat32JS(a,b){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.getFloat32',this]); +} +if(%_ArgumentsLength()<1){ +throw MakeTypeError('invalid_argument'); +} +return %DataViewGetFloat32(this, +ToPositiveDataViewOffset(a), +!!b); +} +function DataViewSetFloat32JS(a,b,c){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.setFloat32',this]); +} +if(%_ArgumentsLength()<2){ +throw MakeTypeError('invalid_argument'); +} +%DataViewSetFloat32(this, +ToPositiveDataViewOffset(a), +((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), +!!c); +} + +function DataViewGetFloat64JS(a,b){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.getFloat64',this]); +} +if(%_ArgumentsLength()<1){ +throw MakeTypeError('invalid_argument'); +} +return %DataViewGetFloat64(this, +ToPositiveDataViewOffset(a), +!!b); +} +function DataViewSetFloat64JS(a,b,c){ +if(!(%_ClassOf(this)==='DataView')){ +throw MakeTypeError('incompatible_method_receiver', +['DataView.setFloat64',this]); +} +if(%_ArgumentsLength()<2){ +throw MakeTypeError('invalid_argument'); +} +%DataViewSetFloat64(this, +ToPositiveDataViewOffset(a), +((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), +!!c); +} + + +function SetupDataView(){ +%CheckIsBootstrapping(); +%SetCode($DataView,DataViewConstructor); +%FunctionSetPrototype($DataView,new $Object); +%AddNamedProperty($DataView.prototype,"constructor",$DataView,2); +%AddNamedProperty( +$DataView.prototype,symbolToStringTag,"DataView",1|2); +InstallGetter($DataView.prototype,"buffer",DataViewGetBufferJS); +InstallGetter($DataView.prototype,"byteOffset",DataViewGetByteOffset); +InstallGetter($DataView.prototype,"byteLength",DataViewGetByteLength); +InstallFunctions($DataView.prototype,2,$Array( +"getInt8",DataViewGetInt8JS, +"setInt8",DataViewSetInt8JS, +"getUint8",DataViewGetUint8JS, +"setUint8",DataViewSetUint8JS, +"getInt16",DataViewGetInt16JS, +"setInt16",DataViewSetInt16JS, +"getUint16",DataViewGetUint16JS, +"setUint16",DataViewSetUint16JS, +"getInt32",DataViewGetInt32JS, +"setInt32",DataViewSetInt32JS, +"getUint32",DataViewGetUint32JS, +"setUint32",DataViewSetUint32JS, +"getFloat32",DataViewGetFloat32JS, +"setFloat32",DataViewSetFloat32JS, +"getFloat64",DataViewGetFloat64JS, +"setFloat64",DataViewSetFloat64JS +)); +} +SetupDataView(); + +$generatora! +"use strict"; +function GeneratorObjectNext(a){ +if(!(%_ClassOf(this)==='Generator')){ +throw MakeTypeError('incompatible_method_receiver', +['[Generator].prototype.next',this]); +} +var b=%GeneratorGetContinuation(this); +if(b>0){ +if((%_DebugIsActive()!=0))%DebugPrepareStepInIfStepping(this); +try{ +return %_GeneratorNext(this,a); +}catch(e){ +%GeneratorClose(this); +throw e; +} +}else if(b==0){ +return{value:void 0,done:true}; +}else{ +throw MakeTypeError('generator_running',[]); +} +} +function GeneratorObjectThrow(a){ +if(!(%_ClassOf(this)==='Generator')){ +throw MakeTypeError('incompatible_method_receiver', +['[Generator].prototype.throw',this]); +} +var b=%GeneratorGetContinuation(this); +if(b>0){ +try{ +return %_GeneratorThrow(this,a); +}catch(e){ +%GeneratorClose(this); +throw e; +} +}else if(b==0){ +throw a; +}else{ +throw MakeTypeError('generator_running',[]); +} +} +function GeneratorObjectIterator(){ +return this; +} +function GeneratorFunctionPrototypeConstructor(a){ +if(%_IsConstructCall()){ +throw MakeTypeError('not_constructor',['GeneratorFunctionPrototype']); +} +} +function GeneratorFunctionConstructor(a){ +return NewFunctionFromString(arguments,'function*'); +} +function SetUpGenerators(){ +%CheckIsBootstrapping(); +%NeverOptimizeFunction(GeneratorObjectNext); +%NeverOptimizeFunction(GeneratorObjectThrow); +var a=GeneratorFunctionPrototype.prototype; +InstallFunctions(a, +2|4|1, +["next",GeneratorObjectNext, +"throw",GeneratorObjectThrow]); +%FunctionSetName(GeneratorObjectIterator,'[Symbol.iterator]'); +%AddNamedProperty(a,symbolIterator, +GeneratorObjectIterator,2|4|1); +%AddNamedProperty(a,"constructor", +GeneratorFunctionPrototype,2|1); +%AddNamedProperty(a, +symbolToStringTag,"Generator",2|1); +%InternalSetPrototype(GeneratorFunctionPrototype,$Function.prototype); +%AddNamedProperty(GeneratorFunctionPrototype, +symbolToStringTag,"GeneratorFunction",2|1); +%SetCode(GeneratorFunctionPrototype,GeneratorFunctionPrototypeConstructor); +%AddNamedProperty(GeneratorFunctionPrototype,"constructor", +GeneratorFunction,2|1); +%InternalSetPrototype(GeneratorFunction,$Function); +%SetCode(GeneratorFunction,GeneratorFunctionConstructor); +} +SetUpGenerators(); + +8object-observeõ­ +"use strict"; +var observationState; +function GetObservationStateJS(){ +if((observationState===(void 0))){ +observationState=%GetObservationState(); +} +if((observationState.callbackInfoMap===(void 0))){ +observationState.callbackInfoMap=%ObservationWeakMapCreate(); +observationState.objectInfoMap=%ObservationWeakMapCreate(); +observationState.notifierObjectInfoMap=%ObservationWeakMapCreate(); +observationState.pendingObservers=null; +observationState.nextCallbackPriority=0; +observationState.lastMicrotaskId=0; +} +return observationState; +} +function GetPendingObservers(){ +return GetObservationStateJS().pendingObservers; +} +function SetPendingObservers(a){ +GetObservationStateJS().pendingObservers=a; +} +function GetNextCallbackPriority(){ +return GetObservationStateJS().nextCallbackPriority++; +} +function nullProtoObject(){ +return{__proto__:null}; +} +function TypeMapCreate(){ +return nullProtoObject(); +} +function TypeMapAddType(a,b,c){ +a[b]=c?1:(a[b]||0)+1; +} +function TypeMapRemoveType(a,b){ +a[b]--; +} +function TypeMapCreateFromList(a,b){ +var c=TypeMapCreate(); +for(var d=0;d0?a.performing:null; +} +function ConvertAcceptListToTypeMap(a){ +if((a===(void 0))) +return a; +if(!(%_IsSpecObject(a))) +throw MakeTypeError("observe_invalid_accept"); +var b=ToInteger(a.length); +if(b<0)b=0; +return TypeMapCreateFromList(a,b); +} +function CallbackInfoGet(a){ +return %WeakCollectionGet(GetObservationStateJS().callbackInfoMap,a); +} +function CallbackInfoSet(a,b){ +%WeakCollectionSet(GetObservationStateJS().callbackInfoMap, +a,b); +} +function CallbackInfoGetOrCreate(a){ +var b=CallbackInfoGet(a); +if(!(b===(void 0))) +return b; +var c=GetNextCallbackPriority(); +CallbackInfoSet(a,c); +return c; +} +function CallbackInfoGetPriority(a){ +if((typeof(a)==='number')) +return a; +else +return a.priority; +} +function CallbackInfoNormalize(a){ +var b=CallbackInfoGet(a); +if((typeof(b)==='number')){ +var c=b; +b=new InternalArray; +b.priority=c; +CallbackInfoSet(a,b); +} +return b; +} +function ObjectObserve(a,b,c){ +if(!(%_IsSpecObject(a))) +throw MakeTypeError("observe_non_object",["observe"]); +if(%IsJSGlobalProxy(a)) +throw MakeTypeError("observe_global_proxy",["observe"]); +if(!(%_ClassOf(b)==='Function')) +throw MakeTypeError("observe_non_function",["observe"]); +if(ObjectIsFrozen(b)) +throw MakeTypeError("observe_callback_frozen"); +var d=%GetObjectContextObjectObserve(a); +return d(a,b,c); +} +function NativeObjectObserve(a,b,c){ +var d=ObjectInfoGetOrCreate(a); +var g=ConvertAcceptListToTypeMap(c); +ObjectInfoAddObserver(d,b,g); +return a; +} +function ObjectUnobserve(a,b){ +if(!(%_IsSpecObject(a))) +throw MakeTypeError("observe_non_object",["unobserve"]); +if(%IsJSGlobalProxy(a)) +throw MakeTypeError("observe_global_proxy",["unobserve"]); +if(!(%_ClassOf(b)==='Function')) +throw MakeTypeError("observe_non_function",["unobserve"]); +var c=ObjectInfoGet(a); +if((c===(void 0))) +return a; +ObjectInfoRemoveObserver(c,b); +return a; +} +function ArrayObserve(a,b){ +return ObjectObserve(a,b,['add', +'update', +'delete', +'splice']); +} +function ArrayUnobserve(a,b){ +return ObjectUnobserve(a,b); +} +function ObserverEnqueueIfActive(a,b,c){ +if(!ObserverIsActive(a,b)|| +!TypeMapHasType(ObserverGetAcceptTypes(a),c.type)){ +return; +} +var d=ObserverGetCallback(a); +if(!%ObserverObjectAndRecordHaveSameOrigin(d,c.object, +c)){ +return; +} +var g=CallbackInfoNormalize(d); +if((GetPendingObservers()===null)){ +SetPendingObservers(nullProtoObject()); +if((%_DebugIsActive()!=0)){ +var h=++GetObservationStateJS().lastMicrotaskId; +var i="Object.observe"; +%EnqueueMicrotask(function(){ +%DebugAsyncTaskEvent({type:"willHandle",id:h,name:i}); +ObserveMicrotaskRunner(); +%DebugAsyncTaskEvent({type:"didHandle",id:h,name:i}); +}); +%DebugAsyncTaskEvent({type:"enqueue",id:h,name:i}); +}else{ +%EnqueueMicrotask(ObserveMicrotaskRunner); +} +} +GetPendingObservers()[g.priority]=d; +g.push(c); +} +function ObjectInfoEnqueueExternalChangeRecord(a,b,c){ +if(!ObjectInfoHasActiveObservers(a)) +return; +var d=!(c===(void 0)); +var g=d? +{object:a.object,type:c}: +{object:a.object}; +for(var h in b){ +if(h==='object'||(d&&h==='type'))continue; +%DefineDataPropertyUnchecked( +g,h,b[h],1+4); +} +ObjectFreezeJS(g); +ObjectInfoEnqueueInternalChangeRecord(a,g); +} +function ObjectInfoEnqueueInternalChangeRecord(a,b){ +if((typeof(b.name)==='symbol'))return; +if(ChangeObserversIsOptimized(a.changeObservers)){ +var c=a.changeObservers; +ObserverEnqueueIfActive(c,a,b); +return; +} +for(var d in a.changeObservers){ +var c=a.changeObservers[d]; +if((c===null)) +continue; +ObserverEnqueueIfActive(c,a,b); +} +} +function BeginPerformSplice(a){ +var b=ObjectInfoGet(a); +if(!(b===(void 0))) +ObjectInfoAddPerformingType(b,'splice'); +} +function EndPerformSplice(a){ +var b=ObjectInfoGet(a); +if(!(b===(void 0))) +ObjectInfoRemovePerformingType(b,'splice'); +} +function EnqueueSpliceRecord(a,b,c,d){ +var g=ObjectInfoGet(a); +if(!ObjectInfoHasActiveObservers(g)) +return; +var h={ +type:'splice', +object:a, +index:b, +removed:c, +addedCount:d +}; +ObjectFreezeJS(h); +ObjectFreezeJS(h.removed); +ObjectInfoEnqueueInternalChangeRecord(g,h); +} +function NotifyChange(a,b,c,d){ +var g=ObjectInfoGet(b); +if(!ObjectInfoHasActiveObservers(g)) +return; +var h; +if(arguments.length==2){ +h={type:a,object:b}; +}else if(arguments.length==3){ +h={type:a,object:b,name:c}; +}else{ +h={ +type:a, +object:b, +name:c, +oldValue:d +}; +} +ObjectFreezeJS(h); +ObjectInfoEnqueueInternalChangeRecord(g,h); +} +var notifierPrototype={}; +function ObjectNotifierNotify(a){ +if(!(%_IsSpecObject(this))) +throw MakeTypeError("called_on_non_object",["notify"]); +var b=ObjectInfoGetFromNotifier(this); +if((b===(void 0))) +throw MakeTypeError("observe_notify_non_notifier"); +if(!(typeof(a.type)==='string')) +throw MakeTypeError("observe_type_non_string"); +ObjectInfoEnqueueExternalChangeRecord(b,a); +} +function ObjectNotifierPerformChange(a,b){ +if(!(%_IsSpecObject(this))) +throw MakeTypeError("called_on_non_object",["performChange"]); +var c=ObjectInfoGetFromNotifier(this); +if((c===(void 0))) +throw MakeTypeError("observe_notify_non_notifier"); +if(!(typeof(a)==='string')) +throw MakeTypeError("observe_perform_non_string"); +if(!(%_ClassOf(b)==='Function')) +throw MakeTypeError("observe_perform_non_function"); +var d=%GetObjectContextNotifierPerformChange(c); +d(c,a,b); +} +function NativeObjectNotifierPerformChange(a,b,c){ +ObjectInfoAddPerformingType(a,b); +var d; +try{ +d=%_CallFunction((void 0),c); +}finally{ +ObjectInfoRemovePerformingType(a,b); +} +if((%_IsSpecObject(d))) +ObjectInfoEnqueueExternalChangeRecord(a,d,b); +} +function ObjectGetNotifier(a){ +if(!(%_IsSpecObject(a))) +throw MakeTypeError("observe_non_object",["getNotifier"]); +if(%IsJSGlobalProxy(a)) +throw MakeTypeError("observe_global_proxy",["getNotifier"]); +if(ObjectIsFrozen(a))return null; +if(!%ObjectWasCreatedInCurrentOrigin(a))return null; +var b=%GetObjectContextObjectGetNotifier(a); +return b(a); +} +function NativeObjectGetNotifier(a){ +var b=ObjectInfoGetOrCreate(a); +return ObjectInfoGetNotifier(b); +} +function CallbackDeliverPending(a){ +var b=CallbackInfoGet(a); +if((b===(void 0))||(typeof(b)==='number')) +return false; +var c=b.priority; +CallbackInfoSet(a,c); +var d=GetPendingObservers(); +if(!(d===null)) +delete d[c]; +var g=[]; +%MoveArrayContents(b,g); +%DeliverObservationChangeRecords(a,g); +return true; +} +function ObjectDeliverChangeRecords(a){ +if(!(%_ClassOf(a)==='Function')) +throw MakeTypeError("observe_non_function",["deliverChangeRecords"]); +while(CallbackDeliverPending(a)){} +} +function ObserveMicrotaskRunner(){ +var a=GetPendingObservers(); +if(!(a===null)){ +SetPendingObservers(null); +for(var b in a){ +CallbackDeliverPending(a[b]); +} +} +} +function SetupObjectObserve(){ +%CheckIsBootstrapping(); +InstallFunctions($Object,2,$Array( +"deliverChangeRecords",ObjectDeliverChangeRecords, +"getNotifier",ObjectGetNotifier, +"observe",ObjectObserve, +"unobserve",ObjectUnobserve +)); +InstallFunctions($Array,2,$Array( +"observe",ArrayObserve, +"unobserve",ArrayUnobserve +)); +InstallFunctions(notifierPrototype,2,$Array( +"notify",ObjectNotifierNotify, +"performChange",ObjectNotifierPerformChange +)); +} +SetupObjectObserve(); + +(collectionUK +"use strict"; +var $Set=global.Set; +var $Map=global.Map; +function SetConstructor(a){ +if(!%_IsConstructCall()){ +throw MakeTypeError('constructor_not_function',['Set']); +} +%_SetInitialize(this); +if(!(a==null)){ +var b=this.add; +if(!(%_ClassOf(b)==='Function')){ +throw MakeTypeError('property_not_function',['add',this]); +} +for(var c of a){ +%_CallFunction(this,c,b); +} +} +} +function SetAddJS(a){ +if(!(%_ClassOf(this)==='Set')){ +throw MakeTypeError('incompatible_method_receiver', +['Set.prototype.add',this]); +} +if(a===0){ +a=0; +} +return %_SetAdd(this,a); +} +function SetHasJS(a){ +if(!(%_ClassOf(this)==='Set')){ +throw MakeTypeError('incompatible_method_receiver', +['Set.prototype.has',this]); +} +return %_SetHas(this,a); +} +function SetDeleteJS(a){ +if(!(%_ClassOf(this)==='Set')){ +throw MakeTypeError('incompatible_method_receiver', +['Set.prototype.delete',this]); +} +return %_SetDelete(this,a); +} +function SetGetSizeJS(){ +if(!(%_ClassOf(this)==='Set')){ +throw MakeTypeError('incompatible_method_receiver', +['Set.prototype.size',this]); +} +return %_SetGetSize(this); +} +function SetClearJS(){ +if(!(%_ClassOf(this)==='Set')){ +throw MakeTypeError('incompatible_method_receiver', +['Set.prototype.clear',this]); +} +%_SetClear(this); +} +function SetForEach(a,b){ +if(!(%_ClassOf(this)==='Set')){ +throw MakeTypeError('incompatible_method_receiver', +['Set.prototype.forEach',this]); +} +if(!(%_ClassOf(a)==='Function')){ +throw MakeTypeError('called_non_callable',[a]); +} +var c=false; +if((b==null)){ +b=%GetDefaultReceiver(a)||b; +}else{ +c=(!(%_IsSpecObject(b))&&%IsSloppyModeFunction(a)); +} +var d=new SetIterator(this,2); +var g; +var h=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +var i=[(void 0)]; +while(%SetIteratorNext(d,i)){ +if(h)%DebugPrepareStepInIfStepping(a); +g=i[0]; +var j=c?ToObject(b):b; +%_CallFunction(j,g,g,this,a); +} +} +function SetUpSet(){ +%CheckIsBootstrapping(); +%SetCode($Set,SetConstructor); +%FunctionSetPrototype($Set,new $Object()); +%AddNamedProperty($Set.prototype,"constructor",$Set,2); +%AddNamedProperty( +$Set.prototype,symbolToStringTag,"Set",2|1); +%FunctionSetLength(SetForEach,1); +InstallGetter($Set.prototype,"size",SetGetSizeJS); +InstallFunctions($Set.prototype,2,$Array( +"add",SetAddJS, +"has",SetHasJS, +"delete",SetDeleteJS, +"clear",SetClearJS, +"forEach",SetForEach +)); +} +SetUpSet(); +function MapConstructor(a){ +if(!%_IsConstructCall()){ +throw MakeTypeError('constructor_not_function',['Map']); +} +%_MapInitialize(this); +if(!(a==null)){ +var b=this.set; +if(!(%_ClassOf(b)==='Function')){ +throw MakeTypeError('property_not_function',['set',this]); +} +for(var c of a){ +if(!(%_IsSpecObject(c))){ +throw MakeTypeError('iterator_value_not_an_object',[c]); +} +%_CallFunction(this,c[0],c[1],b); +} +} +} +function MapGetJS(a){ +if(!(%_ClassOf(this)==='Map')){ +throw MakeTypeError('incompatible_method_receiver', +['Map.prototype.get',this]); +} +return %_MapGet(this,a); +} +function MapSetJS(a,b){ +if(!(%_ClassOf(this)==='Map')){ +throw MakeTypeError('incompatible_method_receiver', +['Map.prototype.set',this]); +} +if(a===0){ +a=0; +} +return %_MapSet(this,a,b); +} +function MapHasJS(a){ +if(!(%_ClassOf(this)==='Map')){ +throw MakeTypeError('incompatible_method_receiver', +['Map.prototype.has',this]); +} +return %_MapHas(this,a); +} +function MapDeleteJS(a){ +if(!(%_ClassOf(this)==='Map')){ +throw MakeTypeError('incompatible_method_receiver', +['Map.prototype.delete',this]); +} +return %_MapDelete(this,a); +} +function MapGetSizeJS(){ +if(!(%_ClassOf(this)==='Map')){ +throw MakeTypeError('incompatible_method_receiver', +['Map.prototype.size',this]); +} +return %_MapGetSize(this); +} +function MapClearJS(){ +if(!(%_ClassOf(this)==='Map')){ +throw MakeTypeError('incompatible_method_receiver', +['Map.prototype.clear',this]); +} +%_MapClear(this); +} +function MapForEach(a,b){ +if(!(%_ClassOf(this)==='Map')){ +throw MakeTypeError('incompatible_method_receiver', +['Map.prototype.forEach',this]); +} +if(!(%_ClassOf(a)==='Function')){ +throw MakeTypeError('called_non_callable',[a]); +} +var c=false; +if((b==null)){ +b=%GetDefaultReceiver(a)||b; +}else{ +c=(!(%_IsSpecObject(b))&&%IsSloppyModeFunction(a)); +} +var d=new MapIterator(this,3); +var g=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +var h=[(void 0),(void 0)]; +while(%MapIteratorNext(d,h)){ +if(g)%DebugPrepareStepInIfStepping(a); +var i=c?ToObject(b):b; +%_CallFunction(i,h[1],h[0],this,a); +} +} +function SetUpMap(){ +%CheckIsBootstrapping(); +%SetCode($Map,MapConstructor); +%FunctionSetPrototype($Map,new $Object()); +%AddNamedProperty($Map.prototype,"constructor",$Map,2); +%AddNamedProperty( +$Map.prototype,symbolToStringTag,"Map",2|1); +%FunctionSetLength(MapForEach,1); +InstallGetter($Map.prototype,"size",MapGetSizeJS); +InstallFunctions($Map.prototype,2,$Array( +"get",MapGetJS, +"set",MapSetJS, +"has",MapHasJS, +"delete",MapDeleteJS, +"clear",MapClearJS, +"forEach",MapForEach +)); +} +SetUpMap(); + +0?"Promise.resolve":"Promise.reject"; +%DebugAsyncTaskEvent({type:"enqueue",id:w,name:z}); +} +} +function PromiseIdResolveHandler(d){return d} +function PromiseIdRejectHandler(g){throw g} +function PromiseNopResolver(){} +IsPromise=function IsPromise(d){ +return(%_IsSpecObject(d))&&(!(d[promiseStatus]===(void 0))); +} +PromiseCreate=function PromiseCreate(){ +return new a(PromiseNopResolver) +} +PromiseResolve=function PromiseResolve(c,d){ +PromiseDone(c,+1,d,promiseOnResolve) +} +PromiseReject=function PromiseReject(c,g){ +if((c[promiseStatus])==0){ +var C=(%_DebugIsActive()!=0); +if(C||!(!(c[promiseHasHandler]===(void 0)))){ +%PromiseRejectEvent(c,g,C); +} +} +PromiseDone(c,-1,g,promiseOnReject) +} +function PromiseDeferred(){ +if(this===a){ +var c=PromiseInit(new a(promiseRaw)); +return{ +promise:c, +resolve:function(d){PromiseResolve(c,d)}, +reject:function(g){PromiseReject(c,g)} +}; +}else{ +var u={}; +u.promise=new this(function(D,E){ +u.resolve=D; +u.reject=E; +}) +return u; +} +} +function PromiseResolved(d){ +if(this===a){ +return PromiseCreateAndSet(+1,d); +}else{ +return new this(function(D,E){D(d)}); +} +} +function PromiseRejected(g){ +var c; +if(this===a){ +c=PromiseCreateAndSet(-1,g); +%PromiseRejectEvent(c,g,false); +}else{ +c=new this(function(D,E){E(g)}); +} +return c; +} +PromiseChain=function PromiseChain(j,k){ +j=(j===(void 0))?PromiseIdResolveHandler:j; +k=(k===(void 0))?PromiseIdRejectHandler:k; +var r=%_CallFunction(this.constructor,PromiseDeferred); +switch((this[promiseStatus])){ +case(void 0): +throw MakeTypeError('not_a_promise',[this]); +case 0: +(this[promiseOnResolve]).push(j,r); +(this[promiseOnReject]).push(k,r); +break; +case+1: +PromiseEnqueue((this[promiseValue]), +[j,r], ++1); +break; +case-1: +if(!(!(this[promiseHasHandler]===(void 0)))){ +%PromiseRevokeReject(this); +} +PromiseEnqueue((this[promiseValue]), +[k,r], +-1); +break; +} +(this[promiseHasHandler]=true); +if((%_DebugIsActive()!=0)){ +%DebugPromiseEvent({promise:r.promise,parentPromise:this}); +} +return r.promise; +} +PromiseCatch=function PromiseCatch(k){ +return this.then((void 0),k); +} +PromiseThen=function PromiseThen(j,k){ +j=(%_ClassOf(j)==='Function')?j +:PromiseIdResolveHandler; +k=(%_ClassOf(k)==='Function')?k +:PromiseIdRejectHandler; +var G=this; +var o=this.constructor; +return %_CallFunction( +this, +function(d){ +d=PromiseCoerce(o,d); +if(d===G){ +if((%_DebugIsActive()!=0&&%DebugCallbackSupportsStepping(k)))%DebugPrepareStepInIfStepping(k); +return k(MakeTypeError('promise_cyclic',[d])); +}else if(IsPromise(d)){ +return d.then(j,k); +}else{ +if((%_DebugIsActive()!=0&&%DebugCallbackSupportsStepping(j)))%DebugPrepareStepInIfStepping(j); +return j(d); +} +}, +k, +PromiseChain +); +} +function PromiseCast(d){ +return IsPromise(d)?d:new this(function(D){D(d)}); +} +function PromiseAll(H){ +var r=%_CallFunction(this,PromiseDeferred); +var I=[]; +try{ +var J=0; +var B=0; +for(var i of H){ +this.resolve(i).then( +(function(B){ +return function(d){ +I[B]=d; +if(--J===0)r.resolve(I); +} +})(B), +function(g){r.reject(g);}); +++B; +++J; +} +if(J===0){ +r.resolve(I); +} +}catch(e){ +r.reject(e) +} +return r.promise; +} +function PromiseRace(H){ +var r=%_CallFunction(this,PromiseDeferred); +try{ +for(var i of H){ +this.resolve(i).then( +function(d){r.resolve(d)}, +function(g){r.reject(g)}); +} +}catch(e){ +r.reject(e) +} +return r.promise; +} +function PromiseHasUserDefinedRejectHandlerRecursive(c){ +var K=(c[promiseOnReject]); +if((K===(void 0)))return false; +for(var B=0;B>>0; +if(d<4){ +try{ +h=NoSideEffectToString(b[d]); +}catch(e){ +if(%IsJSModule(b[d])) +h="module"; +else if((%_IsSpecObject(b[d]))) +h="object"; +else +h="#"; +} +} +} +c+=h; +} +return c; +} +function NoSideEffectToString(a){ +if((typeof(a)==='string'))return a; +if((typeof(a)==='number'))return %_NumberToString(a); +if((typeof(a)==='boolean'))return a?'true':'false'; +if((a===(void 0)))return'undefined'; +if((a===null))return'null'; +if((%_IsFunction(a))){ +var b=%_CallFunction(a,FunctionToString); +if(b.length>128){ +b=%_SubString(b,0,111)+"......"+ +%_SubString(b,b.length-2,b.length); +} +return b; +} +if((typeof(a)==='symbol'))return %_CallFunction(a,$symbolToString); +if((%_IsObject(a)) +&&%GetDataProperty(a,"toString")===DefaultObjectToString){ +var c=%GetDataProperty(a,"constructor"); +if(typeof c=="function"){ +var d=c.name; +if((typeof(d)==='string')&&d!==""){ +return"#<"+d+">"; +} +} +} +if(CanBeSafelyTreatedAsAnErrorObject(a)){ +return %_CallFunction(a,ErrorToString); +} +return %_CallFunction(a,NoSideEffectsObjectToString); +} +function CanBeSafelyTreatedAsAnErrorObject(a){ +switch(%_ClassOf(a)){ +case'Error': +case'EvalError': +case'RangeError': +case'ReferenceError': +case'SyntaxError': +case'TypeError': +case'URIError': +return true; +} +var b=%GetDataProperty(a,"toString"); +return a instanceof $Error&&b===ErrorToString; +} +function ToStringCheckErrorObject(a){ +if(CanBeSafelyTreatedAsAnErrorObject(a)){ +return %_CallFunction(a,ErrorToString); +}else{ +return ToString(a); +} +} +function ToDetailString(a){ +if(a!=null&&(%_IsObject(a))&&a.toString===DefaultObjectToString){ +var b=a.constructor; +if(typeof b=="function"){ +var c=b.name; +if((typeof(c)==='string')&&c!==""){ +return"#<"+c+">"; +} +} +} +return ToStringCheckErrorObject(a); +} +function MakeGenericError(a,b,c){ +if((c===(void 0)))c=[]; +return new a(FormatMessage(b,c)); +} +%FunctionSetInstanceClassName(Script,'Script'); +%AddNamedProperty(Script.prototype,'constructor',Script, +2|4|1); +%SetCode(Script,function(a){ +throw new $Error("Not supported"); +}); +function FormatMessage(a,b){ +var c=kMessages[a]; +if(!c)return""; +return FormatString(c,b); +} +function GetLineNumber(a){ +var b=%MessageGetStartPosition(a); +if(b==-1)return 0; +var c=%MessageGetScript(a); +var d=c.locationFromPosition(b,true); +if(d==null)return 0; +return d.line+1; +} +function GetSourceLine(a){ +var b=%MessageGetScript(a); +var c=%MessageGetStartPosition(a); +var d=b.locationFromPosition(c,true); +if(d==null)return""; +return d.sourceText(); +} +function MakeTypeError(a,b){ +return MakeGenericError($TypeError,a,b); +} +function MakeRangeError(a,b){ +return MakeGenericError($RangeError,a,b); +} +function MakeSyntaxError(a,b){ +return MakeGenericError($SyntaxError,a,b); +} +function MakeReferenceError(a,b){ +return MakeGenericError($ReferenceError,a,b); +} +function MakeEvalError(a,b){ +return MakeGenericError($EvalError,a,b); +} +function MakeError(a,b){ +return MakeGenericError($Error,a,b); +} +function MakeTypeErrorEmbedded(a,b){ +return MakeGenericError($TypeError,a,[b]); +} +function MakeSyntaxErrorEmbedded(a,b){ +return MakeGenericError($SyntaxError,a,[b]); +} +function MakeReferenceErrorEmbedded(a,b){ +return MakeGenericError($ReferenceError,a,[b]); +} +function ScriptLineFromPosition(a){ +var b=this.line_ends; +var c=b.length-1; +if(c<0)return-1; +if(a>b[c])return-1; +if(a<=b[0])return 0; +var d=1; +while(true){ +var g=(c+d)>>1; +if(a<=b[g-1]){ +c=g-1; +}else if(a>b[g]){ +d=g+1; +}else{ +return g; +} +} +} +function ScriptLocationFromPosition(position, +include_resource_offset){ +var a=this.lineFromPosition(position); +if(a==-1)return null; +var b=this.line_ends; +var c=a==0?0:b[a-1]+1; +var d=b[a]; +if(d>0&&%_CallFunction(this.source,d-1,$stringCharAt)=='\r'){ +d--; +} +var g=position-c; +if(include_resource_offset){ +a+=this.line_offset; +if(a==this.line_offset){ +g+=this.column_offset; +} +} +return new SourceLocation(this,position,a,g,c,d); +} +function ScriptLocationFromLine(a,b,c){ +var d=0; +if(!(a===(void 0))){ +d=a-this.line_offset; +} +var g=b||0; +if(d==0){ +g-=this.column_offset; +} +var h=c||0; +if(d<0||g<0||h<0)return null; +if(d==0){ +return this.locationFromPosition(h+g,false); +}else{ +var i=this.lineFromPosition(h); +if(i==-1||i+d>=this.lineCount()){ +return null; +} +return this.locationFromPosition( +this.line_ends[i+d-1]+1+g); +} +} +function ScriptSourceSlice(a,b){ +var c=(a===(void 0))?this.line_offset +:a; +var d=(b===(void 0))?this.line_offset+this.lineCount() +:b; +c-=this.line_offset; +d-=this.line_offset; +if(c<0)c=0; +if(d>this.lineCount())d=this.lineCount(); +if(c>=this.lineCount()|| +d<0|| +c>d){ +return null; +} +var g=this.line_ends; +var h=c==0?0:g[c-1]+1; +var i=d==0?0:g[d-1]+1; +return new SourceSlice(this, +c+this.line_offset, +d+this.line_offset, +h,i); +} +function ScriptSourceLine(a){ +var b=0; +if(!(a===(void 0))){ +b=a-this.line_offset; +} +if(b<0||this.lineCount()<=b){ +return null; +} +var c=this.line_ends; +var d=b==0?0:c[b-1]+1; +var g=c[b]; +return %_CallFunction(this.source,d,g,$stringSubstring); +} +function ScriptLineCount(){ +return this.line_ends.length; +} +function ScriptNameOrSourceURL(){ +if(this.line_offset>0||this.column_offset>0){ +return this.name; +} +if(this.source_url){ +return this.source_url; +} +return this.name; +} +SetUpLockedPrototype(Script, +$Array("source","name","source_url","source_mapping_url","line_ends", +"line_offset","column_offset"), +$Array( +"lineFromPosition",ScriptLineFromPosition, +"locationFromPosition",ScriptLocationFromPosition, +"locationFromLine",ScriptLocationFromLine, +"sourceSlice",ScriptSourceSlice, +"sourceLine",ScriptSourceLine, +"lineCount",ScriptLineCount, +"nameOrSourceURL",ScriptNameOrSourceURL +) +); +function SourceLocation(a,b,c,d,g,h){ +this.script=a; +this.position=b; +this.line=c; +this.column=d; +this.start=g; +this.end=h; +} +function SourceLocationSourceText(){ +return %_CallFunction(this.script.source, +this.start, +this.end, +$stringSubstring); +} +SetUpLockedPrototype(SourceLocation, +$Array("script","position","line","column","start","end"), +$Array( +"sourceText",SourceLocationSourceText +) +); +function SourceSlice(a,b,c,d,g){ +this.script=a; +this.from_line=b; +this.to_line=c; +this.from_position=d; +this.to_position=g; +} +function SourceSliceSourceText(){ +return %_CallFunction(this.script.source, +this.from_position, +this.to_position, +$stringSubstring); +} +SetUpLockedPrototype(SourceSlice, +$Array("script","from_line","to_line","from_position","to_position"), +$Array("sourceText",SourceSliceSourceText) +); +function GetPositionInLine(a){ +var b=%MessageGetScript(a); +var c=%MessageGetStartPosition(a); +var d=b.locationFromPosition(c,false); +if(d==null)return-1; +return c-d.start; +} +function GetStackTraceLine(a,b,c,d){ +return new CallSite(a,b,c,false).toString(); +} +var CallSiteReceiverKey=(%CreatePrivateOwnSymbol("CallSite#receiver")); +var CallSiteFunctionKey=(%CreatePrivateOwnSymbol("CallSite#function")); +var CallSitePositionKey=(%CreatePrivateOwnSymbol("CallSite#position")); +var CallSiteStrictModeKey=(%CreatePrivateOwnSymbol("CallSite#strict_mode")); +function CallSite(a,b,c,d){ +(this[CallSiteReceiverKey]=a); +(this[CallSiteFunctionKey]=b); +(this[CallSitePositionKey]=c); +(this[CallSiteStrictModeKey]=d); +} +function CallSiteGetThis(){ +return(this[CallSiteStrictModeKey]) +?(void 0):(this[CallSiteReceiverKey]); +} +function CallSiteGetTypeName(){ +return GetTypeName((this[CallSiteReceiverKey]),false); +} +function CallSiteIsToplevel(){ +if((this[CallSiteReceiverKey])==null){ +return true; +} +return(%_ClassOf((this[CallSiteReceiverKey]))==='global'); +} +function CallSiteIsEval(){ +var a=%FunctionGetScript((this[CallSiteFunctionKey])); +return a&&a.compilation_type==1; +} +function CallSiteGetEvalOrigin(){ +var a=%FunctionGetScript((this[CallSiteFunctionKey])); +return FormatEvalOrigin(a); +} +function CallSiteGetScriptNameOrSourceURL(){ +var a=%FunctionGetScript((this[CallSiteFunctionKey])); +return a?a.nameOrSourceURL():null; +} +function CallSiteGetFunction(){ +return(this[CallSiteStrictModeKey]) +?(void 0):(this[CallSiteFunctionKey]); +} +function CallSiteGetFunctionName(){ +var a=(this[CallSiteFunctionKey]); +var b=%FunctionGetDebugName(a); +if(b){ +return b; +} +var c=%FunctionGetScript(a); +if(c&&c.compilation_type==1){ +return"eval"; +} +return null; +} +function CallSiteGetMethodName(){ +var a=(this[CallSiteReceiverKey]); +var b=(this[CallSiteFunctionKey]); +var c=b.name; +if(c&&a&& +(%_CallFunction(a,c,ObjectLookupGetter)===b|| +%_CallFunction(a,c,ObjectLookupSetter)===b|| +((%_IsObject(a))&&%GetDataProperty(a,c)===b))){ +return c; +} +var d=null; +for(var g in a){ +if(%_CallFunction(a,g,ObjectLookupGetter)===b|| +%_CallFunction(a,g,ObjectLookupSetter)===b|| +((%_IsObject(a))&&%GetDataProperty(a,g)===b)){ +if(d){ +return null; +} +d=g; +} +} +if(d){ +return d; +} +return null; +} +function CallSiteGetFileName(){ +var a=%FunctionGetScript((this[CallSiteFunctionKey])); +return a?a.name:null; +} +function CallSiteGetLineNumber(){ +if((this[CallSitePositionKey])==-1){ +return null; +} +var a=%FunctionGetScript((this[CallSiteFunctionKey])); +var b=null; +if(a){ +b=a.locationFromPosition( +(this[CallSitePositionKey]),true); +} +return b?b.line+1:null; +} +function CallSiteGetColumnNumber(){ +if((this[CallSitePositionKey])==-1){ +return null; +} +var a=%FunctionGetScript((this[CallSiteFunctionKey])); +var b=null; +if(a){ +b=a.locationFromPosition( +(this[CallSitePositionKey]),true); +} +return b?b.column+1:null; +} +function CallSiteIsNative(){ +var a=%FunctionGetScript((this[CallSiteFunctionKey])); +return a?(a.type==0):false; +} +function CallSiteGetPosition(){ +return(this[CallSitePositionKey]); +} +function CallSiteIsConstructor(){ +var a=(this[CallSiteReceiverKey]); +var b=(a!=null&&(%_IsObject(a))) +?%GetDataProperty(a,"constructor"):null; +if(!b)return false; +return(this[CallSiteFunctionKey])===b; +} +function CallSiteToString(){ +var a; +var b=""; +if(this.isNative()){ +b="native"; +}else{ +a=this.getScriptNameOrSourceURL(); +if(!a&&this.isEval()){ +b=this.getEvalOrigin(); +b+=", "; +} +if(a){ +b+=a; +}else{ +b+=""; +} +var c=this.getLineNumber(); +if(c!=null){ +b+=":"+c; +var d=this.getColumnNumber(); +if(d){ +b+=":"+d; +} +} +} +var g=""; +var h=this.getFunctionName(); +var i=true; +var j=this.isConstructor(); +var k=!(this.isToplevel()||j); +if(k){ +var l=GetTypeName((this[CallSiteReceiverKey]),true); +var m=this.getMethodName(); +if(h){ +if(l&& +%_CallFunction(h,l,$stringIndexOf)!=0){ +g+=l+"."; +} +g+=h; +if(m&& +(%_CallFunction(h,"."+m,$stringIndexOf)!= +h.length-m.length-1)){ +g+=" [as "+m+"]"; +} +}else{ +g+=l+"."+(m||""); +} +}else if(j){ +g+="new "+(h||""); +}else if(h){ +g+=h; +}else{ +g+=b; +i=false; +} +if(i){ +g+=" ("+b+")"; +} +return g; +} +SetUpLockedPrototype(CallSite,$Array("receiver","fun","pos"),$Array( +"getThis",CallSiteGetThis, +"getTypeName",CallSiteGetTypeName, +"isToplevel",CallSiteIsToplevel, +"isEval",CallSiteIsEval, +"getEvalOrigin",CallSiteGetEvalOrigin, +"getScriptNameOrSourceURL",CallSiteGetScriptNameOrSourceURL, +"getFunction",CallSiteGetFunction, +"getFunctionName",CallSiteGetFunctionName, +"getMethodName",CallSiteGetMethodName, +"getFileName",CallSiteGetFileName, +"getLineNumber",CallSiteGetLineNumber, +"getColumnNumber",CallSiteGetColumnNumber, +"isNative",CallSiteIsNative, +"getPosition",CallSiteGetPosition, +"isConstructor",CallSiteIsConstructor, +"toString",CallSiteToString +)); +function FormatEvalOrigin(a){ +var b=a.nameOrSourceURL(); +if(b){ +return b; +} +var c="eval at "; +if(a.eval_from_function_name){ +c+=a.eval_from_function_name; +}else{ +c+=""; +} +var d=a.eval_from_script; +if(d){ +if(d.compilation_type==1){ +c+=" ("+FormatEvalOrigin(d)+")"; +}else{ +if(d.name){ +c+=" ("+d.name; +var g=d.locationFromPosition( +a.eval_from_script_position,true); +if(g){ +c+=":"+(g.line+1); +c+=":"+(g.column+1); +} +c+=")"; +}else{ +c+=" (unknown source)"; +} +} +} +return c; +} +function FormatErrorString(a){ +try{ +return %_CallFunction(a,ErrorToString); +}catch(e){ +try{ +return""; +}catch(ee){ +return""; +} +} +} +function GetStackFrames(a){ +var b=new InternalArray(); +var c=a[0]; +for(var d=1;d"; +}catch(ee){ +k=""; +} +} +h.push(" at "+k); +} +return %_CallFunction(h,"\n",ArrayJoin); +} +function GetTypeName(a,b){ +var c=a.constructor; +if(!c){ +return b?null: +%_CallFunction(a,NoSideEffectsObjectToString); +} +var d=c.name; +if(!d){ +return b?null: +%_CallFunction(a,NoSideEffectsObjectToString); +} +return d; +} +var stack_trace_symbol; +var formatted_stack_trace_symbol=(%CreatePrivateOwnSymbol("formatted stack trace")); +var StackTraceGetter=function(){ +var a=(void 0); +var b=this; +while(b){ +var a= +(b[formatted_stack_trace_symbol]); +if((a===(void 0))){ +var c=(b[stack_trace_symbol]); +if((c===(void 0))){ +b=%_GetPrototype(b); +continue; +} +a=FormatStackTrace(b,c); +(b[stack_trace_symbol]=(void 0)); +(b[formatted_stack_trace_symbol]=a); +} +return a; +} +return(void 0); +}; +var StackTraceSetter=function(a){ +if((%HasOwnProperty(this,stack_trace_symbol))){ +(this[stack_trace_symbol]=(void 0)); +(this[formatted_stack_trace_symbol]=a); +} +}; +var captureStackTrace=function captureStackTrace(a,b){ +ObjectDefineProperty(a,'stack',{get:StackTraceGetter, +set:StackTraceSetter, +configurable:true}); +%CollectStackTrace(a,b?b:captureStackTrace); +} +function SetUpError(){ +var a=function(b){ +var c=b.name; +%AddNamedProperty(global,c,b,2); +%AddNamedProperty(builtins,'$'+c,b, +2|4|1); +if(c=='Error'){ +var d=function(){}; +%FunctionSetPrototype(d,$Object.prototype); +%FunctionSetInstanceClassName(d,'Error'); +%FunctionSetPrototype(b,new d()); +}else{ +%FunctionSetPrototype(b,new $Error()); +} +%FunctionSetInstanceClassName(b,'Error'); +%AddNamedProperty(b.prototype,'constructor',b,2); +%AddNamedProperty(b.prototype,"name",c,2); +%SetCode(b,function(g){ +if(%_IsConstructCall()){ +try{captureStackTrace(this,b);}catch(e){} +if(!(g===(void 0))){ +%AddNamedProperty(this,'message',ToString(g),2); +} +}else{ +return new b(g); +} +}); +%SetNativeFlag(b); +}; +a(function Error(){}); +a(function TypeError(){}); +a(function RangeError(){}); +a(function SyntaxError(){}); +a(function ReferenceError(){}); +a(function EvalError(){}); +a(function URIError(){}); +} +SetUpError(); +$Error.captureStackTrace=captureStackTrace; +%AddNamedProperty($Error.prototype,'message','',2); +var visited_errors=new InternalArray(); +var cyclic_error_marker=new $Object(); +function GetPropertyWithoutInvokingMonkeyGetters(a,b){ +var c=a; +while(c&&!%HasOwnProperty(c,b)){ +c=%_GetPrototype(c); +} +if((c===null))return(void 0); +if(!(%_IsObject(c)))return a[b]; +var d=%GetOwnProperty(c,b); +if(d&&d[0]){ +var g=b==="name"; +if(c===$ReferenceError.prototype) +return g?"ReferenceError":(void 0); +if(c===$SyntaxError.prototype) +return g?"SyntaxError":(void 0); +if(c===$TypeError.prototype) +return g?"TypeError":(void 0); +} +return a[b]; +} +function ErrorToStringDetectCycle(a){ +if(!%PushIfAbsent(visited_errors,a))throw cyclic_error_marker; +try{ +var b=GetPropertyWithoutInvokingMonkeyGetters(a,"name"); +b=(b===(void 0))?"Error":((typeof(%IS_VAR(b))==='string')?b:NonStringToString(b)); +var c=GetPropertyWithoutInvokingMonkeyGetters(a,"message"); +c=(c===(void 0))?"":((typeof(%IS_VAR(c))==='string')?c:NonStringToString(c)); +if(b==="")return c; +if(c==="")return b; +return b+": "+c; +}finally{ +visited_errors.length=visited_errors.length-1; +} +} +function ErrorToString(){ +if(!(%_IsSpecObject(this))){ +throw MakeTypeError("called_on_non_object",["Error.prototype.toString"]); +} +try{ +return ErrorToStringDetectCycle(this); +}catch(e){ +if(e===cyclic_error_marker){ +return''; +} +throw e; +} +} +InstallFunctions($Error.prototype,2,['toString',ErrorToString]); +function SetUpStackOverflowBoilerplate(){ +var a=MakeRangeError('stack_overflow',[]); +%DefineAccessorPropertyUnchecked( +a,'stack',StackTraceGetter,StackTraceSetter,2); +return a; +} +var kStackOverflowBoilerplate=SetUpStackOverflowBoilerplate(); + +json=; +"use strict"; +var $JSON=global.JSON; +function Revive(a,b,c){ +var d=a[b]; +if((%_IsObject(d))){ +if((%_IsArray(d))){ +var g=d.length; +for(var h=0;h0){ +var o=",\n"+d; +m="[\n"+d+i.join(o)+"\n"+ +h+"]"; +}else{ +m="[]"; +} +c.pop(); +return m; +} +function SerializeObject(a,b,c,d,g){ +if(!%PushIfAbsent(c,a)){ +throw MakeTypeError('circular_structure',$Array()); +} +var h=d; +d+=g; +var i=new InternalArray(); +if((%_IsArray(b))){ +var j=b.length; +for(var k=0;k0){ +var r=",\n"+d; +q="{\n"+d+i.join(r)+"\n"+ +h+"}"; +}else{ +q="{}"; +} +c.pop(); +return q; +} +function JSONSerialize(a,b,c,d,g,h){ +var i=b[a]; +if((%_IsSpecObject(i))){ +var j=i.toJSON; +if((%_ClassOf(j)==='Function')){ +i=%_CallFunction(i,a,j); +} +} +if((%_ClassOf(c)==='Function')){ +i=%_CallFunction(b,a,i,c); +} +if((typeof(i)==='string')){ +return %QuoteJSONString(i); +}else if((typeof(i)==='number')){ +return((%_IsSmi(%IS_VAR(i))||i-i==0)?%_NumberToString(i):"null"); +}else if((typeof(i)==='boolean')){ +return i?"true":"false"; +}else if((i===null)){ +return"null"; +}else if((%_IsSpecObject(i))&&!(typeof i=="function")){ +if((%_IsArray(i))){ +return SerializeArray(i,c,d,g,h); +}else if((%_ClassOf(i)==='Number')){ +i=ToNumber(i); +return((%_IsSmi(%IS_VAR(i))||i-i==0)?%_NumberToString(i):"null"); +}else if((%_ClassOf(i)==='String')){ +return %QuoteJSONString(ToString(i)); +}else if((%_ClassOf(i)==='Boolean')){ +return %_ValueOf(i)?"true":"false"; +}else{ +return SerializeObject(i,c,d,g,h); +} +} +return(void 0); +} +function JSONStringify(a,b,c){ +if(%_ArgumentsLength()==1){ +return %BasicJSONStringify(a); +} +if((%_IsObject(c))){ +if((%_ClassOf(c)==='Number')){ +c=ToNumber(c); +}else if((%_ClassOf(c)==='String')){ +c=ToString(c); +} +} +var d; +if((typeof(c)==='number')){ +c=$max(0,$min(ToInteger(c),10)); +d=%_SubString(" ",0,c); +}else if((typeof(c)==='string')){ +if(c.length>10){ +d=%_SubString(c,0,10); +}else{ +d=c; +} +}else{ +d=""; +} +if((%_IsArray(b))){ +var g=new InternalArray(); +var h={__proto__:null}; +var i={}; +var j=b.length; +for(var k=0;k>>0); +if(c>=g){ +(a[arrayIteratorObjectSymbol]=(void 0)); +return CreateIteratorResultObject((void 0),true); +} +(a[arrayIteratorNextIndexSymbol]=c+1); +if(d==2){ +return CreateIteratorResultObject(b[c],false); +} +if(d==3){ +return CreateIteratorResultObject([c,b[c]],false); +} +return CreateIteratorResultObject(c,false); +} +function ArrayEntries(){ +return CreateArrayIterator(this,3); +} +function ArrayValues(){ +return CreateArrayIterator(this,2); +} +function ArrayKeys(){ +return CreateArrayIterator(this,1); +} +function SetUpArrayIterator(){ +%CheckIsBootstrapping(); +%FunctionSetPrototype(ArrayIterator,new $Object()); +%FunctionSetInstanceClassName(ArrayIterator,'Array Iterator'); +InstallFunctions(ArrayIterator.prototype,2,$Array( +'next',ArrayIteratorNext +)); +%FunctionSetName(ArrayIteratorIterator,'[Symbol.iterator]'); +%AddNamedProperty(ArrayIterator.prototype,symbolIterator, +ArrayIteratorIterator,2); +%AddNamedProperty(ArrayIterator.prototype,symbolToStringTag, +"Array Iterator",1|2); +} +SetUpArrayIterator(); +function ExtendArrayPrototype(){ +%CheckIsBootstrapping(); +InstallFunctions($Array.prototype,2,$Array( +'entries',ArrayEntries, +'keys',ArrayKeys +)); +%AddNamedProperty($Array.prototype,symbolIterator,ArrayValues,2); +} +ExtendArrayPrototype(); +function ExtendTypedArrayPrototypes(){ +%CheckIsBootstrapping(); +%AddNamedProperty($Uint8Array.prototype,'entries',ArrayEntries,2); +%AddNamedProperty($Uint8Array.prototype,'values',ArrayValues,2); +%AddNamedProperty($Uint8Array.prototype,'keys',ArrayKeys,2); +%AddNamedProperty($Uint8Array.prototype,symbolIterator,ArrayValues,2); + +%AddNamedProperty($Int8Array.prototype,'entries',ArrayEntries,2); +%AddNamedProperty($Int8Array.prototype,'values',ArrayValues,2); +%AddNamedProperty($Int8Array.prototype,'keys',ArrayKeys,2); +%AddNamedProperty($Int8Array.prototype,symbolIterator,ArrayValues,2); + +%AddNamedProperty($Uint16Array.prototype,'entries',ArrayEntries,2); +%AddNamedProperty($Uint16Array.prototype,'values',ArrayValues,2); +%AddNamedProperty($Uint16Array.prototype,'keys',ArrayKeys,2); +%AddNamedProperty($Uint16Array.prototype,symbolIterator,ArrayValues,2); + +%AddNamedProperty($Int16Array.prototype,'entries',ArrayEntries,2); +%AddNamedProperty($Int16Array.prototype,'values',ArrayValues,2); +%AddNamedProperty($Int16Array.prototype,'keys',ArrayKeys,2); +%AddNamedProperty($Int16Array.prototype,symbolIterator,ArrayValues,2); + +%AddNamedProperty($Uint32Array.prototype,'entries',ArrayEntries,2); +%AddNamedProperty($Uint32Array.prototype,'values',ArrayValues,2); +%AddNamedProperty($Uint32Array.prototype,'keys',ArrayKeys,2); +%AddNamedProperty($Uint32Array.prototype,symbolIterator,ArrayValues,2); + +%AddNamedProperty($Int32Array.prototype,'entries',ArrayEntries,2); +%AddNamedProperty($Int32Array.prototype,'values',ArrayValues,2); +%AddNamedProperty($Int32Array.prototype,'keys',ArrayKeys,2); +%AddNamedProperty($Int32Array.prototype,symbolIterator,ArrayValues,2); + +%AddNamedProperty($Float32Array.prototype,'entries',ArrayEntries,2); +%AddNamedProperty($Float32Array.prototype,'values',ArrayValues,2); +%AddNamedProperty($Float32Array.prototype,'keys',ArrayKeys,2); +%AddNamedProperty($Float32Array.prototype,symbolIterator,ArrayValues,2); + +%AddNamedProperty($Float64Array.prototype,'entries',ArrayEntries,2); +%AddNamedProperty($Float64Array.prototype,'values',ArrayValues,2); +%AddNamedProperty($Float64Array.prototype,'keys',ArrayKeys,2); +%AddNamedProperty($Float64Array.prototype,symbolIterator,ArrayValues,2); + +%AddNamedProperty($Uint8ClampedArray.prototype,'entries',ArrayEntries,2); +%AddNamedProperty($Uint8ClampedArray.prototype,'values',ArrayValues,2); +%AddNamedProperty($Uint8ClampedArray.prototype,'keys',ArrayKeys,2); +%AddNamedProperty($Uint8ClampedArray.prototype,symbolIterator,ArrayValues,2); + + +} +ExtendTypedArrayPrototypes(); + +>>0); +if(k>=l){ +(j[d]=(void 0)); +return CreateIteratorResultObject((void 0),true); +} +var m=%_StringCharCodeAt(i,k); +var o=%_StringCharFromCode(m); +k++; +if(m>=0xD800&&m<=0xDBFF&&k=0xDC00&&q<=0xDFFF){ +o+=%_StringCharFromCode(q); +k++; +} +} +(j[g]=k); +return CreateIteratorResultObject(o,false); +} +function StringPrototypeIterator(){ +return CreateStringIterator(this); +} +%FunctionSetPrototype(StringIterator,new b()); +%FunctionSetInstanceClassName(StringIterator,'String Iterator'); +InstallFunctions(StringIterator.prototype,2,a( +'next',StringIteratorNext +)); +%FunctionSetName(StringIteratorIterator,'[Symbol.iterator]'); +%AddNamedProperty(StringIterator.prototype,symbolIterator, +StringIteratorIterator,2); +%AddNamedProperty(StringIterator.prototype,symbolToStringTag, +"String Iterator",1|2); +%FunctionSetName(StringPrototypeIterator,'[Symbol.iterator]'); +%AddNamedProperty(c.prototype,symbolIterator, +StringPrototypeIterator,2); +})(); + +$templatesõ +"use strict"; +var callSiteCache=new $Map; +function SameCallSiteElements(a,b){ +var c=a.length; +var b=b.raw; +if(c!==b.length)return false; +for(var d=0;d0){ +return I(L,%_Arguments(0)); +}else{ +return I(L); +} +} +} +%FunctionSetName(M,K); +%FunctionRemovePrototype(M); +%SetNativeFlag(M); +this[K]=M; +} +return this[K]; +} +%FunctionSetName(getter,H); +%FunctionRemovePrototype(getter); +%SetNativeFlag(getter); +ObjectDefineProperty(G.prototype,H,{ +get:getter, +enumerable:false, +configurable:true +}); +} +function supportedLocalesOf(Q,R,S){ +if((Q.match(GetServiceRE())===null)){ +throw new $Error('Internal error, wrong service type: '+Q); +} +if(S===d){ +S={}; +}else{ +S=ToObject(S); +} +var T=S.localeMatcher; +if(T!==d){ +T=c(T); +if(T!=='lookup'&&T!=='best fit'){ +throw new $RangeError('Illegal value for localeMatcher:'+T); +} +}else{ +T='best fit'; +} +var U=initializeLocaleList(R); +if(j[Q]===d){ +j[Q]=getAvailableLocalesOf(Q); +} +if(T==='best fit'){ +return initializeLocaleList(bestFitSupportedLocalesOf( +U,j[Q])); +} +return initializeLocaleList(lookupSupportedLocalesOf( +U,j[Q])); +} +function lookupSupportedLocalesOf(U,W){ +var X=[]; +for(var Y=0;Y=3&&J<=8&&an!==d){ +am[an]=ao; +an=d; +}else{ +return{}; +} +} +return am; +} +function setOptions(ap,am,aq,ac,ar){ +var ak=''; +var as=function updateExtension(at,ah){ +return'-'+at+'-'+c(ah); +} +var au=function updateProperty(ad,ae,ah){ +if(ae==='boolean'&&(typeof ah==='string')){ +ah=(ah==='true')?true:false; +} +if(ad!==d){ +defineWEProperty(ar,ad,ah); +} +} +for(var at in aq){ +if(aq.hasOwnProperty(at)){ +var ah=d; +var av=aq[at]; +if(av.property!==d){ +ah=ac(av.property,av.type,av.values); +} +if(ah!==d){ +au(av.property,av.type,ah); +ak+=as(at,ah); +continue; +} +if(am.hasOwnProperty(at)){ +ah=am[at]; +if(ah!==d){ +au(av.property,av.type,ah); +ak+=as(at,ah); +}else if(av.type==='boolean'){ +au(av.property,av.type,true); +ak+=as(at,true); +} +} +} +} +return ak===''?'':'-u'+ak; +} +function freezeArray(aw){ +aw.forEach(function(ao,ax){ +ObjectDefineProperty(aw,ax,{value:ao, +configurable:false, +writable:false, +enumerable:true}); +}); +ObjectDefineProperty(aw,'length',{value:aw.length, +writable:false}); +return aw; +} +function getOptimalLanguageTag(ay,ai){ +if(ay===ai){ +return ay; +} +var R=%GetLanguageTagVariants([ay,ai]); +if(R[0].maximized!==R[1].maximized){ +return ai; +} +var az=new b('^'+R[1].base); +return ai.replace(az,R[0].base); +} +function getAvailableLocalesOf(Q){ +var aA=%AvailableLocalesOf(Q); +for(var Y in aA){ +if(aA.hasOwnProperty(Y)){ +var aB=Y.match(/^([a-z]{2,3})-([A-Z][a-z]{3})-([A-Z]{2})$/); +if(aB!==null){ +aA[aB[1]+'-'+aB[3]]=null; +} +} +} +return aA; +} +function defineWEProperty(aC,ad,ah){ +ObjectDefineProperty(aC,ad, +{value:ah,writable:true,enumerable:true}); +} +function addWEPropertyIfDefined(aC,ad,ah){ +if(ah!==d){ +defineWEProperty(aC,ad,ah); +} +} +function defineWECProperty(aC,ad,ah){ +ObjectDefineProperty(aC,ad, +{value:ah, +writable:true, +enumerable:true, +configurable:true}); +} +function addWECPropertyIfDefined(aC,ad,ah){ +if(ah!==d){ +defineWECProperty(aC,ad,ah); +} +} +function toTitleCaseWord(aD){ +return aD.substr(0,1).toUpperCase()+aD.substr(1).toLowerCase(); +} +function canonicalizeLanguageTag(aE){ +if(typeof aE!=='string'&&typeof aE!=='object'|| +(aE===null)){ +throw new $TypeError('Language ID should be string or object.'); +} +var aF=c(aE); +if(isValidLanguageTag(aF)===false){ +throw new $RangeError('Invalid language tag: '+aF); +} +var aG=%CanonicalizeLanguageTag(aF); +if(aG==='invalid-tag'){ +throw new $RangeError('Invalid language tag: '+aF); +} +return aG; +} +function initializeLocaleList(R){ +var aH=[]; +if(R===d){ +aH=[]; +}else{ +if(typeof R==='string'){ +aH.push(canonicalizeLanguageTag(R)); +return freezeArray(aH); +} +var aI=ToObject(R); +var aJ=aI.length>>>0; +for(var aK=0;aKbl){ +throw new $RangeError(ad+' value is out of range.'); +} +return $floor(ah); +} +return bm; +} +function initializeNumberFormat(bn,R,S){ +if(%IsInitializedIntlObject(bn)){ +throw new $TypeError('Trying to re-initialize NumberFormat object.'); +} +if(S===d){ +S={}; +} +var ac=getGetOption(S,'numberformat'); +var Z=resolveLocale('numberformat',R,S); +var bd={}; +defineWEProperty(bd,'style',ac( +'style','string',['decimal','percent','currency'],'decimal')); +var bj=ac('currency','string'); +if(bj!==d&&!isWellFormedCurrencyCode(bj)){ +throw new $RangeError('Invalid currency code: '+bj); +} +if(bd.style==='currency'&&bj===d){ +throw new $TypeError('Currency code is required with currency style.'); +} +var bo=ac( +'currencyDisplay','string',['code','symbol','name'],'symbol'); +if(bd.style==='currency'){ +defineWEProperty(bd,'currency',bj.toUpperCase()); +defineWEProperty(bd,'currencyDisplay',bo); +} +var bp=getNumberOption(S,'minimumIntegerDigits',1,21,1); +defineWEProperty(bd,'minimumIntegerDigits',bp); +var bq=getNumberOption(S,'minimumFractionDigits',0,20,0); +defineWEProperty(bd,'minimumFractionDigits',bq); +var br=getNumberOption(S,'maximumFractionDigits',bq,20,3); +defineWEProperty(bd,'maximumFractionDigits',br); +var bs=S['minimumSignificantDigits']; +var bt=S['maximumSignificantDigits']; +if(bs!==d||bt!==d){ +bs=getNumberOption(S,'minimumSignificantDigits',1,21,0); +defineWEProperty(bd,'minimumSignificantDigits',bs); +bt=getNumberOption(S,'maximumSignificantDigits',bs,21,21); +defineWEProperty(bd,'maximumSignificantDigits',bt); +} +defineWEProperty(bd,'useGrouping',ac( +'useGrouping','boolean',d,true)); +var am=parseExtension(Z.extension); +var ak=setOptions(S,am,B, +ac,bd); +var bg=Z.locale+ak; +var ai=ObjectDefineProperties({},{ +currency:{writable:true}, +currencyDisplay:{writable:true}, +locale:{writable:true}, +maximumFractionDigits:{writable:true}, +minimumFractionDigits:{writable:true}, +minimumIntegerDigits:{writable:true}, +numberingSystem:{writable:true}, +requestedLocale:{value:bg,writable:true}, +style:{value:bd.style,writable:true}, +useGrouping:{writable:true} +}); +if(bd.hasOwnProperty('minimumSignificantDigits')){ +defineWEProperty(ai,'minimumSignificantDigits',d); +} +if(bd.hasOwnProperty('maximumSignificantDigits')){ +defineWEProperty(ai,'maximumSignificantDigits',d); +} +var bu=%CreateNumberFormat(bg, +bd, +ai); +if(bd.style==='currency'){ +ObjectDefineProperty(ai,'currencyDisplay',{value:bo, +writable:true}); +} +%MarkAsInitializedIntlObjectOfType(bn,'numberformat',bu); +ObjectDefineProperty(bn,'resolved',{value:ai}); +return bn; +} +%AddNamedProperty(g,'NumberFormat',function(){ +var R=%_Arguments(0); +var S=%_Arguments(1); +if(!this||this===g){ +return new g.NumberFormat(R,S); +} +return initializeNumberFormat(ToObject(this),R,S); +}, +2 +); +%AddNamedProperty(g.NumberFormat.prototype,'resolvedOptions',function(){ +if(%_IsConstructCall()){ +throw new $TypeError(E); +} +if(!%IsInitializedIntlObjectOfType(this,'numberformat')){ +throw new $TypeError('resolvedOptions method called on a non-object'+ +' or on a object that is not Intl.NumberFormat.'); +} +var bv=this; +var Z=getOptimalLanguageTag(bv.resolved.requestedLocale, +bv.resolved.locale); +var bw={ +locale:Z, +numberingSystem:bv.resolved.numberingSystem, +style:bv.resolved.style, +useGrouping:bv.resolved.useGrouping, +minimumIntegerDigits:bv.resolved.minimumIntegerDigits, +minimumFractionDigits:bv.resolved.minimumFractionDigits, +maximumFractionDigits:bv.resolved.maximumFractionDigits, +}; +if(bw.style==='currency'){ +defineWECProperty(bw,'currency',bv.resolved.currency); +defineWECProperty(bw,'currencyDisplay', +bv.resolved.currencyDisplay); +} +if(bv.resolved.hasOwnProperty('minimumSignificantDigits')){ +defineWECProperty(bw,'minimumSignificantDigits', +bv.resolved.minimumSignificantDigits); +} +if(bv.resolved.hasOwnProperty('maximumSignificantDigits')){ +defineWECProperty(bw,'maximumSignificantDigits', +bv.resolved.maximumSignificantDigits); +} +return bw; +}, +2 +); +%FunctionSetName(g.NumberFormat.prototype.resolvedOptions, +'resolvedOptions'); +%FunctionRemovePrototype(g.NumberFormat.prototype.resolvedOptions); +%SetNativeFlag(g.NumberFormat.prototype.resolvedOptions); +%AddNamedProperty(g.NumberFormat,'supportedLocalesOf',function(R){ +if(%_IsConstructCall()){ +throw new $TypeError(E); +} +return supportedLocalesOf('numberformat',R,%_Arguments(1)); +}, +2 +); +%FunctionSetName(g.NumberFormat.supportedLocalesOf,'supportedLocalesOf'); +%FunctionRemovePrototype(g.NumberFormat.supportedLocalesOf); +%SetNativeFlag(g.NumberFormat.supportedLocalesOf); +function formatNumber(bu,ah){ +var bx=$Number(ah)+0; +return %InternalNumberFormat(%GetImplFromInitializedIntlObject(bu), +bx); +} +function parseNumber(bu,ah){ +return %InternalNumberParse(%GetImplFromInitializedIntlObject(bu), +c(ah)); +} +addBoundMethod(g.NumberFormat,'format',formatNumber,1); +addBoundMethod(g.NumberFormat,'v8Parse',parseNumber,1); +function toLDMLString(S){ +var ac=getGetOption(S,'dateformat'); +var by=''; +var bz=ac('weekday','string',['narrow','short','long']); +by+=appendToLDMLString( +bz,{narrow:'EEEEE',short:'EEE',long:'EEEE'}); +bz=ac('era','string',['narrow','short','long']); +by+=appendToLDMLString( +bz,{narrow:'GGGGG',short:'GGG',long:'GGGG'}); +bz=ac('year','string',['2-digit','numeric']); +by+=appendToLDMLString(bz,{'2-digit':'yy','numeric':'y'}); +bz=ac('month','string', +['2-digit','numeric','narrow','short','long']); +by+=appendToLDMLString(bz,{'2-digit':'MM','numeric':'M', +'narrow':'MMMMM','short':'MMM','long':'MMMM'}); +bz=ac('day','string',['2-digit','numeric']); +by+=appendToLDMLString( +bz,{'2-digit':'dd','numeric':'d'}); +var bA=ac('hour12','boolean'); +bz=ac('hour','string',['2-digit','numeric']); +if(bA===d){ +by+=appendToLDMLString(bz,{'2-digit':'jj','numeric':'j'}); +}else if(bA===true){ +by+=appendToLDMLString(bz,{'2-digit':'hh','numeric':'h'}); +}else{ +by+=appendToLDMLString(bz,{'2-digit':'HH','numeric':'H'}); +} +bz=ac('minute','string',['2-digit','numeric']); +by+=appendToLDMLString(bz,{'2-digit':'mm','numeric':'m'}); +bz=ac('second','string',['2-digit','numeric']); +by+=appendToLDMLString(bz,{'2-digit':'ss','numeric':'s'}); +bz=ac('timeZoneName','string',['short','long']); +by+=appendToLDMLString(bz,{short:'z',long:'zzzz'}); +return by; +} +function appendToLDMLString(bz,bB){ +if(bz!==d){ +return bB[bz]; +}else{ +return''; +} +} +function fromLDMLString(by){ +by=by.replace(GetQuotedStringRE(),''); +var S={}; +var bC=by.match(/E{3,5}/g); +S=appendToDateTimeObject( +S,'weekday',bC,{EEEEE:'narrow',EEE:'short',EEEE:'long'}); +bC=by.match(/G{3,5}/g); +S=appendToDateTimeObject( +S,'era',bC,{GGGGG:'narrow',GGG:'short',GGGG:'long'}); +bC=by.match(/y{1,2}/g); +S=appendToDateTimeObject( +S,'year',bC,{y:'numeric',yy:'2-digit'}); +bC=by.match(/M{1,5}/g); +S=appendToDateTimeObject(S,'month',bC,{MM:'2-digit', +M:'numeric',MMMMM:'narrow',MMM:'short',MMMM:'long'}); +bC=by.match(/L{1,5}/g); +S=appendToDateTimeObject(S,'month',bC,{LL:'2-digit', +L:'numeric',LLLLL:'narrow',LLL:'short',LLLL:'long'}); +bC=by.match(/d{1,2}/g); +S=appendToDateTimeObject( +S,'day',bC,{d:'numeric',dd:'2-digit'}); +bC=by.match(/h{1,2}/g); +if(bC!==null){ +S['hour12']=true; +} +S=appendToDateTimeObject( +S,'hour',bC,{h:'numeric',hh:'2-digit'}); +bC=by.match(/H{1,2}/g); +if(bC!==null){ +S['hour12']=false; +} +S=appendToDateTimeObject( +S,'hour',bC,{H:'numeric',HH:'2-digit'}); +bC=by.match(/m{1,2}/g); +S=appendToDateTimeObject( +S,'minute',bC,{m:'numeric',mm:'2-digit'}); +bC=by.match(/s{1,2}/g); +S=appendToDateTimeObject( +S,'second',bC,{s:'numeric',ss:'2-digit'}); +bC=by.match(/z|zzzz/g); +S=appendToDateTimeObject( +S,'timeZoneName',bC,{z:'short',zzzz:'long'}); +return S; +} +function appendToDateTimeObject(S,bz,bC,bB){ +if((bC===null)){ +if(!S.hasOwnProperty(bz)){ +defineWEProperty(S,bz,d); +} +return S; +} +var ad=bC[0]; +defineWEProperty(S,bz,bB[ad]); +return S; +} +function toDateTimeOptions(S,bD,bE){ +if(S===d){ +S={}; +}else{ +S=((%_IsSpecObject(%IS_VAR(S)))?S:ToObject(S)); +} +var bF=true; +if((bD==='date'||bD==='any')&& +(S.weekday!==d||S.year!==d|| +S.month!==d||S.day!==d)){ +bF=false; +} +if((bD==='time'||bD==='any')&& +(S.hour!==d||S.minute!==d|| +S.second!==d)){ +bF=false; +} +if(bF&&(bE==='date'||bE==='all')){ +ObjectDefineProperty(S,'year',{value:'numeric', +writable:true, +enumerable:true, +configurable:true}); +ObjectDefineProperty(S,'month',{value:'numeric', +writable:true, +enumerable:true, +configurable:true}); +ObjectDefineProperty(S,'day',{value:'numeric', +writable:true, +enumerable:true, +configurable:true}); +} +if(bF&&(bE==='time'||bE==='all')){ +ObjectDefineProperty(S,'hour',{value:'numeric', +writable:true, +enumerable:true, +configurable:true}); +ObjectDefineProperty(S,'minute',{value:'numeric', +writable:true, +enumerable:true, +configurable:true}); +ObjectDefineProperty(S,'second',{value:'numeric', +writable:true, +enumerable:true, +configurable:true}); +} +return S; +} +function initializeDateTimeFormat(bG,R,S){ +if(%IsInitializedIntlObject(bG)){ +throw new $TypeError('Trying to re-initialize DateTimeFormat object.'); +} +if(S===d){ +S={}; +} +var Z=resolveLocale('dateformat',R,S); +S=toDateTimeOptions(S,'any','date'); +var ac=getGetOption(S,'dateformat'); +var T=ac('formatMatcher','string', +['basic','best fit'],'best fit'); +var by=toLDMLString(S); +var bH=canonicalizeTimeZoneID(S.timeZone); +var bd={}; +var am=parseExtension(Z.extension); +var ak=setOptions(S,am,C, +ac,bd); +var bg=Z.locale+ak; +var ai=ObjectDefineProperties({},{ +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}, +pattern:{writable:true}, +requestedLocale:{value:bg,writable:true}, +second:{writable:true}, +timeZone:{writable:true}, +timeZoneName:{writable:true}, +tz:{value:bH,writable:true}, +weekday:{writable:true}, +year:{writable:true} +}); +var bu=%CreateDateTimeFormat( +bg,{skeleton:by,timeZone:bH},ai); +if(bH!==d&&bH!==ai.timeZone){ +throw new $RangeError('Unsupported time zone specified '+bH); +} +%MarkAsInitializedIntlObjectOfType(bG,'dateformat',bu); +ObjectDefineProperty(bG,'resolved',{value:ai}); +return bG; +} +%AddNamedProperty(g,'DateTimeFormat',function(){ +var R=%_Arguments(0); +var S=%_Arguments(1); +if(!this||this===g){ +return new g.DateTimeFormat(R,S); +} +return initializeDateTimeFormat(ToObject(this),R,S); +}, +2 +); +%AddNamedProperty(g.DateTimeFormat.prototype,'resolvedOptions',function(){ +if(%_IsConstructCall()){ +throw new $TypeError(E); +} +if(!%IsInitializedIntlObjectOfType(this,'dateformat')){ +throw new $TypeError('resolvedOptions method called on a non-object or '+ +'on a object that is not Intl.DateTimeFormat.'); +} +var bv=this; +var bI=fromLDMLString(bv.resolved.pattern); +var bJ=z[bv.resolved.calendar]; +if(bJ===d){ +bJ=bv.resolved.calendar; +} +var Z=getOptimalLanguageTag(bv.resolved.requestedLocale, +bv.resolved.locale); +var bw={ +locale:Z, +numberingSystem:bv.resolved.numberingSystem, +calendar:bJ, +timeZone:bv.resolved.timeZone +}; +addWECPropertyIfDefined(bw,'timeZoneName',bI.timeZoneName); +addWECPropertyIfDefined(bw,'era',bI.era); +addWECPropertyIfDefined(bw,'year',bI.year); +addWECPropertyIfDefined(bw,'month',bI.month); +addWECPropertyIfDefined(bw,'day',bI.day); +addWECPropertyIfDefined(bw,'weekday',bI.weekday); +addWECPropertyIfDefined(bw,'hour12',bI.hour12); +addWECPropertyIfDefined(bw,'hour',bI.hour); +addWECPropertyIfDefined(bw,'minute',bI.minute); +addWECPropertyIfDefined(bw,'second',bI.second); +return bw; +}, +2 +); +%FunctionSetName(g.DateTimeFormat.prototype.resolvedOptions, +'resolvedOptions'); +%FunctionRemovePrototype(g.DateTimeFormat.prototype.resolvedOptions); +%SetNativeFlag(g.DateTimeFormat.prototype.resolvedOptions); +%AddNamedProperty(g.DateTimeFormat,'supportedLocalesOf',function(R){ +if(%_IsConstructCall()){ +throw new $TypeError(E); +} +return supportedLocalesOf('dateformat',R,%_Arguments(1)); +}, +2 +); +%FunctionSetName(g.DateTimeFormat.supportedLocalesOf,'supportedLocalesOf'); +%FunctionRemovePrototype(g.DateTimeFormat.supportedLocalesOf); +%SetNativeFlag(g.DateTimeFormat.supportedLocalesOf); +function formatDate(bu,bK){ +var bL; +if(bK===d){ +bL=a.now(); +}else{ +bL=$Number(bK); +} +if(!$isFinite(bL)){ +throw new $RangeError('Provided date is not in valid range.'); +} +return %InternalDateFormat(%GetImplFromInitializedIntlObject(bu), +new a(bL)); +} +function parseDate(bu,ah){ +return %InternalDateParse(%GetImplFromInitializedIntlObject(bu), +c(ah)); +} +addBoundMethod(g.DateTimeFormat,'format',formatDate,0); +addBoundMethod(g.DateTimeFormat,'v8Parse',parseDate,1); +function canonicalizeTimeZoneID(bM){ +if(bM===d){ +return bM; +} +var bN=bM.toUpperCase(); +if(bN==='UTC'||bN==='GMT'|| +bN==='ETC/UTC'||bN==='ETC/GMT'){ +return'UTC'; +} +var bC=GetTimezoneNameCheckRE().exec(bM); +if((bC===null)){ +throw new $RangeError('Expected Area/Location for time zone, got '+bM); +} +var bw=toTitleCaseWord(bC[1])+'/'+toTitleCaseWord(bC[2]); +var Y=3; +while(bC[Y]!==d&&Y0){ +if((%_DebugIsActive()!=0))%DebugPrepareStepInIfStepping(this); +try{ +return %_GeneratorNext(this,a); +}catch(e){ +%GeneratorClose(this); +throw e; +} +}else if(b==0){ +return{value:void 0,done:true}; +}else{ +throw MakeTypeError('generator_running',[]); +} +} +function GeneratorObjectThrow(a){ +if(!(%_ClassOf(this)==='Generator')){ +throw MakeTypeError('incompatible_method_receiver', +['[Generator].prototype.throw',this]); +} +var b=%GeneratorGetContinuation(this); +if(b>0){ +try{ +return %_GeneratorThrow(this,a); +}catch(e){ +%GeneratorClose(this); +throw e; +} +}else if(b==0){ +throw a; +}else{ +throw MakeTypeError('generator_running',[]); +} +} +function GeneratorObjectIterator(){ +return this; +} +function GeneratorFunctionPrototypeConstructor(a){ +if(%_IsConstructCall()){ +throw MakeTypeError('not_constructor',['GeneratorFunctionPrototype']); +} +} +function GeneratorFunctionConstructor(a){ +return NewFunctionFromString(arguments,'function*'); +} +function SetUpGenerators(){ +%CheckIsBootstrapping(); +%NeverOptimizeFunction(GeneratorObjectNext); +%NeverOptimizeFunction(GeneratorObjectThrow); +var a=GeneratorFunctionPrototype.prototype; +InstallFunctions(a, +2|4|1, +["next",GeneratorObjectNext, +"throw",GeneratorObjectThrow]); +%FunctionSetName(GeneratorObjectIterator,'[Symbol.iterator]'); +%AddNamedProperty(a,symbolIterator, +GeneratorObjectIterator,2|4|1); +%AddNamedProperty(a,"constructor", +GeneratorFunctionPrototype,2|1); +%AddNamedProperty(a, +symbolToStringTag,"Generator",2|1); +%InternalSetPrototype(GeneratorFunctionPrototype,$Function.prototype); +%AddNamedProperty(GeneratorFunctionPrototype, +symbolToStringTag,"GeneratorFunction",2|1); +%SetCode(GeneratorFunctionPrototype,GeneratorFunctionPrototypeConstructor); +%AddNamedProperty(GeneratorFunctionPrototype,"constructor", +GeneratorFunction,2|1); +%InternalSetPrototype(GeneratorFunction,$Function); +%SetCode(GeneratorFunction,GeneratorFunctionConstructor); +} +SetUpGenerators(); + +4harmony-arrayý5 +'use strict'; +function ArrayFind(a){ +if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["Array.prototype.find"]); +var b=ToObject(this); +var c=ToInteger(b.length); +if(!(%_ClassOf(a)==='Function')){ +throw MakeTypeError('called_non_callable',[a]); +} +var d; +if(%_ArgumentsLength()>1){ +d=%_Arguments(1); +} +var e=false; +if((d==null)){ +d=%GetDefaultReceiver(a)||d; +}else{ +e=(!(%_IsSpecObject(d))&&%IsSloppyModeFunction(a)); +} +for(var f=0;f1){ +d=%_Arguments(1); +} +var e=false; +if((d==null)){ +d=%GetDefaultReceiver(a)||d; +}else{ +e=(!(%_IsSpecObject(d))&&%IsSloppyModeFunction(a)); +} +for(var f=0;f>>0); +var d=0; +var e=c; +if(%_ArgumentsLength()>1){ +d=%_Arguments(1); +d=(d===(void 0))?0:(%_IsSmi(%IS_VAR(d))?d:%NumberToInteger(ToNumber(d))); +if(%_ArgumentsLength()>2){ +e=%_Arguments(2); +e=(e===(void 0))?c:(%_IsSmi(%IS_VAR(e))?e:%NumberToInteger(ToNumber(e))); +} +} +if(d<0){ +d+=c; +if(d<0)d=0; +}else{ +if(d>c)d=c; +} +if(e<0){ +e+=c; +if(e<0)e=0; +}else{ +if(e>c)e=c; +} +if((e-d)>0&&ObjectIsFrozen(b)){ +throw MakeTypeError("array_functions_on_frozen", +["Array.prototype.fill"]); +} +for(;d=0){ +f=e; +}else{ +f=d+e; +if(f<0){ +f=0; +} +} +while(f1){ +c=%_Arguments(1); +} +var d=false; +if((c==null)){ +c=%GetDefaultReceiver(a)||c; +}else{ +d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); +} +var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +for(var g=0;g1){ +c=%_Arguments(1); +} +var d=false; +if((c==null)){ +c=%GetDefaultReceiver(a)||c; +}else{ +d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); +} +var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +for(var g=0;g1){ +c=%_Arguments(1); +} +var d=false; +if((c==null)){ +c=%GetDefaultReceiver(a)||c; +}else{ +d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); +} +var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +for(var g=0;g1){ +c=%_Arguments(1); +} +var d=false; +if((c==null)){ +c=%GetDefaultReceiver(a)||c; +}else{ +d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); +} +var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +for(var g=0;g1){ +c=%_Arguments(1); +} +var d=false; +if((c==null)){ +c=%GetDefaultReceiver(a)||c; +}else{ +d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); +} +var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +for(var g=0;g1){ +c=%_Arguments(1); +} +var d=false; +if((c==null)){ +c=%GetDefaultReceiver(a)||c; +}else{ +d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); +} +var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +for(var g=0;g1){ +c=%_Arguments(1); +} +var d=false; +if((c==null)){ +c=%GetDefaultReceiver(a)||c; +}else{ +d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); +} +var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +for(var g=0;g1){ +c=%_Arguments(1); +} +var d=false; +if((c==null)){ +c=%GetDefaultReceiver(a)||c; +}else{ +d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); +} +var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +for(var g=0;g1){ +c=%_Arguments(1); +} +var d=false; +if((c==null)){ +c=%GetDefaultReceiver(a)||c; +}else{ +d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); +} +var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); +for(var g=0;g + +@class MTLModel; + +// A MTLModel object that supports being parsed from and serialized to JSON. +@protocol MTLJSONSerializing +@required + +// Specifies how to map property keys to different key paths in JSON. +// +// Subclasses overriding this method should combine their values with those of +// `super`. +// +// Any property keys not present in the dictionary are assumed to match the JSON +// key that should be used. Any keys associated with NSNull will not participate +// in JSON serialization. +// +// Returns a dictionary mapping property keys to JSON key paths (as strings) or +// NSNull values. ++ (NSDictionary *)JSONKeyPathsByPropertyKey; + +@optional + +// Specifies how to convert a JSON value to the given property key. If +// reversible, the transformer will also be used to convert the property value +// back to JSON. +// +// If the receiver implements a `+JSONTransformer` method, MTLJSONAdapter +// will use the result of that method instead. +// +// Returns a value transformer, or nil if no transformation should be performed. ++ (NSValueTransformer *)JSONTransformerForKey:(NSString *)key; + +// Overridden to parse the receiver as a different class, based on information +// in the provided dictionary. +// +// This is mostly useful for class clusters, where the abstract base class would +// be passed into -[MTLJSONAdapter initWithJSONDictionary:modelClass:], but +// a subclass should be instantiated instead. +// +// JSONDictionary - The JSON dictionary that will be parsed. +// +// Returns the class that should be parsed (which may be the receiver), or nil +// to abort parsing (e.g., if the data is invalid). ++ (Class)classForParsingJSONDictionary:(NSDictionary *)JSONDictionary; + +@end + +// The domain for errors originating from MTLJSONAdapter. +extern NSString * const MTLJSONAdapterErrorDomain; + +// +classForParsingJSONDictionary: returned nil for the given dictionary. +extern const NSInteger MTLJSONAdapterErrorNoClassFound; + +// The provided JSONDictionary is not valid. +extern const NSInteger MTLJSONAdapterErrorInvalidJSONDictionary; + +// The model's implementation of +JSONKeyPathsByPropertyKey included a key which +// does not actually exist in +propertyKeys. +extern const NSInteger MTLJSONAdapterErrorInvalidJSONMapping; + +// Converts a MTLModel object to and from a JSON dictionary. +@interface MTLJSONAdapter : NSObject + +// The model object that the receiver was initialized with, or that the receiver +// parsed from a JSON dictionary. +@property (nonatomic, strong, readonly) MTLModel *model; + +// Attempts to parse a JSON dictionary into a model object. +// +// modelClass - The MTLModel subclass to attempt to parse from the JSON. +// This class must conform to . This +// argument must not be nil. +// JSONDictionary - A dictionary representing JSON data. This should match the +// format returned by NSJSONSerialization. If this argument is +// nil, the method returns nil. +// error - If not NULL, this may be set to an error that occurs during +// parsing or initializing an instance of `modelClass`. +// +// Returns an instance of `modelClass` upon success, or nil if a parsing error +// occurred. ++ (id)modelOfClass:(Class)modelClass fromJSONDictionary:(NSDictionary *)JSONDictionary error:(NSError **)error; + +// Attempts to parse an array of JSON dictionary objects into a model objects +// of a specific class. +// +// modelClass - The MTLModel subclass to attempt to parse from the JSON. This +// class must conform to . This argument must +// not be nil. +// JSONArray - A array of dictionaries representing JSON data. This should +// match the format returned by NSJSONSerialization. If this +// argument is nil, the method returns nil. +// error - If not NULL, this may be set to an error that occurs during +// parsing or initializing an any of the instances of +// `modelClass`. +// +// Returns an array of `modelClass` instances upon success, or nil if a parsing +// error occurred. ++ (NSArray *)modelsOfClass:(Class)modelClass fromJSONArray:(NSArray *)JSONArray error:(NSError **)error; + +// Converts a model into a JSON representation. +// +// model - The model to use for JSON serialization. This argument must not be +// nil. +// +// Returns a JSON dictionary, or nil if a serialization error occurred. ++ (NSDictionary *)JSONDictionaryFromModel:(MTLModel *)model; + +// Converts a array of models into a JSON representation. +// +// models - The array of models to use for JSON serialization. This argument +// must not be nil. +// +// Returns a JSON array, or nil if a serialization error occurred for any +// model. ++ (NSArray *)JSONArrayFromModels:(NSArray *)models; + +// Initializes the receiver by attempting to parse a JSON dictionary into +// a model object. +// +// JSONDictionary - A dictionary representing JSON data. This should match the +// format returned by NSJSONSerialization. If this argument is +// nil, the method returns nil and an error with code +// MTLJSONAdapterErrorInvalidJSONDictionary. +// modelClass - The MTLModel subclass to attempt to parse from the JSON. +// This class must conform to . This +// argument must not be nil. +// error - If not NULL, this may be set to an error that occurs during +// parsing or initializing an instance of `modelClass`. +// +// Returns an initialized adapter upon success, or nil if a parsing error +// occurred. +- (id)initWithJSONDictionary:(NSDictionary *)JSONDictionary modelClass:(Class)modelClass error:(NSError **)error; + +// Initializes the receiver with an existing model. +// +// model - The model to use for JSON serialization. This argument must not be +// nil. +- (id)initWithModel:(MTLModel *)model; + +// Serializes the receiver's `model` into JSON. +// +// Returns a JSON dictionary, or nil if a serialization error occurred. +- (NSDictionary *)JSONDictionary; + +// Looks up the JSON key path in the model's +propertyKeys. +// +// Subclasses may override this method to customize the adapter's seralizing +// behavior. You should not call this method directly. +// +// key - The property key to retrieve the corresponding JSON key path for. This +// argument must not be nil. +// +// Returns a key path to use, or nil to omit the property from JSON. +- (NSString *)JSONKeyPathForPropertyKey:(NSString *)key; + +@end + +@interface MTLJSONAdapter (Deprecated) + ++ (id)modelOfClass:(Class)modelClass fromJSONDictionary:(NSDictionary *)JSONDictionary __attribute__((deprecated("Replaced by +modelOfClass:fromJSONDictionary:error:"))); +- (id)initWithJSONDictionary:(NSDictionary *)JSONDictionary modelClass:(Class)modelClass __attribute__((deprecated("Replaced by -initWithJSONDictionary:modelClass:error:"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/MTLManagedObjectAdapter.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/MTLManagedObjectAdapter.h new file mode 100644 index 0000000..11b2bcf --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/MTLManagedObjectAdapter.h @@ -0,0 +1,215 @@ +// +// MTLManagedObjectAdapter.h +// Mantle +// +// Created by Justin Spahr-Summers on 2013-03-29. +// Copyright (c) 2013 GitHub. All rights reserved. +// + +#import + +@class MTLModel; + +// A MTLModel object that supports being serialized to and from Core Data as an +// NSManagedObject. +@protocol MTLManagedObjectSerializing +@required + +// The name of the Core Data entity that the receiver serializes to and +// deserializes from. +// +// This method must not return nil. ++ (NSString *)managedObjectEntityName; + +// Specifies how to map property keys to different keys on the receiver's +// +managedObjectEntity. +// +// Entity attributes will be mapped to and from the receiver's properties using +// +entityAttributeTransformerForKey:. Entity relationships will be mapped to +// and from MTLModel objects using +relationshipModelClassesByPropertyKey. +// Fetched properties are not supported. +// +// Subclasses overriding this method should combine their values with those of +// `super`. +// +// Any property keys not present in the dictionary are assumed to match the +// entity key that should be used. Any keys associated with NSNull will not +// participate in managed object serialization. +// +// Returns a dictionary mapping property keys to entity keys (as strings) or +// NSNull values. ++ (NSDictionary *)managedObjectKeysByPropertyKey; + +@optional + +// Specifies a set of property keys used by the adapter to check for an already +// existing managed object when converting the MTLModel to its related +// NSManagedObject. +// +// The adapter will first map any keys provided by this method to the correct +// keys in managedObjectKeysByPropertyKey. +// +// The adapter will then perform a fetch request in the provided context for a +// managed object that matches the MTLModel's managedObjectEntityName and has +// equal values set for the property keys on the MTLModel. +// +// The managed object returned by the fetch request will then be set with all +// values from the MTLModel that the managed object is being converted from. +// +// If a property value of our MTLModel is yet another MTLModel which needs to be +// converted to a managed object, the class for that MTLModel can also implement +// this method to perform its own uniqing. +// +// For example: +// 1. An MTLModel subclass has id_number = 10. +// 2. An NSManagedObject accessible to the adapter's context has idnumber = 10. +// 3. managedObjectKeysByPropertyKey returns @{@"id_number" : @"idnumber"} +// 4. propertyKeysForManagedObjectUniquing returns +// [NSSet setWithObject:@"id_number"]; +// 5. Then our fetch request may return this managed object (or another managed +// object with idnumber = 10). +// +// NOTE: If multiple managed objects follow the same uniquing criteria only one +// of them will be set with our MTLModel's values. ++ (NSSet *)propertyKeysForManagedObjectUniquing; + +// Specifies how to convert the given property key to a managed object +// attribute. If reversible, the transformer will also be used to convert the +// managed object attribute back to the property. +// +// If the receiver implements a `+EntityAttributeTransformer` method, +// MTLManagedObjectAdapter will use the result of that method instead. +// +// Returns a value transformer, or nil if no transformation should be performed. ++ (NSValueTransformer *)entityAttributeTransformerForKey:(NSString *)key; + +// Specifies the MTLModel subclasses that should be deserialized to the +// receiver's property keys when a property key corresponds to an entity +// relationship. +// +// In other words, the dictionary returned by this method is used to decode +// managed object relationships into MTLModels (or NSArrays or NSSets thereof) +// set on the receiver. +// +// If a property key is omitted from the returned dictionary, but present in +// +managedObjectKeysByPropertyKey, and the receiver's +managedObjectEntity has +// a relationship at the corresponding key, an exception will be thrown during +// deserialization. +// +// Subclasses overriding this method should combine their values with those of +// `super`. +// +// Returns a dictionary mapping property keys to the Class objects that should +// be used. ++ (NSDictionary *)relationshipModelClassesByPropertyKey; + +// Overridden to deserialize a different class instead of the receiver, based on +// information in the provided object. +// +// This is mostly useful for class clusters, where the abstract base class would +// be passed into +[MTLManagedObjectAdapter +// modelOfClass:fromManagedObject:error:], but a subclass should be instantiated +// instead. +// +// managedObject - The object that will be deserialized. +// +// Returns the class that should be instantiated (which may be the receiver), or +// nil to abort parsing (e.g., if the data is invalid). ++ (Class)classForDeserializingManagedObject:(NSManagedObject *)managedObject; + +// Overriden when merging the value of the given key on the receiver with the +// value of the same key from the given `NSManagedObject` requires custom +// handling. +// +// By default, this method is not implemented, and precedence will be given to +// the value of the receiving model implicitly. +// +// When implemented, this method is called when an existing `NSManagedObject` +// is found for the receiving model, before updating the `NSManagedObject`'s +// properties. +// +// When implementing, you should use `+managedObjectKeysByPropertyKey` to map +// the given `key` to the appropriate `NSManagedObject` property. +- (void)mergeValueForKey:(NSString *)key fromManagedObject:(NSManagedObject *)managedObject; + +// Overriden when merging values on the receiver with the given +// `NSManagedObject` requires custom handling. +// +// By default, this method is not implemented, and precedence will be given to +// the values of the receiving model implicitly. +// +// When implemented, this method is called when an existing `NSManagedObject` +// is found for the receiving model, before updating the `NSManagedObject`'s +// properties. +// +// When implementing, you should use `+managedObjectKeysByPropertyKey` to map +// the given `key` to the appropriate `NSManagedObject` property. +// +// If you have also implemented `mergeValueForKey:fromManagedObject:` you have +// to make sure to call `mergeValueForKey:fromManagedObject:` from this method +// when appropriate. +- (void)mergeValuesForKeysFromManagedObject:(NSManagedObject *)managedObject; + +@end + +// The domain for errors originating from MTLManagedObjectAdapter. +extern NSString * const MTLManagedObjectAdapterErrorDomain; + +// +classForDeserializingManagedObject: returned nil for the given object. +extern const NSInteger MTLManagedObjectAdapterErrorNoClassFound; + +// An NSManagedObject failed to initialize. +extern const NSInteger MTLManagedObjectAdapterErrorInitializationFailed; + +// The managed object key specified by +managedObjectKeysByPropertyKey does not +// exist in the NSEntityDescription. +extern const NSInteger MTLManagedObjectAdapterErrorInvalidManagedObjectKey; + +// The managed object property specified has a type that isn't supported by +// MTLManagedObjectAdapter. +extern const NSInteger MTLManagedObjectAdapterErrorUnsupportedManagedObjectPropertyType; + +// The fetch request to find an existing managed object based on +// `+propertyKeysForManagedObjectUniquing` failed. +extern const NSInteger MTLManagedObjectAdapterErrorUniqueFetchRequestFailed; + +// A MTLModel property cannot be serialized to or deserialized from an +// NSManagedObject relationship. +// +// For a to-one relationship, this means that the property does not contain +// a MTLModel, or the MTLModel does not conform to . +// +// For a to-many relationship, this means that the property does not contain an +// NSArray or NSSet of MTLModel instances. +extern const NSInteger MTLManagedObjectAdapterErrorUnsupportedRelationshipClass; + +// The model's implementation of +managedObjectKeysByPropertyKey included a key +// which does not actually exist in +propertyKeys. +extern const NSInteger MTLManagedObjectAdapterErrorInvalidManagedObjectMapping; + +// Converts a MTLModel object to and from an NSManagedObject. +@interface MTLManagedObjectAdapter : NSObject + +// Attempts to deserialize an NSManagedObject into a MTLModel object. +// +// modelClass - The MTLModel subclass to return. This class must conform to +// . This argument must not be nil. +// managedObject - The managed object to deserialize. If this argument is nil, +// the method returns nil. +// error - If not NULL, this may be set to an error that occurs during +// deserialization or initializing an instance of `modelClass`. +// +// Returns an instance of `modelClass` upon success, or nil if an error +// occurred. ++ (id)modelOfClass:(Class)modelClass fromManagedObject:(NSManagedObject *)managedObject error:(NSError **)error; + +// Serializes a MTLModel into an NSManagedObject. +// +// model - The model object to serialize. This argument must not be nil. +// context - The context into which to insert the created managed object. This +// argument must not be nil. +// error - If not NULL, this may be set to an error that occurs during +// serialization or insertion. ++ (id)managedObjectFromModel:(MTLModel *)model insertingIntoContext:(NSManagedObjectContext *)context error:(NSError **)error; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/MTLModel+NSCoding.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/MTLModel+NSCoding.h new file mode 100644 index 0000000..94b8f7b --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/MTLModel+NSCoding.h @@ -0,0 +1,128 @@ +// +// MTLModel+NSCoding.h +// Mantle +// +// Created by Justin Spahr-Summers on 2013-02-12. +// Copyright (c) 2013 GitHub. All rights reserved. +// + +#import "MTLModel.h" + +// Defines how a MTLModel property key should be encoded into an archive. +// +// MTLModelEncodingBehaviorExcluded - The property should never be encoded. +// MTLModelEncodingBehaviorUnconditional - The property should always be +// encoded. +// MTLModelEncodingBehaviorConditional - The object should be encoded only +// if unconditionally encoded elsewhere. +// This should only be used for object +// properties. +typedef enum : NSUInteger { + MTLModelEncodingBehaviorExcluded = 0, + MTLModelEncodingBehaviorUnconditional, + MTLModelEncodingBehaviorConditional, +} MTLModelEncodingBehavior; + +// Implements default archiving and unarchiving behaviors for MTLModel. +@interface MTLModel (NSCoding) + +// Initializes the receiver from an archive. +// +// This will decode the original +modelVersion of the archived object, then +// invoke -decodeValueForKey:withCoder:modelVersion: for each of the receiver's +// +propertyKeys. +// +// Returns an initialized model object, or nil if a decoding error occurred. +- (id)initWithCoder:(NSCoder *)coder; + +// Archives the receiver using the given coder. +// +// This will encode the receiver's +modelVersion, then the receiver's properties +// according to the behaviors specified in +encodingBehaviorsByPropertyKey. +- (void)encodeWithCoder:(NSCoder *)coder; + +// Determines how the +propertyKeys of the class are encoded into an archive. +// The values of this dictionary should be boxed MTLModelEncodingBehavior +// values. +// +// Any keys not present in the dictionary will be excluded from the archive. +// +// Subclasses overriding this method should combine their values with those of +// `super`. +// +// Returns a dictionary mapping the receiver's +propertyKeys to default encoding +// behaviors. If a property is an object with `weak` semantics, the default +// behavior is MTLModelEncodingBehaviorConditional; otherwise, the default is +// MTLModelEncodingBehaviorUnconditional. ++ (NSDictionary *)encodingBehaviorsByPropertyKey; + +// Determines the classes that are allowed to be decoded for each of the +// receiver's properties when using . The values of this +// dictionary should be NSArrays of Class objects. +// +// If any encodable keys (as determined by +encodingBehaviorsByPropertyKey) are +// not present in the dictionary, an exception will be thrown during secure +// encoding or decoding. +// +// Subclasses overriding this method should combine their values with those of +// `super`. +// +// Returns a dictionary mapping the receiver's encodable keys (as determined by +// +encodingBehaviorsByPropertyKey) to default allowed classes, based on the +// type that each property is declared as. If type of an encodable property +// cannot be determined (e.g., it is declared as `id`), it will be omitted from +// the dictionary, and subclasses must provide a valid value to prevent an +// exception being thrown during encoding/decoding. ++ (NSDictionary *)allowedSecureCodingClassesByPropertyKey; + +// Decodes the value of the given property key from an archive. +// +// By default, this method looks for a `-decodeWithCoder:modelVersion:` +// method on the receiver, and invokes it if found. +// +// If the custom method is not implemented and `coder` does not require secure +// coding, `-[NSCoder decodeObjectForKey:]` will be invoked with the given +// `key`. +// +// If the custom method is not implemented and `coder` requires secure coding, +// `-[NSCoder decodeObjectOfClasses:forKey:]` will be invoked with the +// information from +allowedSecureCodingClassesByPropertyKey and the given `key`. The +// receiver must conform to for this to work correctly. +// +// key - The property key to decode the value for. This argument cannot +// be nil. +// coder - The NSCoder representing the archive being decoded. This +// argument cannot be nil. +// modelVersion - The version of the original model object that was encoded. +// +// Returns the decoded and boxed value, or nil if the key was not present. +- (id)decodeValueForKey:(NSString *)key withCoder:(NSCoder *)coder modelVersion:(NSUInteger)modelVersion; + +// The version of this MTLModel subclass. +// +// This version number is saved in archives so that later model changes can be +// made backwards-compatible with old versions. +// +// Subclasses should override this method to return a higher version number +// whenever a breaking change is made to the model. +// +// Returns 0. ++ (NSUInteger)modelVersion; + +@end + +// This method must be overridden to support archives created by older versions +// of Mantle (before the `MTLModel+NSCoding` interface existed). +@interface MTLModel (OldArchiveSupport) + +// Converts an archived external representation to a dictionary suitable for +// passing to -initWithDictionary:. +// +// externalRepresentation - The decoded external representation of the receiver. +// fromVersion - The model version at the time the external +// representation was encoded. +// +// Returns nil by default, indicating that conversion failed. ++ (NSDictionary *)dictionaryValueFromArchivedExternalRepresentation:(NSDictionary *)externalRepresentation version:(NSUInteger)fromVersion; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/MTLModel.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/MTLModel.h new file mode 100644 index 0000000..65da40d --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/MTLModel.h @@ -0,0 +1,125 @@ +// +// MTLModel.h +// Mantle +// +// Created by Justin Spahr-Summers on 2012-09-11. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import + +// An abstract base class for model objects, using reflection to provide +// sensible default behaviors. +// +// The default implementations of , -hash, and -isEqual: make use of +// the +propertyKeys method. +@interface MTLModel : NSObject + +// Returns a new instance of the receiver initialized using +// -initWithDictionary:error:. ++ (instancetype)modelWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error; + +// Initializes the receiver with default values. +// +// This is the designated initializer for this class. +- (instancetype)init; + +// Initializes the receiver using key-value coding, setting the keys and values +// in the given dictionary. +// +// Subclass implementations may override this method, calling the super +// implementation, in order to perform further processing and initialization +// after deserialization. +// +// dictionaryValue - Property keys and values to set on the receiver. Any NSNull +// values will be converted to nil before being used. KVC +// validation methods will automatically be invoked for all of +// the properties given. If nil, this method is equivalent to +// -init. +// error - If not NULL, this may be set to any error that occurs +// (like a KVC validation error). +// +// Returns an initialized model object, or nil if validation failed. +- (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error; + +// Returns the keys for all @property declarations, except for `readonly` +// properties without ivars, or properties on MTLModel itself. ++ (NSSet *)propertyKeys; + +// A dictionary representing the properties of the receiver. +// +// The default implementation combines the values corresponding to all +// +propertyKeys into a dictionary, with any nil values represented by NSNull. +// +// This property must never be nil. +@property (nonatomic, copy, readonly) NSDictionary *dictionaryValue; + +// Merges the value of the given key on the receiver with the value of the same +// key from the given model object, giving precedence to the other model object. +// +// By default, this method looks for a `-mergeFromModel:` method on the +// receiver, and invokes it if found. If not found, and `model` is not nil, the +// value for the given key is taken from `model`. +- (void)mergeValueForKey:(NSString *)key fromModel:(MTLModel *)model; + +// Merges the values of the given model object into the receiver, using +// -mergeValueForKey:fromModel: for each key in +propertyKeys. +// +// `model` must be an instance of the receiver's class or a subclass thereof. +- (void)mergeValuesForKeysFromModel:(MTLModel *)model; + +// Compares the receiver with another object for equality. +// +// The default implementation is equivalent to comparing both models' +// -dictionaryValue. +// +// Note that this may lead to infinite loops if the receiver holds a circular +// reference to another MTLModel and both use the default behavior. +// It is recommended to override -isEqual: in this scenario. +- (BOOL)isEqual:(id)object; + +// A string that describes the contents of the receiver. +// +// The default implementation is based on the receiver's class and its +// -dictionaryValue. +// +// Note that this may lead to infinite loops if the receiver holds a circular +// reference to another MTLModel and both use the default behavior. +// It is recommended to override -description in this scenario. +- (NSString *)description; + +@end + +// Implements validation logic for MTLModel. +@interface MTLModel (Validation) + +// Validates the model. +// +// The default implementation simply invokes -validateValue:forKey:error: with +// all +propertyKeys and their current value. If -validateValue:forKey:error: +// returns a new value, the property is set to that new value. +// +// error - If not NULL, this may be set to any error that occurs during +// validation +// +// Returns YES if the model is valid, or NO if the validation failed. +- (BOOL)validate:(NSError **)error; + +@end + +@interface MTLModel (Unavailable) + ++ (instancetype)modelWithDictionary:(NSDictionary *)dictionaryValue __attribute__((deprecated("Replaced by +modelWithDictionary:error:"))); +- (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue __attribute__((deprecated("Replaced by -initWithDictionary:error:"))); + ++ (instancetype)modelWithExternalRepresentation:(NSDictionary *)externalRepresentation __attribute__((deprecated("Replaced by -[MTLJSONAdapter initWithJSONDictionary:modelClass:]"))); +- (instancetype)initWithExternalRepresentation:(NSDictionary *)externalRepresentation __attribute__((deprecated("Replaced by -[MTLJSONAdapter initWithJSONDictionary:modelClass:]"))); + +@property (nonatomic, copy, readonly) NSDictionary *externalRepresentation __attribute__((deprecated("Replaced by MTLJSONAdapter.JSONDictionary"))); + ++ (NSDictionary *)externalRepresentationKeyPathsByPropertyKey __attribute__((deprecated("Replaced by +JSONKeyPathsByPropertyKey in "))); ++ (NSValueTransformer *)transformerForKey:(NSString *)key __attribute__((deprecated("Replaced by +JSONTransformerForKey: in "))); + ++ (NSDictionary *)migrateExternalRepresentation:(NSDictionary *)externalRepresentation fromVersion:(NSUInteger)fromVersion __attribute__((deprecated("Replaced by -decodeValueForKey:withCoder:modelVersion:"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/MTLValueTransformer.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/MTLValueTransformer.h new file mode 100644 index 0000000..231b59f --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/MTLValueTransformer.h @@ -0,0 +1,29 @@ +// +// MTLValueTransformer.h +// Mantle +// +// Created by Justin Spahr-Summers on 2012-09-11. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import + +typedef id (^MTLValueTransformerBlock)(id); + +// +// A value transformer supporting block-based transformation. +// +@interface MTLValueTransformer : NSValueTransformer + +// Returns a transformer which transforms values using the given block. Reverse +// transformations will not be allowed. ++ (instancetype)transformerWithBlock:(MTLValueTransformerBlock)transformationBlock; + +// Returns a transformer which transforms values using the given block, for +// forward or reverse transformations. ++ (instancetype)reversibleTransformerWithBlock:(MTLValueTransformerBlock)transformationBlock; + +// Returns a transformer which transforms values using the given blocks. ++ (instancetype)reversibleTransformerWithForwardBlock:(MTLValueTransformerBlock)forwardBlock reverseBlock:(MTLValueTransformerBlock)reverseBlock; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/Mantle.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/Mantle.h new file mode 100644 index 0000000..ebd74e7 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/Mantle.h @@ -0,0 +1,26 @@ +// +// Mantle.h +// Mantle +// +// Created by Justin Spahr-Summers on 2012-09-04. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import + +//! Project version number for Mantle. +FOUNDATION_EXPORT double MantleVersionNumber; + +//! Project version string for Mantle. +FOUNDATION_EXPORT const unsigned char MantleVersionString[]; + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSArray+MTLManipulationAdditions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSArray+MTLManipulationAdditions.h new file mode 100644 index 0000000..fd7347c --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSArray+MTLManipulationAdditions.h @@ -0,0 +1,28 @@ +// +// NSArray+MTLManipulationAdditions.h +// Mantle +// +// Created by Josh Abernathy on 9/19/12. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import + +@interface NSArray (MTLManipulationAdditions) + +// The first object in the array or nil if the array is empty. +// Forwards to `firstObject` which has been first declared in iOS7, but works with iOS4/10.6. +@property (nonatomic, readonly, strong) id mtl_firstObject; + +// Returns a new array without all instances of the given object. +- (NSArray *)mtl_arrayByRemovingObject:(id)object; + +// Returns a new array without the first object. If the array is empty, it +// returns the empty array. +- (NSArray *)mtl_arrayByRemovingFirstObject; + +// Returns a new array without the last object. If the array is empty, it +// returns the empty array. +- (NSArray *)mtl_arrayByRemovingLastObject; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSDictionary+MTLManipulationAdditions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSDictionary+MTLManipulationAdditions.h new file mode 100644 index 0000000..83254d3 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSDictionary+MTLManipulationAdditions.h @@ -0,0 +1,25 @@ +// +// NSDictionary+MTLManipulationAdditions.h +// Mantle +// +// Created by Justin Spahr-Summers on 2012-09-24. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import + +@interface NSDictionary (MTLManipulationAdditions) + +// Merges the keys and values from the given dictionary into the receiver. If +// both the receiver and `dictionary` have a given key, the value from +// `dictionary` is used. +// +// Returns a new dictionary containing the entries of the receiver combined with +// those of `dictionary`. +- (NSDictionary *)mtl_dictionaryByAddingEntriesFromDictionary:(NSDictionary *)dictionary; + +// Creates a new dictionary with all the entries for the given keys removed from +// the receiver. +- (NSDictionary *)mtl_dictionaryByRemovingEntriesWithKeys:(NSSet *)keys; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSObject+MTLComparisonAdditions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSObject+MTLComparisonAdditions.h new file mode 100644 index 0000000..4f7c03e --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSObject+MTLComparisonAdditions.h @@ -0,0 +1,15 @@ +// +// NSObject+MTLComparisonAdditions.h +// Mantle +// +// Created by Josh Vera on 10/26/12. +// Copyright (c) 2012 GitHub. All rights reserved. +// +// Portions copyright (c) 2011 Bitswift. All rights reserved. +// See the LICENSE file for more information. +// + +#import + +// Returns whether both objects are identical or equal via -isEqual: +BOOL MTLEqualObjects(id obj1, id obj2); diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSValueTransformer+MTLInversionAdditions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSValueTransformer+MTLInversionAdditions.h new file mode 100644 index 0000000..eefceec --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSValueTransformer+MTLInversionAdditions.h @@ -0,0 +1,21 @@ +// +// NSValueTransformer+MTLInversionAdditions.h +// Mantle +// +// Created by Justin Spahr-Summers on 2013-05-18. +// Copyright (c) 2013 GitHub. All rights reserved. +// + +#import + +@interface NSValueTransformer (MTLInversionAdditions) + +// Flips the direction of the receiver's transformation, such that +// -transformedValue: will become -reverseTransformedValue:, and vice-versa. +// +// The receiver must allow reverse transformation. +// +// Returns an inverted transformer. +- (NSValueTransformer *)mtl_invertedTransformer; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSValueTransformer+MTLPredefinedTransformerAdditions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSValueTransformer+MTLPredefinedTransformerAdditions.h new file mode 100644 index 0000000..78a6b19 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Headers/NSValueTransformer+MTLPredefinedTransformerAdditions.h @@ -0,0 +1,84 @@ +// +// NSValueTransformer+MTLPredefinedTransformerAdditions.h +// Mantle +// +// Created by Justin Spahr-Summers on 2012-09-27. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import + +// The name for a value transformer that converts strings into URLs and back. +extern NSString * const MTLURLValueTransformerName; + +// Ensure an NSNumber is backed by __NSCFBoolean/CFBooleanRef +// +// NSJSONSerialization, and likely other serialization libraries, ordinarily +// serialize NSNumbers as numbers, and thus booleans would be serialized as +// 0/1. The exception is when the NSNumber is backed by __NSCFBoolean, which, +// though very much an implementation detail, is detected and serialized as a +// proper boolean. +extern NSString * const MTLBooleanValueTransformerName; + +@interface NSValueTransformer (MTLPredefinedTransformerAdditions) + +// Creates a reversible transformer to convert a JSON dictionary into a MTLModel +// object, and vice-versa. +// +// modelClass - The MTLModel subclass to attempt to parse from the JSON. This +// class must conform to . This argument must +// not be nil. +// +// Returns a reversible transformer which uses MTLJSONAdapter for transforming +// values back and forth. ++ (NSValueTransformer *)mtl_JSONDictionaryTransformerWithModelClass:(Class)modelClass; + +// Creates a reversible transformer to convert an array of JSON dictionaries +// into an array of MTLModel objects, and vice-versa. +// +// modelClass - The MTLModel subclass to attempt to parse from each JSON +// dictionary. This class must conform to . +// This argument must not be nil. +// +// Returns a reversible transformer which uses MTLJSONAdapter for transforming +// array elements back and forth. ++ (NSValueTransformer *)mtl_JSONArrayTransformerWithModelClass:(Class)modelClass; + +// A reversible value transformer to transform between the keys and objects of a +// dictionary. +// +// dictionary - The dictionary whose keys and values should be +// transformed between. This argument must not be nil. +// defaultValue - The result to fall back to, in case no key matching the +// input value was found during a forward transformation. +// reverseDefaultValue - The result to fall back to, in case no value matching +// the input value was found during a reverse +// transformation. +// +// Can for example be used for transforming between enum values and their string +// representation. +// +// NSValueTransformer *valueTransformer = [NSValueTransformer mtl_valueMappingTransformerWithDictionary:@{ +// @"foo": @(EnumDataTypeFoo), +// @"bar": @(EnumDataTypeBar), +// } defaultValue: @(EnumDataTypeUndefined) reverseDefaultValue: @"undefined"]; +// +// Returns a transformer that will map from keys to values in dictionary +// for forward transformation, and from values to keys for reverse +// transformations. If no matching key or value can be found, the respective +// default value is returned. ++ (NSValueTransformer *)mtl_valueMappingTransformerWithDictionary:(NSDictionary *)dictionary defaultValue:(id)defaultValue reverseDefaultValue:(id)reverseDefaultValue; + +// Returns a value transformer created by calling +// `+mtl_valueMappingTransformerWithDictionary:defaultValue:reverseDefaultValue:` +// with a default value of `nil` and a reverse default value of `nil`. ++ (NSValueTransformer *)mtl_valueMappingTransformerWithDictionary:(NSDictionary *)dictionary; + +@end + +@interface NSValueTransformer (UnavailableMTLPredefinedTransformerAdditions) + ++ (NSValueTransformer *)mtl_externalRepresentationTransformerWithModelClass:(Class)modelClass __attribute__((deprecated("Replaced by +mtl_JSONDictionaryTransformerWithModelClass:"))); ++ (NSValueTransformer *)mtl_externalRepresentationArrayTransformerWithModelClass:(Class)modelClass __attribute__((deprecated("Replaced by +mtl_JSONArrayTransformerWithModelClass:"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Mantle b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Mantle new file mode 100755 index 0000000..06ee2b4 Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Mantle differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Modules/module.modulemap b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Modules/module.modulemap new file mode 100644 index 0000000..958298b --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module Mantle { + umbrella header "Mantle.h" + + export * + module * { export * } +} diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Resources/Info.plist b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Resources/Info.plist new file mode 100644 index 0000000..f8ffa47 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,45 @@ + + + + + BuildMachineOSBuild + 14C1514 + CFBundleDevelopmentRegion + en + CFBundleExecutable + Mantle + CFBundleIdentifier + org.mantle.Mantle + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Mantle + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 6C131e + DTPlatformVersion + GM + DTSDKBuild + 14A383 + DTSDKName + macosx10.10 + DTXcode + 0620 + DTXcodeBuild + 6C131e + UIDeviceFamily + + 1 + 2 + + + diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/Current b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Mantle.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Headers b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Headers new file mode 120000 index 0000000..a177d2a --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Headers @@ -0,0 +1 @@ +Versions/Current/Headers \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Modules b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Modules new file mode 120000 index 0000000..5736f31 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Modules @@ -0,0 +1 @@ +Versions/Current/Modules \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/ReactiveCocoa b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/ReactiveCocoa new file mode 120000 index 0000000..5dd82ab --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/ReactiveCocoa @@ -0,0 +1 @@ +Versions/Current/ReactiveCocoa \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Resources b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/EXTKeyPathCoding.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/EXTKeyPathCoding.h new file mode 100644 index 0000000..f34dc4a --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/EXTKeyPathCoding.h @@ -0,0 +1,68 @@ +// +// EXTKeyPathCoding.h +// extobjc +// +// Created by Justin Spahr-Summers on 19.06.12. +// Copyright (C) 2012 Justin Spahr-Summers. +// Released under the MIT license. +// + +#import +#import "metamacros.h" + +/** + * \@keypath allows compile-time verification of key paths. Given a real object + * receiver and key path: + * + * @code + +NSString *UTF8StringPath = @keypath(str.lowercaseString.UTF8String); +// => @"lowercaseString.UTF8String" + +NSString *versionPath = @keypath(NSObject, version); +// => @"version" + +NSString *lowercaseStringPath = @keypath(NSString.new, lowercaseString); +// => @"lowercaseString" + + * @endcode + * + * ... the macro returns an \c NSString containing all but the first path + * component or argument (e.g., @"lowercaseString.UTF8String", @"version"). + * + * In addition to simply creating a key path, this macro ensures that the key + * path is valid at compile-time (causing a syntax error if not), and supports + * refactoring, such that changing the name of the property will also update any + * uses of \@keypath. + */ +#define keypath(...) \ + metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__))(keypath1(__VA_ARGS__))(keypath2(__VA_ARGS__)) + +#define keypath1(PATH) \ + (((void)(NO && ((void)PATH, NO)), strchr(# PATH, '.') + 1)) + +#define keypath2(OBJ, PATH) \ + (((void)(NO && ((void)OBJ.PATH, NO)), # PATH)) + +/** + * \@collectionKeypath allows compile-time verification of key paths across collections NSArray/NSSet etc. Given a real object + * receiver, collection object receiver and related keypaths: + * + * @code + + NSString *employessFirstNamePath = @collectionKeypath(department.employees, Employee.new, firstName) + // => @"employees.firstName" + + NSString *employessFirstNamePath = @collectionKeypath(Department.new, employees, Employee.new, firstName) + // => @"employees.firstName" + + * @endcode + * + */ +#define collectionKeypath(...) \ + metamacro_if_eq(3, metamacro_argcount(__VA_ARGS__))(collectionKeypath3(__VA_ARGS__))(collectionKeypath4(__VA_ARGS__)) + +#define collectionKeypath3(PATH, COLLECTION_OBJECT, COLLECTION_PATH) ([[NSString stringWithFormat:@"%s.%s",keypath(PATH), keypath(COLLECTION_OBJECT, COLLECTION_PATH)] UTF8String]) + +#define collectionKeypath4(OBJ, PATH, COLLECTION_OBJECT, COLLECTION_PATH) ([[NSString stringWithFormat:@"%s.%s",keypath(OBJ, PATH), keypath(COLLECTION_OBJECT, COLLECTION_PATH)] UTF8String]) + diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/EXTScope.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/EXTScope.h new file mode 100644 index 0000000..4a16f4a --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/EXTScope.h @@ -0,0 +1,118 @@ +// +// EXTScope.h +// extobjc +// +// Created by Justin Spahr-Summers on 2011-05-04. +// Copyright (C) 2012 Justin Spahr-Summers. +// Released under the MIT license. +// + +#import "metamacros.h" + +/** + * \@onExit defines some code to be executed when the current scope exits. The + * code must be enclosed in braces and terminated with a semicolon, and will be + * executed regardless of how the scope is exited, including from exceptions, + * \c goto, \c return, \c break, and \c continue. + * + * Provided code will go into a block to be executed later. Keep this in mind as + * it pertains to memory management, restrictions on assignment, etc. Because + * the code is used within a block, \c return is a legal (though perhaps + * confusing) way to exit the cleanup block early. + * + * Multiple \@onExit statements in the same scope are executed in reverse + * lexical order. This helps when pairing resource acquisition with \@onExit + * statements, as it guarantees teardown in the opposite order of acquisition. + * + * @note This statement cannot be used within scopes defined without braces + * (like a one line \c if). In practice, this is not an issue, since \@onExit is + * a useless construct in such a case anyways. + */ +#define onExit \ + rac_keywordify \ + __strong rac_cleanupBlock_t metamacro_concat(rac_exitBlock_, __LINE__) __attribute__((cleanup(rac_executeCleanupBlock), unused)) = ^ + +/** + * Creates \c __weak shadow variables for each of the variables provided as + * arguments, which can later be made strong again with #strongify. + * + * This is typically used to weakly reference variables in a block, but then + * ensure that the variables stay alive during the actual execution of the block + * (if they were live upon entry). + * + * See #strongify for an example of usage. + */ +#define weakify(...) \ + rac_keywordify \ + metamacro_foreach_cxt(rac_weakify_,, __weak, __VA_ARGS__) + +/** + * Like #weakify, but uses \c __unsafe_unretained instead, for targets or + * classes that do not support weak references. + */ +#define unsafeify(...) \ + rac_keywordify \ + metamacro_foreach_cxt(rac_weakify_,, __unsafe_unretained, __VA_ARGS__) + +/** + * Strongly references each of the variables provided as arguments, which must + * have previously been passed to #weakify. + * + * The strong references created will shadow the original variable names, such + * that the original names can be used without issue (and a significantly + * reduced risk of retain cycles) in the current scope. + * + * @code + + id foo = [[NSObject alloc] init]; + id bar = [[NSObject alloc] init]; + + @weakify(foo, bar); + + // this block will not keep 'foo' or 'bar' alive + BOOL (^matchesFooOrBar)(id) = ^ BOOL (id obj){ + // but now, upon entry, 'foo' and 'bar' will stay alive until the block has + // finished executing + @strongify(foo, bar); + + return [foo isEqual:obj] || [bar isEqual:obj]; + }; + + * @endcode + */ +#define strongify(...) \ + rac_keywordify \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wshadow\"") \ + metamacro_foreach(rac_strongify_,, __VA_ARGS__) \ + _Pragma("clang diagnostic pop") + +/*** implementation details follow ***/ +typedef void (^rac_cleanupBlock_t)(); + +static inline void rac_executeCleanupBlock (__strong rac_cleanupBlock_t *block) { + (*block)(); +} + +#define rac_weakify_(INDEX, CONTEXT, VAR) \ + CONTEXT __typeof__(VAR) metamacro_concat(VAR, _weak_) = (VAR); + +#define rac_strongify_(INDEX, VAR) \ + __strong __typeof__(VAR) VAR = metamacro_concat(VAR, _weak_); + +// Details about the choice of backing keyword: +// +// The use of @try/@catch/@finally can cause the compiler to suppress +// return-type warnings. +// The use of @autoreleasepool {} is not optimized away by the compiler, +// resulting in superfluous creation of autorelease pools. +// +// Since neither option is perfect, and with no other alternatives, the +// compromise is to use @autorelease in DEBUG builds to maintain compiler +// analysis, and to use @try/@catch otherwise to avoid insertion of unnecessary +// autorelease pools. +#if DEBUG +#define rac_keywordify autoreleasepool {} +#else +#define rac_keywordify try {} @catch (...) {} +#endif diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSArray+RACSequenceAdditions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSArray+RACSequenceAdditions.h new file mode 100644 index 0000000..d2d0b3f --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSArray+RACSequenceAdditions.h @@ -0,0 +1,20 @@ +// +// NSArray+RACSequenceAdditions.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2012-10-29. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import + +@class RACSequence; + +@interface NSArray (RACSequenceAdditions) + +/// Creates and returns a sequence corresponding to the receiver. +/// +/// Mutating the receiver will not affect the sequence after it's been created. +@property (nonatomic, copy, readonly) RACSequence *rac_sequence; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSControl+RACCommandSupport.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSControl+RACCommandSupport.h new file mode 100644 index 0000000..4e51577 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSControl+RACCommandSupport.h @@ -0,0 +1,22 @@ +// +// NSControl+RACCommandSupport.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 3/3/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import + +@class RACCommand; + +@interface NSControl (RACCommandSupport) + +/// Sets the control's command. When the control is clicked, the command is +/// executed with the sender of the event. The control's enabledness is bound +/// to the command's `canExecute`. +/// +/// Note: this will reset the control's target and action. +@property (nonatomic, strong) RACCommand *rac_command; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSControl+RACTextSignalSupport.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSControl+RACTextSignalSupport.h new file mode 100644 index 0000000..3d3618d --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSControl+RACTextSignalSupport.h @@ -0,0 +1,24 @@ +// +// NSControl+RACTextSignalSupport.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2013-03-08. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import + +@class RACSignal; + +@interface NSControl (RACTextSignalSupport) + +/// Observes a text-based control for changes. +/// +/// Using this method on a control without editable text is considered undefined +/// behavior. +/// +/// Returns a signal which sends the current string value of the receiver, then +/// the new value any time it changes. +- (RACSignal *)rac_textSignal; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSData+RACSupport.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSData+RACSupport.h new file mode 100644 index 0000000..0e47f8a --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSData+RACSupport.h @@ -0,0 +1,22 @@ +// +// NSData+RACSupport.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 5/11/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import + +@class RACScheduler; +@class RACSignal; + +@interface NSData (RACSupport) + +// Read the data at the URL using -[NSData initWithContentsOfURL:options:error:]. +// Sends the data or the error. +// +// scheduler - cannot be nil. ++ (RACSignal *)rac_readContentsOfURL:(NSURL *)URL options:(NSDataReadingOptions)options scheduler:(RACScheduler *)scheduler; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSDictionary+RACSequenceAdditions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSDictionary+RACSequenceAdditions.h new file mode 100644 index 0000000..4871fe7 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSDictionary+RACSequenceAdditions.h @@ -0,0 +1,31 @@ +// +// NSDictionary+RACSequenceAdditions.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2012-10-29. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import + +@class RACSequence; + +@interface NSDictionary (RACSequenceAdditions) + +/// Creates and returns a sequence of RACTuple key/value pairs. The key will be +/// the first element in the tuple, and the value will be the second. +/// +/// Mutating the receiver will not affect the sequence after it's been created. +@property (nonatomic, copy, readonly) RACSequence *rac_sequence; + +/// Creates and returns a sequence corresponding to the keys in the receiver. +/// +/// Mutating the receiver will not affect the sequence after it's been created. +@property (nonatomic, copy, readonly) RACSequence *rac_keySequence; + +/// Creates and returns a sequence corresponding to the values in the receiver. +/// +/// Mutating the receiver will not affect the sequence after it's been created. +@property (nonatomic, copy, readonly) RACSequence *rac_valueSequence; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSEnumerator+RACSequenceAdditions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSEnumerator+RACSequenceAdditions.h new file mode 100644 index 0000000..1d8fc84 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSEnumerator+RACSequenceAdditions.h @@ -0,0 +1,20 @@ +// +// NSEnumerator+RACSequenceAdditions.h +// ReactiveCocoa +// +// Created by Uri Baghin on 07/01/2013. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import + +@class RACSequence; + +@interface NSEnumerator (RACSequenceAdditions) + +/// Creates and returns a sequence corresponding to the receiver. +/// +/// The receiver is exhausted lazily as the sequence is enumerated. +@property (nonatomic, copy, readonly) RACSequence *rac_sequence; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSFileHandle+RACSupport.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSFileHandle+RACSupport.h new file mode 100644 index 0000000..985398d --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSFileHandle+RACSupport.h @@ -0,0 +1,19 @@ +// +// NSFileHandle+RACSupport.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 5/10/12. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import + +@class RACSignal; + +@interface NSFileHandle (RACSupport) + +// Read any available data in the background and send it. Completes when data +// length is <= 0. +- (RACSignal *)rac_readInBackground; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSIndexSet+RACSequenceAdditions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSIndexSet+RACSequenceAdditions.h new file mode 100644 index 0000000..4fe3820 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSIndexSet+RACSequenceAdditions.h @@ -0,0 +1,21 @@ +// +// NSIndexSet+RACSequenceAdditions.h +// ReactiveCocoa +// +// Created by Sergey Gavrilyuk on 12/17/13. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import + +@class RACSequence; + +@interface NSIndexSet (RACSequenceAdditions) + +/// Creates and returns a sequence of indexes (as `NSNumber`s) corresponding to +/// the receiver. +/// +/// Mutating the receiver will not affect the sequence after it's been created. +@property (nonatomic, copy, readonly) RACSequence *rac_sequence; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSNotificationCenter+RACSupport.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSNotificationCenter+RACSupport.h new file mode 100644 index 0000000..ddb3954 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSNotificationCenter+RACSupport.h @@ -0,0 +1,18 @@ +// +// NSNotificationCenter+RACSupport.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 5/10/12. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import + +@class RACSignal; + +@interface NSNotificationCenter (RACSupport) + +// Sends the NSNotification every time the notification is posted. +- (RACSignal *)rac_addObserverForName:(NSString *)notificationName object:(id)object; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACAppKitBindings.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACAppKitBindings.h new file mode 100644 index 0000000..eaec439 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACAppKitBindings.h @@ -0,0 +1,40 @@ +// +// NSObject+RACAppKitBindings.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 4/17/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import + +@class RACChannelTerminal; + +@interface NSObject (RACAppKitBindings) + +/// Invokes -rac_channelToBinding:options: without any options. +- (RACChannelTerminal *)rac_channelToBinding:(NSString *)binding; + +/// Applies a Cocoa binding to the receiver, then exposes a RACChannel-based +/// interface for manipulating it. +/// +/// Creating two of the same bindings on the same object will result in undefined +/// behavior. +/// +/// binding - The name of the binding. This must not be nil. +/// options - Any options to pass to Cocoa Bindings. This may be nil. +/// +/// Returns a RACChannelTerminal which will send future values from the receiver, +/// and update the receiver when values are sent to the terminal. +- (RACChannelTerminal *)rac_channelToBinding:(NSString *)binding options:(NSDictionary *)options; + +@end + +@interface NSObject (RACAppKitBindingsDeprecated) + +- (void)rac_bind:(NSString *)binding toObject:(id)object withKeyPath:(NSString *)keyPath __attribute__((deprecated("Use -rac_bind:options: instead"))); +- (void)rac_bind:(NSString *)binding toObject:(id)object withKeyPath:(NSString *)keyPath nilValue:(id)nilValue __attribute__((deprecated("Use -rac_bind:options: instead"))); +- (void)rac_bind:(NSString *)binding toObject:(id)object withKeyPath:(NSString *)keyPath transform:(id (^)(id value))transformBlock __attribute__((deprecated("Use -rac_bind:options: instead"))); +- (void)rac_bind:(NSString *)binding toObject:(id)object withNegatedKeyPath:(NSString *)keyPath __attribute__((deprecated("Use -rac_bind:options: instead"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACDeallocating.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACDeallocating.h new file mode 100644 index 0000000..1530eb4 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACDeallocating.h @@ -0,0 +1,34 @@ +// +// NSObject+RACDeallocating.h +// ReactiveCocoa +// +// Created by Kazuo Koga on 2013/03/15. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import + +@class RACCompoundDisposable; +@class RACDisposable; +@class RACSignal; + +@interface NSObject (RACDeallocating) + +/// The compound disposable which will be disposed of when the receiver is +/// deallocated. +@property (atomic, readonly, strong) RACCompoundDisposable *rac_deallocDisposable; + +/// Returns a signal that will complete immediately before the receiver is fully +/// deallocated. If already deallocated when the signal is subscribed to, +/// a `completed` event will be sent immediately. +- (RACSignal *)rac_willDeallocSignal; + +@end + +@interface NSObject (RACDeallocatingDeprecated) + +- (RACSignal *)rac_didDeallocSignal __attribute__((deprecated("Use -rac_willDeallocSignal"))); + +- (void)rac_addDeallocDisposable:(RACDisposable *)disposable __attribute__((deprecated("Add disposables to -rac_deallocDisposable instead"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACLifting.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACLifting.h new file mode 100644 index 0000000..bc4bca2 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACLifting.h @@ -0,0 +1,61 @@ +// +// NSObject+RACLifting.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 10/13/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import + +@class RACSignal; + +@interface NSObject (RACLifting) + +/// Lifts the selector on the receiver into the reactive world. The selector will +/// be invoked whenever any signal argument sends a value, but only after each +/// signal has sent an initial value. +/// +/// It will replay the most recently sent value to new subscribers. +/// +/// This does not support C arrays or unions. +/// +/// selector - The selector on self to invoke. +/// firstSignal - The signal corresponding to the first method argument. This +/// must not be nil. +/// ... - A list of RACSignals corresponding to the remaining arguments. +/// There must be a non-nil signal for each method argument. +/// +/// Examples +/// +/// [button rac_liftSelector:@selector(setTitleColor:forState:) withSignals:textColorSignal, [RACSignal return:@(UIControlStateNormal)], nil]; +/// +/// Returns a signal which sends the return value from each invocation of the +/// selector. If the selector returns void, it instead sends RACUnit.defaultUnit. +/// It completes only after all the signal arguments complete. +- (RACSignal *)rac_liftSelector:(SEL)selector withSignals:(RACSignal *)firstSignal, ... NS_REQUIRES_NIL_TERMINATION; + +/// Like -rac_liftSelector:withSignals:, but accepts an array instead of +/// a variadic list of arguments. +- (RACSignal *)rac_liftSelector:(SEL)selector withSignalsFromArray:(NSArray *)signals; + +/// Like -rac_liftSelector:withSignals:, but accepts a signal sending tuples of +/// arguments instead of a variadic list of arguments. +- (RACSignal *)rac_liftSelector:(SEL)selector withSignalOfArguments:(RACSignal *)arguments; + +@end + +@interface NSObject (RACLiftingDeprecated) + +- (RACSignal *)rac_liftSelector:(SEL)selector withObjects:(id)arg, ... __attribute__((deprecated("Use -rac_liftSelector:withSignals: instead"))); +- (RACSignal *)rac_liftSelector:(SEL)selector withObjectsFromArray:(NSArray *)args __attribute__((deprecated("Use -rac_liftSelector:withSignalsFromArray: instead"))); +- (RACSignal *)rac_liftBlock:(id)block withArguments:(id)arg, ... NS_REQUIRES_NIL_TERMINATION __attribute__((deprecated("Use +combineLatest:reduce: instead"))); +- (RACSignal *)rac_liftBlock:(id)block withArgumentsFromArray:(NSArray *)args __attribute__((deprecated("Use +combineLatest:reduce: instead"))); + +@end + +@interface NSObject (RACLiftingUnavailable) + +- (instancetype)rac_lift __attribute__((unavailable("Use -rac_liftSelector:withSignals: instead"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACPropertySubscribing.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACPropertySubscribing.h new file mode 100644 index 0000000..2c14d5d --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACPropertySubscribing.h @@ -0,0 +1,105 @@ +// +// NSObject+RACPropertySubscribing.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 3/2/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import +#import "EXTKeyPathCoding.h" +#import "metamacros.h" + +/// Creates a signal which observes `KEYPATH` on `TARGET` for changes. +/// +/// In either case, the observation continues until `TARGET` _or self_ is +/// deallocated. If any intermediate object is deallocated instead, it will be +/// assumed to have been set to nil. +/// +/// Make sure to `@strongify(self)` when using this macro within a block! The +/// macro will _always_ reference `self`, which can silently introduce a retain +/// cycle within a block. As a result, you should make sure that `self` is a weak +/// reference (e.g., created by `@weakify` and `@strongify`) before the +/// expression that uses `RACObserve`. +/// +/// Examples +/// +/// // Observes self, and doesn't stop until self is deallocated. +/// RACSignal *selfSignal = RACObserve(self, arrayController.items); +/// +/// // Observes the array controller, and stops when self _or_ the array +/// // controller is deallocated. +/// RACSignal *arrayControllerSignal = RACObserve(self.arrayController, items); +/// +/// // Observes obj.arrayController, and stops when self _or_ the array +/// // controller is deallocated. +/// RACSignal *signal2 = RACObserve(obj.arrayController, items); +/// +/// @weakify(self); +/// RACSignal *signal3 = [anotherSignal flattenMap:^(NSArrayController *arrayController) { +/// // Avoids a retain cycle because of RACObserve implicitly referencing +/// // self. +/// @strongify(self); +/// return RACObserve(arrayController, items); +/// }]; +/// +/// Returns a signal which sends the current value of the key path on +/// subscription, then sends the new value every time it changes, and sends +/// completed if self or observer is deallocated. +#define RACObserve(TARGET, KEYPATH) \ + ({ \ + __weak id target_ = (TARGET); \ + [target_ rac_valuesForKeyPath:@keypath(TARGET, KEYPATH) observer:self]; \ + }) + +@class RACDisposable; +@class RACSignal; + +@interface NSObject (RACPropertySubscribing) + +/// Creates a signal to observe the value at the given key path. +/// +/// The initial value is sent on subscription, the subsequent values are sent +/// from whichever thread the change occured on, even if it doesn't have a valid +/// scheduler. +/// +/// Returns a signal that immediately sends the receiver's current value at the +/// given keypath, then any changes thereafter. +- (RACSignal *)rac_valuesForKeyPath:(NSString *)keyPath observer:(__weak NSObject *)observer; + +/// Creates a signal to observe the changes of the given key path. +/// +/// The initial value is sent on subscription, the subsequent values are sent +/// from whichever thread the change occured on, even if it doesn't have a valid +/// scheduler. +/// +/// Returns a signal that sends tuples containing the current value at the key +/// path and the change dictionary for each KVO callback. +- (RACSignal *)rac_valuesAndChangesForKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options observer:(__weak NSObject *)observer; + +@end + +#define RACAble(...) \ + metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__)) \ + (_RACAbleObject(self, __VA_ARGS__)) \ + (_RACAbleObject(__VA_ARGS__)) + +#define _RACAbleObject(object, property) [object rac_signalForKeyPath:@keypath(object, property) observer:self] + +#define RACAbleWithStart(...) \ + metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__)) \ + (_RACAbleWithStartObject(self, __VA_ARGS__)) \ + (_RACAbleWithStartObject(__VA_ARGS__)) + +#define _RACAbleWithStartObject(object, property) [object rac_signalWithStartingValueForKeyPath:@keypath(object, property) observer:self] + +@interface NSObject (RACPropertySubscribingDeprecated) + ++ (RACSignal *)rac_signalFor:(NSObject *)object keyPath:(NSString *)keyPath observer:(NSObject *)observer __attribute__((deprecated("Use -rac_valuesForKeyPath:observer: or RACObserve() instead."))); ++ (RACSignal *)rac_signalWithStartingValueFor:(NSObject *)object keyPath:(NSString *)keyPath observer:(NSObject *)observer __attribute__((deprecated("Use -rac_valuesForKeyPath:observer: or RACObserve() instead."))); ++ (RACSignal *)rac_signalWithChangesFor:(NSObject *)object keyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options observer:(NSObject *)observer __attribute__((deprecated("Use -rac_valuesAndChangesForKeyPath:options:observer: instead."))); +- (RACSignal *)rac_signalForKeyPath:(NSString *)keyPath observer:(NSObject *)observer __attribute__((deprecated("Use -rac_valuesForKeyPath:observer: or RACObserve() instead."))); +- (RACSignal *)rac_signalWithStartingValueForKeyPath:(NSString *)keyPath observer:(NSObject *)observer __attribute__((deprecated("Use -rac_valuesForKeyPath:observer: or RACObserve() instead."))); +- (RACDisposable *)rac_deriveProperty:(NSString *)keyPath from:(RACSignal *)signal __attribute__((deprecated("Use -[RACSignal setKeyPath:onObject:] instead"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACSelectorSignal.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACSelectorSignal.h new file mode 100644 index 0000000..c6f3de5 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSObject+RACSelectorSignal.h @@ -0,0 +1,79 @@ +// +// NSObject+RACSelectorSignal.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 3/18/13. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import + +@class RACSignal; + +/// The domain for any errors originating from -rac_signalForSelector:. +extern NSString * const RACSelectorSignalErrorDomain; + +/// -rac_signalForSelector: was going to add a new method implementation for +/// `selector`, but another thread added an implementation before it was able to. +/// +/// This will _not_ occur for cases where a method implementation exists before +/// -rac_signalForSelector: is invoked. +extern const NSInteger RACSelectorSignalErrorMethodSwizzlingRace; + +@interface NSObject (RACSelectorSignal) + +/// Creates a signal associated with the receiver, which will send a tuple of the +/// method's arguments each time the given selector is invoked. +/// +/// If the selector is already implemented on the receiver, the existing +/// implementation will be invoked _before_ the signal fires. +/// +/// If the selector is not yet implemented on the receiver, the injected +/// implementation will have a `void` return type and accept only object +/// arguments. Invoking the added implementation with non-object values, or +/// expecting a return value, will result in undefined behavior. +/// +/// This is useful for changing an event or delegate callback into a signal. For +/// example, on an NSView: +/// +/// [[view rac_signalForSelector:@selector(mouseDown:)] subscribeNext:^(RACTuple *args) { +/// NSEvent *event = args.first; +/// NSLog(@"mouse button pressed: %@", event); +/// }]; +/// +/// selector - The selector for whose invocations are to be observed. If it +/// doesn't exist, it will be implemented to accept object arguments +/// and return void. This cannot have C arrays or unions as arguments +/// or C arrays, unions, structs, complex or vector types as return +/// type. +/// +/// Returns a signal which will send a tuple of arguments upon each invocation of +/// the selector, then completes when the receiver is deallocated. `next` events +/// will be sent synchronously from the thread that invoked the method. If +/// a runtime call fails, the signal will send an error in the +/// RACSelectorSignalErrorDomain. +- (RACSignal *)rac_signalForSelector:(SEL)selector; + +/// Behaves like -rac_signalForSelector:, but if the selector is not yet +/// implemented on the receiver, its method signature is looked up within +/// `protocol`, and may accept non-object arguments. +/// +/// If the selector is not yet implemented and has a return value, the injected +/// method will return all zero bits (equal to `nil`, `NULL`, 0, 0.0f, etc.). +/// +/// selector - The selector for whose invocations are to be observed. If it +/// doesn't exist, it will be implemented using information from +/// `protocol`, and may accept non-object arguments and return +/// a value. This cannot have C arrays or unions as arguments or +/// return type. +/// protocol - The protocol in which `selector` is declared. This will be used +/// for type information if the selector is not already implemented on +/// the receiver. This must not be `NULL`, and `selector` must exist +/// in this protocol. +/// +/// Returns a signal which will send a tuple of arguments on each invocation of +/// the selector, or an error in RACSelectorSignalErrorDomain if a runtime +/// call fails. +- (RACSignal *)rac_signalForSelector:(SEL)selector fromProtocol:(Protocol *)protocol; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSOrderedSet+RACSequenceAdditions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSOrderedSet+RACSequenceAdditions.h new file mode 100644 index 0000000..8bea2db --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSOrderedSet+RACSequenceAdditions.h @@ -0,0 +1,20 @@ +// +// NSOrderedSet+RACSequenceAdditions.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2012-10-29. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import + +@class RACSequence; + +@interface NSOrderedSet (RACSequenceAdditions) + +/// Creates and returns a sequence corresponding to the receiver. +/// +/// Mutating the receiver will not affect the sequence after it's been created. +@property (nonatomic, copy, readonly) RACSequence *rac_sequence; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSSet+RACSequenceAdditions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSSet+RACSequenceAdditions.h new file mode 100644 index 0000000..6665501 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSSet+RACSequenceAdditions.h @@ -0,0 +1,20 @@ +// +// NSSet+RACSequenceAdditions.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2012-10-29. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import + +@class RACSequence; + +@interface NSSet (RACSequenceAdditions) + +/// Creates and returns a sequence corresponding to the receiver. +/// +/// Mutating the receiver will not affect the sequence after it's been created. +@property (nonatomic, copy, readonly) RACSequence *rac_sequence; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSString+RACSequenceAdditions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSString+RACSequenceAdditions.h new file mode 100644 index 0000000..0116231 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSString+RACSequenceAdditions.h @@ -0,0 +1,21 @@ +// +// NSString+RACSequenceAdditions.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2012-10-29. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import + +@class RACSequence; + +@interface NSString (RACSequenceAdditions) + +/// Creates and returns a sequence containing strings corresponding to each +/// composed character sequence in the receiver. +/// +/// Mutating the receiver will not affect the sequence after it's been created. +@property (nonatomic, copy, readonly) RACSequence *rac_sequence; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSString+RACSupport.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSString+RACSupport.h new file mode 100644 index 0000000..4c7fc72 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSString+RACSupport.h @@ -0,0 +1,22 @@ +// +// NSString+RACSupport.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 5/11/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import + +@class RACScheduler; +@class RACSignal; + +@interface NSString (RACSupport) + +// Reads in the contents of the file using +[NSString stringWithContentsOfURL:usedEncoding:error:]. +// Note that encoding won't be valid until the signal completes successfully. +// +// scheduler - cannot be nil. ++ (RACSignal *)rac_readContentsOfURL:(NSURL *)URL usedEncoding:(NSStringEncoding *)encoding scheduler:(RACScheduler *)scheduler; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSText+RACSignalSupport.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSText+RACSignalSupport.h new file mode 100644 index 0000000..e3fc8ed --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSText+RACSignalSupport.h @@ -0,0 +1,19 @@ +// +// NSText+RACSignalSupport.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2013-03-08. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import + +@class RACSignal; + +@interface NSText (RACSignalSupport) + +/// Returns a signal which sends the current `string` of the receiver, then the +/// new value any time it changes. +- (RACSignal *)rac_textSignal; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSURLConnection+RACSupport.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSURLConnection+RACSupport.h new file mode 100644 index 0000000..e9bf04f --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSURLConnection+RACSupport.h @@ -0,0 +1,25 @@ +// +// NSURLConnection+RACSupport.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2013-10-01. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import + +@class RACSignal; + +@interface NSURLConnection (RACSupport) + +// Lazily loads data for the given request in the background. +// +// request - The URL request to load. This must not be nil. +// +// Returns a signal which will begin loading the request upon each subscription, +// then send a `RACTuple` of the received `NSURLResponse` and downloaded +// `NSData`, and complete on a background thread. If any errors occur, the +// returned signal will error out. ++ (RACSignal *)rac_sendAsynchronousRequest:(NSURLRequest *)request; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSUserDefaults+RACSupport.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSUserDefaults+RACSupport.h new file mode 100644 index 0000000..8482fb3 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSUserDefaults+RACSupport.h @@ -0,0 +1,27 @@ +// +// NSUserDefaults+RACSupport.h +// ReactiveCocoa +// +// Created by Matt Diephouse on 12/19/13. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import + +@class RACChannelTerminal; + +@interface NSUserDefaults (RACSupport) + +/// Creates and returns a terminal for binding the user defaults key. +/// +/// **Note:** The value in the user defaults is *asynchronously* updated with +/// values sent to the channel. +/// +/// key - The user defaults key to create the channel terminal for. +/// +/// Returns a channel terminal that sends the value of the user defaults key +/// upon subscription, sends an updated value whenever the default changes, and +/// updates the default asynchronously with values it receives. +- (RACChannelTerminal *)rac_channelTerminalForKey:(NSString *)key; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACBacktrace.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACBacktrace.h new file mode 100644 index 0000000..6037f87 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACBacktrace.h @@ -0,0 +1,70 @@ +// +// RACBacktrace.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2012-08-20. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#ifdef RAC_DEBUG_BACKTRACE + +extern void rac_dispatch_async(dispatch_queue_t queue, dispatch_block_t block); +extern void rac_dispatch_barrier_async(dispatch_queue_t queue, dispatch_block_t block); +extern void rac_dispatch_after(dispatch_time_t time, dispatch_queue_t queue, dispatch_block_t block); +extern void rac_dispatch_async_f(dispatch_queue_t queue, void *context, dispatch_function_t function); +extern void rac_dispatch_barrier_async_f(dispatch_queue_t queue, void *context, dispatch_function_t function); +extern void rac_dispatch_after_f(dispatch_time_t time, dispatch_queue_t queue, void *context, dispatch_function_t function); + +#define dispatch_async rac_dispatch_async +#define dispatch_barrier_async rac_dispatch_barrier_async +#define dispatch_after rac_dispatch_after +#define dispatch_async_f rac_dispatch_async_f +#define dispatch_barrier_async_f rac_dispatch_barrier_async_f +#define dispatch_after_f rac_dispatch_after_f + +/// Preserves backtraces across asynchronous calls. +/// +/// On OS X, you can enable the automatic capturing of asynchronous backtraces +/// (in Debug builds) by setting the `DYLD_INSERT_LIBRARIES` environment variable +/// to `@executable_path/../Frameworks/ReactiveCocoa.framework/ReactiveCocoa` in +/// your scheme's Run action settings. +/// +/// On iOS, your project and RAC will automatically use the `rac_` GCD functions +/// (declared above) for asynchronous work. Unfortunately, unlike OS X, it's +/// impossible to capture backtraces inside NSOperationQueue or other code +/// outside of your project. +/// +/// Once backtraces are being captured, you can `po [RACBacktrace backtrace]` in +/// the debugger to print them out at any time. You can even set up an alias in +/// ~/.lldbinit to do so: +/// +/// command alias racbt po [RACBacktrace backtrace] +/// +@interface RACBacktrace : NSObject + +/// The backtrace from any previous thread. +@property (nonatomic, strong, readonly) RACBacktrace *previousThreadBacktrace; + +/// The call stack of this backtrace's thread. +@property (nonatomic, copy, readonly) NSArray *callStackSymbols; + +/// Captures the current thread's backtrace, appending it to any backtrace from +/// a previous thread. ++ (instancetype)backtrace; + +/// Same as +backtrace, but omits the specified number of frames at the +/// top of the stack (in addition to this method itself). ++ (instancetype)backtraceIgnoringFrames:(NSUInteger)ignoreCount; + +@end + +#else + +#define rac_dispatch_async dispatch_async +#define rac_dispatch_barrier_async dispatch_barrier_async +#define rac_dispatch_after dispatch_after +#define rac_dispatch_async_f dispatch_async_f +#define rac_dispatch_barrier_async_f dispatch_barrier_async_f +#define rac_dispatch_after_f dispatch_after_f + +#endif diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACBehaviorSubject.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACBehaviorSubject.h new file mode 100644 index 0000000..e95fe6d --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACBehaviorSubject.h @@ -0,0 +1,18 @@ +// +// RACBehaviorSubject.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 3/16/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import "RACSubject.h" + +/// A behavior subject sends the last value it received when it is subscribed to. +@interface RACBehaviorSubject : RACSubject + +/// Creates a new behavior subject with a default value. If it hasn't received +/// any values when it gets subscribed to, it sends the default value. ++ (instancetype)behaviorSubjectWithDefaultValue:(id)value; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACChannel.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACChannel.h new file mode 100644 index 0000000..ef1d6f1 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACChannel.h @@ -0,0 +1,70 @@ +// +// RACChannel.h +// ReactiveCocoa +// +// Created by Uri Baghin on 01/01/2013. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import "RACSignal.h" +#import "RACSubscriber.h" + +@class RACChannelTerminal; + +/// A two-way channel. +/// +/// Conceptually, RACChannel can be thought of as a bidirectional connection, +/// composed of two controllable signals that work in parallel. +/// +/// For example, when connecting between a view and a model: +/// +/// Model View +/// `leadingTerminal` ------> `followingTerminal` +/// `leadingTerminal` <------ `followingTerminal` +/// +/// The initial value of the model and all future changes to it are _sent on_ the +/// `leadingTerminal`, and _received by_ subscribers of the `followingTerminal`. +/// +/// Likewise, whenever the user changes the value of the view, that value is sent +/// on the `followingTerminal`, and received in the model from the +/// `leadingTerminal`. However, the initial value of the view is not received +/// from the `leadingTerminal` (only future changes). +@interface RACChannel : NSObject + +/// The terminal which "leads" the channel, by sending its latest value +/// immediately to new subscribers of the `followingTerminal`. +/// +/// New subscribers to this terminal will not receive a starting value, but will +/// receive all future values that are sent to the `followingTerminal`. +@property (nonatomic, strong, readonly) RACChannelTerminal *leadingTerminal; + +/// The terminal which "follows" the lead of the other terminal, only sending +/// _future_ values to the subscribers of the `leadingTerminal`. +/// +/// The latest value sent to the `leadingTerminal` (if any) will be sent +/// immediately to new subscribers of this terminal, and then all future values +/// as well. +@property (nonatomic, strong, readonly) RACChannelTerminal *followingTerminal; + +@end + +/// Represents one end of a RACChannel. +/// +/// An terminal is similar to a socket or pipe -- it represents one end of +/// a connection (the RACChannel, in this case). Values sent to this terminal +/// will _not_ be received by its subscribers. Instead, the values will be sent +/// to the subscribers of the RACChannel's _other_ terminal. +/// +/// For example, when using the `followingTerminal`, _sent_ values can only be +/// _received_ from the `leadingTerminal`, and vice versa. +/// +/// To make it easy to terminate a RACChannel, `error` and `completed` events +/// sent to either terminal will be received by the subscribers of _both_ +/// terminals. +/// +/// Do not instantiate this class directly. Create a RACChannel instead. +@interface RACChannelTerminal : RACSignal + +- (id)init __attribute__((unavailable("Instantiate a RACChannel instead"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACCommand.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACCommand.h new file mode 100644 index 0000000..653d46b --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACCommand.h @@ -0,0 +1,123 @@ +// +// RACCommand.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 3/3/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import + +@class RACSignal; + +/// The domain for errors originating within `RACCommand`. +extern NSString * const RACCommandErrorDomain; + +/// -execute: was invoked while the command was disabled. +extern const NSInteger RACCommandErrorNotEnabled; + +/// A `userInfo` key for an error, associated with the `RACCommand` that the +/// error originated from. +/// +/// This is included only when the error code is `RACCommandErrorNotEnabled`. +extern NSString * const RACUnderlyingCommandErrorKey; + +/// A command is a signal triggered in response to some action, typically +/// UI-related. +@interface RACCommand : NSObject + +/// A signal of the signals returned by successful invocations of -execute: +/// (i.e., while the receiver is `enabled`). +/// +/// Errors will be automatically caught upon the inner signals, and sent upon +/// `errors` instead. If you _want_ to receive inner errors, use -execute: or +/// -[RACSignal materialize]. +/// +/// Only executions that begin _after_ subscription will be sent upon this +/// signal. All inner signals will arrive upon the main thread. +@property (nonatomic, strong, readonly) RACSignal *executionSignals; + +/// A signal of whether this command is currently executing. +/// +/// This will send YES whenever -execute: is invoked and the created signal has +/// not yet terminated. Once all executions have terminated, `executing` will +/// send NO. +/// +/// This signal will send its current value upon subscription, and then all +/// future values on the main thread. +@property (nonatomic, strong, readonly) RACSignal *executing; + +/// A signal of whether this command is able to execute. +/// +/// This will send NO if: +/// +/// - The command was created with an `enabledSignal`, and NO is sent upon that +/// signal, or +/// - `allowsConcurrentExecution` is NO and the command has started executing. +/// +/// Once the above conditions are no longer met, the signal will send YES. +/// +/// This signal will send its current value upon subscription, and then all +/// future values on the main thread. +@property (nonatomic, strong, readonly) RACSignal *enabled; + +/// Forwards any errors that occur within signals returned by -execute:. +/// +/// When an error occurs on a signal returned from -execute:, this signal will +/// send the associated NSError value as a `next` event (since an `error` event +/// would terminate the stream). +/// +/// After subscription, this signal will send all future errors on the main +/// thread. +@property (nonatomic, strong, readonly) RACSignal *errors; + +/// Whether the command allows multiple executions to proceed concurrently. +/// +/// The default value for this property is NO. +@property (atomic, assign) BOOL allowsConcurrentExecution; + +/// Invokes -initWithEnabled:signalBlock: with a nil `enabledSignal`. +- (id)initWithSignalBlock:(RACSignal * (^)(id input))signalBlock; + +/// Initializes a command that is conditionally enabled. +/// +/// This is the designated initializer for this class. +/// +/// enabledSignal - A signal of BOOLs which indicate whether the command should +/// be enabled. `enabled` will be based on the latest value sent +/// from this signal. Before any values are sent, `enabled` will +/// default to YES. This argument may be nil. +/// signalBlock - A block which will map each input value (passed to -execute:) +/// to a signal of work. The returned signal will be multicasted +/// to a replay subject, sent on `executionSignals`, then +/// subscribed to synchronously. Neither the block nor the +/// returned signal may be nil. +- (id)initWithEnabled:(RACSignal *)enabledSignal signalBlock:(RACSignal * (^)(id input))signalBlock; + +/// If the receiver is enabled, this method will: +/// +/// 1. Invoke the `signalBlock` given at the time of initialization. +/// 2. Multicast the returned signal to a RACReplaySubject. +/// 3. Send the multicasted signal on `executionSignals`. +/// 4. Subscribe (connect) to the original signal on the main thread. +/// +/// input - The input value to pass to the receiver's `signalBlock`. This may be +/// nil. +/// +/// Returns the multicasted signal, after subscription. If the receiver is not +/// enabled, returns a signal that will send an error with code +/// RACCommandErrorNotEnabled. +- (RACSignal *)execute:(id)input; + +@end + +@interface RACCommand (Unavailable) + +@property (atomic, readonly) BOOL canExecute __attribute__((unavailable("Use the 'enabled' signal instead"))); + ++ (instancetype)command __attribute__((unavailable("Use -initWithSignalBlock: instead"))); ++ (instancetype)commandWithCanExecuteSignal:(RACSignal *)canExecuteSignal __attribute__((unavailable("Use -initWithEnabled:signalBlock: instead"))); +- (id)initWithCanExecuteSignal:(RACSignal *)canExecuteSignal __attribute__((unavailable("Use -initWithEnabled:signalBlock: instead"))); +- (RACSignal *)addSignalBlock:(RACSignal * (^)(id value))signalBlock __attribute__((unavailable("Pass the signalBlock to -initWithSignalBlock: instead"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACCompoundDisposable.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACCompoundDisposable.h new file mode 100644 index 0000000..bb25f7d --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACCompoundDisposable.h @@ -0,0 +1,48 @@ +// +// RACCompoundDisposable.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 11/30/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import "RACDisposable.h" + +/// A disposable of disposables. When it is disposed, it disposes of all its +/// contained disposables. +/// +/// If -addDisposable: is called after the compound disposable has been disposed +/// of, the given disposable is immediately disposed. This allows a compound +/// disposable to act as a stand-in for a disposable that will be delivered +/// asynchronously. +@interface RACCompoundDisposable : RACDisposable + +/// Creates and returns a new compound disposable. ++ (instancetype)compoundDisposable; + +/// Creates and returns a new compound disposable containing the given +/// disposables. ++ (instancetype)compoundDisposableWithDisposables:(NSArray *)disposables; + +/// Adds the given disposable. If the receiving disposable has already been +/// disposed of, the given disposable is disposed immediately. +/// +/// This method is thread-safe. +/// +/// disposable - The disposable to add. This may be nil, in which case nothing +/// happens. +- (void)addDisposable:(RACDisposable *)disposable; + +/// Removes the specified disposable from the compound disposable (regardless of +/// its disposed status), or does nothing if it's not in the compound disposable. +/// +/// This is mainly useful for limiting the memory usage of the compound +/// disposable for long-running operations. +/// +/// This method is thread-safe. +/// +/// disposable - The disposable to remove. This argument may be nil (to make the +/// use of weak references easier). +- (void)removeDisposable:(RACDisposable *)disposable; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACDisposable.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACDisposable.h new file mode 100644 index 0000000..5b4cf0b --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACDisposable.h @@ -0,0 +1,35 @@ +// +// RACDisposable.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 3/16/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import + +@class RACScopedDisposable; + +/// A disposable encapsulates the work necessary to tear down and cleanup a +/// subscription. +@interface RACDisposable : NSObject + +/// Whether the receiver has been disposed. +/// +/// Use of this property is discouraged, since it may be set to `YES` +/// concurrently at any time. +/// +/// This property is not KVO-compliant. +@property (atomic, assign, getter = isDisposed, readonly) BOOL disposed; + ++ (instancetype)disposableWithBlock:(void (^)(void))block; + +/// Performs the disposal work. Can be called multiple times, though subsequent +/// calls won't do anything. +- (void)dispose; + +/// Returns a new disposable which will dispose of this disposable when it gets +/// dealloc'd. +- (RACScopedDisposable *)asScopedDisposable; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACEvent.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACEvent.h new file mode 100644 index 0000000..9e64e5a --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACEvent.h @@ -0,0 +1,51 @@ +// +// RACEvent.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2013-01-07. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import + +/// Describes the type of a RACEvent. +/// +/// RACEventTypeCompleted - A `completed` event. +/// RACEventTypeError - An `error` event. +/// RACEventTypeNext - A `next` event. +typedef enum : NSUInteger { + RACEventTypeCompleted, + RACEventTypeError, + RACEventTypeNext +} RACEventType; + +/// Represents an event sent by a RACSignal. +/// +/// This corresponds to the `Notification` class in Rx. +@interface RACEvent : NSObject + +/// Returns a singleton RACEvent representing the `completed` event. ++ (instancetype)completedEvent; + +/// Returns a new event of type RACEventTypeError, containing the given error. ++ (instancetype)eventWithError:(NSError *)error; + +/// Returns a new event of type RACEventTypeNext, containing the given value. ++ (instancetype)eventWithValue:(id)value; + +/// The type of event represented by the receiver. +@property (nonatomic, assign, readonly) RACEventType eventType; + +/// Returns whether the receiver is of type RACEventTypeCompleted or +/// RACEventTypeError. +@property (nonatomic, getter = isFinished, assign, readonly) BOOL finished; + +/// The error associated with an event of type RACEventTypeError. This will be +/// nil for all other event types. +@property (nonatomic, strong, readonly) NSError *error; + +/// The value associated with an event of type RACEventTypeNext. This will be +/// nil for all other event types. +@property (nonatomic, strong, readonly) id value; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACGroupedSignal.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACGroupedSignal.h new file mode 100644 index 0000000..04c151b --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACGroupedSignal.h @@ -0,0 +1,19 @@ +// +// RACGroupedSignal.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 5/2/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import "RACSubject.h" + +/// A grouped signal is used by -[RACSignal groupBy:transform:]. +@interface RACGroupedSignal : RACSubject + +/// The key shared by the group. +@property (nonatomic, readonly, copy) id key; + ++ (instancetype)signalWithKey:(id)key; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACKVOChannel.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACKVOChannel.h new file mode 100644 index 0000000..ead15a4 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACKVOChannel.h @@ -0,0 +1,97 @@ +// +// RACKVOChannel.h +// ReactiveCocoa +// +// Created by Uri Baghin on 27/12/2012. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import "RACChannel.h" +#import "EXTKeyPathCoding.h" +#import "metamacros.h" + +/// Creates a RACKVOChannel to the given key path. When the targeted object +/// deallocates, the channel will complete. +/// +/// If RACChannelTo() is used as an expression, it returns a RACChannelTerminal that +/// can be used to watch the specified property for changes, and set new values +/// for it. The terminal will start with the property's current value upon +/// subscription. +/// +/// If RACChannelTo() is used on the left-hand side of an assignment, there must a +/// RACChannelTerminal on the right-hand side of the assignment. The two will be +/// subscribed to one another: the property's value is immediately set to the +/// value of the channel terminal on the right-hand side, and subsequent changes +/// to either terminal will be reflected on the other. +/// +/// There are two different versions of this macro: +/// +/// - RACChannelTo(TARGET, KEYPATH, NILVALUE) will create a channel to the `KEYPATH` +/// of `TARGET`. If the terminal is ever sent a `nil` value, the property will +/// be set to `NILVALUE` instead. `NILVALUE` may itself be `nil` for object +/// properties, but an NSValue should be used for primitive properties, to +/// avoid an exception if `nil` is sent (which might occur if an intermediate +/// object is set to `nil`). +/// - RACChannelTo(TARGET, KEYPATH) is the same as the above, but `NILVALUE` defaults to +/// `nil`. +/// +/// Examples +/// +/// RACChannelTerminal *integerChannel = RACChannelTo(self, integerProperty, @42); +/// +/// // Sets self.integerProperty to 5. +/// [integerChannel sendNext:@5]; +/// +/// // Logs the current value of self.integerProperty, and all future changes. +/// [integerChannel subscribeNext:^(id value) { +/// NSLog(@"value: %@", value); +/// }]; +/// +/// // Binds properties to each other, taking the initial value from the right +/// side. +/// RACChannelTo(view, objectProperty) = RACChannelTo(model, objectProperty); +/// RACChannelTo(view, integerProperty, @2) = RACChannelTo(model, integerProperty, @10); +#define RACChannelTo(TARGET, ...) \ + metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__)) \ + (RACChannelTo_(TARGET, __VA_ARGS__, nil)) \ + (RACChannelTo_(TARGET, __VA_ARGS__)) + +/// Do not use this directly. Use the RACChannelTo macro above. +#define RACChannelTo_(TARGET, KEYPATH, NILVALUE) \ + [[RACKVOChannel alloc] initWithTarget:(TARGET) keyPath:@keypath(TARGET, KEYPATH) nilValue:(NILVALUE)][@keypath(RACKVOChannel.new, followingTerminal)] + +/// A RACChannel that observes a KVO-compliant key path for changes. +@interface RACKVOChannel : RACChannel + +/// Initializes a channel that will observe the given object and key path. +/// +/// The current value of the key path, and future KVO notifications for the given +/// key path, will be sent to subscribers of the channel's `followingTerminal`. +/// Values sent to the `followingTerminal` will be set at the given key path using +/// key-value coding. +/// +/// When the target object deallocates, the channel will complete. Signal errors +/// are considered undefined behavior. +/// +/// This is the designated initializer for this class. +/// +/// target - The object to bind to. +/// keyPath - The key path to observe and set the value of. +/// nilValue - The value to set at the key path whenever a `nil` value is +/// received. This may be nil when connecting to object properties, but +/// an NSValue should be used for primitive properties, to avoid an +/// exception if `nil` is received (which might occur if an intermediate +/// object is set to `nil`). +- (id)initWithTarget:(__weak NSObject *)target keyPath:(NSString *)keyPath nilValue:(id)nilValue; + +- (id)init __attribute__((unavailable("Use -initWithTarget:keyPath:nilValue: instead"))); + +@end + +/// Methods needed for the convenience macro. Do not call explicitly. +@interface RACKVOChannel (RACChannelTo) + +- (RACChannelTerminal *)objectForKeyedSubscript:(NSString *)key; +- (void)setObject:(RACChannelTerminal *)otherTerminal forKeyedSubscript:(NSString *)key; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACMulticastConnection.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACMulticastConnection.h new file mode 100644 index 0000000..67beff6 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACMulticastConnection.h @@ -0,0 +1,48 @@ +// +// RACMulticastConnection.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 4/11/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import + +@class RACDisposable; +@class RACSignal; + +/// A multicast connection encapsulates the idea of sharing one subscription to a +/// signal to many subscribers. This is most often needed if the subscription to +/// the underlying signal involves side-effects or shouldn't be called more than +/// once. +/// +/// The multicasted signal is only subscribed to when +/// -[RACMulticastConnection connect] is called. Until that happens, no values +/// will be sent on `signal`. See -[RACMulticastConnection autoconnect] for how +/// -[RACMulticastConnection connect] can be called automatically. +/// +/// Note that you shouldn't create RACMulticastConnection manually. Instead use +/// -[RACSignal publish] or -[RACSignal multicast:]. +@interface RACMulticastConnection : NSObject + +/// The multicasted signal. +@property (nonatomic, strong, readonly) RACSignal *signal; + +/// Connect to the underlying signal by subscribing to it. Calling this multiple +/// times does nothing but return the existing connection's disposable. +/// +/// Returns the disposable for the subscription to the multicasted signal. +- (RACDisposable *)connect; + +/// Connects to the underlying signal when the returned signal is first +/// subscribed to, and disposes of the subscription to the multicasted signal +/// when the returned signal has no subscribers. +/// +/// If new subscribers show up after being disposed, they'll subscribe and then +/// be immediately disposed of. The returned signal will never re-connect to the +/// multicasted signal. +/// +/// Returns the autoconnecting signal. +- (RACSignal *)autoconnect; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACQueueScheduler+Subclass.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACQueueScheduler+Subclass.h new file mode 100644 index 0000000..b40f984 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACQueueScheduler+Subclass.h @@ -0,0 +1,35 @@ +// +// RACQueueScheduler+Subclass.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 6/6/13. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import "RACQueueScheduler.h" +#import "RACScheduler+Subclass.h" + +/// An interface for use by GCD queue-based subclasses. +/// +/// See RACScheduler+Subclass.h for subclassing notes. +@interface RACQueueScheduler () + +/// The queue on which blocks are enqueued. +@property (nonatomic, strong, readonly) dispatch_queue_t queue; + +/// Initializes the receiver with the name of the scheduler and the queue which +/// the scheduler should use. +/// +/// name - The name of the scheduler. If nil, a default name will be used. +/// queue - The queue upon which the receiver should enqueue scheduled blocks. +/// This argument must not be NULL. +/// +/// Returns the initialized object. +- (id)initWithName:(NSString *)name queue:(dispatch_queue_t)queue; + +/// Converts a date into a GCD time using dispatch_walltime(). +/// +/// date - The date to convert. This must not be nil. ++ (dispatch_time_t)wallTimeWithDate:(NSDate *)date; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACQueueScheduler.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACQueueScheduler.h new file mode 100644 index 0000000..ef42512 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACQueueScheduler.h @@ -0,0 +1,18 @@ +// +// RACQueueScheduler.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 11/30/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import "RACScheduler.h" + +/// An abstract scheduler which asynchronously enqueues all its work to a Grand +/// Central Dispatch queue. +/// +/// Because RACQueueScheduler is abstract, it should not be instantiated +/// directly. Create a subclass using the `RACQueueScheduler+Subclass.h` +/// interface and use that instead. +@interface RACQueueScheduler : RACScheduler +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACReplaySubject.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACReplaySubject.h new file mode 100644 index 0000000..3d429ea --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACReplaySubject.h @@ -0,0 +1,22 @@ +// +// RACReplaySubject.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 3/14/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import "RACSubject.h" + +extern const NSUInteger RACReplaySubjectUnlimitedCapacity; + +/// A replay subject saves the values it is sent (up to its defined capacity) +/// and resends those to new subscribers. It will also replay an error or +/// completion. +@interface RACReplaySubject : RACSubject + +/// Creates a new replay subject with the given capacity. A capacity of +/// RACReplaySubjectUnlimitedCapacity means values are never trimmed. ++ (instancetype)replaySubjectWithCapacity:(NSUInteger)capacity; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACScheduler+Subclass.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACScheduler+Subclass.h new file mode 100644 index 0000000..b6e8a9e --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACScheduler+Subclass.h @@ -0,0 +1,29 @@ +// +// RACScheduler.m +// ReactiveCocoa +// +// Created by MiÄ·elis Vindavs on 5/27/14. +// Copyright (c) 2014 GitHub, Inc. All rights reserved. +// + +#import +#import "RACScheduler.h" + +/// An interface for use by subclasses. +/// +/// Subclasses should use `-performAsCurrentScheduler:` to do the actual block +/// invocation so that +[RACScheduler currentScheduler] behaves as expected. +/// +/// **Note that RACSchedulers are expected to be serial**. Subclasses must honor +/// that contract. See `RACTargetQueueScheduler` for a queue-based scheduler +/// which will enforce the serialization guarantee. +@interface RACScheduler () + +/// Performs the given block with the receiver as the current scheduler for +/// its thread. This should only be called by subclasses to perform their +/// scheduled blocks. +/// +/// block - The block to execute. Cannot be NULL. +- (void)performAsCurrentScheduler:(void (^)(void))block; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACScheduler.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACScheduler.h new file mode 100644 index 0000000..bd1b536 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACScheduler.h @@ -0,0 +1,148 @@ +// +// RACScheduler.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 4/16/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import + +/// The priority for the scheduler. +/// +/// RACSchedulerPriorityHigh - High priority. +/// RACSchedulerPriorityDefault - Default priority. +/// RACSchedulerPriorityLow - Low priority. +/// RACSchedulerPriorityBackground - Background priority. +typedef enum : long { + RACSchedulerPriorityHigh = DISPATCH_QUEUE_PRIORITY_HIGH, + RACSchedulerPriorityDefault = DISPATCH_QUEUE_PRIORITY_DEFAULT, + RACSchedulerPriorityLow = DISPATCH_QUEUE_PRIORITY_LOW, + RACSchedulerPriorityBackground = DISPATCH_QUEUE_PRIORITY_BACKGROUND, +} RACSchedulerPriority; + +/// Scheduled with -scheduleRecursiveBlock:, this type of block is passed a block +/// with which it can call itself recursively. +typedef void (^RACSchedulerRecursiveBlock)(void (^reschedule)(void)); + +@class RACDisposable; + +/// Schedulers are used to control when and where work is performed. +@interface RACScheduler : NSObject + +/// A singleton scheduler that immediately executes the blocks it is given. +/// +/// **Note:** Unlike most other schedulers, this does not set the current +/// scheduler. There may still be a valid +currentScheduler if this is used +/// within a block scheduled on a different scheduler. ++ (RACScheduler *)immediateScheduler; + +/// A singleton scheduler that executes blocks in the main thread. ++ (RACScheduler *)mainThreadScheduler; + +/// Creates and returns a new background scheduler with the given priority and +/// name. The name is for debug and instrumentation purposes only. +/// +/// Scheduler creation is cheap. It's unnecessary to save the result of this +/// method call unless you want to serialize some actions on the same background +/// scheduler. ++ (RACScheduler *)schedulerWithPriority:(RACSchedulerPriority)priority name:(NSString *)name; + +/// Invokes +schedulerWithPriority:name: with a default name. ++ (RACScheduler *)schedulerWithPriority:(RACSchedulerPriority)priority; + +/// Invokes +schedulerWithPriority: with RACSchedulerPriorityDefault. ++ (RACScheduler *)scheduler; + +/// The current scheduler. This will only be valid when used from within a +/// -[RACScheduler schedule:] block or when on the main thread. ++ (RACScheduler *)currentScheduler; + +/// Schedule the given block for execution on the scheduler. +/// +/// Scheduled blocks will be executed in the order in which they were scheduled. +/// +/// block - The block to schedule for execution. Cannot be nil. +/// +/// Returns a disposable which can be used to cancel the scheduled block before +/// it begins executing, or nil if cancellation is not supported. +- (RACDisposable *)schedule:(void (^)(void))block; + +/// Schedule the given block for execution on the scheduler at or after +/// a specific time. +/// +/// Note that blocks scheduled for a certain time will not preempt any other +/// scheduled work that is executing at the time. +/// +/// When invoked on the +immediateScheduler, the calling thread **will block** +/// until the specified time. +/// +/// date - The earliest time at which `block` should begin executing. The block +/// may not execute immediately at this time, whether due to system load +/// or another block on the scheduler currently being run. Cannot be nil. +/// block - The block to schedule for execution. Cannot be nil. +/// +/// Returns a disposable which can be used to cancel the scheduled block before +/// it begins executing, or nil if cancellation is not supported. +- (RACDisposable *)after:(NSDate *)date schedule:(void (^)(void))block; + +/// Schedule the given block for execution on the scheduler after the delay. +/// +/// Converts the delay into an NSDate, then invokes `-after:schedule:`. +- (RACDisposable *)afterDelay:(NSTimeInterval)delay schedule:(void (^)(void))block; + +/// Reschedule the given block at a particular interval, starting at a specific +/// time, and with a given leeway for deferral. +/// +/// Note that blocks scheduled for a certain time will not preempt any other +/// scheduled work that is executing at the time. +/// +/// Regardless of the value of `leeway`, the given block may not execute exactly +/// at `when` or exactly on successive intervals, whether due to system load or +/// because another block is currently being run on the scheduler. +/// +/// It is considered undefined behavior to invoke this method on the +/// +immediateScheduler. +/// +/// date - The earliest time at which `block` should begin executing. The +/// block may not execute immediately at this time, whether due to +/// system load or another block on the scheduler currently being +/// run. Cannot be nil. +/// interval - The interval at which the block should be rescheduled, starting +/// from `date`. This will use the system wall clock, to avoid +/// skew when the computer goes to sleep. +/// leeway - A hint to the system indicating the number of seconds that each +/// scheduling can be deferred. Note that this is just a hint, and +/// there may be some additional latency no matter what. +/// block - The block to repeatedly schedule for execution. Cannot be nil. +/// +/// Returns a disposable which can be used to cancel the automatic scheduling and +/// rescheduling, or nil if cancellation is not supported. +- (RACDisposable *)after:(NSDate *)date repeatingEvery:(NSTimeInterval)interval withLeeway:(NSTimeInterval)leeway schedule:(void (^)(void))block; + +/// Schedule the given recursive block for execution on the scheduler. The +/// scheduler will automatically flatten any recursive scheduling into iteration +/// instead, so this can be used without issue for blocks that may keep invoking +/// themselves forever. +/// +/// Scheduled blocks will be executed in the order in which they were scheduled. +/// +/// recursiveBlock - The block to schedule for execution. When invoked, the +/// recursive block will be passed a `void (^)(void)` block +/// which will reschedule the recursive block at the end of the +/// receiver's queue. This passed-in block will automatically +/// skip scheduling if the scheduling of the `recursiveBlock` +/// was disposed in the meantime. +/// +/// Returns a disposable which can be used to cancel the scheduled block before +/// it begins executing, or to stop it from rescheduling if it's already begun +/// execution. +- (RACDisposable *)scheduleRecursiveBlock:(RACSchedulerRecursiveBlock)recursiveBlock; + +@end + +@interface RACScheduler (Deprecated) + ++ (RACScheduler *)schedulerWithQueue:(dispatch_queue_t)queue name:(NSString *)name __attribute__((deprecated("Use -[RACTargetQueueScheduler initWithName:targetQueue:] instead."))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACScopedDisposable.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACScopedDisposable.h new file mode 100644 index 0000000..69c4a12 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACScopedDisposable.h @@ -0,0 +1,18 @@ +// +// RACScopedDisposable.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 3/28/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import "RACDisposable.h" + +/// A disposable that calls its own -dispose when it is dealloc'd. +@interface RACScopedDisposable : RACDisposable + +/// Creates a new scoped disposable that will also dispose of the given +/// disposable when it is dealloc'd. ++ (instancetype)scopedDisposableWithDisposable:(RACDisposable *)disposable; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSequence.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSequence.h new file mode 100644 index 0000000..a39f840 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSequence.h @@ -0,0 +1,154 @@ +// +// RACSequence.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2012-10-29. +// Copyright (c) 2012 GitHub. All rights reserved. +// + +#import +#import "RACStream.h" + +@class RACScheduler; +@class RACSignal; + +/// Represents an immutable sequence of values. Unless otherwise specified, the +/// sequences' values are evaluated lazily on demand. Like Cocoa collections, +/// sequences cannot contain nil. +/// +/// Most inherited RACStream methods that accept a block will execute the block +/// _at most_ once for each value that is evaluated in the returned sequence. +/// Side effects are subject to the behavior described in +/// +sequenceWithHeadBlock:tailBlock:. +/// +/// Implemented as a class cluster. A minimal implementation for a subclass +/// consists simply of -head and -tail. +@interface RACSequence : RACStream + +/// The first object in the sequence, or nil if the sequence is empty. +/// +/// Subclasses must provide an implementation of this method. +@property (nonatomic, strong, readonly) id head; + +/// All but the first object in the sequence, or nil if the sequence is empty. +/// +/// Subclasses must provide an implementation of this method. +@property (nonatomic, strong, readonly) RACSequence *tail; + +/// Evaluates the full sequence to produce an equivalently-sized array. +@property (nonatomic, copy, readonly) NSArray *array; + +/// Returns an enumerator of all objects in the sequence. +@property (nonatomic, copy, readonly) NSEnumerator *objectEnumerator; + +/// Converts a sequence into an eager sequence. +/// +/// An eager sequence fully evaluates all of its values immediately. Sequences +/// derived from an eager sequence will also be eager. +/// +/// Returns a new eager sequence, or the receiver if the sequence is already +/// eager. +@property (nonatomic, copy, readonly) RACSequence *eagerSequence; + +/// Converts a sequence into a lazy sequence. +/// +/// A lazy sequence evaluates its values on demand, as they are accessed. +/// Sequences derived from a lazy sequence will also be lazy. +/// +/// Returns a new lazy sequence, or the receiver if the sequence is already lazy. +@property (nonatomic, copy, readonly) RACSequence *lazySequence; + +/// Invokes -signalWithScheduler: with a new RACScheduler. +- (RACSignal *)signal; + +/// Evaluates the full sequence on the given scheduler. +/// +/// Each item is evaluated in its own scheduled block, such that control of the +/// scheduler is yielded between each value. +/// +/// Returns a signal which sends the receiver's values on the given scheduler as +/// they're evaluated. +- (RACSignal *)signalWithScheduler:(RACScheduler *)scheduler; + +/// Applies a left fold to the sequence. +/// +/// This is the same as iterating the sequence along with a provided start value. +/// This uses a constant amount of memory. A left fold is left-associative so in +/// the sequence [1,2,3] the block would applied in the following order: +/// reduce(reduce(reduce(start, 1), 2), 3) +/// +/// start - The starting value for the fold. Used as `accumulator` for the +/// first fold. +/// reduce - The block used to combine the accumulated value and the next value. +/// Cannot be nil. +/// +/// Returns a reduced value. +- (id)foldLeftWithStart:(id)start reduce:(id (^)(id accumulator, id value))reduce; + +/// Applies a right fold to the sequence. +/// +/// A right fold is equivalent to recursion on the list. The block is evaluated +/// from the right to the left in list. It is right associative so it's applied +/// to the rightmost elements first. For example, in the sequence [1,2,3] the +/// block is applied in the order: +/// reduce(1, reduce(2, reduce(3, start))) +/// +/// start - The starting value for the fold. +/// reduce - The block used to combine the accumulated value and the next head. +/// The block is given the accumulated value and the value of the rest +/// of the computation (result of the recursion). This is computed when +/// you retrieve its value using `rest.head`. This allows you to +/// prevent unnecessary computation by not accessing `rest.head` if you +/// don't need to. +/// +/// Returns a reduced value. +- (id)foldRightWithStart:(id)start reduce:(id (^)(id first, RACSequence *rest))reduce; + +/// Check if any value in sequence passes the block. +/// +/// block - The block predicate used to check each item. Cannot be nil. +/// +/// Returns a boolean indiciating if any value in the sequence passed. +- (BOOL)any:(BOOL (^)(id value))block; + +/// Check if all values in the sequence pass the block. +/// +/// block - The block predicate used to check each item. Cannot be nil. +/// +/// Returns a boolean indicating if all values in the sequence passed. +- (BOOL)all:(BOOL (^)(id value))block; + +/// Returns the first object that passes the block. +/// +/// block - The block predicate used to check each item. Cannot be nil. +/// +/// Returns an object that passes the block or nil if no objects passed. +- (id)objectPassingTest:(BOOL (^)(id value))block; + +/// Creates a sequence that dynamically generates its values. +/// +/// headBlock - Invoked the first time -head is accessed. +/// tailBlock - Invoked the first time -tail is accessed. +/// +/// The results from each block are memoized, so each block will be invoked at +/// most once, no matter how many times the head and tail properties of the +/// sequence are accessed. +/// +/// Any side effects in `headBlock` or `tailBlock` should be thread-safe, since +/// the sequence may be evaluated at any time from any thread. Not only that, but +/// -tail may be accessed before -head, or both may be accessed simultaneously. +/// As noted above, side effects will only be triggered the _first_ time -head or +/// -tail is invoked. +/// +/// Returns a sequence that lazily invokes the given blocks to provide head and +/// tail. `headBlock` must not be nil. ++ (RACSequence *)sequenceWithHeadBlock:(id (^)(void))headBlock tailBlock:(RACSequence *(^)(void))tailBlock; + +@end + +@interface RACSequence (Deprecated) + +- (id)foldLeftWithStart:(id)start combine:(id (^)(id accumulator, id value))combine __attribute__((deprecated("Renamed to -foldLeftWithStart:reduce:"))); +- (id)foldRightWithStart:(id)start combine:(id (^)(id first, RACSequence *rest))combine __attribute__((deprecated("Renamed to -foldRightWithStart:reduce:"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSerialDisposable.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSerialDisposable.h new file mode 100644 index 0000000..a3fc1d4 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSerialDisposable.h @@ -0,0 +1,43 @@ +// +// RACSerialDisposable.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2013-07-22. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import "RACDisposable.h" + +/// A disposable that contains exactly one other disposable and allows it to be +/// swapped out atomically. +@interface RACSerialDisposable : RACDisposable + +/// The inner disposable managed by the serial disposable. +/// +/// This property is thread-safe for reading and writing. However, if you want to +/// read the current value _and_ write a new one atomically, use +/// -swapInDisposable: instead. +/// +/// Disposing of the receiver will also dispose of the current disposable set for +/// this property, then set the property to nil. If any new disposable is set +/// after the receiver is disposed, it will be disposed immediately and this +/// property will remain set to nil. +@property (atomic, strong) RACDisposable *disposable; + +/// Creates a serial disposable which will wrap the given disposable. +/// +/// disposable - The value to set for `disposable`. This may be nil. +/// +/// Returns a RACSerialDisposable, or nil if an error occurs. ++ (instancetype)serialDisposableWithDisposable:(RACDisposable *)disposable; + +/// Atomically swaps the receiver's `disposable` for `newDisposable`. +/// +/// newDisposable - The new value for `disposable`. If the receiver has already +/// been disposed, this disposable will be too, and `disposable` +/// will remain set to nil. This argument may be nil. +/// +/// Returns the previous value for the `disposable` property. +- (RACDisposable *)swapInDisposable:(RACDisposable *)newDisposable; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSignal+Operations.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSignal+Operations.h new file mode 100644 index 0000000..07d395e --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSignal+Operations.h @@ -0,0 +1,709 @@ +// +// RACSignal+Operations.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2012-09-06. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import +#import "RACSignal.h" + +/// The domain for errors originating in RACSignal operations. +extern NSString * const RACSignalErrorDomain; + +/// The error code used with -timeout:. +extern const NSInteger RACSignalErrorTimedOut; + +/// The error code used when a value passed into +switch:cases:default: does not +/// match any of the cases, and no default was given. +extern const NSInteger RACSignalErrorNoMatchingCase; + +@class RACCommand; +@class RACDisposable; +@class RACMulticastConnection; +@class RACScheduler; +@class RACSequence; +@class RACSubject; +@class RACTuple; +@protocol RACSubscriber; + +@interface RACSignal (Operations) + +/// Do the given block on `next`. This should be used to inject side effects into +/// the signal. +- (RACSignal *)doNext:(void (^)(id x))block; + +/// Do the given block on `error`. This should be used to inject side effects +/// into the signal. +- (RACSignal *)doError:(void (^)(NSError *error))block; + +/// Do the given block on `completed`. This should be used to inject side effects +/// into the signal. +- (RACSignal *)doCompleted:(void (^)(void))block; + +/// Sends `next`s only if we don't receive another `next` in `interval` seconds. +/// +/// If a `next` is received, and then another `next` is received before +/// `interval` seconds have passed, the first value is discarded. +/// +/// After `interval` seconds have passed since the most recent `next` was sent, +/// the most recent `next` is forwarded on the scheduler that the value was +/// originally received on. If +[RACScheduler currentScheduler] was nil at the +/// time, a private background scheduler is used. +/// +/// Returns a signal which sends throttled and delayed `next` events. Completion +/// and errors are always forwarded immediately. +- (RACSignal *)throttle:(NSTimeInterval)interval; + +/// Throttles `next`s for which `predicate` returns YES. +/// +/// When `predicate` returns YES for a `next`: +/// +/// 1. If another `next` is received before `interval` seconds have passed, the +/// prior value is discarded. This happens regardless of whether the new +/// value will be throttled. +/// 2. After `interval` seconds have passed since the value was originally +/// received, it will be forwarded on the scheduler that it was received +/// upon. If +[RACScheduler currentScheduler] was nil at the time, a private +/// background scheduler is used. +/// +/// When `predicate` returns NO for a `next`, it is forwarded immediately, +/// without any throttling. +/// +/// interval - The number of seconds for which to buffer the latest value that +/// passes `predicate`. +/// predicate - Passed each `next` from the receiver, this block returns +/// whether the given value should be throttled. This argument must +/// not be nil. +/// +/// Returns a signal which sends `next` events, throttled when `predicate` +/// returns YES. Completion and errors are always forwarded immediately. +- (RACSignal *)throttle:(NSTimeInterval)interval valuesPassingTest:(BOOL (^)(id next))predicate; + +/// Forwards `next` and `completed` events after delaying for `interval` seconds +/// on the current scheduler (on which the events were delivered). +/// +/// If +[RACScheduler currentScheduler] is nil when `next` or `completed` is +/// received, a private background scheduler is used. +/// +/// Returns a signal which sends delayed `next` and `completed` events. Errors +/// are always forwarded immediately. +- (RACSignal *)delay:(NSTimeInterval)interval; + +/// Resubscribes when the signal completes. +- (RACSignal *)repeat; + +/// Executes the given block each time a subscription is created. +/// +/// block - A block which defines the subscription side effects. Cannot be `nil`. +/// +/// Example: +/// +/// // Write new file, with backup. +/// [[[[fileManager +/// rac_createFileAtPath:path contents:data] +/// initially:^{ +/// // 2. Second, backup current file +/// [fileManager moveItemAtPath:path toPath:backupPath error:nil]; +/// }] +/// initially:^{ +/// // 1. First, acquire write lock. +/// [writeLock lock]; +/// }] +/// finally:^{ +/// [writeLock unlock]; +/// }]; +/// +/// Returns a signal that passes through all events of the receiver, plus +/// introduces side effects which occur prior to any subscription side effects +/// of the receiver. +- (RACSignal *)initially:(void (^)(void))block; + +/// Executes the given block when the signal completes or errors. +- (RACSignal *)finally:(void (^)(void))block; + +/// Divides the receiver's `next`s into buffers which deliver every `interval` +/// seconds. +/// +/// interval - The interval in which values are grouped into one buffer. +/// scheduler - The scheduler upon which the returned signal will deliver its +/// values. This must not be nil or +[RACScheduler +/// immediateScheduler]. +/// +/// Returns a signal which sends RACTuples of the buffered values at each +/// interval on `scheduler`. When the receiver completes, any currently-buffered +/// values will be sent immediately. +- (RACSignal *)bufferWithTime:(NSTimeInterval)interval onScheduler:(RACScheduler *)scheduler; + +/// Collects all receiver's `next`s into a NSArray. Nil values will be converted +/// to NSNull. +/// +/// This corresponds to the `ToArray` method in Rx. +/// +/// Returns a signal which sends a single NSArray when the receiver completes +/// successfully. +- (RACSignal *)collect; + +/// Takes the last `count` `next`s after the receiving signal completes. +- (RACSignal *)takeLast:(NSUInteger)count; + +/// Combines the latest values from the receiver and the given signal into +/// RACTuples, once both have sent at least one `next`. +/// +/// Any additional `next`s will result in a new RACTuple with the latest values +/// from both signals. +/// +/// signal - The signal to combine with. This argument must not be nil. +/// +/// Returns a signal which sends RACTuples of the combined values, forwards any +/// `error` events, and completes when both input signals complete. +- (RACSignal *)combineLatestWith:(RACSignal *)signal; + +/// Combines the latest values from the given signals into RACTuples, once all +/// the signals have sent at least one `next`. +/// +/// Any additional `next`s will result in a new RACTuple with the latest values +/// from all signals. +/// +/// signals - The signals to combine. If this collection is empty, the returned +/// signal will immediately complete upon subscription. +/// +/// Returns a signal which sends RACTuples of the combined values, forwards any +/// `error` events, and completes when all input signals complete. ++ (RACSignal *)combineLatest:(id)signals; + +/// Combines signals using +combineLatest:, then reduces the resulting tuples +/// into a single value using -reduceEach:. +/// +/// signals - The signals to combine. If this collection is empty, the +/// returned signal will immediately complete upon subscription. +/// reduceBlock - The block which reduces the latest values from all the +/// signals into one value. It must take as many arguments as the +/// number of signals given. Each argument will be an object +/// argument. The return value must be an object. This argument +/// must not be nil. +/// +/// Example: +/// +/// [RACSignal combineLatest:@[ stringSignal, intSignal ] reduce:^(NSString *string, NSNumber *number) { +/// return [NSString stringWithFormat:@"%@: %@", string, number]; +/// }]; +/// +/// Returns a signal which sends the results from each invocation of +/// `reduceBlock`. ++ (RACSignal *)combineLatest:(id)signals reduce:(id (^)())reduceBlock; + +/// Merges the receiver and the given signal with `+merge:` and returns the +/// resulting signal. +- (RACSignal *)merge:(RACSignal *)signal; + +/// Sends the latest `next` from any of the signals. +/// +/// Returns a signal that passes through values from each of the given signals, +/// and sends `completed` when all of them complete. If any signal sends an error, +/// the returned signal sends `error` immediately. ++ (RACSignal *)merge:(id)signals; + +/// Merges the signals sent by the receiver into a flattened signal, but only +/// subscribes to `maxConcurrent` number of signals at a time. New signals are +/// queued and subscribed to as other signals complete. +/// +/// If an error occurs on any of the signals, it is sent on the returned signal. +/// It completes only after the receiver and all sent signals have completed. +/// +/// This corresponds to `Merge(IObservable>, Int32)` +/// in Rx. +/// +/// maxConcurrent - the maximum number of signals to subscribe to at a +/// time. If 0, it subscribes to an unlimited number of +/// signals. +- (RACSignal *)flatten:(NSUInteger)maxConcurrent; + +/// Ignores all `next`s from the receiver, waits for the receiver to complete, +/// then subscribes to a new signal. +/// +/// block - A block which will create or obtain a new signal to subscribe to, +/// executed only after the receiver completes. This block must not be +/// nil, and it must not return a nil signal. +/// +/// Returns a signal which will pass through the events of the signal created in +/// `block`. If the receiver errors out, the returned signal will error as well. +- (RACSignal *)then:(RACSignal * (^)(void))block; + +/// Concats the inner signals of a signal of signals. +- (RACSignal *)concat; + +/// Aggregates the `next` values of the receiver into a single combined value. +/// +/// The algorithm proceeds as follows: +/// +/// 1. `start` is passed into the block as the `running` value, and the first +/// element of the receiver is passed into the block as the `next` value. +/// 2. The result of the invocation (`running`) and the next element of the +/// receiver (`next`) is passed into `reduceBlock`. +/// 3. Steps 2 and 3 are repeated until all values have been processed. +/// 4. The last result of `reduceBlock` is sent on the returned signal. +/// +/// This method is similar to -scanWithStart:reduce:, except that only the +/// final result is sent on the returned signal. +/// +/// start - The value to be combined with the first element of the +/// receiver. This value may be `nil`. +/// reduceBlock - The block that describes how to combine values of the +/// receiver. If the receiver is empty, this block will never be +/// invoked. Cannot be nil. +/// +/// Returns a signal that will send the aggregated value when the receiver +/// completes, then itself complete. If the receiver never sends any values, +/// `start` will be sent instead. +- (RACSignal *)aggregateWithStart:(id)start reduce:(id (^)(id running, id next))reduceBlock; + +/// Aggregates the `next` values of the receiver into a single combined value. +/// This is indexed version of -aggregateWithStart:reduce:. +/// +/// start - The value to be combined with the first element of the +/// receiver. This value may be `nil`. +/// reduceBlock - The block that describes how to combine values of the +/// receiver. This block takes zero-based index value as the last +/// parameter. If the receiver is empty, this block will never be +/// invoked. Cannot be nil. +/// +/// Returns a signal that will send the aggregated value when the receiver +/// completes, then itself complete. If the receiver never sends any values, +/// `start` will be sent instead. +- (RACSignal *)aggregateWithStart:(id)start reduceWithIndex:(id (^)(id running, id next, NSUInteger index))reduceBlock; + +/// Aggregates the `next` values of the receiver into a single combined value. +/// +/// This invokes `startFactory` block on each subscription, then calls +/// -aggregateWithStart:reduce: with the return value of the block as start value. +/// +/// startFactory - The block that returns start value which will be combined +/// with the first element of the receiver. Cannot be nil. +/// reduceBlock - The block that describes how to combine values of the +/// receiver. If the receiver is empty, this block will never be +/// invoked. Cannot be nil. +/// +/// Returns a signal that will send the aggregated value when the receiver +/// completes, then itself complete. If the receiver never sends any values, +/// the return value of `startFactory` will be sent instead. +- (RACSignal *)aggregateWithStartFactory:(id (^)(void))startFactory reduce:(id (^)(id running, id next))reduceBlock; + +/// Invokes -setKeyPath:onObject:nilValue: with `nil` for the nil value. +/// +/// WARNING: Under certain conditions, this method is known to be thread-unsafe. +/// See the description in -setKeyPath:onObject:nilValue:. +- (RACDisposable *)setKeyPath:(NSString *)keyPath onObject:(NSObject *)object; + +/// Binds the receiver to an object, automatically setting the given key path on +/// every `next`. When the signal completes, the binding is automatically +/// disposed of. +/// +/// WARNING: Under certain conditions, this method is known to be thread-unsafe. +/// A crash can result if `object` is deallocated concurrently on +/// another thread within a window of time between a value being sent +/// on this signal and immediately prior to the invocation of +/// -setValue:forKeyPath:, which sets the property. To prevent this, +/// ensure `object` is deallocated on the same thread the receiver +/// sends on, or ensure that the returned disposable is disposed of +/// before `object` deallocates. +/// See https://github.com/ReactiveCocoa/ReactiveCocoa/pull/1184 +/// +/// Sending an error on the signal is considered undefined behavior, and will +/// generate an assertion failure in Debug builds. +/// +/// A given key on an object should only have one active signal bound to it at any +/// given time. Binding more than one signal to the same property is considered +/// undefined behavior. +/// +/// keyPath - The key path to update with `next`s from the receiver. +/// object - The object that `keyPath` is relative to. +/// nilValue - The value to set at the key path whenever `nil` is sent by the +/// receiver. This may be nil when binding to object properties, but +/// an NSValue should be used for primitive properties, to avoid an +/// exception if `nil` is sent (which might occur if an intermediate +/// object is set to `nil`). +/// +/// Returns a disposable which can be used to terminate the binding. +- (RACDisposable *)setKeyPath:(NSString *)keyPath onObject:(NSObject *)object nilValue:(id)nilValue; + +/// Sends NSDate.date every `interval` seconds. +/// +/// interval - The time interval in seconds at which the current time is sent. +/// scheduler - The scheduler upon which the current NSDate should be sent. This +/// must not be nil or +[RACScheduler immediateScheduler]. +/// +/// Returns a signal that sends the current date/time every `interval` on +/// `scheduler`. ++ (RACSignal *)interval:(NSTimeInterval)interval onScheduler:(RACScheduler *)scheduler; + +/// Sends NSDate.date at intervals of at least `interval` seconds, up to +/// approximately `interval` + `leeway` seconds. +/// +/// The created signal will defer sending each `next` for at least `interval` +/// seconds, and for an additional amount of time up to `leeway` seconds in the +/// interest of performance or power consumption. Note that some additional +/// latency is to be expected, even when specifying a `leeway` of 0. +/// +/// interval - The base interval between `next`s. +/// scheduler - The scheduler upon which the current NSDate should be sent. This +/// must not be nil or +[RACScheduler immediateScheduler]. +/// leeway - The maximum amount of additional time the `next` can be deferred. +/// +/// Returns a signal that sends the current date/time at intervals of at least +/// `interval seconds` up to approximately `interval` + `leeway` seconds on +/// `scheduler`. ++ (RACSignal *)interval:(NSTimeInterval)interval onScheduler:(RACScheduler *)scheduler withLeeway:(NSTimeInterval)leeway; + +/// Takes `next`s until the `signalTrigger` sends `next` or `completed`. +/// +/// Returns a signal which passes through all events from the receiver until +/// `signalTrigger` sends `next` or `completed`, at which point the returned signal +/// will send `completed`. +- (RACSignal *)takeUntil:(RACSignal *)signalTrigger; + +/// Takes `next`s until the `replacement` sends an event. +/// +/// replacement - The signal which replaces the receiver as soon as it sends an +/// event. +/// +/// Returns a signal which passes through `next`s and `error` from the receiver +/// until `replacement` sends an event, at which point the returned signal will +/// send that event and switch to passing through events from `replacement` +/// instead, regardless of whether the receiver has sent events already. +- (RACSignal *)takeUntilReplacement:(RACSignal *)replacement; + +/// Subscribes to the returned signal when an error occurs. +- (RACSignal *)catch:(RACSignal * (^)(NSError *error))catchBlock; + +/// Subscribes to the given signal when an error occurs. +- (RACSignal *)catchTo:(RACSignal *)signal; + +/// Runs `tryBlock` against each of the receiver's values, passing values +/// until `tryBlock` returns NO, or the receiver completes. +/// +/// tryBlock - An action to run against each of the receiver's values. +/// The block should return YES to indicate that the action was +/// successful. This block must not be nil. +/// +/// Example: +/// +/// // The returned signal will send an error if data values cannot be +/// // written to `someFileURL`. +/// [signal try:^(NSData *data, NSError **errorPtr) { +/// return [data writeToURL:someFileURL options:NSDataWritingAtomic error:errorPtr]; +/// }]; +/// +/// Returns a signal which passes through all the values of the receiver. If +/// `tryBlock` fails for any value, the returned signal will error using the +/// `NSError` passed out from the block. +- (RACSignal *)try:(BOOL (^)(id value, NSError **errorPtr))tryBlock; + +/// Runs `mapBlock` against each of the receiver's values, mapping values until +/// `mapBlock` returns nil, or the receiver completes. +/// +/// mapBlock - An action to map each of the receiver's values. The block should +/// return a non-nil value to indicate that the action was successful. +/// This block must not be nil. +/// +/// Example: +/// +/// // The returned signal will send an error if data cannot be read from +/// // `fileURL`. +/// [signal tryMap:^(NSURL *fileURL, NSError **errorPtr) { +/// return [NSData dataWithContentsOfURL:fileURL options:0 error:errorPtr]; +/// }]; +/// +/// Returns a signal which transforms all the values of the receiver. If +/// `mapBlock` returns nil for any value, the returned signal will error using +/// the `NSError` passed out from the block. +- (RACSignal *)tryMap:(id (^)(id value, NSError **errorPtr))mapBlock; + +/// Returns the first `next`. Note that this is a blocking call. +- (id)first; + +/// Returns the first `next` or `defaultValue` if the signal completes or errors +/// without sending a `next`. Note that this is a blocking call. +- (id)firstOrDefault:(id)defaultValue; + +/// Returns the first `next` or `defaultValue` if the signal completes or errors +/// without sending a `next`. If an error occurs success will be NO and error +/// will be populated. Note that this is a blocking call. +/// +/// Both success and error may be NULL. +- (id)firstOrDefault:(id)defaultValue success:(BOOL *)success error:(NSError **)error; + +/// Blocks the caller and waits for the signal to complete. +/// +/// error - If not NULL, set to any error that occurs. +/// +/// Returns whether the signal completed successfully. If NO, `error` will be set +/// to the error that occurred. +- (BOOL)waitUntilCompleted:(NSError **)error; + +/// Defers creation of a signal until the signal's actually subscribed to. +/// +/// This can be used to effectively turn a hot signal into a cold signal. ++ (RACSignal *)defer:(RACSignal * (^)(void))block; + +/// Every time the receiver sends a new RACSignal, subscribes and sends `next`s and +/// `error`s only for that signal. +/// +/// The receiver must be a signal of signals. +/// +/// Returns a signal which passes through `next`s and `error`s from the latest +/// signal sent by the receiver, and sends `completed` when both the receiver and +/// the last sent signal complete. +- (RACSignal *)switchToLatest; + +/// Switches between the signals in `cases` as well as `defaultSignal` based on +/// the latest value sent by `signal`. +/// +/// signal - A signal of objects used as keys in the `cases` dictionary. +/// This argument must not be nil. +/// cases - A dictionary that has signals as values. This argument must +/// not be nil. A RACTupleNil key in this dictionary will match +/// nil `next` events that are received on `signal`. +/// defaultSignal - The signal to pass through after `signal` sends a value for +/// which `cases` does not contain a signal. If nil, any +/// unmatched values will result in +/// a RACSignalErrorNoMatchingCase error. +/// +/// Returns a signal which passes through `next`s and `error`s from one of the +/// the signals in `cases` or `defaultSignal`, and sends `completed` when both +/// `signal` and the last used signal complete. If no `defaultSignal` is given, +/// an unmatched `next` will result in an error on the returned signal. ++ (RACSignal *)switch:(RACSignal *)signal cases:(NSDictionary *)cases default:(RACSignal *)defaultSignal; + +/// Switches between `trueSignal` and `falseSignal` based on the latest value +/// sent by `boolSignal`. +/// +/// boolSignal - A signal of BOOLs determining whether `trueSignal` or +/// `falseSignal` should be active. This argument must not be nil. +/// trueSignal - The signal to pass through after `boolSignal` has sent YES. +/// This argument must not be nil. +/// falseSignal - The signal to pass through after `boolSignal` has sent NO. This +/// argument must not be nil. +/// +/// Returns a signal which passes through `next`s and `error`s from `trueSignal` +/// and/or `falseSignal`, and sends `completed` when both `boolSignal` and the +/// last switched signal complete. ++ (RACSignal *)if:(RACSignal *)boolSignal then:(RACSignal *)trueSignal else:(RACSignal *)falseSignal; + +/// Adds every `next` to an array. Nils are represented by NSNulls. Note that +/// this is a blocking call. +/// +/// **This is not the same as the `ToArray` method in Rx.** See -collect for +/// that behavior instead. +/// +/// Returns the array of `next` values, or nil if an error occurs. +- (NSArray *)toArray; + +/// Adds every `next` to a sequence. Nils are represented by NSNulls. +/// +/// This corresponds to the `ToEnumerable` method in Rx. +/// +/// Returns a sequence which provides values from the signal as they're sent. +/// Trying to retrieve a value from the sequence which has not yet been sent will +/// block. +@property (nonatomic, strong, readonly) RACSequence *sequence; + +/// Creates and returns a multicast connection. This allows you to share a single +/// subscription to the underlying signal. +- (RACMulticastConnection *)publish; + +/// Creates and returns a multicast connection that pushes values into the given +/// subject. This allows you to share a single subscription to the underlying +/// signal. +- (RACMulticastConnection *)multicast:(RACSubject *)subject; + +/// Multicasts the signal to a RACReplaySubject of unlimited capacity, and +/// immediately connects to the resulting RACMulticastConnection. +/// +/// Returns the connected, multicasted signal. +- (RACSignal *)replay; + +/// Multicasts the signal to a RACReplaySubject of capacity 1, and immediately +/// connects to the resulting RACMulticastConnection. +/// +/// Returns the connected, multicasted signal. +- (RACSignal *)replayLast; + +/// Multicasts the signal to a RACReplaySubject of unlimited capacity, and +/// lazily connects to the resulting RACMulticastConnection. +/// +/// This means the returned signal will subscribe to the multicasted signal only +/// when the former receives its first subscription. +/// +/// Returns the lazily connected, multicasted signal. +- (RACSignal *)replayLazily; + +/// Sends an error after `interval` seconds if the source doesn't complete +/// before then. +/// +/// The error will be in the RACSignalErrorDomain and have a code of +/// RACSignalErrorTimedOut. +/// +/// interval - The number of seconds after which the signal should error out. +/// scheduler - The scheduler upon which any timeout error should be sent. This +/// must not be nil or +[RACScheduler immediateScheduler]. +/// +/// Returns a signal that passes through the receiver's events, until the stream +/// finishes or times out, at which point an error will be sent on `scheduler`. +- (RACSignal *)timeout:(NSTimeInterval)interval onScheduler:(RACScheduler *)scheduler; + +/// Creates and returns a signal that delivers its events on the given scheduler. +/// Any side effects of the receiver will still be performed on the original +/// thread. +/// +/// This is ideal when the signal already performs its work on the desired +/// thread, but you want to handle its events elsewhere. +/// +/// This corresponds to the `ObserveOn` method in Rx. +- (RACSignal *)deliverOn:(RACScheduler *)scheduler; + +/// Creates and returns a signal that executes its side effects and delivers its +/// events on the given scheduler. +/// +/// Use of this operator should be avoided whenever possible, because the +/// receiver's side effects may not be safe to run on another thread. If you just +/// want to receive the signal's events on `scheduler`, use -deliverOn: instead. +- (RACSignal *)subscribeOn:(RACScheduler *)scheduler; + +/// Creates and returns a signal that delivers its events on the main thread. +/// If events are already being sent on the main thread, they may be passed on +/// without delay. An event will instead be queued for later delivery on the main +/// thread if sent on another thread, or if a previous event is already being +/// processed, or has been queued. +/// +/// Any side effects of the receiver will still be performed on the original +/// thread. +/// +/// This can be used when a signal will cause UI updates, to avoid potential +/// flicker caused by delayed delivery of events, such as the first event from +/// a RACObserve at view instantiation. +- (RACSignal *)deliverOnMainThread; + +/// Groups each received object into a group, as determined by calling `keyBlock` +/// with that object. The object sent is transformed by calling `transformBlock` +/// with the object. If `transformBlock` is nil, it sends the original object. +/// +/// The returned signal is a signal of RACGroupedSignal. +- (RACSignal *)groupBy:(id (^)(id object))keyBlock transform:(id (^)(id object))transformBlock; + +/// Calls -[RACSignal groupBy:keyBlock transform:nil]. +- (RACSignal *)groupBy:(id (^)(id object))keyBlock; + +/// Sends an [NSNumber numberWithBool:YES] if the receiving signal sends any +/// objects. +- (RACSignal *)any; + +/// Sends an [NSNumber numberWithBool:YES] if the receiving signal sends any +/// objects that pass `predicateBlock`. +/// +/// predicateBlock - cannot be nil. +- (RACSignal *)any:(BOOL (^)(id object))predicateBlock; + +/// Sends an [NSNumber numberWithBool:YES] if all the objects the receiving +/// signal sends pass `predicateBlock`. +/// +/// predicateBlock - cannot be nil. +- (RACSignal *)all:(BOOL (^)(id object))predicateBlock; + +/// Resubscribes to the receiving signal if an error occurs, up until it has +/// retried the given number of times. +/// +/// retryCount - if 0, it keeps retrying until it completes. +- (RACSignal *)retry:(NSInteger)retryCount; + +/// Resubscribes to the receiving signal if an error occurs. +- (RACSignal *)retry; + +/// Sends the latest value from the receiver only when `sampler` sends a value. +/// The returned signal could repeat values if `sampler` fires more often than +/// the receiver. Values from `sampler` are ignored before the receiver sends +/// its first value. +/// +/// sampler - The signal that controls when the latest value from the receiver +/// is sent. Cannot be nil. +- (RACSignal *)sample:(RACSignal *)sampler; + +/// Ignores all `next`s from the receiver. +/// +/// Returns a signal which only passes through `error` or `completed` events from +/// the receiver. +- (RACSignal *)ignoreValues; + +/// Converts each of the receiver's events into a RACEvent object. +/// +/// Returns a signal which sends the receiver's events as RACEvents, and +/// completes after the receiver sends `completed` or `error`. +- (RACSignal *)materialize; + +/// Converts each RACEvent in the receiver back into "real" RACSignal events. +/// +/// Returns a signal which sends `next` for each value RACEvent, `error` for each +/// error RACEvent, and `completed` for each completed RACEvent. +- (RACSignal *)dematerialize; + +/// Inverts each NSNumber-wrapped BOOL sent by the receiver. It will assert if +/// the receiver sends anything other than NSNumbers. +/// +/// Returns a signal of inverted NSNumber-wrapped BOOLs. +- (RACSignal *)not; + +/// Performs a boolean AND on all of the RACTuple of NSNumbers in sent by the receiver. +/// +/// Asserts if the receiver sends anything other than a RACTuple of one or more NSNumbers. +/// +/// Returns a signal that applies AND to each NSNumber in the tuple. +- (RACSignal *)and; + +/// Performs a boolean OR on all of the RACTuple of NSNumbers in sent by the receiver. +/// +/// Asserts if the receiver sends anything other than a RACTuple of one or more NSNumbers. +/// +/// Returns a signal that applies OR to each NSNumber in the tuple. +- (RACSignal *)or; + +/// Sends the result of calling the block with arguments as packed in each RACTuple +/// sent by the receiver. +/// +/// The receiver must send tuple values, where the first element of the tuple is +/// a block, taking a number of parameters equal to the count of the remaining +/// elements of the tuple, and returning an object. Each block must take at least +/// one argument, so each tuple must contain at least 2 elements. +/// +/// Example: +/// +/// RACSignal *adder = [RACSignal return:^(NSNumber *a, NSNumber *b) { +/// return @(a.intValue + b.intValue); +/// }]; +/// RACSignal *sums = [[RACSignal +/// combineLatest:@[ adder, as, bs ]] +/// reduceApply]; +/// +/// Returns a signal of the result of applying the first element of each tuple +/// to the remaining elements. +- (RACSignal *)reduceApply; + +@end + +@interface RACSignal (OperationsDeprecated) + +- (RACSignal *)windowWithStart:(RACSignal *)openSignal close:(RACSignal * (^)(RACSignal *start))closeBlock __attribute__((deprecated("See https://github.com/ReactiveCocoa/ReactiveCocoa/issues/587"))); +- (RACSignal *)buffer:(NSUInteger)bufferCount __attribute__((deprecated("See https://github.com/ReactiveCocoa/ReactiveCocoa/issues/587"))); +- (RACSignal *)let:(RACSignal * (^)(RACSignal *sharedSignal))letBlock __attribute__((deprecated("Use -publish instead"))); ++ (RACSignal *)interval:(NSTimeInterval)interval __attribute__((deprecated("Use +interval:onScheduler: instead"))); ++ (RACSignal *)interval:(NSTimeInterval)interval withLeeway:(NSTimeInterval)leeway __attribute__((deprecated("Use +interval:onScheduler:withLeeway: instead"))); +- (RACSignal *)bufferWithTime:(NSTimeInterval)interval __attribute__((deprecated("Use -bufferWithTime:onScheduler: instead"))); +- (RACSignal *)timeout:(NSTimeInterval)interval __attribute__((deprecated("Use -timeout:onScheduler: instead"))); +- (RACDisposable *)toProperty:(NSString *)keyPath onObject:(NSObject *)object __attribute__((deprecated("Renamed to -setKeyPath:onObject:"))); +- (RACSignal *)ignoreElements __attribute__((deprecated("Renamed to -ignoreValues"))); +- (RACSignal *)sequenceNext:(RACSignal * (^)(void))block __attribute__((deprecated("Renamed to -then:"))); +- (RACSignal *)aggregateWithStart:(id)start combine:(id (^)(id running, id next))combineBlock __attribute__((deprecated("Renamed to -aggregateWithStart:reduce:"))); +- (RACSignal *)aggregateWithStartFactory:(id (^)(void))startFactory combine:(id (^)(id running, id next))combineBlock __attribute__((deprecated("Renamed to -aggregateWithStartFactory:reduce:"))); +- (RACDisposable *)executeCommand:(RACCommand *)command __attribute__((deprecated("Use -flattenMap: or -subscribeNext: instead"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSignal.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSignal.h new file mode 100644 index 0000000..ed644cf --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSignal.h @@ -0,0 +1,219 @@ +// +// RACSignal.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 3/1/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import +#import "RACStream.h" + +@class RACDisposable; +@class RACScheduler; +@class RACSubject; +@protocol RACSubscriber; + +@interface RACSignal : RACStream + +/// Creates a new signal. This is the preferred way to create a new signal +/// operation or behavior. +/// +/// Events can be sent to new subscribers immediately in the `didSubscribe` +/// block, but the subscriber will not be able to dispose of the signal until +/// a RACDisposable is returned from `didSubscribe`. In the case of infinite +/// signals, this won't _ever_ happen if events are sent immediately. +/// +/// To ensure that the signal is disposable, events can be scheduled on the +/// +[RACScheduler currentScheduler] (so that they're deferred, not sent +/// immediately), or they can be sent in the background. The RACDisposable +/// returned by the `didSubscribe` block should cancel any such scheduling or +/// asynchronous work. +/// +/// didSubscribe - Called when the signal is subscribed to. The new subscriber is +/// passed in. You can then manually control the by +/// sending it -sendNext:, -sendError:, and -sendCompleted, +/// as defined by the operation you're implementing. This block +/// should return a RACDisposable which cancels any ongoing work +/// triggered by the subscription, and cleans up any resources or +/// disposables created as part of it. When the disposable is +/// disposed of, the signal must not send any more events to the +/// `subscriber`. If no cleanup is necessary, return nil. +/// +/// **Note:** The `didSubscribe` block is called every time a new subscriber +/// subscribes. Any side effects within the block will thus execute once for each +/// subscription, not necessarily on one thread, and possibly even +/// simultaneously! ++ (RACSignal *)createSignal:(RACDisposable * (^)(id subscriber))didSubscribe; + +/// Returns a signal that immediately sends the given error. ++ (RACSignal *)error:(NSError *)error; + +/// Returns a signal that never completes. ++ (RACSignal *)never; + +/// Immediately schedules the given block on the given scheduler. The block is +/// given a subscriber to which it can send events. +/// +/// scheduler - The scheduler on which `block` will be scheduled and results +/// delivered. Cannot be nil. +/// block - The block to invoke. Cannot be NULL. +/// +/// Returns a signal which will send all events sent on the subscriber given to +/// `block`. All events will be sent on `scheduler` and it will replay any missed +/// events to new subscribers. ++ (RACSignal *)startEagerlyWithScheduler:(RACScheduler *)scheduler block:(void (^)(id subscriber))block; + +/// Invokes the given block only on the first subscription. The block is given a +/// subscriber to which it can send events. +/// +/// Note that disposing of the subscription to the returned signal will *not* +/// dispose of the underlying subscription. If you need that behavior, see +/// -[RACMulticastConnection autoconnect]. The underlying subscription will never +/// be disposed of. Because of this, `block` should never return an infinite +/// signal since there would be no way of ending it. +/// +/// scheduler - The scheduler on which the block should be scheduled. Note that +/// if given +[RACScheduler immediateScheduler], the block will be +/// invoked synchronously on the first subscription. Cannot be nil. +/// block - The block to invoke on the first subscription. Cannot be NULL. +/// +/// Returns a signal which will pass through the events sent to the subscriber +/// given to `block` and replay any missed events to new subscribers. ++ (RACSignal *)startLazilyWithScheduler:(RACScheduler *)scheduler block:(void (^)(id subscriber))block; + +@end + +@interface RACSignal (RACStream) + +/// Returns a signal that immediately sends the given value and then completes. ++ (RACSignal *)return:(id)value; + +/// Returns a signal that immediately completes. ++ (RACSignal *)empty; + +/// Subscribes to `signal` when the source signal completes. +- (RACSignal *)concat:(RACSignal *)signal; + +/// Zips the values in the receiver with those of the given signal to create +/// RACTuples. +/// +/// The first `next` of each stream will be combined, then the second `next`, and +/// so forth, until either signal completes or errors. +/// +/// signal - The signal to zip with. This must not be `nil`. +/// +/// Returns a new signal of RACTuples, representing the combined values of the +/// two signals. Any error from one of the original signals will be forwarded on +/// the returned signal. +- (RACSignal *)zipWith:(RACSignal *)signal; + +@end + +@interface RACSignal (Subscription) + +/// Subscribes `subscriber` to changes on the receiver. The receiver defines which +/// events it actually sends and in what situations the events are sent. +/// +/// Subscription will always happen on a valid RACScheduler. If the +/// +[RACScheduler currentScheduler] cannot be determined at the time of +/// subscription (e.g., because the calling code is running on a GCD queue or +/// NSOperationQueue), subscription will occur on a private background scheduler. +/// On the main thread, subscriptions will always occur immediately, with a +/// +[RACScheduler currentScheduler] of +[RACScheduler mainThreadScheduler]. +/// +/// This method must be overridden by any subclasses. +/// +/// Returns nil or a disposable. You can call -[RACDisposable dispose] if you +/// need to end your subscription before it would "naturally" end, either by +/// completing or erroring. Once the disposable has been disposed, the subscriber +/// won't receive any more events from the subscription. +- (RACDisposable *)subscribe:(id)subscriber; + +/// Convenience method to subscribe to the `next` event. +/// +/// This corresponds to `IObserver.OnNext` in Rx. +- (RACDisposable *)subscribeNext:(void (^)(id x))nextBlock; + +/// Convenience method to subscribe to the `next` and `completed` events. +- (RACDisposable *)subscribeNext:(void (^)(id x))nextBlock completed:(void (^)(void))completedBlock; + +/// Convenience method to subscribe to the `next`, `completed`, and `error` events. +- (RACDisposable *)subscribeNext:(void (^)(id x))nextBlock error:(void (^)(NSError *error))errorBlock completed:(void (^)(void))completedBlock; + +/// Convenience method to subscribe to `error` events. +/// +/// This corresponds to the `IObserver.OnError` in Rx. +- (RACDisposable *)subscribeError:(void (^)(NSError *error))errorBlock; + +/// Convenience method to subscribe to `completed` events. +/// +/// This corresponds to the `IObserver.OnCompleted` in Rx. +- (RACDisposable *)subscribeCompleted:(void (^)(void))completedBlock; + +/// Convenience method to subscribe to `next` and `error` events. +- (RACDisposable *)subscribeNext:(void (^)(id x))nextBlock error:(void (^)(NSError *error))errorBlock; + +/// Convenience method to subscribe to `error` and `completed` events. +- (RACDisposable *)subscribeError:(void (^)(NSError *error))errorBlock completed:(void (^)(void))completedBlock; + +@end + +/// Additional methods to assist with debugging. +@interface RACSignal (Debugging) + +/// Logs all events that the receiver sends. +- (RACSignal *)logAll; + +/// Logs each `next` that the receiver sends. +- (RACSignal *)logNext; + +/// Logs any error that the receiver sends. +- (RACSignal *)logError; + +/// Logs any `completed` event that the receiver sends. +- (RACSignal *)logCompleted; + +@end + +/// Additional methods to assist with unit testing. +/// +/// **These methods should never ship in production code.** +@interface RACSignal (Testing) + +/// Spins the main run loop for a short while, waiting for the receiver to send a `next`. +/// +/// **Because this method executes the run loop recursively, it should only be used +/// on the main thread, and only from a unit test.** +/// +/// defaultValue - Returned if the receiver completes or errors before sending +/// a `next`, or if the method times out. This argument may be +/// nil. +/// success - If not NULL, set to whether the receiver completed +/// successfully. +/// error - If not NULL, set to any error that occurred. +/// +/// Returns the first value received, or `defaultValue` if no value is received +/// before the signal finishes or the method times out. +- (id)asynchronousFirstOrDefault:(id)defaultValue success:(BOOL *)success error:(NSError **)error; + +/// Spins the main run loop for a short while, waiting for the receiver to complete. +/// +/// **Because this method executes the run loop recursively, it should only be used +/// on the main thread, and only from a unit test.** +/// +/// error - If not NULL, set to any error that occurs. +/// +/// Returns whether the signal completed successfully before timing out. If NO, +/// `error` will be set to any error that occurred. +- (BOOL)asynchronouslyWaitUntilCompleted:(NSError **)error; + +@end + +@interface RACSignal (Deprecated) + ++ (RACSignal *)start:(id (^)(BOOL *success, NSError **error))block __attribute__((deprecated("Use +startEagerlyWithScheduler:block: instead"))); ++ (RACSignal *)startWithScheduler:(RACScheduler *)scheduler subjectBlock:(void (^)(RACSubject *subject))block __attribute__((deprecated("Use +startEagerlyWithScheduler:block: instead"))); ++ (RACSignal *)startWithScheduler:(RACScheduler *)scheduler block:(id (^)(BOOL *success, NSError **error))block __attribute__((deprecated("Use +startEagerlyWithScheduler:block: instead"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACStream.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACStream.h new file mode 100644 index 0000000..ab0060f --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACStream.h @@ -0,0 +1,335 @@ +// +// RACStream.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2012-10-31. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import + +@class RACStream; + +/// A block which accepts a value from a RACStream and returns a new instance +/// of the same stream class. +/// +/// Setting `stop` to `YES` will cause the bind to terminate after the returned +/// value. Returning `nil` will result in immediate termination. +typedef RACStream * (^RACStreamBindBlock)(id value, BOOL *stop); + +/// An abstract class representing any stream of values. +/// +/// This class represents a monad, upon which many stream-based operations can +/// be built. +/// +/// When subclassing RACStream, only the methods in the main @interface body need +/// to be overridden. +@interface RACStream : NSObject + +/// Returns an empty stream. ++ (instancetype)empty; + +/// Lifts `value` into the stream monad. +/// +/// Returns a stream containing only the given value. ++ (instancetype)return:(id)value; + +/// Lazily binds a block to the values in the receiver. +/// +/// This should only be used if you need to terminate the bind early, or close +/// over some state. -flattenMap: is more appropriate for all other cases. +/// +/// block - A block returning a RACStreamBindBlock. This block will be invoked +/// each time the bound stream is re-evaluated. This block must not be +/// nil or return nil. +/// +/// Returns a new stream which represents the combined result of all lazy +/// applications of `block`. +- (instancetype)bind:(RACStreamBindBlock (^)(void))block; + +/// Appends the values of `stream` to the values in the receiver. +/// +/// stream - A stream to concatenate. This must be an instance of the same +/// concrete class as the receiver, and should not be `nil`. +/// +/// Returns a new stream representing the receiver followed by `stream`. +- (instancetype)concat:(RACStream *)stream; + +/// Zips the values in the receiver with those of the given stream to create +/// RACTuples. +/// +/// The first value of each stream will be combined, then the second value, and +/// so forth, until at least one of the streams is exhausted. +/// +/// stream - The stream to zip with. This must be an instance of the same +/// concrete class as the receiver, and should not be `nil`. +/// +/// Returns a new stream of RACTuples, representing the zipped values of the +/// two streams. +- (instancetype)zipWith:(RACStream *)stream; + +@end + +/// This extension contains functionality to support naming streams for +/// debugging. +/// +/// Subclasses do not need to override the methods here. +@interface RACStream () + +/// The name of the stream. This is for debugging/human purposes only. +@property (copy) NSString *name; + +/// Sets the name of the receiver to the given format string. +/// +/// This is for debugging purposes only, and won't do anything unless the +/// RAC_DEBUG_SIGNAL_NAMES environment variable is set. +/// +/// Returns the receiver, for easy method chaining. +- (instancetype)setNameWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2); + +@end + +/// Operations built on the RACStream primitives. +/// +/// These methods do not need to be overridden, although subclasses may +/// occasionally gain better performance from doing so. +@interface RACStream (Operations) + +/// Maps `block` across the values in the receiver and flattens the result. +/// +/// Note that operators applied _after_ -flattenMap: behave differently from +/// operators _within_ -flattenMap:. See the Examples section below. +/// +/// This corresponds to the `SelectMany` method in Rx. +/// +/// block - A block which accepts the values in the receiver and returns a new +/// instance of the receiver's class. Returning `nil` from this block is +/// equivalent to returning an empty signal. +/// +/// Examples +/// +/// [signal flattenMap:^(id x) { +/// // Logs each time a returned signal completes. +/// return [[RACSignal return:x] logCompleted]; +/// }]; +/// +/// [[signal +/// flattenMap:^(id x) { +/// return [RACSignal return:x]; +/// }] +/// // Logs only once, when all of the signals complete. +/// logCompleted]; +/// +/// Returns a new stream which represents the combined streams resulting from +/// mapping `block`. +- (instancetype)flattenMap:(RACStream * (^)(id value))block; + +/// Flattens a stream of streams. +/// +/// This corresponds to the `Merge` method in Rx. +/// +/// Returns a stream consisting of the combined streams obtained from the +/// receiver. +- (instancetype)flatten; + +/// Maps `block` across the values in the receiver. +/// +/// This corresponds to the `Select` method in Rx. +/// +/// Returns a new stream with the mapped values. +- (instancetype)map:(id (^)(id value))block; + +/// Replaces each value in the receiver with the given object. +/// +/// Returns a new stream which includes the given object once for each value in +/// the receiver. +- (instancetype)mapReplace:(id)object; + +/// Filters out values in the receiver that don't pass the given test. +/// +/// This corresponds to the `Where` method in Rx. +/// +/// Returns a new stream with only those values that passed. +- (instancetype)filter:(BOOL (^)(id value))block; + +/// Filters out values in the receiver that equal (via -isEqual:) the provided value. +/// +/// value - The value can be `nil`, in which case it ignores `nil` values. +/// +/// Returns a new stream containing only the values which did not compare equal +/// to `value`. +- (instancetype)ignore:(id)value; + +/// Unpacks each RACTuple in the receiver and maps the values to a new value. +/// +/// reduceBlock - The block which reduces each RACTuple's values into one value. +/// It must take as many arguments as the number of tuple elements +/// to process. Each argument will be an object argument. The +/// return value must be an object. This argument cannot be nil. +/// +/// Returns a new stream of reduced tuple values. +- (instancetype)reduceEach:(id (^)())reduceBlock; + +/// Returns a stream consisting of `value`, followed by the values in the +/// receiver. +- (instancetype)startWith:(id)value; + +/// Skips the first `skipCount` values in the receiver. +/// +/// Returns the receiver after skipping the first `skipCount` values. If +/// `skipCount` is greater than the number of values in the stream, an empty +/// stream is returned. +- (instancetype)skip:(NSUInteger)skipCount; + +/// Returns a stream of the first `count` values in the receiver. If `count` is +/// greater than or equal to the number of values in the stream, a stream +/// equivalent to the receiver is returned. +- (instancetype)take:(NSUInteger)count; + +/// Zips the values in the given streams to create RACTuples. +/// +/// The first value of each stream will be combined, then the second value, and +/// so forth, until at least one of the streams is exhausted. +/// +/// streams - The streams to combine. These must all be instances of the same +/// concrete class implementing the protocol. If this collection is +/// empty, the returned stream will be empty. +/// +/// Returns a new stream containing RACTuples of the zipped values from the +/// streams. ++ (instancetype)zip:(id)streams; + +/// Zips streams using +zip:, then reduces the resulting tuples into a single +/// value using -reduceEach: +/// +/// streams - The streams to combine. These must all be instances of the +/// same concrete class implementing the protocol. If this +/// collection is empty, the returned stream will be empty. +/// reduceBlock - The block which reduces the values from all the streams +/// into one value. It must take as many arguments as the +/// number of streams given. Each argument will be an object +/// argument. The return value must be an object. This argument +/// must not be nil. +/// +/// Example: +/// +/// [RACStream zip:@[ stringSignal, intSignal ] reduce:^(NSString *string, NSNumber *number) { +/// return [NSString stringWithFormat:@"%@: %@", string, number]; +/// }]; +/// +/// Returns a new stream containing the results from each invocation of +/// `reduceBlock`. ++ (instancetype)zip:(id)streams reduce:(id (^)())reduceBlock; + +/// Returns a stream obtained by concatenating `streams` in order. ++ (instancetype)concat:(id)streams; + +/// Combines values in the receiver from left to right using the given block. +/// +/// The algorithm proceeds as follows: +/// +/// 1. `startingValue` is passed into the block as the `running` value, and the +/// first element of the receiver is passed into the block as the `next` value. +/// 2. The result of the invocation is added to the returned stream. +/// 3. The result of the invocation (`running`) and the next element of the +/// receiver (`next`) is passed into `block`. +/// 4. Steps 2 and 3 are repeated until all values have been processed. +/// +/// startingValue - The value to be combined with the first element of the +/// receiver. This value may be `nil`. +/// reduceBlock - The block that describes how to combine values of the +/// receiver. If the receiver is empty, this block will never be +/// invoked. Cannot be nil. +/// +/// Examples +/// +/// RACSequence *numbers = @[ @1, @2, @3, @4 ].rac_sequence; +/// +/// // Contains 1, 3, 6, 10 +/// RACSequence *sums = [numbers scanWithStart:@0 reduce:^(NSNumber *sum, NSNumber *next) { +/// return @(sum.integerValue + next.integerValue); +/// }]; +/// +/// Returns a new stream that consists of each application of `reduceBlock`. If the +/// receiver is empty, an empty stream is returned. +- (instancetype)scanWithStart:(id)startingValue reduce:(id (^)(id running, id next))reduceBlock; + +/// Combines values in the receiver from left to right using the given block +/// which also takes zero-based index of the values. +/// +/// startingValue - The value to be combined with the first element of the +/// receiver. This value may be `nil`. +/// reduceBlock - The block that describes how to combine values of the +/// receiver. This block takes zero-based index value as the last +/// parameter. If the receiver is empty, this block will never +/// be invoked. Cannot be nil. +/// +/// Returns a new stream that consists of each application of `reduceBlock`. If the +/// receiver is empty, an empty stream is returned. +- (instancetype)scanWithStart:(id)startingValue reduceWithIndex:(id (^)(id running, id next, NSUInteger index))reduceBlock; + +/// Combines each previous and current value into one object. +/// +/// This method is similar to -scanWithStart:reduce:, but only ever operates on +/// the previous and current values (instead of the whole stream), and does not +/// pass the return value of `reduceBlock` into the next invocation of it. +/// +/// start - The value passed into `reduceBlock` as `previous` for the +/// first value. +/// reduceBlock - The block that combines the previous value and the current +/// value to create the reduced value. Cannot be nil. +/// +/// Examples +/// +/// RACSequence *numbers = @[ @1, @2, @3, @4 ].rac_sequence; +/// +/// // Contains 1, 3, 5, 7 +/// RACSequence *sums = [numbers combinePreviousWithStart:@0 reduce:^(NSNumber *previous, NSNumber *next) { +/// return @(previous.integerValue + next.integerValue); +/// }]; +/// +/// Returns a new stream consisting of the return values from each application of +/// `reduceBlock`. +- (instancetype)combinePreviousWithStart:(id)start reduce:(id (^)(id previous, id current))reduceBlock; + +/// Takes values until the given block returns `YES`. +/// +/// Returns a stream of the initial values in the receiver that fail `predicate`. +/// If `predicate` never returns `YES`, a stream equivalent to the receiver is +/// returned. +- (instancetype)takeUntilBlock:(BOOL (^)(id x))predicate; + +/// Takes values until the given block returns `NO`. +/// +/// Returns a stream of the initial values in the receiver that pass `predicate`. +/// If `predicate` never returns `NO`, a stream equivalent to the receiver is +/// returned. +- (instancetype)takeWhileBlock:(BOOL (^)(id x))predicate; + +/// Skips values until the given block returns `YES`. +/// +/// Returns a stream containing the values of the receiver that follow any +/// initial values failing `predicate`. If `predicate` never returns `YES`, +/// an empty stream is returned. +- (instancetype)skipUntilBlock:(BOOL (^)(id x))predicate; + +/// Skips values until the given block returns `NO`. +/// +/// Returns a stream containing the values of the receiver that follow any +/// initial values passing `predicate`. If `predicate` never returns `NO`, an +/// empty stream is returned. +- (instancetype)skipWhileBlock:(BOOL (^)(id x))predicate; + +/// Returns a stream of values for which -isEqual: returns NO when compared to the +/// previous value. +- (instancetype)distinctUntilChanged; + +@end + +@interface RACStream (Deprecated) + +- (instancetype)sequenceMany:(RACStream * (^)(void))block __attribute__((deprecated("Use -flattenMap: instead"))); +- (instancetype)scanWithStart:(id)startingValue combine:(id (^)(id running, id next))block __attribute__((deprecated("Renamed to -scanWithStart:reduce:"))); +- (instancetype)mapPreviousWithStart:(id)start reduce:(id (^)(id previous, id current))combineBlock __attribute__((deprecated("Renamed to -combinePreviousWithStart:reduce:"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSubject.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSubject.h new file mode 100644 index 0000000..30c100b --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSubject.h @@ -0,0 +1,22 @@ +// +// RACSubject.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 3/9/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import "RACSignal.h" +#import "RACSubscriber.h" + +/// A subject can be thought of as a signal that you can manually control by +/// sending next, completed, and error. +/// +/// They're most helpful in bridging the non-RAC world to RAC, since they let you +/// manually control the sending of events. +@interface RACSubject : RACSignal + +/// Returns a new subject. ++ (instancetype)subject; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSubscriber.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSubscriber.h new file mode 100644 index 0000000..b62ea35 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSubscriber.h @@ -0,0 +1,51 @@ +// +// RACSubscriber.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 3/1/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import + +@class RACCompoundDisposable; + +/// Represents any object which can directly receive values from a RACSignal. +/// +/// You generally shouldn't need to implement this protocol. +[RACSignal +/// createSignal:], RACSignal's subscription methods, or RACSubject should work +/// for most uses. +/// +/// Implementors of this protocol may receive messages and values from multiple +/// threads simultaneously, and so should be thread-safe. Subscribers will also +/// be weakly referenced so implementations must allow that. +@protocol RACSubscriber +@required + +/// Sends the next value to subscribers. +/// +/// value - The value to send. This can be `nil`. +- (void)sendNext:(id)value; + +/// Sends the error to subscribers. +/// +/// error - The error to send. This can be `nil`. +/// +/// This terminates the subscription, and invalidates the subscriber (such that +/// it cannot subscribe to anything else in the future). +- (void)sendError:(NSError *)error; + +/// Sends completed to subscribers. +/// +/// This terminates the subscription, and invalidates the subscriber (such that +/// it cannot subscribe to anything else in the future). +- (void)sendCompleted; + +/// Sends the subscriber a disposable that represents one of its subscriptions. +/// +/// A subscriber may receive multiple disposables if it gets subscribed to +/// multiple signals; however, any error or completed events must terminate _all_ +/// subscriptions. +- (void)didSubscribeWithDisposable:(RACCompoundDisposable *)disposable; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSubscriptingAssignmentTrampoline.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSubscriptingAssignmentTrampoline.h new file mode 100644 index 0000000..07ec9e7 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACSubscriptingAssignmentTrampoline.h @@ -0,0 +1,54 @@ +// +// RACSubscriptingAssignmentTrampoline.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 9/24/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import +#import "EXTKeyPathCoding.h" + +@class RACSignal; + +/// Assigns a signal to an object property, automatically setting the given key +/// path on every `next`. When the signal completes, the binding is automatically +/// disposed of. +/// +/// There are two different versions of this macro: +/// +/// - RAC(TARGET, KEYPATH, NILVALUE) will bind the `KEYPATH` of `TARGET` to the +/// given signal. If the signal ever sends a `nil` value, the property will be +/// set to `NILVALUE` instead. `NILVALUE` may itself be `nil` for object +/// properties, but an NSValue should be used for primitive properties, to +/// avoid an exception if `nil` is sent (which might occur if an intermediate +/// object is set to `nil`). +/// - RAC(TARGET, KEYPATH) is the same as the above, but `NILVALUE` defaults to +/// `nil`. +/// +/// See -[RACSignal setKeyPath:onObject:nilValue:] for more information about the +/// binding's semantics. +/// +/// Examples +/// +/// RAC(self, objectProperty) = objectSignal; +/// RAC(self, stringProperty, @"foobar") = stringSignal; +/// RAC(self, integerProperty, @42) = integerSignal; +/// +/// WARNING: Under certain conditions, use of this macro can be thread-unsafe. +/// See the documentation of -setKeyPath:onObject:nilValue:. +#define RAC(TARGET, ...) \ + metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__)) \ + (RAC_(TARGET, __VA_ARGS__, nil)) \ + (RAC_(TARGET, __VA_ARGS__)) + +/// Do not use this directly. Use the RAC macro above. +#define RAC_(TARGET, KEYPATH, NILVALUE) \ + [[RACSubscriptingAssignmentTrampoline alloc] initWithTarget:(TARGET) nilValue:(NILVALUE)][@keypath(TARGET, KEYPATH)] + +@interface RACSubscriptingAssignmentTrampoline : NSObject + +- (id)initWithTarget:(id)target nilValue:(id)nilValue; +- (void)setObject:(RACSignal *)signal forKeyedSubscript:(NSString *)keyPath; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACTargetQueueScheduler.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACTargetQueueScheduler.h new file mode 100644 index 0000000..429e595 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACTargetQueueScheduler.h @@ -0,0 +1,24 @@ +// +// RACTargetQueueScheduler.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 6/6/13. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import "RACQueueScheduler.h" + +/// A scheduler that enqueues blocks on a private serial queue, targeting an +/// arbitrary GCD queue. +@interface RACTargetQueueScheduler : RACQueueScheduler + +/// Initializes the receiver with a serial queue that will target the given +/// `targetQueue`. +/// +/// name - The name of the scheduler. If nil, a default name will be used. +/// targetQueue - The queue to target. Cannot be NULL. +/// +/// Returns the initialized object. +- (id)initWithName:(NSString *)name targetQueue:(dispatch_queue_t)targetQueue; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACTestScheduler.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACTestScheduler.h new file mode 100644 index 0000000..a790f5b --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACTestScheduler.h @@ -0,0 +1,42 @@ +// +// RACTestScheduler.h +// ReactiveCocoa +// +// Created by Justin Spahr-Summers on 2013-07-06. +// Copyright (c) 2013 GitHub, Inc. All rights reserved. +// + +#import "RACScheduler.h" + +/// A special kind of scheduler that steps through virtualized time. +/// +/// This scheduler class can be used in unit tests to verify asynchronous +/// behaviors without spending significant time waiting. +/// +/// This class can be used from multiple threads, but only one thread can `step` +/// through the enqueued actions at a time. Other threads will wait while the +/// scheduled blocks are being executed. +@interface RACTestScheduler : RACScheduler + +/// Initializes a new test scheduler. +- (instancetype)init; + +/// Executes the next scheduled block, if any. +/// +/// This method will block until the scheduled action has completed. +- (void)step; + +/// Executes up to the next `ticks` scheduled blocks. +/// +/// This method will block until the scheduled actions have completed. +/// +/// ticks - The number of scheduled blocks to execute. If there aren't this many +/// blocks enqueued, all scheduled blocks are executed. +- (void)step:(NSUInteger)ticks; + +/// Executes all of the scheduled blocks on the receiver. +/// +/// This method will block until the scheduled actions have completed. +- (void)stepAll; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACTuple.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACTuple.h new file mode 100644 index 0000000..647b42c --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACTuple.h @@ -0,0 +1,159 @@ +// +// RACTuple.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 4/12/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import +#import "metamacros.h" + +@class RACSequence; + +/// Creates a new tuple with the given values. At least one value must be given. +/// Values can be nil. +#define RACTuplePack(...) \ + RACTuplePack_(__VA_ARGS__) + +/// Declares new object variables and unpacks a RACTuple into them. +/// +/// This macro should be used on the left side of an assignment, with the +/// tuple on the right side. Nothing else should appear on the same line, and the +/// macro should not be the only statement in a conditional or loop body. +/// +/// If the tuple has more values than there are variables listed, the excess +/// values are ignored. +/// +/// If the tuple has fewer values than there are variables listed, the excess +/// variables are initialized to nil. +/// +/// Examples +/// +/// RACTupleUnpack(NSString *string, NSNumber *num) = [RACTuple tupleWithObjects:@"foo", @5, nil]; +/// NSLog(@"string: %@", string); +/// NSLog(@"num: %@", num); +/// +/// /* The above is equivalent to: */ +/// RACTuple *t = [RACTuple tupleWithObjects:@"foo", @5, nil]; +/// NSString *string = t[0]; +/// NSNumber *num = t[1]; +/// NSLog(@"string: %@", string); +/// NSLog(@"num: %@", num); +#define RACTupleUnpack(...) \ + RACTupleUnpack_(__VA_ARGS__) + +/// A sentinel object that represents nils in the tuple. +/// +/// It should never be necessary to create a tuple nil yourself. Just use +/// +tupleNil. +@interface RACTupleNil : NSObject +/// A singleton instance. ++ (RACTupleNil *)tupleNil; +@end + + +/// A tuple is an ordered collection of objects. It may contain nils, represented +/// by RACTupleNil. +@interface RACTuple : NSObject + +@property (nonatomic, readonly) NSUInteger count; + +/// These properties all return the object at that index or nil if the number of +/// objects is less than the index. +@property (nonatomic, readonly) id first; +@property (nonatomic, readonly) id second; +@property (nonatomic, readonly) id third; +@property (nonatomic, readonly) id fourth; +@property (nonatomic, readonly) id fifth; +@property (nonatomic, readonly) id last; + +/// Creates a new tuple out of the array. Does not convert nulls to nils. ++ (instancetype)tupleWithObjectsFromArray:(NSArray *)array; + +/// Creates a new tuple out of the array. If `convert` is YES, it also converts +/// every NSNull to RACTupleNil. ++ (instancetype)tupleWithObjectsFromArray:(NSArray *)array convertNullsToNils:(BOOL)convert; + +/// Creates a new tuple with the given objects. Use RACTupleNil to represent +/// nils. ++ (instancetype)tupleWithObjects:(id)object, ... NS_REQUIRES_NIL_TERMINATION; + +/// Returns the object at `index` or nil if the object is a RACTupleNil. Unlike +/// NSArray and friends, it's perfectly fine to ask for the object at an index +/// past the tuple's count - 1. It will simply return nil. +- (id)objectAtIndex:(NSUInteger)index; + +/// Returns an array of all the objects. RACTupleNils are converted to NSNulls. +- (NSArray *)allObjects; + +/// Appends `obj` to the receiver. +/// +/// obj - The object to add to the tuple. This argument may be nil. +/// +/// Returns a new tuple. +- (instancetype)tupleByAddingObject:(id)obj; + +@end + +@interface RACTuple (RACSequenceAdditions) + +/// Returns a sequence of all the objects. RACTupleNils are converted to NSNulls. +@property (nonatomic, copy, readonly) RACSequence *rac_sequence; + +@end + +@interface RACTuple (ObjectSubscripting) +/// Returns the object at that index or nil if the number of objects is less +/// than the index. +- (id)objectAtIndexedSubscript:(NSUInteger)idx; +@end + +/// This and everything below is for internal use only. +/// +/// See RACTuplePack() and RACTupleUnpack() instead. +#define RACTuplePack_(...) \ + ([RACTuple tupleWithObjectsFromArray:@[ metamacro_foreach(RACTuplePack_object_or_ractuplenil,, __VA_ARGS__) ]]) + +#define RACTuplePack_object_or_ractuplenil(INDEX, ARG) \ + (ARG) ?: RACTupleNil.tupleNil, + +#define RACTupleUnpack_(...) \ + metamacro_foreach(RACTupleUnpack_decl,, __VA_ARGS__) \ + \ + int RACTupleUnpack_state = 0; \ + \ + RACTupleUnpack_after: \ + ; \ + metamacro_foreach(RACTupleUnpack_assign,, __VA_ARGS__) \ + if (RACTupleUnpack_state != 0) RACTupleUnpack_state = 2; \ + \ + while (RACTupleUnpack_state != 2) \ + if (RACTupleUnpack_state == 1) { \ + goto RACTupleUnpack_after; \ + } else \ + for (; RACTupleUnpack_state != 1; RACTupleUnpack_state = 1) \ + [RACTupleUnpackingTrampoline trampoline][ @[ metamacro_foreach(RACTupleUnpack_value,, __VA_ARGS__) ] ] + +#define RACTupleUnpack_state metamacro_concat(RACTupleUnpack_state, __LINE__) +#define RACTupleUnpack_after metamacro_concat(RACTupleUnpack_after, __LINE__) +#define RACTupleUnpack_loop metamacro_concat(RACTupleUnpack_loop, __LINE__) + +#define RACTupleUnpack_decl_name(INDEX) \ + metamacro_concat(metamacro_concat(RACTupleUnpack, __LINE__), metamacro_concat(_var, INDEX)) + +#define RACTupleUnpack_decl(INDEX, ARG) \ + __strong id RACTupleUnpack_decl_name(INDEX); + +#define RACTupleUnpack_assign(INDEX, ARG) \ + __strong ARG = RACTupleUnpack_decl_name(INDEX); + +#define RACTupleUnpack_value(INDEX, ARG) \ + [NSValue valueWithPointer:&RACTupleUnpack_decl_name(INDEX)], + +@interface RACTupleUnpackingTrampoline : NSObject + ++ (instancetype)trampoline; +- (void)setObject:(RACTuple *)tuple forKeyedSubscript:(NSArray *)variables; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACUnit.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACUnit.h new file mode 100644 index 0000000..a04e2b1 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACUnit.h @@ -0,0 +1,19 @@ +// +// RACUnit.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 3/27/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import + +/// A unit represents an empty value. +/// +/// It should never be necessary to create a unit yourself. Just use +defaultUnit. +@interface RACUnit : NSObject + +/// A singleton instance. ++ (RACUnit *)defaultUnit; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/ReactiveCocoa.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/ReactiveCocoa.h new file mode 100644 index 0000000..164b4a9 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/ReactiveCocoa.h @@ -0,0 +1,89 @@ +// +// ReactiveCocoa.h +// ReactiveCocoa +// +// Created by Josh Abernathy on 3/5/12. +// Copyright (c) 2012 GitHub, Inc. All rights reserved. +// + +#import + +//! Project version number for ReactiveCocoa. +FOUNDATION_EXPORT double ReactiveCocoaVersionNumber; + +//! Project version string for ReactiveCocoa. +FOUNDATION_EXPORT const unsigned char ReactiveCocoaVersionString[]; + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED + #import + #import + #import + #import + #import + #import + #import + #import + #import + #import + #import + #import + #import + #import + #import + #import + #import + #import +#elif TARGET_OS_MAC + #import + #import + #import + #import +#endif diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/metamacros.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/metamacros.h new file mode 100644 index 0000000..77a77b5 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/metamacros.h @@ -0,0 +1,666 @@ +/** + * Macros for metaprogramming + * ExtendedC + * + * Copyright (C) 2012 Justin Spahr-Summers + * Released under the MIT license + */ + +#ifndef EXTC_METAMACROS_H +#define EXTC_METAMACROS_H + +/** + * Executes one or more expressions (which may have a void type, such as a call + * to a function that returns no value) and always returns true. + */ +#define metamacro_exprify(...) \ + ((__VA_ARGS__), true) + +/** + * Returns a string representation of VALUE after full macro expansion. + */ +#define metamacro_stringify(VALUE) \ + metamacro_stringify_(VALUE) + +/** + * Returns A and B concatenated after full macro expansion. + */ +#define metamacro_concat(A, B) \ + metamacro_concat_(A, B) + +/** + * Returns the Nth variadic argument (starting from zero). At least + * N + 1 variadic arguments must be given. N must be between zero and twenty, + * inclusive. + */ +#define metamacro_at(N, ...) \ + metamacro_concat(metamacro_at, N)(__VA_ARGS__) + +/** + * Returns the number of arguments (up to twenty) provided to the macro. At + * least one argument must be provided. + * + * Inspired by P99: http://p99.gforge.inria.fr + */ +#define metamacro_argcount(...) \ + metamacro_at(20, __VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1) + +/** + * Identical to #metamacro_foreach_cxt, except that no CONTEXT argument is + * given. Only the index and current argument will thus be passed to MACRO. + */ +#define metamacro_foreach(MACRO, SEP, ...) \ + metamacro_foreach_cxt(metamacro_foreach_iter, SEP, MACRO, __VA_ARGS__) + +/** + * For each consecutive variadic argument (up to twenty), MACRO is passed the + * zero-based index of the current argument, CONTEXT, and then the argument + * itself. The results of adjoining invocations of MACRO are then separated by + * SEP. + * + * Inspired by P99: http://p99.gforge.inria.fr + */ +#define metamacro_foreach_cxt(MACRO, SEP, CONTEXT, ...) \ + metamacro_concat(metamacro_foreach_cxt, metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__) + +/** + * Identical to #metamacro_foreach_cxt. This can be used when the former would + * fail due to recursive macro expansion. + */ +#define metamacro_foreach_cxt_recursive(MACRO, SEP, CONTEXT, ...) \ + metamacro_concat(metamacro_foreach_cxt_recursive, metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__) + +/** + * In consecutive order, appends each variadic argument (up to twenty) onto + * BASE. The resulting concatenations are then separated by SEP. + * + * This is primarily useful to manipulate a list of macro invocations into instead + * invoking a different, possibly related macro. + */ +#define metamacro_foreach_concat(BASE, SEP, ...) \ + metamacro_foreach_cxt(metamacro_foreach_concat_iter, SEP, BASE, __VA_ARGS__) + +/** + * Iterates COUNT times, each time invoking MACRO with the current index + * (starting at zero) and CONTEXT. The results of adjoining invocations of MACRO + * are then separated by SEP. + * + * COUNT must be an integer between zero and twenty, inclusive. + */ +#define metamacro_for_cxt(COUNT, MACRO, SEP, CONTEXT) \ + metamacro_concat(metamacro_for_cxt, COUNT)(MACRO, SEP, CONTEXT) + +/** + * Returns the first argument given. At least one argument must be provided. + * + * This is useful when implementing a variadic macro, where you may have only + * one variadic argument, but no way to retrieve it (for example, because \c ... + * always needs to match at least one argument). + * + * @code + +#define varmacro(...) \ + metamacro_head(__VA_ARGS__) + + * @endcode + */ +#define metamacro_head(...) \ + metamacro_head_(__VA_ARGS__, 0) + +/** + * Returns every argument except the first. At least two arguments must be + * provided. + */ +#define metamacro_tail(...) \ + metamacro_tail_(__VA_ARGS__) + +/** + * Returns the first N (up to twenty) variadic arguments as a new argument list. + * At least N variadic arguments must be provided. + */ +#define metamacro_take(N, ...) \ + metamacro_concat(metamacro_take, N)(__VA_ARGS__) + +/** + * Removes the first N (up to twenty) variadic arguments from the given argument + * list. At least N variadic arguments must be provided. + */ +#define metamacro_drop(N, ...) \ + metamacro_concat(metamacro_drop, N)(__VA_ARGS__) + +/** + * Decrements VAL, which must be a number between zero and twenty, inclusive. + * + * This is primarily useful when dealing with indexes and counts in + * metaprogramming. + */ +#define metamacro_dec(VAL) \ + metamacro_at(VAL, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19) + +/** + * Increments VAL, which must be a number between zero and twenty, inclusive. + * + * This is primarily useful when dealing with indexes and counts in + * metaprogramming. + */ +#define metamacro_inc(VAL) \ + metamacro_at(VAL, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21) + +/** + * If A is equal to B, the next argument list is expanded; otherwise, the + * argument list after that is expanded. A and B must be numbers between zero + * and twenty, inclusive. Additionally, B must be greater than or equal to A. + * + * @code + +// expands to true +metamacro_if_eq(0, 0)(true)(false) + +// expands to false +metamacro_if_eq(0, 1)(true)(false) + + * @endcode + * + * This is primarily useful when dealing with indexes and counts in + * metaprogramming. + */ +#define metamacro_if_eq(A, B) \ + metamacro_concat(metamacro_if_eq, A)(B) + +/** + * Identical to #metamacro_if_eq. This can be used when the former would fail + * due to recursive macro expansion. + */ +#define metamacro_if_eq_recursive(A, B) \ + metamacro_concat(metamacro_if_eq_recursive, A)(B) + +/** + * Returns 1 if N is an even number, or 0 otherwise. N must be between zero and + * twenty, inclusive. + * + * For the purposes of this test, zero is considered even. + */ +#define metamacro_is_even(N) \ + metamacro_at(N, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1) + +/** + * Returns the logical NOT of B, which must be the number zero or one. + */ +#define metamacro_not(B) \ + metamacro_at(B, 1, 0) + +// IMPLEMENTATION DETAILS FOLLOW! +// Do not write code that depends on anything below this line. +#define metamacro_stringify_(VALUE) # VALUE +#define metamacro_concat_(A, B) A ## B +#define metamacro_foreach_iter(INDEX, MACRO, ARG) MACRO(INDEX, ARG) +#define metamacro_head_(FIRST, ...) FIRST +#define metamacro_tail_(FIRST, ...) __VA_ARGS__ +#define metamacro_consume_(...) +#define metamacro_expand_(...) __VA_ARGS__ + +// implemented from scratch so that metamacro_concat() doesn't end up nesting +#define metamacro_foreach_concat_iter(INDEX, BASE, ARG) metamacro_foreach_concat_iter_(BASE, ARG) +#define metamacro_foreach_concat_iter_(BASE, ARG) BASE ## ARG + +// metamacro_at expansions +#define metamacro_at0(...) metamacro_head(__VA_ARGS__) +#define metamacro_at1(_0, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at2(_0, _1, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at3(_0, _1, _2, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at4(_0, _1, _2, _3, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at5(_0, _1, _2, _3, _4, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at6(_0, _1, _2, _3, _4, _5, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at7(_0, _1, _2, _3, _4, _5, _6, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at8(_0, _1, _2, _3, _4, _5, _6, _7, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at9(_0, _1, _2, _3, _4, _5, _6, _7, _8, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at10(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at11(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at12(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at13(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at14(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at15(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at16(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at17(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at19(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at20(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, ...) metamacro_head(__VA_ARGS__) + +// metamacro_foreach_cxt expansions +#define metamacro_foreach_cxt0(MACRO, SEP, CONTEXT) +#define metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0) + +#define metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \ + metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) \ + SEP \ + MACRO(1, CONTEXT, _1) + +#define metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \ + metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \ + SEP \ + MACRO(2, CONTEXT, _2) + +#define metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ + metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \ + SEP \ + MACRO(3, CONTEXT, _3) + +#define metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ + metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ + SEP \ + MACRO(4, CONTEXT, _4) + +#define metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ + metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ + SEP \ + MACRO(5, CONTEXT, _5) + +#define metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ + metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ + SEP \ + MACRO(6, CONTEXT, _6) + +#define metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ + metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ + SEP \ + MACRO(7, CONTEXT, _7) + +#define metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ + metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ + SEP \ + MACRO(8, CONTEXT, _8) + +#define metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ + SEP \ + MACRO(9, CONTEXT, _9) + +#define metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + SEP \ + MACRO(10, CONTEXT, _10) + +#define metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ + metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + SEP \ + MACRO(11, CONTEXT, _11) + +#define metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ + metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ + SEP \ + MACRO(12, CONTEXT, _12) + +#define metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ + metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ + SEP \ + MACRO(13, CONTEXT, _13) + +#define metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ + metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ + SEP \ + MACRO(14, CONTEXT, _14) + +#define metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ + SEP \ + MACRO(15, CONTEXT, _15) + +#define metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + SEP \ + MACRO(16, CONTEXT, _16) + +#define metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ + metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + SEP \ + MACRO(17, CONTEXT, _17) + +#define metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ + metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ + SEP \ + MACRO(18, CONTEXT, _18) + +#define metamacro_foreach_cxt20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \ + metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ + SEP \ + MACRO(19, CONTEXT, _19) + +// metamacro_foreach_cxt_recursive expansions +#define metamacro_foreach_cxt_recursive0(MACRO, SEP, CONTEXT) +#define metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0) + +#define metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \ + metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) \ + SEP \ + MACRO(1, CONTEXT, _1) + +#define metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \ + metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \ + SEP \ + MACRO(2, CONTEXT, _2) + +#define metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ + metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \ + SEP \ + MACRO(3, CONTEXT, _3) + +#define metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ + metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ + SEP \ + MACRO(4, CONTEXT, _4) + +#define metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ + metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ + SEP \ + MACRO(5, CONTEXT, _5) + +#define metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ + metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ + SEP \ + MACRO(6, CONTEXT, _6) + +#define metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ + metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ + SEP \ + MACRO(7, CONTEXT, _7) + +#define metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ + metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ + SEP \ + MACRO(8, CONTEXT, _8) + +#define metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ + SEP \ + MACRO(9, CONTEXT, _9) + +#define metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + SEP \ + MACRO(10, CONTEXT, _10) + +#define metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ + metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + SEP \ + MACRO(11, CONTEXT, _11) + +#define metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ + metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ + SEP \ + MACRO(12, CONTEXT, _12) + +#define metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ + metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ + SEP \ + MACRO(13, CONTEXT, _13) + +#define metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ + metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ + SEP \ + MACRO(14, CONTEXT, _14) + +#define metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ + SEP \ + MACRO(15, CONTEXT, _15) + +#define metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + SEP \ + MACRO(16, CONTEXT, _16) + +#define metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ + metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + SEP \ + MACRO(17, CONTEXT, _17) + +#define metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ + metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ + SEP \ + MACRO(18, CONTEXT, _18) + +#define metamacro_foreach_cxt_recursive20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \ + metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ + SEP \ + MACRO(19, CONTEXT, _19) + +// metamacro_for_cxt expansions +#define metamacro_for_cxt0(MACRO, SEP, CONTEXT) +#define metamacro_for_cxt1(MACRO, SEP, CONTEXT) MACRO(0, CONTEXT) + +#define metamacro_for_cxt2(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt1(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(1, CONTEXT) + +#define metamacro_for_cxt3(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt2(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(2, CONTEXT) + +#define metamacro_for_cxt4(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt3(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(3, CONTEXT) + +#define metamacro_for_cxt5(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt4(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(4, CONTEXT) + +#define metamacro_for_cxt6(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt5(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(5, CONTEXT) + +#define metamacro_for_cxt7(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt6(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(6, CONTEXT) + +#define metamacro_for_cxt8(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt7(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(7, CONTEXT) + +#define metamacro_for_cxt9(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt8(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(8, CONTEXT) + +#define metamacro_for_cxt10(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt9(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(9, CONTEXT) + +#define metamacro_for_cxt11(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt10(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(10, CONTEXT) + +#define metamacro_for_cxt12(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt11(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(11, CONTEXT) + +#define metamacro_for_cxt13(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt12(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(12, CONTEXT) + +#define metamacro_for_cxt14(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt13(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(13, CONTEXT) + +#define metamacro_for_cxt15(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt14(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(14, CONTEXT) + +#define metamacro_for_cxt16(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt15(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(15, CONTEXT) + +#define metamacro_for_cxt17(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt16(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(16, CONTEXT) + +#define metamacro_for_cxt18(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt17(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(17, CONTEXT) + +#define metamacro_for_cxt19(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt18(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(18, CONTEXT) + +#define metamacro_for_cxt20(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt19(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(19, CONTEXT) + +// metamacro_if_eq expansions +#define metamacro_if_eq0(VALUE) \ + metamacro_concat(metamacro_if_eq0_, VALUE) + +#define metamacro_if_eq0_0(...) __VA_ARGS__ metamacro_consume_ +#define metamacro_if_eq0_1(...) metamacro_expand_ +#define metamacro_if_eq0_2(...) metamacro_expand_ +#define metamacro_if_eq0_3(...) metamacro_expand_ +#define metamacro_if_eq0_4(...) metamacro_expand_ +#define metamacro_if_eq0_5(...) metamacro_expand_ +#define metamacro_if_eq0_6(...) metamacro_expand_ +#define metamacro_if_eq0_7(...) metamacro_expand_ +#define metamacro_if_eq0_8(...) metamacro_expand_ +#define metamacro_if_eq0_9(...) metamacro_expand_ +#define metamacro_if_eq0_10(...) metamacro_expand_ +#define metamacro_if_eq0_11(...) metamacro_expand_ +#define metamacro_if_eq0_12(...) metamacro_expand_ +#define metamacro_if_eq0_13(...) metamacro_expand_ +#define metamacro_if_eq0_14(...) metamacro_expand_ +#define metamacro_if_eq0_15(...) metamacro_expand_ +#define metamacro_if_eq0_16(...) metamacro_expand_ +#define metamacro_if_eq0_17(...) metamacro_expand_ +#define metamacro_if_eq0_18(...) metamacro_expand_ +#define metamacro_if_eq0_19(...) metamacro_expand_ +#define metamacro_if_eq0_20(...) metamacro_expand_ + +#define metamacro_if_eq1(VALUE) metamacro_if_eq0(metamacro_dec(VALUE)) +#define metamacro_if_eq2(VALUE) metamacro_if_eq1(metamacro_dec(VALUE)) +#define metamacro_if_eq3(VALUE) metamacro_if_eq2(metamacro_dec(VALUE)) +#define metamacro_if_eq4(VALUE) metamacro_if_eq3(metamacro_dec(VALUE)) +#define metamacro_if_eq5(VALUE) metamacro_if_eq4(metamacro_dec(VALUE)) +#define metamacro_if_eq6(VALUE) metamacro_if_eq5(metamacro_dec(VALUE)) +#define metamacro_if_eq7(VALUE) metamacro_if_eq6(metamacro_dec(VALUE)) +#define metamacro_if_eq8(VALUE) metamacro_if_eq7(metamacro_dec(VALUE)) +#define metamacro_if_eq9(VALUE) metamacro_if_eq8(metamacro_dec(VALUE)) +#define metamacro_if_eq10(VALUE) metamacro_if_eq9(metamacro_dec(VALUE)) +#define metamacro_if_eq11(VALUE) metamacro_if_eq10(metamacro_dec(VALUE)) +#define metamacro_if_eq12(VALUE) metamacro_if_eq11(metamacro_dec(VALUE)) +#define metamacro_if_eq13(VALUE) metamacro_if_eq12(metamacro_dec(VALUE)) +#define metamacro_if_eq14(VALUE) metamacro_if_eq13(metamacro_dec(VALUE)) +#define metamacro_if_eq15(VALUE) metamacro_if_eq14(metamacro_dec(VALUE)) +#define metamacro_if_eq16(VALUE) metamacro_if_eq15(metamacro_dec(VALUE)) +#define metamacro_if_eq17(VALUE) metamacro_if_eq16(metamacro_dec(VALUE)) +#define metamacro_if_eq18(VALUE) metamacro_if_eq17(metamacro_dec(VALUE)) +#define metamacro_if_eq19(VALUE) metamacro_if_eq18(metamacro_dec(VALUE)) +#define metamacro_if_eq20(VALUE) metamacro_if_eq19(metamacro_dec(VALUE)) + +// metamacro_if_eq_recursive expansions +#define metamacro_if_eq_recursive0(VALUE) \ + metamacro_concat(metamacro_if_eq_recursive0_, VALUE) + +#define metamacro_if_eq_recursive0_0(...) __VA_ARGS__ metamacro_consume_ +#define metamacro_if_eq_recursive0_1(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_2(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_3(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_4(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_5(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_6(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_7(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_8(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_9(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_10(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_11(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_12(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_13(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_14(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_15(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_16(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_17(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_18(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_19(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_20(...) metamacro_expand_ + +#define metamacro_if_eq_recursive1(VALUE) metamacro_if_eq_recursive0(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive2(VALUE) metamacro_if_eq_recursive1(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive3(VALUE) metamacro_if_eq_recursive2(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive4(VALUE) metamacro_if_eq_recursive3(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive5(VALUE) metamacro_if_eq_recursive4(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive6(VALUE) metamacro_if_eq_recursive5(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive7(VALUE) metamacro_if_eq_recursive6(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive8(VALUE) metamacro_if_eq_recursive7(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive9(VALUE) metamacro_if_eq_recursive8(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive10(VALUE) metamacro_if_eq_recursive9(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive11(VALUE) metamacro_if_eq_recursive10(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive12(VALUE) metamacro_if_eq_recursive11(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive13(VALUE) metamacro_if_eq_recursive12(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive14(VALUE) metamacro_if_eq_recursive13(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive15(VALUE) metamacro_if_eq_recursive14(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive16(VALUE) metamacro_if_eq_recursive15(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive17(VALUE) metamacro_if_eq_recursive16(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive18(VALUE) metamacro_if_eq_recursive17(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive19(VALUE) metamacro_if_eq_recursive18(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive20(VALUE) metamacro_if_eq_recursive19(metamacro_dec(VALUE)) + +// metamacro_take expansions +#define metamacro_take0(...) +#define metamacro_take1(...) metamacro_head(__VA_ARGS__) +#define metamacro_take2(...) metamacro_head(__VA_ARGS__), metamacro_take1(metamacro_tail(__VA_ARGS__)) +#define metamacro_take3(...) metamacro_head(__VA_ARGS__), metamacro_take2(metamacro_tail(__VA_ARGS__)) +#define metamacro_take4(...) metamacro_head(__VA_ARGS__), metamacro_take3(metamacro_tail(__VA_ARGS__)) +#define metamacro_take5(...) metamacro_head(__VA_ARGS__), metamacro_take4(metamacro_tail(__VA_ARGS__)) +#define metamacro_take6(...) metamacro_head(__VA_ARGS__), metamacro_take5(metamacro_tail(__VA_ARGS__)) +#define metamacro_take7(...) metamacro_head(__VA_ARGS__), metamacro_take6(metamacro_tail(__VA_ARGS__)) +#define metamacro_take8(...) metamacro_head(__VA_ARGS__), metamacro_take7(metamacro_tail(__VA_ARGS__)) +#define metamacro_take9(...) metamacro_head(__VA_ARGS__), metamacro_take8(metamacro_tail(__VA_ARGS__)) +#define metamacro_take10(...) metamacro_head(__VA_ARGS__), metamacro_take9(metamacro_tail(__VA_ARGS__)) +#define metamacro_take11(...) metamacro_head(__VA_ARGS__), metamacro_take10(metamacro_tail(__VA_ARGS__)) +#define metamacro_take12(...) metamacro_head(__VA_ARGS__), metamacro_take11(metamacro_tail(__VA_ARGS__)) +#define metamacro_take13(...) metamacro_head(__VA_ARGS__), metamacro_take12(metamacro_tail(__VA_ARGS__)) +#define metamacro_take14(...) metamacro_head(__VA_ARGS__), metamacro_take13(metamacro_tail(__VA_ARGS__)) +#define metamacro_take15(...) metamacro_head(__VA_ARGS__), metamacro_take14(metamacro_tail(__VA_ARGS__)) +#define metamacro_take16(...) metamacro_head(__VA_ARGS__), metamacro_take15(metamacro_tail(__VA_ARGS__)) +#define metamacro_take17(...) metamacro_head(__VA_ARGS__), metamacro_take16(metamacro_tail(__VA_ARGS__)) +#define metamacro_take18(...) metamacro_head(__VA_ARGS__), metamacro_take17(metamacro_tail(__VA_ARGS__)) +#define metamacro_take19(...) metamacro_head(__VA_ARGS__), metamacro_take18(metamacro_tail(__VA_ARGS__)) +#define metamacro_take20(...) metamacro_head(__VA_ARGS__), metamacro_take19(metamacro_tail(__VA_ARGS__)) + +// metamacro_drop expansions +#define metamacro_drop0(...) __VA_ARGS__ +#define metamacro_drop1(...) metamacro_tail(__VA_ARGS__) +#define metamacro_drop2(...) metamacro_drop1(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop3(...) metamacro_drop2(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop4(...) metamacro_drop3(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop5(...) metamacro_drop4(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop6(...) metamacro_drop5(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop7(...) metamacro_drop6(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop8(...) metamacro_drop7(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop9(...) metamacro_drop8(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop10(...) metamacro_drop9(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop11(...) metamacro_drop10(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop12(...) metamacro_drop11(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop13(...) metamacro_drop12(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop14(...) metamacro_drop13(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop15(...) metamacro_drop14(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop16(...) metamacro_drop15(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop17(...) metamacro_drop16(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop18(...) metamacro_drop17(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop19(...) metamacro_drop18(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop20(...) metamacro_drop19(metamacro_tail(__VA_ARGS__)) + +#endif diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Modules/module.modulemap b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Modules/module.modulemap new file mode 100644 index 0000000..9f957de --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module ReactiveCocoa { + umbrella header "ReactiveCocoa.h" + + export * + module * { export * } +} diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/ReactiveCocoa b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/ReactiveCocoa new file mode 100755 index 0000000..d7c140d Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/ReactiveCocoa differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Resources/Info.plist b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Resources/Info.plist new file mode 100644 index 0000000..4060f0a --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,47 @@ + + + + + BuildMachineOSBuild + 14C1514 + CFBundleDevelopmentRegion + en + CFBundleExecutable + ReactiveCocoa + CFBundleIdentifier + org.reactivecocoa.ReactiveCocoa + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ReactiveCocoa + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 6C131e + DTPlatformVersion + GM + DTSDKBuild + 14A383 + DTSDKName + macosx10.10 + DTXcode + 0620 + DTXcodeBuild + 6C131e + NSHumanReadableCopyright + Copyright © 2014 GitHub. All rights reserved. + UIDeviceFamily + + 1 + 2 + + + diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/Current b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper EH.app/Contents/Info.plist b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper EH.app/Contents/Info.plist new file mode 100644 index 0000000..8f97974 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper EH.app/Contents/Info.plist @@ -0,0 +1,30 @@ + + + + + BuildMachineOSBuild + 13F34 + CFBundleDisplayName + Electron Helper EH + CFBundleExecutable + Electron Helper EH + CFBundleIdentifier + com.github.electron.helper.EH + CFBundleName + Electron Helper EH + CFBundlePackageType + APPL + DTSDKBuild + 13C64 + DTSDKName + macosx + DTXcode + 0511 + DTXcodeBuild + 5B1008 + LSUIElement + + NSSupportsAutomaticGraphicsSwitching + + + diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper EH.app/Contents/MacOS/Shrug Helper EH b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper EH.app/Contents/MacOS/Shrug Helper EH new file mode 100755 index 0000000..eb9973f Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper EH.app/Contents/MacOS/Shrug Helper EH differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper EH.app/Contents/PkgInfo b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper EH.app/Contents/PkgInfo new file mode 100644 index 0000000..bd04210 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper EH.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPL???? \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper NP.app/Contents/Info.plist b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper NP.app/Contents/Info.plist new file mode 100644 index 0000000..8cb2ea2 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper NP.app/Contents/Info.plist @@ -0,0 +1,30 @@ + + + + + BuildMachineOSBuild + 13F34 + CFBundleDisplayName + Electron Helper NP + CFBundleExecutable + Electron Helper NP + CFBundleIdentifier + com.github.electron.helper.NP + CFBundleName + Electron Helper NP + CFBundlePackageType + APPL + DTSDKBuild + 13C64 + DTSDKName + macosx + DTXcode + 0511 + DTXcodeBuild + 5B1008 + LSUIElement + + NSSupportsAutomaticGraphicsSwitching + + + diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper NP.app/Contents/MacOS/Shrug Helper NP b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper NP.app/Contents/MacOS/Shrug Helper NP new file mode 100755 index 0000000..24b1b2f Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper NP.app/Contents/MacOS/Shrug Helper NP differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper NP.app/Contents/PkgInfo b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper NP.app/Contents/PkgInfo new file mode 100644 index 0000000..bd04210 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper NP.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPL???? \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper.app/Contents/Info.plist b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper.app/Contents/Info.plist new file mode 100644 index 0000000..16f1df9 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper.app/Contents/Info.plist @@ -0,0 +1,28 @@ + + + + + BuildMachineOSBuild + 13F34 + CFBundleIdentifier + com.electron.shrug.helper + CFBundleName + Shrug + CFBundlePackageType + APPL + DTSDKBuild + 13C64 + DTSDKName + macosx + DTXcode + 0511 + DTXcodeBuild + 5B1008 + LSUIElement + + NSSupportsAutomaticGraphicsSwitching + + CFBundleURLTypes + + + \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper.app/Contents/MacOS/Shrug Helper b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper.app/Contents/MacOS/Shrug Helper new file mode 100755 index 0000000..eb9973f Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper.app/Contents/MacOS/Shrug Helper differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper.app/Contents/PkgInfo b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper.app/Contents/PkgInfo new file mode 100644 index 0000000..bd04210 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Shrug Helper.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPL???? \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Headers b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Headers new file mode 120000 index 0000000..a177d2a --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Headers @@ -0,0 +1 @@ +Versions/Current/Headers \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Modules b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Modules new file mode 120000 index 0000000..5736f31 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Modules @@ -0,0 +1 @@ +Versions/Current/Modules \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Resources b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Squirrel b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Squirrel new file mode 120000 index 0000000..af91e72 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Squirrel @@ -0,0 +1 @@ +Versions/Current/Squirrel \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/NSBundle+SQRLVersionExtensions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/NSBundle+SQRLVersionExtensions.h new file mode 100644 index 0000000..d53f35d --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/NSBundle+SQRLVersionExtensions.h @@ -0,0 +1,17 @@ +// +// NSBundle+SQRLVersionExtensions.h +// Squirrel +// +// Created by Justin Spahr-Summers on 2013-09-25. +// Copyright (c) 2013 GitHub. All rights reserved. +// + +#import + +@interface NSBundle (SQRLVersionExtensions) + +// The value associated with the `CFBundleVersion` key in the receiver's +// Info.plist, or nil if the key is not present. +@property (nonatomic, copy, readonly) NSString *sqrl_bundleVersion; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/NSProcessInfo+SQRLVersionExtensions.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/NSProcessInfo+SQRLVersionExtensions.h new file mode 100644 index 0000000..7c419c3 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/NSProcessInfo+SQRLVersionExtensions.h @@ -0,0 +1,16 @@ +// +// NSProcessInfo+SQRLVersionExtensions.h +// Squirrel +// +// Created by Justin Spahr-Summers on 2013-09-16. +// Copyright (c) 2013 GitHub. All rights reserved. +// + +#import + +@interface NSProcessInfo (SQRLVersionExtensions) + +// The short version string (e.g. `10.8.5`) for the running version of OS X. +@property (nonatomic, copy, readonly) NSString *sqrl_operatingSystemShortVersionString; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/SQRLDownloadedUpdate.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/SQRLDownloadedUpdate.h new file mode 100644 index 0000000..22f86a1 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/SQRLDownloadedUpdate.h @@ -0,0 +1,31 @@ +// +// SQRLDownloadedUpdate.h +// Squirrel +// +// Created by Justin Spahr-Summers on 2013-09-25. +// Copyright (c) 2013 GitHub. All rights reserved. +// + +#import + +@class SQRLUpdate; + +// A SQRLUpdate that has been successfully downloaded to disk. +@interface SQRLDownloadedUpdate : MTLModel + +// The application bundle representing the downloaded and unarchived update. +@property (nonatomic, strong, readonly) NSBundle *bundle; + +// The update information sent by the server. +// +// This may be a `SQRLUpdate` subclass if `SQRLUpdater.updateClass` was changed. +@property (nonatomic, copy, readonly) SQRLUpdate *update; + +// Initializes the receiver with update metadata and the downloaded and +// unarchived bundle. +// +// update - The update information sent by the server. This must not be nil. +// bundle - The application bundle representing the update. This must not be nil. +- (id)initWithUpdate:(SQRLUpdate *)update bundle:(NSBundle *)bundle; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/SQRLUpdate.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/SQRLUpdate.h new file mode 100644 index 0000000..9e98f0e --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/SQRLUpdate.h @@ -0,0 +1,31 @@ +// +// SQRLUpdate.h +// Squirrel +// +// Created by Keith Duncan on 18/09/2013. +// Copyright (c) 2013 GitHub. All rights reserved. +// + +#import +#import + +// An update parsed from a response to the `SQRLUpdater.updateRequest`. +// +// This can be subclassed, and `SQRLUpdater.updateClass` set, to preserve +// additional JSON data. Any subclasses must be immutable, and should inherit +// their superclass' property key and transformer behaviors. +@interface SQRLUpdate : MTLModel + +// The release notes for the update. +@property (readonly, copy, nonatomic) NSString *releaseNotes; + +// The release name for the update. +@property (readonly, copy, nonatomic) NSString *releaseName; + +// The release date for the update. +@property (readonly, copy, nonatomic) NSDate *releaseDate; + +// The URL to the update package that should be downloaded for installation. +@property (readonly, copy, nonatomic) NSURL *updateURL; + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/SQRLUpdater.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/SQRLUpdater.h new file mode 100644 index 0000000..4917f41 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/SQRLUpdater.h @@ -0,0 +1,145 @@ +// +// SQRLUpdater.h +// Squirrel +// +// Created by Justin Spahr-Summers on 2013-07-21. +// Copyright (c) 2013 GitHub. All rights reserved. +// + +#import +#import + +// Represents the current state of the updater. +// +// SQRLUpdaterStateIdle - Doing absolutely diddly squat. +// SQRLUpdaterStateCheckingForUpdate - Checking for any updates from the server. +// SQRLUpdaterStateDownloadingUpdate - Update found, downloading the archive. +// SQRLUpdaterStateAwaitingRelaunch - Awaiting a relaunch to install +// the update. +typedef enum : NSUInteger { + SQRLUpdaterStateIdle, + SQRLUpdaterStateCheckingForUpdate, + SQRLUpdaterStateDownloadingUpdate, + SQRLUpdaterStateAwaitingRelaunch, +} SQRLUpdaterState; + +// The domain for errors originating within SQRLUpdater. +extern NSString * const SQRLUpdaterErrorDomain; + +// The downloaded update does not contain an app bundle, or it was deleted on +// disk before we could get to it. +extern const NSInteger SQRLUpdaterErrorMissingUpdateBundle; + +// An error occurred in the out-of-process updater while it was setting up. +extern const NSInteger SQRLUpdaterErrorPreparingUpdateJob; + +// The code signing requirement for the running application could not be +// retrieved. +extern const NSInteger SQRLUpdaterErrorRetrievingCodeSigningRequirement; + +// The server sent a response that we didn't understand. +// +// Includes `SQRLUpdaterServerDataErrorKey` in the error's `userInfo`. +extern const NSInteger SQRLUpdaterErrorInvalidServerResponse; + +// The server sent a response body that we didn't understand. +// +// Includes `SQRLUpdaterServerDataErrorKey` in the error's `userInfo`. +extern const NSInteger SQRLUpdaterErrorInvalidServerBody; + +// The server sent update JSON that we didn't understand. +// +// Includes `SQRLUpdaterJSONObjectErrorKey` in the error's `userInfo`. +extern const NSInteger SQRLUpdaterErrorInvalidJSON; + +// Associated with the `NSData` received from the server when an error with code +// `SQRLUpdaterErrorInvalidServerResponse` is generated. +extern NSString * const SQRLUpdaterServerDataErrorKey; + +// Associated with the JSON object that was received from the server when an +// error with code `SQRLUpdaterErrorInvalidJSON` is generated. +extern NSString * const SQRLUpdaterJSONObjectErrorKey; + +@class RACCommand; +@class RACDisposable; +@class RACSignal; + +// Checks for, downloads, and installs updates. +@interface SQRLUpdater : NSObject + +// Kicks off a check for updates. +// +// If an update is available, it will be sent on `updates` once downloaded. +@property (nonatomic, strong, readonly) RACCommand *checkForUpdatesCommand; + +// The current state of the manager. +// +// This property is KVO-compliant. +@property (atomic, readonly) SQRLUpdaterState state; + +// Sends an `SQRLDownloadedUpdate` object on the main thread whenever a new +// update is available. +// +// This signal is actually just `checkForUpdatesCommand.executionSignals`, +// flattened for convenience. +@property (nonatomic, strong, readonly) RACSignal *updates; + +// The request that will be sent to check for updates. +// +// The default value is the argument that was originally passed to +// -initWithUpdateRequest:. +// +// This property must never be set to nil. +@property (atomic, copy) NSURLRequest *updateRequest; + +// The `SQRLUpdate` subclass to instantiate with the server's response. +// +// By default, this is `SQRLUpdate` itself, but it can be set to a custom +// subclass in order to preserve additional JSON data. See the `SQRLUpdate` +// documentation for more information. +@property (atomic, strong) Class updateClass; + +// Initializes an updater that will send the given request to check for updates. +// +// This is the designated initializer for this class. +// +// updateRequest - A request to send to check for updates. This request can be +// customized as desired, like by including an `Authorization` +// header to authenticate with a private update server, or +// pointing to a local URL for testing. This must not be nil. +// +// Returns the initialized `SQRLUpdater`. +- (id)initWithUpdateRequest:(NSURLRequest *)updateRequest; + +// Executes `checkForUpdatesCommand` (if enabled) every `interval` seconds. +// +// The first check will not occur until `interval` seconds have passed. +// +// interval - The interval, in seconds, between each check. +// +// Returns a disposable which can be used to cancel the automatic update +// checking. +- (RACDisposable *)startAutomaticChecksWithInterval:(NSTimeInterval)interval; + +// Terminates the running application to install any available update, then +// automatically relaunches the app after updating. +// +// This method is only useful if you want the application to automatically +// relaunch. Otherwise, you can simply use `-[NSApplication terminate:]` or any +// other exit mechanism. +// +// After invoking this method, the receiver is responsible for terminating the +// application upon success. The app must not be terminated in any other way +// unless an error occurs. +// +// Returns a signal that will error on the main scheduler if anything goes +// wrong before termination. The signal will never complete. +- (RACSignal *)relaunchToInstallUpdate; + +@end + +@interface SQRLUpdater (Unavailable) + +- (id)init __attribute__((unavailable("Use -initWithUpdateRequest: instead"))); + +@end diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/Squirrel.h b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/Squirrel.h new file mode 100644 index 0000000..23dc330 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Headers/Squirrel.h @@ -0,0 +1,21 @@ +// +// Squirrel.h +// Squirrel +// +// Created by Justin Spahr-Summers on 2013-07-21. +// Copyright (c) 2013 GitHub. All rights reserved. +// + +#import + +//! Project version number for Squirrel. +FOUNDATION_EXPORT double SquirrelVersionNumber; + +//! Project version string for Squirrel. +FOUNDATION_EXPORT const unsigned char SquirrelVersionString[]; + +#import +#import +#import +#import +#import diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Modules/module.modulemap b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Modules/module.modulemap new file mode 100644 index 0000000..b31af5f --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module Squirrel { + umbrella header "Squirrel.h" + + export * + module * { export * } +} diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Resources/Info.plist b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Resources/Info.plist new file mode 100644 index 0000000..612419b --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,42 @@ + + + + + BuildMachineOSBuild + 14C1514 + CFBundleDevelopmentRegion + English + CFBundleExecutable + Squirrel + CFBundleIdentifier + com.github.Squirrel + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Squirrel + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 6C131e + DTPlatformVersion + GM + DTSDKBuild + 14A383 + DTSDKName + macosx10.10 + DTXcode + 0620 + DTXcodeBuild + 6C131e + NSHumanReadableCopyright + Copyright © 2013 GitHub. All rights reserved. + + diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Resources/ShipIt b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Resources/ShipIt new file mode 100755 index 0000000..7e6823e Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Resources/ShipIt differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Squirrel b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Squirrel new file mode 100755 index 0000000..ae1c0ac Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/A/Squirrel differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/Current b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Frameworks/Squirrel.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Info.plist b/Shrug-darwin-x64/Shrug.app/Contents/Info.plist new file mode 100644 index 0000000..fb4bc85 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Info.plist @@ -0,0 +1,44 @@ + + + + + BuildMachineOSBuild + 13F34 + CFBundleDisplayName + Shrug + CFBundleExecutable + Electron + CFBundleIconFile + atom.icns + CFBundleIdentifier + com.electron.shrug + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Shrug + CFBundlePackageType + APPL + CFBundleVersion + 0.30.3 + DTSDKBuild + 13C64 + DTSDKName + macosx + DTXcode + 0511 + DTXcodeBuild + 5B1008 + LSMinimumSystemVersion + 10.8.0 + NSHighResolutionCapable + + NSMainNibFile + MainMenu + NSPrincipalClass + AtomApplication + NSSupportsAutomaticGraphicsSwitching + + CFBundleURLTypes + + + \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/MacOS/Electron b/Shrug-darwin-x64/Shrug.app/Contents/MacOS/Electron new file mode 100755 index 0000000..a943731 Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/MacOS/Electron differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/PkgInfo b/Shrug-darwin-x64/Shrug.app/Contents/PkgInfo new file mode 100644 index 0000000..bd04210 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPL???? \ No newline at end of file diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/.gitignore b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/.gitignore new file mode 100644 index 0000000..25cf50b --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +debug.log +npm-debug.log +node_modules/ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/Icon.icns b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/Icon.icns new file mode 100644 index 0000000..e168886 Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/Icon.icns differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/IconTemplate.png b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/IconTemplate.png new file mode 100644 index 0000000..3f4c5e6 Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/IconTemplate.png differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/IconTemplate@2x.png b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/IconTemplate@2x.png new file mode 100644 index 0000000..7a41087 Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/IconTemplate@2x.png differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/index.html b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/index.html new file mode 100644 index 0000000..2be11e6 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/index.html @@ -0,0 +1,16 @@ + + + + + + Shrug + + +
+
+

¯\_(ツ)_/¯

+

Copied to clipboard

+
+
+ + diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/main.js b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/main.js new file mode 100755 index 0000000..3892312 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/main.js @@ -0,0 +1,42 @@ +var menubar = require('menubar') +var clipboard = require('clipboard') +var globalShortcut = require('global-shortcut') + +var mb = menubar({ + width: 200, + height: 100, + preloadWindow: true, +}) + +mb.on('ready', function ready(){ + var ret = globalShortcut.register('ctrl+alt+\\', function() { + console.log('ctrl+alt+\\ is pressed') + // Emit show event + mb.showWindow() + // Move to center of screen, cannot get tray position to simulate click + mb.positioner.move('center') + // Wait one second, then close window + setTimeout(function(){ + mb.hideWindow() + }, 1000) + + }) + + if (!ret) { + console.log('registration failed') + } + + // Check whether a shortcut is registered + console.log(globalShortcut.isRegistered('ctrl+alt+\\')) +}) + +// When menubar opens +mb.on('show', function ready () { + clipboard.writeText('¯\\_(ツ)_/¯') +}) + +// When menubar application closes +mb.on('will-quit', function ready(){ + // Unregister all shortcuts. + globalShortcut.unregisterAll() +}) diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/package.json b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/package.json new file mode 100644 index 0000000..e72afc0 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/package.json @@ -0,0 +1,17 @@ +{ + "name": "shrug-menubar-app", + "version": "1.0.0", + "description": "Shrug menubar electron app", + "dependencies": { + "menubar": "*" + }, + "devDependencies": { + "electron-packager": "^5.0.1", + "electron-prebuilt": "0.30.3" + }, + "main": "main.js", + "scripts": { + "build": "electron-packager . Shrug --platform=darwin --arch=x64 --version=0.30.3 --ignore=node_modules/electron --icon=Icon.icns", + "start": "electron . && cssnext styles-src.css styles.css" + } +} diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/readme.md b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/readme.md new file mode 100644 index 0000000..2ec5ccc --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/readme.md @@ -0,0 +1,14 @@ +# ¯\\_(ツ)_/¯ + +## about +Menubar app for copying the `¯\_(ツ)_/¯` emoji to your clipboard. App uses Max Ogden's menubar module. + +## usage +- Clicking the icon in the menu bar will copy `¯\_(ツ)_/¯` to your clipboard. Now you can paste away! +- `ctrl + alt + \` will also copy `¯\_(ツ)_/¯` to your clipboard. A small window will show to confirm! + +## instructions + +- run `npm install` +- run `npm run build` to make .app +- run `npm start` to run app from CLI without building .app diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/styles-src.css b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/styles-src.css new file mode 100644 index 0000000..602981e --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/styles-src.css @@ -0,0 +1,5 @@ +@import 'basscss'; + +html{ + background: none; +} diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/styles.css b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/styles.css new file mode 100644 index 0000000..b776e47 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Resources/app/styles.css @@ -0,0 +1,902 @@ +body { margin: 0 } +img { max-width: 100% } +svg { max-height: 100% } +/* Basscss Base Forms */ + +input, +select, +textarea, +fieldset { + font-family: inherit; + font-size: 16px; + font-size: 1rem; + box-sizing: border-box; + margin-top: 0; + margin-bottom: 0; +} + +label { + vertical-align: middle; +} + +input[type=text], +input[type=date], +input[type=datetime], +input[type=datetime-local], +input[type=email], +input[type=month], +input[type=number], +input[type=password], +input[type=search], +input[type=tel], +input[type=time], +input[type=url], +input[type=week] { + height: 36px; + height: 2.25rem; + padding: 8px 8px; + padding: .5rem .5rem; + vertical-align: middle; + -webkit-appearance: none; +} + +select { + line-height: 1.75; + padding: 8px 8px; + padding: .5rem .5rem; +} + +select:not([multiple]) { + height: 36px; + height: 2.25rem; + vertical-align: middle; +} + +textarea { + line-height: 1.75; + padding: 8px 8px; + padding: .5rem .5rem; +} + +/* Basscss Defaults */ + +/* + + COLOR VARIABLES + + - Cool + - Warm + - Gray Scale + +*/ + +:root { + + /* Cool */ + + + /* Warm */ + + + /* Gray scale */ + +} +/* Basscss Base Tables */ + +table { + border-collapse: separate; + border-spacing: 0; + max-width: 100%; + width: 100%; +} + +th { + text-align: left; + font-weight: bold; +} + +th, +td { + padding: 4px 16px; + padding: .25rem 1rem; + line-height: inherit; +} + +th { vertical-align: bottom } +td { vertical-align: top } +/* Basscss Base Typography */ + +body { + font-family: 'Helvetica Neue', Helvetica, sans-serif; + line-height: 1.5; + font-size: 100%; +} + +h1, h2, h3, h4, h5, h6 { + font-family: 'Helvetica Neue', Helvetica, sans-serif; + font-weight: bold; + line-height: 1.25; + margin-top: 1em; + margin-bottom: .5em; +} + +p { + margin-top: 0; + margin-bottom: 16px; + margin-bottom: 1rem; +} + +dl, ol, ul { + margin-top: 0; + margin-bottom: 16px; + margin-bottom: 1rem; +} + +pre, code, samp { + font-family: 'Source Code Pro', Consolas, monospace; + font-size: inherit; +} + +pre { + margin-top: 0; + margin-bottom: 16px; + margin-bottom: 1rem; + overflow-x: scroll; +} + +h1 { font-size: 32px; font-size: 2rem } +h2 { font-size: 24px; font-size: 1.5rem } +h3 { font-size: 20px; font-size: 1.25rem } +h4 { font-size: 16px; font-size: 1rem } +h5 { font-size: 14px; font-size: .875rem } +h6 { font-size: 12px; font-size: .75rem } +/* Basscss Color Base */ + +body { + color: #111; + background-color: #fff; +} + +a { + color: #0074d9; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +pre, code { + background-color: transparent; + border-radius: 3px; +} + +hr { + border: 0; + border-bottom-style: solid; + border-bottom-width: 1px; + border-bottom-color: rgba(0,0,0,.125); +} +/* Basscss Color Forms */ + +.field { + border-style: solid; + border-width: 1px; + border-color: #000000; + border-color: rgba(0,0,0,.125); + border-radius: 3px; +} + +.field:focus, +.field.is-focused { + outline: none; + border-color: #0074d9; + box-shadow: 0 0 0 2px rgba(0, 116, 217, 0.5); +} + +.field:disabled, +.field.is-disabled { + background-color: #000000; + background-color: rgba(0,0,0,.125); + opacity: .5; +} + +.field:read-only:not(select), +.field.is-read-only { + background-color: #000000; + background-color: rgba(0,0,0,.125); +} + + +.field.is-success { + border-color: #2ecc40; +} + +.field.is-success:focus, +.field.is-success.is-focused { + box-shadow: 0 0 0 2px rgba(46, 204, 64, 0.5); +} + +.field.is-warning { + border-color: #ffdc00; +} + +.field.is-warning:focus, +.field.is-warning.is-focused { + box-shadow: 0 0 0 2px rgba(255, 220, 0, 0.5); +} + +.field:invalid, +.field.is-error { + border-color: #ff4136; +} + +.field:invalid:focus, +.field:invalid.is-focused, +.field.is-error:focus, +.field.is-error.is-focused { + box-shadow: 0 0 0 2px rgba(255, 65, 54, 0.5); +} +/* Basscss Color Tables */ + +.table-light th, +.table-light td { + border-bottom-width: 1px; + border-bottom-style: solid; + border-bottom-color: rgba(0,0,0,.125); +} + +.table-light tr:last-child td { + border-bottom: 0; +} +/* Basscss Btn */ + +.btn { + font-family: inherit; + font-size: inherit; + font-weight: bold; + font-weight: bold; + text-decoration: none; + cursor: pointer; + display: inline-block; + line-height: 18px; + line-height: 1.125rem; + padding: 8px 16px; + padding: .5rem 1rem; + margin: 0; + height: auto; + border: 1px solid transparent; + vertical-align: middle; + -webkit-appearance: none; + color: inherit; + background-color: transparent; +} + +.btn:hover { + text-decoration: none; +} + +.btn:focus { + outline: none; + border-color: #000000; + border-color: rgba(0,0,0,.125); + box-shadow: 0 0 0 3px rgba(0,0,0,.25); +} + +::-moz-focus-inner { + border: 0; + padding: 0; +} +/* Basscss Btn Primary */ + +.btn-primary { + color: #fff; + background-color: #0074d9; + border-radius: 3px; +} + +.btn-primary:hover { + box-shadow: inset 0 0 0 20rem rgba(0,0,0,.0625); +} + +.btn-primary:active { + box-shadow: inset 0 0 0 20rem rgba(0,0,0,.125), + inset 0 3px 4px 0 rgba(0,0,0,.25), + 0 0 1px rgba(0,0,0,.125); +} + +.btn-primary:disabled, +.btn-primary.is-disabled { + opacity: .5; +} +/* Basscss Btn Outline */ + +.btn-outline, +.btn-outline:hover { + border-color: currentcolor; +} + +.btn-outline { + border-radius: 3px; +} + +.btn-outline:hover { + box-shadow: inset 0 0 0 20rem rgba(0,0,0,.0625); +} + +.btn-outline:active { + box-shadow: inset 0 0 0 20rem rgba(0,0,0,.125), + inset 0 3px 4px 0 rgba(0,0,0,.25), + 0 0 1px rgba(0,0,0,.125); +} + +.btn-outline:disabled, +.btn-outline.is-disabled { + opacity: .5; +} +/* Basscss Type Scale */ + +.h1 { font-size: 32px; font-size: 2rem } +.h2 { font-size: 24px; font-size: 1.5rem } +.h3 { font-size: 20px; font-size: 1.25rem } +.h4 { font-size: 16px; font-size: 1rem } +.h5 { font-size: 14px; font-size: .875rem } +.h6 { font-size: 12px; font-size: .75rem } +/* Basscss Utility Typography */ + +.bold { font-weight: bold; font-weight: bold } +.regular { font-weight: normal } +.italic { font-style: italic } +.caps { text-transform: uppercase; letter-spacing: .2em; } + +.left-align { text-align: left } +.center { text-align: center } +.right-align { text-align: right } +.justify { text-align: justify } + +.nowrap { white-space: nowrap } +.break-word { word-wrap: break-word } + +.truncate { + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.list-reset { + list-style: none; + padding-left: 0; +} +/* Basscss Utility Layout */ + +.inline { display: inline } +.block { display: block } +.inline-block { display: inline-block } +.table { display: table } +.table-cell { display: table-cell } + +.overflow-hidden { overflow: hidden } +.overflow-scroll { overflow: scroll } +.overflow-auto { overflow: auto } + +.clearfix:before, +.clearfix:after { + content: " "; + display: table +} +.clearfix:after { clear: both } + +.left { float: left } +.right { float: right } + +.fit { max-width: 100% } + +.border-box { box-sizing: border-box } +/* Basscss Align */ + +.align-baseline { vertical-align: baseline } +.align-top { vertical-align: top } +.align-middle { vertical-align: middle } +.align-bottom { vertical-align: bottom } +/* Basscss Utility White Space */ + +.m0 { margin: 0 } +.mt0 { margin-top: 0 } +.mr0 { margin-right: 0 } +.mb0 { margin-bottom: 0 } +.ml0 { margin-left: 0 } + +.m1 { margin: 8px; margin: .5rem } +.mt1 { margin-top: 8px; margin-top: .5rem } +.mr1 { margin-right: 8px; margin-right: .5rem } +.mb1 { margin-bottom: 8px; margin-bottom: .5rem } +.ml1 { margin-left: 8px; margin-left: .5rem } + +.m2 { margin: 16px; margin: 1rem } +.mt2 { margin-top: 16px; margin-top: 1rem } +.mr2 { margin-right: 16px; margin-right: 1rem } +.mb2 { margin-bottom: 16px; margin-bottom: 1rem } +.ml2 { margin-left: 16px; margin-left: 1rem } + +.m3 { margin: 32px; margin: 2rem } +.mt3 { margin-top: 32px; margin-top: 2rem } +.mr3 { margin-right: 32px; margin-right: 2rem } +.mb3 { margin-bottom: 32px; margin-bottom: 2rem } +.ml3 { margin-left: 32px; margin-left: 2rem } + +.m4 { margin: 64px; margin: 4rem } +.mt4 { margin-top: 64px; margin-top: 4rem } +.mr4 { margin-right: 64px; margin-right: 4rem } +.mb4 { margin-bottom: 64px; margin-bottom: 4rem } +.ml4 { margin-left: 64px; margin-left: 4rem } + +.mxn1 { margin-left: -8px; margin-left: -.5rem; margin-right: -8px; margin-right: -.5rem; } +.mxn2 { margin-left: -16px; margin-left: -1rem; margin-right: -16px; margin-right: -1rem; } +.mxn3 { margin-left: -32px; margin-left: -2rem; margin-right: -32px; margin-right: -2rem; } +.mxn4 { margin-left: -64px; margin-left: -4rem; margin-right: -64px; margin-right: -4rem; } + +.mx-auto { margin-left: auto; margin-right: auto; } +.p0 { padding: 0 } + +.p1 { padding: 8px; padding: .5rem } +.py1 { padding-top: 8px; padding-top: .5rem; padding-bottom: 8px; padding-bottom: .5rem } +.px1 { padding-left: 8px; padding-left: .5rem; padding-right: 8px; padding-right: .5rem } + +.p2 { padding: 16px; padding: 1rem } +.py2 { padding-top: 16px; padding-top: 1rem; padding-bottom: 16px; padding-bottom: 1rem } +.px2 { padding-left: 16px; padding-left: 1rem; padding-right: 16px; padding-right: 1rem } + +.p3 { padding: 32px; padding: 2rem } +.py3 { padding-top: 32px; padding-top: 2rem; padding-bottom: 32px; padding-bottom: 2rem } +.px3 { padding-left: 32px; padding-left: 2rem; padding-right: 32px; padding-right: 2rem } + +.p4 { padding: 64px; padding: 4rem } +.py4 { padding-top: 64px; padding-top: 4rem; padding-bottom: 64px; padding-bottom: 4rem } +.px4 { padding-left: 64px; padding-left: 4rem; padding-right: 64px; padding-right: 4rem } +/* Basscss Positions */ + +.relative { position: relative } +.absolute { position: absolute } +.fixed { position: fixed } + +.top-0 { top: 0 } +.right-0 { right: 0 } +.bottom-0 { bottom: 0 } +.left-0 { left: 0 } + +.z1 { z-index: 1 } +.z2 { z-index: 2 } +.z3 { z-index: 3 } +.z4 { z-index: 4 } +/* Basscss Utility Responsive States */ + +.sm-show, .md-show, .lg-show { + display: none !important +} + +@media (min-width: 40em) { + .sm-show { display: block !important } +} + +@media (min-width: 52em) { + .md-show { display: block !important } +} + +@media (min-width: 64em) { + .lg-show { display: block !important } +} + + +@media (min-width: 40em) { + .sm-hide { display: none !important } +} + +@media (min-width: 52em) { + .md-hide { display: none !important } +} + +@media (min-width: 64em) { + .lg-hide { display: none !important } +} + +.display-none { display: none !important } + +.hide { + position: absolute !important; + height: 1px; + width: 1px; + overflow: hidden; + clip: rect(1px, 1px, 1px, 1px); +} +/* Basscss Grid */ + +.container { + max-width: 64em; + margin-left: auto; + margin-right: auto; +} +.col { + float: left; + box-sizing: border-box; +} + +.col-right { + float: right; + box-sizing: border-box; +} + +.col-1 { + width: 8.33333%; +} + +.col-2 { + width: 16.66667%; +} + +.col-3 { + width: 25%; +} + +.col-4 { + width: 33.33333%; +} + +.col-5 { + width: 41.66667%; +} + +.col-6 { + width: 50%; +} + +.col-7 { + width: 58.33333%; +} + +.col-8 { + width: 66.66667%; +} + +.col-9 { + width: 75%; +} + +.col-10 { + width: 83.33333%; +} + +.col-11 { + width: 91.66667%; +} + +.col-12 { + width: 100%; +} +@media (min-width: 40em) { + + .sm-col { + float: left; + box-sizing: border-box; + } + + .sm-col-right { + float: right; + box-sizing: border-box; + } + + .sm-col-1 { + width: 8.33333%; + } + + .sm-col-2 { + width: 16.66667%; + } + + .sm-col-3 { + width: 25%; + } + + .sm-col-4 { + width: 33.33333%; + } + + .sm-col-5 { + width: 41.66667%; + } + + .sm-col-6 { + width: 50%; + } + + .sm-col-7 { + width: 58.33333%; + } + + .sm-col-8 { + width: 66.66667%; + } + + .sm-col-9 { + width: 75%; + } + + .sm-col-10 { + width: 83.33333%; + } + + .sm-col-11 { + width: 91.66667%; + } + + .sm-col-12 { + width: 100%; + } + +} +@media (min-width: 52em) { + + .md-col { + float: left; + box-sizing: border-box; + } + + .md-col-right { + float: right; + box-sizing: border-box; + } + + .md-col-1 { + width: 8.33333%; + } + + .md-col-2 { + width: 16.66667%; + } + + .md-col-3 { + width: 25%; + } + + .md-col-4 { + width: 33.33333%; + } + + .md-col-5 { + width: 41.66667%; + } + + .md-col-6 { + width: 50%; + } + + .md-col-7 { + width: 58.33333%; + } + + .md-col-8 { + width: 66.66667%; + } + + .md-col-9 { + width: 75%; + } + + .md-col-10 { + width: 83.33333%; + } + + .md-col-11 { + width: 91.66667%; + } + + .md-col-12 { + width: 100%; + } + +} +@media (min-width: 64em) { + + .lg-col { + float: left; + box-sizing: border-box; + } + + .lg-col-right { + float: right; + box-sizing: border-box; + } + + .lg-col-1 { + width: 8.33333%; + } + + .lg-col-2 { + width: 16.66667%; + } + + .lg-col-3 { + width: 25%; + } + + .lg-col-4 { + width: 33.33333%; + } + + .lg-col-5 { + width: 41.66667%; + } + + .lg-col-6 { + width: 50%; + } + + .lg-col-7 { + width: 58.33333%; + } + + .lg-col-8 { + width: 66.66667%; + } + + .lg-col-9 { + width: 75%; + } + + .lg-col-10 { + width: 83.33333%; + } + + .lg-col-11 { + width: 91.66667%; + } + + .lg-col-12 { + width: 100%; + } + +} +/* Flex Object */ + +.flex { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex } + +.flex-column { -webkit-box-orient: vertical; -webkit-box-direction: normal; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column } +.flex-wrap { -webkit-flex-wrap: wrap; -ms-flex-wrap: wrap; flex-wrap: wrap } + +.flex-center { -webkit-box-align: center; -webkit-align-items: center; -ms-flex-align: center; align-items: center } +.flex-baseline { -webkit-box-align: baseline; -webkit-align-items: baseline; -ms-flex-align: baseline; align-items: baseline } +.flex-stretch { -webkit-box-align: stretch; -webkit-align-items: stretch; -ms-flex-align: stretch; align-items: stretch } +.flex-start { -webkit-box-align: start; -webkit-align-items: flex-start; -ms-flex-align: start; align-items: flex-start } +.flex-end { -webkit-box-align: end; -webkit-align-items: flex-end; -ms-flex-align: end; align-items: flex-end } + +.flex-justify { -webkit-box-pack: justify; -webkit-justify-content: space-between; -ms-flex-pack: justify; justify-content: space-between } + +/* + * 1. Fix for Chrome 44 bug. https://code.google.com/p/chromium/issues/detail?id=506893 + */ + +.flex-auto { + -webkit-box-flex: 1; + -webkit-flex: 1 1 auto; + -ms-flex: 1 1 auto; + flex: 1 1 auto; + min-width: 0; /* 1 */ + min-height: 0; /* 1 */ +} +.flex-grow { -webkit-box-flex: 1; -webkit-flex: 1 0 auto; -ms-flex: 1 0 auto; flex: 1 0 auto } +.flex-none { -webkit-box-flex: 0; -webkit-flex: none; -ms-flex: none; flex: none } + +.flex-first { -webkit-box-ordinal-group: 0; -webkit-order: -1; -ms-flex-order: -1; order: -1 } +.flex-last { -webkit-box-ordinal-group: 100000; -webkit-order: 99999; -ms-flex-order: 99999; order: 99999 } +@media (min-width: 40em) { + .sm-flex { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex } +} +@media (min-width: 52em) { + .md-flex { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex } +} +@media (min-width: 64em) { + .lg-flex { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex } +} +/* Basscss Color Borders */ + +.border { + border-style: solid; + border-width: 1px; + border-color: #000000; + border-color: rgba(0,0,0,.125); +} + +.border-top { + border-top-style: solid; + border-top-width: 1px; + border-top-color: rgba(0,0,0,.125); +} + +.border-right { + border-right-style: solid; + border-right-width: 1px; + border-right-color: rgba(0,0,0,.125); +} + +.border-bottom { + border-bottom-style: solid; + border-bottom-width: 1px; + border-bottom-color: rgba(0,0,0,.125); +} + +.border-left { + border-left-style: solid; + border-left-width: 1px; + border-left-color: rgba(0,0,0,.125); +} + +.border-none { border: 0 } + +.rounded { border-radius: 3px } +.circle { border-radius: 50% } + +.rounded-top { border-radius: 3px 3px 0 0 } +.rounded-right { border-radius: 0 3px 3px 0 } +.rounded-bottom { border-radius: 0 0 3px 3px } +.rounded-left { border-radius: 3px 0 0 3px } + +.not-rounded { border-radius: 0 } +/* Basscss Colors */ + +.black { color: #111 } +.gray { color: #aaa } +.silver { color: #ddd } +.white { color: #fff } + +.aqua { color: #7fdbff } +.blue { color: #0074d9 } +.navy { color: #001f3f } +.teal { color: #39cccc } +.green { color: #2ecc40 } +.olive { color: #3d9970 } +.lime { color: #01ff70 } + +.yellow { color: #ffdc00 } +.orange { color: #ff851b } +.red { color: #ff4136 } +.fuchsia { color: #f012be } +.purple { color: #b10dc9 } +.maroon { color: #85144b } + +.color-inherit { color: inherit } +.muted { opacity: .5 } +/* Basscss Background Colors */ + +.bg-black { background-color: #111 } +.bg-gray { background-color: #aaa } +.bg-silver { background-color: #ddd } +.bg-white { background-color: #fff } + +.bg-aqua { background-color: #7fdbff } +.bg-blue { background-color: #0074d9 } +.bg-navy { background-color: #001f3f } +.bg-teal { background-color: #39cccc } +.bg-green { background-color: #2ecc40 } +.bg-olive { background-color: #3d9970 } +.bg-lime { background-color: #01ff70 } + +.bg-yellow { background-color: #ffdc00 } +.bg-orange { background-color: #ff851b } +.bg-red { background-color: #ff4136 } +.bg-fuchsia { background-color: #f012be } +.bg-purple { background-color: #b10dc9 } +.bg-maroon { background-color: #85144b } + +.bg-darken-1 { background-color: #000000; background-color: rgba(0,0,0,.0625) } +.bg-darken-2 { background-color: #000000; background-color: rgba(0,0,0,.125) } +.bg-darken-3 { background-color: #000000; background-color: rgba(0,0,0,.25) } +.bg-darken-4 { background-color: #000000; background-color: rgba(0,0,0,.5) } + +.bg-lighten-1 { background-color: #FFFFFF; background-color: rgba(255,255,255,.0625) } +.bg-lighten-2 { background-color: #FFFFFF; background-color: rgba(255,255,255,.125) } +.bg-lighten-3 { background-color: #FFFFFF; background-color: rgba(255,255,255,.25) } +.bg-lighten-4 { background-color: #FFFFFF; background-color: rgba(255,255,255,.5) } + +html{ + background: none; +} diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/atom.asar b/Shrug-darwin-x64/Shrug.app/Contents/Resources/atom.asar new file mode 100644 index 0000000..97f1078 Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Resources/atom.asar differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/atom.icns b/Shrug-darwin-x64/Shrug.app/Contents/Resources/atom.icns new file mode 100644 index 0000000..e168886 Binary files /dev/null and b/Shrug-darwin-x64/Shrug.app/Contents/Resources/atom.icns differ diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/default_app/default_app.js b/Shrug-darwin-x64/Shrug.app/Contents/Resources/default_app/default_app.js new file mode 100644 index 0000000..2378902 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Resources/default_app/default_app.js @@ -0,0 +1,20 @@ +var app = require('app'); +var BrowserWindow = require('browser-window'); + +var mainWindow = null; + +// Quit when all windows are closed. +app.on('window-all-closed', function() { + app.quit(); +}); + +app.on('ready', function() { + mainWindow = new BrowserWindow({ + width: 800, + height: 600, + 'auto-hide-menu-bar': true, + 'use-content-size': true, + }); + mainWindow.loadUrl('file://' + __dirname + '/index.html'); + mainWindow.focus(); +}); diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/default_app/index.html b/Shrug-darwin-x64/Shrug.app/Contents/Resources/default_app/index.html new file mode 100644 index 0000000..96e4580 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Resources/default_app/index.html @@ -0,0 +1,121 @@ + + + Electron + + + + + +

Welcome to Electron

+ +

+ To run your app with Electron, execute the following command under your + Console (or Terminal): +

+ + + +

+ The path-to-your-app should be the path to your own Electron + app, you can read the quick start + guide in Electron's docs + on how to write one. +

+ +

+ Or you can just drag your app here to run it: +

+ +
+ Drag your app here to run it +
+ + + + diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/default_app/main.js b/Shrug-darwin-x64/Shrug.app/Contents/Resources/default_app/main.js new file mode 100644 index 0000000..fd3a6b5 --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Resources/default_app/main.js @@ -0,0 +1,324 @@ +var app = require('app'); +var dialog = require('dialog'); +var fs = require('fs'); +var path = require('path'); +var Menu = require('menu'); +var BrowserWindow = require('browser-window'); + +// Quit when all windows are closed and no other one is listening to this. +app.on('window-all-closed', function() { + if (app.listeners('window-all-closed').length == 1) + app.quit(); +}); + +// Parse command line options. +var argv = process.argv.slice(1); +var option = { file: null, help: null, version: null, webdriver: null }; +for (var i in argv) { + if (argv[i] == '--version' || argv[i] == '-v') { + option.version = true; + break; + } else if (argv[i] == '--help' || argv[i] == '-h') { + option.help = true; + break; + } else if (argv[i] == '--test-type=webdriver') { + option.webdriver = true; + } else if (argv[i][0] == '-') { + continue; + } else { + option.file = argv[i]; + break; + } +} + +// Create default menu. +app.once('ready', function() { + if (Menu.getApplicationMenu()) + return; + + var template; + if (process.platform == 'darwin') { + template = [ + { + label: 'Electron', + submenu: [ + { + label: 'About Electron', + selector: 'orderFrontStandardAboutPanel:' + }, + { + type: 'separator' + }, + { + label: 'Services', + submenu: [] + }, + { + type: 'separator' + }, + { + label: 'Hide Electron', + accelerator: 'Command+H', + selector: 'hide:' + }, + { + label: 'Hide Others', + accelerator: 'Command+Shift+H', + selector: 'hideOtherApplications:' + }, + { + label: 'Show All', + selector: 'unhideAllApplications:' + }, + { + type: 'separator' + }, + { + label: 'Quit', + accelerator: 'Command+Q', + click: function() { app.quit(); } + }, + ] + }, + { + label: 'Edit', + submenu: [ + { + label: 'Undo', + accelerator: 'Command+Z', + selector: 'undo:' + }, + { + label: 'Redo', + accelerator: 'Shift+Command+Z', + selector: 'redo:' + }, + { + type: 'separator' + }, + { + label: 'Cut', + accelerator: 'Command+X', + selector: 'cut:' + }, + { + label: 'Copy', + accelerator: 'Command+C', + selector: 'copy:' + }, + { + label: 'Paste', + accelerator: 'Command+V', + selector: 'paste:' + }, + { + label: 'Select All', + accelerator: 'Command+A', + selector: 'selectAll:' + }, + ] + }, + { + label: 'View', + submenu: [ + { + label: 'Reload', + accelerator: 'Command+R', + click: function() { + var focusedWindow = BrowserWindow.getFocusedWindow(); + if (focusedWindow) + focusedWindow.reload(); + } + }, + { + label: 'Toggle Full Screen', + accelerator: 'Ctrl+Command+F', + click: function() { + var focusedWindow = BrowserWindow.getFocusedWindow(); + if (focusedWindow) + focusedWindow.setFullScreen(!focusedWindow.isFullScreen()); + } + }, + { + label: 'Toggle Developer Tools', + accelerator: 'Alt+Command+I', + click: function() { + var focusedWindow = BrowserWindow.getFocusedWindow(); + if (focusedWindow) + focusedWindow.toggleDevTools(); + } + }, + ] + }, + { + label: 'Window', + submenu: [ + { + label: 'Minimize', + accelerator: 'Command+M', + selector: 'performMiniaturize:' + }, + { + label: 'Close', + accelerator: 'Command+W', + selector: 'performClose:' + }, + { + type: 'separator' + }, + { + label: 'Bring All to Front', + selector: 'arrangeInFront:' + }, + ] + }, + { + label: 'Help', + submenu: [ + { + label: 'Learn More', + click: function() { require('shell').openExternal('http://electron.atom.io') } + }, + { + label: 'Documentation', + click: function() { require('shell').openExternal('https://github.com/atom/electron/tree/master/docs#readme') } + }, + { + label: 'Community Discussions', + click: function() { require('shell').openExternal('https://discuss.atom.io/c/electron') } + }, + { + label: 'Search Issues', + click: function() { require('shell').openExternal('https://github.com/atom/electron/issues') } + } + ] + } + ]; + } else { + template = [ + { + label: '&File', + submenu: [ + { + label: '&Open', + accelerator: 'Ctrl+O', + }, + { + label: '&Close', + accelerator: 'Ctrl+W', + click: function() { + var focusedWindow = BrowserWindow.getFocusedWindow(); + if (focusedWindow) + focusedWindow.close(); + } + }, + ] + }, + { + label: '&View', + submenu: [ + { + label: '&Reload', + accelerator: 'Ctrl+R', + click: function() { + var focusedWindow = BrowserWindow.getFocusedWindow(); + if (focusedWindow) + focusedWindow.reload(); + } + }, + { + label: 'Toggle &Full Screen', + accelerator: 'F11', + click: function() { + var focusedWindow = BrowserWindow.getFocusedWindow(); + if (focusedWindow) + focusedWindow.setFullScreen(!focusedWindow.isFullScreen()); + } + }, + { + label: 'Toggle &Developer Tools', + accelerator: 'Shift+Ctrl+I', + click: function() { + var focusedWindow = BrowserWindow.getFocusedWindow(); + if (focusedWindow) + focusedWindow.toggleDevTools(); + } + }, + ] + }, + { + label: 'Help', + submenu: [ + { + label: 'Learn More', + click: function() { require('shell').openExternal('http://electron.atom.io') } + }, + { + label: 'Documentation', + click: function() { require('shell').openExternal('https://github.com/atom/electron/tree/master/docs#readme') } + }, + { + label: 'Community Discussions', + click: function() { require('shell').openExternal('https://discuss.atom.io/c/electron') } + }, + { + label: 'Search Issues', + click: function() { require('shell').openExternal('https://github.com/atom/electron/issues') } + } + ] + } + ]; + } + + var menu = Menu.buildFromTemplate(template); + Menu.setApplicationMenu(menu); +}); + +// Start the specified app if there is one specified in command line, otherwise +// start the default app. +if (option.file && !option.webdriver) { + try { + // Override app name and version. + var packagePath = path.resolve(option.file); + var packageJsonPath = path.join(packagePath, 'package.json'); + if (fs.existsSync(packageJsonPath)) { + var packageJson = JSON.parse(fs.readFileSync(packageJsonPath)); + if (packageJson.version) + app.setVersion(packageJson.version); + if (packageJson.productName) + app.setName(packageJson.productName); + else if (packageJson.name) + app.setName(packageJson.name); + app.setPath('userData', path.join(app.getPath('appData'), app.getName())); + app.setPath('userCache', path.join(app.getPath('cache'), app.getName())); + app.setAppPath(packagePath); + } + + // Run the app. + require('module')._load(packagePath, module, true); + } catch(e) { + if (e.code == 'MODULE_NOT_FOUND') { + app.focus(); + dialog.showErrorBox('Error opening app', 'The app provided is not a valid electron app, please read the docs on how to write one:\nhttps://github.com/atom/electron/tree/master/docs\n\n' + e.toString()); + process.exit(1); + } else { + console.error('App threw an error when running', e); + throw e; + } + } +} else if (option.version) { + console.log('v' + process.versions.electron); + process.exit(0); +} else if (option.help) { + var helpMessage = "Electron v" + process.versions.electron + " - Cross Platform Desktop Application Shell\n\n"; + helpMessage += "Usage: electron [options] [path]\n\n"; + helpMessage += "A path to an Electron application may be specified. The path must be to \n"; + helpMessage += "an index.js file or to a folder containing a package.json or index.js file.\n\n"; + helpMessage += "Options:\n"; + helpMessage += " -h, --help Print this usage message.\n"; + helpMessage += " -v, --version Print the version."; + console.log(helpMessage); + process.exit(0); +} else { + require('./default_app.js'); +} diff --git a/Shrug-darwin-x64/Shrug.app/Contents/Resources/default_app/package.json b/Shrug-darwin-x64/Shrug.app/Contents/Resources/default_app/package.json new file mode 100644 index 0000000..d6c736c --- /dev/null +++ b/Shrug-darwin-x64/Shrug.app/Contents/Resources/default_app/package.json @@ -0,0 +1,5 @@ +{ + "name": "electron", + "productName": "Electron", + "main": "main.js" +} diff --git a/Shrug-darwin-x64/version b/Shrug-darwin-x64/version new file mode 100644 index 0000000..66e019c --- /dev/null +++ b/Shrug-darwin-x64/version @@ -0,0 +1 @@ +v0.30.3 \ No newline at end of file diff --git a/package.json b/package.json index f160aab..e72afc0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "example-menubar-app", + "name": "shrug-menubar-app", "version": "1.0.0", - "description": "example menubar electron app", + "description": "Shrug menubar electron app", "dependencies": { "menubar": "*" }, @@ -11,7 +11,7 @@ }, "main": "main.js", "scripts": { - "build": "electron-packager . Example --platform=darwin --arch=x64 --version=0.30.3 --ignore=node_modules/electron --icon=Icon.icns", + "build": "electron-packager . Shrug --platform=darwin --arch=x64 --version=0.30.3 --ignore=node_modules/electron --icon=Icon.icns", "start": "electron . && cssnext styles-src.css styles.css" } }