diff --git a/crypto777/tools/fix_deps.py b/crypto777/tools/fix_deps.py new file mode 100755 index 000000000..f5a9cc8af --- /dev/null +++ b/crypto777/tools/fix_deps.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python +# Copyright (c) 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Fixup GCC-generated dependency files. + +Modify GCC generated dependency files so they are more suitable for including +in a GNU Makefile. Without the fixups, deleting or renaming headers can cause +the build to be broken. + +See http://mad-scientist.net/make/autodep.html for more details of the problem. +""" + +import argparse +import os +import sys + +TAG_LINE = '# Updated by fix_deps.py\n' + + +class Error(Exception): + pass + + +def ParseLine(line, new_target): + """Parse one line of a GCC-generated deps file. + + Each line contains an optional target and then a list + of space seperated dependencies. Spaces within filenames + are escaped with a backslash. + """ + filenames = [] + + if new_target and ':' in line: + line = line.split(':', 1)[1] + + line = line.strip() + line = line.rstrip('\\') + + while True: + # Find the next non-escaped space + line = line.strip() + pos = line.find(' ') + while pos > 0 and line[pos-1] == '\\': + pos = line.find(' ', pos+1) + + if pos == -1: + filenames.append(line) + break + filenames.append(line[:pos]) + line = line[pos+1:] + + return filenames + + +def FixupDepFile(filename, output_filename=None): + if not os.path.exists(filename): + raise Error('File not found: %s' % filename) + + if output_filename is None: + output_filename = filename + + outlines = [TAG_LINE] + deps = [] + new_target = True + with open(filename) as infile: + for line in infile: + if line == TAG_LINE: + raise Error('Already processed: %s' % filename) + outlines.append(line) + deps += ParseLine(line, new_target) + new_target = line.endswith('\\') + + # For every depenency found output a dummy target with no rules + for dep in deps: + outlines.append('%s:\n' % dep) + + with open(output_filename, 'w') as outfile: + for line in outlines: + outfile.write(line) + + +def main(argv): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('-o', '--output', help='Output filename (defaults to ' + 'input name with .deps extension') + parser.add_argument('-c', '--clean', action='store_true', + help='Remove input file after writing output') + parser.add_argument('dep_file') + options = parser.parse_args(argv) + output_filename = options.output + if not output_filename: + output_filename = os.path.splitext(options.dep_file)[0] + '.deps' + FixupDepFile(options.dep_file, output_filename) + if options.clean and options.dep_file != output_filename: + os.remove(options.dep_file) + + return 0 + + +if __name__ == '__main__': + try: + sys.exit(main(sys.argv[1:])) + except Error as e: + sys.stderr.write('%s: %s\n' % (os.path.basename(__file__), e)) + sys.exit(1) diff --git a/crypto777/tools/nacl_config.py b/crypto777/tools/nacl_config.py new file mode 100755 index 000000000..146563be4 --- /dev/null +++ b/crypto777/tools/nacl_config.py @@ -0,0 +1,276 @@ +#!/usr/bin/env python +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""A helper script to print paths of NaCl binaries, includes, libs, etc. + +It is similar in behavior to pkg-config or sdl-config. +""" + +import argparse +import os +import posixpath +import sys + +import getos + + +if sys.version_info < (2, 7, 0): + sys.stderr.write("python 2.7 or later is required run this script\n") + sys.exit(1) + + +VALID_ARCHES = ('arm', 'x86_32', 'x86_64', 'i686') +VALID_PNACL_ARCHES = (None, 'pnacl') +ARCH_NAME = { + 'arm': 'arm', + 'x86_32': 'i686', + 'i686': 'i686', + 'x86_64': 'x86_64' +} + +ARCH_ALT_NAME = { + 'arm': 'arm', + 'x86_32': 'x86_32', + 'i686': 'x86_32', + 'x86_64': 'x86_64' +} + +ARCH_BASE_NAME = { + 'arm': 'arm', + 'x86_32': 'x86', + 'i686': 'x86', + 'x86_64': 'x86' +} + +NACL_TOOLCHAINS = ('newlib', 'glibc', 'pnacl', 'bionic', 'clang-newlib') +HOST_TOOLCHAINS = ('linux', 'mac', 'win') +VALID_TOOLCHAINS = list(HOST_TOOLCHAINS) + list(NACL_TOOLCHAINS) + ['host'] + +# This is not an exhaustive list of tools, just the ones that need to be +# special-cased. + +# e.g. For PNaCL cc => pnacl-clang +# For NaCl cc => pnacl-gcc +# +# Most tools will be passed through directly. +# e.g. For PNaCl foo => pnacl-foo +# For NaCl foo => x86_64-nacl-foo. +CLANG_TOOLS = { + 'cc': 'clang', + 'c++': 'clang++', + 'gcc': 'clang', + 'g++': 'clang++', + 'ld': 'clang++' +} + +GCC_TOOLS = { + 'cc': 'gcc', + 'c++': 'g++', + 'gcc': 'gcc', + 'g++': 'g++', + 'ld': 'g++' +} + + +class Error(Exception): + pass + + +def Expect(condition, message): + if not condition: + raise Error(message) + + +def ExpectToolchain(toolchain, expected_toolchains): + Expect(toolchain in expected_toolchains, + 'Expected toolchain to be one of [%s], not %s.' % ( + ', '.join(expected_toolchains), toolchain)) + + +def ExpectArch(arch, expected_arches): + Expect(arch in expected_arches, + 'Expected arch to be one of [%s], not %s.' % ( + ', '.join(map(str, expected_arches)), arch)) + + +def CheckValidToolchainArch(toolchain, arch, arch_required=False): + if toolchain or arch or arch_required: + ExpectToolchain(toolchain, VALID_TOOLCHAINS) + + if toolchain in HOST_TOOLCHAINS: + Expect(arch is None, + 'Expected no arch for host toolchain %r. Got %r.' % ( + toolchain, arch)) + elif toolchain == 'pnacl': + Expect(arch is None or arch == 'pnacl', + 'Expected no arch for toolchain %r. Got %r.' % (toolchain, arch)) + elif arch_required: + Expect(arch is not None, + 'Expected arch to be one of [%s] for toolchain %r.\n' + 'Use the -a or --arch flags to specify one.\n' % ( + ', '.join(VALID_ARCHES), toolchain)) + + if arch: + if toolchain == 'pnacl': + ExpectArch(arch, VALID_PNACL_ARCHES) + else: + ExpectArch(arch, VALID_ARCHES) + + if arch == 'arm': + Expect(toolchain in ['newlib', 'bionic', 'clang-newlib'], + 'The arm arch only supports newlib.') + + +def GetArchName(arch): + return ARCH_NAME.get(arch) + + +def GetArchAltName(arch): + return ARCH_ALT_NAME.get(arch) + + +def GetArchBaseName(arch): + return ARCH_BASE_NAME.get(arch) + + +def CanonicalizeToolchain(toolchain): + if toolchain == 'host': + return getos.GetPlatform() + return toolchain + + +def GetPosixSDKPath(): + sdk_path = getos.GetSDKPath() + if getos.GetPlatform() == 'win': + return sdk_path.replace('\\', '/') + else: + return sdk_path + + +def GetToolchainDir(toolchain, arch=None): + ExpectToolchain(toolchain, NACL_TOOLCHAINS) + root = GetPosixSDKPath() + platform = getos.GetPlatform() + if toolchain in ('pnacl', 'clang-newlib'): + subdir = '%s_pnacl' % platform + else: + assert arch is not None + subdir = '%s_%s_%s' % (platform, GetArchBaseName(arch), toolchain) + + return posixpath.join(root, 'toolchain', subdir) + + +def GetToolchainArchDir(toolchain, arch): + ExpectToolchain(toolchain, NACL_TOOLCHAINS) + assert arch is not None + toolchain_dir = GetToolchainDir(toolchain, arch) + arch_dir = '%s-nacl' % GetArchName(arch) + return posixpath.join(toolchain_dir, arch_dir) + + +def GetToolchainBinDir(toolchain, arch=None): + ExpectToolchain(toolchain, NACL_TOOLCHAINS) + return posixpath.join(GetToolchainDir(toolchain, arch), 'bin') + + +def GetSDKIncludeDirs(toolchain): + root = GetPosixSDKPath() + base_include = posixpath.join(root, 'include') + if toolchain == 'clang-newlib': + toolchain = 'newlib' + return [base_include, posixpath.join(base_include, toolchain)] + + +def GetSDKLibDir(): + return posixpath.join(GetPosixSDKPath(), 'lib') + + +# Commands + +def GetToolPath(toolchain, arch, tool): + if tool == 'gdb': + # Always use the same gdb; it supports multiple toolchains/architectures. + # NOTE: this is always a i686 executable. i686-nacl-gdb is a symlink to + # x86_64-nacl-gdb. + return posixpath.join(GetToolchainBinDir('newlib', 'x86_64'), + 'x86_64-nacl-gdb') + + if toolchain == 'pnacl': + CheckValidToolchainArch(toolchain, arch) + tool = CLANG_TOOLS.get(tool, tool) + full_tool_name = 'pnacl-%s' % tool + else: + CheckValidToolchainArch(toolchain, arch, arch_required=True) + ExpectArch(arch, VALID_ARCHES) + if toolchain == 'clang-newlib': + tool = CLANG_TOOLS.get(tool, tool) + else: + tool = GCC_TOOLS.get(tool, tool) + full_tool_name = '%s-nacl-%s' % (GetArchName(arch), tool) + return posixpath.join(GetToolchainBinDir(toolchain, arch), full_tool_name) + + +def GetCFlags(toolchain): + ExpectToolchain(toolchain, VALID_TOOLCHAINS) + return ' '.join('-I%s' % dirname for dirname in GetSDKIncludeDirs(toolchain)) + + +def GetIncludeDirs(toolchain): + ExpectToolchain(toolchain, VALID_TOOLCHAINS) + return ' '.join(GetSDKIncludeDirs(toolchain)) + + +def GetLDFlags(): + return '-L%s' % GetSDKLibDir() + + +def main(args): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('-t', '--toolchain', help='toolchain name. This can also ' + 'be specified with the NACL_TOOLCHAIN environment ' + 'variable.') + parser.add_argument('-a', '--arch', help='architecture name. This can also ' + 'be specified with the NACL_ARCH environment variable.') + + group = parser.add_argument_group('Commands') + group.add_argument('--tool', help='get tool path') + group.add_argument('--cflags', + help='output all preprocessor and compiler flags', + action='store_true') + group.add_argument('--libs', '--ldflags', help='output all linker flags', + action='store_true') + group.add_argument('--include-dirs', + help='output include dirs, separated by spaces', + action='store_true') + + options = parser.parse_args(args) + + # Get toolchain/arch from environment, if not specified on commandline + options.toolchain = options.toolchain or os.getenv('NACL_TOOLCHAIN') + options.arch = options.arch or os.getenv('NACL_ARCH') + + options.toolchain = CanonicalizeToolchain(options.toolchain) + CheckValidToolchainArch(options.toolchain, options.arch) + + if options.cflags: + print GetCFlags(options.toolchain) + elif options.include_dirs: + print GetIncludeDirs(options.toolchain) + elif options.libs: + print GetLDFlags() + elif options.tool: + print GetToolPath(options.toolchain, options.arch, options.tool) + else: + parser.error('Expected a command. Run with --help for more information.') + + return 0 + + +if __name__ == '__main__': + try: + sys.exit(main(sys.argv[1:])) + except Error as e: + sys.stderr.write(str(e) + '\n') + sys.exit(1) diff --git a/iguana/help/header.md b/iguana/help/header.md index 139597f9c..e69de29bb 100644 --- a/iguana/help/header.md +++ b/iguana/help/header.md @@ -1,2 +0,0 @@ - - diff --git a/iguana/js/tradebot.js b/iguana/js/tradebot.js new file mode 100644 index 000000000..3c2493d59 --- /dev/null +++ b/iguana/js/tradebot.js @@ -0,0 +1,289 @@ + +//THREE_STRINGS_AND_DOUBLE(tradebot,monitor,exchange,base,rel,commission); +var Tradebot_monitor_api=function(){ + var exchange=$('#Tradebot_exchange').val(); + var base=$('#Tradebot_base').val(); + var rel=$('#Tradebot_rel').val(); + var commission=$('#Tradebot_commission').val(); + + var request='{"agent":"tradebot","method":"monitor","exchange":"'+exchange+'","base":"'+base+'","rel":"'+rel+'", "commission":'+commission+'}'; + SPNAPI.makeRequest(request, function(request,response){ + show_tradebot_resposnse(response); + } + ); + //console.log("Monitor called"); +}; + +var set_Tradebot_monitor_table=function(){ + var html=' Base:Rel:Commission: Exchange: '; + $('#tradebot_input').html(html); + if(exchanges!==""){ + $('#Tradebot_exchange').html(exchanges); +} + +}; + +//STRING_AND_DOUBLE(tradebot,monitorall,exchange,commission); +var Tradebot_monitorall_api=function(){ + var exchange=$('#Tradebot_exchange').val(); + var commission=$('#Tradebot_commission').val(); + + var request='{"agent":"tradebot","method":"monitorall","exchange":"'+exchange+'","commission":'+commission+'}'; + SPNAPI.makeRequest(request, function(request,response){ + show_tradebot_resposnse(response); + } + ); + +}; + +var set_Tradebot_monitorall_table=function(){ + var html='Commission: Exchange: '; + $('#tradebot_input').html(html); + if(exchanges!==""){ + $('#Tradebot_exchange').html(exchanges); + } + +}; + +//THREE_STRINGS(tradebot,unmonitor,exchange,base,rel); +var Tradebot_unmonitor_api=function(){ +var exchange=$('#Tradebot_exchange').val(); + var base=$('#Tradebot_base').val(); + var rel=$('#Tradebot_rel').val(); + //var commission=$('#Tradebot_commission').val(); + + var request='{"agent":"tradebot","method":"unmonitor","exchange":"'+exchange+'","base":"'+base+'","rel":"'+rel+'"}'; + SPNAPI.makeRequest(request, function(request,response){ + show_tradebot_resposnse(response); + } + ); + //console.log("Monitor called"); + +}; + +var set_Tradebot_unmonitor_table=function(){ + var html=' Base:Rel: Exchange: '; + $('#tradebot_input').html(html); + if(exchanges!==""){ + $('#Tradebot_exchange').html(exchanges); +} + +}; + +//THREE_STRINGS_AND_THREE_DOUBLES(tradebot,accumulate,exchange,base,rel,price,volume,duration); +var Tradebot_accumulate_api=function(){ + var exchange=$('#Tradebot_exchange').val(); + var base=$('#Tradebot_base').val(); + var rel=$('#Tradebot_rel').val(); + var price=$('#Tradebot_price').val(); + var volume=$('#Tradebot_volume').val(); + var duration=$('#Tradebot_duration').val(); + + var request='{"agent":"tradebot","method":"accumulate","exchange":"'+exchange+'","base":"'+base+'","rel":"'+rel+'", "price":'+price+',"volume":'+volume+',"duration":'+duration+' }'; + SPNAPI.makeRequest(request, function(request,response){ + show_tradebot_resposnse(response); + } + ); +}; + +var set_Tradebot_accumulate_table=function(){ + var html=' Base:Rel:Price:Volume:Duration: Exchange: '; + $('#tradebot_input').html(html); + if(exchanges!==""){ + $('#Tradebot_exchange').html(exchanges); +} +}; + + +//THREE_STRINGS_AND_THREE_DOUBLES(tradebot,divest,exchange,base,rel,price,volume,duration); +var Tradebot_divest_api=function(){ + + var exchange=$('#Tradebot_exchange').val(); + var base=$('#Tradebot_base').val(); + var rel=$('#Tradebot_rel').val(); + var price=$('#Tradebot_price').val(); + var volume=$('#Tradebot_volume').val(); + var duration=$('#Tradebot_duration').val(); + + var request='{"agent":"tradebot","method":"divest","exchange":"'+exchange+'","base":"'+base+'","rel":"'+rel+'", "price":'+price+',"volume":'+volume+',"duration":'+duration+' }'; + SPNAPI.makeRequest(request, function(request,response){ + show_tradebot_resposnse(response); + } + ); + +}; + +var set_Tradebot_divest_table=function(){ + var html=' Base:Rel:Price:Volume:Duration: Exchange: '; + $('#tradebot_input').html(html); + if(exchanges!==""){ + $('#Tradebot_exchange').html(exchanges); +} + + +}; + +//STRING_ARG(tradebot,activebots,exchange); +var Tradebot_activebots_api=function(){ + var exchange=$('#Tradebot_exchange').val(); + var request='{"agent":"tradebot","method":"activebots","exchange":"'+exchange+'"}'; + SPNAPI.makeRequest(request, function(request,response){ + show_tradebot_resposnse(response); + } + ); + +}; + +var set_Tradebot_activebots_table=function(){ + var html=' Exchange: '; + $('#tradebot_input').html(html); + if(exchanges!==""){ + $('#Tradebot_exchange').html(exchanges); + } +}; + +//TWO_STRINGS(tradebot,status,exchange,botid); +var Tradebot_status_api=function(){ + var exchange=$('#Tradebot_exchange').val(); + var botid=$('#Tradebot_botid').val(); + + var request='{"agent":"tradebot","method":"status","exchange":"'+exchange+'","botid":"'+botid+'"}'; + SPNAPI.makeRequest(request, function(request,response){ + show_tradebot_resposnse(response); + } + ); +}; + +var set_Tradebot_status_table=function(){ + var html='Botid: Exchange: '; + $('#tradebot_input').html(html); + if(exchanges!==""){ + $('#Tradebot_exchange').html(exchanges);} + + + +}; + +//TWO_STRINGS(tradebot,pause,exchange,botid); +var Tradebot_pause_api=function(){ + + var exchange=$('#Tradebot_exchange').val(); + var botid=$('#Tradebot_botid').val(); + + var request='{"agent":"tradebot","method":"pause","exchange":"'+exchange+'","botid":"'+botid+'"}'; + SPNAPI.makeRequest(request, function(request,response){ + show_tradebot_resposnse(response); + } + ); + +}; + +var set_Tradebot_pause_table=function(){ + var html='Botid: Exchange: '; + $('#tradebot_input').html(html); + if(exchanges!==""){ + $('#Tradebot_exchange').html(exchanges); +} + +}; + +//TWO_STRINGS(tradebot,stop,exchange,botid); +var Tradebot_stop_api=function(){ + var exchange=$('#Tradebot_exchange').val(); + var botid=$('#Tradebot_botid').val(); + + var request='{"agent":"tradebot","method":"stop","exchange":"'+exchange+'","botid":"'+botid+'"}'; + SPNAPI.makeRequest(request, function(request,response){ + show_tradebot_resposnse(response); + } + ); + + +}; + +var set_Tradebot_stop_table=function(){ + var html='Botid: Exchange: '; + $('#tradebot_input').html(html); + if(exchanges!==""){ + $('#Tradebot_exchange').html(exchanges); +} +}; + +//TWO_STRINGS(tradebot,resume,exchange,botid); +var Tradebot_resume_api=function(){ + + var exchange=$('#Tradebot_exchange').val(); + var botid=$('#Tradebot_botid').val(); + + var request='{"agent":"tradebot","method":"resume","exchange":"'+exchange+'","botid":"'+botid+'"}'; + SPNAPI.makeRequest(request, function(request,response){ + show_tradebot_resposnse(response); + } + ); + + +}; + +var set_Tradebot_resume_table=function(){ + var html='Botid: Exchange: '; + $('#tradebot_input').html(html); + if(exchanges!==""){ + $('#Tradebot_exchange').html(exchanges); +} + +}; + + + +var tradebot_set_method_table=function (method){ + + if(method==="monitor"){ + set_Tradebot_monitor_table(); + }else if(method==="monitorall"){ + set_Tradebot_monitorall_table(); + }else if(method==="unmonitor"){ + set_Tradebot_unmonitor_table(); + }else if(method==="accumulate"){ + set_Tradebot_accumulate_table(); + }else if(method==="divest"){ + set_Tradebot_divest_table(); + } + else if(method==="activebots"){ + set_Tradebot_activebots_table(); + } + else if(method==="status"){ + set_Tradebot_status_table(); + } + else if(method==="pause"){ + set_Tradebot_pause_table(); + } + else if(method==="stop"){ + set_Tradebot_stop_table(); + } + else if(method==="resume"){ + set_Tradebot_resume_table(); + } + else{ + console.log("wrong method value"); + } + + $('#trade_output').html(""); +}; + +var show_tradebot_resposnse=function(response){ + + $('#trade_output').html(""); + response=JSON.parse(response); + for(var i in response){ + if(i==='tag') continue; + var value=""; + if(response[i] instanceof Array){ + value=value+""; + }else{value=response[i];} + $('#trade_output').append(""+i+""+value+""); + } +}; \ No newline at end of file diff --git a/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips.html b/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips.html new file mode 100644 index 000000000..161ae6084 --- /dev/null +++ b/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips.html @@ -0,0 +1,1332 @@ + + + + + + + + + + + + + + + + + + + + bips/bip-atom.mediawiki at bip4x · TierNolan/bips + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Skip to content + + + + + + + + + + + + + + +
+ +
+
+ + +
+
+
+ +
+
+ + + +
    + +
  • +
    + +
    + + + + Watch + + + + +
    + +
    +
    +
    +
  • + +
  • + +
    + +
    + + +
    +
    + + +
    + +
  • + +
  • + + + Fork + + + + + +
  • +
+ +

+ + /bips + + + + + + + forked from bitcoin/bips + +

+ +
+ +
+ +
+
+ + + + + + + +
+ +
+ + + +
+ +
+ + Find file + + +
+ +
+ + +
+ + + 2014161 + + + + + + + + +
+ +
+
+
+ +
+ Raw + Blame + History +
+ + + + + +
+ +
+ +
+ +
+ 466 lines (282 sloc) + + 19.9 KB +
+
+ + +
+
+

  BIP: XX
+  Title: Atomic Cross Chain Transfers
+  Author: Noel Tiernan <tier.nolan@gmail.com>
+  Status: Draft
+  Type: Standards Track
+  Created: 2014-04-29
+
+

+

Table of Contents

+

Abstract

+ + + +

This BIP describes a method for atomically trading coins between Bitcoin and a Bitcoin-like alternative coin (altcoin). +

+ +

Motivation

+ + + +

There are many coin trading exchanges. These websites allow users to trade Bitcoins for altcoin, and also to trade one type altcoin for another. +

+

These sites are centralised in nature. A p2p coin trading system requires a way for traders to trade their coins in an atomic way. +

+ +

Protocol Overview

+ + + +

The protocol defined in this BIP consists of two stages. In the first stage, the parties cooperate to generate a set of transactions, without broadcasting. In the second stage, the transactions are broadcast in a specific ordering. Communication between the parties is only required during the first stage. +

+

Each party has an incentive to participate in the defined broadcast ordering. If the protocol stops at any stage before the transaction is committed, both parties can recover their funds using timelocked refund transactions. +

+

It is assumed that Bob wishes to buy A altcoins (ATC) from Alice for B Bitcoins (BTC). Transaction fees are assumed to be fb for the Bitcoin network and fa for the altcoin network. Bob will pay all Bitcoin fees and Alice will pay all altcoin fees. The exchange price agreed between the parties will take this into account. +

+

Public keys are referred to as pub-AN for Alice's keys and pub-BN for Bob's keys. An optional 3rd party signature is also possible, designated pub-T. +

+

The third party is only required to protect against transaction malleability. Once transaction malleability is resolved, the third party will not be necessary. +

+

An additional standard transaction type is required on one of the networks for the protocol to operate. Trades can be performed between a network which supports P2SH and other that supports OP_HASH160 transaction locking. +

+ +

Transaction Creation

+ + + +

1) Alice sends Bob three public keys (pub-A1, ..., pub-A3) +

+

2) Bob sends Alice three public keys (pub-B1, ..., pub-B3) and Hash160(x) +

+ +

    x = serialized{pub-B4 OP_CHECKSIG}
+
+

+ +

3) Both parties creates their "bail-in" transaction. +

+

Transaction output 0 can only be spent with both parties' signatures. Transaction output 1 can only be spent by Bob, but it results in x being revealed. +

+ +

    Name: Bob.Bail.In
+    Input value:     B + 2*fb + change
+    Input source:    (From Bob's coins, multiple inputs are allowed)
+    Output 0 value:  B
+    ScriptPubKey 0:  OP_HASH160 Hash160(P2SH Redeem) OP_EQUAL
+    Output 1 value:  fb
+    ScriptPubKey 1:  OP_HASH160 Hash160(x) OP_EQUALVERIFY pub-A1 OP_CHECKSIG
+    Output 2 value:  change
+    ScriptPubKey 2:  <= 100 bytes
+
+

+ + +

    P2SH Redeem:  OP_2 pub-A1 pub-B1 OP_2 OP_CHECKMULTISIG
+    P2SH Redeem:  OP_2 pub-A1 pub-B1 pub-T OP_3 OP_CHECKMULTISIG
+
+

+ +

Transaction output 0 can only be spent with both parties' signatures. Transaction 1 can only be spent by Alice, but it requires x to be reveals by Bob first. +

+ +

    Name: Alice.Bail.In
+    Input value:  A + 2*fa + change
+    Input source: (From Alice's altcoins, multiple inputs are allowed)
+    Output 0 value: A
+    ScriptPubKey 0: OP_HASH160 Hash160(P2SH Redeem) OP_EQUAL
+    Output 1 value: fa
+    ScriptPubKey 1: OP_HASH160 Hash160(x) OP_EQUAL
+    Output 2 value: change
+    ScriptPubKey 2: <= 100 bytes
+
+

+ + +

    P2SH Redeem:    OP_2 pub-A1 pub-B1 OP_2 OP_CHECKMULTISIG
+    P2SH Redeem:    OP_2 pub-A1 pub-B1 pub-T OP_3 OP_CHECKMULTISIG
+
+

+ +

Note: x = serialized{pub-B4 OP_CHECKSIG} +

+

The shorter version of P2SH Redeem should be used when a third party is not used. +

+

Output 1 uses P2SH, this means that Bob must provide x in order to spend it. +

+

If a third party isn't used, then pub-T is not included and the key count (OP_3) is replaced by OP_2. +

+

4) Bob and Alice exchange bail-in transaction hashes +

+

Bob sends Alice Hash256(Bob.Bail.In) +

+

Alice sends Bob Hash256(Alice.Bail.In) +

+

Note: The outputs in the bail-in transaction do not need to be ordered as given in steps 1 and 2. +

+

5) Both parties create the payout transactions +

+

This transaction can be spent by Alice. Since it has Bob.Bail.In:1 as an input, it cannot be signed unless Bob reveals x. +

+ +

    Name: Alice.Payout
+    Input value:  B
+    Input source: Bob.Bail.In:0
+    Input value:  fb
+    Input source: Bob.Bail.In:1
+    Output value: B
+    ScriptPubKey: OP_HASH160 Hash160(P2SH Redeem) OP_EQUAL
+
+

+ + +

    P2SH Redeem:  pub-A2 OP_CHECKSIG
+
+

+ +

This transaction can be spent by Bob. However, since it has Alice.Bail.In:1 as an input, he cannot sign the inputs unless he reveals x. +

+ +

    Name: Bob.Payout
+    Input value:  A
+    Input source: Alice.Bail.In:0
+    Input value:  fa
+    Input source: Alice.Bail.In:1
+    Output value: A
+    ScriptPubKey: OP_HASH160 Hash160(P2SH Redeem) OP_EQUAL
+
+

+ + +

    P2SH Redeem:  pub-B2 OP_CHECKSIG
+
+

+ +

6) Both parties create the refund transactions +

+

This transaction is timelocked, so that it can't be spent until the timeout (T) has passed. This transaction does not require Bob.Bail.In:B, so Bob does not have to reveal x in order to spend it. +

+ +

    Name: Bob.Refund
+    Input value:  B
+    Input source: Bob.Bail.In:0
+    Output value: B - fb
+    ScriptPubKey: OP_HASH160 Hash160(P2SH Redeem) OP_EQUAL
+    Locktime:     (current block height) + (T / 10 minutes)
+
+

+ + +

    P2SH Redeem:  pub-B3 OP_CHECKSIG
+
+

+ +

This transaction is timelocked, so that it can't be spent until half the timeout (T/2) has passed. This transaction does not require Alice.Bail.In:B, so Alice can spend it without x being revealed. +

+ +

    Name: Alice.Refund
+    Input value: A
+    Input source: Alice.Bail.In:0
+    Output value: A - fa
+    ScriptPubKey: OP_HASH160 Hash160(P2SH Redeem) OP_EQUAL
+    Locktime:     current block height + ((T/2)/(altcoin block rate))
+
+

+ + +

    P2SH Redeem:  pub-A3 OP_CHECKSIG
+
+

+ +

7) Bob and Alice exchange signatures +

+

Bob sends Alice signatures for Alice.Payout (Input: Bob.Bail.In:0) and Alice.Refund. +

+

Alice signs all three and now has 3 signed transactions. Alice.Payout cannot be fully signed until x is revealed. +

+

Alice sends Bob signatures for Bob.Payout (Input: Alice.Bail.In:0), Bob.Refund and Bob.Trusted.Refund. +

+

Bob signs all three and has 3 fully signed transactions. +

+

8) Exchange of bail-in transactions +

+

The parties can safely exchange bail-in transactions at this point. This is not necessary for the protocol, but would allow both parties to verify that the other party at least has a valid bail-in transaction before locking their funds. +

+

No further communication is required between the parties. Bob and Alice can determine the state of the transaction by monitoring both chains. +

+ +

Transaction Broadcast

+ + + +

The transactions must be broadcast in a specific order for the composite transaction to be atomic. +

+

Bob has the following transactions: +

+ + + + +

  • Bob.Bail.In: Bob's bail-in transaction
  • Bob.Refund: Bob's refund transaction (timelocked until the timeout has passed)
  • Bob.Payout: Bob's altcoin payout transaction (can only be spent by revealing x)
+Alice has the following transactions +

+ + + + + +
  • Alice.Payout: Alice's Bitcoin payout transaction (can only be spent if Bob reveals x)
  • Alice.Bail.In: Alice's bail-in transaction
  • Alice.Refund: Alice's refund transaction (timelocked until half the timeout has passed)
+

Step 1: Bail-in by Bob

+ + + +

Bob broadcasts Bob.Bail.In. +

+

Bob's has no option other than waiting + + + +

  • He cannot broadcast Bob.Refund since it is timelocked
  • He cannot broadcast Bob.Payout since it has Alice.Bail.In as an input
+Alice's only broadcast option is to move to step 2 + + + + +
  • She cannot broadcast Alice.Payout since she doesn't know x
  • She cannot broadcast Alice.Refund since it is timelocked
  • She can broadcast Alice.Bail.In, which moves the protocol to step 2
+If the protocol ends at this point, Bob can use his refund transaction to recover his Bitcoins after the timeout has expired. +

+ +

Step 2: Bail in by Alice

+ + + +

Alice broadcasts Alice.Bail.In. +

+

Alice has no option other than waiting + + + +

  • She cannot broadcast Alice.Refund since it is timelocked
  • She cannot broadcast Alice.Payout since she doesn't know x
+Bob's only broadcast option is to move to step 3 + + + +
  • He cannot broadcast Bob.Refund since it is timelocked
  • He can broadcast Bob.Payout since Alice.Bail.In has been broadcast
+It is recommended that Bob wait until Alice.Bail.In has been confirmed by a few blocks before proceeding to step 3. +

+ +

Step 3: Bob commits to the transaction

+ + + +

Bob broadcasts Bob.Payout to claim his altcoins. To spend the 2nd output of Alice.Bail.In requires that Bob reveal x. +

+

This completes Bob's participation in the protocol. +

+

Once Alice.Bail.In has been confirmed to a sufficient depth, Bob should broadcast Bob.Payout as soon as possible. Since broadcasting Bob.Payout reveals x, if Bob waits until the the locktime on Alice.Refund has expired (or is near to expire), then it creates a race condition. Alice could broadcast Alice.Refund to get her altcoins back and also broadcast Alice.Payout to claim Bob's Bitcoins. +

+

If he broadcasts immediately, he has half the timeout time for his transction to be confirmed. +

+

Alice has only one broadcast option + + + + +

  • She cannot broadcast Alice.Refund since it is timelocked
  • She can broadcast Alice.Payout since she knows x, which moved the protocol to step 4
+

Step 4: Alice completes the transaction

+ + + +

Alice broadcasts Alice.Payout to claim her Bitcoins. +

+

If Alice doesn't claim her Bitcoins before the timeout on Bob.Refund ends, then Bob could use Bob.Refund to recover the Bitcoins he used in the trade. +

+

Since Bob can wait at most half the timeout (T/2) before completing step 3 and Bob.Refund has a timelock of T, Alice has at least half the timeout (T/2) to broadcast Alice.Payout. +

+ +

Specification

+ + + +

JSON-RPC shall be used for communication between the parties. +

+

Hex encoding shall be used for all byte arrays. +

+

Public keys must be serialized using strict SEC format: +

+ +

    byte(0x02) byte_array(32):                Compressed even key
+    byte(0x03) byte_array(32):                Compressed odd key
+
+

+ +

Compressed keys are mandatory. +

+

When included in transactions, hash_type must be set to 1. +

+

Signatures must be serialized using strict DER format. +

+ +

    byte(0x30) byte(total_length) byte(0x02) byte(len(R)) byte_array(len(R)) byte(len(s)) byte_array(len(s))
+
+

+ +

total_length is equal to 3 + len(R) + len(S). +

+

R and S are represented in signed Big Endian format without leading zeros, except that exactly one leading zero is mandatory, if the number would otherwise be negative. This occurs if the MSB in the first non-zero byte is set. +

+

Transactions shall be serialized using the bitcoin protocol serialization. Transactions that are not timelocked should have a lock_time and sequence number of 0. Timelocked inputs should have a sequence number of UINT_MAX (0xFFFFFFFF). +

+

One party shall act as server and one party shall act as client. +

+

The party which selects x and has the longer timeout is defined as the slow trader. The other party is the fast trader. +

+ +

Request Message

+ + + +

Each message shall have the following format. +

+ +

    {"id":1, "method": "method.name", "params": [param1, param2]}
+
+

+ +

id: The method id, it should increment for each method call +method: The name of the method +params: The method parameters +

+ +

Result Message

+ + + +

The server shall reply to Request methods with a response message. +

+ +

    {"id": 1, "result": result, "error: Null}
+
+

+ + +

Error Message

+ + + +

The server shall reply with an error message, if the request is invalid. +

+ +

    {"id": 1, "result": Null, "error: [error_code, "error_string"]}
+
+

+ + +

Methods

+ + + +

The following methods must be supported. +

+ +

Trade Request

+ + + +

This method is used to initiate the protocol. +

+ +

    {"id":1, "method": "trade.request", [version, long_deposit, [third_parties], k_client,
+                                         sell_magic_value, sell_coin_amount, sell_coin_fee, 
+                                         sell_locktime,
+                                         buy_magic_value, buy_coin_amount, buy_coin_fee, 
+                                         buy_locktime]}
+
+

+ +

The parameters are defined as +

+ +

    version:                        Integer version of the handshake (should be set to 1)
+    slow_trader (boolean):          True if the server is the slow trader, false otherwise
+    third_party (list of string):   Hex encoding of acceptable 3rd parties' public key (or Null for no 3rd party)
+    k_client (string):              A random hex encoded byte array (32 bytes)
+    sell_coin_magic_value (string): Hex encoding of the network magic value for the coin being sold
+    sell_coin_amount (number):      An integer count of the number of coins being sold (in the smallest units)
+    sell_locktime (number):         The int locktime for the client's refund transaction
+    buy_coin_magic_value (string):  Hex encoding of the network magic value for the coin being bought
+    buy_coin_amount (number):       An integer count of the number of coins being bought (in the smallest units)
+    buy_locktime (number):          The int locktime for the server's refund transaction
+
+

+ +

The server can decide if the trade is acceptable. +

+

For altcoins with irregular block rates, ensuring that the timeouts occur in the correct order may be difficult. It is recommended that the more stable chain act as slow trader. This prevents the slow trader having to wait an extended period if the altcoin's block rate collapses. +

+

Note: The locktime can mean timestamp and block height depending on value. +

+

The response for the method has a subset of the trade information. +

+ +

    {"id":1, "result": [version, slow_trader, [third_parties], k_server,
+                        sell_coin_amount, sell_coin_fee, sell_locktime,
+                        buy_coin_amount, buy_coin_fee, buy_locktime]
+             "error": Null}
+
+

+ +

If the returned values match the request, then the trade is accepted. Otherwise, it is a counteroffer. +

+

If the server doesn't support the protocol version requested by the client, the version in the response should be equal to the highest supported version, and no other parameters included. Otherwise, the server should respond with the requested version. +

+

An accepted offer should have at most one 3rd party's public key in the public key list. +

+

If the server does not wish to trade in that coin at all, then the buy_coin_amount, _fee and _locktime should be set to Null in the response. +

+

If the exchange rate is insufficient, servers should modify the sell_coin_amount in preference to modifying the buy_coin_amount. +

+

Servers should accept trades if the client echos back the response to the server. +

+

A trade-id is generated for each transaction (| means concatenation). +

+ +

    tr_id = SHA-256(k_client | k_server)
+
+

+ +

The result of the SHA-256 operation is considered a big endian encoded unsigned integer. +

+

If tr_id falls outside the elliptic curve finite field, the server should select a different byte array and repeat until success. +

+

The third party's public key is modified to give +

+ +

    third_party_key_modified = tr-id * third_party_key
+
+

+ +

This key should be used to generate the third party's refund transaction. +

+ +

Exchange Keys

+ + + +

This method is used to exchange public keys between the parties. Each party has to provide 5 public keys and the long trader must provide hash_x. The slow trader should set hash_x to Null. +

+ +

    {"id": 1, "method":"keys.request", "params": [tr_id, key1, key2, ... key5, hash_x]}
+
+

+ +

The server responds with 5 public keys and hash_x. +

+ +

    {"id": 1, "result": [key1, key2, ... key5, hash_x], "error": Null}
+
+

+ + +

Exchange Bail-in Transaction Hashes

+ + + +

This method is for exchanging bail-in transaction hashes and the A and B indexes. +

+ +

    {"id": 1, "method":"k, bail_in_hash.request", "params": [tr_id, client_bail_in_hash]}
+
+

+ +

The server responds with its own bail-in transaction hash. +

+ +

    {"id": 1, "result":"server_bail_in_hash", "error": Null}
+
+

+ +

Both hashes should be encoded as 64 character (32 byte) hashes. +

+

Note 1: This is the transaction id hash, not hash160. +Note 2: The fast and slow trader's bail-in transactions are constructed differently. +

+ +

Exchange Signatures

+ + + +

This method is for the parties to exchange signatures. +

+ +

    {"id": 1, "method": "exchange.signatures", "params": [tr_id, server_payout_signature, server_refund_signature, server_third_party_signature]
+
+

+ +

The parameters are defined as +

+

    server_payout_signature:          This is the signature for the server's payout transaction (input A)
+    server_refund_signature:          This is the signature for the server's timelocked refund transactions
+    server_third_party_signature:     This is the signature for the server's transaction to direct the output to a third party 
+
+

+ +

The response is of the same form +

+ +

    {"id": 1, "result": [client_payout_signature, client_refund_signature, client_third_party_signature], "error": Null}
+
+

+ +

The parameters are defined as +

+

    client_payout_signature:          This is the signature for the client's payout transaction (input A)
+    client_refund_signature:          This is the signature for the client's timelocked refund transactions
+    client_third_party_signature:     This is the signature for the client's transaction to direct the output to a third party
+
+

+ +

Once the 3 signatures are exchanged, no further communication is required. +

+ +

Exchange Bail-in Transactions

+ + + +

This method is for the parties to exchange bail-in transactions. This allows both parties to broadcast both bail-in transactions. +

+

Broadcasting the bail-in transaction prior to this step reduces malleability risk by the other party. +

+ +

    {"id": 1, "method": "exchange.bail.in", params: [tr_id, server_bail_in]}
+
+

+ +

The response is of the same form +

+ +

    {"id": 1, "result": [client_bail_in], "error": Null}
+
+

+ + +

Trade Cancel

+ + + +

This allows the parties to back out of a trade before the timeouts are completed. It is a courtesy and not enforceable. +

+ +

    {"id": 1, "method": "cancel.transaction", "params": "unlocked_server_refund_signature"}
+
+

+ +

The parameters are defined as +

+

    unlocked_server_refund_signature:   This is the signature for the server's refund transaction with locktime set to zero.
+
+

+ +

The response is +

+

    {"id": 1, "result": [unlocked_client_refund_signature]}
+
+

+ +

The parameters are defined as +

+

    unlocked_client_refund_signature:   This is the signature for the client's refund transaction with locktime set to zero.
+
+

+ +

Since this method is only a courtesy, it doesn't matter that the server could fail to provide the client with the refund transaction. +

+

Once this method is used, the parties should not proceed to step 3. +

+ +

Third Party Arbitration

+ + + +

This method is for submitting transactions to third parties. +

+ +

    {"id": 1, method:"arbitrate", "params": [tr_id third_party_key bail_in_p2sh_redeem refund_transaction new_transaction]}
+
+

+ +

The parameters are defined as +

+

    tr_id:                  The tr_id parameter encoded as a integer
+    third_party_key:        The third party's unmodified public key
+    bail_in_p2sh_redeem:    The P2SH Redeem script for the bail-in transction
+    refund_transaction:     The refund transactions, fully signed
+    new_transaction:        This is the new refund transaction
+
+

+ +

The third party must +

+

 * Verify that the refund transaction spends the p2sh_redeem script
+ * Verify that the refund and new transaction are identical except for tx-in hashes
+
+

+ +

The new transaction may have additional outputs. This allows the third party to be paid. +

+

The response is +

+ +

    {"id": 1, "result": [new_transaction_signature], "error": Null}
+
+

+ +

The third party doesn't have to monitor all the chains. As long as it doesn't allow the locktime to be modified or outputs to be redirected, the system remains secure. +

+ +

Compatibility

+ + + +

The protocol outlined in this BIP requires the use of a single non-standard scriptPubKey. +

+

The Bob.Bail.In transaction has a scriptPubKey of the following form. +

+ +

    OP_HASH160 Hash160(x) OP_EQUAL_VERIFY pub-A1 OP_CHECKSIG
+
+

+ +

All the other scriptPubKeys are standard transactions. +

+

If the transaction is only standard on one of the two networks, then the party selling coin on that network should be the fast trader. +

+ +

Reference Implementation

+ + + +

TBD +

+ +

References

+ + + +

[1] https://bitcointalk.org/index.php?topic=193281.0 +

+ +

Copyright

+ + + +

This document is placed in the public domain.

+
+ +
+ +Jump to Line + + +
+ +
+ +
+
+ +
+ +
+ +
+ + + + + + + +
+ + + Something went wrong with that request. Please try again. +
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips_files/5962559 b/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips_files/5962559 new file mode 100644 index 000000000..033f3e33e Binary files /dev/null and b/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips_files/5962559 differ diff --git a/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips_files/884931 b/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips_files/884931 new file mode 100644 index 000000000..9f506a9d8 Binary files /dev/null and b/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips_files/884931 differ diff --git a/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips_files/884931(1) b/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips_files/884931(1) new file mode 100644 index 000000000..9f506a9d8 Binary files /dev/null and b/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips_files/884931(1) differ diff --git a/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips_files/frameworks-ee521b8e9facac68ff27e93fc3ae0f8ed811d7bf9e434e84f4b9ea227780b084.js b/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips_files/frameworks-ee521b8e9facac68ff27e93fc3ae0f8ed811d7bf9e434e84f4b9ea227780b084.js new file mode 100644 index 000000000..f4100999e --- /dev/null +++ b/iguana/swaps/bips_bip-atom.mediawiki at bip4x · TierNolan_bips_files/frameworks-ee521b8e9facac68ff27e93fc3ae0f8ed811d7bf9e434e84f4b9ea227780b084.js @@ -0,0 +1,7 @@ +!function(){function e(e,t,n){r[e]={deps:t,callback:n}}function t(e,t){if("."!==t.charAt(0))return t;for(var n=t.split("/"),r=e.split("/").slice(0,-1),i=0,o=n.length;o>i;i++){var a=n[i];if(".."===a)r.pop();else{if("."===a)continue;r.push(a)}}return r.join("/")}function n(e){if(i[e])return i[e];if(!r[e])throw new Error("Could not find module "+e);i[e]={};for(var o=r[e],a=o.deps,s=o.callback,u=[],c=void 0,l=0,f=a.length;f>l;l++)"exports"===a[l]?u.push(c={}):u.push(n(t(e,a[l])));var d=s.apply(this,u);return i[e]=c||d}var r={},i={};window.define=e,window.require=n}(),define("github/feature-detection",["exports"],function(e){function t(){var e=document.createElement("canvas"),t=e.getContext("2d");t.fillStyle="#f00",t.textBaseline="top",t.font="32px Arial";var n=String.fromCharCode(55357)+String.fromCharCode(56360);return t.fillText(n,0,0),0!==t.getImageData(16,16,1,1).data[0]}function n(){try{var e=new CustomEvent("test",{detail:"supported"});return"supported"===e.detail}catch(t){return!1}}function r(){return o.classList?(i.classList.add("a","b"),i.classList.contains("b")):!1}Object.defineProperty(e,"__esModule",{value:!0});var i=document.createElement("input"),o={emoji:t(),CustomEvent:n(),registerElement:"registerElement"in document,setImmediate:"setImmediate"in window,Promise:"Promise"in window,URL:"URL"in window,WeakMap:"WeakMap"in window,fetch:"fetch"in window,closest:"function"==typeof i.closest,matches:"function"==typeof i.matches,stringEndsWith:"endsWith"in String.prototype,stringStartsWith:"startsWith"in String.prototype,performanceNow:!!(window.performance?window.performance.now:!1),performanceMark:!!(window.performance?window.performance.mark:!1),performanceGetEntries:!!(window.performance?window.performance.getEntries:!1),u2f:"u2f"in window||document.documentElement.classList.contains("is-u2f-enabled")};o.classList="classList"in i,o.classListMultiArg=r(),e["default"]=o}),require("github/feature-detection"),function(e,t){"use strict";function n(e){return h[p]=r.apply(t,e),p++}function r(e){var n=[].slice.call(arguments,1);return function(){"function"==typeof e?e.apply(t,n):new Function(""+e)()}}function i(e){if(m)setTimeout(r(i,e),0);else{var t=h[e];if(t){m=!0;try{t()}finally{o(e),m=!1}}}}function o(e){delete h[e]}function a(){d=function(){var e=n(arguments);return process.nextTick(r(i,e)),e}}function s(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}function u(){var t="setImmediate$"+Math.random()+"$",r=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&i(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",r,!1):e.attachEvent("onmessage",r),d=function(){var r=n(arguments);return e.postMessage(t+r,"*"),r}}function c(){var e=new MessageChannel;e.port1.onmessage=function(e){var t=e.data;i(t)},d=function(){var t=n(arguments);return e.port2.postMessage(t),t}}function l(){var e=v.documentElement;d=function(){var t=n(arguments),r=v.createElement("script");return r.onreadystatechange=function(){i(t),r.onreadystatechange=null,e.removeChild(r),r=null},e.appendChild(r),t}}function f(){d=function(){var e=n(arguments);return setTimeout(r(i,e),0),e}}if(!e.setImmediate){var d,p=1,h={},m=!1,v=e.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(e);g=g&&g.setTimeout?g:e,"[object process]"==={}.toString.call(e.process)?a():s()?u():e.MessageChannel?c():v&&"onreadystatechange"in v.createElement("script")?l():f(),g.setImmediate=d,g.clearImmediate=o}}("undefined"==typeof self?"undefined"==typeof global?this:global:self),function(){"use strict";function e(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function t(e){return"string"!=typeof e&&(e=String(e)),e}function n(e){this.map={},e instanceof n?e.forEach(function(e,t){this.append(t,e)},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function r(e){return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function i(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function o(e){var t=new FileReader;return t.readAsArrayBuffer(e),i(t)}function a(e){var t=new FileReader;return t.readAsText(e),i(t)}function s(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,"string"==typeof e)this._bodyText=e;else if(p.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(p.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(e){if(!p.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e))throw new Error("unsupported BodyInit type")}else this._bodyText=""},p.blob?(this.blob=function(){var e=r(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(o)},this.text=function(){var e=r(this);if(e)return e;if(this._bodyBlob)return a(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)}):this.text=function(){var e=r(this);return e?e:Promise.resolve(this._bodyText)},p.formData&&(this.formData=function(){return this.text().then(l)}),this.json=function(){return this.text().then(JSON.parse)},this}function u(e){var t=e.toUpperCase();return h.indexOf(t)>-1?t:e}function c(e,t){t=t||{};var r=t.body;if(c.prototype.isPrototypeOf(e)){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new n(e.headers)),this.method=e.method,this.mode=e.mode,r||(r=e._bodyInit,e.bodyUsed=!0)}else this.url=e;if(this.credentials=t.credentials||this.credentials||"omit",(t.headers||!this.headers)&&(this.headers=new n(t.headers)),this.method=u(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function l(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}}),t}function f(e){var t=new n,r=e.getAllResponseHeaders().trim().split("\n");return r.forEach(function(e){var n=e.trim().split(":"),r=n.shift().trim(),i=n.join(":").trim();t.append(r,i)}),t}function d(e,t){t||(t={}),this._initBody(e),this.type="default",this.status=t.status,this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText,this.headers=t.headers instanceof n?t.headers:new n(t.headers),this.url=t.url||""}if(!self.fetch){n.prototype.append=function(n,r){n=e(n),r=t(r);var i=this.map[n];i||(i=[],this.map[n]=i),i.push(r)},n.prototype["delete"]=function(t){delete this.map[e(t)]},n.prototype.get=function(t){var n=this.map[e(t)];return n?n[0]:null},n.prototype.getAll=function(t){return this.map[e(t)]||[]},n.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},n.prototype.set=function(n,r){this.map[e(n)]=[t(r)]},n.prototype.forEach=function(e,t){Object.getOwnPropertyNames(this.map).forEach(function(n){this.map[n].forEach(function(r){e.call(t,r,n,this)},this)},this)};var p={blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self},h=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];c.prototype.clone=function(){return new c(this)},s.call(c.prototype),s.call(d.prototype),d.prototype.clone=function(){return new d(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new n(this.headers),url:this.url})},d.error=function(){var e=new d(null,{status:0,statusText:""});return e.type="error",e};var m=[301,302,303,307,308];d.redirect=function(e,t){if(-1===m.indexOf(t))throw new RangeError("Invalid status code");return new d(null,{status:t,headers:{location:e}})},self.Headers=n,self.Request=c,self.Response=d,self.fetch=function(e,t){return new Promise(function(n,r){function i(){return"responseURL"in a?a.responseURL:/^X-Request-URL:/m.test(a.getAllResponseHeaders())?a.getResponseHeader("X-Request-URL"):void 0}var o;o=c.prototype.isPrototypeOf(e)&&!t?e:new c(e,t);var a=new XMLHttpRequest;a.onload=function(){var e=1223===a.status?204:a.status;if(100>e||e>599)return void r(new TypeError("Network request failed"));var t={status:e,statusText:a.statusText,headers:f(a),url:i()},o="response"in a?a.response:a.responseText;n(new d(o,t))},a.onerror=function(){r(new TypeError("Network request failed"))},a.open(o.method,o.url,!0),"include"===o.credentials&&(a.withCredentials=!0),"responseType"in a&&p.blob&&(a.responseType="blob"),o.headers.forEach(function(e,t){a.setRequestHeader(t,e)}),a.send("undefined"==typeof o._bodyInit?null:o._bodyInit)})},self.fetch.polyfill=!0}}(),"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.prototype={set:function(t,n){var r=t[this.name];return r&&r[0]===t?r[1]=n:e(t,this.name,{value:[t,n],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=n}(),function(e){function t(e){w.push(e),b||(b=!0,m(r))}function n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function r(){b=!1;var e=w;w=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var n=e.takeRecords();i(e),n.length&&(e.callback_(n,e),t=!0)}),t&&r()}function i(e){e.nodes_.forEach(function(t){var n=v.get(t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function o(e,t){for(var n=e;n;n=n.parentNode){var r=v.get(n);if(r)for(var i=0;i0){var i=n[r-1],o=p(i,e);if(o)return void(n[r-1]=o)}else t(this.observer);n[r]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=v.get(e);t||v.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=v.get(e),n=0;n=0)){n.push(e);for(var r,i=e.querySelectorAll("link[rel="+a+"]"),s=0,u=i.length;u>s&&(r=i[s]);s++)r["import"]&&o(r["import"],t,n);t(e)}}var a=window.HTMLImports?window.HTMLImports.IMPORT_LINK_TYPE:"none";e.forDocumentTree=i,e.forSubtree=t}),window.CustomElements.addModule(function(e){function t(e,t){return n(e,t)||r(e,t)}function n(t,n){return e.upgrade(t,n)?!0:void(n&&a(t))}function r(e,t){b(e,function(e){return n(e,t)?!0:void 0})}function i(e){T.push(e),E||(E=!0,setTimeout(o))}function o(){E=!1;for(var e,t=T,n=0,r=t.length;r>n&&(e=t[n]);n++)e();T=[]}function a(e){x?i(function(){s(e)}):s(e)}function s(e){e.__upgraded__&&!e.__attached&&(e.__attached=!0,e.attachedCallback&&e.attachedCallback())}function u(e){c(e),b(e,function(e){c(e)})}function c(e){x?i(function(){l(e)}):l(e)}function l(e){e.__upgraded__&&e.__attached&&(e.__attached=!1,e.detachedCallback&&e.detachedCallback())}function f(e){for(var t=e,n=window.wrap(document);t;){if(t==n)return!0;t=t.parentNode||t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host}}function d(e){if(e.shadowRoot&&!e.shadowRoot.__watched){y.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)m(t),t=t.olderShadowRoot}}function p(e,n){if(y.dom){var r=n[0];if(r&&"childList"===r.type&&r.addedNodes&&r.addedNodes){for(var i=r.addedNodes[0];i&&i!==document&&!i.host;)i=i.parentNode;var o=i&&(i.URL||i._URL||i.host&&i.host.localName)||"";o=o.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",n.length,o||"")}var a=f(e);n.forEach(function(e){"childList"===e.type&&(C(e.addedNodes,function(e){e.localName&&t(e,a)}),C(e.removedNodes,function(e){e.localName&&u(e)}))}),y.dom&&console.groupEnd()}function h(e){for(e=window.wrap(e),e||(e=window.wrap(document));e.parentNode;)e=e.parentNode;var t=e.__observer;t&&(p(e,t.takeRecords()),o())}function m(e){if(!e.__observer){var t=new MutationObserver(p.bind(this,e));t.observe(e,{childList:!0,subtree:!0}),e.__observer=t}}function v(e){e=window.wrap(e),y.dom&&console.group("upgradeDocument: ",e.baseURI.split("/").pop());var n=e===window.wrap(document);t(e,n),m(e),y.dom&&console.groupEnd()}function g(e){w(e,v)}var y=e.flags,b=e.forSubtree,w=e.forDocumentTree,x=window.MutationObserver._isPolyfilled&&y["throttle-attached"];e.hasPolyfillMutations=x,e.hasThrottledAttached=x;var E=!1,T=[],C=Array.prototype.forEach.call.bind(Array.prototype.forEach),_=Element.prototype.createShadowRoot;_&&(Element.prototype.createShadowRoot=function(){var e=_.call(this);return window.CustomElements.watchShadow(this),e}),e.watchShadow=d,e.upgradeDocumentTree=g,e.upgradeDocument=v,e.upgradeSubtree=r,e.upgradeAll=t,e.attached=a,e.takeRecords=h}),window.CustomElements.addModule(function(e){function t(t,r){if("template"===t.localName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(t),!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var i=t.getAttribute("is"),o=e.getRegisteredDefinition(t.localName)||e.getRegisteredDefinition(i);if(o&&(i&&o.tag==t.localName||!i&&!o["extends"]))return n(t,o,r)}}function n(t,n,i){return a.upgrade&&console.group("upgrade:",t.localName),n.is&&t.setAttribute("is",n.is),r(t,n),t.__upgraded__=!0,o(t),i&&e.attached(t),e.upgradeSubtree(t,i),a.upgrade&&console.groupEnd(),t}function r(e,t){Object.__proto__?e.__proto__=t.prototype:(i(e,t.prototype,t["native"]),e.__proto__=t.prototype)}function i(e,t,n){for(var r={},i=t;i!==n&&i!==HTMLElement.prototype;){for(var o,a=Object.getOwnPropertyNames(i),s=0;o=a[s];s++)r[o]||(Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(i,o)),r[o]=1);i=Object.getPrototypeOf(i)}}function o(e){e.createdCallback&&e.createdCallback()}var a=e.flags;e.upgrade=t,e.upgradeWithDefinition=n,e.implementPrototype=r}),window.CustomElements.addModule(function(e){function t(t,r){var u=r||{};if(!t)throw new Error("document.registerElement: first argument `name` must not be empty");if(t.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(t)+"'.");if(i(t))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(t)+"'. The type name is invalid.");if(c(t))throw new Error("DuplicateDefinitionError: a type with name '"+String(t)+"' is already registered");return u.prototype||(u.prototype=Object.create(HTMLElement.prototype)),u.__name=t.toLowerCase(),u.lifecycle=u.lifecycle||{},u.ancestry=o(u["extends"]),a(u),s(u),n(u.prototype),l(u.__name,u),u.ctor=f(u),u.ctor.prototype=u.prototype,u.prototype.constructor=u.ctor,e.ready&&g(document),u.ctor}function n(e){if(!e.setAttribute._polyfilled){var t=e.setAttribute;e.setAttribute=function(e,n){r.call(this,e,n,t)};var n=e.removeAttribute;e.removeAttribute=function(e){r.call(this,e,null,n)},e.setAttribute._polyfilled=!0}}function r(e,t,n){e=e.toLowerCase();var r=this.getAttribute(e);n.apply(this,arguments);var i=this.getAttribute(e);this.attributeChangedCallback&&i!==r&&this.attributeChangedCallback(e,r,i)}function i(e){for(var t=0;t=0&&w(r,HTMLElement),r)}function h(e,t){var n=e[t];e[t]=function(){var e=n.apply(this,arguments);return y(e),e}}var m,v=e.isIE,g=e.upgradeDocumentTree,y=e.upgradeAll,b=e.upgradeWithDefinition,w=e.implementPrototype,x=e.useNative,E=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],T={},C="http://www.w3.org/1999/xhtml",_=document.createElement.bind(document),j=document.createElementNS.bind(document);m=Object.__proto__||x?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;for(var n=e;n;){if(n===t.prototype)return!0;n=n.__proto__}return!1},h(Node.prototype,"cloneNode"),h(document,"importNode"),v&&!function(){var e=document.importNode;document.importNode=function(){var t=e.apply(document,arguments);if(t.nodeType==t.DOCUMENT_FRAGMENT_NODE){var n=document.createDocumentFragment();return n.appendChild(t),n}return t}}(),document.registerElement=t,document.createElement=p,document.createElementNS=d,e.registry=T,e["instanceof"]=m,e.reservedTagList=E,e.getRegisteredDefinition=c,document.register=document.registerElement}),function(e){function t(){o(window.wrap(document)),window.CustomElements.ready=!0;var e=window.requestAnimationFrame||function(e){setTimeout(e,16)};e(function(){setTimeout(function(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(window.CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})})}var n=e.useNative,r=e.initializeModules;e.isIE;if(n){var i=function(){};e.watchShadow=i,e.upgrade=i,e.upgradeAll=i,e.upgradeDocumentTree=i,e.upgradeSubtree=i,e.takeRecords=i,e["instanceof"]=function(e,t){return e instanceof t}}else r();var o=e.upgradeDocumentTree,a=e.upgradeDocument;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=window.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function(e){e["import"]&&a(wrap(e["import"]))}),"complete"===document.readyState||e.flags.eager)t();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var s=window.HTMLImports&&!window.HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(s,t)}else t()}(window.CustomElements),function(e){"use strict";function t(e){return void 0!==d[e]}function n(){s.call(this),this._isInvalid=!0}function r(e){return""==e&&n.call(this),e.toLowerCase()}function i(e){var t=e.charCodeAt(0);return t>32&&127>t&&-1==[34,35,60,62,63,96].indexOf(t)?e:encodeURIComponent(e)}function o(e){var t=e.charCodeAt(0);return t>32&&127>t&&-1==[34,35,60,62,96].indexOf(t)?e:encodeURIComponent(e)}function a(e,a,s){function u(e){b.push(e)}var c=a||"scheme start",l=0,f="",g=!1,y=!1,b=[];e:for(;(e[l-1]!=h||0==l)&&!this._isInvalid;){var w=e[l];switch(c){case"scheme start":if(!w||!m.test(w)){if(a){u("Invalid scheme.");break e}f="",c="no scheme";continue}f+=w.toLowerCase(),c="scheme";break;case"scheme":if(w&&v.test(w))f+=w.toLowerCase();else{if(":"!=w){if(a){if(h==w)break e;u("Code point not allowed in scheme: "+w);break e}f="",l=0,c="no scheme";continue}if(this._scheme=f,f="",a)break e;t(this._scheme)&&(this._isRelative=!0),c="file"==this._scheme?"relative":this._isRelative&&s&&s._scheme==this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"==w?(query="?",c="query"):"#"==w?(this._fragment="#",c="fragment"):h!=w&&" "!=w&&"\n"!=w&&"\r"!=w&&(this._schemeData+=i(w));break;case"no scheme":if(s&&t(s._scheme)){c="relative";continue}u("Missing scheme."),n.call(this);break;case"relative or authority":if("/"!=w||"/"!=e[l+1]){u("Expected /, got: "+w),c="relative";continue}c="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!=this._scheme&&(this._scheme=s._scheme),h==w){this._host=s._host,this._port=s._port,this._path=s._path.slice(),this._query=s._query,this._username=s._username,this._password=s._password;break e}if("/"==w||"\\"==w)"\\"==w&&u("\\ is an invalid code point."),c="relative slash";else if("?"==w)this._host=s._host,this._port=s._port,this._path=s._path.slice(),this._query="?",this._username=s._username,this._password=s._password,c="query";else{if("#"!=w){var x=e[l+1],E=e[l+2];("file"!=this._scheme||!m.test(w)||":"!=x&&"|"!=x||h!=E&&"/"!=E&&"\\"!=E&&"?"!=E&&"#"!=E)&&(this._host=s._host,this._port=s._port,this._username=s._username,this._password=s._password,this._path=s._path.slice(),this._path.pop()),c="relative path";continue}this._host=s._host,this._port=s._port,this._path=s._path.slice(),this._query=s._query,this._fragment="#",this._username=s._username,this._password=s._password,c="fragment"}break;case"relative slash":if("/"!=w&&"\\"!=w){"file"!=this._scheme&&(this._host=s._host,this._port=s._port,this._username=s._username,this._password=s._password),c="relative path";continue}"\\"==w&&u("\\ is an invalid code point."),c="file"==this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!=w){u("Expected '/', got: "+w),c="authority ignore slashes";continue}c="authority second slash";break;case"authority second slash":if(c="authority ignore slashes","/"!=w){u("Expected '/', got: "+w);continue}break;case"authority ignore slashes":if("/"!=w&&"\\"!=w){c="authority";continue}u("Expected authority, got: "+w);break;case"authority":if("@"==w){g&&(u("@ already seen."),f+="%40"),g=!0;for(var T=0;T1){var s=arguments[1];void 0!==s&&(a=s?Number(s):0,a!=a&&(a=0))}var u=Math.min(Math.max(a,0),r),c=u-o;if(0>c)return!1;for(var l=-1;++l1?arguments[1]:void 0,s=a?Number(a):0;s!=s&&(s=0);var u=Math.min(Math.max(s,0),r);if(o+u>r)return!1;for(var c=-1;++c0?1:-1)*Math.floor(Math.abs(t)):t},i=Math.pow(2,53)-1,o=function(e){var t=r(e);return Math.min(Math.max(t,0),i)},a=function(t){var r=this;if(null==t)throw new TypeError("`Array.from` requires an array-like object, not `null` or `undefined`");var i,a,s=Object(t);arguments.length>1;if(arguments.length>1){if(i=arguments[1],!n(i))throw new TypeError("When provided, the second argument to `Array.from` must be a function");arguments.length>2&&(a=arguments[2])}for(var u,c,l=o(s.length),f=n(r)?Object(new r(l)):new Array(l),d=0;l>d;)u=s[d],c=i?"undefined"==typeof a?i(u,d):i.call(a,u,d):u,e(f,d,{value:c,configurable:!0,enumerable:!0}),++d;return f.length=l,f};e(Array,"from",{value:a,configurable:!0,writable:!0})}(),function(e){"use strict";"undefined"==typeof e&&(e={}),"undefined"==typeof e.performance&&(e.performance={}),e._perfRefForUserTimingPolyfill=e.performance,e.performance.userTimingJsNow=!1,e.performance.userTimingJsNowPrefixed=!1,e.performance.userTimingJsUserTiming=!1,e.performance.userTimingJsUserTimingPrefixed=!1,e.performance.userTimingJsPerformanceTimeline=!1,e.performance.userTimingJsPerformanceTimelinePrefixed=!1;var t,n,r=[],i=[],o=null;if("function"!=typeof e.performance.now){for(e.performance.userTimingJsNow=!0,i=["webkitNow","msNow","mozNow"],t=0;t=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=v.call(i,"catchLoc"),s=v.call(i,"finallyLoc");if(a&&s){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&v.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),f(n),j}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;f(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:p(e),resultName:t,nextLoc:n},j}}}("object"==typeof global?global:"object"==typeof window?window:"object"==typeof self?self:this),function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=e.length,n=Q.type(e);return"function"===n||Q.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function r(e,t,n){if(Q.isFunction(t))return Q.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return Q.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(se.test(t))return Q.filter(t,e,n);t=Q.filter(t,e)}return Q.grep(e,function(e){return X.call(t,e)>=0!==n})}function i(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function o(e){var t=he[e]={};return Q.each(e.match(pe)||[],function(e,n){t[n]=!0}),t}function a(){Z.removeEventListener("DOMContentLoaded",a,!1),e.removeEventListener("load",a,!1),Q.ready()}function s(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=Q.expando+s.uid++}function u(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(we,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:be.test(n)?Q.parseJSON(n):n}catch(i){}ye.set(e,t,n)}else n=void 0;return n}function c(){return!0}function l(){return!1}function f(){try{return Z.activeElement}catch(e){}}function d(e,t){return Q.nodeName(e,"table")&&Q.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function p(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function h(e){var t=Pe.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function m(e,t){for(var n=0,r=e.length;r>n;n++)ge.set(e[n],"globalEval",!t||ge.get(t[n],"globalEval"))}function v(e,t){var n,r,i,o,a,s,u,c;if(1===t.nodeType){if(ge.hasData(e)&&(o=ge.access(e),a=ge.set(t,o),c=o.events)){delete a.handle,a.events={};for(i in c)for(n=0,r=c[i].length;r>n;n++)Q.event.add(t,i,c[i][n])}ye.hasData(e)&&(s=ye.access(e),u=Q.extend({},s),ye.set(t,u))}}function g(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&Q.nodeName(e,t)?Q.merge([e],n):n}function y(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Ce.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function b(t,n){var r,i=Q(n.createElement(t)).appendTo(n.body),o=e.getDefaultComputedStyle&&(r=e.getDefaultComputedStyle(i[0]))?r.display:Q.css(i[0],"display");return i.detach(),o}function w(e){var t=Z,n=$e[e];return n||(n=b(e,t),"none"!==n&&n||(qe=(qe||Q("')}catch(i){r=qe[V]("iframe"),t(r,e)}r.height="0",r.width="0",r.style.display="none",r.style.visibility="hidden";var s=qe[Q],s=He()+"/analytics_iframe.html#"+H(s[ne]+"//"+s[J]+"/favicon.ico"),o=function(){r.src="",r[we]&&r[we].removeChild(r)};Se(Te,"beforeunload",o);var a=!1,c=0,u=function(){if(!a){try{if(c>9||r.contentWindow[Q][J]==qe[Q][J])return a=!0,o(),Le(Te,"beforeunload",o),void n()}catch(e){}c++,O(u,200)}};return Se(r,"load",u),qe.body.appendChild(r),r.src=s,!0},Ye=function(){this.t=[]};Ye[pe].add=function(e){this.t[oe](e)},Ye[pe].D=function(e){try{for(var t=0;t=n)&&(n={},zn(n)||Bn(n))){var r=n[Mt];void 0==r||1/0==r||isNaN(r)||(r>0?(Un(n,Ht),Un(n,Ft),Un(n,Ot),Un(n,Rt),Un(n,Nt),Un(n,zt),Un(n,Bt),t(n)):Se(Te,"load",function(){Fn(e,t)},!1))}},zn=function(e){var t=Te.performance||Te.webkitPerformance,t=t&&t.timing;if(!t)return!1;var n=t.navigationStart;return 0==n?!1:(e[Mt]=t.loadEventStart-n,e[Ht]=t.domainLookupEnd-t.domainLookupStart,e[Ft]=t.connectEnd-t.connectStart,e[Ot]=t.responseStart-t.requestStart,e[Rt]=t.responseEnd-t.responseStart,e[Nt]=t.fetchStart-n,e[zt]=t.domInteractive-n,e[Bt]=t.domContentLoadedEventStart-n,!0)},Bn=function(e){if(Te.top!=Te)return!1;var t=Te.external,n=t&&t.onloadT;return t&&!t.isValidLoadTime&&(n=void 0),n>2147483648&&(n=void 0),n>0&&t.setPageReadyTime(),void 0==n?!1:(e[Mt]=n,!0)},Un=function(e,t){var n=e[t];(isNaN(n)||1/0==n||0>n)&&(e[t]=void 0)},Wn=function(e){return function(t){"pageview"!=t.get(mt)||e.I||(e.I=!0,Fn(t,function(t){e[W]("timing",t)}))}},Yn=!1,Vn=function(e){if("cookie"==Ze(e,qn)){var t=Ze(e,kn),r=Jn(e),i=er(Ze(e,Sn)),s=Qn(Ze(e,Cn)),o=1e3*et(e,Ln),a=Ze(e,xn);if("auto"!=s)Pe(t,r,i,s,a,o)&&(Yn=!0);else{n(32);var c;if(r=[],s=p()[X]("."),4!=s[me]||(c=s[s[me]-1],parseInt(c,10)!=c)){for(c=s[me]-2;c>=0;c--)r[oe](s[ue](c)[xe]("."));r[oe]("none"),c=r}else c=["none"];for(var u=0;u1&&(n+="-"+e),["GA1",n,t][xe](".")},Xn=function(e,t,n){for(var r,i=[],s=[],o=0;o0;){if(a[re]&&a.nodeName[U](/^a(?:rea)?$/i)){s=a;break e}a=a[we],i--}s={}}("http:"==s[ne]||"https:"==s[ne])&&P(t,s[ee]||"")&&s[re]&&e(s,sr(o,s[re],r))}catch(c){n(26)}}var o=this;if(this.T||(this.T=!0,Se(qe,"mousedown",s,!1),Se(qe,"touchstart",s,!1),Se(qe,"keyup",s,!1)),i){i=function(e){if(e=e||Te.event,(e=e[ve]||e.srcElement)&&e[ie]){var n=e[ie][U](nr);n&&P(t,n[1])&&or(o,e)}};for(var a=0;ai[me])){r=[];for(var s=0;s=c[0]||0>=c[1]?"":c[xe]("x"),e.set(St,r),e.set(At,T()),e.set(xt,qe.characterSet||qe.charset),e.set(Lt,t&&"function"==typeof t.javaEnabled&&t.javaEnabled()||!1),e.set(wt,(t&&(t.language||t.browserLanguage)||"")[ke]()),i&&e.get(En)&&(t=qe[Q][ae])){for(t=t[X](/[?&#]+/),i=[],r=0;rarguments[me])){var t,r;"string"==typeof arguments[0]?(t=arguments[0],r=[][ue][be](arguments,1)):(t=arguments[0]&&arguments[0][mt],r=arguments),t&&(r=v(wr[t]||[],r),r[mt]=t,this.b.set(r,void 0,!0),this.filters.D(this.b),this.b[B].m={},n(44))}};var xr,kr,Cr,Sr=function(e){return"prerender"==qe.visibilityState?!1:(e(),!0)},Lr=/^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/,Ar=function(e){if(r(e[0]))this.u=e[0];else{var t=Lr.exec(e[0]);if(null!=t&&4==t[me]&&(this.c=t[1]||"t0",this.e=t[2]||"",this.d=t[3],this.a=[][ue][be](e,1),this.e||(this.A="create"==this.d,this.i="require"==this.d,this.g="provide"==this.d,this.ba="remove"==this.d),this.i&&(3<=this.a[me]?(this.X=this.a[1],this.W=this.a[2]):this.a[1]&&(s(this.a[1])?this.X=this.a[1]:this.W=this.a[1]))),t=e[1],e=e[2],!this.d)throw"abort";if(this.i&&(!s(t)||""==t))throw"abort";if(this.g&&(!s(t)||""==t||!r(e)))throw"abort";if(M(this.c)||M(this.e))throw"abort";if(this.g&&"t0"!=this.c)throw"abort"}};xr=new Ae,Cr=new Ae,kr={ec:45,ecommerce:46,linkid:47};var Tr=function(e,t,i){t==Er?n(35):t.get($n);var s=xr.get(e);return r(s)?(t.plugins_=t.plugins_||new Ae,t.plugins_.get(e)?!0:(t.plugins_.set(e,new s(t,i||{})),!0)):!1},qr=function(t){function n(e){var t=(e[ee]||"")[X](":")[0][ke](),n=(e[ne]||"")[ke](),n=1*e[Y]||("http:"==n?80:"https:"==n?443:"");return e=e.pathname||"",o(e,"/")||(e="/"+e),[t,""+n,e]}var r=qe[V]("a");e(r,qe[Q][re]);var i=(r[ne]||"")[ke](),s=n(r),a=r[te]||"",c=i+"//"+s[0]+(s[1]?":"+s[1]:"");return o(t,"//")?t=i+t:o(t,"/")?t=c+t:!t||o(t,"?")?t=c+s[2]+(t||a):0>t[X]("/")[0][de](":")&&(t=c+s[2][$e](0,s[2].lastIndexOf("/"))+"/"+t),e(r,t),i=n(r),{protocol:(r[ne]||"")[ke](),host:i[0],port:i[1],path:i[2],G:r[te]||"",url:t||""}},_r={ga:function(){_r.f=[]}};_r.ga(),_r.D=function(e){var t=_r.J[se](_r,arguments),t=_r.f.concat(t);for(_r.f=[];0n;n++)s=o[n],window.ga("set",s.name,s.content)},n=function(){var n;return n={title:t(),path:e()},window.ga("send","pageview",n)},r=function(){return i(),n()},function(){var e;if(e=document.querySelector("meta[name=google-analytics]"))return window.ga("create",e.content,"github.com"),i()}(),$(function(){return n()}),$(document).on("pjax:complete",function(){return setTimeout(r,20)})}.call(this),function(){var e,t,n,r,i=function(e,t){function n(){this.constructor=e}for(var r in t)s.call(t,r)&&(e[r]=t[r]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},s={}.hasOwnProperty;e=function(e){function t(e){this.name="InvalidGAEventValueError",this.message="The event value in '"+JSON.stringify(e)+"' has to be an integer."}return i(t,e),t}(Error),n=function(t,n){var r;if(null==n&&(n=!0),t=t.trim().split(/\s*,\s*/),t[3])if(/^\d+$/.test(t[3]))t[3]=Number(t[3]);else if($(document.documentElement).hasClass("is-preview-features"))return r=new e(t),void setImmediate(function(){throw r});t.unshift("send","event"),t.push({useBeacon:!0,nonInteraction:!n}),window.ga.apply(null,t)},t=function(e){var t;t=$(e.target).closest("[data-ga-click]").attr("data-ga-click"),t&&n(t)},r=function(e){window.ga("send","pageview",e)},$.observe("[data-ga-load]",function(){n(this.getAttribute("data-ga-load"),!1)}),$.observe("meta[name=analytics-event]",function(){n(this.content,!1)}),$.observe("meta[name=analytics-virtual-pageview]",function(){r(this.content)}),window.addEventListener("click",t,!0)}.call(this),function(){$.fn.hasDirtyFields=function(){var e,t,n,r;for(r=this.find("input, textarea"),t=0,n=r.length;n>t;t++)if(e=r[t],e.value!==e.defaultValue)return!0;return!1}}.call(this),function(){var e;e=function(e){var t,n;return e.nodeType!==Node.ELEMENT_NODE?!1:(t=e.nodeName.toLowerCase(),n=(e.getAttribute("type")||"").toLowerCase(),"select"===t||"textarea"===t||"input"===t&&"submit"!==n&&"reset"!==n)},$.fn.hasFocus=function(){var t,n;return(t=this[0])?(n=document.activeElement,e(n)&&t===n||$.contains(t,n)):!1}}.call(this),function(){$.fn.hasMousedown=function(){var e;return(e=this[0])?$(e).is(":active"):!1}}.call(this),function(){$.fn.markedAsDirty=function(){return this.closest(".is-dirty").length>0||this.find(".is-dirty").length>0}}.call(this),function(){$.fn.hasInteractions=function(){return this.hasDirtyFields()||this.hasFocus()||this.hasMousedown()||this.markedAsDirty()}}.call(this),function(){$.observe(".js-in-app-popup",function(e){setTimeout(function(e){return function(){return $(e).submit()}}(this),15e3)})}.call(this),function(){$.pageFocused=function(){return new Promise(function(e){var t;return t=function(){document.hasFocus()&&(e(),document.removeEventListener("visibilitychange",t),window.removeEventListener("focus",t),window.removeEventListener("blur",t))},document.addEventListener("visibilitychange",t),window.addEventListener("focus",t),window.addEventListener("blur",t),t()})}}.call(this),function(){var e,t,n,r,i,s,o;i=0,n=-1,t=function(e){var t,n,r,i;return t=e.getBoundingClientRect(),r=$(window).height(),i=$(window).width(),0===t.height?!1:t.height=0&&t.left>=0&&t.bottom<=r&&t.right<=i:(n=Math.ceil(r/2),t.top>=0&&t.top+nr;r++)n=s[r],t(n)?c.push(null!=(o=e["in"])?o.call(n,n,e):void 0):c.push(null!=(a=e.out)?a.call(n,n,e):void 0);return c},o=function(t){return document.hasFocus()&&window.scrollY!==n&&(n=window.scrollY,!t.checkPending)?(t.checkPending=!0,window.requestAnimationFrame(function(){return t.checkPending=!1,e(t)})):void 0},r=function(t,n){return 0===n.elements.length&&(window.addEventListener("scroll",n.scrollHandler),$.pageFocused().then(function(){return e(n)})),n.elements.push(t)},s=function(e,t){var n;return n=t.elements.indexOf(e),-1!==n&&t.elements.splice(n,1),0===t.elements.length?window.removeEventListener("scroll",t.scrollHandler):void 0},$.inViewport=function(e,t){var n;return null!=t.call&&(t={"in":t}),n={id:i++,selector:e,"in":t["in"],out:t.out,elements:[],checkPending:!1},n.scrollHandler=function(){return o(n)},$.observe(e,{add:function(e){return r(e,n)},remove:function(e){return s(e,n)}}),n}}.call(this),function(){$.interactiveElement=function(){var e,t,n;return document.activeElement!==document.body?e=document.activeElement:(t=document.querySelectorAll(":hover"),(n=t.length)&&(e=t[n-1])),$(e)}}.call(this),function(){var e,t,n;e=require("github/fetch").fetchJSON,t=function(){var t,r,i,s,o,a,c,u,l;if(l=this.getAttribute("data-url")){for(u=e(l),a=this.getAttribute("data-id"),i=document.querySelectorAll(".js-issue-link[data-id='"+a+"']"),o=0,c=i.length;c>o;o++)r=i[o],r.removeAttribute("data-url");return t=function(e){return n(i,e.title)},s=function(e){return function(t){var r,s,o;return o=(null!=(s=t.response)?s.status:void 0)||500,r=function(){switch(o){case 404:return this.getAttribute("data-permission-text");default:return this.getAttribute("data-error-text")}}.call(e),n(i,r)}}(this),u.then(t,s)}},n=function(e,t){var n,r,i,s;for(s=[],r=0,i=e.length;i>r;r++)n=e[r],s.push(n.setAttribute("title",t));return s},$.observe(".js-issue-link",function(){this.addEventListener("mouseenter",t)})}.call(this),function(){$(document).on("ajaxSuccess",".js-immediate-updates",function(e,t,n,r){var i,s,o;if(this===e.target){s=r.updateContent;for(o in s)i=s[o],$(o).updateContent(i)}})}.call(this),function(){$.observe(".labeled-button:checked",{add:function(){return $(this).parent("label").addClass("selected")},remove:function(){return $(this).parent("label").removeClass("selected")}})}.call(this),function(){var e;e="is-last-changed",$(document).on("change","form.js-form-last-changed",function(t){var n,r;n=t.target,null!=(r=this.querySelector("."+e))&&r.classList.remove(e),n.classList.add(e)})}.call(this),function(){var e,t,n,r,i,s=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};t=null,e=function(e){t&&n(t),$(e).fire("menu:activate",function(){return $(document).on("keydown.menu",i),$(document).on("click.menu",r),t=e,$(e).performTransition(function(){return e.classList.add("active"),$(e).find(".js-menu-content[aria-hidden]").attr("aria-hidden","false")}),$(e).fire("menu:activated",{async:!0})})},n=function(e){$(e).fire("menu:deactivate",function(){return $(document).off(".menu"),t=null,$(e).performTransition(function(){return e.classList.remove("active"),$(e).find(".js-menu-content[aria-hidden]").attr("aria-hidden","true")}),$(e).fire("menu:deactivated",{async:!0})})},r=function(e){t&&($(e.target).closest(t)[0]||(e.preventDefault(),n(t)))},i=function(e){t&&"esc"===e.hotkey&&(s.call($(document.activeElement).parents(),t)>=0&&document.activeElement.blur(),e.preventDefault(),n(t))},$(document).on("click",".js-menu-container",function(r){var i,s,o;i=this,(o=$(r.target).closest(".js-menu-target")[0])?(r.preventDefault(),i===t?n(i):e(i)):(s=$(r.target).closest(".js-menu-content")[0])||i===t&&(r.preventDefault(),n(i))}),$(document).on("click",".js-menu-container .js-menu-close",function(e){n($(this).closest(".js-menu-container")[0]),e.preventDefault()}),$.fn.menu=function(t){var r,i;return(r=$(this).closest(".js-menu-container")[0])?(i={activate:function(){return e(r)},deactivate:function(){return n(r)}},"function"==typeof i[t]?i[t]():void 0):void 0},$.observe(".js-menu-container.active",{add:function(){return document.body.classList.add("menu-active")},remove:function(){return document.body.classList.remove("menu-active")}})}.call(this),function(){var e;$(document).on("focus","div.btn-sm, span.btn-sm",function(){$(this).on("keydown",e)}),$(document).on("blur","div.btn-sm, span.btn-sm",function(){$(this).off("keydown",e)}),e=function(e){"enter"===e.hotkey&&($(this).click(),e.preventDefault())}}.call(this),function(){$(document).on("submit",".js-mobile-preference-form",function(e){var t;return t=$(this).find(".js-mobile-preference-anchor-field"),t.val(window.location.hash.substr(1)),!0})}.call(this),define("github/hash-change",["exports"],function(e){function t(e){$.hashChange(e)}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=t}),define("github/sticky-scroll-into-view",["exports"],function(e){function t(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1&&this.href===e&&(history.back(),t.preventDefault())})}.call(this),function(){$(document).on("pjax:click",function(){return window.onbeforeunload?!1:void 0})}.call(this),function(){var e;e=function(){var e,t;return t=function(){var t,n,r;for(r=[],t=0,n=arguments.length;n>t;t++)e=arguments[t],r.push(e.split("/",3).join("/"));return r}.apply(this,arguments),t[0]===t[1]},$(document).on("pjax:click","#js-repo-pjax-container a[href]",function(){var t;return t=$(this).prop("pathname"),e(t,location.pathname)?void 0:!1}),$(document).on("pjax:click",".js-comment-body",function(e){return"files"!==e.target.pathname.split("/")[3]})}.call(this),function(){var e,t;$.support.pjax&&(t={},$(e=function(){return t[document.location.pathname]=$("head [data-pjax-transient]")}),$(document).on("pjax:beforeReplace",function(e,n){var r,i,s,o;for(i=s=0,o=n.length;o>s;i=++s)r=n[i],r&&("pjax-head"===r.id?(t[document.location.pathname]=$(r).children(),n[i]=null):"js-flash-container"===r.id&&($("#js-flash-container").replaceWith(r),n[i]=null))}),$(document).on("pjax:end",function(){var e,n,r;return e=t[document.location.pathname],e?($("head [data-pjax-transient]").remove(),r=$(e).not("title, script, link[rel='stylesheet']"),n=$(e).filter("link[rel='stylesheet']"),$(document.head).append(r.attr("data-pjax-transient",!0)),$(document.head).append(n)):void 0}))}.call(this),function(){var e,t;$.support.pjax&&(t=function(e){return null!=e.getAttribute("data-pjax-preserve-scroll")?!1:0},e=function(e){var t,n,r;return t=$(e),n=t.add(t.parents("[data-pjax]")).map(function(){var e;return e=this.getAttribute("data-pjax"),null!=e&&"true"!==e?e:void 0}),(r=n[0])?document.querySelector(r):$(e).closest("[data-pjax-container]")[0]},$(document).on("click","[data-pjax] a, a[data-pjax]",function(n){var r,i;return i=this,null==i.getAttribute("data-skip-pjax")&&null==i.getAttribute("data-remote")&&(r=e(i))?$.pjax.click(n,{container:r,scrollTo:t(i)}):void 0}),$(document).on("submit","form[data-pjax]",function(n){var r,i;return i=this,(r=e(i))?$.pjax.submit(n,{container:r,scrollTo:t(i)}):void 0}))}.call(this),function(){var e;$.support.pjax&&(e=document.querySelector("meta[name=pjax-timeout]"))&&($.pjax.defaults.timeout=parseInt(e.content))}.call(this),function(){var e,t,n,r,i,s,o,a;o=require("github/stats")["default"],$.support.pjax&&(t=null,i="last_pjax_request",s="pjax_start",r="pjax_end",n=function(e){var n,r;(r=null!=(n=e.relatedTarget)?n.href:void 0)&&(window.performance.mark(s),t=r)},a=function(){setImmediate(function(){var n,a,c;if(window.performance.getEntriesByName(s).length&&(window.performance.mark(r),window.performance.measure(i,s,r),a=window.performance.getEntriesByName(i),n=null!=(c=a.pop())?c.duration:void 0))return o({pjax:{url:t,ms:Math.round(n)}}),e()})},e=function(){window.performance.clearMarks(s),window.performance.clearMarks(r),window.performance.clearMeasures(i)},$(document).on("pjax:start",n),$(document).on("pjax:end",a))}.call(this),function(){var e,t;$.fn.preservingScrollPosition=function(e){return $.preservingScrollPosition(this[0],e),this},$.preservingScrollPosition=function(n,r){var i,s,o,a,c,u,l,d;return n?(o=e(n),l=r.call(n),(s=t(o))?(n=s.element,c=s.top,a=s.left,u=n.getBoundingClientRect(),d=u.top,i=u.left,$(n).cumulativeScrollBy(i-a,d-c),l):void 0):r()},e=function(e){var t,n,r,i;for(n=[];e;)r=e.getBoundingClientRect(),i=r.top,t=r.left,n.push({element:e,top:i,left:t}),e=e.parentElement;return n},t=function(e){var t,n,r;for(t=0,n=e.length;n>t;t++)if(r=e[t],$.contains(document,r.element))return r}}.call(this),function(){$.preserveInteractivePosition=function(e){return $(window).notScrolling().then(function(){var t;return t=$.interactiveElement()[0],$.preservingScrollPosition(t,e)})}}.call(this),function(){$(function(){return document.body.classList.contains("js-print-popup")?(window.print(),setTimeout(window.close,1e3)):void 0})}.call(this),function(){var e;e=require("github/failbot").errorContext,$(function(){var t,n;return document.documentElement.classList.contains("is-employee")?(t=function(){return"qi:"+document.location},n=[],$(document).on("submit",".js-quick-issue-form",function(){var e;$(".facebox-content > *").hide(),$(".facebox-content .js-quick-issue-thanks").show(),e=t();try{localStorage.removeItem(e)}catch(n){}return!0}),$(document).onFocusedInput(".js-quick-issue-body",function(){return function(){var e,n;e=t(),n=$(this).val();try{return localStorage.setItem(e,n)}catch(r){}}}),$(document).on("reveal.facebox",function(){var e,n,r;return $(".facebox-content .quick-issue-link").remove(),r=$(".facebox-content .js-quick-issue-body"),r.length?(n=t(),e=function(){try{return localStorage.getItem(n)}catch(e){}}(),e&&r.val(e),r.focus()):void 0}),$(window).on("error",function(t){return n.push(e(t.originalEvent.error)),$(".js-captured-errors").val(JSON.stringify(n))}),$(document).on("ajaxSuccess",".js-quick-issue-form",function(e,t,n){return $(".js-quick-issue-thanks").append(t.responseText)})):void 0})}.call(this),function(){$(document).onFocusedKeydown(".js-quick-submit",function(){return function(e){var t,n;return"ctrl+enter"===e.hotkey||"meta+enter"===e.hotkey?(n=$(this).closest("form"),t=n.find("input[type=submit], button[type=submit]").first(),t.prop("disabled")||n.submit(),!1):void 0}})}.call(this),function(){var e,t,n,r=function(e,t){return function(){return e.apply(t,arguments)}};t=require("github/sliding-promise-queue")["default"],n=require("github/fetch").fetchText,e=function(){function e(e){this.resultsChanged=r(this.resultsChanged,this),this.fetchResults=r(this.fetchResults,this),this.onFieldInput=r(this.onFieldInput,this),this.onNavigationKeyDown=r(this.onNavigationKeyDown,this),this.teardown=r(this.teardown,this),this.$field=$(e),this.$form=$(e.form),this.fetchQueue=new t,this.$field.on("input.results",this.onFieldInput),this.$field.on("focusout:delayed.results",this.teardown),this.$form.on("submit.results",this.teardown),this.$results=$(".js-quicksearch-results"),this.$results.navigation("push"),this.$results.on("navigation:keydown.results",this.onNavigationKeyDown)}return e.prototype.teardown=function(){return this.$field.off(".results"),this.$form.off(".results"),this.$results.off(".results"),this.$results.removeClass("active"),this.$results.navigation("pop")},e.prototype.onNavigationKeyDown=function(e){return"esc"===e.hotkey?this.$results.removeClass("active").navigation("clear"):"enter"!==e.hotkey||e.target.classList.contains("js-navigation-item")?void 0:(this.$form.submit(),!1)},e.prototype.onFieldInput=function(){return this.fetchResults(this.$field.val())},e.prototype.fetchResults=function(e){var t,r,i;return(i=this.$results.attr("data-quicksearch-url"))?(r=e.trim()?(i+=~i.indexOf("?")?"&":"?",i+=this.$form.serialize(),this.$form.addClass("is-sending"),n(i)):Promise.resolve(""),t=function(e){return function(){return e.$form.removeClass("is-sending")}}(this),this.fetchQueue.push(r).then(function(e){return function(t){return e.$results.html(t),e.resultsChanged()}}(this)).then(t,t)):void 0},e.prototype.resultsChanged=function(){var e;return e=""!==this.$field.val(),this.$results.toggleClass("active",e)},e}(),$(document).on("focusin:delayed",".js-quicksearch-field",function(){new e(this)})}.call(this),function(){var e,t,n,r,i,s,o,a,c,u,l,d=[].slice;for(a=function(){var e,t,n,r,i;for(e=arguments[0],i=2<=arguments.length?d.call(arguments,1):[],t=0,r=i.length;r>t;t++)if(n=i[t],e.classList.contains(n))return!0;return!1},r=function(e){var t,n,r,i,s;for(s=e.parentNode.children,t=r=0,i=s.length;i>r;t=++r)if(n=s[t],n===e)return t},n=function(e){return"IMG"===e.nodeName||null!=e.firstChild},o=0,c=function(e){var t,n;return t=e.childNodes[0],n=e.childNodes[1],t&&e.childNodes.length<3?!("OL"!==t.nodeName&&"UL"!==t.nodeName||n&&(n.nodeType!==Node.TEXT_NODE||n.textContent.trim())):void 0},t={CODE:function(e){var t;return t=e.textContent,"PRE"===e.parentNode.nodeName?e.textContent=t.replace(/^/gm," "):t.indexOf("`")>=0?"`` "+t+" ``":"`"+t+"`"},PRE:function(e){var t;return t=e.parentNode,"DIV"===t.nodeName&&t.classList.contains("highlight")&&(e.textContent=e.textContent.replace(/^/gm," "),e.append("\n\n")),e},STRONG:function(e){return"**"+e.textContent+"**"},EM:function(e){return"_"+e.textContent+"_"},BLOCKQUOTE:function(e){var t,n;return n=e.textContent.trim().replace(/^/gm,"> "),t=document.createElement("pre"),t.textContent=n+"\n\n",t},A:function(e){var t;return t=e.textContent,a(e,"issue-link","user-mention","team-mention")?t:/^https?:/.test(t)&&t===e.getAttribute("href")?t:"["+t+"]("+e.getAttribute("href")+")"},IMG:function(e){var t;return t=e.getAttribute("alt"),a(e,"emoji")?t:"!["+t+"]("+e.getAttribute("src")+")"},LI:function(e){var t,n;if(!c(e))switch(t=e.parentNode,t.nodeName){case"UL":e.prepend("* ");break;case"OL":o>0&&!t.previousSibling?(n=r(e)+o+1,e.prepend(n+"\\. ")):e.prepend(r(e)+1+". ")}return e},OL:function(e){var t;return t=document.createElement("li"),t.append(document.createElement("br")),e.append(t),e},H1:function(e){var t;return t=parseInt(e.nodeName.slice(1)),e.prepend(Array(t+1).join("#")+" "),e}},t.UL=t.OL,s=i=2;6>=i;s=++i)t["H"+s]=t.H1;e=function(e,r){var i,s,o,a,c,u;a=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return e.nodeName in t&&n(e)?NodeFilter.FILTER_ACCEPT:void 0}}),c=[];for(;o=a.nextNode();)c.push(o);for(c.reverse(),u=[],i=0,s=c.length;s>i;i++)o=c[i],u.push(r(o));return u},u=function(e,t){var n,r,i;n=document.createElement("div"),n.appendChild(t),n.style.cssText="position:absolute;left:-9999px;",document.body.appendChild(n);try{r=document.createRange(),r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),i=e.toString(),e.removeAllRanges()}finally{document.body.removeChild(n)}return i},l=function(n){var i,s,a,c;return i=n.getRangeAt(0).cloneContents(),o=0,(a=n.anchorNode.parentNode.closest("li"))&&("OL"===a.parentNode.nodeName&&(o=r(a)),i.querySelector("li")||(c=document.createElement(a.parentNode.nodeName),s=document.createElement("li"),s.append(i),c.append(s),i=document.createDocumentFragment(),i.appendChild(c))),e(i,function(e){var n;return n=t[e.nodeName](e),e.replaceWith(n)}),u(n,i)},$(document).on("quote:selection",".js-quote-markdown",function(e){var t,n,r,i;r=e.detail.selection;try{return i=l(r),e.detail.selectionText=i.replace(/^\n+/,"").replace(/\s+$/,"")}catch(n){return t=n,setImmediate(function(){throw t})}})}.call(this),function(){$(document).on("keydown",function(e){var t,n,r,i,s,o,a,c,u;if("r"===e.hotkey&&!e.isDefaultPrevented()&&!e.isFormInteraction()&&(c=window.getSelection(),r=$(c.focusNode),(u=$.trim(c.toString()))&&(t=r.closest(".js-quote-selection-container"),t.length))){if(s=$.Event("quote:selection",{detail:{selection:c,selectionText:u}}),t.trigger(s),s.isDefaultPrevented())return!1;if(u=s.detail.selectionText,n=t.find(".js-quote-selection-target").visible().first(),o=n[0])return a="> "+u.replace(/\n/g,"\n> ")+"\n\n",(i=o.value)&&(a=i+"\n\n"+a),o.value=a,n.trigger("change"),n.scrollTo({duration:300},function(){return o.focus(),o.selectionStart=o.value.length,n.scrollTop(o.scrollHeight)}),e.preventDefault()}})}.call(this),function(){$.observe(".has-removed-contents",function(){var e,t,n;return e=$(this).contents(),t=function(){return e.detach()},n=function(){return $(this).html(e)},{add:t,remove:n}})}.call(this),function(){var e,t;e=require("github/fetch").fetchText,$(document).on("focusin",".js-repo-filter .js-filterable-field",function(){var e;(e=this.closest(".js-repo-filter").querySelector(".js-more-repos-link"))&&t(e)}),$(document).on("click",".js-repo-filter .js-repo-filter-tab",function(e){var n,r,i,s,o,a;for(n=this.closest(".js-repo-filter"),(o=n.querySelector(".js-more-repos-link"))&&t(o),a=n.querySelectorAll(".js-repo-filter-tab"),i=0,s=a.length;s>i;i++)r=a[i],r.classList.toggle("filter-selected",r===this);$(n.querySelector(".js-filterable-field")).fire("filterable:change"),e.preventDefault()}),$(document).on("filterable:change",".js-repo-filter .js-repo-list",function(){var e,t,n;e=this.closest(".js-repo-filter"),(n=null!=(t=e.querySelector(".js-repo-filter-tab.filter-selected"))?t.getAttribute("data-filter"):void 0)&&$(this).children().not(n).hide()}),t=function(t){var n,r;if(!t.classList.contains("is-loading"))return t.classList.add("is-loading"),r=function(e){var n;return n=t.closest(".js-repo-filter"),n.querySelector(".js-repo-list").innerHTML=e,$(n.querySelector(".js-filterable-field")).fire("filterable:change"),t.remove()},n=function(){return t.classList.remove("is-loading")},e(t.href).then(r).then(n,n)},$(document).on("click",".js-more-repos-link",function(e){e.preventDefault(),t(this)})}.call(this),function(){$(document).on("ajaxSuccess",".js-select-menu:not([data-multiple])",function(){return $(this).menu("deactivate")}),$(document).on("ajaxSend",".js-select-menu:not([data-multiple])",function(){return $(this).addClass("is-loading")}),$(document).on("ajaxComplete",".js-select-menu",function(){return $(this).removeClass("is-loading")}),$(document).on("ajaxError",".js-select-menu",function(){return $(this).addClass("has-error")}),$(document).on("menu:deactivate",".js-select-menu",function(){return $(this).removeClass("is-loading has-error")})}.call(this),function(){var e;e=require("delegated-events").fire,$(document).on("navigation:open",".js-select-menu:not([data-multiple]) .js-navigation-item",function(){var t,n;return n=$(this),t=n.closest(".js-select-menu"),t.find(".js-navigation-item.selected").removeClass("selected"),n.addClass("selected"),n.removeClass("indeterminate"),n.find("input[type=radio], input[type=checkbox]").prop("checked",!0).change(),e(this,"selectmenu:selected"),t.hasClass("is-loading")?void 0:t.menu("deactivate")}),$(document).on("navigation:open",".js-select-menu[data-multiple] .js-navigation-item",function(){var t,n;return t=$(this),n=t.hasClass("selected"),t.toggleClass("selected",!n),t.removeClass("indeterminate"),t.find("input[type=radio], input[type=checkbox]").prop("checked",!n).change(),e(this,"selectmenu:selected")})}.call(this),function(){$(document).on("selectmenu:selected",".js-select-menu .js-navigation-item",function(){var e,t,n;return e=$(this).closest(".js-select-menu"),n=$(this).find(".js-select-button-text"),n[0]&&e.find(".js-select-button").html(n.html()),t=$(this).find(".js-select-menu-item-gravatar"),n[0]?e.find(".js-select-button-gravatar").html(t.html()):void 0})}.call(this),function(){$(document).on("selectmenu:change",".js-select-menu .select-menu-list",function(e){var t,n;t=$(this).find(".js-navigation-item"),t.removeClass("last-visible"),t.visible().last().addClass("last-visible"),$(this).is("[data-filterable-for]")||(n=$(e.target).hasClass("filterable-empty"),$(this).toggleClass("filterable-empty",n))})}.call(this),function(){$(document).on("menu:activated selectmenu:load",".js-select-menu",function(){return $(this).find(".js-filterable-field").focus()}),$(document).on("menu:deactivate",".js-select-menu",function(){var e,t,n,r,i,s;for($(this).find(".js-filterable-field").val("").trigger("filterable:change"),i=this.querySelectorAll(".js-navigation-item.selected"),s=[],e=0,r=i.length;r>e;e++)n=i[e],(t=n.querySelector("input[type=radio], input[type=checkbox]"))?s.push(n.classList.toggle("selected",t.checked)):s.push(void 0);return s})}.call(this),function(){var e,t;e=require("delegated-events").fire,t=function(t){var n,r,i,s,o;return i=t.currentTarget,n=$(i),n.removeClass("js-load-contents"),n.addClass("is-loading"),n.removeClass("has-error"),s=n.attr("data-contents-url"),r=n.data("contents-data"),o=$.ajax({url:s,data:r}),o.then(function(t){n.removeClass("is-loading"),n.find(".js-select-menu-deferred-content").html(t),n.hasClass("active")&&e(i,"selectmenu:load")},function(){n.removeClass("is-loading"),n.addClass("has-error")})},$.observe(".js-select-menu.js-load-contents",{add:function(){$(this).on("mouseenter",t),$(this).on("menu:activate",t)},remove:function(){$(this).off("mouseenter",t),$(this).off("menu:activate",t)}})}.call(this),function(){$(document).on("menu:activate",".js-select-menu",function(){return $(this).find(":focus").blur(),$(this).find(".js-menu-target").addClass("selected"),$(this).find(".js-navigation-container").navigation("push")}),$(document).on("menu:deactivate",".js-select-menu",function(){return $(this).find(".js-menu-target").removeClass("selected"),$(this).find(".js-navigation-container").navigation("pop")}),$(document).on("filterable:change selectmenu:tabchange",".js-select-menu .select-menu-list",function(){return $(this).navigation("refocus")})}.call(this),function(){var e,t;e=require("delegated-events").fire,$(document).on("filterable:change",".js-select-menu .select-menu-list",function(n){var r,i,s,o;(i=this.querySelector(".js-new-item-form"))&&(r=n.relatedTarget.value,""===r||t(this,r)?$(this).removeClass("is-showing-new-item-form"):($(this).addClass("is-showing-new-item-form"),o=i.querySelector(".js-new-item-name"),"innerText"in o?o.innerText=r:o.textContent=r,null!=(s=i.querySelector(".js-new-item-value"))&&(s.value=r))),e(n.target,"selectmenu:change")}),t=function(e,t){var n,r,i,s,o;for(s=e.querySelectorAll(".js-select-button-text"),n=0,i=s.length;i>n;n++)if(r=s[n],o=r.textContent.toLowerCase().trim(),o===t.toLowerCase())return!0;return!1}}.call(this),function(){var e,t;e=require("delegated-events").fire,$(document).on("menu:activate selectmenu:load",".js-select-menu",function(){var e;return e=$(this).find(".js-select-menu-tab"),e.attr("aria-selected","false").removeClass("selected"),e.first().attr("aria-selected","true").addClass("selected")}),$(document).on("click",".js-select-menu .js-select-menu-tab",function(e){var t,n,r,i;return n=this.closest(".js-select-menu"),(i=n.querySelector(".js-select-menu-tab.selected"))&&(i.classList.remove("selected"),i.setAttribute("aria-selected",!1)),this.classList.add("selected"),this.setAttribute("aria-selected",!0),(t=n.querySelector(".js-filterable-field"))&&((r=this.getAttribute("data-filter-placeholder"))&&t.setAttribute("placeholder",r),t.focus()),!1}),t=function(t,n){var r,i,s;s=t.getAttribute("data-tab-filter"),i=$(t).closest(".js-select-menu").find(".js-select-menu-tab-bucket"),r=i.filter(function(){return this.getAttribute("data-tab-filter")===s}),r.toggleClass("selected",n),n&&e(r[0],"selectmenu:tabchange")},$.observe(".js-select-menu .js-select-menu-tab.selected",{add:function(){return t(this,!0)},remove:function(){return t(this,!1)}})}.call(this),function(){}.call(this),function(){var e,t,n,r;e=function(e){var t;return null==e&&(e=window.location),(t=document.querySelector("meta[name=session-resume-id]"))?t.content:e.pathname},r=null,$(window).on("submit:prepare",function(e){r=e.target,setImmediate(function(){return e.isDefaultPrevented()?r=null:void 0})}),t=function(e){var t,n,i,s;if(i="session-resume:"+e,s=function(e){return e.id&&e.value!==e.defaultValue&&e.form!==r},n=function(){var e,n,r,i;for(r=$(".js-session-resumable"),i=[],e=0,n=r.length;n>e;e++)t=r[e],s(t)&&i.push([t.id,t.value]);return i}(),n.length)try{sessionStorage.setItem(i,JSON.stringify(n))}catch(o){}},n=function(e){var t,n,r,i,s,o,a,c;if(i="session-resume:"+e,n=function(){try{return sessionStorage.getItem(i)}catch(e){}}()){try{sessionStorage.removeItem(i)}catch(u){}for(t=[],o=JSON.parse(n),r=0,s=o.length;s>r;r++)a=o[r],e=a[0],c=a[1],$(document).fire("session:resume",{targetId:e,targetValue:c},function(){var n;n=document.getElementById(e),n&&n.value===n.defaultValue&&(n.value=c,t.push(n))});setImmediate(function(){return $(t).trigger("change")})}},$(window).on("pageshow pjax:end",function(){n(e())}),$(window).on("pagehide",function(){t(e())}),$(window).on("pjax:beforeReplace",function(n){var r,i,s,o;(o=null!=(s=n.previousState)?s.url:void 0)?(i=e(new URL(o)),t(i)):(r=new Error("pjax:beforeReplace event.previousState.url is undefined"),setImmediate(function(){throw r}))})}.call(this),function(){var e,t,n;e=require("github/debounce")["default"],t=function(){var t,n,r;t=null,r=e(function(){return t=null},200),n={x:0,y:0},$(this).on("mousemove.userResize",function(e){var i;(n.x!==e.clientX||n.y!==e.clientY)&&(i=this.style.height,t&&t!==i&&$(this).trigger("user:resize"),t=i,r()),n={x:e.clientX,y:e.clientY}})},n=function(){$(this).off("mousemove.userResize")},$.event.special["user:resize"]={setup:t,teardown:n}}.call(this),function(){var e,t,n,r;n=function(e){return $(e).on("user:resize.trackUserResize",function(){return $(e).addClass("is-user-resized"),$(e).css({"max-height":""})})},r=function(e){return $(e).off("user:resize.trackUserResize")},$(document).on("reset","form",function(){var e;e=$(this).find("textarea.js-size-to-fit"),e.removeClass("is-user-resized"),e.css({height:"","max-height":""})}),$.observe("textarea.js-size-to-fit",{add:n,remove:r}),e=function(e){var t,n,r;t=$(e),n=null,r=function(r){var i,s,o,a;e.value!==n&&t.is($.visible)&&(a=t.overflowOffset(),a.top<0||a.bottom<0||(o=t.outerHeight()+a.bottom,e.style.maxHeight=o-100+"px",i=e.parentNode,s=i.style.height,i.style.height=$(i).css("height"),e.style.height="auto",t.innerHeight(e.scrollHeight),i.style.height=s,n=e.value))},t.on("change.sizeToFit",function(){return r()}),t.on("input.sizeToFit",function(){return r()}),e.value&&r()},t=function(e){$(e).off(".sizeToFit")},$.observe("textarea.js-size-to-fit:not(.is-user-resized)",{add:e,remove:t})}.call(this),function(){$(document).on("ajaxSuccess",".js-social-container",function(e,t,n,r){return $(this).find(".js-social-count").text(r.count)})}.call(this),function(e,t){"function"==typeof define&&define.amd?define([],t):"undefined"!=typeof module&&module.exports?module.exports=t():e.ReconnectingWebSocket=t()}(this,function(){function e(t,n,r){function i(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!1,t),n}var s={debug:!1,automaticOpen:!0,reconnectInterval:1e3,maxReconnectInterval:3e4,reconnectDecay:1.5,timeoutInterval:2e3,maxReconnectAttempts:null};r||(r={});for(var o in s)"undefined"!=typeof r[o]?this[o]=r[o]:this[o]=s[o];this.url=t,this.reconnectAttempts=0,this.readyState=WebSocket.CONNECTING,this.protocol=null;var a,c=this,u=!1,l=!1,d=document.createElement("div");d.addEventListener("open",function(e){c.onopen(e)}),d.addEventListener("close",function(e){c.onclose(e)}),d.addEventListener("connecting",function(e){c.onconnecting(e)}),d.addEventListener("message",function(e){c.onmessage(e)}),d.addEventListener("error",function(e){c.onerror(e)}),this.addEventListener=d.addEventListener.bind(d),this.removeEventListener=d.removeEventListener.bind(d),this.dispatchEvent=d.dispatchEvent.bind(d),this.open=function(t){if(a=new WebSocket(c.url,n||[]),t){if(this.maxReconnectAttempts&&this.reconnectAttempts>this.maxReconnectAttempts)return}else d.dispatchEvent(i("connecting")),this.reconnectAttempts=0;(c.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","attempt-connect",c.url);var r=a,s=setTimeout(function(){(c.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","connection-timeout",c.url),l=!0,r.close(),l=!1},c.timeoutInterval);a.onopen=function(n){clearTimeout(s),(c.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onopen",c.url),c.protocol=a.protocol,c.readyState=WebSocket.OPEN,c.reconnectAttempts=0;var r=i("open");r.isReconnect=t,t=!1,d.dispatchEvent(r)},a.onclose=function(n){if(clearTimeout(s),a=null,u)c.readyState=WebSocket.CLOSED,d.dispatchEvent(i("close"));else{c.readyState=WebSocket.CONNECTING;var r=i("connecting");r.code=n.code,r.reason=n.reason,r.wasClean=n.wasClean,d.dispatchEvent(r),t||l||((c.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onclose",c.url),d.dispatchEvent(i("close")));var s=c.reconnectInterval*Math.pow(c.reconnectDecay,c.reconnectAttempts);setTimeout(function(){c.reconnectAttempts++,c.open(!0)},s>c.maxReconnectInterval?c.maxReconnectInterval:s)}},a.onmessage=function(t){(c.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onmessage",c.url,t.data);var n=i("message");n.data=t.data,d.dispatchEvent(n)},a.onerror=function(t){(c.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onerror",c.url,t),d.dispatchEvent(i("error"))}},1==this.automaticOpen&&this.open(!1),this.send=function(t){if(a)return(c.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","send",c.url,t),a.send(t);throw"INVALID_STATE_ERR : Pausing to reconnect websocket"},this.close=function(e,t){"undefined"==typeof e&&(e=1e3),u=!0,a&&a.close(e,t)},this.refresh=function(){a&&a.close()}}if("WebSocket"in window)return e.prototype.onopen=function(e){},e.prototype.onclose=function(e){},e.prototype.onconnecting=function(e){},e.prototype.onmessage=function(e){},e.prototype.onerror=function(e){},e.debugAll=!1,e.CONNECTING=WebSocket.CONNECTING,e.OPEN=WebSocket.OPEN,e.CLOSING=WebSocket.CLOSING,e.CLOSED=WebSocket.CLOSED,e}),function(){var e,t,n,r,i,s,o;"undefined"!=typeof WebSocket&&null!==WebSocket&&(s={},t={},e=null,r=function(e){var n,r;if(n=document.head.querySelector("link[rel=web-socket]"))return r=new ReconnectingWebSocket(n.href),r.reconnectInterval=2e3*Math.random()+1e3,r.reconnectDecay=2,r.maxReconnectAttempts=5,r.addEventListener("open",function(){var e,t,n;n=[];for(t in s)e=s[t],n.push(r.send("subscribe:"+t));return n}),r.addEventListener("message",function(e){var n,r,i;i=JSON.parse(e.data),r=i[0],n=i[1],r&&n&&$(t[r]).trigger("socket:message",[n,r])}),r},n=function(e){var t,n;return null!=(t=null!=(n=e.getAttribute("data-channel"))?n.split(/\s+/):void 0)?t:[]},i=function(i){var o,a,c,u,l;if(null!=e?e:e=r())for(l=e,u=n(i),o=0,a=u.length;a>o;o++)c=u[o],l.readyState!==WebSocket.OPEN||s[c]||l.send("subscribe:"+c),s[c]=!0,null==t[c]&&(t[c]=[]),t[c].push(i)},o=function(e){var r,i,s,o;for(o=n(e),r=0,i=o.length;i>r;r++)s=o[r],t[s]=$(t[s]).not(e).slice(0)},$.observe(".js-socket-channel[data-channel]",{add:i,remove:o}))}.call(this),function(){var e,t,n;if(n=null!=(t=document.querySelector("meta[name=user-login]"))?t.content:void 0,null!=n){e=String(!!n.length);try{localStorage.setItem("logged-in",e)}catch(r){return}window.addEventListener("storage",function(t){var n;if(t.storageArea===localStorage&&"logged-in"===t.key&&t.newValue!==e)return e=t.newValue,n=document.querySelector(".js-stale-session-flash"),n.classList.toggle("is-signed-in","true"===e),n.classList.toggle("is-signed-out","false"===e),n.classList.remove("hidden"),$.pjax.disable(),$(window).on("popstate",function(e){return null!=e.state.container?location.reload():void 0}),$(document).on("submit","form",function(e){return e.preventDefault()})})}}.call(this),function(){var e,t,n;t=["position:absolute;","overflow:auto;","word-wrap:break-word;","top:0px;","left:-9999px;"],n=["box-sizing","font-family","font-size","font-style","font-variant","font-weight","height","letter-spacing","line-height","max-height","min-height","padding-bottom","padding-left","padding-right","padding-top","border-bottom","border-left","border-right","border-top","text-decoration","text-indent","text-transform","width","word-spacing"],e=new WeakMap,$.fn.textFieldMirror=function(r){var i,s,o,a,c,u,l,d,h,f,m,p;if((p=this[0])&&(d=p.nodeName.toLowerCase(),"textarea"===d||"input"===d)){if(u=e.get(p),u&&u.parentElement===p.parentElement)u.innerHTML="";else{for(u=document.createElement("div"),e.set(p,u),f=window.getComputedStyle(p),h=t.slice(0),"textarea"===d?h.push("white-space:pre-wrap;"):h.push("white-space:nowrap;"),o=0,a=n.length;a>o;o++)l=n[o],h.push(l+":"+f.getPropertyValue(l)+";");u.style.cssText=h.join(" ")}return r!==!1&&(c=document.createElement("span"),c.style.cssText="position: absolute;",c.className="text-field-mirror-marker",c.innerHTML=" "),"number"==typeof r?((m=p.value.substring(0,r))&&(s=document.createTextNode(m)),(m=p.value.substring(r))&&(i=document.createTextNode(m))):(m=p.value)&&(s=document.createTextNode(m)),s&&u.appendChild(s),c&&u.appendChild(c),i&&u.appendChild(i),u.parentElement||p.parentElement.insertBefore(u,p),u.scrollTop=p.scrollTop,u.scrollLeft=p.scrollLeft,u}}}.call(this),function(){$.fn.textFieldSelectionPosition=function(e){var t,n,r;if((r=this[0])&&(null==e&&(e=r.selectionEnd),t=$(r).textFieldMirror(e)))return n=$(t).find(".text-field-mirror-marker").position(),n.top+=parseInt($(t).css("border-top-width"),10),n.left+=parseInt($(t).css("border-left-width"),10),setTimeout(function(){return $(t).remove()},5e3),n}}.call(this),function(){var e,t,n,r,i,s,o,a,c,u,l,d,h,f,m,p=function(e,t){return function(){return e.apply(t,arguments)}};o=require("github/feature-detection")["default"],c=require("github/fetch").fetchText,f=function(e,t,n){var r,i,s,o;return o=n[3],i=n[4],s=t-i.length,r=t,{type:e,text:o,query:i,startIndex:s,endIndex:r}},a={},e=function(){function e(e){this.textarea=e,this.deactivate=p(this.deactivate,this),this.onNavigationOpen=p(this.onNavigationOpen,this),this.onNavigationKeyDown=p(this.onNavigationKeyDown,this),this.onInput=p(this.onInput,this),this.onPaste=p(this.onPaste,this),this.teardown=p(this.teardown,this),$(this.textarea).on("focusout:delayed.suggester",this.teardown),$(this.textarea.form).on("reset.suggester",this.deactivate),$(this.textarea).on("paste.suggester",this.onPaste),$(this.textarea).on("input.suggester",this.onInput),this.suggester=this.textarea.closest(".js-suggester-container").querySelector(".js-suggester"),this.fragment=document.createElement("div"),$(this.suggester).on("navigation:keydown.suggester","[data-value]",this.onNavigationKeyDown),$(this.suggester).on("navigation:open.suggester","[data-value]",this.onNavigationOpen),this.loadSuggestions()}var t,r;return e.prototype.types={mention:{match:/(^|\s)(@([a-z0-9\-_\/]*))$/i,replace:"$1@$value ",search:function(e,t){var r,i,s;return s=l(t),r=$(e).find("ul.mention-suggestions"),i=r.fuzzyFilterSortList(t,{limit:5,text:n,score:s.score}),Promise.resolve([r,i])}},auditLogUser:{match:/(^|\s)((\-?actor:|\-?user:)([a-z0-9\-\+_]*))$/i,replace:"$1$3$value ",search:function(e,t){var n,r;return n=$(e).find("ul.user-suggestions"),r=n.fuzzyFilterSortList(t,{limit:5}),Promise.resolve([n,r])},normalizeMatch:f},auditLogOrg:{match:/(^|\s)((\-?org:)([a-z0-9\-\+_]*))$/i,replace:"$1$3$value ",search:function(e,t){var n,r;return n=$(e).find("ul.org-suggestions"),r=n.fuzzyFilterSortList(t,{limit:5}),Promise.resolve([n,r])},normalizeMatch:f},auditLogAction:{match:/(^|\s)((\-?action:)([a-z0-9\.\-\+_]*))$/i,replace:"$1$3$value ",search:function(e,t){var n,r;return n=$(e).find("ul.action-suggestions"),r=n.fuzzyFilterSortList(t,{limit:5}),Promise.resolve([n,r])},normalizeMatch:f},auditLogRepo:{match:/(^|\s)((\-?repo:)([a-z0-9\/\-\+_]*))$/i,replace:"$1$3$value ",search:function(e,t){var n,r;return n=$(e).find("ul.repo-suggestions"), +r=n.fuzzyFilterSortList(t,{limit:5}),Promise.resolve([n,r])},normalizeMatch:f},auditLogCountry:{match:/(^|\s)((\-?country:)([a-z0-9\-\+_]*))$/i,replace:"$1$3$value ",search:function(e,t){var n,r;return n=$(e).find("ul.country-suggestions"),r=n.fuzzyFilterSortList(t,{limit:5}),Promise.resolve([n,r])},normalizeMatch:f},emoji:{match:/(^|\s)(:([a-z0-9\-\+_]*))$/i,replace:"$1$value ",getValue:function(e){return o.emoji&&e.getAttribute("data-raw-value")||e.getAttribute("data-value")},search:function(e,t){var n,r;return n=$(e).find("ul.emoji-suggestions"),t=" "+t.toLowerCase().replace(/_/g," "),r=n.fuzzyFilterSortList(t,{limit:5,text:s,score:i}),Promise.resolve([n,r])}},hashed:{match:/(^|\s)(\#([a-z0-9\-_\/]*))$/i,replace:"$1#$value ",search:function(e,t){var r,i,s,o;return r=$(e).find("ul.hashed-suggestions"),i=/^\d+$/.test(t)?(s=new RegExp("\\b"+t),function(e){return h(e,s)}):l(t).score,o=r.fuzzyFilterSortList(t,{limit:5,text:n,score:i}),Promise.resolve([r,o])}}},r=function(e){return e.replace(/`{3,}[^`]*\n(.+)?\n`{3,}/g,"")},t=function(e){var t,n;return(null!=(t=e.match(/`{3,}/g))?t.length:void 0)%2?!0:(null!=(n=r(e).match(/`/g))?n.length:void 0)%2?!0:void 0},e.prototype.teardown=function(){this.deactivate(),$(this.textarea).off(".suggester"),$(this.textarea.form).off(".suggester"),$(this.suggester).off(".suggester"),this.onSuggestionsLoaded=function(){return null}},e.prototype.onPaste=function(){this.deactivate(),this.justPasted=!0},e.prototype.onInput=function(){return this.justPasted?void(this.justPasted=!1):this.checkQuery()?!1:void 0},e.prototype.onNavigationKeyDown=function(e){switch(e.hotkey){case"tab":return this.onNavigationOpen(e),!1;case"esc":return this.deactivate(),e.stopImmediatePropagation(),!1}},e.prototype.onNavigationOpen=function(e){var t,n,r;r=null!=this.currentSearch.type.getValue?this.currentSearch.type.getValue(e.target):e.target.getAttribute("data-value"),n=this.textarea.value.substring(0,this.currentSearch.endIndex),t=this.textarea.value.substring(this.currentSearch.endIndex),n=n.replace(this.currentSearch.type.match,this.currentSearch.type.replace.replace("$value",r)),this.textarea.value=n+t,this.deactivate(),this.textarea.focus(),this.textarea.selectionStart=n.length,this.textarea.selectionEnd=n.length},e.prototype.checkQuery=function(){var e,t;if(t=this.searchQuery()){if(t.query===(null!=(e=this.currentSearch)?e.query:void 0))return;return this.currentSearch=t,this.search(t.type,t.query).then(function(e){return function(n){return n?e.activate(t.startIndex):e.deactivate()}}(this)),this.currentSearch.query}this.currentSearch=null,this.deactivate()},e.prototype.activate=function(e){$(this.suggester).css($(this.textarea).textFieldSelectionPosition(e+1)),this.suggester.classList.contains("active")||(this.suggester.classList.add("active"),this.textarea.classList.add("js-navigation-enable"),$(this.suggester).navigation("push"),$(this.suggester).navigation("focus"))},e.prototype.deactivate=function(){this.suggester.classList.contains("active")&&(this.suggester.classList.remove("active"),$(this.suggester).find(".suggestions").hide(),this.textarea.classList.remove("js-navigation-enable"),$(this.suggester).navigation("pop"))},e.prototype.search=function(e,t){return e.search(this.fragment,t).then(function(e){return function(t){var n,r,i;return n=t[0],i=t[1],i>0?(r=n[0].cloneNode(!0),e.suggester.innerHTML="",e.suggester.appendChild(r),$(r).show(),$(e.suggester).navigation("focus"),!0):!1}}(this))},e.prototype.searchQuery=function(){var e,n,r,i,s,o,a;if(i=this.textarea.selectionEnd,o=this.textarea.value.substring(0,i),!t(o)){s=this.types;for(r in s)if(a=s[r],e=o.match(a.match))return n=null!=a.normalizeMatch?a.normalizeMatch(a,i,e):this.normalizeMatch(a,i,e)}},e.prototype.normalizeMatch=function(e,t,n){var r,i,s,o;return o=n[2],i=n[3],s=t-o.length,r=t,{type:e,text:o,query:i,startIndex:s,endIndex:r}},e.prototype.loadSuggestions=function(){var e,t;if(!this.fragment.hasChildNodes()&&(t=this.suggester.getAttribute("data-url"),null!=t))return e=null!=a[t]?a[t]:a[t]=c(t),e.then(function(e){return function(t){return e.onSuggestionsLoaded(t)}}(this))},e.prototype.onSuggestionsLoaded=function(e){var t,n,r,i;for(i=$.parseHTML(e),n=0,r=i.length;r>n;n++)t=i[n],this.fragment.appendChild(t);return document.activeElement===this.textarea?(this.currentSearch=null,this.checkQuery()):void 0},e}(),r={},s=function(e){var t;return t=e.getAttribute("data-emoji-name"),r[t]=" "+n(e).replace(/_/g," "),t},n=function(e){return e.getAttribute("data-text").trim().toLowerCase()},i=function(e,t){var n;return n=r[e].indexOf(t),n>-1?1e3-n:0},h=function(e,t){var n;return n=e.search(t),n>-1?1e3-n:0},m=function(e,n){var r,i,s,o,a,c,u;if(u=t(e,n[0]),0!==u.length){if(1===n.length)return[u[0],1,[]];for(a=null,i=0,s=u.length;s>i;i++)c=u[i],(r=d(e,n,c+1))&&(o=r[r.length-1]-c,(!a||o-1;)r.push(n++);return r},d=function(e,t,n){var r,i,s,o;for(i=[],r=s=1,o=t.length;o>=1?o>s:s>o;r=o>=1?++s:--s){if(n=e.indexOf(t[r],n),-1===n)return;i.push(n++)}return i},u=function(){return 2},l=function(e){var t,n;return e?(t=e.toLowerCase().split(""),n=function(n){var r,i;return n&&(r=m(n,t))?(i=e.length/r[1],i/=r[0]/2+1):0}):n=u,{score:n}},$(document).on("focusin:delayed",".js-suggester-field",function(){new e(this)})}.call(this),function(){$(document).on("tasklist:change",".js-task-list-container",function(){$(this).taskList("disable")}),$(document).on("tasklist:changed",".js-task-list-container",function(e,t,n){var r,i,s,o;return i=$(this).find("form.js-comment-update"),s=i.find("input[name=task_list_key]"),s.length>0||(o=i.find(".js-task-list-field").attr("name").split("[")[0],s=$("",{type:"hidden",name:"task_list_key",value:o}),i.append(s)),n=n?"1":"0",r=$("",{type:"hidden",name:"task_list_checked",value:n}),i.append(r),i.one("ajaxComplete",function(e,t){return r.remove(),200!==t.status||/^\s*e.members.length&&e.members.push(e.total-e.members.length+" more"),r(o,n(e.members))},i=function(e){return function(t){var n,i,s;return s=(null!=(i=t.response)?i.status:void 0)||500,n=function(){switch(s){case 404:return this.getAttribute("data-permission-text");default:return this.getAttribute("data-error-text")}}.call(e),r(o,n)}}(this),a.then(t,i)},r=function(e,t){return e.attr("aria-label",t),e.addClass("tooltipped tooltipped-s tooltipped-multiline")},n=function(e){var t;return 0===e.length?"":1===e.length?e[0]:2===e.length?e.join(" and "):([].splice.apply(e,[-1,9e9].concat(t="and "+e.slice(-1))),e.join(", "))},$.observe(".js-team-mention",function(){$(this).on("mouseenter",t)})}.call(this),function(){var e,t;t=function(e,t,n){var r,i;return r=e.value.substring(0,e.selectionEnd),i=e.value.substring(e.selectionEnd),r=r.replace(t,n),i=i.replace(t,n),e.value=r+i,e.selectionStart=r.length,e.selectionEnd=r.length},e=function(e,t){var n,r,i,s;return i=e.selectionEnd,n=e.value.substring(0,i),s=e.value.substring(i),r=""===e.value||n.match(/\n$/)?"":"\n",e.value=n+r+t+s,e.selectionStart=i+t.length,e.selectionEnd=i+t.length},$.fn.replaceText=function(e,n){var r,i,s;for(i=0,s=this.length;s>i;i++)r=this[i],t(r,e,n);return this},$.fn.insertText=function(t){var n,r,i;for(r=0,i=this.length;i>r;r++)n=this[r],e(n,t);return this}}.call(this),function(){$(document).on("ajaxBeforeSend",function(e,t,n){var r;n.crossDomain||(r=$(".js-timeline-marker"),r.length&&t.setRequestHeader("X-Timeline-Last-Modified",r.attr("data-last-modified")))})}.call(this),function(){var e,t,n,r;$(document).on("click",".js-timeline-progressive-disclosure-button",function(){var e;return e=this.closest(".js-timeline-progressive-disclosure-container"),e.src=this.getAttribute("data-url"),!0}),t=null,$.observe(".js-timeline-progressive-disclosure-container",function(){return{add:function(e){return e.addEventListener("loadstart",function(){return this.classList.add("is-loading"),!0}),e.addEventListener("loadend",function(){return this.classList.remove("is-loading"),!0}),e.addEventListener("load",function(){var n,r,i,s,o,a;return e===t&&(t=null,i=window.location.hash.slice(1),(r=document.getElementById(i))&&(null!=(s=r.closest(".js-details-container"))&&s.classList.add("open"),o=$(r).overflowOffset(),a=o.top,n=o.bottom,(0>a||0>n)&&r.scrollIntoView())),!0}),e.addEventListener("error",function(){return this.src="",!0})}}}),e=/^(?:commits-pushed-([0-9a-f]{7})|discussion-diff-(\d+)(?:[LR]-?\d+)?|discussion_r(\d+)|event-(\d+)|issuecomment-(\d+)|ref-issue-(\d+)|ref-pullrequest-(\d+))$/,r=function(t){var n,r,i,s,o,a,c,u,l,d,h,f;return c=e.exec(t),null!=c?(n=c[0],r=c[1],s=c[2],i=c[3],o=c[4],h=c[5],f=c[6],a=null!=(u=null!=(l=null!=(d=null!=s?s:i)?d:o)?l:h)?u:f,null!=a?{timeline_item_id:a}:null!=r?{commit_sha:r}:void 0):void 0},(n=function(){var e,n,i,s,o;return n=window.location.hash.slice(1),!document.getElementById(n)&&(e=document.querySelector(".js-timeline-progressive-disclosure-container"),e&&(i=r(n)))?(o=e.getAttribute("data-fragment-url"),s=o.indexOf("?")?"&":"?",e.src=o+s+$.param(i),t=e):void 0})()}.call(this),function(e){var t=function(){"use strict";var e="s",n=function(e){var t=-e.getTimezoneOffset();return null!==t?t:0},r=function(e,t,n){var r=new Date;return void 0!==e&&r.setFullYear(e),r.setMonth(t),r.setDate(n),r},i=function(e){return n(r(e,0,2))},s=function(e){return n(r(e,5,2))},o=function(e){var t=e.getMonth()>7,r=t?s(e.getFullYear()):i(e.getFullYear()),o=n(e),a=0>r,c=r-o;return a||t?0!==c:0>c},a=function(){var t=i(),n=s(),r=t-n;return 0>r?t+",1":r>0?n+",1,"+e:t+",0"},c=function(){var e=a();return new t.TimeZone(t.olson.timezones[e])},u=function(e){var t=new Date(2010,6,15,1,0,0,0),n={"America/Denver":new Date(2011,2,13,3,0,0,0),"America/Mazatlan":new Date(2011,3,3,3,0,0,0),"America/Chicago":new Date(2011,2,13,3,0,0,0),"America/Mexico_City":new Date(2011,3,3,3,0,0,0),"America/Asuncion":new Date(2012,9,7,3,0,0,0),"America/Santiago":new Date(2012,9,3,3,0,0,0),"America/Campo_Grande":new Date(2012,9,21,5,0,0,0),"America/Montevideo":new Date(2011,9,2,3,0,0,0),"America/Sao_Paulo":new Date(2011,9,16,5,0,0,0),"America/Los_Angeles":new Date(2011,2,13,8,0,0,0),"America/Santa_Isabel":new Date(2011,3,5,8,0,0,0),"America/Havana":new Date(2012,2,10,2,0,0,0),"America/New_York":new Date(2012,2,10,7,0,0,0),"Europe/Helsinki":new Date(2013,2,31,5,0,0,0),"Pacific/Auckland":new Date(2011,8,26,7,0,0,0),"America/Halifax":new Date(2011,2,13,6,0,0,0),"America/Goose_Bay":new Date(2011,2,13,2,1,0,0),"America/Miquelon":new Date(2011,2,13,5,0,0,0),"America/Godthab":new Date(2011,2,27,1,0,0,0),"Europe/Moscow":t,"Asia/Amman":new Date(2013,2,29,1,0,0,0),"Asia/Beirut":new Date(2013,2,31,2,0,0,0),"Asia/Damascus":new Date(2013,3,6,2,0,0,0),"Asia/Jerusalem":new Date(2013,2,29,5,0,0,0),"Asia/Yekaterinburg":t,"Asia/Omsk":t,"Asia/Krasnoyarsk":t,"Asia/Irkutsk":t,"Asia/Yakutsk":t,"Asia/Vladivostok":t,"Asia/Baku":new Date(2013,2,31,4,0,0),"Asia/Yerevan":new Date(2013,2,31,3,0,0),"Asia/Kamchatka":t,"Asia/Gaza":new Date(2010,2,27,4,0,0),"Africa/Cairo":new Date(2010,4,1,3,0,0),"Europe/Minsk":t,"Pacific/Apia":new Date(2010,10,1,1,0,0,0),"Pacific/Fiji":new Date(2010,11,1,0,0,0),"Australia/Perth":new Date(2008,10,1,1,0,0,0)};return n[e]};return{determine:c,date_is_dst:o,dst_start_for:u}}();t.TimeZone=function(e){"use strict";var n={"America/Denver":["America/Denver","America/Mazatlan"],"America/Chicago":["America/Chicago","America/Mexico_City"],"America/Santiago":["America/Santiago","America/Asuncion","America/Campo_Grande"],"America/Montevideo":["America/Montevideo","America/Sao_Paulo"],"Asia/Beirut":["Asia/Amman","Asia/Jerusalem","Asia/Beirut","Europe/Helsinki","Asia/Damascus"],"Pacific/Auckland":["Pacific/Auckland","Pacific/Fiji"],"America/Los_Angeles":["America/Los_Angeles","America/Santa_Isabel"],"America/New_York":["America/Havana","America/New_York"],"America/Halifax":["America/Goose_Bay","America/Halifax"],"America/Godthab":["America/Miquelon","America/Godthab"],"Asia/Dubai":["Europe/Moscow"],"Asia/Dhaka":["Asia/Yekaterinburg"],"Asia/Jakarta":["Asia/Omsk"],"Asia/Shanghai":["Asia/Krasnoyarsk","Australia/Perth"],"Asia/Tokyo":["Asia/Irkutsk"],"Australia/Brisbane":["Asia/Yakutsk"],"Pacific/Noumea":["Asia/Vladivostok"],"Pacific/Tarawa":["Asia/Kamchatka","Pacific/Fiji"],"Pacific/Tongatapu":["Pacific/Apia"],"Asia/Baghdad":["Europe/Minsk"],"Asia/Baku":["Asia/Yerevan","Asia/Baku"],"Africa/Johannesburg":["Asia/Gaza","Africa/Cairo"]},r=e,i=function(){for(var e=n[r],i=e.length,s=0,o=e[0];i>s;s+=1)if(o=e[s],t.date_is_dst(t.dst_start_for(o)))return void(r=o)},s=function(){return"undefined"!=typeof n[r]};return s()&&i(),{name:function(){return r}}},t.olson={},t.olson.timezones={"-720,0":"Pacific/Majuro","-660,0":"Pacific/Pago_Pago","-600,1":"America/Adak","-600,0":"Pacific/Honolulu","-570,0":"Pacific/Marquesas","-540,0":"Pacific/Gambier","-540,1":"America/Anchorage","-480,1":"America/Los_Angeles","-480,0":"Pacific/Pitcairn","-420,0":"America/Phoenix","-420,1":"America/Denver","-360,0":"America/Guatemala","-360,1":"America/Chicago","-360,1,s":"Pacific/Easter","-300,0":"America/Bogota","-300,1":"America/New_York","-270,0":"America/Caracas","-240,1":"America/Halifax","-240,0":"America/Santo_Domingo","-240,1,s":"America/Santiago","-210,1":"America/St_Johns","-180,1":"America/Godthab","-180,0":"America/Argentina/Buenos_Aires","-180,1,s":"America/Montevideo","-120,0":"America/Noronha","-120,1":"America/Noronha","-60,1":"Atlantic/Azores","-60,0":"Atlantic/Cape_Verde","0,0":"UTC","0,1":"Europe/London","60,1":"Europe/Berlin","60,0":"Africa/Lagos","60,1,s":"Africa/Windhoek","120,1":"Asia/Beirut","120,0":"Africa/Johannesburg","180,0":"Asia/Baghdad","180,1":"Europe/Moscow","210,1":"Asia/Tehran","240,0":"Asia/Dubai","240,1":"Asia/Baku","270,0":"Asia/Kabul","300,1":"Asia/Yekaterinburg","300,0":"Asia/Karachi","330,0":"Asia/Kolkata","345,0":"Asia/Kathmandu","360,0":"Asia/Dhaka","360,1":"Asia/Omsk","390,0":"Asia/Rangoon","420,1":"Asia/Krasnoyarsk","420,0":"Asia/Jakarta","480,0":"Asia/Shanghai","480,1":"Asia/Irkutsk","525,0":"Australia/Eucla","525,1,s":"Australia/Eucla","540,1":"Asia/Yakutsk","540,0":"Asia/Tokyo","570,0":"Australia/Darwin","570,1,s":"Australia/Adelaide","600,0":"Australia/Brisbane","600,1":"Asia/Vladivostok","600,1,s":"Australia/Sydney","630,1,s":"Australia/Lord_Howe","660,1":"Asia/Kamchatka","660,0":"Pacific/Noumea","690,0":"Pacific/Norfolk","720,1,s":"Pacific/Auckland","720,0":"Pacific/Tarawa","765,1,s":"Pacific/Chatham","780,0":"Pacific/Tongatapu","780,1,s":"Pacific/Apia","840,0":"Pacific/Kiritimati"},"undefined"!=typeof exports?exports.jstz=t:e.jstz=t}(this),function(){var e,t;t=jstz.determine().name(),"https:"===location.protocol&&(e="secure"),document.cookie="tz="+encodeURIComponent(t)+"; path=/; "+e}.call(this),function(){var e,t,n;n=require("github/stats")["default"],t=function(){if(!window.performance.timing)try{return sessionStorage.setItem("navigationStart",Date.now())}catch(e){}},e=function(){return setTimeout(function(){var e,t,r,i,s,o,a,c,u,l,d,h;if(d={},d.crossBrowserLoadEvent=Date.now(),window.performance.timing){o=window.performance.timing;for(r in o)h=o[r],"number"==typeof h&&(d[r]=h);(e=null!=(a=window.chrome)&&"function"==typeof a.loadTimes&&null!=(c=a.loadTimes())?c.firstPaintTime:void 0)&&(d.chromeFirstPaintTime=Math.round(1e3*e))}else s=function(){try{return sessionStorage.getItem("navigationStart")}catch(e){}}(),s&&(d.simulatedNavigationStart=parseInt(s,10));for(l=function(){var e,t,n,r;for(n=window.performance.getEntriesByType("resource"),r=[],e=0,t=n.length;t>e;e++)u=n[e],r.push($.extend({},u));return r}(),t=0,i=l.length;i>t;t++)u=l[t],delete u.toJSON;return Object.keys(d).length>1||l.length?n({timing:d,resources:l}):void 0},0)},$(window).on("pagehide",t),$(window).on("load",e)}.call(this),function(){$(document).on("click",".js-toggler-container .js-toggler-target",function(e){return 1===e.which?($(e.target).trigger("toggler:toggle"),0===$(this).parent(".js-toggler-form").length?!1:void 0):void 0}),$(document).on("ajaxSend",".js-toggler-container",function(e){return this.classList.remove("success","error"),this.classList.add("loading")}),$(document).on("ajaxComplete",".js-toggler-container",function(e){return this.classList.remove("loading")}),$(document).on("ajaxSuccess",".js-toggler-container",function(e){return this.classList.add("success")}),$(document).on("ajaxError",".js-toggler-container",function(e){return this.classList.add("error")}),$(document).on("toggler:toggle",".js-toggler-container",function(e){return this.classList.toggle("on")})}.call(this),function(){var e,t,n;n=0,t=function(e){var t;if(document.hasFocus()&&(t=document.querySelector(".js-timeline-marker-form")))return $(t).submit()},$.inViewport(".js-unread-item",{"in":function(){e(this)}}),$.observe(".js-unread-item",{add:function(){return n++},remove:function(){return n--,0===n?t(this):void 0}}),e=function(e){return e.classList.remove("js-unread-item","unread-item")},$(document).on("socket:message",".js-discussion",function(t){var n,r,i,s;if(this===t.target)for(s=document.querySelectorAll(".js-unread-item"),r=0,i=s.length;i>r;r++)n=s[r],e(n)})}.call(this),function(){var e,t,n;t=0,e=/^\(\d+\)\s+/,n=function(){var n;return n=t?"("+t+") ":"",document.title.match(e)?document.title=document.title.replace(e,n):document.title=""+n+document.title},$.observe(".js-unread-item",{add:function(){return t++,n()},remove:function(){return t--,n()}})}.call(this),function(){var e,t,n,r;e=new WeakMap,$.fn.updateContent=function(n){var r,i;return r=this[0],null!=(i=e.get(r))&&i.abort(),t(r,n)},$(document).on("socket:message",".js-updatable-content",function(t,i,s){var o;this===t.target&&(e.get(this)||(o=new XMLHttpRequest,o.open("GET",this.getAttribute("data-url")),o.setRequestHeader("Accept","text/html"),o.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.set(this,o),r(o).then(function(t){return function(r){return e["delete"](t),n(t,r)}}(this))["catch"](function(t){return function(n){return e["delete"](t),"XMLHttpRequest abort"!==n.message?console.warn("Failed to update content",t,n):void 0}}(this))))}),r=function(e){return new Promise(function(t,n){return e.onload=function(){return 200===e.status?t(e.responseText):n(new Error("XMLHttpRequest "+e.statusText))},e.onerror=n,e.send()})},t=function(e,t){return $.preserveInteractivePosition(function(){var n;return n=$($.parseHTML($.trim(t))),$(e).replaceWith(n),n})},n=function(e,n){if($(e).hasInteractions())throw new Error("element had interactions");return t(e,n)}}.call(this),function(){var e,t;e=require("delegated-events"),t=require("github/fetch").fetchText,e.on("upload:setup",".js-upload-avatar-image",function(e){var t,n,r,i;return i=e.detail.policyRequest,t=this.getAttribute("data-alambic-organization"),r=this.getAttribute("data-alambic-owner-type"),n=this.getAttribute("data-alambic-owner-id"),t&&i.body.append("organization_id",t),r&&i.body.append("owner_type",r),n?i.body.append("owner_id",n):void 0}),e.on("upload:complete",".js-upload-avatar-image",function(e){var n,r;return n=e.detail.result,r="/settings/avatars/"+n.id,$.facebox(function(){return t(r).then($.facebox)})})}.call(this),define("github/png-scanner",["exports"],function(e){function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function e(e,t){for(var n=0;nn;n++)t.push(String.fromCharCode(this.readChar()));return t.join("")}},{key:"scan",value:function(e){if(this.readLong()!==r)throw new Error("invalid PNG");for(this.advance(4);;){var t=this.readLong(),n=this.readString(4),s=this.pos+t+i;if(e.call(this,n,t)===!1||"IEND"===n)break;this.pos=s}}}]),e}();e["default"]=s}),define("github/image-dimensions",["exports","github/png-scanner"],function(e,t){function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){if("image/png"!==e.type)return Promise.resolve({});var t=e.slice(0,10240,e.type);return i["default"].fromFile(t).then(function(e){var t={};return e.scan(function(e){switch(e){case"IHDR":return t.width=this.readLong(),void(t.height=this.readLong());case"pHYs":var n=this.readLong(),r=this.readLong(),i=this.readChar(),o=void 0;return 1===i&&(o=s),o&&(t.ppi=Math.round((n+r)/2*o)),!1;case"IDAT":return!1}}),t})}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r;var i=n(t),s=.0254}),function(){var e,t,n,r,i,s,o;r=require("github/image-dimensions")["default"],n=require("delegated-events"),s=function(e){return e.toLowerCase().replace(/[^a-z0-9\-_]+/gi,".").replace(/\.{2,}/g,".").replace(/^\.|\.$/gi,"")},o=function(e){var t;return t=i(e)?"!":"",t+("[Uploading "+e.name+"\u2026]()")},t=function(e){return s(e).replace(/\.[^.]+$/,"").replace(/\./g," ")},i=function(e){var t;return"image/gif"===(t=e.type)||"image/png"===t||"image/jpg"===t||"image/jpeg"===t},e=144,n.on("upload:setup",".js-upload-markdown-image",function(e){var t;return t=this.querySelector(".js-comment-field"),$(t).insertText(o(e.detail.file)+"\n"),$(this).trigger("validation:change",!1)}),n.on("upload:complete",".js-upload-markdown-image",function(n){var s,a,c,u,l;return l=n.detail,s=this,a=s.querySelector(".js-comment-field"),c=o(l.file),u=function(n){var r,o,u,d;return o=i(l.file)?(r=t(l.policy.asset.name),u=l.policy.asset.href,(null!=n?n.ppi:void 0)===e?(d=Math.round(n.width/2),''+r+''):"!["+r+"]("+u+")"):"["+l.file.name+"]("+l.policy.asset.href+")",$(a).replaceText(c,o),$(s).trigger("validation:field:change")},r(l.file).then(u,function(e){return u(),setImmediate(function(){throw e})})}),n.on("upload:error",".js-upload-markdown-image",function(e){var t,n;return t=this.querySelector(".js-comment-field"),n=o(e.detail.file),$(t).replaceText(n,""),$(this).trigger("validation:field:change")}),n.on("upload:invalid",".js-upload-markdown-image",function(e){var t,n;return t=this.querySelector(".js-comment-field"),n=o(e.detail.file),$(t).replaceText(n,""),$(this).trigger("validation:field:change")})}.call(this),function(){var e;e=require("delegated-events"),e.on("upload:complete",".js-upload-oauth-logo",function(e){var t,n;return n=e.detail,this.querySelector(".js-image-field").src=n.policy.asset.href,this.classList.add("has-uploaded-logo"),t=this.querySelector(".js-oauth-application-logo-id"),t.value=n.policy.asset.id||n.result.id})}.call(this),function(){var e,t,n,r,i,s,o,a,c,u,l,d,h,f,m,p,g,v,b,y,j,w,x,k,C,S,L,A,T,q,_,E,D,P,I,M,R,H,N,O,F=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};m=require("delegated-events").fire,h=require("github/fetch").fetchJSON,D=function(e){var t;return(null!=(t=e.closest("form").elements.authenticity_token)?t.value:void 0)||function(){throw new Error($(e).inspect()+" is missing authenticity_token")}()},t=function(){function e(){this.uploads=[],this.busy=!1}return e.prototype.upload=function(e,t){var n;return n=function(){},this.uploads.push({file:e,to:t.to,sameOrigin:t.sameOrigin,csrf:t.csrf,form:t.form||{},header:t.header||{},start:t.start||n,progress:t.progress||n,complete:t.complete||n,error:t.error||n}),this.process()},e.prototype.process=function(){var e,t,n,r,i,s,o;if(!this.busy&&0!==this.uploads.length){i=this.uploads.shift(),this.busy=!0,o=new XMLHttpRequest,o.open("POST",i.to,!0),n=i.header;for(t in n)s=n[t],o.setRequestHeader(t,s);o.onloadstart=function(){return i.start()},o.onload=function(e){return function(){return 204===o.status?i.complete({}):201===o.status?i.complete(JSON.parse(o.responseText)):i.error({status:o.status,body:o.responseText}),e.busy=!1,e.process()}}(this),o.onerror=function(){return i.error({status:0,body:""})},o.upload.onprogress=function(e){var t;return e.lengthComputable?(t=Math.round(e.loaded/e.total*100),i.progress(t)):void 0},e=new FormData,i.sameOrigin&&e.append("authenticity_token",i.csrf),r=i.form;for(t in r)s=r[t],e.append(t,s);return e.append("file",i.file),o.send(e)}},e}(),q=["is-default","is-uploading","is-bad-file","is-duplicate-filename","is-too-big","is-too-many","is-failed","is-bad-dimensions","is-empty","is-bad-permissions","is-repository-required"],E=function(e,t){var n;return(n=e.classList).remove.apply(n,q),e.classList.add(t)},N=new t,e=function(){function e(e){var t;this.files=function(){var n,r,i;for(i=[],n=0,r=e.length;r>n;n++)t=e[n],i.push(t);return i}(),this.percentages=function(){var n,r,i;for(i=[],n=0,r=e.length;r>n;n++)t=e[n],i.push(0);return i}(),this.size=this.files.length,this.total=this.files.reduce(function(e,t){return e+t.size},0),this.uploaded=0}return e.prototype.percent=function(){var e,t,n;return e=function(){var e,r,i,s;for(i=this.files,s=[],n=e=0,r=i.length;r>e;n=++e)t=i[n],s.push(t.size*this.percentages[n]/100);return s}.call(this).reduce(function(e,t){return e+t}),Math.round(e/this.total*100)},e.prototype.progress=function(e,t){var n;return n=this.files.indexOf(e),this.percentages[n]=t},e.prototype.completed=function(e){return this.uploaded+=1},e.prototype.isFinished=function(){return this.uploaded===this.files.length},e}(),_=function(e,t){var n,r,i,s,o;for(s=e.files,o=[],r=0,i=s.length;i>r;r++)n=s[r],o.push(function(n){var r,i;return r=c(n,t),i=[],m(t,"upload:setup",{batch:e,file:n,policyRequest:r,preprocess:i})?Promise.all(i).then(function(){return h(r.url,r)}).then(function(r){var i;return i=u(e,n,r,t),N.upload(n,i)})["catch"](function(r){var i;return m(t,"upload:invalid",{batch:e,file:n,error:r}),null!=r.response?r.response.text().then(function(e){var i,s;return s=r.response.status,i=T({status:s,body:e},n),E(t,i)}):(i=T({status:0}),E(t,i))}):void 0}(n));return o},c=function(e,t){var n,r,i;return i=t.getAttribute("data-upload-policy-url"),r=t.getAttribute("data-upload-repository-id"),n=new FormData,n.append("name",e.name),n.append("size",e.size),n.append("content_type",e.type),n.append("authenticity_token",D(t)),r&&n.append("repository_id",r),e._path&&n.append("directory",e._path),{url:i,method:"post",body:n,headers:{}}},T=function(e,t){var n,r,i,s,o,a;if(400===e.status)return"is-bad-file";if(422!==e.status)return"is-failed";if(r=JSON.parse(e.body),null==(null!=r?r.errors:void 0))return"is-failed";for(o=r.errors,i=0,s=o.length;s>i;i++)switch(n=o[i],n.field){case"size":return a=null!=t?t.size:void 0,null!=a&&0===parseInt(a)?"is-empty":"is-too-big";case"file_count":return"is-too-many";case"width":case"height":return"is-bad-dimensions";case"name":return"already_exists"===n.code?"is-duplicate-filename":"is-bad-file";case"content_type":return"is-bad-file";case"uploader_id":return"is-bad-permissions";case"repository_id":return"is-repository-required"}return"is-failed"},u=function(e,t,n,r){var i;return i={to:n.upload_url,form:n.form,header:n.header,sameOrigin:n.same_origin,csrf:D(r),start:function(){return E(r,"is-uploading"),m(r,"upload:start",{batch:e,file:t,policy:n})},progress:function(n){return e.progress(t,n),m(r,"upload:progress",{batch:e,file:t,percent:n})},complete:function(i){var s,o;return e.completed(t),null!=(null!=i?i.href:void 0)&&(n.asset||(n.asset={}),n.asset.href=i.href),(null!=(o=n.asset_upload_url)?o.length:void 0)>0&&(s=new FormData,s.append("authenticity_token",D(r)),h(n.asset_upload_url,{method:"put",body:s})),m(r,"upload:complete",{batch:e,file:t,policy:n,result:i}),E(r,"is-default")},error:function(i){var s;return m(r,"upload:error",{batch:e,file:t,policy:n}),s=T(i),E(r,s)}}},P=function(e){return e.types?F.call(e.types,"Files")>=0:!1},I=function(e){return e.types?F.call(e.types,"text/uri-list")>=0:!1},M=function(e){return e.types?F.call(e.types,"text/plain")>=0:!1},p=function(e){var t,n,r,i;for(r=[],t=0,n=e.length;n>t;t++)i=e[t],Array.isArray(i)?r=r.concat(p(i)):r.push(i);return r},O=function(e){var t,n,r,i;for(i=[],n=0,r=e.length;r>n;n++)t=e[n],t.name.startsWith(".")||i.push(t);return i},R=function(e,t){return t.getFilesAndDirectories?t.getFilesAndDirectories().then(function(e){var n,r;return r=function(){var r,i,s,o;for(s=O(e),o=[],r=0,i=s.length;i>r;r++)n=s[r],o.push(R(t.path,n));return o}(),Promise.all(r)}):(t._path=e,t)},s=function(e){return R("",e).then(p)},v=function(e){return new Promise(function(t,n){return e.file(t,n)})},g=function(e){return new Promise(function(t,n){return e.createReader().readEntries(t,n)})},H=function(e,t){return t.isDirectory?g(t).then(function(e){var n,r;return r=function(){var r,i,s,o;for(s=O(e),o=[],r=0,i=s.length;i>r;r++)n=s[r],o.push(H(t.fullPath,n));return o}(),Promise.all(r)}):v(t).then(function(t){return t._path=e,t})},y=function(e){var t,n,r,i;if(!e.items)return!1;for(i=e.items,t=0,r=i.length;r>t;t++)if(n=i[t],n.webkitGetAsEntry)return!0;return!1},o=function(e){var t,n;return n=function(){var n,r,i,s;for(i=e.items,s=[],n=0,r=i.length;r>n;n++)t=i[n],s.push(H("",t.webkitGetAsEntry()));return s}(),Promise.all(n).then(p)},n=function(t,n){var r;return r=new e(t),_(r,n)},r=function(e,t){var n,r,i,s,o,a,c;if(e){for(n=t.querySelector(".js-comment-field"),o=e.split("\r\n"),a=[],r=0,i=o.length;i>r;r++)s=o[r],c=b(s)?"\n![]("+s+")\n":s,a.push($(n).insertText(c));return a}},i=function(e,t){var n;return n=t.querySelector(".js-comment-field"),$(n).insertText(e)},b=function(e){var t;return t=e.split(".").pop(),"gif"===t||"png"===t||"jpg"===t||"jpeg"===t},l=function(e){return P(e)?"copy":I(e)?"link":M(e)?"copy":"none"},f=function(e){switch(e){case"image/gif":return"image.gif";case"image/png":return"image.png";case"image/jpeg":return"image.jpg"}},k=function(e){return e.preventDefault()},x=function(e){return e.dataTransfer.dropEffect="none",e.preventDefault()},d=null,C=function(e){var t,n;return clearTimeout(d),t=function(e){return function(){return e.classList.remove("dragover")}}(this),d=setTimeout(t,200),n=l(e.dataTransfer),e.dataTransfer.dropEffect=n,this.classList.add("dragover"),e.stopPropagation(),e.preventDefault()},S=function(e){return e.dataTransfer.dropEffect="none",this.classList.remove("dragover"),e.stopPropagation(),e.preventDefault()},j=function(e){var t;return(null!=(t=e.target.classList)?t.contains("js-document-dropzone"):void 0)?this.classList.remove("dragover"):void 0},L=function(e){var t,a,c;return this.classList.remove("dragover"),document.body.classList.remove("dragover"),c=e.dataTransfer,c.types?P(c)?(a=this.hasAttribute("data-directory-upload")&&c.getFilesAndDirectories?s(c):this.hasAttribute("data-directory-upload")&&y(c)?o(c):Promise.resolve(c.files),t=this,a.then(function(e){var r,i;return i=n.bind(null,e),r=!m(t,"upload:drop:setup",{upload:i}),r?void 0:n(e,t)})):I(c)?r(c.getData("text/uri-list"),this):M(c)&&i(c.getData("text/plain"),this):E(this,"is-bad-browser"),e.stopPropagation(),e.preventDefault()},A=function(e){var t,r,i,s,o,a,c; +if(null!=(null!=(a=e.clipboardData)?a.items:void 0)){for(c=e.clipboardData.items,i=0,o=c.length;o>i&&(s=c[i],!(r=f(s.type)));i++);if(r)return t=s.getAsFile(),t.name=r,n([t],this),e.preventDefault()}},w=function(e){return e.target.classList.contains("js-manual-file-chooser")?(e.target.files?n(e.target.files,this):E(this,"is-bad-browser"),e.target.value=""):void 0},a=0,$.observe(".js-document-dropzone",{add:function(){return document.body.addEventListener("dragenter",C),document.body.addEventListener("dragover",C),document.body.addEventListener("dragleave",j),this.addEventListener("drop",L)},remove:function(){return document.body.removeEventListener("dragenter",C),document.body.removeEventListener("dragover",C),document.body.removeEventListener("dragleave",j),this.removeEventListener("drop",L)}}),$.observe(".js-uploadable-container",{add:function(){return 0===a++&&(document.addEventListener("drop",k),document.addEventListener("dragover",x)),this.addEventListener("dragenter",C),this.addEventListener("dragover",C),this.addEventListener("dragleave",S),this.addEventListener("drop",L),this.addEventListener("paste",A),this.addEventListener("change",w)},remove:function(){return 0===--a&&(document.removeEventListener("drop",k),document.removeEventListener("dragover",x)),this.removeEventListener("dragenter",C),this.removeEventListener("dragover",C),this.removeEventListener("dragleave",S),this.removeEventListener("drop",L),this.removeEventListener("paste",A),this.removeEventListener("change",w)}}),("undefined"==typeof FormData||null===FormData)&&document.documentElement.classList.add("no-dnd-uploads")}.call(this),function(){var e,t,n;t=require("delegated-events"),t.on("click",".js-release-remove-file",function(){var e;return e=this.closest(".js-release-file"),e.classList.add("delete"),e.querySelector("input.destroy").value="true"}),t.on("click",".js-release-undo-remove-file",function(){var e;return e=this.closest(".js-release-file"),e.classList.remove("delete"),e.querySelector("input.destroy").value=""}),n=function(e){return e.closest("form").querySelector("#release_id").value},e=[],t.on("release:saved",".js-release-form",function(){var t,n,r,i,s,o;for(setImmediate(function(){var t,n,r;for(t=0,n=e.length;n>t;t++)(r=e[t])();return e.length=0}),o=0,s=this.querySelectorAll(".js-releases-field .js-release-file"),r=0,i=s.length;i>r;r++)t=s[r],t.classList.contains("delete")?t.remove():t.classList.contains("js-template")||o++;return n=this.querySelector(".js-releases-field"),n.classList.toggle("not-populated",!o),n.classList.toggle("is-populated",o)}),t.on("upload:setup",".js-upload-release-file",function(t){var r,i,s,o,a;return a=t.detail,s=a.policyRequest,o=a.preprocess,i=this,r=function(){var e,t,r;return s.body.append("release_id",n(i)),r=document.querySelectorAll(".js-releases-field .js-release-file.delete .id"),r.length?(t=function(){var t,n,i;for(i=[],t=0,n=r.length;n>t;t++)e=r[t],i.push(e.value);return i}(),s.body.append("deletion_candidates",t.join(","))):void 0},n(i)?r():(o.push(new Promise(function(t){return e.push(t)}).then(r)),1===e.length?$("button.js-save-draft").click():void 0)}),t.on("upload:start",".js-upload-release-file",function(e){var t,n,r,i,s,o,a;if(i=e.detail.policy,this.querySelector(".js-upload-meter").classList.remove("hidden"),o=i.asset.replaced_asset){for(s=document.querySelectorAll(".js-releases-field .js-release-file .id"),a=[],n=0,r=s.length;r>n;n++)t=s[n],Number(t.value)===o?a.push(t.closest(".js-release-file").remove()):a.push(void 0);return a}}),t.on("upload:complete",".js-upload-release-file",function(e){var t,n,r,i,s,o,a,c,u,l;for(l=e.detail,a=l.policy,n=document.querySelector(".js-releases-field"),u=n.querySelector(".js-template").cloneNode(!0),u.classList.remove("template","js-template"),u.querySelector("input.id").value=a.asset.id||l.result.id,o=a.asset.name||a.asset.href.split("/").pop(),c=u.querySelectorAll(".filename"),i=0,s=c.length;s>i;i++)t=c[i],"INPUT"===t.tagName?t.value=o:t.textContent=o;return r="",a.asset.size&&(r="("+(a.asset.size/1048576).toFixed(2)+" MB)"),u.querySelector(".filesize").textContent=r,n.appendChild(u),n.classList.remove("not-populated"),n.classList.add("is-populated"),this.querySelector(".js-upload-meter").classList.add("hidden")}),t.on("upload:progress",".js-upload-release-file",function(e){var t;return t=this.querySelector(".js-upload-meter"),t.style.width=e.detail.percent+"%"})}.call(this),function(){var e,t,n,r,i,s,o,a,c,u;t=require("delegated-events"),c=require("github/fetch"),n=c.fetchJSON,r=c.fetchPoll,e=[],o=new WeakMap,u=function(e,t){var n,r,i;n=e.closest(".js-upload-manifest-file-container"),r=n.querySelector(".js-upload-progress"),r.classList.add("active"),e.classList.add("is-progress-bar"),i=r.querySelector(".js-upload-meter-text"),i.querySelector(".js-upload-meter-range-start").textContent=t.batch.uploaded+1,i.querySelector(".js-upload-meter-range-end").textContent=t.batch.size},s=function(e){var t,n,r;return e.classList.remove("is-progress-bar"),t=e.closest(".js-upload-manifest-file-container"),n=t.querySelector(".js-upload-progress"),n.classList.remove("active"),r=t.querySelector(".js-upload-meter-text"),r.querySelector(".js-upload-meter-filename").textContent=""},t.on("upload:drop:setup",".js-upload-manifest-tree-view",function(e){var t,n;return e.preventDefault(),t=e.detail.upload,$(document).one("pjax:success","#js-repo-pjax-container",function(){return t(this.querySelector(".js-uploadable-container"))}),n=this.getAttribute("data-drop-url"),$.pjax({url:n,container:"#js-repo-pjax-container"})}),t.on("upload:setup",".js-upload-manifest-file",function(t){var r,i,s,a,c,l;return l=t.detail,a=l.policyRequest,c=l.preprocess,u(this,t.detail),i=this,r=function(){return a.body.append("upload_manifest_id",o.get(i))},o.get(i)?r():c.push(new Promise(function(t){return e.push(t)}).then(r)),e.length>1||o.get(i)?void 0:(s=this.closest(".js-upload-manifest-file-container").querySelector(".js-upload-manifest-form"),n(s.action,{method:s.method,body:new FormData(s)}).then(function(t){var n,r,s,a;for(n=document.querySelector(".js-manifest-commit-form"),n.elements.manifest_id.value=t.upload_manifest.id,o.set(i,t.upload_manifest.id),r=0,s=e.length;s>r;r++)(a=e[r])();return e.length=0}))}),i=function(e){return e._path?e._path+"/"+e.name:e.name},t.on("upload:start",".js-upload-manifest-file",function(e){var t,n,r,s;return s=e.detail,t=this.closest(".js-upload-manifest-file-container"),n=t.querySelector(".js-upload-progress"),r=n.querySelector(".js-upload-meter-text"),r.querySelector(".js-upload-meter-range-start").textContent=s.batch.uploaded+1,r.querySelector(".js-upload-meter-filename").textContent=i(s.file)}),t.on("upload:complete",".js-upload-manifest-file",function(e){var t,n,r,o,a,c;return c=e.detail,a=document.querySelector(".js-manifest-commit-file-template"),o=a.rows[0].cloneNode(!0),o.querySelector(".name").textContent=i(c.file),o.querySelector(".js-remove-manifest-file-form").elements.file_id.value=c.policy.asset.id,t=document.querySelector(".js-manifest-file-list"),t.classList.remove("hidden"),this.classList.add("is-file-list"),n=document.querySelector(".js-upload-progress"),n.classList.add("is-file-list"),r=t.querySelector(".js-manifest-file-list-root"),r.appendChild(o),c.batch.isFinished()?s(this):void 0}),t.on("upload:progress",".js-upload-manifest-file",function(e){var t,n,r;return r=e.detail,t=this.closest(".js-upload-manifest-file-container"),n=t.querySelector(".js-upload-meter"),n.style.width=r.batch.percent()+"%"}),a=function(){return s(this)},t.on("upload:error",".js-upload-manifest-file",a),t.on("upload:invalid",".js-upload-manifest-file",a),$(document).on("ajaxSuccess",".js-remove-manifest-file-form",function(){var e,t,n,r;r=this.closest(".js-manifest-file-list-root"),this.closest(".js-manifest-file-entry").remove(),r.hasChildNodes()||(t=r.closest(".js-manifest-file-list"),t.classList.add("hidden"),e=document.querySelector(".js-upload-manifest-file"),e.classList.remove("is-file-list"),n=document.querySelector(".js-upload-progress"),n.classList.remove("is-file-list"))}),$.observe(".js-manifest-ready-check",function(){var e;e=this.getAttribute("data-redirect-url"),r(this.getAttribute("data-poll-url")).then(function(){return window.location=e})["catch"](function(){return document.querySelector(".js-manifest-ready-check").classList.add("hidden"),document.querySelector(".js-manifest-ready-check-failed").classList.remove("hidden")})})}.call(this),function(){var e;e=function(){var e,t,n;if(location.hash&&!document.querySelector(":target")){try{e=decodeURIComponent(location.hash.slice(1))}catch(r){return}t="user-content-"+e,n=document.getElementById(t)||document.getElementsByName(t)[0],null!=n&&n.scrollIntoView()}},window.addEventListener("hashchange",e),$(e),$(document).on("pjax:success",e)}.call(this),function(){var e,t,n,r,i,s,o;o=document.createElement("input"),"checkValidity"in o?(o.required=!0,o.value="hi",s=o.cloneNode().checkValidity()):s=!1,o=null,n=function(r){var i,o,a,c,u;if(s)return r.checkValidity();if(i=$(r),i.is("[required]")&&!t(r))return!1;if(i.is("[pattern]")&&!e(r))return!1;if(i.is("form"))for(u=r.elements,a=0,c=u.length;c>a;a++)if(o=u[a],!n(o))return!1;return!0},t=function(e){return!!e.value.trim()},e=function(e){var t;return t=new RegExp("^(?:"+$(e).attr("pattern")+")$"),0===e.value.search(t)},r=function(){var e;return e=n(this),e&&$(this).trigger("validation:field:change"),function(){var t;t=n(this),t!==e&&$(this).trigger("validation:field:change"),e=t}},i=["input[pattern]","input[required]","textarea[required]","select[required]"].join(","),$(document).onFocusedInput(i,r),$(document).on("change",i,r),$.observe(i,function(){$(this).trigger("validation:field:change")}),$(document).on("validation:field:change","form",function(){var e;return e=n(this),$(this).trigger("validation:change",[e])}),$(document).on("validation:change","form",function(e,t){return $(this).find("button[data-disable-invalid]").prop("disabled",!t)}),$(document).on("submit",".js-normalize-submit",function(e){return n(this)?void 0:e.preventDefault()})}.call(this),function(){var e;$.observe(".will-transition-once",{add:function(){this.addEventListener("transitionend",e)},remove:function(){this.removeEventListener("transitionend",e)}}),e=function(e){return e.target.classList.remove("will-transition-once")}}.call(this),function(){$(document).on("ajaxSuccess",function(e,t){var n;(n=t.getResponseHeader("X-XHR-Location"))&&(document.location.href=n,e.stopImmediatePropagation())})}.call(this),function(){$(document).on("submit",".js-user-recommendations-form",function(e){var t;return t=$(".js-user-interests-input").val(),window.ga("send","event","Recommendations","submit","Interest entered : "+t)}),$(document).on("click",".js-interest-option",function(e){var t;return t=$(this).text(),window.ga("send","event","Recommendations","click","Example Interest clicked : "+t)}),$(document).on("submit",".js-remove-user-interest-form",function(e){var t;return t=this.querySelector('input[name="interest"]').value,window.ga("send","event","Recommendations","click","Interest removed : "+t)}),$(document).on("submit",".recommendations-wrapper .js-unfollow-button",function(e){return window.ga("send","event","Recommendations","submit","Unfollowed a User suggestion")}),$(document).on("submit",".recommendations-wrapper .js-follow-button",function(e){return window.ga("send","event","Recommendations","submit","Followed a User suggestion")}),$(document).on("submit",".recommendations-wrapper .js-unstar-button",function(e){return window.ga("send","event","Recommendations","submit","Unstarred a Repo suggestion")}),$(document).on("submit",".recommendations-wrapper .js-star-button",function(e){return window.ga("send","event","Recommendations","submit","Starred a Repo suggestion")})}.call(this),function(){$(function(){return $(".js-signup-form").one("input","input[type=text]",function(){var e;e=this.form.querySelector(".js-signup-source"),window.ga("send","event","Signup","Attempt",e.value)})})}.call(this),function(){var e;e=require("github/fetch").fetchText,$(document).on("click",".js-new-user-contrib-example",function(t){var n,r,i;return t.preventDefault(),n=document.querySelector(".js-calendar-graph"),n.classList.contains("sample-graph")?void 0:(n.classList.add("sample-graph"),r=function(e){var t;return t=n.querySelector(".js-calendar-graph-svg"),$(t).replaceWith(e)},i=function(){return n.classList.remove("sample-graph")},e(this.getAttribute("href")).then(r,i))})}.call(this),function(){$(document).on("graph:load",".js-graph-code-frequency",function(e,t){var n,r,i,s,o,a,c,u,l,d,h,f,m,p,g,v,b,y,j;return g=$(this).width(),s=500,h=[10,10,20,40],d=h[0],l=h[1],c=h[2],u=h[3],t=t.map(function(e,t){return[new Date(1e3*e[0]),e[1],e[2]]}).sort(function(e,t){return d3.ascending(e[0],t[0])}),n=t.map(function(e){return[e[0],e[1]]}),i=t.map(function(e){return[e[0],e[2]]}),o=d3.max(n,function(e){return e[1]}),a=d3.min(i,function(e){return e[1]}),p=t[0][0],m=t[t.length-1][0],v=d3.time.scale().domain([p,m]).range([0,g-u-l]),y=d3.scale.linear().domain([a,o]).range([s-c-d,0]),b=d3.svg.axis().scale(v).tickFormat(function(e){return p.getFullYear()!==m.getFullYear()?d3.time.format("%m/%y")(e):d3.time.format("%m/%d")(e)}),j=d3.svg.axis().scale(y).orient("left").tickPadding(5).tickSize(g).tickFormat(function(e){return d3.formatSymbol(e,!0)}),r=d3.svg.area().x(function(e){return v(e[0])}).y0(function(e){return y(e[1])}).y1(function(e){return y(0)}),f=d3.select(this).data(t).append("svg").attr("width",g).attr("height",s).attr("class","viz code-frequency").append("g").attr("transform","translate("+u+","+d+")"),f.append("g").attr("class","x axis").attr("transform","translate(0, "+(s-d-c)+")").call(b),f.append("g").attr("class","y axis").attr("transform","translate("+g+", 0)").call(j),f.selectAll("path.area").data([n,i]).enter().append("path").attr("class",function(e,t){return 0===t?"addition":"deletion"}).attr("d",r)})}.call(this),define("github/inflector",["exports"],function(e){function t(e,t){return t+(e>1||0==e?"s":"")}function n(e,t){var n=1==e?"data-singular-string":"data-plural-string",r=t.getAttribute(n);t.textContent=r}Object.defineProperty(e,"__esModule",{value:!0}),e.pluralize=t,e.pluralizeNode=n}),function(){var e;e=require("github/inflector").pluralize,$(document).on("graph:load",".js-commit-activity-graph",function(t,n){var r,i,s,o,a,c,u,l,d,h,f,m,p,g,v,b,y,j,w,x,k,C;return u=$("#commit-activity-master"),i=$("#commit-activity-detail"),a=260,y=i.width(),j=0,v=null,function(){var e,t,r,o,c,u,l,d,h,f,m,p,g,b,w,x,k,C,S,L;for(l=0,c=u=0,d=n.length;d>u;c=++u)e=n[c],0!==e.total&&(l=c);return j=l,w=[20,30,30,40],g=w[0],m=w[1],p=w[2],f=w[3],r=n[j].days,h=d3.max(n,function(e){return d3.max(e.days)}),k=d3.scale.linear().domain([0,r.length-1]).range([0,y-m-p]),S=d3.scale.linear().domain([0,h]).range([a,0]),L=d3.svg.axis().scale(S).orient("left").ticks(5).tickSize(-y+p+m),$(this).on("hotkey:activate",function(e){var t,r;return r=j,t=e.originalEvent.hotkey,"left"===t||"right"===t?(j>0&&"left"===t&&(r-=1),j=52||e.index<0))return j=e.index,r=n[e.index].days,h=d3.max(r),k.domain([0,r.length-1]),o=d3.selectAll(".bar.mini").attr("class","bar mini"),t=d3.select(o[0][j]).attr("class","bar mini active"),i=d3.transform(t.attr("transform")),s.transition().ease("back-out").duration(300).attr("transform","translate("+(i.translate[0]+8)+", 105)"),x.selectAll(".path").data([r]).transition().duration(500).attr("d",b),x.selectAll("g.dot").data(r).transition().duration(300).attr("transform",function(e,t){return"translate("+k(t)+", "+S(e)+")"}),x.selectAll("text.tip").data(r).text(function(e){return e})}}(),m=[10,30,20,30],f=m[0],d=m[1],h=m[2],l=m[3],a=100,g=n.map(function(e){return e.total}),c=d3.max(g),o=d3.time.format.utc("%m/%d"),w=d3.scale.ordinal().domain(d3.range(g.length)).rangeRoundBands([0,y-d-h],.1),k=d3.scale.linear().domain([0,c]).range([a,0]),C=d3.svg.axis().scale(k).orient("left").ticks(3).tickSize(-y+d+h).tickFormat(d3.formatSymbol),x=d3.svg.axis().scale(w).ticks(d3.time.weeks).tickFormat(function(e,t){var r;return r=new Date(1e3*n[t].week),o(r)}),p=d3.tip().attr("class","svg-tip").offset([-10,0]).html(function(t,r){var i,s;return i=new Date(1e3*n[r].week),s=d3.months[i.getUTCMonth()].slice(0,3)+" "+i.getUTCDate(),""+t+" "+e(t,"commit")+" the week of "+s}),b=d3.select(u[0]).style("width",y+"px").append("svg").attr("width",y+(d+h)).attr("height",a+f+l).attr("class","viz").append("g").attr("transform","translate("+d+","+f+")").call(p),b.append("g").attr("class","y axis").call(C),r=b.selectAll("g.mini").data(g).enter().append("g").attr("class",function(e,t){return t===j?"bar mini active":"bar mini"}).attr("transform",function(e,t){return"translate("+w(t)+", 0)"}).on("click",function(e,t){return v({node:this,index:t,data:e})}),r.append("rect").attr("width",w.rangeBand()).attr("height",function(e){return a-k(e)}).attr("y",function(e){return k(e)}).on("mouseover",p.show).on("mouseout",p.hide),b.append("g").attr("class","x axis").attr("transform","translate(0,"+a+")").call(x).selectAll(".tick").style("display",function(e,t){return t%3!==0?"none":"block"}),s=b.append("circle").attr("class","focus").attr("r",8).attr("transform","translate("+(w(j)+w.rangeBand()/2)+", "+-a+")"),s.transition().ease("elastic-in").duration(1e3).attr("r",2).attr("transform","translate("+(w(j)+w.rangeBand()/2)+", "+(a+5)+")")})}.call(this),define("github/number-helpers",["exports"],function(e){function t(e){return(""+e).replace(/(^|[^\w.])(\d{4,})/g,function(e,t,n){return t+n.replace(/\d(?=(?:\d\d\d)+(?!\d))/g,"$&,")})}function n(e){return"string"==typeof e&&(e=e.replace(/,/g,"")),parseFloat(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNumber=t,e.parseFormattedNumber=n}),function(){var e,t,n,r,i,s;i=require("github/inflector").pluralize,e=require("github/number-helpers").formatNumber,r=function(){var e,t,n,r,i,s,o,a;for(i={},s=document.location.search.substr(1).split("&"),e=0,n=s.length;n>e;e++)r=s[e],o=r.split("="),t=o[0],a=o[1],i[t]=a;return i},t=function(e){return e=new Date(e),d3.months[e.getUTCMonth()].slice(0,3)+" "+e.getUTCDate()+", "+e.getUTCFullYear()},s=function(e,n){var r,i;return i=t(e),r=t(n),$(".js-date-range").html(i+" – "+r)},n=function(e){var t,n;return t=e[0].weeks[0].date,n=new Date(t.getTime()-6048e5),e.forEach(function(e){return e.weeks.unshift({a:0,c:0,d:0,date:n,w:n/1e3})})},$(document).on("graph:load","#contributors",function(t,o){var a,c,u,l,d,h,f,m,p,g,v,b,y,j,w,x,k,C,S;return a=$(this),u=[],p=r(),S=null,C=null,null!=p.from&&(w=new Date(p.from)),null!=p.to&&(d=new Date(p.to)),l=(null!=p?p.type:void 0)||"c",f=d3.time.format.utc("%Y-%m-%d"),g=function(e){return new Date(1e3*~~e)},a.on("range.selection.end",function(e,t){var n;return n=t.range,w=n[0],d=n[1],f(w)===f(d)&&(w=S,d=C),k(),s(w,d),y()}),b=function(e){var t,r;return 1===e[0].weeks.length&&n(e),r=c(e),S=g(r[0].key),C=g(~~r[r.length-1].key+518400),t=new Date,C>t&&(C=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()))),null==w&&(w=S),null==d&&(d=C),s(w,d),j(r,S,C),y(e,S,C),$(".js-contribution-container").on("change","input[type=radio]",m)},v=function(e){var t,n,r,i,s,o,a;for(n=0,i=e.length;i>n;n++)for(t=e[n],o=t.weeks,r=0,s=o.length;s>r;r++)a=o[r],a.date=new Date(1e3*a.w);return e},h=function(e,t){return e.map(function(e){var n;return n=$.extend(!0,{},e),n.weeks=n.weeks.filter(function(e){return e.date>=t[0]&&e.date<=t[1]}),n})},c=function(e){var t,n,r,i,s,o,a,c,u;for(c={},n=0,i=e.length;i>n;n++)for(t=e[n],a=t.weeks,r=0,s=a.length;s>r;r++)u=a[r],null==c[o=u.w]&&(c[o]={c:0,a:0,d:0}),c[u.w].c+=u.c,c[u.w].a+=u.a,c[u.w].d+=u.d;return d3.entries(c)},x=function(e){return e=h(e,[w,d]),e.forEach(function(e){var t,n,r,i,s,o,a;for(n=0,t=0,r=0,o=e.weeks,i=0,s=o.length;s>i;i++)a=o[i],n+=a.c,t+=a.a,r+=a.d;return e.c=n,e.a=t,e.d=r}),e.sort(function(e,t){return d3.descending(e[l],t[l])})},j=function(e,t,n){var r,i,s,o,c,u,h,m,p,v,b,y,$,j,x,k,C,S;return p=[20,50,20,30],m=p[0],u=p[1],h=p[2],c=p[3],j=a.width(),s=125,o=d3.max(e,function(e){return e.value[l]}),x=d3.time.scale().domain([t,n]).range([0,j-u-h]),C=d3.scale.linear().domain([0,o]).range([s,0]),S=d3.svg.axis().scale(C).orient("left").ticks(4).tickSize(-j+u+h).tickPadding(10).tickFormat(d3.formatSymbol),k=d3.svg.axis().scale(x),e.length<5&&k.ticks(e.length),r=d3.svg.area().interpolate("basis").x(function(e){return x(g(e.key))}).y0(function(e){return s}).y1(function(e){return C(e.value[l])}),d3.select("#contributors-master svg").remove(),$=d3.select("#contributors-master").data([e]).append("svg").attr("height",s+m+c).attr("width",j).attr("class","viz").append("g").attr("transform","translate("+u+","+m+")"),$.append("g").attr("class","x axis").attr("transform","translate(0, "+s+")").call(k),$.append("g").attr("class","y axis").call(S),$.append("path").attr("class","area").attr("d",r),y=function(){var e;return $.classed("selecting",!0),e=d3.event.target.extent(),a.trigger("range.selection.start",{data:arguments[0],range:e})},v=function(){var e;return e=d3.event.target.extent(),a.trigger("range.selection.selected",{data:arguments[0],range:e})},b=function(){var e;return $.classed("selecting",!d3.event.target.empty()),e=d3.event.target.extent(),a.trigger("range.selection.end",{data:arguments[0],range:e})},i=d3.svg.brush().x(x).on("brushstart",y).on("brush",v).on("brushend",b),(f(w)!==f(t)||f(d)!==f(n))&&i.extent([w,d]),$.append("g").attr("class","selection").call(i).selectAll("rect").attr("height",s)},y=function(){var t,n,r,s,c,h,f,m,p,g,v,b,y,j,k,C,S,L,A,T,q,_;return b=[10,10,10,20],g=b[0],m=b[1],p=b[2],f=b[3],S=parseInt(a.attr("data-graph-width")),r=100,$("#contributors ol").remove(),o=x(u),j=document.createElement("ol"),C=d3.select(j).attr("class","contrib-data capped-cards clearfix"),c=d3.max(o,function(e){return d3.max(e.weeks,function(e){return e[l]})}),L=d3.time.scale().domain([w,d]).range([0,S]),T=d3.scale.linear().domain([0,c]).range([r-f-g,0]),n=d3.svg.area().interpolate("basis").x(function(e){return L(e.date)}).y0(function(e){return r-f-g}).y1(function(e){return T(e[l])}),q=d3.svg.axis().scale(T).orient("left").ticks(2).tickSize(-S).tickPadding(10).tickFormat(d3.formatSymbol),A=d3.svg.axis().scale(L),o[0].weeks.length<5&&A.ticks(o[0].weeks.length).tickFormat(d3.time.format("%x")),$("li.capped-card").remove(),v=C.selectAll("li.capped-card").data(o).enter().append("li").attr("class","capped-card").style("display",function(e){return e[l]<1?"none":"block"}),s=v.append("h3"),s.append("img").attr("src",function(e){return e.author.avatar}).attr("class","avatar").attr("alt",""),s.append("span").attr("class","rank").text(function(e,t){return"#"+(t+1)}),s.append("a").attr("class","aname").attr("href",function(e){return"/"+e.author.login}).text(function(e){return e.author.login}),t=s.append("span").attr("class","ameta"),y=$(".graphs").attr("data-repo-url"),t.append("span").attr("class","cmeta").html(function(t){var n,r,s,o,a,c;return n=y+"/commits?author="+t.author.login,c=e(t.c)+" "+i(t.c,"commit"),a=$("",{href:n,"class":"cmt",text:c}),s=$("",{"class":"a",text:e(t.a)+" ++"}),o=$("",{"class":"d",text:e(t.d)+" --"}),r=" / ",$("
").append([a,r,s,r,o]).html()}),k=v.append("svg").attr("width",S+(m+p)).attr("height",r+g+f).attr("class","capped-card-content").append("g").attr("transform","translate("+m+","+g+")"),h=A.ticks()[0],k.append("g").attr("class","x axis").classed("dense",h>=10).attr("transform","translate(0, "+(r-g-f)+")").call(A).selectAll(".tick text").style("display",function(e,t){return t%2!==0?"none":"block"}),k.select(".x.dense text").attr("dx",7),_=k.append("g").attr("class","y axis").call(q).selectAll(".y.axis g text").attr("dx",S/2).style("display",function(e,t){return 0===t?"none":"block"}).classed("midlabel",!0),k.append("path").attr("d",function(e){return n(e.weeks)}),document.querySelector("#contributors").appendChild(j)},k=function(){var e,t;return $.support.pjax?(e=document.location,l=$("input[name=ctype]:checked").prop("value").toLowerCase(),t=e.pathname+"?from="+f(w)+"&to="+f(d)+"&type="+l,window.history.pushState(null,null,t)):void 0},m=function(e){return l!==$(this).val()?(k(),b(u)):void 0},u=v(o),b(o)})}.call(this),function(){var e,t,n,r,i,s,o;n=function(e){var t;return(t=d3.format(","))(e)},t={top:20,right:40,bottom:30,left:40},o=980-t.left-t.right,e=150-t.top-t.bottom,s=function(e,t){return 0>e?t.classList.add("is-decrease"):e>0&&t.classList.add("is-increase"),t.querySelector(".js-change-num").textContent=n(Math.abs(e))},r=function(e,t){return 0>e?(t.classList.add("is-decrease"),t.querySelector(".js-change-num").textContent=n(Math.abs(e))+"% decrease"):e>0?(t.classList.add("is-increase"),t.querySelector(".js-change-num").textContent=n(Math.abs(e))+"% increase"):0===e?t.querySelector(".js-change-num").textContent=n(Math.abs(e))+"% increase":void 0},i=function(i,a){var c,u,l,d,h,f,m,p,g,v,b,y,$,j,w,x,k,C,S,L,A,T,q,_,E,D,P,I;if(a&&null==a.error){for(h=a.counts,d=a.summary.columns,S=new Date(1e3*a.summary.starting),m=new Date(1e3*a.summary.ending),x=a.summary.model,k=a.summary.period,w=d3.max(d3.merge(d3.values(h)),function(e){return e.count}),j=d3.time.format("%A, %B %-d, %Y"),p=d3.time.format("%-I%p"),u=d3.bisector(function(e){return e.date}).left,g=0,b=d.length;b>g;g++)l=d[g],document.querySelector(".js-"+x+"-"+l+" .js-total").textContent=n(a.summary.totals[l]),s(a.summary.total_changes[l],document.querySelector(".js-"+x+"-"+l+" .js-total-change")),r(a.summary.percent_changes[l],document.querySelector(".js-"+x+"-"+l+" .js-percentage-change"));if(0===d3.values(a.summary.totals).filter(function(e){return 0!==e}).length)return this.closest(".js-dashboards-overview-card").classList.add("is-no-activity");for(T=d3.tip().attr("class","svg-tip total-unique comparison").offset([-10,0]).html(function(e){var t,r,i,s,o,c;for(c="",t=function(){switch(k){case"year":return"Week of "+j(e.date);case"week":return j(e.date)+" starting at "+p(e.date);default:return j(e.date)}}(),o=270/a.summary.columns.length,s=a.summary.columns,r=0,i=s.length;i>r;r++)l=s[r],c+="
  • "+n(e[l])+" "+l.split("_at")[0]+"
  • ";return""+t+"
      "+c+"
    "}),C=function(){var e,t,n,r,i,s,o,a,c,f;for(c={},f=_.invert(d3.mouse(this)[0]),i=d[0],s=u(h[i],f,1),t=h[i][s-1],n=h[i][s],e=n&&f-t.date>n.date-f?s:s-1,c.date=h[i][e].date,o=0,a=d.length;a>o;o++)l=d[o],c[l]=h[l][e].count;return r=q.selectAll("g.dots circle").filter(function(e){return e.date===c.date}),T.show.call(this,c,r[0][0])},v=0,y=d.length;y>v;v++)l=d[v],h[l].forEach(function(e){return e.date=new Date(1e3*e.bucket)}),h[l]=h[l].filter(function(e){return e.datet;c=++t)o=i[c],s.push(new e(c,o));return s}(),this.users={},d=r.users,a=0,l=d.length;l>a;a++)h=d[a],this.users[h.name]=h;return this.chrome=new i(this,this.ctx,this.width,this.height,this.focus,this.commits,this.userBlocks,this.users),this.graph=new s(this,this.ctx,this.width,this.height,this.focus,this.commits,this.users,this.spaceMap,this.userBlocks,this.nethash),this.mouseDriver=new n(this.container,this.chrome,this.graph),this.keyDriver=new t(this.chrome,this.graph),this.stopLoader(),this.graph.drawBackground(),this.chrome.draw(),this.graph.requestInitialChunk()}},r.prototype.initError=function(){return this.stopLoader(),this.ctx.clearRect(0,0,this.width,this.height),this.startLoader("Graph could not be drawn due to a network problem.")},r}(),e=function(){function e(e,t){this.time=e,this.date=new Date(t),this.requested=null,this.populated=null}return e.prototype.populate=function(e,t,n){return this.user=t,this.author=e.author,this.date=new Date(e.date.replace(" ","T")),this.gravatar=e.gravatar,this.id=e.id,this.login=e.login,this.message=e.message,this.space=e.space,this.time=e.time,this.parents=this.populateParents(e.parents,n),this.requested=!0,this.populated=new Date},e.prototype.populateParents=function(e,t){var n,r,i;return i=function(){var i,s,o;for(o=[],i=0,s=e.length;s>i;i++)n=e[i],r=t[n[1]],r.id=n[0],r.space=n[2],o.push(r);return o}()},e}(),i=function(){function e(e,t,n,r,i,s,o,a){this.network=e,this.ctx=t,this.width=n,this.height=r,this.focus=i,this.commits=s,this.userBlocks=o,this.users=a,this.namesWidth=120,this.months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.userBgColors=["#fff","#f7f7f7"],this.headerColor="#f7f7f7",this.dividerColor="#ddd",this.headerHeight=40,this.dateRowHeight=30,this.graphTopOffset=10+this.headerHeight+this.dateRowHeight,this.nameLineHeight=24,this.offsetX=this.namesWidth+(this.width-this.namesWidth)/2-this.focus*this.nameLineHeight,this.offsetY=0,this.contentHeight=this.calcContentHeight(),this.graphMidpoint=this.namesWidth+(this.width-this.namesWidth)/2,this.activeUser=null}return e.prototype.moveX=function(e){return this.offsetX+=e,this.offsetX>this.graphMidpoint?this.offsetX=this.graphMidpoint:this.offsetX0||this.contentHeightn;n++)e=i[n],t+=e.count;return t*this.nameLineHeight},e.prototype.hover=function(e,t){var n,r,i,s;for(s=this.userBlocks,r=0,i=s.length;i>r;r++)if(n=s[r],e>0&&ethis.graphTopOffset+this.offsetY+n.start*this.nameLineHeight&&tu&&(u=0),c=u+parseInt(this.width/(this.nameLineHeight-1)),c>this.commits.length&&(c=this.commits.length),e.save(),e.translate(this.offsetX,0),a=null,o=null,s=i=h=u,f=c;f>=h?f>i:i>f;s=f>=h?++i:--i)t=this.commits[s],l=this.months[t.date.getMonth()],l!==a&&(e.font="bold 12px 'Helvetica Neue', Arial, sans-serif",e.fillStyle="#555",d=this.ctx.measureText(l).width,e.fillText(l,s*this.nameLineHeight-d/2,this.headerHeight/2+4),a=l),r=t.date.getDate(),r!==o&&(e.font="12px 'Helvetica Neue', Arial, sans-serif",e.fillStyle="#555",n=this.ctx.measureText(r).width,e.fillText(r,s*this.nameLineHeight-n/2,this.headerHeight+this.dateRowHeight/2+3),o=r,e.fillStyle="#ddd",e.fillRect(s*this.nameLineHeight,this.headerHeight,1,6));return e.restore()},e.prototype.drawUsers=function(e){var t,n,r,i,s,o,a;for(e.fillStyle="#fff",e.fillRect(0,0,this.namesWidth,this.height),e.save(),e.translate(0,this.headerHeight+this.dateRowHeight+this.offsetY),o=this.userBlocks,r=n=0,i=o.length;i>n;r=++n)t=o[r],e.fillStyle=this.userBgColors[r%2],e.fillRect(0,t.start*this.nameLineHeight,this.namesWidth,t.count*this.nameLineHeight),this.activeUser&&this.activeUser.name===t.name&&(e.fillStyle="rgba(0, 0, 0, 0.05)",e.fillRect(0,t.start*this.nameLineHeight,this.namesWidth,t.count*this.nameLineHeight)),s=(t.start+t.count/2)*this.nameLineHeight+3,e.fillStyle="rgba(0, 0, 0, 0.1)",e.fillRect(0,t.start*this.nameLineHeight+t.count*this.nameLineHeight-1,this.namesWidth,1),e.fillStyle="#333",e.font="13px 'Helvetica Neue', Arial, sans-serif",e.textAlign="center",e.fillText(t.name,this.namesWidth/2,s,96);return e.restore(),e.fillStyle=this.headerColor,e.fillRect(0,0,this.namesWidth,this.headerHeight),e.fillStyle="#777",e.font="12px 'Helvetica Neue', Arial, sans-serif",e.fillText("Owners",40,this.headerHeight/2+3),a=10,e.fillStyle=this.dividerColor,e.fillRect(this.namesWidth-1,a,1,this.headerHeight-2*a),e.fillStyle=this.dividerColor,e.fillRect(0,this.headerHeight-1,this.namesWidth,1),e.fillStyle=this.dividerColor,e.fillRect(this.namesWidth-1,this.headerHeight,1,this.height-this.headerHeight)},e}(),s=function(){function e(e,t,n,r,i,s,o,a,c,u){var l,d,h,f,m,p,g,v,b,y,$,j,w,x,k,C,S;for(this.network=e,this.ctx=t,this.width=n,this.height=r,this.focus=i,this.commits=s,this.users=o,this.spaceMap=a,this.userBlocks=c,this.nethash=u,this.namesWidth=120,this.headerHeight=40,this.dateRowHeight=30,this.graphTopOffset=10+this.headerHeight+this.dateRowHeight,this.bgColors=["#fff","#f9f9f9"],this.nameLineHeight=24,this.spaceColors=["#c0392b","#3498db","#2ecc71","#8e44ad","#f1c40f","#e67e22","#34495e","#e74c3c","#2980b9","#1abc9c","#9b59b6","#f39c12","#7f8c8d","#2c3e50","#d35400","#e74c3c","#95a5a6","#bdc3c7","#16a085","#27ae60"],this.offsetX=this.namesWidth+(this.width-this.namesWidth)/2-this.focus*this.nameLineHeight,this.offsetY=0,this.bgCycle=0,this.marginMap={},this.gravatars={},this.activeCommit=null,this.contentHeight=this.calcContentHeight(),this.graphMidpoint=this.namesWidth+(this.width-this.namesWidth)/2,this.showRefs=!0,this.lastHotLoadCenterIndex=null,this.connectionMap={},this.spaceUserMap={},j=this.userBlocks,f=0,g=j.length;g>f;f++)for(l=j[f],m=p=w=l.start,x=l.start+l.count;x>=w?x>p:p>x;m=x>=w?++p:--p)this.spaceUserMap[m]=this.users[l.name];for(this.headsMap={},k=this.userBlocks,y=0,v=k.length;v>y;y++)for(l=k[y],S=this.users[l.name],C=S.heads,$=0,b=C.length;b>$;$++)d=C[$],this.headsMap[d.id]||(this.headsMap[d.id]=[]),h={name:S.name,head:d},this.headsMap[d.id].push(h)}return e.prototype.moveX=function(e){return this.offsetX+=e,this.offsetX>this.graphMidpoint?this.offsetX=this.graphMidpoint:this.offsetX0||this.contentHeightn;n++)e=i[n],t+=e.count;return t*this.nameLineHeight},e.prototype.hover=function(e,t){var n,r,i,s,o,a,c,u;for(u=this.timeWindow(),i=r=s=u.min,o=u.max;o>=s?o>=r:r>=o;i=o>=s?++r:--r)if(n=this.commits[i],a=this.offsetX+n.time*this.nameLineHeight,c=this.offsetY+this.graphTopOffset+n.space*this.nameLineHeight,e>a-5&&a+5>e&&t>c-5&&c+5>t)return n;return null},e.prototype.hotLoadCommits=function(){var e,t,n,r,i,s;return i=200,t=parseInt((-this.offsetX+this.graphMidpoint)/this.nameLineHeight),0>t&&(t=0),t>this.commits.length-1&&(t=this.commits.length-1),this.lastHotLoadCenterIndex&&Math.abs(this.lastHotLoadCenterIndex-t)<10?void 0:(this.lastHotLoadCenterIndex=t,e=this.backSpan(t,i),r=this.frontSpan(t,i),e||r?(s=e?e[0]:r[0],n=r?r[1]:e[1],this.requestChunk(s,n)):void 0)},e.prototype.backSpan=function(e,t){var n,r,i,s,o,a,c,u;for(s=null,r=n=c=e;(0>=c?0>=n:n>=0)&&r>e-t;r=0>=c?++n:--n)if(!this.commits[r].requested){s=r;break}if(null!==s){for(o=null,a=null,r=i=u=s;(0>=u?0>=i:i>=0)&&r>s-t;r=0>=u?++i:--i)if(this.commits[r].requested){o=r;break}return o?a=o+1:(a=s-t,0>a&&(a=0)),[a,s]}return null},e.prototype.frontSpan=function(e,t){var n,r,i,s,o,a,c,u,l,d;for(u=null,r=n=s=e,o=this.commits.length;(o>=s?o>n:n>o)&&e+t>r;r=o>=s?++n:--n)if(!this.commits[r].requested){u=r;break}if(null!==u){for(l=null,d=null,r=i=a=u,c=this.commits.length;(c>=a?c>i:i>c)&&u+t>r;r=c>=a?++i:--i)if(this.commits[r].requested){l=r;break}return d=l?l-1:u+t>=this.commits.length?this.commits.length-1:u+t,[u,d]}return null},e.prototype.chunkUrl=function(){return document.querySelector(".js-network-graph-container").getAttribute("data-network-graph-chunk-url")},e.prototype.requestInitialChunk=function(){var e;if(u)return e=this.chunkUrl()+"?"+$.param({nethash:this.nethash}),o(e).then(function(e){return function(t){return e.importChunk(t),e.draw(),e.network.chrome.draw()}}(this))},e.prototype.requestChunk=function(e,t){var n,r,i,s,a;if(u){for(r=n=i=e,s=t;s>=i?s>=n:n>=s;r=s>=i?++n:--n)this.commits[r].requested=new Date;return a=this.chunkUrl()+"?"+$.param({nethash:this.nethash,start:e,end:t}),o(a).then(function(e){return function(t){return e.importChunk(t),e.draw(),e.network.chrome.draw(),e.lastHotLoadCenterIndex=e.focus}}(this))}},e.prototype.importChunk=function(e){var t,n,r,i,s,o,a,c,u;if(e.commits){for(a=e.commits,c=[],r=0,s=a.length;s>r;r++)t=a[r],u=this.spaceUserMap[t.space],n=this.commits[t.time],n.populate(t,u,this.commits),c.push(function(){var e,t,r,s;for(r=n.parents,s=[],e=0,t=r.length;t>e;e++)o=r[e],s.push(function(){var e,t,r,s;for(s=[],i=e=t=o.time+1,r=n.time;r>=t?r>e:e>r;i=r>=t?++e:--e)this.connectionMap[i]=this.connectionMap[i]||[],s.push(this.connectionMap[i].push(n));return s}.call(this));return s}.call(this));return c}},e.prototype.timeWindow=function(){var e,t;return t=parseInt((this.namesWidth-this.offsetX+this.nameLineHeight)/this.nameLineHeight),0>t&&(t=0),e=t+parseInt((this.width-this.namesWidth)/this.nameLineHeight),e>this.commits.length-1&&(e=this.commits.length-1),{min:t,max:e}},e.prototype.draw=function(){var e,t,n,r,i,s,o,a,c,u,l,d,h,f,m,p,g,v,b,y,$,j,w,x,k,C,S,L,A,T,q,_,E,D,P,I;for(this.drawBackground(),I=this.timeWindow(),g=I.min,p=I.max,this.ctx.save(),this.ctx.translate(this.offsetX,this.offsetY+this.graphTopOffset),r={},x=this.spaceMap,a=o=0,l=x.length;l>o;a=++o)for(e=x[a],D=this.spaceMap.length-a-1,c=u=C=g,S=p;S>=C?S>=u:u>=S;c=S>=C?++u:--u)t=this.commits[c],t.populated&&t.space===D&&(this.drawConnection(t),r[t.id]=!0);for(a=m=L=g,A=p;A>=L?A>=m:m>=A;a=A>=L?++m:--m)if(n=this.connectionMap[a])for(v=0,d=n.length;d>v;v++)t=n[v],r[t.id]||(this.drawConnection(t),r[t.id]=!0);for(T=this.spaceMap,a=y=0,h=T.length;h>y;a=++y)for(e=T[a],D=this.spaceMap.length-a-1,c=j=q=g,_=p;_>=q?_>=j:j>=_;c=_>=q?++j:--j)t=this.commits[c],t.populated&&t.space===D&&(t===this.activeCommit?this.drawActiveCommit(t):this.drawCommit(t));if(this.showRefs)for(c=w=E=g,k=p;k>=E?k>=w:w>=k;c=k>=E?++w:--w)if(t=this.commits[c],t.populated&&(s=this.headsMap[t.id]))for($=0,P=0,f=s.length;f>P;P++)i=s[P],this.spaceUserMap[t.space].name===i.name&&(b=this.drawHead(t,i.head,$),$+=b);return this.ctx.restore(),this.activeCommit?this.drawCommitInfo(this.activeCommit):void 0},e.prototype.drawBackground=function(){var e,t,n,r,i;for(this.ctx.clearRect(0,0,this.width,this.height),this.ctx.save(),this.ctx.translate(0,this.offsetY+this.graphTopOffset),this.ctx.clearRect(0,-10,this.width,this.height),i=this.userBlocks,n=t=0,r=i.length;r>t;n=++t)e=i[n],this.ctx.fillStyle=this.bgColors[n%2],this.ctx.fillRect(0,e.start*this.nameLineHeight-10,this.width,e.count*this.nameLineHeight),this.ctx.fillStyle="#DDDDDD",this.ctx.fillRect(0,(e.start+e.count)*this.nameLineHeight-11,this.width,1);return this.ctx.restore()},e.prototype.drawCommit=function(e){var t,n;return t=e.time*this.nameLineHeight,n=e.space*this.nameLineHeight,this.ctx.beginPath(),this.ctx.arc(t,n,3,0,2*Math.PI,!1),this.ctx.fillStyle=this.spaceColor(e.space),this.ctx.fill()},e.prototype.drawActiveCommit=function(e){var t,n;return t=e.time*this.nameLineHeight,n=e.space*this.nameLineHeight,this.ctx.beginPath(),this.ctx.arc(t,n,6,0,2*Math.PI,!1),this.ctx.fillStyle=this.spaceColor(e.space),this.ctx.fill()},e.prototype.drawCommitInfo=function(e){var t,n,r,i,s,o,a,c,u,l;return t=3,n=340,l=56,u=e.message?this.splitLines(e.message,48):[],o=Math.max(l,38+16*u.length),r=this.offsetX+e.time*this.nameLineHeight,i=this.graphTopOffset+this.offsetY+e.space*this.nameLineHeight,a=0,c=0,a=rr;i=++r)o=e[i],a.push(this.ctx.fillText(o,t,n+16*i));return a},e.prototype.splitLines=function(e,t){var n,r,i,s,o,a;for(a=e.split(" "),s=[],i="",n=0,r=a.length;r>n;n++)o=a[n],i.length+1+o.lengtht;n=++t)i=s[n],0===n?i.space===e.space?o.push(this.drawBasicConnection(i,e)):o.push(this.drawBranchConnection(i,e)):o.push(this.drawMergeConnection(i,e));return o},e.prototype.drawBasicConnection=function(e,t){var n;return n=this.spaceColor(t.space),this.ctx.strokeStyle=n,this.ctx.lineWidth=2,this.ctx.beginPath(),this.ctx.moveTo(e.time*this.nameLineHeight,t.space*this.nameLineHeight),this.ctx.lineTo(t.time*this.nameLineHeight,t.space*this.nameLineHeight),this.ctx.stroke()},e.prototype.drawBranchConnection=function(e,t){var n;return n=this.spaceColor(t.space),this.ctx.strokeStyle=n,this.ctx.lineWidth=2,this.ctx.beginPath(),this.ctx.moveTo(e.time*this.nameLineHeight,e.space*this.nameLineHeight),this.ctx.lineTo(e.time*this.nameLineHeight,t.space*this.nameLineHeight),this.ctx.lineTo(t.time*this.nameLineHeight-10,t.space*this.nameLineHeight),this.ctx.stroke(),this.threeClockArrow(n,t.time*this.nameLineHeight,t.space*this.nameLineHeight)},e.prototype.drawMergeConnection=function(e,t){var n,r,i;return n=this.spaceColor(e.space),this.ctx.strokeStyle=n,this.ctx.lineWidth=2,this.ctx.beginPath(),e.space>t.space?(this.ctx.moveTo(e.time*this.nameLineHeight,e.space*this.nameLineHeight),i=this.safePath(e.time,t.time,e.space),i?(this.ctx.lineTo(t.time*this.nameLineHeight-10,e.space*this.nameLineHeight),this.ctx.lineTo(t.time*this.nameLineHeight-10,t.space*this.nameLineHeight+15),this.ctx.lineTo(t.time*this.nameLineHeight-5.7,t.space*this.nameLineHeight+7.5),this.ctx.stroke(),this.oneClockArrow(n,t.time*this.nameLineHeight,t.space*this.nameLineHeight)):(r=this.closestMargin(e.time,t.time,e.space,-1),e.space===t.space+1&&e.space===r+1?(this.ctx.lineTo(e.time*this.nameLineHeight,r*this.nameLineHeight+10),this.ctx.lineTo(t.time*this.nameLineHeight-15,r*this.nameLineHeight+10),this.ctx.lineTo(t.time*this.nameLineHeight-9.5,r*this.nameLineHeight+7.7),this.ctx.stroke(),this.twoClockArrow(n,t.time*this.nameLineHeight,r*this.nameLineHeight),this.addMargin(e.time,t.time,r)):e.time+1===t.time?(r=this.closestMargin(e.time,t.time,t.space,0),this.ctx.lineTo(e.time*this.nameLineHeight,r*this.nameLineHeight+10),this.ctx.lineTo(t.time*this.nameLineHeight-15,r*this.nameLineHeight+10),this.ctx.lineTo(t.time*this.nameLineHeight-15,t.space*this.nameLineHeight+10),this.ctx.lineTo(t.time*this.nameLineHeight-9.5,t.space*this.nameLineHeight+7.7),this.ctx.stroke(),this.twoClockArrow(n,t.time*this.nameLineHeight,t.space*this.nameLineHeight),this.addMargin(e.time,t.time,r)):(this.ctx.lineTo(e.time*this.nameLineHeight+10,e.space*this.nameLineHeight-10),this.ctx.lineTo(e.time*this.nameLineHeight+10,r*this.nameLineHeight+10),this.ctx.lineTo(t.time*this.nameLineHeight-10,r*this.nameLineHeight+10),this.ctx.lineTo(t.time*this.nameLineHeight-10,t.space*this.nameLineHeight+15),this.ctx.lineTo(t.time*this.nameLineHeight-5.7,t.space*this.nameLineHeight+7.5),this.ctx.stroke(),this.oneClockArrow(n,t.time*this.nameLineHeight,t.space*this.nameLineHeight),this.addMargin(e.time,t.time,r)))):(r=this.closestMargin(e.time,t.time,t.space,-1),rr;r++)if(s=o[r],this.timeInPath(e,s))return s[1]===t;return!1},e.prototype.closestMargin=function(e,t,n,r){var i,s,o,a,c;for(a=this.spaceMap.length,o=r,s=!1,i=!1,c=!1;!i||!s;){if(n+o>=0&&this.safeMargin(e,t,n+o))return n+o;0>n+o&&(s=!0),n+o>a&&(i=!0),c===!1&&0===o?(o=-1,c=!0):o=0>o?-o-1:-o-2}return n>0?n-1:0},e.prototype.safeMargin=function(e,t,n){var r,i,s,o;if(!this.marginMap[n])return!0;for(o=this.marginMap[n],r=0,i=o.length;i>r;r++)if(s=o[r],this.pathsCollide([e,t],s))return!1;return!0},e.prototype.pathsCollide=function(e,t){return this.timeWithinPath(e[0],t)||this.timeWithinPath(e[1],t)||this.timeWithinPath(t[0],e)||this.timeWithinPath(t[1],e)},e.prototype.timeInPath=function(e,t){return e>=t[0]&&e<=t[1]},e.prototype.timeWithinPath=function(e,t){return e>t[0]&&ee?e:d3.format(",s")(e)}),a=d3.tip().attr("class","svg-tip").offset([-10,0]).html(function(t){var n;return""+t.commits+" "+e(t.commits,"commit")+" by "+(null!=(n=t.login)?n:t.name)+""}),c=d3.select(this).append("svg").attr("width",u+o.left+o.right).attr("height",s+o.top+o.bottom).append("g").attr("transform","translate("+o.left+", "+o.top+")").call(a),c.append("g").attr("class","y axis").call(h),i=c.selectAll(".bar").data(n).enter().append("g").attr("class","bar").attr("transform",function(e,t){return"translate("+l(t)+", 0)"}),i.append("rect").attr("width",l.rangeBand()).attr("height",function(e,t){return s-d(e.commits)}).attr("y",function(e){return d(e.commits)}).on("mouseover",a.show).on("mouseout",a.hide),i.append("a").attr("xlink:href",function(e){return null!=e.login?"/"+e.login:void 0}).append("image").attr("y",s+5).attr("xlink:href",function(e){return e.gravatar}).attr("width",l.rangeBand()).attr("height",l.rangeBand())})}.call(this),function(){var e;e=require("github/inflector").pluralize,$(document).on("graph:load",".js-graph-punchcard",function(t,n){var r,i,s,o,a,c,u,l,d,h,f,m,p,g,v,b,y,j,w,x,k;return a=500,w=$(this).width(),h={},n.forEach(function(e){var t,n,r;return r=d3.weekdays[e[0]],t=null!=h[r]?h[r]:h[r]=[],n=e[1],null==t[n]&&(t[n]=0),t[n]+=e[2]}),n=d3.entries(h).reverse(),b=[0,0,0,20],g=b[0],m=b[1],p=b[2],f=b[3],u=100,i=d3.range(7),c=d3.range(24),d=d3.min(n,function(e){return d3.min(e.value)}),l=d3.max(n,function(e){return d3.max(e.value)}),x=d3.scale.ordinal().domain(c).rangeRoundBands([0,w-u-m-p],.1),k=d3.scale.ordinal().domain(i).rangeRoundBands([a-g-f,0],.1),v=d3.scale.sqrt().domain([0,l]).range([0,x.rangeBand()/2]),y=d3.tip().attr("class","svg-tip").offset([-10,0]).html(function(t){return""+t+" "+e(t,"commit")}),j=d3.select(this).data(n).attr("width",w+"px").append("svg").attr("width",w+(m+p)).attr("height",a+g+f).attr("class","viz").append("g").attr("transform","translate("+m+","+g+")").call(y),s=j.selectAll("g.day").data(n).enter().append("g").attr("class","day").attr("transform",function(e,t){return"translate(0, "+k(t)+")"}),s.append("line").attr("x1",0).attr("y1",k.rangeBand()).attr("x2",w-m-p).attr("y2",k.rangeBand()).attr("class","axis"),s.append("text").attr("class","day-name").text(function(e,t){return e.key}).attr("dy",k.rangeBand()/2),j.append("g").selectAll("text.hour").data(c).enter().append("text").attr("text-anchor","middle").attr("transform",function(e,t){return"translate("+(x(t)+u)+", "+a+")"}).attr("class","label").text(function(e){var t;return t=e%12||12,0===e||12>e?t+"a":t+"p"}),o=s.selectAll(".hour").data(function(e){return e.value}).enter().append("g").attr("class","hour").attr("transform",function(e,t){return"translate("+(x(t)+u)+", 0)"}).attr("width",x.rangeBand()),o.append("line").attr("x1",0).attr("y1",function(e,t){return k.rangeBand()-(t%2===0?15:10)}).attr("x2",0).attr("y2",k.rangeBand()).attr("class",function(e,t){return t%2===0?"axis even":"axis odd"}),r=o.append("circle").attr("r",0).attr("cy",k.rangeBand()/2-5).attr("class",function(e){return"day"}).on("mouseover",y.show).on("mouseout",y.hide),r.transition().attr("r",v)})}.call(this),function(){var e,t,n,r,i,s;r=function(e){var t;return(t=d3.format(","))(e)},n={top:20,right:40,bottom:30,left:40},s=980-n.left-n.right,t=170-n.top-n.bottom,e=function(e,t){var n;return n=d3.time.format.utc("%A, %B %-d, %Y"),d3.tip().attr("class","svg-tip web-views comparison").offset([-10,0]).html(function(i){return""+n(i.date)+"
    • "+r(i.total)+" "+e+"
    • "+r(i.unique)+" "+t+"
    "})},i=function(e,i,o){var a,c,u,l,d,h,f,m,p,g,v,b,y,j,w,x,k,C,S,L,A,T,q,_,E,D;if(i&&null==i.error){for(T=d3.time.scale.utc().range([0,s]),_=d3.scale.linear().range([t,0]),E=d3.scale.linear().range([t,0]),b=d3.time.format.utc("%m/%d"),q=d3.svg.axis().scale(T).ticks(i.counts.length).tickSize(t+5).tickPadding(10).tickFormat(b).orient("bottom"),D=d3.svg.axis().scale(_).ticks(3).tickFormat(d3.formatSymbol).orient("left"),m=d3.svg.line().x(function(e){return T(e.key)}).y(function(e){return _(e.value)}),S=d3.select(this).select(".js-graph").append("svg").attr("width",s+n.left+n.right).attr("height",t+n.top+n.bottom).attr("class","vis").append("g").attr("transform","translate("+n.left+","+n.top+")").call(o),c=i.counts,c.forEach(function(e){return e.date=new Date(1e3*e.bucket)}),c.sort(function(e,t){return d3.ascending(e.date,t.date)}),a=d3.bisector(function(e){return e.date}).left,y=function(){var e,t,n,r,i,s;return s=T.invert(d3.mouse(this)[0]),i=a(c,s,1),t=c[i-1],n=c[i],t&&n?(e=s-t.date>n.date-s?n:t,r=S.selectAll("g.dots circle").filter(function(t){return t.key===e.date}),r=r[0],r.sort(function(e,t){return $(e).attr("cy")-$(t).attr("cy")}),o.show.call(this,e,r[0])):void 0},w=[],C=[],h=0,f=c.length;f>h;h++)d=c[h],w.push({key:d.date,value:d.total}),C.push({key:d.date,value:d.unique});return v=[w,C],p=d3.extent(c,function(e){return e.date}),j=p[0],l=p[1],g=d3.extent(w,function(e){return e.value}),A=g[0],L=g[1],x=d3.max(C,function(e){return e.value}),k=x+d3.median(C,function(e){return e.value}),T.domain([j,l]),_.domain([0,L]),E.domain([0,k]),$(this).find(".js-traffic-total").text(r(i.summary.total)),$(this).find(".js-traffic-uniques").text(r(i.summary.unique)),S.append("g").attr("class","x axis").call(q),S.append("g").attr("class","y axis views").call(D),S.selectAll("path.path").data(v).enter().append("path").attr("class",function(e,t){return"path "+(0===t?"total":"unique"); +}).attr("d",function(e,t){return 0===t?m(e):m.y(function(e){return E(e.value)})(e)}),u=S.selectAll("g.dots").data(v).enter().append("g").attr("class",function(e,t){return 0===t?"dots totals":"dots uniques"}),u.each(function(e,t){var n;return n=d3.select(this),1===t&&(_=E),n.selectAll("circle").data(function(e,t){return e}).enter().append("circle").attr("cx",function(e){return T(e.key)}).attr("cy",function(e){return _(e.value)}).attr("r",4)}),D.scale(E).orient("right"),S.append("g").attr("class","y axis unique").attr("transform","translate("+s+", 0)").call(D),S.append("rect").attr("class","overlay").attr("width",s).attr("height",t).on("mousemove",y).on("mouseout",function(e){return setTimeout(o.hide,500)})}},$(document).on("graph:load","#js-visitors-graph",function(t,n){var r;return r=e("views","unique visitors"),$.observe("#js-visitors-graph .js-graph",{remove:r.hide}),i.apply(this,[t,n,r])}),$(document).on("graph:load","#js-clones-graph",function(t,n){var r;return r=e("clones","unique cloners"),$.observe("#js-clones-graph .js-graph",{remove:r.hide}),i.apply(this,[t,n,r])})}.call(this),function(){var e;e=function(){var e,t;t=$(this),e=t.find(":selected"),e.attr("data-already-member")?($(".js-account-membership-form").addClass("is-member"),$(".js-account-membership-form").removeClass("is-not-member")):($(".js-account-membership-form").removeClass("is-member"),$(".js-account-membership-form").addClass("is-not-member"))},$.observe(".js-account-membership",e),$(document).on("change",".js-account-membership",e)}.call(this),function(){var e,t,n,r,i,s,o,a,c,u;n=require("github/fetch").fetchPoll,c=null,o=300,a=[".",".","."],s=0,t=function(){return $(".js-audit-log-export-button").removeClass("disabled")},e=function(){return $(".js-audit-log-export-button").addClass("disabled")},i=function(){var t,n;return t=$(".js-audit-log-export-status"),t.data("oldText",t.text()),n=function(){var e;return e=a.slice(0,s).join(""),t.text("Exporting"+e),s>=3?s=0:s+=1},c=setInterval(n,o),e()},u=function(){var e;return t(),e=$(".js-audit-log-export-status"),e.text(e.data("oldText")),clearInterval(c),s=0},r=function(){return u(),$("#ajax-error-message").show(function(){return this.classList.add("visible")})},$(document).on("ajaxSend",".js-audit-log-export",i),$(document).on("ajaxError",".js-audit-log-export",r),$(document).on("ajaxSuccess",".js-audit-log-export",function(e,t,i,s){var o,a;return a=this,o=function(){return u(),window.location=s.export_url},n(s.job_url).then(o,r)}),$(document).on("navigation:open",".audit-search-form .js-suggester",function(e){return $(this).closest("form").submit()})}.call(this),function(){var e,t;$(document).on("submit",".js-find-coupon-form",function(e){var t,n;return t=e.target.action,n=$("#code").val(),window.location=t+"/"+encodeURIComponent(n),e.stopPropagation(),e.preventDefault()}),$(document).on("click",".js-choose-account",function(t){return $(".js-plan-row, .js-choose-plan").removeClass("selected"),$(".js-plan").val(""),$(".js-billing-section").addClass("has-removed-contents"),e($(this).closest(".js-account-row")),t.stopPropagation(),t.preventDefault()}),$(document).on("click",".js-choose-plan",function(e){return t($(this).closest(".js-plan-row")),e.stopPropagation(),e.preventDefault()}),$.observe(".js-plan-row.selected",{add:function(){return $(this).closest("form").find(".js-redeem-button").prop("disabled",$(this).hasClass("free-plan"))}}),e=function(e){var n,r,i,s;if(e.length)return i=e.attr("data-login"),s=e.attr("data-plan"),$(".js-account-row, .js-choose-account").removeClass("selected"),e.addClass("selected"),e.find(".js-choose-account").addClass("selected"),$(".js-account").val(i),$(".js-plan-section").removeClass("is-hidden"),$(".js-billing-plans").addClass("is-hidden"),r=$(".js-plans-for-"+i),r.removeClass("is-hidden"),n=$(".js-plan-row",r),t(1===n.length?n:$("[data-name='"+s+"']",r))},t=function(e){var t,n,r,i,s;if(e.length)return i=e.attr("data-name"),n=parseInt(e.attr("data-cost"),10),s=e.closest(".js-billing-plans"),r="true"===s.attr("data-has-billing"),t=s.attr("data-login"),$(".js-plan-row, .js-choose-plan").removeClass("selected"),e.addClass("selected"),e.find(".js-choose-plan").addClass("selected"),$(".js-plan").val(i),0===n||r?$(".js-billing-section").addClass("has-removed-contents"):$(".js-billing-section[data-login='"+t+"']").removeClass("has-removed-contents")},$(function(){return e($(".js-account-row.selected")),t($(".js-plan-row.selected"))})}.call(this),function(){$(document).on("change",".js-survey-select",function(){var e,t,n,r;return n=$(this)[0],t=$(this).closest(".js-survey-question-form"),e=t.find(".js-survey-other-text"),r=n.options[n.selectedIndex],r.classList.contains("js-survey-option-other")?(t.addClass("is-other-selected"),e.attr("required","required"),e.focus()):(e.removeAttr("required"),t.removeClass("is-other-selected"))}),$(document).on("change",".js-survey-radio",function(){var e,t,n;return e=$(this)[0],n=$(this).closest(".js-survey-question-form"),t=n.find(".js-survey-other-text"),e.classList.contains("js-survey-radio-other")?(n.addClass("is-other-selected"),t.attr("required","required"),t.focus()):(t.removeAttr("required"),n.removeClass("is-other-selected")),$(this).trigger("validation:field:change")})}.call(this),function(){var e,t,n,r,i,s,o,a,c,u;i=function(e){var t,n,r,i,s;if(i=e.match(/\#?(?:L)(\d+)/gi)){for(s=[],t=0,n=i.length;n>t;t++)r=i[t],s.push(parseInt(r.replace(/\D/g,"")));return s}return[]},n=function(e){var t;return(t=e.match(/(file-.+?-)L\d+?/i))?t[1]:""},r=function(e){return{lineRange:i(e),anchorPrefix:n(e)}},e=function(e){var t,n;switch(n=e.lineRange,t=e.anchorPrefix,n.sort(c),n.length){case 1:return"#"+t+"L"+n[0];case 2:return"#"+t+"L"+n[0]+"-L"+n[1];default:return"#"}},c=function(e,t){return e-t},a=!1,t=function(e){var t,n,r,i,s;if(i=e.lineRange,t=e.anchorPrefix,r=$(".js-file-line"),r.length){if(r.css("background-color",""),1===i.length)return $("#"+t+"LC"+i[0]).css("background-color","#f8eec7");if(i.length>1){for(n=i[0],s=[];n<=i[1];)$("#"+t+"LC"+n).css("background-color","#f8eec7"),s.push(n++);return s}}},o=function(e){var n,i,s;return null==e&&(e=r(window.location.hash)),s=e.lineRange,n=e.anchorPrefix,t(e),!a&&(i=$("#"+n+"LC"+s[0])).length&&$(window).scrollTop(i.offset().top-.33*$(window).height()),a=!1},u=function(e,t){var n,r,i;return i="FORM"===e.nodeName?"action":"href",n=e.getAttribute(i),(r=n.indexOf("#"))>=0&&(n=n.substr(0,r)),n+=t,e.setAttribute(i,n)},$.hashChange(function(){var e,t,n,r,i,s;if(document.querySelector(".js-file-line-container")){for(setTimeout(o,0),t=window.location.hash,i=document.querySelectorAll(".js-update-url-with-hash"),s=[],n=0,r=i.length;r>n;n++)e=i[n],s.push(u(e,t));return s}}),s=function(e){var t,n;return a=!0,n=null!=(t=$(window).scrollTop())?t:0,e(),$(window).scrollTop(n)},$(document).on("mousedown",".js-line-number",function(t){var n,o;return n=r(this.id),t.shiftKey&&(o=i(window.location.hash),n.lineRange.unshift(o[0])),s(function(){return window.location.hash=e(n)}),!1}),$(document).on("submit",".js-jump-to-line-form",function(){var e,t;return e=this.querySelector(".js-jump-to-line-field"),(t=e.value.replace(/[^\d\-]/g,""))&&(window.location.hash="L"+t),$(document).trigger("close.facebox"),!1})}.call(this),function(){var e,t,n,r,i,s,o,a,c,u,l,d,h,f,m,p,g,v,b,y;i=require("github/fetch").fetchText,c=function(e){var t,n,r;return n=e[0],t=n.querySelector(".js-blob-filename"),t?"."===(r=t.value)||".."===r||".git"===r?!1:/\S/.test(t.value):!0},e=function(e){var t;return t=e.querySelector(".js-blob-contents"),t?"true"===t.getAttribute("data-allow-unchanged")?!0:s(t):!0},d=function(e){var t;return t=e.querySelector(".js-new-filename-field"),s(t)},t=function(t){var n;return t=$(".js-blob-form"),n=t[0],t.find(".js-check-for-fork").is($.visible)?!1:c(t)?e(n)||d(n):!1},g=function(e){var t;return t=e.find(".js-blob-contents")[0],t?$(t).attr("data-allow-unchanged")?!0:s(t):!1},u=function(e){var t,n;return n=e[0],t=n.querySelector(".js-blob-contents"),s(t)||d(n)},n=null,r=function(e){var t;return t=$(e).attr("data-github-confirm-unload"),("yes"===t||"true"===t)&&(t=""),null==t&&(t="false"),"no"===t||"false"===t?null:function(){return t}},h=function(){var e;return e=$(".js-blob-form"),e[0]?(e.find(".js-blob-submit").prop("disabled",!t(e)),e.find(".js-blob-contents-changed").val(g(e)),n?u(e)?window.onbeforeunload=n:window.onbeforeunload=null:void 0):void 0},f=function(e){var t,n,r,i,s;for(i=e.querySelectorAll("input"),s=[],n=0,r=i.length;r>n;n++)t=i[n],"hidden"===t.getAttribute("type")&&t.getAttribute("class")&&(null==t.getAttribute("data-default-value")?s.push(t.setAttribute("data-default-value",t.value)):s.push(void 0));return s},s=function(e){return null==e?!0:"hidden"===e.type?e.value!==e.getAttribute("data-default-value"):e.value!==e.defaultValue},m=function(e){var t,n,r,i;return t=e.querySelector(".js-blob-contents"),r=e.querySelector(".js-new-filename-field"),n=e.querySelector(".js-blob-filename"),t&&r&&n&&(null!=(i=n.defaultValue)?i.length:void 0)?$(t).data("old-filename",r.value):void 0},$.observe(".js-blob-form",function(){f(this),m(this),h(),n=r(this),$(this).on("submit",function(){return window.onbeforeunload=null})}),$(document).on("change",".js-blob-contents",function(){return p($(".js-blob-filename")),h()}),$(document).on("click",".js-new-blob-submit",function(){return $(this).closest("form.js-new-blob-form").submit()}),$(document).onFocusedInput(".js-blob-filename",function(){return function(){return $(".js-blob-contents").attr("data-filename",$(this).val()),l($(this).val()),p($(this))}}),$(document).onFocusedInput(".js-breadcrumb-nav",function(){return function(){return y($(this)),p($(this))}}),$(document).onFocusedKeydown(".js-breadcrumb-nav",function(){return function(e){var t,n,r;return n=$(this).caretSelection(),r=[0,0],t=0===$(n).not(r).length&&0===$(r).not(n).length,t&&8===e.keyCode&&1!==$(this).parent().children(".separator").length&&(a($(this),!0),e.preventDefault()),p($(this))}}),p=function(e){return null!=e[0]&&(b(e),v(e)),h()},y=function(e){var t,n,r,i,s,c;for(r=[];e.val().split("/").length>1;)t=e.val(),i=t.split("/"),n=i[0],c=i.slice(1).join("/"),""===n||"."===n||".git"===n?(e.val(c),s=function(){return e.caret(0)},r.push(window.setTimeout(s,1))):".."===n?r.push(a(e)):r.push(o(e,n,c));return r},l=function(e){var t,n;return t=$(".js-gitignore-template"),n=$(".js-license-template"),/^(.+\/)?\.gitignore$/.test(e)?t.addClass("is-visible"):/^(.+\/)?(licen[sc]e|copying)($|\.)/i.test(e)?n.addClass("is-visible"):(t.removeClass("is-visible"),n.removeClass("is-visible"))},v=function(e){var t,n,r,i,o,a,c,u,l,d,h,f;return r=e.closest("form"),n=$(".js-blob-contents"),t=r.find(".js-new-blob-commit-summary"),c=e.val()?"Create "+e.val():"Create new file",h=n.data("old-filename"),u=$(".js-new-filename-field").val(),n.removeData("new-filename"),c=(null!=h?h.length:void 0)&&u!==h&&null!=e[0]?(n.data("new-filename",!0),o=s(n[0]),i=o?"Update and rename":"Rename",e.val().length&&u.length?(f=h.split("/"),l=u.split("/"),d=!0,a=f.length-1,f.forEach(function(e,t){return t!==a&&e!==l[t]?d=!1:void 0}),f.length===l.length&&d?i+" "+f[a]+" to "+l[a]:i+" "+h+" to "+u):i+" "+h):(null!=h?h.length:void 0)&&u===h?"Update "+e.val():c,t.attr("placeholder",c),$(".js-commit-message-fallback").val(c)},b=function(e){var t,n;return t=$(".breadcrumb").children("[itemscope]"),n="",t.each(function(){var e;return e=$(this),n=n+e.text()+"/"}),n+=e.val(),$(".js-new-filename-field").val(n)},a=function(e,t){var n,r;return null==t&&(t=!1),t||e.val(e.val().replace("../","")),r=function(){return e.caret(0)},1!==e.parent().children(".separator").length&&(e.prev().remove(),n=e.prev().children().children().html(),e.prev().remove(),t&&(e.val(""+n+e.val()),r=function(){return t?e.caret(n.length):void 0})),l(e.val()),window.setTimeout(r,1)},o=function(e,t,n){var r,i,s,o,a,c,u;return null==n&&(n=""),t=t.replace(/[^-.a-z_0-9]+/gi,"-"),t=t.replace(/^-+|-+$/g,""),t.length>0&&(u=e.parent().children(".js-repo-root, [itemtype]").children("a").last().attr("href"),u||(r=e.parent().children(".js-repo-root, [itemtype]").children("span").children("a").last(),i=r.attr("data-branch"),a=r.attr("href"),u=a+"/tree/"+i),s=$(".js-crumb-template").clone().removeClass("js-crumb-template"),s.find("a[itemscope]").attr("href",u+"/"+t),s.find("span").text(t),o=$(".js-crumb-separator").clone().removeClass("js-crumb-separator"),e.before(s,o)),e.val(n),l(e.val()),c=function(){return e.caret(0)},window.setTimeout(c,1)},$(document).onFocusedInput(".js-new-blob-commit-summary",function(){var e;return e=$(this).closest(".js-file-commit-form"),function(){return e.toggleClass("is-too-long-error",$(this).val().length>50)}}),$.observe(".js-check-for-fork",function(){this.addEventListener("load",function(){return h()})}),$(document).on("change",".js-gitignore-template input[type=radio]",function(){var e;return e=$(this).closest(".js-blob-form").find(".js-code-editor").data("code-editor"),i(this.getAttribute("data-template-url")).then(function(t){return e.setCode(t)})}),$(document).on("change",".js-license-template input[type=radio]",function(){var e,t;return e=$(this).closest(".js-blob-form").find(".js-code-editor").data("code-editor"),t=$(this).attr("data-template-contents"),e.setCode(t)}),$(document).onFocusedKeydown(".js-new-blob-commit-description",function(){return function(e){return"ctrl+enter"===e.hotkey||"meta+enter"===e.hotkey?($(this).closest("form").submit(),!1):void 0}})}.call(this),function(){var e,t;e=function(e){var t,n,r,i,s,o;for(e=e.toLowerCase(),t=$(".js-csv-data tbody tr"),i=[],n=0,r=t.length;r>n;n++)s=t[n],o=$(s).text().toLowerCase(),-1===o.indexOf(e)?i.push($(s).hide()):i.push($(s).show());return i},t=function(t){var n;n=t.target.value,null!=n&&e(n),t.preventDefault()},$(document).on("focus",".js-csv-filter-field",function(){return $(this).on("keyup",t)}),$(document).on("blur",".js-csv-filter-field",function(){return $(this).off("keyup",t)})}.call(this),function(){var e;e=null,$.observe(".js-branch-search-field",function(){var t,n,r,i,s,o,a,c,u,l,d,h,f,m;n=$(this),r=n.closest(".js-branch-search"),t=r.closest(".js-branches"),i=t.find(".js-branches-subnav .js-subnav-item"),f=r.prop("action"),h=r.attr("data-reset-url"),m=r.attr("data-results-container"),u=/\S/,a=function(){return u.test(n.val())},l=function(e,t){var n;return $.support.pjax&&window.history.replaceState(null,"",t),n=document.getElementById(m),$(n).html(e)},o=null,s=function(e){return o&&o.readyState<4&&o.abort(),o=$.ajax(e)},c=function(){var n,o;return null===e&&(e=i.filter(".selected")),n=a(),o=n?f+"?"+r.serialize():h,s({url:o,context:r}).always(function(){return t.removeClass("is-loading")}).done(function(e){return l(e,o)}),t.toggleClass("is-search-mode",n),t.addClass("is-loading"),i.removeClass("selected"),n?i.filter(".js-branches-all").addClass("selected"):(e.addClass("selected"),e=null)},d=function(){var e;return e=a(),n.val(""),e?c():void 0},n.on("throttled:input",c),n.on("keyup",function(e){return"esc"===e.hotkey?(d(),this.blur()):void 0})}),$(document).on("submit",".js-branch-search",!1),$(document).on("click",".js-clear-branch-search",function(e){var t;if(1===e.which)return t=$(this).closest(".js-branch-search").find(".js-branch-search-field"),t.focus().val("").trigger("input"),e.preventDefault()}),$(document).on("ajaxSend",".js-branch-destroy, .js-branch-restore",function(e,t){var n,r,i,s,o;return r=$(this),o=r.is(".js-branch-destroy"),s=r.closest(".js-branch-row").attr("data-branch-name"),n=r.closest(".js-branches").find(".js-branch-row").filter(function(){return this.getAttribute("data-branch-name")===s}),i=r.find("button[type=submit]"),i.blur().removeClass("tooltipped"),n.addClass("loading"),t.done(function(){return n.toggleClass("is-deleted",o)}).always(function(){return n.removeClass("loading"),i.addClass("tooltipped")})})}.call(this),function(){var e,t;e=function(){var e,n,r,i,s,o;return s=[],n=$(".js-advanced-search-input").val(),o={Repositories:0,Users:0,Code:0},e=$("input[type=text].js-advanced-search-prefix, select.js-advanced-search-prefix"),s=t(e,function(e,t,n){return""===e?"":(""!==t&&o[n]++,""!==t?""+e+t:void 0)}),$.merge(s,t($("input[type=checkbox].js-advanced-search-prefix"),function(e,t,n){var r;return r=$(this).prop("checked"),r!==!1&&o[n]++,r!==!1?""+e+r:void 0})),r=function(e){return e.Users>e.Code&&e.Users>e.Repositories?"Users":e.Code>e.Users&&e.Code>e.Repositories?"Code":"Repositories"},i=$.trim(s.join(" ")),$(".js-type-value").val(r(o)),$(".js-search-query").val($.trim(n+" "+i)),$(".js-advanced-query").empty(),$(".js-advanced-query").text(""+i),$(".js-advanced-query").prepend($("").text($.trim(n))," ")},t=function(e,t){return $.map(e,function(e,n){var r,i,s,o;return s=$.trim($(e).val()),r=$(e).attr("data-search-prefix"),i=$(e).attr("data-search-type"),o=function(e){return-1!==e.search(/\s/g)?'"'+e+'"':e},""===r?t.call(e,r,s,i):-1!==s.search(/\,/g)&&"location"!==r?s.split(/\,/).map(function(n,s){return t.call(e,r,o($.trim(n)),i)}):t.call(e,r,o(s),i)})},$(document).onFocusedInput(".js-advanced-search-prefix",function(){return function(){return e()}}),$(document).on("change",".js-advanced-search-prefix",e),$(document).on("focusin",".js-advanced-search-input",function(){return $(this).closest(".js-advanced-search-label").addClass("focus")}),$(document).on("focusout",".js-advanced-search-input",function(){return $(this).closest(".js-advanced-search-label").removeClass("focus")}),$(document).on("click",".js-see-all-search-cheatsheet",function(){return $(".js-more-cheatsheet-info").removeClass("hidden"),!1}),$(function(){return $(".js-advanced-search-input").length?e():void 0})}.call(this),function(){$(document).on("navigation:keyopen",".commits-list-item",function(){return $(this).find(".commit-title > a").first().click(),!1}),$(document).on("navigation:keydown",".commits-list-item",function(e){return"c"===e.hotkey?($(this).find(".commit-title > a").first().click(),!1):void 0}),$(document).on("menu:activated",".js-diffbar-commits-menu",function(e){var t;t=e.target.querySelector(".in-range"),$(t).navigation("focus",{behavior:"instant"})})}.call(this),function(){$(document).on("click",".js-compare-tabs a",function(){return $(this).closest(".js-compare-tabs").find("a").removeClass("selected"),$(this).addClass("selected"),$("#commits_bucket, #files_bucket, #commit_comments_bucket").hide(),$(this.hash).show(),!1}),$.hashChange(function(){return $(this).closest("#files_bucket")[0]&&!$(this).is($.visible)?$('a.tabnav-tab[href="#files_bucket"]').click():void 0}),$(document).on("click",".js-toggle-range-editor-cross-repo",function(){return $(".js-range-editor").toggleClass("is-cross-repo"),!1}),$(document).on("pjax:click",".js-range-editor",function(e,t){$(".js-compare-pr").hasClass("open")&&!t.url.match(/expand=1/)&&(null==t.data&&(t.data={}),t.data.expand="1")}),$(document).on("navigation:open","form.js-commitish-form",function(){var e,t,n;return t=$(this),n=t.find(".js-new-item-name").text(),e=$("",{type:"hidden",name:"new_compare_ref",value:n}),t.append(e),t.submit()}),$.observe(".js-compare-pr.open",{add:function(){return document.body.classList.add("is-pr-composer-expanded")},remove:function(){return document.body.classList.remove("is-pr-composer-expanded")}})}.call(this),define("github/event-once",["exports"],function(e){function t(){return!0}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=function(e,n){var r=arguments.length<=2||void 0===arguments[2]?t:arguments[2];return new Promise(function(t){$(e).on(n,function i(s){r(s)&&(t(s),$(e).off(n,i))})})}}),function(){function e(e,t,n){var r=Array.from(e.querySelectorAll(".js-navigation-item")),i=r.indexOf(t),s=r.indexOf(n);if(-1==i)throw new Error("Couldn't find startIndex in container");if(-1==s)throw new Error("Couldn't find endItem in container");if(i>s){var o=[s,i];i=o[0],s=o[1]}$(r).removeClass("is-range-selected").addClass("js-navigation-open"),$(r.slice(i,s+1)).addClass("is-range-selected").removeClass("js-navigation-open")}function t(t){var r,i,s,o;return regeneratorRuntime.async(function(a){for(;;)switch(a.prev=a.next){case 0:s=function(n){e(t,i,n.target)},r=n(t,"menu:deactivate"),i=null;case 3:return a.next=5,regeneratorRuntime.awrap(Promise.race([n(window,"keydown",function(e){return e.shiftKey===!0}),r]));case 5:if(o=a.sent,"menu:deactivate"!==o.type){a.next=8;break}return a.abrupt("break",15);case 8:return i=t.querySelector(".navigation-focus"),i&&(e(t,i,i),$(t).on("navigation:focus",s)),a.next=12,regeneratorRuntime.awrap(n(window,"keyup",function(e){return e.shiftKey===!1}));case 12:$(t).off("navigation:focus",s);case 13:a.next=3;break;case 15:$(t).find(".js-navigation-item").removeClass("is-range-selected");case 16:case"end":return a.stop()}},null,this)}var n=require("github/event-once")["default"];$(document).on("menu:activate",".js-diffbar-commits-menu",function(){t(this)}),$(document).on("navigation:open",".js-diffbar-commits-menu .js-navigation-item.is-range-selected",function(e){e.preventDefault(),e.stopPropagation();var t=e.target.closest(".js-diffbar-commits-menu"),n=t.querySelectorAll(".js-navigation-item.is-range-selected"),r=n[0],i=n[n.length-1],s=t.getAttribute("data-range-url"),o=r.getAttribute("data-parent-commit"),a=i.getAttribute("data-commit"),c=void 0;o&&a?c=s.replace("$range",o+".."+a):a&&(c=s.replace("$range",""+a)),window.location.href=c})}(),function(){var e,t,n,r,i,s;t=require("github/fetch").fetchText,$.hashChange(i=function(){var t,i,o,a,c,u,l,d,h;return a=window.location.hash,a&&(u=s(a))&&(t=u[0],i=u[1],h=u[2],c=u[3],!r(a.slice(1)))?(d=0,l=1,(o=function(){var t,s;if((s=$(r(i)).next()[0])&&(t=n(s,h,c)))return $(t).parents(".js-details-container").addClass("open"),e(t).then(function(){var e,t,n,i;if(t=r(a.slice(1))){if(n=$(t).overflowOffset(),i=n.top,e=n.bottom,0>i||0>e)return t.scrollIntoView()}else if(l>d)return d++,o()})})()):void 0}),$(document).on("click",".js-expand",function(){return e(this),!1}),e=function(e){var n;return n=e.getAttribute("data-url"),n+="&anchor="+encodeURIComponent(e.hash.slice(1)),n=n.replace(/[?&]/,"?"),new Promise(function(r,i){return t(n).then(function(t){var n,i;return n=$(e).closest(".js-expandable-line"),i=n.next(".file-diff-line"),i.preservingScrollPosition(function(){return n.replaceWith(t)}),r()},i)})},r=function(e){return document.getElementById(e)||document.getElementsByName(e)[0]},s=function(e){var t,n;return t=e.match(/\#(diff\-[a-f0-9]+)([L|R])(\d+)$/i),null!=t&&4===t.length?t:(n=e.match(/\#(discussion\-diff\-[0-9]+)([L|R])(\d+)$/i),null!=n&&4===n.length?n:null)},n=function(e,t,n){var r,i,s,o,a,c,u,l;for(n=parseInt(n,10),c=$(e).find(".js-expand"),o=0,a=c.length;a>o;o++)if(i=c[o],r="R"===t?"data-right-range":"data-left-range",u=i.getAttribute(r).split("-"),l=u[0],s=u[1],parseInt(l,10)<=n&&n<=parseInt(s,10))return i;return null}}.call(this),function(){var e,t,n,r,i,s,o,a,c;$(document).on("click",".js-add-single-line-comment",function(){var e,t,n,i,s,c;r($(this).closest(".file")[0]),s=this.getAttribute("data-path"),e=this.getAttribute("data-anchor"),c=this.getAttribute("data-position"),t=this.getAttribute("data-line"),i=a($(this).closest("tr")[0],{path:s,anchor:e,position:c,line:t}),n=$(i).find(".js-line-comments")[0],n.classList.contains("is-resolved")?n.classList.toggle("is-collapsed"):o(n)}),$(document).on("click",".js-add-split-line-comment",function(){var e,t,n,s,a,u,l,d;r($(this).closest(".file")[0]),d=this.getAttribute("data-type"),u=this.getAttribute("data-path"),e=this.getAttribute("data-anchor"),l=this.getAttribute("data-position"),n=this.getAttribute("data-line"),t=function(){switch(d){case"addition":return"js-addition";case"deletion":return"js-deletion"}}(),a=c($(this).closest("tr")[0]),s=i(a,t,{type:d,anchor:e,path:u,position:l,line:n}),s.classList.contains("is-resolved")?s.classList.toggle("is-collapsed"):o(s)}),$(document).on("click",".js-toggle-inline-comment-form",function(){return o($(this).closest(".js-line-comments")[0]),!1}),$(document).on("quote:selection",".js-line-comments",function(){o(this)}),$(document).onFocusedKeydown(".js-inline-comment-form .js-comment-field",function(){return function(t){return $(this).hasClass("js-navigation-enable")?void 0:"esc"===t.hotkey&&0===this.value.length?(e($(this).closest(".js-inline-comment-form")[0]),!1):void 0}}),$(document).on("click",".js-hide-inline-comment-form",function(){return e($(this).closest(".js-inline-comment-form")[0]),!1}),$(document).on("ajaxSuccess",".js-inline-comment-form",function(t,n,r,i){var s;this===t.target&&(s=$(this).closest(".js-line-comments"),s.find(".js-comments-holder").append(i.inline_comment),e(this))}),$(document).on("session:resume",function(e){var t;(t=e.targetId.match(/^new_inline_comment_diff_([\w-]+)_(\d+)$/))&&$(".js-add-line-comment[data-anchor="+t[1]+"][data-position="+t[2]+"]").click()}),o=function(e){return $(e).find(".js-inline-comment-form-container").addClass("open"),$(e).find(".js-write-tab").click(),$(e).find(".js-comment-field").focus()},e=function(e){return e.reset(),$(e).closest(".js-inline-comment-form-container").removeClass("open"),t()},r=function(e){return $(e).find(".js-toggle-file-notes").prop("checked",!0).trigger("change")},t=function(){var e,t,n,r,i,s,o;for(o=$(".file .js-inline-comments-container"),i=0,s=o.length;s>i;i++)t=o[i],e=$(t).find(".js-comments-holder > *"),r=e.length>0,n=$(t).find(".js-inline-comment-form-container").hasClass("open"),r||n||$(t).remove()},n=function(e){var t,n;return n=document.querySelector(e),t=n.firstElementChild.cloneNode(!0),t.querySelector("textarea").value="",t},$.observe(".js-comment",{remove:t}),a=function(e,t){var r,i;return null==t&&(t={}),(i=$(e).next(".js-inline-comments-container")[0])?i:(i=n("#js-inline-comments-single-container-template"),(r=i.querySelector(".js-inline-comment-form"))&&s(r,t),e.after(i),i)},i=function(e,t,r){var i,o,a;return null==r&&(r={}),(a=$(e).find(".js-line-comments."+t)[0])?a:(a=n("#js-inline-comments-split-form-container-template"),a.classList.add(t),(o=a.querySelector(".js-inline-comment-form"))&&s(o,r),i=$(e).find("."+t),i.last().after(a),i.remove(),a)},c=function(e){var t;return(t=$(e).next(".js-inline-comments-container")[0])?t:(t=$("#js-inline-comments-split-container-template").clone().children()[0],$(e).after(t),t)},s=function(e,t){var n,r,i,s,o;for(s=e.elements,r=0,i=s.length;i>r;r++)n=s[r],n.name in t&&(n.value=t[n.name]);o=e.querySelector(".js-comment-field"),o.id=o.id.replace(/^r\d+ /,"").replace("${anchor}",t.anchor).replace("${position}",t.position)}}.call(this),function(){var e,t;e=function(e,t,n){return $.observe(e,function(e){var r,i,s,o,a,c;return c=null,i=s=function(){c&&n(c,!1),c=null},o=function(e){c&&n(c,!1),c=$(e.target).closest(t)[0],c&&n(c,!0)},r=function(){return e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",s),e.addEventListener("mouseover",o)},a=function(){return e.removeEventListener("mouseenter",i),e.removeEventListener("mouseleave",s),e.removeEventListener("mouseover",o)},{add:r,remove:a}})},t=function(e){return Math.floor(e/2)},e(".diff-table","td.blob-code, td.blob-num",function(e,n){var r,i,s,o,a,c,u,l,d,h;if(h=e.parentNode,r=h.children,4===r.length)for(o=a=0,u=r.length;u>a;o=++a)s=r[o],s===e&&(i=t(o));for(d=[],o=c=0,l=r.length;l>c;o=++c)s=r[o],(null==i||t(o)===i)&&d.push(s.classList.toggle("is-hovered",n));return d})}.call(this),function(){var e,t,n;$(document).on("click",".js-linkable-line-number",function(){return window.location.hash=this.id,!1}),e=null,n=function(e){return Math.floor(e/2)},t=function(){var t,r,i,s,o,a,c,u,l,d,h;if(e){for(a=0,u=e.length;u>a;a++)i=e[a],i.classList.remove("selected-line");e=null}if(o=window.location.hash.substring(1),o&&(h=document.getElementById(o)),h&&h.classList.contains("js-linkable-line-number")){if(d=h.parentNode,t=d.children,4===t.length)for(s=c=0,l=t.length;l>c;s=++c)i=t[s],i===h&&(r=n(s));e=function(){var e,o,a;for(a=[],s=e=0,o=t.length;o>e;s=++e)i=t[s],(null==r||n(s)===r)&&(i.classList.toggle("selected-line"),a.push(i));return a}()}},$.hashChange(t),$.observe(".blob-expanded",t)}.call(this),function(){$(document).on("click",".js-rich-diff.collapsed .js-expandable",function(e){return e.preventDefault(),$(e.target).closest(".js-rich-diff").removeClass("collapsed")}),$(document).on("click",".js-show-rich-diff",function(e){return e.preventDefault(),$(this).closest(".js-warn-no-visible-changes").addClass("hidden").hide().siblings(".js-no-rich-changes").removeClass("hidden").show()})}.call(this),function(){var e;e=function(){var e;return e="split"===$("meta[name=diff-view]").prop("content")&&$(".file-diff-split").is(":visible"),document.body.classList.toggle("split-diff",e)},$.observe("meta[name=diff-view]",{add:e,remove:e}),$.observe(".file-diff-split",{add:e,remove:e}),$.observe(".js-pull-request-tab.selected",{add:e,remove:e}),$.observe(".js-compare-tabs .tabnav-tab.selected",{add:e,remove:e})}.call(this),function(){$(document).on("change",".js-toggle-file-notes",function(){return $(this).closest(".file").toggleClass("show-inline-notes",this.checked)}),$(document).on("click",".js-toggle-all-file-notes",function(){var e,t;return e=$(".js-toggle-file-notes"),t=0===e.filter(":checked").length,e.prop("checked",t).trigger("change"),!1}),$.observe(".js-inline-comments-container",function(){var e,t,n;return(t=$(this).closest(".file")[0])?(e=n=function(){var e;e=null!=t.querySelector(".js-inline-comments-container"),t.classList.toggle("has-inline-notes",e)},{add:e,remove:n}):void 0})}.call(this),function(){var e;e=function(e){var t,n,r;return r=e.parentElement,n=r.querySelectorAll("td.js-line-comments").length,t=r.querySelectorAll("td.js-line-comments.is-collapsed").length,r.classList.toggle("is-collapsed",t>0&&n===t)},$.observe("td.js-line-comments.is-collapsed",{add:function(t){return e(t)},remove:function(t){return e(t)}})}.call(this),function(){$(document).on("focusin",".js-url-field",function(){var e;return e=this,setTimeout(function(){return $(e).select()},0)})}.call(this),function(){document.querySelector(".js-account-membership-form")&&($(document).one("change.early-access-tracking",".js-account-membership-form",function(){return window.ga("send","event","Large File Storage","attempt","location: early access form")}),$(document).on("submit.early-access-tracking",".js-account-membership-form",function(e){return window.ga("send","event","Large File Storage","submit","location: early access form")}))}.call(this),function(){var e,t;t=require("github/fetch").fetchText,e=function(){return $(".js-repo-toggle-team:checked").visible()},$(document).onFocusedInput(".js-repository-name",function(){var e,t,n;return n=/[^0-9A-Za-z_\-.]/g,t=$(".js-form-note"),e=$(".js-rename-repository-button"),function(){t.html("Will be renamed as "+this.value.replace(n,"-")+""),n.test(this.value)?t.show():t.hide(),this.value&&this.value!==$(this).attr("data-original-name")?e.prop("disabled",!1):e.prop("disabled",!0)}}),$(document).on("click",".js-repo-team-suggestions-view-all",function(){return t(this.href).then(function(t){return function(n){var r,i;return i=e().map(function(){return this.value}),r=$(t).closest("ul"),r.html(n),i.each(function(){return r.find(".js-repo-toggle-team[value="+this+"]").prop("checked",!0)})}}(this)),!1})}.call(this),function(){var e,t,n,r,i,s;s=function(e,t){var n;return n=t.querySelector(".js-repo-access-error"),n.textContent=e,n.classList.remove("hidden")},r=function(){var e,t,n,r,i;for(r=document.querySelectorAll(".js-repo-access-error"),i=[],t=0,n=r.length;n>t;t++)e=r[t],e.textContent="",i.push(e.classList.add("hidden"));return i},e=function(e){return e.classList.toggle("is-empty",!e.querySelector(".js-repo-access-entry"))},i=function(){var e;(e=document.getElementById("collaborators"))&&(e.querySelector(".js-add-new-collab").disabled=!0,$(e.querySelector(".js-add-repo-access-field")).data("autocompleted"))},$.observe(".js-add-new-collab",i),t=function(e){var t,n,r,i,s,o,a;if(o=document.querySelector(".js-repo-access-team-select")){ +for(a=0,s=o.querySelectorAll(".js-repo-access-team-select-option"),t=0,i=s.length;i>t;t++)n=s[t],r=n.classList,e===n.getAttribute("data-team-id")&&(r.add("has-access"),r.remove("selected")),r.contains("has-access")||a++;if(0===a)return o.closest(".js-repo-access-group").classList.add("no-form")}},n=function(e){var t,n;return(n=document.querySelector(".js-repo-access-team-select"))?(null!=(t=n.querySelector("[data-team-id='"+e+"']"))&&t.classList.remove("has-access"),n.closest(".js-repo-access-group").classList.remove("no-form")):void 0},$(document).on("autocomplete:autocompleted:changed",".js-add-repo-access-field",function(){return $(this).data("autocompleted")?this.form.querySelector(".js-add-new-collab").disabled=!1:i()}),$(document).on("selectmenu:selected",".js-repo-access-team-select",function(){var e,t;return e=this.querySelector(".js-repo-access-team-select-option.selected").getAttribute("data-team-id"),t=this.closest(".js-repo-access-group").querySelector(".js-add-repo-access-field"),t.value=e,$(t.form).submit()}),$(document).on("ajaxSend",".js-add-repo-access-form",function(){r()}),$(document).on("ajaxSuccess",".js-add-repo-access-form",function(n,r,o,a){var c,u,l,d;return u=this.closest(".js-repo-access-group"),c=this.querySelector(".js-add-repo-access-field"),l=u.querySelector(".js-repo-access-list"),d=c.value,c.value="",a.error?s(a.error,u):(i(),l.insertAdjacentHTML("beforeend",a.html),e(u),"teams"===u.id?t(d):void 0)}),$(document).on("ajaxSuccess",".js-remove-repo-access-form",function(){var t,i;return r(),t=this.closest(".js-repo-access-entry"),i=this.closest(".js-repo-access-group"),"teams"===i.id&&n(t.getAttribute("data-team-id")),t.remove(),e(i)}),$(document).on("ajaxError",".js-remove-repo-access-form",function(){return s(this.getAttribute("data-error-message"),this.closest(".js-repo-access-group")),!1})}.call(this),function(){var e,t;e=require("github/fetch").fetchText,$(document).on("change",".js-default-branch",function(){var e,t;return t=document.querySelector(".js-default-branch-confirmation"),e=document.querySelector(".js-change-default-branch-button"),e.disabled=this.value===t.getAttribute("data-original-value"),t.value=this.value}),$(document).on("change",".js-repo-features-form input[type=checkbox]",function(){var e;return e=this.closest(".js-repo-option").querySelector(".js-status-indicator"),e.classList.remove("status-indicator-success","status-indicator-failed"),e.classList.add("status-indicator-loading")}),$(document).on("ajaxSuccess",".js-repo-features-form",function(e,t,n,r){var i,s,o,a;for(a=this.querySelectorAll(".status-indicator-loading"),s=0,o=a.length;o>s;s++)i=a[s],i.classList.remove("status-indicator-loading"),i.classList.add("status-indicator-success");return/^\s*n;n++)t=i[n],t.classList.remove("status-indicator-loading"),t.classList.add("status-indicator-failed"),e=t.closest(".js-repo-option").querySelector("input[type=checkbox]"),s.push(e.checked=!e.checked);return s}),$(document).on("change",".js-protect-branch",function(){var e,t,n,r,i,s,o,a,c,u;for(a=this.closest(".js-protected-branch-settings"),e=this.checked,c=a.querySelectorAll(".js-protected-branch-options"),n=0,s=c.length;s>n;n++)t=c[n],t.classList.toggle("active",e);for(u=a.querySelectorAll(".js-protected-branch-option"),i=0,o=u.length;o>i;i++)r=u[i],e?r.removeAttribute("disabled"):r.setAttribute("disabled","disabled")}),$(document).on("change",".js-required-status-toggle",function(){var e;e=this.closest(".js-protected-branch-settings").querySelector(".js-required-statuses"),e.classList.toggle("hidden",!this.checked)}),$(document).on("change",".js-required-status-checkbox",function(){var e;e=this.closest(".js-protected-branches-item"),e.querySelector(".js-required-status-badge").classList.toggle("hidden",!this.checked)}),$(document).on("change",".js-allowed-branch-pushers-toggle",function(){var e;e=this.closest(".js-protected-branch-settings").querySelector(".js-allowed-pushers"),e.classList.toggle("hidden",!this.checked),e.querySelector(".js-autocomplete-field").focus()}),$(document).on("change",".js-protected-branch-include-admin-toggle",function(){var e,t,n,r;for(r=this.closest(".js-protected-branch-settings").querySelectorAll(".js-protected-branch-admin-permission"),t=0,n=r.length;n>t;t++)e=r[t],e.classList.toggle("hidden"),e.classList.toggle("active",!e.classList.contains("hidden"))}),t=function(e){var t,n,r;return t=e.querySelector(".js-allowed-pushers"),r=parseInt(t.getAttribute("data-limit")),n=t.querySelectorAll(".js-allowed-user-or-team").length,t.classList.toggle("at-limit",n>=r)},$(document).on("autocomplete:result",".js-add-protected-branch-user-or-team",function(n,r){var i,s,o;s=this.closest(".js-protected-branch-options"),i=this.closest(".js-autocomplete-container"),o=i.getAttribute("data-url")+"&"+$.param({item:r}),e(o,{method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).then(function(e){return i.querySelector(".js-autocomplete-field").value="",s.querySelector(".js-allowed-users-and-teams").insertAdjacentHTML("beforeend",e),t(s)})}),$(document).on("click",".js-remove-allowed-user-or-team",function(){var e;return e=this.closest(".js-protected-branch-options"),this.closest(".js-allowed-user-or-team").remove(),t(e)})}.call(this),function(){var e,t,n,r,i,s,o,a,c;a=["is-render-pending","is-render-ready","is-render-loading","is-render-loaded"].reduce(function(e,t){return e+" "+t}),o=function(e){var t;return t=e.data("timing"),null!=t?(t.load=t.hello=null,t.helloTimer&&(clearTimeout(t.helloTimer),t.helloTimer=null),t.loadTimer?(clearTimeout(t.loadTimer),t.loadTimer=null):void 0):void 0},r=function(e){var t,n,r;if(!e.data("timing"))return t=10,n=45,r={load:null,hello:null,helloTimer:null,loadTimer:null},r.load=Date.now(),r.helloTimer=setTimeout(c(e,function(){return!r.hello}),1e3*t),r.loadTimer=setTimeout(c(e),1e3*n),e.data("timing",r)},s=function(e){return e.addClass("is-render-requested")},i=function(e){return e.removeClass(a),e.addClass("is-render-failed"),o(e)},c=function(e,t){return null==t&&(t=function(){return!0}),function(){var n,r;return n=function(){try{return e.is($.visible)}catch(t){return e.visible().length>0}}(),!n||e.hasClass("is-render-ready")||e.hasClass("is-render-failed")||e.hasClass("is-render-failed-fatally")||!t()?void 0:(r=e.data("timing"))?(console.error("Render timeout: "+JSON.stringify(r)+" Now: "+Date.now()),i(e)):console.error("No timing data on $:",e)}},e=function(e){var t,n;t=$(e||this),(null!=(n=t.data("timing"))?n.load:0)||(o(t),r(t),t.addClass("is-render-automatic"),s(t))},null!=$.observe?$.observe(".js-render-target",e):$(function(){return $.each($(".js-render-target"),function(t,n){return e(n)})}),t=function(e){var t;return t=".js-render-target",e?$(t+"[data-identity='"+e+"']"):$(t)},$(window).on("message",function(e){var r,i,s,o,a,c,u,l,d,h;return l=null!=(u=e.originalEvent)?u:e,s=l.data,a=l.origin,s&&a&&(d=function(){var t;try{return JSON.parse(s)}catch(t){return e=t,s}}(),h=d.type,o=d.identity,i=d.body,c=d.payload,h&&i&&1===(r=t(o)).length&&a===r.attr("data-host")&&"render"===h)?n(r,h,o,i,c):void 0}),n=function(e,t,n,r,s){var o,c,u,l,d,h;switch(r){case"hello":if(d=e.data("timing")||{untimed:!0},d.hello=Date.now(),o={type:"render:cmd",body:{cmd:"ack",ack:!0}},u={type:"render:cmd",body:{cmd:"branding",branding:!1}},h=null!=(l=e.find("iframe").get(0))?l.contentWindow:void 0,"function"==typeof h.postMessage&&h.postMessage(JSON.stringify(o),"*"),"function"==typeof h.postMessage&&h.postMessage(JSON.stringify(u),"*"),e.hasClass("is-local"))return c=e.parents(".js-code-editor").data("code-editor"),u={type:"render:data",body:c.code()},"function"==typeof h.postMessage?h.postMessage(JSON.stringify(u),"*"):void 0;break;case"error":return i(e);case"error:fatal":return i(e),e.addClass("is-render-failed-fatal");case"error:invalid":return i(e,"invalid"),e.addClass("is-render-failed-invalid");case"loading":return e.removeClass(a),e.addClass("is-render-loading");case"loaded":return e.removeClass(a),e.addClass("is-render-loaded");case"ready":if(e.removeClass(a),e.addClass("is-render-ready"),null!=(null!=s?s.height:void 0))return e.height(s.height);break;case"resize":return null!=(null!=s?s.height:void 0)&&e.hasClass("is-render-ready")?e.height(s.height):console.error("Resize event sent without height or before ready");default:return console.error("Unknown message ["+t+"]=>'"+r+"'")}}}.call(this),function(){$(function(){var e,t;return e=$(".js-newsletter-frequency-choice"),e.length?(t=function(){var t;return e.find(".selected").removeClass("selected"),t=e.find("input[type=radio]:enabled:checked"),t.closest(".choice").addClass("selected")},e.on("change","input[type=radio]",function(){return t()}),t()):void 0}),$(document).on("ajaxSuccess",".js-subscription-toggle",function(e,t,n){var r;return r=$(this).find(".selected .notice"),r.addClass("visible"),setTimeout(function(){return r.removeClass("visible")},2e3)}),$(document).on("ajaxSuccess",".js-explore-newsletter-subscription-container",function(e,t,n){return $(this).replaceWith(t.responseText)})}.call(this),function(){$(document).on("selectmenu:selected",".js-set-user-protocol-preference",function(){return $(this).submit()})}.call(this),function(){$(document).on("click",".js-git-protocol-selector",function(){var e,t,n,r,i,s,o;if(e=this.closest(".url-box"),o=this.getAttribute("data-url"),e.querySelector(".js-url-field").value=o,!/\.patch$/.test(o))for(i=document.querySelectorAll(".js-live-clone-url"),n=0,r=i.length;r>n;n++)t=i[n],t.textContent=o;null!=(s=e.querySelector(".js-clone-url-button.selected"))&&s.classList.remove("selected"),this.closest(".js-clone-url-button").classList.add("selected")})}.call(this),function(){$(document).on("navigation:open",".js-create-branch",function(){return $(this).submit(),!1})}.call(this),function(){$(document).on("click",".js-toggle-lang-stats",function(e){var t,n;return n=document.querySelector(".js-stats-switcher-viewport"),t=0!==n.scrollTop?"is-revealing-overview":"is-revealing-lang-stats",n.classList.toggle(t),e.preventDefault()}),$(document).on("click",".js-toggle-lang-stats-new",function(e){var t;return t=document.querySelector(".js-file-navigation-new"),t.classList.toggle("is-revealing-stats"),e.preventDefault()})}.call(this),function(){var e,t,n=function(e,t){return function(){return e.apply(t,arguments)}};e=function(){function e(e){var t;t=$(e),this.name=t.attr("data-theme-name"),this.slug=t.attr("data-theme-slug"),this.baseHref=t.attr("href")}return e.prototype.wrappedKey=function(e,t){return null==t&&(t=null),t?t+"["+e+"]":e},e.prototype.params=function(e){var t;return null==e&&(e=null),t={},t[this.wrappedKey("theme_slug",e)]=this.slug,t},e.prototype.previewSrc=function(){return[this.baseHref,$.param(this.params())].join("&")},e}(),t=function(){function t(){this.updateScrollLinks=n(this.updateScrollLinks,this),this.scrollThemeLinksContainer=n(this.scrollThemeLinksContainer,this),this.onPublishClick=n(this.onPublishClick,this),this.onHideClick=n(this.onHideClick,this),this.onThemeLinkClick=n(this.onThemeLinkClick,this),this.onThemeNavNextClick=n(this.onThemeNavNextClick,this),this.onThemeNavPrevClick=n(this.onThemeNavPrevClick,this),this.onScrollForwardsClick=n(this.onScrollForwardsClick,this),this.onScrollBackwardsClick=n(this.onScrollBackwardsClick,this),this.onPagePreviewLoad=n(this.onPagePreviewLoad,this),this.pagePreview=$("#page-preview"),this.contextLoader=$(".theme-picker-spinner"),this.fullPicker=$(".theme-picker-thumbs"),this.miniPicker=$(".theme-picker-controls"),this.scrollBackwardsLinks=$(".theme-toggle-full-left"),this.scrollForwardsLinks=$(".theme-toggle-full-right"),this.prevLinks=$(".theme-picker-prev"),this.nextLinks=$(".theme-picker-next"),this.themeLinksContainer=this.fullPicker.find(".js-theme-selector"),this.themeLinks=this.themeLinksContainer.find(".theme-selector-thumbnail"),this.themes=[],this.themeLinks.each(function(t){return function(n,r){return t.themes.push(new e(r))}}(this)),this.selectedTheme=this.themes[0],this.pagePreview.load(this.onPagePreviewLoad),this.scrollBackwardsLinks.click(this.onScrollBackwardsClick),this.scrollForwardsLinks.click(this.onScrollForwardsClick),this.prevLinks.click(this.onThemeNavPrevClick),this.nextLinks.click(this.onThemeNavNextClick),this.themeLinks.click(this.onThemeLinkClick),$(".theme-picker-view-toggle").click(this.onHideClick),$("#page-edit").click(this.onEditClick),$("#page-publish").click(this.onPublishClick),this.theme(this.selectedTheme),this.updateScrollLinks()}return t.prototype.onPagePreviewLoad=function(e){var t,n;return this.contextLoader.removeClass("visible"),t=this.pagePreview[0].contentDocument?this.pagePreview[0].contentDocument:this.pagePreview[0].contentWindow.document,n=this.getDocHeight(t)+"px",this.pagePreview.css("visibility","hidden"),this.pagePreview.height("10px"),this.pagePreview.height(n),this.pagePreview.css("visibility","visible")},t.prototype.onScrollBackwardsClick=function(e){return this.scrollThemeLinksContainer(-1)},t.prototype.onScrollForwardsClick=function(e){return this.scrollThemeLinksContainer(1)},t.prototype.onThemeNavPrevClick=function(e){return this.theme(this.prevTheme())},t.prototype.onThemeNavNextClick=function(e){return this.theme(this.nextTheme())},t.prototype.onThemeLinkClick=function(e){return this.theme(this.themeForLink(e.currentTarget)),!1},t.prototype.onHideClick=function(e){var t;return this.fullPicker.toggle(),this.miniPicker.toggle(),this.scrollToTheme(this.theme(),!1),t=$(e.currentTarget),t.toggleClass("open")},t.prototype.onEditClick=function(e){return $("#page-edit-form").submit(),!1},t.prototype.onPublishClick=function(e){var t;return t=$("#page-publish-form"),t.find('input[name="page[theme_slug]"]').val(this.theme().slug),$("#page-publish-form").submit(),!1},t.prototype.scrollThemeLinksContainer=function(e){var t,n,r;return n=this.themeLinksContainer.scrollLeft(),r=this.themeLinksContainer.outerWidth(!0),t=n+r*e,this.themeLinksContainer.animate({scrollLeft:t},400,function(e){return function(){return e.updateScrollLinks()}}(this)),!1},t.prototype.updateScrollLinks=function(){var e,t,n;return e=this.themeLinksContainer.scrollLeft(),0>=e?(this.scrollBackwardsLinks.addClass("disabled"),this.scrollForwardsLinks.removeClass("disabled")):(this.scrollBackwardsLinks.removeClass("disabled"),n=this.themeLinksContainer[0].scrollWidth,t=n-this.themeLinksContainer.outerWidth(!0),e>=t?this.scrollForwardsLinks.addClass("disabled"):this.scrollForwardsLinks.removeClass("disabled"))},t.prototype.selectedThemeIndex=function(){return this.themes.indexOf(this.selectedTheme)},t.prototype.prevTheme=function(){var e;return e=(this.selectedThemeIndex()-1)%this.themes.length,0>e&&(e+=this.themes.length),this.themes[e]},t.prototype.nextTheme=function(){return this.themes[(this.selectedThemeIndex()+1)%this.themes.length]},t.prototype.themeForLink=function(e){return this.themes[this.themeLinks.index($(e))]},t.prototype.linkForTheme=function(e){return $(this.themeLinks[this.themes.indexOf(e)])},t.prototype.scrollToTheme=function(e,t){var n,r,i,s,o,a;return null==t&&(t=!0),n=this.linkForTheme(e),a=this.themes.indexOf(e),s=n.outerWidth(!0),i=a*s,r=this.themeLinksContainer.scrollLeft(),o=r+this.themeLinksContainer.outerWidth(!0),r>i||i+s>o?t?this.themeLinksContainer.animate({scrollLeft:i},500):this.themeLinksContainer.scrollLeft(i):void 0},t.prototype.theme=function(e){return null==e&&(e=null),e?(this.selectedTheme=e,this.showPreviewFor(e),this.themeLinks.removeClass("selected"),this.linkForTheme(e).addClass("selected"),this.scrollToTheme(e),this.miniPicker.find(".js-theme-name").text(e.name),!1):this.selectedTheme},t.prototype.showPreviewFor=function(e){var t;return this.contextLoader.addClass("visible"),t=this.fullPicker.find("form"),t.find('input[name="theme_slug"]').val(e.slug),t.submit()},t.prototype.getDocHeight=function(e){var t,n;return this.pagePreview.height("auto"),t=e.body,n=e.documentElement,Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)},t}(),$(function(){return document.getElementById("theme-picker-wrap")?new t:void 0})}.call(this),function(){$(document).on("click",".email-hidden-toggle > a",function(){return $(this).parent().siblings(".email-hidden-reply").toggle(),!1})}.call(this),function(){var e,t,n,r;e=function(e){return document.querySelector(".js-gist-dropzone").classList.remove("hidden"),e.stopPropagation(),e.preventDefault()},t=function(e){var t;return(null!=(t=e.target.classList)?t.contains("js-gist-dropzone"):void 0)?e.target.classList.add("hidden"):void 0},n=function(e){var t,n,i,s,o,a;for(a=e.dataTransfer.files,s=0,o=a.length;o>s;s++)i=a[s],window.ga("send","event","Interaction","File Drop",i.type,{useBeacon:!0}),t=function(t){var n;return i=t.file,n=t.data,e.target.dispatchEvent(new CustomEvent("gist:filedrop",{bubbles:!0,cancelable:!0,detail:{file:i,text:n}}))},n=function(){},r(i).then(t,n);return document.querySelector(".js-gist-dropzone").classList.add("hidden"),e.stopPropagation(),e.preventDefault()},$.observe(".js-gist-dropzone",{add:function(){return document.body.addEventListener("dragenter",e),document.body.addEventListener("dragleave",t),document.body.addEventListener("dragover",e),document.body.addEventListener("drop",n)},remove:function(){return document.body.removeEventListener("dragenter",e),document.body.removeEventListener("dragleave",t),document.body.removeEventListener("dragover",e),document.body.removeEventListener("drop",n)}}),r=function(e){return new Promise(function(t,n){var r;return r=new FileReader,r.onload=function(){var i;return i=r.result,i&&!/\0/.test(i)?t({file:e,data:i}):n(new Error("invalid file"))},r.readAsText(e)})}}.call(this),function(){var e,t,n,r,i,s,o,a;n=require("github/fetch").fetchJSON,t=function(e){var t,n,r,i,s,o,a,c,u,l,d;for(r=e.querySelector(".js-gist-files"),d=document.getElementById("js-gist-file-template"),t=document.createElement("div"),t.innerHTML=d.textContent,u=t.querySelectorAll("[id]"),i=0,o=u.length;o>i;i++)n=u[i],n.removeAttribute("id");for(c=t.querySelector(".js-code-textarea"),null!=c&&c.setAttribute("id","blob_contents_"+Date.now()),l=t.children,s=0,a=l.length;a>s;s++)n=l[s],r.append(n);return r.lastElementChild},a=function(e){var n,r,i,s,o,a;for(o=e.querySelectorAll(".js-gist-file"),i=0,s=o.length;s>i;i++)if(n=o[i],r=n.querySelector(".js-gist-filename"),a=n.querySelector(".js-blob-contents"),!r.value&&!a.value)return n;return t(e)},o=function(e){var t;return t=e.closest(".js-code-editor"),new Promise(function(e){var n;return(n=$(t).data("code-editor"))?e(n):$(t).one("codeEditor:ready",function(){return e($(this).data("code-editor"))})})},e=function(e){var t,n,r,i;for(r=e.querySelectorAll(".js-code-textarea"),t=0,n=r.length;n>t;t++)if(i=r[t],i.value.trim().length>0)return!0;return!1},i=function(){var t,n,r,i,s;for(i=document.querySelectorAll(".js-gist-create"),s=[],n=0,r=i.length;r>n;n++)t=i[n],s.push(t.disabled=!e(t.form));return s},$(document).on("change",".js-code-textarea",function(){return i()}),r=function(){var e,t;return t=this,(e=t.getAttribute("data-language-detection-url"))?n(e+"?filename="+encodeURIComponent(t.value)).then(function(e){return o(t).then(function(t){return t.setMode(e.language)})}):void 0},$(document).onFocusedInput(".js-gist-filename",function(e){var t,n;return n=this,t=n.closest(".js-code-editor"),o(t).then(function(t){return null==t.ace?!1:$(n).on("throttled:input."+e,r)}),!1}),$(document).on("click",".js-add-gist-file",function(){var e;return e=this.closest(".js-blob-form"),t(e).scrollIntoView(),!1}),$(document).on("gist:filedrop",".js-blob-form",function(e){var t,n,i,s,c;return s=e.originalEvent.detail,t=s.file,c=s.text,n=a(this),i=n.querySelector(".js-gist-filename"),i.value=t.name,r.call(i),o(i).then(function(e){return e.setCode(c)}),n.scrollIntoView()}),$(document).on("click",".js-remove-gist-file",function(){var e,t,n,r,i;for(e=this.closest(".js-gist-file"),i=e.querySelectorAll(".js-gist-deleted input"),t=0,r=i.length;r>t;t++)n=i[t],n.disabled=!1;return e.querySelector(".js-code-editor").remove(),!1}),$(function(){return i()}),s=function(e){var t,n,r,i,s;for(n=e.querySelectorAll(".js-remove-gist-file"),s=[],r=0,i=n.length;i>r;r++)t=n[r],s.push(t.classList.toggle("hidden",n.length<2));return s},$.observe(".js-remove-gist-file",function(){var e;return e=this.closest(".js-gist-files"),{add:function(){return s(e)},remove:function(){return s(e)}}})}.call(this),function(){$(document).on("ajaxComplete",".js-gist-file-update-container .js-comment-update",function(e,t){var n;return 200===t.status?(n=JSON.parse(t.responseText),this.action=n.url):void 0})}.call(this),function(){$(document).on("click",".js-skip-to-content",function(){return $("#start-of-content").next().attr("tabindex","-1").focus(),!1})}.call(this),function(){var e,t,n,r,i;i=require("github/fetch"),n=i.fetch,r=i.fetchText,e={isHttpFragment:function(e){return 0==="http://".indexOf(e)||0==="https://".indexOf(e)},isValidHttpUrl:function(e){var t,n,r;return e=e.trim(),r=function(){try{return new URL(e)}catch(t){}}(),null==r?!1:(t=/^https?/.test(r.protocol),n=r.href===e||r.href===e+"/",t&&n)}},$.observe(".js-hook-url-field",function(t){var n,r,i;n=$(t),r=function(e){var t,n;return t=$(e).closest("form"),n=/^https:\/\/.+/.test(e.val()),t.toggleClass("is-ssl",n)},i=function(t){var n,r;return n=t.val(),r=e.isHttpFragment(n)||e.isValidHttpUrl(n),t.closest("form").toggleClass("is-invalid-url",!r)},n.on("keyup",function(){return r(n)}),n.on("throttled:input",function(){return i(n)}),r(n),i(n)}),$(document).on("click",".js-hook-toggle-ssl-verification",function(e){return e.preventDefault(),$(".js-ssl-hook-fields").toggleClass("is-not-verifying-ssl"),$(".js-ssl-hook-fields").hasClass("is-not-verifying-ssl")?($(".js-hook-ssl-verification-field").val("1"),$(document).trigger("close.facebox")):$(".js-hook-ssl-verification-field").val("0")}),t=function(e){var t;return t=$(".js-hook-event-checkbox"),t.prop("checked",!1),null!=e?t.filter(e).prop("checked",!0):void 0},$(document).on("change",".js-hook-event-choice",function(){var e;return e="custom"===$(this).val(),$(".js-hook-events-field").toggleClass("is-custom",e),!0}),$(document).on("submit",".js-hook-form",function(){var e,n;return e=$(this),n=e.find(".js-hook-event-choice:checked").val(),"custom"===n&&$(".js-hook-wildcard-event").prop("checked",!1),"push"===n&&t('[value="push"]'),"all"===n&&t(".js-hook-wildcard-event"),!0}),$(document).on("details:toggled",".js-hook-secret",function(){var e,t;return e=$(this),t=e.find("input[type=password]"),e.hasClass("open")?t.removeAttr("disabled").focus():t.attr("disabled","disabled")}),$(document).on("details:toggle",".js-hook-delivery-item",function(){var e,t;return e=$(this),t=this.querySelector(".js-hook-delivery-details"),e.data("details-load-initiated")?void 0:$.sudo().then(function(){var n,i;return e.data("details-load-initiated",!0),t.classList.add("is-loading"),n=function(e){return $(t).replaceWith(e),t.classList.remove("is-loading")},i=function(){return t.classList.add("has-error"),t.classList.remove("is-loading")},r(t.getAttribute("data-url")).then(n,i)})}),$(document).on("click",".js-hook-delivery-details .js-tabnav-tab",function(){var e,t,n;return t=$(this),e=t.closest(".js-hook-delivery-details"),e.find(".js-tabnav-tab").removeClass("selected"),n=e.find(".js-tabnav-tabcontent").removeClass("selected"),t.addClass("selected"),n.filter(function(){return this.getAttribute("data-tab-name")===t.attr("data-tab-target")}).addClass("selected")}),$(document).on("click",".js-hook-deliveries-pagination-button",function(e){var t,n;return e.preventDefault(),n=this,t=$(this).parent(),$.sudo().then(function(){return t.addClass("loading"),r(n.getAttribute("href")).then(function(e){return t.replaceWith(e)})})}),$(document).on("click",".js-redeliver-hook-delivery-init-button",function(e){var t;return e.preventDefault(),t=this.getAttribute("href"),$.sudo().then(function(){return $.facebox({div:t})})}),$(document).on("ajaxSuccess",".js-redeliver-hook-form",function(e,t){var n,r,i,s;return s=this.getAttribute("data-delivery-guid"),n=$(".js-hook-delivery-details").filter(function(){return this.getAttribute("data-delivery-guid")===s}),i=n.closest(".js-hook-delivery-item"),$(document).trigger("close.facebox"),r=$(t.responseText),n.replaceWith(r),r.on("load",function(){return n=i.find(".js-hook-delivery-details"),i.find(".js-item-status").removeClass("success pending failure").addClass(n.attr("data-status-class")),i.find(".js-item-status-tooltip").attr("aria-label",n.attr("data-status-message"))})}),$(document).on("ajaxError",".js-redeliver-hook-form",function(){return $(this).siblings(".js-redelivery-dialog").addClass("failed")}),$(document).on("submit",".js-test-hook-form",function(e){var t;return e.preventDefault(),t=this,$.sudo().then(function(){var e,r,i,s;return s=document.querySelector(".js-test-hook-message"),s.classList.remove("error","success"),e=function(){return t.dispatchEvent(new CustomEvent("ajaxComplete",{bubbles:!0}))},r=function(){return s.classList.add("success")},i=function(e){var t;return s.classList.add("error"),t=s.querySelector(".js-test-hook-message-errors"),null!=e.response?e.response.json().then(function(e){return t.textContent=e.errors}):t.textContent="Network request failed"},n(t.action,{method:t.method,body:$(t).serialize(),headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).then(r,i).then(e,e)})})}.call(this),function(){var e,t,n;n=require("github/fetch"),e=n.fetchJSON,t=n.fetchPoll,$(document).on("change",".js-triage-list-check",function(e){return $(".js-triage-toolbar").toggleClass("triage-mode",$(".js-triage-list-check:checked").length>0)}),$(document).on("change",".js-triage-list-check",function(){var e;e=$(".js-triage-list-check:checked"),$(".js-triage-item").data("contents-data",e).addClass("js-load-contents")}),$(document).on("selectmenu:selected",".js-triage-toolbar .js-navigation-item",function(){var e,t,n,r,i,s;n=$(this).closest(".js-menu-container").hasClass("js-select-menu-multiple"),e=$(this).closest("form"),i=$(this).hasClass("selected"),r=$(this).attr("data-name"),s=$(this).attr("data-value"),t=n?$("",{type:"hidden",name:r+"["+s+"]",value:i?"1":"0"}):$("",{type:"hidden",name:r,value:i?s:""}),setImmediate(function(e){return function(){return $(e).menu("deactivate")}}(this)),e.find(".js-bulk-triage-fields").append(t),e.addClass("will-submit")}),$(document).on("menu:deactivate",".js-triage-toolbar .js-menu-container",function(n){var r,i;(r=this.querySelector("form.will-submit"))&&(this.classList.add("is-loading"),i=e(r.getAttribute("action"),{method:"put",body:$.param($(r).serializeArray()),headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}),i.then(function(e){return function(n){var r,i,s;return s=t(n.job.url,{headers:{accept:"application/json"}}),r=function(){return $(e).menu("deactivate"),location.reload()},i=function(){return e.classList.add("has-error")},s.then(r,i)}}(this)),r.classList.remove("will-submit"),n.preventDefault())}),$(document).on("submit",".js-delete-orgs-form",function(n){var r,i,s,o;n.preventDefault(),s=this,s.classList.add("is-loading"),r=$(".js-triage-list-check:checked"),i=r.length?"&"+$.param(r):"",o=e(s.getAttribute("action"),{method:"put",body:$.param($(s).serializeArray())+i,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}),o.then(function(e){var n,r,i;return i=t(e.job.url,{headers:{accept:"application/json"}}),n=function(){return location.reload()},r=function(){return s.classList.add("has-error")},i.then(n,r)})}),$(document).on("change",".js-hosted-admin-auth-switcher",function(e){var t;return t=$(".js-hosted-admin-saml-settings"),t.toggleClass("hidden")})}.call(this),function(){$(document).on("navigation:open",".js-issues-custom-filter",function(){var e,t,n,r;return t=$(this),r=t.find(".js-new-item-name").text(),n=t.attr("data-name"),e=$("",{type:"hidden",name:n,value:r}),t.append(e),t.submit()})}.call(this),function(){var e,t,n;t=function(t,n){return t.closest(".js-label-editor").find(".js-color-editor-bg").css("background-color",n),t.css("color",e(n,-.5)),t.css("border-color",n)},n=function(e){var t,n;return n="#c00",t=$(e).closest(".js-color-editor"),t.find(".js-color-editor-bg").css("background-color",n),e.css("color","#c00"),e.css("border-color",n)},e=function(e,t){var n,r,i;for(e=String(e).toLowerCase().replace(/[^0-9a-f]/g,""),e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0,i="#",n=void 0,r=0;3>r;)n=parseInt(e.substr(2*r,2),16),n=Math.round(Math.min(Math.max(0,n+n*t),255)).toString(16),i+=("00"+n).substr(n.length),r++;return i},$(document).on("focusin",".js-color-editor-input",function(){var e,r;return r=$(this),e=$(this).closest(".js-label-editor"),r.on("throttled:input.colorEditor",function(i){var s;return"#"!==r.val().charAt(0)&&r.val("#"+r.val()),e.removeClass("is-valid is-not-valid"),s=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(r.val()),s?(e.addClass("is-valid"),t(r,r.val())):(e.addClass("is-not-valid"),n(r))}),r.on("blur.colorEditor",function(){return r.off(".colorEditor")})}),$(document).on("mousedown",".js-color-chooser-color",function(e){var n,r,i;return $(this).closest(".js-color-editor").removeClass("open"),n=$(this).closest(".js-label-editor"),r="#"+$(this).attr("data-hex-color"),i=n.find(".js-color-editor-input"),n.removeClass("is-valid is-not-valid"),i.val(r),t(i,r)}),$(document).on("submit",".js-label-editor form",function(){var e,t;return e=$(this).find(".js-color-editor-input"),t=e.val(),t.length<6&&(t=t[1]+t[1]+t[2]+t[2]+t[3]+t[3]),e.val(t.replace("#",""))}),$(document).on("focusin",".js-label-editor",function(){return $(this).closest(".js-label-editor").addClass("open")}),$(document).on("reset",".js-create-label",function(){var e,n,r;return e=$(this).find(".color-chooser span").removeAttr("data-selected"),r=e.eq(Math.floor(Math.random()*e.length)),n="#"+r.attr("data-selected","").attr("data-hex-color"),setImmediate(function(e){return function(){var r;return r=$(e).find(".js-color-editor-input"),r.attr("data-original-color",n).attr("value",n),t(r,r.val())}}(this))})}.call(this),function(){var e,t,n,r,i,s;n=require("github/inflector").pluralizeNode,r=require("github/number-helpers"),e=r.formatNumber,t=r.parseFormattedNumber,i=function(e,t){return e.closest("div.js-details-container").classList.toggle("is-empty",t)},s=function(r){var i,s,o;return i=document.querySelector(".js-labels-count"),o=t(i.textContent),s=o+r,i.textContent=e(s),n(s,document.querySelector(".js-labels-label")),s},$(document).on("click",".js-edit-label",function(){return $(this).closest(".labels-list-item").addClass("edit")}),$(document).on("click",".js-edit-label-cancel",function(){return this.form.reset(),$(this).closest(".labels-list-item").removeClass("edit")}),$(document).on("ajaxSuccess",".js-create-label",function(e,t,n,r){return this.reset(),$(this).nextAll(".table-list").prepend(r),s(1),i(this,!1)}),$(document).on("ajaxSuccess",".js-update-label",function(e,t,n,r){return $(this).closest(".labels-list-item").replaceWith(r)}),$(document).on("ajaxSend",".js-update-label, .js-create-label",function(){return $(this).find(".error").text("")}),$(document).on("ajaxError",".js-update-label, .js-create-label",function(e,t){return $(this).find(".error").text(t.responseText),!1}),$(document).on("ajaxSuccess",".js-delete-label",function(){var e;return e=s(-1),i(this,0===e),$(this).closest(".labels-list-item").fadeOut()})}.call(this),function(){$.hashChange(function(e){var t,n,r,i;return i=e.newURL,(r=i.match(/\/issues#issue\/(\d+)$/))?(t=r[0],n=r[1],window.location=i.replace(/\/?#issue\/.+/,"/"+n)):void 0}),$.hashChange(function(e){var t,n,r,i,s;return s=e.newURL, +(i=s.match(/\/issues#issue\/(\d+)\/comment\/(\d+)$/))?(t=i[0],r=i[1],n=i[2],window.location=s.replace(/\/?#issue\/.+/,"/"+r+"#issuecomment-"+n)):void 0})}.call(this),function(){var e;$.observe(".js-issues-list-check:checked",{add:function(){return $(this).closest(".js-issue-row").addClass("selected")},remove:function(){return $(this).closest(".js-issue-row").removeClass("selected")}}),$(document).on("navigation:keydown",".js-issue-row",function(t){return"x"===t.hotkey?(e(this),!1):void 0}),$("#js-issues-search").focus(function(e){return this.value=this.value}),e=function(e){var t;(t=$(e).find(".js-issues-list-check")[0])&&(t.checked=!t.checked,$(t).trigger("change"))}}.call(this),function(){var e,t,n,r,i;e=require("github/fetch").fetchText,$(document).on("selectmenu:selected",".js-issue-sidebar-form",function(e){var t,r,i,s,o;return r=e.target,r.hasAttribute("data-assignee-value")&&(i=r.closest(".js-menu-content"),t=i.querySelector(".js-assignee-field"),t.value=r.getAttribute("data-assignee-value"),t.disabled=!1),o=function(e){return function(){return e.matches("form")?$(e).submit():n(e)}}(this),s=r.closest(".js-select-menu").hasAttribute("data-multiple"),s?($(this).off(".deferredSubmit"),$(this).one("menu:deactivate.deferredSubmit",o)):o()}),i=function(e,t){var n;e.replaceWith.apply(e,$.parseHTML(t)),n=document.querySelector(".js-discussion-sidebar-item .js-assignee-field"),n&&n.value&&(n.disabled=!1)},$(document).on("ajaxSuccess",".js-discussion-sidebar-item",function(e,t,n,r){var s;s=e.target.classList,s.contains("js-issue-sidebar-form")&&i(this,r)}),$(document).on("click","div.js-issue-sidebar-form .js-issue-assign-self",function(e){var t;t=this.closest(".js-issue-sidebar-form"),n(t,{name:this.name,value:this.value}),e.preventDefault()}),n=function(t,n){var s;s=r(t),n&&s.push(n),s.push({name:"authenticity_token",value:t.closest("form").elements.authenticity_token.value}),e(t.getAttribute("data-url"),{method:"post",body:$.param(s),headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).then(function(e){return i(t.closest(".js-discussion-sidebar-item"),e)})},r=function(e){var n,r,i,s,o,a;for(n=e.closest("form"),o=$(n).serializeArray(),a=[],r=0,i=o.length;i>r;r++)s=o[r],$.contains(e,t(n,s))&&a.push(s);return a},t=function(e,t){var n,r,i,s;for(s=e.elements,r=0,i=s.length;i>r;r++)if(n=s[r],n.name===t.name&&n.value===t.value)return n}}.call(this),function(){var e,t,n;n=require("github/fetch"),e=n.fetchJSON,t=n.fetchPoll,$(document).on("change",".js-issues-list-check",function(){$("#js-issues-toolbar").toggleClass("triage-mode",$(".js-issues-list-check:checked").length>0)}),$(document).on("change",".js-issues-list-check",function(){var e;e=$(".js-issues-list-check:checked"),$("#js-issues-toolbar .js-issues-toolbar-triage .js-select-menu").data("contents-data",e).addClass("js-load-contents")}),$(document).on("selectmenu:selected",".js-issues-toolbar-triage .js-navigation-item",function(){var e,t,n,r,i,s;n=$(this).closest(".js-menu-container").hasClass("js-label-select-menu"),e=$(this).closest("form"),i=$(this).hasClass("selected"),r=$(this).attr("data-name"),s=$(this).attr("data-value"),t=n?$("",{type:"hidden",name:r+"["+s+"]",value:i?"1":"0"}):$("",{type:"hidden",name:r,value:i?s:""}),setImmediate(function(e){return function(){return $(e).menu("deactivate")}}(this)),e.find(".js-issues-triage-fields").append(t),e.addClass("will-submit")}),$(document).on("menu:deactivate",".js-issues-toolbar-triage .js-menu-container",function(n){var r,i;(r=this.querySelector("form.will-submit"))&&(this.classList.add("is-loading"),i=e(r.getAttribute("action"),{method:r.getAttribute("method"),body:$.param($(r).serializeArray()),headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}),i.then(function(e){return function(n){var r,i,s;return s=t(n.job.url,{headers:{accept:"application/json"}}),r=function(){return $(e).menu("deactivate"),location.reload()},i=function(){return e.classList.add("has-error")},s.then(r,i)}}(this)),r.classList.remove("will-submit"),n.preventDefault())})}.call(this),DateInput=function(e){function t(n,r){"object"!=typeof r&&(r={}),e.extend(this,t.DEFAULT_OPTS,r),this.input=e(n),this.bindMethodsToObj("show","hide","hideIfClickOutside","keydownHandler","selectDate"),this.build(),this.selectDate(),this.show(),this.input.hide(),this.input.data("datePicker",this)}return t.DEFAULT_OPTS={month_names:["January","February","March","April","May","June","July","August","September","October","November","December"],short_month_names:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],short_day_names:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],start_of_week:1},t.prototype={build:function(){var t=e('

    \u25c0 \u25b6

    ');this.monthNameSpan=e(".month-name",t),e(".prev",t).click(this.bindToObj(function(){this.moveMonthBy(-1)})),e(".next",t).click(this.bindToObj(function(){this.moveMonthBy(1)}));var n=e('

    \u25c0 \u25b6

    ');this.yearNameSpan=e(".year-name",n),e(".prev",n).click(this.bindToObj(function(){this.moveMonthBy(-12)})),e(".next",n).click(this.bindToObj(function(){this.moveMonthBy(12)}));var r=e("
    ").append(t,n),i="";e(this.adjustDays(this.short_day_names)).each(function(){i+=""}),i+="
    "+this+"
    ",this.dateSelector=this.rootLayers=e('
    ').append(r,i).insertAfter(this.input),this.tbody=e("tbody",this.dateSelector),this.input.change(this.bindToObj(function(){this.selectDate()})),this.selectDate()},selectMonth:function(t){var n=new Date(t.getFullYear(),t.getMonth(),1);if(!this.currentMonth||this.currentMonth.getFullYear()!=n.getFullYear()||this.currentMonth.getMonth()!=n.getMonth()){this.currentMonth=n;for(var r=this.rangeStart(t),i=this.rangeEnd(t),s=this.daysBetween(r,i),o="",a=0;s>=a;a++){var c=new Date(r.getFullYear(),r.getMonth(),r.getDate()+a,12,0);this.isFirstDayOfWeek(c)&&(o+=""),o+=c.getMonth()==t.getMonth()?''+c.getDate()+"":''+c.getDate()+"",this.isLastDayOfWeek(c)&&(o+="")}this.tbody.empty().append(o),this.monthNameSpan.empty().append(this.monthName(t)),this.yearNameSpan.empty().append(this.currentMonth.getFullYear()),e(".selectable_day",this.tbody).mousedown(this.bindToObj(function(t){this.changeInput(e(t.target).attr("date"))})),e("td[date='"+this.dateToString(new Date)+"']",this.tbody).addClass("today"),e("td.selectable_day",this.tbody).mouseover(function(){e(this).addClass("hover")}),e("td.selectable_day",this.tbody).mouseout(function(){e(this).removeClass("hover")})}e(".selected",this.tbody).removeClass("selected"),e('td[date="'+this.selectedDateString+'"]',this.tbody).addClass("selected")},selectDate:function(e){"undefined"==typeof e&&(e=this.stringToDate(this.input.val())),e||(e=new Date),this.selectedDate=e,this.selectedDateString=this.dateToString(this.selectedDate),this.selectMonth(this.selectedDate)},resetDate:function(){e(".selected",this.tbody).removeClass("selected"),this.changeInput("")},changeInput:function(e){this.input.val(e).change(),this.hide()},show:function(){this.rootLayers.css("display","block"),e([window,document.body]).click(this.hideIfClickOutside),this.input.unbind("focus",this.show),this.rootLayers.keydown(this.keydownHandler),this.setPosition()},hide:function(){},hideIfClickOutside:function(e){e.target==this.input[0]||this.insideSelector(e)||this.hide()},insideSelector:function(t){return $target=e(t.target),$target.parents(".date_selector").length||$target.is(".date_selector")},keydownHandler:function(e){switch(e.keyCode){case 9:case 27:return void this.hide();case 13:this.changeInput(this.selectedDateString);break;case 33:this.moveDateMonthBy(e.ctrlKey?-12:-1);break;case 34:this.moveDateMonthBy(e.ctrlKey?12:1);break;case 38:this.moveDateBy(-7);break;case 40:this.moveDateBy(7);break;case 37:this.moveDateBy(-1);break;case 39:this.moveDateBy(1);break;default:return}e.preventDefault()},stringToDate:function(e){var t;return(t=e.match(/^(\d{1,2}) ([^\s]+) (\d{4,4})$/))?new Date(t[3],this.shortMonthNum(t[2]),t[1],12,0):null},dateToString:function(e){return e.getDate()+" "+this.short_month_names[e.getMonth()]+" "+e.getFullYear()},setPosition:function(){var e=this.input.offset();this.rootLayers.css({top:e.top+this.input.outerHeight(),left:e.left}),this.ieframe&&this.ieframe.css({width:this.dateSelector.outerWidth(),height:this.dateSelector.outerHeight()})},moveDateBy:function(e){var t=new Date(this.selectedDate.getFullYear(),this.selectedDate.getMonth(),this.selectedDate.getDate()+e);this.selectDate(t)},moveDateMonthBy:function(e){var t=new Date(this.selectedDate.getFullYear(),this.selectedDate.getMonth()+e,this.selectedDate.getDate());t.getMonth()==this.selectedDate.getMonth()+e+1&&t.setDate(0),this.selectDate(t)},moveMonthBy:function(e){var t=new Date(this.currentMonth.getFullYear(),this.currentMonth.getMonth()+e,this.currentMonth.getDate());this.selectMonth(t)},monthName:function(e){return this.month_names[e.getMonth()]},bindToObj:function(e){var t=this;return function(){return e.apply(t,arguments)}},bindMethodsToObj:function(){for(var e=0;e1?void 0:e(this.closest(".js-notification"))}),$(document).on("ajaxSuccess",".js-delete-notification",function(){return e(this.closest(".js-notification"))}),$(document).on("ajaxSuccess",".js-mute-notification",function(){var t;return e(this.closest(".js-notification")),t=this.closest(".js-notification"),t.classList.contains("muted")?this.action=this.action.replace("unmute","mute"):this.action=this.action.replace("mute","unmute"),t.classList.toggle("muted")}),$(document).on("ajaxSuccess",".js-unmute-notification",function(){var e;return e=this.closest(".js-notification"),e.classList.contains("muted")?this.action=this.action.replace("unmute","mute"):this.action=this.action.replace("mute","unmute"),e.classList.toggle("muted")}),$(document).on("ajaxSuccess",".js-mark-visible-as-read",function(){var e,t,n,r,i,s,o;for(e=this.closest(".js-notifications-browser"),i=e.querySelectorAll(".unread"),n=0,r=i.length;r>n;n++)t=i[n],t.classList.remove("unread"),t.classList.add("read");return null!=(s=e.querySelector(".js-mark-visible-as-read"))&&s.classList.add("mark-all-as-read-confirmed"),null!=(o=e.querySelector(".js-mark-as-read-confirmation"))?o.classList.add("mark-all-as-read-confirmed"):void 0}),$(document).on("ajaxSuccess",".js-mark-remaining-as-read",function(){var e,t,n;return e=this.closest(".js-notifications-browser"),null!=(t=e.querySelector(".js-mark-remaining-as-read"))&&t.classList.add("hidden"),null!=(n=e.querySelector(".js-mark-remaining-as-read-confirmation"))?n.classList.remove("hidden"):void 0}),$(document).on("navigation:keydown",".js-notification",function(e){switch(e.hotkey){case"I":case"e":case"y":return $(this).find(".js-delete-notification").submit(),!1;case"M":case"m":return $(this).find(".js-mute-notification").submit(),!1}}),$(document).on("navigation:keyopen",".js-notification",function(t){return e(this)}),$(document).on("ajaxSend",".js-notifications-subscription",function(){return this.querySelector(".js-spinner").classList.remove("hidden")}),$(document).on("ajaxComplete",".js-notifications-subscription",function(){return this.querySelector(".js-spinner").classList.add("hidden")})}.call(this),function(){$(document).on("ajaxSend",".js-auto-subscribe-toggle",function(){return $(this).find(".js-status-indicator").removeClass("status-indicator-success").removeClass("status-indicator-loading").addClass("status-indicator-loading")}),$(document).on("ajaxError",".js-auto-subscribe-toggle",function(){return $(this).find(".js-status-indicator").removeClass("status-indicator-loading").addClass("status-indicator-failed")}),$(document).on("ajaxSuccess",".js-auto-subscribe-toggle",function(){return $(this).find(".js-status-indicator").removeClass("status-indicator-loading").addClass("status-indicator-success")}),$(document).on("ajaxSend",".js-unignore-form, .js-ignore-form",function(){return $(this).closest(".js-subscription-row").addClass("loading")}),$(document).on("ajaxError",".js-unignore-form, .js-ignore-form",function(){return $(this).closest(".js-subscription-row").removeClass("loading"),$(this).find(".btn-sm").addClass("btn-danger").attr("title","There was a problem unignoring this repo.")}),$(document).on("ajaxSuccess",".js-unignore-form",function(){return $(this).closest(".js-subscription-row").removeClass("loading").addClass("unsubscribed")}),$(document).on("ajaxSuccess",".js-ignore-form",function(){return $(this).closest(".js-subscription-row").removeClass("loading unsubscribed")}),$(document).on("ajaxSend",".js-unsubscribe-form, .js-subscribe-form",function(){return $(this).closest(".js-subscription-row").addClass("loading")}),$(document).on("ajaxError",".js-unsubscribe-form, .js-subscribe-form",function(){return $(this).closest(".js-subscription-row").removeClass("loading"),$(this).find(".btn-sm").addClass("btn-danger").attr("title","There was a problem with unsubscribing :(")}),$(document).on("ajaxSuccess",".js-unsubscribe-form",function(){return $(this).closest(".js-subscription-row").removeClass("loading").addClass("unsubscribed")}),$(document).on("ajaxSuccess",".js-subscribe-form",function(){return $(this).closest(".js-subscription-row").removeClass("loading unsubscribed")}),$(document).on("ajaxSuccess",".js-thread-subscription-status",function(e,t,n,r){return $(".js-thread-subscription-status").updateContent(r)})}.call(this),function(){var e,t,n,r;$(document).on("ajaxSend",".js-toggler-container .js-set-approval-state",function(){return this.closest(".js-toggler-container").classList.add("loading")}),$(document).on("ajaxComplete",".js-toggler-container .js-set-approval-state",function(){return this.closest(".js-toggler-container").classList.remove("loading")}),$(document).on("ajaxSuccess",".js-toggler-container .js-set-approval-state",function(){return this.closest(".js-toggler-container").classList.add("on")}),$(document).on("ajaxSuccess",".js-request-approval-facebox-form",function(){var e;return e=this.getAttribute("data-container-id"),document.getElementById(e).classList.add("on"),$(document).trigger("close.facebox")}),r=function(e){return e.querySelectorAll(".js-integrations-install-repo-picked .js-repository-picker-result").length},e=function(e){return r(e)>0},n=function(e){var t;return(t=+e.getAttribute("data-max-repos"))?r(e)>=t:void 0},t=function(t){var n;return n=t.querySelector(".js-all-repositories-radio"),n.checked||e(t)},$.observe(".js-integrations-install-form",function(){var e,r,i,s,o,a;o=this,s=o.querySelector(".js-integrations-install-form-submit"),e=o.querySelector(".js-autocomplete"),i=e.getAttribute("data-search-url"),r=o.querySelector(".js-autocomplete-field"),a=function(){return s.disabled=!t(this),r.disabled=n(this),o.querySelector(".flash").classList.toggle("hidden",!n(this))},this.addEventListener("change",a),a.call(this),$(document).on("click",".js-repository-picker-remove",function(){var e;return e=this.closest(".js-repository-picker-result"),e.remove(),a.call(o)}),$(document).on("focus",".js-integrations-install-repo-picker .js-autocomplete-field",function(){return document.querySelector(".js-select-repositories-radio").checked=!0,a.call(o)}),$(document).on("autocomplete:autocompleted:changed",".js-integrations-install-repo-picker",function(){var t,n,r,s,o;for(o=i,s=document.querySelectorAll(".js-integrations-install-repo-picked .js-selected-repository-field"),n=0,r=s.length;r>n;n++)t=s[n],o+=~o.indexOf("?")?"&":"?",o+=t.name+"="+encodeURIComponent(t.value);return e.setAttribute("data-search-url",o)}),$(document).on("autocomplete:result",".js-integrations-install-repo-picker",function(e,t){var n,i;return i=this.querySelector("#repo-result-"+t),n=o.querySelector(".js-integrations-install-repo-picked"),i.classList.remove("hidden"),n.insertBefore(i,n.firstChild),r.value="",o.querySelector(".js-autocomplete-results").innerHTML="",a.call(o)})})}.call(this),function(){$(document).on("submit",".org form[data-results-container]",function(){return!1})}.call(this),function(){var e,t;t=require("github/fetch").fetchText,e=function(){return $(".js-invitation-toggle-team:checked").visible()},$(document).on("click",".js-invitations-team-suggestions-view-all",function(){return t(this.href).then(function(t){return function(n){var r,i;return i=e().map(function(){return this.value}),r=$(t).closest("ul"),r.html(n),i.each(function(){return r.find(".js-invitation-toggle-team[value="+this+"]").prop("checked",!0)})}}(this)),!1})}.call(this),function(){var e,t,n,r,i,s,o;s=require("github/inflector").pluralizeNode,i=require("github/number-helpers").parseFormattedNumber,e=[],t=function(){var e,t,n;return e=$(".js-person-grid"),t=e.find(".js-org-person").has(".js-org-person-toggle:checked"),function(){var e,r,i;for(i=[],e=0,r=t.length;r>e;e++)n=t[e],i.push($(n).attr("data-id"));return i}().sort()},o=function(e,t){var n,r,o,a;return null==t&&(t="+"),n=$("."+e),r=n.siblings(".js-stat-label"),a=i(n.text()),o=function(){switch(t){case"+":return a+1;case"-":return a-1;default:return a}}(),n.text(o),s(o,r[0])},r=null,$(document).on("change",".js-org-person-toggle",function(n){var i,s,o,a;return i=$(".js-org-toolbar"),s=i.find(".js-member-selected-actions"),o=t(),a=o.length>0,JSON.stringify(o)!==JSON.stringify(e)?(e=o,i.find(".js-org-toolbar-select-all-label").toggleClass("has-selected-members",a),$(".js-member-not-selected-actions").toggleClass("hidden",a),s.toggleClass("hidden",!a),i.addClass("disabled"),null!=r&&r.abort(),r=$.ajax({url:s.attr("data-toolbar-actions-url"),data:{member_ids:o}}),r.done(function(e,t,n){return s.html(e)}),r.always(function(){return i.removeClass("disabled")})):void 0}),$(document).on("click",".js-member-remove-confirm-button",function(e){return e.preventDefault(),$.facebox(function(){var n;return n=$.ajax({url:$(e.target).attr("data-url"),data:{member_ids:t()}}),n.done(function(e){return $.facebox(e)})})}),$(document).on("click",".js-member-search-filter",function(){var e,t;return t=$(this).attr("data-filter"),e=$(".js-member-filter-field"),e.val(t+" "),e.focus(),e.trigger("throttled:input"),!1}),$(document).on("ajaxSend ajaxComplete",".js-add-team-member-or-repo-form",function(e){return this===e.target?this.classList.toggle("is-sending","ajaxSend"===e.type):void 0}),n=navigator.userAgent.match(/Macintosh/)?"meta":"ctrl",$(document).onFocusedKeydown(".js-add-team-member-or-repo-form .js-autocomplete-field",function(){return function(e){return"enter"===e.hotkey||e.hotkey===n+"+enter"?e.preventDefault():void 0}}),$(document).on("autocomplete:result",".js-bulk-add-team-form .js-autocomplete-field",function(e){var t,n;return n=$(this).data("autocompleted"),n.indexOf("/")>0?(t=this.form.action,$.sudo().then(function(){return $.facebox(function(){var e;return e=$.ajax({url:t,method:"post",data:{member:n}}),e.done(function(e){return $.facebox(e)})})}),e.stopPropagation()):void 0}),$(document).on("autocomplete:result",".js-add-team-member-or-repo-form",function(){return setImmediate(function(e){return function(){return $(e).submit()}}(this))}),$(document).on("ajaxSuccess",".js-add-team-member-or-repo-form",function(e,t){var n,r,i,s,a,c,u,l,d;try{l=JSON.parse(t.responseText)}catch(h){}if(l?(n=$(l.list_item_html),l.stat_count_class&&o(l.stat_count_class,"+")):n=$(t.responseText),r=$(".js-member-list"),this.querySelector(".js-autocomplete-field").value="",d=n.attr("data-login"))for(u=r.children(),i=0,a=u.length;a>i;i++)if(s=u[i],s.getAttribute("data-login")===d)return;return r.prepend(n),c=!r.children().length,r.closest(".js-org-section").toggleClass("is-empty",c),r.siblings(".js-subnav").addClass("subnav-bordered")}),$(document).on("ajaxSuccess",".js-remove-team-repository",function(e,t,n,r){var i,s,a,c;return s=$(this),i=s.closest(".js-org-section"),a=i.find(".js-org-list"),s.closest(".js-org-repo").remove(),c=!a.children().length,i.toggleClass("is-empty",c),c&&(a.removeClass("table-list-bordered"),a.siblings(".js-subnav").removeClass("subnav-bordered")),o("js-repositories-count","-")}),$(document).on("ajaxError",".js-add-team-member-or-repo-form, .js-remove-team-repository",function(e,t){var n,r,i;if(!/=l?(a.style.position="fixed",a.style.top=u+"px",a.style.left=s+"px",a.style.width="250px"):(a.style.position=n,a.style.top=r,a.style.left=e,a.style.width=i)},5),window.addEventListener("scroll",o),window.addEventListener("resize",o),s()):void 0})}.call(this),function(){var e;$.observe(".js-rename-owners-team-input",function(){$(this).on("throttled:input",function(){var t,n,r;return t=this.closest("form"),n=this.value.trim().toLowerCase(),"owners"===n||""===n?e(!1,""):(t.classList.add("is-sending"),r=$.get(this.getAttribute("data-check-url"),{name:n}),r.done(function(n,r){var i;return n=n.trim(),i=""===n,t.classList.remove("is-sending"),e(i,n)}))})}),e=function(e,t){return document.querySelector(".js-rename-owners-team-button").classList.toggle("disabled",!e),document.querySelector(".js-rename-owners-team-errors").innerHTML=t,document.querySelector(".js-rename-owners-team-note").classList.toggle("hidden",""!==t)}}.call(this),function(){$(document).onFocusedInput(".js-new-organization-name",function(){var e;return(e=this.closest("dd").querySelector(".js-field-hint-name"))?function(){return"innerText"in e?e.innerText=this.value:e.textContent=this.value}:void 0}),$(document).on("ajaxSend",".js-org-list-item .js-org-remove-item",function(){return this.closest(".js-org-list-item").classList.add("hidden")}),$(document).on("ajaxSuccess",".js-org-list-item .js-org-remove-item",function(){return this.closest(".js-org-list-item").remove()}),$(document).on("ajaxError",".js-org-list-item .js-org-remove-item",function(){var e;return this.closest(".js-org-list-item").classList.remove("hidden"),(e=this.getAttribute("data-error-message"))?alert(e):void 0})}.call(this),function(){var e,t;$(document).on("click",".js-org-billing-plans .js-choose-plan",function(t){return e($(this).closest(".js-plan-row")),!1}),e=function(e){var n,r,i,s;return i=e.attr("data-name"),r=parseInt(e.attr("data-cost"),10),n=parseInt(null!=(s=e.attr("data-balance"))?s:"0",10),$(".js-org-billing-plans").find(".js-plan-row, .js-choose-plan").removeClass("selected"),e.find(".js-choose-plan").addClass("selected"),e.addClass("selected"),$(".js-plan").val(i),0===r&&0===n?$(".js-billing-section").addClass("has-removed-contents"):($(".js-billing-section").removeClass("has-removed-contents"),null!=e.attr("data-balance")?t(i):void 0)},t=function(e){return $(".js-plan-change-message").addClass("is-hidden"),$('.js-plan-change-message[data-name="'+e+'"]').removeClass("is-hidden")},$(function(){return $(".selected .js-choose-plan").click()})}.call(this),function(){var e;e=function(e){var t,n,r,i;n=e.selectors;for(r in n)i=n[r],$(r).text(i);return t=100===e.filled_seats_percent,$(".js-live-update-seats-percent").css("width",e.filled_seats_percent+"%"),$(".js-need-more-seats").toggleClass("hidden",!t),$(".js-add-team-member-or-repo-form").toggleClass("hidden",t)},$(document).on("ajaxSuccess",".js-per-seat-invite-field, .js-per-seat-invite .js-org-remove-item",function(t,n){return e(JSON.parse(n.responseText))})}.call(this),function(){$(document).on("click",".js-repo-search-filter",function(){var e,t,n,r,i;return t=$(this).attr("data-filter"),n=$(this).attr("data-negate"),e=$(".js-repo-filter-field"),r=e.val(),r.indexOf(n)>-1&&(r=r.replace(n,""),r=r.replace(/^\s*/,"")),-1===r.indexOf(t)&&(i=r&&r.match(/\s$/)?"":" ",e.val(r+(""+i+t+" ")),e.focus(),e.trigger("throttled:input")),$("body").removeClass("menu-active"),!1}),$.observe(".js-repository-fallback-search",function(){$(this).on("keypress",function(e){var t,n,r,i;if(13===e.which)return t=$(this),n=t.attr("data-host"),r=t.attr("data-org"),i=t.val(),document.location="http://"+n+"/search?q=user%3A"+r+"+"+i+"&type=Repositories"})}),$(document).on("click",".js-team-repo-higher-access",function(e){return e.preventDefault(),$.facebox(function(){var t;return t=$.ajax({url:$(e.target).attr("data-url")}),t.done(function(e){return $.facebox(e)})})})}.call(this),function(){$(document).on("selectmenu:selected",".js-select-repo-permission",function(){return $(this).submit()}),$(document).on("ajaxSend",".js-select-repo-permission",function(){return this.classList.remove("was-successful")}),$(document).on("ajaxSuccess",".js-select-repo-permission",function(e,t,n,r){var i;return this.classList.add("was-successful"),null!=(i=this.closest(".js-org-repo"))?i.classList.toggle("with-higher-access",r.members_with_higher_access):void 0})}.call(this),function(){$(document).on("click",".js-change-default-repository-permission-confirm",function(e){e.preventDefault(),$(document).find(".js-change-default-repository-permission-form").submit()})}.call(this),function(){$(document).on("autocomplete:autocompleted:changed",".js-team-add-user-name",function(e){var t;return t=$(".js-team-add-user-button")[0],t.disabled=!$(this).data("autocompleted")}),$(document).on("click",".js-team-remove-user",function(e){var t,n;return e.preventDefault(),$(".js-team-add-user-form").removeClass("hidden"),$(".js-team-add-user-name").focus(),t=$(this).closest("li").remove(),n=t.attr("data-login")}),$(document).on("click",".js-team-add-user-button",function(e){var t,n,r,i,s,o;if(e.preventDefault(),n=$(".js-team-add-user-name"),o=n.val(),o&&n.data("autocompleted")){for(n.val(""),s=$(".js-team-user-logins li"),t=0,r=s.length;r>t;t++)if(i=s[t],$(i).attr("data-login")===o)return;return $.sudo().then(function(){return $.ajax({url:$(".js-team-add-user-form").attr("data-template-url"),data:{member:o},success:function(e){return $(".js-team-user-logins").append(e),$(".js-login-field").prop("disabled",!1),$(".js-team-add-user-form").addClass("hidden")}}),$(".js-team-add-user-name").focus()})}})}.call(this),function(){$(document).on("ajaxSend",".js-ldap-import-groups-container",function(e,t,n){return t.setRequestHeader("X-Context","import")}),$(document).on("autocomplete:autocompleted:changed",".js-team-ldap-group-field",function(e){var t;(t=this.closest(".js-ldap-group-adder"))&&(t.classList.remove("is-exists"),t.querySelector(".js-ldap-group-adder-button").disabled=!$(this).data("autocompleted"))}),$(document).on("navigation:open",".js-team-ldap-group-autocomplete-results .js-navigation-item",function(){var e,t;return e=$(this).closest(".js-ldap-group-adder"),t=$(this).attr("data-dn"),e.find(".js-team-ldap-dn-field").val(t),$(this).closest(".js-ldap-import-groups-container").find(".js-ldap-group-dn").map(function(n,r){$(r).text()===t&&(e.addClass("is-exists"),e[0].querySelector(".js-ldap-group-adder-button").disabled=!0)})}),$(document).on("ajaxSend",".js-import-container",function(e,t,n){this.classList.add("is-importing"),this.querySelector(".js-ldap-group-adder-button").disabled=!0}),$(document).on("ajaxComplete",".js-import-container",function(e,t,n){ +return $(this).removeClass("is-importing")}),$(document).on("ajaxSuccess",".js-ldap-group-adder",function(e,t,n,r){return $(this).closest(".js-ldap-import-groups-container").removeClass("is-empty").find(".js-ldap-imported-groups").prepend($(r)),this.reset(),$(this).find(".js-team-ldap-group-field").focus(),this.querySelector(".js-ldap-group-adder-button").disabled=!0,$(".js-import-form-actions").removeClass("hidden")}),$(document).on("submit",".js-team-remove-group",function(e){this.closest(".js-team").classList.add("is-removing"),document.querySelector(".js-team-ldap-group-field").focus()}),$(document).on("ajaxSuccess",".js-team-remove-group",function(){this.closest(".js-team").remove(),document.querySelector(".js-team:not(.is-removing)")||(document.querySelector(".js-ldap-import-groups-container").classList.add("is-empty"),document.querySelector(".js-import-form-actions").classList.add("hidden"))}),$(document).on("ajaxError",".js-team-remove-group",function(){this.closest(".js-team").classList.remove("is-removing")}),$(document).on("click",".js-edit-team",function(e){return $(this).closest(".js-team").hasClass("is-removing")?!1:(e.preventDefault(),$(this).closest(".js-team").addClass("is-editing"),$(this).closest(".js-team").find(".js-team-name-field").focus())}),$(document).on("click",".js-save-button",function(){return $(this).hasClass("disabled")?!1:$(this).closest(".js-team").addClass("is-sending")}),$(document).on("click",".js-cancel-team-edit",function(e){var t,n;return e.preventDefault(),n=$(this).closest(".js-team").removeClass("is-editing"),t=n.find(".js-team-form").removeClass("is-exists"),t.find(".js-slug").text(t.find(".js-slug").attr("data-original-slug")),t[0].reset()}),$(document).on("ajaxSuccess",".js-team-form:not(.is-checking)",function(e,t,n,r){return t.nameCheck?void 0:$(this).closest(".js-team").removeClass("is-editing").replaceWith($(r))}),$(document).on("ajaxSuccess",".js-team-form.is-checking",function(e,t,n,r){var i,s;return i=$(this).removeClass("is-checking"),"function"==typeof(s=i.find(".js-team-name-field")).removeData&&s.removeData("autocheck-xhr"),r.error?(i.find(".js-save-button").addClass("disabled"),"exists"===r.error?(i.addClass("is-exists"),i.find(".js-slug").html(r.slug)):void 0):(i.find(".js-slug").html(r.slug),i.find(".js-save-button").removeClass("disabled"))}),$(document).on("ajaxError",".js-team-form",function(e,t,n,r){return t.nameCheck&&"abort"===t.statusText?!1:void 0}),$.observe(".js-team-name-field",function(){$(this).on("throttled:input",function(){var e,t,n,r;return t=$(this),e=t.closest(".js-team-form"),null!=(n=t.data("autocheck-xhr"))&&n.abort(),e.removeClass("is-exists").addClass("is-checking"),e.find(".js-save-button").addClass("disabled"),r=$.ajax({url:t.attr("data-check-url"),type:"GET",context:this,data:{name:this.value}}),r.nameCheck=!0,t.data("autocheck-xhr",r)})})}.call(this),function(){$(document).on("click",".js-show-own-teams",function(){var e,t,n,r;return e=$(".js-team-search-field"),r=e.val(),n=$(this).attr("data-me"),-1===r.indexOf("@"+n)&&(t=r?" ":"",e.val(""+r+t+"@"+n),e.focus(),e.trigger("throttled:input")),!1})}.call(this),function(){var e,t;t=require("github/fetch").fetchText,e=function(e){var n,r,i;r=e.value.trim(),n=e.form,n.classList.add("is-sending"),n.classList.remove("is-name-check-fail"),n.classList.remove("is-name-check-success"),i=new URL(e.getAttribute("data-check-url"),window.location.origin).toString(),i+=-1===i.indexOf("?")?"?":"&",i+="name="+encodeURIComponent(r),t(i).then(function(t){var i,s,o,a,c;return n.classList.remove("is-sending"),n.querySelector(".js-team-name-errors").innerHTML=t||"",o=null!=(a=e.getAttribute("data-original"))?a.trim():void 0,s=o&&r===o,i=!!n.querySelector(".js-error"),c=(i||!r)&&!s,n.querySelector(".js-create-team-button").disabled=c,n.classList.toggle("is-name-check-fail",i),n.classList.toggle("is-name-check-success",!i&&r)})},$.observe(".js-new-team",function(){$(this).on("throttled:input",function(){return e(this)})}),$.observe(".js-new-org-team",function(){var t;t=this.querySelector(".js-new-team"),t.value&&e(t)})}.call(this),function(){var e;e=require("github/fetch").fetch,$(document).on("submit",".js-remove-team-members-form",function(){return $.sudo().then(function(t){return function(){var n;return n=$(t),e(n.attr("action"),{method:"post",body:n.serialize(),headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).then(function(){var e;return e=n.closest(".js-org-section"),n.closest(".js-edit-team-member").remove(),e.toggleClass("is-empty",!e.find(".js-org-list").children().length)})}}(this)),!1}),$(document).on("click",".js-team-description-toggle",function(){return $(".js-description-toggler").toggleClass("on")}),$(document).on("ajaxComplete",".js-team-description-form",function(){var e;return e=$(".js-team-description-field").val(),$(".js-description-toggler").toggleClass("on"),e.trim()?$(".js-team-description .description").text(e):$(".js-team-description .description").html("This team has no description")}),$(document).on("ajaxSuccess",".js-add-team-members-form",function(e,t,n,r){var i;return i=$(document).find(".js-member-listings-container"),$(document).trigger("close.facebox"),i.html(t.responseText)}),$(document).on("click",".js-rename-owners-team-next-btn",function(){return document.querySelector(".js-rename-owners-team-about-content").classList.toggle("migrate-owners-content-hidden"),document.querySelector(".js-rename-owners-team-rename-form").classList.toggle("migrate-owners-content-hidden")})}.call(this),function(){$.observe(".js-org-transform-poller",function(){var e;e=this.getAttribute("data-redirect-url"),this.addEventListener("load",function(){return window.location.href=e})})}.call(this),function(){$(function(){var e;return $("#load-readme").click(function(){var t,n,r,i,s,o;return n=$("#gollum-editor-body"),t=$("#editor-body-buffer"),i=$("#undo-load-readme"),o=t.text(),e(n,t),r=$(this),r.prop("disabled",!0),r.text(r.attr("data-readme-name")+" loaded"),i.show(),s=function(){return $(this).val()!==o&&i.hide(),n.off("change keyup",s)},n.on("change keyup",s),!1}),$("#undo-load-readme").click(function(){var t;return e($("#gollum-editor-body"),$("#editor-body-buffer")),t=$("#load-readme"),t.prop("disabled",!1),t.text("Load "+t.attr("data-readme-name")),$(this).hide(),!1}),e=function(e,t){var n,r,i;return n=$(e),r=$(t),i=n.val(),n.val(r.text()),r.text(i)}})}.call(this),function(){function e(e,t){var n=e.querySelector("table.timeline-commits > tbody"),r=t.querySelectorAll("table.timeline-commits > tbody > tr.commit");Array.from(r).forEach(function(e){n.appendChild(e)}),t.remove()}var t=".discussion-item.discussion-commits + .discussion-item.discussion-commits";$.observe(".discussion-item.discussion-commits",{add:function(){var n=document.querySelectorAll(t);Array.from(n).forEach(function(t){t.querySelector(".discussion-item-header")||e(t.previousElementSibling,t)})}})}(),function(){$(document).on("click",".js-merge-branch-action",function(e){var t,n;n=$(this),t=n.closest(".js-merge-pr"),n.fire("details:toggle",{relatedTarget:e.target},function(){}),t.performTransition(function(){this.toggleClass("open"),this.fire("details:toggled",{relatedTarget:e.target,async:!0})}),e.preventDefault()})}.call(this),function(){$(document).on("details:toggled",".js-pull-merging",function(){var e;return e=$(this).find(".js-merge-pull-request"),e.toggleClass("is-dirty",e.is($.visible))}),$(document).on("ajaxSuccess",".js-merge-pull-request",function(e,t,n,r){var i,s,o;this.reset(),$(this).removeClass("is-dirty"),s=r.updateContent;for(o in s)i=s[o],$(o).updateContent(i)}),$(document).on("session:resume",function(e){var t,n;return(n=document.getElementById(e.targetId))?(t=$(n).closest(".js-merge-pull-request"),t.closest(".js-details-container").addClass("open")):void 0})}.call(this),function(){var e;e=require("github/fetch").fetchText,$(document).on("ajaxError",".js-handle-pull-merging-errors",function(e,t){var n,r,i;return n=this.closest(".js-pull-merging"),n.classList.add("is-error"),422===t.status&&(i=t.responseText)&&(r=n.querySelector(".js-pull-merging-error"),$(r).replaceWith(i)),!1}),$(document).on("click",".js-pull-merging-refresh",function(){var t,n;return t=this.closest(".js-pull-merging"),n=t.getAttribute("data-url"),e(n).then(function(e){return $(t).replaceWith(e)}),!1})}.call(this),function(){var e;$.observeLast(".pull-request-ref-restore","last"),e=function(){var e;return e=$("#js-pull-restorable").length,$(".js-pull-discussion-timeline").toggleClass("is-pull-restorable",e)},$.observe("#js-pull-restorable",{add:e,remove:e})}.call(this),function(){var e,t;t=require("github/fetch").fetchText,e=function(e){var t;return t=e.getAttribute("data-container-id"),document.getElementById(t)},$(document).on("pjax:click",".js-pull-request-tab",function(t,n){return e(this)?!1:(n.push=!1,n.replace=!0)}),$(document).on("click",".js-pull-request-tab",function(t){var n,r,i,s,o,a;if(1===t.which&&!t.metaKey&&!t.ctrlKey&&(n=e(this))){for(o=$(".js-pull-request-tab.selected"),i=0,s=o.length;s>i;i++)a=o[i],$(a).removeClass("selected"),$(e(a)).removeClass("is-visible");return $(n).addClass("is-visible"),$(this).addClass("selected").blur(),r=$(this).attr("data-tab"),$(".js-pull-request-tab-container").attr("data-tab",r),$.support.pjax&&window.history.replaceState($.pjax.state,"",this.href),!1}}),$(document).on("ajaxSuccess","#discussion_bucket .js-inline-comment-form, #discussion_bucket .js-pull-request-review-comment-form",function(){return $("#files_bucket").remove()}),$(document).on("ajaxSuccess","#files_bucket .js-inline-comment-form, #files_bucket .js-pull-request-review-comment-form",function(){return $("#discussion_bucket").remove()}),$(document).on("socket:message",".js-pull-request-tabs",function(){t(this.getAttribute("data-url")).then(function(e){return function(t){var n,r,i,s,o,a,c,u,l,d,h;for(c=document.createDocumentFragment(),u=$.parseHTML(t),r=0,o=u.length;o>r;r++)n=u[r],c.appendChild(n);for(l=["#commits_tab_counter","#files_tab_counter","#diffstat"],h=[],s=0,a=l.length;a>s;s++)i=l[s],h.push(null!=(d=e.querySelector(i))?d.replaceWith(c.querySelector(i)):void 0);return h}}(this))}),$(document).on("socket:message",".js-pull-request-stale-files",function(){return $("#files_bucket").addClass("is-stale")})}.call(this),function(){var e,t,n,r,i,s,o,a;t=require("github/fetch").fetch,n=function(){return $(".user-interests-item").not(".hidden").length},o=function(){return 0===n()?($(".recommendations-outro").fadeOut(100),$(".recommendations-intro").fadeIn(100)):($(".recommendations-intro").fadeOut(100),$(".recommendations-outro").fadeIn(100))},a=function(){var e,t;return e=n(),t=function(){switch(!1){case 0!==e:return"Which programming languages, frameworks, topics, etc.?";case 1!==e:return"Awesome! What else?";case 2!==e:return"Excellent \u2013 let's keep going!";case 3!==e:return"These are great. Anything else?";case 4!==e:return"Great! Maybe one more?"}}(),5===e?($(".js-user-recommendations-form").delay(500).hide(),$(".js-recommendations-complete").delay(500).show()):$(".js-recommendations-complete").visible()&&($(".js-user-recommendations-form").show(),$(".js-recommendations-complete").hide()),$(".js-user-interests-input").attr("placeholder",t),o()},s=null,e=function(e,t,n){var o,c,u,l,d;return c=document.querySelector(".js-user-recommendations-form"),u=c.querySelector(".js-user-interests-input"),e=e.trim(),$(".js-button-skip").hide(),u.value="",null==s&&(s=$(".js-user-interests-item.hidden").remove().removeClass("hidden")[0]),l=s.cloneNode(!0),l.title=e,l.insertBefore(document.createTextNode(e),l.firstChild),$(".js-user-interests-list").append(l),l=$(l),d=l.offset(),o=Math.abs(n-d.left),l.css("position","absolute").css("top",t).css("left",n).fadeIn(100).animate({top:d.top,left:d.left-8},{duration:300+.2*o,specialEasing:{top:"easeInBack"},complete:function(){return $(this).css("position","relative"),$(this).css("top",0),$(this).css("left",0),u.value=e,i(c).then(function(){return r()}),u.value=""}}),a()},$.easing.easeInBack=function(e,t,n,r,i,s){return void 0===s&&(s=3.70158),r*(t/=i)*t*((s+1)*t-s)+n},r=function(){return $.pjax({url:"/recommendations",container:"#js-pjax-container"})},$(document).on("pjax:complete",function(){return a()}),$(function(){return $(".user-interests-item").length?a():void 0}),$(document).on("submit",".js-user-recommendations-form",function(t){var n,r,i,s,o;return t.preventDefault(),n=this.querySelector(".js-user-interests-input"),r=n.value,s=$(n).offset(),o=s.top,i=s.left,e(r,o,i)}),$(document).on("click",".js-interest-option",function(t){var n,r,i,s,o;return t.preventDefault(),s=this,n=s.getAttribute("data-name"),i=$(s).offset(),o=i.top-$(s).height()/2,r=i.left-$(s).width()/2,e(n,o,r)}),$(document).on("submit",".js-remove-user-interest-form",function(e){return e.preventDefault(),i(this).then(function(){return r()})}),$(document).onFocusedKeydown(".js-user-interests-input",function(){return function(e){return","===e.hotkey&&($(".js-user-recommendations-form").trigger("submit"),e.preventDefault()),""===$(this).val()&&"space"===e.hotkey?e.preventDefault():void 0}}),i=function(e){return t(e.getAttribute("action"),{method:e.getAttribute("method"),body:$.param($(e).serializeArray()),headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}})}}.call(this),function(){var e,t,n,r,i,s,o;t=require("github/fetch").fetchJSON,$(document).on("click",".js-timeline-tags-expander",function(){return $(this).closest(".js-timeline-tags").removeClass("is-collapsed")}),r=["is-default","is-saving","is-saved","is-failed"],i=function(e,t){var n;return(n=e.classList).remove.apply(n,r),e.classList.add(t),e.disabled="is-saving"===t},$(document).on("click",".js-save-draft",function(){var e,n,r,s;return e=this,s=e.closest("form"),s.querySelector("#release_draft").value="1",n=function(t){return i(e,"is-saved"),setTimeout(function(){return i(e,"is-default")},5e3),s.dispatchEvent(new CustomEvent("release:saved",{bubbles:!0,cancelable:!1,detail:{release:t}}))},r=function(){return i(e,"is-failed")},t(s.action,{method:s.method,body:$(s).serialize(),headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).then(n,r),i(e,"is-saving"),!1}),$(document).on("release:saved",".js-release-form",function(e){var t,r,i,s,o,a,c,u;return o=e.originalEvent.detail.release,s=this,c=s.getAttribute("data-repo-url"),u=n("tag",c,o.tag_name),i=n("edit",c,o.tag_name),s.setAttribute("action",u),"function"==typeof(t=window.history).replaceState&&t.replaceState($.pjax.state,document.title,i),(r=document.querySelector("#delete_release_confirm form"))&&r.setAttribute("action",u),a=s.querySelector("#release_id"),a.value?void 0:(a.value=o.id,$(s).append(''))}),$(document).on("click",".js-publish-release",function(e){return $("#release_draft").val("0")}),o=["is-loading","is-empty","is-valid","is-invalid","is-duplicate","is-pending"],s=function(e){var t;switch(e){case"is-valid":$(".release-target-wrapper").addClass("hidden");break;case"is-loading":break;default:$(".release-target-wrapper").removeClass("hidden")}return t=$(".js-release-tag"),t.removeClass(o.join(" ")),t.addClass(e)},e=function(e){return e.val()&&e.val()!==e.data("last-checked")?(s("is-loading"),$.ajax({url:e.attr("data-url"),type:"GET",data:{tag_name:e.val()},dataType:"json",success:function(t){return"duplicate"===t.status&&parseInt(e.attr("data-existing-id"))===parseInt(t.release_id)?void s("is-valid"):($(".js-release-tag .js-edit-release-link").attr("href",t.url),s("is-"+t.status))},error:function(e){return s("is-invalid")},complete:function(){return e.data("last-checked",e.val())}})):void 0},n=function(e,t,n){return t+"/releases/"+e+"/"+n},$(document).on("blur",".js-release-tag-field",function(t){return e($(this))}),$.observe(".js-release-tag-field",function(){e($(this))}),$(document).on("change",".js-release-tag",function(){var e,t,n,r,i,s,o,a,c;if(n=$(this),e=n.closest("form"),t=e.find(".js-previewable-comment-form"),t.length){for(r=t.data("base-preview-url"),r||(r=t.attr("data-preview-url"),r+=r.indexOf("?")>=0?"&":"?",t.data("base-preview-url",r)),i=[],c=n.find('input[name="release[tag_name]"], input[name="release[target_commitish]"]:checked'),s=0,a=c.length;a>s;s++)o=c[s],o.value&&i.push({name:o.name,value:o.value});return t.attr("data-preview-url",r+$.param(i))}}),$.observe(".js-release-form .js-previewable-comment-form",function(){$(this).closest("form").find(".js-release-tag").trigger("change")})}.call(this),function(){$(document).on("reveal.facebox",function(e){var t;return(t=document.querySelector("#facebox .js-fork-select-fragment"))?t.setAttribute("src",t.getAttribute("data-url")):void 0})}.call(this),function(){$(document).on("change",".js-pulse-period",function(e){var t;return t=$(e.target).attr("data-url"),$.pjax({url:t,container:"#js-repo-pjax-container"})})}.call(this),function(){var e,t,n=function(e,t){return function(){return e.apply(t,arguments)}};t=require("delegated-events"),e=function(){function e(){this.validate=n(this.validate,this),this.updateUpsell=n(this.updateUpsell,this),this.selectedPrivacyToggleElement=n(this.selectedPrivacyToggleElement,this),this.handlePrivacyChange=n(this.handlePrivacyChange,this),this.handleOwnerChange=n(this.handleOwnerChange,this),this.elements={ownerContainer:$(".js-owner-container"),iconPreviewPublic:$(".js-icon-preview-public"),iconPreviewPrivate:$(".js-icon-preview-private"),upgradeUpsell:$("#js-upgrade-container").hide(),upgradeConfirmationCheckbox:$(".js-confirm-upgrade"),upsells:$(".js-upgrade"),privacyToggles:$(".js-privacy-toggle"),privateRadio:$(".js-privacy-toggle[value=false]"),publicRadio:$(".js-privacy-toggle[value=true]"),repoNameField:$("input[type=text].js-repo-name"),form:$("#new_repository"),licenseContainer:$(".js-license-container"),suggestion:$(".js-reponame-suggestion")},this.current_login=$("input[name=owner]:checked").prop("value"),this.privateRepo=!1,this.changedPrivacyManually=!1,this.elements.ownerContainer.on("change","input[type=radio]",this.handleOwnerChange),this.elements.privacyToggles.on("change",function(e){return function(t){return e.handlePrivacyChange(t.targetElement,t)}}(this)),this.elements.upgradeUpsell.on("change input","input",this.validate),this.elements.form.on("repoform:validate",this.validate),this.elements.suggestion.on("click",function(e){return function(t){var n;return n=e.elements.repoNameField,n.val($(t.target).text()),n.trigger("change")}}(this)),this.handleOwnerChange(),this.validate()}return e.prototype.handleOwnerChange=function(){var e;return this.current_login=$("input[name=owner]:checked").prop("value"),this.elements.repoNameField.trigger("change"),e=this.elements.ownerContainer.find(".select-menu-item.selected"),this.changedPrivacyManually||("private"===e.attr("data-default")?this.elements.privateRadio.prop("checked","checked").change():this.elements.publicRadio.prop("checked","checked").change()),"yes"===e.attr("data-permission")?($(".with-permission-fields").show(),$(".without-permission-fields").hide(),$(".errored").show(),$("dl.warn").show()):($(".with-permission-fields").hide(),$(".without-permission-fields").show(),$(".errored").hide(),$("dl.warn").hide()),this.updateUpsell(),this.handlePrivacyChange()},e.prototype.handlePrivacyChange=function(e,t){var n;return null==e&&(e=this.selectedPrivacyToggleElement()),null==t&&(t=null),t&&!t.isTrigger&&(this.changedPrivacyManually=!0),n=this.elements.upgradeUpsell.find(".js-billing-section"),"false"===e.val()?(this.privateRepo=!0,this.elements.upgradeUpsell.show(),n.removeClass("has-removed-contents"),this.elements.upgradeUpsell.find("input[type=checkbox]").prop("checked","checked"),this.elements.iconPreviewPublic.hide(),this.elements.iconPreviewPrivate.show()):(this.privateRepo=!1,this.elements.upgradeUpsell.hide(),n.addClass("has-removed-contents"),this.elements.upgradeUpsell.find("input[type=checkbox]").prop("checked",null),this.elements.form.attr("action",this.elements.form.attr("data-url")),this.elements.iconPreviewPrivate.hide(),this.elements.iconPreviewPublic.show()),this.validate()},e.prototype.selectedPrivacyToggleElement=function(){return this.elements.privateRadio.is(":checked")?this.elements.privateRadio:this.elements.publicRadio},e.prototype.updateUpsell=function(){var e;return e=this.elements.upsells.filter("[data-login="+this.current_login+"]"),this.elements.upgradeUpsell.html(e)},e.prototype.validate=function(){var e,t;return t=!0,this.elements.repoNameField.is(".is-autocheck-successful")||(t=!1),e=this.elements.upgradeUpsell.find("input[type=checkbox]"),this.privateRepo&&e.length&&!e.is(":checked")&&(t=!1),this.elements.form.find("button.primary").prop("disabled",!t)},e}(),$(function(){return $(".page-new-repo").length?new e:void 0}),t.on("autocheck:send","#repository_name",function(e){var t,n,r;n=e.detail,t=$(this),r=t.closest("form").find("input[name=owner]:checked").val(),n.owner=r,t.trigger("repoform:validate")}),t.on("autocheck:complete","#repository_name",function(){return $(this).trigger("repoform:validate")}),t.on("autocheck:success","#repository_name",function(e){var t,n,r,i;(i=null!=(n=e.detail)?n.trim():void 0)&&(t=this.closest("dl.form"),t.classList.add("warn"),r=document.createElement("dd"),r.classList.add("warning"),r.innerHTML=i,t.append(r))})}.call(this),function(){$(document).on("pjax:end",function(){var e,t,n,r,i,s,o,a,c,u,l;if(l=$(document.head).find("meta[name='selected-link']").attr("value"),null!=l)for(n=$(".js-sidenav-container-pjax .js-selected-navigation-item").removeClass("selected"),e=0,i=n.length;i>e;e++)for(t=n[e],a=null!=(c=$(t).attr("data-selected-links"))?c:"",u=a.split(" "),r=0,s=u.length;s>r;r++)o=u[r],o===l&&$(t).addClass("selected")})}.call(this),function(){var e,t,n,r;e=require("github/fetch").fetch,n=function(){return document.body.classList.add("is-sending"),document.body.classList.remove("is-sent","is-not-sent")},r=function(){return document.body.classList.add("is-sent"),document.body.classList.remove("is-sending")},t=function(e){return e&&(document.querySelector(".js-sms-error").textContent=e),document.body.classList.add("is-not-sent"),document.body.classList.remove("is-sending")},$(document).on("ajaxSend",".js-send-auth-code",function(){n()}),$(document).on("ajaxSuccess",".js-send-auth-code",function(){r()}),$(document).on("ajaxError",".js-send-auth-code",function(e,n){t(n.responseText)}),$(document).on("click",".js-send-two-factor-code",function(){var i,s,o,a,c,u;o=this.form,i=o.querySelector(".js-country-code-select").value,c=o.querySelector(".js-sms-number").value,a=i+" "+c,u=o.querySelector(".js-two-factor-secret").value,n(),s=new FormData,s.append("number",a),s.append("two_factor_secret",u),s.append("authenticity_token",o.elements.authenticity_token.value),e(this.getAttribute("data-url"),{method:"post",body:s}).then(function(){var e,t,n,i;for(r(),i=o.querySelectorAll(".js-2fa-enable"),t=0,n=i.length;n>t;t++)e=i[t],e.disabled=!1;return o.querySelector(".js-2fa-otp").focus()})["catch"](function(e){var n,r,i,s,a,c;for(null!=(s=e.response)&&s.text().then(t),a=o.querySelectorAll(".js-2fa-enable"),c=[],r=0,i=a.length;i>r;r++)n=a[r],c.push(n.disabled=!0);return c})}),$(document).on("loading.facebox",function(){return"/settings/two_factor_authentication/configure"===window.location.pathname?($(".js-configure-sms-fallback .facebox-alert").text("").hide(),$(".js-configure-sms-fallback").show(),$(".js-verify-sms-fallback").hide()):void 0}),$(document).on("ajaxSuccess",".js-two-factor-set-sms-fallback",function(e,t){switch(t.status){case 200:case 201:return window.location.reload();case 202:return $(".js-configure-sms-fallback").hide(),$(".js-verify-sms-fallback").show(),$(".js-fallback-otp").focus()}}),$(document).on("ajaxError",".js-two-factor-set-sms-fallback",function(e,t){switch(t.status){case 422:return window.location.reload();case 429:return $(".js-configure-sms-fallback .facebox-alert").text(t.responseText).show(),!1}})}.call(this),function(){if(!("u2f"in window)&&"chrome"in window){var e=window.u2f={};e.EXTENSION_ID="kmendfapggjehodndflmmgagdbamhnfd",e.MessageTypes={U2F_REGISTER_REQUEST:"u2f_register_request",U2F_SIGN_REQUEST:"u2f_sign_request",U2F_REGISTER_RESPONSE:"u2f_register_response",U2F_SIGN_RESPONSE:"u2f_sign_response"},e.ErrorCodes={OK:0,OTHER_ERROR:1,BAD_REQUEST:2,CONFIGURATION_UNSUPPORTED:3,DEVICE_INELIGIBLE:4,TIMEOUT:5},e.Request,e.Response,e.Error,e.SignRequest,e.SignResponse,e.RegisterRequest,e.RegisterResponse,e.getMessagePort=function(t){if("undefined"!=typeof chrome&&chrome.runtime){var n={type:e.MessageTypes.U2F_SIGN_REQUEST,signRequests:[]};chrome.runtime.sendMessage(e.EXTENSION_ID,n,function(){chrome.runtime.lastError?e.getIframePort_(t):e.getChromeRuntimePort_(t)})}else e.isAndroidChrome_()?e.getAuthenticatorPort_(t):e.getIframePort_(t)},e.isAndroidChrome_=function(){var e=navigator.userAgent;return-1!=e.indexOf("Chrome")&&-1!=e.indexOf("Android")},e.getChromeRuntimePort_=function(t){var n=chrome.runtime.connect(e.EXTENSION_ID,{includeTlsChannelId:!0});setTimeout(function(){t(new e.WrappedChromeRuntimePort_(n))},0)},e.getAuthenticatorPort_=function(t){setTimeout(function(){t(new e.WrappedAuthenticatorPort_)},0)},e.WrappedChromeRuntimePort_=function(e){this.port_=e},e.WrappedChromeRuntimePort_.prototype.formatSignRequest_=function(t,n,r){return{type:e.MessageTypes.U2F_SIGN_REQUEST,signRequests:t,timeoutSeconds:n,requestId:r}},e.WrappedChromeRuntimePort_.prototype.formatRegisterRequest_=function(t,n,r,i){return{type:e.MessageTypes.U2F_REGISTER_REQUEST,signRequests:t,registerRequests:n,timeoutSeconds:r,requestId:i}},e.WrappedChromeRuntimePort_.prototype.postMessage=function(e){this.port_.postMessage(e)},e.WrappedChromeRuntimePort_.prototype.addEventListener=function(e,t){var n=e.toLowerCase();"message"==n||"onmessage"==n?this.port_.onMessage.addListener(function(e){t({data:e})}):console.error("WrappedChromeRuntimePort only supports onMessage")},e.WrappedAuthenticatorPort_=function(){this.requestId_=-1,this.requestObject_=null},e.WrappedAuthenticatorPort_.prototype.postMessage=function(e){var t=e;document.location=t},e.WrappedAuthenticatorPort_.prototype.addEventListener=function(e,t){var n=e.toLowerCase();if("message"==n){var r=this;window.addEventListener("message",r.onRequestUpdate_.bind(r,t),!1)}else console.error("WrappedAuthenticatorPort only supports message")},e.WrappedAuthenticatorPort_.prototype.onRequestUpdate_=function(e,t){var n=JSON.parse(t.data),r=(n.intentURL,n.errorCode,null);n.hasOwnProperty("data")&&(r=JSON.parse(n.data),r.requestId=this.requestId_),r=this.doResponseFixups_(r),e({data:r})},e.WrappedAuthenticatorPort_.prototype.doResponseFixups_=function(t){if(t.hasOwnProperty("responseData"))return t;if(this.requestObject_.type!=e.MessageTypes.U2F_SIGN_REQUEST)return{type:e.MessageTypes.U2F_REGISTER_RESPONSE,responseData:{errorCode:e.ErrorCodes.OTHER_ERROR,errorMessage:"Internal error: invalid response from Authenticator"}};var n=t.challenge;if("undefined"!=typeof n)for(var r=JSON.parse(atob(n)),i=(r.challenge,this.requestObject_.signData),s=null,o=0;or;r++)e=s[r],e.classList.add("hidden");return document.querySelector(".js-u2f-login-waiting").classList.remove("hidden"),t=document.querySelector(".js-u2f-auth-form"),o=t.querySelector(".js-u2f-auth-response"),a=JSON.parse(t.getAttribute("data-sign-requests")),n(a).then(function(e){return o.value=JSON.stringify(e),t.submit()})["catch"](function(e){var t;return t=function(){switch(e.code){case 4:return".js-u2f-auth-not-registered-error";case 5:return".js-u2f-auth-timeout";default:return".js-u2f-auth-error"}}(),document.querySelector(t).classList.remove("hidden"),document.querySelector(".js-u2f-login-waiting").classList.add("hidden")})},$(document).on("click",".js-u2f-auth-retry",function(){r()}),$.observe(".js-u2f-auth-form",function(){r()})))}.call(this),function(){var e;e=function(e){var t;return t=$(".js-hosted-account-linker-hosted"),t.toggleClass("hidden","tenant"!==e.value)},$(document).on("change",".js-hosted-account-linker",function(){return e(this)}),$(function(){var t;return(t=$(".js-hosted-account-linker:checked")[0])?e(t):void 0})}.call(this),function(){ +$.observe(".js-email-global-unsubscribe-form",function(){this.querySelector(".js-email-global-unsubscribe-submit").disabled=!0}),$(document).on("change",".js-email-global-unsubscribe-form",function(){var e,t;return e=function(){var e,n,r,i;for(r=this.querySelectorAll(".js-email-global-unsubscribe"),i=[],e=0,n=r.length;n>e;e++)t=r[e],t.checked&&i.push(t);return i}.call(this),this.querySelector(".js-email-global-unsubscribe-submit").disabled=e[0].defaultChecked}),$(document).on("ajaxSend",".js-remove-key",function(e){return $(this).addClass("disabled").find("span").text("Deleting\u2026")}),$(document).on("ajaxError",".js-remove-key",function(e){return $(this).removeClass("disabled").find("span").text("Error. Try again.")}),$(document).on("ajaxSuccess",".js-remove-key",function(e){return $(this).parents("li").remove(),0===$(".js-ssh-keys-box li").length?$(".js-no-ssh-keys").show():void 0}),$(document).on("ajaxSuccess",".js-leave-collaborated-repo",function(e){var t,n;t=e.target.getAttribute("data-repo-id"),n=document.querySelector(".js-collab-repo[data-repo-id='"+t+"']"),n.remove(),$.facebox.close()}),$(document).on("ajaxSuccess",".js-newsletter-unsubscribe-form",function(){var e,t,n,r,i;for(r=document.querySelectorAll(".js-newsletter-unsubscribe-message"),i=[],t=0,n=r.length;n>t;t++)e=r[t],i.push(e.classList.toggle("hidden"));return i}),$(document).on("click",".js-show-new-ssh-key-form",function(){return $(".js-new-ssh-key-box").toggle().find(".js-ssh-key-title").focus(),!1}),$(document).on("ajaxSuccess",".js-revoke-access-form",function(){var e,t,n;e=this.getAttribute("data-id"),n=this.getAttribute("data-type-name"),t=document.querySelector(".js-revoke-item[data-type='"+n+"'][data-id='"+e+"']"),$.facebox.close(),t.remove(),t.classList.contains("new-token")&&document.querySelector(".js-flash-new-token").remove()}),$(document).on("click",".js-delete-oauth-application-image",function(){var e,t,n;return e=$(this).closest(".js-uploadable-container"),e.removeClass("has-uploaded-logo"),t=e.find("img.js-image-field"),n=e.find("input.js-oauth-application-logo-id"),t.attr("src",""),n.val(""),!1}),$(document).on("click",".js-new-callback",function(e){var t,n;return e.preventDefault(),t=$(e.currentTarget).closest(".js-callback-urls"),n=t.find(".js-callback-url").first().clone(),n.removeClass("is-default-callback"),n.find("input").val(""),t.addClass("has-many"),$(e.currentTarget).before(n)}),$(document).on("click",".js-delete-callback",function(e){var t,n;return e.preventDefault(),t=$(e.currentTarget).closest(".js-callback-urls"),$(e.currentTarget).closest(".js-callback-url").remove(),n=t.find(".js-callback-url"),n.length<=1?t.removeClass("has-many"):void 0}),$(document).on("click",".js-oauth-application-whitelist .js-deny-this-request",function(e){return $(e.currentTarget).siblings("#state").val("denied"),$(e.currentTarget).closest(".js-org-application-access-form").submit()}),$(document).on("ajaxSuccess",".js-org-application-access-form",function(e,t,n,r){return window.location.reload()}),$(document).on("click",".js-user-rename-warning-continue",function(){var e,t,n,r,i;for(r=document.querySelectorAll(".js-user-rename-warning, .js-user-rename-form"),i=[],t=0,n=r.length;n>t;t++)e=r[t],i.push(e.classList.toggle("hidden"));return i}),$(document).on("change",".js-checkbox-scope",function(){var e,t,n,r,i,s;for(r=this.closest(".js-check-scope-container"),i=r.querySelectorAll(".js-checkbox-scope"),s=[],t=0,n=i.length;n>t;t++)e=i[t],e!==this?(e.checked=this.checked,s.push(e.disabled=this.checked)):s.push(void 0);return s})}.call(this),function(){var e,t,n,r,i,s,o,a,c,u,l,d,h,f=[].slice;r=require("github/feature-detection")["default"],i=require("github/fetch").fetchJSON,l=function(){var e;return e=1<=arguments.length?f.call(arguments,0):[],new Promise(function(t,n){return u2f.register.apply(u2f,f.call(e).concat([function(e){var r;return null!=e.errorCode&&0!==e.errorCode?(r=new Error("Device registration failed"),r.code=e.errorCode,n(r)):t(e)}]))})},(t=document.querySelector(".js-u2f-box"))&&(t.classList.toggle("available",r.u2f),s=function(e,t,n){return null!=n?e.setAttribute(t,JSON.stringify(n)):JSON.parse(e.getAttribute(t))},u=function(e){var t;return t=document.querySelector(".js-add-u2f-registration-form"),s(t,"data-sign-requests",e)},o=function(e){var t;return t=document.querySelector(".js-add-u2f-registration-form"),s(t,"data-register-requests",e)},d=function(e){return e.register_requests&&o(e.register_requests),e.sign_requests?u(e.sign_requests):void 0},$(document).on("ajaxSend",".js-u2f-registration-delete",function(){return this.closest(".js-u2f-registration").classList.add("is-sending")}),$(document).on("ajaxSuccess",".js-u2f-registration-delete",function(e,t){return d(t.responseJSON),this.closest(".js-u2f-registration").remove()}),$(document).on("click",".js-add-u2f-registration-link",function(e){var t,n;return t=document.querySelector(".js-new-u2f-registration"),t.classList.add("is-active"),t.classList.remove("is-showing-error"),n=document.querySelector(".js-u2f-registration-nickname-field"),n.focus()}),e=function(e){var n;return t=document.createElement("div"),t.innerHTML=e,n=t.firstChild,document.querySelector(".js-u2f-registrations").appendChild(n)},n=function(e,t){var n,r,i,s,o;for(s=document.querySelector(".js-new-u2f-registration"),s.classList.add("is-showing-error"),s.classList.remove("is-sending"),o=s.querySelectorAll(".js-u2f-error"),r=0,i=o.length;i>r;r++)n=o[r],n.classList.add("hidden");return n=s.querySelector(e),null!=t&&(n.textContent=t),n.classList.remove("hidden")},a=function(){var e;return e=document.querySelector(".js-new-u2f-registration"),e.classList.remove("is-sending","is-active"),document.querySelector(".js-u2f-registration-nickname-field").value=""},c=function(t){var r;return r=document.querySelector(".js-add-u2f-registration-form"),r.elements.response.value=JSON.stringify(t),i(r.action,{method:r.method,body:new FormData(r)}).then(function(t){return d(t),a(),e(t.registration)})["catch"](function(e){return null!=e.response?e.response.json().then(function(e){return d(e),n(".js-u2f-server-error",e.error)}):n(".js-u2f-network-error")})},h=function(){var e;return e=document.querySelector(".js-new-u2f-registration"),e.classList.add("is-sending"),e.classList.remove("is-showing-error"),l(o(),u()).then(c)["catch"](function(e){var t;return t=function(){switch(e.code){case 4:return".js-u2f-registered-error";case 5:return".js-u2f-timeout-error";default:return".js-u2f-other-error"}}(),n(t)})},$(document).on("click",".js-u2f-register-retry",function(){h()}),$(document).on("submit",".js-add-u2f-registration-form",function(e){return e.preventDefault(),h()}))}.call(this),function(){$(document).on("ajaxSuccess",".js-user-sessions-revoke",function(){return this.closest("li").remove()})}.call(this),function(){$(function(){return $(".js-email-notice-trigger").focus(function(){return $(".js-email-notice").addClass("notice-highlight")}),$(".js-email-notice-trigger").blur(function(){return $(".js-email-notice").removeClass("notice-highlight")})}),$.observe(".js-plan-choice:checked",{add:function(){return $(this).closest(".plan-row").addClass("selected")},remove:function(){return $(this).closest(".plan-row").removeClass("selected")}}),$.observe(".js-plan-row.selected",{add:function(){var e;return e=$(this).find(".js-choose-button"),e.text(e.attr("data-selected-text"))},remove:function(){var e;return e=$(this).find(".js-choose-button"),e.text(e.attr("data-default-text"))}}),$.observe(".js-plan-row.free-plan.selected, .js-plan-choice-label.plan-choice-free.open",{add:function(){return $("#js-signup-billing-fields").addClass("has-removed-contents")},remove:function(){return $("#js-signup-billing-fields").removeClass("has-removed-contents")}}),$.observe(".js-setup-organization:checked",{add:function(){var e;return e=$(".js-choose-plan-submit"),e.attr("data-default-text")||e.attr("data-default-text",e.text()),e.text(e.attr("data-org-text"))},remove:function(){var e;return e=$(".js-choose-plan-submit"),e.text(e.attr("data-default-text"))}})}.call(this),function(){var e,t,n;e=function(e){var t;return t=$(".js-site-search-form")[0],t.setAttribute("action",t.getAttribute("data-global-search-url")),$(".js-site-search").removeClass("repo-scope"),e.setAttribute("placeholder",e.getAttribute("data-global-scope-placeholder"))},n=function(e){var t;return t=$(".js-site-search-form")[0],t.setAttribute("action",t.getAttribute("data-repo-search-url")),$(".js-site-search").addClass("repo-scope"),e.setAttribute("placeholder",e.getAttribute("data-repo-scope-placeholder"))},t=function(t){var r,i;r=t.target,i=r.value,""===i&&"backspace"===t.hotkey&&r.classList.contains("is-clearable")&&e(r),""===i&&"esc"===t.hotkey&&n(r),r.classList.toggle("is-clearable",""===i)},$(document).on("focus",".js-site-search-field",function(){return $(this).on("keyup",t)}),$(document).on("blur",".js-site-search-field",function(){return $(this).off("keyup",t)}),$(document).on("focusout",".js-site-search-focus",function(){this.closest(".js-chromeless-input-container").classList.remove("focus"),""===this.value&&this.classList.contains("js-site-search-field")&&n(this)}),$(document).on("focusin",".js-site-search-focus",function(){this.closest(".js-chromeless-input-container").classList.add("focus")})}.call(this),function(){$.observe(".js-contact-javascript-flag",function(e){e.value="true"})}.call(this),function(){var e,t;e=function(){var e;return e=$("#js-features-branch-diagram"),e.removeClass("preload"),e.find("path").each(function(e){var t,n,r;return $(this).is("#js-branch-diagram-branch")?r="stroke-dashoffset 3.5s linear 0.25s":$(this).is("#js-branch-diagram-master")?r="stroke-dashoffset 4.1s linear 0s":$(this).is("#js-branch-diagram-arrow")&&(r="stroke-dashoffset 0.2s linear 4.3s"),n=$(this).get(0),t=n.getTotalLength(),n.style.transition=n.style.WebkitTransition="none",n.style.strokeDasharray=t+" "+t,n.style.strokeDashoffset=t,n.getBoundingClientRect(),n.style.transition=n.style.WebkitTransition=r,n.style.strokeDashoffset="0"})},$(document).on("click",".js-segmented-nav-button",function(e){var t,n;return n=$(this).attr("data-selected-tab"),t=$(this).closest(".js-segmented-nav"),t.find(".js-segmented-nav-button").removeClass("selected"),t.siblings(".js-selected-nav-tab").removeClass("active"),$(this).addClass("selected"),$("."+n).addClass("active"),e.preventDefault()}),t=function(){return $(document).scrollTop()>=$("#js-features-branch-diagram").offset().top-700?e():void 0},$.observe("#js-features-branch-diagram.preload",{add:function(){return $(window).on("scroll",t)},remove:function(){return $(window).off("scroll",t)}})}.call(this),function(){var e,t;e=require("github/fetch").fetchText,t=function(){var t;return t="/site/keyboard_shortcuts?url="+window.location.pathname,$.facebox(function(){return e(t).then(function(e){return $.facebox(e,"shortcuts")})})},$(document).on("click",".js-keyboard-shortcuts",function(){return t(),!1}),$(document).on("click",".js-see-all-keyboard-shortcuts",function(){return this.remove(),$(".facebox .js-hidden-pane").css("display","table-row-group"),!1}),$(document).on("keypress",function(e){return e.target===document.body&&63===e.which?($(".facebox").is($.visible)?$.facebox.close():t(),!1):void 0})}.call(this),function(){$.observe(".js-site-status-container",function(){var e,t,n,r,i;i=this,t=i.querySelector(".js-site-status-message"),n=i.querySelector(".js-site-status-time"),e=i.querySelector(".flash"),r=document.querySelector("meta[name=site-status-api-url]").content,window.fetch(r).then(function(e){return e.json()}).then(function(r){var s;return null!=r.status&&"good"!==r.status?(t.textContent=r.body,n.setAttribute("datetime",r.created_on),s="major"===r.status?"error":"warn",e.classList.add("flash-"+s),i.classList.remove("hidden")):void 0})})}.call(this),function(){$(document).on("ajaxSend",".js-action-ldap-create",function(){return $(this).find(".btn-sm").addClass("disabled")}),$(document).on("ajaxError",".js-action-ldap-create",function(e,t,n,r){return!1}),$(document).on("ajaxComplete",".js-action-ldap-create",function(e,t){var n,r;return n=$(this),r=500===t.status?"Oops, something went wrong.":t.responseText,n.find(".js-message").show().html(" – "+r),200===t.status&&n.find(".btn").hide(),!1})}.call(this),function(){!$.support.pjax||location.search||location.hash||$(function(){var e,t,n;return e=null!=(t=document.getElementById("issues-dashboard"))?t:document.getElementById("issues_list"),(n=$(e).attr("data-url"))?window.history.replaceState(null,document.title,n):void 0})}.call(this),function(){var e,t,n,r,i,s,o;r=require("github/fetch").fetchJSON,s=function(e){return setTimeout(function(){var t,n,r,i,s;for(i=document.querySelectorAll(".js-tree-finder-field"),s=[],n=0,r=i.length;r>n;n++)t=i[n],t.value=e,s.push(o(t));return s},0)},i=null,e=new WeakMap,o=function(t,n){var s,a,c,u,l,d,h,f,m,p,g,v,b,y;if(b=document.getElementById(t.getAttribute("data-results"))){if(!(d=e.get(b)))return void(null==i&&(i=r(b.getAttribute("data-url")).then(function(n){return e.set(b,n.paths),o(t),i=null})["catch"](function(){return i=null})));for(y=b.querySelector(".js-tree-browser-result-template").firstElementChild,p=b.querySelector(".js-tree-finder-results"),null==n&&(n=t.value),n?(h=$.fuzzyRegexp(n),v=$.fuzzySort(d,n)):v=d,b.classList.toggle("filterable-empty",!v.length),c=document.createDocumentFragment(),f=v.slice(0,50),s=0,a=f.length;a>s;s++)g=f[s],m=y.cloneNode(!0),u=m.getElementsByClassName("js-tree-finder-path")[0],l=new URL(u.href),l.pathname=l.pathname+"/"+g,u.href=l.href,u.textContent=g,$.fuzzyHighlight(u,n,h),c.appendChild(m);p.innerHTML="",p.appendChild(c),$(p).navigation("focus")}},$(document).onFocusedKeydown(".js-tree-finder-field",function(e){return o(this),$(this).on("throttled:input."+e,function(){return o(this)}),function(e){return"esc"===e.hotkey?(history.back(),e.preventDefault()):void 0}}),t=function(){var e;return e=$("