diff --git a/.eslintignore b/.eslintignore
index e9e8489..032e6ed 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -3,3 +3,4 @@ node_modules
/biz/webui/htdocs/src/js/components
/test/assets/values
/test/plugins/whistle.test/assets
+/bin/import.js
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c4bf7fc..ae34c93 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,49 @@
+
+# v2.9.56
+1. feat: 支持通过 `Online / IPv6-only network` 强制 dns 获取 ipv6(命令行版本还可以通过 `-M ipv6Only` 开启)
+2. feat: `w2 add` 命令支持 `type: module`
+# v2.9.55
+1. feat: 显示 `captureError`,且可以通过插件获取到这类型错误的抓包数据
+2. fix: 完善 `refreshPlugins` 方法(内部方法)
+
+# v2.9.54
+1. fix: 修复 Dark Mode 模式下图片显示问题
+2. fix: JSON 过滤搜索时保留数组的 index
+
+# v2.9.53
+1. feat: 支持通过 `enable://forHttp|forHttps` 设置 `enable://capture` 只对 http 或 https 生效
+2. feat: 支持通过请求参数设置登录态
+3. feat: 支持 `Dark Mode`,且可以通过界面 `Online -> 打开对话框 -> Disable dark mode` 关闭自动切换 `Dark Mode`
+
+# v2.9.52
+1. feat: 跨域请求本地替换自动设置 cors,可以通过 `disable://autoCors` 或 `lineProps://disableAutoCors` 关闭
+
+# v2.9.51
+1. fix: https://github.com/avwo/whistle/issues/912
+# v2.9.50
+1. fix: Node 20.1.0 版本 `http.request` 只支持通过 `options.search` 设置参数问题
+2. feat: 支持通过 `--uiport "127.0.0.1:8080"` 限制 WebUI 只能通过指定网卡和端口访问
+
+# v2.9.49
+1. fix: `headerReplace://req.host:pattern=value` 无效问题
+2. feat: 插件添加 `sharedStorage` 方便插件在不同实例中共享存储数据
+3. style: https://github.com/avwo/whistle/pull/898
+
+# v2.9.48
+1. feat: 插件扩展的右键菜单和 Tab 添加 `exportSessions(sessions, type, name)` 方法
+2. feat: 插件 server 的 options 添加 `generateSaz(sessions): Buffer` 和 `extract(saz: Buffer, cb(sessions))` 方法
+3. refactor: 兼容 saz 的 comment,需要配合插件使用:https://github.com/whistle-plugins/whistle.comment.git
+4. fix: 修复访问 socks 代理可能出现 pending 的问题
+5. style: 界面优化
+
+# v2.9.47
+1. refactor: 解决安装时依赖包安全警告问题
+2. feat: 支持自定义右键菜单获取树结点下的所有抓包数据
+
+# v2.9.46
+1. feat: 扩展 Tab 支持 `copyText` 方法
+2. feat: `tpl` 协议支持模板字符串语法
+
# v2.9.45
1. feat: 插件界面提供 `copyText` 方法
2. feat: 支持 `lineProps://strictHtml` 和 `lineProsy://safeHtml` 只对当前行的规则生效
diff --git a/README.md b/README.md
index 373b4c7..9a699d7 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,8 @@
[![NPM count](https://img.shields.io/npm/dt/whistle.svg?style=flat-square)](https://www.npmjs.com/package/whistle)
[![License](https://img.shields.io/npm/l/whistle.svg?style=flat-square)](https://www.npmjs.com/package/whistle)
+**Mac 或 Windows 系统推荐使用客户端版本:https://github.com/avwo/whistle-client**
+
Whistle 是基于 Node 实现的跨平台抓包调试工具,其主要特点:
1. **完全跨平台**:支持 Mac、Windows 等桌面系统,且支持服务端等命令行系统
2. **功能强大(理论上可以对请求做任意修改)**:
diff --git a/assets/fiddler/meta.xml b/assets/fiddler/meta.xml
index 3405b4d..4cb5e88 100644
--- a/assets/fiddler/meta.xml
+++ b/assets/fiddler/meta.xml
@@ -18,5 +18,6 @@
' + util.encodeHtml(util.getErrorStack(err)) + '' : 'Internal Server Error'); +} + +exports.sendError = sendError; + exports.sendGzip = function(req, res, data) { if (!util.canGzip(req)) { return res.json(data); @@ -147,8 +155,7 @@ exports.sendGzip = function(req, res, data) { try { res.json(data); } catch (e) { - res.status(500).send(config.debugMode ? - '
' + util.encodeHtml(util.getErrorStack(err)) + '' : 'Internal Server Error'); + sendError(e); } return; } diff --git a/biz/webui/htdocs/index.html b/biz/webui/htdocs/index.html index 8142a79..8ef8d5e 100644 --- a/biz/webui/htdocs/index.html +++ b/biz/webui/htdocs/index.html @@ -1,13 +1,13 @@ - + -
Note: There are unsaved changes.
'),f(".w-reload-data-tips").html(e).attr("data-name",this.state.name)},componentDidMount:function(){function e(e){if(e=e&&e.trim()){var t=e.indexOf("://")+3;if(e=-1!=t?e.substring(t):e,0===e.indexOf("{"))return t=e.lastIndexOf("}"),t>1?e.substring(1,t):null}}var t=this,n=new M(".w-copy-text");n.on("error",function(e){Y.alert("Copy failed.")}),n=new M(".w-copy-text-with-tips"),n.on("error",function(e){z.error("Copy failed.")}),n.on("success",function(e){z.success("Copied clipboard.")});var r=function(e){e.preventDefault()};k.on("enableRecord",function(){t.enableRecord()}),k.on("showJsonViewDialog",function(e,n){t.refs.jsonDialog.show(n)}),k.on("rulesChanged",function(){t.rulesChanged=!0,t.showReloadRules()}),k.on("switchTreeView",function(){t.toggleTreeView()}),k.on("updateGlobal",function(){t.setState({})}),k.on("valuesChanged",function(){t.valuesChanged=!0,t.showReloadValues()}),k.on("disableAllPlugins",t.disableAllPlugins),k.on("disableAllRules",t.disableAllRules),k.on("activeRules",function(){var e=D.rulesModal;e.exists(D.activeRulesName)&&(t.setRulesActive(D.activeRulesName,e),t.setState({}))}),k.on("activeValues",function(){var e=D.valuesModal;e.exists(D.activeValuesName)&&(t.setValuesActive(D.activeValuesName,e),t.setState({}))});var i;k.on("openEditor",function(e,n){try{if(i&&"function"==typeof i.setValue)return window.getTextFromWhistle_=null,t.refs.editorWin.show(),i.setValue(n);window._initWhistleTextEditor_=function(e){i=e,i.setValue(n)},t.refs.editorWin.show("editor.html")}catch(r){}}),k.on("addNewRulesFile",function(e,n){var r=n.filename,o=t.state.rules.add(r,n.data);t.setRulesActive(r),t.setState({activeRules:o}),t.triggerRulesChange("create")}),k.on("addNewValuesFile",function(e,n){var r=n.filename,o=t.state.values.add(r,n.data);t.setValuesActive(r),t.setState({activeValues:o}),t.triggerValuesChange("create")}),k.on("recoverRules",function(e,n){var r=t.state.rules,o=n.filename,i=function(e){e&&D.rules.add({name:o,value:n.data,recycleFilename:n.name},function(e,i){if(e&&0===e.ec){var a=r.add(o,n.data);t.setRulesActive(o),t.setState({activeRules:a}),t.triggerRulesChange("create"),k.trigger("rulesRecycleList",e),k.trigger("focusRulesList")}else S.showSystemError(i)})};return r.exists(o)?void Y.confirm("The name `"+o+"` already exists, whether to overwrite it?",i):i(!0)}),k.on("recoverValues",function(e,n){var r=t.state.values,o=n.filename,i=function(e){e&&D.values.add({name:o,value:n.data,recycleFilename:n.name},function(e,i){if(e&&0===e.ec){var a=r.add(o,n.data);t.setValuesActive(o),t.setState({activeValues:a}),t.triggerValuesChange("create"),k.trigger("valuesRecycleList",e)}else S.showSystemError(i)})};return r.exists(o)?void Y.confirm("The name `"+o+"` already exists, whether to overwrite it?",i):i(!0)}),f(document).on("dragleave",r).on("dragenter",r).on("dragover",r).on("drop",function(e){e.preventDefault();var n=e.originalEvent.dataTransfer.files,r=n&&n[0];if(r){if(f(".w-files-dialog.in").length)return k.trigger("uploadFile",r);var o,i=t.state.name,a=f(e.target);if("network"===i){if(a.closest(".w-frames-composer").length)return;if(/\.log$/i.test(r.name))return r.size>Z?Y.alert("The file size cannot exceed 2m."):void S.readFileAsText(r,function(e){e=S.parseLogs(e),e&&(null!==D.uploadLogs&&(D.uploadLogs=e),k.trigger("showLog"),k.trigger("uploadLogs",{logs:e}))});o=new FormData,o.append("importSessions",n[0]),t.uploadSessionsForm(o)}a.closest(".w-divider-left").length&&("rules"===i?(o=new FormData,o.append("rules",n[0]),t.rulesForm=o,t.refs.confirmImportRules.show()):"values"===i&&(o=new FormData,o.append("values",n[0]),t.valuesForm=o,t.refs.confirmImportValues.show()))}}).on("keydown",function(e){(e.metaKey||e.ctrlKey)&&82===e.keyCode&&e.preventDefault()});var a=function(e){var n=e.target;"A"==n.nodeName&&f(n).parent().hasClass("w-list-data")&&("rules"==t.state.name?t.removeRules():t.removeValues()),e.preventDefault()};f(window).on("hashchange",function(){var e=s(t.state);e&&-1==e.indexOf("rules")?-1!=e.indexOf("values")?t.showValues():-1!=e.indexOf("plugins")?t.showPlugins():t.showNetwork():t.showRules()}).on("keyup",function(e){if(27==e.keyCode){t.setMenuOptionsState();var n=f(".modal");"function"==typeof n.modal&&n.modal("hide")}}).on("keydown",function(e){if(46==e.keyCode&&a(e),!e.ctrlKey&&!e.metaKey)return void(112===e.keyCode?(e.preventDefault(),window.open("https://avwo.github.io/whistle/webui/"+t.state.name+".html")):116===e.keyCode&&e.preventDefault());77===e.keyCode?(t.toggleLeftMenu(),e.preventDefault()):66===e.keyCode&&(t.toggleTreeView(),e.preventDefault(),k.trigger("toggleTreeViewByAccessKey"));var n="network"===t.state.name;n&&88==e.keyCode&&(S.isFocusEditor()||f(e.target).closest(".w-frames-list").length||t.clear()),68==e.keyCode&&a(e);var r=t.state.network;if(n&&83===e.keyCode){if(e.preventDefault(),f(".modal.in").length)return void(f(A.findDOMNode(t.refs.chooseFileType)).is(":visible")&&t.exportBySave());var o=e.target.nodeName;if("INPUT"===o||"TEXTAREA"===o)return;var i=r.hasSelected();return void(i&&(f(A.findDOMNode(t.refs.chooseFileType)).modal("show"),setTimeout(function(){A.findDOMNode(t.refs.sessionsName).focus()},500)))}n&&73===e.keyCode&&(t.importSessions(e),e.preventDefault())});var c=function(){var e=t.state.name;return"rules"===e||"values"===e};f(document.body).on("mouseenter",$,function(t){if(c()&&(t.ctrlKey||t.metaKey)){var n=f(this);(n.hasClass("cm-js-http-url")||n.hasClass("cm-string")||n.hasClass("cm-js-at")||e(n.text()))&&n.addClass("w-is-link")}}).on("mouseleave",$,function(e){f(this).removeClass("w-is-link")}).on("mousedown",$,function(n){if(c()&&(n.ctrlKey||n.metaKey)){var r=f(this),o=r.text();if(r.hasClass("cm-js-at"))return void(te.test(o)&&window.open((RegExp.$1||"http:")+RegExp.$2));if(r.hasClass("cm-string"))return void(ee.test(o)&&window.open((RegExp.$1||"http:")+RegExp.$2));if(r.hasClass("cm-js-http-url"))return/^https?:\/\//i.test(o)||(o="http:"+("/"===o[0]?"":"//")+o),void window.open(o);var i=e(o);return i?void t.showAndActiveValues({name:i}):void 0}}),"network"==t.state.name&&t.startLoadData(),D.on("settings",function(e){var n=t.state,r=e.server,o=r.account&&r.account.url;if(n.interceptHttpsConnects!==e.interceptHttpsConnects||n.enableHttp2!==e.enableHttp2||n.disabledAllRules!==e.disabledAllRules||n.allowMultipleChoice!==e.allowMultipleChoice||n.disabledAllPlugins!==e.disabledAllPlugins||n.backRulesFirst!==e.backRulesFirst||n.multiEnv!=r.multiEnv||n.ndp!=r.ndp||n.ndr!=r.ndr||n.drb!=r.drb||n.drm!=r.drm){n.interceptHttpsConnects=e.interceptHttpsConnects,n.enableHttp2=e.enableHttp2,n.disabledAllRules=e.disabledAllRules,n.allowMultipleChoice=e.allowMultipleChoice,n.backRulesFirst=e.backRulesFirst,n.disabledAllPlugins=e.disabledAllPlugins,n.multiEnv=r.multiEnv,n.ndp=r.ndp,n.ndr=r.ndr,n.drb=r.drb,n.drm=r.drm,L.setPlugins(n);var i=oe;return i[3].checked=!n.disabledAllRules,i[4].checked=!n.disabledAllPlugins,t.setState({accountUrl:o}),void t.refs.contextMenu.update()}n.accountUrl!==o&&t.setState({accountUrl:o})}),D.on("rules",function(e){var n=t.state.rules,r=e.list;e.defaultRulesIsDisabled||-1!==r.indexOf("Default")||r.unshift("Default");var o=n.getSelectedNames();l(o,r)||(t.reselectRules(e,!0),t.setState({}))}),D.on("serverInfo",function(e){t.serverInfo=e}),k.on("executeComposer",function(){t.autoRefresh&&t.autoRefresh()});var u=function(e){if(Array.isArray(e))return e;if(e&&!e.selected)return[e]};k.on("updateUI",function(){t.setState({})}),k.on("replaySessions",function(e,n,r){var o=t.state.network,i=u(n)||o.getSelectedList(),a=i&&i.length;return r&&1===a?(t.replayList=i,t.refs.setReplayCount.show(),void setTimeout(function(){var e=A.findDOMNode(t.refs.replayCount);e.select(),e.focus()},300)):void t.replay(e,i)}),k.on("importSessions",t.importSessions),k.on("filterSessions",t.showSettings),k.on("exportSessions",function(e,n){t.exportData(e,u(n))}),k.on("abortRequest",function(e,n){t.abort(u(n))}),k.on("uploadSessions",function(e,n){var r=u(n&&n.curItem),o=n&&n.upload;if("function"==typeof o){if(!r){var i=t.state.network;r=i.getSelectedList(),r&&r.length&&(r=f.extend(!0,[],r))}r&&o(r)}}),k.on("removeIt",function(e,n){var r=t.state.network;n&&r&&(r.remove(n),t.setState({}))}),k.on("removeOthers",function(e,n){var r=t.state.network;n&&r&&(n.selected?r.removeUnselectedItems():r.removeOthers(n),t.setState({}))}),k.on("clearAll",t.clear),k.on("removeSelected",function(){var e=t.state.network;e&&(e.removeSelectedItems(),t.setState({}))}),k.on("removeUnselected",function(){var e=t.state.network;e&&(e.removeUnselectedItems(),t.setState({}))}),k.on("removeUnmarked",function(){var e=t.state.network;e&&(e.removeUnmarkedItems(),t.setState({}))}),k.on("saveRules",function(e,n){if(n.changed||!n.selected){var r=t.state.rules.getChangedGroupList(n);r.forEach(t.selectRules)}else t.unselectRules(n)}),k.on("saveValues",function(e,n){var r=t.state.values.getChangedGroupList(n);r.forEach(t.saveValues)}),k.on("renameRules",function(e,n){t.showEditRules(n)}),k.on("renameValues",function(e,n){t.showEditValues(n)}),k.on("deleteRules",function(e,n){setTimeout(function(){t.removeRules(n)},0)}),k.on("deleteValues",function(e,n){setTimeout(function(){t.removeValues(n)},0)}),k.on("createRules",t.showCreateRules),k.on("createValues",t.showCreateValues),k.on("exportRules",t.exportData),k.on("exportValues",t.exportData),k.on("importRules",t.importRules),k.on("importValues",t.importValues),k.on("uploadRules",function(e,n){var r=o(n);r.append("replaceAll","1"),t._uploadRules(r,!0)}),k.on("uploadValues",function(e,n){var r=o(n,"values");r.append("replaceAll","1"),t._uploadValues(r,!0)});var d,p,g=document.hidden;f(document).on("visibilitychange",function(){clearTimeout(d);var e="network"===t.state.name;return document.hidden||!e?void(e&&g!==document.hidden&&(g=!0,p=t.scrollerAtBottom&&t.scrollerAtBottom())):(g=!1,void(d=setTimeout(function(){var e=p||t.scrollerAtBottom&&t.scrollerAtBottom();p=!1,t.setState({},function(){e&&t.autoRefresh()})},100)))}),setTimeout(function(){D.checkUpdate(function(e){e&&e.showUpdate&&t.setState({version:e.version,latestVersion:e.latestVersion},function(){f(A.findDOMNode(t.refs.showUpdateTipsDialog)).modal("show")})})},1e4),D.getLogIdList=this.getLogIdListFromRules,D.importAnySessions=t.importAnySessions,D.on("plugins",function(e){var n=t.createPluginsOptions(e.plugins),r=t.state.pluginsOptions,o=t.state.disabledPlugins,i=t.state.disabledAllPlugins,a=e.disabledPlugins;if(i==e.disabledAllPlugins&&n.length==r.length){for(var s,l=0,c=n.length;c>l;l++){var u=n[l],d=r[l];if(u.name!=d.name||u.latest!==d.latest||u.mtime!=d.mtime||o[u.name]!=a[u.name]||u.hideLongProtocol!=d.hideLongProtocol||u.hideShortProtocol!=d.hideShortProtocol||u.path!=d.path){s=!0;break}}if(!s)return}var p=t.state.plugins;p&&e.plugins&&Object.keys(e.plugins).forEach(function(t){var n=p[t];if(n){var r=e.plugins[t];r.selectedRulesHistory=n.selectedRulesHistory,r.selectedValuesHistory=n.selectedValuesHistory}});var g={plugins:e.plugins,disabledPlugins:e.disabledPlugins,pluginsOptions:n,disabledAllPlugins:e.disabledAllPlugins};L.setPlugins(g),t.setState(g)});try{var h=window.parent.onWhistleReady;"function"==typeof h&&h({url:location.href,pageId:D.getPageId(),compose:D.compose,importSessions:t.importAnySessions,importHarSessions:t.importHarSessions,clearSessions:t.clear,selectIndex:function(e){k.trigger("selectedIndex",e)}})}catch(m){}},shouldComponentUpdate:function(e,t){var n=this.state.name;return"network"===n&&t.name!==n&&(this._isAtBottom=this.scrollerAtBottom&&this.scrollerAtBottom()),!0},importAnySessions:function(e){e&&(Array.isArray(e)?D.addNetworkList(e):this.importHarSessions(e))},donotShowAgain:function(){D.donotShowAgain()},hideUpdateTipsDialog:function(){f(A.findDOMNode(this.refs.showUpdateTipsDialog)).modal("hide")},getAllRulesText:function(){var e=" "+this.getAllRulesValue();return e.replace(/#[^\r\n]*[\r\n]/g,"\n")},getLogIdListFromRules:function(){var e=this.getAllRulesText();if(e=e.match(/\slog:\/\/(?:\{[^\s]{1,36}\}|[^/\\{}()<>\s]{1,36})\s/g)){var t={};e=e.map(function(e){return e=S.removeProtocol(e.trim()),"{"===e[0]&&(e=e.slice(1,-1)),e}).filter(function(e){return e?t[e]?!1:(t[e]=1,!0):!1})}return e},getWeinreFromRules:function(){var e=this.state.values,t=this.getAllRulesText();if(t=t.match(/(?:^|\s)weinre:\/\/[^\s#]+(?:$|\s)/gm)){var n={};t=t.map(function(t){t=S.removeProtocol(t.trim());var n=u(t);if(n!==!1)return n;var r=c(t);return r!==!1?(r=e.get(r),r&&r.value):t}).filter(function(e){return e?n[e]?!1:(n[e]=1,!0):!1})}return t},getValuesFromRules:function(){var e=" "+this.getAllRulesValue();return(e=e.match(/\s(?:[\w-]+:\/\/)?\{[^\s#]+\}/g))&&(e=e.map(function(e){return c(S.removeProtocol(e.trim()))}).filter(function(e){return!!e})),e},getAllRulesValue:function(){var e=[],t=[],n=[],r=this.state.rules;return r.list.forEach(function(o){var i=r.get(o),a=i.value||"";i.active?t.push(a):i.selected?n.push(a):e.push(a)}),r=this.state.values,r.list.forEach(function(t){/\.rules$/.test(t)&&e.push(r.get(t).value)}),t.concat(n).concat(e).join("\r\n")},preventBlur:function(e){"INPUT"!=e.target.nodeName&&e.preventDefault()},startLoadData:function(){function e(o,a){o=o||r.state.network,clearTimeout(i),i=null,"network"==r.state.name&&(a=a||n(),o.update(a)&&a&&(i=setTimeout(e,3e3)),document.hidden||r.setState({},function(){a&&t()}))}function t(e){(e||!r.state.network.isTreeView)&&(s.scrollTop=1e7)}function n(){var e=a.find(".ReactVirtualized__Grid__innerScrollContainer")[0];return e?s.scrollTop+s.offsetHeight+5>e.offsetHeight:!0}var r=this;if(r._updateNetwork)return void r._updateNetwork();var o,i,a=f(".w-req-data-list .ReactVirtualized__Grid:first").scroll(function(){var t=r.state.network;o&&clearTimeout(o),o=null,n()&&(o=setTimeout(function(){e(t,!0)},1e3))}),s=a[0];this.container=a,D.on("data",e),f(document).on("dblclick",".w-network-menu-list",function(e){f(e.target).hasClass("w-network-menu-list")&&(s.scrollTop<1?t(!0):s.scrollTop=0)}),r._updateNetwork=e,r.autoRefresh=t,r.scrollerAtBottom=n},showPlugins:function(e){"plugins"!=this.state.name?(this.setMenuOptionsState(),this.hidePluginsOptions()):e&&!this.state.showLeftMenu&&this.showPluginsOptions(),this.setState({hasPlugins:!0,name:"plugins"}),S.changePageName("plugins")},handleAction:function(e){if("top"===e)return void(this.container[0].scrollTop=0);if("bottom"===e)return this.autoRefresh(!0);if("pause"===e)return k.trigger("changeRecordState",e),D.pauseNetworkRecord();var t="refresh"===e;return t?k.trigger("changeRecordState"):k.trigger("changeRecordState","stop"),D.stopNetworkRecord(!t),t?this.autoRefresh():void 0},showNetwork:function(e){var t=this;return"network"==t.state.name?void(e&&!t.state.showLeftMenu&&t.showNetworkOptions()):(t.setMenuOptionsState(),t.setState({hasNetwork:!0,name:"network"},function(){t.startLoadData(),t._isAtBottom&&(t._isAtBottom=!1,t.autoRefresh&&t.autoRefresh())}),void S.changePageName("network"))},handleNetwork:function(e,t){var n=this.state.network;"removeAll"==e.id?this.clear():"removeSelected"==e.id?n.removeSelectedItems():"removeUnselected"==e.id?n.removeUnselectedItems():"exportWhistleFile"==e.id?this.exportSessions("whistle"):"exportSazFile"==e.id?this.exportSessions("Fiddler"):"exportHarFile"==e.id?this.exportSessions("har"):"importSessions"==e.id?this.importSessions(t):"toggleView"===e.id&&this.toggleTreeView(),this.hideNetworkOptions()},importData:function(e){switch(this.state.name){case"network":this.importSessions(e);break;case"rules":this.importRules(e);break;case"values":this.importValues(e)}},exportData:function(e,t){switch(this.state.name){case"network":var n=this.state.network,r=Array.isArray(t)||n.hasSelected();if(this.currentFoucsItem=t,r){f(A.findDOMNode(this.refs.chooseFileType)).modal("show");var o=this;setTimeout(function(){A.findDOMNode(o.refs.sessionsName).focus()},500)}else z.info("Please select the sessions first.");break;case"rules":this.showAndActiveRules({id:"exportRules"});break;case"values":this.showAndActiveValues({id:"exportValues"})}},importSessions:function(e,t){var n=this,r=e&&e.shiftKey||t&&t.shiftKey;return r?(n.refs.importRemoteSessions.show(),void setTimeout(function(){var e=A.findDOMNode(n.refs.sessionsRemoteUrl);e.focus(),e.select()},500)):void A.findDOMNode(n.refs.importSessions).click()},importSessionsFromUrl:function(e,t){if(e){var n=this;n.setState({pendingSessions:!0}),D.importRemote({url:e},a(function(e,r){n.setState({pendingSessions:!1}),e||(t&&n.refs.importRemoteSessions.hide(),n.importAnySessions(r))}))}},importRemoteSessions:function(e){if(!e||"click"===e.type||13===e.keyCode){var t=this,n=A.findDOMNode(t.refs.sessionsRemoteUrl),r=i(n.value);t.importSessionsFromUrl(r,!0)}},importRules:function(e,t){var n=this,r=e&&e.shiftKey||t&&t.shiftKey;return r?(n.refs.importRemoteRules.show(),void setTimeout(function(){var e=A.findDOMNode(n.refs.rulesRemoteUrl);e.focus(),e.select()},500)):void A.findDOMNode(n.refs.importRules).click()},importRemoteRules:function(e){if(!e||"click"===e.type||13===e.keyCode){var t=this,n=A.findDOMNode(t.refs.rulesRemoteUrl),r=i(n.value);r&&(t.setState({pendingRules:!0}),D.importRemote({url:r},a(function(e,n){t.setState({pendingRules:!1}),e||(t.refs.importRemoteRules.hide(),n&&(t.rulesForm=o(n),t.refs.confirmImportRules.show()))})))}},importValues:function(e,t){var n=this,r=e&&e.shiftKey||t&&t.shiftKey;return r?(n.refs.importRemoteValues.show(),void setTimeout(function(){var e=A.findDOMNode(n.refs.valuesRemoteUrl);e.focus(),e.select()},500)):void A.findDOMNode(n.refs.importValues).click()},importRemoteValues:function(e){if(!e||"click"===e.type||13===e.keyCode){var t=this,n=A.findDOMNode(t.refs.valuesRemoteUrl),r=i(n.value);r&&(t.setState({pendingValues:!0}),D.importRemote({url:r},a(function(e,n){t.setState({pendingValues:!1}),e||(t.refs.importRemoteValues.hide(),n&&(t.valuesForm=o(n,"values"),t.refs.confirmImportValues.show()))})))}},_uploadRules:function(e,t){var n=this;D.upload.importRules(e,function(e,r){e?0===e.ec?(n.reloadRules(e),t&&z.success("Successful synchronization Rules.")):Y.alert(e.em):S.showSystemError(r)})},_uploadValues:function(e,t){var n=this;D.upload.importValues(e,function(e,r){e||S.showSystemError(r),0===e.ec?(n.reloadValues(e),t&&z.success("Successful synchronization Values.")):Y.alert(e.em)})},uploadRules:function(e){var t=this.rulesForm;if(this.rulesForm=null,t){var n=t.get("rules");if(!n||!/\.(txt|json)$/i.test(n.name))return Y.alert("Only supports .txt or .json file.");if(n.size>K)return Y.alert("The file size cannot exceed 6m.");f(e.target).hasClass("btn-danger")&&t.append("replaceAll","1"),this._uploadRules(t),A.findDOMNode(this.refs.importRules).value=""}},uploadValues:function(e){var t=this.valuesForm;if(this.valuesForm=null,t){var n=t.get("values");if(!n||!/\.(txt|json)$/i.test(n.name))return Y.alert("Only supports .txt or .json file.");if(n.size>K)return Y.alert("The file size cannot exceed 6m.");f(e.target).hasClass("btn-danger")&&t.append("replaceAll","1"),this._uploadValues(t),A.findDOMNode(this.refs.importValues).value=""}},uploadRulesForm:function(){this.rulesForm=new FormData(A.findDOMNode(this.refs.importRulesForm)),this.refs.confirmImportRules.show()},uploadValuesForm:function(){this.valuesForm=new FormData(A.findDOMNode(this.refs.importValuesForm)),this.refs.confirmImportValues.show()},showAndActiveRules:function(e,t){if("rules"===this.state.name)switch(e.id){case"exportRules":this.refs.selectRulesDialog.show();break;case"importRules":this.importRules(t)}else this.setRulesActive(e.name),this.showRules();this.hideRulesOptions()},showRules:function(e){"rules"!=this.state.name?(this.setMenuOptionsState(),this.hideRulesOptions()):e&&!this.state.showLeftMenu&&this.showRulesOptions(e),this.setState({hasRules:!0,name:"rules"}),S.changePageName("rules")},showAndActiveValues:function(e,t){var n=this;if("values"===n.state.name&&e.id)switch(e.id){case"exportValues":n.refs.selectValuesDialog.show();break;case"importValues":this.importValues(t)}else{var r=n.state.values,o=e.name;r.exists(o)?n.setValuesActive(o):D.values.add({name:o},function(e,t){if(e&&0===e.ec){var i=r.add(o);n.setValuesActive(o),n.setState({activeValues:i}),k.trigger("focusValuesList")}else S.showSystemError(t)}),this.showValues()}n.hideValuesOptions()},addValue:function(){},showValues:function(e){"values"!=this.state.name?(this.setMenuOptionsState(),this.hideValuesOptions()):e&&!this.state.showLeftMenu&&this.showValuesOptions(e),this.setState({hasValues:!0,name:"values"}),S.changePageName("values")},showNetworkOptions:function(){"network"==this.state.name&&this.setState({showNetworkOptions:!0})},hideNetworkOptions:function(){this.setState({showRemoveOptions:!1,showAbortOptions:!1,showNetworkOptions:!1})},showRemoveOptions:function(){this.setState({showRemoveOptions:!0})},showAbortOptions:function(){var e=this.state.network,t=e.getSelectedList();le[0].disabled=!t||!t.filter(S.canAbort).length,this.setState({showAbortOptions:!0})},showCreateOptions:function(){this.setState({showCreateOptions:!0})},hideCreateOptions:function(){this.setState({showCreateOptions:!1})},hideRemoveOptions:function(){this.setState({showRemoveOptions:!1})},hideAbortOptions:function(){this.setState({ -showAbortOptions:!1})},showHelpOptions:function(){this.setState({showHelpOptions:!0})},hideHelpOptions:function(){this.setState({showHelpOptions:!1})},showHasNewVersion:function(e){this.setState({hasNewVersion:e})},showRulesOptions:function(e){var t,n=this,r=n.state.rules,o=r.data,i=r.list;if("rules"===n.state.name){var a=i.length;ie[0].disabled=2>a,ie[1].disabled=1>a,t=ie}else t=[],i.forEach(function(e){t.push(o[e])});n.setState({rulesOptions:t,showRulesOptions:!0})},hideRulesOptions:function(){this.setState({showRulesOptions:!1})},showValuesOptions:function(e){var t,n=this,r=this.state.values.list;if("values"===n.state.name){var o=r.length;ae[0].disabled=2>o,ae[1].disabled=1>o,t=ae}else{t=[];var i=n.getValuesFromRules()||[];i=S.unique(r.concat(i));var a=[];i.forEach(function(e){var n=-1!=r.indexOf(e),o={name:e,icon:n?"edit":"plus"};n?t.push(o):a.push(o)}),t=a.concat(t)}n.setState({valuesOptions:t,showValuesOptions:!0})},hideValuesOptions:function(){this.setState({showValuesOptions:!1})},showAndActivePlugins:function(e){this.hidePluginsOptions(),this.showPlugins(),this.showPluginTab(e.name)},showPluginTab:function(e){var t="Home",n=this.state.tabs||[];if(e&&e!=t)for(var r=0,o=n.length;o>r;r++)if(n[r].name==e){t=e,e=null;break}var i=e&&this.state.plugins[e+":"];if(i){if(n.length>=_)return Y.alert("At most "+_+" tabs can be opened at the same time."),this.showPlugins();if(t=e,i.pluginHomepage&&!i.openInPlugins)return window.open(i.pluginHomepage);n.push({name:e,url:i.pluginHomepage||"plugin."+e+"/"})}this.setState({active:t,tabs:n}),this.updatePluginTabInfo(n,t)},updatePluginTabInfo:function(e,t){e=e.map(function(e){return e.name}),j.set("activePluginTabList",JSON.stringify(e)),t&&j.set("activePluginTabName",t)},activePluginTab:function(e){this.showPluginTab(f(e.target).attr("data-name"))},closePluginTab:function(e){for(var t=f(e.target).attr("data-name"),n=this.state.tabs||[],r=0,o=n.length;o>r;r++)if(n[r].name==t){n.splice(r,1);var i=this.state.active;if(i==t){var a=n[r]||n[r-1];this.state.active=a?a.name:null}return this.setState({tabs:n}),void this.updatePluginTabInfo(n)}},showPluginsOptions:function(e){this.setState({showPluginsOptions:!0})},hidePluginsOptions:function(){this.setState({showPluginsOptions:!1})},showWeinreOptionsQuick:function(e){var t=this.getWeinreFromRules();return t&&t.length?void f(e.target).closest("div").addClass("w-menu-wrapper-show"):void this.showAnonymousWeinre()},showWeinreOptions:function(e){var t=this,n=t.state.weinreOptions=t.getWeinreFromRules()||[];t.state.weinreOptions=S.unique(n).map(function(e){return{name:e,icon:"console"}}),t.setState({showWeinreOptions:!0})},hideWeinreOptions:function(){this.setState({showWeinreOptions:!1})},setMenuOptionsState:function(e,t){var n={showCreateRules:!1,showCreateValues:!1,showEditRules:!1,showEditValues:!1,showCreateOptions:!1};e&&(n[e]=!0),this.setState(n,t)},hideRulesInput:function(){this.setState({showCreateRules:!1})},hideValuesInput:function(){this.setState({showCreateValues:!1})},hideRenameRuleInput:function(){this.setState({showEditRules:!1})},hideRenameValueInput:function(){this.setState({showEditValues:!1})},showCreateRules:function(e,t){var n=A.findDOMNode(this.refs.createRulesInput);this._curFocusRulesItem=t,this.setState({showCreateRules:!0},function(){n.focus()})},showCreateValues:function(e,t){var n=A.findDOMNode(this.refs.createValuesInput);this._curFocusValuesItem=t,this.setState({showCreateValues:!0},function(){n.focus()})},showHttpsSettingsDialog:function(){f(A.findDOMNode(this.refs.rootCADialog)).modal("show")},showAccountDialog:function(){this.refs.accountDialog.show(this.state.accountUrl)},interceptHttpsConnects:function(e){var t=this,n=e.target.checked;D.interceptHttpsConnects({interceptHttpsConnects:n?1:0},function(e,r){e&&0===e.ec?t.state.interceptHttpsConnects=n:S.showSystemError(r),t.setState({})})},enableHttp2:function(e){if(!D.supportH2){var t=this;return void Y.confirm("The current version of Node.js cannot support HTTP/2.\nPlease upgrade to the latest LTS version.",function(e){e&&window.open("https://nodejs.org/"),t.setState({})})}var n=e.target.checked;D.enableHttp2({enableHttp2:n?1:0},function(e,r){e&&0===e.ec?t.state.enableHttp2=n:S.showSystemError(r),t.setState({})})},createRules:function(e){if(13==e.keyCode||"click"==e.type){var t=this,n=A.findDOMNode(t.refs.createRulesInput),r=n.value.trim();if(!r)return void z.error("The name cannot be empty.");var o,i=t.state.rules,a=e&&e.target.getAttribute("data-type");if("group"===a&&(o=!0,r="\r"+r),i.exists(r))return void z.error("The name '"+r+"' already exists.");var s="top"===a?1:"",l=t._curFocusRulesItem,c={name:r,addToTop:s};l&&(c.groupName=l.name),D.rules.add(c,function(e,a){if(e&&0===e.ec){var l=i[s?"unshift":"add"](r);n.value="",n.blur(),i.moveToGroup(r,c.groupName,s),!o&&t.setRulesActive(r),c.groupName&&k.trigger("expandRulesGroup",c.groupName),t.setState(o?{}:{activeRules:l},function(){o&&k.trigger("scrollRulesBottom")}),t.triggerRulesChange("create")}else S.showSystemError(a)})}},createValues:function(e){if(13==e.keyCode||"click"==e.type){var t=this,n=A.findDOMNode(t.refs.createValuesInput),r=n.value.trim();if(!r)return void z.error("The name cannot be empty.");if(/\s/.test(r))return void z.error("The name cannot contain spaces.");if(/#/.test(r))return void z.error("The name cannot contain #.");var o,i=t.state.values,a=e&&e.target.getAttribute("data-type");if("group"===a&&(o=!0,r="\r"+r),i.exists(r))return void z.error("The name '"+r+"' already exists.");var s=t._curFocusValuesItem,l={name:r};s&&(l.groupName=s.name),D.values.add(l,function(e,a){if(e&&0===e.ec){var s=i.add(r);n.value="",n.blur(),i.moveToGroup(r,l.groupName),!o&&t.setValuesActive(r),l.groupName&&k.trigger("expandValuesGroup",l.groupName),t.setState(o?{}:{activeValues:s},function(){o&&k.trigger("scrollValuesBottom")}),t.triggerValuesChange("create")}else S.showSystemError(a)})}},showEditRules:function(e){this.currentFocusRules=e;var t=this.state.rules,n=e||t.getActive();if(n&&!n.isDefault){var r=A.findDOMNode(this.refs.editRulesInput);r.value=n.name,this.setState({showEditRules:!0,selectedRule:n},function(){r.select(),r.focus()})}},showEditValuesByDBClick:function(e){!e.changed&&this.showEditValues()},showEditValues:function(e){this.currentFocusValues=e;var t=this.state.values,n=e||t.getActive();if(n&&!n.isDefault){var r=A.findDOMNode(this.refs.editValuesInput);r.value=n.name,this.setState({showEditValues:!0,selectedValue:n},function(){r.select(),r.focus()})}},editRules:function(e){if(13==e.keyCode||"click"==e.type){var t=this,n=t.state.rules,r=this.currentFocusRules||n.getActive();if(r){var o=A.findDOMNode(t.refs.editRulesInput),i=S.isGroup(r.name),a=(i?"\r":"")+o.value.trim();if(!a)return void z.error("The name cannot be empty.");if(n.exists(a))return void z.error("The name '"+a+"' already exists.");var s=r.name;D.rules.rename({name:s,newName:a},function(e,r){e&&0===e.ec?(n.rename(s,a),o.value="",o.blur(),!i&&t.setRulesActive(a),k.trigger("rulesNameChanged",[s,a]),t.setState({activeRules:n.getActive()}),t.triggerRulesChange("rename")):S.showSystemError(r)})}}},editValues:function(e){if(13==e.keyCode||"click"==e.type){var t=this,n=t.state.values,o=this.currentFocusValues||n.getActive();if(o){var i=A.findDOMNode(t.refs.editValuesInput),a=S.isGroup(o.name),s=(a?"\r":"")+i.value.trim();if(!s)return void z.error("The name cannot be empty.");if(n.exists(s))return void z.error("The name '"+s+"' already exists.");var l=o.name;D.values.rename({name:l,newName:s},function(e,c){e&&0===e.ec?(n.rename(l,s),i.value="",i.blur(),!a&&t.setValuesActive(s),k.trigger("valuesNameChanged",[l,s]),t.setState({activeValues:n.getActive()}),t.triggerValuesChange("rename"),r(o)):S.showSystemError(c)})}}},showAnonymousWeinre:function(){this.openWeinre()},showWeinre:function(e){this.openWeinre(e.name)},openWeinre:function(e){window.open("weinre/client/#"+(e||"anonymous")),this.setState({showWeinreOptions:!1})},onClickRulesOption:function(e){e.selected?this.unselectRules(e):this.selectRules(e)},selectRules:function(e){if(!S.isGroup(e.name)){var t=this;return D.rules[e.isDefault?"enableDefault":"select"](e,function(n,r){n&&0===n.ec?(t.reselectRules(n),t.state.rules.setChanged(e.name,!1),t.setState({}),t.triggerRulesChange("save"),t.state.disabledAllRules&&Y.confirm("Rules has been turn off, do you want to turn on it?",function(e){e&&D.rules.disableAllRules({disabledAllRules:0},function(e,n){e&&0===e.ec?(t.state.disabledAllRules=!1,t.setState({})):S.showSystemError(n)})})):S.showSystemError(r)}),!1}},selectRulesByOptions:function(e){var t=this.state.rules.data[f(e.target).attr("data-name")];this[e.target.checked?"selectRules":"unselectRules"](t)},unselectRules:function(e){var t=this;return D.rules[e.isDefault?"disableDefault":"unselect"](e,function(e,n){e&&0===e.ec?(t.reselectRules(e),t.setState({})):S.showSystemError(n)}),!1},reselectRules:function(e,t){var n=this;n.state.rules.clearAllSelected(),n.setSelected(n.state.rules,"Default",!e.defaultRulesIsDisabled,t),e.list.forEach(function(e){n.setSelected(n.state.rules,e,!0,t)})},saveValues:function(e){if(e.changed&&!S.isGroup(e.name)){var t=this;return D.values.add(e,function(n,o){n&&0===n.ec?(t.setSelected(t.state.values,e.name),t.triggerValuesChange("save"),r(e)):S.showSystemError(o)}),!1}},setSelected:function(e,t,n,r){e.setSelected(t,n)&&(r||e.setChanged(t,!1),this.setState({curSelectedName:t}))},replayCountChange:function(e){var t=e.target.value.replace(/^\s*0*|[^\d]+/,""),n=t.slice(0,3);n>q&&(n=q),this.setState({replayCount:n})},clickReplay:function(e){e.shiftKey?k.trigger("replaySessions",[null,e.shiftKey]):this.replay(e)},replay:function(e,t,n){var r=this.state.network;if(t=Array.isArray(t)?t:r.getSelectedList(),t&&t.length){this.enableRecord();var o,i=function(e,t){var n=e.req;D.compose2({repeatCount:t,useH2:e.useH2?1:"",url:e.url,headers:S.getOriginalReqHeaders(e),method:n.method,base64:n.base64})};if(n>1?i(t[0],Math.min(n,q)):(o={},t.slice(0,q).forEach(function(e){o[e.id]=1,i(e)})),r.isTreeView){var a=D.lastSelectedDataId;if(!a)return;if(!o)return k.trigger("replayTreeView",[a,n]);var s=a&&r.getTreeNode(a);if(s=s&&s.parent,!s)return;n=0,s.children.forEach(function(e){e=e.data,e&&o[e.id]&&++n}),k.trigger("replayTreeView",[a,n])}else this.autoRefresh&&this.autoRefresh()}},enableRecord:function(){this.refs.recordBtn.enable(),k.trigger("changeRecordState")},composer:function(){k.trigger("composer")},clear:function(){var e=this.state.network;this.setState({network:e.clear(),showRemoveOptions:!1})},removeRulesBatch:function(e){var t=this;D.rules.remove({list:e},function(n,r){if(n&&0===n.ec){var o,i=t.state.rules;e.forEach(function(e){var n=i.data[e]||"";n.active&&(o=i.getSibling(e),o&&t.setRulesActive(o.name)),i.remove(e)}),o&&k.trigger("expandRulesGroup",o.name),t.setState(o?{activeRules:o}:{}),t.triggerRulesChange("remove"),k.trigger("focusRulesList")}else S.showSystemError(r)}),this.refs.deleteRulesDialog.hide()},removeValuesBatch:function(e){var t=this;D.values.remove({list:e},function(n,r){if(n&&0===n.ec){var o,i=t.state.values;e.forEach(function(e){var n=i.data[e]||"";n.active&&(o=i.getSibling(e),o&&t.setValuesActive(o.name)),i.remove(e)}),o&&k.trigger("expandValuesGroup",o.name),t.setState(o?{activeValues:o}:{}),t.triggerValuesChange("remove"),k.trigger("focusValuesList")}else S.showSystemError(r)}),this.refs.deleteValuesDialog.hide()},removeRules:function(e){var t=this.state.rules,n=e||t.getActive();n&&!n.isDefault&&this.refs.deleteRulesDialog.show(n.name)},removeValues:function(e){var t=this.state.values,n=e||t.getActive();n&&!n.isDefault&&this.refs.deleteValuesDialog.show(n.name)},setRulesActive:function(e,t){t=t||this.state.rules,j.set("activeRules",e),t.setActive(e)},setValuesActive:function(e,t){t=t||this.state.values,j.set("activeValues",e),t.setActive(e)},showRulesSettings:function(){var e=this;f(A.findDOMNode(e.refs.rulesSettingsDialog)).modal("show"),D.rules.accountRules(function(t,n){t&&0===t.ec?e.setState({accountRules:t.rules}):S.showSystemError(n)})},showValuesSettings:function(){f(A.findDOMNode(this.refs.valuesSettingsDialog)).modal("show")},toggleLeftMenu:function(){var e=!this.state.showLeftMenu;this.setState({showLeftMenu:e}),j.set("showLeftMenu",e?1:"")},handleCreate:function(){"rules"==this.state.name?this.showCreateRules():this.showCreateValues()},saveRulesOrValues:function(){var e,t=this,n=t.state,r="rules"==n.name;r?(e=n.rules.getChangedList(),e.length&&(e.forEach(function(e){t.selectRules(e)}),t.setState({}))):(e=n.values.getChangedList(),e.length&&(e.forEach(function(e){t.saveValues(e)}),t.setState({})))},onClickMenu:function(e){var t=f(e.target).closest("a"),n=this,r=n.state,o="rules"==r.name;t.hasClass("w-edit-menu")?o?n.showEditRules():n.showEditValues():t.hasClass("w-delete-menu")?o?n.removeRules():n.removeValues():t.hasClass("w-save-menu")&&n.saveRulesOrValues()},showSettings:function(e){var t=this.state.name;return"rules"===t?void this.showRulesSettings():"values"===t?void this.showValuesSettings():void this.refs.networkSettings.showDialog()},activeRules:function(e){j.set("activeRules",e.name),this.setState({activeRules:e})},activeValues:function(e){j.set("activeValues",e.name),this.setState({activeValues:e})},onRulesThemeChange:function(e){var t=e.target.value;j.set("rulesTheme",t),this.setState({rulesTheme:t})},onValuesThemeChange:function(e){var t=e.target.value;j.set("valuesTheme",t),this.setState({valuesTheme:t})},onRulesFontSizeChange:function(e){var t=e.target.value;j.set("rulesFontSize",t),this.setState({rulesFontSize:t})},onValuesFontSizeChange:function(e){var t=e.target.value;j.set("valuesFontSize",t),this.setState({valuesFontSize:t})},onRulesLineNumberChange:function(e){var t=e.target.checked;j.set("showRulesLineNumbers",t),this.setState({showRulesLineNumbers:t})},onValuesLineNumberChange:function(e){var t=e.target.checked;j.set("showValuesLineNumbers",t),this.setState({showValuesLineNumbers:t})},showFoldGutter:function(e){var t=e.target.checked;j.set("foldGutter",t?"1":""),this.setState({foldGutter:t})},onRulesLineWrappingChange:function(e){var t=e.target.checked;j.set("autoRulesLineWrapping",t?1:""),this.setState({autoRulesLineWrapping:t})},onValuesLineWrappingChange:function(e){var t=e.target.checked;j.set("autoValuesLineWrapping",t?1:""),this.setState({autoValuesLineWrapping:t})},confirmDisableAllRules:function(e){var t=this,n=t.state;n.disabledAllRules?t.disableAllRules():Y.confirm("Are you sure to disable all rules",function(e){e&&t.disableAllRules()}),e&&e.preventDefault()},confirmDisableAllPlugins:function(e){var t=this,n=t.state;n.disabledAllPlugins?t.disableAllPlugins():Y.confirm("Are you sure to disable all plugins",function(e){e&&t.disableAllPlugins()}),e&&e.preventDefault()},disableAllRules:function(e,t){var n=this,r=n.state,o=!r.disabledAllRules;D.rules.disableAllRules({disabledAllRules:o?1:0},function(e,i){e&&0===e.ec?(r.disabledAllRules=o,n.setState({}),"function"==typeof t&&t(o)):S.showSystemError(i)}),e&&e.preventDefault()},disableAllPlugins:function(e,t){var n=this,r=n.state,o=!r.disabledAllPlugins;D.plugins.disableAllPlugins({disabledAllPlugins:o?1:0},function(e,i){e&&0===e.ec?(r.disabledAllPlugins=o,L.setPlugins(r),n.setState({}),"function"==typeof t&&t(o)):S.showSystemError(i)}),e&&e.preventDefault()},disablePlugin:function(e){var t=this,n=e.target;return t.state.ndp?z.warn("Not allowed disable plugins."):void D.plugins.disablePlugin({name:f(n).attr("data-name"),disabled:n.checked?0:1},function(e,n){e&&0===e.ec?(t.state.disabledPlugins=e.data,L.setPlugins(t.state),t.setState({})):S.showSystemError(n)})},abort:function(e){if(!Array.isArray(e)){var t=this.state.network;e=t.getSelectedList()}e&&(e=e.map(function(e){return S.canAbort(e)?e.id:void 0}),e.length&&D.abort({list:e.join()})),this.hideAbortOptions()},allowMultipleChoice:function(e){var t=this,n=e.target.checked;D.rules.allowMultipleChoice({allowMultipleChoice:n?1:0},function(e,r){e&&0===e.ec?t.setState({allowMultipleChoice:n}):S.showSystemError(r)})},enableBackRulesFirst:function(e){var t=this,n=e.target.checked;D.rules.enableBackRulesFirst({backRulesFirst:n?1:0},function(e,r){e&&0===e.ec?(t.setState({backRulesFirst:n}),D.backRulesFirst=n):S.showSystemError(r)})},reinstallAllPlugins:function(){k.trigger("updateAllPlugins","reinstallAllPlugins")},chooseFileType:function(e){var t=e.target.value;j.set("exportFileType",t),this.setState({exportFileType:t})},uploadSessions:function(){this.uploadSessionsForm(new FormData(A.findDOMNode(this.refs.importSessionsForm))),A.findDOMNode(this.refs.importSessions).value=""},importHarSessions:function(e){if(e&&"object"===("undefined"==typeof e?"undefined":p(e))){var t=e.log.entries,n=[];t.forEach(function(e){if(e){var t=e.whistleTimes||"",r=new Date(t.startTime||e.startedDateTime).getTime();if(!isNaN(r)){var o=e.request||{},i=e.response||{},a=S.parseHeadersFromHar(o.headers),s=S.parseHeadersFromHar(i.headers),l=e.clientIPAddress||"127.0.0.1",c=e.serverIPAddress||"",u=G.test(o.httpVersion||i.httpVersion),d=u?"2.0":"1.1",p=o.postData||"",g={method:o.method,ip:l,port:o.port,httpVersion:d,unzipSize:p.size,size:o.bodySize>0?o.bodySize:0,headers:a.headers,rawHeaderNames:a.rawHeaderNames,body:""},h=p.base64||p.text;h&&(p.base64?g.base64=h:g.body=h);var f=i.content,m={httpVersion:d,statusCode:i.statusCode||i.status,statusMessage:i.statusText,unzipSize:f.size,size:i.bodySize>0?i.bodySize:0,headers:s.headers,rawHeaderNames:s.rawHeaderNames,ip:c,port:i.port,body:""},A=i.content,M=A&&A.text;M&&(A.base64?m.base64=A.base64:"IMG"===S.getContentType(A.mimeType)||M.length%4===0&&/^[a-z\d+/]+={0,2}$/i.test(M)?m.base64=M:m.body=M);var w={useH2:u,startTime:r,frames:e.frames,url:o.url,realUrl:e.whistleRealUrl,req:g,res:m,fwdHost:e.whistleFwdHost,sniPlugin:e.whistleSniPlugin,rules:e.whistleRules||{},version:e.whistleVersion,nodeVersion:e.whistleNodeVersion};if(t&&t.startTime)w.dnsTime=t.dnsTime,w.requestTime=t.requestTime,w.responseTime=t.responseTime,w.endTime=t.endTime;else{var y=e.timings||{},b=Math.round(r+S.getTimeFromHar(e.time));r=Math.floor(r+S.getTimeFromHar(y.dns)),w.dnsTime=r,r=Math.floor(r+S.getTimeFromHar(y.connect)+S.getTimeFromHar(y.ssl)+S.getTimeFromHar(y.send)+S.getTimeFromHar(y.blocked)+S.getTimeFromHar(y.wait)),w.requestTime=r,r=Math.floor(r+S.getTimeFromHar(y.receive)),w.responseTime=r,w.endTime=Math.max(r,b)}n.push(w)}}}),D.addNetworkList(n)}},uploadSessionsForm:function(e){var t=e.get("importSessions");if(!t||!/\.(txt|json|saz|har)$/i.test(t.name))return Y.alert("Only supports .txt, .json, .saz or .har file.");if(t.size>J)return Y.alert("The file size cannot exceed 64m.");var n=/\.txt$/i.test(t.name);if(n||/\.har$/i.test(t.name)){var r=this;return void S.readFileAsText(t,function(e){try{e=JSON.parse(e),n?D.addNetworkList(e):r.importHarSessions(e)}catch(t){Y.alert("Unrecognized format.")}})}D.upload.importSessions(e,D.addNetworkList)},exportSessions:function(e,t){var n=this.state.network,r=this.currentFoucsItem;if(this.currentFoucsItem=null,r&&f(A.findDOMNode(this.refs.chooseFileType)).is(":visible")||(r=n.getSelectedList()),r&&r.length){var o=A.findDOMNode(this.refs.exportSessionsForm);A.findDOMNode(this.refs.exportFilename).value=t||"",A.findDOMNode(this.refs.exportFileType).value=e,"har"===e&&(r={log:{version:"1.2",creator:{name:"Whistle",version:this.state.version,comment:""},browser:{name:"Whistle",version:this.state.version},pages:[],entries:r.map(S.toHar),comment:""}}),A.findDOMNode(this.refs.sessions).value=JSON.stringify(r,null," "),o.submit()}},exportBySave:function(e){if(!e||"click"===e.type||13===e.keyCode){var t=A.findDOMNode(this.refs.sessionsName),n=t.value.trim();t.value="",this.exportSessions(this.state.exportFileType,n),f(A.findDOMNode(this.refs.chooseFileType)).modal("hide")}},replayRepeat:function(e){e&&"click"!==e.type&&13!==e.keyCode||(this.refs.setReplayCount.hide(),this.replay("",this.replayList,this.state.replayCount),k.trigger("focusNetworkList"))},showAboutDialog:function(e){f(e.target).closest(".w-menu-enable").length&&this.refs.aboutDialog.showAboutInfo()},showCustomCertsInfo:function(){var e=this;e.loadingCerts||(e.loadingCerts=!0,D.certs.all(function(t,n){return e.loadingCerts=!1,t?void e.refs.certsInfoDialog.show(t.certs,t.dir):void S.showSystemError(n)}))},onContextMenu:function(e){var t=0,n=oe;if(n[2].hide&&++t,n[3].hide&&++t,n[4].hide&&++t,3>t){var r=S.getMenuPosition(e,110,100-30*t),o=this.state;r.list=n,n[2].checked=!!o.network.isTreeView,n[3].checked=!o.disabledAllRules,n[4].checked=!o.disabledAllPlugins;var i=f(e.target);n[0].hide=!0,n[1].hide=!0,i.closest(".w-network-menu").length?n[0].hide=!1:i.closest(".w-save-menu").length&&(n[1].hide=!1,i.closest(".w-rules-menu").length?n[1].disabled=!o.rules.hasChanged():n[1].disabled=!o.values.hasChanged()),this.refs.contextMenu.show(r)}e.preventDefault()},onClickContextMenu:function(e){var t=this,n=t.state,r=oe;switch(e){case"Tree View":r[2].checked=!n.network.isTreeView,t.toggleTreeView();break;case"Rules":t.disableAllRules(null,function(e){r[3].checked=!e,t.setState({})});break;case"Plugins":t.disableAllPlugins(null,function(e){r[4].checked=!e,t.setState({})});break;case"Clear":return void t.clear();case"Save":return void t.saveRulesOrValues()}this.refs.contextMenu.show({})},forceShowLeftMenu:function(){var e=this;clearTimeout(e.hideTimer),clearTimeout(e.showTimer),e.showTimer=setTimeout(function(){e.setState({forceShowLeftMenu:!0})},200)},selectCAType:function(e){var t=e.target.value;"cer"!==t&&"pem"!==t&&(t="crt"),this.setState({caType:t}),j.set("caType",t)},forceHideLeftMenu:function(){var e=this;clearTimeout(e.hideTimer),clearTimeout(e.showTimer),e.hideTimer=setTimeout(function(){e.setState({forceShowLeftMenu:!1})},500)},updateMenuView:function(e){var t=e.networkOptions[e.networkOptions.length-1];return e.network.isTreeView?(t.icon="globe",t.name="Show List View"):(t.icon="tree-conifer",t.name="Show Tree View"),e},toggleTreeView:function(){var e=this,t=e.state.network;t.setTreeView(!t.isTreeView),e.updateMenuView(e.state),e.setState({},function(){t.isTreeView||e.autoRefresh&&e.autoRefresh()})},toggleTreeViewByIcon:function(){"network"==this.getTabName()&&this.toggleTreeView()},getTabName:function(){var e=this.state,t=e.rulesMode,n=e.pluginsMode,r=e.name;return e.networkMode?r="network":e.rulesOnlyMode?r="values"===r?"values":"rules":t&&n?r="plugins":t?r="network"===r?"rules":r:n&&(r="plugins"!==r?"network":r),r||"network"},render:function(){var e=this.state,t=e.networkMode,n=e.rulesMode,r=e.rulesOnlyMode,o=e.pluginsMode,i=e.multiEnv,a=this.getTabName(),s="network"==a,l="rules"==a,c="values"==a,u="plugins"==a,p=!0,h=!0,f=e.rulesTheme||"cobalt",A=e.valuesTheme||"cobalt",M=e.rulesFontSize||"14px",y=e.valuesFontSize||"14px",S=e.showRulesLineNumbers||!1,L=e.showValuesLineNumbers||!1,k=e.autoRulesLineWrapping,j=e.autoValuesLineWrapping,z=e.rulesOptions,Y=e.pluginsOptions,G={},W=e.showNetworkOptions,_=e.showRulesOptions,J=e.showValuesOptions,K=e.showPluginsOptions,Z=e.showWeinreOptions,$=e.showHelpOptions,ee=e.network,te=ee.isTreeView,re=te?"tree-conifer":"globe";z[0].name===X&&z.forEach(function(t,n){t.icon=n&&e.multiEnv?"edit":"checkbox",t.selected||(G[t.name]=1)});var ie,ae;if(l){ae=e.rules.data;for(ie in ae)if(ae[ie].active){p=h=ae[ie].isDefault;break}}else if(c){ae=e.values.data;for(ie in ae)if(ae[ie].active){p=h=!1;break}}ee.rulesModal=e.rules,e.rules.editorTheme={theme:f,fontSize:M,lineNumbers:S};var ce=e.networkOptions,ue=ee.hasUnselected();ee.hasSelected()?(ce.forEach(function(e){e.disabled=!1,"removeUnselected"===e.id&&(e.disabled=!ue)}),se.forEach(function(e){e.disabled=!1,"removeUnselected"===e.id&&(e.disabled=!ue)})):(ce.forEach(function(e){-1!==ne.indexOf(e.id)?e.disabled=!0:"removeUnselected"===e.id&&(e.disabled=!ue)}),ce[0].disabled=!ue,se.forEach(function(e){-1!==ne.indexOf(e.id)?e.disabled=!0:"removeUnselected"===e.id&&(e.disabled=!ue)}));var de,pe,ge=e.pendingSessions,he=e.pendingRules,fe=e.pendingValues,me=e.accountRules,Ae=e.accountUrl,Me=g&&!e.forceShowLeftMenu,we=o&&n,ye=(t||e.showLeftMenu)&&!we,be=e.disabledAllPlugins,ve=e.disabledAllRules;ye&&g&&(de=this.forceShowLeftMenu,pe=this.forceHideLeftMenu),oe[2].hide=n,oe[3].hide=o,oe[4].hide=r;var Te=e.caType||"crt",xe="img/qrcode.png",Ne="cgi-bin/rootca",Ce="http://rootca.pro/";return"crt"!==Te&&(xe="img/qrcode-"+Te+".png",Ne+="?type="+Te,Ce+=Te),D.hideMockMenu=o||t,m.createElement("div",{className:"main orient-vertical-box"+(ye?" w-show-left-menu":"")},m.createElement("div",{className:"w-menu w-"+a+"-menu-list"},m.createElement("a",{onClick:this.toggleLeftMenu,draggable:"false",className:"w-show-left-menu-btn",onMouseEnter:de,onMouseLeave:pe,style:{display:t||we?"none":void 0},title:"Dock to "+(ye?"top":"left")+" (Ctrl[Command] + M)"},m.createElement("span",{className:"glyphicon glyphicon-chevron-"+(ye?Me?"down":"up":"left")})),m.createElement("div",{style:{display:n?"none":void 0},onMouseEnter:this.showNetworkOptions,onMouseLeave:this.hideNetworkOptions,className:"w-nav-menu w-menu-wrapper"+(W?" w-menu-wrapper-show":"")},m.createElement("a",{onClick:this.showNetwork,onDoubleClick:this.toggleTreeView,className:"w-network-menu"+("network"==a?" w-menu-selected":""),title:"Double click to show"+(te?" List View":" Tree View"),draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-"+re}),"Network"),m.createElement(x,{ref:"networkMenuItem",options:e.networkOptions,className:"w-network-menu-item",onClickOption:this.handleNetwork})),m.createElement("div",{style:{display:o?"none":void 0},onMouseEnter:this.showRulesOptions,onMouseLeave:this.hideRulesOptions,className:"w-nav-menu w-menu-wrapper"+(_?" w-menu-wrapper-show":"")+(l?" w-menu-auto":"")},m.createElement("a",{onClick:this.showRules,className:"w-rules-menu"+("rules"==a?" w-menu-selected":""),draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-list"+(ve?" w-disabled":"")}),"Rules"),m.createElement(x,{ref:"rulesMenuItem",name:"rules"==a?null:"Open",options:z,checkedOptions:G,disabled:ve,className:"w-rules-menu-item",onClick:this.showRules,onClickOption:this.showAndActiveRules,onChange:this.selectRulesByOptions})),m.createElement("div",{style:{display:o?"none":void 0},onMouseEnter:this.showValuesOptions,onMouseLeave:this.hideValuesOptions,className:"w-nav-menu w-menu-wrapper"+(J?" w-menu-wrapper-show":"")+(c?" w-menu-auto":"")},m.createElement("a",{onClick:this.showValues,className:"w-values-menu"+("values"==a?" w-menu-selected":""),draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-folder-close"}),"Values"),m.createElement(x,{ref:"valuesMenuItem",name:"values"==a?null:"Open",options:e.valuesOptions,className:"w-values-menu-item",onClick:this.showValues,onClickOption:this.showAndActiveValues})),m.createElement("div",{style:{display:r||we?"none":void 0},ref:"pluginsMenu",onMouseEnter:this.showPluginsOptions,onMouseLeave:this.hidePluginsOptions,className:"w-nav-menu w-menu-wrapper"+(K?" w-menu-wrapper-show":"")},m.createElement("a",{onClick:this.showPlugins,className:"w-plugins-menu"+("plugins"==a?" w-menu-selected":""),draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-list-alt"+(be?" w-disabled":"")}),"Plugins"),m.createElement(x,{ref:"pluginsMenuItem",name:"plugins"==a?null:"Open",options:Y,checkedOptions:e.disabledPlugins,disabled:be,className:"w-plugins-menu-item",onClick:this.showPlugins,onChange:this.disablePlugin,onClickOption:this.showAndActivePlugins})),!e.ndr&&m.createElement("a",{onClick:this.confirmDisableAllRules,className:"w-enable-rules-menu",title:ve?"Enable all rules":"Disable all rules",style:{display:l?"":"none",color:ve?"#f66":void 0},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-"+(ve?"play-circle":"off")}),ve?"ON":"OFF"),!e.ndp&&m.createElement("a",{onClick:this.confirmDisableAllPlugins,className:"w-enable-plugin-menu",title:be?"Enable all plugins":"Disable all plugins",style:{display:u?"":"none",color:be?"#f66":void 0},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-"+(be?"play-circle":"off")}),be?"ON":"OFF"),m.createElement(R,{hide:!u}),m.createElement("a",{onClick:this.reinstallAllPlugins,className:"w-plugins-menu"+(u?"":" hide"),draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-download-alt"}),"ReinstallAll"),m.createElement(N,{ref:"recordBtn",hide:!s,onClick:this.handleAction}),m.createElement("a",{onClick:this.importData,className:"w-import-menu",style:{display:u?"none":""},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-import"}),"Import"),m.createElement("a",{onClick:this.exportData,className:"w-export-menu",style:{display:u?"none":""},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-export"}),"Export"),m.createElement("div",{onMouseEnter:this.showRemoveOptions,onMouseLeave:this.hideRemoveOptions,style:{display:s?"":"none"},className:"w-menu-wrapper w-remove-menu-list w-menu-auto"+(e.showRemoveOptions?" w-menu-wrapper-show":"")},m.createElement("a",{onClick:this.clear,className:"w-remove-menu",title:"Ctrl[Command] + X",draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-remove"}),"Clear"),m.createElement(x,{options:se,className:"w-remove-menu-item",onClickOption:this.handleNetwork})),m.createElement("a",{onClick:this.onClickMenu,className:"w-save-menu",style:{display:s||u?"none":""},draggable:"false",title:"Ctrl[Command] + S"},m.createElement("span",{className:"glyphicon glyphicon-save-file"}),"Save"),m.createElement("a",{className:"w-create-menu",style:{display:s||u?"none":""},draggable:"false",onClick:this.handleCreate},m.createElement("span",{className:"glyphicon glyphicon-plus"}),"Create"),m.createElement("a",{onClick:this.onClickMenu,className:"w-edit-menu"+(p?" w-disabled":""),style:{display:s||u?"none":""},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-edit"}),"Rename"),m.createElement("div",{onMouseEnter:this.showAbortOptions,onMouseLeave:this.hideAbortOptions,style:{display:s?"":"none"},className:"w-menu-wrapper w-abort-menu-list w-menu-auto"+(e.showAbortOptions?" w-menu-wrapper-show":"")},m.createElement("a",{onClick:this.clickReplay,className:"w-replay-menu",draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-repeat"}),"Replay"),m.createElement(x,{options:le,className:"w-remove-menu-item",onClickOption:this.abort})),m.createElement("a",{onClick:this.composer,className:"w-composer-menu",style:{display:s?"":"none"},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-send"}),"Compose"),m.createElement("a",{onClick:this.onClickMenu,className:"w-delete-menu"+(h?" w-disabled":""),style:{display:s||u?"none":""},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-trash"}),"Delete"),m.createElement(Q,{onClick:this.showSettings,disabledRules:l&&ve,isNetwork:s,hide:u}),m.createElement("div",{onMouseEnter:this.showWeinreOptions,onMouseLeave:this.hideWeinreOptions,className:"w-menu-wrapper"+(Z?" w-menu-wrapper-show":"")},m.createElement("a",{onClick:this.showWeinreOptionsQuick,onDoubleClick:this.showAnonymousWeinre,className:"w-weinre-menu",draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-console"}),"Weinre"),m.createElement(x,{ref:"weinreMenuItem",name:"anonymous",options:e.weinreOptions,className:"w-weinre-menu-item",onClick:this.showAnonymousWeinre,onClickOption:this.showWeinre})),m.createElement("a",{onClick:this.showHttpsSettingsDialog,className:"w-https-menu",draggable:"false",style:{color:D.hasInvalidCerts?"red":void 0}},m.createElement("span",{className:"glyphicon glyphicon-"+(e.interceptHttpsConnects?"ok":"lock")}),"HTTPS"),m.createElement("div",{onMouseEnter:this.showHelpOptions,onMouseLeave:this.hideHelpOptions,className:"w-menu-wrapper"+($?" w-menu-wrapper-show":"")},m.createElement("a",{className:"w-help-menu"+(e.hasNewVersion?" w-menu-enable":""),onClick:this.showAboutDialog,title:e.hasNewVersion?"There is a new version of whistle":void 0, -href:e.hasNewVersion?void 0:"https://github.com/avwo/whistle#whistle",target:e.hasNewVersion?void 0:"_blank"},e.hasNewVersion?m.createElement("i",{className:"w-new-version-icon"}):null,m.createElement("span",{className:"glyphicon glyphicon-question-sign"}),"Help"),m.createElement(x,{ref:"helpMenuItem",options:e.helpOptions,name:m.createElement(v,{ref:"aboutDialog",onClick:this.hideHelpOptions,onCheckUpdate:this.showHasNewVersion}),className:"w-help-menu-item"})),m.createElement("a",{onClick:this.showAccountDialog,className:"w-account-menu",draggable:"false",style:{display:Ae?null:"none"}},m.createElement("span",{className:"glyphicon glyphicon-user"}),"Account"),m.createElement(T,{name:a}),m.createElement("div",{onMouseDown:this.preventBlur,style:{display:e.showCreateRules?"block":"none"},className:"shadow w-input-menu-item w-create-rules-input"},m.createElement("input",{ref:"createRulesInput",onKeyDown:this.createRules,onBlur:this.hideRulesInput,type:"text",maxLength:"64",placeholder:"Input the name"}),m.createElement("button",{type:"button",onClick:this.createRules,className:"btn btn-primary"},"+Rule"),m.createElement("button",{type:"button",onClick:this.createRules,"data-type":"top",className:"btn btn-default"},"+Top"),m.createElement("button",{type:"button",onClick:this.createRules,"data-type":"group",className:"btn btn-default"},"+Group")),m.createElement("div",{onMouseDown:this.preventBlur,style:{display:e.showCreateValues?"block":"none"},className:"shadow w-input-menu-item w-create-values-input"},m.createElement("input",{ref:"createValuesInput",onKeyDown:this.createValues,onBlur:this.hideValuesInput,type:"text",maxLength:"64",placeholder:"Input the name"}),m.createElement("button",{type:"button",onClick:this.createValues,className:"btn btn-primary"},"+Key"),m.createElement("button",{type:"button",onClick:this.createValues,"data-type":"group",className:"btn btn-default"},"+Group")),m.createElement("div",{onMouseDown:this.preventBlur,style:{display:e.showEditRules?"block":"none"},className:"shadow w-input-menu-item w-edit-rules-input"},m.createElement("input",{ref:"editRulesInput",onKeyDown:this.editRules,onBlur:this.hideRenameRuleInput,type:"text",maxLength:"64"}),m.createElement("button",{type:"button",onClick:this.editRules,className:"btn btn-primary"},"OK")),m.createElement("div",{onMouseDown:this.preventBlur,style:{display:e.showEditValues?"block":"none"},className:"shadow w-input-menu-item w-edit-values-input"},m.createElement("input",{ref:"editValuesInput",onKeyDown:this.editValues,onBlur:this.hideRenameValueInput,type:"text",maxLength:"64"}),m.createElement("button",{type:"button",onClick:this.editValues,className:"btn btn-primary"},"OK"))),m.createElement("div",{className:"w-container box fill"},m.createElement(O,{onClick:this.onClickContextMenu,ref:"contextMenu"}),m.createElement("div",{onContextMenu:this.onContextMenu,onDoubleClick:this.onContextMenu,className:"w-left-menu"+(de?" w-hover-left-menu":""),style:{display:t||Me?"none":void 0},onMouseEnter:de,onMouseLeave:pe},m.createElement("a",{onClick:this.showNetwork,className:"w-network-menu"+("network"==a?" w-menu-selected":""),style:{display:n?"none":void 0},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-"+re}),m.createElement("i",{className:"w-left-menu-name"},"Network")),m.createElement("a",{onClick:this.showRules,className:"w-save-menu w-rules-menu"+("rules"==a?" w-menu-selected":""),style:{display:o?"none":void 0},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-list"+(ve?" w-disabled":"")}),m.createElement("i",{className:"w-left-menu-name"},"Rules"),m.createElement("i",{className:"w-menu-changed",style:{display:e.rules.hasChanged()?void 0:"none"}},"*")),m.createElement("a",{onClick:this.showValues,className:"w-save-menu w-values-menu"+("values"==a?" w-menu-selected":""),style:{display:o?"none":void 0},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-folder-close"}),m.createElement("i",{className:"w-left-menu-name"},"Values"),m.createElement("i",{className:"w-menu-changed",style:{display:e.values.hasChanged()?void 0:"none"}},"*")),m.createElement("a",{onClick:this.showPlugins,className:"w-plugins-menu"+("plugins"==a?" w-menu-selected":""),style:{display:r||we?"none":void 0},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-list-alt"+(be?" w-disabled":"")}),m.createElement("i",{className:"w-left-menu-name"},"Plugins"))),e.hasRules?m.createElement(w,{ref:"rules",disabled:ve,theme:f,lineWrapping:k,fontSize:M,lineNumbers:S,onSelect:this.selectRules,onUnselect:this.unselectRules,onActive:this.activeRules,modal:e.rules,hide:"rules"==a?!1:!0,name:"rules"}):void 0,e.hasValues?m.createElement(w,{theme:A,onDoubleClick:this.showEditValuesByDBClick,fontSize:y,lineWrapping:j,lineNumbers:L,onSelect:this.saveValues,onActive:this.activeValues,modal:e.values,hide:"values"==a?!1:!0,className:"w-values-list",foldGutter:e.foldGutter}):void 0,e.hasNetwork?m.createElement(b,{ref:"network",hide:"rules"===a||"values"===a||"plugins"===a,modal:ee}):void 0,e.hasPlugins?m.createElement(E,d({},e,{onOpen:this.activePluginTab,onClose:this.closePluginTab,onActive:this.activePluginTab,onChange:this.disablePlugin,ref:"plugins",hide:"plugins"==a?!1:!0})):void 0),m.createElement("div",{ref:"rulesSettingsDialog",className:"modal fade w-rules-settings-dialog"},m.createElement("div",{className:"modal-dialog"},m.createElement("div",{className:"modal-content"},m.createElement("div",{className:"modal-body"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},m.createElement("span",{"aria-hidden":"true"},"×")),m.createElement(C,{theme:f,fontSize:M,lineNumbers:S,lineWrapping:k,onLineWrappingChange:this.onRulesLineWrappingChange,onThemeChange:this.onRulesThemeChange,onFontSizeChange:this.onRulesFontSizeChange,onLineNumberChange:this.onRulesLineNumberChange}),!e.drb&&m.createElement("p",{className:"w-editor-settings-box"},m.createElement("label",null,m.createElement("input",{type:"checkbox",checked:e.backRulesFirst,onChange:this.enableBackRulesFirst})," ","Back rules first")),!e.drm&&m.createElement("p",{className:"w-editor-settings-box"},m.createElement("label",{style:{color:i?"#aaa":void 0}},m.createElement("input",{type:"checkbox",disabled:i,checked:!i&&e.allowMultipleChoice,onChange:this.allowMultipleChoice})," ","Use multiple rules")),me&&me.trim()?m.createElement("fieldset",{className:"w-fieldset"},m.createElement("legend",null,"Account Rules",m.createElement("span",{className:"glyphicon glyphicon-edit"})),m.createElement("pre",null,me)):null),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"Close"))))),m.createElement("div",{ref:"valuesSettingsDialog",className:"modal fade w-values-settings-dialog"},m.createElement("div",{className:"modal-dialog"},m.createElement("div",{className:"modal-content"},m.createElement("div",{className:"modal-body"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},m.createElement("span",{"aria-hidden":"true"},"×")),m.createElement(C,{theme:A,fontSize:y,lineNumbers:L,lineWrapping:j,onLineWrappingChange:this.onValuesLineWrappingChange,onThemeChange:this.onValuesThemeChange,onFontSizeChange:this.onValuesFontSizeChange,onLineNumberChange:this.onValuesLineNumberChange}),m.createElement("p",{className:"w-editor-settings-box"},m.createElement("label",null,m.createElement("input",{type:"checkbox",checked:e.foldGutter,onChange:this.showFoldGutter})," ","Show fold gutter"))),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"Close"))))),m.createElement(I,{ref:"networkSettings"}),m.createElement("div",{ref:"rootCADialog",className:"modal fade w-https-dialog"},m.createElement("div",{className:"modal-dialog"},m.createElement("div",{className:"modal-content"},m.createElement("div",{className:"modal-body"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},m.createElement("span",{"aria-hidden":"true"},"×")),m.createElement("div",null,m.createElement("a",{className:"w-help-menu",title:"Click here to learn how to install root ca",href:"https://avwo.github.io/whistle/webui/https.html",target:"_blank"},m.createElement("span",{className:"glyphicon glyphicon-question-sign"})),m.createElement("a",{className:"w-download-rootca",title:Ce,href:Ne,target:"downloadTargetFrame"},"Download RootCA"),m.createElement("select",{className:"w-root-ca-type",value:Te,onChange:this.selectCAType},m.createElement("option",{value:"crt"},"rootCA.crt"),m.createElement("option",{value:"cer"},"rootCA.cer"),m.createElement("option",{value:"pem"},"rootCA.pem"))),m.createElement("a",{title:Ce,href:Ne,target:"downloadTargetFrame"},m.createElement("img",{src:xe,width:"320"})),m.createElement("div",{className:"w-https-settings"},m.createElement("p",null,m.createElement("label",{title:i?"Use `pattern enable://capture` in rules to replace global configuration":void 0},m.createElement("input",{disabled:i,checked:e.interceptHttpsConnects,onChange:this.interceptHttpsConnects,type:"checkbox"})," ","Capture TUNNEL CONNECTS")),m.createElement("p",null,m.createElement("label",null,m.createElement("input",{checked:D.supportH2&&e.enableHttp2,onChange:this.enableHttp2,type:"checkbox"})," ","Enable HTTP/2")),m.createElement("a",{draggable:"false",style:{color:D.hasInvalidCerts?"red":void 0},onClick:this.showCustomCertsInfo},"View all custom certificates"),m.createElement(H,{ref:"certsInfoDialog"}))),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"Close"))))),m.createElement("div",{ref:"chooseFileType",className:"modal fade w-choose-filte-type"},m.createElement("div",{className:"modal-dialog"},m.createElement("div",{className:"modal-content"},m.createElement("div",{className:"modal-body"},m.createElement("label",{className:"w-choose-filte-type-label"},"Save as:",m.createElement("input",{ref:"sessionsName",onKeyDown:this.exportBySave,placeholder:"Input the filename",className:"form-control",maxLength:"64"}),m.createElement("select",{ref:"fileType",className:"form-control",value:e.exportFileType,onChange:this.chooseFileType},m.createElement("option",{value:"whistle"},"*.txt"),m.createElement("option",{value:"Fiddler"},"*.saz"),m.createElement("option",{value:"har"},"*.har"))),m.createElement("a",{type:"button",onKeyDown:this.exportBySave,tabIndex:"0",onMouseDown:this.preventBlur,className:"btn btn-primary",onClick:this.exportBySave},"Export"))))),m.createElement(F,{ref:"accountDialog"}),m.createElement(F,{ref:"editorWin",className:"w-editor-win"}),m.createElement(U,{ref:"setReplayCount",wstyle:"w-replay-count-dialog"},m.createElement("div",{className:"modal-body"},m.createElement("label",null,"Times:",m.createElement("input",{ref:"replayCount",placeholder:"<= "+q,onKeyDown:this.replayRepeat,onChange:this.replayCountChange,value:e.replayCount,className:"form-control",maxLength:"3"})),m.createElement("button",{type:"button",onKeyDown:this.replayRepeat,tabIndex:"0",onMouseDown:this.preventBlur,className:"btn btn-primary",disabled:!e.replayCount,onClick:this.replayRepeat},"Replay"))),m.createElement(U,{ref:"importRemoteRules",wstyle:"w-import-remote-dialog"},m.createElement("div",{className:"modal-body"},m.createElement("input",{readOnly:he,ref:"rulesRemoteUrl",maxLength:"2048",onKeyDown:this.importRemoteRules,placeholder:"Input the url",style:{"ime-mode":"disabled"}})),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-primary",disabled:he,onMouseDown:this.preventBlur,onClick:this.importRemoteRules},he?"Importing rules":"Import rules"),m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"Close"))),m.createElement(U,{ref:"importRemoteSessions",wstyle:"w-import-remote-dialog"},m.createElement("div",{className:"modal-body"},m.createElement("input",{readOnly:ge,ref:"sessionsRemoteUrl",maxLength:"2048",onKeyDown:this.importRemoteSessions,placeholder:"Input the url",style:{"ime-mode":"disabled"}})),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-primary",disabled:ge,onMouseDown:this.preventBlur,onClick:this.importRemoteSessions},ge?"Importing sessions":"Import sessions"),m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"Close"))),m.createElement(U,{ref:"importRemoteValues",wstyle:"w-import-remote-dialog"},m.createElement("div",{className:"modal-body"},m.createElement("input",{readOnly:fe,ref:"valuesRemoteUrl",maxLength:"2048",onKeyDown:this.importRemoteValues,placeholder:"Input the url",style:{"ime-mode":"disabled"}})),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-primary",disabled:fe,onMouseDown:this.preventBlur,onClick:this.importRemoteValues},fe?"Importing values":"Import values"),m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"Close"))),m.createElement("div",{ref:"showUpdateTipsDialog",className:"modal fade w-show-update-tips-dialog"},m.createElement("div",{className:"modal-dialog"},m.createElement("div",{className:"modal-content"},m.createElement("div",{className:"modal-body"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},m.createElement("span",{"aria-hidden":"true"},"×")),m.createElement("p",{className:"w-show-update-tips"},"whistle has important updates, it is recommended that you update to the latest version."),m.createElement("p",null,"Current version: ",e.version),m.createElement("p",null,"The latest stable version: ",e.latestVersion),m.createElement("p",null,"View change:"," ",m.createElement("a",{title:"Change log",href:"https://github.com/avwo/whistle/blob/master/CHANGELOG.md",target:"_blank"},"CHANGELOG.md"))),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-default",onClick:this.donotShowAgain,"data-dismiss":"modal"},"Don't show again"),m.createElement("a",{type:"button",className:"btn btn-primary",onClick:this.hideUpdateTipsDialog,href:"https://avwo.github.io/whistle/update.html",target:"_blank"},"Update now"))))),m.createElement(U,{ref:"confirmReload",wstyle:"w-confirm-reload-dialog"},m.createElement("div",{className:"modal-body w-confirm-reload"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal"},m.createElement("span",{"aria-hidden":"true"},"×")),m.createElement("div",{className:"w-reload-data-tips"})),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"No"),m.createElement("button",{type:"button",className:"btn btn-primary",onClick:this.reloadData,"data-dismiss":"modal"},"Yes"))),m.createElement(U,{ref:"confirmImportRules",wstyle:"w-confirm-import-dialog"},m.createElement("div",{className:"modal-body w-confirm-import"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal"},m.createElement("span",{"aria-hidden":"true"},"×")),"Whether to replace the existing rules?"),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-danger",onClick:this.uploadRules,"data-dismiss":"modal"},"Replace"),m.createElement("button",{type:"button",className:"btn btn-primary",onClick:this.uploadRules,"data-dismiss":"modal"},"Reserve"))),m.createElement(U,{ref:"confirmImportValues",wstyle:"w-confirm-import-dialog"},m.createElement("div",{className:"modal-body w-confirm-import"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal"},m.createElement("span",{"aria-hidden":"true"},"×")),"Whether to replace the existing values?"),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-danger",onClick:this.uploadValues,"data-dismiss":"modal"},"Replace"),m.createElement("button",{type:"button",className:"btn btn-primary",onClick:this.uploadValues,"data-dismiss":"modal"},"Reserve"))),m.createElement(B,{ref:"deleteRulesDialog",tips:"Are you sure to delete all follow rules or group?",onConfirm:this.removeRulesBatch,name:"rules",isRules:"1",list:e.rules.list}),m.createElement(B,{ref:"deleteValuesDialog",tips:"Are you sure to delete all follow values or group?",onConfirm:this.removeValuesBatch,name:"values",list:e.values.list}),m.createElement(B,{ref:"selectRulesDialog",name:"rules",list:e.rules.list}),m.createElement(B,{ref:"selectValuesDialog",name:"values",list:e.values.list}),m.createElement("iframe",{name:"downloadTargetFrame",style:{display:"none"}}),m.createElement("form",{ref:"exportSessionsForm",action:"cgi-bin/sessions/export",style:{display:"none"},method:"post",target:"downloadTargetFrame"},m.createElement("input",{ref:"exportFilename",name:"exportFilename",type:"hidden"}),m.createElement("input",{ref:"exportFileType",name:"exportFileType",type:"hidden"}),m.createElement("input",{ref:"sessions",name:"sessions",type:"hidden"})),m.createElement("form",{ref:"importSessionsForm",encType:"multipart/form-data",style:{display:"none"}},m.createElement("input",{ref:"importSessions",onChange:this.uploadSessions,type:"file",name:"importSessions",accept:".txt,.json,.saz,.har"})),m.createElement("form",{ref:"importRulesForm",encType:"multipart/form-data",style:{display:"none"}},m.createElement("input",{ref:"importRules",onChange:this.uploadRulesForm,name:"rules",type:"file",accept:".txt,.json"})),m.createElement("form",{ref:"importValuesForm",encType:"multipart/form-data",style:{display:"none"}},m.createElement("input",{ref:"importValues",onChange:this.uploadValuesForm,name:"values",type:"file",accept:".txt,.json"})),m.createElement(V,{ref:"syncDialog"}),m.createElement(P,{ref:"jsonDialog"}),m.createElement("div",{id:"copyTextBtn",style:{display:"none"}}))}});D.getInitialData(function(e){A.render(m.createElement(ce,{modal:e}),document.getElementById("container"))})},function(e,t){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function r(e){var t=n(e),r=t[0],o=t[1];return 3*(r+o)/4-o}function o(e,t,n){return 3*(t+n)/4-n}function i(e){var t,r,i=n(e),a=i[0],s=i[1],l=new d(o(e,a,s)),c=0,p=s>0?a-4:a;for(r=0;p>r;r+=4)t=u[e.charCodeAt(r)]<<18|u[e.charCodeAt(r+1)]<<12|u[e.charCodeAt(r+2)]<<6|u[e.charCodeAt(r+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=u[e.charCodeAt(r)]<<2|u[e.charCodeAt(r+1)]>>4,l[c++]=255&t),1===s&&(t=u[e.charCodeAt(r)]<<10|u[e.charCodeAt(r+1)]<<4|u[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l}function a(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function s(e,t,n){for(var r,o=[],i=t;n>i;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(a(r));return o.join("")}function l(e){for(var t,n=e.length,r=n%3,o=[],i=16383,a=0,l=n-r;l>a;a+=i)o.push(s(e,a,a+i>l?l:a+i));return 1===r?(t=e[n-1],o.push(c[t>>2]+c[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(c[t>>10]+c[t>>4&63]+c[t<<2&63]+"=")),o.join("")}t.byteLength=r,t.toByteArray=i,t.fromByteArray=l;for(var c=[],u=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g=0,h=p.length;h>g;++g)c[g]=p[g],u[p.charCodeAt(g)]=g;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},function(e,t,n){var r,o;(function(n){!function(t,n){e.exports=n(t)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof n?n:this,function(n){"use strict";n=n||{};var i,a=n.Base64,s="2.6.4",l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=function(e){for(var t={},n=0,r=e.length;r>n;n++)t[e.charAt(n)]=n;return t}(l),u=String.fromCharCode,d=function(e){if(e.length<2){var t=e.charCodeAt(0);return 128>t?e:2048>t?u(192|t>>>6)+u(128|63&t):u(224|t>>>12&15)+u(128|t>>>6&63)+u(128|63&t)}var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return u(240|t>>>18&7)+u(128|t>>>12&63)+u(128|t>>>6&63)+u(128|63&t)},p=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,g=function(e){return e.replace(p,d)},h=function(e){var t=[0,2,1][e.length%3],n=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0),r=[l.charAt(n>>>18),l.charAt(n>>>12&63),t>=2?"=":l.charAt(n>>>6&63),t>=1?"=":l.charAt(63&n)];return r.join("")},f=n.btoa&&"function"==typeof n.btoa?function(e){return n.btoa(e)}:function(e){if(e.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return e.replace(/[\s\S]{1,3}/g,h)},m=function(e){return f(g(String(e)))},A=function(e){return e.replace(/[+\/]/g,function(e){return"+"==e?"-":"_"}).replace(/=/g,"")},M=function(e,t){return t?A(m(e)):m(e)},w=function(e){return M(e,!0)};n.Uint8Array&&(i=function(e,t){for(var n="",r=0,o=e.length;o>r;r+=3){var i=e[r],a=e[r+1],s=e[r+2],c=i<<16|a<<8|s;n+=l.charAt(c>>>18)+l.charAt(c>>>12&63)+("undefined"!=typeof a?l.charAt(c>>>6&63):"=")+("undefined"!=typeof s?l.charAt(63&c):"=")}return t?A(n):n});var y,b=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,v=function(e){switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),n=t-65536;return u((n>>>10)+55296)+u((1023&n)+56320);case 3:return u((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return u((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},T=function(e){return e.replace(b,v)},x=function(e){var t=e.length,n=t%4,r=(t>0?c[e.charAt(0)]<<18:0)|(t>1?c[e.charAt(1)]<<12:0)|(t>2?c[e.charAt(2)]<<6:0)|(t>3?c[e.charAt(3)]:0),o=[u(r>>>16),u(r>>>8&255),u(255&r)];return o.length-=[0,0,2,1][n],o.join("")},N=n.atob&&"function"==typeof n.atob?function(e){return n.atob(e)}:function(e){return e.replace(/\S{1,4}/g,x)},C=function(e){return N(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},I=function(e){return T(N(e))},E=function(e){return String(e).replace(/[-_]/g,function(e){return"-"==e?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},D=function(e){return I(E(e))};n.Uint8Array&&(y=function(e){return Uint8Array.from(C(E(e)),function(e){return e.charCodeAt(0)})});var S=function(){var e=n.Base64;return n.Base64=a,e};if(n.Base64={VERSION:s,atob:C,btoa:f,fromBase64:D,toBase64:M,utob:g,encode:M,encodeURI:w,btou:T,decode:D,noConflict:S,fromUint8Array:i,toUint8Array:y},"function"==typeof Object.defineProperty){var L=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};n.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",L(function(){return D(this)})),Object.defineProperty(String.prototype,"toBase64",L(function(e){return M(this,e)})),Object.defineProperty(String.prototype,"toBase64URI",L(function(){return M(this,!0)}))}}return n.Meteor&&(Base64=n.Base64),"undefined"!=typeof e&&e.exports?e.exports.Base64=n.Base64:(r=[],o=function(){return n.Base64}.apply(t,r),!(void 0!==o&&(e.exports=o))),{Base64:n.Base64}})}).call(t,function(){return this}())},function(e,t){"use strict";function n(e,t){t=t||0;for(var n=Math.min(e.length,r);n>t;t++){var o=e[t];if(!(9==o||10==o||13==o||o>=32&&127>=o)){++t;var i=e[t];if(o>=194&&223>=o){if(i>=128&&191>=i)continue;return!i}++t;var a=e[t];if(224==o){if(i>=160&&191>=i&&a>=128&&191>=a)continue;return!a}if(o>=225&&236>=o||238==o||239==o){if(i>=128&&191>=i&&a>=128&&191>=a)continue;return!a}if(237==o){if(i>=128&&159>=i&&a>=128&&191>=a)continue;return!a}++t;var s=e[t];if(240==o){if(i>=144&&191>=i&&a>=128&&191>=a&&s>=128&&191>=s)continue;return!s}if(o>=241&&243>=o){if(i>=128&&191>=i&&a>=128&&191>=a&&s>=128&&191>=s)continue;return!s}if(244==o){if(i>=128&&143>=i&&a>=128&&191>=a&&s>=128&&191>=s)continue;return!s}return!1}}return!0}var r=32768;e.exports=function(e){return n(e)?!0:0===e[0]&&n(e,5)}},function(e,t,n){var r=n(5);"string"==typeof r&&(r=[[e.id,r,""]]);n(7)(r,{});r.locals&&(e.exports=r.locals)},function(e,t,n){t=e.exports=n(6)(),t.push([e.id,".w-menu{height:30px;border-top:1px solid #fcfcfc;border-bottom:1px solid #ccc;background:#f1f3f4;padding-right:5pc;position:relative;z-index:1001;white-space:nowrap}.w-history-bar a,.w-menu a{text-decoration:none!important;color:#000;padding:0 5px;line-height:26px;height:26px;margin-right:5px;display:inline-block}.w-menu a{height:27px;line-height:28px;overflow:hidden}.w-detail .glyphicon,.w-menu .glyphicon{margin-right:3px}.w-menu .glyphicon-folder-close,.w-menu .glyphicon-folder-open{margin-right:6px}.w-menu .w-online{position:absolute;top:0;right:0}.w-left-menu a:hover,.w-left-menu a:hover .w-disabled,.w-menu .w-online,.w-menu a:hover{color:#337ab7}.w-menu .w-offline{color:#ccc!important;cursor:default}.w-frames-action .w-disabled,.w-history-bar .w-disabled,.w-menu .w-disabled{color:#aaa!important;cursor:not-allowed!important}.w-left-menu .w-disabled{color:#aaa}.w-menu .w-menu-enable .glyphicon-cog{color:#f66!important}.w-menu .w-new-version-icon{position:absolute;top:2px;left:17px;width:5px;height:5px;border-radius:5px;background:red}.w-menu .w-menu-wrapper{display:inline-block;position:relative;height:30px}.w-show-update-tips{font-weight:700}.w-input-menu-item{display:block;position:absolute;background:#fff;border:1px solid #ccc;border-radius:2px;z-index:101;top:30px;display:none;white-space:nowrap}.w-input-menu-item input{width:246px;height:2pc;border:1px solid #ccc;border-radius:0!important;border-radius:2px;padding:0 5px;vertical-align:middle}.w-input-menu-item .btn{height:2pc;padding:0 9pt;vertical-align:middle;border-radius:0;border-top-right-radius:2px;border-bottom-right-radius:2px;margin-left:1px;border-color:#ccc}.w-create-rules-input{left:310px}.w-create-values-input{left:300px}.w-edit-rules-input{left:382px}.w-edit-values-input{left:372px}.w-show-left-menu .w-create-rules-input{left:210px}.w-show-left-menu .w-create-values-input{left:200px}.w-show-left-menu .w-edit-rules-input{left:282px}.w-show-left-menu .w-edit-values-input{left:17pc}.w-menu-wrapper .w-menu-item{display:none!important}.w-menu-wrapper-show .w-menu-item{display:block!important}.w-values-list .glyphicon-ok{display:none!important}.w-values-list a{font-weight:400!important}.w-disabled .glyphicon-ok,.w-disabled .glyphicon-stop{color:#ccc!important}.w-rules-settings-dialog .modal-dialog{width:25pc}.w-values-settings-dialog .modal-dialog{width:300px}.w-show-update-tips-dialog .modal-dialog{width:21pc}.w-show-update-tips-dialog .modal-body p{margin-bottom:5px}.w-https-dialog .modal-dialog{width:340px}.w-https-help{margin-left:150px}.w-https-dialog .modal-dialog div{white-space:nowrap}.w-https-dialog a{display:inline-block}.w-download-rootca,.w-https-help{line-height:30px}.w-https-settings label{font-weight:400}.w-https-settings p{margin:10px 0}.w-is-link{cursor:pointer;text-decoration:underline}.w-choose-filte-type .modal-dialog{width:456px}.w-choose-filte-type-label{white-space:nowrap}.w-choose-filte-type-label .form-control{margin-left:10px;width:200px;display:inline-block;font-weight:400}.w-choose-filte-type-label select.form-control{margin:0 5px;width:5pc}.w-confirm-import-dialog .modal-dialog{width:20pc;font-weight:700}.w-account-menu{white-space:nowrap;max-width:75pt;max-width:calc(100% - 750pt);text-overflow:ellipsis;overflow:hidden}.w-show-left-menu .w-account-menu{max-width:220px;max-width:calc(100% - 900px)}.w-show-left-menu-btn{padding:0 15px!important;margin-right:0!important}.w-left-menu{background:#f1f3f4;border-left:1px solid #ccc;border-right:1px solid #ccc;display:none}.w-show-left-menu .w-left-menu{display:block;border-left:none}.w-show-left-menu .w-nav-menu{display:none}.w-left-menu a{display:block;position:relative;padding:10px 0 8px;width:47px;overflow:hidden;text-align:center;text-decoration:none!important;color:#000}.w-left-menu a span{margin-right:5px}.w-left-menu a .w-left-menu-name{display:block;font-style:normal;font-size:9pt;zoom:1;transform:scale(0.8,0.8);width:65px;margin-left:-10px;white-space:nowrap}.w-left-menu-tips{padding:6px 10px;display:none;left:47px;top:3px;position:absolute;z-index:1;border-radius:4px}.w-left-menu a:hover .w-left-menu-tips{display:block;color:#000;background-color:#f1f3f4;font-weight:700;border:1px solid #ccc}.w-left-menu a .w-left-menu-tips:hover,.w-menu .w-export-menu,.w-menu .w-import-menu,.w-menu .w-remove-menu-list{display:none}.w-show-left-menu .w-export-menu,.w-show-left-menu .w-import-menu,.w-show-left-menu .w-remove-menu-list{display:inline-block}.w-menu-changed{position:absolute;top:2px;left:5px;color:red}.w-replay-count-dialog .modal-content{width:236px!important;white-space:nowrap}.w-replay-count-dialog .modal-dialog{width:236px!important}.w-replay-count-dialog .modal-content label{width:auto}.w-replay-count-dialog input{display:inline-block;width:5pc;text-align:center;margin:0 10px}.w-import-remote-dialog .modal-content{width:525px}.w-import-remote-dialog input{width:500px;height:30px;line-height:30px;padding:5px;border:1px solid #ccc}.w-https-menu .glyphicon-lock{color:#9e9e26}.w-hover-left-menu{position:absolute;z-index:1;height:auto;border-bottom:1px solid #ccc;min-height:0}.w-menu .w-tree-view-active{color:#337ab7}.w-menu-selected{background-color:#ddd}.w-root-ca-type{width:75pt;float:right;margin:3px 15px 0 0;border:1px solid #ccc;border-radius:3px;height:24px;font-size:9pt;padding-left:8px}.w-fieldset pre{max-height:220px;overflow:auto;padding:10px}.w-fieldset{border:1px solid #ddd}.w-fieldset legend{font-size:9pt;padding:0 5px;border:none;width:auto;margin:0 10px;font-weight:700}.w-fieldset legend .glyphicon{margin-left:5px;cursor:pointer}",""])},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;tNote: There are unsaved changes.
'),f(".w-reload-data-tips").html(e).attr("data-name",this.state.name)},showTab:function(){var e=s(this.state);e&&-1==e.indexOf("rules")?-1!=e.indexOf("values")?this.showValues():-1!=e.indexOf("plugins")?this.showPlugins():this.state.showAccount&&"account"===e?this.showAccount():this.showNetwork():this.showRules(),j.set("pageName",e||"")},componentDidMount:function(){function e(e){if(e=e&&e.trim()){var t=e.indexOf("://")+3;if(e=-1!=t?e.substring(t):e,0===e.indexOf("{"))return t=e.lastIndexOf("}"),t>1?e.substring(1,t):null}}var t=this,n=new M(".w-copy-text");n.on("error",function(e){G.alert("Copy failed.")}),n=new M(".w-copy-text-with-tips"),n.on("error",function(e){z.error("Copy failed.")}),n.on("success",function(e){z.success("Copied clipboard.")});var r=function(e){e.preventDefault()};k.on("enableRecord",function(){t.enableRecord()}),k.on("showJsonViewDialog",function(e,n){t.refs.jsonDialog.show(n)}),k.on("rulesChanged",function(){t.rulesChanged=!0,t.showReloadRules()}),k.on("switchTreeView",function(){t.toggleTreeView()}),k.on("updateGlobal",function(){t.setState({})}),k.on("valuesChanged",function(){t.valuesChanged=!0,t.showReloadValues()}),k.on("showNetwork",function(){t.showNetwork()}),k.on("showRules",function(){t.showRules()}),k.on("showValues",function(){t.showValues()}),k.on("showPlugins",function(){t.showPlugins()}),k.on("disableAllPlugins",t.disableAllPlugins),k.on("disableAllRules",t.disableAllRules),k.on("activeRules",function(){var e=D.rulesModal;e.exists(D.activeRulesName)&&(t.setRulesActive(D.activeRulesName,e),t.setState({}))}),k.on("activeValues",function(){var e=D.valuesModal;e.exists(D.activeValuesName)&&(t.setValuesActive(D.activeValuesName,e),t.setState({}))});var i;k.on("openEditor",function(e,n){try{if(i&&"function"==typeof i.setValue)return window.getTextFromWhistle_=null,t.refs.editorWin.show(),i.setValue(n);window._initWhistleTextEditor_=function(e){i=e,i.setValue(n)},t.refs.editorWin.show("editor.html")}catch(r){}});var a;k.on("updateUIThrottle",function(){a||(a=setTimeout(function(){a=null,t.setState({})},200))}),k.on("addNewRulesFile",function(e,n){var r=n.filename,o=t.state.rules.add(r,n.data);t.setRulesActive(r),t.setState({activeRules:o}),t.triggerRulesChange("create")}),k.on("addNewValuesFile",function(e,n){var r=n.filename,o=t.state.values.add(r,n.data);t.setValuesActive(r),t.setState({activeValues:o}),t.triggerValuesChange("create")}),k.on("recoverRules",function(e,n){var r=t.state.rules,o=n.filename,i=function(e){e&&D.rules.add({name:o,value:n.data,recycleFilename:n.name},function(e,i){if(e&&0===e.ec){var a=r.add(o,n.data);t.setRulesActive(o),t.setState({activeRules:a}),t.triggerRulesChange("create"),k.trigger("rulesRecycleList",e),k.trigger("focusRulesList")}else S.showSystemError(i)})};return r.exists(o)?void G.confirm("The name `"+o+"` already exists, whether to overwrite it?",i):i(!0)}),k.on("recoverValues",function(e,n){var r=t.state.values,o=n.filename,i=function(e){e&&D.values.add({name:o,value:n.data,recycleFilename:n.name},function(e,i){if(e&&0===e.ec){var a=r.add(o,n.data);t.setValuesActive(o),t.setState({activeValues:a}),t.triggerValuesChange("create"),k.trigger("valuesRecycleList",e)}else S.showSystemError(i)})};return r.exists(o)?void G.confirm("The name `"+o+"` already exists, whether to overwrite it?",i):i(!0)}),f(document).on("dragleave",r).on("dragenter",r).on("dragover",r).on("drop",function(e){e.preventDefault();var n=e.originalEvent.dataTransfer.files,r=n&&n[0];if(r){if(f(".w-files-dialog.in").length)return k.trigger("uploadFile",r);var o,i=t.state.name,a=f(e.target);if("network"===i){if(a.closest(".w-frames-composer").length)return;if(/\.log$/i.test(r.name))return r.size>q?G.alert("The file size cannot exceed 2m."):void S.readFileAsText(r,function(e){e=S.parseLogs(e),e&&(null!==D.uploadLogs&&(D.uploadLogs=e),k.trigger("showLog"),k.trigger("uploadLogs",{logs:e}))});o=new FormData,o.append("importSessions",n[0]),t.uploadSessionsForm(o)}a.closest(".w-divider-left").length&&("rules"===i?(o=new FormData,o.append("rules",n[0]),t.rulesForm=o,t.refs.confirmImportRules.show()):"values"===i&&(o=new FormData,o.append("values",n[0]),t.valuesForm=o,t.refs.confirmImportValues.show()))}}).on("keydown",function(e){(e.metaKey||e.ctrlKey)&&82===e.keyCode&&e.preventDefault()});var s=function(e){var n=e.target;"A"==n.nodeName&&f(n).parent().hasClass("w-list-data")&&("rules"==t.state.name?t.removeRules():t.removeValues()),e.preventDefault()};f(window).on("hashchange",t.showTab).on("keyup",function(e){if(27==e.keyCode){t.setMenuOptionsState();var n=f(".modal");"function"==typeof n.modal&&n.modal("hide")}}).on("keydown",function(e){if(46==e.keyCode&&s(e),!e.ctrlKey&&!e.metaKey)return void(112===e.keyCode?(e.preventDefault(),window.open("https://avwo.github.io/whistle/webui/"+t.state.name+".html")):116===e.keyCode&&e.preventDefault());77===e.keyCode?(t.toggleLeftMenu(),e.preventDefault()):66===e.keyCode&&(t.toggleTreeView(),e.preventDefault(),k.trigger("toggleTreeViewByAccessKey"));var n="network"===t.state.name;n&&88==e.keyCode&&(S.isFocusEditor()||f(e.target).closest(".w-frames-list").length||t.clear()),68==e.keyCode&&s(e);var r=t.state.network;if(n&&83===e.keyCode){if(e.preventDefault(),f(".modal.in").length)return void(f(A.findDOMNode(t.refs.chooseFileType)).is(":visible")&&t.exportBySave());var o=e.target.nodeName;if("INPUT"===o||"TEXTAREA"===o)return;var i=r.hasSelected();return void(i&&(f(A.findDOMNode(t.refs.chooseFileType)).modal("show"),setTimeout(function(){A.findDOMNode(t.refs.sessionsName).focus()},500)))}n&&73===e.keyCode&&(t.importSessions(e),e.preventDefault())});var c=function(){var e=t.state.name;return"rules"===e||"values"===e};f(document.body).on("mouseenter",ee,function(t){if(c()&&(t.ctrlKey||t.metaKey)){var n=f(this);(n.hasClass("cm-js-http-url")||n.hasClass("cm-string")||n.hasClass("cm-js-at")||e(n.text()))&&n.addClass("w-is-link")}}).on("mouseleave",ee,function(e){f(this).removeClass("w-is-link")}).on("mousedown",ee,function(n){if(c()&&(n.ctrlKey||n.metaKey)){var r=f(this),o=r.text();if(r.hasClass("cm-js-at"))return void(ne.test(o)&&window.open((RegExp.$1||"http:")+RegExp.$2));if(r.hasClass("cm-string"))return void(te.test(o)&&window.open((RegExp.$1||"http:")+RegExp.$2));if(r.hasClass("cm-js-http-url"))return/^https?:\/\//i.test(o)||(o="http:"+("/"===o[0]?"":"//")+o),void window.open(o);var i=e(o);return i?void t.showAndActiveValues({name:i}):void 0}}),"network"==t.state.name&&t.startLoadData(),D.on("settings",function(e){var n=t.state,r=e.server;if(n.interceptHttpsConnects!==e.interceptHttpsConnects||n.enableHttp2!==e.enableHttp2||n.disabledAllRules!==e.disabledAllRules||n.allowMultipleChoice!==e.allowMultipleChoice||n.disabledAllPlugins!==e.disabledAllPlugins||n.backRulesFirst!==e.backRulesFirst||n.multiEnv!=r.multiEnv||n.ndp!=r.ndp||n.ndr!=r.ndr||n.drb!=r.drb||n.drm!=r.drm){n.interceptHttpsConnects=e.interceptHttpsConnects,n.enableHttp2=e.enableHttp2,n.disabledAllRules=e.disabledAllRules,n.allowMultipleChoice=e.allowMultipleChoice,n.backRulesFirst=e.backRulesFirst,n.disabledAllPlugins=e.disabledAllPlugins,n.multiEnv=r.multiEnv,n.ndp=r.ndp,n.ndr=r.ndr,n.drb=r.drb,n.drm=r.drm,L.setPlugins(n);var o=se;return o[3].checked=!n.disabledAllRules,o[4].checked=!n.disabledAllPlugins,t.refs.contextMenu.update(),t.setState({})}}),D.on("rules",function(e){var n=t.state.rules,r=e.list;e.defaultRulesIsDisabled||-1!==r.indexOf("Default")||r.unshift("Default");var o=n.getSelectedNames();l(o,r)||(t.reselectRules(e,!0),t.setState({}))}),D.on("serverInfo",function(e){t.serverInfo=e}),k.on("executeComposer",function(){t.autoRefresh&&t.autoRefresh()});var u=function(e){if(Array.isArray(e))return e;if(e&&!e.selected)return[e]};k.on("updateUI",function(){t.setState({})}),k.on("replaySessions",function(e,n,r){var o=t.state.network,i=u(n)||o.getSelectedList(),a=i&&i.length;return r&&1===a?(t.replayList=i,t.refs.setReplayCount.show(),void setTimeout(function(){var e=A.findDOMNode(t.refs.replayCount);e.select(),e.focus()},300)):void t.replay(e,i)}),k.on("importSessions",t.importSessions),k.on("filterSessions",t.showSettings),k.on("exportSessions",function(e,n){t.exportData(e,u(n))}),k.on("abortRequest",function(e,n){t.abort(u(n))}),k.on("uploadSessions",function(e,n){var r=u(n&&n.curItem),o=n&&n.upload;if("function"==typeof o){if(!r){var i=t.state.network;r=i.getSelectedList(),r&&r.length&&(r=f.extend(!0,[],r))}r&&o(r)}}),k.on("removeIt",function(e,n){var r=t.state.network;n&&r&&(r.remove(n),t.setState({}))}),k.on("removeOthers",function(e,n){var r=t.state.network;n&&r&&(n.selected?r.removeUnselectedItems():r.removeOthers(n),t.setState({}))}),k.on("clearAll",t.clear),k.on("removeSelected",function(){var e=t.state.network;e&&(e.removeSelectedItems(),t.setState({}))}),k.on("removeUnselected",function(){var e=t.state.network;e&&(e.removeUnselectedItems(),t.setState({}))}),k.on("removeUnmarked",function(){var e=t.state.network;e&&(e.removeUnmarkedItems(),t.setState({}))}),k.on("saveRules",function(e,n){if(n.changed||!n.selected){var r=t.state.rules.getChangedGroupList(n);r.forEach(t.selectRules)}else t.unselectRules(n)}),k.on("saveValues",function(e,n){var r=t.state.values.getChangedGroupList(n);r.forEach(t.saveValues)}),k.on("renameRules",function(e,n){t.showEditRules(n)}),k.on("renameValues",function(e,n){t.showEditValues(n)}),k.on("deleteRules",function(e,n){setTimeout(function(){t.removeRules(n)},0)}),k.on("deleteValues",function(e,n){setTimeout(function(){t.removeValues(n)},0)}),k.on("createRules",t.showCreateRules),k.on("createValues",t.showCreateValues),k.on("exportRules",t.exportData),k.on("exportValues",t.exportData),k.on("importRules",t.importRules),k.on("importValues",t.importValues),k.on("uploadRules",function(e,n){var r=o(n);r.append("replaceAll","1"),t._uploadRules(r,!0)}),k.on("uploadValues",function(e,n){var r=o(n,"values");r.append("replaceAll","1"),t._uploadValues(r,!0)});var d,p,h=document.hidden;f(document).on("visibilitychange",function(){clearTimeout(d);var e="network"===t.state.name;return document.hidden||!e?void(e&&h!==document.hidden&&(h=!0,p=t.scrollerAtBottom&&t.scrollerAtBottom())):(h=!1,void(d=setTimeout(function(){var e=p||t.scrollerAtBottom&&t.scrollerAtBottom();p=!1,t.setState({},function(){e&&t.autoRefresh()})},100)))}),setTimeout(function(){D.checkUpdate(function(e){e&&e.showUpdate&&t.setState({version:e.version,latestVersion:e.latestVersion},function(){f(A.findDOMNode(t.refs.showUpdateTipsDialog)).modal("show")})})},1e4),D.getLogIdList=this.getLogIdListFromRules,D.importAnySessions=t.importAnySessions,D.on("plugins",function(e){var n=t.createPluginsOptions(e.plugins),r=t.state.pluginsOptions,o=t.state.disabledPlugins,i=t.state.disabledAllPlugins,a=e.disabledPlugins;if(i==e.disabledAllPlugins&&n.length==r.length){for(var s,l=0,c=n.length;c>l;l++){var u=n[l],d=r[l];if(u.name!=d.name||u.latest!==d.latest||u.mtime!=d.mtime||o[u.name]!=a[u.name]||u.hideLongProtocol!=d.hideLongProtocol||u.hideShortProtocol!=d.hideShortProtocol||u.path!=d.path){s=!0;break}}if(!s)return}var p=t.state.plugins;p&&e.plugins&&Object.keys(e.plugins).forEach(function(t){var n=p[t];if(n){var r=e.plugins[t];r.selectedRulesHistory=n.selectedRulesHistory,r.selectedValuesHistory=n.selectedValuesHistory}});var h={plugins:e.plugins,disabledPlugins:e.disabledPlugins,pluginsOptions:n,disabledAllPlugins:e.disabledAllPlugins};L.setPlugins(h),t.setState(h)});try{var g=window.parent.onWhistleReady;"function"==typeof g&&g({url:location.href,pageId:D.getPageId(),compose:D.compose,importSessions:t.importAnySessions,importHarSessions:t.importHarSessions,clearSessions:t.clear,selectIndex:function(e){k.trigger("selectedIndex",e)}})}catch(m){}},shouldComponentUpdate:function(e,t){var n=this.state.name;return"network"===n&&t.name!==n&&(this._isAtBottom=this.scrollerAtBottom&&this.scrollerAtBottom()),!0},importAnySessions:function(e){e&&(Array.isArray(e)?D.addNetworkList(e):this.importHarSessions(e))},donotShowAgain:function(){D.donotShowAgain()},hideUpdateTipsDialog:function(){f(A.findDOMNode(this.refs.showUpdateTipsDialog)).modal("hide")},getAllRulesText:function(){var e=" "+this.getAllRulesValue();return e.replace(/#[^\r\n]*[\r\n]/g,"\n")},getLogIdListFromRules:function(){var e=this.getAllRulesText();if(e=e.match(/\slog:\/\/(?:\{[^\s]{1,36}\}|[^/\\{}()<>\s]{1,36})\s/g)){var t={};e=e.map(function(e){return e=S.removeProtocol(e.trim()),"{"===e[0]&&(e=e.slice(1,-1)),e}).filter(function(e){return e?t[e]?!1:(t[e]=1,!0):!1})}return e},getWeinreFromRules:function(){var e=this.state.values,t=this.getAllRulesText();if(t=t.match(/(?:^|\s)weinre:\/\/[^\s#]+(?:$|\s)/gm)){var n={};t=t.map(function(t){t=S.removeProtocol(t.trim());var n=u(t);if(n!==!1)return n;var r=c(t);return r!==!1?(r=e.get(r),r&&r.value):t}).filter(function(e){return e?n[e]?!1:(n[e]=1,!0):!1})}return t},getValuesFromRules:function(){var e=" "+this.getAllRulesValue();return(e=e.match(/\s(?:[\w-]+:\/\/)?\{[^\s#]+\}/g))&&(e=e.map(function(e){return c(S.removeProtocol(e.trim()))}).filter(function(e){return!!e})),e},getAllRulesValue:function(){var e=[],t=[],n=[],r=this.state.rules;return r.list.forEach(function(o){var i=r.get(o),a=i.value||"";i.active?t.push(a):i.selected?n.push(a):e.push(a)}),r=this.state.values,r.list.forEach(function(t){/\.rules$/.test(t)&&e.push(r.get(t).value)}),t.concat(n).concat(e).join("\r\n")},preventBlur:function(e){"INPUT"!=e.target.nodeName&&e.preventDefault()},startLoadData:function(){function e(o,a){o=o||r.state.network,clearTimeout(i),i=null,"network"==r.state.name&&(a=a||n(),o.update(a)&&a&&(i=setTimeout(e,3e3)),document.hidden||r.setState({},function(){a&&t()}))}function t(e){(e||!r.state.network.isTreeView)&&(s.scrollTop=1e7)}function n(){var e=a.find(".ReactVirtualized__Grid__innerScrollContainer")[0];return e?s.scrollTop+s.offsetHeight+5>e.offsetHeight:!0}var r=this;if(r._updateNetwork)return void r._updateNetwork();var o,i,a=f(".w-req-data-list .ReactVirtualized__Grid:first").scroll(function(){var t=r.state.network;o&&clearTimeout(o),o=null,n()&&(o=setTimeout(function(){e(t,!0)},1e3))}),s=a[0];this.container=a,D.on("data",e),f(document).on("dblclick",".w-network-menu-list",function(e){f(e.target).hasClass("w-network-menu-list")&&(s.scrollTop<1?t(!0):s.scrollTop=0)}),r._updateNetwork=e,r.autoRefresh=t,r.scrollerAtBottom=n},showPlugins:function(e){"plugins"!=this.state.name?(this.setMenuOptionsState(),this.hidePluginsOptions()):e&&!this.state.showLeftMenu&&this.showPluginsOptions(),this.setState({hasPlugins:!0,name:"plugins"}),S.changePageName("plugins")},handleAction:function(e){if("top"===e)return void(this.container[0].scrollTop=0);if("bottom"===e)return this.autoRefresh(!0);if("pause"===e)return k.trigger("changeRecordState",e),D.pauseNetworkRecord();var t="refresh"===e;return t?k.trigger("changeRecordState"):k.trigger("changeRecordState","stop"),D.stopNetworkRecord(!t),t?this.autoRefresh():void 0},showNetwork:function(e){var t=this;return"network"==t.state.name?void(e&&!t.state.showLeftMenu&&t.showNetworkOptions()):(t.setMenuOptionsState(),t.setState({hasNetwork:!0,name:"network"},function(){t.startLoadData(),t._isAtBottom&&(t._isAtBottom=!1,t.autoRefresh&&t.autoRefresh())}),void S.changePageName("network"))},showAccount:function(){var e=this;"account"!=e.state.name&&(e.setState({name:"account",hasAccount:!0}),S.changePageName("account"))},signOut:function(){this.state.showAccount=!1,this.showTab()},handleNetwork:function(e,t){var n=this.state.network;"removeAll"==e.id?this.clear():"removeSelected"==e.id?n.removeSelectedItems():"removeUnselected"==e.id?n.removeUnselectedItems():"exportWhistleFile"==e.id?this.exportSessions("whistle"):"exportSazFile"==e.id?this.exportSessions("Fiddler"):"exportHarFile"==e.id?this.exportSessions("har"):"importSessions"==e.id?this.importSessions(t):"toggleView"===e.id&&this.toggleTreeView(),this.hideNetworkOptions()},importData:function(e){switch(this.state.name){case"network":this.importSessions(e);break;case"rules":this.importRules(e);break;case"values":this.importValues(e)}},exportData:function(e,t){switch(this.state.name){case"network":var n=this.state.network,r=Array.isArray(t)||n.hasSelected();if(this.currentFoucsItem=t,r){f(A.findDOMNode(this.refs.chooseFileType)).modal("show");var o=this;setTimeout(function(){A.findDOMNode(o.refs.sessionsName).focus()},500)}else z.info("Please select the sessions first.");break;case"rules":this.showAndActiveRules({id:"exportRules"});break;case"values":this.showAndActiveValues({id:"exportValues"})}},importSessions:function(e,t){var n=this,r=e&&e.shiftKey||t&&t.shiftKey;return r?(n.refs.importRemoteSessions.show(),void setTimeout(function(){var e=A.findDOMNode(n.refs.sessionsRemoteUrl);e.focus(),e.select()},500)):void A.findDOMNode(n.refs.importSessions).click()},importSessionsFromUrl:function(e,t){if(e){var n=this;n.setState({pendingSessions:!0}),D.importRemote({url:e},a(function(e,r){n.setState({pendingSessions:!1}),e||(t&&n.refs.importRemoteSessions.hide(),n.importAnySessions(r))}))}},importRemoteSessions:function(e){if(!e||"click"===e.type||13===e.keyCode){var t=this,n=A.findDOMNode(t.refs.sessionsRemoteUrl),r=i(n.value);t.importSessionsFromUrl(r,!0)}},importRules:function(e,t){var n=this,r=e&&e.shiftKey||t&&t.shiftKey;return r?(n.refs.importRemoteRules.show(),void setTimeout(function(){var e=A.findDOMNode(n.refs.rulesRemoteUrl);e.focus(),e.select()},500)):void A.findDOMNode(n.refs.importRules).click()},importRemoteRules:function(e){if(!e||"click"===e.type||13===e.keyCode){var t=this,n=A.findDOMNode(t.refs.rulesRemoteUrl),r=i(n.value);r&&(t.setState({pendingRules:!0}),D.importRemote({url:r},a(function(e,n){t.setState({pendingRules:!1}),e||(t.refs.importRemoteRules.hide(),n&&(t.rulesForm=o(n),t.refs.confirmImportRules.show()))})))}},importValues:function(e,t){var n=this,r=e&&e.shiftKey||t&&t.shiftKey;return r?(n.refs.importRemoteValues.show(),void setTimeout(function(){var e=A.findDOMNode(n.refs.valuesRemoteUrl);e.focus(),e.select()},500)):void A.findDOMNode(n.refs.importValues).click()},importRemoteValues:function(e){if(!e||"click"===e.type||13===e.keyCode){var t=this,n=A.findDOMNode(t.refs.valuesRemoteUrl),r=i(n.value);r&&(t.setState({pendingValues:!0}),D.importRemote({url:r},a(function(e,n){t.setState({pendingValues:!1}),e||(t.refs.importRemoteValues.hide(),n&&(t.valuesForm=o(n,"values"),t.refs.confirmImportValues.show()))})))}},_uploadRules:function(e,t){var n=this;D.upload.importRules(e,function(e,r){e?0===e.ec?(n.reloadRules(e),t&&z.success("Successful synchronization Rules.")):G.alert(e.em):S.showSystemError(r)})},_uploadValues:function(e,t){var n=this;D.upload.importValues(e,function(e,r){e||S.showSystemError(r),0===e.ec?(n.reloadValues(e),t&&z.success("Successful synchronization Values.")):G.alert(e.em)})},uploadRules:function(e){var t=this.rulesForm;if(this.rulesForm=null,t){var n=t.get("rules");if(!n||!/\.(txt|json)$/i.test(n.name))return G.alert("Only supports .txt or .json file.");if(n.size>Z)return G.alert("The file size cannot exceed 6m.");f(e.target).hasClass("btn-danger")&&t.append("replaceAll","1"),this._uploadRules(t),A.findDOMNode(this.refs.importRules).value=""}},uploadValues:function(e){var t=this.valuesForm;if(this.valuesForm=null,t){var n=t.get("values");if(!n||!/\.(txt|json)$/i.test(n.name))return G.alert("Only supports .txt or .json file.");if(n.size>Z)return G.alert("The file size cannot exceed 6m.");f(e.target).hasClass("btn-danger")&&t.append("replaceAll","1"),this._uploadValues(t),A.findDOMNode(this.refs.importValues).value=""}},uploadRulesForm:function(){this.rulesForm=new FormData(A.findDOMNode(this.refs.importRulesForm)),this.refs.confirmImportRules.show()},uploadValuesForm:function(){this.valuesForm=new FormData(A.findDOMNode(this.refs.importValuesForm)),this.refs.confirmImportValues.show()},showAndActiveRules:function(e,t){if("rules"===this.state.name)switch(e.id){case"exportRules":this.refs.selectRulesDialog.show();break;case"importRules":this.importRules(t)}else this.setRulesActive(e.name),this.showRules();this.hideRulesOptions()},showRules:function(e){"rules"!=this.state.name?(this.setMenuOptionsState(),this.hideRulesOptions()):e&&!this.state.showLeftMenu&&this.showRulesOptions(e),this.setState({hasRules:!0,name:"rules"}),S.changePageName("rules")},showAndActiveValues:function(e,t){var n=this;if("values"===n.state.name&&e.id)switch(e.id){case"exportValues":n.refs.selectValuesDialog.show();break;case"importValues":this.importValues(t)}else{var r=n.state.values,o=e.name;r.exists(o)?n.setValuesActive(o):D.values.add({name:o},function(e,t){if(e&&0===e.ec){var i=r.add(o);n.setValuesActive(o),n.setState({activeValues:i}),k.trigger("focusValuesList")}else S.showSystemError(t)}),this.showValues()}n.hideValuesOptions()},addValue:function(){},showValues:function(e){"values"!=this.state.name?(this.setMenuOptionsState(),this.hideValuesOptions()):e&&!this.state.showLeftMenu&&this.showValuesOptions(e), +this.setState({hasValues:!0,name:"values"}),S.changePageName("values")},showNetworkOptions:function(){"network"==this.state.name&&this.setState({showNetworkOptions:!0})},hideNetworkOptions:function(){this.setState({showRemoveOptions:!1,showAbortOptions:!1,showNetworkOptions:!1})},showRemoveOptions:function(){this.setState({showRemoveOptions:!0})},showAbortOptions:function(){var e=this.state.network,t=e.getSelectedList();de[0].disabled=!t||!t.filter(S.canAbort).length,this.setState({showAbortOptions:!0})},showCreateOptions:function(){this.setState({showCreateOptions:!0})},hideCreateOptions:function(){this.setState({showCreateOptions:!1})},hideRemoveOptions:function(){this.setState({showRemoveOptions:!1})},hideAbortOptions:function(){this.setState({showAbortOptions:!1})},showHelpOptions:function(){this.setState({showHelpOptions:!0})},hideHelpOptions:function(){this.setState({showHelpOptions:!1})},showHasNewVersion:function(e){this.setState({hasNewVersion:e})},showRulesOptions:function(e){var t,n=this,r=n.state.rules,o=r.data,i=r.list;if("rules"===n.state.name){var a=i.length;le[0].disabled=2>a,le[1].disabled=1>a,t=le}else t=[],i.forEach(function(e){t.push(o[e])});n.setState({rulesOptions:t,showRulesOptions:!0})},hideRulesOptions:function(){this.setState({showRulesOptions:!1})},showValuesOptions:function(e){var t,n=this,r=this.state.values.list;if("values"===n.state.name){var o=r.length;ce[0].disabled=2>o,ce[1].disabled=1>o,t=ce}else{t=[];var i=n.getValuesFromRules()||[];i=S.unique(r.concat(i));var a=[];i.forEach(function(e){var n=-1!=r.indexOf(e),o={name:e,icon:n?"edit":"plus"};n?t.push(o):a.push(o)}),t=a.concat(t)}n.setState({valuesOptions:t,showValuesOptions:!0})},hideValuesOptions:function(){this.setState({showValuesOptions:!1})},showAndActivePlugins:function(e){this.hidePluginsOptions(),this.showPlugins(),this.showPluginTab(e.name)},showPluginTab:function(e){var t="Home",n=this.state.tabs||[];if(e&&e!=t)for(var r=0,o=n.length;o>r;r++)if(n[r].name==e){t=e,e=null;break}var i=e&&this.state.plugins[e+":"];if(i){if(n.length>=J)return G.alert("At most "+J+" tabs can be opened at the same time."),this.showPlugins();if(t=e,i.pluginHomepage&&!i.openInPlugins)return window.open(i.pluginHomepage);n.push({name:e,url:i.pluginHomepage||"plugin."+e+"/"})}this.setState({active:t,tabs:n}),this.updatePluginTabInfo(n,t)},updatePluginTabInfo:function(e,t){e=e.map(function(e){return e.name}),j.set("activePluginTabList",JSON.stringify(e)),t&&j.set("activePluginTabName",t)},activePluginTab:function(e){this.showPluginTab(f(e.target).attr("data-name"))},closePluginTab:function(e){for(var t=f(e.target).attr("data-name"),n=this.state.tabs||[],r=0,o=n.length;o>r;r++)if(n[r].name==t){n.splice(r,1);var i=this.state.active;if(i==t){var a=n[r]||n[r-1];this.state.active=a?a.name:null}return this.setState({tabs:n}),void this.updatePluginTabInfo(n)}},showPluginsOptions:function(e){this.setState({showPluginsOptions:!0})},hidePluginsOptions:function(){this.setState({showPluginsOptions:!1})},showWeinreOptionsQuick:function(e){var t=this.getWeinreFromRules();return t&&t.length?void f(e.target).closest("div").addClass("w-menu-wrapper-show"):void this.showAnonymousWeinre()},showWeinreOptions:function(e){var t=this,n=t.state.weinreOptions=t.getWeinreFromRules()||[];t.state.weinreOptions=S.unique(n).map(function(e){return{name:e,icon:"console"}}),t.setState({showWeinreOptions:!0})},hideWeinreOptions:function(){this.setState({showWeinreOptions:!1})},setMenuOptionsState:function(e,t){var n={showCreateRules:!1,showCreateValues:!1,showEditRules:!1,showEditValues:!1,showCreateOptions:!1};e&&(n[e]=!0),this.setState(n,t)},hideRulesInput:function(){this.setState({showCreateRules:!1})},hideValuesInput:function(){this.setState({showCreateValues:!1})},hideRenameRuleInput:function(){this.setState({showEditRules:!1})},hideRenameValueInput:function(){this.setState({showEditValues:!1})},showCreateRules:function(e,t){var n=A.findDOMNode(this.refs.createRulesInput);this._curFocusRulesItem=t,this.setState({showCreateRules:!0},function(){n.focus()})},showCreateValues:function(e,t){var n=A.findDOMNode(this.refs.createValuesInput);this._curFocusValuesItem=t,this.setState({showCreateValues:!0},function(){n.focus()})},showHttpsSettingsDialog:function(){f(A.findDOMNode(this.refs.rootCADialog)).modal("show")},interceptHttpsConnects:function(e){var t=this,n=e.target.checked;D.interceptHttpsConnects({interceptHttpsConnects:n?1:0},function(e,r){e&&0===e.ec?t.state.interceptHttpsConnects=n:S.showSystemError(r),t.setState({})})},enableHttp2:function(e){if(!D.supportH2){var t=this;return void G.confirm("The current version of Node.js cannot support HTTP/2.\nPlease upgrade to the latest LTS version.",function(e){e&&window.open("https://nodejs.org/"),t.setState({})})}var n=e.target.checked;D.enableHttp2({enableHttp2:n?1:0},function(e,r){e&&0===e.ec?t.state.enableHttp2=n:S.showSystemError(r),t.setState({})})},createRules:function(e){if(13==e.keyCode||"click"==e.type){var t=this,n=A.findDOMNode(t.refs.createRulesInput),r=n.value.trim();if(!r)return void z.error("The name cannot be empty.");var o,i=t.state.rules,a=e&&e.target.getAttribute("data-type");if("group"===a&&(o=!0,r="\r"+r),i.exists(r))return void z.error("The name '"+r+"' already exists.");var s="top"===a?1:"",l=t._curFocusRulesItem,c={name:r,addToTop:s};l&&(c.groupName=l.name),D.rules.add(c,function(e,a){if(e&&0===e.ec){var l=i[s?"unshift":"add"](r);n.value="",n.blur(),i.moveToGroup(r,c.groupName,s),!o&&t.setRulesActive(r),c.groupName&&k.trigger("expandRulesGroup",c.groupName),t.setState(o?{}:{activeRules:l},function(){o&&k.trigger("scrollRulesBottom")}),t.triggerRulesChange("create")}else S.showSystemError(a)})}},createValues:function(e){if(13==e.keyCode||"click"==e.type){var t=this,n=A.findDOMNode(t.refs.createValuesInput),r=n.value.trim();if(!r)return void z.error("The name cannot be empty.");if(/\s/.test(r))return void z.error("The name cannot contain spaces.");if(/#/.test(r))return void z.error("The name cannot contain #.");var o,i=t.state.values,a=e&&e.target.getAttribute("data-type");if("group"===a&&(o=!0,r="\r"+r),i.exists(r))return void z.error("The name '"+r+"' already exists.");var s=t._curFocusValuesItem,l={name:r};s&&(l.groupName=s.name),D.values.add(l,function(e,a){if(e&&0===e.ec){var s=i.add(r);n.value="",n.blur(),i.moveToGroup(r,l.groupName),!o&&t.setValuesActive(r),l.groupName&&k.trigger("expandValuesGroup",l.groupName),t.setState(o?{}:{activeValues:s},function(){o&&k.trigger("scrollValuesBottom")}),t.triggerValuesChange("create")}else S.showSystemError(a)})}},showEditRules:function(e){this.currentFocusRules=e;var t=this.state.rules,n=e||t.getActive();if(n&&!n.isDefault){var r=A.findDOMNode(this.refs.editRulesInput);r.value=n.name,this.setState({showEditRules:!0,selectedRule:n},function(){r.select(),r.focus()})}},showEditValuesByDBClick:function(e){!e.changed&&this.showEditValues()},showEditValues:function(e){this.currentFocusValues=e;var t=this.state.values,n=e||t.getActive();if(n&&!n.isDefault){var r=A.findDOMNode(this.refs.editValuesInput);r.value=n.name,this.setState({showEditValues:!0,selectedValue:n},function(){r.select(),r.focus()})}},editRules:function(e){if(13==e.keyCode||"click"==e.type){var t=this,n=t.state.rules,r=this.currentFocusRules||n.getActive();if(r){var o=A.findDOMNode(t.refs.editRulesInput),i=S.isGroup(r.name),a=(i?"\r":"")+o.value.trim();if(!a)return void z.error("The name cannot be empty.");if(n.exists(a))return void z.error("The name '"+a+"' already exists.");var s=r.name;D.rules.rename({name:s,newName:a},function(e,r){e&&0===e.ec?(n.rename(s,a),o.value="",o.blur(),!i&&t.setRulesActive(a),k.trigger("rulesNameChanged",[s,a]),t.setState({activeRules:n.getActive()}),t.triggerRulesChange("rename")):S.showSystemError(r)})}}},editValues:function(e){if(13==e.keyCode||"click"==e.type){var t=this,n=t.state.values,o=this.currentFocusValues||n.getActive();if(o){var i=A.findDOMNode(t.refs.editValuesInput),a=S.isGroup(o.name),s=(a?"\r":"")+i.value.trim();if(!s)return void z.error("The name cannot be empty.");if(n.exists(s))return void z.error("The name '"+s+"' already exists.");var l=o.name;D.values.rename({name:l,newName:s},function(e,c){e&&0===e.ec?(n.rename(l,s),i.value="",i.blur(),!a&&t.setValuesActive(s),k.trigger("valuesNameChanged",[l,s]),t.setState({activeValues:n.getActive()}),t.triggerValuesChange("rename"),r(o)):S.showSystemError(c)})}}},showAnonymousWeinre:function(){this.openWeinre()},showWeinre:function(e){this.openWeinre(e.name)},openWeinre:function(e){window.open("weinre/client/#"+(e||"anonymous")),this.setState({showWeinreOptions:!1})},onClickRulesOption:function(e){e.selected?this.unselectRules(e):this.selectRules(e)},selectRules:function(e){if(!S.isGroup(e.name)){var t=this;return D.rules[e.isDefault?"enableDefault":"select"](e,function(n,r){n&&0===n.ec?(t.reselectRules(n),t.state.rules.setChanged(e.name,!1),t.setState({}),t.triggerRulesChange("save"),t.state.disabledAllRules&&G.confirm("Rules has been turn off, do you want to turn on it?",function(e){e&&D.rules.disableAllRules({disabledAllRules:0},function(e,n){e&&0===e.ec?(t.state.disabledAllRules=!1,t.setState({})):S.showSystemError(n)})})):S.showSystemError(r)}),!1}},selectRulesByOptions:function(e){var t=this.state.rules.data[f(e.target).attr("data-name")];this[e.target.checked?"selectRules":"unselectRules"](t)},unselectRules:function(e){var t=this;return D.rules[e.isDefault?"disableDefault":"unselect"](e,function(e,n){e&&0===e.ec?(t.reselectRules(e),t.setState({})):S.showSystemError(n)}),!1},reselectRules:function(e,t){var n=this;n.state.rules.clearAllSelected(),n.setSelected(n.state.rules,"Default",!e.defaultRulesIsDisabled,t),e.list.forEach(function(e){n.setSelected(n.state.rules,e,!0,t)})},saveValues:function(e){if(e.changed&&!S.isGroup(e.name)){var t=this;return D.values.add(e,function(n,o){n&&0===n.ec?(t.setSelected(t.state.values,e.name),t.triggerValuesChange("save"),r(e)):S.showSystemError(o)}),!1}},setSelected:function(e,t,n,r){e.setSelected(t,n)&&(r||e.setChanged(t,!1),this.setState({curSelectedName:t}))},replayCountChange:function(e){var t=e.target.value.replace(/^\s*0*|[^\d]+/,""),n=t.slice(0,3);n>$&&(n=$),this.setState({replayCount:n})},clickReplay:function(e){e.shiftKey?k.trigger("replaySessions",[null,e.shiftKey]):this.replay(e)},replay:function(e,t,n){var r=this.state.network;if(t=Array.isArray(t)?t:r.getSelectedList(),t&&t.length){this.enableRecord();var o,i=function(e,t){var n=e.req;D.compose2({repeatCount:t,useH2:e.useH2?1:"",url:e.url,headers:S.getOriginalReqHeaders(e),method:n.method,base64:n.base64})};if(n>1?i(t[0],Math.min(n,$)):(o={},t.slice(0,$).forEach(function(e){o[e.id]=1,i(e)})),r.isTreeView){var a=D.lastSelectedDataId;if(!a)return;if(!o)return k.trigger("replayTreeView",[a,n]);var s=a&&r.getTreeNode(a);if(s=s&&s.parent,!s)return;n=0,s.children.forEach(function(e){e=e.data,e&&o[e.id]&&++n}),k.trigger("replayTreeView",[a,n])}else this.autoRefresh&&this.autoRefresh()}},enableRecord:function(){this.refs.recordBtn.enable(),k.trigger("changeRecordState")},composer:function(){k.trigger("composer")},clear:function(){var e=this.state.network;this.setState({network:e.clear(),showRemoveOptions:!1})},removeRulesBatch:function(e){var t=this;D.rules.remove({list:e},function(n,r){if(n&&0===n.ec){var o,i=t.state.rules;e.forEach(function(e){var n=i.data[e]||"";n.active&&(o=i.getSibling(e),o&&t.setRulesActive(o.name)),i.remove(e)}),o&&k.trigger("expandRulesGroup",o.name),t.setState(o?{activeRules:o}:{}),t.triggerRulesChange("remove"),k.trigger("focusRulesList")}else S.showSystemError(r)}),this.refs.deleteRulesDialog.hide()},removeValuesBatch:function(e){var t=this;D.values.remove({list:e},function(n,r){if(n&&0===n.ec){var o,i=t.state.values;e.forEach(function(e){var n=i.data[e]||"";n.active&&(o=i.getSibling(e),o&&t.setValuesActive(o.name)),i.remove(e)}),o&&k.trigger("expandValuesGroup",o.name),t.setState(o?{activeValues:o}:{}),t.triggerValuesChange("remove"),k.trigger("focusValuesList")}else S.showSystemError(r)}),this.refs.deleteValuesDialog.hide()},removeRules:function(e){var t=this.state.rules,n=e||t.getActive();n&&!n.isDefault&&this.refs.deleteRulesDialog.show(n.name)},removeValues:function(e){var t=this.state.values,n=e||t.getActive();n&&!n.isDefault&&this.refs.deleteValuesDialog.show(n.name)},setRulesActive:function(e,t){t=t||this.state.rules,j.set("activeRules",e),t.setActive(e)},setValuesActive:function(e,t){t=t||this.state.values,j.set("activeValues",e),t.setActive(e)},showRulesSettings:function(){var e=this;f(A.findDOMNode(e.refs.rulesSettingsDialog)).modal("show"),D.rules.accountRules(function(t,n){t&&0===t.ec?e.setState({accountRules:t.rules}):S.showSystemError(n)})},showValuesSettings:function(){f(A.findDOMNode(this.refs.valuesSettingsDialog)).modal("show")},toggleLeftMenu:function(){var e=!this.state.showLeftMenu;this.setState({showLeftMenu:e}),j.set("showLeftMenu",e?1:""),k.trigger("editorResize")},handleCreate:function(){"rules"==this.state.name?this.showCreateRules():this.showCreateValues()},saveRulesOrValues:function(){var e,t=this,n=t.state,r="rules"==n.name;r?(e=n.rules.getChangedList(),e.length&&(e.forEach(function(e){t.selectRules(e)}),t.setState({}))):(e=n.values.getChangedList(),e.length&&(e.forEach(function(e){t.saveValues(e)}),t.setState({})))},onClickMenu:function(e){var t=f(e.target).closest("a"),n=this,r=n.state,o="rules"==r.name;t.hasClass("w-edit-menu")?o?n.showEditRules():n.showEditValues():t.hasClass("w-delete-menu")?o?n.removeRules():n.removeValues():t.hasClass("w-save-menu")&&n.saveRulesOrValues()},showSettings:function(e){var t=this.state.name;return"rules"===t?void this.showRulesSettings():"values"===t?void this.showValuesSettings():void this.refs.networkSettings.showDialog()},activeRules:function(e){j.set("activeRules",e.name),this.setState({activeRules:e})},activeValues:function(e){j.set("activeValues",e.name),this.setState({activeValues:e})},onRulesThemeChange:function(e){var t=e.target.value;j.set("rulesTheme",t),this.setState({rulesTheme:t})},onValuesThemeChange:function(e){var t=e.target.value;j.set("valuesTheme",t),this.setState({valuesTheme:t})},onRulesFontSizeChange:function(e){var t=e.target.value;j.set("rulesFontSize",t),this.setState({rulesFontSize:t})},onValuesFontSizeChange:function(e){var t=e.target.value;j.set("valuesFontSize",t),this.setState({valuesFontSize:t})},onRulesLineNumberChange:function(e){var t=e.target.checked;j.set("showRulesLineNumbers",t),this.setState({showRulesLineNumbers:t})},onValuesLineNumberChange:function(e){var t=e.target.checked;j.set("showValuesLineNumbers",t),this.setState({showValuesLineNumbers:t})},showFoldGutter:function(e){var t=e.target.checked;j.set("foldGutter",t?"1":""),this.setState({foldGutter:t})},onRulesLineWrappingChange:function(e){var t=e.target.checked;j.set("autoRulesLineWrapping",t?1:""),this.setState({autoRulesLineWrapping:t})},onValuesLineWrappingChange:function(e){var t=e.target.checked;j.set("autoValuesLineWrapping",t?1:""),this.setState({autoValuesLineWrapping:t})},confirmDisableAllRules:function(e){var t=this,n=t.state;n.disabledAllRules?t.disableAllRules():G.confirm("Are you sure to disable all rules",function(e){e&&t.disableAllRules()}),e&&e.preventDefault()},confirmDisableAllPlugins:function(e){var t=this,n=t.state;n.disabledAllPlugins?t.disableAllPlugins():G.confirm("Are you sure to disable all plugins",function(e){e&&t.disableAllPlugins()}),e&&e.preventDefault()},disableAllRules:function(e,t){var n=this,r=n.state,o=!r.disabledAllRules;D.rules.disableAllRules({disabledAllRules:o?1:0},function(e,i){e&&0===e.ec?(r.disabledAllRules=o,n.setState({}),"function"==typeof t&&t(o)):S.showSystemError(i)}),e&&e.preventDefault()},disableAllPlugins:function(e,t){var n=this,r=n.state,o=!r.disabledAllPlugins;D.plugins.disableAllPlugins({disabledAllPlugins:o?1:0},function(e,i){e&&0===e.ec?(r.disabledAllPlugins=o,L.setPlugins(r),n.setState({}),"function"==typeof t&&t(o)):S.showSystemError(i)}),e&&e.preventDefault()},disablePlugin:function(e){var t=this,n=e.target;return t.state.ndp?z.warn("Not allowed disable plugins."):void D.plugins.disablePlugin({name:f(n).attr("data-name"),disabled:n.checked?0:1},function(e,n){e&&0===e.ec?(t.state.disabledPlugins=e.data,L.setPlugins(t.state),t.setState({})):S.showSystemError(n)})},abort:function(e){if(!Array.isArray(e)){var t=this.state.network;e=t.getSelectedList()}e&&(e=e.map(function(e){return S.canAbort(e)?e.id:void 0}),e.length&&D.abort({list:e.join()})),this.hideAbortOptions()},allowMultipleChoice:function(e){var t=this,n=e.target.checked;D.rules.allowMultipleChoice({allowMultipleChoice:n?1:0},function(e,r){e&&0===e.ec?t.setState({allowMultipleChoice:n}):S.showSystemError(r)})},enableBackRulesFirst:function(e){var t=this,n=e.target.checked;D.rules.enableBackRulesFirst({backRulesFirst:n?1:0},function(e,r){e&&0===e.ec?(t.setState({backRulesFirst:n}),D.backRulesFirst=n):S.showSystemError(r)})},reinstallAllPlugins:function(){D.enablePluginMgr?k.trigger("installPlugins"):k.trigger("updateAllPlugins","reinstallAllPlugins")},chooseFileType:function(e){var t=e.target.value;j.set("exportFileType",t),this.setState({exportFileType:t})},uploadSessions:function(){this.uploadSessionsForm(new FormData(A.findDOMNode(this.refs.importSessionsForm))),A.findDOMNode(this.refs.importSessions).value=""},importHarSessions:function(e){if(e&&"object"===("undefined"==typeof e?"undefined":p(e))){var t=e.log.entries,n=[];t.forEach(function(e){if(e){var t=e.whistleTimes||"",r=new Date(t.startTime||e.startedDateTime).getTime();if(!isNaN(r)){var o=e.request||{},i=e.response||{},a=S.parseHeadersFromHar(o.headers),s=S.parseHeadersFromHar(i.headers),l=e.clientIPAddress||"127.0.0.1",c=e.serverIPAddress||"",u=W.test(o.httpVersion||i.httpVersion),d=u?"2.0":"1.1",p=o.postData||"",h={method:o.method,ip:l,port:o.port,httpVersion:d,unzipSize:p.size,size:o.bodySize>0?o.bodySize:0,headers:a.headers,rawHeaderNames:a.rawHeaderNames,body:""},g=p.base64||p.text;g&&(p.base64?h.base64=g:h.body=g);var f=i.content,m={httpVersion:d,statusCode:i.statusCode||i.status,statusMessage:i.statusText,unzipSize:f.size,size:i.bodySize>0?i.bodySize:0,headers:s.headers,rawHeaderNames:s.rawHeaderNames,ip:c,port:i.port,body:""},A=i.content,M=A&&A.text;M&&(A.base64?m.base64=A.base64:"IMG"===S.getContentType(A.mimeType)||M.length%4===0&&/^[a-z\d+/]+={0,2}$/i.test(M)?m.base64=M:m.body=M);var w={useH2:u,startTime:r,frames:e.frames,url:o.url,realUrl:e.whistleRealUrl,req:h,res:m,customData:e.whistleCustomData,fwdHost:e.whistleFwdHost,sniPlugin:e.whistleSniPlugin,rules:e.whistleRules||{},captureError:e.whistleCaptureError,isHttps:e.whistleIsHttps,reqError:e.whistleReqError,resError:e.whistleResError,version:e.whistleVersion,nodeVersion:e.whistleNodeVersion};if(t&&t.startTime)w.dnsTime=t.dnsTime,w.requestTime=t.requestTime,w.responseTime=t.responseTime,w.endTime=t.endTime;else{var y=e.timings||{},b=Math.round(r+S.getTimeFromHar(e.time));r=Math.floor(r+S.getTimeFromHar(y.dns)),w.dnsTime=r,r=Math.floor(r+S.getTimeFromHar(y.connect)+S.getTimeFromHar(y.ssl)+S.getTimeFromHar(y.send)+S.getTimeFromHar(y.blocked)+S.getTimeFromHar(y.wait)),w.requestTime=r,r=Math.floor(r+S.getTimeFromHar(y.receive)),w.responseTime=r,w.endTime=Math.max(r,b)}n.push(w)}}}),D.addNetworkList(n)}},uploadSessionsForm:function(e){var t=e.get("importSessions");if(!t||!/\.(txt|json|saz|har)$/i.test(t.name))return G.alert("Only supports .txt, .json, .saz or .har file.");if(t.size>K)return G.alert("The file size cannot exceed 64m.");var n=/\.txt$/i.test(t.name);if(n||/\.har$/i.test(t.name)){var r=this;return void S.readFileAsText(t,function(e){try{e=JSON.parse(e),n?D.addNetworkList(e):r.importHarSessions(e)}catch(t){G.alert("Unrecognized format.")}})}D.upload.importSessions(e,D.addNetworkList)},getExportSessions:function(){var e=this.state.network,t=this.currentFoucsItem;return this.currentFoucsItem=null,t&&f(A.findDOMNode(this.refs.chooseFileType)).is(":visible")||(t=e.getSelectedList()),t},exportSessions:function(e,t,n){if(n=n||this.getExportSessions(),n&&n.length){var r=A.findDOMNode(this.refs.exportSessionsForm);A.findDOMNode(this.refs.exportFilename).value=t||"",A.findDOMNode(this.refs.exportFileType).value=e,"har"===e&&(n={log:{version:"1.2",creator:{name:"Whistle",version:this.state.version,comment:""},browser:{name:"Whistle",version:this.state.version},pages:[],entries:n.map(S.toHar),comment:""}}),A.findDOMNode(this.refs.sessions).value=JSON.stringify(n,null," "),r.submit()}},exportBySave:function(e){if(!e||"click"===e.type||13===e.keyCode){var t=A.findDOMNode(this.refs.sessionsName),n=t.value.trim();t.value="",this.exportSessions(this.state.exportFileType,n),f(A.findDOMNode(this.refs.chooseFileType)).modal("hide")}},replayRepeat:function(e){e&&"click"!==e.type&&13!==e.keyCode||(this.refs.setReplayCount.hide(),this.replay("",this.replayList,this.state.replayCount),k.trigger("focusNetworkList"))},showAboutDialog:function(e){f(e.target).closest(".w-menu-enable").length&&this.refs.aboutDialog.showAboutInfo()},showCustomCertsInfo:function(){var e=this;e.loadingCerts||(e.loadingCerts=!0,D.certs.all(function(t,n){return e.loadingCerts=!1,t?void e.refs.certsInfoDialog.show(t.certs,t.dir):void S.showSystemError(n)}))},onContextMenu:function(e){var t=0,n=se;if(n[2].hide&&++t,n[3].hide&&++t,n[4].hide&&++t,3>t){var r=S.getMenuPosition(e,110,100-30*t),o=this.state;r.list=n,n[2].checked=!!o.network.isTreeView,n[3].checked=!o.disabledAllRules,n[4].checked=!o.disabledAllPlugins;var i=f(e.target);n[0].hide=!0,n[1].hide=!0,i.closest(".w-network-menu").length?n[0].hide=!1:i.closest(".w-save-menu").length&&(n[1].hide=!1,i.closest(".w-rules-menu").length?n[1].disabled=!o.rules.hasChanged():n[1].disabled=!o.values.hasChanged()),this.refs.contextMenu.show(r)}e.preventDefault()},onClickContextMenu:function(e){var t=this,n=t.state,r=se;switch(e){case"Tree View":r[2].checked=!n.network.isTreeView,t.toggleTreeView();break;case"Rules":t.disableAllRules(null,function(e){r[3].checked=!e,t.setState({})});break;case"Plugins":t.disableAllPlugins(null,function(e){r[4].checked=!e,t.setState({})});break;case"Clear":return void t.clear();case"Save":return void t.saveRulesOrValues()}this.refs.contextMenu.show({})},forceShowLeftMenu:function(){var e=this;clearTimeout(e.hideTimer),clearTimeout(e.showTimer),e.showTimer=setTimeout(function(){e.setState({forceShowLeftMenu:!0})},200)},selectCAType:function(e){var t=e.target.value;"cer"!==t&&"pem"!==t&&(t="crt"),this.setState({caType:t}),j.set("caType",t)},forceHideLeftMenu:function(){var e=this;clearTimeout(e.hideTimer),clearTimeout(e.showTimer),e.hideTimer=setTimeout(function(){e.setState({forceShowLeftMenu:!1})},500)},updateMenuView:function(e){var t=e.networkOptions[e.networkOptions.length-1];return e.network.isTreeView?(t.icon="globe",t.name="Show List View"):(t.icon="tree-conifer",t.name="Show Tree View"),e},toggleTreeView:function(){var e=this,t=e.state.network;t.setTreeView(!t.isTreeView),e.updateMenuView(e.state),e.setState({},function(){t.isTreeView||e.autoRefresh&&e.autoRefresh()})},toggleTreeViewByIcon:function(){"network"==this.getTabName()&&this.toggleTreeView()},getTabName:function(){var e=this.state,t=e.rulesMode,n=e.pluginsMode,r=e.name;return e.showAccount&&"account"===r?r:(e.networkMode?r="network":e.rulesOnlyMode?r="values"===r?"values":"rules":t&&n?r="plugins":t?r="network"===r?"rules":r:n&&(r="plugins"!==r?"network":r),r||"network")},render:function(){var e=this.state,t=e.networkMode,n=e.rulesMode,r=e.rulesOnlyMode,o=e.pluginsMode,i=e.multiEnv,a=this.getTabName(),s="account"==a,l="network"==a,c="rules"==a,u="values"==a,p="plugins"==a,g=c||u,f=g?null:oe,A=p||s?oe:null,M=s?null:oe,y=!0,S=!0,L=e.rulesTheme||"cobalt",k=e.valuesTheme||"cobalt",j=e.rulesFontSize||"14px",z=e.valuesFontSize||"14px",G=e.showRulesLineNumbers||!1,W=e.showValuesLineNumbers||!1,X=e.autoRulesLineWrapping,J=e.autoValuesLineWrapping,K=e.rulesOptions,Z=e.pluginsOptions,q={},ee=e.showNetworkOptions,te=e.showRulesOptions,ne=e.showValuesOptions,ie=e.showPluginsOptions,ae=e.showWeinreOptions,le=e.showHelpOptions,ce=e.network,pe=ce.isTreeView,he=pe?"tree-conifer":"globe";K[0].name===_&&K.forEach(function(t,n){t.icon=n&&e.multiEnv?"edit":"checkbox",t.selected||(q[t.name]=1)});var ge,fe;if(c){fe=e.rules.data;for(ge in fe)if(fe[ge].active){y=S=fe[ge].isDefault;break}}else if(u){fe=e.values.data;for(ge in fe)if(fe[ge].active){y=S=!1;break}}ce.rulesModal=e.rules,e.rules.editorTheme={theme:L,fontSize:j,lineNumbers:G};var me=e.networkOptions,Ae=ce.hasUnselected();ce.hasSelected()?(me.forEach(function(e){e.disabled=!1,"removeUnselected"===e.id&&(e.disabled=!Ae)}),ue.forEach(function(e){e.disabled=!1,"removeUnselected"===e.id&&(e.disabled=!Ae)})):(me.forEach(function(e){-1!==re.indexOf(e.id)?e.disabled=!0:"removeUnselected"===e.id&&(e.disabled=!Ae)}),me[0].disabled=!Ae,ue.forEach(function(e){-1!==re.indexOf(e.id)?e.disabled=!0:"removeUnselected"===e.id&&(e.disabled=!Ae)}));var Me,we,ye=e.pendingSessions,be=e.pendingRules,ve=e.pendingValues,Te=e.accountRules,xe=h&&!e.forceShowLeftMenu,Ne=o&&n,Ce=e.showAccount,Ie=(t&&!Ce||e.showLeftMenu)&&(!Ne||Ce),Ee=e.disabledAllPlugins,De=e.disabledAllRules,Se=r||Ne&&!Ce||t?oe:null;Ie&&h&&(Me=this.forceShowLeftMenu,we=this.forceHideLeftMenu),se[2].hide=n,se[3].hide=o,se[4].hide=r;var Le=e.caType||"crt",ke="img/qrcode.png",je="cgi-bin/rootca",Ue="http://rootca.pro/";"crt"!==Le&&(ke="img/qrcode-"+Le+".png",je+="?type="+Le,Ue+=Le);var Be=o||t,Qe=Be?oe:null;return D.hideMockMenu=Be,m.createElement("div",{className:"main orient-vertical-box"+(Ie?" w-show-left-menu":"")+(Ce?" w-show-account":"")+(g&&!r?" w-show-editor":"")+(c?" w-show-rules":"")+(r||n?" w-show-rules-mode":"")},m.createElement("div",{className:"w-menu w-"+a+"-menu-list"},m.createElement("a",{onClick:this.toggleLeftMenu,draggable:"false",className:"w-show-left-menu-btn",onMouseEnter:Me,onMouseLeave:we,style:Ce||!t&&!Ne?null:oe,title:"Dock to "+(Ie?"top":"left")+" (Ctrl[Command] + M)"},m.createElement("span",{className:"glyphicon glyphicon-chevron-"+(Ie?xe?"down":"up":"left")})),m.createElement("div",{style:{display:n?"none":void 0},onMouseEnter:this.showNetworkOptions,onMouseLeave:this.hideNetworkOptions,className:"w-nav-menu w-menu-wrapper"+(ee?" w-menu-wrapper-show":"")},m.createElement("a",{onClick:this.showNetwork,onDoubleClick:this.toggleTreeView,className:"w-network-menu"+(l?" w-menu-selected":""),title:"Double click to show"+(pe?" List View":" Tree View"),draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-"+he}),"Network"),m.createElement(x,{ref:"networkMenuItem",options:e.networkOptions,className:"w-network-menu-item",onClickOption:this.handleNetwork})),m.createElement("div",{style:Qe,onMouseEnter:this.showRulesOptions,onMouseLeave:this.hideRulesOptions,className:"w-nav-menu w-menu-wrapper"+(te?" w-menu-wrapper-show":"")+(c?" w-menu-auto":"")},m.createElement("a",{onClick:this.showRules,className:"w-rules-menu"+(c?" w-menu-selected":""),draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-list"+(De?" w-disabled":"")}),"Rules"),m.createElement(x,{ref:"rulesMenuItem",name:c?null:"Open",options:K,checkedOptions:q,disabled:De,className:"w-rules-menu-item",onClick:this.showRules,onClickOption:this.showAndActiveRules,onChange:this.selectRulesByOptions})),m.createElement("div",{style:Qe,onMouseEnter:this.showValuesOptions,onMouseLeave:this.hideValuesOptions,className:"w-nav-menu w-menu-wrapper"+(ne?" w-menu-wrapper-show":"")+(u?" w-menu-auto":"")},m.createElement("a",{onClick:this.showValues,className:"w-values-menu"+(u?" w-menu-selected":""),draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-folder-close"}),"Values"),m.createElement(x,{ref:"valuesMenuItem",name:u?null:"Open",options:e.valuesOptions,className:"w-values-menu-item",onClick:this.showValues,onClickOption:this.showAndActiveValues})),m.createElement("div",{style:Se,ref:"pluginsMenu",onMouseEnter:this.showPluginsOptions,onMouseLeave:this.hidePluginsOptions,className:"w-nav-menu w-menu-wrapper"+(ie?" w-menu-wrapper-show":"")},m.createElement("a",{onClick:this.showPlugins,className:"w-plugins-menu"+(p?" w-menu-selected":""),draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-list-alt"+(Ee?" w-disabled":"")}),"Plugins"),m.createElement(x,{ref:"pluginsMenuItem",name:p?null:"Open",options:Z,checkedOptions:e.disabledPlugins,disabled:Ee,className:"w-plugins-menu-item",onClick:this.showPlugins,onChange:this.disablePlugin,onClickOption:this.showAndActivePlugins})),m.createElement("a",{onClick:this.showAccount,className:"w-account-menu"+(s?" w-menu-selected":""),draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-user"}),"Account"),!e.ndr&&m.createElement("a",{onClick:this.confirmDisableAllRules,className:"w-enable-rules-menu",title:De?"Enable all rules":"Disable all rules",style:{display:c?"":"none",color:De?"#f66":void 0},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-"+(De?"play-circle":"off")}),De?"ON":"OFF"),!e.ndp&&m.createElement("a",{onClick:this.confirmDisableAllPlugins,className:"w-enable-plugin-menu",title:Ee?"Enable all plugins":"Disable all plugins",style:{display:p?"":"none",color:Ee?"#f66":void 0},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-"+(Ee?"play-circle":"off")}),Ee?"ON":"OFF"),m.createElement(R,{hide:!p}),m.createElement("a",{onClick:this.reinstallAllPlugins,className:"w-plugins-menu"+(p?"":" hide"),draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-download-alt"}),D.enablePluginMgr?"Install":"ReinstallAll"),m.createElement(N,{ref:"recordBtn",hide:!l,onClick:this.handleAction}),m.createElement("a",{onClick:this.importData,className:"w-import-menu",style:A,draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-import"}),"Import"),m.createElement("a",{onClick:this.exportData,className:"w-export-menu",style:A,draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-export"}),"Export"),m.createElement("div",{onMouseEnter:this.showRemoveOptions,onMouseLeave:this.hideRemoveOptions,style:{display:l?"":"none"},className:"w-menu-wrapper w-remove-menu-list w-menu-auto"+(e.showRemoveOptions?" w-menu-wrapper-show":"")},m.createElement("a",{onClick:this.clear,className:"w-remove-menu",title:"Ctrl[Command] + X",draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-remove"}),"Clear"),m.createElement(x,{options:ue,className:"w-remove-menu-item",onClickOption:this.handleNetwork})),m.createElement("a",{onClick:this.onClickMenu,className:"w-save-menu",style:f,draggable:"false",title:"Ctrl[Command] + S"},m.createElement("span",{className:"glyphicon glyphicon-save-file"}),"Save"),m.createElement("a",{className:"w-create-menu",style:f,draggable:"false",onClick:this.handleCreate},m.createElement("span",{className:"glyphicon glyphicon-plus"}),"Create"),m.createElement("a",{onClick:this.onClickMenu,className:"w-edit-menu"+(y?" w-disabled":""),style:f,draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-transfer"}),"Rename"),m.createElement("div",{onMouseEnter:this.showAbortOptions,onMouseLeave:this.hideAbortOptions,style:{display:l?"":"none"},className:"w-menu-wrapper w-abort-menu-list w-menu-auto"+(e.showAbortOptions?" w-menu-wrapper-show":"")},m.createElement("a",{onClick:this.clickReplay,className:"w-replay-menu",draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-repeat"}),"Replay"),m.createElement(x,{options:de,className:"w-remove-menu-item",onClickOption:this.abort})),m.createElement("a",{onClick:this.composer,className:"w-composer-menu",style:{display:l?"":"none"},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-send"}),"Edit"),m.createElement("a",{onClick:this.onClickMenu,className:"w-delete-menu"+(S?" w-disabled":""),style:f,draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-trash"}),"Delete"),m.createElement("a",{ +onClick:this.addWidget,className:"w-add-widget",style:M,draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-plus"}),"Widget"),m.createElement(Q,{onClick:this.showSettings,disabledRules:c&&De,isNetwork:l,hide:p}),m.createElement("div",{onMouseEnter:this.showWeinreOptions,onMouseLeave:this.hideWeinreOptions,className:"w-menu-wrapper"+(ae?" w-menu-wrapper-show":"")},m.createElement("a",{onClick:this.showFiles,className:"w-files-menu",style:Ce?null:oe,draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-file"}),"Files"),m.createElement("a",{onClick:this.showWeinreOptionsQuick,onDoubleClick:this.showAnonymousWeinre,className:"w-weinre-menu",draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-console"}),m.createElement("span",{className:"w-weinre-name"},"Weinre")),m.createElement(x,{ref:"weinreMenuItem",name:"anonymous",options:e.weinreOptions,className:"w-weinre-menu-item",onClick:this.showAnonymousWeinre,onClickOption:this.showWeinre})),m.createElement("a",{onClick:this.showHttpsSettingsDialog,className:"w-https-menu",draggable:"false",style:{color:D.hasInvalidCerts?"red":void 0}},m.createElement("span",{className:"glyphicon glyphicon-"+(e.interceptHttpsConnects?"ok":"lock")}),m.createElement("span",{className:"w-https-name"},"HTTPS")),m.createElement("div",{onMouseEnter:this.showHelpOptions,onMouseLeave:this.hideHelpOptions,className:"w-menu-wrapper"+(le?" w-menu-wrapper-show":"")},m.createElement("a",{className:"w-help-menu"+(e.hasNewVersion?" w-menu-enable":""),onClick:this.showAboutDialog,title:e.hasNewVersion?"There is a new version of whistle":void 0,href:e.hasNewVersion?void 0:"https://github.com/avwo/whistle#whistle",target:e.hasNewVersion?void 0:"_blank"},e.hasNewVersion?m.createElement("i",{className:"w-new-version-icon"}):null,m.createElement("span",{className:"glyphicon glyphicon-question-sign"}),m.createElement("span",{className:"w-help-name"},"Help")),m.createElement(x,{ref:"helpMenuItem",options:e.helpOptions,name:m.createElement(v,{ref:"aboutDialog",onClick:this.hideHelpOptions,onCheckUpdate:this.showHasNewVersion}),className:"w-help-menu-item"})),m.createElement(T,{name:a}),m.createElement("div",{onMouseDown:this.preventBlur,style:{display:e.showCreateRules?"block":"none"},className:"shadow w-input-menu-item w-create-rules-input"},m.createElement("input",{ref:"createRulesInput",onKeyDown:this.createRules,onBlur:this.hideRulesInput,type:"text",maxLength:"64",placeholder:"Input the name"}),m.createElement("button",{type:"button",onClick:this.createRules,className:"btn btn-primary"},"+Rule"),m.createElement("button",{type:"button",onClick:this.createRules,"data-type":"top",className:"btn btn-default"},"+Top"),m.createElement("button",{type:"button",onClick:this.createRules,"data-type":"group",className:"btn btn-default"},"+Group")),m.createElement("div",{onMouseDown:this.preventBlur,style:{display:e.showCreateValues?"block":"none"},className:"shadow w-input-menu-item w-create-values-input"},m.createElement("input",{ref:"createValuesInput",onKeyDown:this.createValues,onBlur:this.hideValuesInput,type:"text",maxLength:"64",placeholder:"Input the name"}),m.createElement("button",{type:"button",onClick:this.createValues,className:"btn btn-primary"},"+Key"),m.createElement("button",{type:"button",onClick:this.createValues,"data-type":"group",className:"btn btn-default"},"+Group")),m.createElement("div",{onMouseDown:this.preventBlur,style:{display:e.showEditRules?"block":"none"},className:"shadow w-input-menu-item w-edit-rules-input"},m.createElement("input",{ref:"editRulesInput",onKeyDown:this.editRules,onBlur:this.hideRenameRuleInput,type:"text",maxLength:"64"}),m.createElement("button",{type:"button",onClick:this.editRules,className:"btn btn-primary"},"OK")),m.createElement("div",{onMouseDown:this.preventBlur,style:{display:e.showEditValues?"block":"none"},className:"shadow w-input-menu-item w-edit-values-input"},m.createElement("input",{ref:"editValuesInput",onKeyDown:this.editValues,onBlur:this.hideRenameValueInput,type:"text",maxLength:"64"}),m.createElement("button",{type:"button",onClick:this.editValues,className:"btn btn-primary"},"OK"))),m.createElement("div",{className:"w-container box fill"},m.createElement(O,{onClick:this.onClickContextMenu,ref:"contextMenu"}),m.createElement("div",{onContextMenu:this.onContextMenu,onDoubleClick:this.onContextMenu,className:"w-left-menu"+(Me?" w-hover-left-menu":""),style:!Ce&&t||xe?oe:null,onMouseEnter:Me,onMouseLeave:we},m.createElement("a",{onClick:this.showNetwork,className:"w-network-menu"+(l?" w-menu-selected":""),style:{display:n?"none":void 0},draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-"+he}),m.createElement("i",{className:"w-left-menu-name"},"Network")),m.createElement("a",{onClick:this.showRules,className:"w-save-menu w-rules-menu"+(c?" w-menu-selected":""),style:Qe,draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-list"+(De?" w-disabled":"")}),m.createElement("i",{className:"w-left-menu-name"},"Rules"),m.createElement("i",{className:"w-menu-changed",style:{display:e.rules.hasChanged()?void 0:"none"}},"*")),m.createElement("a",{onClick:this.showValues,className:"w-save-menu w-values-menu"+(u?" w-menu-selected":""),style:Qe,draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-folder-close"}),m.createElement("i",{className:"w-left-menu-name"},"Values"),m.createElement("i",{className:"w-menu-changed",style:{display:e.values.hasChanged()?void 0:"none"}},"*")),m.createElement("a",{onClick:this.showPlugins,className:"w-plugins-menu"+(p?" w-menu-selected":""),style:Se,draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-list-alt"+(Ee?" w-disabled":"")}),m.createElement("i",{className:"w-left-menu-name"},"Plugins")),m.createElement("a",{onClick:this.showAccount,className:"w-account-menu"+(s?" w-menu-selected":""),draggable:"false"},m.createElement("span",{className:"glyphicon glyphicon-user"}),m.createElement("i",{className:"w-left-menu-name"},"Account"))),e.hasRules?m.createElement(w,{ref:"rules",disabled:De,theme:L,lineWrapping:X,fontSize:j,lineNumbers:G,onSelect:this.selectRules,onUnselect:this.unselectRules,onActive:this.activeRules,modal:e.rules,hide:!c,name:"rules"}):void 0,e.hasValues?m.createElement(w,{theme:k,onDoubleClick:this.showEditValuesByDBClick,fontSize:z,lineWrapping:J,lineNumbers:W,onSelect:this.saveValues,onActive:this.activeValues,modal:e.values,hide:!u,className:"w-values-list",foldGutter:e.foldGutter}):void 0,e.hasAccount?m.createElement(Y,{hide:!s}):void 0,e.hasNetwork?m.createElement(b,{ref:"network",hide:!l,modal:ce}):void 0,e.hasPlugins?m.createElement(E,d({},e,{onOpen:this.activePluginTab,onClose:this.closePluginTab,onActive:this.activePluginTab,onChange:this.disablePlugin,ref:"plugins",hide:!p})):void 0),m.createElement("div",{ref:"rulesSettingsDialog",className:"modal fade w-rules-settings-dialog"},m.createElement("div",{className:"modal-dialog"},m.createElement("div",{className:"modal-content"},m.createElement("div",{className:"modal-body"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},m.createElement("span",{"aria-hidden":"true"},"×")),m.createElement(C,{theme:L,fontSize:j,lineNumbers:G,lineWrapping:X,onLineWrappingChange:this.onRulesLineWrappingChange,onThemeChange:this.onRulesThemeChange,onFontSizeChange:this.onRulesFontSizeChange,onLineNumberChange:this.onRulesLineNumberChange}),!e.drb&&m.createElement("p",{className:"w-editor-settings-box"},m.createElement("label",null,m.createElement("input",{type:"checkbox",checked:e.backRulesFirst,onChange:this.enableBackRulesFirst})," ","Back rules first")),!e.drm&&m.createElement("p",{className:"w-editor-settings-box"},m.createElement("label",{style:{color:i?"#aaa":void 0}},m.createElement("input",{type:"checkbox",disabled:i,checked:!i&&e.allowMultipleChoice,onChange:this.allowMultipleChoice})," ","Use multiple rules")),Te&&Te.trim()?m.createElement("fieldset",{className:"w-fieldset"},m.createElement("legend",null,"Account Rules",m.createElement("span",{className:"glyphicon glyphicon-edit"})),m.createElement("pre",null,Te)):null),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"Close"))))),m.createElement("div",{ref:"valuesSettingsDialog",className:"modal fade w-values-settings-dialog"},m.createElement("div",{className:"modal-dialog"},m.createElement("div",{className:"modal-content"},m.createElement("div",{className:"modal-body"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},m.createElement("span",{"aria-hidden":"true"},"×")),m.createElement(C,{theme:k,fontSize:z,lineNumbers:W,lineWrapping:J,onLineWrappingChange:this.onValuesLineWrappingChange,onThemeChange:this.onValuesThemeChange,onFontSizeChange:this.onValuesFontSizeChange,onLineNumberChange:this.onValuesLineNumberChange}),m.createElement("p",{className:"w-editor-settings-box"},m.createElement("label",null,m.createElement("input",{type:"checkbox",checked:e.foldGutter,onChange:this.showFoldGutter})," ","Show fold gutter"))),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"Close"))))),m.createElement(I,{ref:"networkSettings"}),m.createElement("div",{ref:"rootCADialog",className:"modal fade w-https-dialog"},m.createElement("div",{className:"modal-dialog"},m.createElement("div",{className:"modal-content"},m.createElement("div",{className:"modal-body"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},m.createElement("span",{"aria-hidden":"true"},"×")),m.createElement("div",null,m.createElement("a",{className:"w-help-menu",title:"Click here to learn how to install root ca",href:"https://avwo.github.io/whistle/webui/https.html",target:"_blank"},m.createElement("span",{className:"glyphicon glyphicon-question-sign"})),m.createElement("a",{className:"w-download-rootca",title:Ue,href:je,target:"downloadTargetFrame"},"Download RootCA"),m.createElement("select",{className:"w-root-ca-type",value:Le,onChange:this.selectCAType},m.createElement("option",{value:"crt"},"rootCA.crt"),m.createElement("option",{value:"cer"},"rootCA.cer"),m.createElement("option",{value:"pem"},"rootCA.pem"))),m.createElement("a",{title:Ue,href:je,target:"downloadTargetFrame"},m.createElement("img",{src:ke,width:"320"})),m.createElement("div",{className:"w-https-settings"},m.createElement("p",null,m.createElement("label",{title:i?"Use `pattern enable://capture` in rules to replace global configuration":void 0},m.createElement("input",{disabled:i,checked:e.interceptHttpsConnects,onChange:this.interceptHttpsConnects,type:"checkbox"})," ","Capture TUNNEL CONNECTS")),m.createElement("p",null,m.createElement("label",null,m.createElement("input",{checked:D.supportH2&&e.enableHttp2,onChange:this.enableHttp2,type:"checkbox"})," ","Enable HTTP/2")),m.createElement("a",{draggable:"false",style:{color:D.hasInvalidCerts?"red":void 0},onClick:this.showCustomCertsInfo},"View all custom certificates"),m.createElement(H,{ref:"certsInfoDialog"}))),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"Close"))))),m.createElement("div",{ref:"chooseFileType",className:"modal fade w-choose-filte-type"},m.createElement("div",{className:"modal-dialog"},m.createElement("div",{className:"modal-content"},m.createElement("div",{className:"modal-body"},m.createElement("label",{className:"w-choose-filte-type-label"},"Save as:",m.createElement("input",{ref:"sessionsName",onKeyDown:this.exportBySave,placeholder:"Input the filename",className:"form-control",maxLength:"64"}),m.createElement("select",{ref:"fileType",className:"form-control",value:e.exportFileType,onChange:this.chooseFileType},m.createElement("option",{value:"whistle"},"*.txt"),m.createElement("option",{value:"Fiddler"},"*.saz"),m.createElement("option",{value:"har"},"*.har"))),m.createElement("a",{type:"button",onKeyDown:this.exportBySave,tabIndex:"0",onMouseDown:this.preventBlur,className:"btn btn-primary",onClick:this.exportBySave},"Export"))))),m.createElement(F,{ref:"editorWin",className:"w-editor-win"}),m.createElement(U,{ref:"setReplayCount",wstyle:"w-replay-count-dialog"},m.createElement("div",{className:"modal-body"},m.createElement("label",null,"Times:",m.createElement("input",{ref:"replayCount",placeholder:"<= "+$,onKeyDown:this.replayRepeat,onChange:this.replayCountChange,value:e.replayCount,className:"form-control",maxLength:"3"})),m.createElement("button",{type:"button",onKeyDown:this.replayRepeat,tabIndex:"0",onMouseDown:this.preventBlur,className:"btn btn-primary",disabled:!e.replayCount,onClick:this.replayRepeat},"Replay"))),m.createElement(U,{ref:"importRemoteRules",wstyle:"w-import-remote-dialog"},m.createElement("div",{className:"modal-body"},m.createElement("input",{readOnly:be,ref:"rulesRemoteUrl",maxLength:"2048",onKeyDown:this.importRemoteRules,placeholder:"Input the url",style:{"ime-mode":"disabled"}})),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-primary",disabled:be,onMouseDown:this.preventBlur,onClick:this.importRemoteRules},be?"Importing rules":"Import rules"),m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"Close"))),m.createElement(U,{ref:"importRemoteSessions",wstyle:"w-import-remote-dialog"},m.createElement("div",{className:"modal-body"},m.createElement("input",{readOnly:ye,ref:"sessionsRemoteUrl",maxLength:"2048",onKeyDown:this.importRemoteSessions,placeholder:"Input the url",style:{"ime-mode":"disabled"}})),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-primary",disabled:ye,onMouseDown:this.preventBlur,onClick:this.importRemoteSessions},ye?"Importing sessions":"Import sessions"),m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"Close"))),m.createElement(U,{ref:"importRemoteValues",wstyle:"w-import-remote-dialog"},m.createElement("div",{className:"modal-body"},m.createElement("input",{readOnly:ve,ref:"valuesRemoteUrl",maxLength:"2048",onKeyDown:this.importRemoteValues,placeholder:"Input the url",style:{"ime-mode":"disabled"}})),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-primary",disabled:ve,onMouseDown:this.preventBlur,onClick:this.importRemoteValues},ve?"Importing values":"Import values"),m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"Close"))),m.createElement("div",{ref:"showUpdateTipsDialog",className:"modal fade w-show-update-tips-dialog"},m.createElement("div",{className:"modal-dialog"},m.createElement("div",{className:"modal-content"},m.createElement("div",{className:"modal-body"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},m.createElement("span",{"aria-hidden":"true"},"×")),m.createElement("p",{className:"w-show-update-tips"},"whistle has important updates, it is recommended that you update to the latest version."),m.createElement("p",null,"Current version: ",e.version),m.createElement("p",null,"The latest stable version: ",e.latestVersion),m.createElement("p",null,"View change:"," ",m.createElement("a",{title:"Change log",href:"https://github.com/avwo/whistle/blob/master/CHANGELOG.md",target:"_blank"},"CHANGELOG.md"))),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-default",onClick:this.donotShowAgain,"data-dismiss":"modal"},"Don't show again"),m.createElement("a",{type:"button",className:"btn btn-primary",onClick:this.hideUpdateTipsDialog,href:"https://avwo.github.io/whistle/update.html",target:"_blank"},"View Update Guide"))))),m.createElement(U,{ref:"confirmReload",wstyle:"w-confirm-reload-dialog"},m.createElement("div",{className:"modal-body w-confirm-reload"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal"},m.createElement("span",{"aria-hidden":"true"},"×")),m.createElement("div",{className:"w-reload-data-tips"})),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},"No"),m.createElement("button",{type:"button",className:"btn btn-primary",onClick:this.reloadData,"data-dismiss":"modal"},"Yes"))),m.createElement(U,{ref:"confirmImportRules",wstyle:"w-confirm-import-dialog"},m.createElement("div",{className:"modal-body w-confirm-import"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal"},m.createElement("span",{"aria-hidden":"true"},"×")),"Whether to replace the existing rules?"),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-danger",onClick:this.uploadRules,"data-dismiss":"modal"},"Replace"),m.createElement("button",{type:"button",className:"btn btn-primary",onClick:this.uploadRules,"data-dismiss":"modal"},"Reserve"))),m.createElement(U,{ref:"confirmImportValues",wstyle:"w-confirm-import-dialog"},m.createElement("div",{className:"modal-body w-confirm-import"},m.createElement("button",{type:"button",className:"close","data-dismiss":"modal"},m.createElement("span",{"aria-hidden":"true"},"×")),"Whether to replace the existing values?"),m.createElement("div",{className:"modal-footer"},m.createElement("button",{type:"button",className:"btn btn-danger",onClick:this.uploadValues,"data-dismiss":"modal"},"Replace"),m.createElement("button",{type:"button",className:"btn btn-primary",onClick:this.uploadValues,"data-dismiss":"modal"},"Reserve"))),m.createElement(B,{ref:"deleteRulesDialog",tips:"Are you sure to delete all follow rules or group?",onConfirm:this.removeRulesBatch,name:"rules",isRules:"1",list:e.rules.list}),m.createElement(B,{ref:"deleteValuesDialog",tips:"Are you sure to delete all follow values or group?",onConfirm:this.removeValuesBatch,name:"values",list:e.values.list}),m.createElement(B,{ref:"selectRulesDialog",name:"rules",list:e.rules.list}),m.createElement(B,{ref:"selectValuesDialog",name:"values",list:e.values.list}),m.createElement("iframe",{name:"downloadTargetFrame",style:{display:"none"}}),m.createElement("form",{ref:"exportSessionsForm",action:"cgi-bin/sessions/export",style:{display:"none"},method:"post",target:"downloadTargetFrame"},m.createElement("input",{ref:"exportFilename",name:"exportFilename",type:"hidden"}),m.createElement("input",{ref:"exportFileType",name:"exportFileType",type:"hidden"}),m.createElement("input",{ref:"sessions",name:"sessions",type:"hidden"})),m.createElement("form",{ref:"importSessionsForm",encType:"multipart/form-data",style:{display:"none"}},m.createElement("input",{ref:"importSessions",onChange:this.uploadSessions,type:"file",name:"importSessions",accept:".txt,.json,.saz,.har"})),m.createElement("form",{ref:"importRulesForm",encType:"multipart/form-data",style:{display:"none"}},m.createElement("input",{ref:"importRules",onChange:this.uploadRulesForm,name:"rules",type:"file",accept:".txt,.json"})),m.createElement("form",{ref:"importValuesForm",encType:"multipart/form-data",style:{display:"none"}},m.createElement("input",{ref:"importValues",onChange:this.uploadValuesForm,name:"values",type:"file",accept:".txt,.json"})),m.createElement(V,{ref:"syncDialog"}),m.createElement(P,{ref:"jsonDialog"}),m.createElement("div",{id:"copyTextBtn",style:{display:"none"}}))}});D.getInitialData(function(e){A.render(m.createElement(pe,{modal:e}),document.getElementById("container"))})},function(e,t){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function r(e){var t=n(e),r=t[0],o=t[1];return 3*(r+o)/4-o}function o(e,t,n){return 3*(t+n)/4-n}function i(e){var t,r,i=n(e),a=i[0],s=i[1],l=new d(o(e,a,s)),c=0,p=s>0?a-4:a;for(r=0;p>r;r+=4)t=u[e.charCodeAt(r)]<<18|u[e.charCodeAt(r+1)]<<12|u[e.charCodeAt(r+2)]<<6|u[e.charCodeAt(r+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=u[e.charCodeAt(r)]<<2|u[e.charCodeAt(r+1)]>>4,l[c++]=255&t),1===s&&(t=u[e.charCodeAt(r)]<<10|u[e.charCodeAt(r+1)]<<4|u[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l}function a(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function s(e,t,n){for(var r,o=[],i=t;n>i;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(a(r));return o.join("")}function l(e){for(var t,n=e.length,r=n%3,o=[],i=16383,a=0,l=n-r;l>a;a+=i)o.push(s(e,a,a+i>l?l:a+i));return 1===r?(t=e[n-1],o.push(c[t>>2]+c[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(c[t>>10]+c[t>>4&63]+c[t<<2&63]+"=")),o.join("")}t.byteLength=r,t.toByteArray=i,t.fromByteArray=l;for(var c=[],u=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,g=p.length;g>h;++h)c[h]=p[h],u[p.charCodeAt(h)]=h;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},function(e,t,n){var r,o;(function(n){!function(t,n){e.exports=n(t)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof n?n:this,function(n){"use strict";n=n||{};var i,a=n.Base64,s="2.6.4",l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=function(e){for(var t={},n=0,r=e.length;r>n;n++)t[e.charAt(n)]=n;return t}(l),u=String.fromCharCode,d=function(e){if(e.length<2){var t=e.charCodeAt(0);return 128>t?e:2048>t?u(192|t>>>6)+u(128|63&t):u(224|t>>>12&15)+u(128|t>>>6&63)+u(128|63&t)}var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return u(240|t>>>18&7)+u(128|t>>>12&63)+u(128|t>>>6&63)+u(128|63&t)},p=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,h=function(e){return e.replace(p,d)},g=function(e){var t=[0,2,1][e.length%3],n=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0),r=[l.charAt(n>>>18),l.charAt(n>>>12&63),t>=2?"=":l.charAt(n>>>6&63),t>=1?"=":l.charAt(63&n)];return r.join("")},f=n.btoa&&"function"==typeof n.btoa?function(e){return n.btoa(e)}:function(e){if(e.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return e.replace(/[\s\S]{1,3}/g,g)},m=function(e){return f(h(String(e)))},A=function(e){return e.replace(/[+\/]/g,function(e){return"+"==e?"-":"_"}).replace(/=/g,"")},M=function(e,t){return t?A(m(e)):m(e)},w=function(e){return M(e,!0)};n.Uint8Array&&(i=function(e,t){for(var n="",r=0,o=e.length;o>r;r+=3){var i=e[r],a=e[r+1],s=e[r+2],c=i<<16|a<<8|s;n+=l.charAt(c>>>18)+l.charAt(c>>>12&63)+("undefined"!=typeof a?l.charAt(c>>>6&63):"=")+("undefined"!=typeof s?l.charAt(63&c):"=")}return t?A(n):n});var y,b=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,v=function(e){switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),n=t-65536;return u((n>>>10)+55296)+u((1023&n)+56320);case 3:return u((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return u((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},T=function(e){return e.replace(b,v)},x=function(e){var t=e.length,n=t%4,r=(t>0?c[e.charAt(0)]<<18:0)|(t>1?c[e.charAt(1)]<<12:0)|(t>2?c[e.charAt(2)]<<6:0)|(t>3?c[e.charAt(3)]:0),o=[u(r>>>16),u(r>>>8&255),u(255&r)];return o.length-=[0,0,2,1][n],o.join("")},N=n.atob&&"function"==typeof n.atob?function(e){return n.atob(e)}:function(e){return e.replace(/\S{1,4}/g,x)},C=function(e){return N(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},I=function(e){return T(N(e))},E=function(e){return String(e).replace(/[-_]/g,function(e){return"-"==e?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},D=function(e){return I(E(e))};n.Uint8Array&&(y=function(e){return Uint8Array.from(C(E(e)),function(e){return e.charCodeAt(0)})});var S=function(){var e=n.Base64;return n.Base64=a,e};if(n.Base64={VERSION:s,atob:C,btoa:f,fromBase64:D,toBase64:M,utob:h,encode:M,encodeURI:w,btou:T,decode:D,noConflict:S,fromUint8Array:i,toUint8Array:y},"function"==typeof Object.defineProperty){var L=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};n.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",L(function(){return D(this)})),Object.defineProperty(String.prototype,"toBase64",L(function(e){return M(this,e)})),Object.defineProperty(String.prototype,"toBase64URI",L(function(){return M(this,!0)}))}}return n.Meteor&&(Base64=n.Base64),"undefined"!=typeof e&&e.exports?e.exports.Base64=n.Base64:(r=[],o=function(){return n.Base64}.apply(t,r),!(void 0!==o&&(e.exports=o))),{Base64:n.Base64}})}).call(t,function(){return this}())},function(e,t){"use strict";function n(e,t){t=t||0;for(var n=Math.min(e.length,r);n>t;t++){var o=e[t];if(!(9==o||10==o||13==o||o>=32&&127>=o)){++t;var i=e[t];if(o>=194&&223>=o){if(i>=128&&191>=i)continue;return!i}++t;var a=e[t];if(224==o){if(i>=160&&191>=i&&a>=128&&191>=a)continue;return!a}if(o>=225&&236>=o||238==o||239==o){if(i>=128&&191>=i&&a>=128&&191>=a)continue;return!a}if(237==o){if(i>=128&&159>=i&&a>=128&&191>=a)continue;return!a}++t;var s=e[t];if(240==o){if(i>=144&&191>=i&&a>=128&&191>=a&&s>=128&&191>=s)continue;return!s}if(o>=241&&243>=o){if(i>=128&&191>=i&&a>=128&&191>=a&&s>=128&&191>=s)continue;return!s}if(244==o){if(i>=128&&143>=i&&a>=128&&191>=a&&s>=128&&191>=s)continue;return!s}return!1}}return!0}var r=32768;e.exports=function(e){return n(e)?!0:0===e[0]&&n(e,5)}},function(e,t,n){var r=n(5);"string"==typeof r&&(r=[[e.id,r,""]]);n(7)(r,{});r.locals&&(e.exports=r.locals)},function(e,t,n){t=e.exports=n(6)(),t.push([e.id,".w-menu{height:30px;border-top:1px solid #fcfcfc;border-bottom:1px solid #ccc;background:#f1f3f4;padding-right:5pc;position:relative;z-index:1001;white-space:nowrap}.w-history-bar a,.w-menu a{text-decoration:none!important;color:#000;padding:0 5px;line-height:26px;height:26px;margin-right:5px;display:inline-block}.w-menu a{height:27px;line-height:28px;overflow:hidden}.w-detail .glyphicon,.w-menu .glyphicon{margin-right:3px}.w-menu .glyphicon-folder-close,.w-menu .glyphicon-folder-open{margin-right:6px}.w-menu .w-online{position:absolute;top:0;right:0}.w-left-menu a:hover,.w-left-menu a:hover .w-disabled,.w-menu .w-online,.w-menu a:hover{color:#337ab7}.w-menu .w-offline{color:#ccc!important;cursor:default}.w-frames-action .w-disabled,.w-history-bar .w-disabled,.w-menu .w-disabled{color:#aaa!important;cursor:not-allowed!important}.w-left-menu .w-disabled{color:#aaa}.w-menu .w-menu-enable .glyphicon-cog{color:#f66!important}.w-menu .w-new-version-icon{position:absolute;top:2px;left:17px;width:5px;height:5px;border-radius:5px;background:red}.w-menu .w-menu-wrapper{display:inline-block;position:relative;height:30px}.w-show-update-tips{font-weight:700}.w-input-menu-item{display:block;position:absolute;background:#fff;border:1px solid #ccc;border-radius:2px;z-index:101;top:30px;display:none;white-space:nowrap}.w-input-menu-item input{width:246px;height:2pc;border:1px solid #ccc;border-radius:0!important;border-radius:2px;padding:0 5px;vertical-align:middle}.w-input-menu-item .btn{height:2pc;padding:0 9pt;vertical-align:middle;border-radius:0;border-top-right-radius:2px;border-bottom-right-radius:2px;margin-left:1px;border-color:#ccc}.w-create-rules-input{left:310px}.w-create-values-input{left:300px}.w-edit-rules-input{left:382px}.w-edit-values-input{left:372px}.w-show-left-menu .w-create-rules-input{left:210px}.w-show-left-menu .w-create-values-input{left:200px}.w-show-left-menu .w-edit-rules-input{left:282px}.w-show-left-menu .w-edit-values-input{left:17pc}.w-menu-wrapper .w-menu-item{display:none!important}.w-menu-wrapper-show .w-menu-item{display:block!important}.w-values-list .glyphicon-ok{display:none!important}.w-values-list a{font-weight:400!important}.w-disabled .glyphicon-ok,.w-disabled .glyphicon-stop{color:#ccc!important}.w-rules-settings-dialog .modal-dialog{width:25pc}.w-values-settings-dialog .modal-dialog{width:300px}.w-show-update-tips-dialog .modal-dialog{width:21pc}.w-show-update-tips-dialog .modal-body p{margin-bottom:5px}.w-https-dialog .modal-dialog{width:340px}.w-https-help{margin-left:150px}.w-https-dialog .modal-dialog div{white-space:nowrap}.w-https-dialog a{display:inline-block}.w-download-rootca,.w-https-help{line-height:30px}.w-https-settings label{font-weight:400}.w-https-settings p{margin:10px 0}.w-is-link{cursor:pointer;text-decoration:underline}.w-choose-filte-type .modal-dialog{width:456px}.w-choose-filte-type-label{white-space:nowrap}.w-choose-filte-type-label .form-control{margin-left:10px;width:200px;display:inline-block;font-weight:400}.w-choose-filte-type-label select.form-control{margin:0 5px;width:5pc}.w-confirm-import-dialog .modal-dialog{width:20pc;font-weight:700}.w-show-left-menu .w-menu .w-account-menu{display:none!important}.w-show-left-menu-btn{padding:0 15px!important;margin-right:0!important}.w-left-menu{background:#f1f3f4;border-left:1px solid #ccc;border-right:1px solid #ccc;display:none}.w-show-left-menu .w-left-menu{display:block;border-left:none}.w-show-left-menu .w-nav-menu{display:none}.w-left-menu a{display:block;position:relative;padding:10px 0 8px;width:47px;overflow:hidden;text-align:center;text-decoration:none!important;color:#000}.w-left-menu a span{margin-right:5px}.w-left-menu a .w-left-menu-name{display:block;font-style:normal;font-size:9pt;zoom:1;transform:scale(0.8,0.8);width:65px;margin-left:-10px;white-space:nowrap}.w-left-menu-tips{padding:6px 10px;display:none;left:47px;top:3px;position:absolute;z-index:1;border-radius:4px}.w-left-menu a:hover .w-left-menu-tips{display:block;color:#000;background-color:#f1f3f4;font-weight:700;border:1px solid #ccc}.w-left-menu a .w-left-menu-tips:hover,.w-menu .w-export-menu,.w-menu .w-import-menu,.w-menu .w-remove-menu-list{display:none}.w-show-left-menu .w-export-menu,.w-show-left-menu .w-import-menu,.w-show-left-menu .w-remove-menu-list{display:inline-block}.w-menu-changed{position:absolute;top:2px;left:5px;color:red}.w-replay-count-dialog .modal-content{width:236px!important;white-space:nowrap}.w-replay-count-dialog .modal-dialog{width:236px!important}.w-replay-count-dialog .modal-content label{width:auto}.w-replay-count-dialog input{display:inline-block;width:5pc;text-align:center;margin:0 10px}.w-import-remote-dialog .modal-content{width:525px}.w-import-remote-dialog input{width:500px;height:30px;line-height:30px;padding:5px;border:1px solid #ccc}.w-https-menu .glyphicon-lock{color:#9e9e26}.w-hover-left-menu{position:absolute;z-index:1;height:auto;border-bottom:1px solid #ccc;min-height:0}.w-menu .w-tree-view-active{color:#337ab7}.w-menu-selected{background-color:#ddd}.w-root-ca-type{width:75pt;float:right;margin:3px 15px 0 0;border:1px solid #ccc;border-radius:3px;height:24px;font-size:9pt;padding-left:8px}.w-fieldset pre{max-height:220px;overflow:auto;padding:10px}.w-fieldset{border:1px solid #ddd}.w-fieldset legend{font-size:9pt;padding:0 5px;border:none;width:auto;margin:0 10px;font-weight:700}.w-fieldset legend .glyphicon{margin-left:5px;cursor:pointer}@media screen and (max-width:1210px){.w-show-account.w-show-editor .w-help-name{display:none}}@media screen and (max-width:1190px){.w-show-account.w-show-rules .w-https-name{display:none}.w-show-account.w-show-rules-mode span.w-help-name,.w-show-account.w-show-rules-mode span.w-https-name,.w-show-account.w-show-rules-mode span.w-weinre-name{display:inline}}@media screen and (max-width:1160px){.w-show-account.w-show-editor .w-https-name,.w-show-account.w-show-editor span.w-help-name{display:none}}@media screen and (max-width:1130px){.w-show-account.w-show-rules .w-weinre-name{display:none}}@media screen and (max-width:1090px){.w-show-account.w-show-rules .w-help-menu,.w-show-account.w-show-rules .w-https-menu,.w-show-account.w-show-rules .w-weinre-menu{padding:0 3px}}.w-show-left-menu .w-help-name,.w-show-left-menu .w-https-name{display:inline!important}.w-account-menu{display:none!important}.w-show-account .w-account-menu{display:inline-block!important}",""]); +},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t