diff --git a/README.md b/README.md index 9d955b7e..80e27c3a 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,9 @@ Open source simple business intelligence application and sql editor tool for Cli Not need, open in browser http://ui.tabix.io/ +Alpha version : http://alpha.tabix.io + + ### If need install [Install to you host](https://tabix.io/doc/Install/) diff --git a/bower.json b/bower.json index b649941b..96c3facc 100644 --- a/bower.json +++ b/bower.json @@ -1,13 +1,14 @@ { - "name": "Tabix", - "version": "18.06.1", + "name": "tabix", + "version": "18.07.1", "dependencies": { + "metismenu": "2.6.1", "angular-animate": "1.6.6", "angular-aria": "1.5.9", - "jquery": "^3.2.1", + "jquery": "3.2.1", "jquery-ui": "^1.12.1", "angular": "1.6.6", - "angular-local-storage": "~0.2.7", + "angular-local-storage": "0.7.1", "angular-screenfull": "^0.1.1", "screenfull": "~3.0.2", "angular-sanitize": "1.6.2", @@ -147,7 +148,6 @@ "resolutions": { "jquery": "~2.1.4", "angular": "~1.5.11", - "d3": "~4.4.1", "jquery-ui": "~1.12.1" } } diff --git a/build/assets/images/TabixBeta2018.png b/build/assets/images/TabixBeta2018.png new file mode 100644 index 00000000..a41ee9e8 Binary files /dev/null and b/build/assets/images/TabixBeta2018.png differ diff --git a/build/assets/plotly-toolpanel/fonts/unified.eot b/build/assets/plotly-toolpanel/fonts/unified.eot new file mode 100644 index 00000000..483e8382 Binary files /dev/null and b/build/assets/plotly-toolpanel/fonts/unified.eot differ diff --git a/build/assets/plotly-toolpanel/fonts/unified.svg b/build/assets/plotly-toolpanel/fonts/unified.svg new file mode 100644 index 00000000..784b6804 --- /dev/null +++ b/build/assets/plotly-toolpanel/fonts/unified.svg @@ -0,0 +1,167 @@ + + + +Generated by Fontastic.me + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/assets/plotly-toolpanel/fonts/unified.ttf b/build/assets/plotly-toolpanel/fonts/unified.ttf new file mode 100644 index 00000000..ae1142fe Binary files /dev/null and b/build/assets/plotly-toolpanel/fonts/unified.ttf differ diff --git a/build/assets/plotly-toolpanel/fonts/unified.woff b/build/assets/plotly-toolpanel/fonts/unified.woff new file mode 100644 index 00000000..27c18ad4 Binary files /dev/null and b/build/assets/plotly-toolpanel/fonts/unified.woff differ diff --git a/build/assets/plotly-toolpanel/static/css/images/jstree.png b/build/assets/plotly-toolpanel/static/css/images/jstree.png new file mode 100755 index 00000000..17cbe05f Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/jstree.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png new file mode 100755 index 00000000..954e22db Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_diagonals-thick_20_666666_40x40.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_diagonals-thick_20_666666_40x40.png new file mode 100755 index 00000000..64ece570 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_diagonals-thick_20_666666_40x40.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_0_aaaaaa_40x100.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100755 index 00000000..5b5dab2a Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_0_ffffff_40x100.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_0_ffffff_40x100.png new file mode 100755 index 00000000..ac8b229a Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_0_ffffff_40x100.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_100_000000_40x100.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_100_000000_40x100.png new file mode 100755 index 00000000..abdc0108 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_100_000000_40x100.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_10_000000_40x100.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_10_000000_40x100.png new file mode 100755 index 00000000..abdc0108 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_10_000000_40x100.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_75_ffffff_40x100.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_75_ffffff_40x100.png new file mode 100755 index 00000000..ac8b229a Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_100_f6f6f6_1x400.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_100_f6f6f6_1x400.png new file mode 100755 index 00000000..9b383f4d Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_100_f6f6f6_1x400.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_100_fdf5ce_1x400.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_100_fdf5ce_1x400.png new file mode 100755 index 00000000..a23baad2 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_100_fdf5ce_1x400.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_55_fbf9ee_1x400.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100755 index 00000000..ad3d6346 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_65_ffffff_1x400.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100755 index 00000000..42ccba26 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_75_dadada_1x400.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_75_dadada_1x400.png new file mode 100755 index 00000000..5a46b47c Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_75_e6e6e6_1x400.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100755 index 00000000..86c2baa6 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_95_fef1ec_1x400.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100755 index 00000000..4443fdc1 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png new file mode 100755 index 00000000..39d5824d Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png new file mode 100755 index 00000000..f1273672 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100755 index 00000000..7c9fa6c6 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png new file mode 100755 index 00000000..359397ac Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_highlight-soft_75_ffffff_1x100.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_highlight-soft_75_ffffff_1x100.png new file mode 100755 index 00000000..cb5a7944 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_highlight-soft_75_ffffff_1x100.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-bg_inset-soft_95_fef1ec_1x100.png b/build/assets/plotly-toolpanel/static/css/images/ui-bg_inset-soft_95_fef1ec_1x100.png new file mode 100755 index 00000000..0e05810f Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-bg_inset-soft_95_fef1ec_1x100.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-icons_222222_256x240.png b/build/assets/plotly-toolpanel/static/css/images/ui-icons_222222_256x240.png new file mode 100755 index 00000000..b273ff11 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-icons_222222_256x240.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-icons_228ef1_256x240.png b/build/assets/plotly-toolpanel/static/css/images/ui-icons_228ef1_256x240.png new file mode 100755 index 00000000..a641a371 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-icons_228ef1_256x240.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-icons_2e83ff_256x240.png b/build/assets/plotly-toolpanel/static/css/images/ui-icons_2e83ff_256x240.png new file mode 100755 index 00000000..09d1cdc8 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-icons_2e83ff_256x240.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-icons_454545_256x240.png b/build/assets/plotly-toolpanel/static/css/images/ui-icons_454545_256x240.png new file mode 100755 index 00000000..59bd45b9 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-icons_454545_256x240.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-icons_888888_256x240.png b/build/assets/plotly-toolpanel/static/css/images/ui-icons_888888_256x240.png new file mode 100755 index 00000000..6d02426c Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-icons_888888_256x240.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-icons_cd0a0a_256x240.png b/build/assets/plotly-toolpanel/static/css/images/ui-icons_cd0a0a_256x240.png new file mode 100755 index 00000000..2ab019b7 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-icons_cd0a0a_256x240.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-icons_ef8c08_256x240.png b/build/assets/plotly-toolpanel/static/css/images/ui-icons_ef8c08_256x240.png new file mode 100755 index 00000000..85e63e9f Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-icons_ef8c08_256x240.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-icons_ffd27a_256x240.png b/build/assets/plotly-toolpanel/static/css/images/ui-icons_ffd27a_256x240.png new file mode 100755 index 00000000..e117effa Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-icons_ffd27a_256x240.png differ diff --git a/build/assets/plotly-toolpanel/static/css/images/ui-icons_ffffff_256x240.png b/build/assets/plotly-toolpanel/static/css/images/ui-icons_ffffff_256x240.png new file mode 100755 index 00000000..42f8f992 Binary files /dev/null and b/build/assets/plotly-toolpanel/static/css/images/ui-icons_ffffff_256x240.png differ diff --git a/build/index.html b/build/index.html index 31547718..3c5580e3 100644 --- a/build/index.html +++ b/build/index.html @@ -1,3 +1,3 @@ -Tabix.io
\ No newline at end of file +
\ No newline at end of file diff --git a/build/scripts/app-b6bad67439.js b/build/scripts/app-65ac869b2e.js similarity index 85% rename from build/scripts/app-b6bad67439.js rename to build/scripts/app-65ac869b2e.js index 6756abcc..ac2de745 100644 --- a/build/scripts/app-b6bad67439.js +++ b/build/scripts/app-65ac869b2e.js @@ -1,8 +1,8 @@ "use strict";function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t

404 not found

Back'),e.put("app/base/addVarsDialog.html",'

Mango (Fruit)

Add var (no space)
TextIntDateCode
CloseAdd
'),e.put("app/base/base.html",'
Open table
'),e.put("app/base/breadcrumbs.html",''),e.put("app/base/header.html",'
Requirements Chrome! Dashboard SQL Metrics & Processes Settings Help Sign out [{{user}}]
'),e.put("app/base/helpDialogLogin.html",'

Tabix.io Build {{::vars.version}} [{{::vars.buildDate}}]

* Work only in "Google chrome" version up 55

* Clickhouse server version up v1.1.54164

* Not readonly CH user




https://tabix.ioOk
'),e.put("app/base/helpDialogRu.html",'

Tabix.io Build {{::vars.version}} [{{::vars.buildDate}}]

ClickHouse Manual


Tabix.IO Manual

Hot keys

⌘ + Enter

Exec current query

⌘ + Shift + Enter

Exec all query

⌘ + Y

Drop current line

⌘ + ⇧ + F

Reformat

⌘ + ⇧ + Plus|Minus

свернуть все/развернуть

⌘ + Right|Left

переключает вкладки

⌘ + ⌥ + Up|Down

Copy lines Up/Down

⌥ + Up|Down

Move lines Up/Down

Ctrl + K

Remove to line end

⌘ + Backspace

Remove to linestart

Ace Editor Default Keyboard Shortcuts

DrawChart

DrawChart

DrawMap

DrawMap

https://tabix.ioOk
'),e.put("app/base/sidebar.html",'
'),e.put("app/base/sidebarhelper.html",'

{{ hist }}

'),e.put("app/dash/dash.html",'
favorite

{{vars.dash.title}}

favoritePinSave


Apply
'),e.put("app/dash/dashsidebar.html",'
'),e.put("app/dev/edit.html",'
'),e.put("app/dev/plot.html",'openEditorWidget
code:
{{code}}
'),e.put("app/login/login.html",'
Requirements Chrome or Chromium engine Browser! Requirements & helpUi Theme{{theme.title}}
'),e.put("app/metrics/dialog.kill.html",'

Kill query

{{ q.elapsed }}

{{ q.query }}

{{ q.bytes_read }}

{{ q.hash }}

Cancel
'),e.put("app/metrics/metrics.html",'Processes
Overview
Metrics
'),e.put("app/metrics/metricschart.html",'

Metrics

