🌈 Sync 2026-08-11 02:29:57

This commit is contained in:
github-actions[bot] committed 2026-08-11 02:29:57 +08:00
1 parent f8bdc4459f
commit 412c262edf
73 files changed
+9791 -5915

No files matched your search

+29 -33
View File
@@ -575,7 +575,7 @@ do_run_file()
ln -s "$meta_core_path" /etc/openclash/clash
if [ -n "$OIX_TOKEN" ] || [ "$core_type" == "Oix" ]; then
if [ -n "$OIX_TOKEN" ]; then
core_type="Oix"
elif [ "$smart_enable" -eq 1 ] || [ "$core_type" == "Smart" ]; then
core_type="Smart"
@@ -590,7 +590,6 @@ do_run_file()
[ ! -f "$CLASH" ] || { [ "$core_type" = "Smart" ] && [ -z "$($CLASH -v | grep 'smart')" ] && [ -z "$($CLASH -v | grep 'oix')" ]; } || { [ "$core_type" = "Oix" ] && [ -z "$($CLASH -v | grep 'oix')" ]; } && {
LOG_TIP "【$core_type】Core is not Detected installed, Ready to Download..."
rm -rf "/tmp/clash_last_version"
/usr/share/openclash/openclash_core.sh "$core_type"
if [ ! -f "$meta_core_path" ]; then
start_fail
@@ -807,7 +806,6 @@ check_core_status()
fi
write_run_quick
SLOG_CLEAN
} >/dev/null 2>&1
start_run_core()
@@ -826,7 +824,7 @@ start_run_core()
procd_append_param env CLASH_AGE_SECRET_KEY="$SECRET_KEY"
procd_append_param env OIX_TOKEN="$OIX_TOKEN"
procd_append_param env OIX_PARAMS="$OIX_PARAMS"
procd_set_param command /bin/sh -c "$CLASH -d $CLASH_CONFIG -f \"$CONFIG_FILE\" >> $LOG_FILE 2>&1"
procd_set_param command /bin/sh -c "exec $CLASH -d $CLASH_CONFIG -f \"$CONFIG_FILE\" >> $LOG_FILE 2>&1"
procd_set_param user "root"
procd_set_param group "nogroup"
procd_set_param limits nproc="unlimited" as="unlimited" memlock="unlimited" nofile="1000000 1000000"
@@ -1727,7 +1725,7 @@ if [ -n "$FW4" ]; then
fi
if [ "$router_self_proxy" = 1 ]; then
nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }'
nft insert rule inet fw4 nat_output position 0 skgid != 65534 meta nfproto {ipv6} ip6 nexthdr {tcp,udp} th dport 53 ip6 daddr {::/0} counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\"
nft insert rule inet fw4 nat_output position 0 skgid != 65534 meta nfproto {ipv6} ip6 nexthdr {tcp,udp} th dport 53 ip6 daddr {::1} counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\"
fi
elif [ "$enable_redirect_dns" -eq 2 ]; then
if [ "$lan_ac_mode" != "1" ]; then
@@ -1748,7 +1746,7 @@ if [ -n "$FW4" ]; then
nft 'insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} ip6 nexthdr {tcp,udp} th dport 53 counter jump openclash_dns_redirect'
if [ "$router_self_proxy" = 1 ]; then
nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }'
nft insert rule inet fw4 nat_output position 0 meta nfproto {ipv6} ip6 nexthdr {tcp,udp} th dport 53 ip6 daddr {::/0} meta skgid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\"
nft insert rule inet fw4 nat_output position 0 meta nfproto {ipv6} ip6 nexthdr {tcp,udp} th dport 53 ip6 daddr {::1} meta skgid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\"
fi
fi
fi
@@ -2563,8 +2561,8 @@ if [ -z "$FW4" ]; then
ip6tables -t nat -I PREROUTING -p tcp --dport 53 -m set --match-set lan_ac_white_macs src -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
fi
if [ "$router_self_proxy" = 1 ]; then
ip6tables -t nat -I OUTPUT -p tcp --dport 53 -d ::/0 $noowner -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
ip6tables -t nat -I OUTPUT -p udp --dport 53 -d ::/0 $noowner -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
ip6tables -t nat -I OUTPUT -p tcp --dport 53 -d ::1 $noowner -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
ip6tables -t nat -I OUTPUT -p udp --dport 53 -d ::1 $noowner -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
fi
elif [ "$enable_redirect_dns" -eq 2 ]; then
ip6tables -t nat -N openclash_dns_redirect
@@ -2590,8 +2588,8 @@ if [ -z "$FW4" ]; then
ip6tables -t nat -I PREROUTING -p udp --dport 53 -j openclash_dns_redirect
ip6tables -t nat -I PREROUTING -p tcp --dport 53 -j openclash_dns_redirect
if [ "$router_self_proxy" = 1 ]; then
ip6tables -t nat -I OUTPUT -p udp --dport 53 -d ::/0 $noowner -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack"
ip6tables -t nat -I OUTPUT -p tcp --dport 53 -d ::/0 $noowner -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack"
ip6tables -t nat -I OUTPUT -p udp --dport 53 -d ::1 $noowner -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack"
ip6tables -t nat -I OUTPUT -p tcp --dport 53 -d ::1 $noowner -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack"
fi
fi
fi
@@ -3159,6 +3157,7 @@ EOF
SMART_ENABLE_LGBM:int_bool \
SMART_POLICY_PRIORITY:string \
SMART_PREFER_ASN:int_bool \
SMART_TOLERANCE:int \
SKIP_PROXY_ADDRESS:int_bool \
SMALL_FLASH_MEMORY:int_bool \
SOCKS_PORT:int \
@@ -3421,11 +3420,14 @@ EOF
yaml_data = YAML.load(yaml_override_content)
if yaml_data.is_a?(Hash)
Value = YAML.load_file('$CONFIG_FILE')
Overwrite_Value = YAML.overwrite(Value, yaml_data)
File.open('$CONFIG_FILE', 'w') do |f|
YAML.dump(Overwrite_Value, f)
if File.exist?('/tmp/yaml_overwrite_marshal')
Value = Marshal.load(File.open('/tmp/yaml_overwrite_marshal', 'rb') { |f| f.read })
else
Value = YAML.load_file('$CONFIG_FILE')
end
Overwrite_Value = YAML.overwrite(Value, yaml_data)
YAML.dump(Overwrite_Value, '$CONFIG_FILE')
File.open('/tmp/yaml_overwrite_marshal', 'wb') { |f| Marshal.dump(Overwrite_Value, f) }
else
YAML.LOG_WARN('Invalid YAML Override format, skipped...')
end
@@ -3444,13 +3446,15 @@ if [ -f "/tmp/yaml_openclash_ruby_parts/$OPENCLASH_OVERWRITE_SID" ]; then
ruby_code=$(cat "/tmp/yaml_openclash_ruby_parts/$OPENCLASH_OVERWRITE_SID")
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
begin
Value = YAML.load_file('$CONFIG_FILE')
if File.exist?('/tmp/yaml_overwrite_marshal')
Value = Marshal.load(File.open('/tmp/yaml_overwrite_marshal', 'rb') { |f| f.read })
else
Value = YAML.load_file('$CONFIG_FILE')
end
threads = []
$ruby_code
threads.each(&:join)
File.open('$CONFIG_FILE', 'w') do |f|
YAML.dump(Value, f)
end
YAML.dump(Value, '$CONFIG_FILE')
rescue Exception => e
YAML.LOG_ERROR('Set Custom Overwrite Script Failed,【%s】' % [e.message])
end
@@ -3587,6 +3591,7 @@ get_config()
smart_policy_priority=$(uci_get_config "smart_policy_priority" || echo 0)
smart_enable_lgbm=$(uci_get_config "smart_enable_lgbm" || echo 0)
smart_prefer_asn=$(uci_get_config "smart_prefer_asn" || echo 0)
smart_tolerance=$(uci_get_config "smart_tolerance" || echo 0)
[ -z "$dns_port" ] && dns_port=7874 && uci -q set openclash.config.dns_port=7874
uci -q commit openclash
@@ -3595,7 +3600,7 @@ get_config()
start_service()
{
enable=$(uci_get_config "enable")
[ "$enable" != "1" ] && LOG_WARN "OpenClash Now Disabled, Need Start From Luci Page, Exit..." && SLOG_CLEAN && exit 0
[ "$enable" != "1" ] && LOG_WARN "OpenClash Now Disabled, Need Start From Luci Page, Exit..." && exit 0
if procd_running "openclash" >/dev/null; then
LOG_TIP "OpenClash Already Running, Exit..."
@@ -3633,7 +3638,7 @@ start_service()
/usr/share/openclash/yml_rules_change.sh \
"$enable_custom_clash_rules" "$TMP_CONFIG_FILE"\
"$enable_rule_proxy" "$router_self_proxy" "$lan_ip" "$enable_redirect_dns" "$en_mode"\
"$auto_smart_switch" "$smart_collect" "$smart_collect_rate" "$smart_policy_priority" "$smart_enable_lgbm" "$smart_prefer_asn"
"$auto_smart_switch" "$smart_collect" "$smart_collect_rate" "$smart_policy_priority" "$smart_enable_lgbm" "$smart_prefer_asn" "$smart_tolerance"
#Custom overwrite
if [ -f "/tmp/yaml_overwrite.sh" ]; then
@@ -3658,9 +3663,7 @@ start_service()
threads = []
$ruby_code
threads.each(&:join)
File.open('$yaml_file', 'w') do |f|
YAML.dump(Value, f)
end
YAML.dump(Value, '$yaml_file')
rescue Exception => e
YAML.LOG_ERROR('Set Custom Overwrite Script Failed,【%s】' % [e.message])
end
@@ -3696,7 +3699,7 @@ start_service()
end
end
threads.each(&:join)
File.open('$TMP_CONFIG_FILE', 'w') { |f| YAML.dump(Value, f) }
YAML.dump(Value, '$TMP_CONFIG_FILE')
rescue Exception => e
YAML.LOG_ERROR('Edit Provider Path Failed,【%s】' % [e.message])
end
@@ -3751,11 +3754,6 @@ stop_service()
for i in $(seq 1 10); do
procd_running "openclash" >/dev/null && sleep 1 || break
done
if procd_running "openclash" >/dev/null; then
for pid in $(pidof clash 2>/dev/null); do
kill -9 "$pid" 2>/dev/null || true
done
fi
LOG_OUT "Step 4: Restart Dnsmasq..."
revert_dnsmasq
@@ -3764,14 +3762,13 @@ stop_service()
LOG_TIP "OpenClash Already Stop!"
if [ "$enable" != "1" ]; then
rm -rf /tmp/clash_last_version \
/tmp/openclash_last_version \
rm -rf /tmp/openclash_version_history.json \
/tmp/openclash_cdn_info.json \
/tmp/openclash.change \
/tmp/openclash_announcement \
${DNSMASQ_CONF_DIR}/dnsmasq_openclash_chnroute_pass.conf \
${DNSMASQ_CONF_DIR}/dnsmasq_openclash_chnroute6_pass.conf \
${DNSMASQ_CONF_DIR}/dnsmasq_openclash_custom_domain.conf
SLOG_CLEAN
fi
del_cron
@@ -3839,7 +3836,6 @@ reload_service()
if pidof clash >/dev/null && [ "$enable" == "1" ] && [ "$1" == "revert" ]; then
revert_firewall
revert_dnsmasq
SLOG_CLEAN
fi
if pidof clash >/dev/null && [ "$enable" == "1" ] && [ "$1" == "restore" ]; then
do_run_mode
@@ -119,7 +119,7 @@ CONFIG_FILE="$1"
# rescue Exception => e
# puts '${LOGTIME} [error] Set General Failed,【' + e.message + '】';
# ensure
# File.open('$CONFIG_FILE','w') {|f| YAML.dump(Value, f)};
# YAML.dump(Value, '$CONFIG_FILE');
# end" 2>/dev/null >> $LOG_FILE
exit 0
@@ -89,10 +89,13 @@ case "${DISTRIB_ARCH}" in
aarch64_*)
CORE_ARCH="linux-arm64"
;;
arm_*_neon-vfp*)
armeb_*)
CORE_ARCH="0"
;;
arm_cortex-a5|arm_cortex-a5[^0-9]*|arm_cortex-a7|arm_cortex-a7[^0-9]*|arm_cortex-a8*|arm_cortex-a9*|arm_cortex-a12*|arm_cortex-a15*|arm_cortex-a17*)
CORE_ARCH="linux-armv7"
;;
arm_*_neon|arm_*_vfp*)
arm_arm1176jzf-s*|arm_arm1136*|arm_mpcore*)
CORE_ARCH="linux-armv6"
;;
arm*)
@@ -101,6 +104,9 @@ case "${DISTRIB_ARCH}" in
i386_*)
CORE_ARCH="linux-386"
;;
mips64el_*)
CORE_ARCH="linux-mips64le"
;;
mips64_*)
CORE_ARCH="linux-mips64"
;;
@@ -110,6 +116,12 @@ case "${DISTRIB_ARCH}" in
mipsel_*)
CORE_ARCH="linux-mipsle-softfloat"
;;
riscv64*)
CORE_ARCH="linux-riscv64"
;;
loongarch64*|loongarch_*)
CORE_ARCH="linux-loong64-abi2"
;;
x86_64)
CORE_ARCH="linux-amd64-v1"
;;
@@ -22,19 +22,19 @@ module YAML
end
def self.load_file(filename, *args, **kwargs)
yaml_content = File.read(filename, mode: "r:bom|utf-8")
secret = nil
if kwargs.key?(:secret)
secret = kwargs.delete(:secret)
end
if yaml_content.include?("BEGIN AGE ENCRYPTED FILE")
header = File.binread(filename, 512).to_s
if header.include?("BEGIN AGE ENCRYPTED FILE")
yaml_content = File.read(filename, mode: "r:bom|utf-8")
if secret && secret.to_s.strip != ""
decrypted = decrypt_content_with_secret(secret.to_s, yaml_content)
if decrypted && !decrypted.empty? && !decrypted.include?("BEGIN AGE ENCRYPTED FILE")
processed = fix_short_id_quotes(decrypted)
return load(processed, *args, **kwargs)
return fix_and_load(decrypted, *args, **kwargs)
else
raise "Decrypted content empty or still encrypted: [#{filename}]"
end
@@ -46,8 +46,7 @@ module YAML
begin
decrypted = decrypt_content_with_secret(sec, yaml_content)
if decrypted && !decrypted.empty? && !decrypted.include?("BEGIN AGE ENCRYPTED FILE")
processed = fix_short_id_quotes(decrypted)
return load(processed, *args, **kwargs)
return fix_and_load(decrypted, *args, **kwargs)
end
rescue => e
last_error = e.message
@@ -58,13 +57,51 @@ module YAML
raise "Encrypted file: decryption failed for [#{filename}]: [#{detail}]"
end
processed_content = fix_short_id_quotes(yaml_content)
load(processed_content, *args, **kwargs)
base64, short_id, protocol_param = File.open(filename, "r:bom|utf-8") do |io|
scan_for_fixes(io)
end
if base64 || protocol_param
fix_and_load(File.read(filename, mode: "r:bom|utf-8"), *args, **kwargs)
elsif short_id
fixed = File.open(filename, "r:bom|utf-8") { |io| fix_short_id_text(io) }
begin
load(fixed, *args, **kwargs)
rescue => e
raise "fix short-id values type failed: #{e.message}"
end
else
result = File.open(filename, "r:bom|utf-8") do |io|
load(io, *args, **kwargs)
end
if result.nil? || result == false
result = fix_and_load(File.read(filename, mode: "r:bom|utf-8"), *args, **kwargs)
end
result
end
end
def self.dump(obj, io = nil, **options)
yaml_content = original_dump(obj, **options)
processed = fix_short_id_quotes(yaml_content)
if obj.nil? || obj == false
target = ""
if io.is_a?(String)
target = " [#{io}]"
elsif io && io.respond_to?(:path)
target = " [#{io.path}]"
elsif options.key?(:filename)
target = " [#{options[:filename]}]"
end
raise "YAML.dump: refusing to write nil/false config content#{target} (previous load may have failed)"
end
if io.is_a?(String)
dump_to_path(obj, io, **options)
else
dump_to_io(obj, io, **options)
end
end
def self.dump_to_io(obj, io = nil, **options)
public_key = nil
fname = nil
if options.key?(:public)
@@ -86,7 +123,11 @@ module YAML
end
end
needs_fix = contains_short_id?(obj)
if public_key && public_key.to_s.strip != ""
yaml_content = original_dump(obj, **options)
processed = needs_fix ? fix_short_id_quotes(yaml_content) : yaml_content
begin
encrypted = encrypt_content_with_public(public_key.to_s, processed)
if encrypted && !encrypted.empty?
@@ -108,15 +149,40 @@ module YAML
end
if io.nil?
processed
yaml_content = original_dump(obj, **options)
needs_fix ? fix_short_id_quotes(yaml_content) : yaml_content
elsif io.respond_to?(:write)
io.write(processed)
if needs_fix
fix_short_id_text(original_dump(obj, **options), io)
else
original_dump(obj, io, **options)
end
io
else
processed
yaml_content = original_dump(obj, **options)
needs_fix ? fix_short_id_quotes(yaml_content) : yaml_content
end
end
def self.dump_to_path(obj, path, **options)
real = File.symlink?(path) ? File.realpath(path) : path
dir = File.dirname(real)
tmp = File.join(dir, ".#{File.basename(real)}.tmp#{Process.pid}.#{rand(1000)}")
mode = File.exist?(real) ? File.stat(real).mode & 07777 : nil
begin
File.open(tmp, 'w') { |f| dump_to_io(obj, f, **options.merge(filename: real)) }
File.chmod(mode, tmp) if mode
File.rename(tmp, real)
rescue Exception
begin
File.unlink(tmp) if File.exist?(tmp)
rescue
end
raise
end
path
end
def self.popen_stream(cmd, input, chunk_size: 64 * 1024)
output = String.new
IO.popen(cmd, 'r+', err: [:child, :out]) do |io|
@@ -229,75 +295,162 @@ module YAML
# Input: short-id: "1600e237" -> Output: short-id: "1600e237"
# Input: short-id: null -> Output: short-id: ""
def self.fix_short_id_quotes(yaml_content)
def self.fix_and_load(yaml_content, *args, **kwargs)
yaml_content = decode64(yaml_content)
return yaml_content unless yaml_content.include?('short-id:')
# Fix bare protocol-param values that break YAML parsing (e.g. "1.2.3.4:8080#test")
yaml_content.gsub!(/^(\s*protocol-param:\s+)([^\s"'][^"\n\r]*[#:][^"\n\r]*)$/, '\1"\2"')
return load(yaml_content, *args, **kwargs) unless yaml_content.include?('short-id:')
begin
stream = Psych.parse_stream(yaml_content)
traverse = lambda do |node|
case node
when Psych::Nodes::Mapping
children = node.children || []
i = 0
while i < children.length
key = children[i]
val = children[i + 1]
if key.is_a?(Psych::Nodes::Scalar) && key.value == 'short-id'
if val.is_a?(Psych::Nodes::Scalar)
is_null_scalar = (val.tag == 'tag:yaml.org,2002:null') || (val.tag == '!!null') || (val.value =~ /^\s*(~|null|NULL|Null)\s*$/)
unless is_null_scalar
val.tag = nil
val.style = defined?(Psych::Nodes::Scalar::DOUBLE_QUOTED) ? Psych::Nodes::Scalar::DOUBLE_QUOTED : 2
end
elsif val.is_a?(Psych::Nodes::Sequence)
val.children.each do |child|
if child.is_a?(Psych::Nodes::Scalar)
is_null_child = (child.tag == 'tag:yaml.org,2002:null') || (child.tag == '!!null') || (child.value =~ /^\s*(~|null|NULL|Null)\s*$/)
unless is_null_child
child.tag = nil
child.style = defined?(Psych::Nodes::Scalar::DOUBLE_QUOTED) ? Psych::Nodes::Scalar::DOUBLE_QUOTED : 2
end
end
end
end
else
traverse.call(key) if key.respond_to?(:children)
traverse.call(val) if val.respond_to?(:children)
end
i += 2
end
when Psych::Nodes::Sequence
(node.children || []).each { |c| traverse.call(c) }
when Psych::Nodes::Document, Psych::Nodes::Stream
(node.children || []).each { |c| traverse.call(c) }
else
if node.respond_to?(:children)
(node.children || []).each { |c| traverse.call(c) }
end
end
end
stream.children.each do |doc_node|
if doc_node.is_a?(Psych::Nodes::Document)
traverse.call(doc_node.root) if doc_node.root
end
end
if stream.respond_to?(:to_yaml)
processed_yaml = stream.to_yaml
processed_yaml = processed_yaml.gsub(/^([ \t]*short-id:\s*)!\s*/, "\\1")
processed_yaml
else
yaml_content
end
load(fix_short_id_text(yaml_content), *args, **kwargs)
rescue => e
raise "fix short-id values type failed: #{e.message}"
end
end
def self.quote_short_id_scalar(value)
v = value.strip
return value if v.empty?
return '""' if v =~ /\A(?:~|null|NULL|Null)\z/
if v.start_with?("'")
if (m = v.match(/\A'((?:[^']|'')*)'(\s+#.*)?\z/))
inner = m[1].gsub("''", "'")
return "\"#{inner.gsub(/["\\]/) { |c| "\\#{c}" }}\"#{m[2]}"
end
return value
end
return value if v.start_with?('"')
return value if v =~ /[:{}\[\],|>]/
if (m = v.match(/\A(\S+)(\s+#.*)?\z/))
"\"#{m[1].gsub('"', '\\"')}\"#{m[2]}"
else
"\"#{v.gsub('"', '\\"')}\""
end
end
def self.fix_short_id_text(yaml_content, output = nil)
out = output || String.new
in_seq = false
seq_indent = -1
in_block = false
block_indent = -1
pending = nil
yaml_content.each_line do |line|
if in_block
if line.strip.empty? || (line =~ /^(\s*)/ && Regexp.last_match(1).length > block_indent)
out << line
next
else
in_block = false
end
end
if pending
if (m = line.match(/^(\s*)-(\s*)(.*?)(\r?\n)?\z/)) && m[1].length >= seq_indent
out << pending
in_seq = true
else
out << pending.sub(/^(\s*)short-id:.*?(\r?\n)?\z/, '\1short-id: ""\2')
in_seq = false
end
pending = nil
end
if (m = line.match(/^(\s*)short-id:(\s*)(.*?)(\r?\n)?\z/))
indent = m[1]
rest = m[3].to_s.strip
if rest.empty? || rest.start_with?('#')
in_seq = true
seq_indent = indent.length
pending = line
else
in_seq = false
out << indent + "short-id:" + m[2] + quote_short_id_scalar(rest) + m[4].to_s
end
elsif (m = line.match(/^(\s*)[^:\s][^:]*:\s*[|>](\s*.*)?$/))
in_block = true
in_seq = false
block_indent = m[1].length
out << line
elsif line.strip.empty?
out << line
elsif in_seq && (m = line.match(/^(\s*)-(\s*)(.*?)(\r?\n)?\z/)) && m[1].length >= seq_indent
out << m[1] + "-" + m[2] + quote_short_id_scalar(m[3]) + m[4].to_s
else
in_seq = false
out << line
end
end
if pending
out << pending.sub(/^(\s*)short-id:.*?(\r?\n)?\z/, '\1short-id: ""\2')
end
out
end
def self.fix_short_id_quotes(yaml_content)
begin
fix_short_id_text(yaml_content)
rescue => e
raise "fix short-id values type failed: #{e.message}"
end
end
def self.scan_for_fixes(io)
base64 = false
short_id = false
protocol_param = false
first_nonempty_seen = false
buffer = String.new
chunk_size = 64 * 1024
while (chunk = io.read(chunk_size))
buffer << chunk
unless first_nonempty_seen
if (idx = buffer.index("\n"))
stripped = buffer[0...idx].strip
if !stripped.empty?
first_nonempty_seen = true
base64 = stripped.match?(/\A[A-Za-z0-9+\/=]+\z/)
end
end
end
short_id ||= buffer.include?('short-id:')
protocol_param ||= buffer.include?('protocol-param:')
if first_nonempty_seen && buffer.bytesize > chunk_size + 4096
buffer = buffer[-4096, 4096]
end
break if base64 || short_id || protocol_param
end
unless first_nonempty_seen
stripped = buffer.strip
base64 = !stripped.empty? && stripped.match?(/\A[A-Za-z0-9+\/=]+\z/)
end
[base64, short_id, protocol_param]
end
def self.contains_short_id?(obj, depth = 0)
return false if depth > 64
case obj
when Hash
return true if obj.key?('short-id') || obj.key?(:"short-id")
obj.each_value { |v| return true if contains_short_id?(v, depth + 1) }
false
when Array
obj.any? { |v| contains_short_id?(v, depth + 1) }
else
false
end
end
def self.overwrite(base, override)
return override if base.nil?
return base if override.nil?
@@ -1,48 +0,0 @@
#!/bin/bash
. /usr/share/openclash/openclash_curl.sh
. /usr/share/openclash/uci.sh
set_lock() {
exec 884>"/tmp/lock/openclash_clash_version.lock" 2>/dev/null
flock -x 884 2>/dev/null
}
del_lock() {
flock -u 884 2>/dev/null
rm -rf "/tmp/lock/openclash_clash_version.lock" 2>/dev/null
}
set_lock
DOWNLOAD_FILE="/tmp/clash_last_version"
RELEASE_BRANCH=$(uci_get_config "release_branch" || echo "master")
github_address_mod=$(uci_get_config "github_address_mod" || echo 0)
CORE_TYPE=$(uci_get_config "core_type")
OIX_TOKEN=$(uci_get_config "oix_token")
if [ -n "$1" ]; then
github_address_mod="$1"
fi
if [ "$CORE_TYPE" = "Oix" ] || [ -n "$OIX_TOKEN" ]; then
OIX_VERSION_URL="https://github.com/vernesong/mihomo-oix/releases/download/Pre-Alpha/version.txt"
OIX_VERSION_P_URL="https://dl.dler.io/mihomo-oix/version.txt?tag=Pre-Alpha"
if [ "$github_address_mod" != "0" ] && [ "$github_address_mod" != "https://cdn.jsdelivr.net/" ] && [ "$github_address_mod" != "https://fastly.jsdelivr.net/" ] && [ "$github_address_mod" != "https://testingcf.jsdelivr.net/" ]; then
DOWNLOAD_URL="${github_address_mod}${OIX_VERSION_URL}"
else
DOWNLOAD_URL="$OIX_VERSION_P_URL"
fi
else
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
DOWNLOAD_URL="${github_address_mod}gh/vernesong/OpenClash@core/${RELEASE_BRANCH}/core_version"
else
DOWNLOAD_URL="${github_address_mod}https://raw.githubusercontent.com/vernesong/OpenClash/core/${RELEASE_BRANCH}/core_version"
fi
else
DOWNLOAD_URL="https://raw.githubusercontent.com/vernesong/OpenClash/core/${RELEASE_BRANCH}/core_version"
fi
fi
DOWNLOAD_FILE_CURL "$DOWNLOAD_URL" "$DOWNLOAD_FILE" "$DOWNLOAD_FILE"
del_lock
@@ -6,7 +6,7 @@ LOG_FILE="/tmp/openclash.log"
LOG_OUT()
{
if [ -n "${1}" ]; then
echo -e "${1}" > $START_LOG
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Info] ${1}" >> $START_LOG
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Info] ${1}" >> $LOG_FILE
fi
}
@@ -14,7 +14,7 @@ LOG_OUT()
LOG_TIP()
{
if [ -n "${1}" ]; then
echo -e "${1}" > $START_LOG
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Tip] ${1}" >> $START_LOG
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Tip] ${1}" >> $LOG_FILE
fi
}
@@ -22,7 +22,7 @@ LOG_TIP()
LOG_WARN()
{
if [ -n "${1}" ]; then
echo -e "${1}" > $START_LOG
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Warning] ${1}" >> $START_LOG
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Warning] ${1}" >> $LOG_FILE
fi
}
@@ -30,7 +30,7 @@ LOG_WARN()
LOG_ERROR()
{
if [ -n "${1}" ]; then
echo -e "${1}" > $START_LOG
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Error] ${1}" >> $START_LOG
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Error] ${1}" >> $LOG_FILE
fi
}
@@ -48,14 +48,3 @@ LOG_WATCHDOG()
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Watchdog] ${1}" >> $LOG_FILE
fi
}
LOG_ALERT()
{
echo -e "$(tail -n 20 $LOG_FILE |grep -E 'level=fatal|level=error' |awk 'END {print}')" > $START_LOG
sleep 3
}
SLOG_CLEAN()
{
echo "##FINISH##" > $START_LOG
}
@@ -67,6 +67,24 @@ config_test()
fi
}
yaml_sub_validate()
{
rm -f /tmp/yaml_sub_status 2>/dev/null
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
begin
Value = YAML.load_file('$CFG_FILE')
unless Value.key?('proxies') || Value.key?('proxy-providers')
File.open('/tmp/yaml_sub_status', 'w') { |f| f.puts 'NO_CONTENT' }
end
rescue Exception => e
YAML.LOG_ERROR('Unable To Parse Config File,【' + e.message + '】')
system 'rm -rf ${CFG_FILE} 2>/dev/null'
end
" 2>/dev/null >> $LOG_FILE
YAML_SUB_STATUS=$(cat /tmp/yaml_sub_status 2>/dev/null)
rm -f /tmp/yaml_sub_status 2>/dev/null
}
config_download()
{
LOG_TIP "Config File【$name】Downloading User-Agent【$sub_ua】..."
@@ -152,7 +170,7 @@ config_cus_up()
YAML.LOG_ERROR('Filter Proxies Failed,【' + e.message + '】');
ensure
begin
File.open('$CFG_FILE','w') {|f| YAML.dump(Value, f)};
YAML.dump(Value, '$CFG_FILE');
rescue Exception => e
YAML.LOG_ERROR('Write file failed:【%s】' % [e.message])
end
@@ -222,8 +240,6 @@ config_download_direct()
if [ "$DOWNLOAD_RESULT" -eq 0 ] && [ -s "$CFG_FILE" ]; then
#prevent ruby unexpected error
sed -i -E 's/protocol-param: ([^,'"'"'"''}( *#)\n\r]+)/protocol-param: "\1"/g' "$CFG_FILE" 2>/dev/null
sed -i '/^ \{0,\}enhanced-mode:/d' "$CFG_FILE" >/dev/null 2>&1
config_test
if [ $? -ne 0 ]; then
LOG_ERROR "Config File Tested Failed, Please Check The Log Infos!"
@@ -231,14 +247,7 @@ config_download_direct()
config_error
return
fi
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
begin
YAML.load_file('$CFG_FILE');
rescue Exception => e
YAML.LOG_ERROR('Unable To Parse Config File,【' + e.message + '】');
system 'rm -rf ${CFG_FILE} 2>/dev/null'
end
" 2>/dev/null >> $LOG_FILE
yaml_sub_validate
if [ $? -ne 0 ]; then
LOG_ERROR "Ruby Works Abnormally, Please Check The Ruby Library Depends!"
only_download=1
@@ -248,7 +257,7 @@ config_download_direct()
LOG_OUT "Config File Format Validation Failed..."
change_dns
config_error
elif ! "$(ruby_read "$CFG_FILE" ".key?('proxies')")" && ! "$(ruby_read "$CFG_FILE" ".key?('proxy-providers')")" ; then
elif [ "$YAML_SUB_STATUS" = "NO_CONTENT" ]; then
LOG_ERROR "Updated Config【$name】Has No Proxy Field, Update Exit..."
change_dns
config_error
@@ -434,7 +443,6 @@ sub_info_get()
config_download
if [ "$DOWNLOAD_RESULT" -eq 0 ] && [ -s "$CFG_FILE" ]; then
#prevent ruby unexpected error
sed -i -E 's/protocol-param: ([^,'"'"'"''}( *#)\n\r]+)/protocol-param: "\1"/g' "$CFG_FILE" 2>/dev/null
config_test
if [ $? -ne 0 ]; then
LOG_ERROR "Config File Tested Failed, Please Check The Log Infos!"
@@ -442,14 +450,7 @@ sub_info_get()
config_download_direct
return
fi
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
begin
YAML.load_file('$CFG_FILE');
rescue Exception => e
YAML.LOG_ERROR('Unable To Parse Config File,【' + e.message + '】');
system 'rm -rf ${CFG_FILE} 2>/dev/null'
end
" 2>/dev/null >> $LOG_FILE
yaml_sub_validate
if [ $? -ne 0 ]; then
LOG_ERROR "Ruby Works Abnormally, Please Check The Ruby Library Depends!"
only_download=1
@@ -457,7 +458,7 @@ sub_info_get()
elif [ ! -f "$CFG_FILE" ]; then
LOG_OUT "Config File Format Validation Failed, Trying To Download Without Agent..."
config_download_direct
elif ! "$(ruby_read "$CFG_FILE" ".key?('proxies')")" && ! "$(ruby_read "$CFG_FILE" ".key?('proxy-providers')")" ; then
elif [ "$YAML_SUB_STATUS" = "NO_CONTENT" ]; then
LOG_ERROR "Updated Config【$name】Has No Proxy Field, Trying To Download Without Agent..."
config_download_direct
else
@@ -474,6 +475,5 @@ sub_info_get()
#分别获取订阅信息进行处理
config_load "openclash"
config_foreach sub_info_get "config_subscribe" "$1"
SLOG_CLEAN
dec_job_counter_and_restart "$restart"
del_lock
@@ -115,6 +115,5 @@ fi
rm -rf /tmp/china_ip*_route* >/dev/null 2>&1
SLOG_CLEAN
dec_job_counter_and_restart "$restart"
del_lock
@@ -19,40 +19,54 @@ set_lock
inc_job_counter
restart=0
UPDATE_SUCCESS=0
github_address_mod=$(uci_get_config "github_address_mod" || echo 0)
if [ "$github_address_mod" = "0" ] && [ -z "$(echo $2 2>/dev/null |grep -E 'http|one_key_update')" ] && [ -z "$(echo $3 2>/dev/null |grep 'http')" ]; then
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - Github Address Modify Options"
DIRECT_CORE_URL=""
if [ -n "$2" ] && echo "$2" | grep -qE '^https?://'; then
DIRECT_CORE_URL="$2"
fi
if [ -n "$3" ] && [ "$2" = "one_key_update" ]; then
github_address_mod="$3"
if [ "$github_address_mod" = "0" ] && [ -z "$DIRECT_CORE_URL" ] && [ -z "$(echo $2 2>/dev/null |grep -E 'http|one_key_update')" ] && [ -z "$(echo $3 2>/dev/null |grep 'http')" ]; then
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - GitHub Address Proxy Options"
fi
if [ -n "$2" ] && [ "$2" = "one_key_update" ] && [ -z "$3" ]; then
github_address_mod=0
fi
if [ -n "$2" ] && [ "$2" != "one_key_update" ]; then
github_address_mod="$2"
if [ -z "$DIRECT_CORE_URL" ]; then
if [ -n "$3" ] && [ "$2" = "one_key_update" ]; then
github_address_mod="$3"
fi
if [ -n "$2" ] && [ "$2" = "one_key_update" ] && [ -z "$3" ]; then
github_address_mod=0
fi
if [ -n "$2" ] && [ "$2" != "one_key_update" ]; then
github_address_mod="$2"
fi
if echo "$github_address_mod" | grep -q "raw\.githubusercontent\.com"; then
github_address_mod=0
fi
fi
CORE_TYPE="$1"
C_CORE_TYPE=$(uci_get_config "core_type")
SMART_ENABLE=$(uci_get_config "smart_enable" || echo 0)
OIX_TOKEN=$(uci_get_config "oix_token")
[ "$SMART_ENABLE" -eq 1 ] && CORE_TYPE="Smart"
[ "$CORE_TYPE" = "Oix" ] || [ -n "$OIX_TOKEN" ] && CORE_TYPE="Oix"
[ -n "$OIX_TOKEN" ] && CORE_TYPE="Oix"
[ -z "$CORE_TYPE" ] && CORE_TYPE="Meta"
small_flash_memory=$(uci_get_config "small_flash_memory")
CPU_MODEL=$(uci_get_config "core_version")
RELEASE_BRANCH=$(uci_get_config "release_branch" || echo "master")
if [ "$github_address_mod" != "0" ]; then
/usr/share/openclash/clash_version.sh "$github_address_mod" 2>/dev/null
else
/usr/share/openclash/clash_version.sh 2>/dev/null
fi
if [ ! -f "/tmp/clash_last_version" ]; then
LOG_ERROR "【"$CORE_TYPE"】Core Version Check Error, Please Try Again Later..."
SLOG_CLEAN
del_lock
exit 0
if [ -z "$DIRECT_CORE_URL" ]; then
lua /usr/share/openclash/openclash_version.lua "$github_address_mod" 2>/dev/null
if [ "$CORE_TYPE" = "Oix" ]; then
CORE_LV=$(jsonfilter -i /tmp/openclash_version_history.json -e "@.oix.ver" 2>/dev/null)
elif [ "$CORE_TYPE" = "Smart" ]; then
CORE_LV=$(jsonfilter -i /tmp/openclash_version_history.json -e "@.${RELEASE_BRANCH}.latest.core_smart" 2>/dev/null)
else
CORE_LV=$(jsonfilter -i /tmp/openclash_version_history.json -e "@.${RELEASE_BRANCH}.latest.core_meta" 2>/dev/null)
fi
if [ -z "$CORE_LV" ]; then
LOG_ERROR "【"$CORE_TYPE"】Core Version Check Error, Please Try Again Later..."
del_lock
exit 0
fi
fi
if [ "$small_flash_memory" != "1" ]; then
@@ -70,23 +84,23 @@ TMP_FILE="${TARGET_CORE_PATH}.new.$$"
if [ "$CORE_TYPE" = "Oix" ]; then
CORE_URL_PATH=""
DOWNLOAD_FILE="/tmp/clash_meta.gz"
CORE_LV=$(sed -n 1p /tmp/clash_last_version 2>/dev/null)
elif [ "$CORE_TYPE" = "Smart" ]; then
CORE_URL_PATH="$RELEASE_BRANCH/smart"
DOWNLOAD_FILE="/tmp/clash_meta.tar.gz"
CORE_LV=$(sed -n 2p /tmp/clash_last_version 2>/dev/null)
else
CORE_URL_PATH="$RELEASE_BRANCH/meta"
DOWNLOAD_FILE="/tmp/clash_meta.tar.gz"
CORE_LV=$(sed -n 1p /tmp/clash_last_version 2>/dev/null)
fi
[ "$C_CORE_TYPE" != "$CORE_TYPE" ] || [ -z "$C_CORE_TYPE" ] && restart=1
if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
if [ -n "$DIRECT_CORE_URL" ] || [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
if [ "$CPU_MODEL" != 0 ]; then
LOG_TIP "【$CORE_TYPE】Core Downloading, Please Try to Download and Upload Manually If Fails"
if [ "$CORE_TYPE" = "Oix" ]; then
LOG_TIP "【"$CORE_TYPE"】Core Downloading, Please Try to Download and Upload Manually If Fails"
# If $2 is a full download URL, use it directly
if [ -n "$2" ] && echo "$2" | grep -qE '^https?://'; then
DOWNLOAD_URL="$2"
elif [ "$CORE_TYPE" = "Oix" ]; then
OIX_CORE_URL="https://github.com/vernesong/mihomo-oix/releases/download/Pre-Alpha/mihomo-${CPU_MODEL}-${CORE_LV}.gz"
OIX_CORE_P_URL="https://dl.dler.io/mihomo-oix/mihomo-${CPU_MODEL}-${CORE_LV}.gz?tag=Pre-Alpha"
if [ "$github_address_mod" != "0" ] && [ "$github_address_mod" != "https://cdn.jsdelivr.net/" ] && [ "$github_address_mod" != "https://fastly.jsdelivr.net/" ] && [ "$github_address_mod" != "https://testingcf.jsdelivr.net/" ]; then
@@ -118,91 +132,85 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
DOWNLOAD_RESULT=$?
if [ "$DOWNLOAD_RESULT" -eq 0 ]; then
gzip -t "$DOWNLOAD_FILE" >/dev/null 2>&1
gzip_test_err=$(gzip -t "$DOWNLOAD_FILE" 2>&1)
if [ "$?" -eq 0 ]; then
LOG_TIP "【"$CORE_TYPE"】Core Download Successful, Start Update..."
extract_success=true
extract_err=""
[ -s "$DOWNLOAD_FILE" ] && {
if [ "$CORE_TYPE" = "Oix" ]; then
gzip -dc "$DOWNLOAD_FILE" > "$TMP_FILE" 2>/dev/null || extract_success=false
extract_err=$(gzip -dc "$DOWNLOAD_FILE" > "$TMP_FILE" 2>&1) || extract_success=false
else
tar zxvfo "$DOWNLOAD_FILE" -C /tmp >/dev/null 2>&1 || extract_success=false
mv /tmp/clash "$TMP_FILE" >/dev/null 2>&1 || extract_success=false
extract_err=$(tar zxvfo "$DOWNLOAD_FILE" -C /tmp 2>&1) || extract_success=false
[ "$extract_success" = "true" ] && { extract_err=$(mv /tmp/clash "$TMP_FILE" 2>&1) || extract_success=false; }
fi
rm -rf "$DOWNLOAD_FILE" >/dev/null 2>&1
chmod 4755 "$TMP_FILE" >/dev/null 2>&1 || extract_success=false
"$TMP_FILE" -v >/dev/null 2>&1 || extract_success=false
[ "$extract_success" = "true" ] && { extract_err=$(chmod 4755 "$TMP_FILE" 2>&1) || extract_success=false; }
[ "$extract_success" = "true" ] && { extract_err=$("$TMP_FILE" -v 2>&1) || extract_success=false; }
}
if [ "$extract_success" != "true" ]; then
if [ "$retry_count" -lt "$max_retries" ]; then
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Update Failed..."
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Update Failed:【$(echo "$extract_err" | tr '\n' ' ' | head -c 300)】..."
rm -rf "$TMP_FILE" >/dev/null 2>&1
sleep 2
continue
else
LOG_ERROR "【"$CORE_TYPE"】Core Update Failed, Please Make Sure Enough Flash Memory Space or Selected Correct Core Platform And Try Again!"
LOG_ERROR "【"$CORE_TYPE"】Core Update Failed:【$(echo "$extract_err" | tr '\n' ' ' | head -c 300)】..."
rm -rf "$TMP_FILE" >/dev/null 2>&1
SLOG_CLEAN
del_lock
exit 0
break
fi
fi
mv -f "$TMP_FILE" "$TARGET_CORE_PATH" >/dev/null 2>&1
mv_err=$(mv -f "$TMP_FILE" "$TARGET_CORE_PATH" 2>&1)
if [ "$?" == "0" ]; then
LOG_TIP "【"$CORE_TYPE"】Core Update Successful!"
SLOG_CLEAN
LOG_TIP "【"$CORE_TYPE"】Core Update Successful"
UPDATE_SUCCESS=1
restart=1
break
else
if [ "$retry_count" -lt "$max_retries" ]; then
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Update Failed..."
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Move Failed:【$(echo "$mv_err" | tr '\n' ' ' | head -c 300)】"
sleep 2
continue
else
LOG_ERROR "【"$CORE_TYPE"】Core Update Failed, Please Make Sure Enough Flash Memory Space And Try Again!"
SLOG_CLEAN
LOG_ERROR "【"$CORE_TYPE"】Core Move Failed:【$(echo "$mv_err" | tr '\n' ' ' | head -c 300)】"
break
fi
fi
else
if [ "$retry_count" -lt "$max_retries" ]; then
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Update Failed..."
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Verification Failed:【$(echo "$gzip_test_err" | tr '\n' ' ' | head -c 300)】"
sleep 2
continue
else
LOG_ERROR "【"$CORE_TYPE"】Core Update Failed, Please Check The Network or Try Again Later!"
SLOG_CLEAN
LOG_ERROR "【"$CORE_TYPE"】Core Verification Failed:【$(echo "$gzip_test_err" | tr '\n' ' ' | head -c 300)】"
break
fi
fi
elif [ "$DOWNLOAD_RESULT" -eq 2 ]; then
LOG_TIP "【"$CORE_TYPE"】Core Has Not Been Updated, Stop Continuing Operation!"
SLOG_CLEAN
LOG_TIP "【"$CORE_TYPE"】Core Has Not Been Updated, Stop Continuing Operation"
else
if [ "$retry_count" -lt "$max_retries" ]; then
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Download Failed..."
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Download Failed, Please Check The Network or Try Again Later..."
sleep 2
continue
else
LOG_ERROR "【"$CORE_TYPE"】Core Download Failed, Please Check The Network or Try Again Later!"
SLOG_CLEAN
LOG_ERROR "【"$CORE_TYPE"】Core Download Failed, Please Check The Network or Try Again Later"
break
fi
fi
done
else
LOG_WARN "No Compiled Version Selected, Please Select In Update Page And Try Again!"
SLOG_CLEAN
fi
else
LOG_TIP "【"$CORE_TYPE"】Core Has Not Been Updated, Stop Continuing Operation!"
SLOG_CLEAN
LOG_TIP "【"$CORE_TYPE"】Core Has Not Been Updated, Stop Continuing Operation"
fi
rm -rf "$TMP_FILE" >/dev/null 2>&1
[ "$UPDATE_SUCCESS" = "1" ] && restart=1 || restart=0
dec_job_counter_and_restart "$restart"
del_lock
@@ -54,7 +54,7 @@ EOF
if [ "$SHOW_DOWNLOAD_PROGRESS" = "1" ] || [ "$SHOW_DOWNLOAD_PROGRESS" = "true" ]; then
TEMP_LOG="/tmp/curl_log_$$"
LOG_OUT "Downloading:【$(basename "$DOWNLOAD_PATH") - 0%】"
LOG_OUT "Downloading:【$(basename "$DOWNLOAD_PATH") - 0%】..."
(
if [ -n "$SECRET_KEY" ] && [ -n "$ETAG_HEADER" ]; then
@@ -101,7 +101,7 @@ EOF
if [ -n "$PROGRESS" ] && [ "$PROGRESS" -ne "$LAST_PROGRESS" ]; then
if [ "$PROGRESS" -gt "$LAST_PROGRESS" ]; then
LOG_OUT "Downloading:【$(basename "$DOWNLOAD_PATH") - ${PROGRESS}%】"
LOG_OUT "Downloading:【$(basename "$DOWNLOAD_PATH") - ${PROGRESS}%】..."
LAST_PROGRESS="$PROGRESS"
fi
fi
@@ -114,7 +114,7 @@ EOF
HTTP_CODE=$(grep -i "^HTTP" "$HEADER_TMP" 2>/dev/null | tail -1 | cut -d' ' -f2)
if [ "$EXIR_CODE" -eq 0 ] && [ "$LAST_PROGRESS" -ne 100 ]; then
LOG_OUT "Downloading:【$(basename "$DOWNLOAD_PATH") - 100%】"
LOG_OUT "Downloading:【$(basename "$DOWNLOAD_PATH") - 100%】..."
fi
if [ "$EXIR_CODE" -ne 0 ]; then
@@ -132,7 +132,6 @@ EOF
OUTPUT=$(DOWNLOAD_FAILURE_OUTPUT "$EXIR_CODE" "$HTTP_CODE" "${OUTPUT:-}")
LOG_OUT "【${DOWNLOAD_PATH}】Download Failed:【${OUTPUT}】"
rm -f "$HEADER_TMP" "$DOWNLOAD_TMP"
SLOG_CLEAN
return 1
fi
else
@@ -188,7 +187,6 @@ EOF
OUTPUT=$(DOWNLOAD_FAILURE_OUTPUT "$EXIR_CODE" "$HTTP_CODE" "$OUTPUT")
LOG_OUT "【${DOWNLOAD_PATH}】Download Failed:【${OUTPUT}】"
rm -f "$HEADER_TMP" "$DOWNLOAD_TMP"
SLOG_CLEAN
return 1
fi
fi
@@ -196,7 +194,6 @@ EOF
if ! mv -f "$DOWNLOAD_TMP" "$DOWNLOAD_PATH"; then
LOG_OUT "【${DOWNLOAD_PATH}】Download Failed:【Unable to save download file】"
rm -f "$HEADER_TMP" "$DOWNLOAD_TMP"
SLOG_CLEAN
return 1
fi
NEW_ETAG=$(grep -i "^etag:" "$HEADER_TMP" 2>/dev/null | tail -1 | cut -d' ' -f2- | tr -d '\r\n' | sed 's/^"//;s/"$//')
@@ -794,7 +794,9 @@ EOF
sed -i -E 's/(([0-9]{1,3}\.){2})[0-9]{1,3}\.[0-9]{1,3}/\1*\.*/g' "$DEBUG_LOG" 2>/dev/null
sed -i -E 's/(:[0-9a-fA-F]{1,4}){3}/:*:*:*/' "$DEBUG_LOG" 2>/dev/null
sed -i -E 's/::[0-9a-fA-F]{1,4}:(([0-9]{1,3}\.){3}[0-9]{1,3})/::*:\1/g' "$DEBUG_LOG" 2>/dev/null
sed -i -E 's/([0-9a-fA-F]{1,4}):[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){3}/\1:*:*:*:*\2/g' "$DEBUG_LOG" 2>/dev/null
sed -i -E 's/([0-9a-fA-F]{1,4})(:[0-9a-fA-F]{1,4}){0,5}::([0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4})*)?/\1:*::*/g' "$DEBUG_LOG" 2>/dev/null
sed -i 's/Downloading URL【[^】]*】/Downloading URL【*】/g' "$DEBUG_LOG" 2>/dev/null
@@ -9,16 +9,6 @@ local json = require "luci.jsonc"
local datatype = require "luci.cbi.datatypes"
local addr = arg[1]
local function s(e)
local t=0
local a={' KB',' MB',' GB',' TB',' PB'}
repeat
e=e/1024
t=t+1
until(e<=1024)
return string.format("%.1f",e)..a[t]
end
local function debug_getcon()
local info, ip, host, diag_info
ip = fs.lanip()
@@ -30,6 +20,7 @@ local function debug_getcon()
info = json.parse(info)
end
if info then
local conn_lines = {}
for i = 1, #(info.connections) do
if info.connections[i].metadata.host == "" then
host = "Empty"
@@ -37,13 +28,20 @@ local function debug_getcon()
host = info.connections[i].metadata.host
end
if not addr then
luci.sys.exec(string.format('echo "%s. SourceIP:【%s】 - Host:【%s】 - DestinationIP:【%s】 - Network:【%s】 - RulePayload:【%s】 - Lastchain:【%s】" >> /tmp/openclash_debug.log', i, (info.connections[i].metadata.sourceIP), host, (info.connections[i].metadata.destinationIP), (info.connections[i].metadata.network), (info.connections[i].rulePayload),(info.connections[i].chains[1])))
conn_lines[#conn_lines + 1] = string.format("%d. SourceIP:【%s】 - Host:【%s】 - DestinationIP:【%s】 - Network:【%s】 - RulePayload:【%s】 - Lastchain:【%s】\n",
i,
tostring(info.connections[i].metadata.sourceIP),
tostring(host),
tostring(info.connections[i].metadata.destinationIP),
tostring(info.connections[i].metadata.network),
tostring(info.connections[i].rulePayload),
tostring(info.connections[i].chains and info.connections[i].chains[1]))
else
if datatype.hostname(addr) and string.lower(addr) == host or datatype.ipaddr(addr) and addr == (info.connections[i].metadata.destinationIP) then
print("id: "..(info.connections[i].id))
print("start: "..(info.connections[i].start))
print("download: "..s(info.connections[i].download))
print("upload: "..s(info.connections[i].upload))
print("download: "..fs.filesize(info.connections[i].download))
print("upload: "..fs.filesize(info.connections[i].upload))
print("rule: "..(info.connections[i].rule))
print("rulePayload: "..(info.connections[i].rulePayload))
print("chains: ")
@@ -62,6 +60,10 @@ local function debug_getcon()
end
end
end
if not addr and #conn_lines > 0 then
local existing = fs.readfile("/tmp/openclash_debug.log") or ""
fs.writefile("/tmp/openclash_debug.log", existing .. table.concat(conn_lines))
end
end
end
os.exit(0)
@@ -57,7 +57,7 @@ EOF
}
log_unzip_error() {
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Unzip Error!" && SLOG_CLEAN
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Unzip Error!"
cleanup_dashboard_tmp
del_lock
exit 2
@@ -121,7 +121,7 @@ EOF
fi
if mv "$NEW_FILE_DIR" "$TARGET_FILE_DIR" >/dev/null 2>&1 && validate_dashboard_dir "$TARGET_FILE_DIR"; then
cleanup_dashboard_tmp
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Successful!" && SLOG_CLEAN
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Successful!"
del_lock
exit 0
else
@@ -137,7 +137,7 @@ EOF
elif [ "$DOWNLOAD_RESULT" -eq 2 ]; then
if validate_dashboard_dir "$UNPACK_FILE_DIR"; then
cleanup_dashboard_tmp
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Successful!" && SLOG_CLEAN
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Successful!"
del_lock
exit 0
else
@@ -145,7 +145,7 @@ EOF
fi
else
cleanup_dashboard_tmp
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Error!" && SLOG_CLEAN
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Error!"
del_lock
exit 1
fi
@@ -174,6 +174,5 @@ case "$1" in
;;
esac
SLOG_CLEAN
dec_job_counter_and_restart "$restart"
del_lock
@@ -56,6 +56,5 @@ fi
rm -rf /tmp/Model.bin >/dev/null 2>&1
SLOG_CLEAN
dec_job_counter_and_restart "$restart"
del_lock
@@ -14,23 +14,29 @@ del_lock() {
rm -rf "/tmp/lock/openclash_update.lock" 2>/dev/null
}
early_exit() {
dec_job_counter_and_restart "0"
del_lock
exit "${1:-0}"
}
set_lock
inc_job_counter
if [ -n "$1" ] && [ "$1" != "one_key_update" ]; then
/usr/share/openclash/openclash_version.sh "$1" 2>/dev/null
elif [ -n "$2" ]; then
/usr/share/openclash/openclash_version.sh "$2" 2>/dev/null
else
/usr/share/openclash/openclash_version.sh 2>/dev/null
RELEASE_BRANCH=$(uci_get_config "release_branch" || echo "master")
PLUGIN_DIRECT=0
if [ -n "$3" ] && echo "$3" | grep -qE '^https?://'; then
PLUGIN_DIRECT=1
fi
if [ ! -f "/tmp/openclash_last_version" ]; then
lua /usr/share/openclash/openclash_version.lua "$2" 2>/dev/null
PLUGIN_LATEST=$(jsonfilter -i /tmp/openclash_version_history.json -e "@.${RELEASE_BRANCH}.latest.plugin" 2>/dev/null)
if [ "$PLUGIN_DIRECT" -eq 0 ] && [ -z "$PLUGIN_LATEST" ]; then
LOG_ERROR "Failed to get version information, please try again later..."
SLOG_CLEAN
dec_job_counter_and_restart "0"
del_lock
exit 0
early_exit
fi
version_compare() {
@@ -59,7 +65,7 @@ run_with_timeout() {
(
sleep "$timeout_sec"
kill $_pid 2>/dev/null
sleep 0.5
sleep 1
kill -9 $_pid 2>/dev/null
) &
local _watchdog=$!
@@ -70,36 +76,65 @@ run_with_timeout() {
return $_ret
}
LAST_OPVER="/tmp/openclash_last_version"
LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |sed "s/^v//g" |tr -d "\n")
LAST_VER=$(echo "$PLUGIN_LATEST" |sed "s/^v//g" |tr -d "\n")
if [ -x "/bin/opkg" ]; then
OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print $2}' 2>/dev/null)
elif [ -x "/usr/bin/apk" ]; then
OP_CV=$(rm -f /lib/apk/db/lock && apk list luci-app-openclash 2>/dev/null|grep "installed" | grep -oE '[0-9]+(\.[0-9]+)*' | head -1 2>/dev/null)
fi
OP_LV=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |sed "s/^v//g" |tr -d "\n")
RELEASE_BRANCH=$(uci_get_config "release_branch" || echo "master")
OP_LV="$LAST_VER"
github_address_mod=$(uci_get_config "github_address_mod" || echo 0)
#一键更新
if [ "$1" = "one_key_update" ]; then
if [ "$github_address_mod" = "0" ] && [ -z "$2" ]; then
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - Github Address Modify Options"
fi
if [ -n "$2" ]; then
/usr/share/openclash/openclash_core.sh "Meta" "$1" "$2" >/dev/null 2>&1
github_address_mod="$2"
else
/usr/share/openclash/openclash_core.sh "Meta" "$1" >/dev/null 2>&1
github_address_mod=0
fi
if [ "$PLUGIN_DIRECT" -eq 0 ]; then
if [ "$github_address_mod" = "0" ] && [ -z "$2" ]; then
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - GitHub Address Proxy Options"
fi
if [ -n "$2" ]; then
github_address_mod="$2"
else
github_address_mod=0
fi
if echo "$github_address_mod" | grep -q "raw\.githubusercontent\.com"; then
github_address_mod=0
fi
fi
elif [ "$1" = "plugin_update" ]; then
if [ "$PLUGIN_DIRECT" -eq 0 ]; then
if [ "$github_address_mod" = "0" ] && [ -z "$2" ]; then
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - GitHub Address Proxy Options"
fi
if [ -n "$2" ]; then
github_address_mod="$2"
fi
if echo "$github_address_mod" | grep -q "raw\.githubusercontent\.com"; then
github_address_mod=0
fi
fi
else
if [ "$github_address_mod" = "0" ]; then
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - Github Address Modify Options"
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - GitHub Address Proxy Options"
fi
fi
if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [ -f "$LAST_OPVER" ]; then
if [ "$PLUGIN_DIRECT" -eq 1 ]; then
# Direct download URL (historical version / downgrade) — skip version compare
if [ -x "/bin/opkg" ]; then
DOWNLOAD_URL="$3"
DOWNLOAD_PATH="/tmp/openclash.ipk"
elif [ -x "/usr/bin/apk" ]; then
DOWNLOAD_URL="$3"
DOWNLOAD_PATH="/tmp/openclash.apk"
fi
LAST_VER=$(echo "$DOWNLOAD_URL" | grep -oE 'luci-app-openclash[_-][0-9]+(\.[0-9]+)*' | head -1 | sed 's/^luci-app-openclash[_-]//')
LOG_TIP "Start downloading【OpenClash - v$LAST_VER】..."
elif [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [ -n "$PLUGIN_LATEST" ]; then
LOG_TIP "Start downloading【OpenClash - v$LAST_VER】..."
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
@@ -128,6 +163,16 @@ if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [
DOWNLOAD_PATH="/tmp/openclash.apk"
fi
fi
else
if [ -z "$PLUGIN_LATEST" ] || [ -z "$OP_CV" ] || [ -z "$OP_LV" ]; then
LOG_ERROR "Failed to get version information, please try again later..."
else
LOG_TIP "OpenClash has not been updated, stop continuing!"
fi
early_exit
fi
if [ -n "$DOWNLOAD_URL" ]; then
retry_count=0
max_retries=3
@@ -154,22 +199,25 @@ if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [
max_update_retry=2
while [ $update_retry -lt $max_update_retry ]; do
update_retry=$((update_retry + 1))
run_with_timeout 30 opkg update >/dev/null 2>&1
opkg_update_err=$(run_with_timeout 30 opkg update 2>&1)
opkg_ret=$?
rm -f /var/lock/opkg.lock
if [ $opkg_ret -eq 0 ]; then
break
fi
if [ $update_retry -lt $max_update_retry ]; then
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】opkg update failed or timed out, retrying..."
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】opkg update failed or timed out:【$(echo "$opkg_update_err" | tr '\n' ' ' | head -c 300)】, retrying..."
sleep 2
else
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】opkg update failed, trying pre update test..."
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】opkg update failed:【$(echo "$opkg_update_err" | tr '\n' ' ' | head -c 300)】, trying pre update test..."
fi
done
if [ -s "/tmp/openclash.ipk" ]; then
if [ -n "$(opkg install /tmp/openclash.ipk --noaction 2>/dev/null |grep 'Upgrading luci-app-openclash on root' 2>/dev/null)" ]; then
opkg_test_err=$(opkg --force-downgrade install /tmp/openclash.ipk --noaction 2>&1)
if [ -n "$(echo "$opkg_test_err" | grep -E '(Upgrading|Downgrading) luci-app-openclash on root')" ]; then
pre_test_success=true
else
LOG_ERROR "【$retry_count/$max_retries】【OpenClash - v$LAST_VER】Pre update test failed:【$(echo "$opkg_test_err" | tr '\n' ' ' | head -c 500)】..."
fi
fi
elif [ -x "/usr/bin/apk" ]; then
@@ -177,23 +225,25 @@ if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [
max_update_retry=2
while [ $update_retry -lt $max_update_retry ]; do
update_retry=$((update_retry + 1))
run_with_timeout 30 apk update >/dev/null 2>&1
apk_update_err=$(run_with_timeout 30 apk update 2>&1)
apk_ret=$?
rm -f /lib/apk/db/lock
if [ $apk_ret -eq 0 ]; then
break
fi
if [ $update_retry -lt $max_update_retry ]; then
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】apk update failed or timed out, retrying..."
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】apk update failed or timed out:【$(echo "$apk_update_err" | tr '\n' ' ' | head -c 300)】, retrying..."
sleep 2
else
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】apk update failed, trying pre update test..."
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】apk update failed:【$(echo "$apk_update_err" | tr '\n' ' ' | head -c 300)】, trying pre update test..."
fi
done
if [ -s "/tmp/openclash.apk" ]; then
apk add -s -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk >/dev/null 2>&1
apk_test_err=$(apk add -s -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk 2>&1)
if [ $? -eq 0 ]; then
pre_test_success=true
else
LOG_ERROR "【$retry_count/$max_retries】【OpenClash - v$LAST_VER】Pre update test failed:【$(echo "$apk_test_err" | tr '\n' ' ' | head -c 500)】..."
fi
fi
fi
@@ -208,14 +258,11 @@ if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [
continue
else
if [ -x "/bin/opkg" ]; then
LOG_ERROR "【OpenClash - v$LAST_VER】Pre update test failed after 3 attempts, the file is saved in /tmp/openclash.ipk, please try to update manually with【opkg install /tmp/openclash.ipk】"
LOG_ERROR "【OpenClash - v$LAST_VER】Pre update test failed after 3 attempts, the file is saved in /tmp/openclash.ipk, please try to update manually with【opkg --force-downgrade install /tmp/openclash.ipk】"
elif [ -x "/usr/bin/apk" ]; then
LOG_ERROR "【OpenClash - v$LAST_VER】Pre update test failed after 3 attempts, the file is saved in /tmp/openclash.apk, please try to update manually with【apk add -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk】"
fi
SLOG_CLEAN
dec_job_counter_and_restart "0"
del_lock
exit 0
early_exit
fi
fi
else
@@ -227,10 +274,7 @@ if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [
LOG_ERROR "【OpenClash - v$LAST_VER】Download Failed after 3 attempts, please check the network or try again later!"
rm -rf /tmp/openclash.ipk >/dev/null 2>&1
rm -rf /tmp/openclash.apk >/dev/null 2>&1
dec_job_counter_and_restart "0"
SLOG_CLEAN
del_lock
exit 0
early_exit
fi
fi
done
@@ -299,9 +343,9 @@ install_missing_packages() {
while [ $retry_count -lt $max_retries ]; do
retry_count=$((retry_count + 1))
if [ -x "/bin/opkg" ]; then
opkg install "$pkg"
pkg_err=$(opkg install "$pkg" 2>&1)
elif [ -x "/usr/bin/apk" ]; then
apk add "$pkg"
pkg_err=$(apk add "$pkg" 2>&1)
fi
if [ $? -eq 0 ]; then
break
@@ -309,7 +353,7 @@ install_missing_packages() {
if [ $retry_count -lt $max_retries ]; then
sleep 2
else
LOG_ERROR "【$pkg】failed to install, please try to install it manually..."
LOG_ERROR "【$pkg】failed to install:【$(echo "$pkg_err" | tr '\n' ' ' | head -c 300)】, please try to install it manually..."
fi
fi
done
@@ -333,14 +377,16 @@ while [ $install_retry_count -lt $max_install_retries ]; do
installed_before="$installed_before $pkg"
fi
done
opkg install /tmp/openclash.ipk
opkg --force-downgrade install /tmp/openclash.ipk >/dev/null 2>&1
install_err=$(cat /tmp/openclash_install.log 2>/dev/null)
elif [ -x "/usr/bin/apk" ]; then
for pkg in $packages_to_check; do
if apk list "$pkg" |grep "installed" >/dev/null 2>&1; then
installed_before="$installed_before $pkg"
fi
done
apk add -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk
apk add -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk >/tmp/openclash_install.log 2>&1
install_err=$(cat /tmp/openclash_install.log 2>/dev/null)
fi
sleep 2
@@ -350,7 +396,7 @@ while [ $install_retry_count -lt $max_install_retries ]; do
install_missing_packages "$installed_before"
break
else
LOG_ERROR "【$install_retry_count/$max_install_retries】Installation failed..."
LOG_ERROR "【$install_retry_count/$max_install_retries】Installation failed:【$(echo "$install_err" | tr '\n' ' ' | head -c 500)】..."
if [ $install_retry_count -lt $max_install_retries ]; then
sleep 3
fi
@@ -365,13 +411,12 @@ if [ "$install_success" = true ]; then
fi
else
if [ -x "/bin/opkg" ]; then
LOG_ERROR "OpenClash update failed after 3 attempts, the file is saved in /tmp/openclash.ipk, please try to update manually with【opkg install /tmp/openclash.ipk】"
LOG_ERROR "OpenClash update failed after 3 attempts, the file is saved in /tmp/openclash.ipk, please try to update manually with【opkg --force-downgrade install /tmp/openclash.ipk】【$(echo "$install_err" | tr '\n' ' ' | head -c 500)】"
elif [ -x "/usr/bin/apk" ]; then
LOG_ERROR "OpenClash update failed after 3 attempts, the file is saved in /tmp/openclash.apk, please try to update manually with【apk add -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk】"
LOG_ERROR "OpenClash update failed after 3 attempts, the file is saved in /tmp/openclash.apk, please try to update manually with【apk add -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk】【$(echo "$install_err" | tr '\n' ' ' | head -c 500)】"
fi
fi
dec_job_counter_and_restart "0"
SLOG_CLEAN
del_update_lock
EOF
chmod 4755 /tmp/openclash_update.sh
@@ -379,10 +424,7 @@ EOF
if [ ! -f "/tmp/openclash_update.sh" ] || [ ! -s "/tmp/openclash_update.sh" ] || [ ! -x "/tmp/openclash_update.sh" ]; then
LOG_ERROR "Failed to create update script!"
rm -rf /tmp/openclash_update.sh
dec_job_counter_and_restart "0"
SLOG_CLEAN
del_lock
exit 1
early_exit 1
fi
retry_count=0
@@ -413,14 +455,6 @@ EOF
fi
(sleep 15; rm -f /tmp/openclash_update.sh) &
else
if [ ! -f "$LAST_OPVER" ] || [ -z "$OP_CV" ] || [ -z "$OP_LV" ]; then
LOG_ERROR "Failed to get version information, please try again later..."
else
LOG_TIP "OpenClash has not been updated, stop continuing!"
fi
dec_job_counter_and_restart "0"
SLOG_CLEAN
fi
del_lock
@@ -0,0 +1,644 @@
#!/usr/bin/lua
require "nixio"
require "luci.model.uci"
local fs = require "luci.openclash"
local json = require "luci.jsonc"
local M = {}
local VERSION_CACHE_FILE = "/tmp/openclash_version_history.json"
local CDN_CACHE_FILE = "/tmp/openclash_cdn_info.json"
local function trim(s)
if not s then return "" end
return (s:gsub("^%s+", ""):gsub("%s+$", ""))
end
function M.is_valid_version(s)
if not s or s == "" then return false end
s = trim(s)
if s == "" then return false end
if s:match("^<") then return false end
return true
end
function M.is_oix_mode()
local oix_token = fs.uci_get_config("config", "oix_token") or ""
return oix_token ~= ""
end
function try_read(fd, maxlen)
local pfds = {
{ fd = fd, events = nixio.poll_flags("in", "hup", "err") }
}
local nfds = nixio.poll(pfds, 0)
if nfds and nfds > 0 then
local buf = fd:read(maxlen or 4096)
if buf and #buf > 0 then
return buf
end
end
return nil
end
local function read_json(path)
if not fs.access(path) then return nil end
local raw = fs.readfile(path)
if not raw or raw == "" then return nil end
local ok, parsed = pcall(json.parse, raw)
if ok and parsed and type(parsed) == "table" then
return parsed
end
return nil
end
local function write_json(path, data)
local tmp = path .. ".tmp"
fs.writefile(tmp, json.stringify(data))
os.rename(tmp, path)
end
local function read_version_cache()
return read_json(VERSION_CACHE_FILE)
end
local function update_version_cache(updater)
local parsed = read_version_cache() or {}
updater(parsed)
write_json(VERSION_CACHE_FILE, parsed)
end
local DEFAULT_CDN_LIST = {
"https://ghfast.top/",
"https://github.dpik.top/",
"https://gh-proxy.com/",
"https://git.yylx.win/"
}
local function cdn_list()
local list = fs.cdn_list()
if #list > 0 then return list end
return DEFAULT_CDN_LIST
end
local function raw_url(path)
return "https://raw.githubusercontent.com/vernesong/OpenClash/" .. path
end
local function build_fetch_urls(mod, path)
if mod == "0" or mod == "" then
local urls = { raw_url(path) }
for _, cdn in ipairs(cdn_list()) do
urls[#urls + 1] = cdn .. raw_url(path)
end
return urls
end
if mod == "https://cdn.jsdelivr.net/" or mod == "https://fastly.jsdelivr.net/" or mod == "https://testingcf.jsdelivr.net/" then
return { mod .. "gh/vernesong/OpenClash@" .. path }
end
return { mod .. raw_url(path) }
end
local function fork_curl(url, timeout)
local fdi, fdo = nixio.pipe()
if not fdi or not fdo then return nil end
local cmd = string.format('curl -sL -m %d "%s" 2>/dev/null', timeout or 5, url)
local child = nixio.fork()
if child > 0 then
fdo:close()
return { pid = child, fdi = fdi, buf = "", done = false }
elseif child == 0 then
nixio.dup(fdo, nixio.stdout)
fdi:close()
fdo:close()
nixio.exec("/bin/sh", "-c", cmd)
else
if fdi then fdi:close() end
if fdo then fdo:close() end
return nil
end
end
local MAX_URL_BATCH = 3
local function try_fetch(urls, validator)
if not urls or #urls == 0 then return "" end
local timeout = (#urls > 1) and 5 or 10
local delay = 50000000
local max_wait = 100
local jobs = {}
local active = 0
local idx = 1
local function launch_batch()
local n = 0
while idx <= #urls and n < MAX_URL_BATCH do
local job = fork_curl(urls[idx], timeout)
if job then
jobs[#jobs + 1] = job
active = active + 1
end
idx = idx + 1
n = n + 1
end
end
launch_batch()
for _ = 1, max_wait do
local winner = ""
for _, job in ipairs(jobs) do
if not job.done then
local ok_r, buf = pcall(try_read, job.fdi, 4096)
if ok_r and buf then job.buf = job.buf .. buf end
local ok_w, wpid = pcall(nixio.waitpid, job.pid, "nohang")
if ok_w and wpid then
while true do
local ok_b, b = pcall(try_read, job.fdi, 4096)
if not ok_b or not b then break end
job.buf = job.buf .. b
end
pcall(job.fdi.close, job.fdi)
job.done = true
active = active - 1
if winner == "" and job.buf ~= "" and (not validator or validator(job.buf)) then
winner = job.buf
end
end
end
end
if winner ~= "" then
for _, job in ipairs(jobs) do
if not job.done then
pcall(job.fdi.close, job.fdi)
nixio.kill(job.pid, 9)
end
end
return trim(winner)
end
if active == 0 then
if idx <= #urls then
launch_batch()
else
break
end
end
nixio.nanosleep(0, delay)
delay = math.min(delay * 2, 200000000)
end
for _, job in ipairs(jobs) do
if not job.done then
pcall(job.fdi.close, job.fdi)
nixio.kill(job.pid, 9)
end
end
return ""
end
function M.prepare_oix_cdn_data(force)
if not M.is_oix_mode() then
return false, "", ""
end
local parsed = read_version_cache()
if parsed and parsed.oix and parsed.oix.cached_at then
local age = os.time() - parsed.oix.cached_at
local ttl = parsed.oix.cache_ttl or 300
if age < 5 or (not force and age < ttl) then
return true, parsed.oix.ver or "", parsed.oix.error or ""
end
end
local function fork_oix_version(url)
local fdi, fdo = nixio.pipe()
if not fdi or not fdo then return nil end
local cmd = string.format('curl -sL -m 3 --connect-timeout 3 "%s" 2>/dev/null', url)
local child = nixio.fork()
if child > 0 then
fdo:close()
return { pid = child, fdi = fdi, buf = "" }
elseif child == 0 then
nixio.dup(fdo, nixio.stdout)
fdi:close()
fdo:close()
nixio.exec("/bin/sh", "-c", cmd)
else
if fdi then fdi:close() end
if fdo then fdo:close() end
return nil
end
end
local jobs = {}
local dl_job = fork_oix_version("https://dl.dler.io/mihomo-oix/version.txt?tag=Pre-Alpha")
if dl_job then jobs[#jobs + 1] = dl_job end
local gh_job = fork_oix_version("https://github.com/vernesong/mihomo-oix/releases/download/Pre-Alpha/version.txt")
if gh_job then jobs[#jobs + 1] = gh_job end
if #jobs == 0 then
return true, "", "error"
end
local ver = ""
local delay = 50000000
local max_wait = 40
for _ = 1, max_wait do
for _, job in ipairs(jobs) do
if not job.done then
local ok_r, buf = pcall(try_read, job.fdi, 4096)
if ok_r and buf then job.buf = job.buf .. buf end
local ok_w, wpid = pcall(nixio.waitpid, job.pid, "nohang")
if ok_w and wpid then
while true do
local ok_b, b = pcall(try_read, job.fdi, 4096)
if not ok_b or not b then break end
job.buf = job.buf .. b
end
pcall(job.fdi.close, job.fdi)
job.done = true
end
end
end
for _, job in ipairs(jobs) do
if job.done and ver == "" then
local candidate = trim(job.buf:gsub("[\n\r]+", ""))
if M.is_valid_version(candidate) then
ver = candidate
end
end
end
if ver ~= "" then
for _, job in ipairs(jobs) do
if not job.done then
pcall(job.fdi.close, job.fdi)
nixio.kill(job.pid, 9)
end
end
update_version_cache(function(p) p.oix = { ver = ver, error = "", cache_ttl = 300, cached_at = os.time() } end)
return true, ver, ""
end
local all_done = true
for _, job in ipairs(jobs) do
if not job.done then all_done = false break end
end
if all_done then break end
nixio.nanosleep(0, delay)
delay = math.min(delay * 2, 200000000)
end
for _, job in ipairs(jobs) do
if not job.done then
pcall(job.fdi.close, job.fdi)
nixio.kill(job.pid, 9)
end
end
update_version_cache(function(p) p.oix = { ver = "", error = "error", cache_ttl = 5, cached_at = os.time() } end)
return true, "", "error"
end
local function fork_file_fetch(sha, file_path, mod)
local urls = build_fetch_urls(mod, sha .. "/" .. file_path)
if #urls == 0 then return nil end
return { children = {}, idx = 1, buf = "", done = false, launched = false, sha = sha, urls = urls }
end
local function launch_file_batch(job)
local timeout = (#job.urls > 1) and 5 or 10
local n = 0
while job.idx <= #job.urls and n < MAX_URL_BATCH do
local child = fork_curl(job.urls[job.idx], timeout)
if child then job.children[#job.children + 1] = child end
job.idx = job.idx + 1
n = n + 1
end
end
local function collect_fork_results(jobs, max_jobs)
local results = {}
local active = 0
local delay = 50000000
local max_iter = 250
for _ = 1, max_iter do
while active < max_jobs do
local launched = false
for _, job in ipairs(jobs) do
if not job.launched then
job.launched = true
active = active + 1
launched = true
launch_file_batch(job)
if #job.children == 0 then
job.done = true
active = active - 1
end
break
end
end
if not launched then break end
end
for _, job in ipairs(jobs) do
if job.launched and not job.done then
local winner = ""
local all_children_done = true
for _, child in ipairs(job.children) do
if not child.done then
all_children_done = false
local ok_r, buf = pcall(try_read, child.fdi, 4096)
if ok_r and buf then child.buf = child.buf .. buf end
local ok_w, wpid = pcall(nixio.waitpid, child.pid, "nohang")
if ok_w and wpid then
while true do
local ok_b, b = pcall(try_read, child.fdi, 4096)
if not ok_b or not b then break end
child.buf = child.buf .. b
end
pcall(child.fdi.close, child.fdi)
child.done = true
if winner == "" and child.buf ~= "" then
winner = child.buf
end
end
end
end
if winner ~= "" then
for _, child in ipairs(job.children) do
if not child.done then
pcall(child.fdi.close, child.fdi)
nixio.kill(child.pid, 9)
end
end
job.done = true
active = active - 1
results[job.sha] = trim(winner)
elseif all_children_done then
if job.idx <= #job.urls then
launch_file_batch(job)
else
job.done = true
active = active - 1
end
end
end
end
local all_done = true
for _, job in ipairs(jobs) do
if not job.done then all_done = false break end
end
if all_done then break end
nixio.nanosleep(0, delay)
delay = math.min(delay * 2, 200000000)
end
for _, job in ipairs(jobs) do
if not job.done then
if job.children then
for _, child in ipairs(job.children) do
if not child.done then
pcall(child.fdi.close, child.fdi)
nixio.kill(child.pid, 9)
end
end
end
job.done = true
end
end
return results
end
local function html_unescape(s)
if not s then return "" end
s = s:gsub("&amp;", "&")
s = s:gsub("&lt;", "<")
s = s:gsub("&gt;", ">")
s = s:gsub("&quot;", '"')
s = s:gsub("&#39;", "'")
s = s:gsub("&#x27;", "'")
return s
end
local function build_feed_urls(mod, path)
local feed = "https://github.com/vernesong/OpenClash/commits/" .. path .. ".atom"
if mod == "0" or mod == "" then
local urls = { feed }
for _, cdn in ipairs(cdn_list()) do
urls[#urls + 1] = cdn .. feed
end
return urls
end
if mod == "https://cdn.jsdelivr.net/" or mod == "https://fastly.jsdelivr.net/" or mod == "https://testingcf.jsdelivr.net/" then
return { feed }
end
return { mod .. feed, feed }
end
local function fetch_commit_feed(mod, path)
return try_fetch(build_feed_urls(mod, path), function(buf)
return buf:match("<entry") ~= nil
end)
end
local function parse_commit_feed(raw, max_count)
local commits = {}
if raw and raw ~= "" then
local n = 0
for entry in raw:gmatch("<entry>(.-)</entry>") do
n = n + 1
if n > max_count then break end
local sha = entry:match("<id>[^<]*/([0-9a-f]+)</id>")
if sha then
local date = entry:match("<updated>(.-)</updated>") or ""
local title = entry:match("<title>(.-)</title>") or ""
title = trim(title)
commits[#commits + 1] = { sha = sha, date = date, message = html_unescape(title) }
end
end
end
return commits
end
function M.fetch_version_history(branch, force, cdn, latest_only)
local result = { plugin = {}, core_meta = {}, core_smart = {}, latest = nil, error = nil, oix_ver = "" }
local cur_oix = M.is_oix_mode()
local skip_core = cur_oix
local github_address_mod = fs.uci_get_config("config", "github_address_mod") or "0"
if cdn and cdn ~= "" then
github_address_mod = cdn
if github_address_mod:match("raw%.githubusercontent%.com") then
github_address_mod = "0"
end
end
if not force then
local parsed = read_version_cache()
if parsed and parsed[branch] and parsed[branch].cached_at then
local blk = parsed[branch]
local ttl = blk.cache_ttl or 300
if os.time() - blk.cached_at < ttl and blk.oix == cur_oix then
if latest_only then
local lt = blk.latest
if lt and lt.plugin and lt.plugin ~= "" and (cur_oix or (lt.core_meta and lt.core_meta ~= "")) then
return blk
end
elseif blk.plugin and #blk.plugin > 0 then
return blk
end
end
end
end
if latest_only then
local plugin_latest = ""
local core_meta_latest = ""
local core_smart_latest = ""
local plugin_raw = try_fetch(build_fetch_urls(github_address_mod, "package/" .. branch .. "/version"))
if plugin_raw and plugin_raw ~= "" then
plugin_latest = trim(plugin_raw:match("^[^\n\r]*") or "")
end
if not cur_oix then
local core_raw = try_fetch(build_fetch_urls(github_address_mod, "core/" .. branch .. "/core_version"))
if core_raw and core_raw ~= "" then
core_meta_latest = trim(core_raw:match("^[^\n\r]*") or "")
local after = core_raw:match("[\n\r]+(.*)")
if after then
core_smart_latest = trim(after:match("^[^\n\r]*") or "")
end
end
end
result.latest = { plugin = plugin_latest, core_meta = core_meta_latest, core_smart = core_smart_latest }
if plugin_latest == "" then
result.error = "network_error"
end
if cur_oix then
M.prepare_oix_cdn_data(force)
end
result.cache_ttl = (plugin_latest == "") and 5 or 300
result.cached_at = os.time()
result.oix = cur_oix
update_version_cache(function(parsed)
local blk = parsed[branch] or {}
blk.latest = result.latest
blk.error = result.error
blk.cache_ttl = result.cache_ttl
blk.cached_at = result.cached_at
blk.oix = cur_oix
blk.plugin = nil
blk.core_meta = nil
blk.core_smart = nil
blk.oix_ver = nil
parsed[branch] = blk
end)
return result
end
local plugin_feed = fetch_commit_feed(github_address_mod, "package/" .. branch .. "/version")
local plugin_commits = parse_commit_feed(plugin_feed, 5)
if #plugin_commits > 0 then
local file_jobs = {}
for _, c in ipairs(plugin_commits) do
local job = fork_file_fetch(c.sha, branch .. "/version", github_address_mod)
if job then file_jobs[#file_jobs + 1] = job end
end
local file_results = collect_fork_results(file_jobs, 2)
for _, c in ipairs(plugin_commits) do
local raw = file_results[c.sha]
local ver
if raw and raw ~= "" then
ver = trim(raw:match("^[^\n\r]*") or "")
if not M.is_valid_version(ver) then ver = nil end
end
result.plugin[#result.plugin + 1] = {
version = ver,
date = c.date,
sha = c.sha,
message = c.message
}
end
end
if not skip_core then
local core_feed = fetch_commit_feed(github_address_mod, "core/" .. branch .. "/core_version")
local core_commits = parse_commit_feed(core_feed, 5)
if #core_commits > 0 then
local file_jobs = {}
for _, c in ipairs(core_commits) do
local job = fork_file_fetch(c.sha, branch .. "/core_version", github_address_mod)
if job then file_jobs[#file_jobs + 1] = job end
end
local file_results = collect_fork_results(file_jobs, 2)
for _, c in ipairs(core_commits) do
local content = file_results[c.sha]
if content and content ~= "" then
local meta_ver = content:match("^[^\n\r]*")
local after_first = content:match("[\n\r]+(.*)")
local smart_ver = after_first and after_first:match("^[^\n\r]*") or nil
if meta_ver then
meta_ver = trim(meta_ver)
if M.is_valid_version(meta_ver) then
result.core_meta[#result.core_meta + 1] = { version = meta_ver, date = c.date, sha = c.sha }
end
end
if smart_ver then
smart_ver = trim(smart_ver)
if M.is_valid_version(smart_ver) then
result.core_smart[#result.core_smart + 1] = { version = smart_ver, date = c.date, sha = c.sha }
end
end
end
end
end
end
result.latest = {
plugin = (result.plugin[1] and result.plugin[1].version) or "",
core_meta = (result.core_meta[1] and result.core_meta[1].version) or "",
core_smart = (result.core_smart[1] and result.core_smart[1].version) or ""
}
if cur_oix then
local _, oix_ver = M.prepare_oix_cdn_data(force)
if oix_ver and oix_ver ~= "" then
result.oix_ver = oix_ver
end
end
local cache_ttl = 300
if #result.plugin == 0 then
if not plugin_feed or plugin_feed == "" then
result.error = "network_error"
cache_ttl = 5
else
result.error = "parse_error"
cache_ttl = 5
end
end
result.cache_ttl = cache_ttl
result.cached_at = os.time()
result.oix = cur_oix
update_version_cache(function(parsed)
parsed[branch] = result
end)
return result
end
if arg and arg[0] and arg[0]:match("openclash_version%.lua$") then
local branch = fs.uci_get_config("config", "release_branch") or "master"
M.fetch_version_history(branch, arg[2], arg[1], arg[3] ~= "0")
end
return M
@@ -1,67 +0,0 @@
#!/bin/bash
. /usr/share/openclash/openclash_curl.sh
. /usr/share/openclash/uci.sh
set_lock() {
exec 869>"/tmp/lock/openclash_version.lock" 2>/dev/null
flock -x 869 2>/dev/null
}
del_lock() {
flock -u 869 2>/dev/null
rm -rf "/tmp/lock/openclash_version.lock" 2>/dev/null
}
set_lock
version_compare() {
local current_ver="$1"
local latest_ver="$2"
if echo "1.0.0" | sort -V >/dev/null 2>&1; then
if [ "$(printf '%s\n%s\n' "$current_ver" "$latest_ver" | sort -V | head -n1)" = "$current_ver" ] && [ "$current_ver" != "$latest_ver" ]; then
return 0
fi
else
local cv_num=$(echo "$current_ver" | awk -F '.' '{print $2$3}' 2>/dev/null)
local lv_num=$(echo "$latest_ver" | awk -F '.' '{print $2$3}' 2>/dev/null)
if [ -n "$cv_num" ] && [ -n "$lv_num" ] && [ "$(expr "$lv_num" \> "$cv_num")" -eq 1 ]; then
return 0
fi
fi
return 1
}
DOWNLOAD_FILE="/tmp/openclash_last_version"
RELEASE_BRANCH=$(uci_get_config "release_branch" || echo "master")
if [ -x "/bin/opkg" ]; then
OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print $2}' 2>/dev/null)
elif [ -x "/usr/bin/apk" ]; then
OP_CV=$(rm -f /lib/apk/db/lock && apk list luci-app-openclash 2>/dev/null|grep 'installed' | grep -oE '[0-9]+(\.[0-9]+)*' | head -1 2>/dev/null)
fi
OP_LV=$(sed -n 1p "$DOWNLOAD_FILE" 2>/dev/null |sed "s/^v//g" |tr -d "\n")
github_address_mod=$(uci_get_config "github_address_mod" || echo 0)
if [ -n "$1" ]; then
github_address_mod="$1"
fi
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
DOWNLOAD_URL="${github_address_mod}gh/vernesong/OpenClash@package/${RELEASE_BRANCH}/version"
else
DOWNLOAD_URL="${github_address_mod}https://raw.githubusercontent.com/vernesong/OpenClash/package/${RELEASE_BRANCH}/version"
fi
else
DOWNLOAD_URL="https://raw.githubusercontent.com/vernesong/OpenClash/package/${RELEASE_BRANCH}/version"
fi
DOWNLOAD_FILE_CURL "$DOWNLOAD_URL" "$DOWNLOAD_FILE" "$DOWNLOAD_FILE"
if [ "$?" -eq 0 ]; then
OP_LV=$(sed -n 1p $DOWNLOAD_FILE 2>/dev/null |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [ -f "$DOWNLOAD_FILE" ]; then
sed -i '/^https:/,$d' $DOWNLOAD_FILE
fi
fi
del_lock
@@ -244,7 +244,7 @@ fi
LOG_WATCHDOG "Setting Firewall For Rules Order..."
/etc/init.d/openclash reload "firewall"
let FIREWALL_RELOAD++
elif [ -n "$(ip tuntap list |grep utun)" ] && [ -z "$(ip route list table 354)" ]; then
elif [ -n "$(ip link show utun 2>/dev/null)" ] && [ -z "$(ip route list table 354)" ]; then
## 路由表检查
LOG_WATCHDOG "Setting Firewall For IP Rules Table Recreate..."
/etc/init.d/openclash reload "firewall"
@@ -470,6 +470,5 @@ fi
LOG_ERROR "Streaming Unlock Could not Work Because of Router-Self Proxy Disabled, Exiting..."
fi
SLOG_CLEAN
sleep 60
done 2>/dev/null
@@ -0,0 +1,13 @@
# CDN proxy address list (one URL per line, "#" starts a comment)
# Comment out a line with "#" to temporarily disable it
https://ghfast.top/
https://git.yylx.win/
https://cdn.akaere.online/
https://gh-proxy.com/
https://gh.jasonzeng.dev/
https://ghproxy.monkeyray.net/
https://down.mxw.xx.kg/
https://github.tbap.top/
https://ghm.078465.xyz/
https://gh.monlor.com/
https://gh.idayer.com/
@@ -35,6 +35,10 @@ ACL4SSR 规则 WithChinaIp WithGFW,ACL4SSR_WithChinaIp_WithGFW.ini,https://raw.g
ACL4SSR 规则 WithGFW,ACL4SSR_WithGFW.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_WithGFW.ini
eHpo1 规则,ehpo1_main.ini,https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/ehpo1_main.ini
Aethersailor 规则 标准版 Custom_Clash,Custom_Clash.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash.ini
Aethersailor 规则 标准版 故障转移,Custom_Clash_Fallback.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_Fallback.ini
Aethersailor 规则 轻量版 Custom_Clash_Lite,Custom_Clash_Lite.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_Lite.ini
Aethersailor 规则 轻量版 故障转移,Custom_Clash_Lite_Fallback.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_Lite_Fallback.ini
Aethersailor 规则 极简版(GFW) Custom_Clash_GFW,Custom_Clash_GFW.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_GFW.ini
Aethersailor 规则 极简版(GFW) 故障转移,Custom_Clash_GFW_Fallback.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_GFW_Fallback.ini
Aethersailor 规则 重度分流版 Custom_Clash_Full,Custom_Clash_Full.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_Full.ini
Aethersailor 规则 重度分流版 故障转移,Custom_Clash_Full_Fallback.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_Full_Fallback.ini
@@ -92,7 +92,7 @@ if openclash_custom_overwrite; then
write_ruby_part "$RUBY_YAML_PARSE"
return
fi
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); Value$2=$3; File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); Value$2=$3; YAML.dump(Value, '$1')"
run_ruby_part "$RUBY_YAML_PARSE"
}
@@ -107,7 +107,7 @@ if openclash_custom_overwrite; then
write_ruby_part "$RUBY_YAML_PARSE"
return
fi
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$3') then Value_1 = YAML.load_file('$3'); if not '$4'.empty? then Value$2=Value_1['$4']; else Value$2=Value_1 end else if not '$4'.empty? then Value.delete('$4'); end; end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$3') then Value_1 = YAML.load_file('$3'); if not '$4'.empty? then Value$2=Value_1['$4']; else Value$2=Value_1 end else if not '$4'.empty? then Value.delete('$4'); end; end; YAML.dump(Value, '$1')"
run_ruby_part "$RUBY_YAML_PARSE"
}
@@ -122,7 +122,7 @@ if openclash_custom_overwrite; then
write_ruby_part "$RUBY_YAML_PARSE"
return
fi
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$3') then Value_1 = YAML.load_file('$3'); if not Value$2 then Value$2 = {}; end; if Value_1$4 && Value_1$4.is_a?(Hash) then Value$2.merge!(Value_1$4) end end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$3') then Value_1 = YAML.load_file('$3'); if not Value$2 then Value$2 = {}; end; if Value_1$4 && Value_1$4.is_a?(Hash) then Value$2.merge!(Value_1$4) end end; YAML.dump(Value, '$1')"
run_ruby_part "$RUBY_YAML_PARSE"
}
@@ -137,7 +137,7 @@ if openclash_custom_overwrite; then
write_ruby_part "$RUBY_YAML_PARSE"
return
fi
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 then Value$2=Value$2.uniq; end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 then Value$2=Value$2.uniq; end; YAML.dump(Value, '$1')"
run_ruby_part "$RUBY_YAML_PARSE"
}
@@ -152,7 +152,7 @@ if openclash_custom_overwrite; then
write_ruby_part "$RUBY_YAML_PARSE"
return
fi
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 then Value$2 = {}; end; Value$2.merge!({$3}); File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 then Value$2 = {}; end; Value$2.merge!({$3}); YAML.dump(Value, '$1')"
run_ruby_part "$RUBY_YAML_PARSE"
}
@@ -167,7 +167,7 @@ if openclash_custom_overwrite; then
write_ruby_part "$RUBY_YAML_PARSE"
return
fi
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$4') then Value_1 = YAML.load_file('$4'); if not Value$2 or Value$2.nil? then Value$2 = []; end; if Value_1$5 && Value_1$5.is_a?(Array) then idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; Value_1$5.reverse.each{|x| Value$2.insert(idx,x); idx += 1}; Value$2=Value$2.uniq end end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$4') then Value_1 = YAML.load_file('$4'); if not Value$2 or Value$2.nil? then Value$2 = []; end; if Value_1$5 && Value_1$5.is_a?(Array) then idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; Value_1$5.reverse.each{|x| Value$2.insert(idx,x); idx += 1}; Value$2=Value$2.uniq end end; YAML.dump(Value, '$1')"
run_ruby_part "$RUBY_YAML_PARSE"
}
@@ -182,7 +182,7 @@ if openclash_custom_overwrite; then
write_ruby_part "$RUBY_YAML_PARSE"
return
fi
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$3') then Value_1 = YAML.load_file('$3'); if not Value$2 or Value$2.nil? then Value$2 = []; end; if Value_1$4 && Value_1$4.is_a?(Array) then Value$2=(Value_1$4+Value$2).uniq else Value$2=Value$2.uniq end end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$3') then Value_1 = YAML.load_file('$3'); if not Value$2 or Value$2.nil? then Value$2 = []; end; if Value_1$4 && Value_1$4.is_a?(Array) then Value$2=(Value_1$4+Value$2).uniq else Value$2=Value$2.uniq end end; YAML.dump(Value, '$1')"
run_ruby_part "$RUBY_YAML_PARSE"
}
@@ -197,7 +197,7 @@ if openclash_custom_overwrite; then
write_ruby_part "$RUBY_YAML_PARSE"
return
fi
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; Value$2=Value$2.insert(idx,'$4').uniq; File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; Value$2=Value$2.insert(idx,'$4').uniq; YAML.dump(Value, '$1')"
run_ruby_part "$RUBY_YAML_PARSE"
}
@@ -212,7 +212,7 @@ if openclash_custom_overwrite; then
write_ruby_part "$RUBY_YAML_PARSE"
return
fi
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; Value$2=Value$2.insert(idx,$4).uniq; File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; Value$2=Value$2.insert(idx,$4).uniq; YAML.dump(Value, '$1')"
run_ruby_part "$RUBY_YAML_PARSE"
}
@@ -227,7 +227,7 @@ if openclash_custom_overwrite; then
write_ruby_part "$RUBY_YAML_PARSE"
return
fi
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; if $4.is_a?(Array) then idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; $4.reverse.each{|x| Value$2=Value$2.insert(idx,x); idx += 1}; Value$2=Value$2.uniq end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; if $4.is_a?(Array) then idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; $4.reverse.each{|x| Value$2=Value$2.insert(idx,x); idx += 1}; Value$2=Value$2.uniq end; YAML.dump(Value, '$1')"
run_ruby_part "$RUBY_YAML_PARSE"
}
@@ -247,9 +247,9 @@ if openclash_custom_overwrite; then
return
fi
if [ -z "$2" ]; then
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); Value.delete('$3'); File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); Value.delete('$3'); YAML.dump(Value, '$1')"
else
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 then if Value$2.is_a?(Hash) then Value$2.delete('$3') elsif Value$2.is_a?(Array) then Value$2.delete('$3') end end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 then if Value$2.is_a?(Hash) then Value$2.delete('$3') elsif Value$2.is_a?(Array) then Value$2.delete('$3') end end; YAML.dump(Value, '$1')"
fi
run_ruby_part "$RUBY_YAML_PARSE"
}
@@ -265,7 +265,7 @@ if openclash_custom_overwrite; then
write_ruby_part "$RUBY_YAML_PARSE"
return
fi
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 && Value$2.is_a?(Hash) then if Value$2['$3'] && Value$2['$3'].is_a?(Hash) then Value$2['$3']$4 = '$5' end end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 && Value$2.is_a?(Hash) then if Value$2['$3'] && Value$2['$3'].is_a?(Hash) then Value$2['$3']$4 = '$5' end end; YAML.dump(Value, '$1')"
run_ruby_part "$RUBY_YAML_PARSE"
}
@@ -288,9 +288,9 @@ if openclash_custom_overwrite; then
return
fi
if [ -n "$3" ] && [ -n "$4" ] && [ -n "$5" ] && [ -n "$6" ]; then
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 && Value$2.is_a?(Array) then Value$2.map!{|x| if x.is_a?(Hash) && x$3 == '$4' then x$5='$6' end; x}; Value$2.uniq! end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 && Value$2.is_a?(Array) then Value$2.map!{|x| if x.is_a?(Hash) && x$3 == '$4' then x$5='$6' end; x}; Value$2.uniq! end; YAML.dump(Value, '$1')"
elif [ -z "$3" ] && [ -n "$4" ] && [ -z "$5" ] && [ -n "$6" ]; then
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 && Value$2.is_a?(Array) then Value$2.map!{|x| if x == '$4' then '$6' else x end}; Value$2.uniq! end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 && Value$2.is_a?(Array) then Value$2.map!{|x| if x == '$4' then '$6' else x end}; Value$2.uniq! end; YAML.dump(Value, '$1')"
else
return
fi
@@ -166,6 +166,7 @@ sys_dns_append()
PROXY_GROUPS=$(ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
begin
Value = YAML.load_file('$CONFIG_FILE')
File.open('/tmp/yaml_change_marshal', 'wb') { |f| Marshal.dump(Value, f) }
if Value.key?('proxy-groups') && Value['proxy-groups'].is_a?(Array)
Value['proxy-groups'].each { |x| puts x['name'] if x.key?('name') }
end
@@ -328,7 +329,15 @@ end
begin
config_file = '$5'
Value = YAML.load_file(config_file)
if File.exist?('/tmp/yaml_change_marshal')
begin
Value = Marshal.load(File.open('/tmp/yaml_change_marshal', 'rb') { |f| f.read })
rescue
Value = YAML.load_file(config_file)
end
else
Value = YAML.load_file(config_file)
end
rescue Exception => e
YAML.LOG_ERROR('Load File Failed,【%s】' % [e.message])
exit
@@ -811,9 +820,10 @@ rescue Exception => e
YAML.LOG_ERROR('Config File Overwrite Failed,【%s】' % [e.message])
ensure
begin
File.open(config_file, 'w') { |f| YAML.dump(Value, f) }
YAML.dump(Value, config_file)
rescue Exception => e
YAML.LOG_ERROR('Write file failed:【%s】' % [e.message])
end
File.delete('/tmp/yaml_change_marshal') rescue nil
end
" 2>/dev/null >> $LOG_FILE
@@ -1617,5 +1617,4 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
" >> $LOG_FILE
LOG_OUT "Config File【$CONFIG_NAME】Read Successful!"
SLOG_CLEAN
del_lock
@@ -1852,12 +1852,33 @@ rm -rf $servers_name
LOG_OUT "Proxies, Proxy-providers, Groups Edited Successful, Updating Config File【$CONFIG_NAME】..."
config_hash=$(ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "Value = YAML.load_file('$CONFIG_FILE'); puts Value" 2>/dev/null)
if [ "$config_hash" != "false" ] && [ -n "$config_hash" ]; then
ruby_cover "$CONFIG_FILE" "['proxies']" "$SERVER_FILE" "proxies"
ruby_cover "$CONFIG_FILE" "['proxy-providers']" "$PROXY_PROVIDER_FILE" "proxy-providers"
ruby_cover "$CONFIG_FILE" "['proxy-groups']" "/tmp/yaml_groups.yaml" "proxy-groups"
else
config_hash=$(ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
begin
Value = YAML.load_file('$CONFIG_FILE')
{
'proxies' => '$SERVER_FILE',
'proxy-providers' => '$PROXY_PROVIDER_FILE',
'proxy-groups' => '/tmp/yaml_groups.yaml'
}.each do |key, src_file|
begin
if File.exist?(src_file)
src = YAML.load_file(src_file)
Value[key] = src[key]
else
Value.delete(key)
end
rescue Exception => e
YAML.LOG_ERROR('Merge [' + key + '] Failed: ' + e.message)
end
end
YAML.dump(Value, '$CONFIG_FILE')
puts 'OK'
rescue Exception => e
YAML.LOG_ERROR('Update Config File Failed: ' + e.message)
end
" 2>/dev/null)
if [ "$config_hash" != "OK" ]; then
cat "$SERVER_FILE" "$PROXY_PROVIDER_FILE" "/tmp/yaml_groups.yaml" > "$CONFIG_FILE" 2>/dev/null
fi
@@ -1868,5 +1889,4 @@ rm -rf /tmp/Proxy_Server 2>/dev/null
rm -rf /tmp/Proxy_Provider 2>/dev/null
LOG_OUT "Config File【$CONFIG_NAME】Write Successful!"
SLOG_CLEAN
del_lock
@@ -387,27 +387,29 @@ yml_other_set()
# smart auto switch
begin
if ('${8}' == '1' or '${9}' == '1' or '${11}' != '0' or '${12}' != '0' or '${12}' == '1' or '${13}' == '1') and Value.key?('proxy-groups') and Value['proxy-groups'].is_a?(Array) then
if ('${8}' == '1' or '${9}' == '1' or '${11}' != '0' or '${12}' != '0' or '${12}' == '1' or '${13}' == '1' or '${14}' != '0') and Value.key?('proxy-groups') and Value['proxy-groups'].is_a?(Array) then
Value['proxy-groups'].each{|group|
threads << Thread.new {
if '${8}' == '1' and ['url-test', 'load-balance'].include?(group['type']) then
group['type'] = 'smart';
group['uselightgbm'] = true if '${12}' == '1';
group['collectdata'] = true if '${9}' == '1';
group['sample-rate'] = '${10}'.to_f if '${9}' == '1';
end;
if '${9}' == '1' and group['type'] == 'smart' then
group['collectdata'] = true;
group['sample-rate'] = '${10}'.to_f;
end;
if '${11}' != '0' and group['type'] == 'smart' then
group['policy-priority'] = '${11}';
end;
if '${12}' == '1' and group['type'] == 'smart' then
group['uselightgbm'] = true;
end;
if '${13}' == '1' and group['type'] == 'smart' then
group['prefer-asn'] = true;
if group['type'] == 'smart' then
if '${9}' == '1' then
group['collectdata'] = true;
group['sample-rate'] = '${10}'.to_f;
end;
if '${11}' != '0'then
group['policy-priority'] = '${11}';
end;
if '${12}' == '1' then
group['uselightgbm'] = true;
end;
if '${13}' == '1' then
group['prefer-asn'] = true;
end;
if '${14}' != '0' then
group['tolerance'] = '${14}'.to_i;
end;
end;
};
};
@@ -425,11 +427,11 @@ yml_other_set()
YAML.LOG_ERROR('Config File Overwrite Failed,【%s】' % [e.message])
ensure
begin
File.open('$2','w') {|f| YAML.dump(Value, f)};
YAML.dump(Value, '$2');
rescue Exception => e
YAML.LOG_ERROR('Write file failed:【%s】' % [e.message])
end
end" 2>/dev/null >> $LOG_FILE
}
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}" "${13}"
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}" "${13}" "${14}"
File diff suppressed because it is too large. Load diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

@@ -1,23 +1,23 @@
var CM6=(()=>{var Dk=Object.create;var es=Object.defineProperty;var Ik=Object.getOwnPropertyDescriptor;var Bk=Object.getOwnPropertyNames;var Nk=Object.getPrototypeOf,jk=Object.prototype.hasOwnProperty;var zk=(t,e,i)=>e in t?es(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var Yk=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}},qk=(t,e)=>{for(var i in e)es(t,i,{get:e[i],enumerable:!0})},bg=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Bk(e))!jk.call(t,r)&&r!==i&&es(t,r,{get:()=>e[r],enumerable:!(n=Ik(e,r))||n.enumerable});return t};var Wk=(t,e,i)=>(i=t!=null?Dk(Nk(t)):{},bg(e||!t||!t.__esModule?es(i,"default",{value:t,enumerable:!0}):i,t)),Vk=t=>bg(es({},"__esModule",{value:!0}),t);var K=(t,e,i)=>zk(t,typeof e!="symbol"?e+"":e,i);var Qk=Yk((CZ,vk)=>{function uk(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let i=t[e],n=typeof i;(n==="object"||n==="function")&&!Object.isFrozen(i)&&uk(i)}),t}var ac=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function dk(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function on(t,...e){let i=Object.create(null);for(let n in t)i[n]=t[n];return e.forEach(function(n){for(let r in n)i[r]=n[r]}),i}var xL="</span>",ok=t=>!!t.scope,kL=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let i=t.split(".");return[`${e}${i.shift()}`,...i.map((n,r)=>`${n}${"_".repeat(r+1)}`)].join(" ")}return`${e}${t}`},rg=class{constructor(e,i){this.buffer="",this.classPrefix=i.classPrefix,e.walk(this)}addText(e){this.buffer+=dk(e)}openNode(e){if(!ok(e))return;let i=kL(e.scope,{prefix:this.classPrefix});this.span(i)}closeNode(e){ok(e)&&(this.buffer+=xL)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},lk=(t={})=>{let e={children:[]};return Object.assign(e,t),e},sg=class t{constructor(){this.rootNode=lk(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let i=lk({scope:e});this.add(i),this.stack.push(i)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,i){return typeof i=="string"?e.addText(i):i.children&&(e.openNode(i),i.children.forEach(n=>this._walk(e,n)),e.closeNode(i)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(i=>typeof i=="string")?e.children=[e.children.join("")]:e.children.forEach(i=>{t._collapse(i)}))}},og=class extends sg{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,i){let n=e.root;i&&(n.scope=`language:${i}`),this.add(n)}toHTML(){return new rg(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Qo(t){return t?typeof t=="string"?t:t.source:null}function pk(t){return Hn("(?=",t,")")}function wL(t){return Hn("(?:",t,")*")}function vL(t){return Hn("(?:",t,")?")}function Hn(...t){return t.map(i=>Qo(i)).join("")}function QL(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function ag(...t){return"("+(QL(t).capture?"":"?:")+t.map(n=>Qo(n)).join("|")+")"}function gk(t){return new RegExp(t.toString()+"|").exec("").length-1}function PL(t,e){let i=t&&t.exec(e);return i&&i.index===0}var $L=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function cg(t,{joinWith:e}){let i=0;return t.map(n=>{i+=1;let r=i,s=Qo(n),o="";for(;s.length>0;){let l=$L.exec(s);if(!l){o+=s;break}o+=s.substring(0,l.index),s=s.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?o+="\\"+String(Number(l[1])+r):(o+=l[0],l[0]==="("&&i++)}return o}).map(n=>`(${n})`).join(e)}var TL=/\b\B/,Ok="[a-zA-Z]\\w*",hg="[a-zA-Z_]\\w*",mk="\\b\\d+(\\.\\d+)?",bk="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",yk="\\b(0b[01]+)",CL="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",AL=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=Hn(e,/.*\b/,t.binary,/\b.*/)),on({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(i,n)=>{i.index!==0&&n.ignoreMatch()}},t)},Po={begin:"\\\\[\\s\\S]",relevance:0},RL={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Po]},EL={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Po]},ML={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|suLine truncated
https://github.com/highlightjs/highlight.js/issues/2277`),te=P,Y=D),V===void 0&&(V=!0);let re={code:Y,language:te};E("before:highlight",re);let J=re.result?re.result:f(re.language,re.code,V);return J.code=re.code,E("after:highlight",J),J}function f(P,D,V,Y){let te=Object.create(null);function re(B,q){return B.keywords[q]}function J(){if(!H.keywords){Ye.addText(Pe);return}let B=0;H.keywordPatternRe.lastIndex=0;let q=H.keywordPatternRe.exec(Pe),ee="";for(;q;){ee+=Pe.substring(B,q.index);let Se=ii.case_insensitive?q[0].toLowerCase():q[0],He=re(H,Se);if(He){let[yi,_k]=He;if(Ye.addText(ee),ee="",te[Se]=(te[Se]||0)+1,te[Se]<=cX&&(Ao+=_k),yi.startsWith("_"))ee+=q[0];else{let Zk=ii.classNameAliases[yi]||yi;xe(q[0],Zk)}}else ee+=q[0];B=H.keywordPatternRe.lastIndex,q=H.keywordPatternRe.exec(Pe)}ee+=Pe.substring(B),Ye.addText(ee)}function ye(){if(Pe==="")return;let B=null;if(typeof H.subLanguage=="string"){if(!e[H.subLanguage]){Ye.addText(Pe);return}B=f(H.subLanguage,Pe,!0,mg[H.subLanguage]),mg[H.subLanguage]=B._top}else B=d(Pe,H.subLanguage.length?H.subLanguage:null);H.relevance>0&&(Ao+=B.relevance),Ye.__addSublanguage(B._emitter,B.language)}function ce(){H.subLanguage!=null?ye():J(),Pe=""}function xe(B,q){B!==""&&(Ye.startScope(q),Ye.addText(B),Ye.endScope())}function dt(B,q){let ee=1,Se=q.length-1;for(;ee<=Se;){if(!B._emit[ee]){ee++;continue}let He=ii.classNameAliases[B[ee]]||B[ee],yi=q[ee];He?xe(yi,He):(Pe=yi,J(),Pe=""),ee++}}function Nt(B,q){return B.scope&&typeof B.scope=="string"&&Ye.openNode(ii.classNameAliases[B.scope]||B.scope),B.beginScope&&(B.beginScope._wrap?(xe(Pe,ii.classNameAliases[B.beginScope._wrap]||B.beginScope._wrap),Pe=""):B.beginScope._multi&&(dt(B.beginScope,q),Pe="")),H=Object.create(B,{parent:{value:H}}),H}function Jr(B,q,ee){let Se=PL(B.endRe,ee);if(Se){if(B["on:end"]){let He=new ac(B);B["on:end"](q,He),He.isMatchIgnored&&(Se=!1)}if(Se){for(;B.endsParent&&B.parent;)B=B.parent;return B}}if(B.endsWithParent)return Jr(B.parent,q,ee)}function To(B){return H.matcher.regexIndex===0?(Pe+=B[0],1):(Oc=!0,0)}function Ek(B){let q=B[0],ee=B.rule,Se=new ac(ee),He=[ee.__beforeBegin,ee["on:begin"]];for(let yi of He)if(yi&&(yi(B,Se),Se.isMatchIgnored))return To(q);return ee.skip?Pe+=q:(ee.excludeBegin&&(Pe+=q),ce(),!ee.returnBegin&&!ee.excludeBegin&&(Pe=q)),Nt(ee,B),ee.returnBegin?0:q.length}function Mk(B){let q=B[0],ee=D.substring(B.index),Se=Jr(H,B,ee);if(!Se)return fk;let He=H;H.endScope&&H.endScope._wrap?(ce(),xe(q,H.endScope._wrap)):H.endScope&&H.endScope._multi?(ce(),dt(H.endScope,B)):He.skip?Pe+=q:(He.returnEnd||He.excludeEnd||(Pe+=q),ce(),He.excludeEnd&&(Pe=q));do H.scope&&Ye.closeNode(),!H.skip&&!H.subLanguage&&(Ao+=H.relevance),H=H.parent;while(H!==Se.parent);return Se.starts&&Nt(Se.starts,B),He.returnEnd?0:q.length}function Lk(){let B=[];for(let q=H;q!==ii;q=q.parent)q.scope&&B.unshift(q.scope);B.forEach(q=>Ye.openNode(q))}let Co={};function Og(B,q){let ee=q&&q[0];if(Pe+=B,ee==null)return ce(),0;if(Co.type==="begin"&&q.type==="end"&&Co.index===q.index&&ee===""){if(Pe+=D.slice(q.index,q.index+1),!r){let Se=new Error(`0 width match regex (${P})`);throw Se.languageName=P,Se.badRule=Co.rule,Se}return 1}if(Co=q,q.type==="begin")return Ek(q);if(q.type==="illegal"&&!V){let Se=new Error('Illegal lexeme "'+ee+'" for mode "'+(H.scope||"<unnamed>")+'"');throw Se.mode=H,Se}else if(q.type==="end"){let Se=Mk(q);if(Se!==fk)return Se}if(q.type==="illegal"&&ee==="")return Pe+=`
`,1;if(gc>1e5&&gc>q.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Pe+=ee,ee.length}let ii=C(P);if(!ii)throw Fn(s.replace("{}",P)),new Error('Unknown language: "'+P+'"');let Xk=oX(ii),pc="",H=Y||Xk,mg={},Ye=new l.__emitter(l);Lk();let Pe="",Ao=0,ln=0,gc=0,Oc=!1;try{if(ii.__emitTokens)ii.__emitTokens(D,Ye);else{for(H.matcher.considerAll();;){gc++,Oc?Oc=!1:H.matcher.considerAll(),H.matcher.lastIndex=ln;let B=H.matcher.exec(D);if(!B)break;let q=D.substring(ln,B.index),ee=Og(q,B);ln=B.index+ee}Og(D.substring(ln))}return Ye.finalize(),pc=Ye.toHTML(),{language:P,value:pc,relevance:Ao,illegal:!1,_emitter:Ye,_top:H}}catch(B){if(B.message&&B.message.includes("Illegal"))return{language:P,value:ng(D),illegal:!0,relevance:0,_illegalBy:{message:B.message,index:ln,context:D.slice(ln-100,ln+100),mode:B.mode,resultSoFar:pc},_emitter:Ye};if(r)return{language:P,value:ng(D),illegal:!1,relevance:0,errorRaised:B,_emitter:Ye,_top:H};throw B}}function u(P){let D={value:ng(P),illegal:!1,relevance:0,_top:o,_emitter:new l.__emitter(l)};return D._emitter.addText(P),D}function d(P,D){D=D||l.languages||Object.keys(e);let V=u(P),Y=D.filter(C).filter(N).map(ce=>f(ce,P,!1));Y.unshift(V);let te=Y.sort((ce,xe)=>{if(ce.relevance!==xe.relevance)return xe.relevance-ce.relevance;if(ce.language&&xe.language){if(C(ce.language).supersetOf===xe.language)return 1;if(C(xe.language).supersetOf===ce.language)return-1}return 0}),[re,J]=te,ye=re;return ye.secondBest=J,ye}function p(P,D,V){let Y=D&&i[D]||V;P.classList.add("hljs"),P.classList.add(`language-${Y}`)}function g(P){let D=null,V=h(P);if(a(V))return;if(E("before:highlightElement",{el:P,language:V}),P.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",P);return}if(P.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(P)),l.throwUnescapedHTML))throw new lg("One of your code blocks includes unescaped HTML.",P.innerHTML);D=P;let Y=D.textContent,te=V?c(Y,{language:V,ignoreIllegals:!0}):d(Y);P.innerHTML=te.value,P.dataset.highlighted="yes",p(P,V,te.language),P.result={language:te.language,re:te.relevance,relevance:te.relevance},te.secondBest&&(P.secondBest={language:te.secondBest.language,relevance:te.secondBest.relevance}),E("after:highlightElement",{el:P,result:te,text:Y})}function m(P){l=hk(l,P)}let b=()=>{v(),Hr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){v(),Hr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let S=!1;function v(){function P(){v()}if(document.readyState==="loading"){S||window.addEventListener("DOMContentLoaded",P,!1),S=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function x(P,D){let V=null;try{V=D(t)}catch(Y){if(Fn("Language definition for '{}' could not be registered.".replace("{}",P)),r)Fn(Y);else throw Y;V=o}V.name||(V.name=P),e[P]=V,V.rawDefinition=D.bind(null,t),V.aliases&&_(V.aliases,{languageName:P})}function w(P){delete e[P];for(let D of Object.keys(i))i[D]===P&&delete i[D]}function k(){return Object.keys(e)}function C(P){return P=(P||"").toLowerCase(),e[P]||e[i[P]]}function _(P,{languageName:D}){typeof P=="string"&&(P=[P]),P.forEach(V=>{i[V.toLowerCase()]=D})}function N(P){let D=C(P);return D&&!D.disableAutodetect}function R(P){P["before:highlightBlock"]&&!P["before:highlightElement"]&&(P["before:highlightElement"]=D=>{P["before:highlightBlock"](Object.assign({block:D.el},D))}),P["after:highlightBlock"]&&!P["after:highlightElement"]&&(P["after:highlightElement"]=D=>{P["after:highlightBlock"](Object.assign({block:D.el},D))})}function $(P){R(P),n.push(P)}function j(P){let D=n.indexOf(P);D!==-1&&n.splice(D,1)}function E(P,D){let V=P;n.forEach(function(Y){Y[V]&&Y[V](D)})}function U(P){return Hr("10.7.0","highlightBlock will be removed entirely in v12.0"),Hr("10.7.0","Please use highlightElement now."),g(P)}Object.assign(t,{highlight:c,highlightAuto:d,highlightAll:v,highlightElement:g,highlightBlock:U,configure:m,initHighlighting:b,initHighlightingOnLoad:y,registerLanguage:x,unregisterLanguage:w,listLanguages:k,getLanguage:C,registerAliases:_,autoDetection:N,inherit:hk,addPlugin:$,removePlugin:j}),t.debugMode=function(){r=!1},t.safeMode=function(){r=!0},t.versionString=aX,t.regex={concat:Hn,lookahead:pk,either:ag,optional:vL,anyNumberOfTimes:wL};for(let P in lc)typeof lc[P]=="object"&&uk(lc[P]);return Object.assign(t,lc),t},Kr=wk({});Kr.newInstance=()=>wk({});vk.exports=Kr;Kr.HighlightJS=Kr;Kr.default=Kr});var EX={};qk(EX,{Compartment:()=>ni,EditorState:()=>he,EditorView:()=>T,HighlightStyle:()=>Vt,MergeView:()=>Ja,StreamLanguage:()=>_s,autocompletion:()=>Fb,baseExtensions:()=>yX,bracketMatching:()=>Rf,closeBrackets:()=>Tu,closeBracketsKeymap:()=>Cu, Line truncated
var CM6=(()=>{var Nk=Object.create;var es=Object.defineProperty;var jk=Object.getOwnPropertyDescriptor;var zk=Object.getOwnPropertyNames;var Yk=Object.getPrototypeOf,qk=Object.prototype.hasOwnProperty;var Wk=(t,e,i)=>e in t?es(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var Vk=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}},Gk=(t,e)=>{for(var i in e)es(t,i,{get:e[i],enumerable:!0})},mg=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of zk(e))!qk.call(t,r)&&r!==i&&es(t,r,{get:()=>e[r],enumerable:!(n=jk(e,r))||n.enumerable});return t};var Uk=(t,e,i)=>(i=t!=null?Nk(Yk(t)):{},mg(e||!t||!t.__esModule?es(i,"default",{value:t,enumerable:!0}):i,t)),Fk=t=>mg(es({},"__esModule",{value:!0}),t);var K=(t,e,i)=>Wk(t,typeof e!="symbol"?e+"":e,i);var vk=Vk((MZ,wk)=>{function fk(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let i=t[e],n=typeof i;(n==="object"||n==="function")&&!Object.isFrozen(i)&&fk(i)}),t}var lc=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function uk(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function on(t,...e){let i=Object.create(null);for(let n in t)i[n]=t[n];return e.forEach(function(n){for(let r in n)i[r]=n[r]}),i}var vL="</span>",sk=t=>!!t.scope,QL=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let i=t.split(".");return[`${e}${i.shift()}`,...i.map((n,r)=>`${n}${"_".repeat(r+1)}`)].join(" ")}return`${e}${t}`},ng=class{constructor(e,i){this.buffer="",this.classPrefix=i.classPrefix,e.walk(this)}addText(e){this.buffer+=uk(e)}openNode(e){if(!sk(e))return;let i=QL(e.scope,{prefix:this.classPrefix});this.span(i)}closeNode(e){sk(e)&&(this.buffer+=vL)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},ok=(t={})=>{let e={children:[]};return Object.assign(e,t),e},rg=class t{constructor(){this.rootNode=ok(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let i=ok({scope:e});this.add(i),this.stack.push(i)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,i){return typeof i=="string"?e.addText(i):i.children&&(e.openNode(i),i.children.forEach(n=>this._walk(e,n)),e.closeNode(i)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(i=>typeof i=="string")?e.children=[e.children.join("")]:e.children.forEach(i=>{t._collapse(i)}))}},sg=class extends rg{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,i){let n=e.root;i&&(n.scope=`language:${i}`),this.add(n)}toHTML(){return new ng(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Qo(t){return t?typeof t=="string"?t:t.source:null}function dk(t){return Hn("(?=",t,")")}function PL(t){return Hn("(?:",t,")*")}function $L(t){return Hn("(?:",t,")?")}function Hn(...t){return t.map(i=>Qo(i)).join("")}function TL(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function lg(...t){return"("+(TL(t).capture?"":"?:")+t.map(n=>Qo(n)).join("|")+")"}function pk(t){return new RegExp(t.toString()+"|").exec("").length-1}function CL(t,e){let i=t&&t.exec(e);return i&&i.index===0}var AL=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function ag(t,{joinWith:e}){let i=0;return t.map(n=>{i+=1;let r=i,s=Qo(n),o="";for(;s.length>0;){let l=AL.exec(s);if(!l){o+=s;break}o+=s.substring(0,l.index),s=s.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?o+="\\"+String(Number(l[1])+r):(o+=l[0],l[0]==="("&&i++)}return o}).map(n=>`(${n})`).join(e)}var RL=/\b\B/,gk="[a-zA-Z]\\w*",cg="[a-zA-Z_]\\w*",Ok="\\b\\d+(\\.\\d+)?",mk="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",bk="\\b(0b[01]+)",EL="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ML=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=Hn(e,/.*\b/,t.binary,/\b.*/)),on({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(i,n)=>{i.index!==0&&n.ignoreMatch()}},t)},Po={begin:"\\\\[\\s\\S]",relevance:0},LL={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Po]},XL={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Po]},_L={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|suLine truncated
https://github.com/highlightjs/highlight.js/issues/2277`),te=P,Y=D),V===void 0&&(V=!0);let re={code:Y,language:te};E("before:highlight",re);let J=re.result?re.result:f(re.language,re.code,V);return J.code=re.code,E("after:highlight",J),J}function f(P,D,V,Y){let te=Object.create(null);function re(B,q){return B.keywords[q]}function J(){if(!H.keywords){Ye.addText(Pe);return}let B=0;H.keywordPatternRe.lastIndex=0;let q=H.keywordPatternRe.exec(Pe),ee="";for(;q;){ee+=Pe.substring(B,q.index);let Se=ii.case_insensitive?q[0].toLowerCase():q[0],He=re(H,Se);if(He){let[yi,Ik]=He;if(Ye.addText(ee),ee="",te[Se]=(te[Se]||0)+1,te[Se]<=uX&&(Co+=Ik),yi.startsWith("_"))ee+=q[0];else{let Bk=ii.classNameAliases[yi]||yi;xe(q[0],Bk)}}else ee+=q[0];B=H.keywordPatternRe.lastIndex,q=H.keywordPatternRe.exec(Pe)}ee+=Pe.substring(B),Ye.addText(ee)}function ye(){if(Pe==="")return;let B=null;if(typeof H.subLanguage=="string"){if(!e[H.subLanguage]){Ye.addText(Pe);return}B=f(H.subLanguage,Pe,!0,Og[H.subLanguage]),Og[H.subLanguage]=B._top}else B=d(Pe,H.subLanguage.length?H.subLanguage:null);H.relevance>0&&(Co+=B.relevance),Ye.__addSublanguage(B._emitter,B.language)}function ce(){H.subLanguage!=null?ye():J(),Pe=""}function xe(B,q){B!==""&&(Ye.startScope(q),Ye.addText(B),Ye.endScope())}function dt(B,q){let ee=1,Se=q.length-1;for(;ee<=Se;){if(!B._emit[ee]){ee++;continue}let He=ii.classNameAliases[B[ee]]||B[ee],yi=q[ee];He?xe(yi,He):(Pe=yi,J(),Pe=""),ee++}}function Nt(B,q){return B.scope&&typeof B.scope=="string"&&Ye.openNode(ii.classNameAliases[B.scope]||B.scope),B.beginScope&&(B.beginScope._wrap?(xe(Pe,ii.classNameAliases[B.beginScope._wrap]||B.beginScope._wrap),Pe=""):B.beginScope._multi&&(dt(B.beginScope,q),Pe="")),H=Object.create(B,{parent:{value:H}}),H}function Jr(B,q,ee){let Se=CL(B.endRe,ee);if(Se){if(B["on:end"]){let He=new lc(B);B["on:end"](q,He),He.isMatchIgnored&&(Se=!1)}if(Se){for(;B.endsParent&&B.parent;)B=B.parent;return B}}if(B.endsWithParent)return Jr(B.parent,q,ee)}function $o(B){return H.matcher.regexIndex===0?(Pe+=B[0],1):(gc=!0,0)}function Xk(B){let q=B[0],ee=B.rule,Se=new lc(ee),He=[ee.__beforeBegin,ee["on:begin"]];for(let yi of He)if(yi&&(yi(B,Se),Se.isMatchIgnored))return $o(q);return ee.skip?Pe+=q:(ee.excludeBegin&&(Pe+=q),ce(),!ee.returnBegin&&!ee.excludeBegin&&(Pe=q)),Nt(ee,B),ee.returnBegin?0:q.length}function _k(B){let q=B[0],ee=D.substring(B.index),Se=Jr(H,B,ee);if(!Se)return hk;let He=H;H.endScope&&H.endScope._wrap?(ce(),xe(q,H.endScope._wrap)):H.endScope&&H.endScope._multi?(ce(),dt(H.endScope,B)):He.skip?Pe+=q:(He.returnEnd||He.excludeEnd||(Pe+=q),ce(),He.excludeEnd&&(Pe=q));do H.scope&&Ye.closeNode(),!H.skip&&!H.subLanguage&&(Co+=H.relevance),H=H.parent;while(H!==Se.parent);return Se.starts&&Nt(Se.starts,B),He.returnEnd?0:q.length}function Zk(){let B=[];for(let q=H;q!==ii;q=q.parent)q.scope&&B.unshift(q.scope);B.forEach(q=>Ye.openNode(q))}let To={};function gg(B,q){let ee=q&&q[0];if(Pe+=B,ee==null)return ce(),0;if(To.type==="begin"&&q.type==="end"&&To.index===q.index&&ee===""){if(Pe+=D.slice(q.index,q.index+1),!r){let Se=new Error(`0 width match regex (${P})`);throw Se.languageName=P,Se.badRule=To.rule,Se}return 1}if(To=q,q.type==="begin")return Xk(q);if(q.type==="illegal"&&!V){let Se=new Error('Illegal lexeme "'+ee+'" for mode "'+(H.scope||"<unnamed>")+'"');throw Se.mode=H,Se}else if(q.type==="end"){let Se=_k(q);if(Se!==hk)return Se}if(q.type==="illegal"&&ee==="")return Pe+=`
`,1;if(pc>1e5&&pc>q.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Pe+=ee,ee.length}let ii=C(P);if(!ii)throw Fn(s.replace("{}",P)),new Error('Unknown language: "'+P+'"');let Dk=cX(ii),dc="",H=Y||Dk,Og={},Ye=new l.__emitter(l);Zk();let Pe="",Co=0,ln=0,pc=0,gc=!1;try{if(ii.__emitTokens)ii.__emitTokens(D,Ye);else{for(H.matcher.considerAll();;){pc++,gc?gc=!1:H.matcher.considerAll(),H.matcher.lastIndex=ln;let B=H.matcher.exec(D);if(!B)break;let q=D.substring(ln,B.index),ee=gg(q,B);ln=B.index+ee}gg(D.substring(ln))}return Ye.finalize(),dc=Ye.toHTML(),{language:P,value:dc,relevance:Co,illegal:!1,_emitter:Ye,_top:H}}catch(B){if(B.message&&B.message.includes("Illegal"))return{language:P,value:ig(D),illegal:!0,relevance:0,_illegalBy:{message:B.message,index:ln,context:D.slice(ln-100,ln+100),mode:B.mode,resultSoFar:dc},_emitter:Ye};if(r)return{language:P,value:ig(D),illegal:!1,relevance:0,errorRaised:B,_emitter:Ye,_top:H};throw B}}function u(P){let D={value:ig(P),illegal:!1,relevance:0,_top:o,_emitter:new l.__emitter(l)};return D._emitter.addText(P),D}function d(P,D){D=D||l.languages||Object.keys(e);let V=u(P),Y=D.filter(C).filter(N).map(ce=>f(ce,P,!1));Y.unshift(V);let te=Y.sort((ce,xe)=>{if(ce.relevance!==xe.relevance)return xe.relevance-ce.relevance;if(ce.language&&xe.language){if(C(ce.language).supersetOf===xe.language)return 1;if(C(xe.language).supersetOf===ce.language)return-1}return 0}),[re,J]=te,ye=re;return ye.secondBest=J,ye}function p(P,D,V){let Y=D&&i[D]||V;P.classList.add("hljs"),P.classList.add(`language-${Y}`)}function g(P){let D=null,V=h(P);if(a(V))return;if(E("before:highlightElement",{el:P,language:V}),P.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",P);return}if(P.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(P)),l.throwUnescapedHTML))throw new og("One of your code blocks includes unescaped HTML.",P.innerHTML);D=P;let Y=D.textContent,te=V?c(Y,{language:V,ignoreIllegals:!0}):d(Y);P.innerHTML=te.value,P.dataset.highlighted="yes",p(P,V,te.language),P.result={language:te.language,re:te.relevance,relevance:te.relevance},te.secondBest&&(P.secondBest={language:te.secondBest.language,relevance:te.secondBest.relevance}),E("after:highlightElement",{el:P,result:te,text:Y})}function m(P){l=ck(l,P)}let b=()=>{v(),Hr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){v(),Hr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let S=!1;function v(){function P(){v()}if(document.readyState==="loading"){S||window.addEventListener("DOMContentLoaded",P,!1),S=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function x(P,D){let V=null;try{V=D(t)}catch(Y){if(Fn("Language definition for '{}' could not be registered.".replace("{}",P)),r)Fn(Y);else throw Y;V=o}V.name||(V.name=P),e[P]=V,V.rawDefinition=D.bind(null,t),V.aliases&&_(V.aliases,{languageName:P})}function w(P){delete e[P];for(let D of Object.keys(i))i[D]===P&&delete i[D]}function k(){return Object.keys(e)}function C(P){return P=(P||"").toLowerCase(),e[P]||e[i[P]]}function _(P,{languageName:D}){typeof P=="string"&&(P=[P]),P.forEach(V=>{i[V.toLowerCase()]=D})}function N(P){let D=C(P);return D&&!D.disableAutodetect}function R(P){P["before:highlightBlock"]&&!P["before:highlightElement"]&&(P["before:highlightElement"]=D=>{P["before:highlightBlock"](Object.assign({block:D.el},D))}),P["after:highlightBlock"]&&!P["after:highlightElement"]&&(P["after:highlightElement"]=D=>{P["after:highlightBlock"](Object.assign({block:D.el},D))})}function $(P){R(P),n.push(P)}function j(P){let D=n.indexOf(P);D!==-1&&n.splice(D,1)}function E(P,D){let V=P;n.forEach(function(Y){Y[V]&&Y[V](D)})}function U(P){return Hr("10.7.0","highlightBlock will be removed entirely in v12.0"),Hr("10.7.0","Please use highlightElement now."),g(P)}Object.assign(t,{highlight:c,highlightAuto:d,highlightAll:v,highlightElement:g,highlightBlock:U,configure:m,initHighlighting:b,initHighlightingOnLoad:y,registerLanguage:x,unregisterLanguage:w,listLanguages:k,getLanguage:C,registerAliases:_,autoDetection:N,inherit:ck,addPlugin:$,removePlugin:j}),t.debugMode=function(){r=!1},t.safeMode=function(){r=!0},t.versionString=fX,t.regex={concat:Hn,lookahead:dk,either:lg,optional:$L,anyNumberOfTimes:PL};for(let P in oc)typeof oc[P]=="object"&&fk(oc[P]);return Object.assign(t,oc),t},Kr=kk({});Kr.newInstance=()=>kk({});wk.exports=Kr;Kr.HighlightJS=Kr;Kr.default=Kr});var _X={};Gk(_X,{Compartment:()=>ni,EditorState:()=>he,EditorView:()=>T,HighlightStyle:()=>Vt,MergeView:()=>Ka,StreamLanguage:()=>_s,autocompletion:()=>Ub,baseExtensions:()=>kX,bracketMatching:()=>Af,closeBrackets:()=>$u,closeBracketsKeymap:()=>Tu, Line truncated
`){[e,i]=ir(this,e,i);let r="";for(let s=0,o=0;s<=i&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=n),e<a&&i>s&&(r+=l.slice(Math.max(0,e-s),i-s)),s=a+1}return r}flatten(e){for(let i of this.text)e.push(i)}scanIdentical(){return 0}static split(e,i){let n=[],r=-1;for(let s of e)n.push(s),r+=s.length+1,n.length==32&&(i.push(new t(n,r)),n=[],r=-1);return r>-1&&i.push(new t(n,r)),i}},Jn=class t extends ie{constructor(e,i){super(),this.children=e,this.length=i,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,i,n,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=n+o.lines-1;if((i?a:l)>=e)return o.lineInner(e,i,n,r);r=l+1,n=a+1}}decompose(e,i,n,r){for(let s=0,o=0;o<=i&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&i>=o){let h=r&((o<=e?1:0)|(a>=i?2:0));o>=e&&a<=i&&!h?n.push(l):l.decompose(e-o,i-o,n,h)}o=a+1}}replace(e,i,n){if([e,i]=ir(this,e,i),n.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&i<=l){let a=o.replace(e-s,i-s,n),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new t(c,this.length-(i-e)+n.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,i,n)}sliceString(e,i=this.length,n=`
`){[e,i]=ir(this,e,i);let r="";for(let s=0,o=0;s<this.children.length&&o<=i;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=n),e<a&&i>o&&(r+=l.sliceString(e-o,i-o,n)),o=a+1}return r}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof t))return 0;let n=0,[r,s,o,l]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=i,s+=i){if(r==o||s==l)return n;let a=this.children[r],h=e.children[s];if(a!=h)return n+a.scanIdentical(h,i);n+=a.length+1}}static from(e,i=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let d of e)n+=d.lines;if(n<32){let d=[];for(let p of e)p.flatten(d);return new wt(d,i)}let r=Math.max(32,n>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>s&&d instanceof t)for(let g of d.children)f(g);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof wt&&a&&(p=c[c.length-1])instanceof wt&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new wt(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>r&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:t.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new t(l,i)}};ie.empty=new wt([""],0);function Fk(t){let e=-1;for(let i of t)e+=i.length+1;return e}function Mo(t,e,i=0,n=1e9){for(let r=0,s=0,o=!0;s<t.length&&r<=n;s++){let l=t[s],a=r+l.length;a>=i&&(a>n&&(l=l.slice(0,n-r)),r<i&&(l=l.slice(i-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function $g(t,e,i){return Mo(t,[""],e,i)}var hn=class{constructor(e,i=1){this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[i>0?1:(e instanceof wt?e.text.length:e.children.length)<<1]}nextInner(e,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,l=r instanceof wt?r.text.length:r.children.length;if(o==(i>0?l:0)){if(n==0)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(i>0?0:1)){if(this.offsets[n]+=i,e==0)return this.lineBreak=!0,this.value=`
`,this;e--}else if(r instanceof wt){let a=r.text[o+(i<0?-1:0)];if(this.offsets[n]+=i,a.length>Math.max(0,e))return this.value=e==0?a:i>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(i<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(i>0?1:(a instanceof wt?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Lo=class{constructor(e,i,n){this.value="",this.done=!1,this.cursor=new hn(e,i>n?-1:1),this.pos=i>n?e.length:0,this.from=Math.min(i,n),this.to=Math.max(i,n)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let n=i<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*i,this.value=r.length<=n?r:i<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Xo=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:n,value:r}=this.inner.next(e);return i&&this.afterBreak?(this.value="",this.afterBreak=!1):i?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(ie.prototype[Symbol.iterator]=function(){return this.iter()},hn.prototype[Symbol.iterator]=Lo.prototype[Symbol.iterator]=Xo.prototype[Symbol.iterator]=function(){return this});var Sc=class{constructor(e,i,n,r){this.from=e,this.to=i,this.number=n,this.text=r}get length(){return this.to-this.from}};function ir(t,e,i){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,i))]}function Xe(t,e,i=!0,n=!0){return wg(t,e,i,n)}function Hk(t){return t>=56320&&t<57344}function Kk(t){return t>=55296&&t<56320}function We(t,e){let i=t.charCodeAt(e);if(!Kk(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return Hk(n)?(i-55296<<10)+(n-56320)+65536:i}function os(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function vt(t){return t<65536?1:2}var xc=/\r\n?|\n/,De=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(De||(De={})),Si=class t{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;i<this.sections.length;i+=2)e+=this.sections[i];return e}get newLength(){let e=0;for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i+1];e+=n<0?this.sections[i]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,n=0,r=0;i<this.sections.length;){let s=this.sections[i++],o=this.sections[i++];o<0?(e(n,r,s),r+=s):r+=o,n+=s}}iterChangedRanges(e,i=!1){kc(this,e,i)}get invertedDesc(){let e=[];for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];r<0?e.push(n,r):e.push(r,n)}return new t(e)}composeDesc(e){return this.empty?e:e.empty?this:Mg(this,e)}mapDesc(e,i=!1){return e.empty?this:wc(this,e,i)}mapPos(e,i=-1,n=De.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=r+l;if(a<0){if(h>e)return s+(e-r);s+=l}else{if(n!=De.Simple&&h>=e&&(n==De.TrackDel&&r<e&&h>e||n==De.TrackBefore&&r<e||n==De.TrackAfter&&h>e))return null;if(h>e||h==e&&i<0&&!l)return e==r||i<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,i=e){for(let n=0,r=0;n<this.sections.length&&r<=i;){let s=this.sections[n++],o=this.sections[n++],l=r+s;if(o>=0&&r<=i&&l>=e)return r<e&&l>i?"cover":!0;r=l}return!1}toString(){let e="";for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}static create(e){return new t(e)}},qe=class t extends Si{constructor(e,i){super(e),this.inserted=i}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return kc(this,(i,n,r,s,o)=>e=e.replace(r,r+(n-i),o),!1),e}mapDesc(e,i=!1){return wc(this,e,i,!0)}invert(e){let i=this.sections.slice(),n=[];for(let r=0,s=0;r<i.length;r+=2){let o=i[r],l=i[r+1];if(l>=0){i[r]=l,i[r+1]=o;let a=r>>1;for(;n.length<a;)n.push(ie.empty);n.push(o?e.slice(s,s+o):ie.empty)}s+=o}return new t(i,n)}compose(e){return this.empty?e:e.empty?this:Mg(this,e,!0)}map(e,i=!1){return e.empty?this:wc(this,e,i,!0)}iterChanges(e,i=!1){kc(this,e,i)}get desc Line truncated
`}get readOnly(){return this.facet(Bg)}phrase(e,...i){for(let n of this.facet(t.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>i.length?n:i[s-1]})),e}languageDataAt(e,i,n=-1){let r=[];for(let s of this.facet(Xg))for(let o of s(this,i,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){return lw(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:i,from:n,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,l=e-n;for(;o>0;){let a=Xe(i,o,!1);if(s(i.slice(a,o))!=ke.Word)break;o=a}for(;l<r;){let a=Xe(i,l);if(s(i.slice(l,a))!=ke.Word)break;l=a}return o==l?null:Q.range(o+n,l+n)}};he.allowMultipleSelections=Qc;he.tabSize=L.define({combine:t=>t.length?t[0]:4});he.lineSeparator=_g;he.readOnly=Bg;he.phrases=L.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every(r=>t[r]==e[r])}});he.languageData=Xg;he.changeFilter=Zg;he.transactionFilter=Dg;he.transactionExtender=Ig;ni.reconfigure=W.define();function Ge(t,e,i={}){let n={};for(let r of t)for(let s of Object.keys(r)){let o=r[s],l=n[s];if(l===void 0)n[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(i,s))n[s]=i[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}var jt=class{eq(e){return this==e}range(e,i=e){return rs.create(e,i,this)}};jt.prototype.startSide=jt.prototype.endSide=0;jt.prototype.point=!1;jt.prototype.mapMode=De.TrackDel;var rs=class t{constructor(e,i,n){this.from=e,this.to=i,this.value=n}static create(e,i,n){return new t(e,i,n)}};function Ac(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}var Rc=class t{constructor(e,i,n,r){this.from=e,this.to=i,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,i,n,r=0){let s=n?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-e||(n?this.value[a].endSide:this.value[a].startSide)-i;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,i,n,r){for(let s=this.findIndex(i,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(r(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,i){let n=[],r=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let h=this.value[a],c=this.from[a]+e,f=this.to[a]+e,u,d;if(c==f){let p=i.mapPos(c,h.startSide,h.mapMode);if(p==null||(u=d=p,h.startSide!=h.endSide&&(d=i.mapPos(c,h.endSide),d<u)))continue}else if(u=i.mapPos(c,h.startSide),d=i.mapPos(f,h.endSide),u>d||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),n.push(h),r.push(u-o),s.push(d-o))}return{mapped:n.length?new t(r,s,n,l):null,pos:o}}},se=class t{constructor(e,i,n,r){this.chunkPos=e,this.chunk=i,this.nextLayer=n,this.maxPoint=r}static create(e,i,n,r){return new t(e,i,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let i of this.chunk)e+=i.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:i=[],sort:n=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(i.length==0&&!o)return this;if(n&&(i=i.slice().sort(Ac)),this.isEmpty)return i.length?t.of(i):this;let l=new Io(this,null,-1).goto(0),a=0,h=[],c=new Ee;for(;l.value||a<i.length;)if(a<i.length&&(l.from-i[a].from||l.startSide-i[a].value.startSide)>=0){let f=i[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==i.length||this.chunkEnd(l.chunkIndex)<i[a].from)&&(!o||r>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||r>l.to||s<l.from||o(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||h.push(rs.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!h.length?t.empty:this.nextLayer.update({add:h,filter:o,filterFrom:r,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],n=[],r=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],h=e.touchesRange(l,l+a.length);if(h===!1)r=Math.max(r,a.maxPoint),i.push(a),n.push(e.mapPos(l));else if(h===!0){let{mapped:c,pos:f}=a.map(l,e);c&&(r=Math.max(r,c.maxPoint),i.push(c),n.push(f))}}let s=this.nextLayer.map(e);return i.length==0?s:new t(n,i,s||t.empty,r)}between(e,i,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r];if(i>=s&&e<=s+o.length&&o.between(s,e-s,i-s,n)===!1)return}this.nextLayer.between(e,i,n)}}iter(e=0){return ss.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return ss.from(e).goto(i)}static compare(e,i,n,r,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=i.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),a=Ag(o,l Line truncated
`)}static newName(){let e=Yg[zg]||1;return Yg[zg]=e+1,"\u037C"+e.toString(36)}static mount(e,i,n){let r=e[Xc],s=n&&n.nonce;r?s&&r.setNonce(s):r=new _c(e,s),r.mount(Array.isArray(i)?i:[i],e)}},qg=new Map,_c=class{constructor(e,i){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=qg.get(n);if(s)return e[Xc]=s;this.sheet=new r.CSSStyleSheet,qg.set(n,this)}else this.styleTag=n.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);this.modules=[],e[Xc]=this}mount(e,i){let n=this.sheet,r=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),n)for(let h=0;h<l.rules.length;h++)n.insertRule(l.rules[h],r++)}else{for(;s<a;)r+=this.modules[s++].rules.length;r+=l.rules.length,s++}}if(n)i.adoptedStyleSheets.indexOf(this.sheet)<0&&(i.adoptedStyleSheets=[this.sheet,...i.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
`;this.styleTag.textContent=o;let l=i.head||i;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var xi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},nr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},cw=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),hw=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(_e=0;_e<10;_e++)xi[48+_e]=xi[96+_e]=String(_e);var _e;for(_e=1;_e<=24;_e++)xi[_e+111]="F"+_e;var _e;for(_e=65;_e<=90;_e++)xi[_e]=String.fromCharCode(_e+32),nr[_e]=String.fromCharCode(_e);var _e;for(No in xi)nr.hasOwnProperty(No)||(nr[No]=xi[No]);var No;function Wg(t){var e=cw&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||hw&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",i=!e&&t.key||(t.shiftKey?nr:xi)[t.keyCode]||t.key||"Unidentified";return i=="Esc"&&(i="Escape"),i=="Del"&&(i="Delete"),i=="Left"&&(i="ArrowLeft"),i=="Up"&&(i="ArrowUp"),i=="Right"&&(i="ArrowRight"),i=="Down"&&(i="ArrowDown"),i}function Oe(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&typeof i=="object"&&i.nodeType==null&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var r=i[n];typeof r=="string"?t.setAttribute(n,r):r!=null&&(t[n]=r)}e++}for(;e<arguments.length;e++)Vg(t,arguments[e]);return t}function Vg(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var i=0;i<e.length;i++)Vg(t,e[i]);else throw new RangeError("Unsupported child node: "+e)}var st=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},Yc=typeof document!="undefined"?document:{documentElement:{style:{}}},qc=/Edge\/(\d+)/.exec(st.userAgent),_O=/MSIE \d/.test(st.userAgent),Wc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(st.userAgent),yl=!!(_O||Wc||qc),Gg=!yl&&/gecko\/(\d+)/i.test(st.userAgent),Zc=!yl&&/Chrome\/(\d+)/.exec(st.userAgent),Ug="webkitFontSmoothing"in Yc.documentElement.style,Vc=!yl&&/Apple Computer/.test(st.vendor),Fg=Vc&&(/Mobile\/\w+/.test(st.userAgent)||st.maxTouchPoints>2),I={mac:Fg||/Mac/.test(st.platform),windows:/Win/.test(st.platform),linux:/Linux|X11/.test(st.platform),ie:yl,ie_version:_O?Yc.documentMode||6:Wc?+Wc[1]:qc?+qc[1]:0,gecko:Gg,gecko_version:Gg?+(/Firefox\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,chrome:!!Zc,chrome_version:Zc?+Zc[1]:0,ios:Fg,android:/Android\b/.test(st.userAgent),webkit:Ug,webkit_version:Ug?+(/\bAppleWebKit\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,safari:Vc,safari_version:Vc?+(/\bVersion\/(\d+(\.\d+)?)/.exec(st.userAgent)||[0,0])[1]:0,tabSize:Yc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function ys(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Gc(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Ko(t,e){if(!e.anchorNode)return!1;try{return Gc(t,e.anchorNode)}catch{return!1}}function cr(t){return t.nodeType==3?gn(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function fs(t,e,i,n){return i?Hg(t,e,i,n,-1)||Hg(t,e,i,n,1):!1}function pn(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function rl(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Hg(t,e,i,n,r){for(;;){if(t==i&&e==n)return!0;if(e==(r<0?0:ai(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=pn(t)+(r<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=r<0?ai(t):0}else return!1}}function ai(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $s(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function fw(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function ZO(t,e){let i=e.width/t.offsetWidth,n=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-t.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}function uw(t,e,i,n,r,Line truncated
`,r=t.state.doc.line(r.number+(i?1:-1)),s=t.bidiSpans(r),h=t.visualLineSide(r,!i)}if(a){if(!a(c))return l}else{if(!n)return h;a=n(c)}l=h}}function qw(t,e,i){let n=t.state.charCategorizer(e),r=n(i);return s=>{let o=n(s);return r==ke.Space&&(r=o),r==o}}function Ww(t,e,i,n){let r=e.head,s=i?1:-1;if(r==(i?t.state.doc.length:0))return Q.cursor(r,e.assoc);let o=e.goalColumn,l,a=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(r,e.assoc||-1),c=t.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let d=t.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,t.defaultCharacterWidth*(r-d.from))),l=(s<0?d.top:d.bottom)+c}let f=a.left+o,u=n!=null?n:t.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*s,g=gm(t,{x:f,y:p},!1,s);if(p<a.top||p>a.bottom||(s<0?g<r:g>r)){let m=t.docView.coordsForChar(g),b=!m||p<m.top?-1:1;return Q.cursor(g,b,void 0,o)}}}function gs(t,e,i){for(;;){let n=0;for(let r of t)r.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=n||i||(e-s<o-e?-1:1);e=a<0?s:o,n=a}});if(!n)return e}}function mm(t,e){let i=null;for(let n=0;n<e.ranges.length;n++){let r=e.ranges[n],s=null;if(r.empty){let o=gs(t,r.from,0);o!=r.from&&(s=Q.cursor(o,-1))}else{let o=gs(t,r.from,-1),l=gs(t,r.to,1);(o!=r.from||l!=r.to)&&(s=Q.range(r.from==r.anchor?o:l,r.from==r.head?o:l))}s&&(i||(i=e.ranges.slice()),i[n]=s)}return i?Q.create(i,e.mainIndex):e}function Ic(t,e,i){let n=gs(t.state.facet(Ts).map(r=>r(t)),i.from,e.head>i.from?-1:1);return n==i.from?i:Q.cursor(n,n<i.from?1:-1)}var as="\uFFFF",rh=class{constructor(e,i){this.points=e,this.text="",this.lineSeparator=i.facet(he.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=as}readRange(e,i){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let s=this.text.length;this.readNode(r);let o=r.nextSibling;if(o==i)break;let l=Qe.get(r),a=Qe.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:rl(r))||rl(o)&&(r.nodeName!="BR"||r.cmIgnore)&&this.text.length>s)&&!Gw(o,i)&&this.lineBreak(),r=o}return this.findPointBefore(n,i),this}readTextNode(e){let i=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,i.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=i.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(l=r.exec(i))&&(s=l.index,o=l[0].length),this.append(i.slice(n,s<0?i.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let i=Qe.get(e),n=i&&i.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,i){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==i&&(n.pos=this.text.length)}findPointInside(e,i){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Vw(e,n.node,n.offset)?i:0))}};function Vw(t,e,i){for(;;){if(!e||i<ai(e))return!1;if(e==t)return!0;i=pn(e)+1,e=e.parentNode}}function Gw(t,e){let i;for(;!(t==e||!t);t=t.nextSibling){let n=Qe.get(t);if(!(n!=null&&n.isWidget||t.cmIgnore))return!1;n&&(i||(i=[])).push(n)}if(i)for(let n of i){let r=n.overrideDOMText;if(r!=null&&r.length)return!1}return!0}var cl=class{constructor(e,i){this.node=e,this.offset=i,this.pos=-1}},sh=class{constructor(e,i,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=i>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&i>-1)this.newSel=null;else if(i>-1&&(this.bounds=e.docView.domBoundsAround(i,n,0))){let l=s||o?[]:Fw(e),a=new rh(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=Hw(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Gc(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Gc(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((I.ios||I.chrome)&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.to<e.state.doc.length)){let f=Math.min(a,h),u=Math.max(a,h),d=c.from-f,p=c.to-u;(d==0||d==1||f==0)&&(p==0||p==-1||u==e.state.doc.length)&&(a=0,h=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Q.range(h,a)):this.newSel=Q.single(h,a)}}};function bm(t,e){let i,{newSel:n}=e,r=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=r.from,h=null;(s===8||I.android&&e.text.length<l-o)&&(a=r.to,h="end");let c=ym(t.state.doc.sliceString(o,l,as),e.text,a-o,h);c&&(I.chrome&&s==13&&c.toB==c.from+2&&e.text.sl Line truncated
`&&t.lineWrapping&&(n&&(n=Q.single(n.main.anchor-1,n.main.head-1)),i={from:r.from,to:r.to,insert:ie.of([" "])}),i)return Ih(t,i,n,s);if(n&&!n.main.eq(r)){let o=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),l=t.inputState.lastSelectionOrigin,l=="select.pointer"&&(n=mm(t.state.facet(Ts).map(a=>a(t)),n))),t.dispatch({selection:n,scrollIntoView:o,userEvent:l}),!0}else return!1}function Ih(t,e,i,n=-1){if(I.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(I.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&t.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ar(t.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&ar(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&ar(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,l=()=>o||(o=Uw(t,e,i));return t.state.facet(rm).some(a=>a(t,e.from,e.to,s,l))||t.dispatch(l()),!0}function Uw(t,e,i){let n,r=t.state,s=r.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let a=e.from<s.from?-1:1,h=a<0?s.from:s.to,c=gs(r.facet(Ts).map(f=>f(t)),h,a);e.from==c&&(o=c)}if(o>-1)n={changes:e,selection:Q.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=s.from<e.from?r.sliceDoc(s.from,e.from):"",h=s.to>e.to?r.sliceDoc(e.to,s.to):"";n=r.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let a=r.changes(e),h=i&&i.main.to<=a.newLength?i.main:void 0;if(r.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let c=t.state.sliceDoc(e.from,e.to),f,u=i&&pm(t,i.main.head);if(u){let p=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-p}}else f=t.state.doc.lineAt(s.head);let d=s.to-e.to;n=r.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:a,range:h||p.map(a)};let g=p.to-d,m=g-c.length;if(t.state.sliceDoc(m,g)!=c||g>=f.from&&m<=f.to)return{range:p};let b=r.changes({from:m,to:g,insert:e.insert}),y=p.to-s.to;return{changes:b,range:h?Q.range(Math.max(0,h.anchor+y),Math.max(0,h.head+y)):p.map(b)}})}else n={changes:a,selection:h&&r.selection.replaceRange(h)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:l,scrollIntoView:!0})}function ym(t,e,i,n){let r=Math.min(t.length,e.length),s=0;for(;s<r&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&t.length==e.length)return null;let o=t.length,l=e.length;for(;o>0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(n=="end"){let a=Math.max(0,s-Math.min(o,l));i-=o+a-s}if(o<s&&t.length<e.length){let a=i<=s&&i>=o?s-i:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=i<=s&&i>=l?s-i:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function Fw(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:s}=t.observer.selectionRange;return i&&(e.push(new cl(i,n)),(r!=i||s!=n)&&e.push(new cl(r,s))),e}function Hw(t,e){if(t.length==0)return null;let i=t[0].pos,n=t.length==2?t[1].pos:i;return i>-1&&n>-1?Q.single(i+e,n+e):null}var oh=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,I.safari&&e.contentDOM.addEventListener("input",()=>null),I.gecko&&uv(e.contentDOM.ownerDocument)}handleEvent(e){!rv(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,i){let n=this.handlers[e];if(n){for(let r of n.observers)r(this.view,i);for(let r of n.handlers){if(i.defaultPrevented)break;if(r(this.view,i)){i.preventDefault();break}}}}ensureHandlers(e){let i=Kw(e),n=this.handlers,r=this.view.contentDOM;for(let s in i)if(s!="scroll"){let o=!i[s].handlers.length,l=n[s];l&&o!=!l.handlers.length&&(r.removeEventListe Line truncated
`))};if((I.mac||I.android)&&f.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:ie.of([n.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);Ih(e,f,Q.single(this.toEditorPos(n.selectionStart,u),this.toEditorPos(n.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from<f.to&&!f.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(i.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(i.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],s=null;for(let o=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,r.push(s)}i.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let s of n.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),h=this.toEditorPos(s.rangeEnd);if(a<h){let c=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;r.push(X.mark({attributes:{style:c}}).range(a,h))}}}e.dispatch({effects:cm.of(X.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)i.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let r=ys(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let i=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,h)=>{if(n)return;let c=h.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(h)){r=this.pendingContextChange=null,i+=c,this.to+=c;return}else r=null,this.revertPending(e.state);if(s+=i,o+=i,o<=this.from)this.from+=c,this.to+=c;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+h.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=c}i+=c}),r&&!n&&this.revertPending(e.state),!n}update(e){let i=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||i)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:i}=e.selection.main;this.from=Math.max(0,i-1e4),this.to=Math.min(e.doc.length,i+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let i=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(i.from),this.toContextPos(i.from+i.insert.length),e.doc.sliceString(i.from,i.to))}setSelection(e){let{main:i}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,i.anchor))),r=this.toContextPos(i.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:i}=e.selection.main;return!(this.from>0&&i-this.from<500||this.to<e.doc.length&&this.to-i<500||this.to-this.from>1e4*3)}toEditorPos(e,i=this.to-this.from){e=Math.min(e,i);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let i=this.composing;return i&&i.drifted?i.contextBase+(e-i.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},T=class t{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var i;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureR Line truncated
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,vh),Zv={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},Nc=null;function Dv(){var t;if(Nc==null&&typeof document!="undefined"&&document.body){let e=document.body.style;Nc=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Nc||!1}var il=L.define({combine(t){let e=Ge(t,{render:null,specialChars:_v,addSpecialChars:null});return(e.replaceTabs=!Dv())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,vh)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,vh)),e}});function jh(t={}){return[il.of(t),Iv()]}var TO=null;function Iv(){return TO||(TO=me.fromClass(class{constructor(t){this.view=t,this.decorations=X.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(il)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new wh({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:r}=i.state,s=We(e[0],0);if(s==9){let o=r.lineAt(n),l=i.state.tabSize,a=rt(o.text,l,n-o.from);return X.replace({widget:new Ph((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=X.replace({widget:new Qh(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(il);t.startState.facet(il)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}var Bv="\u2022";function Nv(t){return t>=32?Bv:t==10?"\u2424":String.fromCharCode(9216+t)}var Qh=class extends Be{constructor(e,i){super(),this.options=e,this.code=i}eq(e){return e.code==this.code}toDOM(e){let i=Nv(this.code),n=e.state.phrase("Control character")+" "+(Zv[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,i);if(r)return r;let s=document.createElement("span");return s.textContent=i,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}},Ph=class extends Be{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};function zh(){return zv}var jv=X.line({class:"cm-activeLine"}),zv=me.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let n of t.state.selection.ranges){let r=t.lineBlockAt(n.head);r.from>e&&(i.push(jv.range(r.from)),e=r.from)}return X.set(i)}},{decorations:t=>t.decorations}),$h=class extends Be{constructor(e){super(),this.content=e}toDOM(e){let i=document.createElement("span");return i.className="cm-placeholder",i.style.pointerEvents="none",i.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),i.setAttribute("aria-hidden","true"),i}coordsAt(e){let i=e.firstChild?cr(e.firstChild):[];if(!i.length)return null;let n=window.getComputedStyle(e.parentNode),r=$s(i[0],n.direction!="rtl"),s=parseInt(n.lineHeight);return r.bottom-r.top>s*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+s}:r}ignoreEvent(){return!1}};function Dm(t){let e=me.fromClass(class{constructor(i){this.view=i,this.placeholder=t?X.set([X.widget({widget:new $h(t),side:1}).range(0)]):X.none}get decorations(){return this.view.state.doc.length?X.none:this.placeholder}},{decorations:i=>i.decorations});return typeof t=="string"?[e,T.contentAttributes.of({"aria-placeholder":t})]:e}var Th=2e3;function Yv(t,e,i){let n=Math.min(e.line,i.line),r=Math.max(e.line,i.line),s=[];if(e.off>Th||i.off>Th||e.col<0||i.col<0){let o=Math.min(e.off,i.off),l=Math.max(e.off,i.off);for(let a=n;a<=r;a++){let h=t.doc.line(a);h.length<=l&&s.push(Q.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,i.col),l=Math.max(e.col,i.col);for(let a=n;a<=r;a++){let h=t.doc.line(a),c=Bo(h.text,o,t.tabSize,!0);if(c<0)s.push(Q.cursor(h.to));else{let f=Bo(h.text,l,t.tabSize);s.push(Q.range(h.from+c,h.from+f))}}}return s}function qv(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}function CO(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(i),r=i-n.from,s=r>Th?-1:r==n.length?qv(t,e.clientX):rt(n.text,t.state.tabSize,i-n.from);return{line:n.numbe Line truncated
`){[e,i]=ir(this,e,i);let r="";for(let s=0,o=0;s<this.children.length&&o<=i;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=n),e<a&&i>o&&(r+=l.sliceString(e-o,i-o,n)),o=a+1}return r}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof t))return 0;let n=0,[r,s,o,l]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=i,s+=i){if(r==o||s==l)return n;let a=this.children[r],h=e.children[s];if(a!=h)return n+a.scanIdentical(h,i);n+=a.length+1}}static from(e,i=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let d of e)n+=d.lines;if(n<32){let d=[];for(let p of e)p.flatten(d);return new wt(d,i)}let r=Math.max(32,n>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>s&&d instanceof t)for(let g of d.children)f(g);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof wt&&a&&(p=c[c.length-1])instanceof wt&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new wt(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>r&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:t.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new t(l,i)}};ie.empty=new wt([""],0);function Jk(t){let e=-1;for(let i of t)e+=i.length+1;return e}function Eo(t,e,i=0,n=1e9){for(let r=0,s=0,o=!0;s<t.length&&r<=n;s++){let l=t[s],a=r+l.length;a>=i&&(a>n&&(l=l.slice(0,n-r)),r<i&&(l=l.slice(i-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function Pg(t,e,i){return Eo(t,[""],e,i)}var hn=class{constructor(e,i=1){this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[i>0?1:(e instanceof wt?e.text.length:e.children.length)<<1]}nextInner(e,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,l=r instanceof wt?r.text.length:r.children.length;if(o==(i>0?l:0)){if(n==0)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(i>0?0:1)){if(this.offsets[n]+=i,e==0)return this.lineBreak=!0,this.value=`
`,this;e--}else if(r instanceof wt){let a=r.text[o+(i<0?-1:0)];if(this.offsets[n]+=i,a.length>Math.max(0,e))return this.value=e==0?a:i>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(i<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(i>0?1:(a instanceof wt?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Mo=class{constructor(e,i,n){this.value="",this.done=!1,this.cursor=new hn(e,i>n?-1:1),this.pos=i>n?e.length:0,this.from=Math.min(i,n),this.to=Math.max(i,n)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let n=i<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*i,this.value=r.length<=n?r:i<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Lo=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:n,value:r}=this.inner.next(e);return i&&this.afterBreak?(this.value="",this.afterBreak=!1):i?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(ie.prototype[Symbol.iterator]=function(){return this.iter()},hn.prototype[Symbol.iterator]=Mo.prototype[Symbol.iterator]=Lo.prototype[Symbol.iterator]=function(){return this});var yc=class{constructor(e,i,n,r){this.from=e,this.to=i,this.number=n,this.text=r}get length(){return this.to-this.from}};function ir(t,e,i){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,i))]}function Xe(t,e,i=!0,n=!0){return kg(t,e,i,n)}function ew(t){return t>=56320&&t<57344}function tw(t){return t>=55296&&t<56320}function We(t,e){let i=t.charCodeAt(e);if(!tw(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return ew(n)?(i-55296<<10)+(n-56320)+65536:i}function os(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function vt(t){return t<65536?1:2}var Sc=/\r\n?|\n/,De=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(De||(De={})),Si=class t{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;i<this.sections.length;i+=2)e+=this.sections[i];return e}get newLength(){let e=0;for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i+1];e+=n<0?this.sections[i]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,n=0,r=0;i<this.sections.length;){let s=this.sections[i++],o=this.sections[i++];o<0?(e(n,r,s),r+=s):r+=o,n+=s}}iterChangedRanges(e,i=!1){xc(this,e,i)}get invertedDesc(){let e=[];for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];r<0?e.push(n,r):e.push(r,n)}return new t(e)}composeDesc(e){return this.empty?e:e.empty?this:Eg(this,e)}mapDesc(e,i=!1){return e.empty?this:kc(this,e,i)}mapPos(e,i=-1,n=De.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=r+l;if(a<0){if(h>e)return s+(e-r);s+=l}else{if(n!=De.Simple&&h>=e&&(n==De.TrackDel&&r<e&&h>e||n==De.TrackBefore&&r<e||n==De.TrackAfter&&h>e))return null;if(h>e||h==e&&i<0&&!l)return e==r||i<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,i=e){for(let n=0,r=0;n<this.sections.length&&r<=i;){let s=this.sections[n++],o=this.sections[n++],l=r+s;if(o>=0&&r<=i&&l>=e)return r<e&&l>i?"cover":!0;r=l}return!1}toString(){let e="";for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}static create(e){return new t(e)}},qe=class t extends Si{constructor(e,i){super(e),this.inserted=i}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return xc(this,(i,n,r,s,o)=>e=e.replace(r,r+(n-i),o),!1),e}mapDesc(e,i=!1){return kc(this,e,i,!0)}invert(e){let i=this.sections.slice(),n=[];for(let r=0,s=0;r<i.length;r+=2){let o=i[r],l=i[r+1];if(l>=0){i[r]=l,i[r+1]=o;let a=r>>1;for(;n.length<a;)n.push(ie.empty);n.push(o?e.slice(s,s+o):ie.empty)}s+=o}return new t(i,n)}compose(e){return this.empty?e:e.empty?this:Eg(this,e,!0)}map(e,i=!1){return e.empty?this:kc(this,e,i,!0)}iterChanges(e,i=!1){xc(this,e,i)}get desc Line truncated
`}get readOnly(){return this.facet(Ig)}phrase(e,...i){for(let n of this.facet(t.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>i.length?n:i[s-1]})),e}languageDataAt(e,i,n=-1){let r=[];for(let s of this.facet(Lg))for(let o of s(this,i,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){return hw(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:i,from:n,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,l=e-n;for(;o>0;){let a=Xe(i,o,!1);if(s(i.slice(a,o))!=ke.Word)break;o=a}for(;l<r;){let a=Xe(i,l);if(s(i.slice(l,a))!=ke.Word)break;l=a}return o==l?null:Q.range(o+n,l+n)}};he.allowMultipleSelections=vc;he.tabSize=L.define({combine:t=>t.length?t[0]:4});he.lineSeparator=Xg;he.readOnly=Ig;he.phrases=L.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every(r=>t[r]==e[r])}});he.languageData=Lg;he.changeFilter=_g;he.transactionFilter=Zg;he.transactionExtender=Dg;ni.reconfigure=W.define();function Ge(t,e,i={}){let n={};for(let r of t)for(let s of Object.keys(r)){let o=r[s],l=n[s];if(l===void 0)n[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(i,s))n[s]=i[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}var jt=class{eq(e){return this==e}range(e,i=e){return rs.create(e,i,this)}};jt.prototype.startSide=jt.prototype.endSide=0;jt.prototype.point=!1;jt.prototype.mapMode=De.TrackDel;var rs=class t{constructor(e,i,n){this.from=e,this.to=i,this.value=n}static create(e,i,n){return new t(e,i,n)}};function Cc(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}var Ac=class t{constructor(e,i,n,r){this.from=e,this.to=i,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,i,n,r=0){let s=n?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-e||(n?this.value[a].endSide:this.value[a].startSide)-i;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,i,n,r){for(let s=this.findIndex(i,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(r(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,i){let n=[],r=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let h=this.value[a],c=this.from[a]+e,f=this.to[a]+e,u,d;if(c==f){let p=i.mapPos(c,h.startSide,h.mapMode);if(p==null||(u=d=p,h.startSide!=h.endSide&&(d=i.mapPos(c,h.endSide),d<u)))continue}else if(u=i.mapPos(c,h.startSide),d=i.mapPos(f,h.endSide),u>d||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),n.push(h),r.push(u-o),s.push(d-o))}return{mapped:n.length?new t(r,s,n,l):null,pos:o}}},se=class t{constructor(e,i,n,r){this.chunkPos=e,this.chunk=i,this.nextLayer=n,this.maxPoint=r}static create(e,i,n,r){return new t(e,i,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let i of this.chunk)e+=i.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:i=[],sort:n=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(i.length==0&&!o)return this;if(n&&(i=i.slice().sort(Cc)),this.isEmpty)return i.length?t.of(i):this;let l=new Do(this,null,-1).goto(0),a=0,h=[],c=new Ee;for(;l.value||a<i.length;)if(a<i.length&&(l.from-i[a].from||l.startSide-i[a].value.startSide)>=0){let f=i[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==i.length||this.chunkEnd(l.chunkIndex)<i[a].from)&&(!o||r>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||r>l.to||s<l.from||o(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||h.push(rs.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!h.length?t.empty:this.nextLayer.update({add:h,filter:o,filterFrom:r,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],n=[],r=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],h=e.touchesRange(l,l+a.length);if(h===!1)r=Math.max(r,a.maxPoint),i.push(a),n.push(e.mapPos(l));else if(h===!0){let{mapped:c,pos:f}=a.map(l,e);c&&(r=Math.max(r,c.maxPoint),i.push(c),n.push(f))}}let s=this.nextLayer.map(e);return i.length==0?s:new t(n,i,s||t.empty,r)}between(e,i,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r];if(i>=s&&e<=s+o.length&&o.between(s,e-s,i-s,n)===!1)return}this.nextLayer.between(e,i,n)}}iter(e=0){return ss.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return ss.from(e).goto(i)}static compare(e,i,n,r,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=i.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),a=Cg(o,l Line truncated
`)}static newName(){let e=zg[jg]||1;return zg[jg]=e+1,"\u037C"+e.toString(36)}static mount(e,i,n){let r=e[Lc],s=n&&n.nonce;r?s&&r.setNonce(s):r=new Xc(e,s),r.mount(Array.isArray(i)?i:[i],e)}},Yg=new Map,Xc=class{constructor(e,i){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=Yg.get(n);if(s)return e[Lc]=s;this.sheet=new r.CSSStyleSheet,Yg.set(n,this)}else this.styleTag=n.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);this.modules=[],e[Lc]=this}mount(e,i){let n=this.sheet,r=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),n)for(let h=0;h<l.rules.length;h++)n.insertRule(l.rules[h],r++)}else{for(;s<a;)r+=this.modules[s++].rules.length;r+=l.rules.length,s++}}if(n)i.adoptedStyleSheets.indexOf(this.sheet)<0&&(i.adoptedStyleSheets=[this.sheet,...i.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
`;this.styleTag.textContent=o;let l=i.head||i;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var xi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},nr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},uw=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),dw=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(_e=0;_e<10;_e++)xi[48+_e]=xi[96+_e]=String(_e);var _e;for(_e=1;_e<=24;_e++)xi[_e+111]="F"+_e;var _e;for(_e=65;_e<=90;_e++)xi[_e]=String.fromCharCode(_e+32),nr[_e]=String.fromCharCode(_e);var _e;for(Bo in xi)nr.hasOwnProperty(Bo)||(nr[Bo]=xi[Bo]);var Bo;function qg(t){var e=uw&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||dw&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",i=!e&&t.key||(t.shiftKey?nr:xi)[t.keyCode]||t.key||"Unidentified";return i=="Esc"&&(i="Escape"),i=="Del"&&(i="Delete"),i=="Left"&&(i="ArrowLeft"),i=="Up"&&(i="ArrowUp"),i=="Right"&&(i="ArrowRight"),i=="Down"&&(i="ArrowDown"),i}function Oe(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&typeof i=="object"&&i.nodeType==null&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var r=i[n];typeof r=="string"?t.setAttribute(n,r):r!=null&&(t[n]=r)}e++}for(;e<arguments.length;e++)Wg(t,arguments[e]);return t}function Wg(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var i=0;i<e.length;i++)Wg(t,e[i]);else throw new RangeError("Unsupported child node: "+e)}var st=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},zc=typeof document!="undefined"?document:{documentElement:{style:{}}},Yc=/Edge\/(\d+)/.exec(st.userAgent),XO=/MSIE \d/.test(st.userAgent),qc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(st.userAgent),bl=!!(XO||qc||Yc),Vg=!bl&&/gecko\/(\d+)/i.test(st.userAgent),_c=!bl&&/Chrome\/(\d+)/.exec(st.userAgent),Gg="webkitFontSmoothing"in zc.documentElement.style,Wc=!bl&&/Apple Computer/.test(st.vendor),Ug=Wc&&(/Mobile\/\w+/.test(st.userAgent)||st.maxTouchPoints>2),I={mac:Ug||/Mac/.test(st.platform),windows:/Win/.test(st.platform),linux:/Linux|X11/.test(st.platform),ie:bl,ie_version:XO?zc.documentMode||6:qc?+qc[1]:Yc?+Yc[1]:0,gecko:Vg,gecko_version:Vg?+(/Firefox\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,chrome:!!_c,chrome_version:_c?+_c[1]:0,ios:Ug,android:/Android\b/.test(st.userAgent),webkit:Gg,webkit_version:Gg?+(/\bAppleWebKit\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,safari:Wc,safari_version:Wc?+(/\bVersion\/(\d+(\.\d+)?)/.exec(st.userAgent)||[0,0])[1]:0,tabSize:zc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function ys(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Vc(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Ho(t,e){if(!e.anchorNode)return!1;try{return Vc(t,e.anchorNode)}catch{return!1}}function cr(t){return t.nodeType==3?gn(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function fs(t,e,i,n){return i?Fg(t,e,i,n,-1)||Fg(t,e,i,n,1):!1}function pn(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function nl(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Fg(t,e,i,n,r){for(;;){if(t==i&&e==n)return!0;if(e==(r<0?0:ai(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=pn(t)+(r<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=r<0?ai(t):0}else return!1}}function ai(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $s(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function pw(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function _O(t,e){let i=e.width/t.offsetWidth,n=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-t.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}function gw(t,e,i,n,r,Line truncated
`,r=t.state.doc.line(r.number+(i?1:-1)),s=t.bidiSpans(r),h=t.visualLineSide(r,!i)}if(a){if(!a(c))return l}else{if(!n)return h;a=n(c)}l=h}}function Gw(t,e,i){let n=t.state.charCategorizer(e),r=n(i);return s=>{let o=n(s);return r==ke.Space&&(r=o),r==o}}function Uw(t,e,i,n){let r=e.head,s=i?1:-1;if(r==(i?t.state.doc.length:0))return Q.cursor(r,e.assoc);let o=e.goalColumn,l,a=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(r,e.assoc||-1),c=t.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let d=t.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,t.defaultCharacterWidth*(r-d.from))),l=(s<0?d.top:d.bottom)+c}let f=a.left+o,u=n!=null?n:t.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*s,g=pm(t,{x:f,y:p},!1,s);if(p<a.top||p>a.bottom||(s<0?g<r:g>r)){let m=t.docView.coordsForChar(g),b=!m||p<m.top?-1:1;return Q.cursor(g,b,void 0,o)}}}function gs(t,e,i){for(;;){let n=0;for(let r of t)r.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=n||i||(e-s<o-e?-1:1);e=a<0?s:o,n=a}});if(!n)return e}}function Om(t,e){let i=null;for(let n=0;n<e.ranges.length;n++){let r=e.ranges[n],s=null;if(r.empty){let o=gs(t,r.from,0);o!=r.from&&(s=Q.cursor(o,-1))}else{let o=gs(t,r.from,-1),l=gs(t,r.to,1);(o!=r.from||l!=r.to)&&(s=Q.range(r.from==r.anchor?o:l,r.from==r.head?o:l))}s&&(i||(i=e.ranges.slice()),i[n]=s)}return i?Q.create(i,e.mainIndex):e}function Dc(t,e,i){let n=gs(t.state.facet(Ts).map(r=>r(t)),i.from,e.head>i.from?-1:1);return n==i.from?i:Q.cursor(n,n<i.from?1:-1)}var as="\uFFFF",nh=class{constructor(e,i){this.points=e,this.text="",this.lineSeparator=i.facet(he.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=as}readRange(e,i){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let s=this.text.length;this.readNode(r);let o=r.nextSibling;if(o==i)break;let l=Qe.get(r),a=Qe.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:nl(r))||nl(o)&&(r.nodeName!="BR"||r.cmIgnore)&&this.text.length>s)&&!Hw(o,i)&&this.lineBreak(),r=o}return this.findPointBefore(n,i),this}readTextNode(e){let i=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,i.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=i.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(l=r.exec(i))&&(s=l.index,o=l[0].length),this.append(i.slice(n,s<0?i.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let i=Qe.get(e),n=i&&i.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,i){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==i&&(n.pos=this.text.length)}findPointInside(e,i){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Fw(e,n.node,n.offset)?i:0))}};function Fw(t,e,i){for(;;){if(!e||i<ai(e))return!1;if(e==t)return!0;i=pn(e)+1,e=e.parentNode}}function Hw(t,e){let i;for(;!(t==e||!t);t=t.nextSibling){let n=Qe.get(t);if(!(n!=null&&n.isWidget||t.cmIgnore))return!1;n&&(i||(i=[])).push(n)}if(i)for(let n of i){let r=n.overrideDOMText;if(r!=null&&r.length)return!1}return!0}var al=class{constructor(e,i){this.node=e,this.offset=i,this.pos=-1}},rh=class{constructor(e,i,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=i>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&i>-1)this.newSel=null;else if(i>-1&&(this.bounds=e.docView.domBoundsAround(i,n,0))){let l=s||o?[]:Jw(e),a=new nh(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=ev(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Vc(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Vc(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((I.ios||I.chrome)&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.to<e.state.doc.length)){let f=Math.min(a,h),u=Math.max(a,h),d=c.from-f,p=c.to-u;(d==0||d==1||f==0)&&(p==0||p==-1||u==e.state.doc.length)&&(a=0,h=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Q.range(h,a)):this.newSel=Q.single(h,a)}}};function mm(t,e){let i,{newSel:n}=e,r=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=r.from,h=null;(s===8||I.android&&e.text.length<l-o)&&(a=r.to,h="end");let c=bm(t.state.doc.sliceString(o,l,as),e.text,a-o,h);c&&(I.chrome&&s==13&&c.toB==c.from+2&&e.text.sl Line truncated
`&&t.lineWrapping&&(n&&(n=Q.single(n.main.anchor-1,n.main.head-1)),i={from:r.from,to:r.to,insert:ie.of([" "])}),i)return Dh(t,i,n,s);if(n&&!n.main.eq(r)){let o=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),l=t.inputState.lastSelectionOrigin,l=="select.pointer"&&(n=Om(t.state.facet(Ts).map(a=>a(t)),n))),t.dispatch({selection:n,scrollIntoView:o,userEvent:l}),!0}else return!1}function Dh(t,e,i,n=-1){if(I.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(I.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&t.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ar(t.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&ar(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&ar(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,l=()=>o||(o=Kw(t,e,i));return t.state.facet(nm).some(a=>a(t,e.from,e.to,s,l))||t.dispatch(l()),!0}function Kw(t,e,i){let n,r=t.state,s=r.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let a=e.from<s.from?-1:1,h=a<0?s.from:s.to,c=gs(r.facet(Ts).map(f=>f(t)),h,a);e.from==c&&(o=c)}if(o>-1)n={changes:e,selection:Q.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=s.from<e.from?r.sliceDoc(s.from,e.from):"",h=s.to>e.to?r.sliceDoc(e.to,s.to):"";n=r.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let a=r.changes(e),h=i&&i.main.to<=a.newLength?i.main:void 0;if(r.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let c=t.state.sliceDoc(e.from,e.to),f,u=i&&dm(t,i.main.head);if(u){let p=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-p}}else f=t.state.doc.lineAt(s.head);let d=s.to-e.to;n=r.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:a,range:h||p.map(a)};let g=p.to-d,m=g-c.length;if(t.state.sliceDoc(m,g)!=c||g>=f.from&&m<=f.to)return{range:p};let b=r.changes({from:m,to:g,insert:e.insert}),y=p.to-s.to;return{changes:b,range:h?Q.range(Math.max(0,h.anchor+y),Math.max(0,h.head+y)):p.map(b)}})}else n={changes:a,selection:h&&r.selection.replaceRange(h)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:l,scrollIntoView:!0})}function bm(t,e,i,n){let r=Math.min(t.length,e.length),s=0;for(;s<r&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&t.length==e.length)return null;let o=t.length,l=e.length;for(;o>0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(n=="end"){let a=Math.max(0,s-Math.min(o,l));i-=o+a-s}if(o<s&&t.length<e.length){let a=i<=s&&i>=o?s-i:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=i<=s&&i>=l?s-i:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function Jw(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:s}=t.observer.selectionRange;return i&&(e.push(new al(i,n)),(r!=i||s!=n)&&e.push(new al(r,s))),e}function ev(t,e){if(t.length==0)return null;let i=t[0].pos,n=t.length==2?t[1].pos:i;return i>-1&&n>-1?Q.single(i+e,n+e):null}var sh=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,I.safari&&e.contentDOM.addEventListener("input",()=>null),I.gecko&&gv(e.contentDOM.ownerDocument)}handleEvent(e){!lv(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,i){let n=this.handlers[e];if(n){for(let r of n.observers)r(this.view,i);for(let r of n.handlers){if(i.defaultPrevented)break;if(r(this.view,i)){i.preventDefault();break}}}}ensureHandlers(e){let i=tv(e),n=this.handlers,r=this.view.contentDOM;for(let s in i)if(s!="scroll"){let o=!i[s].handlers.length,l=n[s];l&&o!=!l.handlers.length&&(r.removeEventListe Line truncated
`))};if((I.mac||I.android)&&f.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:ie.of([n.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);Dh(e,f,Q.single(this.toEditorPos(n.selectionStart,u),this.toEditorPos(n.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from<f.to&&!f.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(i.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(i.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],s=null;for(let o=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,r.push(s)}i.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let s of n.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),h=this.toEditorPos(s.rangeEnd);if(a<h){let c=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;r.push(X.mark({attributes:{style:c}}).range(a,h))}}}e.dispatch({effects:am.of(X.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)i.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let r=ys(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let i=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,h)=>{if(n)return;let c=h.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(h)){r=this.pendingContextChange=null,i+=c,this.to+=c;return}else r=null,this.revertPending(e.state);if(s+=i,o+=i,o<=this.from)this.from+=c,this.to+=c;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+h.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=c}i+=c}),r&&!n&&this.revertPending(e.state),!n}update(e){let i=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||i)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:i}=e.selection.main;this.from=Math.max(0,i-1e4),this.to=Math.min(e.doc.length,i+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let i=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(i.from),this.toContextPos(i.from+i.insert.length),e.doc.sliceString(i.from,i.to))}setSelection(e){let{main:i}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,i.anchor))),r=this.toContextPos(i.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:i}=e.selection.main;return!(this.from>0&&i-this.from<500||this.to<e.doc.length&&this.to-i<500||this.to-this.from>1e4*3)}toEditorPos(e,i=this.to-this.from){e=Math.min(e,i);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let i=this.composing;return i&&i.drifted?i.contextBase+(e-i.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},T=class t{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var i;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureR Line truncated
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,wh),Bv={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},Bc=null;function Nv(){var t;if(Bc==null&&typeof document!="undefined"&&document.body){let e=document.body.style;Bc=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Bc||!1}var tl=L.define({combine(t){let e=Ge(t,{render:null,specialChars:Iv,addSpecialChars:null});return(e.replaceTabs=!Nv())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,wh)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,wh)),e}});function Nh(t={}){return[tl.of(t),jv()]}var $O=null;function jv(){return $O||($O=me.fromClass(class{constructor(t){this.view=t,this.decorations=X.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(tl)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new kh({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:r}=i.state,s=We(e[0],0);if(s==9){let o=r.lineAt(n),l=i.state.tabSize,a=rt(o.text,l,n-o.from);return X.replace({widget:new Qh((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=X.replace({widget:new vh(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(tl);t.startState.facet(tl)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}var zv="\u2022";function Yv(t){return t>=32?zv:t==10?"\u2424":String.fromCharCode(9216+t)}var vh=class extends Be{constructor(e,i){super(),this.options=e,this.code=i}eq(e){return e.code==this.code}toDOM(e){let i=Yv(this.code),n=e.state.phrase("Control character")+" "+(Bv[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,i);if(r)return r;let s=document.createElement("span");return s.textContent=i,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}},Qh=class extends Be{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};function jh(){return Wv}var qv=X.line({class:"cm-activeLine"}),Wv=me.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let n of t.state.selection.ranges){let r=t.lineBlockAt(n.head);r.from>e&&(i.push(qv.range(r.from)),e=r.from)}return X.set(i)}},{decorations:t=>t.decorations}),Ph=class extends Be{constructor(e){super(),this.content=e}toDOM(e){let i=document.createElement("span");return i.className="cm-placeholder",i.style.pointerEvents="none",i.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),i.setAttribute("aria-hidden","true"),i}coordsAt(e){let i=e.firstChild?cr(e.firstChild):[];if(!i.length)return null;let n=window.getComputedStyle(e.parentNode),r=$s(i[0],n.direction!="rtl"),s=parseInt(n.lineHeight);return r.bottom-r.top>s*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+s}:r}ignoreEvent(){return!1}};function Zm(t){let e=me.fromClass(class{constructor(i){this.view=i,this.placeholder=t?X.set([X.widget({widget:new Ph(t),side:1}).range(0)]):X.none}get decorations(){return this.view.state.doc.length?X.none:this.placeholder}},{decorations:i=>i.decorations});return typeof t=="string"?[e,T.contentAttributes.of({"aria-placeholder":t})]:e}var $h=2e3;function Vv(t,e,i){let n=Math.min(e.line,i.line),r=Math.max(e.line,i.line),s=[];if(e.off>$h||i.off>$h||e.col<0||i.col<0){let o=Math.min(e.off,i.off),l=Math.max(e.off,i.off);for(let a=n;a<=r;a++){let h=t.doc.line(a);h.length<=l&&s.push(Q.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,i.col),l=Math.max(e.col,i.col);for(let a=n;a<=r;a++){let h=t.doc.line(a),c=Io(h.text,o,t.tabSize,!0);if(c<0)s.push(Q.cursor(h.to));else{let f=Io(h.text,l,t.tabSize);s.push(Q.range(h.from+c,h.from+f))}}}return s}function Gv(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}function TO(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(i),r=i-n.from,s=r>$h?-1:r==n.length?Gv(t,e.clientX):rt(n.text,t.state.tabSize,i-n.from);return{line:n.numbe Line truncated
`&&(i="");else{let n=i.indexOf(`
`);n>-1&&(i=i.slice(0,n))}return e+i.length<=this.to?i:i.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,i=this.lineAfter(e),n=e+i.length;for(let r=this.rangeIndex;;){let s=this.ranges[r].to;if(s>=n||(i=i.slice(0,s-(n-i.length)),r++,r==this.ranges.length))break;let o=this.ranges[r].from,l=this.lineAfter(o);i+=l,n=o+l.length}return{line:i,end:n}}skipGapsTo(e,i,n){for(;;){let r=this.ranges[this.rangeIndex].to,s=e+i;if(n>0?r>s:r>=s)break;let o=this.ranges[++this.rangeIndex].from;i+=o-r}return i}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,i,n,r){let s=4;if(this.ranges.length>1){r=this.skipGapsTo(i,r,1),i+=r;let l=this.chunk.length;r=this.skipGapsTo(n,r,-1),n+=r,s+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==i?this.chunk[o+2]=n:this.chunk.push(e,i,n,s),r}parseLine(e){let{line:i,end:n}=this.nextLine(),r=0,{streamParser:s}=this.lang,o=new Rl(i,e?e.state.tabSize:4,e?Wt(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=v0(s.token,o,this.state);if(l&&(r=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=ue.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:tP,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new ue(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new ue(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function v0(t,e,i){e.start=e.pos;for(let n=0;n<10;n++){let r=t(e,i);if(e.pos>e.start)return r}throw new Error("Stream parser failed to advance stream.")}var Lf=Object.create(null),Zs=[Ne.none],tP=new gr(Zs),o0=[],l0=Object.create(null),Q0=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Q0[t]=P0(Lf,e);var El=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Q0)}resolve(e){return e?this.table[e]||(this.table[e]=P0(this.extra,e)):0}},iP=new El(Lf);function mf(t,e){o0.indexOf(t)>-1||(o0.push(t),console.warn(e))}function P0(t,e){let i=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=t[h]||O[h];c?typeof c=="function"?a.length?a=a.map(c):mf(h,`Modifier ${h} used at start of tag`):a.length?mf(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:mf(h,`Unknown highlighting tag ${h}`)}for(let h of a)i.push(h)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+i.map(l=>l.id),s=l0[r];if(s)return s.id;let o=l0[r]=Ne.define({id:Zs.length,name:n,props:[at({[n]:i})]});return Zs.push(o),o.id}function nP(t,e){let i=Ne.define({id:Zs.length,name:"Document",props:[Qi.add(()=>t),Et.add(()=>n=>e.getIndent(n))],top:!0});return Zs.push(i),i}var u_={rtl:X.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:we.RTL}),ltr:X.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:we.LTR}),auto:X.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var Bf=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=jf(t.state,i.from);return n.line?rP(t):n.block?oP(t):!1};function Nf(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let r=t(e,i);return r?(n(i.update(r)),!0):!1}}var rP=Nf(cP,0);var sP=Nf(X0,0);var oP=Nf((t,e)=>X0(t,e,aP(e)),0);function jf(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}var Bs=50;function lP(t,{open:e,close:i},n,r){let s=t.sliceDoc(n-Bs,n),o=t.sliceDoc(r,r+Bs),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,h=s.length-l;if(s.slice(h-e.length,h)==e&&o.slice(a,a+i.length)==i)return{open:{pos:n-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let c,f;r-n<=2*Bs?c=f=t.sliceDoc(n,r):(c=t.sliceDoc(n,n+Bs),f=t.sliceDoc(r-Bs,r));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-i.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+i.length)==i?{open:{pos:n+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:r-d-i.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function aP(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),r=i.to<=n.to?n:t.doc.lineAt(i.to);r.from>n.from&&r.from==i.to&&(r=i.to==n.to+1?n:t.doc.lineAt(i.to-1));let s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function X Line truncated
`+i.scrub(),s=this.advance(r);return s>-1&&s<r.length?this.complete(e,n,s):!1}finish(e,i){return(this.stage==2||this.stage==3)&&Js(i.content,this.pos)==i.content.length?this.complete(e,i,i.content.length):!1}complete(e,i,n){return e.addLeafElement(i,oe(A.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(Ly(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(oe(A.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Ey(e,Js(e,this.pos),this.start)))return-1}else if(this.stage==2){let i=Js(e,this.pos),n=0;if(i>this.pos){let r=My(e,i,this.start);if(r){let s=Nu(e,r.to-this.start);s>0&&(this.nextStage(r),n=s)}}return n||(n=Nu(e,this.pos)),n>0&&n<e.length?n:-1}else return Nu(e,this.pos)}}};function Nu(t,e){for(;e<t.length;e++){let i=t.charCodeAt(e);if(i==10)break;if(!Dt(i))return-1}return e}var Gu=class{nextLine(e,i,n){let r=i.depth<e.stack.length?-1:wy(i),s=i.next;if(r<0)return!1;let o=oe(A.HeaderMark,e.lineStart+i.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,oe(s==61?A.SetextHeading1:A.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}},$y={LinkReference(t,e){return e.content.charCodeAt(0)==91?new Vu(e):null},SetextHeading(){return new Gu}},_T=[(t,e)=>ky(e)>=0,(t,e)=>yy(e)>=0,(t,e)=>Sy(e)>=0,(t,e)=>td(e,t,!0)>=0,(t,e)=>id(e,t,!0)>=0,(t,e)=>ed(e,t,!0)>=0,(t,e)=>Py(e,t,!0)>=0],ZT={text:"",end:0},Uu=class{constructor(e,i,n,r){this.parser=e,this.input=i,this.ranges=r,this.line=new Yu,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=sa.create(A.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new Ku(n,i):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let n=0;;){let r=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!r||e.markers[n].from<r.end);){let s=e.markers[n++];this.addNode(s.type,s.from,s.to)}if(!r)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let n of this.parser.blockParsers)if(n){let r=n(this,e);if(r!=!1){if(r==!0)return null;e.forward();continue e}}break}let i=new zu(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let r=n(this,i);r&&i.parsers.push(r)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,i))break e}for(let n of i.parsers)if(n.nextLine(this,e,i))return null;i.content+=`
`+e.scrub();for(let n of e.markers)i.marks.push(n)}return this.finishLeaf(i),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let i=this.fragments.takeNodes(this);return i?(this.absoluteLineStart+=i,this.lineStart=Xy(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let i=ZT;if(i.end=e,e>=this.to)i.text="";else if(i.text=this.lineChunkAt(e),i.end+=i.text.length,this.ranges.length>1){let n=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<i.end;){r++;let s=this.ranges[r].from,o=this.lineChunkAt(s);i.end=s+o.length,i.text=i.text.slice(0,this.ranges[r-1].to-n)+o,n=i.end-i.text.length}}return i}readLine(){let{line:e}=this,{text:i,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(i);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],s=this.parser.skipContextMarkup[r.type];if(!s)throw new Error("Unhandled block context "+A[r.type]);let o=this.line.markers.length;if(!s(r,this,e)){this.line.markers.length>o&&(r.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let i=this.input.chunk(e),n;if(this.input.lineChunks)n=i==`
`);n>-1&&(i=i.slice(0,n))}return e+i.length<=this.to?i:i.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,i=this.lineAfter(e),n=e+i.length;for(let r=this.rangeIndex;;){let s=this.ranges[r].to;if(s>=n||(i=i.slice(0,s-(n-i.length)),r++,r==this.ranges.length))break;let o=this.ranges[r].from,l=this.lineAfter(o);i+=l,n=o+l.length}return{line:i,end:n}}skipGapsTo(e,i,n){for(;;){let r=this.ranges[this.rangeIndex].to,s=e+i;if(n>0?r>s:r>=s)break;let o=this.ranges[++this.rangeIndex].from;i+=o-r}return i}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,i,n,r){let s=4;if(this.ranges.length>1){r=this.skipGapsTo(i,r,1),i+=r;let l=this.chunk.length;r=this.skipGapsTo(n,r,-1),n+=r,s+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==i?this.chunk[o+2]=n:this.chunk.push(e,i,n,s),r}parseLine(e){let{line:i,end:n}=this.nextLine(),r=0,{streamParser:s}=this.lang,o=new Al(i,e?e.state.tabSize:4,e?Wt(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=w0(s.token,o,this.state);if(l&&(r=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=ue.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:rP,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new ue(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new ue(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function w0(t,e,i){e.start=e.pos;for(let n=0;n<10;n++){let r=t(e,i);if(e.pos>e.start)return r}throw new Error("Stream parser failed to advance stream.")}var Mf=Object.create(null),Zs=[Ne.none],rP=new gr(Zs),s0=[],o0=Object.create(null),v0=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])v0[t]=Q0(Mf,e);var Rl=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),v0)}resolve(e){return e?this.table[e]||(this.table[e]=Q0(this.extra,e)):0}},sP=new Rl(Mf);function Of(t,e){s0.indexOf(t)>-1||(s0.push(t),console.warn(e))}function Q0(t,e){let i=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=t[h]||O[h];c?typeof c=="function"?a.length?a=a.map(c):Of(h,`Modifier ${h} used at start of tag`):a.length?Of(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:Of(h,`Unknown highlighting tag ${h}`)}for(let h of a)i.push(h)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+i.map(l=>l.id),s=o0[r];if(s)return s.id;let o=o0[r]=Ne.define({id:Zs.length,name:n,props:[at({[n]:i})]});return Zs.push(o),o.id}function oP(t,e){let i=Ne.define({id:Zs.length,name:"Document",props:[Qi.add(()=>t),Et.add(()=>n=>e.getIndent(n))],top:!0});return Zs.push(i),i}var O_={rtl:X.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:we.RTL}),ltr:X.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:we.LTR}),auto:X.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var If=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=Nf(t.state,i.from);return n.line?lP(t):n.block?cP(t):!1};function Bf(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let r=t(e,i);return r?(n(i.update(r)),!0):!1}}var lP=Bf(uP,0);var aP=Bf(L0,0);var cP=Bf((t,e)=>L0(t,e,fP(e)),0);function Nf(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}var Bs=50;function hP(t,{open:e,close:i},n,r){let s=t.sliceDoc(n-Bs,n),o=t.sliceDoc(r,r+Bs),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,h=s.length-l;if(s.slice(h-e.length,h)==e&&o.slice(a,a+i.length)==i)return{open:{pos:n-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let c,f;r-n<=2*Bs?c=f=t.sliceDoc(n,r):(c=t.sliceDoc(n,n+Bs),f=t.sliceDoc(r-Bs,r));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-i.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+i.length)==i?{open:{pos:n+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:r-d-i.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function fP(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),r=i.to<=n.to?n:t.doc.lineAt(i.to);r.from>n.from&&r.from==i.to&&(r=i.to==n.to+1?n:t.doc.lineAt(i.to-1));let s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function L Line truncated
`+i.scrub(),s=this.advance(r);return s>-1&&s<r.length?this.complete(e,n,s):!1}finish(e,i){return(this.stage==2||this.stage==3)&&Js(i.content,this.pos)==i.content.length?this.complete(e,i,i.content.length):!1}complete(e,i,n){return e.addLeafElement(i,oe(A.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(My(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(oe(A.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Ry(e,Js(e,this.pos),this.start)))return-1}else if(this.stage==2){let i=Js(e,this.pos),n=0;if(i>this.pos){let r=Ey(e,i,this.start);if(r){let s=Bu(e,r.to-this.start);s>0&&(this.nextStage(r),n=s)}}return n||(n=Bu(e,this.pos)),n>0&&n<e.length?n:-1}else return Bu(e,this.pos)}}};function Bu(t,e){for(;e<t.length;e++){let i=t.charCodeAt(e);if(i==10)break;if(!Dt(i))return-1}return e}var Vu=class{nextLine(e,i,n){let r=i.depth<e.stack.length?-1:ky(i),s=i.next;if(r<0)return!1;let o=oe(A.HeaderMark,e.lineStart+i.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,oe(s==61?A.SetextHeading1:A.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}},Py={LinkReference(t,e){return e.content.charCodeAt(0)==91?new Wu(e):null},SetextHeading(){return new Vu}},IT=[(t,e)=>xy(e)>=0,(t,e)=>by(e)>=0,(t,e)=>yy(e)>=0,(t,e)=>ed(e,t,!0)>=0,(t,e)=>td(e,t,!0)>=0,(t,e)=>Ju(e,t,!0)>=0,(t,e)=>Qy(e,t,!0)>=0],BT={text:"",end:0},Gu=class{constructor(e,i,n,r){this.parser=e,this.input=i,this.ranges=r,this.line=new zu,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=ra.create(A.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new Hu(n,i):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let n=0;;){let r=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!r||e.markers[n].from<r.end);){let s=e.markers[n++];this.addNode(s.type,s.from,s.to)}if(!r)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let n of this.parser.blockParsers)if(n){let r=n(this,e);if(r!=!1){if(r==!0)return null;e.forward();continue e}}break}let i=new ju(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let r=n(this,i);r&&i.parsers.push(r)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,i))break e}for(let n of i.parsers)if(n.nextLine(this,e,i))return null;i.content+=`
`+e.scrub();for(let n of e.markers)i.marks.push(n)}return this.finishLeaf(i),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let i=this.fragments.takeNodes(this);return i?(this.absoluteLineStart+=i,this.lineStart=Ly(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let i=BT;if(i.end=e,e>=this.to)i.text="";else if(i.text=this.lineChunkAt(e),i.end+=i.text.length,this.ranges.length>1){let n=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<i.end;){r++;let s=this.ranges[r].from,o=this.lineChunkAt(s);i.end=s+o.length,i.text=i.text.slice(0,this.ranges[r-1].to-n)+o,n=i.end-i.text.length}}return i}readLine(){let{line:e}=this,{text:i,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(i);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],s=this.parser.skipContextMarkup[r.type];if(!s)throw new Error("Unhandled block context "+A[r.type]);let o=this.line.markers.length;if(!s(r,this,e)){this.line.markers.length>o&&(r.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let i=this.input.chunk(e),n;if(this.input.lineChunks)n=i==`
`?"":i;else{let r=i.indexOf(`
`);n=r<0?i:i.slice(0,r)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,i,n=0){this.block=sa.create(e,n,this.lineStart+i,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,i,n=0){this.startContext(this.parser.getNodeType(e),i,n)}addNode(e,i,n){typeof e=="number"&&(e=new Me(this.parser.nodeSet.types[e],Rr,Rr,(n!=null?n:this.prevLineEnd())-i)),this.block.addChild(e,i-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,i){this.addNode(this.buffer.writeElements(Hu(i.children,e.marks),-i.from).finish(i.type,i.to-i.from),i.from)}finishContext(){let e=this.stack.pop(),i=this.stack[this.stack.length-1];i.addChild(e.toTree(this.parser.nodeSet),e.from-i.from),this.block=i}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?Ty(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let i=Hu(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(i,-e.start).finish(A.Paragraph,e.content.length),e.start)}elt(e,i,n,r){return typeof e=="string"?oe(this.parser.getNodeType(e),i,n,r):new la(e,i)}get buffer(){return new oa(this.parser.nodeSet)}};function Ty(t,e,i,n,r){let s=t[e].to,o=[],l=[],a=i.from+n;function h(c,f){for(;f?c>=s:c>s;){let u=t[e+1].from-s;n+=u,c+=u,e++,s=t[e].to}}for(let c=i.firstChild;c;c=c.nextSibling){h(c.from+n,!0);let f=c.from+n,u,d=r.get(c.tree);d?u=d:c.to+n>s?(u=Ty(t,e,c,n,r),h(c.to+n,!1)):u=c.toTree(),o.push(u),l.push(f-a)}return h(i.to+n,!1),new Me(i.type,o,l,i.to+n-a,i.tree?i.tree.propValues:void 0)}var to=class t extends ea{constructor(e,i,n,r,s,o,l,a,h){super(),this.nodeSet=e,this.blockParsers=i,this.leafBlockParsers=n,this.blockNames=r,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=l,this.inlineNames=a,this.wrappers=h,this.nodeTypes=Object.create(null);for(let c of e.types)this.nodeTypes[c.name]=c.id}createParse(e,i,n){let r=new Uu(this,e,i,n);for(let s of this.wrappers)r=s(r,e,i,n);return r}configure(e){let i=Fu(e);if(!i)return this;let{nodeSet:n,skipContextMarkup:r}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),l=this.blockNames.slice(),a=this.inlineParsers.slice(),h=this.inlineNames.slice(),c=this.endLeafBlock.slice(),f=this.wrappers;if(Ks(i.defineNodes)){r=Object.assign({},r);let u=n.types.slice(),d;for(let p of i.defineNodes){let{name:g,block:m,composite:b,style:y}=typeof p=="string"?{name:p}:p;if(u.some(x=>x.name==g))continue;b&&(r[u.length]=(x,w,k)=>b(w,k,x.value));let S=u.length,v=b?["Block","BlockContext"]:m?S>=A.ATXHeading1&&S<=A.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;u.push(tt.define({id:S,name:g,props:v&&[[de.group,v]]})),y&&(d||(d={}),Array.isArray(y)||y instanceof $e?d[g]=y:Object.assign(d,y))}n=new Us(u),d&&(n=n.extend(at(d)))}if(Ks(i.props)&&(n=n.extend(...i.props)),Ks(i.remove))for(let u of i.remove){let d=this.blockNames.indexOf(u),p=this.inlineNames.indexOf(u);d>-1&&(s[d]=o[d]=void 0),p>-1&&(a[p]=void 0)}if(Ks(i.parseBlock))for(let u of i.parseBlock){let d=l.indexOf(u.name);if(d>-1)s[d]=u.parse,o[d]=u.leaf;else{let p=u.before?ra(l,u.before):u.after?ra(l,u.after)+1:l.length-1;s.splice(p,0,u.parse),o.splice(p,0,u.leaf),l.splice(p,0,u.name)}u.endLeaf&&c.push(u.endLeaf)}if(Ks(i.parseInline))for(let u of i.parseInline){let d=h.indexOf(u.name);if(d>-1)a[d]=u.parse;else{let p=u.before?ra(h,u.before):u.after?ra(h,u.after)+1:h.length-1;a.splice(p,0,u.parse),h.splice(p,0,u.name)}}return i.wrap&&(f=f.concat(i.wrap)),new t(n,s,o,l,c,r,a,h,f)}getNodeType(e){let i=this.nodeTypes[e];if(i==null)throw new RangeError(`Unknown node type '${e}'`);return i}parseInline(e,i){let n=new no(this,e,i);e:for(let r=i;r<n.end;){let s=n.char(r);for(let o of this.inlineParsers)if(o){let l=o(n,s,r);if(l>=0){r=l;continue e}}r++}return n.resolveMarkers(0)}};function Ks(t){return t!=null&&t.length>0}function Fu(t){if(!Array.isArray(t))return t;if(t.length==0)return null;let e=Fu(t[0]);if(t.length==1)return e;let i=Fu(t.slice(1));if(!i||!e)return e||i;let n=(o,l)=>(o||Rr).concat(l||Rr),r=e.wrap,s=i.wrap;return{props:n(e.props,i.props),defineNodes:n(e.defineNodes,i.defineNodes),parseBlock:n(e.parseBlock,i.parseBlock),parseInline:n(e.parseInline,i.parseInline),remove:n(e.remove,i.remove),wrap:r?s?(o,l,a,h)=>r(s(o,l,a,h),l,a,h):r:s}}function ra(t,e){let i=t.indexOf(e);if(i<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return i}var Cy=[tt.none];for(let t=1,e;e=A[t];t++)Cy[t]=tt.define({id:t,name:e,props:t>=A.Escape?[]:[[de.group,t in by?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var Rr=[],oa=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,i,n, Line truncated
`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let r=e+this.fragment.offset;for(;n.to<=r;)if(!n.parent())return!1;for(;;){if(n.from>=r)return this.fragment.from<=i;if(!n.childAfter(r))return!1}}matches(e){let i=this.cursor.tree;return i&&i.prop(de.contextHash)==e}takeNodes(e){let i=this.cursor,n=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,l=e.block.children.length,a=o,h=l;for(;;){if(i.to-n>r){if(i.type.isAnonymous&&i.firstChild())continue;break}let c=Xy(i.from-n,e.ranges);if(i.to-n<=e.ranges[e.rangeI].to)e.addNode(i.tree,c);else{let f=new Me(e.parser.nodeSet.types[A.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(f,i.tree),e.addNode(f,c)}if(i.type.is("Block")&&(IT.indexOf(i.type.id)<0?(o=i.to-n,l=e.block.children.length):(o=a,l=h),a=i.to-n,h=e.block.children.length),!i.nextSibling())break}for(;e.block.children.length>l;)e.block.children.pop(),e.block.positions.pop();return o-s}};function Xy(t,e){let i=t;for(let n=1;n<e.length;n++){let r=e[n-1].to,s=e[n].from;r<t&&(i-=s-r)}return i}var BT=at({"Blockquote/...":O.quote,HorizontalRule:O.contentSeparator,"ATXHeading1/... SetextHeading1/...":O.heading1,"ATXHeading2/... SetextHeading2/...":O.heading2,"ATXHeading3/...":O.heading3,"ATXHeading4/...":O.heading4,"ATXHeading5/...":O.heading5,"ATXHeading6/...":O.heading6,"Comment CommentBlock":O.comment,Escape:O.escape,Entity:O.character,"Emphasis/...":O.emphasis,"StrongEmphasis/...":O.strong,"Link/... Image/...":O.link,"OrderedList/... BulletList/...":O.list,"BlockQuote/...":O.quote,"InlineCode CodeText":O.monospace,"URL Autolink":O.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":O.processingInstruction,"CodeInfo LinkLabel":O.labelName,LinkTitle:O.string,Paragraph:O.content}),_y=new to(new Us(Cy).extend(BT),Object.keys(na).map(t=>na[t]),Object.keys(na).map(t=>$y[t]),Object.keys(na),_T,by,Object.keys(ju).map(t=>ju[t]),Object.keys(ju),[]);function NT(t,e,i){let n=[];for(let r=t.firstChild,s=e;;r=r.nextSibling){let o=r?r.from:i;if(o>s&&n.push({from:s,to:o}),!r)break;s=r.to}return n}function Zy(t){let{codeParser:e,htmlParser:i}=t;return{wrap:oy((r,s)=>{let o=r.type.id;if(e&&(o==A.CodeBlock||o==A.FencedCode)){let l="";if(o==A.FencedCode){let h=r.node.getChild(A.CodeInfo);h&&(l=s.read(h.from,h.to))}let a=e(l);if(a)return{parser:a,overlay:h=>h.type.id==A.CodeText,bracketed:o==A.FencedCode}}else if(i&&(o==A.HTMLBlock||o==A.HTMLTag||o==A.CommentBlock))return{parser:i,overlay:NT(r.node,r.from,r.to)};return null})}}var jT={resolve:"Strikethrough",mark:"StrikethroughMark"},zT={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":O.strikethrough}},{name:"StrikethroughMark",style:O.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(e!=126||t.char(i+1)!=126||t.char(i+2)==126)return-1;let n=t.slice(i-1,i),r=t.slice(i+2,i+3),s=/\s|^$/.test(n),o=/\s|^$/.test(r),l=io.test(n),a=io.test(r);return t.addDelimiter(jT,i,i+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function eo(t,e,i=0,n,r=0){let s=0,o=!0,l=-1,a=-1,h=!1,c=()=>{n.push(t.elt("TableCell",r+l,r+a,t.parser.parseInline(e.slice(l,a),r+l)))};for(let f=i;f<e.length;f++){let u=e.charCodeAt(f);u==124&&!h?((!o||l>-1)&&s++,o=!1,n&&(l>-1&&c(),n.push(t.elt("TableDelimiter",f+r,f+r+1))),l=a=-1):(h||u!=32&&u!=9)&&(l<0&&(l=f),a=f+1),h=!h&&u==92}return l>-1&&(s++,n&&c()),s}function fy(t,e){for(let i=e;i<t.length;i++){let n=t.charCodeAt(i);if(n==124)return!0;n==92&&i++}return!1}var Dy=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,ca=class{constructor(){this.rows=null}nextLine(e,i,n){if(this.rows==null){this.rows=!1;let r;if((i.next==45||i.next==58||i.next==124)&&Dy.test(r=i.text.slice(i.pos))){let s=[];eo(e,n.content,0,s,n.start)==eo(e,r,0)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+i.pos,e.lineStart+i.text.length)])}}else if(this.rows){let r=[];eo(e,i.text,i.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+i.pos,e.lineStart+i.text.length,r))}return!1}finish(e,i){return this.rows?(e.addLeafElement(i,e.elt("Table",i.start,i.start+i.content.length,this.rows)),!0):!1}},YT={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":O.heading}},"TableRow",{name:"TableCell",style:O.content},{name:"TableDelimiter",style:O.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return fy(e.content,0)?new ca:null},endLeaf(t,e,i){if(i.parsers.some(r=>r instanceof ca)||!fy(e.text,e.basePos))return!1;let n=t.peekLine();return Dy.test(n)&&eo(t,e.text,e.basePos)==eo(t,n,e.basePos)},before:"SetextHeading"}]},Ju=class{nextLine(){return!1}finish(e,i){return e.addLeafElement(i,e.elt("Task",i.start,i.start+i.content.length,[e.elt("TaskMarker",i.start,i.start+3),...e.parser.parseInline(i.content.slice(3),i.start+3)])),!0}},qT={defineNodes:[{name:"Task",block:!0,style:O.list},{name:"TaskMarker",style:O.atom}],parseBlock:[{name: Line truncated
`);n=r<0?i:i.slice(0,r)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,i,n=0){this.block=ra.create(e,n,this.lineStart+i,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,i,n=0){this.startContext(this.parser.getNodeType(e),i,n)}addNode(e,i,n){typeof e=="number"&&(e=new Me(this.parser.nodeSet.types[e],Rr,Rr,(n!=null?n:this.prevLineEnd())-i)),this.block.addChild(e,i-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,i){this.addNode(this.buffer.writeElements(Fu(i.children,e.marks),-i.from).finish(i.type,i.to-i.from),i.from)}finishContext(){let e=this.stack.pop(),i=this.stack[this.stack.length-1];i.addChild(e.toTree(this.parser.nodeSet),e.from-i.from),this.block=i}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?$y(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let i=Fu(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(i,-e.start).finish(A.Paragraph,e.content.length),e.start)}elt(e,i,n,r){return typeof e=="string"?oe(this.parser.getNodeType(e),i,n,r):new oa(e,i)}get buffer(){return new sa(this.parser.nodeSet)}};function $y(t,e,i,n,r){let s=t[e].to,o=[],l=[],a=i.from+n;function h(c,f){for(;f?c>=s:c>s;){let u=t[e+1].from-s;n+=u,c+=u,e++,s=t[e].to}}for(let c=i.firstChild;c;c=c.nextSibling){h(c.from+n,!0);let f=c.from+n,u,d=r.get(c.tree);d?u=d:c.to+n>s?(u=$y(t,e,c,n,r),h(c.to+n,!1)):u=c.toTree(),o.push(u),l.push(f-a)}return h(i.to+n,!1),new Me(i.type,o,l,i.to+n-a,i.tree?i.tree.propValues:void 0)}var to=class t extends Jl{constructor(e,i,n,r,s,o,l,a,h){super(),this.nodeSet=e,this.blockParsers=i,this.leafBlockParsers=n,this.blockNames=r,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=l,this.inlineNames=a,this.wrappers=h,this.nodeTypes=Object.create(null);for(let c of e.types)this.nodeTypes[c.name]=c.id}createParse(e,i,n){let r=new Gu(this,e,i,n);for(let s of this.wrappers)r=s(r,e,i,n);return r}configure(e){let i=Uu(e);if(!i)return this;let{nodeSet:n,skipContextMarkup:r}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),l=this.blockNames.slice(),a=this.inlineParsers.slice(),h=this.inlineNames.slice(),c=this.endLeafBlock.slice(),f=this.wrappers;if(Ks(i.defineNodes)){r=Object.assign({},r);let u=n.types.slice(),d;for(let p of i.defineNodes){let{name:g,block:m,composite:b,style:y}=typeof p=="string"?{name:p}:p;if(u.some(x=>x.name==g))continue;b&&(r[u.length]=(x,w,k)=>b(w,k,x.value));let S=u.length,v=b?["Block","BlockContext"]:m?S>=A.ATXHeading1&&S<=A.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;u.push(tt.define({id:S,name:g,props:v&&[[de.group,v]]})),y&&(d||(d={}),Array.isArray(y)||y instanceof $e?d[g]=y:Object.assign(d,y))}n=new Us(u),d&&(n=n.extend(at(d)))}if(Ks(i.props)&&(n=n.extend(...i.props)),Ks(i.remove))for(let u of i.remove){let d=this.blockNames.indexOf(u),p=this.inlineNames.indexOf(u);d>-1&&(s[d]=o[d]=void 0),p>-1&&(a[p]=void 0)}if(Ks(i.parseBlock))for(let u of i.parseBlock){let d=l.indexOf(u.name);if(d>-1)s[d]=u.parse,o[d]=u.leaf;else{let p=u.before?na(l,u.before):u.after?na(l,u.after)+1:l.length-1;s.splice(p,0,u.parse),o.splice(p,0,u.leaf),l.splice(p,0,u.name)}u.endLeaf&&c.push(u.endLeaf)}if(Ks(i.parseInline))for(let u of i.parseInline){let d=h.indexOf(u.name);if(d>-1)a[d]=u.parse;else{let p=u.before?na(h,u.before):u.after?na(h,u.after)+1:h.length-1;a.splice(p,0,u.parse),h.splice(p,0,u.name)}}return i.wrap&&(f=f.concat(i.wrap)),new t(n,s,o,l,c,r,a,h,f)}getNodeType(e){let i=this.nodeTypes[e];if(i==null)throw new RangeError(`Unknown node type '${e}'`);return i}parseInline(e,i){let n=new no(this,e,i);e:for(let r=i;r<n.end;){let s=n.char(r);for(let o of this.inlineParsers)if(o){let l=o(n,s,r);if(l>=0){r=l;continue e}}r++}return n.resolveMarkers(0)}};function Ks(t){return t!=null&&t.length>0}function Uu(t){if(!Array.isArray(t))return t;if(t.length==0)return null;let e=Uu(t[0]);if(t.length==1)return e;let i=Uu(t.slice(1));if(!i||!e)return e||i;let n=(o,l)=>(o||Rr).concat(l||Rr),r=e.wrap,s=i.wrap;return{props:n(e.props,i.props),defineNodes:n(e.defineNodes,i.defineNodes),parseBlock:n(e.parseBlock,i.parseBlock),parseInline:n(e.parseInline,i.parseInline),remove:n(e.remove,i.remove),wrap:r?s?(o,l,a,h)=>r(s(o,l,a,h),l,a,h):r:s}}function na(t,e){let i=t.indexOf(e);if(i<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return i}var Ty=[tt.none];for(let t=1,e;e=A[t];t++)Ty[t]=tt.define({id:t,name:e,props:t>=A.Escape?[]:[[de.group,t in my?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var Rr=[],sa=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,i,n, Line truncated
`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let r=e+this.fragment.offset;for(;n.to<=r;)if(!n.parent())return!1;for(;;){if(n.from>=r)return this.fragment.from<=i;if(!n.childAfter(r))return!1}}matches(e){let i=this.cursor.tree;return i&&i.prop(de.contextHash)==e}takeNodes(e){let i=this.cursor,n=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,l=e.block.children.length,a=o,h=l;for(;;){if(i.to-n>r){if(i.type.isAnonymous&&i.firstChild())continue;break}let c=Ly(i.from-n,e.ranges);if(i.to-n<=e.ranges[e.rangeI].to)e.addNode(i.tree,c);else{let f=new Me(e.parser.nodeSet.types[A.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(f,i.tree),e.addNode(f,c)}if(i.type.is("Block")&&(jT.indexOf(i.type.id)<0?(o=i.to-n,l=e.block.children.length):(o=a,l=h),a=i.to-n,h=e.block.children.length),!i.nextSibling())break}for(;e.block.children.length>l;)e.block.children.pop(),e.block.positions.pop();return o-s}};function Ly(t,e){let i=t;for(let n=1;n<e.length;n++){let r=e[n-1].to,s=e[n].from;r<t&&(i-=s-r)}return i}var zT=at({"Blockquote/...":O.quote,HorizontalRule:O.contentSeparator,"ATXHeading1/... SetextHeading1/...":O.heading1,"ATXHeading2/... SetextHeading2/...":O.heading2,"ATXHeading3/...":O.heading3,"ATXHeading4/...":O.heading4,"ATXHeading5/...":O.heading5,"ATXHeading6/...":O.heading6,"Comment CommentBlock":O.comment,Escape:O.escape,Entity:O.character,"Emphasis/...":O.emphasis,"StrongEmphasis/...":O.strong,"Link/... Image/...":O.link,"OrderedList/... BulletList/...":O.list,"BlockQuote/...":O.quote,"InlineCode CodeText":O.monospace,"URL Autolink":O.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":O.processingInstruction,"CodeInfo LinkLabel":O.labelName,LinkTitle:O.string,Paragraph:O.content}),Xy=new to(new Us(Ty).extend(zT),Object.keys(ia).map(t=>ia[t]),Object.keys(ia).map(t=>Py[t]),Object.keys(ia),IT,my,Object.keys(Nu).map(t=>Nu[t]),Object.keys(Nu),[]);function YT(t,e,i){let n=[];for(let r=t.firstChild,s=e;;r=r.nextSibling){let o=r?r.from:i;if(o>s&&n.push({from:s,to:o}),!r)break;s=r.to}return n}function _y(t){let{codeParser:e,htmlParser:i}=t;return{wrap:sy((r,s)=>{let o=r.type.id;if(e&&(o==A.CodeBlock||o==A.FencedCode)){let l="";if(o==A.FencedCode){let h=r.node.getChild(A.CodeInfo);h&&(l=s.read(h.from,h.to))}let a=e(l);if(a)return{parser:a,overlay:h=>h.type.id==A.CodeText,bracketed:o==A.FencedCode}}else if(i&&(o==A.HTMLBlock||o==A.HTMLTag||o==A.CommentBlock))return{parser:i,overlay:YT(r.node,r.from,r.to)};return null})}}var qT={resolve:"Strikethrough",mark:"StrikethroughMark"},WT={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":O.strikethrough}},{name:"StrikethroughMark",style:O.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(e!=126||t.char(i+1)!=126||t.char(i+2)==126)return-1;let n=t.slice(i-1,i),r=t.slice(i+2,i+3),s=/\s|^$/.test(n),o=/\s|^$/.test(r),l=io.test(n),a=io.test(r);return t.addDelimiter(qT,i,i+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function eo(t,e,i=0,n,r=0){let s=0,o=!0,l=-1,a=-1,h=!1,c=()=>{n.push(t.elt("TableCell",r+l,r+a,t.parser.parseInline(e.slice(l,a),r+l)))};for(let f=i;f<e.length;f++){let u=e.charCodeAt(f);u==124&&!h?((!o||l>-1)&&s++,o=!1,n&&(l>-1&&c(),n.push(t.elt("TableDelimiter",f+r,f+r+1))),l=a=-1):(h||u!=32&&u!=9)&&(l<0&&(l=f),a=f+1),h=!h&&u==92}return l>-1&&(s++,n&&c()),s}function hy(t,e){for(let i=e;i<t.length;i++){let n=t.charCodeAt(i);if(n==124)return!0;n==92&&i++}return!1}var Zy=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,aa=class{constructor(){this.rows=null}nextLine(e,i,n){if(this.rows==null){this.rows=!1;let r;if((i.next==45||i.next==58||i.next==124)&&Zy.test(r=i.text.slice(i.pos))){let s=[];eo(e,n.content,0,s,n.start)==eo(e,r,0)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+i.pos,e.lineStart+i.text.length)])}}else if(this.rows){let r=[];eo(e,i.text,i.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+i.pos,e.lineStart+i.text.length,r))}return!1}finish(e,i){return this.rows?(e.addLeafElement(i,e.elt("Table",i.start,i.start+i.content.length,this.rows)),!0):!1}},VT={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":O.heading}},"TableRow",{name:"TableCell",style:O.content},{name:"TableDelimiter",style:O.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return hy(e.content,0)?new aa:null},endLeaf(t,e,i){if(i.parsers.some(r=>r instanceof aa)||!hy(e.text,e.basePos))return!1;let n=t.peekLine();return Zy.test(n)&&eo(t,e.text,e.basePos)==eo(t,n,e.basePos)},before:"SetextHeading"}]},Ku=class{nextLine(){return!1}finish(e,i){return e.addLeafElement(i,e.elt("Task",i.start,i.start+i.content.length,[e.elt("TaskMarker",i.start,i.start+3),...e.parser.parseInline(i.content.slice(3),i.start+3)])),!0}},GT={defineNodes:[{name:"Task",block:!0,style:O.list},{name:"TaskMarker",style:O.atom}],parseBlock:[{name: Line truncated
\${}
} catch (\${error}) {
\${}
@@ -29,15 +29,15 @@ https://github.com/highlightjs/highlight.js/issues/2277`),te=P,Y=D),V===void 0&&
constructor(\${params}) {
\${}
}
}`,{label:"class",detail:"definition",type:"keyword"}),M('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),M('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],jA=P1.concat([M("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),M("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),M("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),w1=new mr,$1=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function oo(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}var zA=["FunctionDeclaration"],YA={FunctionDeclaration:oo("function"),ClassDeclaration:oo("class"),ClassExpression:()=>!0,EnumDeclaration:oo("constant"),TypeAliasDeclaration:oo("type"),NamespaceDeclaration:oo("namespace"),VariableDefinition(t,e){t.matchContext(zA)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function T1(t,e){let i=w1.get(e);if(i)return i;let n=[],r=!0;function s(o,l){let a=t.sliceString(o.from,o.to);n.push({label:a,type:l})}return e.cursor(be.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=YA[o.name];if(l&&l(o,s)||$1.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of T1(t,o.node))n.push(l);return!1}}),w1.set(e,n),n}var v1=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,C1=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function qA(t){let e=fe(t.state).resolveInner(t.pos,-1);if(C1.indexOf(e.name)>-1)return null;let i=e.name=="VariableName"||e.to-e.from<20&&v1.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let r=e;r;r=r.parent)$1.has(r.name)&&(n=n.concat(T1(t.state.doc,r)));return{options:n,from:i?e.from:t.pos,validFor:v1}}var Ft=qt.define({name:"javascript",parser:k1.configure({props:[Et.add({IfStatement:xr({except:/^\s*({|else\b)/}),TryStatement:xr({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:u0,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:Ds({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":xr({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),Mt.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":kr,BlockComment(t){return{from:t.from+2,to:t.to-2}},JSXElement(t){let e=t.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let i=t.lastChild;return{from:e.to,to:i.type.isError?t.to:i.from}},"JSXSelfClosingTag JSXOpenTag"(t){var e;let i=(e=t.firstChild)===null||e===void 0?void 0:e.nextSibling,n=t.lastChild;return!i||i.type.isError?null:{from:i.to,to:n.type.isError?t.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),A1={test:t=>/^JSX/.test(t.name),facet:yr({commentTokens:{block:{open:"{/*",close:"*/}"}}})},md=Ft.configure({dialect:"ts"},"typescript"),bd=Ft.configure({dialect:"jsx",props:[Ml.add(t=>t.isTop?[A1]:void 0)]}),yd=Ft.configure({dialect:"jsx ts",props:[Ml.add(t=>t.isTop?[A1]:void 0)]},"typescript"),R1=t=>({label:t,type:"keyword"}),E1="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(R1),WA=E1.concat(["declare","implements","private","protected","public"].map(R1));function M1(t={}){let e=t.jsx?t.typescript?yd:bd:t.typescript?md:Ft,i=t.typescript?jA.concat(WA):P1.concat(E1);return new Pt(e,[Ft.data.of({autocomplete:Bb(C1,xu(i))}),Ft.data.of({autocomplete:qA}),t.jsx?UA:[]])}function VA(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function Q1(t,e,i=t.length){for(let n=e==null?void 0:e.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return t.sliceString(n.from,Math.min(n.to,i));return""}var GA=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),UA=T.inputHandler.of((t,e,i,n,r)=>{if((GA?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||n!=">"&&n!="/"||!Ft.isActiveAt(t.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var h;let{head:c}=a,f=fe(o).resolveInn Line truncated
${a}`}let f=Xd(t.buffer,r[l],s[l],t.position,c);a+=`${" ".repeat(i.indent)}${_d((t.line+1).toString(),h)} | ${f.str}
}`,{label:"class",detail:"definition",type:"keyword"}),M('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),M('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],qA=Q1.concat([M("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),M("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),M("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),k1=new mr,P1=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function oo(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}var WA=["FunctionDeclaration"],VA={FunctionDeclaration:oo("function"),ClassDeclaration:oo("class"),ClassExpression:()=>!0,EnumDeclaration:oo("constant"),TypeAliasDeclaration:oo("type"),NamespaceDeclaration:oo("namespace"),VariableDefinition(t,e){t.matchContext(WA)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function $1(t,e){let i=k1.get(e);if(i)return i;let n=[],r=!0;function s(o,l){let a=t.sliceString(o.from,o.to);n.push({label:a,type:l})}return e.cursor(be.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=VA[o.name];if(l&&l(o,s)||P1.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of $1(t,o.node))n.push(l);return!1}}),k1.set(e,n),n}var w1=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,T1=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function GA(t){let e=fe(t.state).resolveInner(t.pos,-1);if(T1.indexOf(e.name)>-1)return null;let i=e.name=="VariableName"||e.to-e.from<20&&w1.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let r=e;r;r=r.parent)P1.has(r.name)&&(n=n.concat($1(t.state.doc,r)));return{options:n,from:i?e.from:t.pos,validFor:w1}}var Ft=qt.define({name:"javascript",parser:x1.configure({props:[Et.add({IfStatement:xr({except:/^\s*({|else\b)/}),TryStatement:xr({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:f0,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:Ds({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":xr({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),Mt.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":kr,BlockComment(t){return{from:t.from+2,to:t.to-2}},JSXElement(t){let e=t.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let i=t.lastChild;return{from:e.to,to:i.type.isError?t.to:i.from}},"JSXSelfClosingTag JSXOpenTag"(t){var e;let i=(e=t.firstChild)===null||e===void 0?void 0:e.nextSibling,n=t.lastChild;return!i||i.type.isError?null:{from:i.to,to:n.type.isError?t.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),C1={test:t=>/^JSX/.test(t.name),facet:yr({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Od=Ft.configure({dialect:"ts"},"typescript"),md=Ft.configure({dialect:"jsx",props:[El.add(t=>t.isTop?[C1]:void 0)]}),bd=Ft.configure({dialect:"jsx ts",props:[El.add(t=>t.isTop?[C1]:void 0)]},"typescript"),A1=t=>({label:t,type:"keyword"}),R1="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(A1),UA=R1.concat(["declare","implements","private","protected","public"].map(A1));function E1(t={}){let e=t.jsx?t.typescript?bd:md:t.typescript?Od:Ft,i=t.typescript?qA.concat(UA):Q1.concat(R1);return new Pt(e,[Ft.data.of({autocomplete:Ib(T1,Su(i))}),Ft.data.of({autocomplete:GA}),t.jsx?KA:[]])}function FA(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function v1(t,e,i=t.length){for(let n=e==null?void 0:e.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return t.sliceString(n.from,Math.min(n.to,i));return""}var HA=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),KA=T.inputHandler.of((t,e,i,n,r)=>{if((HA?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||n!=">"&&n!="/"||!Ft.isActiveAt(t.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var h;let{head:c}=a,f=fe(o).resolveInn Line truncated
${a}`}let f=Ld(t.buffer,r[l],s[l],t.position,c);a+=`${" ".repeat(i.indent)}${Xd((t.line+1).toString(),h)} | ${f.str}
`,a+=`${"-".repeat(i.indent+h+3+f.pos)}^
`;for(let u=1;u<=i.linesAfter&&!(l+u>=s.length);u++){let d=Xd(t.buffer,r[l+u],s[l+u],t.position-(r[l]-r[l+u]),c);a+=`${" ".repeat(i.indent)}${_d((t.line+u+1).toString(),h)} | ${d.str}
`}return a.replace(/\n$/,"")}function kS(t,e){let i="";return t.mark?(t.mark.name&&(i+=`in "${t.mark.name}" `),i+=`(${t.mark.line+1}:${t.mark.column+1})`,!e&&t.mark.snippet&&(i+=`
`;for(let u=1;u<=i.linesAfter&&!(l+u>=s.length);u++){let d=Ld(t.buffer,r[l+u],s[l+u],t.position-(r[l]-r[l+u]),c);a+=`${" ".repeat(i.indent)}${Xd((t.line+u+1).toString(),h)} | ${d.str}
`}return a.replace(/\n$/,"")}function xS(t,e){let i="";return t.mark?(t.mark.name&&(i+=`in "${t.mark.name}" `),i+=`(${t.mark.line+1}:${t.mark.column+1})`,!e&&t.mark.snippet&&(i+=`
${t.mark.snippet}`),`${t.reason} ${i}`):t.reason}var MS=class extends Error{constructor(e,i){super();K(this,"reason");K(this,"mark");this.name="YAMLException",this.reason=e,this.mark=i,this.message=kS(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(e){return`${this.name}: ${kS(this,e)}`}};function Ca(t,e,i,n=""){let r=0,s=0;for(let l=0;l<e;l++){let a=t.charCodeAt(l);a===10?(r++,s=l+1):a===13&&(r++,t.charCodeAt(l+1)===10&&l++,s=l+1)}let o={name:n,buffer:t,position:e,line:r,column:e-s};throw o.snippet=Z2(o),new MS(i,o)}var D2=-1;function wS(t){switch(t){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}var LS=new Array(256),XS=new Array(256);for(let t=0;t<256;t++)LS[t]=wS(t)?1:0,XS[t]=wS(t);function I2(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}function B2(t){return t>=48&&t<=57?t-48:(t|32)-97+10}function N2(t){return t===120?2:t===117?4:8}function wa(t,e,i){let n=0;for(;e<i;){let r=t.charCodeAt(e);if(r===10)n++,e++;else if(r===13)n++,e++,t.charCodeAt(e)===10&&e++;else if(r===32||r===9)e++;else break}return{position:e,breaks:n}}function Ud(t){return t===1?" ":`
`.repeat(t-1)}function j2(t,e,i){let n="",r=e,s=e,o=e;for(;r<i;){let l=t.charCodeAt(r);if(l===10||l===13){n+=t.slice(s,o);let a=wa(t,r,i);n+=Ud(a.breaks),r=s=o=a.position}else r++,l!==32&&l!==9&&(o=r)}return n+t.slice(s,o)}function z2(t,e,i){let n="",r=e,s=e,o=e;for(;r<i;){let l=t.charCodeAt(r);if(l===39)n+=t.slice(s,r)+"'",r+=2,s=o=r;else if(l===10||l===13){n+=t.slice(s,o);let a=wa(t,r,i);n+=Ud(a.breaks),r=s=o=a.position}else r++,l!==32&&l!==9&&(o=r)}return n+t.slice(s,i)}function Y2(t,e,i){let n="",r=e,s=e,o=e;for(;r<i;){let l=t.charCodeAt(r);if(l===92){n+=t.slice(s,r),r++;let a=t.charCodeAt(r);if(a===10||a===13)r=wa(t,r,i).position;else if(a<256&&LS[a])n+=XS[a],r++;else{let h=N2(a),c=0;for(;h>0;h--){r++;let f=B2(t.charCodeAt(r));c=(c<<4)+f}n+=I2(c),r++}s=o=r}else if(l===10||l===13){n+=t.slice(s,o);let a=wa(t,r,i);n+=Ud(a.breaks),r=s=o=a.position}else r++,l!==32&&l!==9&&(o=r)}return n+t.slice(s,i)}function vS(t,e,i,n,r,s){let o=n<0?0:n,l=t.slice(e,i).replace(/\r\n?/g,`
${t.mark.snippet}`),`${t.reason} ${i}`):t.reason}var ES=class extends Error{constructor(e,i){super();K(this,"reason");K(this,"mark");this.name="YAMLException",this.reason=e,this.mark=i,this.message=xS(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(e){return`${this.name}: ${xS(this,e)}`}};function Ta(t,e,i,n=""){let r=0,s=0;for(let l=0;l<e;l++){let a=t.charCodeAt(l);a===10?(r++,s=l+1):a===13&&(r++,t.charCodeAt(l+1)===10&&l++,s=l+1)}let o={name:n,buffer:t,position:e,line:r,column:e-s};throw o.snippet=B2(o),new ES(i,o)}var N2=-1;function kS(t){switch(t){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}var MS=new Array(256),LS=new Array(256);for(let t=0;t<256;t++)MS[t]=kS(t)?1:0,LS[t]=kS(t);function j2(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}function z2(t){return t>=48&&t<=57?t-48:(t|32)-97+10}function Y2(t){return t===120?2:t===117?4:8}function ka(t,e,i){let n=0;for(;e<i;){let r=t.charCodeAt(e);if(r===10)n++,e++;else if(r===13)n++,e++,t.charCodeAt(e)===10&&e++;else if(r===32||r===9)e++;else break}return{position:e,breaks:n}}function Gd(t){return t===1?" ":`
`.repeat(t-1)}function q2(t,e,i){let n="",r=e,s=e,o=e;for(;r<i;){let l=t.charCodeAt(r);if(l===10||l===13){n+=t.slice(s,o);let a=ka(t,r,i);n+=Gd(a.breaks),r=s=o=a.position}else r++,l!==32&&l!==9&&(o=r)}return n+t.slice(s,o)}function W2(t,e,i){let n="",r=e,s=e,o=e;for(;r<i;){let l=t.charCodeAt(r);if(l===39)n+=t.slice(s,r)+"'",r+=2,s=o=r;else if(l===10||l===13){n+=t.slice(s,o);let a=ka(t,r,i);n+=Gd(a.breaks),r=s=o=a.position}else r++,l!==32&&l!==9&&(o=r)}return n+t.slice(s,i)}function V2(t,e,i){let n="",r=e,s=e,o=e;for(;r<i;){let l=t.charCodeAt(r);if(l===92){n+=t.slice(s,r),r++;let a=t.charCodeAt(r);if(a===10||a===13)r=ka(t,r,i).position;else if(a<256&&MS[a])n+=LS[a],r++;else{let h=Y2(a),c=0;for(;h>0;h--){r++;let f=z2(t.charCodeAt(r));c=(c<<4)+f}n+=j2(c),r++}s=o=r}else if(l===10||l===13){n+=t.slice(s,o);let a=ka(t,r,i);n+=Gd(a.breaks),r=s=o=a.position}else r++,l!==32&&l!==9&&(o=r)}return n+t.slice(s,i)}function wS(t,e,i,n,r,s){let o=n<0?0:n,l=t.slice(e,i).replace(/\r\n?/g,`
`),a=l===""?[]:(l.endsWith(`
`)?l.slice(0,-1):l).split(`
`),h="",c=!1,f=0,u=!1;for(let d of a){let p=0;for(;p<o&&d.charCodeAt(p)===32;)p++;if(n<0||p>=d.length){f++;continue}let g=d.slice(o),m=g.charCodeAt(0);s?m===32||m===9?(u=!0,h+=`
@@ -46,13 +46,13 @@ ${t.mark.snippet}`),`${t.reason} ${i}`):t.reason}var MS=class extends Error{cons
`.repeat(f):h+=`
`.repeat(c?1+f:f),h+=g,c=!0,f=0}return r===3?h+=`
`.repeat(c?1+f:f):r!==2&&c&&(h+=`
`),h}function q2(t,e){if(e.valueStart===D2)return"";let{valueStart:i,valueEnd:n}=e;if(e.fast)return t.slice(i,n);switch(e.style){case 2:return z2(t,i,n);case 3:return Y2(t,i,n);case 4:return vS(t,i,n,e.indent,e.chomping,!1);case 5:return vS(t,i,n,e.indent,e.chomping,!0);default:return j2(t,i,n)}}var W2={"!":"!","!!":"tag:yaml.org,2002:"};function _S(t,e){var s,o;if(t.startsWith("!<")&&t.endsWith(">"))return decodeURIComponent(t.slice(2,-1));let i=t.indexOf("!",1),n=i===-1?"!":t.slice(0,i+1),r=(o=(s=e==null?void 0:e[n])!=null?s:W2[n])!=null?o:n;return decodeURIComponent(r)+decodeURIComponent(t.slice(n.length))}var _r=-1,Fd={filename:"",schema:X2,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1};function V2(t){return"tagStart"in t&&t.tagStart!==_r?t.tagStart:"anchorStart"in t&&t.anchorStart!==_r?t.anchorStart:"valueStart"in t&&t.valueStart!==_r?t.valueStart:"start"in t?t.start:0}function xt(t,e){Ca(t.source,t.position,e,t.filename)}function ZS(t,e,i,n){try{return i.finalize(n)}catch(r){if(r instanceof MS)throw r;Ca(t.source,e,r instanceof Error?r.message:String(r),t.filename)}}function ka(t,e,i){let n=t[i];if(n)return n;for(let r of e)if(i.startsWith(r.tagName))return r}function G2(t,e,i,n,r){let s=ka(e,i,n);if(s)return s;xt(t,`unknown ${r} tag !<${n}>`)}function U2(t,e){var s,o;let i=q2(t.source,e),n=e.tagStart===_r?"":t.source.slice(e.tagStart,e.tagEnd),r=t.schema.defaultScalarTag;if(n!==""){if(n==="!")return{value:i,tag:r};let l=_S(n,t.tagHandlers),a=ka(t.schema.exact.scalar,t.schema.prefix.scalar,l);if(a){let c=a.resolve(i,!0,l);return c===ae&&xt(t,`cannot resolve a node with !<${l}> explicit tag`),{value:c,tag:a}}let h=(s=ka(t.schema.exact.mapping,t.schema.prefix.mapping,l))!=null?s:ka(t.schema.exact.sequence,t.schema.prefix.sequence,l);if(h){i!==""&&xt(t,`cannot resolve a node with !<${l}> explicit tag`);let c=h.create(l);return{value:h.carrierIsResult?c:ZS(t,t.position,h,c),tag:h}}xt(t,`unknown scalar tag !<${l}>`)}if(e.style===1){let l=(o=t.schema.implicitScalarByFirstChar.get(i.charAt(0)))!=null?o:t.schema.implicitScalarAnyFirstChar;for(let a of l){let h=a.resolve(i,!1,a.tagName);if(h!==ae)return{value:h,tag:a}}}return{value:r.resolve(i,!1,r.tagName),tag:r}}function QS(t,e,i,n,r,s){let o=e.tagStart===_r?"":t.source.slice(e.tagStart,e.tagEnd),l=o===""||o==="!"?r:_S(o,t.tagHandlers);return{tagName:l,tag:G2(t,i,n,l,s)}}function DS(t){return t.nodeKind==="mapping"}function PS(t,e,i,n){var r;for(let s of n.keys(i)){if(t.maxTotalMergeKeys!==-1&&++t.totalMergeKeys>t.maxTotalMergeKeys&&xt(t,`merge keys exceeded maxTotalMergeKeys (${t.maxTotalMergeKeys})`),e.tag.has(e.value,s))continue;let o=e.tag.addPair(e.value,s,n.get(i,s));o&&xt(t,o),((r=e.overridable)!=null?r:e.overridable=new Set).add(s)}}function F2(t,e,i,n){if(t.position=e.keyPosition,DS(n))PS(t,e,i,n);else if(n.nodeKind==="sequence"&&Array.isArray(i))for(let r of i)PS(t,e,r,e.tag);else xt(t,"cannot merge mappings; the provided source object is unacceptable")}function H2(t,e,i,n,r){var o,l;if(t.position=e.keyPosition,i===qd){F2(t,e,n,r);return}!t.json&&e.tag.has(e.value,i)&&!((o=e.overridable)!=null&&o.has(i))&&xt(t,"duplicated mapping key");let s=e.tag.addPair(e.value,i,n);s&&xt(t,s),(l=e.overridable)==null||l.delete(i)}function Zd(t,e,i){let n=t.frames[t.frames.length-1];if(n.kind==="document")n.value=e,n.hasValue=!0;else if(n.kind==="sequence"){n.merge&&(DS(i)||xt(t,"cannot merge mappings; the provided source object is unacceptable"));let r=n.tag.addItem(n.value,e,n.index++);r&&xt(t,r)}else if(n.hasKey){let r=n.key;n.key=void 0,n.hasKey=!1,H2(t,n,r,e,i)}else n.key=e,n.keyPosition=t.position,n.hasKey=!0}function Dd(t,e,i,n,r){if(e.anchorStart!==_r){let s={value:i,tag:n,isValueFinal:r};return t.anchors.set(t.source.slice(e.anchorStart,e.anchorEnd),s),s}return null}function K2(t,e){let i={...Fd,...e,events:t,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,tagHandlers:Object.create(null),totalMergeKeys:0,aliasCount:0};for(;i.eventIndex<i.events.length;){let n=i.events[i.eventIndex++];switch(i.position=V2(n),n.type){case 1:i.anchors=new Map,i.aliasCount=0,i.tagHandlers=Object.create(null);for(let r of n.directives)r.kind==="tag"&&(i.tagHandlers[r.handle]=r.prefix);i.frames.push({kind:"document",position:i.position,value:void 0,hasValue:!1});break;case 4:{let{value:r,tag:s}=U2(i,n);Dd(i,n,r,s,!0),Zd(i,r,s);break}case 2:{let r=QS(i,n,i.schema.exact.sequence,i.schema.prefix.sequence,"tag:yaml.org,2002:seq","sequence"),s=r.tag.create(r.tagName),o=Dd(i,n,s,r.tag,r.tag.carrierIsResult),l=i.frames[i.frames.length-1],a=l!==void 0&&l.kind==="mapping"&&l.hasKey&&l.key===qd;i.frames.push({kind:"sequence",position:i.position,value:s,tag:r.tag,anchor:o,index:0,merge:a});break}case 3:{let r=QS(i,n,i.schema.exact.mapping,i.schema.prefix.mapping,"tag:yaml.org,2002:map","mapping"),s=r.tag.create(r.tagName),o=Dd(i,n,s,r.tag,r.tag.carrierIsResult);i.frames.push({kind:"mapping",position:i.position,value:s,tag:r.tag,anchor:o,key:void 0,keyPosition:i.position,hasK Line truncated
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new tp(this):new ep(this)}getCursor(e,i=0,n){let r=e.doc?e:he.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?Br(this,r,i,n):Ir(this,r,i,n)}},Da=class{constructor(e){this.spec=e}};function Ir(t,e,i,n){return new tn(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:r=>r.toLowerCase(),t.wholeWord?DE(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function DE(t,e){return(i,n,r,s)=>((s>i||s+r.length<n)&&(s=Math.max(0,i-2),r=t.sliceString(s,Math.min(t.length,n+2))),(e(Ia(r,i-s))!=ke.Word||e(Ba(r,i-s))!=ke.Word)&&(e(Ba(r,n-s))!=ke.Word||e(Ia(r,n-s))!=ke.Word))}var ep=class extends Da{constructor(e){super(e)}nextMatch(e,i,n){let r=Ir(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let s=Math.min(e.doc.length,i+this.spec.unquoted.length);r=Ir(this.spec,e,0,s).nextOverlapping()}return r.done||r.value.from==i&&r.value.to==n?null:r.value}prevMatchInRange(e,i,n){for(let r=n;;){let s=Math.max(i,r-1e4-this.spec.unquoted.length),o=Ir(this.spec,e,s,r),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(s==i)return null;r-=1e4}}prevMatch(e,i,n){let r=this.prevMatchInRange(e,0,i);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=i||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,i){let n=Ir(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let s=Ir(this.spec,e,Math.max(0,i-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}};function Br(t,e,i,n){return new Ea(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?IE(e.charCategorizer(e.selection.main.head)):void 0},i,n)}function Ia(t,e){return t.slice(Xe(t,e,!1),e)}function Ba(t,e){return t.slice(e,Xe(t,e))}function IE(t){return(e,i,n)=>!n[0].length||(t(Ia(n.input,n.index))!=ke.Word||t(Ba(n.input,n.index))!=ke.Word)&&(t(Ba(n.input,n.index+n[0].length))!=ke.Word||t(Ia(n.input,n.index+n[0].length))!=ke.Word)}var tp=class extends Da{nextMatch(e,i,n){let r=Br(this.spec,e,n,e.doc.length).next();return r.done&&(r=Br(this.spec,e,0,i).next()),r.done?null:r.value}prevMatchInRange(e,i,n){for(let r=1;;r++){let s=Math.max(i,n-r*1e4),o=Br(this.spec,e,s,n),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==i||l.from>s+10))return l;if(s==i)return null}}prevMatch(e,i,n){return this.prevMatchInRange(e,0,i)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(i,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:i)}matchAll(e,i){let n=Br(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let s=Br(this.spec,e,Math.max(0,i-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}},uo=W.define(),ap=W.define(),en=ge.define({create(t){return new fo(ip(t).create(),null)},update(t,e){for(let i of e.effects)i.is(uo)?t=new fo(i.value.create(),t.panel):i.is(ap)&&(t=new fo(t.query,i.value?cp:null));return t},provide:t=>mn.from(t,e=>e.panel)});var fo=class{constructor(e,i){this.query=e,this.panel=i}},BE=X.mark({class:"cm-searchMatch"}),NE=X.mark({class:"cm-searchMatch cm-searchMatch-selected"}),jE=me.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(en))}update(t){let e=t.state.field(en);(e!=t.startState.field(en)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return X.none;let{view:i}=this,n=new Ee;for(let r=0,s=i.visibleRanges,o=s.length;r<o;r++){let{from:l,to:a}=s[r];for(;r<o-1&&a>s[r+1].from-500;)a=s[++r].to;t.highlight(i.state,l,a,(h,c)=>{let f=i.state.selection.ranges.some(u=>u.from==h&&u.to==c);n.add(h,c,f?NE:BE)})}return n.finish()}},{decorations:t=>t.decorations});function po(t){return e=>{let i=e.state.field(en,!1);return i&&i.query.spec.valid?t(e,i):ex(e)}}var Na=po((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let r=Q.single(n.from,n.to),s=t.state.facet(_n);return t.dispatch({selection:r,effects:[fp(t,n),s.scrollToMatch(r.main,t)],userEvent:"select.search"}),JS(t),!0}),ja=po((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,r=e.prevMatch(i,n,n);if(!r)return!1;let s=Q.single(r.from,r.to),o=t.state.facet(_n);return t.dispatch({selection:s,effects:[fp(t,r),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),JS(t),!0}),zE=po((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!i||!i.length?!1:(t.dispatch({selection:Q.create(i.map(n=>Q.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),YE=({state:t,dispatch:e})=>{let i=t.select Line truncated
]`).replace("lheading",Kx).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},VM=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,GM=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ek=/^( {2,}|\\)\n(?!\s*$)/,UM=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Fr=/[\p{P}\p{S}]/u,oc=/[\s\p{P}\p{S}]/u,eg=/[^\s\p{P}\p{S}]/u,FM=le(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,oc).getRegex(),tk=/(?!~)[\p{P}\p{S}]/u,HM=/(?!~)[\s\p{P}\p{S}]/u,KM=/(?:[^\s\p{P}\p{S}]|~)/u,JM=le(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",LM?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ik=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,eL=le(ik,"u").replace(/punct/g,Fr).getRegex(),tL=le(ik,"u").replace(/punct/g,tk).getRegex(),nk="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",iL=le(nk,"gu").replace(/notPunctSpace/g,eg).replace(/punctSpace/g,oc).replace(/punct/g,Fr).getRegex(),nL=le(nk,"gu").replace(/notPunctSpace/g,KM).replace(/punctSpace/g,HM).replace(/punct/g,tk).getRegex(),rL=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,eg).replace(/punctSpace/g,oc).replace(/punct/g,Fr).getRegex(),sL=le(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Fr).getRegex(),oL="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",lL=le(oL,"gu").replace(/notPunctSpace/g,eg).replace(/punctSpace/g,oc).replace(/punct/g,Fr).getRegex(),aL=le(/\\(punct)/,"gu").replace(/punct/g,Fr).getRegex(),cL=le(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),hL=le(Kp).replace("(?:-->|$)","-->").getRegex(),fL=le("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",hL).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ic=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,uL=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ic).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),rk=le(/^!?\[(label)\]\[(ref)\]/).replace("label",ic).replace("ref",Hp).getRegex(),sk=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",Hp).getRegex(),dL=le("reflink|nolink(?!\\()","g").replace("reflink",rk).replace("nolink",sk).getRegex(),Yx=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,tg={_backpedal:Vn,anyPunctuation:aL,autolink:cL,blockSkip:JM,br:ek,code:GM,del:Vn,delLDelim:Vn,delRDelim:Vn,emStrongLDelim:eL,emStrongRDelimAst:iL,emStrongRDelimUnd:rL,escape:VM,link:uL,nolink:sk,punctuation:FM,reflink:rk,reflinkSearch:dL,tag:fL,text:UM,url:Vn},pL={...tg,link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",ic).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ic).getRegex()},qp={...tg,emStrongRDelimAst:nL,emStrongLDelim:tL,delLDelim:sL,delRDelim:lL,url:le(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Yx).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:le(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Yx).getRegex()},gL={...qp,br:le(ek).replace("{2,}","*").getRegex(),text:le(qp.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ec={normal:Jp,gfm:qM,pedantic:WM},ko={normal:tg,gfm:qp,breaks:gL,pedantic:pL},OL={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},qx=t=>OL[t];function bi(t,e){if(e){if(nt.escapeTest.test(t))return t.replace(nt.escapeReplace,qx)}else if(nt.escapeTestNoEncode.tesLine truncated
`),h}function G2(t,e){if(e.valueStart===N2)return"";let{valueStart:i,valueEnd:n}=e;if(e.fast)return t.slice(i,n);switch(e.style){case 2:return W2(t,i,n);case 3:return V2(t,i,n);case 4:return wS(t,i,n,e.indent,e.chomping,!1);case 5:return wS(t,i,n,e.indent,e.chomping,!0);default:return q2(t,i,n)}}var U2={"!":"!","!!":"tag:yaml.org,2002:"};function XS(t,e){var s,o;if(t.startsWith("!<")&&t.endsWith(">"))return decodeURIComponent(t.slice(2,-1));let i=t.indexOf("!",1),n=i===-1?"!":t.slice(0,i+1),r=(o=(s=e==null?void 0:e[n])!=null?s:U2[n])!=null?o:n;return decodeURIComponent(r)+decodeURIComponent(t.slice(n.length))}var _r=-1,Ud={filename:"",schema:D2,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1};function F2(t){return"tagStart"in t&&t.tagStart!==_r?t.tagStart:"anchorStart"in t&&t.anchorStart!==_r?t.anchorStart:"valueStart"in t&&t.valueStart!==_r?t.valueStart:"start"in t?t.start:0}function xt(t,e){Ta(t.source,t.position,e,t.filename)}function _S(t,e,i,n){try{return i.finalize(n)}catch(r){if(r instanceof ES)throw r;Ta(t.source,e,r instanceof Error?r.message:String(r),t.filename)}}function xa(t,e,i){let n=t[i];if(n)return n;for(let r of e)if(i.startsWith(r.tagName))return r}function H2(t,e,i,n,r){let s=xa(e,i,n);if(s)return s;xt(t,`unknown ${r} tag !<${n}>`)}function K2(t,e){var s,o;let i=G2(t.source,e),n=e.tagStart===_r?"":t.source.slice(e.tagStart,e.tagEnd),r=t.schema.defaultScalarTag;if(n!==""){if(n==="!")return{value:i,tag:r};let l=XS(n,t.tagHandlers),a=xa(t.schema.exact.scalar,t.schema.prefix.scalar,l);if(a){let c=a.resolve(i,!0,l);return c===ae&&xt(t,`cannot resolve a node with !<${l}> explicit tag`),{value:c,tag:a}}let h=(s=xa(t.schema.exact.mapping,t.schema.prefix.mapping,l))!=null?s:xa(t.schema.exact.sequence,t.schema.prefix.sequence,l);if(h){i!==""&&xt(t,`cannot resolve a node with !<${l}> explicit tag`);let c=h.create(l);return{value:h.carrierIsResult?c:_S(t,t.position,h,c),tag:h}}xt(t,`unknown scalar tag !<${l}>`)}if(e.style===1){let l=(o=t.schema.implicitScalarByFirstChar.get(i.charAt(0)))!=null?o:t.schema.implicitScalarAnyFirstChar;for(let a of l){let h=a.resolve(i,!1,a.tagName);if(h!==ae)return{value:h,tag:a}}}return{value:r.resolve(i,!1,r.tagName),tag:r}}function vS(t,e,i,n,r,s){let o=e.tagStart===_r?"":t.source.slice(e.tagStart,e.tagEnd),l=o===""||o==="!"?r:XS(o,t.tagHandlers);return{tagName:l,tag:H2(t,i,n,l,s)}}function ZS(t){return t.nodeKind==="mapping"}function QS(t,e,i,n){var r;for(let s of n.keys(i)){if(t.maxTotalMergeKeys!==-1&&++t.totalMergeKeys>t.maxTotalMergeKeys&&xt(t,`merge keys exceeded maxTotalMergeKeys (${t.maxTotalMergeKeys})`),e.tag.has(e.value,s))continue;let o=e.tag.addPair(e.value,s,n.get(i,s));o&&xt(t,o),((r=e.overridable)!=null?r:e.overridable=new Set).add(s)}}function J2(t,e,i,n){if(t.position=e.keyPosition,ZS(n))QS(t,e,i,n);else if(n.nodeKind==="sequence"&&Array.isArray(i))for(let r of i)QS(t,e,r,e.tag);else xt(t,"cannot merge mappings; the provided source object is unacceptable")}function eE(t,e,i,n,r){var o,l;if(t.position=e.keyPosition,i===Yd){J2(t,e,n,r);return}!t.json&&e.tag.has(e.value,i)&&!((o=e.overridable)!=null&&o.has(i))&&xt(t,"duplicated mapping key");let s=e.tag.addPair(e.value,i,n);s&&xt(t,s),(l=e.overridable)==null||l.delete(i)}function _d(t,e,i){let n=t.frames[t.frames.length-1];if(n.kind==="document")n.value=e,n.hasValue=!0;else if(n.kind==="sequence"){n.merge&&(ZS(i)||xt(t,"cannot merge mappings; the provided source object is unacceptable"));let r=n.tag.addItem(n.value,e,n.index++);r&&xt(t,r)}else if(n.hasKey){let r=n.key;n.key=void 0,n.hasKey=!1,eE(t,n,r,e,i)}else n.key=e,n.keyPosition=t.position,n.hasKey=!0}function Zd(t,e,i,n,r){if(e.anchorStart!==_r){let s={value:i,tag:n,isValueFinal:r};return t.anchors.set(t.source.slice(e.anchorStart,e.anchorEnd),s),s}return null}function tE(t,e){let i={...Ud,...e,events:t,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,tagHandlers:Object.create(null),totalMergeKeys:0,aliasCount:0};for(;i.eventIndex<i.events.length;){let n=i.events[i.eventIndex++];switch(i.position=F2(n),n.type){case 1:i.anchors=new Map,i.aliasCount=0,i.tagHandlers=Object.create(null);for(let r of n.directives)r.kind==="tag"&&(i.tagHandlers[r.handle]=r.prefix);i.frames.push({kind:"document",position:i.position,value:void 0,hasValue:!1});break;case 4:{let{value:r,tag:s}=K2(i,n);Zd(i,n,r,s,!0),_d(i,r,s);break}case 2:{let r=vS(i,n,i.schema.exact.sequence,i.schema.prefix.sequence,"tag:yaml.org,2002:seq","sequence"),s=r.tag.create(r.tagName),o=Zd(i,n,s,r.tag,r.tag.carrierIsResult),l=i.frames[i.frames.length-1],a=l!==void 0&&l.kind==="mapping"&&l.hasKey&&l.key===Yd;i.frames.push({kind:"sequence",position:i.position,value:s,tag:r.tag,anchor:o,index:0,merge:a});break}case 3:{let r=vS(i,n,i.schema.exact.mapping,i.schema.prefix.mapping,"tag:yaml.org,2002:map","mapping"),s=r.tag.create(r.tagName),o=Zd(i,n,s,r.tag,r.tag.carrierIsResult);i.frames.push({kind:"mapping",position:i.position,value:s,tag:r.tag,anchor:o,key:void 0,keyPosition:i.position,hasK Line truncated
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new ep(this):new Jd(this)}getCursor(e,i=0,n){let r=e.doc?e:he.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?Br(this,r,i,n):Ir(this,r,i,n)}},Za=class{constructor(e){this.spec=e}};function Ir(t,e,i,n){return new tn(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:r=>r.toLowerCase(),t.wholeWord?NE(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function NE(t,e){return(i,n,r,s)=>((s>i||s+r.length<n)&&(s=Math.max(0,i-2),r=t.sliceString(s,Math.min(t.length,n+2))),(e(Da(r,i-s))!=ke.Word||e(Ia(r,i-s))!=ke.Word)&&(e(Ia(r,n-s))!=ke.Word||e(Da(r,n-s))!=ke.Word))}var Jd=class extends Za{constructor(e){super(e)}nextMatch(e,i,n){let r=Ir(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let s=Math.min(e.doc.length,i+this.spec.unquoted.length);r=Ir(this.spec,e,0,s).nextOverlapping()}return r.done||r.value.from==i&&r.value.to==n?null:r.value}prevMatchInRange(e,i,n){for(let r=n;;){let s=Math.max(i,r-1e4-this.spec.unquoted.length),o=Ir(this.spec,e,s,r),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(s==i)return null;r-=1e4}}prevMatch(e,i,n){let r=this.prevMatchInRange(e,0,i);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=i||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,i){let n=Ir(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let s=Ir(this.spec,e,Math.max(0,i-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}};function Br(t,e,i,n){return new Ra(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?jE(e.charCategorizer(e.selection.main.head)):void 0},i,n)}function Da(t,e){return t.slice(Xe(t,e,!1),e)}function Ia(t,e){return t.slice(e,Xe(t,e))}function jE(t){return(e,i,n)=>!n[0].length||(t(Da(n.input,n.index))!=ke.Word||t(Ia(n.input,n.index))!=ke.Word)&&(t(Ia(n.input,n.index+n[0].length))!=ke.Word||t(Da(n.input,n.index+n[0].length))!=ke.Word)}var ep=class extends Za{nextMatch(e,i,n){let r=Br(this.spec,e,n,e.doc.length).next();return r.done&&(r=Br(this.spec,e,0,i).next()),r.done?null:r.value}prevMatchInRange(e,i,n){for(let r=1;;r++){let s=Math.max(i,n-r*1e4),o=Br(this.spec,e,s,n),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==i||l.from>s+10))return l;if(s==i)return null}}prevMatch(e,i,n){return this.prevMatchInRange(e,0,i)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(i,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:i)}matchAll(e,i){let n=Br(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let s=Br(this.spec,e,Math.max(0,i-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}},uo=W.define(),lp=W.define(),en=ge.define({create(t){return new fo(tp(t).create(),null)},update(t,e){for(let i of e.effects)i.is(uo)?t=new fo(i.value.create(),t.panel):i.is(lp)&&(t=new fo(t.query,i.value?ap:null));return t},provide:t=>mn.from(t,e=>e.panel)});var fo=class{constructor(e,i){this.query=e,this.panel=i}},zE=X.mark({class:"cm-searchMatch"}),YE=X.mark({class:"cm-searchMatch cm-searchMatch-selected"}),qE=me.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(en))}update(t){let e=t.state.field(en);(e!=t.startState.field(en)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return X.none;let{view:i}=this,n=new Ee;for(let r=0,s=i.visibleRanges,o=s.length;r<o;r++){let{from:l,to:a}=s[r];for(;r<o-1&&a>s[r+1].from-500;)a=s[++r].to;t.highlight(i.state,l,a,(h,c)=>{let f=i.state.selection.ranges.some(u=>u.from==h&&u.to==c);n.add(h,c,f?YE:zE)})}return n.finish()}},{decorations:t=>t.decorations});function po(t){return e=>{let i=e.state.field(en,!1);return i&&i.query.spec.valid?t(e,i):JS(e)}}var Ba=po((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let r=Q.single(n.from,n.to),s=t.state.facet(_n);return t.dispatch({selection:r,effects:[hp(t,n),s.scrollToMatch(r.main,t)],userEvent:"select.search"}),KS(t),!0}),Na=po((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,r=e.prevMatch(i,n,n);if(!r)return!1;let s=Q.single(r.from,r.to),o=t.state.facet(_n);return t.dispatch({selection:s,effects:[hp(t,r),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),KS(t),!0}),WE=po((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!i||!i.length?!1:(t.dispatch({selection:Q.create(i.map(n=>Q.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),VE=({state:t,dispatch:e})=>{let i=t.select Line truncated
]`).replace("lheading",Hx).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},FM=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,HM=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Jx=/^( {2,}|\\)\n(?!\s*$)/,KM=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Fr=/[\p{P}\p{S}]/u,sc=/[\s\p{P}\p{S}]/u,Jp=/[^\s\p{P}\p{S}]/u,JM=le(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,sc).getRegex(),ek=/(?!~)[\p{P}\p{S}]/u,eL=/(?!~)[\s\p{P}\p{S}]/u,tL=/(?:[^\s\p{P}\p{S}]|~)/u,iL=le(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ZM?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),tk=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,nL=le(tk,"u").replace(/punct/g,Fr).getRegex(),rL=le(tk,"u").replace(/punct/g,ek).getRegex(),ik="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",sL=le(ik,"gu").replace(/notPunctSpace/g,Jp).replace(/punctSpace/g,sc).replace(/punct/g,Fr).getRegex(),oL=le(ik,"gu").replace(/notPunctSpace/g,tL).replace(/punctSpace/g,eL).replace(/punct/g,ek).getRegex(),lL=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Jp).replace(/punctSpace/g,sc).replace(/punct/g,Fr).getRegex(),aL=le(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Fr).getRegex(),cL="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",hL=le(cL,"gu").replace(/notPunctSpace/g,Jp).replace(/punctSpace/g,sc).replace(/punct/g,Fr).getRegex(),fL=le(/\\(punct)/,"gu").replace(/punct/g,Fr).getRegex(),uL=le(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),dL=le(Hp).replace("(?:-->|$)","-->").getRegex(),pL=le("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",dL).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),tc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,gL=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",tc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nk=le(/^!?\[(label)\]\[(ref)\]/).replace("label",tc).replace("ref",Fp).getRegex(),rk=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",Fp).getRegex(),OL=le("reflink|nolink(?!\\()","g").replace("reflink",nk).replace("nolink",rk).getRegex(),zx=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,eg={_backpedal:Vn,anyPunctuation:fL,autolink:uL,blockSkip:iL,br:Jx,code:HM,del:Vn,delLDelim:Vn,delRDelim:Vn,emStrongLDelim:nL,emStrongRDelimAst:sL,emStrongRDelimUnd:lL,escape:FM,link:gL,nolink:rk,punctuation:JM,reflink:nk,reflinkSearch:OL,tag:pL,text:KM,url:Vn},mL={...eg,link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",tc).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",tc).getRegex()},Yp={...eg,emStrongRDelimAst:oL,emStrongLDelim:rL,delLDelim:aL,delRDelim:hL,url:le(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",zx).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:le(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",zx).getRegex()},bL={...Yp,br:le(Jx).replace("{2,}","*").getRegex(),text:le(Yp.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ja={normal:Kp,gfm:GM,pedantic:UM},ko={normal:eg,gfm:Yp,breaks:bL,pedantic:mL},yL={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Yx=t=>yL[t];function bi(t,e){if(e){if(nt.escapeTest.test(t))return t.replace(nt.escapeReplace,Yx)}else if(nt.escapeTestNoEncode.tesLine truncated
`),i=e.length-1;for(;i>=0&&nt.blankLine.test(e[i]);)i--;return e.length-i<=2?t:e.slice(0,i+1).join(`
`)}function mL(t,e){if(t.indexOf(e[1])===-1)return-1;let i=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])i++;else if(t[n]===e[1]&&(i--,i<0))return n;return i>0?-2:-1}function bL(t,e=0){let i=e,n="";for(let r of t)if(r===" "){let s=4-i%4;n+=" ".repeat(s),i+=s}else n+=r,i++;return n}function Ux(t,e,i,n,r){let s=e.href,o=e.title||null,l=t[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=!0;let a={type:t[0].charAt(0)==="!"?"image":"link",raw:i,href:s,title:o,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,a}function yL(t,e,i){let n=t.match(i.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
`)}function SL(t,e){if(t.indexOf(e[1])===-1)return-1;let i=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])i++;else if(t[n]===e[1]&&(i--,i<0))return n;return i>0?-2:-1}function xL(t,e=0){let i=e,n="";for(let r of t)if(r===" "){let s=4-i%4;n+=" ".repeat(s),i+=s}else n+=r,i++;return n}function Gx(t,e,i,n,r){let s=e.href,o=e.title||null,l=t[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=!0;let a={type:t[0].charAt(0)==="!"?"image":"link",raw:i,href:s,title:o,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,a}function kL(t,e,i){let n=t.match(i.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
`).map(s=>{let o=s.match(i.other.beginningSpace);if(o===null)return s;let[l]=o;return l.length>=r.length?s.slice(r.length):s}).join(`
`)}var nc=class{constructor(t){K(this,"options");K(this,"rules");K(this,"lexer");this.options=t||Un}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let i=this.options.pedantic?e[0]:Gx(e[0]),n=i.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:i,codeBlockStyle:"indented",text:n}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let i=e[0],n=yL(i,e[3]||"",this.rules);return{type:"code",raw:i,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let i=e[2].trim();if(this.rules.other.endingHash.test(i)){let n=sn(i,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(i=n.trim())}return{type:"heading",raw:sn(e[0],`
`)}var ic=class{constructor(t){K(this,"options");K(this,"rules");K(this,"lexer");this.options=t||Un}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let i=this.options.pedantic?e[0]:Vx(e[0]),n=i.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:i,codeBlockStyle:"indented",text:n}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let i=e[0],n=kL(i,e[3]||"",this.rules);return{type:"code",raw:i,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let i=e[2].trim();if(this.rules.other.endingHash.test(i)){let n=sn(i,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(i=n.trim())}return{type:"heading",raw:sn(e[0],`
`),depth:e[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:sn(e[0],`
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let i=sn(e[0],`
`).split(`
@@ -65,19 +65,19 @@ ${c}`:c;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
`),g=this.blockquote(p);s[s.length-1]=g,n=n.substring(0,n.length-d.raw.length)+g.raw,r=r.substring(0,r.length-d.text.length)+g.text;break}else if((u==null?void 0:u.type)==="list"){let d=u,p=d.raw+`
`+i.join(`
`),g=this.list(p);s[s.length-1]=g,n=n.substring(0,n.length-u.raw.length)+g.raw,r=r.substring(0,r.length-d.raw.length)+g.raw,i=p.substring(s.at(-1).raw.length).split(`
`);continue}}return{type:"blockquote",raw:n,tokens:s,text:r}}}list(t){let e=this.rules.block.list.exec(t);if(e){let i=e[1].trim(),n=i.length>1,r={type:"list",raw:"",ordered:n,start:n?+i.slice(0,-1):"",loose:!1,items:[]};i=n?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=n?i:"[*+-]");let s=this.rules.other.listItemRegex(i),o=!1;for(;t;){let a=!1,h="",c="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;h=e[0],t=t.substring(h.length);let f=bL(e[2].split(`
`);continue}}return{type:"blockquote",raw:n,tokens:s,text:r}}}list(t){let e=this.rules.block.list.exec(t);if(e){let i=e[1].trim(),n=i.length>1,r={type:"list",raw:"",ordered:n,start:n?+i.slice(0,-1):"",loose:!1,items:[]};i=n?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=n?i:"[*+-]");let s=this.rules.other.listItemRegex(i),o=!1;for(;t;){let a=!1,h="",c="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;h=e[0],t=t.substring(h.length);let f=xL(e[2].split(`
`,1)[0],e[1].length),u=t.split(`
`,1)[0],d=!f.trim(),p=0;if(this.options.pedantic?(p=2,c=f.trimStart()):d?p=e[1].length+1:(p=f.search(this.rules.other.nonSpaceChar),p=p>4?1:p,c=f.slice(p),p+=e[1].length),d&&this.rules.other.blankLine.test(u)&&(h+=u+`
`,t=t.substring(u.length+1),a=!0),!a){let g=this.rules.other.nextBulletRegex(p),m=this.rules.other.hrRegex(p),b=this.rules.other.fencesBeginRegex(p),y=this.rules.other.headingBeginRegex(p),S=this.rules.other.htmlBeginRegex(p),v=this.rules.other.blockquoteBeginRegex(p);for(;t;){let x=t.split(`
`,1)[0],w;if(u=x,this.options.pedantic?(u=u.replace(this.rules.other.listReplaceNesting," "),w=u):w=u.replace(this.rules.other.tabCharGlobal," "),b.test(u)||y.test(u)||S.test(u)||v.test(u)||g.test(u)||m.test(u))break;if(w.search(this.rules.other.nonSpaceChar)>=p||!u.trim())c+=`
`+w.slice(p);else{if(d||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||b.test(f)||y.test(f)||m.test(f))break;c+=`
`+u}d=!u.trim(),h+=x+`
`,t=t.substring(x.length+1),f=w.slice(p)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(o=!0)),r.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),r.raw+=h}let l=r.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let a of r.items){this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]);let h=a.tokens[0];if(a.task&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="paragraph")){a.text=a.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let c=this.rules.other.listTaskCheckbox.exec(a.raw);if(c){let f={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};a.checked=f.checked,r.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=f.raw+a.tokens[0].raw,a.tokens[0].text=f.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(f)):a.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):a.tokens.unshift(f)}}else a.task&&(a.task=!1);if(!r.loose){let c=a.tokens.filter(u=>u.type==="space"),f=c.length>0&&c.some(u=>this.rules.other.anyLine.test(u.raw));r.loose=f}}if(r.loose)for(let a of r.items){a.loose=!0;for(let h of a.tokens)h.type==="text"&&(h.type="paragraph")}return r}}html(t){let e=this.rules.block.html.exec(t);if(e){let i=Gx(e[0]);return{type:"html",block:!0,raw:i,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:i}}}def(t){let e=this.rules.block.def.exec(t);if(e){let i=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:i,raw:sn(e[0],`
`),href:n,title:r}}}table(t){var o;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let i=Vx(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
`,t=t.substring(x.length+1),f=w.slice(p)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(o=!0)),r.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),r.raw+=h}let l=r.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let a of r.items){this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]);let h=a.tokens[0];if(a.task&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="paragraph")){a.text=a.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let c=this.rules.other.listTaskCheckbox.exec(a.raw);if(c){let f={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};a.checked=f.checked,r.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=f.raw+a.tokens[0].raw,a.tokens[0].text=f.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(f)):a.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):a.tokens.unshift(f)}}else a.task&&(a.task=!1);if(!r.loose){let c=a.tokens.filter(u=>u.type==="space"),f=c.length>0&&c.some(u=>this.rules.other.anyLine.test(u.raw));r.loose=f}}if(r.loose)for(let a of r.items){a.loose=!0;for(let h of a.tokens)h.type==="text"&&(h.type="paragraph")}return r}}html(t){let e=this.rules.block.html.exec(t);if(e){let i=Vx(e[0]);return{type:"html",block:!0,raw:i,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:i}}}def(t){let e=this.rules.block.def.exec(t);if(e){let i=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:i,raw:sn(e[0],`
`),href:n,title:r}}}table(t){var o;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let i=Wx(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
`):[],s={type:"table",raw:sn(e[0],`
`),header:[],align:[],rows:[]};if(i.length===n.length){for(let l of n)this.rules.other.tableAlignRight.test(l)?s.align.push("right"):this.rules.other.tableAlignCenter.test(l)?s.align.push("center"):this.rules.other.tableAlignLeft.test(l)?s.align.push("left"):s.align.push(null);for(let l=0;l<i.length;l++)s.header.push({text:i[l],tokens:this.lexer.inline(i[l]),header:!0,align:s.align[l]});for(let l of r)s.rows.push(Vx(l,s.header.length).map((a,h)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:s.align[h]})));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let i=e[1].trim();return{type:"heading",raw:sn(e[0],`
`),header:[],align:[],rows:[]};if(i.length===n.length){for(let l of n)this.rules.other.tableAlignRight.test(l)?s.align.push("right"):this.rules.other.tableAlignCenter.test(l)?s.align.push("center"):this.rules.other.tableAlignLeft.test(l)?s.align.push("left"):s.align.push(null);for(let l=0;l<i.length;l++)s.header.push({text:i[l],tokens:this.lexer.inline(i[l]),header:!0,align:s.align[l]});for(let l of r)s.rows.push(Wx(l,s.header.length).map((a,h)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:s.align[h]})));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let i=e[1].trim();return{type:"heading",raw:sn(e[0],`
`),depth:e[2].charAt(0)==="="?1:2,text:i,tokens:this.lexer.inline(i)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let i=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:i,tokens:this.lexer.inline(i)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let i=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let s=sn(i.slice(0,-1),"\\");if((i.length-s.length)%2===0)return}else{let s=mL(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let n=e[2],r="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(n);s&&(n=s[1],r=s[3])}else r=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?n=n.slice(1):n=n.slice(1,-1)),Ux(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let i;if((i=this.rules.inline.reflink.exec(t))||(i=this.rules.inline.nolink.exec(t))){let n=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[n.toLowerCase()];if(!r){let s=i[0].charAt(0);return{type:"text",raw:s,text:s}}return Ux(i,r,i[0],this.lexer,this.rules)}}emStrong(t,e,i=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!(!n||!n[1]&&!n[2]&&!n[3]&&!n[4]||n[4]&&i.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[3])||!i||this.rules.inline.punctuation.exec(i))){let r=[...n[0]].length-1,s,o,l=r,a=0,h=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*t.length+r);(n=h.exec(e))!==null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s)continue;if(o=[...s].length,n[3]||n[4]){l+=o;continue}else if((n[5]||n[6])&&r%3&&!((r+o)%3)){a+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+a);let c=[...n[0]][0].length,f=t.slice(0,r+n.index+c+o);if(Math.min(r,o)%2){let d=f.slice(1,-1);return{type:"em",raw:f,text:d,tokens:this.lexer.inlineTokens(d)}}let u=f.slice(2,-2);return{type:"strong",raw:f,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let i=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(i),r=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return n&&r&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:e[0],text:i}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,i=""){let n=this.rules.inline.delLDelim.exec(t);if(n&&(!n[1]||!i||this.rules.inline.punctuation.exec(i))){let r=[...n[0]].length-1,s,o,l=r,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*t.length+r);(n=a.exec(e))!==null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s||(o=[...s].length,o!==r))continue;if(n[3]||n[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let h=[...n[0]][0].length,c=t.slice(0,r+n.index+h+o),f=c.slice(r,-r);return{type:"del",raw:c,text:f,tokens:this.lexer.inlineTokens(f)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let i,n;return e[2]==="@"?(i=e[1],n="mailto:"+i):(i=e[1],n=i),{type:"link",raw:e[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}url(t){var i,n;let e;if(e=this.rules.inline.url.exec(t)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let o;do o=e[0],e[0]=(n=(i=this.rules.inline._backpedal.exec(e[0]))==null?void 0:i[0])!=null?n:"";while(o!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let i=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:i}}}},ei=class Wp{constructor(e){K(this,"tokens");K(this,"options");K(this,"state");K(this,"inlineQueue");K(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Un,this.options.tokenizer=this.options.tokenizer||new nc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let i={other:nt,block:ec.normal,inline:ko.normal};this.options.pedantic?(i.block=ec.pedantic,i.inline=ko.p Line truncated
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:i,tokens:this.lexer.inline(i)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let i=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let s=sn(i.slice(0,-1),"\\");if((i.length-s.length)%2===0)return}else{let s=SL(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let n=e[2],r="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(n);s&&(n=s[1],r=s[3])}else r=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?n=n.slice(1):n=n.slice(1,-1)),Gx(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let i;if((i=this.rules.inline.reflink.exec(t))||(i=this.rules.inline.nolink.exec(t))){let n=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[n.toLowerCase()];if(!r){let s=i[0].charAt(0);return{type:"text",raw:s,text:s}}return Gx(i,r,i[0],this.lexer,this.rules)}}emStrong(t,e,i=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!(!n||!n[1]&&!n[2]&&!n[3]&&!n[4]||n[4]&&i.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[3])||!i||this.rules.inline.punctuation.exec(i))){let r=[...n[0]].length-1,s,o,l=r,a=0,h=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*t.length+r);(n=h.exec(e))!==null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s)continue;if(o=[...s].length,n[3]||n[4]){l+=o;continue}else if((n[5]||n[6])&&r%3&&!((r+o)%3)){a+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+a);let c=[...n[0]][0].length,f=t.slice(0,r+n.index+c+o);if(Math.min(r,o)%2){let d=f.slice(1,-1);return{type:"em",raw:f,text:d,tokens:this.lexer.inlineTokens(d)}}let u=f.slice(2,-2);return{type:"strong",raw:f,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let i=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(i),r=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return n&&r&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:e[0],text:i}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,i=""){let n=this.rules.inline.delLDelim.exec(t);if(n&&(!n[1]||!i||this.rules.inline.punctuation.exec(i))){let r=[...n[0]].length-1,s,o,l=r,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*t.length+r);(n=a.exec(e))!==null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s||(o=[...s].length,o!==r))continue;if(n[3]||n[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let h=[...n[0]][0].length,c=t.slice(0,r+n.index+h+o),f=c.slice(r,-r);return{type:"del",raw:c,text:f,tokens:this.lexer.inlineTokens(f)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let i,n;return e[2]==="@"?(i=e[1],n="mailto:"+i):(i=e[1],n=i),{type:"link",raw:e[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}url(t){var i,n;let e;if(e=this.rules.inline.url.exec(t)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let o;do o=e[0],e[0]=(n=(i=this.rules.inline._backpedal.exec(e[0]))==null?void 0:i[0])!=null?n:"";while(o!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let i=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:i}}}},ei=class qp{constructor(e){K(this,"tokens");K(this,"options");K(this,"state");K(this,"inlineQueue");K(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Un,this.options.tokenizer=this.options.tokenizer||new ic,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let i={other:nt,block:Ja.normal,inline:ko.normal};this.options.pedantic?(i.block=Ja.pedantic,i.inline=ko.p Line truncated
`),this.blockTokens(e,this.tokens);for(let i=0;i<this.inlineQueue.length;i++){let n=this.inlineQueue[i];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,i=[],n=!1){var s,o,l;this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(nt.tabCharGlobal," ").replace(nt.spaceLine,""));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let a;if((o=(s=this.options.extensions)==null?void 0:s.block)!=null&&o.some(c=>(a=c.call({lexer:this},e,i))?(e=e.substring(a.raw.length),i.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let c=i.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
`:i.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let c=i.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
`)?"":`
@@ -91,7 +91,7 @@ ${c}`:c;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):i.push(a),n=h.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let c=i.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
`)?"":`
`)+a.raw,c.text+=`
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):i.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,i}inline(e,i=[]){return this.inlineQueue.push({src:e,tokens:i}),i}inlineTokens(e,i=[]){var h,c,f,u,d,p;this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let g=Object.keys(this.tokens.links);if(g.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)g.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)s=r[2]?r[2].length:0,n=n.slice(0,r.index+s)+"["+"a".repeat(r[0].length-s-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=(f=(c=(h=this.options.hooks)==null?void 0:h.emStrongMask)==null?void 0:c.call({lexer:this},n))!=null?f:n;let o=!1,l="",a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}o||(l=""),o=!1;let g;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(b=>(g=b.call({lexer:this},e,i))?(e=e.substring(g.raw.length),i.push(g),!0):!1))continue;if(g=this.tokenizer.escape(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.tag(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.link(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(g.raw.length);let b=i.at(-1);g.type==="text"&&(b==null?void 0:b.type)==="text"?(b.raw+=g.raw,b.text+=g.text):i.push(g);continue}if(g=this.tokenizer.emStrong(e,n,l)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.codespan(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.br(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.del(e,n,l)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.autolink(e)){e=e.substring(g.raw.length),i.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(e))){e=e.substring(g.raw.length),i.push(g);continue}let m=e;if((p=this.options.extensions)!=null&&p.startInline){let b=1/0,y=e.slice(1),S;this.options.extensions.startInline.forEach(v=>{S=v.call({lexer:this},y),typeof S=="number"&&S>=0&&(b=Math.min(b,S))}),b<1/0&&b>=0&&(m=e.substring(0,b+1))}if(g=this.tokenizer.inlineText(m)){e=e.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(l=g.raw.slice(-1)),o=!0;let b=i.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=g.raw,b.text+=g.text):i.push(g);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return i}infiniteLoopError(e){let i="Infinite loop on byte: "+e;if(this.options.silent)console.error(i);else throw new Error(i)}},rc=class{constructor(t){K(this,"options");K(this,"parser");this.options=t||Un}space(t){return""}code({text:t,lang:e,escaped:i}){var s;let n=(s=(e||"").match(nt.notSpaceStart))==null?void 0:s[0],r=t.replace(nt.endingNewline,"")+`
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):i.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,i}inline(e,i=[]){return this.inlineQueue.push({src:e,tokens:i}),i}inlineTokens(e,i=[]){var h,c,f,u,d,p;this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let g=Object.keys(this.tokens.links);if(g.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)g.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)s=r[2]?r[2].length:0,n=n.slice(0,r.index+s)+"["+"a".repeat(r[0].length-s-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=(f=(c=(h=this.options.hooks)==null?void 0:h.emStrongMask)==null?void 0:c.call({lexer:this},n))!=null?f:n;let o=!1,l="",a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}o||(l=""),o=!1;let g;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(b=>(g=b.call({lexer:this},e,i))?(e=e.substring(g.raw.length),i.push(g),!0):!1))continue;if(g=this.tokenizer.escape(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.tag(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.link(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(g.raw.length);let b=i.at(-1);g.type==="text"&&(b==null?void 0:b.type)==="text"?(b.raw+=g.raw,b.text+=g.text):i.push(g);continue}if(g=this.tokenizer.emStrong(e,n,l)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.codespan(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.br(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.del(e,n,l)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.autolink(e)){e=e.substring(g.raw.length),i.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(e))){e=e.substring(g.raw.length),i.push(g);continue}let m=e;if((p=this.options.extensions)!=null&&p.startInline){let b=1/0,y=e.slice(1),S;this.options.extensions.startInline.forEach(v=>{S=v.call({lexer:this},y),typeof S=="number"&&S>=0&&(b=Math.min(b,S))}),b<1/0&&b>=0&&(m=e.substring(0,b+1))}if(g=this.tokenizer.inlineText(m)){e=e.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(l=g.raw.slice(-1)),o=!0;let b=i.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=g.raw,b.text+=g.text):i.push(g);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return i}infiniteLoopError(e){let i="Infinite loop on byte: "+e;if(this.options.silent)console.error(i);else throw new Error(i)}},nc=class{constructor(t){K(this,"options");K(this,"parser");this.options=t||Un}space(t){return""}code({text:t,lang:e,escaped:i}){var s;let n=(s=(e||"").match(nt.notSpaceStart))==null?void 0:s[0],r=t.replace(nt.endingNewline,"")+`
`;return n?'<pre><code class="language-'+bi(n)+'">'+(i?r:bi(r,!0))+`</code></pre>
`:"<pre><code>"+(i?r:bi(r,!0))+`</code></pre>
`}blockquote({tokens:t}){return`<blockquote>
@@ -109,8 +109,8 @@ ${this.parser.parse(t)}</blockquote>
`}tablerow({text:t}){return`<tr>
${t}</tr>
`}tablecell(t){let e=this.parser.parseInline(t.tokens),i=t.header?"th":"td";return(t.align?`<${i} align="${t.align}">`:`<${i}>`)+e+`</${i}>
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${bi(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:i}){let n=this.parser.parseInline(i),r=Wx(t);if(r===null)return n;t=r;let s='<a href="'+t+'"';return e&&(s+=' title="'+bi(e)+'"'),s+=">"+n+"</a>",s}image({href:t,title:e,text:i,tokens:n}){n&&(i=this.parser.parseInline(n,this.parser.textRenderer));let r=Wx(t);if(r===null)return bi(i);t=r;let s=`<img src="${t}" alt="${bi(i)}"`;return e&&(s+=` title="${bi(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:bi(t.text)}},ig=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},ti=class Vp{constructor(e){K(this,"options");K(this,"renderer");K(this,"textRenderer");this.options=e||Un,this.options.renderer=this.options.renderer||new rc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ig}static parse(e,i){return new Vp(i).parse(e)}static parseInline(e,i){return new Vp(i).parseInline(e)}parse(e){var n,r;this.renderer.parser=this;let i="";for(let s=0;s<e.length;s++){let o=e[s];if((r=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&r[o.type]){let a=o,h=this.options.extensions.renderers[a.type].call({parser:this},a);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){i+=h||"";continue}}let l=o;switch(l.type){case"space":{i+=this.renderer.space(l);break}case"hr":{i+=this.renderer.hr(l);break}case"heading":{i+=this.renderer.heading(l);break}case"code":{i+=this.renderer.code(l);break}case"table":{i+=this.renderer.table(l);break}case"blockquote":{i+=this.renderer.blockquote(l);break}case"list":{i+=this.renderer.list(l);break}case"checkbox":{i+=this.renderer.checkbox(l);break}case"html":{i+=this.renderer.html(l);break}case"def":{i+=this.renderer.def(l);break}case"paragraph":{i+=this.renderer.paragraph(l);break}case"text":{i+=this.renderer.text(l);break}default:{let a='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return i}parseInline(e,i=this.renderer){var r,s;this.renderer.parser=this;let n="";for(let o=0;o<e.length;o++){let l=e[o];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[l.type]){let h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){n+=h||"";continue}}let a=l;switch(a.type){case"escape":{n+=i.text(a);break}case"html":{n+=i.html(a);break}case"link":{n+=i.link(a);break}case"image":{n+=i.image(a);break}case"checkbox":{n+=i.checkbox(a);break}case"strong":{n+=i.strong(a);break}case"em":{n+=i.em(a);break}case"codespan":{n+=i.codespan(a);break}case"br":{n+=i.br(a);break}case"del":{n+=i.del(a);break}case"text":{n+=i.text(a);break}default:{let h='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return n}},tc,wo=(tc=class{constructor(t){K(this,"options");K(this,"block");this.options=t||Un}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?ei.lex:ei.lexInline}provideParser(t=this.block){return t?ti.parse:ti.parseInline}},K(tc,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),K(tc,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),tc),SL=class{constructor(...t){K(this,"defaults",Gp());K(this,"options",this.setOptions);K(this,"parse",this.parseMarkdown(!0));K(this,"parseInline",this.parseMarkdown(!1));K(this,"Parser",ti);K(this,"Renderer",rc);K(this,"TextRenderer",ig);K(this,"Lexer",ei);K(this,"Tokenizer",nc);K(this,"Hooks",wo);this.use(...t)}walkTokens(t,e){var n,r;let i=[];for(let s of t)switch(i=i.concat(e.call(this,s)),s.type){case"table":{let o=s;for(let l of o.header)i=i.concat(this.walkTokens(l.tokens,e));for(let l of o.rows)for(let a of l)i=i.concat(this.walkTokens(a.tokens,e));break}case"list":{let o=s;i=i.concat(this.walkTokens(o.items,e));break}default:{let o=s;(r=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&r[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{let a=o[l].flat(1/0);i=i.concat(this.walkTokens(a,e))}):o.tokens&&(i=i.concat(this.walkTokens(o.tokens,e)))}}return i}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(i=>{let n={...i};if(n.async=this.defaults.async||n.async||!1,i.extensions&&(i.extensLine truncated
Please report this to https://github.com/markedjs/marked.`,t){let n="<p>An error occurred:</p><pre>"+bi(i.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(i);throw i}}},Gn=new SL;function pe(t,e){return Gn.parse(t,e)}pe.options=pe.setOptions=function(t){return Gn.setOptions(t),pe.defaults=Gn.defaults,Fx(pe.defaults),pe};pe.getDefaults=Gp;pe.defaults=Un;pe.use=function(...t){return Gn.use(...t),pe.defaults=Gn.defaults,Fx(pe.defaults),pe};pe.walkTokens=function(t,e){return Gn.walkTokens(t,e)};pe.parseInline=Gn.parseInline;pe.Parser=ti;pe.parser=ti.parse;pe.Renderer=rc;pe.TextRenderer=ig;pe.Lexer=ei;pe.lexer=ei.lex;pe.Tokenizer=nc;pe.Hooks=wo;pe.parse=pe;var gZ=pe.options,OZ=pe.setOptions,mZ=pe.use,bZ=pe.walkTokens,yZ=pe.parseInline;var SZ=ti.parse,xZ=ei.lex;var Pk=Wk(Qk(),1);var Mi=Pk.default;function fg(t){let e="true false yes no null",i="[\\w#;/?:@&=+$,.~*'()[\\]]+",n={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,r]},l=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),u={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},d={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},p={begin:/\{/,end:/\}/,contains:[d],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[d],illegal:"\\n",relevance:0},m=[n,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+i},{className:"type",begin:"!<"+i+">"},{className:"type",begin:"!"+i},{className:"type",begin:"!!"+i},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},u,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},p,g,s,o],b=[...m];return b.pop(),b.push(l),d.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:m}}function fc(t){let e=t.regex,i={},n={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[i]}]};Object.assign(i,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});let r={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},s=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,i,r]};r.contains.push(l);let a={match:/\\"/},h={className:"string",begin:/'/,end:/'/},c={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,i]},u=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],d=t.SHEBANG({binary:`(${u.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],m=["true","false"],b={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],S=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],v=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],x=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir"," Line truncated
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${bi(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:i}){let n=this.parser.parseInline(i),r=qx(t);if(r===null)return n;t=r;let s='<a href="'+t+'"';return e&&(s+=' title="'+bi(e)+'"'),s+=">"+n+"</a>",s}image({href:t,title:e,text:i,tokens:n}){n&&(i=this.parser.parseInline(n,this.parser.textRenderer));let r=qx(t);if(r===null)return bi(i);t=r;let s=`<img src="${t}" alt="${bi(i)}"`;return e&&(s+=` title="${bi(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:bi(t.text)}},tg=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},ti=class Wp{constructor(e){K(this,"options");K(this,"renderer");K(this,"textRenderer");this.options=e||Un,this.options.renderer=this.options.renderer||new nc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new tg}static parse(e,i){return new Wp(i).parse(e)}static parseInline(e,i){return new Wp(i).parseInline(e)}parse(e){var n,r;this.renderer.parser=this;let i="";for(let s=0;s<e.length;s++){let o=e[s];if((r=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&r[o.type]){let a=o,h=this.options.extensions.renderers[a.type].call({parser:this},a);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){i+=h||"";continue}}let l=o;switch(l.type){case"space":{i+=this.renderer.space(l);break}case"hr":{i+=this.renderer.hr(l);break}case"heading":{i+=this.renderer.heading(l);break}case"code":{i+=this.renderer.code(l);break}case"table":{i+=this.renderer.table(l);break}case"blockquote":{i+=this.renderer.blockquote(l);break}case"list":{i+=this.renderer.list(l);break}case"checkbox":{i+=this.renderer.checkbox(l);break}case"html":{i+=this.renderer.html(l);break}case"def":{i+=this.renderer.def(l);break}case"paragraph":{i+=this.renderer.paragraph(l);break}case"text":{i+=this.renderer.text(l);break}default:{let a='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return i}parseInline(e,i=this.renderer){var r,s;this.renderer.parser=this;let n="";for(let o=0;o<e.length;o++){let l=e[o];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[l.type]){let h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){n+=h||"";continue}}let a=l;switch(a.type){case"escape":{n+=i.text(a);break}case"html":{n+=i.html(a);break}case"link":{n+=i.link(a);break}case"image":{n+=i.image(a);break}case"checkbox":{n+=i.checkbox(a);break}case"strong":{n+=i.strong(a);break}case"em":{n+=i.em(a);break}case"codespan":{n+=i.codespan(a);break}case"br":{n+=i.br(a);break}case"del":{n+=i.del(a);break}case"text":{n+=i.text(a);break}default:{let h='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return n}},ec,wo=(ec=class{constructor(t){K(this,"options");K(this,"block");this.options=t||Un}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?ei.lex:ei.lexInline}provideParser(t=this.block){return t?ti.parse:ti.parseInline}},K(ec,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),K(ec,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ec),wL=class{constructor(...t){K(this,"defaults",Vp());K(this,"options",this.setOptions);K(this,"parse",this.parseMarkdown(!0));K(this,"parseInline",this.parseMarkdown(!1));K(this,"Parser",ti);K(this,"Renderer",nc);K(this,"TextRenderer",tg);K(this,"Lexer",ei);K(this,"Tokenizer",ic);K(this,"Hooks",wo);this.use(...t)}walkTokens(t,e){var n,r;let i=[];for(let s of t)switch(i=i.concat(e.call(this,s)),s.type){case"table":{let o=s;for(let l of o.header)i=i.concat(this.walkTokens(l.tokens,e));for(let l of o.rows)for(let a of l)i=i.concat(this.walkTokens(a.tokens,e));break}case"list":{let o=s;i=i.concat(this.walkTokens(o.items,e));break}default:{let o=s;(r=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&r[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{let a=o[l].flat(1/0);i=i.concat(this.walkTokens(a,e))}):o.tokens&&(i=i.concat(this.walkTokens(o.tokens,e)))}}return i}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(i=>{let n={...i};if(n.async=this.defaults.async||n.async||!1,i.extensions&&(i.extensLine truncated
Please report this to https://github.com/markedjs/marked.`,t){let n="<p>An error occurred:</p><pre>"+bi(i.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(i);throw i}}},Gn=new wL;function pe(t,e){return Gn.parse(t,e)}pe.options=pe.setOptions=function(t){return Gn.setOptions(t),pe.defaults=Gn.defaults,Ux(pe.defaults),pe};pe.getDefaults=Vp;pe.defaults=Un;pe.use=function(...t){return Gn.use(...t),pe.defaults=Gn.defaults,Ux(pe.defaults),pe};pe.walkTokens=function(t,e){return Gn.walkTokens(t,e)};pe.parseInline=Gn.parseInline;pe.Parser=ti;pe.parser=ti.parse;pe.Renderer=nc;pe.TextRenderer=tg;pe.Lexer=ei;pe.lexer=ei.lex;pe.Tokenizer=ic;pe.Hooks=wo;pe.parse=pe;var yZ=pe.options,SZ=pe.setOptions,xZ=pe.use,kZ=pe.walkTokens,wZ=pe.parseInline;var vZ=ti.parse,QZ=ei.lex;var Qk=Uk(vk(),1);var Mi=Qk.default;function hg(t){let e="true false yes no null",i="[\\w#;/?:@&=+$,.~*'()[\\]]+",n={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,r]},l=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),u={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},d={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},p={begin:/\{/,end:/\}/,contains:[d],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[d],illegal:"\\n",relevance:0},m=[n,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+i},{className:"type",begin:"!<"+i+">"},{className:"type",begin:"!"+i},{className:"type",begin:"!!"+i},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},u,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},p,g,s,o],b=[...m];return b.pop(),b.push(l),d.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:m}}function hc(t){let e=t.regex,i={},n={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[i]}]};Object.assign(i,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});let r={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},s=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,i,r]};r.contains.push(l);let a={match:/\\"/},h={className:"string",begin:/'/,end:/'/},c={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,i]},u=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],d=t.SHEBANG({binary:`(${u.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],m=["true","false"],b={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],S=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],v=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],x=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir"," Line truncated
display: block;
overflow-x: auto;
padding: 1em
@@ -227,7 +227,7 @@ code.hljs {
.hljs-tag {
/* purposely ignored */
}`;var dg=`pre code.hljs {
}`;var ug=`pre code.hljs {
display: block;
overflow-x: auto;
padding: 1em
@@ -343,7 +343,7 @@ code.hljs {
.hljs-tag {
/* purposely ignored */
}`;var Ae={timestamp:$e.define(),bracket:$e.define(),category:$e.define(),logString:$e.define(),logLink:$e.define(),levelInfo:$e.define(),levelWarning:$e.define(),levelError:$e.define(),levelDebug:$e.define(),levelTip:$e.define(),levelFatal:$e.define(),levelWatchdog:$e.define()};Mi.registerLanguage("yaml",fg);Mi.registerLanguage("yml",fg);Mi.registerLanguage("bash",fc);Mi.registerLanguage("sh",fc);Mi.registerLanguage("shell",fc);Mi.registerLanguage("json",$k);var uX=[{label:"port",type:"keyword",detail:"HTTP proxy port",info:"Invalid when mixed port is enabled"},{label:"socks-port",type:"keyword",detail:"SOCKS5 proxy port"},{label:"mixed-port",type:"keyword",detail:"HTTP/SOCKS mixed port",info:"Overrides port and socks-port when set"},{label:"redir-port",type:"keyword",detail:"Transparent proxy port"},{label:"tproxy-port",type:"keyword",detail:"TPROXY transparent proxy port"},{label:"mode",type:"keyword",detail:"Run mode: rule / global / direct"},{label:"log-level",type:"keyword",detail:"Log level: debug / info / warning / error / silent"},{label:"ipv6",type:"keyword",detail:"IPv6 traffic handling: true / false"},{label:"allow-lan",type:"keyword",detail:"Allow LAN connections: true / false"},{label:"bind-address",type:"keyword",detail:"Bind address, default *"},{label:"authentication",type:"keyword",detail:"HTTP/SOCKS authentication, array format"},{label:"external-controller",type:"keyword",detail:"RESTful API listen address"},{label:"external-ui",type:"keyword",detail:"Dashboard path"},{label:"secret",type:"keyword",detail:"API secret"},{label:"interface-name",type:"keyword",detail:"Outbound interface name"},{label:"routing-mark",type:"keyword",detail:"Routing mark"},{label:"hosts",type:"keyword",detail:"Custom hosts mapping"},{label:"profile",type:"keyword",detail:"Profiling configuration"},{label:"global-ua",type:"keyword",detail:"Global User-Agent"},{label:"unified-delay",type:"keyword",detail:"Unified delay: true / false"},{label:"tcp-concurrent",type:"keyword",detail:"TCP concurrent connections"},{label:"find-process-mode",type:"keyword",detail:"Find process mode: off / strict / always"},{label:"sniffing",type:"keyword",detail:"Domain sniffing: true / false"},{label:"keep-alive-interval",type:"keyword",detail:"TCP keep-alive interval (seconds)"},{label:"geodata-mode",type:"keyword",detail:"GEO data mode: true / false"},{label:"geodata-loader",type:"keyword",detail:"GEO loader: memconservative / standard"},{label:"geox-url",type:"keyword",detail:"GEOX custom URL template"},{label:"geosite",type:"keyword",detail:"GeoSite configuration"},{label:"geo-auto-update",type:"keyword",detail:"GEO auto update: true / false"},{label:"geo-update-interval",type:"keyword",detail:"GEO update interval (hours)"},{label:"tun",type:"keyword",detail:"TUN mode configuration"},{label:"enable",type:"property",detail:"Enable: true / false"},{label:"stack",type:"property",detail:"Protocol stack: system / gvisor / mixed"},{label:"device",type:"property",detail:"TUN device name"},{label:"dns-hijack",type:"property",detail:"DNS hijack address list"},{label:"auto-route",type:"property",detail:"Auto set route: true / false"},{label:"auto-detect-interface",type:"property",detail:"Auto detect interface: true / false"},{label:"mtu",type:"property",detail:"MTU value"},{label:"inet4-address",type:"property",detail:"IPv4 address range"},{label:"inet6-address",type:"property",detail:"IPv6 address range"},{label:"strict-route",type:"property",detail:"Strict route: true / false"},{label:"endpoint-independent-nat",type:"property",detail:"Endpoint-independent NAT: true / false"},{label:"udp-timeout",type:"property",detail:"UDP timeout"},{label:"dns",type:"keyword",detail:"DNS configuration"},{label:"nameserver",type:"property",detail:"DNS upstream servers"},{label:"fallback",type:"property",detail:"Fallback DNS servers"},{label:"fallback-filter",type:"property",detail:"Fallback filter configuration"},{label:"default-nameserver",type:"property",detail:"Default DNS servers"},{label:"nameserver-policy",type:"property",detail:"DNS by domain name"},{label:"proxy-server-nameserver",type:"property",detail:"Proxy DNS servers"},{label:"use-hosts",type:"property",detail:"Use hosts: true / false"},{label:"enhanced-mode",type:"property",detail:"DNS mode: normal / redir-host / fake-ip"},{label:"fake-ip-range",type:"property",detail:"Fake-IP address range"},{label:"fake-ip-filter",type:"property",detail:"Fake-IP filter domains"},{label:"type",type:"type",detail:"ss / ssr / vmess / trojan / snell / http / socks5 / hysteria / vless / tuic / wireguard"},{label:"server",type:"property",detail:"Server address"},{label:"name",type:"property",detail:"Proxy name"},{label:"password",type:"property",detail:"Password"},{label:"cipher",type:"property",detail:"Encryption method"},{label:"udp",type:"property",detail:"UDP relay: true / false"},{label:"xudp",type:"property",detail:"XUDP mode"},{label:"tfo",type:"property",detail:"TCP Fast Open: true / false"},{label:"mpt Line truncated
}`;var Ae={timestamp:$e.define(),bracket:$e.define(),category:$e.define(),logString:$e.define(),logLink:$e.define(),levelInfo:$e.define(),levelWarning:$e.define(),levelError:$e.define(),levelDebug:$e.define(),levelTip:$e.define(),levelFatal:$e.define(),levelWatchdog:$e.define()},$k=!1;function Ck(){$k||($k=!0,Mi.registerLanguage("yaml",hg),Mi.registerLanguage("yml",hg),Mi.registerLanguage("bash",hc),Mi.registerLanguage("sh",hc),Mi.registerLanguage("shell",hc),Mi.registerLanguage("json",Pk))}var gX=[{label:"port",type:"keyword",detail:"HTTP proxy port",info:"Invalid when mixed port is enabled"},{label:"socks-port",type:"keyword",detail:"SOCKS5 proxy port"},{label:"mixed-port",type:"keyword",detail:"HTTP/SOCKS mixed port",info:"Overrides port and socks-port when set"},{label:"redir-port",type:"keyword",detail:"Transparent proxy port"},{label:"tproxy-port",type:"keyword",detail:"TPROXY transparent proxy port"},{label:"mode",type:"keyword",detail:"Run mode: rule / global / direct"},{label:"log-level",type:"keyword",detail:"Log level: debug / info / warning / error / silent"},{label:"ipv6",type:"keyword",detail:"IPv6 traffic handling: true / false"},{label:"allow-lan",type:"keyword",detail:"Allow LAN connections: true / false"},{label:"bind-address",type:"keyword",detail:"Bind address, default *"},{label:"authentication",type:"keyword",detail:"HTTP/SOCKS authentication, array format"},{label:"external-controller",type:"keyword",detail:"RESTful API listen address"},{label:"external-ui",type:"keyword",detail:"Dashboard path"},{label:"secret",type:"keyword",detail:"API secret"},{label:"interface-name",type:"keyword",detail:"Outbound interface name"},{label:"routing-mark",type:"keyword",detail:"Routing mark"},{label:"hosts",type:"keyword",detail:"Custom hosts mapping"},{label:"profile",type:"keyword",detail:"Profiling configuration"},{label:"global-ua",type:"keyword",detail:"Global User-Agent"},{label:"unified-delay",type:"keyword",detail:"Unified delay: true / false"},{label:"tcp-concurrent",type:"keyword",detail:"TCP concurrent connections"},{label:"find-process-mode",type:"keyword",detail:"Find process mode: off / strict / always"},{label:"sniffing",type:"keyword",detail:"Domain sniffing: true / false"},{label:"keep-alive-interval",type:"keyword",detail:"TCP keep-alive interval (seconds)"},{label:"geodata-mode",type:"keyword",detail:"GEO data mode: true / false"},{label:"geodata-loader",type:"keyword",detail:"GEO loader: memconservative / standard"},{label:"geox-url",type:"keyword",detail:"GEOX custom URL template"},{label:"geosite",type:"keyword",detail:"GeoSite configuration"},{label:"geo-auto-update",type:"keyword",detail:"GEO auto update: true / false"},{label:"geo-update-interval",type:"keyword",detail:"GEO update interval (hours)"},{label:"tun",type:"keyword",detail:"TUN mode configuration"},{label:"enable",type:"property",detail:"Enable: true / false"},{label:"stack",type:"property",detail:"Protocol stack: system / gvisor / mixed"},{label:"device",type:"property",detail:"TUN device name"},{label:"dns-hijack",type:"property",detail:"DNS hijack address list"},{label:"auto-route",type:"property",detail:"Auto set route: true / false"},{label:"auto-detect-interface",type:"property",detail:"Auto detect interface: true / false"},{label:"mtu",type:"property",detail:"MTU value"},{label:"inet4-address",type:"property",detail:"IPv4 address range"},{label:"inet6-address",type:"property",detail:"IPv6 address range"},{label:"strict-route",type:"property",detail:"Strict route: true / false"},{label:"endpoint-independent-nat",type:"property",detail:"Endpoint-independent NAT: true / false"},{label:"udp-timeout",type:"property",detail:"UDP timeout"},{label:"dns",type:"keyword",detail:"DNS configuration"},{label:"nameserver",type:"property",detail:"DNS upstream servers"},{label:"fallback",type:"property",detail:"Fallback DNS servers"},{label:"fallback-filter",type:"property",detail:"Fallback filter configuration"},{label:"default-nameserver",type:"property",detail:"Default DNS servers"},{label:"nameserver-policy",type:"property",detail:"DNS by domain name"},{label:"proxy-server-nameserver",type:"property",detail:"Proxy DNS servers"},{label:"use-hosts",type:"property",detail:"Use hosts: true / false"},{label:"enhanced-mode",type:"property",detail:"DNS mode: normal / redir-host / fake-ip"},{label:"fake-ip-range",type:"property",detail:"Fake-IP address range"},{label:"fake-ip-filter",type:"property",detail:"Fake-IP filter domains"},{label:"type",type:"type",detail:"ss / ssr / vmess / trojan / snell / http / socks5 / hysteria / vless / tuic / wireguard"},{label:"server",type:"property",detail:"Server address"},{label:"name",type:"property",detail:"Proxy name"},{label:"password",type:"property",detail:"Password"},{label:"cipher",type:"property",detail:"Encryption method"},{label:"udp",type:"property",detail:"UDP relay: true / false"},{label:"xudp",type:"property",detail:"XUDP mode"},{label:"tfo",type:"property",detail:"TCP Fast Line truncated
mode: #{2}
log-level: #{3}
allow-lan: #{4}
@@ -872,4 +872,4 @@ external-controller: 0.0.0.0:9093
# mux: true
# username: ""
# password: ""
#{}`,{label:"gost-relay-template",type:"snippet",detail:"GOST Relay node"})];function pX(t){let e=t.matchBefore(/[\w-]+/);if(!e||e.from===e.to&&!t.explicit)return null;let i=uX.filter(s=>s.label.toLowerCase().startsWith(e.text.toLowerCase())),n=dX.filter(s=>(s.label||s.name||"").toLowerCase().startsWith(e.text.toLowerCase())),r=[...i,...n];return r.length?{from:e.from,options:r,validFor:/^[\w-]*$/}:null}function gX(t=750){return Md(e=>{let i=[];try{qS(e.state.doc.toString(),{schema:Gd})}catch(n){let r=n.mark;if(r&&r.line!==void 0){let s=r.line+1;if(s<=e.state.doc.lines){let o=e.state.doc.line(s),l=Math.min(o.from+(r.column||0),o.to);i.push({from:l,to:Math.min(l+1,o.to),severity:"error",message:n.reason||n.message})}}else i.push({from:0,to:0,severity:"error",message:n.reason||n.message})}return i},typeof t=="number"?{delay:t}:void 0)}var uc=null,gg=null;function OX(){if(!window.levelTranslations){uc={},gg=/(?!)/;return}var t={},e=[];for(var i in window.levelTranslations)if(window.levelTranslations.hasOwnProperty(i)){var n=window.levelTranslations[i];t[n]=i,e.push(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}uc=t,gg=new RegExp("^\\[("+e.join("|")+")\\]")}var mX=_s.define({tokenTable:{timestamp:Ae.timestamp,bracket:Ae.bracket,category:Ae.category,logString:Ae.logString,logLink:Ae.logLink,levelInfo:Ae.levelInfo,levelWarning:Ae.levelWarning,levelError:Ae.levelError,levelDebug:Ae.levelDebug,levelTip:Ae.levelTip,levelFatal:Ae.levelFatal,levelWatchdog:Ae.levelWatchdog},startState(){return{tabDone:!1}},token(t,e){if(t.sol()&&(e.tabDone=!1,t.match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)))return"timestamp";if(t.eatSpace())return null;var i=t.peek();if(!i)return t.skipToEnd(),null;if(i==="\u3010"&&t.match(/\u3010[^\u3011]*\u3011/))return"bracket";if(e.tabDone)return t.next(),"logString";if(i==="["){uc===null&&OX();var n=t.match(gg);if(n){var r=uc[n[1]];if(r){var s="level"+r.charAt(0).toUpperCase()+r.slice(1);if(Ae[s])return s}return"category"}if(t.match(/\[[A-Z][^\]]*\]/))return"category"}return i!=="["&&(e.tabDone=!0),t.next(),"logString"}}),bX=Vt.define([{tag:Ae.timestamp,class:"cmt-log-timestamp"},{tag:Ae.bracket,class:"cmt-log-bracket"},{tag:Ae.category,class:"cmt-log-category"},{tag:Ae.logString,class:"cmt-log-string"},{tag:Ae.logLink,class:"cmt-log-link"},{tag:Ae.levelInfo,class:"cmt-log-level-info"},{tag:Ae.levelWarning,class:"cmt-log-level-warning"},{tag:Ae.levelError,class:"cmt-log-level-error"},{tag:Ae.levelDebug,class:"cmt-log-level-debug"},{tag:Ae.levelTip,class:"cmt-log-level-tip"},{tag:Ae.levelFatal,class:"cmt-log-level-fatal"},{tag:Ae.levelWatchdog,class:"cmt-log-level-watchdog"}]);function Tk(t=1e3){return me.fromClass(class{constructor(e){this._preload(e)}update(e){if(e.viewportChanged||e.docChanged){this._rafId&&cancelAnimationFrame(this._rafId);var i=this;this._rafId=requestAnimationFrame(function(){i._rafId=null,i._preload(e.view)})}}_preload(e){var i=e.state.doc,n=i.lineAt(e.viewport.to).number,r=Math.min(n+t,i.lines);a0(e.state,i.line(r).to,50)}})}function yX(t=[]){return[Gh(),zh(),Uh(),jh(),Bh(),Nh(),Yh(),qh(),Rf(),Af({placeholderDOM:null}),Pf(),zf(),op(),T.lineWrapping,Tu(),Tk(),wi.of([...Wf,...Yf,...hp,...Cu,...Tf,{key:"Tab",run:function(e){return Qu(e)||jl(e)}}]),...t]}var SX=T.baseTheme({".cm-line":{position:"relative"},".cm-oc-im::before":{content:'""',position:"absolute",top:0,left:"6px",right:0,height:"var(--oc-lh, 100%)",background:"var(--oc-im)",pointerEvents:"none",zIndex:"-1"},"&light":{"--oc-im-c":"#e1e4e8","--oc-im-ca":"#d0d7de"},"&dark":{"--oc-im-c":"#30363d","--oc-im-ca":"#484f58"}});function pg(t,e){let i=0;for(let n=0;n<t.length;n++)if(t[n]===" ")i++;else if(t[n]===" ")i+=e;else break;return i}function xX({highlightActiveBlock:t=!0,hideFirstIndent:e=!1,thickness:i=1,colors:n,deferMode:r="raf",buffer:s=1e3}={}){var o=n?T.baseTheme({"&light":{"--oc-im-c":n.light||"#e1e4e8","--oc-im-ca":n.activeLight||"#d0d7de"},"&dark":{"--oc-im-c":n.dark||"#30363d","--oc-im-ca":n.activeDark||"#484f58"}}):[];return[SX,o,me.fromClass(class{constructor(l){this._view=l,this._stepPx=null,this._measurePending=!1,this.decorations=this._build(l),this._scheduleMeasure(l)}update(l){this._view=l.view;var a=l.docChanged||l.viewportChanged||t&&l.selectionSet;if(a){if(r==="raf"&&l.viewportChanged&&!l.docChanged){this._rafId&&cancelAnimationFrame(this._rafId);var h=this;this._rafId=requestAnimationFrame(function(){h._rafId=null,h._stepPx=null,h._measurePending=!1,h.decorations=h._build(l.view),h._scheduleMeasure(l.view)});return}this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._stepPx=null,this._measurePending=!1,this.decorations=this._build(l.view),this._scheduleMeasure(l.view)}else this._measurePending&&(this._measurePending=!1,this.decorations=this._build(l.view))}_scheduleMeasure(l){this._measureId!==void 0&&l.cancelMeasure(this._measureId),this._measureId=l.requestMeasure(this._mkSpec())}_mkSpec(){var l=this;return{read:function(a){for(var h=a.state,c=Wt(h),f=h.tabSize,u=h.doc,d=u.lineAt(a Line truncated
#{}`,{label:"gost-relay-template",type:"snippet",detail:"GOST Relay node"})];function mX(t){let e=t.matchBefore(/[\w-]+/);if(!e||e.from===e.to&&!t.explicit)return null;let i=gX.filter(s=>s.label.toLowerCase().startsWith(e.text.toLowerCase())),n=OX.filter(s=>(s.label||s.name||"").toLowerCase().startsWith(e.text.toLowerCase())),r=[...i,...n];return r.length?{from:e.from,options:r,validFor:/^[\w-]*$/}:null}function bX(t=750){return Ed(e=>{let i=[];try{YS(e.state.doc.toString(),{schema:Vd})}catch(n){let r=n.mark;if(r&&r.line!==void 0){let s=r.line+1;if(s<=e.state.doc.lines){let o=e.state.doc.line(s),l=Math.min(o.from+(r.column||0),o.to);i.push({from:l,to:Math.min(l+1,o.to),severity:"error",message:n.reason||n.message})}}else i.push({from:0,to:0,severity:"error",message:n.reason||n.message})}return i},typeof t=="number"?{delay:t}:void 0)}var fc=null,pg=null;function yX(){if(!window.levelTranslations){fc={},pg=/(?!)/;return}var t={},e=[];for(var i in window.levelTranslations)if(window.levelTranslations.hasOwnProperty(i)){var n=window.levelTranslations[i];t[n]=i,e.push(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}fc=t,pg=new RegExp("^\\[("+e.join("|")+")\\]")}var SX=_s.define({tokenTable:{timestamp:Ae.timestamp,bracket:Ae.bracket,category:Ae.category,logString:Ae.logString,logLink:Ae.logLink,levelInfo:Ae.levelInfo,levelWarning:Ae.levelWarning,levelError:Ae.levelError,levelDebug:Ae.levelDebug,levelTip:Ae.levelTip,levelFatal:Ae.levelFatal,levelWatchdog:Ae.levelWatchdog},startState(){return{tabDone:!1}},token(t,e){if(t.sol()&&(e.tabDone=!1,t.match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)))return"timestamp";if(t.eatSpace())return null;var i=t.peek();if(!i)return t.skipToEnd(),null;if(i==="\u3010"&&t.match(/\u3010[^\u3011]*\u3011/))return"bracket";if(e.tabDone)return t.next(),"logString";if(i==="["){fc===null&&yX();var n=t.match(pg);if(n){var r=fc[n[1]];if(r){var s="level"+r.charAt(0).toUpperCase()+r.slice(1);if(Ae[s])return s}return"category"}if(t.match(/\[[A-Z][^\]]*\]/))return"category"}return i!=="["&&(e.tabDone=!0),t.next(),"logString"}}),xX=Vt.define([{tag:Ae.timestamp,class:"cmt-log-timestamp"},{tag:Ae.bracket,class:"cmt-log-bracket"},{tag:Ae.category,class:"cmt-log-category"},{tag:Ae.logString,class:"cmt-log-string"},{tag:Ae.logLink,class:"cmt-log-link"},{tag:Ae.levelInfo,class:"cmt-log-level-info"},{tag:Ae.levelWarning,class:"cmt-log-level-warning"},{tag:Ae.levelError,class:"cmt-log-level-error"},{tag:Ae.levelDebug,class:"cmt-log-level-debug"},{tag:Ae.levelTip,class:"cmt-log-level-tip"},{tag:Ae.levelFatal,class:"cmt-log-level-fatal"},{tag:Ae.levelWatchdog,class:"cmt-log-level-watchdog"}]);function Ak(t=1e3){return me.fromClass(class{constructor(e){this._preload(e)}update(e){if(e.viewportChanged||e.docChanged){this._rafId&&cancelAnimationFrame(this._rafId);var i=this;this._rafId=requestAnimationFrame(function(){i._rafId=null,i._preload(e.view)})}}_preload(e){var i=e.state.doc,n=i.lineAt(e.viewport.to).number,r=Math.min(n+t,i.lines);l0(e.state,i.line(r).to,50)}})}function kX(t=[]){return[Vh(),jh(),Gh(),Nh(),Ih(),Bh(),zh(),Yh(),Af(),Cf({placeholderDOM:null}),Qf(),jf(),sp(),T.lineWrapping,$u(),Ak(),wi.of([...qf,...zf,...cp,...Tu,...$f,{key:"Tab",run:function(e){return vu(e)||Nl(e)}}]),...t]}var wX=T.baseTheme({".cm-line":{position:"relative"},".cm-oc-im::before":{content:'""',position:"absolute",top:0,left:"6px",right:0,height:"var(--oc-lh, 100%)",background:"var(--oc-im)",pointerEvents:"none",zIndex:"-1"},"&light":{"--oc-im-c":"#e1e4e8","--oc-im-ca":"#d0d7de"},"&dark":{"--oc-im-c":"#30363d","--oc-im-ca":"#484f58"}});function dg(t,e){let i=0;for(let n=0;n<t.length;n++)if(t[n]===" ")i++;else if(t[n]===" ")i+=e;else break;return i}function vX({highlightActiveBlock:t=!0,hideFirstIndent:e=!1,thickness:i=1,colors:n,deferMode:r="raf",buffer:s=1e3}={}){var o=n?T.baseTheme({"&light":{"--oc-im-c":n.light||"#e1e4e8","--oc-im-ca":n.activeLight||"#d0d7de"},"&dark":{"--oc-im-c":n.dark||"#30363d","--oc-im-ca":n.activeDark||"#484f58"}}):[];return[wX,o,me.fromClass(class{constructor(l){this._view=l,this._stepPx=null,this._measurePending=!1,this.decorations=this._build(l),this._scheduleMeasure(l)}update(l){this._view=l.view;var a=l.docChanged||l.viewportChanged||t&&l.selectionSet;if(a){if(r==="raf"&&l.viewportChanged&&!l.docChanged){this._rafId&&cancelAnimationFrame(this._rafId);var h=this;this._rafId=requestAnimationFrame(function(){h._rafId=null,h._stepPx=null,h._measurePending=!1,h.decorations=h._build(l.view),h._scheduleMeasure(l.view)});return}this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._stepPx=null,this._measurePending=!1,this.decorations=this._build(l.view),this._scheduleMeasure(l.view)}else this._measurePending&&(this._measurePending=!1,this.decorations=this._build(l.view))}_scheduleMeasure(l){this._measureId!==void 0&&l.cancelMeasure(this._measureId),this._measureId=l.requestMeasure(this._mkSpec())}_mkSpec(){var l=this;return{read:function(a){for(var h=a.state,c=Wt(h),f=h.tabSize,u=h.doc,d=u.lineAt(a Line truncated
@@ -1,11 +1,38 @@
// OpenClash shared utilities
_ocGuard: { if (window._ocCommonLoaded) break _ocGuard; window._ocCommonLoaded = true; }
// ═══ Remove LuCI's global @media (prefers-reduced-motion: reduce) ═══
(function() {
var sheets = document.styleSheets;
for (var i = sheets.length - 1; i >= 0; i--) {
try {
var rules = sheets[i].cssRules || sheets[i].rules;
if (!rules) continue;
for (var j = rules.length - 1; j >= 0; j--) {
var rule = rules[j];
if (rule.type === CSSRule.MEDIA_RULE &&
/prefers-reduced-motion.*reduce/.test(rule.conditionText)) {
sheets[i].deleteRule(j);
}
}
} catch(e) {}
}
})();
// ═══ Internal helpers ═══
// Parse a CSS color string and return relative luminance (0-255).
// Returns 128 for unparseable colors (sentinel: neither dark nor light).
function _luminanceFromColor(color) {
function luminanceFromColor(color) {
var r, g, b;
if (color.indexOf('lab(') === 0) {
var labM = color.match(/[\d.]+%?/g);
if (labM && labM.length >= 1) {
var L = parseFloat(labM[0]);
return L * 2.55;
}
return 128;
}
if (color[0] === '#') {
if (color.length === 4) {
r = parseInt(color[1] + color[1], 16);
@@ -24,15 +51,14 @@ function _luminanceFromColor(color) {
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
}
// Multi-signal dark-mode detection for initial load (runs in <head>,
// before <body> exists). Covers Bootstrap 5.3, Argon, Material, and
// generic LuCI themes. Defaults to light when no signal detected —
// after DOM ready isDarkBackground(document.body) corrects if needed.
function _detectInitialAutoDark() {
function detectInitialAutoDark() {
var html = document.documentElement,
v, cls, lum;
// 1. HTML data-* attributes (Bootstrap 5.3, Material, OpenClash, and generic)
v = html.getAttribute('data-bs-theme') || html.getAttribute('data-theme') || html.getAttribute('data-darkmode');
var bs = html.getAttribute('data-bs-theme'),
th = html.getAttribute('data-theme'),
dm = html.getAttribute('data-darkmode');
v = bs || th || dm;
if (v === 'dark' || v === 'dim' || v === 'true') return true;
if (v === 'light' || v === 'false') return false;
// 2. HTML class name (Argon dark-mode, generic theme-dark, etc.)
@@ -52,42 +78,30 @@ function _detectInitialAutoDark() {
checkBg = style.getPropertyValue('--bs-body-bg').trim()
|| style.getPropertyValue('--body-bg').trim()
|| style.getPropertyValue('--theme-bg').trim();
if (checkBg && checkBg !== 'transparent' && checkBg !== 'rgba(0, 0, 0, 0)') return _luminanceFromColor(checkBg) < 128;
if (checkBg && checkBg !== 'transparent' && checkBg !== 'rgba(0, 0, 0, 0)')
return luminanceFromColor(checkBg) < 128;
// 5. System preference (ultimate fallback)
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) return true;
return false;
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
}
// Detect whether the given element sits on a dark background.
// Explicit oc-theme → immediate. Auto → computed background-color
// (fallback to <html> if element background is transparent).
function isDarkBackground(element) {
var cachedTheme = localStorage.getItem('oc-theme');
if (cachedTheme === 'dark') {
return true;
} else if (cachedTheme === 'light') {
return false;
}
if (cachedTheme === 'dark') return true;
if (cachedTheme === 'light') return false;
var style = window.getComputedStyle(element);
var bgColor = style.backgroundColor;
if (!bgColor || bgColor === 'transparent' || bgColor === 'rgba(0, 0, 0, 0)') {
bgColor = window.getComputedStyle(document.documentElement).backgroundColor;
}
var lum = _luminanceFromColor(bgColor);
if (lum > 100 && lum < 156 && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
return true;
}
var lum = luminanceFromColor(bgColor);
if (lum > 100 && lum < 156 && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) return true;
return lum < 128;
}
// ═══ Theme system ═══
// Sets html[data-darkmode] and <meta name="color-scheme">.
// Explicit dark/light → immediate. Auto → background detection
// (isDarkBackground after DOM ready; _detectInitialAutoDark initially).
function ocApplyRootTheme() {
var t = localStorage.getItem('oc-theme') || 'auto',
d;
@@ -96,11 +110,7 @@ function ocApplyRootTheme() {
} else if (t === 'light') {
d = false;
} else {
if (document.body && document.readyState !== 'loading') {
d = isDarkBackground(document.body);
} else {
d = _detectInitialAutoDark();
}
d = document.body ? isDarkBackground(document.body) : detectInitialAutoDark();
}
document.documentElement.setAttribute('data-darkmode', d ? 'true' : 'false');
var m = document.querySelector('meta[name="color-scheme"]');
@@ -112,8 +122,6 @@ function ocApplyRootTheme() {
m.content = d ? 'dark' : 'light';
}
// Idempotent theme initializer. First call registers DOMContentLoaded
// listener (if page still loading); subsequent calls just re-apply.
function ocInitTheme() {
if (window._ocThemeInited) {
ocUpdateTheme();
@@ -121,25 +129,34 @@ function ocInitTheme() {
}
window._ocThemeInited = true;
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', function() {
ocUpdateTheme();
ocHideEmptyCbiElements();
ocCenterCbiActions();
});
} else {
ocUpdateTheme();
ocApplyRootTheme();
var needsCorrection = (localStorage.getItem('oc-theme') || 'auto') === 'auto';
function _ocDomReady() {
if (needsCorrection) ocApplyRootTheme();
ocApplyEditorTheme();
ocHideEmptyCbiElements();
ocCenterCbiActions();
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', _ocDomReady);
} else {
_ocDomReady();
}
}
// Respond to OS-level theme changes when oc-theme is 'auto'.
if (window.matchMedia) {
function ocUpdateTheme() {
ocApplyRootTheme();
ocApplyEditorTheme();
}
if (window.matchMedia && !window._ocCommonLoaded) {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function() {
if ((localStorage.getItem('oc-theme') || 'auto') === 'auto') {
ocApplyRootTheme();
if (document.readyState !== 'loading') ocUpdateTheme();
if (document.body) ocUpdateTheme();
}
});
}
@@ -154,6 +171,49 @@ function winOpen(url) {
return false;
}
function ocGetLogColor(log) {
for (var levelKey in window.levelTranslations) {
var translatedText = '[' + window.levelTranslations[levelKey] + ']';
if (log.indexOf(translatedText) >= 0) return "var(--" + levelKey + "-color)";
}
return "var(--info-color)";
}
function imgerrorfuns(imgobj, imgSrc) {
setTimeout(function() {
imgobj.src = imgSrc;
imgobj.loading = "lazy";
}, 1000 * 10);
}
function ocAnimateScroll(element) {
if (!element) return;
if (element._ocScrollAnimId) cancelAnimationFrame(element._ocScrollAnimId);
var start = element.scrollTop;
var duration = 500;
var startTime = null;
function step(timestamp) {
if (!startTime) startTime = timestamp;
var elapsed = timestamp - startTime;
var progress = Math.min(elapsed / duration, 1);
var eased = 1 - (1 - progress) * (1 - progress);
var lastChild = element.lastElementChild || element.lastChild;
var lastLineH = (lastChild && lastChild.offsetHeight) ? lastChild.offsetHeight : 0;
var maxScroll = Math.max(0, element.scrollHeight - element.clientHeight);
var target = Math.max(0, element.scrollHeight - (element.clientHeight + lastLineH) / 2);
if (target > maxScroll) target = maxScroll;
var distance = target - start;
element.scrollTop = Math.round(start + distance * eased);
if (progress < 1) {
element._ocScrollAnimId = requestAnimationFrame(step);
} else {
element._ocScrollAnimId = null;
element.style.willChange = '';
}
}
element._ocScrollAnimId = requestAnimationFrame(step);
}
function ocFormatUnixTime(unixTimestamp) {
if (!unixTimestamp || unixTimestamp === 0) {
return '--';
@@ -383,10 +443,9 @@ window._cmWhenReady = function(cb) { cb(); };
// ═══ Theme — CM6 & CBI helpers ═══
// Apply theme to CodeMirror editors + highlight.js.
function ocUpdateTheme() {
ocApplyRootTheme();
var isDark = isDarkBackground(document.body);
// Apply CM6 editor themes + highlight.js theme based on current data-darkmode.
function ocApplyEditorTheme() {
var isDark = document.documentElement.getAttribute('data-darkmode') === 'true';
if (typeof CM6 !== 'undefined' && CM6.dispatchTheme) {
var editors = document.querySelectorAll('.cm-editor');
for (var j = 0; j < editors.length; j++) {
@@ -482,7 +541,7 @@ function ocRegisterEditorHotkeys() {
}
}
}
ocUpdateTheme();
ocApplyEditorTheme();
return;
}
@@ -509,7 +568,7 @@ function ocRegisterEditorHotkeys() {
_ocExitFullscreen();
window._ocFullscreenActive = false;
if (window.ConfigEditor) window.ConfigEditor.isFullscreen = false;
ocUpdateTheme();
ocApplyEditorTheme();
}
}, true);
@@ -604,6 +663,35 @@ function ocFallbackCopy(text, btnElement, successMessage, failMessage) {
}
}
function ocSetBtnLoading(btn, loading) {
var svg = btn.querySelector('svg');
if (loading) {
if (svg && !btn.dataset.ocSvgHtml) {
btn.dataset.ocSvgHtml = svg.outerHTML;
var spinner = document.createElement('span');
spinner.className = 'loading-spinner oc-btn-spinner';
spinner.style.verticalAlign = 'middle';
var svgW = parseInt(svg.getAttribute('width'), 10);
var size = (!isNaN(svgW) && svgW > 0) ? svgW : 14;
spinner.style.width = size + 'px';
spinner.style.height = size + 'px';
btn.replaceChild(spinner, svg);
}
btn.disabled = true;
} else {
btn.disabled = false;
if (btn.dataset.ocSvgHtml) {
var holder = document.createElement('span');
holder.innerHTML = btn.dataset.ocSvgHtml;
var newSvg = holder.firstChild;
var cur = btn.querySelector('.loading-spinner');
if (cur && newSvg) {
btn.replaceChild(newSvg, cur);
}
delete btn.dataset.ocSvgHtml;
}
}
}
ocApplyRootTheme();
ocInitTheme();
@@ -1,6 +1,9 @@
// oc-icons.js — OpenClash unified SVG icon library
// Include in HTM files: <script src="/luci-static/resources/openclash/js/oc-icons.js?v=<%=plugin_version%>"></script>
(function() {
if (window._ocIconsLoaded) return;
window._ocIconsLoaded = true;
var SPRITE_ID = 'oc-icon-sprite';
if (document.getElementById(SPRITE_ID)) return;
@@ -13,6 +16,8 @@
svg.innerHTML = [
'<symbol id="oc-icon-refresh" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 4v6h-6"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></symbol>',
'<symbol id="oc-icon-close" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></symbol>',
'<symbol id="oc-icon-player-pause" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 4h6v16h-6z"/><path d="M15 4h6v16h-6z"/></symbol>',
'<symbol id="oc-icon-player-play" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 4v16l13 -8l-13 -8"/></symbol>',
'<symbol id="oc-icon-copy" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></symbol>',
'<symbol id="oc-icon-megaphone" viewBox="0 0 256 256" fill="currentColor"><path d="M228.54,86.66l-176.06-54A16,16,0,0,0,32,48V192a16,16,0,0,0,16,16,16,16,0,0,0,4.52-.65L136,181.73V192a16,16,0,0,0,16,16h32a16,16,0,0,0,16-16v-29.9l28.54-8.75A16.09,16.09,0,0,0,240,138V102A16.09,16.09,0,0,0,228.54,86.66ZM136,165,48,192V48l88,27Zm48,27H152V176.82L184,167Zm40-54-.11,0L152,160.08V79.92l71.89,22,.11,0v36Z"/></symbol>',
'<symbol id="oc-icon-shield-check" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4" stroke-linejoin="round"><path d="M6 9.25564L24.0086 4L42 9.25564V20.0337C42 31.3622 34.7502 41.4194 24.0026 45.0005C13.2521 41.4195 6 31.36 6 20.0287V9.25564Z"/><path d="M15 23L22 30L34 18" stroke-linecap="round" stroke-linejoin="round"/></symbol>',
@@ -20,14 +25,20 @@
'<symbol id="oc-icon-home" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9.75,20.25V14.25h4.5v6h6V11.25a0.75,0.75,0,0,0-0.22-0.53l-7.5-7.5a0.75,0.75,0,0,0-1.06,0l-7.5,7.5A0.75,0.75,0,0,0,3.75,11.25v9Z"/></symbol>',
'<symbol id="oc-icon-globe" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="12" x2="21" y2="12"/><circle cx="12" cy="12" r="9"/><path d="M15.75,12c0,6-3.75,9-3.75,9s-3.75-3-3.75-9,3.75-9,3.75-9S15.75,6,15.75,12Z"/></symbol>',
'<symbol id="oc-icon-edit" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></symbol>',
'<symbol id="oc-icon-upload" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></symbol>',
'<symbol id="oc-icon-add" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></symbol>',
'<symbol id="oc-icon-upload" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"/><path d="M7 9l5 -5l5 5"/><path d="M12 4l0 12"/></symbol>',
'<symbol id="oc-icon-download" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7,11 12,16 17,11"/><line x1="12" y1="2" x2="12" y2="16"/></symbol>',
'<symbol id="oc-icon-save" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17,21 17,13 7,13 7,21"/><polyline points="7,3 7,8 15,8"/></symbol>',
'<symbol id="oc-icon-switch" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><polyline points="7 23 3 19 7 15"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></symbol>',
'<symbol id="oc-icon-update" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"/><path d="M21 21v-5h-5"/></symbol>',
'<symbol id="oc-icon-compare" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="3" width="8" height="18" rx="2"/><rect x="14" y="3" width="8" height="18" rx="2"/></symbol>',
'<symbol id="oc-icon-restore" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/></symbol>',
'<symbol id="oc-icon-help" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></symbol>',
'<symbol id="oc-icon-list" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="4" y="4" width="16" height="16" rx="2"/><line x1="8" y1="8" x2="16" y2="8"/><line x1="8" y1="12" x2="16" y2="12"/><line x1="8" y1="16" x2="12" y2="16"/></symbol>',
'<symbol id="oc-icon-zap" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="13 2 3 14 12 14 11 22 21 10 13 10 13 2"/></symbol>',
'<symbol id="oc-icon-gear" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33h.09a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51h.09a1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82v.09a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></symbol>',
'<symbol id="oc-icon-upload-feather" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17,11 12,6 7,11"/><line x1="12" y1="18" x2="12" y2="6"/></symbol>',
'<symbol id="oc-icon-clock-edit" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M21 12a9 9 0 1 0 -9.972 8.948c.32 .034 .644 .052 .972 .052"/><path d="M12 7v5l2 2"/><path d="M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97l-3.39 3.42h-3v-3l3.42 -3.39"/></symbol>',
'<symbol id="oc-icon-help" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"/><path d="M12 17l0 .01"/><path d="M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"/></symbol>',
'<symbol id="oc-icon-chat" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4"><path d="M4 6H44V36H29L24 41L19 36H4V6Z"/><path d="M23 21H25.0025"/><path d="M33.001 21H34.9999"/><path d="M13.001 21H14.9999"/></symbol>',
'<symbol id="oc-icon-overwrite" viewBox="0 0 256 256" fill="currentColor"><path d="M12,111l112,64a8,8,0,0,0,7.94,0l112-64a8,8,0,0,0,0-13.9l-112-64a8,8,0,0,0-7.94,0l-112,64A8,8,0,0,0,12,111ZM128,49.21,223.87,104,128,158.79,32.13,104ZM246.94,140A8,8,0,0,1,244,151L132,215a8,8,0,0,1-7.94,0L12,151A8,8,0,0,1,20,137.05l108,61.74,108-61.74A8,8,0,0,1,246.94,140Z"/></symbol>',
'<symbol id="oc-icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></symbol>',
@@ -39,15 +50,16 @@
'<symbol id="oc-icon-telegram" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="20"><path d="M80,134.87,170.26,214a8,8,0,0,0,13.09-4.21L224,33.22a1,1,0,0,0-1.34-1.15L20,111.38A6.23,6.23,0,0,0,21,123.3Z" stroke-linecap="round" stroke-linejoin="round"/><line x1="80" y1="134.87" x2="223.41" y2="32.09" stroke-linecap="round" stroke-linejoin="round"/><path d="M124.37,173.78,93.76,205.54A8,8,0,0,1,80,200V134.87" stroke-linecap="round" stroke-linejoin="round"/></symbol>',
'<symbol id="oc-icon-heart" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></symbol>',
'<symbol id="oc-icon-settings" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4" stroke-linejoin="round"><path d="M18.2838 43.1713C14.9327 42.1736 11.9498 40.3213 9.58787 37.867C10.469 36.8227 11 35.4734 11 34.0001C11 30.6864 8.31371 28.0001 5 28.0001C4.79955 28.0001 4.60139 28.01 4.40599 28.0292C4.13979 26.7277 4 25.3803 4 24.0001C4 21.9095 4.32077 19.8938 4.91579 17.9995C4.94381 17.9999 4.97188 18.0001 5 18.0001C8.31371 18.0001 11 15.3138 11 12.0001C11 11.0488 10.7786 10.1493 10.3846 9.35011C12.6975 7.1995 15.5205 5.59002 18.6521 4.72314C19.6444 6.66819 21.6667 8.00013 24 8.00013C26.3333 8.00013 28.3556 6.66819 29.3479 4.72314C32.4795 5.59002 35.3025 7.1995 37.6154 9.35011C37.2214 10.1493 37 11.0488 37 12.0001C37 15.3138 39.6863 18.0001 43 18.0001C43.0281 18.0001 43.0562 17.9999 43.0842 17.9995C43.6792 19.8938 44 21.9095 44 24.0001C44 25.3803 43.8602 26.7277 43.594 28.0292C43.3986 28.01 43.2005 28.0001 43 28.0001C39.6863 28.0001 37 30.6864 37 34.0001C37 35.4734 37.531 36.8227 38.4121 37.867C36.0502 40.3213 33.0673 42.1736 29.7162 43.1713C28.9428 40.752 26.676 39.0001 24 39.0001C21.324 39.0001 19.0572 40.752 18.2838 43.1713Z"/><path d="M24 31C27.866 31 31 27.866 31 24C31 20.134 27.866 17 24 17C20.134 17 17 20.134 17 24C17 27.866 20.134 31 24 31Z"/></symbol>',
'<symbol id="oc-icon-document" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="4" y="4" width="16" height="16" rx="2"/><line x1="8" y1="8" x2="16" y2="8"/><line x1="8" y1="12" x2="16" y2="12"/><line x1="8" y1="16" x2="12" y2="16"/></symbol>',
'<symbol id="oc-icon-lightning" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="13 2 3 14 12 14 11 22 21 10 13 10 13 2"/></symbol>',
'<symbol id="oc-icon-alert-circle" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12" y2="16"/></symbol>',
'<symbol id="oc-icon-bug" viewBox="2 4 20 19" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 9v-1a3 3 0 0 1 6 0v1"/><path d="M8 9h8a6 6 0 0 1 1 3v3a5 5 0 0 1 -10 0v-3a6 6 0 0 1 1 -3"/><path d="M3 13h4"/><path d="M17 13h4"/><path d="M12 20v-6"/><path d="M4 19l3.35 -2"/><path d="M20 19l-3.35 -2"/><path d="M4 7l3.75 2.4"/><path d="M20 7l-3.75 2.4"/></symbol>',
'<symbol id="oc-icon-play-bugs" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3.5 18a2.5 3 0 1 0 5 0a2.5 3 0 1 0 -5 0"/><path d="M2 17.5h1.5"/><path d="M8.5 17.5h1.5"/><path d="M9.5 14.5l-1.5 1.5"/><path d="M2.5 14.5l1.5 1.5"/><path d="M2.5 21.5l1.5 -1.5"/><path d="M8 20l1.5 1.5"/><path d="M15.5 16l6.5 -5l-11 -8"/><path d="M13 12.5l2 -1.5l-11 -8v8"/></symbol>',
'<symbol id="oc-icon-link-tabler" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 15l6 -6"/><path d="M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"/><path d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"/></symbol>',
'<symbol id="oc-icon-speedtest" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5.636 19.364a9 9 0 1 1 12.728 0"/><path d="M16 9l-4 4"/></symbol>',
'<symbol id="oc-icon-alert-circle" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"/><path d="M12 8v4"/><path d="M12 16h.01"/></symbol>',
'<symbol id="oc-icon-link" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M26.2401 16.373L17.1001 7.23303C14.4388 4.57168 10.0653 4.6303 7.33158 7.36397C4.59791 10.0976 4.53929 14.4712 7.20064 17.1325L15.1359 25.0678"/><path d="M32.9027 23.0031L40.838 30.9384C43.4994 33.5998 43.4407 37.9733 40.7071 40.707C37.9734 43.4407 33.5999 43.4993 30.9385 40.8379L21.7985 31.6979"/><path d="M26.1093 26.1416C28.843 23.4079 28.9016 19.0344 26.2403 16.373"/><path d="M21.7989 21.7984C19.0652 24.5321 19.0066 28.9056 21.6679 31.5669"/></symbol>',
'<symbol id="oc-icon-key" viewBox="0 0 16 16" fill="currentColor"><path d="M10.5 0a5.499 5.499 0 1 1-1.288 10.848l-.932.932a.749.749 0 0 1-.53.22H7v.75a.749.749 0 0 1-.22.53l-.5.5a.749.749 0 0 1-.53.22H5v.75a.749.749 0 0 1-.22.53l-.5.5a.749.749 0 0 1-.53.22h-2A1.75 1.75 0 0 1 0 14.25v-2c0-.199.079-.389.22-.53l4.932-4.932A5.5 5.5 0 0 1 10.5 0Zm-4 5.5c-.001.431.069.86.205 1.269a.75.75 0 0 1-.181.768L1.5 12.56v1.69c0 .138.112.25.25.25h1.69l.06-.06v-1.19a.75.75 0 0 1 .75-.75h1.19l.06-.06v-1.19a.75.75 0 0 1 .75-.75h1.19l1.023-1.025a.75.75 0 0 1 .768-.18A4 4 0 1 0 6.5 5.5ZM11 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"/></symbol>',
'<symbol id="oc-icon-calculator" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M28 32.5H42"/><path d="M28 41.5H42"/><path d="M6 13H22"/><path d="M14 5L14 21"/><path d="M42 5L6 41"/></symbol>',
'<symbol id="oc-icon-chevron-down" viewBox="0 0 24 24" fill="currentColor"><polygon points="6,9 18,9 12,15"/></symbol>',
'<symbol id="oc-icon-trash" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"/></symbol>',
'<symbol id="oc-icon-info" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></symbol>',
'<symbol id="oc-icon-usage-help" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="7" width="18" height="13" rx="2"/><circle cx="9" cy="13" r="1"/><circle cx="15" cy="13" r="1"/><line x1="9" y1="17" x2="15" y2="17"/><path d="M12 3v4"/><circle cx="12" cy="3" r="1"/></symbol>',
'<symbol id="oc-icon-eye" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"><path d="M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Z"/><circle cx="128" cy="128" r="40"/></symbol>',
'<symbol id="oc-icon-eye-off" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"><line x1="48" y1="40" x2="208" y2="216"/><path d="M154.9,157.6A39.6,39.6,0,0,1,128,168a40,40,0,0,1-26.9-69.6"/><path d="M74,68.6C33.2,89.2,16,128,16,128s32,72,112,72a117.9,117.9,0,0,0,54-12.6"/><path d="M208.6,169.1C230.4,149.6,240,128,240,128S208,56,128,56a123.9,123.9,0,0,0-20.7,1.7"/><path d="M135.5,88.7a39.9,39.9,0,0,1,32.3,35.5"/></symbol>',
@@ -59,9 +71,17 @@
'<symbol id="oc-icon-gift" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="20 12 20 22 4 22 4 12"/><rect x="2" y="7" width="20" height="5"/><line x1="12" y1="22" x2="12" y2="7"/><path d="M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z"/><path d="M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z"/></symbol>',
'<symbol id="oc-icon-logout" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16,17 21,12 16,7"/><line x1="21" y1="12" x2="9" y2="12"/></symbol>',
'<symbol id="oc-icon-bell" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></symbol>',
'<symbol id="oc-icon-bell-phosphor" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="2"><path d="M176,232a8,8,0,0,1-8,8H88a8,8,0,0,1,0-16h80A8,8,0,0,1,176,232Zm40-128a87.55,87.55,0,0,1-33.64,69.21A16.24,16.24,0,0,0,176,186v6a16,16,0,0,1-16,16H96a16,16,0,0,1-16-16v-6a16,16,0,0,0-6.23-12.66A87.59,87.59,0,0,1,40,104.49C39.74,56.83,78.26,17.14,125.88,16A88,88,0,0,1,216,104Zm-16,0a72,72,0,0,0-73.74-72c-39,.92-70.47,33.39-70.26,72.39a71.65,71.65,0,0,0,27.64,56.3A32,32,0,0,1,96,186v6h64v-6a32.15,32.15,0,0,1,12.47-25.35A71.65,71.65,0,0,0,200,104Zm-16.11-9.34a57.6,57.6,0,0,0-46.56-46.55,8,8,0,0,0-2.66,15.78c16.57,2.79,30.63,16.85,33.44,33.45A8,8,0,0,0,176,104a9,9,0,0,0,1.35-.11A8,8,0,0,0,183.89,94.66Z"/></symbol>',
'<symbol id="oc-icon-key-oix" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"/></symbol>',
'<symbol id="oc-icon-chevron-oix" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="6 9 12 15 18 9"/></symbol>',
'<symbol id="oc-icon-badge" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4" stroke-linejoin="round"><path d="M9 40L4 17L14 22L24 8L34 22L44 17L39 40H9Z"/><path d="M24 33C26.2091 33 28 31.2091 28 29C28 26.7909 26.2091 25 24 25C21.7909 25 20 26.7909 20 29C20 31.2091 21.7909 33 24 33Z"/></symbol>'
'<symbol id="oc-icon-badge" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4" stroke-linejoin="round"><path d="M9 40L4 17L14 22L24 8L34 22L44 17L39 40H9Z"/><path d="M24 33C26.2091 33 28 31.2091 28 29C28 26.7909 26.2091 25 24 25C21.7909 25 20 26.7909 20 29C20 31.2091 21.7909 33 24 33Z"/></symbol>',
'<symbol id="oc-icon-brand-baidu" viewBox="0 0 24 24"><path fill="currentColor" d="M9.154 0C7.71 0 6.54 1.658 6.54 3.707c0 2.051 1.171 3.71 2.615 3.71 1.446 0 2.614-1.659 2.614-3.71C11.768 1.658 10.6 0 9.154 0zm7.025.594C14.86.58 13.347 2.589 13.2 3.927c-.187 1.745.25 3.487 2.179 3.735 1.933.25 3.175-1.806 3.422-3.364.252-1.555-.995-3.364-2.362-3.674a1.218 1.218 0 0 0-.261-.03zM3.582 5.535a2.811 2.811 0 0 0-.156.008c-2.118.19-2.428 3.24-2.428 3.24-.287 1.41.686 4.425 3.297 3.864 2.617-.561 2.262-3.68 2.183-4.362-.125-1.018-1.292-2.773-2.896-2.75zm16.534 1.753c-2.308 0-2.617 2.119-2.617 3.616 0 1.43.121 3.425 2.988 3.362 2.867-.063 2.553-3.238 2.553-3.988 0-.745-.62-2.99-2.924-2.99zm-8.264 2.478c-1.424.014-2.708.925-3.323 1.947-1.118 1.868-2.863 3.05-3.112 3.363-.25.309-3.61 2.116-2.864 5.42.746 3.301 3.365 3.237 3.365 3.237s1.93.19 4.171-.31c2.24-.495 4.17.123 4.17.123s5.233 1.748 6.665-1.616c1.43-3.364-.808-5.109-.808-5.109s-2.99-2.306-4.736-4.798c-1.072-1.665-2.348-2.268-3.528-2.257zm-2.234 3.84 1.542.024v8.197H7.758c-1.47-.291-2.055-1.292-2.13-1.462-.072-.173-.488-.976-.268-2.343.635-2.049 2.447-2.196 2.447-2.196h1.81zm3.964 2.39v3.881c.096.413.612.488.612.488h1.614v-4.343h1.689v5.782h-3.915c-1.517-.39-1.59-1.465-1.59-1.465v-4.317zm-5.458 1.147c-.66.197-.978.708-1.05.928-.076.22-.247.78-.1 1.269.294 1.095 1.248 1.144 1.248 1.144h1.37v-3.34z"/></symbol>',
'<symbol id="oc-icon-brand-netease" viewBox="0 0 24 24"><path fill="currentColor" d="M13.046 9.388a3.919 3.919 0 0 0-.66.19c-.809.312-1.447.991-1.666 1.775a2.269 2.269 0 0 0-.074.81c.048.546.333 1.05.764 1.35a1.483 1.483 0 0 0 2.01-.286c.406-.531.355-1.183.24-1.636-.098-.387-.22-.816-.345-1.249a64.76 64.76 0 0 1-.269-.954zm-.82 10.07c-3.984 0-7.224-3.24-7.224-7.223 0-.98.226-3.02 1.884-4.822A7.188 7.188 0 0 1 9.502 5.6a.792.792 0 1 1 .587 1.472 5.619 5.619 0 0 0-2.795 2.462 5.538 5.538 0 0 0-.707 2.7 5.645 5.645 0 0 0 5.638 5.638c1.844 0 3.627-.953 4.542-2.428 1.042-1.68.772-3.931-.627-5.238a3.299 3.299 0 0 0-1.437-.777c.172.589.334 1.18.494 1.772.284 1.12.1 2.181-.519 2.989-.39.51-.956.888-1.592 1.064a3.038 3.038 0 0 1-2.58-.44 3.45 3.45 0 0 1-1.44-2.514c-.04-.467.002-.93.128-1.376.35-1.256 1.356-2.339 2.622-2.826a5.5 5.5 0 0 1 .823-.246l-.134-.505c-.37-1.371.25-2.579 1.547-3.007.329-.109.68-.145 1.025-.105.792.09 1.476.592 1.709 1.023.258.507-.096 1.153-.706 1.153a.788.788 0 0 1-.54-.213c-.088-.08-.163-.174-.259-.247a.825.825 0 0 0-.632-.166.807.807 0 0 0-.634.551c-.056.191-.031.406.02.595.07.256.159.597.217.82 1.11.098 2.162.54 2.97 1.296 1.974 1.844 2.35 4.886.892 7.233-1.197 1.93-3.509 3.177-5.889 3.177zM0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0 0 5.373 0 12Z"/></symbol>',
'<symbol id="oc-icon-brand-github" viewBox="0 0 1024 1024"><path fill="currentColor" fill-rule="evenodd" d="M512 0C229.12 0 0 229.12 0 512c0 226.56 146.56 417.92 350.08 485.76 25.6 4.48 35.2-10.88 35.2-24.32 0-12.16-.64-52.48-.64-95.36-128.64 23.68-161.92-31.36-172.16-60.16-5.76-14.72-30.72-60.16-52.48-72.32-17.92-9.6-43.52-33.28-.64-33.92 40.32-.64 69.12 37.12 78.72 52.48 46.08 77.44 119.68 55.68 149.12 42.24 4.48-33.28 17.92-55.68 32.64-68.48-113.92-12.8-232.96-56.96-232.96-252.8 0-55.68 19.84-101.76 52.48-137.6-5.12-12.8-23.04-65.28 5.12-135.68 0 0 42.88-13.44 140.8 52.48 40.96-11.52 84.48-17.28 128-17.28s87.04 5.76 128 17.28c97.92-66.56 140.8-52.48 140.8-52.48 28.16 70.4 10.24 122.88 5.12 135.68 32.64 35.84 52.48 81.28 52.48 137.6 0 196.48-119.68 240-233.6 252.8 18.56 16 34.56 46.72 34.56 94.72 0 68.48-.64 123.52-.64 140.8 0 13.44 9.6 29.44 35.2 24.32C877.44 929.92 1024 737.92 1024 512 1024 229.12 794.88 0 512 0" clip-rule="evenodd"/></symbol>',
'<symbol id="oc-icon-brand-youtube" viewBox="0 0 256 180"><path fill="red" d="M250.346 28.075A32.18 32.18 0 0 0 227.69 5.418C207.824 0 127.87 0 127.87 0S47.912.164 28.046 5.582A32.18 32.18 0 0 0 5.39 28.24c-6.009 35.298-8.34 89.084.165 122.97a32.18 32.18 0 0 0 22.656 22.657c19.866 5.418 99.822 5.418 99.822 5.418s79.955 0 99.82-5.418a32.18 32.18 0 0 0 22.657-22.657c6.338-35.348 8.291-89.1-.164-123.134Z"/><path fill="#FFF" d="m102.421 128.06 66.328-38.418-66.328-38.418z"/></symbol>',
'<symbol id="oc-icon-package" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16.5 9.4 7.55 4.24"/><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><polyline points="3.29 7 12 12 20.71 7"/><line x1="12" y1="22" x2="12" y2="12"/></symbol>',
'<symbol id="oc-icon-cpu" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="4" width="16" height="16" rx="2"/><rect x="9" y="9" width="6" height="6"/><line x1="9" y1="1" x2="9" y2="4"/><line x1="15" y1="1" x2="15" y2="4"/><line x1="9" y1="20" x2="9" y2="23"/><line x1="15" y1="20" x2="15" y2="23"/><line x1="20" y1="9" x2="23" y2="9"/><line x1="20" y1="14" x2="23" y2="14"/><line x1="1" y1="9" x2="4" y2="9"/><line x1="1" y1="14" x2="4" y2="14"/></symbol>',
'<symbol id="oc-icon-history" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8l0 4l2 2"/><path d="M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"/></symbol>'
].join('');
document.body.insertBefore(svg, document.body.firstChild);
@@ -1,3 +1,5 @@
// Guard: skip if already loaded (handles multi-template page loads)
_ocGuard: { if (window._ocSubconverterLoaded) break _ocGuard; window._ocSubconverterLoaded = true; }
(function(window, document) {
'use strict';