You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-mitmproxy/addon/web/client/build/static/js/main.0486ccb3.chunk.js

2 lines
22 KiB
JavaScript

(this["webpackJsonpmitmproxy-client"]=this["webpackJsonpmitmproxy-client"]||[]).push([[0],{52:function(e,t,s){},58:function(e,t,s){"use strict";s.r(t);var n,i=s(0),o=s.n(i),r=s(20),a=s.n(r),c=(s(51),s(8)),l=s(9),h=s(17),d=s(16),u=s(45),p=s(7),j=s(10),b=s(41),f=s.n(b),v=(s(52),s(21)),O=s(18),y=s(12),w=s(33),x=s(23),S=s(1),m=function(e){Object(h.a)(s,e);var t=Object(d.a)(s);function s(e){var n;return Object(c.a)(this,s),(n=t.call(this,e)).state={show:!1,rule:{method:"ALL",url:"",action:1},haveRules:!1},n.handleClose=n.handleClose.bind(Object(O.a)(n)),n.handleShow=n.handleShow.bind(Object(O.a)(n)),n.handleSave=n.handleSave.bind(Object(O.a)(n)),n}return Object(l.a)(s,[{key:"handleClose",value:function(){this.setState({show:!1})}},{key:"handleShow",value:function(){this.setState({show:!0})}},{key:"handleSave",value:function(){var e=this.state.rule,t=[];e.url&&t.push({method:"ALL"===e.method?"":e.method,url:e.url,action:e.action}),this.props.onSave(t),this.handleClose(),this.setState({haveRules:!!t.length})}},{key:"render",value:function(){var e=this,t=this.state,s=t.rule,n=t.haveRules?"success":"primary";return Object(S.jsxs)("div",{children:[Object(S.jsx)(j.a,{variant:n,size:"sm",onClick:this.handleShow,children:"BreakPoint"}),Object(S.jsxs)(y.a,{show:this.state.show,onHide:this.handleClose,children:[Object(S.jsx)(y.a.Header,{closeButton:!0,children:Object(S.jsx)(y.a.Title,{children:"Set BreakPoint"})}),Object(S.jsxs)(y.a.Body,{children:[Object(S.jsxs)(p.a.Group,{as:w.a,children:[Object(S.jsx)(p.a.Label,{column:!0,sm:2,children:"Method"}),Object(S.jsx)(x.a,{sm:10,children:Object(S.jsxs)(p.a.Control,{as:"select",value:s.method,onChange:function(t){e.setState({rule:Object(v.a)(Object(v.a)({},s),{},{method:t.target.value})})},children:[Object(S.jsx)("option",{children:"ALL"}),Object(S.jsx)("option",{children:"GET"}),Object(S.jsx)("option",{children:"POST"}),Object(S.jsx)("option",{children:"PUT"}),Object(S.jsx)("option",{children:"DELETE"})]})})]}),Object(S.jsxs)(p.a.Group,{as:w.a,children:[Object(S.jsx)(p.a.Label,{column:!0,sm:2,children:"URL"}),Object(S.jsx)(x.a,{sm:10,children:Object(S.jsx)(p.a.Control,{value:s.url,onChange:function(t){e.setState({rule:Object(v.a)(Object(v.a)({},s),{},{url:t.target.value})})}})})]}),Object(S.jsxs)(p.a.Group,{as:w.a,children:[Object(S.jsx)(p.a.Label,{column:!0,sm:2,children:"Action"}),Object(S.jsx)(x.a,{sm:10,children:Object(S.jsxs)(p.a.Control,{as:"select",value:s.action,onChange:function(t){e.setState({rule:Object(v.a)(Object(v.a)({},s),{},{action:parseInt(t.target.value)})})},children:[Object(S.jsx)("option",{value:"1",children:"Request"}),Object(S.jsx)("option",{value:"2",children:"Response"}),Object(S.jsx)("option",{value:"3",children:"Both"})]})})]})]}),Object(S.jsxs)(y.a.Footer,{children:[Object(S.jsx)(j.a,{variant:"secondary",onClick:this.handleClose,children:"Close"}),Object(S.jsx)(j.a,{variant:"primary",onClick:this.handleSave,children:"Save"})]})]})]})}}]),s}(o.a.Component),E=function(e){return!!e&&(!!e.header&&(!!e.header["Content-Type"]&&/text|javascript|json|x-www-form-urlencoded|xml/.test(e.header["Content-Type"].join(""))))},R=function(e){return e?isNaN(e)||e<=0?"0":e<1024?"".concat(e," B"):e<1048576?"".concat((e/1024).toFixed(2)," KB"):"".concat((e/1048576).toFixed(2)," MB"):"0"},g=function(e){for(var t="",s=new Uint8Array(e),n=s.byteLength,i=0;i<n;i++)t+=String.fromCharCode(s[i]);return btoa(t)},T=function(e){Object(h.a)(s,e);var t=Object(d.a)(s);function s(){return Object(c.a)(this,s),t.apply(this,arguments)}return Object(l.a)(s,[{key:"shouldComponentUpdate",value:function(e){return e.isSelected!==this.props.isSelected||!function(e,t){if(e===t)return!0;var s=Object.keys(e),n=Object.keys(t);if(s.length!==n.length)return!1;for(var i=0;i<s.length;i++){var o=s[i];if(void 0===t[o]||e[o]!==t[o])return!1}return!0}(e.flow,this.props.flow)}},{key:"render",value:function(){var e=this,t=this.props.flow,s=[];return this.props.isSelected&&s.push("tr-selected"),t.waitIntercept&&s.push("tr-wait-intercept"),Object(S.jsxs)("tr",{className:s.length?s.join(" "):void 0,onClick:function(){e.props.onShowDetail()},children:[Object(S.jsx)("td",{children:t.no}),Object(S.jsx)("td",{children:t.method}),Object(S.jsx)("td",{children:t.host}),Object(S.jsx)("td",{children:t.path}),Object(S.jsx)("td",{children:t.contentType}),Object(S.jsx)("td",{children:t.statusCode}),Object(S.jsx)("td",{children:t.size}),Object(S.jsx)("td",{children:t.costTime})]})}}]),s}(o.a.Component),C=s(42),_=s.n(C),B=s(43),N=s.n(B),k=s(44),q=s.n(k),L=s(39),P=s(34),U=s(46),D=s(40);!function(e){e[e.REQUEST=1]="REQUEST",e[e.REQUEST_BODY=2]="REQUEST_BODY",e[e.RESPONSE=3]="RESPONSE",e[e.RESPONSE_BODY=4]="RESPONSE_BODY"}(n||(n={}));var A=function(){function e(t){Object(c.a)(this,e),this.no=void 0,this.id=void 0,this.waitIntercept=void 0,this.request=void 0,this.response=null,this.url=void 0,this.path=void 0,this._size=0,this.size="0",this.headerContentLengthExist=!1,this.contentType="",this.startTime=Date.now(),this.endTime=0,this.costTime="(pending)",this.status=n.REQUEST,this._isTextRequest=void 0,this._isTextResponse=void 0,this._requestBody=void 0,this._responseBody=void 0,this._previewResponseBody=null,this.no=++e.curNo,this.id=t.id,this.waitIntercept=t.waitIntercept,this.request=t.content,this.url=new URL(this.request.url),this.path=this.url.pathname+this.url.search,this._isTextRequest=null,this._isTextResponse=null,this._requestBody=null,this._responseBody=null}return Object(l.a)(e,[{key:"addRequestBody",value:function(e){return this.status=n.REQUEST_BODY,this.waitIntercept=e.waitIntercept,this.request.body=e.content,this}},{key:"addResponse",value:function(e){return this.status=n.RESPONSE,this.waitIntercept=e.waitIntercept,this.response=e.content,this.response&&this.response.header&&(null!=this.response.header["Content-Type"]&&(this.contentType=this.response.header["Content-Type"][0].split(";")[0],this.contentType.includes("javascript")&&(this.contentType="javascript")),null!=this.response.header["Content-Length"]&&(this.headerContentLengthExist=!0,this._size=parseInt(this.response.header["Content-Length"][0]),this.size=R(this._size))),this}},{key:"addResponseBody",value:function(e){return this.status=n.RESPONSE_BODY,this.waitIntercept=e.waitIntercept,this.response&&(this.response.body=e.content),this.endTime=Date.now(),this.costTime=String(this.endTime-this.startTime)+" ms",!this.headerContentLengthExist&&this.response&&this.response.body&&(this._size=this.response.body.byteLength,this.size=R(this._size)),this}},{key:"preview",value:function(){return{no:this.no,id:this.id,waitIntercept:this.waitIntercept,host:this.url.host,path:this.path,method:this.request.method,statusCode:this.response?String(this.response.statusCode):"(pending)",size:this.size,costTime:this.costTime,contentType:this.contentType}}},{key:"isTextRequest",value:function(){return null!==this._isTextRequest||(this._isTextRequest=E(this.request)),this._isTextRequest}},{key:"requestBody",value:function(){return null!==this._requestBody?this._requestBody:this.isTextRequest()?this.status<n.REQUEST_BODY?"":(this._requestBody=(new TextDecoder).decode(this.request.body),this._requestBody):(this._requestBody="",this._requestBody)}},{key:"isTextResponse",value:function(){return this.status<n.RESPONSE?null:(null!==this._isTextResponse||(this._isTextResponse=E(this.response)),this._isTextResponse)}},{key:"responseBody",value:function(){var e;return null!==this._responseBody?this._responseBody:this.status<n.RESPONSE?"":this.isTextResponse()?this.status<n.RESPONSE_BODY?"":(this._responseBody=(new TextDecoder).decode(null===(e=this.response)||void 0===e?void 0:e.body),this._responseBody):(this._responseBody="",this._responseBody)}},{key:"previewResponseBody",value:function(){var e,t,s;return this._previewResponseBody?this._previewResponseBody:this.status<n.RESPONSE_BODY?null:(null===(e=this.response)||void 0===e||null===(t=e.body)||void 0===t?void 0:t.byteLength)?(this.response.header["Content-Type"]&&(s=this.response.header["Content-Type"][0]),s?(s.startsWith("image/")?this._previewResponseBody={type:"image",data:g(this.response.body)}:s.includes("application/json")&&(this._previewResponseBody={type:"json",data:this.responseBody()}),this._previewResponseBody):null):null}}]),e}();A.curNo=0;var M,I=[n.REQUEST,n.REQUEST_BODY,n.RESPONSE,n.RESPONSE_BODY];!function(e){e[e.CHANGE_REQUEST=11]="CHANGE_REQUEST",e[e.CHANGE_RESPONSE=12]="CHANGE_RESPONSE",e[e.DROP_REQUEST=13]="DROP_REQUEST",e[e.DROP_RESPONSE=14]="DROP_RESPONSE",e[e.CHANGE_BREAK_POINT_RULES=21]="CHANGE_BREAK_POINT_RULES"}(M||(M={}));var H=function(e,t){if(e===M.DROP_REQUEST||e===M.DROP_RESPONSE){var s=new Uint8Array(38);return s[0]=1,s[1]=e,s.set((new TextEncoder).encode(t.id),2),s}var n,i;if(e===M.CHANGE_REQUEST){var o=t.request;i=o.body,n=Object(D.a)(o,["body"])}else{if(e!==M.CHANGE_RESPONSE)throw new Error("invalid message type");var r=t.response;i=r.body,n=Object(D.a)(r,["body"])}i instanceof ArrayBuffer&&(i=new Uint8Array(i));var a=i&&i.byteLength?i.byteLength:0;"Content-Encoding"in n.header&&delete n.header["Content-Encoding"],"Transfer-Encoding"in n.header&&delete n.header["Transfer-Encoding"],n.header["Content-Length"]=[String(a)];var c=(new TextEncoder).encode(JSON.stringify(n)),l=42+c.byteLength+4+a,h=new ArrayBuffer(l),d=new Uint8Array(h);d[0]=1,d[1]=e,d.set((new TextEncoder).encode(t.id),2),d.set(c,42),a&&d.set(i,42+c.byteLength+4);var u=new DataView(h);return u.setUint32(38,c.byteLength),u.setUint32(42+c.byteLength,a),d},z=function(e){Object(h.a)(s,e);var t=Object(d.a)(s);function s(e){var n;return Object(c.a)(this,s),(n=t.call(this,e)).state={show:!1,alertMsg:"",content:""},n.handleClose=n.handleClose.bind(Object(O.a)(n)),n.handleShow=n.handleShow.bind(Object(O.a)(n)),n.handleSave=n.handleSave.bind(Object(O.a)(n)),n}return Object(l.a)(s,[{key:"showAlert",value:function(e){this.setState({alertMsg:e})}},{key:"handleClose",value:function(){this.setState({show:!1})}},{key:"handleShow",value:function(){var e=this.props.flow,t="";t="request"===(e.response?"response":"request")?function(e){var t="".concat(e.method," ").concat(e.url),s=Object.keys(e.header).map((function(t){var s=e.header[t].join(" \t ");return"".concat(t,": ").concat(s)})).join("\n"),n="";return e.body&&E(e)&&(n=(new TextDecoder).decode(e.body)),"".concat(t,"\n\n").concat(s,"\n\n").concat(n)}(e.request):function(e){var t="".concat(e.statusCode),s=Object.keys(e.header).map((function(t){var s=e.header[t].join(" \t ");return"".concat(t,": ").concat(s)})).join("\n"),n="";return e.body&&E(e)&&(n=(new TextDecoder).decode(e.body)),"".concat(t,"\n\n").concat(s,"\n\n").concat(n)}(e.response),this.setState({show:!0,alertMsg:"",content:t})}},{key:"handleSave",value:function(){var e=this.props.flow.response?"response":"request",t=this.state.content;if("request"===e){var s=function(e){var t=e.indexOf("\n\n");if(!(t<=0)){var s=e.slice(0,t).split(" "),n=Object(P.a)(s,2),i=n[0],o=n[1];if(i&&o){var r=e.indexOf("\n\n",t+2);if(!(r<=0)){var a,c=e.slice(t+2,r),l={},h=Object(L.a)(c.split("\n"));try{for(h.s();!(a=h.n()).done;){var d=a.value.split(": "),u=Object(P.a)(d,2),p=u[0],j=u[1];if(!p||!j)return;l[p]=j.split(" \t ")}}catch(v){h.e(v)}finally{h.f()}var b,f=e.slice(r+2);return f&&(b=(new TextEncoder).encode(f)),{method:i,url:o,proto:"",header:l,body:b}}}}}(t);if(!s)return void this.showAlert("parse error");this.props.onChangeRequest(s),this.handleClose()}else{var n=function(e){var t=e.indexOf("\n\n");if(!(t<=0)){var s=e.slice(0,t),n=parseInt(s);if(!isNaN(n)){var i=e.indexOf("\n\n",t+2);if(!(i<=0)){var o,r=e.slice(t+2,i),a={},c=Object(L.a)(r.split("\n"));try{for(c.s();!(o=c.n()).done;){var l=o.value.split(": "),h=Object(P.a)(l,2),d=h[0],u=h[1];if(!d||!u)return;a[d]=u.split(" \t ")}}catch(b){c.e(b)}finally{c.f()}var p,j=e.slice(i+2);return j&&(p=(new TextEncoder).encode(j)),{statusCode:n,header:a,body:p}}}}}(t);if(!n)return void this.showAlert("parse error");this.props.onChangeResponse(n),this.handleClose()}}},{key:"render",value:function(){var e=this,t=this.props.flow;if(!t.waitIntercept)return null;var s=this.state.alertMsg,n=t.response?"response":"request";return Object(S.jsxs)("div",{className:"flow-wait-area",children:[Object(S.jsx)(j.a,{size:"sm",onClick:this.handleShow,children:"Edit"}),Object(S.jsx)(j.a,{size:"sm",onClick:function(){var s="response"===n?M.CHANGE_RESPONSE:M.CHANGE_REQUEST,i=H(s,t);e.props.onMessage(i)},children:"Continue"}),Object(S.jsx)(j.a,{size:"sm",onClick:function(){var s="response"===n?M.DROP_RESPONSE:M.DROP_REQUEST,i=H(s,t);e.props.onMessage(i)},children:"Drop"}),Object(S.jsxs)(y.a,{size:"lg",show:this.state.show,onHide:this.handleClose,children:[Object(S.jsx)(y.a.Header,{closeButton:!0,children:Object(S.jsxs)(y.a.Title,{children:["Edit ","request"===n?"Request":"Response"]})}),Object(S.jsxs)(y.a.Body,{children:[Object(S.jsx)(p.a.Group,{children:Object(S.jsx)(p.a.Control,{as:"textarea",rows:10,value:this.state.content,onChange:function(t){e.setState({content:t.target.value})}})}),s?Object(S.jsx)(U.a,{variant:"danger",children:s}):null]}),Object(S.jsxs)(y.a.Footer,{children:[Object(S.jsx)(j.a,{variant:"secondary",onClick:this.handleClose,children:"Close"}),Object(S.jsx)(j.a,{variant:"primary",onClick:this.handleSave,children:"Save"})]})]})]})}}]),s}(o.a.Component),Q=function(e){Object(h.a)(s,e);var t=Object(d.a)(s);function s(e){var n;return Object(c.a)(this,s),(n=t.call(this,e)).state={flowTab:"Headers"},n}return Object(l.a)(s,[{key:"preview",value:function(){var e=this.props.flow;if(!e)return null;var t=e.response;if(!t)return null;if(!t.body||!t.body.byteLength)return Object(S.jsx)("div",{style:{color:"gray"},children:"No response"});var s=e.previewResponseBody();return s?"image"===s.type?Object(S.jsx)("img",{src:"data:image/png;base64,".concat(s.data)}):"json"===s.type?Object(S.jsx)("div",{children:Object(S.jsx)(q.a,{data:s.data,keyStyle:"color: rgb(130,40,144);",stringStyle:"color: rgb(153,68,60);",valueStyle:"color: rgb(25,1,199);",booleanStyle:"color: rgb(94,105,192);"})}):Object(S.jsx)("div",{style:{color:"gray"},children:"Not support preview"}):Object(S.jsx)("div",{style:{color:"gray"},children:"Not support preview"})}},{key:"render",value:function(){var e=this;if(!this.props.flow)return null;var t=this.props.flow,s=this.state.flowTab,n=t.request,i=t.response||{};return Object(S.jsxs)("div",{className:"flow-detail",children:[Object(S.jsxs)("div",{className:"header-tabs",children:[Object(S.jsx)("span",{onClick:function(){e.props.onClose()},children:"x"}),Object(S.jsx)("span",{className:"Headers"===s?"selected":void 0,onClick:function(){e.setState({flowTab:"Headers"})},children:"Headers"}),Object(S.jsx)("span",{className:"Preview"===s?"selected":void 0,onClick:function(){e.setState({flowTab:"Preview"})},children:"Preview"}),Object(S.jsx)("span",{className:"Response"===s?"selected":void 0,onClick:function(){e.setState({flowTab:"Response"})},children:"Response"}),Object(S.jsx)(z,{flow:t,onChangeRequest:function(s){t.request.method=s.method,t.request.url=s.url,t.request.header=s.header,E(t.request)&&(t.request.body=s.body),e.props.onReRenderFlows()},onChangeResponse:function(s){t.response||(t.response={}),t.response.statusCode=s.statusCode,t.response.header=s.header,E(t.response)&&(t.response.body=s.body),e.props.onReRenderFlows()},onMessage:function(s){e.props.onMessage(s),t.waitIntercept=!1,e.props.onReRenderFlows()}})]}),Object(S.jsxs)("div",{style:{padding:"20px"},children:["Headers"!==s?null:Object(S.jsxs)("div",{children:[Object(S.jsx)("p",{children:Object(S.jsx)(j.a,{size:"sm",onClick:function(){var e=_()({url:t.request.url,method:t.request.method,headers:Object.keys(t.request.header).reduce((function(e,s){return e[s]=t.request.header[s][0],e}),{}),body:t.requestBody()});N()(e)},children:"Copy as cURL"})}),Object(S.jsxs)("div",{className:"header-block",children:[Object(S.jsx)("p",{children:"General"}),Object(S.jsxs)("div",{className:"header-block-content",children:[Object(S.jsxs)("p",{children:["Request URL: ",n.url]}),Object(S.jsxs)("p",{children:["Request Method: ",n.method]}),Object(S.jsxs)("p",{children:["Status Code: ","".concat(i.statusCode||"(pending)")]})]})]}),i.header?Object(S.jsxs)("div",{className:"header-block",children:[Object(S.jsx)("p",{children:"Response Headers"}),Object(S.jsx)("div",{className:"header-block-content",children:Object.keys(i.header).map((function(e){return Object(S.jsxs)("p",{children:[e,": ",i.header[e].join(" ")]},e)}))})]}):null,Object(S.jsxs)("div",{className:"header-block",children:[Object(S.jsx)("p",{children:"Request Headers"}),Object(S.jsx)("div",{className:"header-block-content",children:n.header?Object.keys(n.header).map((function(e){return Object(S.jsxs)("p",{children:[e,": ",n.header[e].join(" ")]},e)})):null})]}),n.body&&n.body.byteLength?Object(S.jsxs)("div",{className:"header-block",children:[Object(S.jsx)("p",{children:"Request Body"}),Object(S.jsx)("div",{className:"header-block-content",children:Object(S.jsx)("p",{children:t.isTextRequest()?t.requestBody():Object(S.jsx)("span",{style:{color:"gray"},children:"Not text"})})})]}):null]}),"Response"!==s?null:i.body&&i.body.byteLength?t.isTextResponse()?Object(S.jsx)("div",{children:t.responseBody()}):Object(S.jsx)("div",{style:{color:"gray"},children:"Not text response"}):Object(S.jsx)("div",{style:{color:"gray"},children:"No response"}),"Preview"!==s?null:Object(S.jsx)("div",{children:this.preview()})]})]})}}]),s}(o.a.Component),G=function(){function e(){Object(c.a)(this,e),this.items=void 0,this._map=void 0,this.filterText=void 0,this.filterTimer=void 0,this.num=void 0,this.max=void 0,this.items=[],this._map=new Map,this.filterText="",this.filterTimer=null,this.num=0,this.max=1e3}return Object(l.a)(e,[{key:"showList",value:function(){var e=this;return this.filterText?this.items.filter((function(t){return t.request.url.includes(e.filterText)})):this.items}},{key:"add",value:function(e){if(e.no=++this.num,this.items.push(e),this._map.set(e.id,e),this.items.length>this.max){var t=this.items.shift();t&&this._map.delete(t.id)}}},{key:"get",value:function(e){return this._map.get(e)}},{key:"changeFilter",value:function(e){this.filterText=e}},{key:"changeFilterLazy",value:function(e,t){var s=this;this.filterTimer&&(clearTimeout(this.filterTimer),this.filterTimer=null),this.filterTimer=setTimeout((function(){s.filterText=e,t()}),300)}},{key:"clear",value:function(){this.items=[],this._map=new Map}}]),e}(),F=function(e){Object(h.a)(s,e);var t=Object(d.a)(s);function s(e){var n;return Object(c.a)(this,s),(n=t.call(this,e)).flowMgr=void 0,n.ws=void 0,n.pageBottom=void 0,n.autoScore=!1,n.flowMgr=new G,n.state={flows:n.flowMgr.showList(),flow:null,flowTab:"Headers"},n.ws=null,n.pageBottom=null,n}return Object(l.a)(s,[{key:"componentDidMount",value:function(){this.initWs()}},{key:"componentWillUnmount",value:function(){this.ws&&this.ws.close()}},{key:"initWs",value:function(){var e,t=this;this.ws||(e=new URL(document.URL).host,this.ws=new WebSocket("ws://".concat(e,"/echo")),this.ws.binaryType="arraybuffer",this.ws.onopen=function(){console.log("OPEN")},this.ws.onclose=function(){console.log("CLOSE")},this.ws.onmessage=function(e){var s=function(e){if(e.byteLength<39)return null;var t=new Int8Array(e.slice(0,39));if(1!==t[0])return null;var s=t[1];if(!I.includes(s))return null;var i={type:s,id:(new TextDecoder).decode(e.slice(2,38)),waitIntercept:1===t[38]};if(39===e.byteLength)return i;if(s===n.REQUEST_BODY||s===n.RESPONSE_BODY)return i.content=e.slice(39),i;var o,r=(new TextDecoder).decode(e.slice(39));try{o=JSON.parse(r)}catch(a){return null}return i.content=o,i}(e.data);if(s){if(s.type===n.REQUEST){var i=new A(s);t.flowMgr.add(i),t.setState({flows:t.flowMgr.showList()},(function(){t.pageBottom&&t.autoScore&&t.pageBottom.scrollIntoView({behavior:"auto"})}))}else if(s.type===n.REQUEST_BODY){var o=t.flowMgr.get(s.id);if(!o)return;o.addRequestBody(s),t.setState({flows:t.state.flows})}else if(s.type===n.RESPONSE){var r=t.flowMgr.get(s.id);if(!r)return;r.addResponse(s),t.setState({flows:t.state.flows})}else if(s.type===n.RESPONSE_BODY){var a=t.flowMgr.get(s.id);if(!a||!a.response)return;a.addResponseBody(s),t.setState({flows:t.state.flows})}}else console.error("parse error:",e.data)},this.ws.onerror=function(e){console.log("ERROR:",e)})}},{key:"initScrollMonitor",value:function(){var e=this;if(this.pageBottom){var t=f.a.create(this.pageBottom);t.enterViewport((function(){e.autoScore=!0})),t.exitViewport((function(){e.autoScore=!1}))}}},{key:"render",value:function(){var e=this,t=this.state.flows;return Object(S.jsxs)("div",{className:"main-table-wrap",children:[Object(S.jsxs)("div",{className:"top-control",children:[Object(S.jsx)("div",{children:Object(S.jsx)(j.a,{size:"sm",onClick:function(){e.flowMgr.clear(),e.setState({flows:e.flowMgr.showList(),flow:null})},children:"Clear"})}),Object(S.jsx)("div",{children:Object(S.jsx)(p.a.Control,{size:"sm",placeholder:"Filter",onChange:function(t){var s=t.target.value;e.flowMgr.changeFilterLazy(s,(function(){e.setState({flows:e.flowMgr.showList()})}))}})}),Object(S.jsx)(m,{onSave:function(t){var s=function(e,t){if(e!==M.CHANGE_BREAK_POINT_RULES)throw new Error("invalid message type");var s=(new TextEncoder).encode(JSON.stringify(t)),n=new Uint8Array(2+s.byteLength);return n[0]=1,n[1]=e,n.set(s,2),n}(M.CHANGE_BREAK_POINT_RULES,t);e.ws&&e.ws.send(s)}})]}),Object(S.jsxs)(u.a,{striped:!0,bordered:!0,size:"sm",style:{tableLayout:"fixed"},children:[Object(S.jsx)("thead",{children:Object(S.jsxs)("tr",{children:[Object(S.jsx)("th",{style:{width:"50px"},children:"No"}),Object(S.jsx)("th",{style:{width:"80px"},children:"Method"}),Object(S.jsx)("th",{style:{width:"200px"},children:"Host"}),Object(S.jsx)("th",{style:{width:"600px"},children:"Path"}),Object(S.jsx)("th",{style:{width:"150px"},children:"Type"}),Object(S.jsx)("th",{style:{width:"80px"},children:"Status"}),Object(S.jsx)("th",{style:{width:"90px"},children:"Size"}),Object(S.jsx)("th",{style:{width:"90px"},children:"Time"})]})}),Object(S.jsx)("tbody",{children:t.map((function(t){var s=t.preview();return Object(S.jsx)(T,{flow:s,isSelected:!(!e.state.flow||e.state.flow.id!==s.id),onShowDetail:function(){e.setState({flow:t})}},s.id)}))})]}),Object(S.jsx)(Q,{flow:this.state.flow,onClose:function(){e.setState({flow:null})},onReRenderFlows:function(){e.setState({flows:e.state.flows})},onMessage:function(t){e.ws&&e.ws.send(t)}}),Object(S.jsx)("div",{ref:function(t){e.pageBottom||(e.pageBottom=t,e.initScrollMonitor())},style:{height:"0px",visibility:"hidden"},children:"bottom"})]})}}]),s}(o.a.Component),Y=function(e){e&&e instanceof Function&&s.e(3).then(s.bind(null,60)).then((function(t){var s=t.getCLS,n=t.getFID,i=t.getFCP,o=t.getLCP,r=t.getTTFB;s(e),n(e),i(e),o(e),r(e)}))};a.a.render(Object(S.jsx)(o.a.StrictMode,{children:Object(S.jsx)(F,{})}),document.getElementById("root")),Y()}},[[58,1,2]]]);
//# sourceMappingURL=main.0486ccb3.chunk.js.map