{{interval == -1 ? (\'Refresh is disabled\') : interval +\' \'+(\'sec\')}}{{interval}}system.eventsRefreshReset
'),e.put("app/metrics/overview.html",'

Overview

'),e.put("app/metrics/processes.html",'

Processes

{{interval == -1 ? (\'Refresh is disabled\') : interval +\' \'+\'sec\'}}Select/Read onlyLog ModeClusterRefreshResetKILL Query
'),e.put("app/panels/sendtodashboard.html",'
Send to dashboard
ApplicationWebsite


AppendBottom





CloseApply
'), -e.put("app/panels/share.html",'
Share


Can refresh dataPassword protectSupport variablesBoardJsonTSVCSV
CloseApply
'),e.put("app/preference/preference.html",'

Preference & settings

{{theme}}{{theme}}Save sessionLive AutocompletionDisable auto-helpDisable hotKey left+rightUse WrapModeShow invisible charsApply
'),e.put("app/render/WidgetsList.html",'
{{::w.title}}
'),e.put("app/sql/PlotlyEditor.tmpl.html",'
PlotLy JavaScript editor ( alpha )

Tab One

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla venenatis ante augue. Phasellus volutpat neque ac dui mattis vulputate. Etiam consequat aliquam cursus. In sodales pretium ultrices. Maecenas lectus est, sollicitudin consectetur felis nec, feugiat ultricies mi.

Tab Two

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla venenatis ante augue. Phasellus volutpat neque ac dui mattis vulputate. Etiam consequat aliquam cursus. In sodales pretium ultrices. Maecenas lectus est, sollicitudin consectetur felis nec, feugiat ultricies mi. Aliquam erat volutpat. Nam placerat, tortor in ultrices porttitor, orci enim rutrum enim, vel tempor sapien arcu a tellus. Vivamus convallis sodales ante varius gravida. Curabitur a purus vel augue ultrices ultricies id a nisl. Nullam malesuada consequat diam, a facilisis tortor volutpat et. Sed urna dolor, aliquet vitae posuere vulputate, euismod ac lorem. Sed felis risus, pulvinar at interdum quis, vehicula sed odio. Phasellus in enim venenatis, iaculis tortor eu, bibendum ante. Donec ac tellus dictum neque volutpat blandit. Praesent efficitur faucibus risus, ac auctor purus porttitor vitae. Phasellus ornare dui nec orci posuere, nec luctus mauris semper.

Morbi viverra, ante vel aliquet tincidunt, leo dolor pharetra quam, at semper massa orci nec magna. Donec posuere nec sapien sed laoreet. Etiam cursus nunc in condimentum facilisis. Etiam in tempor tortor. Vivamus faucibus egestas enim, at convallis diam pulvinar vel. Cras ac orci eget nisi maximus cursus. Nunc urna libero, viverra sit amet nisl at, hendrerit tempor turpis. Maecenas facilisis convallis mi vel tempor. Nullam vitae nunc leo. Cras sed nisl consectetur, rhoncus sapien sit amet, tempus sapien.

Integer turpis erat, porttitor vitae mi faucibus, laoreet interdum tellus. Curabitur posuere molestie dictum. Morbi eget congue risus, quis rhoncus quam. Suspendisse vitae hendrerit erat, at posuere mi. Cras eu fermentum nunc. Sed id ante eu orci commodo volutpat non ac est. Praesent ligula diam, congue eu enim scelerisque, finibus commodo lectus.

Close
'),e.put("app/sql/renderResult.html",'
{{resultContainer.cellsCalc}}{{::tableData.data.progressQuery}}CSV with headersCSV without headersTSV with headersTSV without headersPinnedTable
Draw
'),e.put("app/sql/showDialogUpload.html",'

Upload CSV to View

'),e.put("app/sql/sql.html",'
{{tab.name + (tab.changed ? \' *\' : \'\')}}
Make snippetAutoFormatExpandCollapseCollapse All
{{tab.buttonTitle}}Run current ⌘ + ⏎Full screenSave{{item.name}}Query log
USE {{::dbb.name}}{{vars.LastStatistics.elapsed| number:2}} sec.| {{vars.LastStatistics.rows_read| number}} rows.| {{vars.LastStatistics.bytes_read|filesize}}
..... {{tab.progress.query}}
'),e.put("app/table/table-container.html",'

{{vars.currentDatabase}} {{vars.currentTable}}

Structure
NameTypeDefault typeValueSizeCompress
{{$index + 1}}{{field[key]}}
Information
1Size{{vars.statistics.size}}
2Size,bytes{{vars.statistics.sizeBytes}}
3First row{{vars.statistics.minDate}}
4Last row{{vars.statistics.maxDate}}

SHOW CREATE TABLE
{{vars.createtable}}
Data
Data From {{vars.offset}} To {{vars.offset + vars.limit}}
No data
'),e.put("app/table/table.html",'
')}]),function(e,t){function a(e,t){var a=t.dbName,n=t.tableName;e.vars={dbName:a,tableName:n}}e.module(t.app.name).controller("TableController",a),a.$inject=["$scope","$stateParams"]}(angular,smi2),function(e,t){function a(t,a,n,i,r,s,o,l){t.tablewidget={},t.vars={columns:{},ugrid:{},sortColumn:!1,isDark:i.isDark(),createtable:{},data:null,grid:null,limit:100,offset:0,statistics:{},loading:!0,isRawStatistics:!1,rawstatistics:"",scrollConfig:{autoHideScrollbar:!1,theme:i.isDark()?"light":"dark",scrollButtons:{enable:!1},scrollInertia:100,advanced:{updateOnContentResize:!0}}},t.initContainer=function(){a.$watch("currentTable",function(e){e&&(t.vars.currentTable=a.currentTable,t.vars.currentDatabase=a.currentDatabase,t.init())})},t.onAfterInit=function(){},t.updateHandTable=function(){l.getInstance("hotTableContain").render()},t.initOnGo=function(){t.$parent.vars&&(o.get("tableSiedenav")&&s("tableSiedenav").close(),t.vars.currentTable=t.$parent.vars.tableName,t.vars.currentDatabase=t.$parent.vars.dbName,t.init())},t.load=function(){console.warn("LOAD DATA! IN TABLES"),t.vars.data=-1,n.fetchQuery("\n select * from "+t.vars.currentDatabase+"."+t.vars.currentTable+" limit "+t.vars.offset+", "+t.vars.limit+"\n ").then(function(e){var a="ch";t.tablewidget=new WidgetTable(new DataProvider(e,a)),t.vars.loading=!1},function(e){t.vars.loading=!1,console.error("Error "+e)})},t.calcRawSize=function(){t.vars.isRawStatistics=!0,n.fetchQuery("SELECT any(ignore(*)) FROM "+t.vars.currentDatabase+"."+t.vars.currentTable+" SAMPLE 1 / 10000 ").then(function(e){t.vars.rawstatistics=e.statistics},function(e){t.vars.rawstatistics=e.data})},t.init=function(){t.vars.loading=!0,t.vars.createtable="N/A",n.fetchQuery("SHOW CREATE TABLE "+t.vars.currentDatabase+"."+t.vars.currentTable).then(function(e){t.vars.createtable=window.sqlFormatter.format(e.data[0].statement)}),n.fetchQuery("SELECT table, formatReadableSize(sum(bytes)) as size, sum(bytes) as sizeBytes, min(min_date) as minDate, max(max_date) as maxDate FROM system.parts WHERE database = '"+t.vars.currentDatabase+"' AND ( table = '"+t.vars.currentTable+"' OR table = '"+t.vars.currentTable+"_sharded' ) GROUP BY table ").then(function(e){return t.vars.statistics=e&&e.data.length&&e.data[0]||{}}),n.fetchQuery("SELECT * FROM system.columns WHERE database='"+t.vars.currentDatabase+"' AND table='"+t.vars.currentTable+"'").then(function(a){n.fetchQuery("describe table "+t.vars.currentDatabase+"."+t.vars.currentTable).then(function(n){_.map(n.data,function(t){var n=_.find(a.data,{name:t.name});return _.merge(t,n),t.size="-",t.ratio="-",!e.isUndefined(t.default_kind)&&e.isUndefined(t.default_type)&&(t.default_type=t.default_kind),t.data_compressed_bytes&&(t.size=numbro(t.data_compressed_bytes).format("0.0 b")+" / "+numbro(t.data_uncompressed_bytes).format("0.0 b"),t.ratio=numbro(parseInt(t.data_uncompressed_bytes)/parseInt(t.data_compressed_bytes)).format("0.0")),t}),t.vars.columns=n,t.vars.sortColumn=!1;var i=0;n.data.forEach(function(e){3>i&&("Date"==e.type&&(t.vars.sortColumn=e.name),"DateTime"==e.type&&(t.vars.sortColumn=e.name)),i+=1}),t.load()})})},t.loadNext=function(){t.vars.loading=!0,t.vars.offset+=t.vars.limit,t.load()},t.loadPrev=function(){t.vars.offset>0&&(t.vars.loading=!0,t.vars.offset-=t.vars.limit,t.load())}}e.module(t.app.name).controller("TableContainerController",a),a.$inject=["$scope","$rootScope","API","ThemeService","$stateParams","$mdSidenav","$mdComponentRegistry","hotRegisterer"]}(angular,smi2),/* +!function(){var e=window.smi2=window.smi2||{};e.app={name:"SMI2",version:window.TabixVersion||"",buildDate:window.TabixBuildDate||""},angular.module(e.app.name,["ui.router","LocalStorageModule","angularScreenfull","ui.ace","ngScrollbars","angularResizable","ngSanitize","ngMaterial","funMetisMenu","ngCsv","cfp.hotkeys","ngHandsontable","ngCsvImport","gridstack-angular"])}(),angular.module("SMI2").run(["$templateCache",function(e){e.put("app/dash/dash.html",'
favorite

{{vars.dash.title}}

favoritePinSave


Apply
'),e.put("app/dash/dashsidebar.html",'
'),e.put("app/base/404.html",'

404 not found

Back
'),e.put("app/base/addVarsDialog.html",'

Mango (Fruit)

Add var (no space)
TextIntDateCode
CloseAdd
'),e.put("app/base/base.html",'
Open table
'),e.put("app/base/breadcrumbs.html",''),e.put("app/base/header.html",'
Requirements Chrome! Dashboard SQL Metrics & Processes Settings Help Sign out [{{user}}]
'),e.put("app/base/helpDialogLogin.html",'

Tabix.io Build {{::vars.version}} [{{::vars.buildDate}}]

* Work only in "Google chrome" version up 55

* Clickhouse server version up v1.1.54164

* Not readonly CH user




https://tabix.ioOk
'),e.put("app/base/helpDialogRu.html",'

Tabix.io Build {{::vars.version}} [{{::vars.buildDate}}]

ClickHouse Manual


Tabix.IO Manual

Hot keys

⌘ + Enter

Exec current query

⌘ + Shift + Enter

Exec all query

⌘ + Y

Drop current line

⌘ + ⇧ + F

Reformat

⌘ + ⇧ + Plus|Minus

свернуть все/развернуть

⌘ + Right|Left

переключает вкладки

⌘ + ⌥ + Up|Down

Copy lines Up/Down

⌥ + Up|Down

Move lines Up/Down

Ctrl + K

Remove to line end

⌘ + Backspace

Remove to linestart

Ace Editor Default Keyboard Shortcuts

DrawChart

DrawChart

DrawMap

DrawMap

https://tabix.ioOk
'),e.put("app/base/sidebar.html",'
'),e.put("app/base/sidebarhelper.html",'

{{ hist }}

'),e.put("app/dev/edit.html",'
'),e.put("app/dev/plot.html",'openEditorWidget
code:
{{code}}
'),e.put("app/login/login.html",'
Requirements Chrome or Chromium engine Browser! Requirements & helpUi Theme{{theme.title}}
'),e.put("app/panels/sendtodashboard.html",'
Send to dashboard
ApplicationWebsite


AppendBottom





CloseApply
'),e.put("app/panels/share.html",'
Share


Can refresh dataPassword protectSupport variablesBoardJsonTSVCSV
CloseApply
'),e.put("app/preference/preference.html",'

Preference & settings

{{theme}}{{theme}}Save sessionLive AutocompletionDisable auto-helpDisable hotKey left+rightUse WrapModeShow invisible charsApply
'),e.put("app/metrics/dialog.kill.html",'

Kill query

{{ q.elapsed }}

{{ q.query }}

{{ q.bytes_read }}

{{ q.hash }}

Cancel
'),e.put("app/metrics/metrics.html",'Processes
Overview
Metrics
'),e.put("app/metrics/metricschart.html",'

Metrics

{{interval == -1 ? (\'Refresh is disabled\') : interval +\' \'+(\'sec\')}}{{interval}}system.eventsRefreshReset
'), +e.put("app/metrics/overview.html",'

Overview

'),e.put("app/metrics/processes.html",'

Processes

{{interval == -1 ? (\'Refresh is disabled\') : interval +\' \'+\'sec\'}}Select/Read onlyLog ModeClusterRefreshResetKILL Query
'),e.put("app/render/WidgetsList.html",'
{{::w.title}}
'),e.put("app/sql/PlotlyEditor.tmpl.html",'
PlotLy JavaScript editor ( alpha )

Tab One

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla venenatis ante augue. Phasellus volutpat neque ac dui mattis vulputate. Etiam consequat aliquam cursus. In sodales pretium ultrices. Maecenas lectus est, sollicitudin consectetur felis nec, feugiat ultricies mi.

Tab Two

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla venenatis ante augue. Phasellus volutpat neque ac dui mattis vulputate. Etiam consequat aliquam cursus. In sodales pretium ultrices. Maecenas lectus est, sollicitudin consectetur felis nec, feugiat ultricies mi. Aliquam erat volutpat. Nam placerat, tortor in ultrices porttitor, orci enim rutrum enim, vel tempor sapien arcu a tellus. Vivamus convallis sodales ante varius gravida. Curabitur a purus vel augue ultrices ultricies id a nisl. Nullam malesuada consequat diam, a facilisis tortor volutpat et. Sed urna dolor, aliquet vitae posuere vulputate, euismod ac lorem. Sed felis risus, pulvinar at interdum quis, vehicula sed odio. Phasellus in enim venenatis, iaculis tortor eu, bibendum ante. Donec ac tellus dictum neque volutpat blandit. Praesent efficitur faucibus risus, ac auctor purus porttitor vitae. Phasellus ornare dui nec orci posuere, nec luctus mauris semper.

Morbi viverra, ante vel aliquet tincidunt, leo dolor pharetra quam, at semper massa orci nec magna. Donec posuere nec sapien sed laoreet. Etiam cursus nunc in condimentum facilisis. Etiam in tempor tortor. Vivamus faucibus egestas enim, at convallis diam pulvinar vel. Cras ac orci eget nisi maximus cursus. Nunc urna libero, viverra sit amet nisl at, hendrerit tempor turpis. Maecenas facilisis convallis mi vel tempor. Nullam vitae nunc leo. Cras sed nisl consectetur, rhoncus sapien sit amet, tempus sapien.

Integer turpis erat, porttitor vitae mi faucibus, laoreet interdum tellus. Curabitur posuere molestie dictum. Morbi eget congue risus, quis rhoncus quam. Suspendisse vitae hendrerit erat, at posuere mi. Cras eu fermentum nunc. Sed id ante eu orci commodo volutpat non ac est. Praesent ligula diam, congue eu enim scelerisque, finibus commodo lectus.

Close
'),e.put("app/sql/renderResult.html",'
{{resultContainer.cellsCalc}}{{::tableData.data.progressQuery}}CSV with headersCSV without headersTSV with headersTSV without headersPinnedTable
Draw
'),e.put("app/sql/showDialogUpload.html",'

Upload CSV to View

'),e.put("app/sql/sql.html",'
{{tab.name + (tab.changed ? \' *\' : \'\')}}
Make snippetAutoFormatExpandCollapseCollapse All
{{tab.buttonTitle}}Run current ⌘ + ⏎Full screenSave{{item.name}}Query log
USE {{::dbb.name}}{{vars.LastStatistics.elapsed| number:2}} sec.| {{vars.LastStatistics.rows_read| number}} rows.| {{vars.LastStatistics.bytes_read|filesize}}
..... {{tab.progress.query}}
'),e.put("app/table/table-container.html",'

{{vars.currentDatabase}} {{vars.currentTable}}

Structure
NameTypeDefault typeValueSizeCompress
{{$index + 1}}{{field[key]}}
Information
1Size{{vars.statistics.size}}
2Size,bytes{{vars.statistics.sizeBytes}}
3First row{{vars.statistics.minDate}}
4Last row{{vars.statistics.maxDate}}

SHOW CREATE TABLE
{{vars.createtable}}
Data
Data From {{vars.offset}} To {{vars.offset + vars.limit}}
No data
'),e.put("app/table/table.html",'
')}]),function(e,t){function a(e,t){var a=t.dbName,n=t.tableName;e.vars={dbName:a,tableName:n}}e.module(t.app.name).controller("TableController",a),a.$inject=["$scope","$stateParams"]}(angular,smi2),function(e,t){function a(t,a,n,i,r,s,o,l){t.tablewidget={},t.vars={columns:{},ugrid:{},sortColumn:!1,isDark:i.isDark(),createtable:{},data:null,grid:null,limit:100,offset:0,statistics:{},loading:!0,isRawStatistics:!1,rawstatistics:"",scrollConfig:{autoHideScrollbar:!1,theme:i.isDark()?"light":"dark",scrollButtons:{enable:!1},scrollInertia:100,advanced:{updateOnContentResize:!0}}},t.initContainer=function(){a.$watch("currentTable",function(e){e&&(t.vars.currentTable=a.currentTable,t.vars.currentDatabase=a.currentDatabase,t.init())})},t.onAfterInit=function(){},t.updateHandTable=function(){l.getInstance("hotTableContain").render()},t.initOnGo=function(){t.$parent.vars&&(o.get("tableSiedenav")&&s("tableSiedenav").close(),t.vars.currentTable=t.$parent.vars.tableName,t.vars.currentDatabase=t.$parent.vars.dbName,t.init())},t.load=function(){console.warn("LOAD DATA! IN TABLES"),t.vars.data=-1,n.fetchQuery("\n select * from "+t.vars.currentDatabase+"."+t.vars.currentTable+" limit "+t.vars.offset+", "+t.vars.limit+"\n ").then(function(e){var a="ch";t.tablewidget=new WidgetTable(new DataProvider(e,a)),t.vars.loading=!1},function(e){t.vars.loading=!1,console.error("Error "+e)})},t.calcRawSize=function(){t.vars.isRawStatistics=!0,n.fetchQuery("SELECT any(ignore(*)) FROM "+t.vars.currentDatabase+"."+t.vars.currentTable+" SAMPLE 1 / 10000 ").then(function(e){t.vars.rawstatistics=e.statistics},function(e){t.vars.rawstatistics=e.data})},t.init=function(){t.vars.loading=!0,t.vars.createtable="N/A",n.fetchQuery("SHOW CREATE TABLE "+t.vars.currentDatabase+"."+t.vars.currentTable).then(function(e){t.vars.createtable=window.sqlFormatter.format(e.data[0].statement)}),n.fetchQuery("SELECT table, formatReadableSize(sum(bytes)) as size, sum(bytes) as sizeBytes, min(min_date) as minDate, max(max_date) as maxDate FROM system.parts WHERE database = '"+t.vars.currentDatabase+"' AND ( table = '"+t.vars.currentTable+"' OR table = '"+t.vars.currentTable+"_sharded' ) GROUP BY table ").then(function(e){return t.vars.statistics=e&&e.data.length&&e.data[0]||{}}),n.fetchQuery("SELECT * FROM system.columns WHERE database='"+t.vars.currentDatabase+"' AND table='"+t.vars.currentTable+"'").then(function(a){n.fetchQuery("describe table "+t.vars.currentDatabase+"."+t.vars.currentTable).then(function(n){_.map(n.data,function(t){var n=_.find(a.data,{name:t.name});return _.merge(t,n),t.size="-",t.ratio="-",!e.isUndefined(t.default_kind)&&e.isUndefined(t.default_type)&&(t.default_type=t.default_kind),t.data_compressed_bytes&&(t.size=numbro(t.data_compressed_bytes).format("0.0 b")+" / "+numbro(t.data_uncompressed_bytes).format("0.0 b"),t.ratio=numbro(parseInt(t.data_uncompressed_bytes)/parseInt(t.data_compressed_bytes)).format("0.0")),t}),t.vars.columns=n,t.vars.sortColumn=!1;var i=0;n.data.forEach(function(e){3>i&&("Date"==e.type&&(t.vars.sortColumn=e.name),"DateTime"==e.type&&(t.vars.sortColumn=e.name)),i+=1}),t.load()})})},t.loadNext=function(){t.vars.loading=!0,t.vars.offset+=t.vars.limit,t.load()},t.loadPrev=function(){t.vars.offset>0&&(t.vars.loading=!0,t.vars.offset-=t.vars.limit,t.load())}}e.module(t.app.name).controller("TableContainerController",a),a.$inject=["$scope","$rootScope","API","ThemeService","$stateParams","$mdSidenav","$mdComponentRegistry","hotRegisterer"]}(angular,smi2),/* * Licensed under the Apache License, Version 2.0 Copyright 2017 Tabix LLC,Igor Strykhar and other contributors */ window.global_delimiter=";;",window.aceJSRules={builtinFunctions:[],lang:"en",dictionaries:[],fieldsList:[],tables:[]},function(e,t){function a(t,a,n,i,r,s,o,l,c,d,u,m,h,p,g){var b="sqlHistory2",f="saveTabs",v="sessionData",y=255;t.AceEditorInLoad=!1,t.vars={EditorIsInit:!1,sqlHistory:i.get(b)||[],dictionaries:[],isDictionariesLoad:!1,tabs:[],enableLiveAutocompletion:h.get("liveAutocompletion"),disableAutohelp:h.get("disableAutohelp"),disableHotKeyCmdLeft:h.get("disableHotKeyCmdLeft"),saveTabs:i.get(f)||!0,LastStatistics:!1,delimiters:[{name:";; Double",delimiter:";;"},{name:"; Single",delimiter:";"}],databasesList:[],searchQueryOnServer:"",currentTab:{},selectedTab:0,formats:[{name:"Table",sql:" format JSON",render:"html"},{name:"JSON compact",sql:" format JSONCompact"}],db:null,limitTimes:h.get("limitTimes"),limitRows:h.get("limitRows"),fontSize:h.get("fontSize"),theme:h.get("editorTheme")},t.vars.delimiter=i.get("delimiter")||";;",t.vars.format=t.vars.formats[0],t.vars.themes=["ambiance","eclipse","mono_industrial","tomorrow_night_blue","chaos","github","monokai","tomorrow_night_bright","chrome","idle_fingers","pastel_on_dark","tomorrow_night_eighties","clouds","iplastic","solarized_dark","tomorrow_night","clouds_midnight","katzenmilch","solarized_light","twilight","cobalt","kr_theme","sqlserver","vibrant_ink","crimson_editor","kuroir","terminal","xcode","dawn","merbivore","textmate","dreamweaver","merbivore_soft","tomorrow"],n.onbeforeunload=function(e){if(""!==t.vars.currentTab.sql&&"localhost"!=location.hostname){var a="Do you want to leave this page?";return"undefined"==typeof e&&(e=window.event),e&&(e.returnValue=a),a}};var w=t.$on("$stateChangeStart",function(e){var a="Do you want to leave this page?";e.defaultPrevented||""===t.vars.currentTab||confirm(a)||e.preventDefault()}),k=function(){if(t.vars.saveTabs){var e=t.vars.tabs.map(function(e){return e.editor?e.sql=e.editor.getValue():e.sql="",{name:e.name,sql:e.sql,buttonTitle:e.buttonTitle,format:e.format,delimiter:e.delimiter,results:[],editor:null,selectedResultTab:0}});i.set(v,e),console.info("Save session , localStorageService.set(SQL_SESSION_KEY)")}};t.$watch("$root.isInitDatabaseStructure",function(){t.vars.EditorIsInit=a.isInitDatabaseStructure}),t.InitDatabaseStructure=function(){console.warn(">>>>>>>>>>>>>>>InitDatabaseStructure<<<<<<<",a.isInitDatabaseStructure)},t.executeQuery=function(a,n,i){var s="result_overflow_mode=throw";t.vars.currentTab.loading=!0,t.vars.limitRows&&(s+="&max_result_rows="+t.vars.limitRows),t.vars.limitTimes&&(s+="&timeout_overflow_mode=throw&max_execution_time="+t.vars.limitTimes);var o=a.sql.replace(/(\r\n|\n|\r)$/gm,"").substr(0,130);t.vars.currentTab.progress.query=o;var d="";a.qid&&(d=" /*TABIX_QUERY_ID_"+a.qid+"*/ "),r.fetchQuery(d+a.sql,!0,a.format,s).then(function(r){try{var s=r;e.isObject(r)||(r={data:s,meta:null,rows:null,statistics:null}),r.error=!1,r.query=a,r.countAllQuery=n.length;var l={time:moment().format("HH:mm:ss")};e.isObject(r.statistics)&&Object.assign(l,r.statistics),l.query=o,_.isArray(t.vars.currentTab.statistics)&&t.vars.currentTab.statistics.push(l),t.vars.LastStatistics=l;var c=new DataProvider(r,"ch");c.progressQuery=o,i.widgets.tables.push(new WidgetTable(c)),"drawCommand"in a&&a.drawCommand.length?(c.countAll=a.drawCommand.length>r.countAllQuery?a.drawCommand.length:r.countAllQuery,console.info("query.drawCommand",a.drawCommand),a.drawCommand.forEach(function(e){i.widgets.draw.push(new WidgetDraw(c,e))})):i.widgets.draw.push(new WidgetDraw(c,!1)),i.data.push(a),t.$applyAsync(),a.index+1-1&&r>-1&&t.vars.currentTab.editor.gotoLine(s,r),console.log("move cursor to",s,r)}var d="ch";console.warn("ERROR",n);var u=new DataProvider(n,d);i.data.push(a),i.widgets.tables.push(new WidgetTable(u)),t.finalizeResult(i)})},t.renderResult=function(e){},t.finalizeResult=function(e){if(t.vars.currentTab.loading=!1,t.vars.currentTab.progress=!1,e.data.find(function(e){return e.keyword&&-1!=["DROP","CREATE","ALTER"].indexOf(e.keyword.toUpperCase())})&&l.show(l.simple().content("Press `Reload Structure` for reload").theme(c.theme).position("bottom right")),t.$applyAsync(),t.vars.currentTab.statistics[0]){var a=DataProvider.convertArrayToDataProvider(t.vars.currentTab.statistics,"statistics");a.sort="time",a.sortOrder="desc",e.widgets.stats.push(new WidgetTable(a,!1))}},t.execute=function(n,s){t.$applyAsync(),console.groupCollapsed("Execute query"),t.vars.LastStatistics=!1,s.sql=s.editor.getValue();var o=s.sql,d=0,m=s.editor,h=[],p=m.getSelectedText();e.isUndefined(s.selectedTabResultIndex)&&(s.selectedTabResultIndex=0);var b={data:[],time:u("date")(new Date,"HH:mm:ss"),pinned:!1,widgets:{tables:[],pivot:[],draw:[],stats:[]}};if(""!==p&&null!==p&&(o=p),console.info("[EDITOR TEXT]> ",o),""===o||null===o)return void l.show(l.simple().content("SQL query is empty").theme(c.theme).position("bottom right"));s.results=[b],k();var f=window.global_delimiter;f||(f=";;"),m.session.$mode.splitByTokens(o,"constant.character.escape",f).forEach(function(t){if(!("current"==n&&d>0)){var s=[],o=t.sql;if(!(o.length<5)){if("current"==n&&!p){var l=m.selection.getCursor();if(!l||e.isUndefined(l))return;var c=t.range.compare(l.row,l.column);if(0!==c)return}var u=o.trim();-1==a.sqlLog.indexOf(u)&&(a.sqlLog.unshift(u),a.sqlLog.length>y&&a.sqlLog.splice(0,y),i.set("sqlLog",a.sqlLog));var b=m.session.$mode.replaceVars(o,g.get());o=b.sql;b.vars;if(console.log("replacedVars",b),m.session.$mode.findTokens(o,"invalid.illegal",!0)){var f=m.session.$mode.splitByTokens(o,"invalid.illegal",!0);o=f[0].sql,f.forEach(function(t){if(e.isDefined(t.keyword)&&t.keyword){var a=/DRAW_(\w+)/gim,n=a.exec(t.keyword);n&&n[1]&&s.push({drawtype:n[1].toLowerCase(),code:t.sql})}})}console.info("[SQL]>",o),s&&console.info("[DRAW]>",s);var v=null,w=!1,k=!1,x=null,C=m.session.$mode.findTokens(o,"storage",!0),S=m.session.$mode.findTokens(o,"keyword",!0);C.hasOwnProperty("value")?(v=!1,k=C.value):(v=" FORMAT JSON ",w=!0),S.hasOwnProperty("value")&&(x=S.value),"select"!=x&&"with"!=x&&(v=!1,w=!1),h.push({sql:o,index:d,format:v,setedformat:w,keyword:x,storage:k,drawCommand:s,itemRange:t.range,qid:r.makeQueryId()}),d++}}}),console.groupEnd("Execute query"),h.length&&(t.vars.currentTab.progress={},t.vars.currentTab.statistics||(t.vars.currentTab.statistics=[]),t.executeQuery(h[0],h,b))},t.setTheme=function(e){t.vars.theme=e,t.vars.tabs.forEach(function(t){return t.editor.setTheme("ace/theme/"+e)}),i.set("editorTheme",e)},t.reloadCache=function(){console.log("reloadCache"),r.resetDatabaseStructure(),l.show(l.simple().content("Reload page - for reset cache").theme(c.theme).position("bottom right"))},t.selectDatabase=function(e,a){e&&(r.setDatabase(e),t.vars.db!=e&&(t.vars.db=e,t.AceEditorInLoad||(t.aceLoadDatabaseFields(),t.aceApply(!1))))},t.insertWordInEditor=function(e){var a=t.vars.currentTab.editor,n=a.getCursorPosition();n.column+=e.length,a.clearSelection(),a.insert(e),t.vars.currentTab.sql=a.getValue(),d(function(){a.focus(),a.moveCursorToPosition(n)})},t.aceLoadDatabaseFields=function(){var e=t.vars.db;window.aceJSRules.fieldsList=[],r.databaseStructure(function(t){window.aceJSRules.fieldsList=t.getAllFieldsInDatabase(e)})},t.aceLoadDatabaseStructure=function(){var e=t.vars.db;window.aceJSRules.tables=[],r.databaseStructure(function(a){t.vars.databasesList=a.getDatabases(),Object.keys(a.getUniqueDatabaseTables()).forEach(function(e){window.aceJSRules.tables.push(e)}),window.aceJSRules.fieldsList=a.getAllFieldsInDatabase(e)})},t.loadInAce=function(e){e.session.setMode({path:"ace/mode/clickhouse"});for(var t in window.aceJSRules.builtinFunctions){var a=window.aceJSRules.builtinFunctions[t];e.session.$mode.$highlightRules.addCompletionsFunctions(a)}e.session.$mode.$highlightRules.addArrayCompletions(window.aceJSRules.tables,"[table]","table");for(var n in window.aceJSRules.dictionaries){var i=window.aceJSRules.dictionaries[n];e.session.$mode.$highlightRules.addCompletionsDictionaries(i)}for(var r in window.aceJSRules.fieldsList){var s=window.aceJSRules.fieldsList[r];e.session.$mode.$highlightRules.addCompletionsTableFiled(s)}var o=g.getCompletions(),l=p.getCompletions();e.session.$mode.$highlightRules.addArrayCompletions(o,"[var]","var"),e.session.$mode.$highlightRules.addArrayCompletions(l,"[snippet]","snippet"),e.session.bgTokenizer.start(0)},t.aceApply=function(e){e?(console.log(""),t.loadInAce(e)):t.vars.tabs.forEach(function(e){e.editor&&(console.log(""),t.loadInAce(e.editor))}),a.$watch("currentDatabase",t.selectDatabase)},t.changeRootSelectDatabase=function(e){a.currentDatabase!=e&&(a.currentDatabase=e)},t.aceLoadDictionaries=function(){t.vars.isDictionariesLoad||(window.aceJSRules.dictionaries=[],t.vars.dictionaries=[],window.aceJSRules.builtinFunctions=[],t.vars.isDictionariesLoad=!0,r.databaseStructure(function(e){e.getFunctions().forEach(function(e){if(window.aceJSRules.builtinFunctions.push({name:e.name,isaggr:e.is_aggregate,score:101,comb:!1,origin:e.name}),e.is_aggregate){var t={name:e.name+"If",isaggr:e.is_aggregate,score:3,comb:"If",origin:e.name};window.aceJSRules.builtinFunctions.push(t),t={name:e.name+"Array",isaggr:e.is_aggregate,score:2,comb:"Array",origin:e.name},window.aceJSRules.builtinFunctions.push(t),t={name:e.name+"State",isaggr:e.is_aggregate,score:1,comb:"State",origin:e.name},window.aceJSRules.builtinFunctions.push(t)}}),e.getDictionaries().forEach(function(e){var a=e.name;a=a.replace(/^.*\./gm,""),"news"!=a&&(a=a.replace(/s$/gm,"")),a=a?a.toLowerCase()+"_id":"ID";var n="dictGet"+e["attribute.types"]+"('"+e.name+"','"+e["attribute.names"]+"',to"+e.key+"( "+a+" ) ) AS "+e["attribute.names"]+",";window.aceJSRules.dictionaries.push({dic:n,title:"dic_"+e.name+"."+e["attribute.names"]}),t.vars.dictionaries.push({dic:n,title:e.name+"."+e["attribute.names"]+" as "+e["attribute.types"]})})}))};for(var x=function(e){t.vars.tabs.length>=e&&(t.vars.currentTab=t.vars.tabs[e],t.vars.selectedTab=e,d(function(){t.vars.currentTab.editor.focus()}))},C=function(){t.vars.selectedTab>0&&x(t.vars.selectedTab-1)},S=function(){t.vars.selectedTabD;D++)A(D);m.add({combo:t.vars.disableHotKeyCmdLeft?"ctrl+shift+alt+right":"ctrl+right",callback:S}),m.add({combo:t.vars.disableHotKeyCmdLeft?"ctrl+shift+alt+left":"ctrl+left",callback:C}),m.add({combo:"ctrl+shift+f",callback:T}),t.aceLoaded=function(e){t.editorVisiable=!1,d(function(){t.editorVisiable=!0,t.AceEditorInLoad=!0,a.currentDatabase&&t.selectDatabase(a.currentDatabase),t.aceLoadDictionaries(),t.aceLoadDatabaseStructure(),t.aceLoadDatabaseFields();var n=t.vars.tabs.find(function(e){return!e.editor})||t.vars.currentTab;n.editor=e,e.$blockScrolling=1/0,e.setOptions({fontSize:t.vars.fontSize+"px",enableBasicAutocompletion:!0,behavioursEnabled:!0,wrapBehavioursEnabled:!0,highlightSelectedWord:!0,showGutter:!0,enableLiveAutocompletion:t.vars.enableLiveAutocompletion,liveAutocompletionDelay:500,liveAutocompletionThreshold:1}),e.setTheme("ace/theme/"+t.vars.theme),e.session.setUseWrapMode(h.get("useWrapMode")),e.commands.addCommand({name:"runCurrentCommand",bindKey:{win:"Ctrl-Enter",mac:"Command-Enter"},exec:function(){t.execute("current",n)}}),e.commands.addCommand({name:"removeLiness",bindKey:{win:"Ctrl-Y",mac:"Cmd-Y"},exec:function(e){e.removeLines()}}),e.commands.addCommand({name:"collapseAll",bindKey:{win:"Ctrl-Shift--",mac:"Command+Shift+-"},exec:function(e){e.session.$mode.collapseAll(e.session)}}),e.commands.addCommand({name:"unfold",bindKey:{win:"Ctrl-Shift-+",mac:"Command+Shift+="},exec:function(e){e.session.unfold()}}),e.commands.addCommand({name:"runAllCommand",bindKey:{win:"Shift-Ctrl-Enter",mac:"Shift-Command-Enter"},exec:function(){t.execute("all",n)}});for(var i=function(t){e.commands.addCommand({name:"selecttab"+t,bindKey:{win:"Ctrl-Shift-"+(t+1),mac:"Command-Shift-"+(t+1)},exec:function(){return x(t)}})},r=0;9>r;r++)i(r);e.commands.addCommand({name:"selectnexttab",bindKey:{win:t.vars.disableHotKeyCmdLeft?"Shift-Alt-Ctrl-Right":"Ctrl-Right",mac:t.vars.disableHotKeyCmdLeft?"Shift-Alt-Command-Right":"Command-Right"},exec:S}),e.commands.addCommand({name:"selectprevtab",bindKey:{win:t.vars.disableHotKeyCmdLeft?"Shift-Alt-Ctrl-Left":"Ctrl-Left",mac:t.vars.disableHotKeyCmdLeft?"Shift-Alt-Command-Left":"Command-Left"},exec:C}),e.commands.addCommand({name:"formatcode",bindKey:{win:"Ctrl-Shift-F",mac:"Command-Shift-F"},exec:T}),e.setValue(n.sql),e.clearSelection(),e.focus(),e.selection.moveTo(0,0),e.on("changeSelection",function(){d(function(){n.buttonTitle=""!==e.getSelectedText()?"Run selected ⌘ + ⏎":"Run all ⇧ + ⌘ + ⏎",n.originalSql&&(n.changed=n.originalSql!=n.sql)})}),t.AceEditorInLoad=!1,t.aceApply(e)},100)},t.save=function(e,a){return o.show(o.prompt().title("Save SQL as?").placeholder("Title").initialValue(e.name).targetEvent(a).ok("Save").cancel("")).then(function(a){var n=t.vars.sqlHistory.findIndex(function(t){return t.name==e.name});-1!=n?(t.vars.sqlHistory[n].sql=e.sql,t.vars.sqlHistory[n].name=a):t.vars.sqlHistory.push({sql:e.sql,name:a}),e.originalSql=e.sql,e.name=a,i.set(b,t.vars.sqlHistory),k()})},t.load=function(e){t.vars.currentTab.sql=e.sql,t.vars.currentTab.originalSql=e.sql,t.vars.currentTab.name=e.name,t.vars.currentTab.editor.setValue(e.sql),t.aceApply(t.vars.currentTab.editor)},t.getExportData=function(t){return t.data.data.map(function(t){return Object.keys(t).map(function(a){return e.isArray(t[a])?t[a].join(", "):t[a]})})},t.getExportHeaders=function(e){return e.data.meta.map(function(e){return e.name})},t.addTab=function(){t.vars.currentTab={name:"new SQL",sql:"",buttonTitle:"Run ⌘ + ⏎",format:{},editor:null,results:[],selectedResultTab:0},t.vars.tabs.push(t.vars.currentTab),k()},t.changeTab=function(e){k(),t.vars.currentTab=e},t.removeTab=function(e,a){a.stopPropagation();var n=function(){t.vars.tabs.splice(t.vars.tabs.indexOf(e),1),t.vars.tabs.length==t.vars.selectedTab&&t.vars.selectedTab--};e.changed?o.show(o.confirm().title("SQL was changed. Save it before exit?").targetEvent(a).ok("Yes").cancel("No")).then(function(){var a=t.vars.sqlHistory.findIndex(function(t){return t.name==e.name});-1!=a&&(t.vars.sqlHistory[a].sql=e.sql,t.vars.sqlHistory[a].name=e.name),i.set(b,t.vars.sqlHistory),n()},n):n()},t.removeResult=function(e,t,a){},a.$on("handleBroadcastUpdateVarsAndSnippets",function(e,a){t.aceApply()}),a.$on("handleBroadcastCalcSumCells",function(e,a){_.isObject(t.vars.currentTab.results[0])&&(t.vars.currentTab.results[0].cellsCalc=a,t.$applyAsync())}),a.$on("handleBroadcastInsertInActive",function(e,a){a.value&&t.insertWordInEditor(" "+a.value+" ")}),t.toggleSidenav=function(e){s(e).toggle()},t.removeHistory=function(e,a){a.preventDefault();var n=t.vars.sqlHistory.indexOf(e);-1!=n&&o.show(o.confirm().title("Delete "+e.name+"?").targetEvent(a).ok("Yes").cancel("No")).then(function(){t.vars.sqlHistory.splice(n,1),i.set(b,t.vars.sqlHistory)})},t.setSql=function(e){t.vars.currentTab.sql=e,t.toggleSidenav("log"),t.vars.currentTab.editor.setValue(e),d(function(){return t.vars.currentTab.editor.focus()},500)},t.changeTabName=function(e,a){a.stopPropagation(),o.show(o.prompt().title("Title tab").placeholder("title").initialValue(e.name).targetEvent(a).ok("Apply").cancel("Cancel")).then(function(a){var n=t.vars.sqlHistory.findIndex(function(t){return t.name==e.name});-1!=n&&(e.originalSql=e.sql,t.vars.sqlHistory[n].name=a,i.set(b,t.vars.sqlHistory)),e.name=a,k()})},t.vars.saveTabs?(t.vars.tabs=i.get(v),_.isArray(t.vars.tabs)||(t.vars.tabs=[]),t.vars.tabs.length>0?d(function(){return t.vars.currentTab=t.vars.tabs[0]},500):t.addTab()):(i.set(v,[]),t.addTab()),t.$on("$destroy",function(){r.setDatabase(a.currentDatabase),w(),n.onbeforeunload=null}),t.rightAceMenuList=[],t.showDialogUpload=function(t,a){function n(e,t){e.vars={UploadCsv:{content:null,header:!0,headerVisible:!0,separator:",",separatorVisible:!0,result:null,encoding:"ISO-8859-1",encodingVisible:!0,uploadButtonLabel:"Upload",callback:function(e){t.hide()}}},e.$watch("vars.UploadCsv.result",function(e){e&&t.hide(e)}),e.hide=function(){t.hide()},e.cancel=function(){t.cancel()}}n.$inject=["$scope","$mdDialog"],o.show({controller:n,templateUrl:"app/sql/showDialogUpload.html",parent:e.element(document.body),targetEvent:a,clickOutsideToClose:!0}).then(function(e){if(e&&t&&t.tables){var a=DataProvider.convertArrayToDataProvider(e,"csv");t.tables.push(new WidgetTable(a))}},function(){})},t.rightMenuProcess=function(e){t.vars.currentTab.sql=t.vars.currentTab.editor.getValue();var a=t.vars.currentTab.editor.session;if(t.vars.currentTab.editor.resize(),"Snippet"==e){var n=t.vars.currentTab.editor.getSelectedText();n&&(p.add(n),t.aceApply())}else"AutoFormat"==e?T():"Expand"==e?a.unfold():"Collapse All"==e?a.$mode.collapseAll(a):"Collapse"==e&&a.foldAll();t.vars.currentTab.editor.focus()}}e.module(t.app.name).controller("SqlController",a),a.$inject=["$scope","$rootScope","$window","localStorageService","API","$mdSidenav","$mdDialog","$mdToast","ThemeService","$timeout","$filter","hotkeys","Preference","Snippets","Variables"]}(angular,smi2),/* @@ -20,7 +20,7 @@ function(e,t){function a(e){var t=this;this.snippets={},this.constructor=functio function(e,t){function a(e,t){var a=this,n={limitRows:5e3,limitTimes:5,fontSize:14,editorTheme:"cobalt",theme:"dark",saveTabs:!0,liveAutocompletion:!0,disableAutohelp:!1,disableHotKeyCmdLeft:!0,delimiter:";;",liveAutocompletionDelay:500,liveAutocompletionThreshold:1,useWrapMode:!0,showInvisibles:!1},i=["ligth","dark"],r=["ambiance","eclipse","mono_industrial","tomorrow_night_blue","chaos","github","monokai","tomorrow_night_bright","chrome","idle_fingers","pastel_on_dark","tomorrow_night_eighties","clouds","iplastic","solarized_dark","tomorrow_night","clouds_midnight","katzenmilch","solarized_light","twilight","cobalt","kr_theme","sqlserver","vibrant_ink","crimson_editor","kuroir","terminal","xcode","dawn","merbivore","textmate","dreamweaver","merbivore_soft","tomorrow","dracula"];this.current={},this.constructor=function(){var t=e.get("UserPreference");a.current=_.merge(n,t)},this.constructor(),this.getThemes=function(){return i},this.getEditorThemes=function(){return r},this.apply=function(e){_.forEach(e,function(e,t){a.set(t,e)}),a.save()},this.save=function(){console.log("localStorageService,set",a.current),e.set("UserPreference",a.current)},this.getCurrentState=function(){return a.current},this.get=function(e){return n[e]},this.set=function(e,t){("limitRows"==e||"limitTimes"==e||"fontSize"==e||"liveAutocompletionDelay"==e||"liveAutocompletionThreshold"==e)&&(t=parseInt(t)),a.current[e]=t}}e.module(t.app.name).service("Preference",a),a.$inject=["localStorageService","ThemeService"]}(angular,smi2),function(e,t){function a(e,t){return{responseError:function(a){return 401==a.status&&t.get("$state").go("login"),e.reject(a)}}}e.module(t.app.name).service("HttpInterceptor",a),a.$inject=["$q","$injector"]}(angular,smi2),/* * Licensed under the Apache License, Version 2.0 Copyright 2017 Tabix LLC,Igor Strykhar and other contributors */ -function(e,t){function a(t,a,n,i,r){var s=this,o="currentBaseConfig",l=new DatabaseStructure,c=null,d={},u=n.get(o);u&&(u.host||u.tabix)&&(d=u),this.setConnection=function(t){n.set(o,t),d=e.copy(t)},this.isAuthorized=function(){return s.isTabixServer()?d&&d.tabix?d.tabix.server:!1:d?d.host:!1},this.clear=function(){c=null,d={},n.set(o,{}),l=new DatabaseStructure},this.hashCode=function(e){return e.split("").reduce(function(e,t){return e=(e<<5)-e+t.charCodeAt(0),e&e},0)},this.DS_CacheKey=function(){var e="_databaseStructure:"+JSON.stringify(d);return e=s.hashCode(e)},this.DS_storeCache=function(e,t,a,i,r){var o={columns:e,tables:t,databases:a,dictionaries:i,functions:r,ttl:Date.now()};return n.set(s.DS_CacheKey(),o)},this.DS_fetchFromCache=function(){var e=n.get(s.DS_CacheKey());if(!e||!e.ttl)return!1;var t=(Date.now()-e.ttl)/36e5;return t>1.5?!1:e&&e.functions&&e.functions.length>1?(l.init(e.columns,e.tables,e.databases,e.dictionaries,e.functions),!0):!1},this.memory=function(e){},this.resetDatabaseStructure=function(){console.log("reset databaseStructure"),n.set("_databaseStructure:"+s.getHost()+":"+s.getLogin(),[])},this.databaseStructure=function(e,t){return!t&&l.isInit()?e(l):!t&&s.DS_fetchFromCache()&&l.isInit()?(console.info("restore from cache : database Structure!"),e(l)):(t&&(l=new DatabaseStructure),console.time("Load Database Structure!"),void s.fetchQuery("SELECT * FROM system.columns").then(function(t){s.fetchQuery("SELECT database,name,engine FROM system.tables").then(function(a){s.fetchQuery("SELECT name FROM system.databases").then(function(n){s.fetchQuery("SELECT name,key,attribute.names,attribute.types from system.dictionaries ARRAY JOIN attribute ORDER BY name,attribute.names",null).then(function(i){s.fetchQuery("SELECT name,is_aggregate from system.functions",null).then(function(r){return console.timeEnd("Load Database Structure!"),s.DS_storeCache(t.data,a.data,n.data,i.data,r.data),l.init(t.data,a.data,n.data,i.data,r.data),e(l)},function(e){throw e})},function(e){throw e})},function(e){throw e})},function(e){throw e})},function(e){throw e}))},this.getConnectionInfo=function(){return d},this.setDatabase=function(e){return c=e},this.getDatabase=function(){return c},this.getHost=function(){return d.host},this.getPassword=function(){return d.password},this.getLogin=function(){return d.login},this.makeQueryId=function(){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",a=0;8>a;a++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},this.isTabixServer=function(){return d.tabix&&d.tabix.server?!0:!1},this.makeSqlQuery=function(e,t){var a="";return t!==!1?(t=t||" FoRmAt JSON","null"==t&&(t=""),a=e+"\n\n"+t):a=e,a},this.direct_makeUrlRequest=function(e,t){var a="",n="";d.host.indexOf("://")>0||0==d.host.indexOf("/")||(n="http://"),a=n+d.host,a+="/?",a+="add_http_cors_header=1&log_queries=1&output_format_json_quote_64bit_integers=1",d.NotCH1_1_54276||(a+="&output_format_json_quote_denormals=1");return d.baseauth||(a+=d.password?"&user="+encodeURIComponent(d.login)+"&password="+encodeURIComponent(d.password):"&user="+encodeURIComponent(d.login)),e&&(a+="&database="+encodeURIComponent(c)),t&&(a+="&"+t),d.params&&(a+="&"+d.params),a},this.fetchQuery=function(e,t,a,n){return s.isTabixServer()?s.ts_fetchQuery(e,t,a,n):s.direct_fetchQuery(e,t,a,n)},this.pushProjectState=function(e){return s.fetchTabixServer("projectstate/push",e)},this.getProjectState=function(e){return s.fetchTabixServer("projectstate/fetch",e)},this.getStructure=function(e){return s.fetchTabixServer("structure",e)},this.getWidget=function(e,t){return s.fetchTabixServer("widget/"+e,t)},this.getDashboard=function(e,t){return s.fetchTabixServer("dashboard/"+e,t)},this.getDashboardsTree=function(e){return s.fetchTabixServer("dashboards",e)},this.fetchTabixServer=function(e,t,a){_.isObject(t)||(t={});var n=d.tabix.server;n=n+"/"+e+"?tabix_client="+window.TabixVersion+"&random="+Math.round(1e8*Math.random()),a&&(n+="&"+a);var i={version:window.TabixVersion,auth:{login:d.tabix.login,password:d.tabix.password,confid:d.tabix.confid}};i=Object.assign(t,i);var r={mode:"cors",method:"post",headers:{"Content-type":"application/json; charset=UTF-8"},body:JSON.stringify(i)};console.info("TS Request",n,r);var s=new Request(n,r);return fetch(s).then(function(e){var t=e.headers.get("content-type");return t.includes("text/plain")&&200==e.status&&"ok"==e.statusText.toLowerCase()?"OK":t&&t.includes("application/json")&&e.status>=200&&e.status<300?Promise.resolve(e):e.text().then(Promise.reject.bind(Promise))}).then(function(e){return"OK"===e?"OK":e.json()},function(e){return Promise.reject(e)})},this.ts_fetchQuery=function(e,t,a,n){return s.fetchTabixServer("query",{query:s.makeSqlQuery(e,a)},n)},this.direct_fetchQuery=function(e,t,a,n){var i=s.makeSqlQuery(e,a),r=s.direct_makeUrlRequest(t,n),o={mode:"cors",method:"post",headers:{"Content-type":"application/x-www-form-urlencoded; charset=UTF-8"},body:i};d.includeCredentials&&(o.credentials="include");var l=new Request(r,o);return fetch(l).then(function(e){var t=e.headers.get("content-type");return t.includes("text/tab-separated-values")&&200==e.status&&"ok"==e.statusText.toLowerCase()?"OK":t.includes("text/plain")&&200==e.status&&"ok"==e.statusText.toLowerCase()?"OK":t&&t.includes("application/json")&&e.status>=200&&e.status<300?Promise.resolve(e):e.text().then(Promise.reject.bind(Promise))}).then(function(e){return"OK"===e?"OK":e.json()},function(e){return Promise.reject(e)})}}e.module(t.app.name).service("API",a),a.$inject=["$http","$q","localStorageService","$sanitize","ThemeService"]}(angular,smi2);var DatabaseStructure=function(){function e(){_classCallCheck(this,e),this._init=!1,this.uciq_fields=[],this.all_fields=[],this.all_db_fields=[],this.uciq_dbtables=[]}return _createClass(e,[{key:"init",value:function(e,t,a,n,i){var r=this;console.log("Try init DS...."),this._init||(this.columns=e,this.tables=t,this.databases=a,this.functions=i,this.dictionaries=n,this.columns.forEach(function(e){!angular.isUndefined(e.default_kind)&&angular.isUndefined(e.default_type)&&(e.default_type=e.default_kind),r.all_fields[e.database+"."+e.table]||(r.all_fields[e.database+"."+e.table]=[]),r.all_db_fields[e.database]||(r.all_db_fields[e.database]=[]),r.all_db_fields[e.database][e.table]||(r.all_db_fields[e.database][e.table]=[]),r.all_db_fields[e.database][e.table].push(e),r.all_fields[e.database+"."+e.table].push({name:e.name,type:e.type,active:!0}),r.uciq_fields[e.database]||(r.uciq_fields[e.database]=[]),_.isArray(r.uciq_fields[e.database])||(r.uciq_fields[e.database]=[]),_.isArray(r.uciq_fields[e.database])||(r.uciq_fields[e.database]=[]),r.uciq_fields[e.database].push(e),r.uciq_dbtables[e.database+"."+e.table]=1}),console.log("DS init ... done"),this._init=!0)}},{key:"isInit",value:function(){return this._init&&this.functions&&this.functions.length>1}},{key:"getTables",value:function(){return this.tables}},{key:"getDatabases",value:function(){return this.databases}},{key:"getFieldsByDatabase",value:function(e){return this.all_db_fields[e]}},{key:"getFunctions",value:function(){return this.functions}},{key:"getFields",value:function(){return this.all_fields}},{key:"getUniqueDatabaseTables",value:function(){return this.uciq_dbtables}},{key:"getAllFieldsInDatabase",value:function(e){return this.uciq_fields[e]}},{key:"getDictionaries",value:function(){return this.dictionaries}},{key:"getColumns",value:function(){return this.columns}}]),e}();/* +function(e,t){function a(t,a,n,i,r){var s=this,o="currentBaseConfig",l=new DatabaseStructure,c=null,d={},u=n.get(o);u&&(u.host||u.tabix)&&(d=u),this.setConnection=function(t){n.set(o,t),d=e.copy(t)},this.isAuthorized=function(){return s.isTabixServer()?d&&d.tabix?d.tabix.server:!1:d?d.host:!1},this.clear=function(){c=null,d={},n.set(o,{}),l=new DatabaseStructure},this.hashCode=function(e){return e.split("").reduce(function(e,t){return e=(e<<5)-e+t.charCodeAt(0),e&e},0)},this.DS_CacheKey=function(){var e="_databaseStructure:"+JSON.stringify(d);return e=s.hashCode(e)},this.DS_storeCache=function(e,t,a,i,r){var o={columns:e,tables:t,databases:a,dictionaries:i,functions:r,ttl:Date.now()};return n.set(s.DS_CacheKey(),o)},this.DS_fetchFromCache=function(){var e=n.get(s.DS_CacheKey());if(!e||!e.ttl)return!1;var t=(Date.now()-e.ttl)/36e5;return t>1.5?!1:e&&e.functions&&e.functions.length>1?(l.init(e.columns,e.tables,e.databases,e.dictionaries,e.functions),!0):!1},this.memory=function(e){},this.resetDatabaseStructure=function(){console.log("reset databaseStructure"),n.set("_databaseStructure:"+s.getHost()+":"+s.getLogin(),[])},this.databaseStructure=function(e,t){return!t&&l.isInit()?e(l):!t&&s.DS_fetchFromCache()&&l.isInit()?(console.info("restore from cache : database Structure!"),e(l)):(t&&(l=new DatabaseStructure),console.time("Load Database Structure!"),void s.fetchQuery("SELECT * FROM system.columns").then(function(t){s.fetchQuery("SELECT database,name,engine FROM system.tables").then(function(a){s.fetchQuery("SELECT name FROM system.databases").then(function(n){s.fetchQuery("SELECT name,key,attribute.names,attribute.types from system.dictionaries ARRAY JOIN attribute ORDER BY name,attribute.names",null).then(function(i){s.fetchQuery("SELECT name,is_aggregate from system.functions",null).then(function(r){return console.timeEnd("Load Database Structure!"),s.DS_storeCache(t.data,a.data,n.data,i.data,r.data),l.init(t.data,a.data,n.data,i.data,r.data),e(l)},function(e){throw e})},function(e){throw e})},function(e){throw e})},function(e){throw e})},function(e){throw e}))},this.getConnectionInfo=function(){return d},this.setDatabase=function(e){return c=e},this.getDatabase=function(){return c},this.getHost=function(){return d.host},this.getPassword=function(){return d.password},this.getLogin=function(){return d.login},this.makeQueryId=function(){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",a=0;8>a;a++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},this.isTabixServer=function(){return d.tabix&&d.tabix.server?!0:!1},this.makeSqlQuery=function(e,t){var a="";return t!==!1?(t=t||" FoRmAt JSON","null"==t&&(t=""),a=e+"\n\n"+t):a=e,a},this.direct_makeUrlRequest=function(e,t){var a="",n="";d.host.indexOf("://")>0||0==d.host.indexOf("/")||(n="http://"),a=n+d.host,a+="/?",a+="add_http_cors_header=1&log_queries=1&output_format_json_quote_64bit_integers=1",d.NotCH1_1_54276||(a+="&output_format_json_quote_denormals=1");return d.baseauth||(a+=d.password?"&user="+encodeURIComponent(d.login)+"&password="+encodeURIComponent(d.password):"&user="+encodeURIComponent(d.login)),e&&(a+="&database="+encodeURIComponent(c)),t&&(a+="&"+t),d.params&&(a+="&"+d.params),a},this.fetchQuery=function(e,t,a,n){return s.isTabixServer()?s.ts_fetchQuery(e,t,a,n):s.direct_fetchQuery(e,t,a,n)},this.pushProjectState=function(e){return s.fetchTabixServer("projectstate/push",e)},this.getProjectState=function(e){return s.fetchTabixServer("projectstate/fetch",e)},this.getStructure=function(e){return s.fetchTabixServer("structure",e)},this.getWidget=function(e,t){return s.fetchTabixServer("widget/"+e,t)},this.getDashboard=function(e,t){return s.fetchTabixServer("dashboard/"+e,t)},this.getDashboardsTree=function(e){return s.fetchTabixServer("dashboards",e)},this.fetchTabixServer=function(e,t,a){_.isObject(t)||(t={});var n=d.tabix.server;n=n+"/"+e+"?tabix_client="+window.TabixVersion+"&random="+Math.round(1e8*Math.random()),a&&(n+="&"+a);var i={version:window.TabixVersion,auth:{login:d.tabix.login,password:d.tabix.password,confid:d.tabix.confid}};i=Object.assign(t,i);var r={mode:"cors",method:"post",headers:{"Content-type":"application/json; charset=UTF-8"},body:JSON.stringify(i)};console.info("TS Request",n,r);var s=new Request(n,r);return fetch(s).then(function(e){var t=e.headers.get("content-type");return t.includes("text/plain")&&200==e.status&&"ok"==e.statusText.toLowerCase()?"OK":t&&t.includes("application/json")&&e.status>=200&&e.status<300?Promise.resolve(e):e.text().then(Promise.reject.bind(Promise))}).then(function(e){return"OK"===e?"OK":e.json()},function(e){return Promise.reject(e)})},this.ts_fetchQuery=function(e,t,a,n){return s.fetchTabixServer("query",{query:s.makeSqlQuery(e,a)},n)},this.direct_fetchQuery=function(e,t,a,n){var i=s.makeSqlQuery(e,a),r=s.direct_makeUrlRequest(t,n),o={mode:"cors",method:"post",headers:{"Content-type":"application/x-www-form-urlencoded; charset=UTF-8"},body:i};d.includeCredentials&&(o.credentials="include");var l=new Request(r,o);return fetch(l).then(function(e){var t=e.headers.get("content-type");return t.includes("text/tab-separated-values")&&200==e.status&&"ok"==e.statusText.toLowerCase()?"OK":t.includes("text/plain")&&200==e.status&&"ok"==e.statusText.toLowerCase()?"OK":t&&t.includes("application/json")&&e.status>=200&&e.status<300?Promise.resolve(e):e.text().then(Promise.reject.bind(Promise))}).then(function(e){return"OK"===e?"OK":e.json()},function(e){return Promise.reject(e)})}}e.module(t.app.name).service("API",a),a.$inject=["$http","$q","localStorageService","$sanitize","ThemeService"]}(angular,smi2);var DatabaseStructure=function(){function e(){_classCallCheck(this,e),this._init=!1,this.uciq_fields=[],this.all_fields=[],this.all_db_fields=[],this.uciq_dbtables=[]}return _createClass(e,[{key:"init",value:function(e,t,a,n,i){var r=this;console.log("Try init DS...."),this._init||(this.columns=e,this.tables=t,this.databases=a,this.functions=i,this.dictionaries=n,this.columns.forEach(function(e){!angular.isUndefined(e.default_kind)&&angular.isUndefined(e.default_type)&&(e.default_type=e.default_kind),r.all_fields[e.database+"."+e.table]||(r.all_fields[e.database+"."+e.table]=[]),_.isArray(r.all_db_fields[e.database])||(r.all_db_fields[e.database]=[]),_.isArray(r.all_db_fields[e.database][e.table])||(r.all_db_fields[e.database][e.table]=[]),r.all_db_fields[e.database][e.table].push(e),r.all_fields[e.database+"."+e.table].push({name:e.name,type:e.type,active:!0}),r.uciq_fields[e.database]||(r.uciq_fields[e.database]=[]),_.isArray(r.uciq_fields[e.database])||(r.uciq_fields[e.database]=[]),_.isArray(r.uciq_fields[e.database])||(r.uciq_fields[e.database]=[]),r.uciq_fields[e.database].push(e),r.uciq_dbtables[e.database+"."+e.table]=1}),console.log("DS init ... done"),this._init=!0)}},{key:"isInit",value:function(){return this._init&&this.functions&&this.functions.length>1}},{key:"getTables",value:function(){return this.tables}},{key:"getDatabases",value:function(){return this.databases}},{key:"getFieldsByDatabase",value:function(e){return this.all_db_fields[e]}},{key:"getFunctions",value:function(){return this.functions}},{key:"getFields",value:function(){return this.all_fields}},{key:"getUniqueDatabaseTables",value:function(){return this.uciq_dbtables}},{key:"getAllFieldsInDatabase",value:function(e){return this.uciq_fields[e]}},{key:"getDictionaries",value:function(){return this.dictionaries}},{key:"getColumns",value:function(){return this.columns}}]),e}();/* * Copyright (C) 2017 IgorStrykhar in SMI2 * All rights reserved. */ @@ -41,7 +41,7 @@ var WidgetDraw=function(e){function t(e,a,n,i){_classCallCheck(this,t);var r=_po * Licensed under the Apache License, Version 2.0 Copyright 2017 Igor Strykhar,SMI2 LLC and other contributors */ var HandsTable=function(){function e(t,a,n){_classCallCheck(this,e),this.isDarkTheme=t,this.meta=a,this.Preset=n}return e.$inject=["isDark","metaData","Preset"],_createClass(e,[{key:"_handsRenderer",value:function(e,t,a,n,i,r,s){"numeric"==s.type?null==r||"-nan"==r||"inf"==r||"+nan"==r||"+inf"==r||"-inf"==r||"nan"==r?(null==r&&(arguments[5]="NULL"),t.style.color="black",t.style.background="red",Handsontable.renderers.TextRenderer.apply(this,arguments)):Handsontable.renderers.NumericRenderer.apply(this,arguments):"date"==s.type||"time"==s.type?(moment(new Date(r)).isValid()&&s.renderDateFormat&&(r=moment(r).format(s.renderDateFormat)),arguments[5]=r,Handsontable.renderers.TextRenderer.apply(this,arguments)):Handsontable.renderers.TextRenderer.apply(this,arguments),s.backgroundColor&&(t.style.backgroundColor=s.backgroundColor),s.color&&(t.style.color=s.color)}},{key:"countColumns",value:function(){return this.meta.length}},{key:"makeColumns",value:function(){var e=this,t=this.Preset.humanSortCols,a=[],n=[],i={},r=0;return this.meta.forEach(function(s){i[s.name]=r,r++,a.push(s.name);var o={};switch(o.type="text",o.width=100,o.typeOriginal=s.type,o.isDark=e.isDarkTheme,s.type.includes("Int64")?(o.type="text",o.width=100,_.isObject(e.meta.prepareInt64Cols)&&e.meta.prepareInt64Cols[s.name]&&(o.type="numeric")):s.type.includes("Int")&&(o.width=80,o.type="numeric"),s.type){case"Date":o.width=90,o.type="date",o.dateFormat="YYYY-MM-DD";break;case"DateTime":o.width=150,o.type="time",o.timeFormat="YYYY-MM-DD HH:mm:ss";break;case"Float32":o.width=80,o.type="numeric",o.format="0.[0000000]";break;case"Float64":o.width=80,o.type="numeric",o.format="0.[0000000]";break;case"String":o.width=180}o.renderer=e._handsRenderer,o.data=s.name,_.isArray(t)&&_.indexOf(t,s.name)>-1&&(o.sortFunction=function(e){var t=Handsontable.helper.objectEach,a={TiB:1099511627776,GiB:1073741824,MiB:1048576,KiB:1024,B:1},n=function(e,t,a){return _.isUndefined(e)?e:(isNaN(e)&&e.indexOf(" "+t)>-1&&(e=parseFloat(e.replace(t,""))*a),e)};return function(i,r){var s=i[1],o=r[1];return t(a,function(e,t){s=n(s,t,e),o=n(o,t,e)}),o>s?e?-1:1:s>o?e?1:-1:0}}),n.push(o)}),{colHeaders:a,columns:n,colPositions:i}}},{key:"fecthContextMenu",value:function(){return{items:{columnformat:{name:"Column format",submenu:{items:[{name:"Reset",key:"columnformat:1",callback:function(t,a,n){e.makeFormat(this,"Reset")}},{name:"Money",key:"columnformat:2",callback:function(t,a,n){e.makeFormat(this,"Money")},disabled:function(){return!e.isFormatColl(this,"numeric")}},{name:"Human",key:"columnformat:3",callback:function(t,a,n){e.makeFormat(this,"Human")},disabled:function(){return!e.isFormatColl(this,"numeric")}},{name:"Bytes",key:"columnformat:4",callback:function(t,a,n){e.makeFormat(this,"Bytes")},disabled:function(){return!e.isFormatColl(this,"numeric")}},{name:"Percentages",key:"columnformat:5",callback:function(t,a,n){e.makeFormat(this,"Percentages")},disabled:function(){return!e.isFormatColl(this,"numeric")}},{name:"Time only",key:"columnformat:6",callback:function(t,a,n){e.makeFormat(this,"Time")},disabled:function(){return!e.isFormatColl(this,"Time")}},{name:"Date only",key:"columnformat:7",callback:function(t,a,n){e.makeFormat(this,"Date")},disabled:function(){return!e.isFormatColl(this,"Date")}},{name:"Date loc.",key:"columnformat:8",callback:function(t,a,n){e.makeFormat(this,"DateLoc")},disabled:function(){return!e.isFormatColl(this,"Date")}},{name:"Float",key:"columnformat:9",callback:function(t,a,n){e.makeFormat(this,"Float")},disabled:function(){return!e.isFormatColl(this,"numeric")}},{name:"Heatmaps",key:"columnformat:10",callback:function(t,a,n){e.makeHeatmaps(this,"Heatmaps")},disabled:function(){return!e.isFormatColl(this,"numeric")}},{name:"Negative & Positive",key:"columnformat:11",callback:function(t,a,n){e.makeHeatmaps(this,"NegaPosi")},disabled:function(){return!e.isFormatColl(this,"numeric")}}]}},style:{name:"Style",submenu:{items:[{name:"Normal",callback:function(t,a,n){e.makeStyle(this,"Normal")},key:"style:normal"},{name:"Bold",callback:function(t,a){e.makeStyle(this,"Bold")},key:"style:makebold"},{name:"Red color",callback:function(t,a){e.makeStyle(this,"Red")},key:"style:red"},{name:"Green color",callback:function(t,a){e.makeStyle(this,"Green")},key:"style:green"},{name:"Yellow color",callback:function(t,a){e.makeStyle(this,"Yellow")},key:"style:yellow"},{name:"Orange color",callback:function(t,a){e.makeStyle(this,"Orange")},key:"style:orange"}]}},hsep1:"---------",copyTo:{name:"To Clipboard",submenu:{items:[{name:"Redmine Markdown",callback:function(t,a,n){console.info("copyToClipboard"),e.copyToClipboard(this,"Redmine")},key:"copyTo:1"},{name:"Redmine Markdown (full)",callback:function(t,a,n){console.info("copyToClipboard"),e.copyToClipboard(this,"Redmine",!0)},key:"copyTo:2"},{name:"WHERE col1 IN (val,val),col2 IN ...",callback:function(t,a,n){console.info("makeWhereIn"),e.makeWhereIn(this)},key:"copyTo:3"},{name:"Create TABLE...",callback:function(t,a,n){e.makeCreateTable(this)},key:"copyTo:4"}]}},hsep3:"---------",Transform:{name:"Transpose full table",callback:function(t,a,n){e.Transpose(this,"Transpose")}},Calculate:{name:"Calc Avg & Sum & Median",callback:function(t,a,n){e.Calc(this,"All")}},hsep4:"---------",undo:{},make_read_only:{},alignment:{},hsep5:"---------"}}}},{key:"makeSettings",value:function(){var e=this.makeColumns(),t={observeChanges:!1,observeDOMVisibility:!0,dropdownMenu:!0,manualColumnMove:!0,manualColumnResize:!0,rowHeaders:!0,colWidths:100,fillHandle:!1,stretchH:"all",customBorders:!0,isDark:this.isDarkTheme,filters:!0,columnSorting:!0,sortIndicator:!0,manualRowResize:!0,viewportColumnRenderingOffset:"auto",wordWrap:!1,autoColumnSize:{samplingRatio:23},columns:e.columns,colHeaders:e.colHeaders,contextMenu:this.fecthContextMenu(),currentRowClassName:this.isDarkTheme?"currentRowDark":"currentRowWhite",currentColClassName:"currentCol",renderAllRows:!1,visibleRows:1500};return this.Preset.sort&&(t.columnSorting={column:e.colPositions[this.Preset.sort]},t.columnSorting.sortOrder=this.Preset.sortOrder),t}}],[{key:"isDark",value:function(){return window.isDarkTheme}},{key:"makeHeatmaps",value:function(e,t){for(var a=e.getSelectedRange(),n=Math.min(a.from.col,a.to.col),i=Math.max(a.from.col,a.to.col),r="#a900e5",s="#3668ff",o=chroma.scale([r,s]),l=n;i>=l;l++){var c=e.countRows(),d=e.getDataAtCol(l),u=Math.min.apply(null,d),m=Math.max.apply(null,d);if(null!==u&&null!==m)for(var h=0;c>=h;h++){var p=parseFloat(e.getDataAtCell(h,l));if("Heatmaps"==t){var g=(p-u)/(m-u),b=o(g).hex(),f=e.getCellMeta(h,l);f&&e.setCellMeta(h,l,"backgroundColor",b)}if("NegaPosi"==t){var v=!1;0>p&&(v="#e27137"),p>0&&(v="#31b3e5");var y=e.getCellMeta(h,l);y&&v&&e.setCellMeta(h,l,"color",v)}}else console.warn("Can`t find Min&Max in column",l)}e.render()}},{key:"getSelected",value:function(e,t,a){var n=e.getSelectedRange(),i=!1;if(!n&&t||a)return{isSelection:!1,fromRow:0,toRow:e.countRows(),toCol:e.countCols(),fromCol:0};if(!n)return{isSelection:!1,fromRow:-1,toRow:-1,toCol:-1,fromCol:-1};var r=Math.min(n.from.col,n.to.col),s=Math.max(n.from.col,n.to.col),o=Math.min(n.from.row,n.to.row),l=Math.max(n.from.row,n.to.row);return{isSelection:i,fromRow:o,toRow:l,toCol:s,fromCol:r}}},{key:"makeFormat",value:function(t,a){for(var n=e.getSelected(t,!0),i=t.getSettings().columns,r=n.fromCol;r<=n.toCol;r++)switch(console.log("makeFormat for coll ="+r,a),a){case"Reset":i[r].format=!1,i[r].renderDateFormat=!1;break;case"Money":i[r].format="$0,0.00";break;case"Human":i[r].format="5a";break;case"Bytes":i[r].format="0.0b";break;case"Percentages":i[r].format="(0.00 %)";break;case"Time":i[r].renderDateFormat="HH:mm:ss";break;case"Date":i[r].renderDateFormat="YYYY-MM-DD";break;case"DateTime":i[r].renderDateFormat="YYYY-MM-DD HH:mm:ss";break;case"DateLoc":i[r].renderDateFormat="LLLL";break;case"Float":i[r].format="0.[0000000]"}t.updateSettings({columns:i}),t.render()}},{key:"isFormatColl",value:function(e,t){t=t.toLowerCase();for(var a=e.getSelectedRange(),n=Math.min(a.from.col,a.to.col),i=Math.max(a.from.col,a.to.col),r=e.getSettings().columns,s=n;i>=s;s++)if(!r[s].type.toLowerCase().includes(t))return!1;return!0}},{key:"pushToClipboardText",value:function(e){var t=document.createElement("textarea");t.style.width=0,t.style.height=0,t.style.border=0,t.style.position="absolute",t.style.top=0,document.body.append(t),t.value=e,t.focus(),t.select();try{document.execCommand("copy")}catch(a){console.log("Oops, unable to copy")}document.body.removeChild(t)}},{key:"makeCreateTable",value:function(t){for(var a=e.getSelected(t,!0),n="\nCREATE TABLE x (\n",i=[],r=t.getSettings().columns,s=a.fromCol;s<=a.toCol;s++){var o=r[s].typeOriginal;i.push(" "+t.colToProp(s)+" "+o)}n=n+i.join(",\n")+"\n)\nENGINE = TinyLog\n;;\n",console.log(n),e.pushToClipboardText(n)}},{key:"Calc",value:function(t,a){for(var n=e.getSelected(t,!0),i=t.getSettings().columns,r=[],s=n.fromCol;s<=n.toCol;s++)for(var o=n.fromRow;o<=n.toRow;o++){var l=i[s].type.toLowerCase();l.includes("numeric")&&r.push(t.getDataAtCell(o,s))}if(_.isArray(r)&&r.length){var c={median:_.round(_.median(r),3),sum:_.round(_.sum(r),3),average:_.round(_.average(r),3),std:_.round(_.stdDeviation(r),3)};angular.element(document).scope().$emit("handleBroadcastCalcSumCells",c)}}},{key:"Transpose",value:function(t,a){var n=e.transpose(t.getSourceData()),i=[],r=[],s=!0,o=!1,l=void 0;try{for(var c,d=n.columns[Symbol.iterator]();!(s=(c=d.next()).done);s=!0){var u=c.value,m={};m.renderer=this._handsRenderer,m.data=u,m.type="text",m.width=100,r.push(m),i.push(u)}}catch(h){o=!0,l=h}finally{try{!s&&d["return"]&&d["return"]()}finally{if(o)throw l}}t.updateSettings({columns:r,colHeaders:i,data:n.data})}},{key:"transpose",value:function(e){var t=[],a=1,n=[];t.push(0);var i=!0,r=!1,s=void 0;try{for(var o,l=e[Symbol.iterator]();!(i=(o=l.next()).done);i=!0){var c=o.value,d=0,u=!0,m=!1,h=void 0;try{for(var p,g=Object.entries(c)[Symbol.iterator]();!(u=(p=g.next()).done);u=!0){var b=_slicedToArray(p.value,2),f=b[0],v=b[1];n[d]||(n[d]={}),1==a&&(n[d][0]=f),n[d][a]=v,d++}}catch(y){m=!0,h=y}finally{try{!u&&g["return"]&&g["return"]()}finally{if(m)throw h}}t.push(a),a++}}catch(y){r=!0,s=y}finally{try{!i&&l["return"]&&l["return"]()}finally{if(r)throw s}}return{data:n,columns:t}}},{key:"makeWhereIn",value:function(t){for(var a=e.getSelected(t,!0),n=[],i=t.getSettings().columns,r=a.fromCol;r<=a.toCol;r++){for(var s=[],o=a.fromRow;o<=a.toRow;o++)s.push(t.getDataAtCell(o,r));var l=s.filter(function(e,t,a){return a.indexOf(e)===t}),c=i[r].type.toLowerCase();c.includes("numeric")?n.push(t.colToProp(r)+" IN ( "+l.join(" , ")+") "):n.push(t.colToProp(r)+" IN ( '"+l.join("' , '")+"') ")}n="\n"+n.join("\n AND\n")+"\n\n",console.log(n),e.pushToClipboardText(n)}},{key:"copyToClipboard",value:function(t,a,n){for(var i=e.getSelected(t,!0,n),r="",s=[],o=i.fromCol;o<=i.toCol;o++)s.push(t.colToProp(o));r=r+" | "+s.join(" | ")+" |\n",s=[];for(var l=i.fromRow;l<=i.toRow;l++){for(var c=i.fromCol;c<=i.toCol;c++)s.push(t.getDataAtCell(l,c));r=r+" | "+s.join(" | ")+" |\n",s=[]}e.pushToClipboardText(r)}},{key:"HideColumn",value:function(t){for(var a=e.getSelected(t,!0),n=t.getSettings().columns,i=a.fromCol;i<=a.toCol;i++)n[i].width=0;t.updateSettings({columns:n})}},{key:"ShowAllColumns",value:function(e){var t=e.getSettings().columns;console.info("SHOWALL",t);var a=!0,n=!1,i=void 0;try{for(var r,s=t[Symbol.iterator]();!(a=(r=s.next()).done);a=!0){var o=r.value;console.info("COL",t[o])}}catch(l){n=!0,i=l}finally{try{!a&&s["return"]&&s["return"]()}finally{if(n)throw i}}e.updateSettings({columns:t})}},{key:"makeStyle",value:function(t,a){console.log("makeStyle",a);for(var n=e.getSelected(t,!0),i=n.fromRow;i<=n.toRow;i++)for(var r=n.fromCol;r<=n.toCol;r++){var s=t.getCellMeta(i,r),o="htCell"+a;(!s.className||s.className&&s.className.indexOf(o)<0)&&t.setCellMeta(i,r,"className",o)}t.render()}}]),e}();angular.module(smi2.app.name).service("HandsTable",HandsTable);var DrawBasicChart=function(){function DrawBasicChart(e){_classCallCheck(this,DrawBasicChart),this.widget=e,this.chart=!1,this.init=!1,this.options={},this.widget.height=1,this.widget.width=1,this.errorMessage="",this.drawCodeObject={type:!1};try{this.drawCodeObject=this.initDrawCodeObject()}catch(t){console.error("error eval ",t)}console.info("isExecutableCode()",this.isExecutableCode())}return _createClass(DrawBasicChart,[{key:"setWidgetSize",value:function(e,t){console.log("setWidgetSize",e,t,this.widget.sizeX,this.widget.sizeY),this.widget.sizeX=e,this.widget.sizeY=t}},{key:"setError",value:function(e){this.errorMessage=e;var t="",a="";_.isUndefined(this.help)||(t=this.help),_.isUndefined(this.helpLink)||(a=this.helpLink),this.widget.error="Draw error message:"+e+"\n\n"+t+"\n\n"+(a?''+a+"":"")}},{key:"isDark",value:function(){return this.widget.isDark}},{key:"getError",value:function(){return this.errorMessage}},{key:"isExecutableCode",value:function(){return this.drawCodeObject&&this.drawCodeObject.type?this.drawCodeObject.exec:!1}},{key:"executableCode",value:function(){var e={};return this.isExecutableCode()&&(console.log(this.drawCodeObject.code),e=this.drawCodeObject.code.call(window,this.widget.data)),console.warn("executableCode:ResultFunction",e),e}},{key:"initChartByJsCode",value:function(){if(this.isExecutableCode()){var e=this.executableCode();return this.options=Object.assign(this.options,e),!0}return!1}},{key:"data",value:function(){return this.widget.data.data}},{key:"meta",value:function(){return this.widget.data.meta}},{key:"isNumericColumn",value:function(e){var t=this.getColumnPosition(e);if(!_.isUndefined(t)){var a=this.meta()[t].type;return a?(a=a.toLowerCase(),a.includes("int")||a.includes("float")?!0:!1):!1}}},{key:"isStringColumn",value:function(e){var t=this.getColumnPosition(e);if(!_.isUndefined(t)){var a=this.meta()[t].type;return a?(a=a.toLowerCase(),a.includes("string")||a.includes("enum")?!0:!1):!1}}},{key:"getColumnPosition",value:function(e){return parseInt(_.findKey(this.meta(),{name:e}))}},{key:"haveColumn",value:function(e){if(_.isNaN(e)||_.isNull(e)||_.isUndefined(e))return!1;var t=this.getColumnPosition(e);return _.isNaN(t)||_.isNull(t)||_.isUndefined(t)?!1:!0}},{key:"getColumnByType",value:function(e){var t=_.findIndex(this.meta(),{type:e});return 0>t?!1:this.getColumns(t)}},{key:"getDateTimeColumn",value:function(){return this.getColumnByType("DateTime")}},{key:"getDateColumn",value:function(){return this.getColumnByType("Date")}},{key:"findDateTimeAxis",value:function(){var e=this.getDateTimeColumn();if(e)return e;var t=this.getDateColumn();return t?t:!1}},{key:"getColumns",value:function(e){var t=_.map(this.meta(),"name");return _.isUndefined(e)?t:t[e]}},{key:"getFirstColumn",value:function(){return this.getColumns(0)}},{key:"getDrawCommandObject",value:function(){return this.drawCodeObject&&this.drawCodeObject.type?this.drawCodeObject.code:!1}},{key:"updateCode",value:function updateCode(codejs,showErrors){var drawCommand=this.widget.drawCommnads;if(drawCommand&&drawCommand.code)try{var data={},code="("+codejs+")",obj=eval(code);_.isObject(obj)&&(console.info("Apply code",codejs),drawCommand.code=codejs,this.applyCode())}catch(E){showErrors&&console.error("error eval ",codejs,E)}}},{key:"getCode",value:function(){var e=!1,t=this.widget.drawCommnads;return t&&t.code&&(e=t.code),e.length<9?!1:e}},{key:"initDrawCodeObject",value:function initDrawCodeObject(){var drawCommand=this.widget.drawCommnads;if(!drawCommand)return[];var codeDrawText=!1;if(drawCommand&&drawCommand.code&&(codeDrawText=drawCommand.code),!codeDrawText)return[];var draw={code:!1,type:!1};if(_.isObject(codeDrawText))return draw={isok:!0,code:codeDrawText,type:"undefined"==typeof codeDrawText?"undefined":_typeof(codeDrawText),exec:!1};if("text"==drawCommand.drawtype.toLowerCase()){var obj=codeDrawText.trim();return draw={isok:!0,code:obj,type:"undefined"==typeof obj?"undefined":_typeof(obj),exec:!1}}try{var code="("+codeDrawText+")",_obj=eval(code),type="undefined"==typeof _obj?"undefined":_typeof(_obj);draw={isok:!0,code:_obj,type:type,exec:!!(_obj&&_obj.constructor&&_obj.call&&_obj.apply)}}catch(E){console.error("error eval ",codeDrawText,E)}return draw}}]),DrawBasicChart}(),DrawText=function(e){function t(e,a){_classCallCheck(this,t);var n=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.type=a.toUpperCase(),n.library="text",n.widget.sizeX=0,n.widget.sizeY=0,n}return _inherits(t,e),_createClass(t,[{key:"preProcessor",value:function(){var e=this.getDrawCommandObject();this.init=this.applyText(e)}},{key:"applyText",value:function(e){return this.isDark()&&(this.widget.element[0].style.background="#404a59"),e?this.widget.element[0].innerHTML=Mustache.render(e,this.widget.data):this.widget.element[0].innerHTML="
"+JSON.stringify(this.widget.data,null,"	")+"
",!0}},{key:"onResize",value:function(){}}]),t}(DrawBasicChart),DrawPlotly=function(_DrawBasicChart2){function DrawPlotly(e,t){_classCallCheck(this,DrawPlotly);var a=_possibleConstructorReturn(this,(DrawPlotly.__proto__||Object.getPrototypeOf(DrawPlotly)).call(this,e));return a.type=t.toUpperCase(),a.library="plotly",a.chart=null,a.setWidgetSize(6,3),a._datajs=!1,a}return _inherits(DrawPlotly,_DrawBasicChart2),_createClass(DrawPlotly,[{key:"onResize",value:function(){if(this.plotly){var e=this.widget.getSizeElementHeight(),t=this.widget.getSizeElementWidth();(this.layout.height!=e||this.layout.width!=t)&&(this.layout.height=e,this.layout.width=t,this.relayout())}}},{key:"preProcessor",value:function(){return this.init=this.create(),this.getError()?(console.error(this.getError()),this.chart.before("

"+this.getError()+"

"),this.init=!1,!1):void console.info("preProcessor",this.init)}},{key:"initDrawCodeObject",value:function(){return!1}},{key:"getElement",value:function(){return this.widget.element[0]}},{key:"relayout",value:function(){Plotly.relayout(this.getElement(),this.layout)}},{key:"editor",value:function(){console.info("editoreditoreditor")}},{key:"getDataForCodeJS",value:function(){if(this._datajs)return this._datajs;for(var e={},t=this.getColumns(),a=this.data().length,n=0;a>n;++n){var i=this.data()[n];for(var r in t){var s=t[r];e[s]||(e[s]=[]),e[s].push(i[s])}}return this._datajs=e,e}},{key:"applyCode",value:function applyCode(){try{var codeJS=this.getCode();console.info("applyCode",codeJS);var data=this.getDataForCodeJS();console.log("getDataForCodeJS",data),console.log("this.data()",this.data()),codeJS="("+codeJS+")";var obj=eval(codeJS);_.isObject(obj)&&this.applyObject(obj)}catch(E){console.log(E)}}},{key:"applyLayout",value:function(e){console.info("<<<<<<< applyLayout >>>>>>>>>>",e),this.layout=e;var t=this.widget.getSizeElementHeight(),a=this.widget.getSizeElementWidth();this.layout.height=t,this.layout.width=a}},{key:"applyObject",value:function(e){var t={data:[],layout:{}};_.isObject(e)&&(_.isObject(e.data)&&(t.data=e.data),_.isObject(e.trace)&&t.data.push(e.trace),_.isObject(e.trace1)&&t.data.push(e.trace1),_.isObject(e.trace2)&&t.data.push(e.trace2),_.isObject(e.trace3)&&t.data.push(e.trace3),_.isObject(e.trace4)&&t.data.push(e.trace4),_.isObject(e.layout)&&(t.layout=e.layout)),console.info(t),console.log("llll:",t);var a={editable:!1};t=Object.assign(t,this.getDarkThemeSettings()),this.applyLayout(t.layout),console.warn("this.layout",this.layout),this.plotly?(console.info("UPDATE!"),this.plotly=Plotly.newPlot(this.getElement(),t.data,this.layout,a)):this.plotly=Plotly.newPlot(this.getElement(),t.data,this.layout,a)}},{key:"makeAutoDraw",value:function(){var e=this;console.info("<<<<<<< makeAutoDraw >>>>>>>>>>");var t={autoAxis:!1,markLine:!0,stack:!1,path:!1,sort:!0,xAxis:!1,yAxis:!1},a={},n=this.getColumns(),i=this.getFirstColumn(),r=i,s=this.findDateTimeAxis(),o=this.data();s&&(i=s),t.sort&&(o=_.sortBy(o,i)),r=i;var l=0,c=[],d=[];for(var u in n){var m=n[u],h=!1;_.size(a)&&(h=_.isUndefined(a[m])),m==r||h||(this.isStringColumn(m)&&2>l&&!groupPath?(_.isArray(c)||(c=[]),c.push(m),l++):this.isNumericColumn(m)&&d.push(m))}var p=o.length,g=0,b=[],f={};for(console.log("DATA LEN",p,o),g=0;p>g;++g){var v=o[g];b.push(v[r])}for(b=_.uniq(b),g=0;p>g;++g){var y=o[g],w=function(t){var i=n[t],s=[r],o=!1;if(_.size(a)&&(o=_.isUndefined(a[i])),i!==r&&!o&&e.isNumericColumn(i)&&_.findIndex(c,i)<0){if(c)for(var l=0;l"+this.getError()+"

"),!1;var e=this.getDrawCommandObject();e.raw&&(this.options=_.merge(this.options,e.raw)),this.isDark(),console.info("preProcessor",this.init,this.options)}},{key:"loadGoogleMapJS",value:function(e){if(window._sendGoogleMapLoad)return void this.afterLoadMapProcessor();window._sendGoogleMapLoad=!0,window._isGoogleMapLoaded=!1,console.info("YA_MAP>Start load map : api-maps.yandex.ru");var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCRQH39oyrPnfPPgADuOp0eSRsDHRUMyyY",t.charset="utf-8",t.onload=t.onreadystatechange=function(){t.readyState&&"complete"!==t.readyState&&"loaded"!==t.readyState||(t.onload=t.onreadystatechange=null,e.afterLoadMapProcessor(),window._isGoogleMapLoaded=!0)};var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(t,a)}},{key:"getDarkStyle",value:function(){return[{featureType:"all",elementType:"labels.text.fill",stylers:[{color:"#ffffff"}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{color:"#000000"},{lightness:13}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#144b53"},{lightness:14},{weight:1.4}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#08304b"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#0c4152"},{lightness:5}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#0b434f"},{lightness:25}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.arterial",elementType:"geometry.stroke",stylers:[{color:"#0b3d51"},{lightness:16}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#000000"}]},{featureType:"transit",elementType:"all",stylers:[{color:"#146474"}]},{featureType:"water",elementType:"all",stylers:[{color:"#021019"}]}]}},{key:"getLightStyle",value:function(){return[{featureType:"landscape",stylers:[{hue:"#FFBB00"},{saturation:43.400000000000006},{lightness:37.599999999999994},{gamma:1}]},{featureType:"road.highway",stylers:[{hue:"#FFC200"},{saturation:-61.8},{lightness:45.599999999999994},{gamma:1}]},{featureType:"road.arterial",stylers:[{hue:"#FF0300"},{saturation:-100},{lightness:51.19999999999999},{gamma:1}]},{featureType:"road.local",stylers:[{hue:"#FF0300"},{saturation:-100},{lightness:52},{gamma:1}]},{featureType:"water",stylers:[{hue:"#0078FF"},{saturation:-13.200000000000003},{lightness:2.4000000000000057},{gamma:1}]},{featureType:"poi",stylers:[{hue:"#00FF6A"},{saturation:-1.0989010989011234},{lightness:11.200000000000017},{gamma:1}]}]}},{key:"create",value:function(){console.warn("CREATE"),this._map=new google.maps.Map(this.widget.element[0],this.mapOptions);var e=this.getLightStyle();this.isDark()&&(e=this.getDarkStyle()),this._map.setOptions({styles:e});var t=this,a=this.getDrawCommandObject(),n={longitude:"longitude",latitude:"latitude",count:"count",title:"title"},i=new google.maps.LatLngBounds,r=0;a&&(n=Object.assign(n,a)),this.data().forEach(function(e,a){var s=parseInt(e[n.count]);s>r&&(r=s);var o={lat:e[n.latitude],lng:e[n.longitude]},l=!1;e[n.title]&&(l=new google.maps.InfoWindow({content:'
'+e[n.title]+"
"})),i.extend(o);var c=new google.maps.Marker({position:o,map:t._map,title:"Value:"+s});l&&c.addListener("click",function(){l.open(this._map,c)})}),this._map.fitBounds(i),this._map.panToBounds(i)}}]),t}(DrawBasicChart),DrawEcharts=function(e){function t(e,a){_classCallCheck(this,t);var n=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.help="",n.type=a.toUpperCase(),n.library="echarts",n.preference={gridchart:!1,bar:!1},n.options={version:3,textStyle:{fontFamily:"Menlo"},toolbox:{show:!0,feature:{dataZoom:{yAxisIndex:"none",title:"data Zoom"},dataView:{readOnly:!1,title:"data View"},magicType:{type:["line","bar","stack","tiled"],title:{line:"line",bar:"bar",stack:"stack",tiled:"tiled"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image"}}}},n}return _inherits(t,e),_createClass(t,[{key:"onResize",value:function(){console.log("onResize Chart"),this.chart&&this.init&&this.chart.resize()}},{key:"preProcessor",value:function(){if(this.initChartByJsCode())this.init=!0;else try{this.init=this.create()}catch(e){this.setError(this.getError()+"\n\n\n"+e.name+":"+e.message+"\n"+e.stack)}if(this.getError())return console.error(this.getError()),!1;var t=this.getDrawCommandObject();if(t.raw&&(this.options=_.merge(this.options,t.raw)),this.isDark()&&(this.options.backgroundColor="#404a59",this.options.textStyle={color:"rgba(255, 255, 255, 0.3)"},this.options.lineStyle={color:"rgba(255, 255, 255, 0.3)"}),_.isArray(this.options.series)&&_.isObject(this.options.series[0])){if(_.isObject(t))if(_.isArray(t.series))for(var a=0;a<=t.series.length;a++)_.isObject(this.options.series[a])&&(this.options.series[a]=_.merge(this.options.series[a],t.series[a]));else this.options.series[0]=_.merge(this.options.series[0],t);this.isDark()&&_.set(this.options.series[0],"label.normal.textStyle.color","white")}this.chart.setOption(this.options),console.info("preProcessor",this.init,this.options)}},{key:"getParameterPath",value:function(){var e=this.getDrawCommandObject(),t={path:""};e&&(t=Object.assign(t,e));var a="";if(_.isString(e)?a=e:t.path&&(a=t.path),!a)return!1;for(var n=_.split(a,"."),i=0;is;s+=1){var o=this.getColumns(s);if(!i&&this.isNumericColumn(o)){i=o;break}}t.date=n,t.value=i}if(!this.haveColumn(t.date)||!this.haveColumn(t.value))return this.setError("Not set date | value cols"),!1;var l=0,c=Number.MAX_VALUE,d=_.map(this.data(),function(e){var a=parseFloat(e[t.value]);return a&&a>l&&(l=a),a&&c>a&&(c=a),[e[t.date],a]});d=_.groupBy(d,function(e){var t=(""+e[0]).substring(0,4);return t});var u={tooltip:{position:"top"},calendar:[],series:[],visualMap:{min:c,max:l,calculable:!0,orient:"horizontal",left:"center",top:"top"}},m=60,h=0;return _.forEach(d,function(e,t){u.calendar.push({top:m,range:t,right:0,cellSize:["auto",20]}),u.series.push({type:"heatmap",coordinateSystem:"calendar",data:e,calendarIndex:h}),h+=1,m+=200}),this.options=Object.assign(u,this.options),!0}}]),t}(DrawEcharts),DrawEchartsTreemap=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"getSerieSettings",value:function(e){var t=echarts.format;return{tooltip:{formatter:function(a){var n=a.value,i=[],r=a.treePathInfo;if(_.isArray(r))for(var s=1;s'+t.encodeHTML(i.join("."))+"",e.tooltip+" : "+numbro(n).format(o)].join("")}},itemStyle:{normal:{borderColor:"#fff"}},type:"treemap"}}},{key:"getLevelOption",value:function(){return[{itemStyle:{normal:{borderWidth:0,gapWidth:5}}},{itemStyle:{normal:{gapWidth:1}}},{colorSaturation:[.35,.5],itemStyle:{normal:{gapWidth:1,borderColorSaturation:.6}}}]}},{key:"buildTreeData",value:function(e,t){var a=[],n=this;return _.forEach(e,function(e,i){var r=t[i],s={};if(s.value=r.__value,_.isObject(e)){var o=n.buildTreeData(e,r);_.isArray(o)&&o.length&&(s.children=o)}s.name=i,a.push(s)}),a}},{key:"create",value:function(){var e=this.getDrawCommandObject(),t={path:"",title:"TreeMap",tooltip:"Usage",valueformat:!1};e&&(t=Object.assign(t,e));var a="";t.path&&(a=t.path),_.isString(e)&&(a=e);var n=_.split(a,"."),i=n.length;if(!i)return this.setError("Not set path"),!1;for(var r=0;i>r;r+=1)if(!this.haveColumn(n[r]))return this.setError("bad path, no column:"+n[r]),!1;if(!this.isNumericColumn(n[i-1]))return this.setError("bad column:"+n[i-1]+" must be number"),!1;var s={},o={};this.data().forEach(function(e){for(var t=e[n[i-1]],a=[],r=0;i-1>r;r+=1){a.push(e[n[r]]);var l=_.get(s,a.join("_"),0);_.set(s,a.join(".")+".__value",parseFloat(l)+parseFloat(t))}_.set(o,a.join("."),t)});var l=this.buildTreeData(o,s),c={tooltip:{trigger:"item"}};return c.series=[{name:t.title,label:{show:!0,formatter:"{b}"},levels:this.getLevelOption(),data:l}],this.options=Object.assign(c,this.options),this.options.series[0]=Object.assign(this.getSerieSettings(t),this.options.series[0]),!0}}]),t}(DrawEcharts),DrawEchartsSunkeys=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments)); -}return _inherits(t,e),_createClass(t,[{key:"create",value:function(){this.helpLink="https://tabix.io/doc/draw/Draw_Sankeys/",this.help="Default config : {path:''} or {value:'',source:'',target:''}, if empty path or not set, try auto create path, then find columns [String] : [Integer|Float] : [String] ";var e=this.getDrawCommandObject(),t={path:"",value:"value",source:"source",target:"target"};e&&(t=Object.assign(t,e));var a="";_.isString(e)?a=e:t.path?a=t.path:this.haveColumn(t.source)&&this.haveColumn(t.value)&&this.haveColumn(t.target)&&(a=t.source+"."+t.value+"."+t.target);var n=[];if(a)n=_.split(a,".");else{var i=!1,r=this.getColumns();for(var s in r){var o=r[s];this.isNumericColumn(o)&&i&&(n.push(o),i=!1),this.isStringColumn(o)&&!i&&(n.push(o),i=!0)}}if(console.log("patharr>",n),!n.length)return this.setError("The value of the variable 'path' - empty"),!1;if(!(1&n.length))return this.setError("The value of the variable 'path' must be odd"),!1;var l=[],c=[];this.data().forEach(function(e){for(var t=0;ta&&(a=s),e[t.destination.longitude]&&e[t.destination.latitude]){var o="";e[t.destination.name]&&(o=e[t.destination.name]),i.push({fromName:e[t.name],toName:o,coords:[[e[t.longitude],e[t.latitude]],[e[t.destination.longitude],e[t.destination.latitude]]]})}n.push({name:e[t.name],value:[e[t.longitude],e[t.latitude],s],label:{emphasis:{position:"right",show:!0}}})});var r=[{name:t.title,type:"effectScatter",coordinateSystem:"geo",data:n,showEffectOn:"render",rippleEffect:{brushType:"stroke"},symbolSize:function(e){return a?e[2]/a*15:e[2]/1e4},hoverAnimation:!0,label:{normal:{formatter:"{b}",position:"right",show:!0}},itemStyle:{normal:{color:"#f4e925",shadowBlur:10,shadowColor:"#333"}},zlevel:1}];if(i.length>0){var s="path://M1705.06,1318.313v-89.254l-319.9-221.799l0.073-208.063c0.521-84.662-26.629-121.796-63.961-121.491c-37.332-0.305-64.482,36.829-63.961,121.491l0.073,208.063l-319.9,221.799v89.254l330.343-157.288l12.238,241.308l-134.449,92.931l0.531,42.034l175.125-42.917l175.125,42.917l0.531-42.034l-134.449-92.931l12.238-241.308L1705.06,1318.313z";r.push({name:t.title,type:"lines",zlevel:1,effect:{show:!0,period:6,trailLength:.7,color:"#fff",symbolSize:3},lineStyle:{normal:{width:0,curveness:.2}},data:i}),r.push({name:t.title,type:"lines",zlevel:2,symbol:["none","arrow"],symbolSize:10,effect:{show:!0,period:6,trailLength:0,symbol:s,symbolSize:15},lineStyle:{normal:{width:1,opacity:.6,curveness:.2}},data:i})}var o={tooltip:{trigger:"item"},geo:{name:t.title,type:"map",map:"world",label:{emphasis:{show:!1}},visualMap:{show:!0,min:0,max:100,inRange:{symbolSize:[6,60]}},roam:!0,itemStyle:{normal:{areaColor:"#323c48",borderColor:"#404a59"},emphasis:{areaColor:"#2a333d"}}},series:r};return this.options=Object.assign(this.options,o),!0}}]),t}(DrawEcharts),DrawEchartsHeatmap=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"create",value:function(){var e=this.getParameterPath();if(!e)return this.setError("Not set path"),!1;var t={},a={},n={};this.data().forEach(function(i){_.set(t,i[e[0]],1),_.set(a,i[e[1]],1),_.set(n,i[e[0]]+"."+i[e[1]],parseFloat(i[e[2]]))});var i=[],r=_.keys(t),s=_.keys(a),o=0,l=0;_.mapKeys(t,function(e,t){_.mapKeys(a,function(e,a){var r=_.get(n,t+"."+a,"-");o>r&&(o=r),r>l&&(l=r),i.push([t,a,r])})});var c={tooltip:{position:"top"},animation:!1,grid:{height:"50%",y:"10%"},xAxis:{type:"category",data:r,splitArea:{show:!0}},yAxis:{type:"category",data:s,splitArea:{show:!0}},visualMap:{min:o,max:l,calculable:!0,orient:"horizontal",left:"center",bottom:"15%"},series:[{name:"Punch Card",type:"heatmap",data:i,label:{normal:{show:!0}},itemStyle:{emphasis:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};return this.options=Object.assign(c,this.options),!0}}]),t}(DrawEcharts),DrawEchartsGraph=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"create",value:function(){this.helpLink="https://tabix.io/doc/draw/Draw_Graph/",this.help="Default config : {path:''} or {value:'',source:'',target:''}, if empty path or not set, try auto create path, then find columns [String] : [Integer|Float] : [String] ";var e=this.getDrawCommandObject(),t={path:"",categories:"categories",name:"name",value:"value",target:"target",targetValue:"",sourceValue:"",layout:"",edgeSymbol:""};e&&(t=Object.assign(t,e));var a="";_.isString(e)?a=e:t.path?a=t.path:this.haveColumn(t.source)&&this.haveColumn(t.value)&&this.haveColumn(t.target)&&(a=t.source+"."+t.value+"."+t.target);var n=[],i=this.haveColumn(t.targetValue),r=this.haveColumn(t.sourceValue);this.haveColumn(t.categories);if(a)n=_.split(a,".");else{var s=!1,o=this.getColumns();for(var l in o){var c=o[l];this.isNumericColumn(c)&&s&&(n.push(c),s=!1),this.isStringColumn(c)&&!s&&(n.push(c),s=!0)}}if(console.log("patharr>",n),!n.length)return this.setError("The value of the variable 'path' - empty"),!1;if(!(1&n.length))return this.setError("The value of the variable 'path' must be odd"),!1;var d=[],u=[];this.data().forEach(function(e){for(var a=0;a10}}}}else u[e[s]]={symbolSize:1};if(i){var m=e[t.targetValue]/1.5;u[e[l]]={symbolSize:m,label:{normal:{show:m>10}}}}else u[e[l]]={symbolSize:1};d.push({source:e[s],target:e[l],value:e[o]})}});var m=[];for(var h in u)m.push(_.merge({name:h},u[h]));console.log("result_nodes",m);var p={tooltip:{trigger:"item",triggerOn:"mousemove"},series:[{type:"graph",layout:"circular",data:m,circular:{rotateLabel:!0},animationThreshold:300,animationDuration:300,links:d,itemStyle:{normal:{borderWidth:1,borderColor:"#aaa"}},roam:!0,label:{normal:{position:"right",formatter:"{b}"}},lineStyle:{normal:{color:"source",curveness:.3}}}]};return p=Object.assign(p,this.options),this.options=p,!0}}]),t}(DrawEcharts),DrawEchartsFlatTree=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"getSerieSettings",value:function(){return{symbolSize:7,type:"tree",label:{normal:{position:"left",verticalAlign:"middle",align:"right"}},leaves:{label:{color:this.isDark()?"white":"auto",normal:{position:"right",verticalAlign:"middle",align:"left"}}},expandAndCollapse:!0}}}]),t}(DrawEchartsTreemap),DrawEchartsChart=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"create",value:function(){console.log("DrawEchartsChart");var e=this.getDrawCommandObject(),t=this.preCreate(e),a=this.createChart(e),n={tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0}};return e.title&&this.applyTitle(e.title),this.applyDataZoom(),this.applyLegend(),this.options=Object.assign(a,this.options,n,t),this.postCreate(e),!0}},{key:"postCreate",value:function(e){return{}}},{key:"preCreate",value:function(e){return{}}},{key:"createChart",value:function(e){var t=this,a={autoAxis:!1,markLine:!0,stack:!1,path:!1,sort:!0,xAxis:!1,yAxis:!1};e&&(a=Object.assign(a,e));var n={},i=this.getColumns(),r=this.getFirstColumn(),s=r,o=this.findDateTimeAxis(),l={},c=[],d=[],u=[],m={},h=this.data();if(o&&(r=o),a.xAxis){if(!this.haveColumn(a.xAxis))throw"xAxis column not exists";s=a.xAxis}else a.sort&&(h=_.sortBy(h,r)),s=r;if(d=[{name:s,type:"category",data:[]}],a.yAxis)if(_.isString(a.yAxis)){if(!this.haveColumn(a.yAxis))throw"yAxis column not exists";n[a.yAxis]=1}else{if(!_.isArray(a.yAxis))throw"yAxis column must string or array";var p=void 0;for(p=0;pk&&!w?(_.isArray(y)||(y=[]),y.push(S),k++):this.isNumericColumn(S)&&x.push(S))}var A=h.length;for(console.log("DATA LEN",A,h),v=0;A>v;++v){var D=h[v];d[0].data.push(D[d[0].name])}for(d[0].data=_.uniq(d[0].data),console.log("xAxis[0].data.",d[0].data),v=0;A>v;++v){var E=h[v],R=function(e){var a=i[e],r=[s],o=!1;if(_.size(n)&&(o=_.isUndefined(n[a])),a!==s&&!o&&t.isNumericColumn(a)&&_.findIndex(y,a)<0){if(y)for(var l=0;l1){var P=_.groupBy(b,function(e){return Math.floor(e.median/1e3)});if(_.size(P)>1){var q=function(e){var t=P[e],n=_.map(t,"column").join(",");_.forEach(t,function(e){u[e.index].yAxisIndex=c.length,a.stack&&(u[e.index].stack=n,u[e.index].areaStyle={normal:{}})}),c.push({name:n,type:"value"})};for(var N in P)q(N)}}return c.length||(c=[{name:f,type:"value"}]),l.series=u,l.yAxis=c,l.xAxis=d,console.info("Make Chart Done : Options",l),l}}]),t}(DrawEcharts),DrawEchartsGridChart=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"preCreate",value:function(e){return this.preference.gridchart=!0,{}}},{key:"postCreate",value:function(e){var t=[],a=[],n=[],i=[],r=0;console.info("postCreate!!!!!!",this.options);var s=[],o=this.options.xAxis[0],l=this.options.yAxis[0];for(var c in this.options.series){c=parseInt(c);var d=this.options.series[c].name;this.options.series[c].xAxisIndex=c,this.options.series[c].yAxisIndex=r,console.log(d,this.options.series[c]),o.show=!1,o.gridIndex=c,l.gridIndex=c,l.show=!1,l.name=d,t.push({show:!0,borderWidth:0,shadowBlur:2}),n.push(_.clone(o)),a.push(_.clone(l)),i.push({textAlign:"center",text:d,textStyle:{fontSize:11,fontWeight:"normal"}}),s.push(c),r+=1}var u=Math.ceil(Math.sqrt(r));t.forEach(function(e,t){e.left=t%u/u*100+.5+"%",e.top=Math.floor(t/u)/u*100+.5+"%",e.width=1/u*100-1+"%",e.height=1/u*100-1+"%",i[t].left=parseFloat(e.left)+parseFloat(e.width)/2+"%",i[t].top=parseFloat(e.top)+"%"}),this.options.dataZoom&&this.options.dataZoom[0]&&(this.options.dataZoom[0].xAxisIndex=s),this.options.titles=i,this.options.grid=t,this.options.xAxis=n,this.options.yAxis=a}}]),t}(DrawEchartsChart),DrawEchartsBar=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"preCreate",value:function(e){return this.preference.bar=!0,{}}}]),t}(DrawEchartsChart),DrawD3=function(e){function t(e){_classCallCheck(this,t);var a=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.library="d3",a}return _inherits(t,e),t}(DrawBasicChart),DrawC3=function(e){function t(e){_classCallCheck(this,t);var a=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.library="c3",a.bindto=!1,a}return _inherits(t,e),_createClass(t,[{key:"onResize",value:function(){this.chart&&this.init}},{key:"preProcessor",value:function(){return console.log("preProcessor>c3.generate"),this.initChartByJsCode()?(console.log("c3.options>",this.options),this.bindto.className+=" c3",console.log("this.bindto.className",this.bindto.className),this.options.bindto=this.bindto,console.log("c3.options>",this.options),void(this.chart=c3.generate(this.options))):(console.error("C3.Init by code"),!1)}}]),t}(DrawBasicChart),DrawAMcharts=function(e){function t(e){_classCallCheck(this,t),console.warn("DrawAMcharts constructor");var a=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.library="amchart",a}return _inherits(t,e),_createClass(t,[{key:"onResize",value:function(){this.makeLegend()}},{key:"preProcessor",value:function(){this.createChart()&&(this.init=!0),console.log("!preProcessor,done",this.init,this.options)}},{key:"createChart",value:function(){var e=this,t={},a=this.widget.data.meta,n=!1,i="",r="mm",s=[],o=0,l=[];a.forEach(function(a){if("DateTime"==a.type)n="YYYY-MM-DD JJ:NN:SS",i=a.name;else if("Date"==a.type)n="YYYY-MM-DD",r="DD",i=a.name;else{if(!i)return void(i=a.name);o+=1;var c=e.getChartGraph(a,t[a.name]);c.id="g"+o,"v1"!==c.valueAxis&&l.push(c.valueAxis),s.push(c)}});var c={theme:Widget.isDark?"dark":"light",color:Widget.isDark?"#eee":"#333",type:"serial",categoryField:i,valueAxes:[{id:"v1",axisAlpha:1,gridAlpha:.07,axisColor:Widget.isDark?"#eee":"#333",gridColor:Widget.isDark?"#eee":"#333",ignoreAxisWidth:!0}],balloon:{borderThickness:1,shadowAlpha:0},graphs:s,chartCursor:{valueLineEnabled:!0,valueLineBalloonEnabled:!0,cursorAlpha:0,zoomable:!1,valueZoomable:!0,valueLineAlpha:.5},chartScrollbar:{graph:"g1",gridAlpha:0,color:"#888888",scrollbarHeight:25,backgroundAlpha:0,selectedBackgroundAlpha:.1,selectedBackgroundColor:"#888888",graphFillAlpha:0,autoGridCount:!0,selectedGraphFillAlpha:0,graphLineAlpha:.2,graphLineColor:"#c2c2c2",selectedGraphLineColor:"#888888",selectedGraphLineAlpha:1},categoryAxis:{dashLength:1,minorGridEnabled:!0,axisColor:Widget.isDark?"#eee":"#333",gridColor:Widget.isDark?"#eee":"#333"},data:this.widget.data.data};if(c.categoryAxis.parseDates=!1,n&&(c.dataDateFormat=n,c.categoryAxis.parseDates=!0,c.categoryAxis.minPeriod=r),l){var d=0;l.forEach(function(e){d++;var t={id:e,axisAlpha:1,axisThickness:1,position:"right",ignoreAxisWidth:!0,offset:1*d};c.valueAxes.push(t)})}return this.options=c,this.init=!0,this.makeLegend(),!0}},{key:"makeLegend",value:function(){console.log("this.widget.sizeY",this.widget.sizeY),this.widget.sizeY<2?delete this.options.legend:this.options.legend={align:"center",equalWidths:!1,periodValueText:"total: [[value.sum]]",valueAlign:"left",valueText:"[[value]] ([[percents]]%)",valueWidth:100},console.warn(this.options)}},{key:"getChartGraph",value:function(e,t){var a=e.name,n=e.name,i="v1";a=a.replace(/_axis\d+/gm,"");var r=/.*_axis(\d+).*/i,s=n.match(r);s&&s[1]&&(i="v"+s[1]);var o={id:"g1",valueAxis:i,fillAlphas:.2,bullet:"round",bulletSize:8,hideBulletsCount:50,lineThickness:1,title:a,useLineColorForBulletBorder:!0,valueField:n,type:"smoothedLine",balloonText:"[[title]] [[category]]
[[value]]"};return t||(t={}),Object.assign(o,t)}}]),t}(DrawBasicChart),DataProvider=function(){function e(t,a){if(_classCallCheck(this,e),t.totals&&t.data&&t.data.push(t.totals),this._humanSortCols=[],this._sortBy=!1,this._sortOrder=!1,this.data=t.data,this.text=!1,this.progressQuery="",this.sort=!1,this.sortOrder=!1,t.error||angular.isObject(t.data)||(angular.isString(t.data)?this.text=t.data:this.text=angular.toJson(t.data,!0),this.text=this.text.replace(/&/g,"&").replace(//g,">")),a||(a="ch"),this.sourceType=a,this.meta=t.meta,this.prepareInt64Cols={},this.data){try{this.prepareInt64()}catch(n){console.error("Error in prepareInt64",n)}_.isObject(this.meta)&&(this.meta.prepareInt64Cols=this.prepareInt64Cols)}t.query?this.query=t.query:this.query={index:0,drawCommands:!1},t.error?(this.error=t.error.replace("
","\n").replace(/&/g,"&").replace(//g,">"),this.error=this.error.replace("\\n","
")):this.error=!1,this.draw=this.query.drawCommands,this.rows=t.rows,this.position=this.query.index,this.countAll=t.countAllQuery}return e.$inject=["result","sourceType"],_createClass(e,[{key:"prepareInt64",value:function(){var e=this,t=[];return _.isArray(this.data)&&this.data.length>1?(this.prepareInt64Cols={},this.meta.forEach(function(a){if(a.type.includes("Int64")&&!a.type.includes("Array(")){var n=0;try{n=_.maxBy(e.data,function(e){return _.isEmpty(e[a.name])?void 0:parseInt(e[a.name])})[a.name]}catch(i){console.error("prepareInt64,maxBy",i,"in cell",a,"meta",e.meta)}var r=parseInt(n);r0?void(this.data=_.map(this.data,function(e){return t.forEach(function(t){e[t]=parseInt(e[t])}),e})):!1):!1}},{key:"isNormalInt64Col",value:function(e){return this.prepareInt64Cols[e]}},{key:"isText",value:function(){return this.text?!0:!1}},{key:"isError",value:function(){return this.error?!0:!1}},{key:"getError",value:function(){return this.error}},{key:"update",value:function(e){this.data=e}},{key:"data",value:function(){return this.data}},{key:"getData",value:function(){return this.data}},{key:"meta",value:function(){return this.meta}},{key:"toString",value:function(){return"("+this.name+", "+this.y+")"}},{key:"getColumnsHumanSort",value:function(){return this._humanSortCols}},{key:"setColumnsHumanSort",value:function(e){this._humanSortCols=e}},{key:"setSort",value:function(e,t){this._sortBy=e,this._sortOrder=t,_.isNumber(t)&&(this._sortOrder=parseInt(t)<0?!1:!0)}},{key:"sortByColl",value:function(){return this._sortBy}},{key:"sortOrderBy",value:function(){return this._sortOrder}}],[{key:"convertArrayToDataProvider",value:function(t,a){var n={};return n.data=t,n.meta=[],n.error=!1,n.query={drawCommands:!1},n.rows=t.length,n.position=0,n.countAll=0,Object.keys(t[0]).map(function(e){return n.meta.push({name:e,type:"string"})}),new e(n,a)}}]),e}();angular.module(smi2.app.name).service("DataProvider",DataProvider),angular.module("ui.ace",[]).constant("uiAceConfig",{}).directive("uiAce",["uiAceConfig",function(e){if(angular.isUndefined(window.ace))throw new Error("ui-ace need ace to work... (o rly?)");return{restrict:"EA",scope:{onChange:"=?",load:"=?"},link:function(e,t,a){var n=window.ace.edit(t[0]);e.load(n),e.onChange&&(console.warn("Ace+bind:scope.onChange"),n.session.on("change",function(t){e.onChange(n.session)})),t.on("$destroy",function(){n.session.$stopWorker(),n.destroy()}),e.$watch(function(){return[t[0].offsetWidth,t[0].offsetHeight]},function(){n.resize(),n.renderer.updateFull()},!0)}}}]),/* +}return _inherits(t,e),_createClass(t,[{key:"create",value:function(){this.helpLink="https://tabix.io/doc/draw/Draw_Sankeys/",this.help="Default config : {path:''} or {value:'',source:'',target:''}, if empty path or not set, try auto create path, then find columns [String] : [Integer|Float] : [String] ";var e=this.getDrawCommandObject(),t={path:"",value:"value",source:"source",target:"target"};e&&(t=Object.assign(t,e));var a="";_.isString(e)?a=e:t.path?a=t.path:this.haveColumn(t.source)&&this.haveColumn(t.value)&&this.haveColumn(t.target)&&(a=t.source+"."+t.value+"."+t.target);var n=[];if(a)n=_.split(a,".");else{var i=!1,r=this.getColumns();for(var s in r){var o=r[s];this.isNumericColumn(o)&&i&&(n.push(o),i=!1),this.isStringColumn(o)&&!i&&(n.push(o),i=!0)}}if(console.log("patharr>",n),!n.length)return this.setError("The value of the variable 'path' - empty"),!1;if(!(1&n.length))return this.setError("The value of the variable 'path' must be odd"),!1;var l=[],c=[];this.data().forEach(function(e){for(var t=0;ta&&(a=s),e[t.destination.longitude]&&e[t.destination.latitude]){var o="";e[t.destination.name]&&(o=e[t.destination.name]),i.push({fromName:e[t.name],toName:o,coords:[[e[t.longitude],e[t.latitude]],[e[t.destination.longitude],e[t.destination.latitude]]]})}n.push({name:e[t.name],value:[e[t.longitude],e[t.latitude],s],label:{emphasis:{position:"right",show:!0}}})});var r=[{name:t.title,type:"effectScatter",coordinateSystem:"geo",data:n,showEffectOn:"render",rippleEffect:{brushType:"stroke"},symbolSize:function(e){return a?e[2]/a*15:e[2]/1e4},hoverAnimation:!0,label:{normal:{formatter:"{b}",position:"right",show:!0}},itemStyle:{normal:{color:"#f4e925",shadowBlur:10,shadowColor:"#333"}},zlevel:1}];if(i.length>0){var s="path://M1705.06,1318.313v-89.254l-319.9-221.799l0.073-208.063c0.521-84.662-26.629-121.796-63.961-121.491c-37.332-0.305-64.482,36.829-63.961,121.491l0.073,208.063l-319.9,221.799v89.254l330.343-157.288l12.238,241.308l-134.449,92.931l0.531,42.034l175.125-42.917l175.125,42.917l0.531-42.034l-134.449-92.931l12.238-241.308L1705.06,1318.313z";r.push({name:t.title,type:"lines",zlevel:1,effect:{show:!0,period:6,trailLength:.7,color:"#fff",symbolSize:3},lineStyle:{normal:{width:0,curveness:.2}},data:i}),r.push({name:t.title,type:"lines",zlevel:2,symbol:["none","arrow"],symbolSize:10,effect:{show:!0,period:6,trailLength:0,symbol:s,symbolSize:15},lineStyle:{normal:{width:1,opacity:.6,curveness:.2}},data:i})}var o={tooltip:{trigger:"item"},geo:{name:t.title,type:"map",map:"world",label:{emphasis:{show:!1}},visualMap:{show:!0,min:0,max:100,inRange:{symbolSize:[6,60]}},roam:!0,itemStyle:{normal:{areaColor:"#323c48",borderColor:"#404a59"},emphasis:{areaColor:"#2a333d"}}},series:r};return this.options=Object.assign(this.options,o),!0}}]),t}(DrawEcharts),DrawEchartsHeatmap=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"create",value:function(){var e=this.getParameterPath();if(!e)return this.setError("Not set path"),!1;var t={},a={},n={};this.data().forEach(function(i){_.set(t,i[e[0]],1),_.set(a,i[e[1]],1),_.set(n,i[e[0]]+"."+i[e[1]],parseFloat(i[e[2]]))});var i=[],r=_.keys(t),s=_.keys(a),o=0,l=0;_.mapKeys(t,function(e,t){_.mapKeys(a,function(e,a){var r=_.get(n,t+"."+a,"-");o>r&&(o=r),r>l&&(l=r),i.push([t,a,r])})});var c={tooltip:{position:"top"},animation:!1,grid:{height:"50%",y:"10%"},xAxis:{type:"category",data:r,splitArea:{show:!0}},yAxis:{type:"category",data:s,splitArea:{show:!0}},visualMap:{min:o,max:l,calculable:!0,orient:"horizontal",left:"center",bottom:"15%"},series:[{name:"Punch Card",type:"heatmap",data:i,label:{normal:{show:!0}},itemStyle:{emphasis:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};return this.options=Object.assign(c,this.options),!0}}]),t}(DrawEcharts),DrawEchartsGraph=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"create",value:function(){this.helpLink="https://tabix.io/doc/draw/Draw_Graph/",this.help="Default config : {path:''} or {value:'',source:'',target:''}, if empty path or not set, try auto create path, then find columns [String] : [Integer|Float] : [String] ";var e=this.getDrawCommandObject(),t={path:"",categories:"categories",name:"name",value:"value",target:"target",targetValue:"",sourceValue:"",layout:"",edgeSymbol:""};e&&(t=Object.assign(t,e));var a="";_.isString(e)?a=e:t.path?a=t.path:this.haveColumn(t.source)&&this.haveColumn(t.value)&&this.haveColumn(t.target)&&(a=t.source+"."+t.value+"."+t.target);var n=[],i=this.haveColumn(t.targetValue),r=this.haveColumn(t.sourceValue);this.haveColumn(t.categories);if(a)n=_.split(a,".");else{var s=!1,o=this.getColumns();for(var l in o){var c=o[l];this.isNumericColumn(c)&&s&&(n.push(c),s=!1),this.isStringColumn(c)&&!s&&(n.push(c),s=!0)}}if(console.log("patharr>",n),!n.length)return this.setError("The value of the variable 'path' - empty"),!1;if(!(1&n.length))return this.setError("The value of the variable 'path' must be odd"),!1;var d=[],u=[];this.data().forEach(function(e){for(var a=0;a10}}}}else u[e[s]]={symbolSize:1};if(i){var m=e[t.targetValue]/1.5;u[e[l]]={symbolSize:m,label:{normal:{show:m>10}}}}else u[e[l]]={symbolSize:1};d.push({source:e[s],target:e[l],value:e[o]})}});var m=[];for(var h in u)m.push(_.merge({name:h},u[h]));console.log("result_nodes",m);var p={tooltip:{trigger:"item",triggerOn:"mousemove"},series:[{type:"graph",layout:"circular",data:m,circular:{rotateLabel:!0},animationThreshold:300,animationDuration:300,links:d,itemStyle:{normal:{borderWidth:1,borderColor:"#aaa"}},roam:!0,label:{normal:{position:"right",formatter:"{b}"}},lineStyle:{normal:{color:"source",curveness:.3}}}]};return p=Object.assign(p,this.options),this.options=p,!0}}]),t}(DrawEcharts),DrawEchartsFlatTree=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"getSerieSettings",value:function(){return{symbolSize:7,type:"tree",label:{normal:{position:"left",verticalAlign:"middle",align:"right"}},leaves:{label:{color:this.isDark()?"white":"auto",normal:{position:"right",verticalAlign:"middle",align:"left"}}},expandAndCollapse:!0}}}]),t}(DrawEchartsTreemap),DrawEchartsChart=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"create",value:function(){console.log("DrawEchartsChart");var e=this.getDrawCommandObject(),t=this.preCreate(e),a=this.createChart(e),n={tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0}};return e.title&&this.applyTitle(e.title),this.applyDataZoom(),this.applyLegend(),this.options=Object.assign(a,this.options,n,t),this.postCreate(e),!0}},{key:"postCreate",value:function(e){return{}}},{key:"preCreate",value:function(e){return{}}},{key:"createChart",value:function(e){var t=this,a={autoAxis:!1,markLine:!0,stack:!1,path:!1,sort:!0,xAxis:!1,yAxis:!1};e&&(a=Object.assign(a,e));var n={},i=this.getColumns(),r=this.getFirstColumn(),s=r,o=this.findDateTimeAxis(),l={},c=[],d=[],u=[],m={},h=this.data();if(o&&(r=o),a.xAxis){if(!this.haveColumn(a.xAxis))throw"xAxis column not exists";s=a.xAxis}else a.sort&&(h=_.sortBy(h,r)),s=r;if(d=[{name:s,type:"category",data:[]}],a.yAxis)if(_.isString(a.yAxis)){if(!this.haveColumn(a.yAxis))throw"yAxis column not exists";n[a.yAxis]=1}else{if(!_.isArray(a.yAxis))throw"yAxis column must string or array";var p=void 0;for(p=0;pk&&!w?(_.isArray(y)||(y=[]),y.push(S),k++):this.isNumericColumn(S)&&x.push(S))}var A=h.length;for(console.log("DATA LEN",A,h),v=0;A>v;++v){var D=h[v];d[0].data.push(D[d[0].name])}for(d[0].data=_.uniq(d[0].data),console.log("xAxis[0].data.",d[0].data),v=0;A>v;++v){var R=h[v],E=function(e){var a=i[e],r=[s],o=!1;if(_.size(n)&&(o=_.isUndefined(n[a])),a!==s&&!o&&t.isNumericColumn(a)&&_.findIndex(y,a)<0){if(y)for(var l=0;l1){var P=_.groupBy(b,function(e){return Math.floor(e.median/1e3)});if(_.size(P)>1){var q=function(e){var t=P[e],n=_.map(t,"column").join(",");_.forEach(t,function(e){u[e.index].yAxisIndex=c.length,a.stack&&(u[e.index].stack=n,u[e.index].areaStyle={normal:{}})}),c.push({name:n,type:"value"})};for(var N in P)q(N)}}return c.length||(c=[{name:f,type:"value"}]),l.series=u,l.yAxis=c,l.xAxis=d,console.info("Make Chart Done : Options",l),l}}]),t}(DrawEcharts),DrawEchartsGridChart=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"preCreate",value:function(e){return this.preference.gridchart=!0,{}}},{key:"postCreate",value:function(e){var t=[],a=[],n=[],i=[],r=0;console.info("postCreate!!!!!!",this.options);var s=[],o=this.options.xAxis[0],l=this.options.yAxis[0];for(var c in this.options.series){c=parseInt(c);var d=this.options.series[c].name;this.options.series[c].xAxisIndex=c,this.options.series[c].yAxisIndex=r,console.log(d,this.options.series[c]),o.show=!1,o.gridIndex=c,l.gridIndex=c,l.show=!1,l.name=d,t.push({show:!0,borderWidth:0,shadowBlur:2}),n.push(_.clone(o)),a.push(_.clone(l)),i.push({textAlign:"center",text:d,textStyle:{fontSize:11,fontWeight:"normal"}}),s.push(c),r+=1}var u=Math.ceil(Math.sqrt(r));t.forEach(function(e,t){e.left=t%u/u*100+.5+"%",e.top=Math.floor(t/u)/u*100+.5+"%",e.width=1/u*100-1+"%",e.height=1/u*100-1+"%",i[t].left=parseFloat(e.left)+parseFloat(e.width)/2+"%",i[t].top=parseFloat(e.top)+"%"}),this.options.dataZoom&&this.options.dataZoom[0]&&(this.options.dataZoom[0].xAxisIndex=s),this.options.titles=i,this.options.grid=t,this.options.xAxis=n,this.options.yAxis=a}}]),t}(DrawEchartsChart),DrawEchartsBar=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"preCreate",value:function(e){return this.preference.bar=!0,{}}}]),t}(DrawEchartsChart),DrawD3=function(e){function t(e){_classCallCheck(this,t);var a=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.library="d3",a}return _inherits(t,e),t}(DrawBasicChart),DrawC3=function(e){function t(e){_classCallCheck(this,t);var a=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.library="c3",a.bindto=!1,a}return _inherits(t,e),_createClass(t,[{key:"onResize",value:function(){this.chart&&this.init}},{key:"preProcessor",value:function(){return console.log("preProcessor>c3.generate"),this.initChartByJsCode()?(console.log("c3.options>",this.options),this.bindto.className+=" c3",console.log("this.bindto.className",this.bindto.className),this.options.bindto=this.bindto,console.log("c3.options>",this.options),void(this.chart=c3.generate(this.options))):(console.error("C3.Init by code"),!1)}}]),t}(DrawBasicChart),DrawAMcharts=function(e){function t(e){_classCallCheck(this,t),console.warn("DrawAMcharts constructor");var a=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.library="amchart",a}return _inherits(t,e),_createClass(t,[{key:"onResize",value:function(){this.makeLegend()}},{key:"preProcessor",value:function(){this.createChart()&&(this.init=!0),console.log("!preProcessor,done",this.init,this.options)}},{key:"createChart",value:function(){var e=this,t={},a=this.widget.data.meta,n=!1,i="",r="mm",s=[],o=0,l=[];a.forEach(function(a){if("DateTime"==a.type)n="YYYY-MM-DD JJ:NN:SS",i=a.name;else if("Date"==a.type)n="YYYY-MM-DD",r="DD",i=a.name;else{if(!i)return void(i=a.name);o+=1;var c=e.getChartGraph(a,t[a.name]);c.id="g"+o,"v1"!==c.valueAxis&&l.push(c.valueAxis),s.push(c)}});var c={theme:Widget.isDark?"dark":"light",color:Widget.isDark?"#eee":"#333",type:"serial",categoryField:i,valueAxes:[{id:"v1",axisAlpha:1,gridAlpha:.07,axisColor:Widget.isDark?"#eee":"#333",gridColor:Widget.isDark?"#eee":"#333",ignoreAxisWidth:!0}],balloon:{borderThickness:1,shadowAlpha:0},graphs:s,chartCursor:{valueLineEnabled:!0,valueLineBalloonEnabled:!0,cursorAlpha:0,zoomable:!1,valueZoomable:!0,valueLineAlpha:.5},chartScrollbar:{graph:"g1",gridAlpha:0,color:"#888888",scrollbarHeight:25,backgroundAlpha:0,selectedBackgroundAlpha:.1,selectedBackgroundColor:"#888888",graphFillAlpha:0,autoGridCount:!0,selectedGraphFillAlpha:0,graphLineAlpha:.2,graphLineColor:"#c2c2c2",selectedGraphLineColor:"#888888",selectedGraphLineAlpha:1},categoryAxis:{dashLength:1,minorGridEnabled:!0,axisColor:Widget.isDark?"#eee":"#333",gridColor:Widget.isDark?"#eee":"#333"},data:this.widget.data.data};if(c.categoryAxis.parseDates=!1,n&&(c.dataDateFormat=n,c.categoryAxis.parseDates=!0,c.categoryAxis.minPeriod=r),l){var d=0;l.forEach(function(e){d++;var t={id:e,axisAlpha:1,axisThickness:1,position:"right",ignoreAxisWidth:!0,offset:1*d};c.valueAxes.push(t)})}return this.options=c,this.init=!0,this.makeLegend(),!0}},{key:"makeLegend",value:function(){console.log("this.widget.sizeY",this.widget.sizeY),this.widget.sizeY<2?delete this.options.legend:this.options.legend={align:"center",equalWidths:!1,periodValueText:"total: [[value.sum]]",valueAlign:"left",valueText:"[[value]] ([[percents]]%)",valueWidth:100},console.warn(this.options)}},{key:"getChartGraph",value:function(e,t){var a=e.name,n=e.name,i="v1";a=a.replace(/_axis\d+/gm,"");var r=/.*_axis(\d+).*/i,s=n.match(r);s&&s[1]&&(i="v"+s[1]);var o={id:"g1",valueAxis:i,fillAlphas:.2,bullet:"round",bulletSize:8,hideBulletsCount:50,lineThickness:1,title:a,useLineColorForBulletBorder:!0,valueField:n,type:"smoothedLine",balloonText:"[[title]] [[category]]
[[value]]"};return t||(t={}),Object.assign(o,t)}}]),t}(DrawBasicChart),DataProvider=function(){function e(t,a){if(_classCallCheck(this,e),t.totals&&t.data&&t.data.push(t.totals),this._humanSortCols=[],this._sortBy=!1,this._sortOrder=!1,this.data=t.data,this.text=!1,this.progressQuery="",this.sort=!1,this.sortOrder=!1,t.error||angular.isObject(t.data)||(angular.isString(t.data)?this.text=t.data:this.text=angular.toJson(t.data,!0),this.text=this.text.replace(/&/g,"&").replace(//g,">")),a||(a="ch"),this.sourceType=a,this.meta=t.meta,this.prepareInt64Cols={},this.data){try{this.prepareInt64()}catch(n){console.error("Error in prepareInt64",n)}_.isObject(this.meta)&&(this.meta.prepareInt64Cols=this.prepareInt64Cols)}t.query?this.query=t.query:this.query={index:0,drawCommands:!1},t.error?(this.error=t.error.replace("
","\n").replace(/&/g,"&").replace(//g,">"),this.error=this.error.replace("\\n","
")):this.error=!1,this.draw=this.query.drawCommands,this.rows=t.rows,this.position=this.query.index,this.countAll=t.countAllQuery}return e.$inject=["result","sourceType"],_createClass(e,[{key:"prepareInt64",value:function(){var e=this,t=[];return _.isArray(this.data)&&this.data.length>1?(this.prepareInt64Cols={},this.meta.forEach(function(a){if(a.type.includes("Int64")&&!a.type.includes("Array(")){var n=0;try{n=_.maxBy(e.data,function(e){return _.isEmpty(e[a.name])?void 0:parseInt(e[a.name])})[a.name]}catch(i){console.error("prepareInt64,maxBy",i,"in cell",a,"meta",e.meta)}var r=parseInt(n);r0?void(this.data=_.map(this.data,function(e){return t.forEach(function(t){e[t]=parseInt(e[t])}),e})):!1):!1}},{key:"isNormalInt64Col",value:function(e){return this.prepareInt64Cols[e]}},{key:"isText",value:function(){return this.text?!0:!1}},{key:"isError",value:function(){return this.error?!0:!1}},{key:"getError",value:function(){return this.error}},{key:"update",value:function(e){this.data=e}},{key:"data",value:function(){return this.data}},{key:"getData",value:function(){return this.data}},{key:"meta",value:function(){return this.meta}},{key:"toString",value:function(){return"("+this.name+", "+this.y+")"}},{key:"getColumnsHumanSort",value:function(){return this._humanSortCols}},{key:"setColumnsHumanSort",value:function(e){this._humanSortCols=e}},{key:"setSort",value:function(e,t){this._sortBy=e,this._sortOrder=t,_.isNumber(t)&&(this._sortOrder=parseInt(t)<0?!1:!0)}},{key:"sortByColl",value:function(){return this._sortBy}},{key:"sortOrderBy",value:function(){return this._sortOrder}}],[{key:"convertArrayToDataProvider",value:function(t,a){var n={};return n.data=t,n.meta=[],n.error=!1,n.query={drawCommands:!1},n.rows=t.length,n.position=0,n.countAll=0,Object.keys(t[0]).map(function(e){return n.meta.push({name:e,type:"string"})}),new e(n,a)}}]),e}();angular.module(smi2.app.name).service("DataProvider",DataProvider),angular.module("ui.ace",[]).constant("uiAceConfig",{}).directive("uiAce",["uiAceConfig",function(e){if(angular.isUndefined(window.ace))throw new Error("ui-ace need ace to work... (o rly?)");return{restrict:"EA",scope:{onChange:"=?",load:"=?"},link:function(e,t,a){var n=window.ace.edit(t[0]);e.load(n),e.onChange&&(console.warn("Ace+bind:scope.onChange"),n.session.on("change",function(t){e.onChange(n.session)})),t.on("$destroy",function(){n.session.$stopWorker(),n.destroy()}),e.$watch(function(){return[t[0].offsetWidth,t[0].offsetHeight]},function(){n.resize(),n.renderer.updateFull()},!0)}}}]),/* * Copyright (c) 2017. Smi2 */ angular.module(smi2.app.name).directive("pivot",[function(){return{restrict:"AE",scope:{data:"=",config:"=",editMode:"="},link:function(e,t,a){var n=$.extend($.pivotUtilities.renderers);null==e.config&&(e.config={rows:[],cols:[]}),e.renderPivotTable=function(){$(t).pivot(e.data,{renderers:n,rendererName:"Table",cols:e.config.cols,rows:e.config.rows,onRefresh:function(t){var a=JSON.parse(JSON.stringify(t));delete a.aggregators,delete a.renderers,delete a.derivedAttributes,delete a.rendererOptions,delete a.localeStrings,e.config=a,e.$apply()}})},e.renderPivotUITable=function(){$(t).pivotUI(e.data)},e.$watch("scope.editMode",function(t,a){console.log("watch"+e.editMode),t&&(e.editMode?e.renderPivotUITable():e.renderPivotTable())},!0),e.renderPivotUITable()}}}]),/** diff --git a/build/scripts/app.js b/build/scripts/app.js index d6877f7e..f1d9f9b6 100644 --- a/build/scripts/app.js +++ b/build/scripts/app.js @@ -23,7 +23,15 @@ */ function(e){function t(e,t,n,i){var r,o,a,s,l,c,u,h=t&&t.ownerDocument,p=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==p&&9!==p&&11!==p)return n;if(!i&&((t?t.ownerDocument||t:z)!==O&&$(t),t=t||O,L)){if(11!==p&&(l=_e.exec(e)))if(r=l[1]){if(9===p){if(!(a=t.getElementById(r)))return n;if(a.id===r)return n.push(a),n}else if(h&&(a=h.getElementById(r))&&B(t,a)&&a.id===r)return n.push(a),n}else{if(l[2])return Q.apply(n,t.getElementsByTagName(e)),n;if((r=l[3])&&x.getElementsByClassName&&t.getElementsByClassName)return Q.apply(n,t.getElementsByClassName(r)),n}if(x.qsa&&!U[e+" "]&&(!F||!F.test(e))){if(1!==p)h=t,u=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(we,xe):t.setAttribute("id",s=H),c=A(e),o=c.length;o--;)c[o]="#"+s+" "+f(c[o]);u=c.join(","),h=ve.test(e)&&d(t.parentNode)||t}if(u)try{return Q.apply(n,h.querySelectorAll(u)),n}catch(m){}finally{s===H&&t.removeAttribute("id")}}}return T(e.replace(se,"$1"),t,n,i)}function n(){function e(n,i){return t.push(n+" ")>C.cacheLength&&delete e[t.shift()],e[n+" "]=i}var t=[];return e}function i(e){return e[H]=!0,e}function r(e){var t=O.createElement("fieldset");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),i=n.length;i--;)C.attrHandle[n[i]]=t}function a(e,t){var n=t&&e,i=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(i)return i;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function l(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function c(e){return function(t){return"form"in t?t.parentNode&&t.disabled===!1?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ke(t)===e:t.disabled===e:"label"in t?t.disabled===e:!1}}function u(e){return i(function(t){return t=+t,i(function(n,i){for(var r,o=e([],n.length,t),a=o.length;a--;)n[r=o[a]]&&(n[r]=!(i[r]=n[r]))})})}function d(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function h(){}function f(e){for(var t=0,n=e.length,i="";n>t;t++)i+=e[t].value;return i}function p(e,t,n){var i=t.dir,r=t.next,o=r||i,a=n&&"parentNode"===o,s=j++;return t.first?function(t,n,r){for(;t=t[i];)if(1===t.nodeType||a)return e(t,n,r);return!1}:function(t,n,l){var c,u,d,h=[q,s];if(l){for(;t=t[i];)if((1===t.nodeType||a)&&e(t,n,l))return!0}else for(;t=t[i];)if(1===t.nodeType||a)if(d=t[H]||(t[H]={}),u=d[t.uniqueID]||(d[t.uniqueID]={}),r&&r===t.nodeName.toLowerCase())t=t[i]||t;else{if((c=u[o])&&c[0]===q&&c[1]===s)return h[2]=c[2];if(u[o]=h,h[2]=e(t,n,l))return!0}return!1}}function m(e){return e.length>1?function(t,n,i){for(var r=e.length;r--;)if(!e[r](t,n,i))return!1;return!0}:e[0]}function g(e,n,i){for(var r=0,o=n.length;o>r;r++)t(e,n[r],i);return i}function _(e,t,n,i,r){for(var o,a=[],s=0,l=e.length,c=null!=t;l>s;s++)(o=e[s])&&(!n||n(o,i,r))&&(a.push(o),c&&t.push(s));return a}function v(e,t,n,r,o,a){return r&&!r[H]&&(r=v(r)),o&&!o[H]&&(o=v(o,a)),i(function(i,a,s,l){var c,u,d,h=[],f=[],p=a.length,m=i||g(t||"*",s.nodeType?[s]:s,[]),v=!e||!i&&t?m:_(m,h,e,s,l),y=n?o||(i?e:p||r)?[]:a:v;if(n&&n(v,y,s,l),r)for(c=_(y,f),r(c,[],s,l),u=c.length;u--;)(d=c[u])&&(y[f[u]]=!(v[f[u]]=d));if(i){if(o||e){if(o){for(c=[],u=y.length;u--;)(d=y[u])&&c.push(v[u]=d);o(null,y=[],c,l)}for(u=y.length;u--;)(d=y[u])&&(c=o?ee(i,d):h[u])>-1&&(i[c]=!(a[c]=d))}}else y=_(y===a?y.splice(p,y.length):y),o?o(null,a,y,l):Q.apply(a,y)})}function y(e){for(var t,n,i,r=e.length,o=C.relative[e[0].type],a=o||C.relative[" "],s=o?1:0,l=p(function(e){return e===t},a,!0),c=p(function(e){return ee(t,e)>-1},a,!0),u=[function(e,n,i){var r=!o&&(i||n!==M)||((t=n).nodeType?l(e,n,i):c(e,n,i));return t=null,r}];r>s;s++)if(n=C.relative[e[s].type])u=[p(m(u),n)];else{if(n=C.filter[e[s].type].apply(null,e[s].matches),n[H]){for(i=++s;r>i&&!C.relative[e[i].type];i++);return v(s>1&&m(u),s>1&&f(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(se,"$1"),n,i>s&&y(e.slice(s,i)),r>i&&y(e=e.slice(i)),r>i&&f(e))}u.push(n)}return m(u)}function b(e,n){var r=n.length>0,o=e.length>0,a=function(i,a,s,l,c){var u,d,h,f=0,p="0",m=i&&[],g=[],v=M,y=i||o&&C.find.TAG("*",c),b=q+=null==v?1:Math.random()||.1,w=y.length;for(c&&(M=a===O||a||c);p!==w&&null!=(u=y[p]);p++){if(o&&u){for(d=0,a||u.ownerDocument===O||($(u),s=!L);h=e[d++];)if(h(u,a||O,s)){l.push(u);break}c&&(q=b)}r&&((u=!h&&u)&&f--,i&&m.push(u))}if(f+=p,r&&p!==f){for(d=0;h=n[d++];)h(m,g,a,s);if(i){if(f>0)for(;p--;)m[p]||g[p]||(g[p]=X.call(l));g=_(g)}Q.apply(l,g),c&&!i&&g.length>0&&f+n.length>1&&t.uniqueSort(l)}return c&&(q=b,M=v),m};return r?i(a):a}var w,x,C,k,E,A,S,T,M,D,R,$,O,I,L,F,N,P,B,H="sizzle"+1*new Date,z=e.document,q=0,j=0,W=n(),V=n(),U=n(),G=function(e,t){return e===t&&(R=!0),0},Y={}.hasOwnProperty,K=[],X=K.pop,Z=K.push,Q=K.push,J=K.slice,ee=function(e,t){for(var n=0,i=e.length;i>n;n++)if(e[n]===t)return n;return-1},te="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ne="[\\x20\\t\\r\\n\\f]",ie="(?:\\\\.|[\\w-]|[^\x00-\\xa0])+",re="\\["+ne+"*("+ie+")(?:"+ne+"*([*^$|!~]?=)"+ne+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+ie+"))|)"+ne+"*\\]",oe=":("+ie+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+re+")*)|.*)\\)|)",ae=new RegExp(ne+"+","g"),se=new RegExp("^"+ne+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ne+"+$","g"),le=new RegExp("^"+ne+"*,"+ne+"*"),ce=new RegExp("^"+ne+"*([>+~]|"+ne+")"+ne+"*"),ue=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),de=new RegExp(oe),he=new RegExp("^"+ie+"$"),fe={ID:new RegExp("^#("+ie+")"),CLASS:new RegExp("^\\.("+ie+")"),TAG:new RegExp("^("+ie+"|[*])"),ATTR:new RegExp("^"+re),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},pe=/^(?:input|select|textarea|button)$/i,me=/^h\d$/i,ge=/^[^{]+\{\s*\[native \w/,_e=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ve=/[+~]/,ye=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),be=function(e,t,n){var i="0x"+t-65536;return i!==i||n?t:0>i?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)},we=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,xe=function(e,t){return t?"\x00"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},Ce=function(){$()},ke=p(function(e){return e.disabled===!0&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{Q.apply(K=J.call(z.childNodes),z.childNodes),K[z.childNodes.length].nodeType}catch(Ee){Q={apply:K.length?function(e,t){Z.apply(e,J.call(t))}:function(e,t){for(var n=e.length,i=0;e[n++]=t[i++];);e.length=n-1}}}x=t.support={},E=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},$=t.setDocument=function(e){var t,n,i=e?e.ownerDocument||e:z;return i!==O&&9===i.nodeType&&i.documentElement?(O=i,I=O.documentElement,L=!E(O),z!==O&&(n=O.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Ce,!1):n.attachEvent&&n.attachEvent("onunload",Ce)),x.attributes=r(function(e){return e.className="i",!e.getAttribute("className")}),x.getElementsByTagName=r(function(e){return e.appendChild(O.createComment("")),!e.getElementsByTagName("*").length}),x.getElementsByClassName=ge.test(O.getElementsByClassName),x.getById=r(function(e){return I.appendChild(e).id=H,!O.getElementsByName||!O.getElementsByName(H).length}),x.getById?(C.filter.ID=function(e){var t=e.replace(ye,be);return function(e){return e.getAttribute("id")===t}},C.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&L){var n=t.getElementById(e);return n?[n]:[]}}):(C.filter.ID=function(e){var t=e.replace(ye,be);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},C.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&L){var n,i,r,o=t.getElementById(e);if(o){if(n=o.getAttributeNode("id"),n&&n.value===e)return[o];for(r=t.getElementsByName(e),i=0;o=r[i++];)if(n=o.getAttributeNode("id"),n&&n.value===e)return[o]}return[]}}),C.find.TAG=x.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):x.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,i=[],r=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[r++];)1===n.nodeType&&i.push(n);return i}return o},C.find.CLASS=x.getElementsByClassName&&function(e,t){return"undefined"!=typeof t.getElementsByClassName&&L?t.getElementsByClassName(e):void 0},N=[],F=[],(x.qsa=ge.test(O.querySelectorAll))&&(r(function(e){I.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&F.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||F.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+H+"-]").length||F.push("~="),e.querySelectorAll(":checked").length||F.push(":checked"),e.querySelectorAll("a#"+H+"+*").length||F.push(".#.+[+~]")}),r(function(e){e.innerHTML="";var t=O.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&F.push("name"+ne+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&F.push(":enabled",":disabled"),I.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&F.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),F.push(",.*:")})),(x.matchesSelector=ge.test(P=I.matches||I.webkitMatchesSelector||I.mozMatchesSelector||I.oMatchesSelector||I.msMatchesSelector))&&r(function(e){x.disconnectedMatch=P.call(e,"*"),P.call(e,"[s!='']:x"),N.push("!=",oe)}),F=F.length&&new RegExp(F.join("|")),N=N.length&&new RegExp(N.join("|")),t=ge.test(I.compareDocumentPosition),B=t||ge.test(I.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},G=t?function(e,t){if(e===t)return R=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!x.sortDetached&&t.compareDocumentPosition(e)===n?e===O||e.ownerDocument===z&&B(z,e)?-1:t===O||t.ownerDocument===z&&B(z,t)?1:D?ee(D,e)-ee(D,t):0:4&n?-1:1)}:function(e,t){if(e===t)return R=!0,0;var n,i=0,r=e.parentNode,o=t.parentNode,s=[e],l=[t];if(!r||!o)return e===O?-1:t===O?1:r?-1:o?1:D?ee(D,e)-ee(D,t):0;if(r===o)return a(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)l.unshift(n);for(;s[i]===l[i];)i++;return i?a(s[i],l[i]):s[i]===z?-1:l[i]===z?1:0},O):O},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==O&&$(e),n=n.replace(ue,"='$1']"),x.matchesSelector&&L&&!U[n+" "]&&(!N||!N.test(n))&&(!F||!F.test(n)))try{var i=P.call(e,n);if(i||x.disconnectedMatch||e.document&&11!==e.document.nodeType)return i}catch(r){}return t(n,O,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==O&&$(e),B(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==O&&$(e);var n=C.attrHandle[t.toLowerCase()],i=n&&Y.call(C.attrHandle,t.toLowerCase())?n(e,t,!L):void 0;return void 0!==i?i:x.attributes||!L?e.getAttribute(t):(i=e.getAttributeNode(t))&&i.specified?i.value:null},t.escape=function(e){return(e+"").replace(we,xe)},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],i=0,r=0;if(R=!x.detectDuplicates,D=!x.sortStable&&e.slice(0),e.sort(G),R){for(;t=e[r++];)t===e[r]&&(i=n.push(r));for(;i--;)e.splice(n[i],1)}return D=null,e},k=t.getText=function(e){var t,n="",i=0,r=e.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=k(e)}else if(3===r||4===r)return e.nodeValue}else for(;t=e[i++];)n+=k(t);return n},C=t.selectors={cacheLength:50,createPseudo:i,match:fe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(ye,be),e[3]=(e[3]||e[4]||e[5]||"").replace(ye,be),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return fe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&de.test(n)&&(t=A(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(ye,be).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=W[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&W(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,i){return function(r){var o=t.attr(r,e);return null==o?"!="===n:n?(o+="","="===n?o===i:"!="===n?o!==i:"^="===n?i&&0===o.indexOf(i):"*="===n?i&&o.indexOf(i)>-1:"$="===n?i&&o.slice(-i.length)===i:"~="===n?(" "+o.replace(ae," ")+" ").indexOf(i)>-1:"|="===n?o===i||o.slice(0,i.length+1)===i+"-":!1):!0}},CHILD:function(e,t,n,i,r){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===i&&0===r?function(e){return!!e.parentNode}:function(t,n,l){var c,u,d,h,f,p,m=o!==a?"nextSibling":"previousSibling",g=t.parentNode,_=s&&t.nodeName.toLowerCase(),v=!l&&!s,y=!1;if(g){if(o){for(;m;){for(h=t;h=h[m];)if(s?h.nodeName.toLowerCase()===_:1===h.nodeType)return!1;p=m="only"===e&&!p&&"nextSibling"}return!0}if(p=[a?g.firstChild:g.lastChild],a&&v){for(h=g,d=h[H]||(h[H]={}),u=d[h.uniqueID]||(d[h.uniqueID]={}),c=u[e]||[],f=c[0]===q&&c[1],y=f&&c[2],h=f&&g.childNodes[f];h=++f&&h&&h[m]||(y=f=0)||p.pop();)if(1===h.nodeType&&++y&&h===t){u[e]=[q,f,y];break}}else if(v&&(h=t,d=h[H]||(h[H]={}),u=d[h.uniqueID]||(d[h.uniqueID]={}),c=u[e]||[],f=c[0]===q&&c[1],y=f),y===!1)for(;(h=++f&&h&&h[m]||(y=f=0)||p.pop())&&((s?h.nodeName.toLowerCase()!==_:1!==h.nodeType)||!++y||(v&&(d=h[H]||(h[H]={}),u=d[h.uniqueID]||(d[h.uniqueID]={}),u[e]=[q,y]),h!==t)););return y-=r,y===i||y%i===0&&y/i>=0}}},PSEUDO:function(e,n){var r,o=C.pseudos[e]||C.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[H]?o(n):o.length>1?(r=[e,e,"",n],C.setFilters.hasOwnProperty(e.toLowerCase())?i(function(e,t){for(var i,r=o(e,n),a=r.length;a--;)i=ee(e,r[a]),e[i]=!(t[i]=r[a])}):function(e){return o(e,0,r)}):o}},pseudos:{not:i(function(e){var t=[],n=[],r=S(e.replace(se,"$1"));return r[H]?i(function(e,t,n,i){for(var o,a=r(e,null,i,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:i(function(e){return function(n){return t(e,n).length>0}}),contains:i(function(e){return e=e.replace(ye,be),function(t){return(t.textContent||t.innerText||k(t)).indexOf(e)>-1}}),lang:i(function(e){return he.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(ye,be).toLowerCase(),function(t){var n;do if(n=L?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===I},focus:function(e){return e===O.activeElement&&(!O.hasFocus||O.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:c(!1),disabled:c(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!C.pseudos.empty(e)},header:function(e){return me.test(e.nodeName)},input:function(e){return pe.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:u(function(){return[0]}),last:u(function(e,t){return[t-1]}),eq:u(function(e,t,n){return[0>n?n+t:n]}),even:u(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:u(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:u(function(e,t,n){for(var i=0>n?n+t:n;--i>=0;)e.push(i);return e}),gt:u(function(e,t,n){for(var i=0>n?n+t:n;++i2&&"ID"===(a=o[0]).type&&9===t.nodeType&&L&&C.relative[o[1].type]){if(t=(C.find.ID(a.matches[0].replace(ye,be),t)||[])[0],!t)return n;c&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(r=fe.needsContext.test(e)?0:o.length;r--&&(a=o[r],!C.relative[s=a.type]);)if((l=C.find[s])&&(i=l(a.matches[0].replace(ye,be),ve.test(o[0].type)&&d(t.parentNode)||t))){if(o.splice(r,1),e=i.length&&f(o),!e)return Q.apply(n,i),n;break}}return(c||S(e,u))(i,t,!L,n,!t||ve.test(e)&&d(t.parentNode)||t),n},x.sortStable=H.split("").sort(G).join("")===H,x.detectDuplicates=!!R,$(),x.sortDetached=r(function(e){return 1&e.compareDocumentPosition(O.createElement("fieldset"))}),r(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){return n?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),x.attributes&&r(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),r(function(e){return null==e.getAttribute("disabled")})||o(te,function(e,t,n){var i;return n?void 0:e[t]===!0?t.toLowerCase():(i=e.getAttributeNode(t))&&i.specified?i.value:null}),t}(e);me.find=be,me.expr=be.selectors,me.expr[":"]=me.expr.pseudos,me.uniqueSort=me.unique=be.uniqueSort,me.text=be.getText,me.isXMLDoc=be.isXML,me.contains=be.contains,me.escapeSelector=be.escape;var we=function(e,t,n){for(var i=[],r=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(r&&me(e).is(n))break;i.push(e)}return i},xe=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},Ce=me.expr.match.needsContext,ke=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Ee=/^.[^:#\[\.,]*$/;me.filter=function(e,t,n){var i=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===i.nodeType?me.find.matchesSelector(i,e)?[i]:[]:me.find.matches(e,me.grep(t,function(e){return 1===e.nodeType}))},me.fn.extend({find:function(e){var t,n,i=this.length,r=this;if("string"!=typeof e)return this.pushStack(me(e).filter(function(){for(t=0;i>t;t++)if(me.contains(r[t],this))return!0}));for(n=this.pushStack([]),t=0;i>t;t++)me.find(e,r[t],n);return i>1?me.uniqueSort(n):n},filter:function(e){return this.pushStack(o(this,e||[],!1))},not:function(e){return this.pushStack(o(this,e||[],!0))},is:function(e){return!!o(this,"string"==typeof e&&Ce.test(e)?me(e):e||[],!1).length}});var Ae,Se=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,Te=me.fn.init=function(e,t,n){var i,r;if(!e)return this;if(n=n||Ae,"string"==typeof e){if(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:Se.exec(e),!i||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof me?t[0]:t,me.merge(this,me.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:ne,!0)),ke.test(i[1])&&me.isPlainObject(t))for(i in t)me.isFunction(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return r=ne.getElementById(i[2]),r&&(this[0]=r,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):me.isFunction(e)?void 0!==n.ready?n.ready(e):e(me):me.makeArray(e,this)};Te.prototype=me.fn,Ae=me(ne);var Me=/^(?:parents|prev(?:Until|All))/,De={children:!0,contents:!0,next:!0,prev:!0};me.fn.extend({has:function(e){var t=me(e,this),n=t.length;return this.filter(function(){for(var e=0;n>e;e++)if(me.contains(this,t[e]))return!0})},closest:function(e,t){var n,i=0,r=this.length,o=[],a="string"!=typeof e&&me(e);if(!Ce.test(e))for(;r>i;i++)for(n=this[i];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&me.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?me.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?se.call(me(e),this[0]):se.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(me.uniqueSort(me.merge(this.get(),me(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),me.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return we(e,"parentNode")},parentsUntil:function(e,t,n){return we(e,"parentNode",n)},next:function(e){return a(e,"nextSibling")},prev:function(e){return a(e,"previousSibling")},nextAll:function(e){return we(e,"nextSibling")},prevAll:function(e){return we(e,"previousSibling")},nextUntil:function(e,t,n){return we(e,"nextSibling",n)},prevUntil:function(e,t,n){return we(e,"previousSibling",n)},siblings:function(e){return xe((e.parentNode||{}).firstChild,e)},children:function(e){return xe(e.firstChild)},contents:function(e){return r(e,"iframe")?e.contentDocument:(r(e,"template")&&(e=e.content||e),me.merge([],e.childNodes))}},function(e,t){me.fn[e]=function(n,i){var r=me.map(this,t,n);return"Until"!==e.slice(-5)&&(i=n),i&&"string"==typeof i&&(r=me.filter(i,r)),this.length>1&&(De[e]||me.uniqueSort(r),Me.test(e)&&r.reverse()),this.pushStack(r)}});var Re=/[^\x20\t\r\n\f]+/g;me.Callbacks=function(e){e="string"==typeof e?s(e):me.extend({},e);var t,n,i,r,o=[],a=[],l=-1,c=function(){for(r=r||e.once,i=t=!0;a.length;l=-1)for(n=a.shift();++l-1;)o.splice(n,1),l>=n&&l--}),this},has:function(e){return e?me.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return r=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return r=a=[],n||t||(o=n=""),this},locked:function(){return!!r},fireWith:function(e,n){return r||(n=n||[],n=[e,n.slice?n.slice():n],a.push(n),t||c()),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!i}};return u},me.extend({Deferred:function(t){var n=[["notify","progress",me.Callbacks("memory"),me.Callbacks("memory"),2],["resolve","done",me.Callbacks("once memory"),me.Callbacks("once memory"),0,"resolved"],["reject","fail",me.Callbacks("once memory"),me.Callbacks("once memory"),1,"rejected"]],i="pending",r={state:function(){return i},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return r.then(null,e)},pipe:function(){var e=arguments;return me.Deferred(function(t){me.each(n,function(n,i){var r=me.isFunction(e[i[4]])&&e[i[4]];o[i[1]](function(){var e=r&&r.apply(this,arguments);e&&me.isFunction(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[i[0]+"With"](this,r?[e]:arguments)})}),e=null}).promise()},then:function(t,i,r){function o(t,n,i,r){return function(){var s=this,u=arguments,d=function(){var e,d;if(!(a>t)){if(e=i.apply(s,u),e===n.promise())throw new TypeError("Thenable self-resolution");d=e&&("object"==typeof e||"function"==typeof e)&&e.then,me.isFunction(d)?r?d.call(e,o(a,n,l,r),o(a,n,c,r)):(a++,d.call(e,o(a,n,l,r),o(a,n,c,r),o(a,n,l,n.notifyWith))):(i!==l&&(s=void 0,u=[e]),(r||n.resolveWith)(s,u))}},h=r?d:function(){try{d()}catch(e){me.Deferred.exceptionHook&&me.Deferred.exceptionHook(e,h.stackTrace),t+1>=a&&(i!==c&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?h():(me.Deferred.getStackHook&&(h.stackTrace=me.Deferred.getStackHook()),e.setTimeout(h))}}var a=0;return me.Deferred(function(e){n[0][3].add(o(0,e,me.isFunction(r)?r:l,e.notifyWith)),n[1][3].add(o(0,e,me.isFunction(t)?t:l)),n[2][3].add(o(0,e,me.isFunction(i)?i:c))}).promise()},promise:function(e){return null!=e?me.extend(e,r):r}},o={};return me.each(n,function(e,t){var a=t[2],s=t[5];r[t[1]]=a.add,s&&a.add(function(){i=s},n[3-e][2].disable,n[0][2].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),r.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,i=Array(n),r=re.call(arguments),o=me.Deferred(),a=function(e){return function(n){i[e]=this,r[e]=arguments.length>1?re.call(arguments):n,--t||o.resolveWith(i,r)}};if(1>=t&&(u(e,o.done(a(n)).resolve,o.reject,!t),"pending"===o.state()||me.isFunction(r[n]&&r[n].then)))return o.then();for(;n--;)u(r[n],a(n),o.reject);return o.promise()}});var $e=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;me.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&$e.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},me.readyException=function(t){e.setTimeout(function(){throw t})};var Oe=me.Deferred();me.fn.ready=function(e){return Oe.then(e)["catch"](function(e){me.readyException(e)}),this},me.extend({isReady:!1,readyWait:1,ready:function(e){(e===!0?--me.readyWait:me.isReady)||(me.isReady=!0,e!==!0&&--me.readyWait>0||Oe.resolveWith(ne,[me]))}}),me.ready.then=Oe.then,"complete"===ne.readyState||"loading"!==ne.readyState&&!ne.documentElement.doScroll?e.setTimeout(me.ready):(ne.addEventListener("DOMContentLoaded",d),e.addEventListener("load",d));var Ie=function(e,t,n,i,r,o,a){var s=0,l=e.length,c=null==n;if("object"===me.type(n)){r=!0;for(s in n)Ie(e,t,s,n[s],!0,o,a)}else if(void 0!==i&&(r=!0,me.isFunction(i)||(a=!0),c&&(a?(t.call(e,i),t=null):(c=t,t=function(e,t,n){return c.call(me(e),n)})),t))for(;l>s;s++)t(e[s],n,a?i:i.call(e[s],s,t(e[s],n)));return r?e:c?t.call(e):l?t(e[0],n):o},Le=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};h.uid=1,h.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Le(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var i,r=this.cache(e);if("string"==typeof t)r[me.camelCase(t)]=n;else for(i in t)r[me.camelCase(i)]=t[i];return r},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][me.camelCase(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,i=e[this.expando];if(void 0!==i){if(void 0!==t){Array.isArray(t)?t=t.map(me.camelCase):(t=me.camelCase(t),t=t in i?[t]:t.match(Re)||[]),n=t.length;for(;n--;)delete i[t[n]]}(void 0===t||me.isEmptyObject(i))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!me.isEmptyObject(t)}};var Fe=new h,Ne=new h,Pe=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Be=/[A-Z]/g;me.extend({hasData:function(e){return Ne.hasData(e)||Fe.hasData(e)},data:function(e,t,n){return Ne.access(e,t,n)},removeData:function(e,t){Ne.remove(e,t)},_data:function(e,t,n){return Fe.access(e,t,n)},_removeData:function(e,t){Fe.remove(e,t)}}),me.fn.extend({data:function(e,t){var n,i,r,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(r=Ne.get(o),1===o.nodeType&&!Fe.get(o,"hasDataAttrs"))){for(n=a.length;n--;)a[n]&&(i=a[n].name,0===i.indexOf("data-")&&(i=me.camelCase(i.slice(5)),p(o,i,r[i])));Fe.set(o,"hasDataAttrs",!0)}return r}return"object"==typeof e?this.each(function(){Ne.set(this,e)}):Ie(this,function(t){var n;if(o&&void 0===t){if(n=Ne.get(o,e),void 0!==n)return n;if(n=p(o,e),void 0!==n)return n}else this.each(function(){Ne.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){Ne.remove(this,e)})}}),me.extend({queue:function(e,t,n){var i;return e?(t=(t||"fx")+"queue",i=Fe.get(e,t),n&&(!i||Array.isArray(n)?i=Fe.access(e,t,me.makeArray(n)):i.push(n)),i||[]):void 0},dequeue:function(e,t){t=t||"fx";var n=me.queue(e,t),i=n.length,r=n.shift(),o=me._queueHooks(e,t),a=function(){me.dequeue(e,t)};"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===t&&n.unshift("inprogress"),delete o.stop,r.call(e,a,o)),!i&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Fe.get(e,n)||Fe.access(e,n,{empty:me.Callbacks("once memory").add(function(){Fe.remove(e,[t+"queue",n])})})}}),me.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]+)/i,Ye=/^$|\/(?:java|ecma)script/i,Ke={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};Ke.optgroup=Ke.option,Ke.tbody=Ke.tfoot=Ke.colgroup=Ke.caption=Ke.thead, Ke.th=Ke.td;var Xe=/<|&#?\w+;/;!function(){var e=ne.createDocumentFragment(),t=e.appendChild(ne.createElement("div")),n=ne.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),fe.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="",fe.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var Ze=ne.documentElement,Qe=/^key/,Je=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,et=/^([^.]*)(?:\.(.+)|)/;me.event={global:{},add:function(e,t,n,i,r){var o,a,s,l,c,u,d,h,f,p,m,g=Fe.get(e);if(g)for(n.handler&&(o=n,n=o.handler,r=o.selector),r&&me.find.matchesSelector(Ze,r),n.guid||(n.guid=me.guid++),(l=g.events)||(l=g.events={}),(a=g.handle)||(a=g.handle=function(t){return"undefined"!=typeof me&&me.event.triggered!==t.type?me.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(Re)||[""],c=t.length;c--;)s=et.exec(t[c])||[],f=m=s[1],p=(s[2]||"").split(".").sort(),f&&(d=me.event.special[f]||{},f=(r?d.delegateType:d.bindType)||f,d=me.event.special[f]||{},u=me.extend({type:f,origType:m,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&me.expr.match.needsContext.test(r),namespace:p.join(".")},o),(h=l[f])||(h=l[f]=[],h.delegateCount=0,d.setup&&d.setup.call(e,i,p,a)!==!1||e.addEventListener&&e.addEventListener(f,a)),d.add&&(d.add.call(e,u),u.handler.guid||(u.handler.guid=n.guid)),r?h.splice(h.delegateCount++,0,u):h.push(u),me.event.global[f]=!0)},remove:function(e,t,n,i,r){var o,a,s,l,c,u,d,h,f,p,m,g=Fe.hasData(e)&&Fe.get(e);if(g&&(l=g.events)){for(t=(t||"").match(Re)||[""],c=t.length;c--;)if(s=et.exec(t[c])||[],f=m=s[1],p=(s[2]||"").split(".").sort(),f){for(d=me.event.special[f]||{},f=(i?d.delegateType:d.bindType)||f,h=l[f]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=h.length;o--;)u=h[o],!r&&m!==u.origType||n&&n.guid!==u.guid||s&&!s.test(u.namespace)||i&&i!==u.selector&&("**"!==i||!u.selector)||(h.splice(o,1),u.selector&&h.delegateCount--,d.remove&&d.remove.call(e,u));a&&!h.length&&(d.teardown&&d.teardown.call(e,p,g.handle)!==!1||me.removeEvent(e,f,g.handle),delete l[f])}else for(f in l)me.event.remove(e,f+t[c],n,i,!0);me.isEmptyObject(l)&&Fe.remove(e,"handle events")}},dispatch:function(e){var t,n,i,r,o,a,s=me.event.fix(e),l=new Array(arguments.length),c=(Fe.get(this,"events")||{})[s.type]||[],u=me.event.special[s.type]||{};for(l[0]=s,t=1;t=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==e.type||c.disabled!==!0)){for(o=[],a={},n=0;l>n;n++)i=t[n],r=i.selector+" ",void 0===a[r]&&(a[r]=i.needsContext?me(r,this).index(c)>-1:me.find(r,this,null,[c]).length),a[r]&&o.push(i);o.length&&s.push({elem:c,handlers:o})}return c=this,l\x20\t\r\n\f]*)[^>]*)\/>/gi,nt=/\s*$/g;me.extend({htmlPrefilter:function(e){return e.replace(tt,"<$1>")},clone:function(e,t,n){var i,r,o,a,s=e.cloneNode(!0),l=me.contains(e.ownerDocument,e);if(!(fe.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||me.isXMLDoc(e)))for(a=v(s),o=v(e),i=0,r=o.length;r>i;i++)M(o[i],a[i]);if(t)if(n)for(o=o||v(e),a=a||v(s),i=0,r=o.length;r>i;i++)T(o[i],a[i]);else T(e,s);return a=v(s,"script"),a.length>0&&y(a,!l&&v(e,"script")),s},cleanData:function(e){for(var t,n,i,r=me.event.special,o=0;void 0!==(n=e[o]);o++)if(Le(n)){if(t=n[Fe.expando]){if(t.events)for(i in t.events)r[i]?me.event.remove(n,i):me.removeEvent(n,i,t.handle);n[Fe.expando]=void 0}n[Ne.expando]&&(n[Ne.expando]=void 0)}}}),me.fn.extend({detach:function(e){return R(this,e,!0)},remove:function(e){return R(this,e)},text:function(e){return Ie(this,function(e){return void 0===e?me.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=e)})},null,e,arguments.length)},append:function(){return D(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=E(this,e);t.appendChild(e)}})},prepend:function(){return D(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=E(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return D(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return D(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(me.cleanData(v(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return me.clone(this,e,t)})},html:function(e){return Ie(this,function(e){var t=this[0]||{},n=0,i=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!nt.test(e)&&!Ke[(Ge.exec(e)||["",""])[1].toLowerCase()]){e=me.htmlPrefilter(e);try{for(;i>n;n++)t=this[n]||{},1===t.nodeType&&(me.cleanData(v(t,!1)),t.innerHTML=e);t=0}catch(r){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return D(this,arguments,function(t){var n=this.parentNode;me.inArray(this,e)<0&&(me.cleanData(v(this)),n&&n.replaceChild(t,this))},e)}}),me.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){me.fn[e]=function(e){for(var n,i=[],r=me(e),o=r.length-1,a=0;o>=a;a++)n=a===o?this:this.clone(!0),me(r[a])[t](n),ae.apply(i,n.get());return this.pushStack(i)}});var at=/^margin/,st=new RegExp("^("+He+")(?!px)[a-z%]+$","i"),lt=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)};!function(){function t(){if(s){s.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",s.innerHTML="",Ze.appendChild(a);var t=e.getComputedStyle(s);n="1%"!==t.top,o="2px"===t.marginLeft,i="4px"===t.width,s.style.marginRight="50%",r="4px"===t.marginRight,Ze.removeChild(a),s=null}}var n,i,r,o,a=ne.createElement("div"),s=ne.createElement("div");s.style&&(s.style.backgroundClip="content-box",s.cloneNode(!0).style.backgroundClip="",fe.clearCloneStyle="content-box"===s.style.backgroundClip,a.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",a.appendChild(s),me.extend(fe,{pixelPosition:function(){return t(),n},boxSizingReliable:function(){return t(),i},pixelMarginRight:function(){return t(),r},reliableMarginLeft:function(){return t(),o}}))}();var ct=/^(none|table(?!-c[ea]).+)/,ut=/^--/,dt={position:"absolute",visibility:"hidden",display:"block"},ht={letterSpacing:"0",fontWeight:"400"},ft=["Webkit","Moz","ms"],pt=ne.createElement("div").style;me.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=$(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var r,o,a,s=me.camelCase(t),l=ut.test(t),c=e.style;return l||(t=L(s)),a=me.cssHooks[t]||me.cssHooks[s],void 0===n?a&&"get"in a&&void 0!==(r=a.get(e,!1,i))?r:c[t]:(o=typeof n,"string"===o&&(r=ze.exec(n))&&r[1]&&(n=m(e,t,r),o="number"),null!=n&&n===n&&("number"===o&&(n+=r&&r[3]||(me.cssNumber[s]?"":"px")),fe.clearCloneStyle||""!==n||0!==t.indexOf("background")||(c[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,i))||(l?c.setProperty(t,n):c[t]=n)),void 0)}},css:function(e,t,n,i){var r,o,a,s=me.camelCase(t),l=ut.test(t);return l||(t=L(s)),a=me.cssHooks[t]||me.cssHooks[s],a&&"get"in a&&(r=a.get(e,!0,n)),void 0===r&&(r=$(e,t,i)),"normal"===r&&t in ht&&(r=ht[t]),""===n||n?(o=parseFloat(r),n===!0||isFinite(o)?o||0:r):r}}),me.each(["height","width"],function(e,t){me.cssHooks[t]={get:function(e,n,i){return n?!ct.test(me.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?P(e,t,i):We(e,dt,function(){return P(e,t,i)}):void 0},set:function(e,n,i){var r,o=i&<(e),a=i&&N(e,t,i,"border-box"===me.css(e,"boxSizing",!1,o),o);return a&&(r=ze.exec(n))&&"px"!==(r[3]||"px")&&(e.style[t]=n,n=me.css(e,t)),F(e,n,a)}}}),me.cssHooks.marginLeft=O(fe.reliableMarginLeft,function(e,t){return t?(parseFloat($(e,"marginLeft"))||e.getBoundingClientRect().left-We(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px":void 0}),me.each({margin:"",padding:"",border:"Width"},function(e,t){me.cssHooks[e+t]={expand:function(n){for(var i=0,r={},o="string"==typeof n?n.split(" "):[n];4>i;i++)r[e+qe[i]+t]=o[i]||o[i-2]||o[0];return r}},at.test(e)||(me.cssHooks[e+t].set=F)}),me.fn.extend({css:function(e,t){return Ie(this,function(e,t,n){var i,r,o={},a=0;if(Array.isArray(t)){for(i=lt(e),r=t.length;r>a;a++)o[t[a]]=me.css(e,t[a],!1,i);return o}return void 0!==n?me.style(e,t,n):me.css(e,t)},e,t,arguments.length>1)}}),me.Tween=B,B.prototype={constructor:B,init:function(e,t,n,i,r,o){this.elem=e,this.prop=n,this.easing=r||me.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=i,this.unit=o||(me.cssNumber[n]?"":"px")},cur:function(){var e=B.propHooks[this.prop];return e&&e.get?e.get(this):B.propHooks._default.get(this)},run:function(e){var t,n=B.propHooks[this.prop];return this.options.duration?this.pos=t=me.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):B.propHooks._default.set(this),this}},B.prototype.init.prototype=B.prototype,B.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=me.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){me.fx.step[e.prop]?me.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[me.cssProps[e.prop]]&&!me.cssHooks[e.prop]?e.elem[e.prop]=e.now:me.style(e.elem,e.prop,e.now+e.unit)}}},B.propHooks.scrollTop=B.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},me.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},me.fx=B.prototype.init,me.fx.step={};var mt,gt,_t=/^(?:toggle|show|hide)$/,vt=/queueHooks$/;me.Animation=me.extend(U,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return m(n.elem,e,ze.exec(t),n),n}]},tweener:function(e,t){me.isFunction(e)?(t=e,e=["*"]):e=e.match(Re);for(var n,i=0,r=e.length;r>i;i++)n=e[i],U.tweeners[n]=U.tweeners[n]||[],U.tweeners[n].unshift(t)},prefilters:[W],prefilter:function(e,t){t?U.prefilters.unshift(e):U.prefilters.push(e)}}),me.speed=function(e,t,n){var i=e&&"object"==typeof e?me.extend({},e):{complete:n||!n&&t||me.isFunction(e)&&e,duration:e,easing:n&&t||t&&!me.isFunction(t)&&t};return me.fx.off?i.duration=0:"number"!=typeof i.duration&&(i.duration in me.fx.speeds?i.duration=me.fx.speeds[i.duration]:i.duration=me.fx.speeds._default),(null==i.queue||i.queue===!0)&&(i.queue="fx"),i.old=i.complete,i.complete=function(){me.isFunction(i.old)&&i.old.call(this),i.queue&&me.dequeue(this,i.queue)},i},me.fn.extend({fadeTo:function(e,t,n,i){return this.filter(je).css("opacity",0).show().end().animate({opacity:t},e,n,i)},animate:function(e,t,n,i){var r=me.isEmptyObject(e),o=me.speed(t,n,i),a=function(){var t=U(this,me.extend({},e),o);(r||Fe.get(this,"finish"))&&t.stop(!0)};return a.finish=a,r||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var i=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,r=null!=e&&e+"queueHooks",o=me.timers,a=Fe.get(this);if(r)a[r]&&a[r].stop&&i(a[r]);else for(r in a)a[r]&&a[r].stop&&vt.test(r)&&i(a[r]);for(r=o.length;r--;)o[r].elem!==this||null!=e&&o[r].queue!==e||(o[r].anim.stop(n),t=!1,o.splice(r,1));(t||!n)&&me.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=Fe.get(this),i=n[e+"queue"],r=n[e+"queueHooks"],o=me.timers,a=i?i.length:0;for(n.finish=!0,me.queue(this,e,[]),r&&r.stop&&r.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)i[t]&&i[t].finish&&i[t].finish.call(this);delete n.finish})}}),me.each(["toggle","show","hide"],function(e,t){var n=me.fn[t];me.fn[t]=function(e,i,r){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(q(t,!0),e,i,r)}}),me.each({slideDown:q("show"),slideUp:q("hide"),slideToggle:q("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){me.fn[e]=function(e,n,i){return this.animate(t,e,n,i)}}),me.timers=[],me.fx.tick=function(){var e,t=0,n=me.timers;for(mt=me.now();t1)},removeAttr:function(e){return this.each(function(){me.removeAttr(this,e)})}}),me.extend({attr:function(e,t,n){var i,r,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?me.prop(e,t,n):(1===o&&me.isXMLDoc(e)||(r=me.attrHooks[t.toLowerCase()]||(me.expr.match.bool.test(t)?yt:void 0)),void 0!==n?null===n?void me.removeAttr(e,t):r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:(e.setAttribute(t,n+""),n):r&&"get"in r&&null!==(i=r.get(e,t))?i:(i=me.find.attr(e,t),null==i?void 0:i))},attrHooks:{type:{set:function(e,t){if(!fe.radioValue&&"radio"===t&&r(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,i=0,r=t&&t.match(Re);if(r&&1===e.nodeType)for(;n=r[i++];)e.removeAttribute(n)}}),yt={set:function(e,t,n){return t===!1?me.removeAttr(e,n):e.setAttribute(n,n),n}},me.each(me.expr.match.bool.source.match(/\w+/g),function(e,t){var n=bt[t]||me.find.attr;bt[t]=function(e,t,i){var r,o,a=t.toLowerCase();return i||(o=bt[a],bt[a]=r,r=null!=n(e,t,i)?a:null,bt[a]=o),r}});var wt=/^(?:input|select|textarea|button)$/i,xt=/^(?:a|area)$/i;me.fn.extend({prop:function(e,t){return Ie(this,me.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[me.propFix[e]||e]})}}),me.extend({prop:function(e,t,n){var i,r,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&me.isXMLDoc(e)||(t=me.propFix[t]||t,r=me.propHooks[t]),void 0!==n?r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:e[t]=n:r&&"get"in r&&null!==(i=r.get(e,t))?i:e[t]},propHooks:{tabIndex:{get:function(e){var t=me.find.attr(e,"tabindex");return t?parseInt(t,10):wt.test(e.nodeName)||xt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),fe.optSelected||(me.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),me.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){me.propFix[this.toLowerCase()]=this}),me.fn.extend({addClass:function(e){var t,n,i,r,o,a,s,l=0;if(me.isFunction(e))return this.each(function(t){me(this).addClass(e.call(this,t,Y(this)))});if("string"==typeof e&&e)for(t=e.match(Re)||[];n=this[l++];)if(r=Y(n),i=1===n.nodeType&&" "+G(r)+" "){for(a=0;o=t[a++];)i.indexOf(" "+o+" ")<0&&(i+=o+" ");s=G(i),r!==s&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,i,r,o,a,s,l=0;if(me.isFunction(e))return this.each(function(t){me(this).removeClass(e.call(this,t,Y(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(Re)||[];n=this[l++];)if(r=Y(n),i=1===n.nodeType&&" "+G(r)+" "){for(a=0;o=t[a++];)for(;i.indexOf(" "+o+" ")>-1;)i=i.replace(" "+o+" "," ");s=G(i),r!==s&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):me.isFunction(e)?this.each(function(n){me(this).toggleClass(e.call(this,n,Y(this),t),t)}):this.each(function(){var t,i,r,o;if("string"===n)for(i=0,r=me(this),o=e.match(Re)||[];t=o[i++];)r.hasClass(t)?r.removeClass(t):r.addClass(t);else(void 0===e||"boolean"===n)&&(t=Y(this),t&&Fe.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||e===!1?"":Fe.get(this,"__className__")||""))})},hasClass:function(e){var t,n,i=0;for(t=" "+e+" ";n=this[i++];)if(1===n.nodeType&&(" "+G(Y(n))+" ").indexOf(t)>-1)return!0;return!1}});var Ct=/\r/g;me.fn.extend({val:function(e){var t,n,i,r=this[0];{if(arguments.length)return i=me.isFunction(e),this.each(function(n){var r;1===this.nodeType&&(r=i?e.call(this,n,me(this).val()):e,null==r?r="":"number"==typeof r?r+="":Array.isArray(r)&&(r=me.map(r,function(e){return null==e?"":e+""})),t=me.valHooks[this.type]||me.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,r,"value")||(this.value=r))});if(r)return t=me.valHooks[r.type]||me.valHooks[r.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(r,"value"))?n:(n=r.value,"string"==typeof n?n.replace(Ct,""):null==n?"":n)}}}),me.extend({valHooks:{option:{get:function(e){var t=me.find.attr(e,"value");return null!=t?t:G(me.text(e))}},select:{get:function(e){var t,n,i,o=e.options,a=e.selectedIndex,s="select-one"===e.type,l=s?null:[],c=s?a+1:o.length;for(i=0>a?c:s?a:0;c>i;i++)if(n=o[i],(n.selected||i===a)&&!n.disabled&&(!n.parentNode.disabled||!r(n.parentNode,"optgroup"))){if(t=me(n).val(),s)return t;l.push(t)}return l},set:function(e,t){for(var n,i,r=e.options,o=me.makeArray(t),a=r.length;a--;)i=r[a],(i.selected=me.inArray(me.valHooks.option.get(i),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),me.each(["radio","checkbox"],function(){me.valHooks[this]={set:function(e,t){return Array.isArray(t)?e.checked=me.inArray(me(e).val(),t)>-1:void 0}},fe.checkOn||(me.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var kt=/^(?:focusinfocus|focusoutblur)$/;me.extend(me.event,{trigger:function(t,n,i,r){var o,a,s,l,c,u,d,h=[i||ne],f=ue.call(t,"type")?t.type:t,p=ue.call(t,"namespace")?t.namespace.split("."):[];if(a=s=i=i||ne,3!==i.nodeType&&8!==i.nodeType&&!kt.test(f+me.event.triggered)&&(f.indexOf(".")>-1&&(p=f.split("."),f=p.shift(),p.sort()),c=f.indexOf(":")<0&&"on"+f,t=t[me.expando]?t:new me.Event(f,"object"==typeof t&&t),t.isTrigger=r?2:3,t.namespace=p.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:me.makeArray(n,[t]),d=me.event.special[f]||{},r||!d.trigger||d.trigger.apply(i,n)!==!1)){if(!r&&!d.noBubble&&!me.isWindow(i)){for(l=d.delegateType||f,kt.test(l+f)||(a=a.parentNode);a;a=a.parentNode)h.push(a),s=a;s===(i.ownerDocument||ne)&&h.push(s.defaultView||s.parentWindow||e)}for(o=0;(a=h[o++])&&!t.isPropagationStopped();)t.type=o>1?l:d.bindType||f,u=(Fe.get(a,"events")||{})[t.type]&&Fe.get(a,"handle"),u&&u.apply(a,n),u=c&&a[c],u&&u.apply&&Le(a)&&(t.result=u.apply(a,n),t.result===!1&&t.preventDefault());return t.type=f,r||t.isDefaultPrevented()||d._default&&d._default.apply(h.pop(),n)!==!1||!Le(i)||c&&me.isFunction(i[f])&&!me.isWindow(i)&&(s=i[c],s&&(i[c]=null),me.event.triggered=f,i[f](),me.event.triggered=void 0,s&&(i[c]=s)),t.result}},simulate:function(e,t,n){var i=me.extend(new me.Event,n,{type:e,isSimulated:!0});me.event.trigger(i,null,t)}}),me.fn.extend({trigger:function(e,t){return this.each(function(){me.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?me.event.trigger(e,t,n,!0):void 0}}),me.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){me.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),me.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),fe.focusin="onfocusin"in e,fe.focusin||me.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){me.event.simulate(t,e.target,me.event.fix(e))};me.event.special[t]={setup:function(){var i=this.ownerDocument||this,r=Fe.access(i,t);r||i.addEventListener(e,n,!0),Fe.access(i,t,(r||0)+1)},teardown:function(){var i=this.ownerDocument||this,r=Fe.access(i,t)-1;r?Fe.access(i,t,r):(i.removeEventListener(e,n,!0),Fe.remove(i,t))}}});var Et=e.location,At=me.now(),St=/\?/;me.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(i){n=void 0}return(!n||n.getElementsByTagName("parsererror").length)&&me.error("Invalid XML: "+t),n};var Tt=/\[\]$/,Mt=/\r?\n/g,Dt=/^(?:submit|button|image|reset|file)$/i,Rt=/^(?:input|select|textarea|keygen)/i;me.param=function(e,t){var n,i=[],r=function(e,t){var n=me.isFunction(t)?t():t;i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!me.isPlainObject(e))me.each(e,function(){r(this.name,this.value)});else for(n in e)K(n,e[n],t,r);return i.join("&")},me.fn.extend({serialize:function(){return me.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=me.prop(this,"elements");return e?me.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!me(this).is(":disabled")&&Rt.test(this.nodeName)&&!Dt.test(e)&&(this.checked||!Ue.test(e))}).map(function(e,t){var n=me(this).val();return null==n?null:Array.isArray(n)?me.map(n,function(e){return{name:t.name,value:e.replace(Mt,"\r\n")}}):{name:t.name,value:n.replace(Mt,"\r\n")}}).get()}});var $t=/%20/g,Ot=/#.*$/,It=/([?&])_=[^&]*/,Lt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ft=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nt=/^(?:GET|HEAD)$/,Pt=/^\/\//,Bt={},Ht={},zt="*/".concat("*"),qt=ne.createElement("a");qt.href=Et.href,me.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Et.href,type:"GET",isLocal:Ft.test(Et.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":me.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Q(Q(e,me.ajaxSettings),t):Q(me.ajaxSettings,e)},ajaxPrefilter:X(Bt),ajaxTransport:X(Ht),ajax:function(t,n){function i(t,n,i,s){var c,h,f,b,w,x=n;u||(u=!0,l&&e.clearTimeout(l),r=void 0,a=s||"",C.readyState=t>0?4:0,c=t>=200&&300>t||304===t,i&&(b=J(p,C,i)),b=ee(p,b,C,c),c?(p.ifModified&&(w=C.getResponseHeader("Last-Modified"),w&&(me.lastModified[o]=w),w=C.getResponseHeader("etag"),w&&(me.etag[o]=w)),204===t||"HEAD"===p.type?x="nocontent":304===t?x="notmodified":(x=b.state,h=b.data,f=b.error,c=!f)):(f=x,(t||!x)&&(x="error",0>t&&(t=0))),C.status=t,C.statusText=(n||x)+"",c?_.resolveWith(m,[h,x,C]):_.rejectWith(m,[C,x,f]),C.statusCode(y),y=void 0,d&&g.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?h:f]),v.fireWith(m,[C,x]),d&&(g.trigger("ajaxComplete",[C,p]),--me.active||me.event.trigger("ajaxStop")))}"object"==typeof t&&(n=t,t=void 0),n=n||{};var r,o,a,s,l,c,u,d,h,f,p=me.ajaxSetup({},n),m=p.context||p,g=p.context&&(m.nodeType||m.jquery)?me(m):me.event,_=me.Deferred(),v=me.Callbacks("once memory"),y=p.statusCode||{},b={},w={},x="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(u){if(!s)for(s={};t=Lt.exec(a);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return u?a:null},setRequestHeader:function(e,t){return null==u&&(e=w[e.toLowerCase()]=w[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==u&&(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(u)C.always(e[C.status]);else for(t in e)y[t]=[y[t],e[t]];return this},abort:function(e){var t=e||x;return r&&r.abort(t),i(0,t),this}};if(_.promise(C),p.url=((t||p.url||Et.href)+"").replace(Pt,Et.protocol+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=(p.dataType||"*").toLowerCase().match(Re)||[""],null==p.crossDomain){c=ne.createElement("a");try{c.href=p.url,c.href=c.href,p.crossDomain=qt.protocol+"//"+qt.host!=c.protocol+"//"+c.host}catch(k){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=me.param(p.data,p.traditional)),Z(Bt,p,n,C),u)return C;d=me.event&&p.global,d&&0===me.active++&&me.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nt.test(p.type),o=p.url.replace(Ot,""),p.hasContent?p.data&&p.processData&&0===(p.contentType||"").indexOf("application/x-www-form-urlencoded")&&(p.data=p.data.replace($t,"+")):(f=p.url.slice(o.length),p.data&&(o+=(St.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(o=o.replace(It,"$1"),f=(St.test(o)?"&":"?")+"_="+At++ +f),p.url=o+f),p.ifModified&&(me.lastModified[o]&&C.setRequestHeader("If-Modified-Since",me.lastModified[o]),me.etag[o]&&C.setRequestHeader("If-None-Match",me.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+zt+"; q=0.01":""):p.accepts["*"]);for(h in p.headers)C.setRequestHeader(h,p.headers[h]);if(p.beforeSend&&(p.beforeSend.call(m,C,p)===!1||u))return C.abort();if(x="abort",v.add(p.complete),C.done(p.success),C.fail(p.error),r=Z(Ht,p,n,C)){if(C.readyState=1,d&&g.trigger("ajaxSend",[C,p]),u)return C;p.async&&p.timeout>0&&(l=e.setTimeout(function(){C.abort("timeout")},p.timeout));try{u=!1,r.send(b,i)}catch(k){if(u)throw k;i(-1,k)}}else i(-1,"No Transport");return C},getJSON:function(e,t,n){return me.get(e,t,n,"json")},getScript:function(e,t){return me.get(e,void 0,t,"script")}}),me.each(["get","post"],function(e,t){me[t]=function(e,n,i,r){return me.isFunction(n)&&(r=r||i,i=n,n=void 0),me.ajax(me.extend({url:e,type:t,dataType:r,data:n,success:i},me.isPlainObject(e)&&e))}}),me._evalUrl=function(e){return me.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},me.fn.extend({wrapAll:function(e){var t;return this[0]&&(me.isFunction(e)&&(e=e.call(this[0])),t=me(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return me.isFunction(e)?this.each(function(t){me(this).wrapInner(e.call(this,t))}):this.each(function(){var t=me(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=me.isFunction(e);return this.each(function(n){me(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){me(this).replaceWith(this.childNodes)}),this}}),me.expr.pseudos.hidden=function(e){return!me.expr.pseudos.visible(e); -},me.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},me.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(t){}};var jt={0:200,1223:204},Wt=me.ajaxSettings.xhr();fe.cors=!!Wt&&"withCredentials"in Wt,fe.ajax=Wt=!!Wt,me.ajaxTransport(function(t){var n,i;return fe.cors||Wt&&!t.crossDomain?{send:function(r,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest");for(a in r)s.setRequestHeader(a,r[a]);n=function(e){return function(){n&&(n=i=s.onload=s.onerror=s.onabort=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(jt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),i=s.onerror=n("error"),void 0!==s.onabort?s.onabort=i:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&i()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(l){if(n)throw l}},abort:function(){n&&n()}}:void 0}),me.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),me.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return me.globalEval(e),e}}}),me.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),me.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,r){t=me("