Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: support visualized explain for mssql (#18172)

ecmadaod81241233278
diff --git a/backend/generated-go/v1/sql_service.pb.go b/backend/generated-go/v1/sql_service.pb.go
index 749a850481..11acb75e30 100644
--- a/backend/generated-go/v1/sql_service.pb.go
+++ b/backend/generated-go/v1/sql_service.pb.go
@@ -77,6 +77,58 @@ func (QueryOption_RedisRunCommandsOn) EnumDescriptor() ([]byte, []int) {
return file_v1_sql_service_proto_rawDescGZIP(), []int{4, 0}
}
+type QueryOption_MSSQLExplainFormat int32
+
+const (
+ // defaults to SHOWPLAN_ALL
+ QueryOption_MSSQL_EXPLAIN_FORMAT_UNSPECIFIED QueryOption_MSSQLExplainFormat = 0
+ // SHOWPLAN_ALL
+ QueryOption_MSSQL_EXPLAIN_FORMAT_ALL QueryOption_MSSQLExplainFormat = 1
+ // SHOWPLAN_XML
+ QueryOption_MSSQL_EXPLAIN_FORMAT_XML QueryOption_MSSQLExplainFormat = 2
+)
+
+// Enum value maps for QueryOption_MSSQLExplainFormat.
+var (
+ QueryOption_MSSQLExplainFormat_name = map[int32]string{
+ 0: "MSSQL_EXPLAIN_FORMAT_UNSPECIFIED",
+ 1: "MSSQL_EXPLAIN_FORMAT_ALL",
+ 2: "MSSQL_EXPLAIN_FORMAT_XML",
+ }
+ QueryOption_MSSQLExplainFormat_value = map[string]int32{
+ "MSSQL_EXPLAIN_FORMAT_UNSPECIFIED": 0,
+ "MSSQL_EXPLAIN_FORMAT_ALL": 1,
+ "MSSQL_EXPLAIN_FORMAT_XML": 2,
+ }
+)
+
+func (x QueryOption_MSSQLExplainFormat) Enum() *QueryOption_MSSQLExplainFormat {
+ p := new(QueryOption_MSSQLExplainFormat)
+ *p = x
+ return p
+}
+
+func (x QueryOption_MSSQLExplainFormat) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (QueryOption_MSSQLExplainFormat) Descriptor() protoreflect.EnumDescriptor {
+ return file_v1_sql_service_proto_enumTypes[1].Descriptor()
+}
+
+func (QueryOption_MSSQLExplainFormat) Type() protoreflect.EnumType {
+ return &file_v1_sql_service_proto_enumTypes[1]
+}
+
+func (x QueryOption_MSSQLExplainFormat) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use QueryOption_MSSQLExplainFormat.Descriptor instead.
+func (QueryOption_MSSQLExplainFormat) EnumDescriptor() ([]byte, []int) {
+ return file_v1_sql_service_proto_rawDescGZIP(), []int{4, 1}
+}
+
type QueryResult_PermissionDenied_CommandType int32
const (
@@ -113,11 +165,11 @@ func (x QueryResult_PermissionDenied_CommandType) String() string {
}
func (QueryResult_PermissionDenied_CommandType) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_sql_service_proto_enumTypes[1].Descriptor()
+ return file_v1_sql_service_proto_enumTypes[2].Descriptor()
}
func (QueryResult_PermissionDenied_CommandType) Type() protoreflect.EnumType {
- return &file_v1_sql_service_proto_enumTypes[1]
+ return &file_v1_sql_service_proto_enumTypes[2]
}
func (x QueryResult_PermissionDenied_CommandType) Number() protoreflect.EnumNumber {
@@ -181,11 +233,11 @@ func (x QueryResult_Message_Level) String() string {
}
func (QueryResult_Message_Level) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_sql_service_proto_enumTypes[2].Descriptor()
+ return file_v1_sql_service_proto_enumTypes[3].Descriptor()
}
func (QueryResult_Message_Level) Type() protoreflect.EnumType {
- return &file_v1_sql_service_proto_enumTypes[2]
+ return &file_v1_sql_service_proto_enumTypes[3]
}
func (x QueryResult_Message_Level) Number() protoreflect.EnumNumber {
@@ -238,11 +290,11 @@ func (x Advice_Level) String() string {
}
func (Advice_Level) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_sql_service_proto_enumTypes[3].Descriptor()
+ return file_v1_sql_service_proto_enumTypes[4].Descriptor()
}
func (Advice_Level) Type() protoreflect.EnumType {
- return &file_v1_sql_service_proto_enumTypes[3]
+ return &file_v1_sql_service_proto_enumTypes[4]
}
func (x Advice_Level) Number() protoreflect.EnumNumber {
@@ -293,11 +345,11 @@ func (x Advice_RuleType) String() string {
}
func (Advice_RuleType) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_sql_service_proto_enumTypes[4].Descriptor()
+ return file_v1_sql_service_proto_enumTypes[5].Descriptor()
}
func (Advice_RuleType) Type() protoreflect.EnumType {
- return &file_v1_sql_service_proto_enumTypes[4]
+ return &file_v1_sql_service_proto_enumTypes[5]
}
func (x Advice_RuleType) Number() protoreflect.EnumNumber {
@@ -345,11 +397,11 @@ func (x QueryHistory_Type) String() string {
}
func (QueryHistory_Type) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_sql_service_proto_enumTypes[5].Descriptor()
+ return file_v1_sql_service_proto_enumTypes[6].Descriptor()
}
func (QueryHistory_Type) Type() protoreflect.EnumType {
- return &file_v1_sql_service_proto_enumTypes[5]
+ return &file_v1_sql_service_proto_enumTypes[6]
}
func (x QueryHistory_Type) Number() protoreflect.EnumNumber {
@@ -651,6 +703,7 @@ func (x *QueryResponse) GetResults() []*QueryResult {
type QueryOption struct {
state protoimpl.MessageState `protogen:"open.v1"`
RedisRunCommandsOn QueryOption_RedisRunCommandsOn `protobuf:"varint,1,opt,name=redis_run_commands_on,json=redisRunCommandsOn,proto3,enum=bytebase.v1.QueryOption_RedisRunCommandsOn" json:"redis_run_commands_on,omitempty"`
+ MssqlExplainFormat QueryOption_MSSQLExplainFormat `protobuf:"varint,2,opt,name=mssql_explain_format,json=mssqlExplainFormat,proto3,enum=bytebase.v1.QueryOption_MSSQLExplainFormat" json:"mssql_explain_format,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -692,6 +745,13 @@ func (x *QueryOption) GetRedisRunCommandsOn() QueryOption_RedisRunCommandsOn {
return QueryOption_REDIS_RUN_COMMANDS_ON_UNSPECIFIED
}
+func (x *QueryOption) GetMssqlExplainFormat() QueryOption_MSSQLExplainFormat {
+ if x != nil {
+ return x.MssqlExplainFormat
+ }
+ return QueryOption_MSSQL_EXPLAIN_FORMAT_UNSPECIFIED
+}
+
type QueryResult struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Column names of the query result.
@@ -2688,13 +2748,18 @@ const file_v1_sql_service_proto_rawDesc = "" +
"\n" +
"_containerJ\x04\b\x02\x10\x03\"I\n" +
"\rQueryResponse\x122\n" +
- "\aresults\x18\x01 \x03(\v2\x18.bytebase.v1.QueryResultR\aresultsJ\x04\b\x02\x10\x03\"\xca\x01\n" +
+ "\aresults\x18\x01 \x03(\v2\x18.bytebase.v1.QueryResultR\aresultsJ\x04\b\x02\x10\x03\"\xa1\x03\n" +
"\vQueryOption\x12^\n" +
- "\x15redis_run_commands_on\x18\x01 \x01(\x0e2+.bytebase.v1.QueryOption.RedisRunCommandsOnR\x12redisRunCommandsOn\"[\n" +
+ "\x15redis_run_commands_on\x18\x01 \x01(\x0e2+.bytebase.v1.QueryOption.RedisRunCommandsOnR\x12redisRunCommandsOn\x12]\n" +
+ "\x14mssql_explain_format\x18\x02 \x01(\x0e2+.bytebase.v1.QueryOption.MSSQLExplainFormatR\x12mssqlExplainFormat\"[\n" +
"\x12RedisRunCommandsOn\x12%\n" +
"!REDIS_RUN_COMMANDS_ON_UNSPECIFIED\x10\x00\x12\x0f\n" +
"\vSINGLE_NODE\x10\x01\x12\r\n" +
- "\tALL_NODES\x10\x02\"\x85\r\n" +
+ "\tALL_NODES\x10\x02\"v\n" +
+ "\x12MSSQLExplainFormat\x12$\n" +
+ " MSSQL_EXPLAIN_FORMAT_UNSPECIFIED\x10\x00\x12\x1c\n" +
+ "\x18MSSQL_EXPLAIN_FORMAT_ALL\x10\x01\x12\x1c\n" +
+ "\x18MSSQL_EXPLAIN_FORMAT_XML\x10\x02\"\x85\r\n" +
"\vQueryResult\x12!\n" +
"\fcolumn_names\x18\x01 \x03(\tR\vcolumnNames\x12*\n" +
"\x11column_type_names\x18\x02 \x03(\tR\x0fcolumnTypeNames\x12)\n" +
@@ -2898,111 +2963,113 @@ func file_v1_sql_service_proto_rawDescGZIP() []byte {
return file_v1_sql_service_proto_rawDescData
}
-var file_v1_sql_service_proto_enumTypes = make([]protoimpl.EnumInfo, 6)
+var file_v1_sql_service_proto_enumTypes = make([]protoimpl.EnumInfo, 7)
var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 29)
var file_v1_sql_service_proto_goTypes = []any{
(QueryOption_RedisRunCommandsOn)(0), // 0: bytebase.v1.QueryOption.RedisRunCommandsOn
- (QueryResult_PermissionDenied_CommandType)(0), // 1: bytebase.v1.QueryResult.PermissionDenied.CommandType
- (QueryResult_Message_Level)(0), // 2: bytebase.v1.QueryResult.Message.Level
- (Advice_Level)(0), // 3: bytebase.v1.Advice.Level
- (Advice_RuleType)(0), // 4: bytebase.v1.Advice.RuleType
- (QueryHistory_Type)(0), // 5: bytebase.v1.QueryHistory.Type
- (*AdminExecuteRequest)(nil), // 6: bytebase.v1.AdminExecuteRequest
- (*AdminExecuteResponse)(nil), // 7: bytebase.v1.AdminExecuteResponse
- (*QueryRequest)(nil), // 8: bytebase.v1.QueryRequest
- (*QueryResponse)(nil), // 9: bytebase.v1.QueryResponse
- (*QueryOption)(nil), // 10: bytebase.v1.QueryOption
- (*QueryResult)(nil), // 11: bytebase.v1.QueryResult
- (*MaskingReason)(nil), // 12: bytebase.v1.MaskingReason
- (*QueryRow)(nil), // 13: bytebase.v1.QueryRow
- (*RowValue)(nil), // 14: bytebase.v1.RowValue
- (*Advice)(nil), // 15: bytebase.v1.Advice
- (*ExportRequest)(nil), // 16: bytebase.v1.ExportRequest
- (*ExportResponse)(nil), // 17: bytebase.v1.ExportResponse
- (*DiffMetadataRequest)(nil), // 18: bytebase.v1.DiffMetadataRequest
- (*DiffMetadataResponse)(nil), // 19: bytebase.v1.DiffMetadataResponse
- (*SearchQueryHistoriesRequest)(nil), // 20: bytebase.v1.SearchQueryHistoriesRequest
- (*SearchQueryHistoriesResponse)(nil), // 21: bytebase.v1.SearchQueryHistoriesResponse
- (*QueryHistory)(nil), // 22: bytebase.v1.QueryHistory
- (*AICompletionRequest)(nil), // 23: bytebase.v1.AICompletionRequest
- (*AICompletionResponse)(nil), // 24: bytebase.v1.AICompletionResponse
- (*QueryResult_PostgresError)(nil), // 25: bytebase.v1.QueryResult.PostgresError
- (*QueryResult_SyntaxError)(nil), // 26: bytebase.v1.QueryResult.SyntaxError
- (*QueryResult_PermissionDenied)(nil), // 27: bytebase.v1.QueryResult.PermissionDenied
- (*QueryResult_Message)(nil), // 28: bytebase.v1.QueryResult.Message
- (*RowValue_Timestamp)(nil), // 29: bytebase.v1.RowValue.Timestamp
- (*RowValue_TimestampTZ)(nil), // 30: bytebase.v1.RowValue.TimestampTZ
- (*AICompletionRequest_Message)(nil), // 31: bytebase.v1.AICompletionRequest.Message
- (*AICompletionResponse_Candidate)(nil), // 32: bytebase.v1.AICompletionResponse.Candidate
- (*AICompletionResponse_Candidate_Content)(nil), // 33: bytebase.v1.AICompletionResponse.Candidate.Content
- (*AICompletionResponse_Candidate_Content_Part)(nil), // 34: bytebase.v1.AICompletionResponse.Candidate.Content.Part
- (*durationpb.Duration)(nil), // 35: google.protobuf.Duration
- (structpb.NullValue)(0), // 36: google.protobuf.NullValue
- (*structpb.Value)(nil), // 37: google.protobuf.Value
- (*Position)(nil), // 38: bytebase.v1.Position
- (ExportFormat)(0), // 39: bytebase.v1.ExportFormat
- (*DatabaseMetadata)(nil), // 40: bytebase.v1.DatabaseMetadata
- (*DatabaseCatalog)(nil), // 41: bytebase.v1.DatabaseCatalog
- (Engine)(0), // 42: bytebase.v1.Engine
- (*timestamppb.Timestamp)(nil), // 43: google.protobuf.Timestamp
+ (QueryOption_MSSQLExplainFormat)(0), // 1: bytebase.v1.QueryOption.MSSQLExplainFormat
+ (QueryResult_PermissionDenied_CommandType)(0), // 2: bytebase.v1.QueryResult.PermissionDenied.CommandType
+ (QueryResult_Message_Level)(0), // 3: bytebase.v1.QueryResult.Message.Level
+ (Advice_Level)(0), // 4: bytebase.v1.Advice.Level
+ (Advice_RuleType)(0), // 5: bytebase.v1.Advice.RuleType
+ (QueryHistory_Type)(0), // 6: bytebase.v1.QueryHistory.Type
+ (*AdminExecuteRequest)(nil), // 7: bytebase.v1.AdminExecuteRequest
+ (*AdminExecuteResponse)(nil), // 8: bytebase.v1.AdminExecuteResponse
+ (*QueryRequest)(nil), // 9: bytebase.v1.QueryRequest
+ (*QueryResponse)(nil), // 10: bytebase.v1.QueryResponse
+ (*QueryOption)(nil), // 11: bytebase.v1.QueryOption
+ (*QueryResult)(nil), // 12: bytebase.v1.QueryResult
+ (*MaskingReason)(nil), // 13: bytebase.v1.MaskingReason
+ (*QueryRow)(nil), // 14: bytebase.v1.QueryRow
+ (*RowValue)(nil), // 15: bytebase.v1.RowValue
+ (*Advice)(nil), // 16: bytebase.v1.Advice
+ (*ExportRequest)(nil), // 17: bytebase.v1.ExportRequest
+ (*ExportResponse)(nil), // 18: bytebase.v1.ExportResponse
+ (*DiffMetadataRequest)(nil), // 19: bytebase.v1.DiffMetadataRequest
+ (*DiffMetadataResponse)(nil), // 20: bytebase.v1.DiffMetadataResponse
+ (*SearchQueryHistoriesRequest)(nil), // 21: bytebase.v1.SearchQueryHistoriesRequest
+ (*SearchQueryHistoriesResponse)(nil), // 22: bytebase.v1.SearchQueryHistoriesResponse
+ (*QueryHistory)(nil), // 23: bytebase.v1.QueryHistory
+ (*AICompletionRequest)(nil), // 24: bytebase.v1.AICompletionRequest
+ (*AICompletionResponse)(nil), // 25: bytebase.v1.AICompletionResponse
+ (*QueryResult_PostgresError)(nil), // 26: bytebase.v1.QueryResult.PostgresError
+ (*QueryResult_SyntaxError)(nil), // 27: bytebase.v1.QueryResult.SyntaxError
+ (*QueryResult_PermissionDenied)(nil), // 28: bytebase.v1.QueryResult.PermissionDenied
+ (*QueryResult_Message)(nil), // 29: bytebase.v1.QueryResult.Message
+ (*RowValue_Timestamp)(nil), // 30: bytebase.v1.RowValue.Timestamp
+ (*RowValue_TimestampTZ)(nil), // 31: bytebase.v1.RowValue.TimestampTZ
+ (*AICompletionRequest_Message)(nil), // 32: bytebase.v1.AICompletionRequest.Message
+ (*AICompletionResponse_Candidate)(nil), // 33: bytebase.v1.AICompletionResponse.Candidate
+ (*AICompletionResponse_Candidate_Content)(nil), // 34: bytebase.v1.AICompletionResponse.Candidate.Content
+ (*AICompletionResponse_Candidate_Content_Part)(nil), // 35: bytebase.v1.AICompletionResponse.Candidate.Content.Part
+ (*durationpb.Duration)(nil), // 36: google.protobuf.Duration
+ (structpb.NullValue)(0), // 37: google.protobuf.NullValue
+ (*structpb.Value)(nil), // 38: google.protobuf.Value
+ (*Position)(nil), // 39: bytebase.v1.Position
+ (ExportFormat)(0), // 40: bytebase.v1.ExportFormat
+ (*DatabaseMetadata)(nil), // 41: bytebase.v1.DatabaseMetadata
+ (*DatabaseCatalog)(nil), // 42: bytebase.v1.DatabaseCatalog
+ (Engine)(0), // 43: bytebase.v1.Engine
+ (*timestamppb.Timestamp)(nil), // 44: google.protobuf.Timestamp
}
var file_v1_sql_service_proto_depIdxs = []int32{
- 11, // 0: bytebase.v1.AdminExecuteResponse.results:type_name -> bytebase.v1.QueryResult
- 10, // 1: bytebase.v1.QueryRequest.query_option:type_name -> bytebase.v1.QueryOption
- 11, // 2: bytebase.v1.QueryResponse.results:type_name -> bytebase.v1.QueryResult
+ 12, // 0: bytebase.v1.AdminExecuteResponse.results:type_name -> bytebase.v1.QueryResult
+ 11, // 1: bytebase.v1.QueryRequest.query_option:type_name -> bytebase.v1.QueryOption
+ 12, // 2: bytebase.v1.QueryResponse.results:type_name -> bytebase.v1.QueryResult
0, // 3: bytebase.v1.QueryOption.redis_run_commands_on:type_name -> bytebase.v1.QueryOption.RedisRunCommandsOn
- 13, // 4: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow
- 35, // 5: bytebase.v1.QueryResult.latency:type_name -> google.protobuf.Duration
- 25, // 6: bytebase.v1.QueryResult.postgres_error:type_name -> bytebase.v1.QueryResult.PostgresError
- 26, // 7: bytebase.v1.QueryResult.syntax_error:type_name -> bytebase.v1.QueryResult.SyntaxError
- 27, // 8: bytebase.v1.QueryResult.permission_denied:type_name -> bytebase.v1.QueryResult.PermissionDenied
- 28, // 9: bytebase.v1.QueryResult.messages:type_name -> bytebase.v1.QueryResult.Message
- 12, // 10: bytebase.v1.QueryResult.masked:type_name -> bytebase.v1.MaskingReason
- 14, // 11: bytebase.v1.QueryRow.values:type_name -> bytebase.v1.RowValue
- 36, // 12: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue
- 37, // 13: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value
- 29, // 14: bytebase.v1.RowValue.timestamp_value:type_name -> bytebase.v1.RowValue.Timestamp
- 30, // 15: bytebase.v1.RowValue.timestamp_tz_value:type_name -> bytebase.v1.RowValue.TimestampTZ
- 3, // 16: bytebase.v1.Advice.status:type_name -> bytebase.v1.Advice.Level
- 38, // 17: bytebase.v1.Advice.start_position:type_name -> bytebase.v1.Position
- 38, // 18: bytebase.v1.Advice.end_position:type_name -> bytebase.v1.Position
- 4, // 19: bytebase.v1.Advice.rule_type:type_name -> bytebase.v1.Advice.RuleType
- 39, // 20: bytebase.v1.ExportRequest.format:type_name -> bytebase.v1.ExportFormat
- 40, // 21: bytebase.v1.DiffMetadataRequest.source_metadata:type_name -> bytebase.v1.DatabaseMetadata
- 40, // 22: bytebase.v1.DiffMetadataRequest.target_metadata:type_name -> bytebase.v1.DatabaseMetadata
- 41, // 23: bytebase.v1.DiffMetadataRequest.source_catalog:type_name -> bytebase.v1.DatabaseCatalog
- 41, // 24: bytebase.v1.DiffMetadataRequest.target_catalog:type_name -> bytebase.v1.DatabaseCatalog
- 42, // 25: bytebase.v1.DiffMetadataRequest.engine:type_name -> bytebase.v1.Engine
- 22, // 26: bytebase.v1.SearchQueryHistoriesResponse.query_histories:type_name -> bytebase.v1.QueryHistory
- 43, // 27: bytebase.v1.QueryHistory.create_time:type_name -> google.protobuf.Timestamp
- 35, // 28: bytebase.v1.QueryHistory.duration:type_name -> google.protobuf.Duration
- 5, // 29: bytebase.v1.QueryHistory.type:type_name -> bytebase.v1.QueryHistory.Type
- 31, // 30: bytebase.v1.AICompletionRequest.messages:type_name -> bytebase.v1.AICompletionRequest.Message
- 32, // 31: bytebase.v1.AICompletionResponse.candidates:type_name -> bytebase.v1.AICompletionResponse.Candidate
- 38, // 32: bytebase.v1.QueryResult.SyntaxError.start_position:type_name -> bytebase.v1.Position
- 1, // 33: bytebase.v1.QueryResult.PermissionDenied.command_type:type_name -> bytebase.v1.QueryResult.PermissionDenied.CommandType
- 2, // 34: bytebase.v1.QueryResult.Message.level:type_name -> bytebase.v1.QueryResult.Message.Level
- 43, // 35: bytebase.v1.RowValue.Timestamp.google_timestamp:type_name -> google.protobuf.Timestamp
- 43, // 36: bytebase.v1.RowValue.TimestampTZ.google_timestamp:type_name -> google.protobuf.Timestamp
- 33, // 37: bytebase.v1.AICompletionResponse.Candidate.content:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content
- 34, // 38: bytebase.v1.AICompletionResponse.Candidate.Content.parts:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content.Part
- 8, // 39: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest
- 6, // 40: bytebase.v1.SQLService.AdminExecute:input_type -> bytebase.v1.AdminExecuteRequest
- 20, // 41: bytebase.v1.SQLService.SearchQueryHistories:input_type -> bytebase.v1.SearchQueryHistoriesRequest
- 16, // 42: bytebase.v1.SQLService.Export:input_type -> bytebase.v1.ExportRequest
- 18, // 43: bytebase.v1.SQLService.DiffMetadata:input_type -> bytebase.v1.DiffMetadataRequest
- 23, // 44: bytebase.v1.SQLService.AICompletion:input_type -> bytebase.v1.AICompletionRequest
- 9, // 45: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse
- 7, // 46: bytebase.v1.SQLService.AdminExecute:output_type -> bytebase.v1.AdminExecuteResponse
- 21, // 47: bytebase.v1.SQLService.SearchQueryHistories:output_type -> bytebase.v1.SearchQueryHistoriesResponse
- 17, // 48: bytebase.v1.SQLService.Export:output_type -> bytebase.v1.ExportResponse
- 19, // 49: bytebase.v1.SQLService.DiffMetadata:output_type -> bytebase.v1.DiffMetadataResponse
- 24, // 50: bytebase.v1.SQLService.AICompletion:output_type -> bytebase.v1.AICompletionResponse
- 45, // [45:51] is the sub-list for method output_type
- 39, // [39:45] is the sub-list for method input_type
- 39, // [39:39] is the sub-list for extension type_name
- 39, // [39:39] is the sub-list for extension extendee
- 0, // [0:39] is the sub-list for field type_name
+ 1, // 4: bytebase.v1.QueryOption.mssql_explain_format:type_name -> bytebase.v1.QueryOption.MSSQLExplainFormat
+ 14, // 5: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow
+ 36, // 6: bytebase.v1.QueryResult.latency:type_name -> google.protobuf.Duration
+ 26, // 7: bytebase.v1.QueryResult.postgres_error:type_name -> bytebase.v1.QueryResult.PostgresError
+ 27, // 8: bytebase.v1.QueryResult.syntax_error:type_name -> bytebase.v1.QueryResult.SyntaxError
+ 28, // 9: bytebase.v1.QueryResult.permission_denied:type_name -> bytebase.v1.QueryResult.PermissionDenied
+ 29, // 10: bytebase.v1.QueryResult.messages:type_name -> bytebase.v1.QueryResult.Message
+ 13, // 11: bytebase.v1.QueryResult.masked:type_name -> bytebase.v1.MaskingReason
+ 15, // 12: bytebase.v1.QueryRow.values:type_name -> bytebase.v1.RowValue
+ 37, // 13: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue
+ 38, // 14: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value
+ 30, // 15: bytebase.v1.RowValue.timestamp_value:type_name -> bytebase.v1.RowValue.Timestamp
+ 31, // 16: bytebase.v1.RowValue.timestamp_tz_value:type_name -> bytebase.v1.RowValue.TimestampTZ
+ 4, // 17: bytebase.v1.Advice.status:type_name -> bytebase.v1.Advice.Level
+ 39, // 18: bytebase.v1.Advice.start_position:type_name -> bytebase.v1.Position
+ 39, // 19: bytebase.v1.Advice.end_position:type_name -> bytebase.v1.Position
+ 5, // 20: bytebase.v1.Advice.rule_type:type_name -> bytebase.v1.Advice.RuleType
+ 40, // 21: bytebase.v1.ExportRequest.format:type_name -> bytebase.v1.ExportFormat
+ 41, // 22: bytebase.v1.DiffMetadataRequest.source_metadata:type_name -> bytebase.v1.DatabaseMetadata
+ 41, // 23: bytebase.v1.DiffMetadataRequest.target_metadata:type_name -> bytebase.v1.DatabaseMetadata
+ 42, // 24: bytebase.v1.DiffMetadataRequest.source_catalog:type_name -> bytebase.v1.DatabaseCatalog
+ 42, // 25: bytebase.v1.DiffMetadataRequest.target_catalog:type_name -> bytebase.v1.DatabaseCatalog
+ 43, // 26: bytebase.v1.DiffMetadataRequest.engine:type_name -> bytebase.v1.Engine
+ 23, // 27: bytebase.v1.SearchQueryHistoriesResponse.query_histories:type_name -> bytebase.v1.QueryHistory
+ 44, // 28: bytebase.v1.QueryHistory.create_time:type_name -> google.protobuf.Timestamp
+ 36, // 29: bytebase.v1.QueryHistory.duration:type_name -> google.protobuf.Duration
+ 6, // 30: bytebase.v1.QueryHistory.type:type_name -> bytebase.v1.QueryHistory.Type
+ 32, // 31: bytebase.v1.AICompletionRequest.messages:type_name -> bytebase.v1.AICompletionRequest.Message
+ 33, // 32: bytebase.v1.AICompletionResponse.candidates:type_name -> bytebase.v1.AICompletionResponse.Candidate
+ 39, // 33: bytebase.v1.QueryResult.SyntaxError.start_position:type_name -> bytebase.v1.Position
+ 2, // 34: bytebase.v1.QueryResult.PermissionDenied.command_type:type_name -> bytebase.v1.QueryResult.PermissionDenied.CommandType
+ 3, // 35: bytebase.v1.QueryResult.Message.level:type_name -> bytebase.v1.QueryResult.Message.Level
+ 44, // 36: bytebase.v1.RowValue.Timestamp.google_timestamp:type_name -> google.protobuf.Timestamp
+ 44, // 37: bytebase.v1.RowValue.TimestampTZ.google_timestamp:type_name -> google.protobuf.Timestamp
+ 34, // 38: bytebase.v1.AICompletionResponse.Candidate.content:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content
+ 35, // 39: bytebase.v1.AICompletionResponse.Candidate.Content.parts:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content.Part
+ 9, // 40: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest
+ 7, // 41: bytebase.v1.SQLService.AdminExecute:input_type -> bytebase.v1.AdminExecuteRequest
+ 21, // 42: bytebase.v1.SQLService.SearchQueryHistories:input_type -> bytebase.v1.SearchQueryHistoriesRequest
+ 17, // 43: bytebase.v1.SQLService.Export:input_type -> bytebase.v1.ExportRequest
+ 19, // 44: bytebase.v1.SQLService.DiffMetadata:input_type -> bytebase.v1.DiffMetadataRequest
+ 24, // 45: bytebase.v1.SQLService.AICompletion:input_type -> bytebase.v1.AICompletionRequest
+ 10, // 46: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse
+ 8, // 47: bytebase.v1.SQLService.AdminExecute:output_type -> bytebase.v1.AdminExecuteResponse
+ 22, // 48: bytebase.v1.SQLService.SearchQueryHistories:output_type -> bytebase.v1.SearchQueryHistoriesResponse
+ 18, // 49: bytebase.v1.SQLService.Export:output_type -> bytebase.v1.ExportResponse
+ 20, // 50: bytebase.v1.SQLService.DiffMetadata:output_type -> bytebase.v1.DiffMetadataResponse
+ 25, // 51: bytebase.v1.SQLService.AICompletion:output_type -> bytebase.v1.AICompletionResponse
+ 46, // [46:52] is the sub-list for method output_type
+ 40, // [40:46] is the sub-list for method input_type
+ 40, // [40:40] is the sub-list for extension type_name
+ 40, // [40:40] is the sub-list for extension extendee
+ 0, // [0:40] is the sub-list for field type_name
}
func init() { file_v1_sql_service_proto_init() }
@@ -3043,7 +3110,7 @@ func file_v1_sql_service_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_sql_service_proto_rawDesc), len(file_v1_sql_service_proto_rawDesc)),
- NumEnums: 6,
+ NumEnums: 7,
NumMessages: 29,
NumExtensions: 0,
NumServices: 1,
diff --git a/backend/generated-go/v1/sql_service_equal.pb.go b/backend/generated-go/v1/sql_service_equal.pb.go
index f44a11d407..b16e7efa04 100644
--- a/backend/generated-go/v1/sql_service_equal.pb.go
+++ b/backend/generated-go/v1/sql_service_equal.pb.go
@@ -114,6 +114,9 @@ func (x *QueryOption) Equal(y *QueryOption) bool {
if x.RedisRunCommandsOn != y.RedisRunCommandsOn {
return false
}
+ if x.MssqlExplainFormat != y.MssqlExplainFormat {
+ return false
+ }
return true
}
diff --git a/backend/plugin/db/mssql/mssql.go b/backend/plugin/db/mssql/mssql.go
index 0284839d0a..38d75ceb9c 100644
--- a/backend/plugin/db/mssql/mssql.go
+++ b/backend/plugin/db/mssql/mssql.go
@@ -424,22 +424,26 @@ func (*Driver) queryBatch(ctx context.Context, conn *sql.Conn, batch string, que
return nil, nil
}
- // Special handling for EXPLAIN queries in MSSQL using SHOWPLAN_ALL
+ // Special handling for EXPLAIN queries in MSSQL using explain
if queryContext.Explain {
- // Enable SHOWPLAN_ALL mode once for all statements
- if _, err := conn.ExecContext(ctx, "SET SHOWPLAN_ALL ON"); err != nil {
- return nil, errors.Wrap(err, "failed to enable SHOWPLAN_ALL mode")
+ explain := "SHOWPLAN_ALL"
+ if queryContext.Option.MssqlExplainFormat == v1pb.QueryOption_MSSQL_EXPLAIN_FORMAT_XML {
+ explain = "SHOWPLAN_XML"
}
- // Ensure SHOWPLAN_ALL is turned off after processing
+ // Enable explain mode once for all statements
+ if _, err := conn.ExecContext(ctx, fmt.Sprintf("SET %s ON", explain)); err != nil {
+ return nil, errors.Wrap(err, "failed to enable explain mode")
+ }
+ // Ensure explain is turned off after processing
defer func() {
- if _, err := conn.ExecContext(ctx, "SET SHOWPLAN_ALL OFF"); err != nil {
- slog.Warn("failed to disable SHOWPLAN_ALL mode", log.BBError(err))
+ if _, err := conn.ExecContext(ctx, fmt.Sprintf("SET %s OFF", explain)); err != nil {
+ slog.Warn("failed to disable explain mode", log.BBError(err))
}
}()
var results []*v1pb.QueryResult
- // Process each statement with SHOWPLAN_ALL enabled
+ // Process each statement with explain enabled
for _, singleSQL := range singleSQLs {
startTime := time.Now()
diff --git a/backend/plugin/db/util/driverutil.go b/backend/plugin/db/util/driverutil.go
index bab6bd14da..ef943b75a5 100644
--- a/backend/plugin/db/util/driverutil.go
+++ b/backend/plugin/db/util/driverutil.go
@@ -81,7 +81,7 @@ func RowsToQueryResult(rows *sql.Rows, valueMaker func(string, *sql.ColumnType)
}
row := &v1pb.QueryRow{}
- for i := 0; i < columnLength; i++ {
+ for i := range columnLength {
row.Values = append(row.Values, rowValueConverter(columnTypeNames[i], columnTypes[i], values[i]))
}
diff --git a/frontend/biome.json b/frontend/biome.json
index ea101190e3..d0b4b2d51e 100644
--- a/frontend/biome.json
+++ b/frontend/biome.json
@@ -189,6 +189,11 @@
"formatter": { "enabled": false },
"linter": { "enabled": false }
},
+ {
+ "includes": ["public/libs/**"],
+ "formatter": { "enabled": false },
+ "linter": { "enabled": false }
+ },
{
"includes": [
"src/shims-3rd-party.d.ts",
diff --git a/frontend/package.json b/frontend/package.json
index f5d351e309..31de8c022b 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -13,7 +13,7 @@
"type-check": "export NODE_OPTIONS=--max_old_space_size=8000 && vue-tsc --build --force",
"test": "vitest run --passWithNoTests",
"coverage": "vitest --coverage",
- "i18n": "TS_NODE_PROJECT='./tsconfig.i18n.json' ts-node i18n.ts && eslint --cache src --fix",
+ "i18n": "TS_NODE_PROJECT='./tsconfig.i18n.json' ts-node i18n.ts && pnpm biome:check",
"biome:format": "biome format --write .",
"biome:lint": "biome lint --write .",
"biome:check": "biome check --write .",
@@ -46,6 +46,7 @@
"emittery": "^1.2.0",
"file-saver": "^2.0.5",
"highlight.js": "11.11.1",
+ "html-query-plan": "^2.6.1",
"html-to-image": "^1.11.13",
"is-chinese": "^2.0.0",
"js-yaml": "4.1.1",
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 96085c7864..4f84b0ae93 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -88,6 +88,9 @@ importers:
highlight.js:
specifier: 11.11.1
version: 11.11.1
+ html-query-plan:
+ specifier: ^2.6.1
+ version: 2.6.1
html-to-image:
specifier: ^1.11.13
version: 1.11.13
@@ -1682,152 +1685,158 @@ packages:
'@emotion/[email protected]':
resolution: {integrity: sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==}
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==}
engines: {node: '>=18'}
cpu: [ppc64]
os: [aix]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==}
engines: {node: '>=18'}
cpu: [arm64]
os: [android]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==}
engines: {node: '>=18'}
cpu: [arm]
os: [android]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==}
engines: {node: '>=18'}
cpu: [x64]
os: [android]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==}
engines: {node: '>=18'}
cpu: [arm64]
os: [darwin]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==}
engines: {node: '>=18'}
cpu: [x64]
os: [darwin]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==}
engines: {node: '>=18'}
cpu: [arm64]
os: [freebsd]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==}
engines: {node: '>=18'}
cpu: [x64]
os: [freebsd]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==}
engines: {node: '>=18'}
cpu: [arm64]
os: [linux]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==}
engines: {node: '>=18'}
cpu: [arm]
os: [linux]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==}
engines: {node: '>=18'}
cpu: [ia32]
os: [linux]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==}
engines: {node: '>=18'}
cpu: [loong64]
os: [linux]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==}
engines: {node: '>=18'}
cpu: [mips64el]
os: [linux]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==}
engines: {node: '>=18'}
cpu: [ppc64]
os: [linux]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==}
engines: {node: '>=18'}
cpu: [riscv64]
os: [linux]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==}
engines: {node: '>=18'}
cpu: [s390x]
os: [linux]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==}
engines: {node: '>=18'}
cpu: [x64]
os: [linux]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==}
engines: {node: '>=18'}
cpu: [arm64]
os: [netbsd]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==}
engines: {node: '>=18'}
cpu: [x64]
os: [netbsd]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==}
engines: {node: '>=18'}
cpu: [arm64]
os: [openbsd]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==}
engines: {node: '>=18'}
cpu: [x64]
os: [openbsd]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==}
+ engines: {node: '>=18'}
+ cpu: [arm64]
+ os: [openharmony]
+
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==}
engines: {node: '>=18'}
cpu: [x64]
os: [sunos]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==}
engines: {node: '>=18'}
cpu: [arm64]
os: [win32]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==}
engines: {node: '>=18'}
cpu: [ia32]
os: [win32]
- '@esbuild/[email protected]':
- resolution: {integrity: sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==}
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==}
engines: {node: '>=18'}
cpu: [x64]
os: [win32]
@@ -3297,8 +3306,8 @@ packages:
resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==}
engines: {node: '>= 0.4'}
- resolution: {integrity: sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==}
+ resolution: {integrity: sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==}
engines: {node: '>=18'}
hasBin: true
@@ -3562,6 +3571,9 @@ packages:
resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==}
engines: {node: '>=18'}
+ resolution: {integrity: sha512-8LoHDSOFGu4RKXit8we3ydE5W5qJFYg/hKtCfrV+hUnqhOssVDAgaxoJ2NNyF+eDkeXaicbJ/FBhz2/NmI4KuQ==}
+
resolution: {integrity: sha512-cuOPoI7WApyhBElTTb9oqsawRvZ0rHhaHwghRLlTuffoD1B2aDemlCruLeZrUIIdvG7gs9xeELEPm6PhuASqrg==}
@@ -6061,7 +6073,7 @@ snapshots:
'@codingame/[email protected]':
dependencies:
- esbuild: 0.25.5
+ esbuild: 0.25.12
import-meta-resolve: 4.1.0
'@codingame/[email protected]':
@@ -7346,79 +7358,82 @@ snapshots:
'@emotion/[email protected]': {}
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
+ optional: true
+
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
- '@esbuild/[email protected]':
+ '@esbuild/[email protected]':
optional: true
@@ -7520,7 +7535,7 @@ snapshots:
'@intlify/message-compiler': 11.1.12
'@intlify/shared': 11.1.12
acorn: 8.15.0
- esbuild: 0.25.5
+ esbuild: 0.25.12
escodegen: 2.1.0
estree-walker: 2.0.2
jsonc-eslint-parser: 2.4.0
@@ -8990,33 +9005,34 @@ snapshots:
dependencies:
es-errors: 1.3.0
optionalDependencies:
- '@esbuild/aix-ppc64': 0.25.5
- '@esbuild/android-arm': 0.25.5
- '@esbuild/android-arm64': 0.25.5
- '@esbuild/android-x64': 0.25.5
- '@esbuild/darwin-arm64': 0.25.5
- '@esbuild/darwin-x64': 0.25.5
- '@esbuild/freebsd-arm64': 0.25.5
- '@esbuild/freebsd-x64': 0.25.5
- '@esbuild/linux-arm': 0.25.5
- '@esbuild/linux-arm64': 0.25.5
- '@esbuild/linux-ia32': 0.25.5
- '@esbuild/linux-loong64': 0.25.5
- '@esbuild/linux-mips64el': 0.25.5
- '@esbuild/linux-ppc64': 0.25.5
- '@esbuild/linux-riscv64': 0.25.5
- '@esbuild/linux-s390x': 0.25.5
- '@esbuild/linux-x64': 0.25.5
- '@esbuild/netbsd-arm64': 0.25.5
- '@esbuild/netbsd-x64': 0.25.5
- '@esbuild/openbsd-arm64': 0.25.5
- '@esbuild/openbsd-x64': 0.25.5
- '@esbuild/sunos-x64': 0.25.5
- '@esbuild/win32-arm64': 0.25.5
- '@esbuild/win32-ia32': 0.25.5
- '@esbuild/win32-x64': 0.25.5
+ '@esbuild/aix-ppc64': 0.25.12
+ '@esbuild/android-arm': 0.25.12
+ '@esbuild/android-arm64': 0.25.12
+ '@esbuild/android-x64': 0.25.12
+ '@esbuild/darwin-arm64': 0.25.12
+ '@esbuild/darwin-x64': 0.25.12
+ '@esbuild/freebsd-arm64': 0.25.12
+ '@esbuild/freebsd-x64': 0.25.12
+ '@esbuild/linux-arm': 0.25.12
+ '@esbuild/linux-arm64': 0.25.12
+ '@esbuild/linux-ia32': 0.25.12
+ '@esbuild/linux-loong64': 0.25.12
+ '@esbuild/linux-mips64el': 0.25.12
+ '@esbuild/linux-ppc64': 0.25.12
+ '@esbuild/linux-riscv64': 0.25.12
+ '@esbuild/linux-s390x': 0.25.12
+ '@esbuild/linux-x64': 0.25.12
+ '@esbuild/netbsd-arm64': 0.25.12
+ '@esbuild/netbsd-x64': 0.25.12
+ '@esbuild/openbsd-arm64': 0.25.12
+ '@esbuild/openbsd-x64': 0.25.12
+ '@esbuild/openharmony-arm64': 0.25.12
+ '@esbuild/sunos-x64': 0.25.12
+ '@esbuild/win32-arm64': 0.25.12
+ '@esbuild/win32-ia32': 0.25.12
+ '@esbuild/win32-x64': 0.25.12
@@ -9281,6 +9297,8 @@ snapshots:
dependencies:
whatwg-encoding: 3.1.1
+
@@ -10926,7 +10944,7 @@ snapshots:
dependencies:
- esbuild: 0.25.5
+ esbuild: 0.25.12
fdir: 6.5.0([email protected])
picomatch: 4.0.3
postcss: 8.5.6
diff --git a/frontend/public/libs/qp.min.js b/frontend/public/libs/qp.min.js
new file mode 100755
index 0000000000..5837b2077f
--- /dev/null
+++ b/frontend/public/libs/qp.min.js
@@ -0,0 +1,11 @@
+!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.QP=e():t.QP=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1);function i(t,e){for(var n=[],r=0;r<t.length;r++)t[r].nodeName===e&&n.push(t[r]);return n}function s(t,e,n){var r=t.querySelector('[StatementId="'+e+'"]');if(!n)return r;for(var i=r.getElementsByTagName("RelOp"),s=0;s<i.length;s++){var a=i[s];if(a.attributes.NodeId&&a.attributes.NodeId.value==n)return a}return null}var a=function(){function t(t){if(this.element=t,!this.element)throw new Error("element cannot be null");if("RelOp"!=this.element.tagName)throw new Error("element must be a RelOp element")}return Object.defineProperty(t.prototype,"estimatedRows",{get:function(){return parseFloat(this.element.attributes.EstimateRows.value)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"estimatedRowSize",{get:function(){return parseInt(this.element.attributes.AvgRowSize.value)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"estimatedDataSize",{get:function(){return Math.round(this.estimatedRowSize*this.estimatedRows)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"runtimeCountersPerThread",{get:function(){var t=i(this.element.childNodes,"RunTimeInformation");return 0==t.length?[]:i(t[0].childNodes,"RunTimeCountersPerThread")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"actualRows",{get:function(){return 0==this.runtimeCountersPerThread.length?null:this.runtimeCountersPerThread.reduce(function(t,e){return t+parseFloat(e.attributes.ActualRows.value)},0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"actualRowsRead",{get:function(){return 0!=this.runtimeCountersPerThread.length&&this.runtimeCountersPerThread[0].attributes.ActualRowsRead?this.runtimeCountersPerThread.reduce(function(t,e){return t+parseFloat(e.attributes.ActualRowsRead.value)},0):null},enumerable:!0,configurable:!0}),t}();e.RelOp=a;var l=function(){function t(t){if(this.element=t,!this.element)throw new Error("element cannot be null");if("qp-node"!=this.element.className)throw new Error("element must have class qp-node")}return Object.defineProperty(t.prototype,"children",{get:function(){return[].slice.call(r.findAncestor(this.element,"qp-tr").children[1].children).map(function(e){return new t(e.children[0].children[0].children[0])})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeId",{get:function(){var t=this.element.attributes["data-node-id"];return t&&t.value},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"statementId",{get:function(){return r.findAncestorP(this.element,function(t){return t.hasAttribute("data-statement-id")}).attributes["data-statement-id"].value},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"queryPlanXml",{get:function(){var t=r.findAncestor(this.element,"qp-root");return null==t?null:t.parentElement.xml},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeXml",{get:function(){return null==this.queryPlanXml?null:s(this.queryPlanXml,this.statementId,this.nodeId)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"relOp",{get:function(){var t=this.nodeXml;return t&&"RelOp"==t.tagName?new a(this.nodeXml):null},enumerable:!0,configurable:!0}),t}();e.Node=l;var o=function(){function t(t){if(this.element=t,!this.element)throw new Error("element cannot be null");if("polyline"!=this.element.nodeName)throw new Error("element must be a polyline")}return Object.defineProperty(t.prototype,"nodeId",{get:function(){var t=this.element.attributes["data-node-id"];return t&&t.value},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"statementId",{get:function(){return this.element.attributes["data-statement-id"].value},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"queryPlanXml",{get:function(){return r.findAncestor(this.element,"qp-root").parentElement.xml},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeXml",{get:function(){return s(this.queryPlanXml,this.statementId,this.nodeId)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"relOp",{get:function(){var t=this.nodeXml;return t&&"RelOp"==t.tagName?new a(this.nodeXml):null},enumerable:!0,configurable:!0}),t}();e.Line=o},function(t,e,n){"use strict";function r(t,e){if(null===t)return null;for(;(t=t.parentElement)&&t&&!e(t););return t}function i(t,e){return(" "+t.className+" ").indexOf(" "+e+" ")>-1}Object.defineProperty(e,"__esModule",{value:!0}),e.findAncestor=function(t,e){return r(t,function(t){return i(t,e)})},e.findAncestorP=r,e.hasClass=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=n(4);e.drawLines=i.drawLines;var s=n(6),a=n(0);e.Node=a.Node;var l=n(7);e.showPlan=function(t,e,n){n=function(t,e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}(n,{jsTooltips:!0}),r.setContentsUsingXslt(t,e,l),t.xml=(new DOMParser).parseFromString(e,"text/xml"),i.drawLines(t),n.jsTooltips&&s.initTooltip(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setContentsUsingXslt=function(t,e,n){if(window.ActiveXObject||"ActiveXObject"in window){var r=new ActiveXObject("Microsoft.xmlDOM");r.async=!1,r.loadXML(n);var i=new ActiveXObject("Microsoft.xmlDOM");i.async=!1,i.loadXML(e);var s=i.transformNode(r);t.innerHTML=s}else if(document.implementation&&document.implementation.createDocument){var a=new DOMParser,l=new XSLTProcessor;l.importStylesheet(a.parseFromString(n,"text/xml")),s=l.transformToFragment(a.parseFromString(e,"text/xml"),document),t.innerHTML="",t.appendChild(s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(5),i=n(0),s=5;function a(t,e){for(var n=[],r=-(t.reduce(function(t,e){return t+e},0)+(t.length-1)*e)/2,i=0;i<t.length;i++){var s=r+t[i];n.push((s+r)/2),r=s+e}return n}function l(t){var e=0;return null!=t.relOp&&(e=null==t.relOp.actualRows?t.relOp.estimatedRows:t.relOp.actualRows),Math.max(2,Math.min(Math.floor(Math.log(e>0?e:1)),12))}function o(t,e,n){var r=n.children,i=r.map(l);!function(t,e){t.element.parentElement.parentElement.style.paddingRight=e+"px"}(n,i.reduce(function(t,e){return t+e},0)+s*(r.length-1));for(var o=a(i,s),u=0;u<r.length;u++)h(t,e,n,r[u],i[u],o[u])}function h(t,e,n,r,i,s){var a=n.element.getBoundingClientRect(),l=r.element.getBoundingClientRect(),o=a.right,h=(a.top+a.bottom)/2,c=l.left,m=(l.top+l.bottom)/2;Math.abs(m-h)<5&&(m=h);var p=o/2+c/2;!function(t,e,n,r,i,s,a){var l=u(e,n,r,i),o=t.polyline(l).fill("#E3E3E3").stroke({color:"#505050",width:.5}).data("statement-id",a);s&&o.data("node-id",s)}(t,{x:o-e.left+1,y:h-e.top+s},{x:l.left-e.left-1,y:m-e.top},p-e.left-s,i,r.nodeId,r.statementId)}function u(t,e,n,r){var i=r/2;return[[t.x,t.y],[t.x+i+2,t.y-(i+2)],[t.x+i+2,t.y-i],[n+(t.y<=e.y?i:-i),t.y-i],[n+(t.y<=e.y?i:-i),e.y-i],[e.x,e.y-i],[e.x,e.y+i],[n+(t.y<=e.y?-i:i),e.y+i],[n+(t.y<=e.y?-i:i),t.y+i],[t.x+i+2,t.y+i],[t.x+i+2,t.y+i+2],[t.x,t.y]]}e.drawLines=function(t){for(var e=t.querySelector(".qp-root"),n=r(e),s=e.getBoundingClientRect(),a=e.querySelectorAll(".qp-node"),l=0;l<a.length;l++)o(n,s,new i.Node(a[l]))},e.thicknessesToOffsets=a,e.nodeToThickness=l,e.arrowPath=u},function(t,e,n){var r;
+/*!
+* svg.js - A lightweight library for manipulating and animating SVG.
+* @version 2.6.2
+* https://svgdotjs.github.io/
+*
+* @copyright Wout Fierens <[email protected]>
+* @license MIT
+*
+* BUILT: Mon Jun 05 2017 11:33:23 GMT+0200 (Mitteleuropäische Sommerzeit)
+*/!function(i,s){void 0===(r=function(){return function(t,e){var n=this.SVG=function(t){if(n.supported)return t=new n.Doc(t),n.parser.draw||n.prepare(),t};if(n.ns="http://www.w3.org/2000/svg",n.xmlns="http://www.w3.org/2000/xmlns/",n.xlink="http://www.w3.org/1999/xlink",n.svgjs="http://svgjs.com/svgjs",n.supported=!!e.createElementNS&&!!e.createElementNS(n.ns,"svg").createSVGRect,!n.supported)return!1;n.did=1e3,n.eid=function(t){return"Svgjs"+u(t)+n.did++},n.create=function(t){var n=e.createElementNS(this.ns,t);return n.setAttribute("id",this.eid(t)),n},n.extend=function(){var t,e,r,i;for(t=[].slice.call(arguments),e=t.pop(),i=t.length-1;i>=0;i--)if(t[i])for(r in e)t[i].prototype[r]=e[r];n.Set&&n.Set.inherit&&n.Set.inherit()},n.invent=function(t){var e="function"==typeof t.create?t.create:function(){this.constructor.call(this,n.create(t.create))};return t.inherit&&(e.prototype=new t.inherit),t.extend&&n.extend(e,t.extend),t.construct&&n.extend(t.parent||n.Container,t.construct),e},n.adopt=function(e){return e?e.instance?e.instance:((r="svg"==e.nodeName?e.parentNode instanceof t.SVGElement?new n.Nested:new n.Doc:"linearGradient"==e.nodeName?new n.Gradient("linear"):"radialGradient"==e.nodeName?new n.Gradient("radial"):n[u(e.nodeName)]?new(n[u(e.nodeName)]):new n.Element(e)).type=e.nodeName,r.node=e,e.instance=r,r instanceof n.Doc&&r.namespace().defs(),r.setData(JSON.parse(e.getAttribute("svgjs:data"))||{}),r):null;var r},n.prepare=function(){var t=e.getElementsByTagName("body")[0],r=(t?new n.Doc(t):n.adopt(e.documentElement).nested()).size(2,0);n.parser={body:t||e.documentElement,draw:r.style("opacity:0;position:absolute;left:-100%;top:-100%;overflow:hidden").node,poly:r.polyline().node,path:r.path().node,native:n.create("svg")}},n.parser={native:n.create("svg")},e.addEventListener("DOMContentLoaded",function(){n.parser.draw||n.prepare()},!1),n.regex={numberAndUnit:/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,hex:/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,rgb:/rgb\((\d+),(\d+),(\d+)\)/,reference:/#([a-z0-9\-_]+)/i,transforms:/\)\s*,?\s*/,whitespace:/\s/g,isHex:/^#[a-f0-9]{3,6}$/i,isRgb:/^rgb\(/,isCss:/[^:]+:[^;]+;?/,isBlank:/^(\s+)?$/,isNumber:/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,isPercent:/^-?[\d\.]+%$/,isImage:/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,delimiter:/[\s,]+/,hyphen:/([^e])\-/gi,pathLetters:/[MLHVCSQTAZ]/gi,isPathLetter:/[MLHVCSQTAZ]/i,numbersWithDots:/((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi,dots:/\./g},n.utils={map:function(t,e){var n,r=t.length,i=[];for(n=0;n<r;n++)i.push(e(t[n]));return i},filter:function(t,e){var n,r=t.length,i=[];for(n=0;n<r;n++)e(t[n])&&i.push(t[n]);return i},radians:function(t){return t%360*Math.PI/180},degrees:function(t){return 180*t/Math.PI%360},filterSVGElements:function(e){return this.filter(e,function(e){return e instanceof t.SVGElement})}},n.defaults={attrs:{"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","font-size":16,"font-family":"Helvetica, Arial, sans-serif","text-anchor":"start"}},n.Color=function(t){var e;this.r=0,this.g=0,this.b=0,t&&("string"==typeof t?n.regex.isRgb.test(t)?(e=n.regex.rgb.exec(t.replace(n.regex.whitespace,"")),this.r=parseInt(e[1]),this.g=parseInt(e[2]),this.b=parseInt(e[3])):n.regex.isHex.test(t)&&(e=n.regex.hex.exec(function(t){return 4==t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}(t)),this.r=parseInt(e[1],16),this.g=parseInt(e[2],16),this.b=parseInt(e[3],16)):"object"==typeof t&&(this.r=t.r,this.g=t.g,this.b=t.b))},n.extend(n.Color,{toString:function(){return this.toHex()},toHex:function(){return"#"+c(this.r)+c(this.g)+c(this.b)},toRgb:function(){return"rgb("+[this.r,this.g,this.b].join()+")"},brightness:function(){return this.r/255*.3+this.g/255*.59+this.b/255*.11},morph:function(t){return this.destination=new n.Color(t),this},at:function(t){return this.destination?(t=t<0?0:t>1?1:t,new n.Color({r:~~(this.r+(this.destination.r-this.r)*t),g:~~(this.g+(this.destination.g-this.g)*t),b:~~(this.b+(this.destination.b-this.b)*t)})):this}}),n.Color.test=function(t){return t+="",n.regex.isHex.test(t)||n.regex.isRgb.test(t)},n.Color.isRgb=function(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b},n.Color.isColor=function(t){return n.Color.isRgb(t)||n.Color.test(t)},n.Array=function(t,e){0==(t=(t||[]).valueOf()).length&&e&&(t=e.valueOf()),this.value=this.parse(t)},n.extend(n.Array,{morph:function(t){if(this.destination=this.parse(t),this.value.length!=this.destination.length){for(var e=this.value[this.value.length-1],n=this.destination[this.destination.length-1];this.value.length>this.destination.length;)this.destination.push(n);for(;this.value.length<this.destination.length;)this.value.push(e)}return this},settle:function(){for(var t=0,e=this.value.length,n=[];t<e;t++)-1==n.indexOf(this.value[t])&&n.push(this.value[t]);return this.value=n},at:function(t){if(!this.destination)return this;for(var e=0,r=this.value.length,i=[];e<r;e++)i.push(this.value[e]+(this.destination[e]-this.value[e])*t);return new n.Array(i)},toString:function(){return this.value.join(" ")},valueOf:function(){return this.value},parse:function(t){return t=t.valueOf(),Array.isArray(t)?t:this.split(t)},split:function(t){return t.trim().split(n.regex.delimiter).map(parseFloat)},reverse:function(){return this.value.reverse(),this},clone:function(){var t=new this.constructor;return t.value=function t(e){var n=e.slice(0);for(var r=n.length;r--;)Array.isArray(n[r])&&(n[r]=t(n[r]));return n}(this.value),t}}),n.PointArray=function(t,e){n.Array.call(this,t,e||[[0,0]])},n.PointArray.prototype=new n.Array,n.PointArray.prototype.constructor=n.PointArray,n.extend(n.PointArray,{toString:function(){for(var t=0,e=this.value.length,n=[];t<e;t++)n.push(this.value[t].join(","));return n.join(" ")},toLine:function(){return{x1:this.value[0][0],y1:this.value[0][1],x2:this.value[1][0],y2:this.value[1][1]}},at:function(t){if(!this.destination)return this;for(var e=0,r=this.value.length,i=[];e<r;e++)i.push([this.value[e][0]+(this.destination[e][0]-this.value[e][0])*t,this.value[e][1]+(this.destination[e][1]-this.value[e][1])*t]);return new n.PointArray(i)},parse:function(t){var e=[];if(t=t.valueOf(),Array.isArray(t)){if(Array.isArray(t[0]))return t}else t=t.trim().split(n.regex.delimiter).map(parseFloat);t.length%2!=0&&t.pop();for(var r=0,i=t.length;r<i;r+=2)e.push([t[r],t[r+1]]);return e},move:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var r=this.value.length-1;r>=0;r--)this.value[r]=[this.value[r][0]+t,this.value[r][1]+e];return this},size:function(t,e){var n,r=this.bbox();for(n=this.value.length-1;n>=0;n--)r.width&&(this.value[n][0]=(this.value[n][0]-r.x)*t/r.width+r.x),r.height&&(this.value[n][1]=(this.value[n][1]-r.y)*e/r.height+r.y);return this},bbox:function(){return n.parser.poly.setAttribute("points",this.toString()),n.parser.poly.getBBox()}});for(var r={M:function(t,e,n){return e.x=n.x=t[0],e.y=n.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,n){return e.x=n.x,e.y=n.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},i="mlhvqtcsaz".split(""),s=0,a=i.length;s<a;++s)r[i[s]]=function(t){return function(e,n,i){if("H"==t)e[0]=e[0]+n.x;else if("V"==t)e[0]=e[0]+n.y;else if("A"==t)e[5]=e[5]+n.x,e[6]=e[6]+n.y;else for(var s=0,a=e.length;s<a;++s)e[s]=e[s]+(s%2?n.y:n.x);return r[t](e,n,i)}}(i[s].toUpperCase());n.PathArray=function(t,e){n.Array.call(this,t,e||[["M",0,0]])},n.PathArray.prototype=new n.Array,n.PathArray.prototype.constructor=n.PathArray,n.extend(n.PathArray,{toString:function(){return function(t){for(var e=0,n=t.length,r="";e<n;e++)r+=t[e][0],null!=t[e][1]&&(r+=t[e][1],null!=t[e][2]&&(r+=" ",r+=t[e][2],null!=t[e][3]&&(r+=" ",r+=t[e][3],r+=" ",r+=t[e][4],null!=t[e][5]&&(r+=" ",r+=t[e][5],r+=" ",r+=t[e][6],null!=t[e][7]&&(r+=" ",r+=t[e][7])))));return r+" "}(this.value)},move:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var r,i=this.value.length-1;i>=0;i--)"M"==(r=this.value[i][0])||"L"==r||"T"==r?(this.value[i][1]+=t,this.value[i][2]+=e):"H"==r?this.value[i][1]+=t:"V"==r?this.value[i][1]+=e:"C"==r||"S"==r||"Q"==r?(this.value[i][1]+=t,this.value[i][2]+=e,this.value[i][3]+=t,this.value[i][4]+=e,"C"==r&&(this.value[i][5]+=t,this.value[i][6]+=e)):"A"==r&&(this.value[i][6]+=t,this.value[i][7]+=e);return this},size:function(t,e){var n,r,i=this.bbox();for(n=this.value.length-1;n>=0;n--)"M"==(r=this.value[n][0])||"L"==r||"T"==r?(this.value[n][1]=(this.value[n][1]-i.x)*t/i.width+i.x,this.value[n][2]=(this.value[n][2]-i.y)*e/i.height+i.y):"H"==r?this.value[n][1]=(this.value[n][1]-i.x)*t/i.width+i.x:"V"==r?this.value[n][1]=(this.value[n][1]-i.y)*e/i.height+i.y:"C"==r||"S"==r||"Q"==r?(this.value[n][1]=(this.value[n][1]-i.x)*t/i.width+i.x,this.value[n][2]=(this.value[n][2]-i.y)*e/i.height+i.y,this.value[n][3]=(this.value[n][3]-i.x)*t/i.width+i.x,this.value[n][4]=(this.value[n][4]-i.y)*e/i.height+i.y,"C"==r&&(this.value[n][5]=(this.value[n][5]-i.x)*t/i.width+i.x,this.value[n][6]=(this.value[n][6]-i.y)*e/i.height+i.y)):"A"==r&&(this.value[n][1]=this.value[n][1]*t/i.width,this.value[n][2]=this.value[n][2]*e/i.height,this.value[n][6]=(this.value[n][6]-i.x)*t/i.width+i.x,this.value[n][7]=(this.value[n][7]-i.y)*e/i.height+i.y);return this},equalCommands:function(t){var e,r,i;for(t=new n.PathArray(t),i=this.value.length===t.value.length,e=0,r=this.value.length;i&&e<r;e++)i=this.value[e][0]===t.value[e][0];return i},morph:function(t){return t=new n.PathArray(t),this.equalCommands(t)?this.destination=t:this.destination=null,this},at:function(t){if(!this.destination)return this;var e,r,i,s,a=this.value,l=this.destination.value,o=[],h=new n.PathArray;for(e=0,r=a.length;e<r;e++){for(o[e]=[a[e][0]],i=1,s=a[e].length;i<s;i++)o[e][i]=a[e][i]+(l[e][i]-a[e][i])*t;"A"===o[e][0]&&(o[e][4]=+(0!=o[e][4]),o[e][5]=+(0!=o[e][5]))}return h.value=o,h},parse:function(t){if(t instanceof n.PathArray)return t.valueOf();var e,i={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};t="string"==typeof t?t.replace(n.regex.numbersWithDots,o).replace(n.regex.pathLetters," $& ").replace(n.regex.hyphen,"$1 -").trim().split(n.regex.delimiter):t.reduce(function(t,e){return[].concat.call(t,e)},[]);var s=[],a=new n.Point,l=new n.Point,h=0,u=t.length;do{n.regex.isPathLetter.test(t[h])?(e=t[h],++h):"M"==e?e="L":"m"==e&&(e="l"),s.push(r[e].call(null,t.slice(h,h+=i[e.toUpperCase()]).map(parseFloat),a,l))}while(u>h);return s},bbox:function(){return n.parser.path.setAttribute("d",this.toString()),n.parser.path.getBBox()}}),n.Number=n.invent({create:function(t,e){this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-3.4e38:3.4e38:"string"==typeof t?(e=t.match(n.regex.numberAndUnit))&&(this.value=parseFloat(e[1]),"%"==e[5]?this.value/=100:"s"==e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof n.Number&&(this.value=t.valueOf(),this.unit=t.unit)},extend:{toString:function(){return("%"==this.unit?~~(1e8*this.value)/1e6:"s"==this.unit?this.value/1e3:this.value)+this.unit},toJSON:function(){return this.toString()},valueOf:function(){return this.value},plus:function(t){return t=new n.Number(t),new n.Number(this+t,this.unit||t.unit)},minus:function(t){return t=new n.Number(t),new n.Number(this-t,this.unit||t.unit)},times:function(t){return t=new n.Number(t),new n.Number(this*t,this.unit||t.unit)},divide:function(t){return t=new n.Number(t),new n.Number(this/t,this.unit||t.unit)},to:function(t){var e=new n.Number(this);return"string"==typeof t&&(e.unit=t),e},morph:function(t){return this.destination=new n.Number(t),t.relative&&(this.destination.value+=this.value),this},at:function(t){return this.destination?new n.Number(this.destination).minus(this).times(t).plus(this):this}}}),n.Element=n.invent({create:function(t){this._stroke=n.defaults.attrs.stroke,this._event=null,this.dom={},(this.node=t)&&(this.type=t.nodeName,this.node.instance=this,this._stroke=t.getAttribute("stroke")||this._stroke)},extend:{x:function(t){return this.attr("x",t)},y:function(t){return this.attr("y",t)},cx:function(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)},cy:function(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},width:function(t){return this.attr("width",t)},height:function(t){return this.attr("height",t)},size:function(t,e){var r=m(this,t,e);return this.width(new n.Number(r.width)).height(new n.Number(r.height))},clone:function(e,r){this.writeDataToDom();var i=function e(r){for(var i=r.childNodes.length-1;i>=0;i--)r.childNodes[i]instanceof t.SVGElement&&e(r.childNodes[i]);return n.adopt(r).id(n.eid(r.nodeName))}(this.node.cloneNode(!0));return e?e.add(i):this.after(i),i},remove:function(){return this.parent()&&this.parent().removeElement(this),this},replace:function(t){return this.after(t).remove(),t},addTo:function(t){return t.put(this)},putIn:function(t){return t.add(this)},id:function(t){return this.attr("id",t)},inside:function(t,e){var n=this.bbox();return t>n.x&&e>n.y&&t<n.x+n.width&&e<n.y+n.height},show:function(){return this.style("display","")},hide:function(){return this.style("display","none")},visible:function(){return"none"!=this.style("display")},toString:function(){return this.attr("id")},classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(n.regex.delimiter)},hasClass:function(t){return-1!=this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter(function(e){return e!=t}).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)},reference:function(t){return n.get(this.attr(t))},parent:function(e){var r=this;if(!r.node.parentNode)return null;if(r=n.adopt(r.node.parentNode),!e)return r;for(;r&&r.node instanceof t.SVGElement;){if("string"==typeof e?r.matches(e):r instanceof e)return r;r=n.adopt(r.node.parentNode)}},doc:function(){return this instanceof n.Doc?this:this.parent(n.Doc)},parents:function(t){var e=[],n=this;do{if(!(n=n.parent(t))||!n.node)break;e.push(n)}while(n.parent);return e},matches:function(t){return function(t,e){return(t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector).call(t,e)}(this.node,t)},native:function(){return this.node},svg:function(t){var r=e.createElement("svg");if(!(t&&this instanceof n.Parent))return r.appendChild(t=e.createElement("svg")),this.writeDataToDom(),t.appendChild(this.node.cloneNode(!0)),r.innerHTML.replace(/^<svg>/,"").replace(/<\/svg>$/,"");r.innerHTML="<svg>"+t.replace(/\n/,"").replace(/<(\w+)([^<]+?)\/>/g,"<$1$2></$1>")+"</svg>";for(var i=0,s=r.firstChild.childNodes.length;i<s;i++)this.node.appendChild(r.firstChild.firstChild);return this},writeDataToDom:function(){if(this.each||this.lines){var t=this.each?this:this.lines();t.each(function(){this.writeDataToDom()})}return this.node.removeAttribute("svgjs:data"),Object.keys(this.dom).length&&this.node.setAttribute("svgjs:data",JSON.stringify(this.dom)),this},setData:function(t){return this.dom=t,this},is:function(t){return function(t,e){return t instanceof e}(this,t)}}}),n.easing={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)}},n.morph=function(t){return function(e,r){return new n.MorphObj(e,r).at(t)}},n.Situation=n.invent({create:function(t){this.init=!1,this.reversed=!1,this.reversing=!1,this.duration=new n.Number(t.duration).valueOf(),this.delay=new n.Number(t.delay).valueOf(),this.start=+new Date+this.delay,this.finish=this.start+this.duration,this.ease=t.ease,this.loop=0,this.loops=!1,this.animations={},this.attrs={},this.styles={},this.transforms=[],this.once={}}}),n.FX=n.invent({create:function(t){this._target=t,this.situations=[],this.active=!1,this.situation=null,this.paused=!1,this.lastPos=0,this.pos=0,this.absPos=0,this._speed=1},extend:{animate:function(t,e,r){"object"==typeof t&&(e=t.ease,r=t.delay,t=t.duration);var i=new n.Situation({duration:t||1e3,delay:r||0,ease:n.easing[e||"-"]||e});return this.queue(i),this},delay:function(t){var e=new n.Situation({duration:t,delay:0,ease:n.easing["-"]});return this.queue(e)},target:function(t){return t&&t instanceof n.Element?(this._target=t,this):this._target},timeToAbsPos:function(t){return(t-this.situation.start)/(this.situation.duration/this._speed)},absPosToTime:function(t){return this.situation.duration/this._speed*t+this.situation.start},startAnimFrame:function(){this.stopAnimFrame(),this.animationFrame=t.requestAnimationFrame(function(){this.step()}.bind(this))},stopAnimFrame:function(){t.cancelAnimationFrame(this.animationFrame)},start:function(){return!this.active&&this.situation&&(this.active=!0,this.startCurrent()),this},startCurrent:function(){return this.situation.start=+new Date+this.situation.delay/this._speed,this.situation.finish=this.situation.start+this.situation.duration/this._speed,this.initAnimations().step()},queue:function(t){return("function"==typeof t||t instanceof n.Situation)&&this.situations.push(t),this.situation||(this.situation=this.situations.shift()),this},dequeue:function(){return this.stop(),this.situation=this.situations.shift(),this.situation&&(this.situation instanceof n.Situation?this.start():this.situation.call(this)),this},initAnimations:function(){var t,e,r,i=this.situation;if(i.init)return this;for(t in i.animations)for(r=this.target()[t](),Array.isArray(r)||(r=[r]),Array.isArray(i.animations[t])||(i.animations[t]=[i.animations[t]]),e=r.length;e--;)i.animations[t][e]instanceof n.Number&&(r[e]=new n.Number(r[e])),i.animations[t][e]=r[e].morph(i.animations[t][e]);for(t in i.attrs)i.attrs[t]=new n.MorphObj(this.target().attr(t),i.attrs[t]);for(t in i.styles)i.styles[t]=new n.MorphObj(this.target().style(t),i.styles[t]);return i.initialTransformation=this.target().matrixify(),i.init=!0,this},clearQueue:function(){return this.situations=[],this},clearCurrent:function(){return this.situation=null,this},stop:function(t,e){var n=this.active;return this.active=!1,e&&this.clearQueue(),t&&this.situation&&(!n&&this.startCurrent(),this.atEnd()),this.stopAnimFrame(),this.clearCurrent()},reset:function(){if(this.situation){var t=this.situation;this.stop(),this.situation=t,this.atStart()}return this},finish:function(){for(this.stop(!0,!1);this.dequeue().situation&&this.stop(!0,!1););return this.clearQueue().clearCurrent(),this},atStart:function(){return this.at(0,!0)},atEnd:function(){return!0===this.situation.loops&&(this.situation.loops=this.situation.loop+1),"number"==typeof this.situation.loops?this.at(this.situation.loops,!0):this.at(1,!0)},at:function(t,e){var n=this.situation.duration/this._speed;return this.absPos=t,e||(this.situation.reversed&&(this.absPos=1-this.absPos),this.absPos+=this.situation.loop),this.situation.start=+new Date-this.absPos*n,this.situation.finish=this.situation.start+n,this.step(!0)},speed:function(t){return 0===t?this.pause():t?(this._speed=t,this.at(this.absPos,!0)):this._speed},loop:function(t,e){var n=this.last();return n.loops=null==t||t,n.loop=0,e&&(n.reversing=!0),this},pause:function(){return this.paused=!0,this.stopAnimFrame(),this},play:function(){return this.paused?(this.paused=!1,this.at(this.absPos,!0)):this},reverse:function(t){var e=this.last();return e.reversed=void 0===t?!e.reversed:t,this},progress:function(t){return t?this.situation.ease(this.pos):this.pos},after:function(t){var e=this.last();return this.target().on("finished.fx",function n(r){r.detail.situation==e&&(t.call(this,e),this.off("finished.fx",n))}),this._callStart()},during:function(t){var e=this.last(),r=function(r){r.detail.situation==e&&t.call(this,r.detail.pos,n.morph(r.detail.pos),r.detail.eased,e)};return this.target().off("during.fx",r).on("during.fx",r),this.after(function(){this.off("during.fx",r)}),this._callStart()},afterAll:function(t){var e=function e(n){t.call(this),this.off("allfinished.fx",e)};return this.target().off("allfinished.fx",e).on("allfinished.fx",e),this._callStart()},duringAll:function(t){var e=function(e){t.call(this,e.detail.pos,n.morph(e.detail.pos),e.detail.eased,e.detail.situation)};return this.target().off("during.fx",e).on("during.fx",e),this.afterAll(function(){this.off("during.fx",e)}),this._callStart()},last:function(){return this.situations.length?this.situations[this.situations.length-1]:this.situation},add:function(t,e,n){return this.last()[n||"animations"][t]=e,this._callStart()},step:function(t){var e,n,r;(t||(this.absPos=this.timeToAbsPos(+new Date)),!1!==this.situation.loops)?(e=Math.max(this.absPos,0),n=Math.floor(e),!0===this.situation.loops||n<this.situation.loops?(this.pos=e-n,r=this.situation.loop,this.situation.loop=n):(this.absPos=this.situation.loops,this.pos=1,r=this.situation.loop-1,this.situation.loop=this.situation.loops),this.situation.reversing&&(this.situation.reversed=this.situation.reversed!=Boolean((this.situation.loop-r)%2))):(this.absPos=Math.min(this.absPos,1),this.pos=this.absPos);this.pos<0&&(this.pos=0),this.situation.reversed&&(this.pos=1-this.pos);var i=this.situation.ease(this.pos);for(var s in this.situation.once)s>this.lastPos&&s<=i&&(this.situation.once[s].call(this.target(),this.pos,i),delete this.situation.once[s]);return this.active&&this.target().fire("during",{pos:this.pos,eased:i,fx:this,situation:this.situation}),this.situation?(this.eachAt(),1==this.pos&&!this.situation.reversed||this.situation.reversed&&0==this.pos?(this.stopAnimFrame(),this.target().fire("finished",{fx:this,situation:this.situation}),this.situations.length||(this.target().fire("allfinished"),this.situations.length||(this.target().off(".fx"),this.active=!1)),this.active?this.dequeue():this.clearCurrent()):!this.paused&&this.active&&this.startAnimFrame(),this.lastPos=i,this):this},eachAt:function(){var t,e,r,i=this,s=this.target(),a=this.situation;for(t in a.animations)r=[].concat(a.animations[t]).map(function(t){return"string"!=typeof t&&t.at?t.at(a.ease(i.pos),i.pos):t}),s[t].apply(s,r);for(t in a.attrs)r=[t].concat(a.attrs[t]).map(function(t){return"string"!=typeof t&&t.at?t.at(a.ease(i.pos),i.pos):t}),s.attr.apply(s,r);for(t in a.styles)r=[t].concat(a.styles[t]).map(function(t){return"string"!=typeof t&&t.at?t.at(a.ease(i.pos),i.pos):t}),s.style.apply(s,r);if(a.transforms.length){for(r=a.initialTransformation,t=0,e=a.transforms.length;t<e;t++){var l=a.transforms[t];l instanceof n.Matrix?r=l.relative?r.multiply((new n.Matrix).morph(l).at(a.ease(this.pos))):r.morph(l).at(a.ease(this.pos)):(l.relative||l.undo(r.extract()),r=r.multiply(l.at(a.ease(this.pos))))}s.matrix(r)}return this},once:function(t,e,n){var r=this.last();return n||(t=r.ease(t)),r.once[t]=e,this},_callStart:function(){return setTimeout(function(){this.start()}.bind(this),0),this}},parent:n.Element,construct:{animate:function(t,e,r){return(this.fx||(this.fx=new n.FX(this))).animate(t,e,r)},delay:function(t){return(this.fx||(this.fx=new n.FX(this))).delay(t)},stop:function(t,e){return this.fx&&this.fx.stop(t,e),this},finish:function(){return this.fx&&this.fx.finish(),this},pause:function(){return this.fx&&this.fx.pause(),this},play:function(){return this.fx&&this.fx.play(),this},speed:function(t){if(this.fx){if(null==t)return this.fx.speed();this.fx.speed(t)}return this}}}),n.MorphObj=n.invent({create:function(t,e){return n.Color.isColor(e)?new n.Color(t).morph(e):n.regex.numberAndUnit.test(e)?new n.Number(t).morph(e):(this.value=t,void(this.destination=e))},extend:{at:function(t,e){return e<1?this.value:this.destination},valueOf:function(){return this.value}}}),n.extend(n.FX,{attr:function(t,e,n){if("object"==typeof t)for(var r in t)this.attr(r,t[r]);else this.add(t,e,"attrs");return this},style:function(t,e){if("object"==typeof t)for(var n in t)this.style(n,t[n]);else this.add(t,e,"styles");return this},x:function(t,e){if(this.target()instanceof n.G)return this.transform({x:t},e),this;var r=new n.Number(t);return r.relative=e,this.add("x",r)},y:function(t,e){if(this.target()instanceof n.G)return this.transform({y:t},e),this;var r=new n.Number(t);return r.relative=e,this.add("y",r)},cx:function(t){return this.add("cx",new n.Number(t))},cy:function(t){return this.add("cy",new n.Number(t))},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},size:function(t,e){var r;this.target()instanceof n.Text?this.attr("font-size",t):(t&&e||(r=this.target().bbox()),t||(t=r.width/r.height*e),e||(e=r.height/r.width*t),this.add("width",new n.Number(t)).add("height",new n.Number(e)));return this},width:function(t){return this.add("width",new n.Number(t))},height:function(t){return this.add("height",new n.Number(t))},plot:function(t,e,n,r){return 4==arguments.length?this.plot([t,e,n,r]):this.add("plot",new(this.target().morphArray)(t))},leading:function(t){return this.target().leading?this.add("leading",new n.Number(t)):this},viewbox:function(t,e,r,i){return this.target()instanceof n.Container&&this.add("viewbox",new n.ViewBox(t,e,r,i)),this},update:function(t){if(this.target()instanceof n.Stop){if("number"==typeof t||t instanceof n.Number)return this.update({offset:arguments[0],color:arguments[1],opacity:arguments[2]});null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset)}return this}}),n.Box=n.invent({create:function(t,e,r,i){if(!("object"!=typeof t||t instanceof n.Element))return n.Box.call(this,null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height);4==arguments.length&&(this.x=t,this.y=e,this.width=r,this.height=i),x(this)},extend:{merge:function(t){var e=new this.constructor;return e.x=Math.min(this.x,t.x),e.y=Math.min(this.y,t.y),e.width=Math.max(this.x+this.width,t.x+t.width)-e.x,e.height=Math.max(this.y+this.height,t.y+t.height)-e.y,x(e)},transform:function(t){var e,r=1/0,i=-1/0,s=1/0,a=-1/0,l=[new n.Point(this.x,this.y),new n.Point(this.x2,this.y),new n.Point(this.x,this.y2),new n.Point(this.x2,this.y2)];return l.forEach(function(e){e=e.transform(t),r=Math.min(r,e.x),i=Math.max(i,e.x),s=Math.min(s,e.y),a=Math.max(a,e.y)}),(e=new this.constructor).x=r,e.width=i-r,e.y=s,e.height=a-s,x(e),e}}}),n.BBox=n.invent({create:function(t){if(n.Box.apply(this,[].slice.call(arguments)),t instanceof n.Element){var r;try{if(e.documentElement.contains){if(!e.documentElement.contains(t.node))throw new Exception("Element not in the dom")}else{for(var i=t.node;i.parentNode;)i=i.parentNode;if(i!=e)throw new Exception("Element not in the dom")}r=t.node.getBBox()}catch(e){if(t instanceof n.Shape){var s=t.clone(n.parser.draw.instance).show();r=s.node.getBBox(),s.remove()}else r={x:t.node.clientLeft,y:t.node.clientTop,width:t.node.clientWidth,height:t.node.clientHeight}}n.Box.call(this,r)}},inherit:n.Box,parent:n.Element,construct:{bbox:function(){return new n.BBox(this)}}}),n.BBox.prototype.constructor=n.BBox,n.extend(n.Element,{tbox:function(){return console.warn("Use of TBox is deprecated and mapped to RBox. Use .rbox() instead."),this.rbox(this.doc())}}),n.RBox=n.invent({create:function(t){n.Box.apply(this,[].slice.call(arguments)),t instanceof n.Element&&n.Box.call(this,t.node.getBoundingClientRect())},inherit:n.Box,parent:n.Element,extend:{addOffset:function(){return this.x+=t.pageXOffset,this.y+=t.pageYOffset,this}},construct:{rbox:function(t){return t?new n.RBox(this).transform(t.screenCTM().inverse()):new n.RBox(this).addOffset()}}}),n.RBox.prototype.constructor=n.RBox,n.Matrix=n.invent({create:function(t){var e,r=d([1,0,0,1,0,0]);for(t=t instanceof n.Element?t.matrixify():"string"==typeof t?d(t.split(n.regex.delimiter).map(parseFloat)):6==arguments.length?d([].slice.call(arguments)):Array.isArray(t)?d(t):"object"==typeof t?t:r,e=v.length-1;e>=0;--e)this[v[e]]=null!=t[v[e]]?t[v[e]]:r[v[e]]},extend:{extract:function(){var t=p(this,0,1),e=p(this,1,0),r=180/Math.PI*Math.atan2(t.y,t.x)-90;return{x:this.e,y:this.f,transformedX:(this.e*Math.cos(r*Math.PI/180)+this.f*Math.sin(r*Math.PI/180))/Math.sqrt(this.a*this.a+this.b*this.b),transformedY:(this.f*Math.cos(r*Math.PI/180)+this.e*Math.sin(-r*Math.PI/180))/Math.sqrt(this.c*this.c+this.d*this.d),skewX:-r,skewY:180/Math.PI*Math.atan2(e.y,e.x),scaleX:Math.sqrt(this.a*this.a+this.b*this.b),scaleY:Math.sqrt(this.c*this.c+this.d*this.d),rotation:r,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f,matrix:new n.Matrix(this)}},clone:function(){return new n.Matrix(this)},morph:function(t){return this.destination=new n.Matrix(t),this},at:function(t){if(!this.destination)return this;var e=new n.Matrix({a:this.a+(this.destination.a-this.a)*t,b:this.b+(this.destination.b-this.b)*t,c:this.c+(this.destination.c-this.c)*t,d:this.d+(this.destination.d-this.d)*t,e:this.e+(this.destination.e-this.e)*t,f:this.f+(this.destination.f-this.f)*t});return e},multiply:function(t){return new n.Matrix(this.native().multiply(function(t){t instanceof n.Matrix||(t=new n.Matrix(t));return t}(t).native()))},inverse:function(){return new n.Matrix(this.native().inverse())},translate:function(t,e){return new n.Matrix(this.native().translate(t||0,e||0))},scale:function(t,e,r,i){return 1==arguments.length?e=t:3==arguments.length&&(i=r,r=e,e=t),this.around(r,i,new n.Matrix(t,0,0,e,0,0))},rotate:function(t,e,r){return t=n.utils.radians(t),this.around(e,r,new n.Matrix(Math.cos(t),Math.sin(t),-Math.sin(t),Math.cos(t),0,0))},flip:function(t,e){return"x"==t?this.scale(-1,1,e,0):"y"==t?this.scale(1,-1,0,e):this.scale(-1,-1,t,null!=e?e:t)},skew:function(t,e,r,i){return 1==arguments.length?e=t:3==arguments.length&&(i=r,r=e,e=t),t=n.utils.radians(t),e=n.utils.radians(e),this.around(r,i,new n.Matrix(1,Math.tan(e),Math.tan(t),1,0,0))},skewX:function(t,e,n){return this.skew(t,0,e,n)},skewY:function(t,e,n){return this.skew(0,t,e,n)},around:function(t,e,r){return this.multiply(new n.Matrix(1,0,0,1,t||0,e||0)).multiply(r).multiply(new n.Matrix(1,0,0,1,-t||0,-e||0))},native:function(){for(var t=n.parser.native.createSVGMatrix(),e=v.length-1;e>=0;e--)t[v[e]]=this[v[e]];return t},toString:function(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}},parent:n.Element,construct:{ctm:function(){return new n.Matrix(this.node.getCTM())},screenCTM:function(){if(this instanceof n.Nested){var t=this.rect(1,1),e=t.node.getScreenCTM();return t.remove(),new n.Matrix(e)}return new n.Matrix(this.node.getScreenCTM())}}}),n.Point=n.invent({create:function(t,e){var n;n=Array.isArray(t)?{x:t[0],y:t[1]}:"object"==typeof t?{x:t.x,y:t.y}:null!=t?{x:t,y:null!=e?e:t}:{x:0,y:0},this.x=n.x,this.y=n.y},extend:{clone:function(){return new n.Point(this)},morph:function(t,e){return this.destination=new n.Point(t,e),this},at:function(t){if(!this.destination)return this;var e=new n.Point({x:this.x+(this.destination.x-this.x)*t,y:this.y+(this.destination.y-this.y)*t});return e},native:function(){var t=n.parser.native.createSVGPoint();return t.x=this.x,t.y=this.y,t},transform:function(t){return new n.Point(this.native().matrixTransform(t.native()))}}}),n.extend(n.Element,{point:function(t,e){return new n.Point(t,e).transform(this.screenCTM().inverse())}}),n.extend(n.Element,{attr:function(t,e,r){if(null==t){for(t={},e=this.node.attributes,r=e.length-1;r>=0;r--)t[e[r].nodeName]=n.regex.isNumber.test(e[r].nodeValue)?parseFloat(e[r].nodeValue):e[r].nodeValue;return t}if("object"==typeof t)for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return null==(e=this.node.getAttribute(t))?n.defaults.attrs[t]:n.regex.isNumber.test(e)?parseFloat(e):e;"stroke-width"==t?this.attr("stroke",parseFloat(e)>0?this._stroke:null):"stroke"==t&&(this._stroke=e),"fill"!=t&&"stroke"!=t||(n.regex.isImage.test(e)&&(e=this.doc().defs().image(e,0,0)),e instanceof n.Image&&(e=this.doc().defs().pattern(0,0,function(){this.add(e)}))),"number"==typeof e?e=new n.Number(e):n.Color.isColor(e)?e=new n.Color(e):Array.isArray(e)&&(e=new n.Array(e)),"leading"==t?this.leading&&this.leading(e):"string"==typeof r?this.node.setAttributeNS(r,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!=t&&"x"!=t||this.rebuild(t,e)}return this}}),n.extend(n.Element,{transform:function(t,e){var r,i;if("object"!=typeof t)return r=new n.Matrix(this).extract(),"string"==typeof t?r[t]:r;if(r=new n.Matrix(this),e=!!e||!!t.relative,null!=t.a)r=e?r.multiply(new n.Matrix(t)):new n.Matrix(t);else if(null!=t.rotation)f(t,this),r=e?r.rotate(t.rotation,t.cx,t.cy):r.rotate(t.rotation-r.extract().rotation,t.cx,t.cy);else if(null!=t.scale||null!=t.scaleX||null!=t.scaleY){if(f(t,this),t.scaleX=null!=t.scale?t.scale:null!=t.scaleX?t.scaleX:1,t.scaleY=null!=t.scale?t.scale:null!=t.scaleY?t.scaleY:1,!e){var s=r.extract();t.scaleX=1*t.scaleX/s.scaleX,t.scaleY=1*t.scaleY/s.scaleY}r=r.scale(t.scaleX,t.scaleY,t.cx,t.cy)}else if(null!=t.skew||null!=t.skewX||null!=t.skewY){if(f(t,this),t.skewX=null!=t.skew?t.skew:null!=t.skewX?t.skewX:0,t.skewY=null!=t.skew?t.skew:null!=t.skewY?t.skewY:0,!e){var s=r.extract();r=r.multiply((new n.Matrix).skew(s.skewX,s.skewY,t.cx,t.cy).inverse())}r=r.skew(t.skewX,t.skewY,t.cx,t.cy)}else t.flip?("x"==t.flip||"y"==t.flip?t.offset=null==t.offset?this.bbox()["c"+t.flip]:t.offset:null==t.offset?(i=this.bbox(),t.flip=i.cx,t.offset=i.cy):t.flip=t.offset,r=(new n.Matrix).flip(t.flip,t.offset)):null==t.x&&null==t.y||(e?r=r.translate(t.x,t.y):(null!=t.x&&(r.e=t.x),null!=t.y&&(r.f=t.y)));return this.attr("transform",r)}}),n.extend(n.FX,{transform:function(t,e){var r,i,s=this.target();return"object"!=typeof t?(r=new n.Matrix(s).extract(),"string"==typeof t?r[t]:r):(e=!!e||!!t.relative,null!=t.a?r=new n.Matrix(t):null!=t.rotation?(f(t,s),r=new n.Rotate(t.rotation,t.cx,t.cy)):null!=t.scale||null!=t.scaleX||null!=t.scaleY?(f(t,s),t.scaleX=null!=t.scale?t.scale:null!=t.scaleX?t.scaleX:1,t.scaleY=null!=t.scale?t.scale:null!=t.scaleY?t.scaleY:1,r=new n.Scale(t.scaleX,t.scaleY,t.cx,t.cy)):null!=t.skewX||null!=t.skewY?(f(t,s),t.skewX=null!=t.skewX?t.skewX:0,t.skewY=null!=t.skewY?t.skewY:0,r=new n.Skew(t.skewX,t.skewY,t.cx,t.cy)):t.flip?("x"==t.flip||"y"==t.flip?t.offset=null==t.offset?s.bbox()["c"+t.flip]:t.offset:null==t.offset?(i=s.bbox(),t.flip=i.cx,t.offset=i.cy):t.flip=t.offset,r=(new n.Matrix).flip(t.flip,t.offset)):null==t.x&&null==t.y||(r=new n.Translate(t.x,t.y)),r?(r.relative=e,this.last().transforms.push(r),this._callStart()):this)}}),n.extend(n.Element,{untransform:function(){return this.attr("transform",null)},matrixify:function(){var t=(this.attr("transform")||"").split(n.regex.transforms).slice(0,-1).map(function(t){var e=t.trim().split("(");return[e[0],e[1].split(n.regex.delimiter).map(function(t){return parseFloat(t)})]}).reduce(function(t,e){return"matrix"==e[0]?t.multiply(d(e[1])):t[e[0]].apply(t,e[1])},new n.Matrix);return t},toParent:function(t){if(this==t)return this;var e=this.screenCTM(),n=t.screenCTM().inverse();return this.addTo(t).untransform().transform(n.multiply(e)),this},toDoc:function(){return this.toParent(this.doc())}}),n.Transformation=n.invent({create:function(t,e){if(arguments.length>1&&"boolean"!=typeof e)return this.constructor.call(this,[].slice.call(arguments));if(Array.isArray(t))for(var n=0,r=this.arguments.length;n<r;++n)this[this.arguments[n]]=t[n];else if("object"==typeof t)for(var n=0,r=this.arguments.length;n<r;++n)this[this.arguments[n]]=t[this.arguments[n]];this.inversed=!1,!0===e&&(this.inversed=!0)},extend:{arguments:[],method:"",at:function(t){for(var e=[],r=0,i=this.arguments.length;r<i;++r)e.push(this[this.arguments[r]]);var s=this._undo||new n.Matrix;return s=(new n.Matrix).morph(n.Matrix.prototype[this.method].apply(s,e)).at(t),this.inversed?s.inverse():s},undo:function(t){for(var e=0,r=this.arguments.length;e<r;++e)t[this.arguments[e]]=void 0===this[this.arguments[e]]?0:t[this.arguments[e]];return t.cx=this.cx,t.cy=this.cy,this._undo=new(n[u(this.method)])(t,!0).at(1),this}}}),n.Translate=n.invent({parent:n.Matrix,inherit:n.Transformation,create:function(t,e){this.constructor.apply(this,[].slice.call(arguments))},extend:{arguments:["transformedX","transformedY"],method:"translate"}}),n.Rotate=n.invent({parent:n.Matrix,inherit:n.Transformation,create:function(t,e){this.constructor.apply(this,[].slice.call(arguments))},extend:{arguments:["rotation","cx","cy"],method:"rotate",at:function(t){var e=(new n.Matrix).rotate((new n.Number).morph(this.rotation-(this._undo?this._undo.rotation:0)).at(t),this.cx,this.cy);return this.inversed?e.inverse():e},undo:function(t){return this._undo=t,this}}}),n.Scale=n.invent({parent:n.Matrix,inherit:n.Transformation,create:function(t,e){this.constructor.apply(this,[].slice.call(arguments))},extend:{arguments:["scaleX","scaleY","cx","cy"],method:"scale"}}),n.Skew=n.invent({parent:n.Matrix,inherit:n.Transformation,create:function(t,e){this.constructor.apply(this,[].slice.call(arguments))},extend:{arguments:["skewX","skewY","cx","cy"],method:"skew"}}),n.extend(n.Element,{style:function(t,e){if(0==arguments.length)return this.node.style.cssText||"";if(arguments.length<2)if("object"==typeof t)for(e in t)this.style(e,t[e]);else{if(!n.regex.isCss.test(t))return this.node.style[h(t)];for(t=t.split(/\s*;\s*/).filter(function(t){return!!t}).map(function(t){return t.split(/\s*:\s*/)});e=t.pop();)this.style(e[0],e[1])}else this.node.style[h(t)]=null===e||n.regex.isBlank.test(e)?"":e;return this}}),n.Parent=n.invent({create:function(t){this.constructor.call(this,t)},inherit:n.Element,extend:{children:function(){return n.utils.map(n.utils.filterSVGElements(this.node.childNodes),function(t){return n.adopt(t)})},add:function(t,e){return null==e?this.node.appendChild(t.node):t.node!=this.node.childNodes[e]&&this.node.insertBefore(t.node,this.node.childNodes[e]),this},put:function(t,e){return this.add(t,e),t},has:function(t){return this.index(t)>=0},index:function(t){return[].slice.call(this.node.childNodes).indexOf(t.node)},get:function(t){return n.adopt(this.node.childNodes[t])},first:function(){return this.get(0)},last:function(){return this.get(this.node.childNodes.length-1)},each:function(t,e){var r,i,s=this.children();for(r=0,i=s.length;r<i;r++)s[r]instanceof n.Element&&t.apply(s[r],[r,s]),e&&s[r]instanceof n.Container&&s[r].each(t,e);return this},removeElement:function(t){return this.node.removeChild(t.node),this},clear:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return delete this._defs,this},defs:function(){return this.doc().defs()}}}),n.extend(n.Parent,{ungroup:function(t,e){return 0===e||this instanceof n.Defs||this.node==n.parser.draw?this:(t=t||(this instanceof n.Doc?this:this.parent(n.Parent)),e=e||1/0,this.each(function(){return this instanceof n.Defs?this:this instanceof n.Parent?this.ungroup(t,e-1):this.toParent(t)}),this.node.firstChild||this.remove(),this)},flatten:function(t,e){return this.ungroup(t,e)}}),n.Container=n.invent({create:function(t){this.constructor.call(this,t)},inherit:n.Parent}),n.ViewBox=n.invent({create:function(t){var e,r,i,s,a,l,o,h=1,u=1,c=/[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?/gi;if(t instanceof n.Element){for(l=t,o=t,a=(t.attr("viewBox")||"").match(c),t.bbox,i=new n.Number(t.width()),s=new n.Number(t.height());"%"==i.unit;)h*=i.value,i=new n.Number(l instanceof n.Doc?l.parent().offsetWidth:l.parent().width()),l=l.parent();for(;"%"==s.unit;)u*=s.value,s=new n.Number(o instanceof n.Doc?o.parent().offsetHeight:o.parent().height()),o=o.parent();this.x=0,this.y=0,this.width=i*h,this.height=s*u,this.zoom=1,a&&(e=parseFloat(a[0]),r=parseFloat(a[1]),i=parseFloat(a[2]),s=parseFloat(a[3]),this.zoom=this.width/this.height>i/s?this.height/s:this.width/i,this.x=e,this.y=r,this.width=i,this.height=s)}else t="string"==typeof t?t.match(c).map(function(t){return parseFloat(t)}):Array.isArray(t)?t:"object"==typeof t?[t.x,t.y,t.width,t.height]:4==arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]},extend:{toString:function(){return this.x+" "+this.y+" "+this.width+" "+this.height},morph:function(t,e,r,i){return this.destination=new n.ViewBox(t,e,r,i),this},at:function(t){return this.destination?new n.ViewBox([this.x+(this.destination.x-this.x)*t,this.y+(this.destination.y-this.y)*t,this.width+(this.destination.width-this.width)*t,this.height+(this.destination.height-this.height)*t]):this}},parent:n.Container,construct:{viewbox:function(t,e,r,i){return 0==arguments.length?new n.ViewBox(this):this.attr("viewBox",new n.ViewBox(t,e,r,i))}}}),["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","touchstart","touchmove","touchleave","touchend","touchcancel"].forEach(function(t){n.Element.prototype[t]=function(e){return n.on(this.node,t,e),this}}),n.listeners=[],n.handlerMap=[],n.listenerId=0,n.on=function(t,e,r,i,s){var a=r.bind(i||t.instance||t),l=(n.handlerMap.indexOf(t)+1||n.handlerMap.push(t))-1,o=e.split(".")[0],h=e.split(".")[1]||"*";n.listeners[l]=n.listeners[l]||{},n.listeners[l][o]=n.listeners[l][o]||{},n.listeners[l][o][h]=n.listeners[l][o][h]||{},r._svgjsListenerId||(r._svgjsListenerId=++n.listenerId),n.listeners[l][o][h][r._svgjsListenerId]=a,t.addEventListener(o,a,s||!1)},n.off=function(t,e,r){var i=n.handlerMap.indexOf(t),s=e&&e.split(".")[0],a=e&&e.split(".")[1],l="";if(-1!=i)if(r){if("function"==typeof r&&(r=r._svgjsListenerId),!r)return;n.listeners[i][s]&&n.listeners[i][s][a||"*"]&&(t.removeEventListener(s,n.listeners[i][s][a||"*"][r],!1),delete n.listeners[i][s][a||"*"][r])}else if(a&&s){if(n.listeners[i][s]&&n.listeners[i][s][a]){for(r in n.listeners[i][s][a])n.off(t,[s,a].join("."),r);delete n.listeners[i][s][a]}}else if(a)for(e in n.listeners[i])for(l in n.listeners[i][e])a===l&&n.off(t,[e,a].join("."));else if(s){if(n.listeners[i][s]){for(l in n.listeners[i][s])n.off(t,[s,l].join("."));delete n.listeners[i][s]}}else{for(e in n.listeners[i])n.off(t,e);delete n.listeners[i],delete n.handlerMap[i]}},n.extend(n.Element,{on:function(t,e,r,i){return n.on(this.node,t,e,r,i),this},off:function(t,e){return n.off(this.node,t,e),this},fire:function(e,n){return e instanceof t.Event?this.node.dispatchEvent(e):this.node.dispatchEvent(e=new t.CustomEvent(e,{detail:n,cancelable:!0})),this._event=e,this},event:function(){return this._event}}),n.Defs=n.invent({create:"defs",inherit:n.Container}),n.G=n.invent({create:"g",inherit:n.Container,extend:{x:function(t){return null==t?this.transform("x"):this.transform({x:t-this.x()},!0)},y:function(t){return null==t?this.transform("y"):this.transform({y:t-this.y()},!0)},cx:function(t){return null==t?this.gbox().cx:this.x(t-this.gbox().width/2)},cy:function(t){return null==t?this.gbox().cy:this.y(t-this.gbox().height/2)},gbox:function(){var t=this.bbox(),e=this.transform();return t.x+=e.x,t.x2+=e.x,t.cx+=e.x,t.y+=e.y,t.y2+=e.y,t.cy+=e.y,t}},construct:{group:function(){return this.put(new n.G)}}}),n.extend(n.Element,{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},previous:function(){return this.siblings()[this.position()-1]},forward:function(){var t=this.position()+1,e=this.parent();return e.removeElement(this).add(this,t),e instanceof n.Doc&&e.node.appendChild(e.defs().node),this},backward:function(){var t=this.position();return t>0&&this.parent().removeElement(this).add(this,t-1),this},front:function(){var t=this.parent();return t.node.appendChild(this.node),t instanceof n.Doc&&t.node.appendChild(t.defs().node),this},back:function(){return this.position()>0&&this.parent().removeElement(this).add(this,0),this},before:function(t){t.remove();var e=this.position();return this.parent().add(t,e),this},after:function(t){t.remove();var e=this.position();return this.parent().add(t,e+1),this}}),n.Mask=n.invent({create:function(){this.constructor.call(this,n.create("mask")),this.targets=[]},inherit:n.Container,extend:{remove:function(){for(var t=this.targets.length-1;t>=0;t--)this.targets[t]&&this.targets[t].unmask();return this.targets=[],this.parent().removeElement(this),this}},construct:{mask:function(){return this.defs().put(new n.Mask)}}}),n.extend(n.Element,{maskWith:function(t){return this.masker=t instanceof n.Mask?t:this.parent().mask().add(t),this.masker.targets.push(this),this.attr("mask",'url("#'+this.masker.attr("id")+'")')},unmask:function(){return delete this.masker,this.attr("mask",null)}}),n.ClipPath=n.invent({create:function(){this.constructor.call(this,n.create("clipPath")),this.targets=[]},inherit:n.Container,extend:{remove:function(){for(var t=this.targets.length-1;t>=0;t--)this.targets[t]&&this.targets[t].unclip();return this.targets=[],this.parent().removeElement(this),this}},construct:{clip:function(){return this.defs().put(new n.ClipPath)}}}),n.extend(n.Element,{clipWith:function(t){return this.clipper=t instanceof n.ClipPath?t:this.parent().clip().add(t),this.clipper.targets.push(this),this.attr("clip-path",'url("#'+this.clipper.attr("id")+'")')},unclip:function(){return delete this.clipper,this.attr("clip-path",null)}}),n.Gradient=n.invent({create:function(t){this.constructor.call(this,n.create(t+"Gradient")),this.type=t},inherit:n.Container,extend:{at:function(t,e,r){return this.put(new n.Stop).update(t,e,r)},update:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this},fill:function(){return"url(#"+this.id()+")"},toString:function(){return this.fill()},attr:function(t,e,r){return"transform"==t&&(t="gradientTransform"),n.Container.prototype.attr.call(this,t,e,r)}},construct:{gradient:function(t,e){return this.defs().gradient(t,e)}}}),n.extend(n.Gradient,n.FX,{from:function(t,e){return"radial"==(this._target||this).type?this.attr({fx:new n.Number(t),fy:new n.Number(e)}):this.attr({x1:new n.Number(t),y1:new n.Number(e)})},to:function(t,e){return"radial"==(this._target||this).type?this.attr({cx:new n.Number(t),cy:new n.Number(e)}):this.attr({x2:new n.Number(t),y2:new n.Number(e)})}}),n.extend(n.Defs,{gradient:function(t,e){return this.put(new n.Gradient(t)).update(e)}}),n.Stop=n.invent({create:"stop",inherit:n.Element,extend:{update:function(t){return("number"==typeof t||t instanceof n.Number)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new n.Number(t.offset)),this}}}),n.Pattern=n.invent({create:"pattern",inherit:n.Container,extend:{fill:function(){return"url(#"+this.id()+")"},update:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this},toString:function(){return this.fill()},attr:function(t,e,r){return"transform"==t&&(t="patternTransform"),n.Container.prototype.attr.call(this,t,e,r)}},construct:{pattern:function(t,e,n){return this.defs().pattern(t,e,n)}}}),n.extend(n.Defs,{pattern:function(t,e,r){return this.put(new n.Pattern).update(r).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})}}),n.Doc=n.invent({create:function(t){t&&("svg"==(t="string"==typeof t?e.getElementById(t):t).nodeName?this.constructor.call(this,t):(this.constructor.call(this,n.create("svg")),t.appendChild(this.node),this.size("100%","100%")),this.namespace().defs())},inherit:n.Container,extend:{namespace:function(){return this.attr({xmlns:n.ns,version:"1.1"}).attr("xmlns:xlink",n.xlink,n.xmlns).attr("xmlns:svgjs",n.svgjs,n.xmlns)},defs:function(){var t;this._defs||((t=this.node.getElementsByTagName("defs")[0])?this._defs=n.adopt(t):this._defs=new n.Defs,this.node.appendChild(this._defs.node));return this._defs},parent:function(){return"#document"==this.node.parentNode.nodeName?null:this.node.parentNode},spof:function(t){var e=this.node.getScreenCTM();return e&&this.style("left",-e.e%1+"px").style("top",-e.f%1+"px"),this},remove:function(){return this.parent()&&this.parent().removeChild(this.node),this},clear:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return delete this._defs,n.parser.draw.parentNode||this.node.appendChild(n.parser.draw),this}}}),n.Shape=n.invent({create:function(t){this.constructor.call(this,t)},inherit:n.Element}),n.Bare=n.invent({create:function(t,e){if(this.constructor.call(this,n.create(t)),e)for(var r in e.prototype)"function"==typeof e.prototype[r]&&(this[r]=e.prototype[r])},inherit:n.Element,extend:{words:function(t){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this.node.appendChild(e.createTextNode(t)),this}}}),n.extend(n.Parent,{element:function(t,e){return this.put(new n.Bare(t,e))}}),n.Symbol=n.invent({create:"symbol",inherit:n.Container,construct:{symbol:function(){return this.put(new n.Symbol)}}}),n.Use=n.invent({create:"use",inherit:n.Shape,extend:{element:function(t,e){return this.attr("href",(e||"")+"#"+t,n.xlink)}},construct:{use:function(t,e){return this.put(new n.Use).element(t,e)}}}),n.Rect=n.invent({create:"rect",inherit:n.Shape,construct:{rect:function(t,e){return this.put(new n.Rect).size(t,e)}}}),n.Circle=n.invent({create:"circle",inherit:n.Shape,construct:{circle:function(t){return this.put(new n.Circle).rx(new n.Number(t).divide(2)).move(0,0)}}}),n.extend(n.Circle,n.FX,{rx:function(t){return this.attr("r",t)},ry:function(t){return this.rx(t)}}),n.Ellipse=n.invent({create:"ellipse",inherit:n.Shape,construct:{ellipse:function(t,e){return this.put(new n.Ellipse).size(t,e).move(0,0)}}}),n.extend(n.Ellipse,n.Rect,n.FX,{rx:function(t){return this.attr("rx",t)},ry:function(t){return this.attr("ry",t)}}),n.extend(n.Circle,n.Ellipse,{x:function(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())},y:function(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())},cx:function(t){return null==t?this.attr("cx"):this.attr("cx",t)},cy:function(t){return null==t?this.attr("cy"):this.attr("cy",t)},width:function(t){return null==t?2*this.rx():this.rx(new n.Number(t).divide(2))},height:function(t){return null==t?2*this.ry():this.ry(new n.Number(t).divide(2))},size:function(t,e){var r=m(this,t,e);return this.rx(new n.Number(r.width).divide(2)).ry(new n.Number(r.height).divide(2))}}),n.Line=n.invent({create:"line",inherit:n.Shape,extend:{array:function(){return new n.PointArray([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])},plot:function(t,e,r,i){return null==t?this.array():(t=void 0!==e?{x1:t,y1:e,x2:r,y2:i}:new n.PointArray(t).toLine(),this.attr(t))},move:function(t,e){return this.attr(this.array().move(t,e).toLine())},size:function(t,e){var n=m(this,t,e);return this.attr(this.array().size(n.width,n.height).toLine())}},construct:{line:function(t,e,r,i){return n.Line.prototype.plot.apply(this.put(new n.Line),null!=t?[t,e,r,i]:[0,0,0,0])}}}),n.Polyline=n.invent({create:"polyline",inherit:n.Shape,construct:{polyline:function(t){return this.put(new n.Polyline).plot(t||new n.PointArray)}}}),n.Polygon=n.invent({create:"polygon",inherit:n.Shape,construct:{polygon:function(t){return this.put(new n.Polygon).plot(t||new n.PointArray)}}}),n.extend(n.Polyline,n.Polygon,{array:function(){return this._array||(this._array=new n.PointArray(this.attr("points")))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new n.PointArray(t))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("points",this.array().move(t,e))},size:function(t,e){var n=m(this,t,e);return this.attr("points",this.array().size(n.width,n.height))}}),n.extend(n.Line,n.Polyline,n.Polygon,{morphArray:n.PointArray,x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},width:function(t){var e=this.bbox();return null==t?e.width:this.size(t,e.height)},height:function(t){var e=this.bbox();return null==t?e.height:this.size(e.width,t)}}),n.Path=n.invent({create:"path",inherit:n.Shape,extend:{morphArray:n.PathArray,array:function(){return this._array||(this._array=new n.PathArray(this.attr("d")))},plot:function(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new n.PathArray(t))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("d",this.array().move(t,e))},x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},size:function(t,e){var n=m(this,t,e);return this.attr("d",this.array().size(n.width,n.height))},width:function(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)},height:function(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}},construct:{path:function(t){return this.put(new n.Path).plot(t||new n.PathArray)}}}),n.Image=n.invent({create:"image",inherit:n.Shape,extend:{load:function(e){if(!e)return this;var r=this,i=new t.Image;return n.on(i,"load",function(){var t=r.parent(n.Pattern);null!==t&&(0==r.width()&&0==r.height()&&r.size(i.width,i.height),t&&0==t.width()&&0==t.height()&&t.size(r.width(),r.height()),"function"==typeof r._loaded&&r._loaded.call(r,{width:i.width,height:i.height,ratio:i.width/i.height,url:e}))}),n.on(i,"error",function(t){"function"==typeof r._error&&r._error.call(r,t)}),this.attr("href",i.src=this.src=e,n.xlink)},loaded:function(t){return this._loaded=t,this},error:function(t){return this._error=t,this}},construct:{image:function(t,e,r){return this.put(new n.Image).load(t).size(e||0,r||e||0)}}}),n.Text=n.invent({create:function(){this.constructor.call(this,n.create("text")),this.dom.leading=new n.Number(1.3),this._rebuild=!0,this._build=!1,this.attr("font-family",n.defaults.attrs["font-family"])},inherit:n.Shape,extend:{x:function(t){return null==t?this.attr("x"):this.attr("x",t)},y:function(t){var e=this.attr("y"),n="number"==typeof e?e-this.bbox().y:0;return null==t?"number"==typeof e?e-n:e:this.attr("y","number"==typeof t?t+n:t)},cx:function(t){return null==t?this.bbox().cx:this.x(t-this.bbox().width/2)},cy:function(t){return null==t?this.bbox().cy:this.y(t-this.bbox().height/2)},text:function(t){if(void 0===t){for(var t="",e=this.node.childNodes,r=0,i=e.length;r<i;++r)0!=r&&3!=e[r].nodeType&&1==n.adopt(e[r]).dom.newLined&&(t+="\n"),t+=e[r].textContent;return t}if(this.clear().build(!0),"function"==typeof t)t.call(this,this);else for(var r=0,s=(t=t.split("\n")).length;r<s;r++)this.tspan(t[r]).newLine();return this.build(!1).rebuild()},size:function(t){return this.attr("font-size",t).rebuild()},leading:function(t){return null==t?this.dom.leading:(this.dom.leading=new n.Number(t),this.rebuild())},lines:function(){var t=(this.textPath&&this.textPath()||this).node,e=n.utils.map(n.utils.filterSVGElements(t.childNodes),function(t){return n.adopt(t)});return new n.Set(e)},rebuild:function(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){var e=this,r=0,i=this.dom.leading*new n.Number(this.attr("font-size"));this.lines().each(function(){this.dom.newLined&&(e.textPath()||this.attr("x",e.attr("x")),"\n"==this.text()?r+=i:(this.attr("dy",i+r),r=0))}),this.fire("rebuild")}return this},build:function(t){return this._build=!!t,this},setData:function(t){return this.dom=t,this.dom.leading=new n.Number(t.leading||1.3),this}},construct:{text:function(t){return this.put(new n.Text).text(t)},plain:function(t){return this.put(new n.Text).plain(t)}}}),n.Tspan=n.invent({create:"tspan",inherit:n.Shape,extend:{text:function(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("function"==typeof t?t.call(this,this):this.plain(t),this)},dx:function(t){return this.attr("dx",t)},dy:function(t){return this.attr("dy",t)},newLine:function(){var t=this.parent(n.Text);return this.dom.newLined=!0,this.dy(t.dom.leading*t.attr("font-size")).attr("x",t.x())}}}),n.extend(n.Text,n.Tspan,{plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(e.createTextNode(t)),this},tspan:function(t){var e=(this.textPath&&this.textPath()||this).node,r=new n.Tspan;return!1===this._build&&this.clear(),e.appendChild(r.node),r.text(t)},clear:function(){for(var t=(this.textPath&&this.textPath()||this).node;t.hasChildNodes();)t.removeChild(t.lastChild);return this},length:function(){return this.node.getComputedTextLength()}}),n.TextPath=n.invent({create:"textPath",inherit:n.Parent,parent:n.Text,construct:{morphArray:n.PathArray,path:function(t){for(var e=new n.TextPath,r=this.doc().defs().path(t);this.node.hasChildNodes();)e.node.appendChild(this.node.firstChild);return this.node.appendChild(e.node),e.attr("href","#"+r,n.xlink),this},array:function(){var t=this.track();return t?t.array():null},plot:function(t){var e=this.track(),n=null;return e&&(n=e.plot(t)),null==t?n:this},track:function(){var t=this.textPath();if(t)return t.reference("href")},textPath:function(){if(this.node.firstChild&&"textPath"==this.node.firstChild.nodeName)return n.adopt(this.node.firstChild)}}}),n.Nested=n.invent({create:function(){this.constructor.call(this,n.create("svg")),this.style("overflow","visible")},inherit:n.Container,construct:{nested:function(){return this.put(new n.Nested)}}}),n.A=n.invent({create:"a",inherit:n.Container,extend:{to:function(t){return this.attr("href",t,n.xlink)},show:function(t){return this.attr("show",t,n.xlink)},target:function(t){return this.attr("target",t)}},construct:{link:function(t){return this.put(new n.A).to(t)}}}),n.extend(n.Element,{linkTo:function(t){var e=new n.A;return"function"==typeof t?t.call(e,e):e.to(t),this.parent().put(e).put(this)}}),n.Marker=n.invent({create:"marker",inherit:n.Container,extend:{width:function(t){return this.attr("markerWidth",t)},height:function(t){return this.attr("markerHeight",t)},ref:function(t,e){return this.attr("refX",t).attr("refY",e)},update:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this},toString:function(){return"url(#"+this.id()+")"}},construct:{marker:function(t,e,n){return this.defs().marker(t,e,n)}}}),n.extend(n.Defs,{marker:function(t,e,r){return this.put(new n.Marker).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(r)}}),n.extend(n.Line,n.Polyline,n.Polygon,n.Path,{marker:function(t,e,r,i){var s=["marker"];return"all"!=t&&s.push(t),s=s.join("-"),t=arguments[1]instanceof n.Marker?arguments[1]:this.doc().marker(e,r,i),this.attr(s,t)}});var l={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,e){return"color"==e?t:t+"-"+e}};function o(t,e,r,i){return r+i.replace(n.regex.dots," .")}function h(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function u(t){return t.charAt(0).toUpperCase()+t.slice(1)}function c(t){var e=t.toString(16);return 1==e.length?"0"+e:e}function m(t,e,n){if(null==e||null==n){var r=t.bbox();null==e?e=r.width/r.height*n:null==n&&(n=r.height/r.width*e)}return{width:e,height:n}}function p(t,e,n){return{x:e*t.a+n*t.c+0,y:e*t.b+n*t.d+0}}function d(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}function f(t,e){t.cx=null==t.cx?e.bbox().cx:t.cx,t.cy=null==t.cy?e.bbox().cy:t.cy}function x(t){return null==t.x&&(t.x=0,t.y=0,t.width=0,t.height=0),t.w=t.width,t.h=t.height,t.x2=t.x+t.width,t.y2=t.y+t.height,t.cx=t.x+t.width/2,t.cy=t.y+t.height/2,t}["fill","stroke"].forEach(function(t){var e,r={};r[t]=function(r){if(void 0===r)return this;if("string"==typeof r||n.Color.isRgb(r)||r&&"function"==typeof r.fill)this.attr(t,r);else for(e=l[t].length-1;e>=0;e--)null!=r[l[t][e]]&&this.attr(l.prefix(t,l[t][e]),r[l[t][e]]);return this},n.extend(n.Element,n.FX,r)}),n.extend(n.Element,n.FX,{rotate:function(t,e,n){return this.transform({rotation:t,cx:e,cy:n})},skew:function(t,e,n,r){return 1==arguments.length||3==arguments.length?this.transform({skew:t,cx:e,cy:n}):this.transform({skewX:t,skewY:e,cx:n,cy:r})},scale:function(t,e,n,r){return 1==arguments.length||3==arguments.length?this.transform({scale:t,cx:e,cy:n}):this.transform({scaleX:t,scaleY:e,cx:n,cy:r})},translate:function(t,e){return this.transform({x:t,y:e})},flip:function(t,e){return e="number"==typeof t?t:e,this.transform({flip:t||"both",offset:e})},matrix:function(t){return this.attr("transform",new n.Matrix(6==arguments.length?[].slice.call(arguments):t))},opacity:function(t){return this.attr("opacity",t)},dx:function(t){return this.x(new n.Number(t).plus(this instanceof n.FX?0:this.x()),!0)},dy:function(t){return this.y(new n.Number(t).plus(this instanceof n.FX?0:this.y()),!0)},dmove:function(t,e){return this.dx(t).dy(e)}}),n.extend(n.Rect,n.Ellipse,n.Circle,n.Gradient,n.FX,{radius:function(t,e){var r=(this._target||this).type;return"radial"==r||"circle"==r?this.attr("r",new n.Number(t)):this.rx(t).ry(null==e?t:e)}}),n.extend(n.Path,{length:function(){return this.node.getTotalLength()},pointAt:function(t){return this.node.getPointAtLength(t)}}),n.extend(n.Parent,n.Text,n.Tspan,n.FX,{font:function(t,e){if("object"==typeof t)for(e in t)this.font(e,t[e]);return"leading"==t?this.leading(e):"anchor"==t?this.attr("text-anchor",e):"size"==t||"family"==t||"weight"==t||"stretch"==t||"variant"==t||"style"==t?this.attr("font-"+t,e):this.attr(t,e)}}),n.Set=n.invent({create:function(t){Array.isArray(t)?this.members=t:this.clear()},extend:{add:function(){var t,e,n=[].slice.call(arguments);for(t=0,e=n.length;t<e;t++)this.members.push(n[t]);return this},remove:function(t){var e=this.index(t);return e>-1&&this.members.splice(e,1),this},each:function(t){for(var e=0,n=this.members.length;e<n;e++)t.apply(this.members[e],[e,this.members]);return this},clear:function(){return this.members=[],this},length:function(){return this.members.length},has:function(t){return this.index(t)>=0},index:function(t){return this.members.indexOf(t)},get:function(t){return this.members[t]},first:function(){return this.get(0)},last:function(){return this.get(this.members.length-1)},valueOf:function(){return this.members},bbox:function(){if(0==this.members.length)return new n.RBox;var t=this.members[0].rbox(this.members[0].doc());return this.each(function(){t=t.merge(this.rbox(this.doc()))}),t}},construct:{set:function(t){return new n.Set(t)}}}),n.FX.Set=n.invent({create:function(t){this.set=t}}),n.Set.inherit=function(){var t=[];for(var e in n.Shape.prototype)"function"==typeof n.Shape.prototype[e]&&"function"!=typeof n.Set.prototype[e]&&t.push(e);for(var e in t.forEach(function(t){n.Set.prototype[t]=function(){for(var e=0,r=this.members.length;e<r;e++)this.members[e]&&"function"==typeof this.members[e][t]&&this.members[e][t].apply(this.members[e],arguments);return"animate"==t?this.fx||(this.fx=new n.FX.Set(this)):this}}),t=[],n.FX.prototype)"function"==typeof n.FX.prototype[e]&&"function"!=typeof n.FX.Set.prototype[e]&&t.push(e);t.forEach(function(t){n.FX.Set.prototype[t]=function(){for(var e=0,n=this.set.members.length;e<n;e++)this.set.members[e].fx[t].apply(this.set.members[e].fx,arguments);return this}})},n.extend(n.Element,{data:function(t,e,n){if("object"==typeof t)for(e in t)this.data(e,t[e]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(e){return this.attr("data-"+t)}else this.attr("data-"+t,null===e?null:!0===n||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),n.extend(n.Element,{remember:function(t,e){if("object"==typeof arguments[0])for(var e in t)this.remember(e,t[e]);else{if(1==arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0==arguments.length)this._memory={};else for(var t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory||(this._memory={})}}),n.get=function(t){var r=e.getElementById(function(t){var e=t.toString().match(n.regex.reference);if(e)return e[1]}(t)||t);return n.adopt(r)},n.select=function(t,r){return new n.Set(n.utils.map((r||e).querySelectorAll(t),function(t){return n.adopt(t)}))},n.extend(n.Parent,{select:function(t){return n.select(t,this.node)}});var v="abcdef".split("");if("function"!=typeof t.CustomEvent){var y=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var r=e.createEvent("CustomEvent");return r.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),r};y.prototype=t.Event.prototype,t.CustomEvent=y}return function(e){for(var n=0,r=["moz","webkit"],i=0;i<r.length&&!t.requestAnimationFrame;++i)e.requestAnimationFrame=e[r[i]+"RequestAnimationFrame"],e.cancelAnimationFrame=e[r[i]+"CancelAnimationFrame"]||e[r[i]+"CancelRequestAnimationFrame"];e.requestAnimationFrame=e.requestAnimationFrame||function(t){var r=(new Date).getTime(),i=Math.max(0,16-(r-n)),s=e.setTimeout(function(){t(r+i)},i);return n=r+i,s},e.cancelAnimationFrame=e.cancelAnimationFrame||e.clearTimeout}(t),n}(i,i.document)}.call(e,n,e,t))||(t.exports=r)}("undefined"!=typeof window?window:this)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=n(0),s=500,a=null,l=null,o=0,h=0;function u(t,e){t.addEventListener("mouseover",function(){return function(t,e){if(null!=a)return;a=window.setTimeout(function(){var n=e(t);null!=n&&function(t,e){m();var n=h,r=function(){var t=document.body,e=document.documentElement;return Math.max(t.scrollHeight,t.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight)}();r-(n+e.offsetHeight)<10&&(n=r-(e.offsetHeight+10));n<10&&(n=10);l=e,document.body.appendChild(l),l.style.left=o+"px",l.style.top=n+"px",l.addEventListener("mouseout",function(e){c(t,e)})}(t,n)},s)}(t,e)}),t.addEventListener("mouseout",function(e){return c(t,e)})}function c(t,e){var n=e.toElement||e.relatedTarget;n!=t&&n!=l&&(r.findAncestorP(n,function(e){return e==t})||r.findAncestorP(n,function(t){return t==l})||(window.clearTimeout(a),a=null,m()))}function m(){null!=l&&(document.body.removeChild(l),l=null)}function p(t){if(null==t.relOp)return null;var e=new DOMParser,n=null!=t.relOp.actualRows?"<tr>\n <th>Actual Number of Rows</th>\n <td>"+t.relOp.actualRows+"</td>\n </tr>":"",r=null!=t.relOp.actualRowsRead?"<tr>\n <th>Number of Rows Read</th>\n <td>"+t.relOp.actualRowsRead+"</td>\n </tr>":"";return e.parseFromString('\n <div class="qp-tt"><table><tbody>\n '+n+"\n "+r+"\n <tr>\n <th>Estimated Number of Rows</th>\n <td>"+t.relOp.estimatedRows+"</td>\n </tr>\n <tr>\n <th>Estimated Row Size</th>\n <td>"+d(t.relOp.estimatedRowSize)+"</td>\n </tr>\n <tr>\n <th>Estimated Data Size</th>\n <td>"+d(t.relOp.estimatedDataSize)+"</td>\n </tr>\n </tbody></tabke></div>\n ","text/html").getElementsByClassName("qp-tt")[0]}function d(t){if(t>=1e4){var e=t/1024;if(e>=1e4){var n=e/1024;return Math.round(n)+" MB"}return Math.round(e)+" KB"}return t+" B"}e.initTooltip=function(t){!function(t){t.querySelector(".qp-root").className+=" qp-noCssTooltip"}(t),document.onmousemove=function(t){o=t.pageX,h=t.pageY};for(var e=t.querySelectorAll(".qp-node"),n=0;n<e.length;n++)u(e[n],function(t){return t.querySelector(".qp-tt").cloneNode(!0)});var r=t.getElementsByTagName("polyline"),s=function(t){var e=new i.Line(r[t]);u(e.element,function(t){return p(e)})};for(n=0;n<r.length;n++)s(n)},e.buildLineTooltip=p,e.convertSize=d},function(t,e){t.exports='<?xml version="1.0" encoding="utf-8"?>\r\n<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r\n xmlns:msxsl="urn:schemas-microsoft-com:xslt"\r\n xmlns:exslt="http://exslt.org/common"\r\n xmlns:s="http://schemas.microsoft.com/sqlserver/2004/07/showplan"\r\n exclude-result-prefixes="msxsl s xsl">\r\n <xsl:output method="html" indent="no" omit-xml-declaration="yes" />\r\n\r\n \x3c!-- Disable built-in recursive processing templates --\x3e\r\n <xsl:template match="*|/|text()|@*" mode="NodeLabel" />\r\n <xsl:template match="*|/|text()|@*" mode="NodeLabel2" />\r\n <xsl:template match="*|/|text()|@*" mode="ToolTipDescription" />\r\n <xsl:template match="*|/|text()|@*" mode="ToolTipDetails" />\r\n\r\n \x3c!-- Default template --\x3e\r\n <xsl:template match="/">\r\n <xsl:apply-templates select="s:ShowPlanXML" />\r\n </xsl:template>\r\n\r\n \x3c!-- Outermost div that contains all statement plans. --\x3e\r\n <xsl:template match="s:ShowPlanXML">\r\n <div class="qp-root">\r\n <xsl:apply-templates select="s:BatchSequence/s:Batch/s:Statements/*" mode="Statement" /> \r\n </div>\r\n </xsl:template>\r\n\r\n <xsl:template match="s:BatchSequence/s:Batch/s:Statements/*" mode="Statement">\r\n <div class="qp-statement-header">\r\n <div class="qp-statement-header-row">\r\n <div><xsl:value-of select="@StatementText" /></div>\r\n </div>\r\n <xsl:apply-templates select="s:QueryPlan/s:MissingIndexes/s:MissingIndexGroup" mode="MissingIndex" />\r\n </div>\r\n <xsl:apply-templates select="." mode="QpTr" />\r\n </xsl:template>\r\n\r\n <xsl:template match="s:MissingIndexGroup" mode="MissingIndex">\r\n <div class="qp-statement-header-row missing-index">\r\n <div>Missing Index (Impact <xsl:value-of select="@Impact" />): <xsl:apply-templates select="s:MissingIndex" mode="CreateIndex" /></div>\r\n </div>\r\n </xsl:template>\r\n\r\n \x3c!-- This template produces the "CREATE INDEX ..." text --\x3e\r\n <xsl:template match="s:MissingIndex" mode="CreateIndex">CREATE NONCLUSTERED INDEX [&lt;Name of Missing Index, sysname,>] ON <xsl:value-of select="@Schema" />.<xsl:value-of select="@Table" /> (<xsl:for-each select="s:ColumnGroup[@Usage!=\'INCLUDE\']/s:Column">\r\n <xsl:value-of select="@Name" />\r\n <xsl:if test="position() != last()">,</xsl:if>\r\n</xsl:for-each>)\r\n<xsl:if test="s:ColumnGroup[@Usage=\'INCLUDE\']"> INCLUDE (<xsl:for-each select="s:ColumnGroup[@Usage=\'INCLUDE\']/s:Column">\r\n <xsl:value-of select="@Name" />\r\n <xsl:if test="position() != last()">,</xsl:if>\r\n</xsl:for-each>)</xsl:if>\r\n </xsl:template>\r\n \r\n \x3c!-- Each node has a parent qp-tr element which contains / positions the node and its children --\x3e\r\n <xsl:template match="s:RelOp|s:StmtSimple|s:StmtUseDb|s:StmtCond|s:StmtCursor|s:Operation" mode="QpTr">\r\n <div class="qp-tr">\r\n <xsl:if test="@StatementId">\r\n <xsl:attribute name="data-statement-id"><xsl:value-of select="@StatementId" /></xsl:attribute>\r\n </xsl:if>\r\n <div>\r\n <div class="qp-node-outer">\r\n <div class="qp-node">\r\n <xsl:if test="@NodeId">\r\n <xsl:attribute name="data-node-id"><xsl:value-of select="@NodeId" /></xsl:attribute>\r\n </xsl:if>\r\n <xsl:call-template name="NodeIcon" />\r\n <div><xsl:apply-templates select="." mode="NodeLabel" /></div>\r\n <xsl:apply-templates select="." mode="NodeLabel2" />\r\n <xsl:apply-templates select="." mode="NodeCostLabel" />\r\n <xsl:call-template name="ToolTip" />\r\n </div>\r\n </div>\r\n </div>\r\n <div><xsl:apply-templates select="*/*" mode="QpTr" /></div>\r\n </div>\r\n </xsl:template>\r\n\r\n \x3c!-- Writes the tool tip --\x3e\r\n <xsl:template name="ToolTip">\r\n <div class="qp-tt">\r\n <div class="qp-tt-header"><xsl:apply-templates select="." mode="NodeLabel" /></div>\r\n <div><xsl:apply-templates select="." mode="ToolTipDescription" /></div>\r\n <xsl:call-template name="ToolTipGrid" />\r\n <xsl:apply-templates select="* | @* | */* | */@*" mode="ToolTipDetails" />\r\n <xsl:choose>\r\n <xsl:when test="s:QueryPlan">\r\n <xsl:apply-templates select="s:QueryPlan" mode="QueryPlanToolTipDetails" />\r\n </xsl:when>\r\n <xsl:otherwise>\r\n <xsl:call-template name="ToolTipDetails" />\r\n </xsl:otherwise>\r\n </xsl:choose>\r\n </div>\r\n </xsl:template>\r\n\r\n <xsl:template match="s:QueryPlan" mode="QueryPlanToolTipDetails">\r\n <xsl:call-template name="ToolTipDetails" />\r\n </xsl:template>\r\n\r\n \x3c!-- Writes the grid of node properties to the tool tip --\x3e\r\n <xsl:template name="ToolTipGrid">\r\n <table>\r\n \r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="s:QueryPlan/@CachedPlanSize" />\r\n <xsl:with-param name="Label">Cached plan size</xsl:with-param>\r\n <xsl:with-param name="Value" select="concat(s:QueryPlan/@CachedPlanSize, \' KB\')" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="@PhysicalOp" />\r\n <xsl:with-param name="Label">Physical Operation</xsl:with-param>\r\n <xsl:with-param name="Value"> \r\n <xsl:apply-templates select="." mode="PhysicalOperation" />\r\n </xsl:with-param>\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="@LogicalOp" />\r\n <xsl:with-param name="Label">Logical Operation</xsl:with-param>\r\n <xsl:with-param name="Value"> \r\n <xsl:apply-templates select="." mode="LogicalOperation" />\r\n </xsl:with-param>\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualJoinType" />\r\n <xsl:with-param name="Label">Actual Join Type</xsl:with-param>\r\n <xsl:with-param name="Value">\r\n <xsl:value-of select="s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualJoinType" />\r\n </xsl:with-param>\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="s:RunTimeInformation" />\r\n <xsl:with-param name="Label">Actual Execution Mode</xsl:with-param>\r\n <xsl:with-param name="Value">\r\n <xsl:choose>\r\n <xsl:when test="s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualExecutionMode">\r\n <xsl:value-of select="s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualExecutionMode" />\r\n </xsl:when>\r\n <xsl:otherwise>Row</xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:with-param>\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Label">Estimated Join Type</xsl:with-param>\r\n <xsl:with-param name="Value" select="@EstimatedJoinType" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="@IsAdaptive" />\r\n <xsl:with-param name="Label">Is Adaptive</xsl:with-param>\r\n <xsl:with-param name="Value">\r\n <xsl:choose>\r\n <xsl:when test="@IsAdaptive = \'true\'">True</xsl:when>\r\n <xsl:otherwise>False</xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:with-param>\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Label">Estimated Execution Mode</xsl:with-param>\r\n <xsl:with-param name="Value" select="@EstimatedExecutionMode" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Label">Storage</xsl:with-param>\r\n <xsl:with-param name="Value" select="s:IndexScan/@Storage|s:TableScan/@Storage" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Label">Number of Rows Read</xsl:with-param>\r\n <xsl:with-param name="Value" select="sum(s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualRowsRead)" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="@AdaptiveThresholdRows" />\r\n <xsl:with-param name="Label">Adaptive Threshold Rows</xsl:with-param>\r\n <xsl:with-param name="Value">\r\n <xsl:value-of select="@AdaptiveThresholdRows" />\r\n </xsl:with-param>\r\n </xsl:call-template>\r\n \r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="s:RunTimeInformation" />\r\n <xsl:with-param name="Label">Actual Number of Rows</xsl:with-param>\r\n <xsl:with-param name="Value" select="sum(s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualRows)" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="s:RunTimeInformation" />\r\n <xsl:with-param name="Label">Actual Number of Batches</xsl:with-param>\r\n <xsl:with-param name="Value" select="sum(s:RunTimeInformation/s:RunTimeCountersPerThread/@Batches)" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Label">Estimated Operator Cost</xsl:with-param>\r\n <xsl:with-param name="Value">\r\n <xsl:variable name="EstimatedOperatorCost">\r\n <xsl:call-template name="EstimatedOperatorCost" />\r\n </xsl:variable>\r\n <xsl:variable name="TotalCost">\r\n <xsl:value-of select="ancestor::s:QueryPlan/s:RelOp/@EstimatedTotalSubtreeCost" />\r\n </xsl:variable>\r\n <xsl:variable name="Percentage">\r\n <xsl:choose>\r\n <xsl:when test="$TotalCost > 0"><xsl:value-of select="number($EstimatedOperatorCost) div number($TotalCost)" /></xsl:when>\r\n <xsl:otherwise>0</xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:variable>\r\n <xsl:call-template name="round">\r\n <xsl:with-param name="value" select="$EstimatedOperatorCost" />\r\n </xsl:call-template> (<xsl:value-of select="format-number($Percentage, \'0%\')" />)</xsl:with-param>\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="@EstimateIO" />\r\n <xsl:with-param name="Label">Estimated I/O Cost</xsl:with-param>\r\n <xsl:with-param name="Value">\r\n <xsl:call-template name="round">\r\n <xsl:with-param name="value" select="@EstimateIO" />\r\n </xsl:call-template>\r\n </xsl:with-param>\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="@EstimateCPU" />\r\n <xsl:with-param name="Label">Estimated CPU Cost</xsl:with-param>\r\n <xsl:with-param name="Value">\r\n <xsl:call-template name="round">\r\n <xsl:with-param name="value" select="@EstimateCPU" />\r\n </xsl:call-template>\r\n </xsl:with-param>\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="@StatementSubTreeCost | @EstimatedTotalSubtreeCost" />\r\n <xsl:with-param name="Label">Estimated Subtree Cost</xsl:with-param>\r\n <xsl:with-param name="Value">\r\n <xsl:call-template name="round">\r\n <xsl:with-param name="value" select="@StatementSubTreeCost | @EstimatedTotalSubtreeCost" />\r\n </xsl:call-template>\r\n </xsl:with-param>\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Label">Estimated Number of Executions</xsl:with-param>\r\n <xsl:with-param name="Value" select="@EstimateRebinds + 1" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Label">Number of Executions</xsl:with-param>\r\n <xsl:with-param name="Value" select="sum(s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualExecutions)" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Label">Degree of Parallelism</xsl:with-param>\r\n <xsl:with-param name="Value" select="s:QueryPlan/@DegreeOfParallelism" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Label">Memory Grant</xsl:with-param>\r\n <xsl:with-param name="Value" select="s:QueryPlan/@MemoryGrant" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Label">Estimated Number of Rows to be Read</xsl:with-param>\r\n <xsl:with-param name="Value" select="@EstimatedRowsRead" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Label">Estimated Number of Rows</xsl:with-param>\r\n <xsl:with-param name="Value" select="@StatementEstRows | @EstimateRows" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="@AvgRowSize" />\r\n <xsl:with-param name="Label">Estimated Row Size</xsl:with-param>\r\n <xsl:with-param name="Value" select="concat(@AvgRowSize, \' B\')" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="s:RunTimeInformation" />\r\n <xsl:with-param name="Label">Actual Rebinds</xsl:with-param>\r\n <xsl:with-param name="Value" select="sum(s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualRebinds)" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="s:RunTimeInformation" />\r\n <xsl:with-param name="Label">Actual Rewinds</xsl:with-param>\r\n <xsl:with-param name="Value" select="sum(s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualRewinds)" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Condition" select="s:IndexScan/@Ordered" />\r\n <xsl:with-param name="Label">Ordered</xsl:with-param>\r\n <xsl:with-param name="Value">\r\n <xsl:choose>\r\n <xsl:when test="s:IndexScan/@Ordered = \'true\'">True</xsl:when>\r\n <xsl:when test="s:IndexScan/@Ordered = 1">True</xsl:when>\r\n <xsl:otherwise>False</xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:with-param>\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Label">Partitioning Type</xsl:with-param>\r\n <xsl:with-param name="Value" select="s:Parallelism/@PartitioningType" />\r\n </xsl:call-template>\r\n\r\n <xsl:call-template name="ToolTipRow">\r\n <xsl:with-param name="Label">Node ID</xsl:with-param>\r\n <xsl:with-param name="Value" select="@NodeId" />\r\n </xsl:call-template>\r\n\r\n </table>\r\n </xsl:template>\r\n\r\n \x3c!-- Gets the Physical Operation --\x3e\r\n <xsl:template match="s:RelOp" mode="PhysicalOperation">\r\n <xsl:value-of select="@PhysicalOp" />\r\n </xsl:template>\r\n <xsl:template match="s:RelOp[s:IndexScan/@Lookup]" mode="PhysicalOperation">Key Lookup</xsl:template>\r\n \r\n \x3c!-- Gets the Logical Operation --\x3e\r\n <xsl:template match="s:RelOp" mode="LogicalOperation">\r\n <xsl:value-of select="@LogicalOp" />\r\n </xsl:template>\r\n <xsl:template match="s:RelOp[s:IndexScan/@Lookup]" mode="LogicalOperation">Key Lookup</xsl:template>\r\n \r\n \x3c!-- Calculates the estimated operator cost. --\x3e\r\n <xsl:template name="EstimatedOperatorCost">\r\n <xsl:variable name="EstimatedTotalSubtreeCost">\r\n <xsl:call-template name="convertSciToNumString">\r\n <xsl:with-param name="inputVal">\r\n <xsl:choose>\r\n <xsl:when test="@EstimatedTotalSubtreeCost"><xsl:value-of select="@EstimatedTotalSubtreeCost" /></xsl:when>\r\n <xsl:otherwise>0</xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:with-param>\r\n </xsl:call-template>\r\n </xsl:variable>\r\n <xsl:variable name="ChildEstimatedSubtreeCost">\r\n <xsl:for-each select="*/s:RelOp">\r\n <value>\r\n <xsl:call-template name="convertSciToNumString">\r\n <xsl:with-param name="inputVal" select="@EstimatedTotalSubtreeCost" />\r\n </xsl:call-template>\r\n </value>\r\n </xsl:for-each>\r\n </xsl:variable>\r\n <xsl:variable name="TotalChildEstimatedSubtreeCost">\r\n <xsl:choose>\r\n <xsl:when test="function-available(\'exslt:node-set\')">\r\n <xsl:value-of select=\'sum(exslt:node-set($ChildEstimatedSubtreeCost)/value)\' />\r\n </xsl:when>\r\n <xsl:when test="function-available(\'msxsl:node-set\')">\r\n <xsl:value-of select=\'sum(msxsl:node-set($ChildEstimatedSubtreeCost)/value)\' />\r\n </xsl:when>\r\n </xsl:choose>\r\n </xsl:variable>\r\n <xsl:choose>\r\n <xsl:when test="number($EstimatedTotalSubtreeCost) - number($TotalChildEstimatedSubtreeCost) &lt; 0">0</xsl:when>\r\n <xsl:otherwise>\r\n <xsl:value-of select="number($EstimatedTotalSubtreeCost) - number($TotalChildEstimatedSubtreeCost)" />\r\n </xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:template>\r\n\r\n \x3c!-- Renders a row in the tool tip details table. --\x3e\r\n <xsl:template name="ToolTipRow">\r\n <xsl:param name="Label" />\r\n <xsl:param name="Value" />\r\n <xsl:param name="Condition" select="$Value" />\r\n <xsl:if test="$Condition">\r\n <tr>\r\n <th><xsl:value-of select="$Label" /></th>\r\n <td><xsl:value-of select="$Value" /></td>\r\n </tr>\r\n </xsl:if>\r\n </xsl:template>\r\n\r\n \x3c!-- Prints the name of an object. --\x3e\r\n <xsl:template match="s:Object | s:ColumnReference" mode="ObjectName">\r\n <xsl:param name="ExcludeDatabaseName" select="false()" />\r\n <xsl:choose>\r\n <xsl:when test="$ExcludeDatabaseName">\r\n <xsl:for-each select="@Table | @Index | @Column | @Alias">\r\n <xsl:value-of select="." />\r\n <xsl:if test="position() != last()">.</xsl:if>\r\n </xsl:for-each>\r\n </xsl:when>\r\n <xsl:otherwise>\r\n <xsl:for-each select="@Database | @Schema | @Table | @Index | @Column | @Alias">\r\n <xsl:value-of select="." />\r\n <xsl:if test="position() != last()">.</xsl:if>\r\n </xsl:for-each>\r\n </xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:template>\r\n \r\n <xsl:template match="s:Object | s:ColumnReference" mode="ObjectNameNoAlias">\r\n <xsl:for-each select="@Database | @Schema | @Table | @Index | @Column">\r\n <xsl:value-of select="." />\r\n <xsl:if test="position() != last()">.</xsl:if>\r\n </xsl:for-each>\r\n </xsl:template>\r\n\r\n \x3c!-- Displays the node cost label. --\x3e \r\n <xsl:template match="s:RelOp" mode="NodeCostLabel">\r\n <xsl:variable name="EstimatedOperatorCost"><xsl:call-template name="EstimatedOperatorCost" /></xsl:variable>\r\n <xsl:variable name="TotalCost"><xsl:value-of select="ancestor::s:QueryPlan/s:RelOp/@EstimatedTotalSubtreeCost" /></xsl:variable>\r\n <div>Cost: <xsl:value-of select="format-number(number($EstimatedOperatorCost) div number($TotalCost), \'0%\')" /></div>\r\n </xsl:template>\r\n\r\n \x3c!-- Dont show the node cost for statements. --\x3e\r\n <xsl:template match="s:StmtSimple|s:StmtUseDb" mode="NodeCostLabel" />\r\n\r\n <xsl:template match="s:StmtCursor|s:Operation|s:StmtCond" mode="NodeCostLabel">\r\n <div>Cost: 0%</div>\r\n </xsl:template>\r\n\r\n \x3c!-- \r\n ================================\r\n Tool tip detail sections\r\n ================================\r\n The following section contains templates used for writing the detail sections at the bottom of the tool tip,\r\n for example listing outputs, or information about the object to which an operator applies.\r\n --\x3e\r\n\r\n <xsl:template match="*/s:Object" mode="ToolTipDetails">\r\n \x3c!-- TODO: Make sure this works all the time --\x3e\r\n <div class="qp-bold">Object</div>\r\n <div><xsl:apply-templates select="." mode="ObjectName" /></div>\r\n </xsl:template>\r\n\r\n <xsl:template match="s:SetPredicate[s:ScalarOperator/@ScalarString]" mode="ToolTipDetails">\r\n <div class="qp-bold">Predicate</div>\r\n <div><xsl:value-of select="s:ScalarOperator/@ScalarString" /></div>\r\n </xsl:template>\r\n\r\n <xsl:template match="s:Predicate[s:ScalarOperator/@ScalarString]" mode="ToolTipDetails">\r\n <div class="qp-bold">Predicate</div>\r\n <div><xsl:value-of select="s:ScalarOperator/@ScalarString" /></div>\r\n </xsl:template>\r\n\r\n <xsl:template match="s:TopExpression[s:ScalarOperator/@ScalarString]" mode="ToolTipDetails">\r\n <div class="qp-bold">Top Expression</div>\r\n <div><xsl:value-of select="s:ScalarOperator/@ScalarString" /></div>\r\n </xsl:template>\r\n\r\n <xsl:template match="s:OutputList[count(s:ColumnReference) > 0]" mode="ToolTipDetails">\r\n <div class="qp-bold">Output List</div>\r\n <xsl:for-each select="s:ColumnReference">\r\n <div><xsl:apply-templates select="." mode="ObjectName" /></div>\r\n </xsl:for-each>\r\n </xsl:template>\r\n \r\n <xsl:template match="s:AdaptiveJoin/s:HashKeysProbe" mode="ToolTipDetails">\r\n <div class="qp-bold">Hash Keys Probe</div>\r\n <xsl:for-each select="s:ColumnReference">\r\n <div><xsl:apply-templates select="." mode="ObjectNameNoAlias" /></div>\r\n </xsl:for-each>\r\n </xsl:template>\r\n \r\n <xsl:template match="s:AdaptiveJoin/s:OuterReferences" mode="ToolTipDetails">\r\n <div class="qp-bold">Outer References</div>\r\n <xsl:for-each select="s:ColumnReference">\r\n <div><xsl:apply-templates select="." mode="ObjectNameNoAlias" /></div>\r\n </xsl:for-each>\r\n </xsl:template>\r\n\r\n <xsl:template match="s:NestedLoops/s:OuterReferences[count(s:ColumnReference) > 0]" mode="ToolTipDetails">\r\n <div class="qp-bold">Outer References</div>\r\n <xsl:for-each select="s:ColumnReference">\r\n <div><xsl:apply-templates select="." mode="ObjectName" /></div>\r\n </xsl:for-each>\r\n </xsl:template>\r\n\r\n <xsl:template match="@StatementText" mode="ToolTipDetails">\r\n <div class="qp-bold">Statement</div>\r\n <div><xsl:value-of select="." /></div>\r\n </xsl:template>\r\n \r\n <xsl:template match="s:StmtSimple/s:StoredProc" mode="ToolTipDetails">\r\n <div class="qp-bold">Procedure Name</div>\r\n <div><xsl:value-of select="@ProcName" /></div>\r\n </xsl:template>\r\n\r\n <xsl:template match="s:Sort/s:OrderBy[count(s:OrderByColumn/s:ColumnReference) > 0]" mode="ToolTipDetails">\r\n <div class="qp-bold">Order By</div>\r\n <xsl:for-each select="s:OrderByColumn">\r\n <div>\r\n <xsl:apply-templates select="s:ColumnReference" mode="ObjectName" />\r\n <xsl:choose>\r\n <xsl:when test="@Ascending = \'true\'"> Ascending</xsl:when>\r\n <xsl:when test="@Ascending = 1"> Ascending</xsl:when>\r\n <xsl:otherwise> Descending</xsl:otherwise>\r\n </xsl:choose>\r\n </div>\r\n </xsl:for-each>\r\n </xsl:template>\r\n\r\n \x3c!-- \r\n Seek Predicates Tooltip\r\n --\x3e\r\n\r\n <xsl:template match="s:SeekPredicates" mode="ToolTipDetails">\r\n <div class="qp-bold">Seek Predicates</div>\r\n <div>\r\n <xsl:for-each select="s:SeekPredicateNew/s:SeekKeys">\r\n <xsl:call-template name="SeekKeyDetail">\r\n <xsl:with-param name="position" select="position()" />\r\n </xsl:call-template>\r\n <xsl:if test="position() != last()">, </xsl:if>\r\n </xsl:for-each>\r\n </div>\r\n </xsl:template>\r\n\r\n \x3c!-- Turns out using apply-templates for this was a bad idea, but its too big a change to fix it all right now. This is probably\r\n the template that should contain tooltip details, I\'ll try to refactor more stuff into here over time, maybe. --\x3e\r\n <xsl:template name="ToolTipDetails">\r\n <xsl:variable name="relop" select="." />\r\n <xsl:if test="s:Warnings">\r\n <div class="qp-bold">Warnings</div>\r\n <div>\r\n <xsl:if test="s:Warnings/@NoJoinPredicate=1 or s:Warnings/@NoJoinPredicate=true"><div>No Join Predicate</div></xsl:if>\r\n <xsl:for-each select="s:UnmatchedIndexes/s:Parameterization/s:Object">\r\n <div>Unmatched index: <xsl:apply-templates select="." mode="ObjectNameNoAlias" /></div>\r\n </xsl:for-each>\r\n <xsl:for-each select="s:Warnings/s:SpillToTempDb">\r\n <div>Operator used tempdb to spill data during execution with spill level <xsl:value-of select="@SpillLevel" /> and <xsl:value-of select="@SpilledThreadCount" /> spilled thread(s)</div>\r\n </xsl:for-each>\r\n <xsl:for-each select="s:Warnings/s:ColumnsWithNoStatistics/s:ColumnReference">\r\n <div>Columns With No Statistics: <xsl:apply-templates select="." mode="ObjectNameNoAlias" /></div>\r\n </xsl:for-each>\r\n <xsl:for-each select="s:Warnings/s:Wait">\r\n <div>The query had to wait <xsl:value-of select="@WaitTime" /> seconds for <xsl:value-of select="@WaitType" /> during execution.</div>\r\n </xsl:for-each>\r\n <xsl:for-each select="s:Warnings/s:PlanAffectingConvert">\r\n <div>Type conversion in expression (<xsl:value-of select="@Expression" />) may affect "<xsl:value-of select="@ConvertIssue" />" in query plan choice.</div>\r\n </xsl:for-each>\r\n <xsl:for-each select="s:Warnings/s:SortSpillDetails">\r\n <div><xsl:value-of select="$relop/@LogicalOp" /> wrote <xsl:value-of select="@WritesToTempDb" /> pages to and read <xsl:value-of select="@ReadsFromTempDb" /> pages from tempdb with granted memory <xsl:value-of select="@GrantedMemoryKb" />KB and used memory <xsl:value-of select="@UsedMemoryKb" />KB.</div>\r\n </xsl:for-each>\r\n <xsl:for-each select="s:Warnings/s:MemoryGrantWarning">\r\n <div>The query memory grant detected "<xsl:value-of select="@GrantWarningKind" />", which may impact the reliability. Grant size: Initial <xsl:value-of select="@RequestedMemory" /> KB, Final <xsl:value-of select="@GrantedMemory" /> KB, Used <xsl:value-of select="@MaxUsedMemory" /> KB.</div>\r\n </xsl:for-each>\r\n <xsl:for-each select="s:Warnings/s:HashSpillDetails">\r\n <div>Hash wrote <xsl:value-of select="@WritesToTempDb" /> pages to and read <xsl:value-of select="@ReadsFromTempDb" /> pages from tempdb with granted memory <xsl:value-of select="@GrantedMemoryKb" />KB and used memory <xsl:value-of select="@UsedMemoryKb" />KB.</div>\r\n </xsl:for-each>\r\n </div>\r\n </xsl:if>\r\n </xsl:template>\r\n\r\n <xsl:template name="SeekKeyDetail">\r\n <xsl:param name="position" />Seek Keys[<xsl:value-of select="$position" />]: <xsl:for-each select="s:Prefix|s:StartRange|s:EndRange">\r\n <xsl:choose>\r\n <xsl:when test="self::s:Prefix">Prefix: </xsl:when>\r\n <xsl:when test="self::s:StartRange">Start: </xsl:when>\r\n <xsl:when test="self::s:EndRange">End: </xsl:when>\r\n </xsl:choose>\r\n <xsl:for-each select="s:RangeColumns/s:ColumnReference">\r\n <xsl:apply-templates select="." mode="ObjectNameNoAlias" />\r\n <xsl:if test="position() != last()">, </xsl:if>\r\n </xsl:for-each>\r\n <xsl:choose>\r\n <xsl:when test="@ScanType = \'EQ\'"> = </xsl:when>\r\n <xsl:when test="@ScanType = \'LT\'"> &lt; </xsl:when>\r\n <xsl:when test="@ScanType = \'GT\'"> > </xsl:when>\r\n <xsl:when test="@ScanType = \'LE\'"> &lt;= </xsl:when>\r\n <xsl:when test="@ScanType = \'GE\'"> >= </xsl:when>\r\n </xsl:choose>\r\n <xsl:for-each select="s:RangeExpressions/s:ScalarOperator">Scalar Operator(<xsl:value-of select="@ScalarString" />)<xsl:if test="position() != last()">, </xsl:if>\r\n </xsl:for-each>\r\n <xsl:if test="position() != last()">, </xsl:if>\r\n </xsl:for-each>\r\n </xsl:template>\r\n\r\n <xsl:template name="NodeIcon">\r\n <xsl:variable name="iconName">\r\n <xsl:choose>\r\n \x3c!-- Use the logical operation to determine the icon for the "Parallelism" operators. --\x3e\r\n <xsl:when test="@PhysicalOp = \'Parallelism\'"><xsl:value-of select="translate(@LogicalOp, \' \', \'\')" /></xsl:when>\r\n <xsl:when test="s:CursorPlan/@CursorActualType"><xsl:value-of select="s:CursorPlan/@CursorActualType" /></xsl:when>\r\n <xsl:when test="@OperationType"><xsl:value-of select="@OperationType" /></xsl:when>\r\n <xsl:when test="s:IndexScan/@Lookup">KeyLookup</xsl:when>\r\n <xsl:when test="s:IndexScan/@Storage = \'ColumnStore\'">ColumnStoreIndexScan</xsl:when>\r\n <xsl:when test="s:ScalarInsert/s:Object/@Storage = \'ColumnStore\'">ColumnStoreIndexInsert</xsl:when>\r\n <xsl:when test="s:Update/s:Object/@Storage = \'ColumnStore\'">ColumnStoreIndex<xsl:value-of select="@LogicalOp" /></xsl:when>\r\n <xsl:when test="s:TableValuedFunction">TableValuedFunction</xsl:when>\r\n \x3c!-- Use the physical operation to determine icon if it is present. --\x3e\r\n <xsl:when test="@PhysicalOp"><xsl:value-of select="translate(@PhysicalOp, \' \', \'\')" /></xsl:when>\r\n \x3c!-- Matches all statements. --\x3e\r\n <xsl:when test="local-name() = \'StmtSimple\'">Statement</xsl:when>\r\n <xsl:when test="local-name() = \'StmtCursor\'">StmtCursor</xsl:when>\r\n <xsl:when test="local-name() = \'StmtCond\'">StmtCond</xsl:when>\r\n \x3c!-- Fallback - show the Bitmap icon. --\x3e\r\n <xsl:otherwise>Catchall</xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:variable>\r\n <xsl:variable name="executionMode">\r\n <xsl:choose>\r\n <xsl:when test="s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualExecutionMode">\r\n <xsl:value-of select="s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualExecutionMode" />\r\n </xsl:when>\r\n <xsl:otherwise><xsl:value-of select="@EstimatedExecutionMode" /></xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:variable>\r\n <xsl:element name="div">\r\n <xsl:attribute name="class">qp-icon-<xsl:value-of select="$iconName" /></xsl:attribute>\r\n <xsl:if test="s:Warnings or s:QueryPlan/s:Warnings"><div class="qp-iconwarn" /></xsl:if>\r\n <xsl:if test="@Parallel=\'1\' or @Parallel=\'true\'"><div class="qp-iconpar" /></xsl:if>\r\n <xsl:if test="$executionMode=\'Batch\'"><div class="qp-iconbatch" /></xsl:if>\r\n </xsl:element>\r\n </xsl:template>\r\n\r\n \x3c!-- \r\n ================================\r\n Node labels\r\n ================================\r\n The following section contains templates used to determine the first (main) label for a node.\r\n --\x3e\r\n\r\n <xsl:template match="s:RelOp[s:ScalarInsert/s:Object/@Storage=\'ColumnStore\']" mode="NodeLabel">Columnstore Index Insert</xsl:template>\r\n <xsl:template match="s:RelOp[s:Update/s:Object/@Storage=\'ColumnStore\']" mode="NodeLabel">Columnstore Index <xsl:value-of select="@LogicalOp"/></xsl:template>\r\n <xsl:template match="s:RelOp[s:IndexScan]" mode="NodeLabel">\r\n <xsl:choose>\r\n <xsl:when test="s:IndexScan/@Storage=\'ColumnStore\'">Columnstore Index Scan</xsl:when>\r\n <xsl:when test="s:IndexScan/@Lookup and s:IndexScan/s:Object/@IndexKind=\'Clustered\'">Key Lookup</xsl:when>\r\n <xsl:when test="s:IndexScan/@Lookup">RID Lookup</xsl:when>\r\n <xsl:otherwise><xsl:value-of select="@PhysicalOp" /></xsl:otherwise>\r\n </xsl:choose>\r\n <xsl:if test="s:IndexScan/s:Object/@IndexKind"> (<xsl:value-of select="s:IndexScan/s:Object/@IndexKind" />)</xsl:if>\r\n </xsl:template>\r\n\r\n <xsl:template match="s:RelOp" mode="NodeLabel">\r\n <xsl:value-of select="@PhysicalOp" />\r\n </xsl:template>\r\n\r\n <xsl:template match="*[@StatementType]" mode="NodeLabel">\r\n <xsl:value-of select="@StatementType" />\r\n </xsl:template>\r\n \r\n <xsl:template match="*[s:StoredProc]" mode="NodeLabel">Stored Procedure</xsl:template>\r\n\r\n <xsl:template match="*[s:CursorPlan/@CursorActualType = \'Dynamic\']" mode="NodeLabel">Dynamic</xsl:template>\r\n <xsl:template match="*[s:CursorPlan/@CursorActualType = \'FastForward\']" mode="NodeLabel">Fast Forward</xsl:template>\r\n <xsl:template match="*[s:CursorPlan/@CursorActualType = \'Keyset\']" mode="NodeLabel">Keyset</xsl:template>\r\n <xsl:template match="*[s:CursorPlan/@CursorActualType = \'SnapShot\']" mode="NodeLabel">Snapshot</xsl:template> \r\n\r\n <xsl:template match="*[@OperationType = \'FetchQuery\']" mode="NodeLabel">Fetch Query</xsl:template>\r\n <xsl:template match="*[@OperationType = \'PopulateQuery\']" mode="NodeLabel">Population Query</xsl:template>\r\n <xsl:template match="*[@OperationType = \'RefreshQuery\']" mode="NodeLabel">Refresh Query</xsl:template>\r\n\r\n \x3c!--\r\n ================================\r\n Node alternate labels\r\n ================================\r\n The following section contains templates used to determine the second label to be displayed for a node.\r\n --\x3e\r\n\r\n \x3c!-- Display the object for any node that has one --\x3e\r\n <xsl:template match="*[*/s:Object]" mode="NodeLabel2">\r\n <xsl:variable name="ObjectName">\r\n <xsl:apply-templates select="*/s:Object" mode="ObjectName">\r\n <xsl:with-param name="ExcludeDatabaseName" select="true()" />\r\n </xsl:apply-templates>\r\n </xsl:variable>\r\n <div>\r\n <xsl:value-of select="substring($ObjectName, 0, 36)" />\r\n <xsl:if test="string-length($ObjectName) >= 36">…</xsl:if>\r\n </div>\r\n </xsl:template>\r\n\r\n \x3c!-- Display the logical operation for any node where it is not the same as the physical operation. --\x3e\r\n <xsl:template match="s:RelOp[@LogicalOp != @PhysicalOp]" mode="NodeLabel2">\r\n <div>(<xsl:value-of select="@LogicalOp" />)</div>\r\n </xsl:template>\r\n\r\n \x3c!-- Disable the default template --\x3e\r\n <xsl:template match="*" mode="NodeLabel2" />\r\n\r\n \x3c!-- \r\n ================================\r\n Tool tip descriptions\r\n ================================\r\n The following section contains templates used for writing the description shown in the tool tip.\r\n --\x3e\r\n\r\n <xsl:template match="*[@PhysicalOp = \'Table Insert\']" mode="ToolTipDescription">Insert input rows into the table specified in Argument field.</xsl:template>\r\n <xsl:template match="*[@PhysicalOp = \'Compute Scalar\']" mode="ToolTipDescription">Compute new values from existing values in a row.</xsl:template>\r\n <xsl:template match="*[@PhysicalOp = \'Sort\']" mode="ToolTipDescription">Sort the input.</xsl:template>\r\n <xsl:template match="*[@PhysicalOp = \'Clustered Index Scan\']" mode="ToolTipDescription">Scanning a clustered index, entirely or only a range.</xsl:template>\r\n <xsl:template match="*[@PhysicalOp = \'Stream Aggregate\']" mode="ToolTipDescription">Compute summary values for groups of rows in a suitably sorted stream.</xsl:template>\r\n <xsl:template match="*[@PhysicalOp = \'Hash Match\']" mode="ToolTipDescription">Use each row from the top input to build a hash table, and each row from the bottom input to probe into the hash table, outputting all matching rows.</xsl:template>\r\n <xsl:template match="*[@PhysicalOp = \'Bitmap\']" mode="ToolTipDescription">Bitmap.</xsl:template>\r\n <xsl:template match="*[@PhysicalOp = \'Clustered Index Seek\']" mode="ToolTipDescription">Scanning a particular range of rows from a clustered index.</xsl:template>\r\n <xsl:template match="*[@PhysicalOp = \'Index Seek\']" mode="ToolTipDescription">Scan a particular range of rows from a nonclustered index.</xsl:template>\r\n <xsl:template match="*[@PhysicalOp = \'Adaptive Join\']" mode="ToolTipDescription">Chooses dynamically between hash join and nested loops.</xsl:template>\r\n <xsl:template match="*[@PhysicalOp = \'Index Spool\']" mode="ToolTipDescription">Reformats the data from the input into a temporary index, which is then used for seeking with the supplied seek predicate.</xsl:template>\r\n <xsl:template match="*[s:IndexScan/@Lookup]" mode="ToolTipDescription">Uses a supplied clustering key to lookup on a table that has a clustered index.</xsl:template>\r\n\r\n <xsl:template match="*[@PhysicalOp = \'Parallelism\' and @LogicalOp=\'Repartition Streams\']" mode="ToolTipDescription">Repartition Streams.</xsl:template>\r\n <xsl:template match="*[@PhysicalOp = \'Parallelism\']" mode="ToolTipDescription">An operation involving parallelism.</xsl:template>\r\n \r\n <xsl:template match="*[s:TableScan]" mode="ToolTipDescription">Scan rows from a table.</xsl:template>\r\n <xsl:template match="*[s:NestedLoops]" mode="ToolTipDescription">For each row in the top (outer) input, scan the bottom (inner) input, and output matching rows.</xsl:template>\r\n <xsl:template match="*[s:Top]" mode="ToolTipDescription">Select the first few rows based on a sort order.</xsl:template>\r\n \r\n <xsl:template match="*[@OperationType=\'FetchQuery\']" mode="ToolTipDescription">The query used to retrieve rows when a fetch is issued against a cursor.</xsl:template>\r\n <xsl:template match="*[@OperationType=\'PopulateQuery\']" mode="ToolTipDescription">The query used to populate a cursor\'s work table when the cursor is opened.</xsl:template>\r\n <xsl:template match="*[s:CursorPlan/@CursorActualType=\'FastForward\']" mode="ToolTipDescription">Fast Forward.</xsl:template>\r\n <xsl:template match="*[s:CursorPlan/@CursorActualType=\'Dynamic\']" mode="ToolTipDescription">Cursor that can see all changes made by others.</xsl:template>\r\n <xsl:template match="*[s:CursorPlan/@CursorActualType=\'Keyset\']" mode="ToolTipDescription">Cursor that can see updates made by others, but not inserts.</xsl:template>\r\n <xsl:template match="*[s:CursorPlan/@CursorActualType=\'SnapShot\']" mode="ToolTipDescription">A cursor that does not see changes made by others.</xsl:template>\r\n\r\n \x3c!-- \r\n ================================\r\n Number handling\r\n ================================\r\n The following section contains templates used for handling numbers (scientific notation, rounding etc...)\r\n --\x3e\r\n\r\n \x3c!-- Outputs a number rounded to 7 decimal places - to be used for displaying all numbers.\r\n This template accepts numbers in scientific notation. --\x3e\r\n <xsl:template name="round">\r\n <xsl:param name="value" select="0" />\r\n <xsl:variable name="number">\r\n <xsl:call-template name="convertSciToNumString">\r\n <xsl:with-param name="inputVal" select="$value" />\r\n </xsl:call-template>\r\n </xsl:variable>\r\n <xsl:value-of select="format-number(round(number($number) * 10000000) div 10000000, \'0.#######\')" />\r\n </xsl:template>\r\n \r\n \x3c!-- Template for handling of scientific numbers\r\n See: http://www.orm-designer.com/article/xslt-convert-scientific-notation-to-decimal-number --\x3e\r\n <xsl:variable name="max-exp">\r\n <xsl:value-of select="\'0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\'" />\r\n </xsl:variable>\r\n\r\n <xsl:template name="convertSciToNumString">\r\n <xsl:param name="inputVal" select="0" />\r\n\r\n <xsl:variable name="numInput">\r\n <xsl:value-of select="translate(string($inputVal),\'e\',\'E\')" />\r\n </xsl:variable>\r\n\r\n <xsl:choose>\r\n <xsl:when test="number($numInput) = $numInput">\r\n <xsl:value-of select="$numInput" />\r\n </xsl:when> \r\n <xsl:otherwise>\r\n \x3c!-- ==== Mantisa ==== --\x3e\r\n <xsl:variable name="numMantisa">\r\n <xsl:value-of select="number(substring-before($numInput,\'E\'))" />\r\n </xsl:variable>\r\n\r\n \x3c!-- ==== Exponent ==== --\x3e\r\n <xsl:variable name="numExponent">\r\n <xsl:choose>\r\n <xsl:when test="contains($numInput,\'E+\')">\r\n <xsl:value-of select="substring-after($numInput,\'E+\')" />\r\n </xsl:when>\r\n <xsl:otherwise>\r\n <xsl:value-of select="substring-after($numInput,\'E\')" />\r\n </xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:variable>\r\n\r\n \x3c!-- ==== Coefficient ==== --\x3e\r\n <xsl:variable name="numCoefficient">\r\n <xsl:choose>\r\n <xsl:when test="$numExponent > 0">\r\n <xsl:text>1</xsl:text>\r\n <xsl:value-of select="substring($max-exp, 1, number($numExponent))" />\r\n </xsl:when>\r\n <xsl:when test="$numExponent &lt; 0">\r\n <xsl:text>0.</xsl:text>\r\n <xsl:value-of select="substring($max-exp, 1, -number($numExponent)-1)" />\r\n <xsl:text>1</xsl:text>\r\n </xsl:when>\r\n <xsl:otherwise>1</xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:variable>\r\n <xsl:value-of select="number($numCoefficient) * number($numMantisa)" />\r\n </xsl:otherwise>\r\n </xsl:choose>\r\n </xsl:template>\r\n</xsl:stylesheet>\r\n'}])});
\ No newline at end of file
diff --git a/frontend/src/ExplainVisualizerApp.vue b/frontend/src/ExplainVisualizerApp.vue
index ee576c9c1a..27dae64825 100644
--- a/frontend/src/ExplainVisualizerApp.vue
+++ b/frontend/src/ExplainVisualizerApp.vue
@@ -1,10 +1,24 @@
<template>
<div id="app" class="d-flex">
- <pev2
- v-if="storedQuery"
- :plan-source="storedQuery.explain"
- :plan-query="storedQuery.statement"
- />
+ <template v-if="storedQuery">
+ <!-- PostgreSQL visualization using pev2 -->
+ <pev2
+ v-if="isPostgreSQL"
+ :plan-source="storedQuery.explain"
+ :plan-query="storedQuery.statement"
+ />
+ <!-- MSSQL visualization using html-query-plan -->
+ <div
+ v-else-if="isMSSQL"
+ ref="mssqlContainer"
+ class="mssql-query-plan-container"
+ />
+ <!-- Fallback for unsupported engines -->
+ <div v-else class="unsupported-engine">
+ <h2>Unsupported Database Engine</h2>
+ <p>Query plan visualization is not available for this database engine.</p>
+ </div>
+ </template>
<template v-else>
<h1>session expired</h1>
</template>
@@ -14,16 +28,79 @@
<script setup lang="ts">
import { Plan as pev2 } from "pev2";
import "pev2/dist/pev2.css";
+import "html-query-plan/css/qp.css";
import { parse } from "qs";
-import { computed } from "vue";
+import { computed, onMounted, ref } from "vue";
+import { Engine } from "@/types/proto-es/v1/common_pb";
import { readExplainFromToken } from "@/utils/pev2";
+// Declare the global QP object from html-query-plan
+declare global {
+ interface Window {
+ QP: {
+ showPlan: (container: Element, planXml: string, options?: any) => void;
+ };
+ }
+}
+
const token = computed(() => {
const query = location.search.replace(/^\?/, "");
return (parse(query).token as string) || "";
});
const storedQuery = computed(() => readExplainFromToken(token.value));
+
+const isPostgreSQL = computed(
+ () => storedQuery.value?.engine === Engine.POSTGRES
+);
+const isMSSQL = computed(() => storedQuery.value?.engine === Engine.MSSQL);
+
+const mssqlContainer = ref<HTMLDivElement>();
+const qpLoaded = ref(false);
+
+// Load html-query-plan script dynamically
+const loadQueryPlanScript = () => {
+ return new Promise<void>((resolve, reject) => {
+ // Check if already loaded
+ if (window.QP) {
+ qpLoaded.value = true;
+ resolve();
+ return;
+ }
+
+ // Check if script already exists
+ if (document.getElementById("html-query-plan-script")) {
+ qpLoaded.value = true;
+ resolve();
+ return;
+ }
+
+ const script = document.createElement("script");
+ script.id = "html-query-plan-script";
+ script.src = "/libs/qp.min.js";
+ script.onload = () => {
+ qpLoaded.value = true;
+ resolve();
+ };
+ script.onerror = () => {
+ reject(new Error("Failed to load html-query-plan script"));
+ };
+ document.head.appendChild(script);
+ });
+};
+
+onMounted(async () => {
+ if (isMSSQL.value && mssqlContainer.value && storedQuery.value) {
+ try {
+ await loadQueryPlanScript();
+ if (window.QP && mssqlContainer.value) {
+ window.QP.showPlan(mssqlContainer.value, storedQuery.value.explain);
+ }
+ } catch (error) {
+ console.error("Failed to load query plan visualizer:", error);
+ }
+ }
+});
</script>
<style>
@@ -32,4 +109,36 @@ body,
#app {
height: 100%;
}
+
+.mssql-query-plan-container {
+ width: 100%;
+ height: 100%;
+ overflow: auto;
+ padding: 16px;
+}
+
+.unsupported-engine {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ height: 100%;
+ padding: 24px;
+ text-align: center;
+}
+
+.unsupported-engine h2 {
+ margin-bottom: 8px;
+ color: #666;
+}
+
+.unsupported-engine p {
+ color: #999;
+}
+
+.qp-root {
+ width: 100%;
+ height: 100%;
+}
</style>
diff --git a/frontend/src/composables/useExecuteSQL.ts b/frontend/src/composables/useExecuteSQL.ts
index 2ba016c1b1..8eedb5961e 100644
--- a/frontend/src/composables/useExecuteSQL.ts
+++ b/frontend/src/composables/useExecuteSQL.ts
@@ -29,6 +29,7 @@ import { isValidDatabaseName } from "@/types";
import { Engine } from "@/types/proto-es/v1/common_pb";
import { DatabaseGroupView } from "@/types/proto-es/v1/database_group_service_pb";
import {
+ type QueryOption,
QueryOptionSchema,
QueryRequestSchema,
QueryResult_PermissionDenied_CommandType,
@@ -288,6 +289,7 @@ const useExecuteSQL = () => {
}
const queryOption = create(QueryOptionSchema, {
+ ...(context.params.queryOption ?? ({} as QueryOption)),
redisRunCommandsOn: sqlEditorStore.redisCommandOption,
});
const resultSet = await sqlStore.query(
diff --git a/frontend/src/types/proto-es/v1/sql_service_pb.d.ts b/frontend/src/types/proto-es/v1/sql_service_pb.d.ts
index 5ad4e89b57..6638d483d3 100644
--- a/frontend/src/types/proto-es/v1/sql_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/sql_service_pb.d.ts
@@ -178,6 +178,11 @@ export declare type QueryOption = Message<"bytebase.v1.QueryOption"> & {
* @generated from field: bytebase.v1.QueryOption.RedisRunCommandsOn redis_run_commands_on = 1;
*/
redisRunCommandsOn: QueryOption_RedisRunCommandsOn;
+
+ /**
+ * @generated from field: bytebase.v1.QueryOption.MSSQLExplainFormat mssql_explain_format = 2;
+ */
+ mssqlExplainFormat: QueryOption_MSSQLExplainFormat;
};
/**
@@ -217,6 +222,37 @@ export enum QueryOption_RedisRunCommandsOn {
*/
export declare const QueryOption_RedisRunCommandsOnSchema: GenEnum<QueryOption_RedisRunCommandsOn>;
+/**
+ * @generated from enum bytebase.v1.QueryOption.MSSQLExplainFormat
+ */
+export enum QueryOption_MSSQLExplainFormat {
+ /**
+ * defaults to SHOWPLAN_ALL
+ *
+ * @generated from enum value: MSSQL_EXPLAIN_FORMAT_UNSPECIFIED = 0;
+ */
+ MSSQL_EXPLAIN_FORMAT_UNSPECIFIED = 0,
+
+ /**
+ * SHOWPLAN_ALL
+ *
+ * @generated from enum value: MSSQL_EXPLAIN_FORMAT_ALL = 1;
+ */
+ MSSQL_EXPLAIN_FORMAT_ALL = 1,
+
+ /**
+ * SHOWPLAN_XML
+ *
+ * @generated from enum value: MSSQL_EXPLAIN_FORMAT_XML = 2;
+ */
+ MSSQL_EXPLAIN_FORMAT_XML = 2,
+}
+
+/**
+ * Describes the enum bytebase.v1.QueryOption.MSSQLExplainFormat.
+ */
+export declare const QueryOption_MSSQLExplainFormatSchema: GenEnum<QueryOption_MSSQLExplainFormat>;
+
/**
* @generated from message bytebase.v1.QueryResult
*/
diff --git a/frontend/src/types/proto-es/v1/sql_service_pb.js b/frontend/src/types/proto-es/v1/sql_service_pb.js
index c4921d76dc..4fae6614e4 100644
--- a/frontend/src/types/proto-es/v1/sql_service_pb.js
+++ b/frontend/src/types/proto-es/v1/sql_service_pb.js
@@ -16,7 +16,7 @@ import { file_v1_database_service } from "./database_service_pb";
* Describes the file v1/sql_service.proto.
*/
export const file_v1_sql_service = /*@__PURE__*/
- fileDesc("ChR2MS9zcWxfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEisAEKE0FkbWluRXhlY3V0ZVJlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVieXRlYmFzZS5jb20vRGF0YWJhc2USEQoJc3RhdGVtZW50GAMgASgJEg0KBWxpbWl0GAQgASgFEhMKBnNjaGVtYRgGIAEoCUgAiAEBEhYKCWNvbnRhaW5lchgHIAEoCUgBiAEBQgkKB19zY2hlbWFCDAoKX2NvbnRhaW5lckoECAIQAyJBChRBZG1pbkV4ZWN1dGVSZXNwb25zZRIpCgdyZXN1bHRzGAEgAygLMhguYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQihwIKDFF1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vbXBsZXRpb25SZXNwb25zZSIjkOowAoLT5JMCGToBKiIUL3YxL3NxbC9haUNvbXBsZXRpb25CpQEKD2NvbS5ieXRlYmFzZS52MUIPU3FsU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_google_api_annotations, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_struct, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_database_catalog_service, file_v1_database_service]);
+ fileDesc("ChR2MS9zcWxfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEisAEKE0FkbWluRXhlY3V0ZVJlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVieXRlYmFzZS5jb20vRGF0YWJhc2USEQoJc3RhdGVtZW50GAMgASgJEg0KBWxpbWl0GAQgASgFEhMKBnNjaGVtYRgGIAEoCUgAiAEBEhYKCWNvbnRhaW5lchgHIAEoCUgBiAEBQgkKB19zY2hlbWFCDAoKX2NvbnRhaW5lckoECAIQAyJBChRBZG1pbkV4ZWN1dGVSZXNwb25zZRIpCgdyZXN1bHRzGAEgAygLMhguYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQihwIKDFF1ZXJ5UmVxdWVzdBIrCgRuYW1lGAEgASgJQh3gQQL6QRcKFWJ5dGViYXNlLmNvbS9EYXRhYmFzZRIRCglzdGF0ZW1lbnQYAyABKAkSDQoFbGltaXQYBCABKAUSGwoOZGF0YV9zb3VyY2VfaWQYBiABKAlCA+BBAhIPCgdleHBsYWluGAcgASgIEhMKBnNjaGVtYRgIIAEoCUgAiAEBEi4KDHF1ZXJ5X29wdGlvbhgJIAEoCzIYLmJ5dGViY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5BSUNvbXBsZXRpb25SZXNwb25zZSIjkOowAoLT5JMCGToBKiIUL3YxL3NxbC9haUNvbXBsZXRpb25CpQEKD2NvbS5ieXRlYmFzZS52MUIPU3FsU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_google_api_annotations, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_struct, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_database_catalog_service, file_v1_database_service]);
/**
* Describes the message bytebase.v1.AdminExecuteRequest.
@@ -65,6 +65,18 @@ export const QueryOption_RedisRunCommandsOnSchema = /*@__PURE__*/
export const QueryOption_RedisRunCommandsOn = /*@__PURE__*/
tsEnum(QueryOption_RedisRunCommandsOnSchema);
+/**
+ * Describes the enum bytebase.v1.QueryOption.MSSQLExplainFormat.
+ */
+export const QueryOption_MSSQLExplainFormatSchema = /*@__PURE__*/
+ enumDesc(file_v1_sql_service, 4, 1);
+
+/**
+ * @generated from enum bytebase.v1.QueryOption.MSSQLExplainFormat
+ */
+export const QueryOption_MSSQLExplainFormat = /*@__PURE__*/
+ tsEnum(QueryOption_MSSQLExplainFormatSchema);
+
/**
* Describes the message bytebase.v1.QueryResult.
* Use `create(QueryResultSchema)` to create a new message.
diff --git a/frontend/src/types/sqlEditor/editor.ts b/frontend/src/types/sqlEditor/editor.ts
index f40659ab02..f8370ba8ac 100644
--- a/frontend/src/types/sqlEditor/editor.ts
+++ b/frontend/src/types/sqlEditor/editor.ts
@@ -1,5 +1,6 @@
import type * as monaco from "monaco-editor";
import { Engine } from "../proto-es/v1/common_pb";
+import { type QueryOption } from "../proto-es/v1/sql_service_pb";
export type EditorModel = monaco.editor.ITextModel;
export type EditorPosition = monaco.Position;
@@ -76,4 +77,5 @@ export type SQLEditorQueryParams = {
explain: boolean;
// Use to calculate the advice position.
selection: monaco.Selection | null;
+ queryOption?: QueryOption;
};
diff --git a/frontend/src/utils/pev2.ts b/frontend/src/utils/pev2.ts
index 0822e49207..8eb8293029 100644
--- a/frontend/src/utils/pev2.ts
+++ b/frontend/src/utils/pev2.ts
@@ -1,19 +1,25 @@
+import { Engine } from "@/types/proto-es/v1/common_pb";
import { randomString } from "./util";
-export const createExplainToken = (
- statement: string,
- explain: string
-): string => {
+export type StoredExplain = {
+ statement: string;
+ explain: string;
+ engine: Engine;
+};
+
+export const createExplainToken = ({
+ statement,
+ explain,
+ engine,
+}: StoredExplain): string => {
const token = `pev2-${randomString(32)}`;
- const json = JSON.stringify({ statement, explain });
+ const json = JSON.stringify({ statement, explain, engine });
sessionStorage.setItem(token, json);
return token;
};
-export type StoredExplain = { statement: string; explain: string };
-
export const readExplainFromToken = (token: string) => {
if (!token) return undefined;
try {
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue
index d373ccc35d..ea6d15f8da 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue
@@ -54,7 +54,7 @@ import { escape } from "lodash-es";
import { NButton } from "naive-ui";
import { twMerge } from "tailwind-merge";
import { computed, ref } from "vue";
-import { useConnectionOfCurrentSQLEditorTab } from "@/store";
+import { type ComposedDatabase } from "@/types";
import { Engine } from "@/types/proto-es/v1/common_pb";
import type { QueryRow, RowValue } from "@/types/proto-es/v1/sql_service_pb";
import { extractSQLRowValuePlain, getHighlightHTMLByRegExp } from "@/utils";
@@ -76,10 +76,10 @@ const props = defineProps<{
colIndex: number;
allowSelect?: boolean;
columnType: string; // Column type from QueryResult
+ database: ComposedDatabase;
}>();
const { detail, keyword } = useSQLResultViewContext();
-const { database } = useConnectionOfCurrentSQLEditorTab();
const { getBinaryFormat, setBinaryFormat } = useBinaryFormatContext();
const {
@@ -124,7 +124,7 @@ useResizeObserver(wrapperRef, (entries) => {
const clickable = computed(() => {
if (truncated.value) return true;
- if (database.value.instanceResource.engine === Engine.MONGODB) {
+ if (props.database.instanceResource.engine === Engine.MONGODB) {
// A cheap way to check JSON string without paying the parsing cost.
const maybeJSON = String(props.value).trim();
return (
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/VirtualDataTable.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/VirtualDataTable.vue
index 2f44fae500..9d21e73c52 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/VirtualDataTable.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/VirtualDataTable.vue
@@ -80,7 +80,7 @@
<!-- The drag-to-resize handler -->
<div
- class="absolute w-[8px] right-0 top-0 bottom-0 cursor-col-resize"
+ class="absolute w-2 right-0 top-0 bottom-0 cursor-col-resize"
@pointerdown="tableResize.startResizing(header.index)"
@click.stop.prevent
/>
@@ -158,6 +158,7 @@
'h-full': true,
'w-full': true,
}"
+ :database="database"
/>
</div>
<div
@@ -198,6 +199,7 @@ import type { Table } from "@tanstack/vue-table";
import { useVirtualizer } from "@tanstack/vue-virtual";
import { NEmpty } from "naive-ui";
import { computed, nextTick, onMounted, ref, watch } from "vue";
+import { type ComposedDatabase } from "@/types";
import {
type QueryRow,
type RowValue,
@@ -224,6 +226,7 @@ const props = defineProps<{
isSensitiveColumn: (index: number) => boolean;
getMaskingReason?: (index: number) => any;
maxHeight?: number;
+ database: ComposedDatabase;
}>();
const {
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
index dc95ed841d..6382921b50 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
@@ -134,7 +134,7 @@
v-else-if="resultSet.error.includes('resource not found')"
:type="'primary'"
:text="true"
- :database="database ?? connectedDatabase"
+ :database="database"
/>
</template>
</ErrorView>
@@ -188,7 +188,6 @@ import DataExportButton from "@/components/DataExportButton.vue";
import { parseStringToResource } from "@/components/GrantRequestPanel/DatabaseResourceForm/common";
import { Drawer } from "@/components/v2";
import {
- useConnectionOfCurrentSQLEditorTab,
usePolicyV1Store,
useSQLEditorStore,
useSQLEditorTabStore,
@@ -237,8 +236,6 @@ defineEmits<{
const { t } = useI18n();
const policyStore = usePolicyV1Store();
-const { instance, database: connectedDatabase } =
- useConnectionOfCurrentSQLEditorTab();
const tabStore = useSQLEditorTabStore();
const { project } = storeToRefs(useSQLEditorStore());
@@ -315,17 +312,14 @@ const disallowCopyingData = computed(() => {
return false;
}
- let environment = instance.value.environment;
- if (props.database) {
- if (
- policyStore.getQueryDataPolicyByParent(props.database.project)
- .disableCopyData
- ) {
- return true;
- }
- // If the database is provided, use its effective environment.
- environment = props.database.effectiveEnvironment;
+ if (
+ policyStore.getQueryDataPolicyByParent(props.database.project)
+ .disableCopyData
+ ) {
+ return true;
}
+ // If the database is provided, use its effective environment.
+ const environment = props.database.effectiveEnvironment;
// Check if the environment has a policy that disables copying data.
if (environment) {
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
index 287cabfeb6..0bc6620545 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
@@ -127,6 +127,7 @@
:offset="pageIndex * pageSize"
:is-sensitive-column="isSensitiveColumn"
:get-masking-reason="getMaskingReason"
+ :database="database"
/>
<VirtualDataTable
v-else
@@ -135,6 +136,7 @@
:offset="pageIndex * pageSize"
:is-sensitive-column="isSensitiveColumn"
:get-masking-reason="getMaskingReason"
+ :database="database"
/>
</div>
@@ -155,7 +157,7 @@
{{ $t("common.click-to-copy") }}
</NTooltip>
</div>
- <div class="shrink-0 gap-x-2">
+ <div class="flex items-center shrink-0 gap-x-2">
<NButton
v-if="showVisualizeButton"
text
@@ -184,6 +186,7 @@
</template>
<script lang="ts" setup>
+import { create } from "@bufbuild/protobuf";
import type { ColumnDef } from "@tanstack/vue-table";
import {
getCoreRowModel,
@@ -203,6 +206,7 @@ import {
NTooltip,
type SelectOption,
} from "naive-ui";
+import { v4 as uuidv4 } from "uuid";
import { computed, reactive } from "vue";
import { useI18n } from "vue-i18n";
import { BBAttention } from "@/bbkit";
@@ -213,17 +217,23 @@ import type {
} from "@/components/DataExportButton.vue";
import DataExportButton from "@/components/DataExportButton.vue";
import { RichDatabaseName } from "@/components/v2";
+import { useExecuteSQL } from "@/composables/useExecuteSQL";
import { DISMISS_PLACEHOLDER } from "@/plugins/ai/components/state";
import {
pushNotification,
- useConnectionOfCurrentSQLEditorTab,
useSQLEditorStore,
useSQLEditorTabStore,
} from "@/store";
-import type { ComposedDatabase, SQLEditorQueryParams } from "@/types";
+import type {
+ ComposedDatabase,
+ SQLEditorDatabaseQueryContext,
+ SQLEditorQueryParams,
+} from "@/types";
import { DEBOUNCE_SEARCH_DELAY, isValidInstanceName } from "@/types";
import { Engine, ExportFormat } from "@/types/proto-es/v1/common_pb";
import {
+ QueryOption_MSSQLExplainFormat,
+ QueryOptionSchema,
type QueryResult,
type QueryRow,
type RowValue,
@@ -305,7 +315,7 @@ const { dark, keyword } = useSQLResultViewContext();
const tabStore = useSQLEditorTabStore();
const editorStore = useSQLEditorStore();
const currentTab = computed(() => tabStore.currentTab);
-const { instance: connectedInstance } = useConnectionOfCurrentSQLEditorTab();
+const { runQuery } = useExecuteSQL();
const viewMode = computed((): ViewMode => {
const { result } = props;
@@ -323,10 +333,10 @@ const viewMode = computed((): ViewMode => {
});
const showSearchFeature = computed(() => {
- if (!isValidInstanceName(connectedInstance.value.name)) {
+ if (!isValidInstanceName(props.database.instance)) {
return false;
}
- return instanceV1HasStructuredQueryResult(connectedInstance.value);
+ return instanceV1HasStructuredQueryResult(props.database.instanceResource);
});
// use a debounced value to improve performance when typing rapidly
@@ -452,25 +462,24 @@ const pageSizeOptions = computed(() => {
}));
});
+const engine = computed(() => props.database.instanceResource.engine);
+
const showVisualizeButton = computed((): boolean => {
return (
- connectedInstance.value.engine === Engine.POSTGRES && props.params.explain
+ (engine.value === Engine.POSTGRES || engine.value === Engine.MSSQL) &&
+ props.params.explain
);
});
-const visualizeExplain = () => {
+const visualizeExplain = async () => {
+ let token: string | undefined;
try {
- const { result } = props;
- const { statement } = result;
- if (!statement) return;
-
- const lines = result.rows.map((row) =>
- row.values.map((value) => String(extractSQLRowValuePlain(value)))
- );
- const explain = lines.map((line) => line[0]).join("\n");
- if (!explain) return;
-
- const token = createExplainToken(statement, explain);
+ if (engine.value === Engine.POSTGRES) {
+ token = getExplainToken(props.result);
+ } else if (engine.value === Engine.MSSQL) {
+ token = await getExplainTokenForMSSQL();
+ }
+ if (!token) return;
window.open(`/explain-visualizer.html?token=${token}`, "_blank");
} catch {
@@ -478,6 +487,44 @@ const visualizeExplain = () => {
}
};
+const getExplainToken = (result: QueryResult) => {
+ const { statement } = result;
+ if (!statement) return;
+
+ const lines = result.rows.map((row) =>
+ row.values.map((value) => String(extractSQLRowValuePlain(value)))
+ );
+ const explain = lines.map((line) => line[0]).join("\n");
+ if (!explain) return;
+
+ return createExplainToken({
+ statement,
+ explain,
+ engine: engine.value,
+ });
+};
+
+const getExplainTokenForMSSQL = async () => {
+ const context: SQLEditorDatabaseQueryContext = {
+ id: uuidv4(),
+ params: {
+ ...props.params,
+ queryOption: create(QueryOptionSchema, {
+ mssqlExplainFormat:
+ QueryOption_MSSQLExplainFormat.MSSQL_EXPLAIN_FORMAT_XML,
+ }),
+ },
+ status: "PENDING",
+ };
+ await runQuery(props.database, context);
+
+ const result = context.resultSet?.results[0];
+ if (!result) {
+ return;
+ }
+ return getExplainToken(result);
+};
+
const handleChangePage = (page: number) => {
table.setPageIndex(page - 1);
};
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/VirtualDataBlock.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/VirtualDataBlock.vue
index 98243368db..6f9a98a29e 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/VirtualDataBlock.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/VirtualDataBlock.vue
@@ -68,6 +68,7 @@
:col-index="header.index"
:column-type="getColumnType(header)"
:allow-select="true"
+ :database="database"
/>
</div>
</div>
@@ -89,6 +90,7 @@ import type { Table } from "@tanstack/vue-table";
import { useVirtualizer } from "@tanstack/vue-virtual";
import { computed, ref, watch } from "vue";
import { CopyButton } from "@/components/v2";
+import { type ComposedDatabase } from "@/types";
import type { QueryRow, RowValue } from "@/types/proto-es/v1/sql_service_pb";
import { useSQLResultViewContext } from "./context";
import MaskingReasonPopover from "./DataTable/common/MaskingReasonPopover.vue";
@@ -102,6 +104,7 @@ const props = defineProps<{
offset: number;
isSensitiveColumn: (index: number) => boolean;
getMaskingReason?: (index: number) => any;
+ database: ComposedDatabase;
}>();
const { keyword } = useSQLResultViewContext();
diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/common/CodeViewer.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/common/CodeViewer.vue
index bb3d5997e2..cbab9193b1 100644
--- a/frontend/src/views/sql-editor/EditorPanel/Panels/common/CodeViewer.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/common/CodeViewer.vue
@@ -1,6 +1,6 @@
<template>
<div
- class="w-full h-[44px] px-2 py-2 border-b flex flex-row justify-between items-center"
+ class="w-full h-11 px-2 py-2 border-b flex flex-row justify-between items-center"
:class="headerClass"
>
<div class="flex justify-start items-center gap-2">
diff --git a/frontend/src/views/sql-editor/EditorPanel/StandardPanel/SQLEditor.vue b/frontend/src/views/sql-editor/EditorPanel/StandardPanel/SQLEditor.vue
index 9c04a9fc8a..573beeedfd 100644
--- a/frontend/src/views/sql-editor/EditorPanel/StandardPanel/SQLEditor.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/StandardPanel/SQLEditor.vue
@@ -70,8 +70,10 @@ import { activeSQLEditorRef } from "./state";
import UploadFileButton from "./UploadFileButton.vue";
const emit = defineEmits<{
- (e: "execute", params: SQLEditorQueryParams): void;
- (e: "execute-in-new-tab", params: SQLEditorQueryParams): void;
+ (
+ e: "execute",
+ params: { params: SQLEditorQueryParams; newTab: boolean }
+ ): void;
}>();
const tabStore = useSQLEditorTabStore();
@@ -192,10 +194,8 @@ const runQueryAction = ({
};
if (!newTab) {
params.selection = tab.editorState.selection;
- emit("execute", params);
- } else {
- emit("execute-in-new-tab", params);
}
+ emit("execute", { params, newTab });
uiStateStore.saveIntroStateByKey({
key: "data.query",
newState: true,
diff --git a/frontend/src/views/sql-editor/EditorPanel/StandardPanel/StandardPanel.vue b/frontend/src/views/sql-editor/EditorPanel/StandardPanel/StandardPanel.vue
index c0fbecbac4..ab30845dfc 100644
--- a/frontend/src/views/sql-editor/EditorPanel/StandardPanel/StandardPanel.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/StandardPanel/StandardPanel.vue
@@ -19,7 +19,6 @@
<SQLEditor
ref="sqlEditorRef"
@execute="handleExecute"
- @execute-in-new-tab="handleExecuteInNewTab"
/>
<template #fallback>
<div
@@ -118,31 +117,39 @@ const handleExecuteFromActionBar = (params: SQLEditorQueryParams) => {
return;
}
const statement = sqlEditorRef.value.getActiveStatement();
- handleExecute({ ...params, statement });
+ handleExecute({
+ params: { ...params, statement },
+ newTab: false,
+ });
};
-const handleExecute = (params: SQLEditorQueryParams) => {
- execute(params);
-};
-const handleExecuteInNewTab = (params: SQLEditorQueryParams) => {
- const fromTab = tabStore.currentTab;
- const clonedTab = defaultSQLEditorTab();
- if (fromTab) {
- clonedTab.connection = cloneDeep(fromTab.connection);
- clonedTab.treeState = cloneDeep(fromTab.treeState);
- }
- clonedTab.title = suggestedTabTitleForSQLEditorConnection(
- clonedTab.connection
- );
- const newTab = tabStore.addTab(clonedTab, /* beside */ true);
- if (fromTab) {
- const vs = cloneViewState(fromTab.id, newTab.id);
- if (vs) {
- vs.view = "CODE";
- vs.detail = {};
+const handleExecute = ({
+ params,
+ newTab,
+}: {
+ params: SQLEditorQueryParams;
+ newTab: boolean;
+}) => {
+ if (newTab) {
+ const fromTab = tabStore.currentTab;
+ const clonedTab = defaultSQLEditorTab();
+ if (fromTab) {
+ clonedTab.connection = cloneDeep(fromTab.connection);
+ clonedTab.treeState = cloneDeep(fromTab.treeState);
+ }
+ clonedTab.title = suggestedTabTitleForSQLEditorConnection(
+ clonedTab.connection
+ );
+ const newTab = tabStore.addTab(clonedTab, /* beside */ true);
+ if (fromTab) {
+ const vs = cloneViewState(fromTab.id, newTab.id);
+ if (vs) {
+ vs.view = "CODE";
+ vs.detail = {};
+ }
}
+ newTab.statement = params.statement;
}
- newTab.statement = params.statement;
nextTick(() => {
execute(params);
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 2f2e1d3a70..5ec4113b03 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -12196,6 +12196,13 @@ components:
- ALL_NODES
type: string
format: enum
+ mssqlExplainFormat:
+ enum:
+ - MSSQL_EXPLAIN_FORMAT_UNSPECIFIED
+ - MSSQL_EXPLAIN_FORMAT_ALL
+ - MSSQL_EXPLAIN_FORMAT_XML
+ type: string
+ format: enum
QueryRequest:
required:
- name
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 13d1ef9694..f64ba87d2f 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -485,6 +485,7 @@
- [Advice.Level](#bytebase-v1-Advice-Level)
- [Advice.RuleType](#bytebase-v1-Advice-RuleType)
- [QueryHistory.Type](#bytebase-v1-QueryHistory-Type)
+ - [QueryOption.MSSQLExplainFormat](#bytebase-v1-QueryOption-MSSQLExplainFormat)
- [QueryOption.RedisRunCommandsOn](#bytebase-v1-QueryOption-RedisRunCommandsOn)
- [QueryResult.Message.Level](#bytebase-v1-QueryResult-Message-Level)
- [QueryResult.PermissionDenied.CommandType](#bytebase-v1-QueryResult-PermissionDenied-CommandType)
@@ -7805,6 +7806,7 @@ OrgPolicyService manages organizational policies at various resource levels.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| redis_run_commands_on | [QueryOption.RedisRunCommandsOn](#bytebase-v1-QueryOption-RedisRunCommandsOn) | | |
+| mssql_explain_format | [QueryOption.MSSQLExplainFormat](#bytebase-v1-QueryOption-MSSQLExplainFormat) | | |
@@ -8109,6 +8111,19 @@ RuleType indicates the source of the linting rule.
+<a name="bytebase-v1-QueryOption-MSSQLExplainFormat"></a>
+
+### QueryOption.MSSQLExplainFormat
+
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| MSSQL_EXPLAIN_FORMAT_UNSPECIFIED | 0 | defaults to SHOWPLAN_ALL |
+| MSSQL_EXPLAIN_FORMAT_ALL | 1 | SHOWPLAN_ALL |
+| MSSQL_EXPLAIN_FORMAT_XML | 2 | SHOWPLAN_XML |
+
+
+
<a name="bytebase-v1-QueryOption-RedisRunCommandsOn"></a>
### QueryOption.RedisRunCommandsOn
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index a66451d98d..290eb8a453 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -2032,6 +2032,10 @@
<a href="#bytebase.v1.QueryHistory.Type"><span class="badge">E</span>QueryHistory.Type</a>
</li>
+ <li>
+ <a href="#bytebase.v1.QueryOption.MSSQLExplainFormat"><span class="badge">E</span>QueryOption.MSSQLExplainFormat</a>
+ </li>
+
<li>
<a href="#bytebase.v1.QueryOption.RedisRunCommandsOn"><span class="badge">E</span>QueryOption.RedisRunCommandsOn</a>
</li>
@@ -21994,6 +21998,13 @@ Format: instances/{instance}/databases/{databaseName} </p></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>mssql_explain_format</td>
+ <td><a href="#bytebase.v1.QueryOption.MSSQLExplainFormat">QueryOption.MSSQLExplainFormat</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
</tbody>
</table>
@@ -22840,6 +22851,35 @@ These are custom, flexible checks powered by AI models.</p></td>
</tbody>
</table>
+ <h3 id="bytebase.v1.QueryOption.MSSQLExplainFormat">QueryOption.MSSQLExplainFormat</h3>
+ <p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>MSSQL_EXPLAIN_FORMAT_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p>defaults to SHOWPLAN_ALL</p></td>
+ </tr>
+
+ <tr>
+ <td>MSSQL_EXPLAIN_FORMAT_ALL</td>
+ <td>1</td>
+ <td><p>SHOWPLAN_ALL</p></td>
+ </tr>
+
+ <tr>
+ <td>MSSQL_EXPLAIN_FORMAT_XML</td>
+ <td>2</td>
+ <td><p>SHOWPLAN_XML</p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
<h3 id="bytebase.v1.QueryOption.RedisRunCommandsOn">QueryOption.RedisRunCommandsOn</h3>
<p></p>
<table class="enum-table">
diff --git a/proto/v1/v1/sql_service.proto b/proto/v1/v1/sql_service.proto
index 89e90e9d56..a2689a118b 100644
--- a/proto/v1/v1/sql_service.proto
+++ b/proto/v1/v1/sql_service.proto
@@ -175,6 +175,16 @@ message QueryOption {
ALL_NODES = 2;
}
RedisRunCommandsOn redis_run_commands_on = 1;
+
+ enum MSSQLExplainFormat {
+ // defaults to SHOWPLAN_ALL
+ MSSQL_EXPLAIN_FORMAT_UNSPECIFIED = 0;
+ // SHOWPLAN_ALL
+ MSSQL_EXPLAIN_FORMAT_ALL = 1;
+ // SHOWPLAN_XML
+ MSSQL_EXPLAIN_FORMAT_XML = 2;
+ }
+ MSSQLExplainFormat mssql_explain_format = 2;
}
message QueryResult {