(this["webpackJsonpmitmproxy-client"]=this["webpackJsonpmitmproxy-client"]||[]).push([[0],{60:function(e,t,s){},66:function(e,t,s){"use strict";s.r(t);var n,i=s(1),r=s.n(i),o=s(20),a=s.n(o),c=(s(59),s(7)),l=s(8),h=s(15),d=s(14),u=s(53),p=s(10),j=s(13),v=s(49),b=s.n(v),y=(s(60),s(2)),f=s(22),w=s(16),O=s(43),x=s(30),S=s(0),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(f.a)(n)),n.handleShow=n.handleShow.bind(Object(f.a)(n)),n.handleSave=n.handleSave.bind(Object(f.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)(w.a,{show:this.state.show,onHide:this.handleClose,children:[Object(S.jsx)(w.a.Header,{closeButton:!0,children:Object(S.jsx)(w.a.Title,{children:"Set BreakPoint"})}),Object(S.jsxs)(w.a.Body,{children:[Object(S.jsxs)(p.a.Group,{as:O.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(y.a)(Object(y.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:O.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(y.a)(Object(y.a)({},s),{},{url:t.target.value})})}})})]}),Object(S.jsxs)(p.a.Group,{as:O.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(y.a)(Object(y.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)(w.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}(r.a.Component),R=function(e){return!!e&&(!!e.header&&(!!e.header["Content-Type"]&&/text|javascript|json|x-www-form-urlencoded|xml|form-data/.test(e.header["Content-Type"].join(""))))},g=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"},E=function(e){for(var t="",s=new Uint8Array(e),n=s.byteLength,i=0;i=32&&s[r]<=126?i+=String.fromCharCode(s[r]):i+=".",(r+1)%16===0?(t+=" "+i,i="",t+="\n".concat((r+1).toString(16).padStart(8,"0"),": ")):(r+1)%8===0&&(t+=" ");if(i.length>0){for(var o=i.length;o<16;o++)t+=" ",(o+1)%8===0&&(t+=" ");t+=" "+i}return 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;ithis.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}(),V=[1,1,2,2,4,4,8,8,16,16,32,32],W=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.wsUnmountClose=void 0,n.pageBottom=void 0,n.autoScore=!1,n.wsReconnCount=-1,n.flowMgr=new F,n.state={flows:n.flowMgr.showList(),flow:null,flowTab:"Headers",wsStatus:"close"},n.ws=null,n.wsUnmountClose=!1,n.pageBottom=null,n}return Object(l.a)(s,[{key:"componentDidMount",value:function(){this.initWs()}},{key:"componentWillUnmount",value:function(){this.ws&&(this.wsUnmountClose=!0,this.ws.close(),this.ws=null)}},{key:"initWs",value:function(){var e,t=this;this.ws||(this.setState({wsStatus:"connecting"}),e=new URL(document.URL).host,this.ws=new WebSocket("ws://".concat(e,"/echo")),this.ws.binaryType="arraybuffer",this.ws.onopen=function(){t.wsReconnCount=-1,t.setState({wsStatus:"open"})},this.ws.onerror=function(e){var s;console.error("ERROR:",e),null===(s=t.ws)||void 0===s||s.close()},this.ws.onclose=function(){if(t.setState({wsStatus:"close"}),!t.wsUnmountClose){t.wsReconnCount++,t.ws=null;var e=V[t.wsReconnCount]||V[V.length-1];console.info("will reconnect after ".concat(e," seconds")),setTimeout((function(){t.initWs()}),1e3*e)}},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(!z.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 r,o=(new TextDecoder).decode(e.slice(39));try{r=JSON.parse(o)}catch(a){return null}return i.content=r,i}(e.data);if(s){if(s.type===n.REQUEST){var i=new H(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 r=t.flowMgr.get(s.id);if(!r)return;r.addRequestBody(s),t.setState({flows:t.state.flows})}else if(s.type===n.RESPONSE){var o=t.flowMgr.get(s.id);if(!o)return;o.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)})}},{key:"initScrollMonitor",value:function(){var e=this;if(this.pageBottom){var t=b.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!==I.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}(I.CHANGE_BREAK_POINT_RULES,t);e.ws&&e.ws.send(s)}}),Object(S.jsxs)("span",{children:["status: ",this.state.wsStatus]})]}),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)(Y,{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}(r.a.Component),J=function(e){e&&e instanceof Function&&s.e(3).then(s.bind(null,68)).then((function(t){var s=t.getCLS,n=t.getFID,i=t.getFCP,r=t.getLCP,o=t.getTTFB;s(e),n(e),i(e),r(e),o(e)}))};a.a.render(Object(S.jsx)(r.a.StrictMode,{children:Object(S.jsx)(W,{})}),document.getElementById("root")),J()}},[[66,1,2]]]); //# sourceMappingURL=main.f24ab4b3.chunk.js.map