]> git.feebdaed.xyz Git - 0xmirror/mitmproxy.git/commitdiff
mitmproxy 12.2.1
authormitmproxy release bot <noreply@mitmproxy.org>
Mon, 24 Nov 2025 18:47:09 +0000 (18:47 +0000)
committermitmproxy release bot <noreply@mitmproxy.org>
Mon, 24 Nov 2025 18:47:09 +0000 (18:47 +0000)
CHANGELOG.md
mitmproxy/tools/web/index.html
mitmproxy/tools/web/static/index-B67aJAE2.js [deleted file]
mitmproxy/tools/web/static/index-Bt--WL1e.js [new file with mode: 0644]
mitmproxy/version.py

index 419748e45a55f5b9ae310ae267e74c7b4a6913c1..73699739e12ef7ebdedc67ca360dd416eb5f9229 100644 (file)
@@ -7,6 +7,9 @@
 
 ## Unreleased: mitmproxy next
 
+
+## 24 November 2025: mitmproxy 12.2.1
+
 - Make TCP inactivity timeout configurable through a new `tcp_timeout` option (default: 600 seconds).
   Previously, the timeout was hardcoded to 10 minutes for all TCP connections.
   ([#7909](https://github.com/mitmproxy/mitmproxy/pull/7909), @keshavkrishnadav)
index 059229e21124ffb3031ea1f80608f8d5037a87a1..04caa7afaad9f0a3cdb523f2084e10151ab88542 100644 (file)
@@ -5,7 +5,7 @@
         <title>mitmproxy</title>
         <link rel="icon" href="static/favicon.ico" type="image/x-icon" />
         <meta name="viewport" content="width=device-width, initial-scale=1" />
-      <script type="module" crossorigin src="./static/index-B67aJAE2.js"></script>
+      <script type="module" crossorigin src="./static/index-Bt--WL1e.js"></script>
       <link rel="modulepreload" crossorigin href="./static/vendor-BS4xPthR.js">
       <link rel="stylesheet" crossorigin href="./static/vendor-Cg3S-P9H.css">
       <link rel="stylesheet" crossorigin href="./static/index-DhPPoJ7G.css">
diff --git a/mitmproxy/tools/web/static/index-B67aJAE2.js b/mitmproxy/tools/web/static/index-B67aJAE2.js
deleted file mode 100644 (file)
index 540cb55..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-import{c as ae,R as Cl,a as xe,r as I,b as Ee,d as _e,j as o,e as E,f as ui,u as Nl,g as kl,h as fi,s as Kt,i as El,l as Ht,k as Tl,m as Rl,n as Al,y as Dl,o as Fl,p as Il,q as zt,Q as Ll,t as Pl,P as Ol}from"./vendor-BS4xPthR.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const l of n.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function s(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(r){if(r.ep)return;r.ep=!0;const n=s(r);fetch(r.href,n)}})();const Ml={tab:"request",contentViewFor:{}},ql=ae({name:"ui/flow",initialState:Ml,reducers:{selectTab(t,e){t.tab=e.payload},setContentViewFor(t,e){t.contentViewFor[e.payload.messageId]=e.payload.contentView}}}),{actions:Hl,reducer:Vl}=ql,{selectTab:Ut,setContentViewFor:pi}=Hl;window.React=Cl;const hi=function(t){if(t===0)return"0";const e=["b","kb","mb","gb","tb"];let s=0;for(;s<e.length&&!(Math.pow(1024,s+1)>t);s++);let i;return t%Math.pow(1024,s)===0?i=0:i=1,(t/Math.pow(1024,s)).toFixed(i)+e[s]},mi=function(t){let e=t;const s=["ms","s","min","h"],i=[1e3,60,60];let r=0;for(;Math.abs(e)>=i[r]&&r<i.length;)e=e/i[r],r++;return Math.round(e)+s[r]},at=function(t,{includeMilliseconds:e=!0}={}){const s=new Date(t*1e3),i=String(s.getFullYear()),r=String(s.getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0"),l=String(s.getHours()).padStart(2,"0"),a=String(s.getMinutes()).padStart(2,"0"),d=String(s.getSeconds()).padStart(2,"0"),u=String(s.getMilliseconds()).padStart(3,"0");let h=`${i}-${r}-${n} ${l}:${a}:${d}`;return e&&(h+=`.${u}`),h};function Hn(t){return t[0].includes(":")?`[${t[0]}]:${t[1]}`:`${t[0]}:${t[1]}`}function Ul(t){const e=document.cookie.match(new RegExp("\\b"+t+"=([^;]*)\\b"));return e?e[1]:void 0}let fs=()=>{const t=Ul("_xsrf");return fs=()=>t,fs()};function ne(t,e={}){return e.method&&e.method!=="GET"&&(e.headers=e.headers||{},e.headers["X-XSRFToken"]=fs()),t.startsWith("/")&&(t="."+t),fetch(t,{credentials:"same-origin",...e})}ne.put=(t,e,s={})=>ne(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),...s});ne.post=(t,e,s={})=>ne(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),...s});async function Bt(t,...e){return await(await ne(`/commands/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({arguments:e})})).json()}async function gi(t){try{await navigator.clipboard.write([new ClipboardItem({"text/plain":t})]);return}catch(i){console.warn(i)}const e=await t;try{await navigator.clipboard.writeText(e);return}catch(i){console.warn(i)}const s=document.createElement("textarea");s.value=e,s.style.position="absolute",s.style.opacity="0",document.body.appendChild(s);try{if(s.focus(),s.select(),!document.execCommand("copy"))throw"failed to copy"}catch{alert(e)}finally{s.remove()}}async function Bl(t){await gi(Promise.resolve(t?.text||""))}function ps(t,e){const s=t.lastIndexOf(e);if(s===-1)return["",t];const i=t.slice(0,s),r=t.slice(s+e.length);return[i,r]}function vi(t,e){const s=t.indexOf(e);if(s===-1)return[t,""];const i=t.slice(0,s),r=t.slice(s+e.length);return[i,r]}function Ct(t){throw new Error(`Unreachable: ${JSON.stringify(t)}`)}const xi={http:80,https:443},Vn=new WeakMap;class je{static getContentType(e){const s=je.get_first_header(e,/^Content-Type$/i);if(s)return s.split(";")[0].trim()}static get_first_header(e,s){let i=Vn.get(e);i||(i=new Map,Vn.set(e,i));let r=i.get(s);if(r===void 0){const n=e.headers.find(([l,a])=>s.test(l));r=n?n[1]:!1,i.set(s,r)}return r!==!1?r:void 0}static match_header(e,s){const i=e.headers;if(!i)return!1;let r=i.length;for(;r--;)if(s.test(i[r].join(" ")))return i[r];return!1}static getContentURL(e,s,i,r){e.type==="http"&&s===e.request?s="request":e.type==="http"&&s===e.response&&(s="response");const n=r?`?lines=${r}`:"";return`./flows/${e.id}/${s}/`+(i?`content/${encodeURIComponent(i)}.json${n}`:"content.data")}}class ct extends je{static pretty_url(e){let s="";return xi[e.scheme]!==e.port&&(s=":"+e.port),e.scheme+"://"+e.pretty_host+s+e.path}}class mt extends je{}const Wl=/^(?:(https?):\/\/)?([^/:]+)?(?::(\d+))?(\/.*)?$/i,_i=function(t){const e=Wl.exec(t);if(!e)return;const s=e[1],i=e[2],r=parseInt(e[3]),n=e[4],l=s?r||xi[s]:r,a={};return s&&(a.scheme=s),i&&(a.host=i),l&&(a.port=l),n&&(a.path=n),a},Kl=/^HTTP\/\d+(\.\d+)*$/i,ji=function(t){return Kl.test(t)};function Wt(t){switch(t.type){case"http":return t.request.timestamp_start;case"tcp":case"udp":return t.client_conn.timestamp_start;case"dns":return t.request.timestamp}}function yi(t){switch(t.type){case"http":if(t.websocket){if(t.websocket.timestamp_end)return t.websocket.timestamp_end;if(t.websocket.messages_meta.timestamp_last)return t.websocket.messages_meta.timestamp_last}return t.response?t.response.timestamp_end:void 0;case"tcp":return t.server_conn?.timestamp_end;case"udp":return t.messages_meta.timestamp_last;case"dns":return t.response?.timestamp}}const wi=t=>{switch(t.type){case"http":{let e=t.request.contentLength||0;return t.response&&(e+=t.response.contentLength||0),t.websocket&&(e+=t.websocket.messages_meta.contentLength||0),e}case"tcp":case"udp":return t.messages_meta.contentLength||0;case"dns":return t.response?.size??0}},xs=t=>t.type==="http"&&!t.websocket,bi=t=>t.modified,_s=t=>t.intercepted,Si=t=>{if(t.type!=="http")return t.client_conn.tls_version==="QUICv1"?"resource-icon-quic":`resource-icon-${t.type}`;if(t.websocket)return"resource-icon-websocket";if(!t.response)return"resource-icon-plain";const e=mt.getContentType(t.response)||"";return t.response.status_code===304?"resource-icon-not-modified":300<=t.response.status_code&&t.response.status_code<400?"resource-icon-redirect":e.indexOf("image")>=0?"resource-icon-image":e.indexOf("javascript")>=0?"resource-icon-js":e.indexOf("css")>=0?"resource-icon-css":e.indexOf("html")>=0?"resource-icon-document":"resource-icon-plain"},$i=t=>{switch(t.type){case"http":return ct.pretty_url(t.request);case"tcp":case"udp":return`${t.client_conn.peername.join(":")} ↔ ${t.server_conn?.address?.join(":")}`;case"dns":return`${t.request.questions.map(e=>`${e.name} ${e.type}`).join(", ")} = ${(t.response?.answers.map(e=>e.data).join(", ")??"...")||"?"}`}},Ci=t=>{switch(t.type){case"http":return t.response?.status_code;case"dns":return t.response?.response_code;default:return}},Ni=t=>{switch(t.type){case"http":return t.websocket?t.client_conn.tls_established?"WSS":"WS":t.request.method;case"dns":return t.request.op_code;default:return t.type.toUpperCase()}},ki=t=>{switch(t.type){case"http":return t.request.http_version;default:return""}},Ei={tls:t=>t.type==="http"&&t.request.scheme,icon:Si,index:()=>0,path:$i,method:Ni,version:ki,status:Ci,size:wi,time:t=>{const e=Wt(t),s=yi(t);return e&&s&&s-e},timestamp:Wt,quickactions:()=>0,comment:t=>t.comment};function zl(t){return t in Ei}var ge=(t=>(t.Search="search",t.Highlight="highlight",t))(ge||{});const Ti={search:"",highlight:""},Gl=ae({name:"ui/filters",initialState:Ti,reducers:{setFilter(t,e){t.search=e.payload},setHighlight(t,e){t.highlight=e.payload}}}),{actions:Yl,reducer:Jl}=Gl,{setFilter:Ri,setHighlight:Ai}=Yl;function rs(t,e){return t.toSorted?t.toSorted(e):[...t].sort(e)}function js(t,...e){if(t.toSpliced)return t.toSpliced(...e);{const s=[...t];return s.splice(...e),s}}function jt(t){return new Map(t.map((e,s)=>[e.id,s]))}function os(t){return new Set(t.map(e=>e.id))}function Un(t,e){return t.has(e)&&(t=new Set(t),t.delete(e)),t}function Bn(t,e,s){const i=js(t,s,1),r=new Map(e);r.delete(t[s].id);for(let n=i.length-1;n>=s;n--)r.set(i[n].id,n);return{view:i,_viewIndex:r}}function Ql(t,e,s,i){const r=[...t],n=r.length;let l=e,a=l.get(s.id);if(a+1<n&&i(s,r[a+1])>0){l=new Map(l);do{const d=r[a+1];r[a]=d,l.set(d.id,a),a++}while(a+1<n&&i(s,r[a+1])>0);l.set(s.id,a)}else if(a>0&&i(s,r[a-1])<0){l=new Map(l);do{const d=r[a-1];r[a]=d,l.set(d.id,a),a--}while(a>0&&i(s,r[a-1])<0);l.set(s.id,a)}return r[a]=s,{view:r,_viewIndex:l}}function Wn(t,e,s,i){const r=Xl(t,s,i),n=js(t,r,0,s),l=new Map(e);for(let a=n.length-1;a>=r;a--)l.set(n[a].id,a);return{view:n,_viewIndex:l}}function Xl(t,e,s){let i=0,r=t.length;if(r===0||s(t[r-1],e)<=0)return r;for(;i<r;){const n=i+r>>>1;s(e,t[n])>=0?i=n+1:r=n}return i}function ys(t){return t=t.filter(_s),()=>Promise.all(t.map(e=>ne(`/flows/${e.id}/resume`,{method:"POST"})))}function Di(){return()=>ne("/flows/resume",{method:"POST"})}function Fi(t){return t=t.filter(_s),()=>Promise.all(t.map(e=>ne(`/flows/${e.id}/kill`,{method:"POST"})))}function Zl(){return()=>ne("/flows/kill",{method:"POST"})}function Ii(t){return()=>Promise.all(t.map(e=>ne(`/flows/${e.id}`,{method:"DELETE"})))}function Li(t){return()=>Promise.all(t.map(e=>ne(`/flows/${e.id}/duplicate`,{method:"POST"})))}function ws(t){return t=t.filter(xs),()=>Promise.all(t.map(e=>ne(`/flows/${e.id}/replay`,{method:"POST"})))}function Pi(t){return t=t.filter(bi),()=>Promise.all(t.map(e=>ne(`/flows/${e.id}/revert`,{method:"POST"})))}function Kn(t,e){return()=>Promise.all(t.map(s=>Ie(s,{marked:e})()))}function Ie(t,e){return()=>ne.put(`/flows/${t.id}`,e)}function ec(t,e,s){const i=new FormData;return e=new window.Blob([e],{type:"plain/text"}),i.append("file",e),()=>ne(`/flows/${t.id}/${s}/content.data`,{method:"POST",body:i})}function Oi(){return()=>ne("/clear",{method:"POST"})}function tc(t){const e=new FormData;return e.append("file",t),()=>ne("/flows/dump",{method:"POST",body:e})}const Mi=xe("flows/add"),qi=xe("flows/update"),Hi=xe("flows/remove"),bs=xe("flows/receive"),Vi=xe("flows/filterUpdate"),Ui=xe("flows/sort"),He=xe("flows/select"),sc={list:[],_listIndex:new Map,byId:new Map,view:[],_viewIndex:new Map,sort:{column:void 0,desc:!1},selected:[],selectedIds:new Set,highlightedIds:new Set};function nc(t=sc,e){if(bs.match(e)){const{sort:s}=t,i=e.payload,r=jt(i),n=new Map(i.map(p=>[p.id,p])),l=rs(i,pt(s)),a=jt(l),d=t.selected.map(p=>n.get(p.id)).filter(p=>p!==void 0),u=os(d);return{list:i,_listIndex:r,byId:n,view:l,_viewIndex:a,sort:s,selected:d,selectedIds:u,highlightedIds:new Set}}else if(Mi.match(e)){const{flow:s,matching_filters:i}=e.payload;if(t._listIndex.has(s.id))return t;const{sort:r,selected:n,selectedIds:l}=t;let{view:a,_viewIndex:d,highlightedIds:u}=t;const h=new Map(t._listIndex);h.set(s.id,t.list.length);const p=[...t.list,s],g=new Map(t.byId);return g.set(s.id,s),(i[ge.Search]===!0||i[ge.Search]===void 0)&&({view:a,_viewIndex:d}=Wn(a,d,s,pt(r))),i[ge.Highlight]===!0&&(u=new Set(u),u.add(s.id)),{list:p,_listIndex:h,byId:g,view:a,_viewIndex:d,sort:r,selected:n,selectedIds:l,highlightedIds:u}}else if(qi.match(e)){const{flow:s,matching_filters:i}=e.payload,{_listIndex:r,sort:n,selectedIds:l}=t;let{view:a,_viewIndex:d,selected:u,highlightedIds:h}=t;const p=t._listIndex.get(s.id),g=[...t.list];p!==void 0?g[p]=s:g.push(s);const _=new Map(t.byId);_.set(s.id,s);const j=d.get(s.id),y=j!==void 0,w=i[ge.Search]===!0||i[ge.Search]===void 0;return w&&!y?{view:a,_viewIndex:d}=Wn(a,d,s,pt(n)):!w&&y?{view:a,_viewIndex:d}=Bn(a,d,j):w&&y&&({view:a,_viewIndex:d}=Ql(a,d,s,pt(n))),l.has(s.id)&&(u=u.map($=>$.id===s.id?s:$)),i[ge.Highlight]===!0?h.has(s.id)||(h=new Set(h),h.add(s.id)):h=Un(h,s.id),{list:g,_listIndex:r,byId:_,view:a,_viewIndex:d,sort:n,selected:u,selectedIds:l,highlightedIds:h}}else if(Hi.match(e)){const s=e.payload,{sort:i}=t;let{view:r,_viewIndex:n,selected:l,selectedIds:a}=t;const d=t._listIndex.get(s);if(d===void 0)return t;const u=js(t.list,d,1),h=jt(u),p=new Map(t.byId);p.delete(s);const g=n.get(s);if(g!==void 0&&({view:r,_viewIndex:n}=Bn(r,n,g)),a.has(s)){if(l.length===1&&g!==void 0){const j=r[g]??r[g-1];l=j?[j]:[]}else l=l.filter(j=>j.id!==s);a=os(l)}const _=Un(t.highlightedIds,s);return{list:u,_listIndex:h,byId:p,view:r,_viewIndex:n,sort:i,selected:l,selectedIds:a,highlightedIds:_}}else if(Vi.match(e)){const{name:s,matching_flow_ids:i}=e.payload;switch(s){case ge.Search:{const r=rs(i===null?t.list:i.map(l=>t.byId.get(l)).filter(l=>l!==void 0),pt(t.sort)),n=jt(r);return{...t,view:r,_viewIndex:n}}case ge.Highlight:return{...t,highlightedIds:new Set(i)};default:Ct(s)}}else if(Ui.match(e)){const s=e.payload;let i;s.column?i=rs(t.view,pt(s)):i=t.list.filter(n=>t._viewIndex.has(n.id));const r=jt(i);return{...t,sort:s,view:i,_viewIndex:r}}else return He.match(e)?{...t,selected:e.payload,selectedIds:os(e.payload)}:t}function pt({column:t,desc:e}){if(!t)return(i,r)=>0;const s=Ei[t];return(i,r)=>{const n=s(i),l=s(r);return n>l?e?-1:1:n<l?e?1:-1:0}}function ht(t,e){const s=t.selected[t.selected.length-1],i=t._viewIndex.get(s?.id),r=0,n=t.view.length-1;let l;i===void 0?l=e<0?r:n:(l=i+e,l=window.Math.max(l,r),l=window.Math.min(l,n));const a=t.view[l];return He(a?[a]:[])}function ic(t){return(e,s)=>{const{flows:i}=s();i.selectedIds.has(t.id)?e(He(i.selected.filter(r=>r!==t))):e(He([...i.selected,t]))}}function rc(t){return(e,s)=>{const{flows:i}=s(),r=i.selected[i.selected.length-1],n=i._viewIndex.get(t.id),l=i._viewIndex.get(r?.id);if(n===void 0||l===void 0)return e(He([t]));let a;return n<=l?a=i.view.slice(n,l+1):(a=i.view.slice(l+1,n+1),a.push(r)),e(He(a))}}const oc={activeModal:void 0},Bi=ae({name:"ui/modal",initialState:oc,reducers:{setActiveModal(t,e){t.activeModal=e.payload},hideModal(t){t.activeModal=void 0}}}),{actions:lc,reducer:cc}=Bi,ac=Bi.actions.hideModal.type,{setActiveModal:dc,hideModal:Wi}=lc,zn=(()=>{const t=document.createElement("div");return t.setAttribute("contenteditable","PLAINTEXT-ONLY"),t.contentEditable==="plaintext-only"?"plaintext-only":"true"})();class le extends I.Component{input=Ee.createRef();render(){const e=_e("inline-input",this.props.className);return o.jsx("span",{ref:this.input,tabIndex:0,className:e,placeholder:this.props.placeholder,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onInput:this.onInput,onPaste:this.onPaste,onMouseDown:this.onMouseDown,onClick:this.onClick,children:this.props.content})}componentDidUpdate(e){e.content!==this.props.content&&this.props.onInput?.(this.props.content)}isEditing=()=>this.input.current?.contentEditable===zn;startEditing=()=>{if(!this.input.current)return console.error("unreachable");this.isEditing()||(this.suppress_events=!0,this.input.current.blur(),this.input.current.contentEditable=zn,window.requestAnimationFrame(()=>{if(this.input.current){if(this.input.current.focus(),this.suppress_events=!1,this.props.selectAllOnClick){const e=document.createRange();e.selectNodeContents(this.input.current);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(e)}this.props.onEditStart?.()}}))};resetValue=()=>{if(!this.input.current)return console.error("unreachable");this.input.current.textContent=this.props.content,this.props.onInput?.(this.props.content)};finishEditing=()=>{if(!this.input.current)return console.error("unreachable");this.props.onEditDone(this.input.current.textContent||""),this.input.current.blur(),this.input.current.contentEditable="inherit"};onPaste=e=>{e.preventDefault();const s=e.clipboardData.getData("text/plain");document.execCommand("insertHTML",!1,s)};suppress_events=!1;onMouseDown=e=>{this.suppress_events=!0,window.addEventListener("mouseup",this.onMouseUp,{once:!0})};onMouseUp=e=>{const s=e.target===this.input.current,i=!window.getSelection()?.toString();this.props.selectAllOnClick?s&&i&&this.startEditing():s&&this.startEditing(),this.suppress_events=!1};onClick=e=>{};onFocus=e=>{if(!this.input.current)throw"unreachable";this.suppress_events||this.startEditing()};onInput=e=>{this.props.onInput?.(this.input.current?.textContent||"")};onBlur=e=>{this.suppress_events||this.finishEditing()};onKeyDown=e=>{switch(e.stopPropagation(),e.key){case"Escape":e.preventDefault(),this.resetValue(),this.finishEditing();break;case"Enter":e.shiftKey||(e.preventDefault(),this.finishEditing());break}this.props.onKeyDown?.(e)}}function bt(t){const e=E.c(15);let s;e[0]!==t.content||e[1]!==t.isValid?(s=t.isValid(t.content),e[0]=t.content,e[1]=t.isValid,e[2]=s):s=e[2];const[i,r]=I.useState(s),n=I.useRef(null);let l;e[3]!==t?(l=_=>{t.isValid(_)?t.onEditDone(_):n.current?.resetValue()},e[3]=t,e[4]=l):l=e[4];const a=l,d=i?"has-success":"has-warning";let u;e[5]!==t.className||e[6]!==d?(u=_e(t.className,d),e[5]=t.className,e[6]=d,e[7]=u):u=e[7];const h=u;let p;e[8]!==t?(p=_=>r(t.isValid(_)),e[8]=t,e[9]=p):p=e[9];let g;return e[10]!==h||e[11]!==a||e[12]!==t||e[13]!==p?(g=o.jsx(le,{...t,className:h,onInput:p,onEditDone:a,ref:n}),e[10]=h,e[11]=a,e[12]=t,e[13]=p,e[14]=g):g=e[14],g}const G=()=>Nl(),D=kl,uc=ui.withTypes(),Ss=xe("EVENTS_ADD"),Ki=xe("EVENTS_RECEIVE"),Gt=xe("events/toggleVisibility"),zi=xe("events/toggleFilter");var Gi=(t=>(t.debug="debug",t.info="info",t.web="web",t.warn="warn",t.error="error",t))(Gi||{});const fc={visible:!1,filters:{debug:!1,info:!0,web:!0,warn:!0,error:!0},list:[],view:[]};function pc(t=fc,e){if(Ss.match(e)){const s=e.payload;return{...t,list:[...t.list,s],view:t.filters[s.level]?[...t.view,s]:t.view}}else{if(Ki.match(e))return{...t,list:e.payload,view:e.payload.filter(s=>t.filters[s.level])};if(Gt.match(e))return{...t,visible:!t.visible};if(zi.match(e)){const s={...t.filters,[e.payload]:!t.filters[e.payload]};return{...t,filters:s,view:t.list.filter(i=>s[i.level])}}else return t}}function hc(t,e="web"){return Ss({id:Math.random().toString(),message:t,level:e})}const Gn={},mc=ae({name:"ui/optionsEditor",initialState:Gn,reducers:{startUpdate(t,e){t[e.payload.option]={isUpdating:!0,value:e.payload.value,error:!1}},updateSuccess(t,e){t[e.payload.option]=void 0},updateError(t,e){let s=t[e.payload.option].value;typeof s=="boolean"&&(s=!s),t[e.payload.option]={value:s,isUpdating:!1,error:e.payload.error}}},extraReducers:t=>{t.addCase(ac,()=>Gn)}}),{actions:gc,reducer:vc}=mc,{startUpdate:xc,updateSuccess:_c,updateError:jc}=gc;var ve=(t=>(t[t.Capture=0]="Capture",t[t.FlowList=1]="FlowList",t[t.Options=2]="Options",t[t.Flow=3]="Flow",t))(ve||{});const yc=ae({name:"ui/tabs",initialState:{current:1},reducers:{setCurrent(t,e){t.current=e.payload}}}),{actions:wc,reducer:bc}=yc,{setCurrent:Vt}=wc,Sc=fi({flow:Vl,modal:cc,optionsEditor:vc,tabs:bc,filter:Jl});var wt=(t=>(t.INIT="CONNECTION_INIT",t.FETCHING="CONNECTION_FETCHING",t.ESTABLISHED="CONNECTION_ESTABLISHED",t.ERROR="CONNECTION_ERROR",t))(wt||{});const $c={state:"CONNECTION_INIT",message:void 0},Yi=ae({name:"connection",initialState:$c,reducers:{startFetching:t=>{t.state==="CONNECTION_INIT"&&(t.state="CONNECTION_FETCHING")},finishFetching:t=>{t.state==="CONNECTION_FETCHING"&&(t.state="CONNECTION_ESTABLISHED")},connectionError:(t,e)=>{t.state="CONNECTION_ERROR",t.message=e.payload}}}),{startFetching:Cc,finishFetching:Nc,connectionError:kc}=Yi.actions,Ec=Yi.reducer,Tc={add_upstream_certs_to_client_chain:!1,allow_hosts:[],anticache:!1,anticomp:!1,block_global:!0,block_list:[],block_private:!1,body_size_limit:void 0,cert_passphrase:void 0,certs:[],ciphers_client:void 0,ciphers_server:void 0,client_certs:void 0,client_replay:[],client_replay_concurrency:1,command_history:!0,confdir:"~/.mitmproxy",connect_addr:void 0,connection_strategy:"eager",console_focus_follow:!1,content_view_lines_cutoff:512,dns_name_servers:[],dns_use_hosts_file:!0,export_preserve_original_ip:!1,hardump:"",http2:!0,http2_ping_keepalive:58,http3:!0,http_connect_send_host_header:!0,ignore_hosts:[],intercept:void 0,intercept_active:!1,keep_alt_svc_header:!1,keep_host_header:!1,key_size:2048,listen_host:"",listen_port:void 0,map_local:[],map_remote:[],mode:["regular"],modify_body:[],modify_headers:[],normalize_outbound_headers:!0,onboarding:!0,onboarding_host:"mitm.it",protobuf_definitions:void 0,proxy_debug:!1,proxyauth:void 0,rawtcp:!0,readfile_filter:void 0,request_client_cert:!1,rfile:void 0,save_stream_file:void 0,save_stream_filter:void 0,scripts:[],server:!0,server_replay:[],server_replay_extra:"forward",server_replay_ignore_content:!1,server_replay_ignore_host:!1,server_replay_ignore_params:[],server_replay_ignore_payload_params:[],server_replay_ignore_port:!1,server_replay_kill_extra:!1,server_replay_nopop:!1,server_replay_refresh:!0,server_replay_reuse:!1,server_replay_use_headers:[],show_ignored_hosts:!1,showhost:!1,ssl_insecure:!1,ssl_verify_upstream_trusted_ca:void 0,ssl_verify_upstream_trusted_confdir:void 0,stickyauth:void 0,stickycookie:void 0,store_streamed_bodies:!1,stream_large_bodies:void 0,strip_ech:!0,tcp_hosts:[],termlog_verbosity:"info",tls_ecdh_curve_client:void 0,tls_ecdh_curve_server:void 0,tls_version_client_max:"UNBOUNDED",tls_version_client_min:"TLS1_2",tls_version_server_max:"UNBOUNDED",tls_version_server_min:"TLS1_2",udp_hosts:[],upstream_auth:void 0,upstream_cert:!0,validate_inbound_headers:!0,view_filter:void 0,view_order:"time",view_order_reversed:!1,web_columns:["tls","icon","path","method","status","size","time"],web_debug:!1,web_host:"127.0.0.1",web_open_browser:!0,web_password:"",web_port:8081,web_static_viewer:"",websocket:!0},Yt=xe("OPTIONS_RECEIVE"),$s=xe("OPTIONS_UPDATE"),Rc=ae({name:"options",initialState:Tc,reducers:{},extraReducers:t=>{t.addCase(Yt,(e,s)=>{const i={};for(const[r,{value:n}]of Object.entries(s.payload))i[r]=n;return i}).addCase($s,(e,s)=>{for(const[i,{value:r}]of Object.entries(s.payload))e[i]=r})}}),Ac=Rc.reducer;async function Dc(t,e,s){try{const i=await ne.put("/options",{[t]:e});if(i.status===200)s(_c({option:t}));else throw await i.text()}catch(i){s(jc({option:t,error:i.toString()}))}}const Fc=Dc;function Cs(t,e){return s=>{s(xc({option:t,value:e})),Fc(t,e,s)}}const Ic={visible:!1},Lc=ae({name:"commandBar",initialState:Ic,reducers:{toggleVisibility(t){t.visible=!t.visible}}}),{actions:Pc,reducer:Oc}=Lc,{toggleVisibility:Ji}=Pc,Ve=xe("STATE_RECEIVE"),Ue=xe("STATE_UPDATE"),Mc={available:!1,version:"",contentViews:[],servers:{},platform:"",localModeUnavailable:null},qc=ae({name:"backendState",initialState:Mc,reducers:{},extraReducers:t=>{t.addCase(Ve,(e,s)=>({...e,available:!0,...s.payload})).addCase(Ue,(e,s)=>({...e,...s.payload}))}}),Hc=qc.reducer,Vc={},Uc=ae({name:"optionsMeta",initialState:Vc,reducers:{},extraReducers:t=>{t.addCase(Yt,(e,s)=>s.payload).addCase($s,(e,s)=>({...e,...s.payload}))}}),Bc=Uc.reducer,dt=(t,e)=>e.listen_host&&e.listen_port?`${t}@${e.listen_host}:${e.listen_port}`:e.listen_port?`${t}@${e.listen_port}`:t,Qi=t=>{let[e,s]=ps(t,"@");e||(e=s,s="");const[i,r]=vi(e,":");let n,l;if(s){let a;if(s.includes(":")?[n,a]=ps(s,":"):(n="",a=s),a&&(l=parseInt(a,10),isNaN(l)||l<0||l>65535))throw new Error(`invalid port: ${a}`)}return{full_spec:t,name:i,data:r,listen_host:n,listen_port:l}},Xi=t=>dt("regular",t),Yn=({listen_host:t,listen_port:e})=>({ui_id:Math.random(),active:!0,listen_host:t,listen_port:e}),Zi=t=>t.selectedProcesses?`local:${t.selectedProcesses}`:"local",Jn=({data:t})=>({ui_id:Math.random(),active:!0,selectedProcesses:t}),er=t=>{const e=t.file_path?`wireguard:${t.file_path}`:"wireguard";return dt(e,t)},Qn=({data:t,listen_host:e,listen_port:s})=>({ui_id:Math.random(),active:!0,listen_host:e,listen_port:s,file_path:t});var Jt=(t=>(t.HTTP="http",t.HTTPS="https",t.HTTP3="http3",t.TLS="tls",t.DTLS="dtls",t.TCP="tcp",t.UDP="udp",t.DNS="dns",t.QUIC="quic",t))(Jt||{}),ot=(t=>(t.CSS="css",t.JAVASCRIPT="javascript",t.XML="xml",t.YAML="yaml",t.NONE="none",t.ERROR="error",t))(ot||{});const hs=()=>({active:!1,protocol:Jt.HTTPS,destination:"",ui_id:Math.random()}),Ns=t=>dt(`reverse:${t.protocol}://${t.destination}`,t),Wc=({data:t,listen_host:e,listen_port:s})=>{let[i,r]=vi(t,"://");return r||(r=i,i=Jt.HTTPS),{ui_id:Math.random(),active:!0,protocol:i,destination:r,listen_host:e,listen_port:s}},tr=t=>dt("transparent",t),Xn=({listen_host:t,listen_port:e})=>({ui_id:Math.random(),active:!0,listen_host:t,listen_port:e}),sr=t=>dt("socks5",t),Zn=({listen_host:t,listen_port:e})=>({ui_id:Math.random(),active:!0,listen_host:t,listen_port:e}),nr=t=>dt(`upstream:${t.destination}`,t),ei=({data:t,listen_host:e,listen_port:s})=>({ui_id:Math.random(),active:!0,destination:t||"",listen_host:e,listen_port:s}),ir=t=>dt("dns",t),ti=({listen_host:t,listen_port:e})=>({ui_id:Math.random(),active:!0,listen_host:t,listen_port:e}),Xe=t=>t.active&&!t.error;async function Kc(t,e){const s=e.getState().modes,i=[...s.regular.filter(Xe).map(Xi),...s.local.filter(Xe).map(Zi),...s.wireguard.filter(Xe).map(er),...s.reverse.filter(Xe).map(Ns),...s.transparent.filter(Xe).map(tr),...s.socks.filter(Xe).map(sr),...s.upstream.filter(Xe).map(nr),...s.dns.filter(Xe).map(ir)],r=await ne.put("/options",{mode:i});if(r.status!==200)throw new Error(await r.text())}function ie(t){return uc(t,Kc)}function se(t,e,s){t.addCase(s.pending,(i,r)=>{const{server:n,value:l}=r.meta.arg,a=i.findIndex(d=>d.ui_id===n.ui_id);a>=0&&(i[a][e]=l,i[a].error=void 0)}),t.addCase(s.rejected,(i,r)=>{const{server:n}=r.meta.arg,l=i.findIndex(a=>a.ui_id===n.ui_id);l>=0&&(i[l].error=r.error.message)})}function ye(t,e){return function(i,r){if(r.payload.servers){const n=Object.values(r.payload.servers).filter(l=>l.type===t).map(l=>Qi(l.full_spec));if(n.length>0)return n.map(e);for(const l of i)l.active=!1}}}const rr=ie("modes/regular/setActive"),or=ie("modes/regular/setListenHost"),lr=ie("modes/regular/setListenPort"),zc=[{active:!0,ui_id:Math.random()}],Gc=ae({name:"modes/regular",initialState:zc,reducers:{},extraReducers:t=>{se(t,"active",rr),se(t,"listen_host",or),se(t,"listen_port",lr),t.addCase(Ve,ye("regular",Yn)),t.addCase(Ue,ye("regular",Yn))}}),Yc=Gc.reducer,cr=ie("modes/local/setActive"),St=ie("modes/local/setSelectedProcesses"),Jc=[{active:!1,selectedProcesses:"",ui_id:Math.random()}],Qc=ae({name:"modes/local",initialState:Jc,reducers:{},extraReducers:t=>{se(t,"active",cr),se(t,"selectedProcesses",St),t.addCase(Ve,ye("local",Jn)),t.addCase(Ue,ye("local",Jn))}}),Xc=Qc.reducer,ar=ie("modes/wireguard/setActive"),dr=ie("modes/wireguard/setListenHost"),ur=ie("modes/wireguard/setListenPort"),fr=ie("modes/wireguard/setFilePath"),Zc=[{active:!1,ui_id:Math.random()}],ea=ae({name:"modes/wireguard",initialState:Zc,reducers:{},extraReducers:t=>{se(t,"active",ar),se(t,"listen_host",dr),se(t,"listen_port",ur),se(t,"file_path",fr),t.addCase(Ve,ye("wireguard",Qn)),t.addCase(Ue,ye("wireguard",Qn))}}),ta=ea.reducer,ms=ie("modes/reverse/setActive"),pr=ie("modes/reverse/setListenHost"),hr=ie("modes/reverse/setListenPort"),mr=ie("modes/reverse/setProtocol"),gr=ie("modes/reverse/setDestination"),sa=[hs()],vr=ae({name:"modes/reverse",initialState:sa,reducers:{addServer:t=>{t.push(hs())},removeServer:(t,e)=>{const s=t.findIndex(i=>i.ui_id===e.payload.ui_id);s!==-1&&(t[s].active&&console.error("servers should be deactivated before removal"),t.splice(s,1))}},extraReducers:t=>{se(t,"active",ms),se(t,"listen_host",pr),se(t,"listen_port",hr),se(t,"protocol",mr),se(t,"destination",gr),t.addCase(Ve,e),t.addCase(Ue,e);function e(s,i){if(i.payload.servers){const r=Object.fromEntries(Object.entries(i.payload.servers).filter(([l,a])=>a.type==="reverse").map(([l,a])=>[l,Qi(l)])),n=[];for(const l of s){const a=Ns(l),d=a in r;delete r[a],n.push({...l,active:d})}for(const l of Object.values(r))n.push(Wc(l));return n.length>1&&Kt({...n[0],ui_id:void 0},{...hs(),ui_id:void 0})&&n.shift(),n}}}}),{addServer:na,removeServer:ia}=vr.actions,ra=vr.reducer,xr=ie("modes/transparent/setActive"),_r=ie("modes/transparent/setListenHost"),jr=ie("modes/transparent/setListenPort"),oa=[{active:!1,ui_id:Math.random()}],la=ae({name:"modes/transparent",initialState:oa,reducers:{},extraReducers:t=>{se(t,"active",xr),se(t,"listen_host",_r),se(t,"listen_port",jr),t.addCase(Ve,ye("transparent",Xn)),t.addCase(Ue,ye("transparent",Xn))}}),ca=la.reducer,yr=ie("modes/socks5/setActive"),wr=ie("modes/socks5/setListenHost"),br=ie("modes/socks5/setListenPort"),aa=[{active:!1,ui_id:Math.random()}],da=ae({name:"modes/socks5",initialState:aa,reducers:{},extraReducers:t=>{se(t,"active",yr),se(t,"listen_host",wr),se(t,"listen_port",br),t.addCase(Ve,ye("socks5",Zn)),t.addCase(Ue,ye("socks5",Zn))}}),ua=da.reducer,Sr=ie("modes/upstream/setActive"),$r=ie("modes/upstream/setListenHost"),Cr=ie("modes/upstream/setListenPort"),Nr=ie("modes/upstream/setDestination"),fa=[{active:!1,destination:"",ui_id:Math.random()}],pa=ae({name:"modes/upstream",initialState:fa,reducers:{},extraReducers:t=>{se(t,"active",Sr),se(t,"listen_host",$r),se(t,"listen_port",Cr),se(t,"destination",Nr),t.addCase(Ve,ye("upstream",ei)),t.addCase(Ue,ye("upstream",ei))}}),ha=pa.reducer,kr=ie("modes/dns/setActive"),Er=ie("modes/dns/setListenHost"),Tr=ie("modes/dns/setListenPort"),ma=[{active:!0,ui_id:Math.random()}],ga=ae({name:"modes/dns",initialState:ma,reducers:{},extraReducers:t=>{se(t,"active",kr),se(t,"listen_host",Er),se(t,"listen_port",Tr),t.addCase(Ve,ye("dns",ti)),t.addCase(Ue,ye("dns",ti))}}),va=ga.reducer,xa=fi({regular:Yc,local:Xc,wireguard:ta,reverse:ra,transparent:ca,socks:ua,upstream:ha,dns:va}),$t=ui("fetchProcesses",async(t,{rejectWithValue:e})=>{try{return(await ne("/processes")).json()}catch(s){return e(s.message)}}),_a={currentProcesses:[],isLoading:!1},ja=ae({name:"processes",initialState:_a,reducers:{},extraReducers:t=>{t.addCase($t.pending,e=>{e.isLoading=!0,e.error=void 0}),t.addCase($t.fulfilled,(e,s)=>{e.isLoading=!1,e.currentProcesses=s.payload}),t.addCase($t.rejected,(e,s)=>{e.isLoading=!1,e.error=s.payload})}}),ya=ja.reducer,wa={commandBar:Oc,eventLog:pc,flows:nc,connection:Ec,modes:xa,ui:Sc,options:Ac,options_meta:Bc,backendState:Hc,processes:ya},ba={immutableCheck:{warnAfter:5e5},serializableCheck:{warnAfter:5e5,ignoredPaths:["flows"]}},Nt=El({reducer:wa,middleware:t=>t(ba),devTools:!1});class Sa extends I.Component{container=Ee.createRef();nameInput=Ee.createRef();valueInput=Ee.createRef();render=()=>{const[e,s]=this.props.item;return o.jsxs("div",{ref:this.container,className:"kv-row",onClick:this.onClick,onKeyDownCapture:this.onKeyDown,children:[o.jsx(le,{ref:this.nameInput,className:"kv-key",content:e,onEditStart:this.props.onEditStart,onEditDone:i=>this.props.onEditDone([i,s]),selectAllOnClick:!0}),": ",o.jsx(le,{ref:this.valueInput,className:"kv-value",content:s,onEditStart:this.props.onEditStart,onEditDone:i=>this.props.onEditDone([e,i]),placeholder:"empty",selectAllOnClick:!0})]})};onClick=e=>{e.target===this.container.current&&this.props.onClickEmptyArea()};onKeyDown=e=>{e.target===this.valueInput.current?.input.current&&e.key==="Tab"&&this.props.onTabNext()}}class Rr extends I.Component{rowRefs={};currentlyEditing;justFinishedEditing;state={currentList:this.props.data||[],initialList:this.props.data};static getDerivedStateFromProps(e,s){return e.data!==s.initialList?{currentList:e.data||[],initialList:e.data}:null}render=()=>{this.rowRefs={};const e=this.state.currentList.map((s,i)=>o.jsx(Sa,{item:s,onEditStart:()=>this.currentlyEditing=i,onEditDone:r=>this.onEditDone(i,r),onClickEmptyArea:()=>this.onClickEmptyArea(i),onTabNext:()=>this.onTabNext(i),ref:r=>{this.rowRefs[i]=r}},i));return o.jsxs("div",{className:_e("kv-editor",this.props.className),onMouseDown:this.onMouseDown,children:[e,o.jsx("div",{onClick:s=>{s.preventDefault(),this.onClickEmptyArea(this.state.currentList.length-1)},className:"kv-add-row fa fa-plus-square-o",role:"button","aria-label":"Add"})]})};onEditDone=(e,s)=>{const i=[...this.state.currentList];s[0]?i[e]=s:i.splice(e,1),this.currentlyEditing=void 0,Ht.isEqual(this.state.currentList,i)||this.props.onChange(i),this.setState({currentList:i})};onClickEmptyArea=e=>{if(this.justFinishedEditing)return;const s=[...this.state.currentList];s.splice(e+1,0,["",""]),this.setState({currentList:s},()=>this.rowRefs[e+1]?.nameInput.current?.startEditing())};onTabNext=e=>{e==this.state.currentList.length-1&&this.onClickEmptyArea(e)};onMouseDown=e=>{this.justFinishedEditing=this.currentlyEditing}}function Ar(t,e){const s=E.c(6),[i,r]=I.useState(),[n,l]=I.useState();let a;s[0]!==n||s[1]!==t?(a=()=>{n&&n.abort();const u=new AbortController;return ne(t,{signal:u.signal}).then($a).then(h=>{r(h)}).catch(h=>{u.signal.aborted||r(`Error getting content: ${h}.`)}),l(u),()=>{u.signal.aborted||u.abort()}},s[0]=n,s[1]=t,s[2]=a):a=s[2];let d;return s[3]!==e||s[4]!==t?(d=[t,e],s[3]=e,s[4]=t,s[5]=d):d=s[5],I.useEffect(a,d),i}function $a(t){if(!t.ok)throw`${t.status} ${t.statusText}`.trim();return t.text()}function Dr(t,e,s,i,r){const n=E.c(11);let l;n[0]!==t||n[1]!==i||n[2]!==e||n[3]!==s?(l=je.getContentURL(t,e,s,i),n[0]=t,n[1]=i,n[2]=e,n[3]=s,n[4]=l):l=n[4];const d=Ar(l,r);let u;if(d)try{let h;n[5]!==d?(h=JSON.parse(d),n[5]=d,n[6]=h):h=n[6],u=h}catch{let h;n[7]!==d?(h={text:d,description:"Network Error",syntax_highlight:"error",view_name:"raw"},n[7]=d,n[8]=h):h=n[8];const p=h;if(e==="messages"){let g;n[9]!==p?(g=[p],n[9]=p,n[10]=g):g=n[10],u=g}else u=p}else u=void 0;return u}const Fr=Ee.memo(function({icon:e,text:s,className:i,title:r,onOpenFile:n,onClick:l}){let a;return o.jsxs("a",{href:"#",onClick:d=>{a.click(),l&&l(d)},className:i,title:r,children:[o.jsx("i",{className:"fa fa-fw "+e}),s,o.jsx("input",{ref:d=>{a=d},className:"hidden",type:"file",onChange:d=>{d.preventDefault(),d.target.files&&d.target.files.length>0&&n(d.target.files[0]),a.value=""}})]})});function ue(t){const e=E.c(11),{onClick:s,children:i,icon:r,disabled:n,className:l,title:a}=t;let d;e[0]!==l?(d=_e(l,"btn btn-default"),e[0]=l,e[1]=d):d=e[1];const u=n?void 0:s;let h;e[2]!==r?(h=r&&o.jsxs(o.Fragment,{children:[o.jsx("i",{className:"fa "+r})," "]}),e[2]=r,e[3]=h):h=e[3];let p;return e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==u||e[8]!==h||e[9]!==a?(p=o.jsxs("button",{className:d,onClick:u,disabled:n,title:a,children:[h,i]}),e[4]=i,e[5]=n,e[6]=d,e[7]=u,e[8]=h,e[9]=a,e[10]=p):p=e[10],p}function Ca(t){const e=E.c(11),{initialContent:s,onChange:i,language:r,readonly:n}=t,l=n===void 0?!1:n,a=Na;let d;e:switch(r){case ot.YAML:{let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=[Dl()],e[0]=p):p=e[0],d=p;break e}case ot.XML:{let p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=[Al()],e[1]=p):p=e[1],d=p;break e}case ot.JAVASCRIPT:{let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=[Rl()],e[2]=p):p=e[2],d=p;break e}case ot.CSS:{let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=[Tl()],e[3]=p):p=e[3],d=p;break e}case void 0:case null:case ot.NONE:case ot.ERROR:{let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[4]=p):p=e[4],d=p;break e}default:{console.error("Unexpected syntax highlighting language: ",r);let g;e[5]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[5]=g):g=e[5],d=g}}const u=d;let h;return e[6]!==u||e[7]!==s||e[8]!==i||e[9]!==l?(h=o.jsx("div",{className:"codeeditor",onKeyDown:a,children:o.jsx(Fl,{value:s,onChange:i,readOnly:l,extensions:u})}),e[6]=u,e[7]=s,e[8]=i,e[9]=l,e[10]=h):h=e[10],h}function Na(t){return t.stopPropagation()}const Ir=Ee.memo(function(e){const s=E.c(9),{content:i,maxLines:r,showMore:n}=e;if(i.length===0)return null;let l;if(s[0]!==i||s[1]!==r||s[2]!==n){let d;s[4]!==r||s[5]!==n?(d=(u,h)=>h===r?o.jsxs("button",{onClick:n,className:"btn btn-xs btn-info",children:[o.jsx("i",{className:"fa fa-angle-double-down","aria-hidden":"true"})," ","Show more"]},"showmore"):o.jsx("div",{children:u},h),s[4]=r,s[5]=n,s[6]=d):d=s[6],l=i.split(`
-`).map(d),s[0]=i,s[1]=r,s[2]=n,s[3]=l}else l=s[3];let a;return s[7]!==l?(a=o.jsx("pre",{children:l}),s[7]=l,s[8]=a):a=s[8],a}),ka=()=>{const t=E.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("li",{role:"separator",className:"divider"}),t[0]=e):e=t[0],e};function Ne(t){const e=E.c(8);let s,i,r;if(e[0]!==t){const{onClick:a,children:d,...u}=t;i=d,s=u,r=h=>{h.preventDefault(),a()},e[0]=t,e[1]=s,e[2]=i,e[3]=r}else s=e[1],i=e[2],r=e[3];const n=r;let l;return e[4]!==s||e[5]!==i||e[6]!==n?(l=o.jsx("li",{children:o.jsx("a",{href:"#",onClick:n,...s,children:i})}),e[4]=s,e[5]=i,e[6]=n,e[7]=l):l=e[7],l}const Et=Ee.memo(function({text:e,children:s,options:i,className:r,onOpen:n,...l}){const[a,d]=I.useState(!1),{refs:u,floatingStyles:h}=Il(i),p=_=>{d(_),n&&n(_)};I.useEffect(()=>{u.floating.current&&document.addEventListener("click",_=>{u.floating.current?.contains(_.target)?document.addEventListener("click",()=>p(!1),{once:!0}):(_.preventDefault(),_.stopPropagation(),p(!1))},{once:!0,capture:!0})},[u.floating.current]);let g;return a?g=o.jsx("ul",{className:"dropdown-menu show",ref:u.setFloating,style:h,children:s}):g=null,o.jsxs(o.Fragment,{children:[o.jsx("a",{href:"#",ref:u.setReference,className:_e(r,{open:a}),onClick:_=>{_.preventDefault(),p(!0)},...l,children:e}),g]})});function Lr(t){const e=E.c(16),{value:s,onChange:i}=t,r=D(Ea);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("i",{className:"fa fa-fw fa-files-o"}),e[0]=n):n=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("b",{children:"View:"}),e[1]=l):l=e[1];let a;e[2]!==s?(a=s.toLowerCase(),e[2]=s,e[3]=a):a=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("span",{className:"caret"}),e[4]=d):d=e[4];let u;e[5]!==a?(u=o.jsxs("span",{children:[n," ",l," ",a," ",d]}),e[5]=a,e[6]=u):u=e[6];const h=u;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p={placement:"top-end"},e[7]=p):p=e[7];let g;if(e[8]!==r||e[9]!==i){let j;e[11]!==i?(j=y=>o.jsx(Ne,{onClick:()=>i(y),children:y.toLowerCase().replace("_"," ")},y),e[11]=i,e[12]=j):j=e[12],g=r.map(j),e[8]=r,e[9]=i,e[10]=g}else g=e[10];let _;return e[13]!==h||e[14]!==g?(_=o.jsx(Et,{text:h,className:"btn btn-default btn-xs",options:p,children:g}),e[13]=h,e[14]=g,e[15]=_):_=e[15],_}function Ea(t){return t.backendState.contentViews||[]}function Ta(t){const e=E.c(8),{flow:s,message:i}=t,[r,n]=I.useState(!1);if(r){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>n(!1),e[0]=l):l=e[0];let a;return e[1]!==s||e[2]!==i?(a=o.jsx(Ra,{flow:s,message:i,stopEdit:l}),e[1]=s,e[2]=i,e[3]=a):a=e[3],a}else{let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=()=>n(!0),e[4]=l):l=e[4];let a;return e[5]!==s||e[6]!==i?(a=o.jsx(Aa,{flow:s,message:i,startEdit:l}),e[5]=s,e[6]=i,e[7]=a):a=e[7],a}}function Ra(t){const e=E.c(23),{flow:s,message:i,stopEdit:r}=t,n=G(),l=s.request===i?"request":"response";let a;e[0]!==s||e[1]!==i?(a=je.getContentURL(s,i),e[0]=s,e[1]=i,e[2]=a):a=e[2];const u=Ar(a,i.contentHash),[h,p]=I.useState();let g;e[3]!==u||e[4]!==n||e[5]!==h||e[6]!==s||e[7]!==l||e[8]!==r?(g=async()=>{await n(Ie(s,{[l]:{content:h||u||""}})),r()},e[3]=u,e[4]=n,e[5]=h,e[6]=s,e[7]=l,e[8]=r,e[9]=g):g=e[9];const _=g;let j;e[10]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx("h5",{children:"[Editing]"}),e[10]=j):j=e[10];let y;e[11]!==_?(y=o.jsx(ue,{onClick:_,icon:"fa-check text-success",className:"btn-xs",children:"Done"}),e[11]=_,e[12]=y):y=e[12];let w;e[13]!==r?(w=o.jsx(ue,{onClick:()=>r(),icon:"fa-times text-danger",className:"btn-xs",children:"Cancel"}),e[13]=r,e[14]=w):w=e[14];let $;e[15]!==y||e[16]!==w?($=o.jsxs("div",{className:"controls",children:[j,y," ",w]}),e[15]=y,e[16]=w,e[17]=$):$=e[17];const N=u||"";let k;e[18]!==N?(k=o.jsx(Ca,{initialContent:N,onChange:p}),e[18]=N,e[19]=k):k=e[19];let T;return e[20]!==$||e[21]!==k?(T=o.jsxs("div",{className:"contentview",children:[$,k]},"edit"),e[20]=$,e[21]=k,e[22]=T):T=e[22],T}function Aa(t){const e=E.c(43),{flow:s,message:i,startEdit:r}=t,n=G(),l=s.request===i?"request":"response";let a;e[0]!==s.id||e[1]!==l?(a=V=>V.ui.flow.contentViewFor[s.id+l]||"Auto",e[0]=s.id,e[1]=l,e[2]=a):a=e[2];const d=D(a),[u,h]=I.useState(D(Da));let p;e[3]!==u?(p=()=>h(Math.max(1024,u*2)),e[3]=u,e[4]=p):p=e[4];const g=p,_=Dr(s,i,d,u+1,i.contentHash);let j;if(i.contentLength===0)j="No content";else if(_===void 0)j="Loading...";else{const V=`${_.view_name} ${_.description}`;let W;e[5]!==V?(W=V.trimEnd(),e[5]=V,e[6]=W):W=e[6],j=W}let y;e[7]!==j?(y=o.jsx("h5",{children:j}),e[7]=j,e[8]=y):y=e[8];let w;e[9]!==_||e[10]!==s||e[11]!==i?(w=_&&_?.text.length>0&&o.jsx(Fa,{flow:s,message:i}),e[9]=_,e[10]=s,e[11]=i,e[12]=w):w=e[12];let $;e[13]!==r?($=o.jsx(ue,{onClick:r,icon:"fa-edit",className:"btn-xs",children:"Edit"}),e[13]=r,e[14]=$):$=e[14];let N;e[15]!==n||e[16]!==s||e[17]!==l?(N=o.jsx(Fr,{icon:"fa-upload",text:"Replace",title:"Upload a file to replace the content.",onOpenFile:V=>n(ec(s,V,l)),className:"btn btn-default btn-xs"}),e[15]=n,e[16]=s,e[17]=l,e[18]=N):N=e[18];let k;e[19]!==n||e[20]!==s.id||e[21]!==l?(k=V=>n(pi({messageId:s.id+l,contentView:V})),e[19]=n,e[20]=s.id,e[21]=l,e[22]=k):k=e[22];let T;e[23]!==d||e[24]!==k?(T=o.jsx(Lr,{value:d,onChange:k}),e[23]=d,e[24]=k,e[25]=T):T=e[25];let P;e[26]!==y||e[27]!==w||e[28]!==$||e[29]!==N||e[30]!==T?(P=o.jsxs("div",{className:"controls",children:[y,w," ",$," ",N," ",T]}),e[26]=y,e[27]=w,e[28]=$,e[29]=N,e[30]=T,e[31]=P):P=e[31];let L;e[32]!==s||e[33]!==i?(L=gs.matches(i)&&o.jsx(gs,{flow:s,message:i}),e[32]=s,e[33]=i,e[34]=L):L=e[34];const O=_?.text??"";let M;e[35]!==u||e[36]!==g||e[37]!==O?(M=o.jsx(Ir,{content:O,maxLines:u,showMore:g}),e[35]=u,e[36]=g,e[37]=O,e[38]=M):M=e[38];let U;return e[39]!==L||e[40]!==M||e[41]!==P?(U=o.jsxs("div",{className:"contentview",children:[P,L,M]},"view"),e[39]=L,e[40]=M,e[41]=P,e[42]=U):U=e[42],U}function Da(t){return t.options.content_view_lines_cutoff}function Fa({flow:t,message:e}){const s=t.request===e?"request":"response",i=D(u=>u.ui.flow.contentViewFor[t.id+s]||"Auto"),[r,n]=I.useState(!1),[l,a]=I.useState(!1),d=async()=>{try{const u=je.getContentURL(t,e,i);a(!0);const h=await ne(u);if(!h.ok)throw new Error(`${h.status} ${h.statusText}`.trim());const p=await h.json();await Bl(p),n(!0),setTimeout(()=>n(!1),2e3)}catch(u){console.error(u)}finally{a(!1)}};return o.jsx(ue,{onClick:d,icon:"fa-clipboard",className:"btn-xs",disabled:l,children:r?"Copied!":"Copy"})}const Ia=/^image\/(png|jpe?g|gif|webp|vnc.microsoft.icon|x-icon|svg\+xml)$/i;gs.matches=t=>Ia.test(je.getContentType(t)||"");function gs(t){const e=E.c(5),{flow:s,message:i}=t;let r;e[0]!==s||e[1]!==i?(r=je.getContentURL(s,i),e[0]=s,e[1]=i,e[2]=r):r=e[2];let n;return e[3]!==r?(n=o.jsx("div",{className:"flowview-image",children:o.jsx("img",{src:r,alt:"preview",className:"img-thumbnail"})}),e[3]=r,e[4]=n):n=e[4],n}function La(t){const e=E.c(24),{flow:s}=t,i=G();let r;e[0]!==i||e[1]!==s?(r=g=>i(Ie(s,{request:{method:g}})),e[0]=i,e[1]=s,e[2]=r):r=e[2];let n;e[3]!==s.request.method||e[4]!==r?(n=o.jsx(bt,{content:s.request.method,onEditDone:r,isValid:Oa,selectAllOnClick:!0}),e[3]=s.request.method,e[4]=r,e[5]=n):n=e[5];let l;e[6]!==s.request?(l=ct.pretty_url(s.request),e[6]=s.request,e[7]=l):l=e[7];let a;e[8]!==i||e[9]!==s?(a=g=>i(Ie(s,{request:{path:"",..._i(g)}})),e[8]=i,e[9]=s,e[10]=a):a=e[10];let d;e[11]!==l||e[12]!==a?(d=o.jsx(bt,{content:l,onEditDone:a,isValid:Pa}),e[11]=l,e[12]=a,e[13]=d):d=e[13];let u;e[14]!==i||e[15]!==s?(u=g=>i(Ie(s,{request:{http_version:g}})),e[14]=i,e[15]=s,e[16]=u):u=e[16];let h;e[17]!==s.request.http_version||e[18]!==u?(h=o.jsx(bt,{content:s.request.http_version,onEditDone:u,isValid:ji,selectAllOnClick:!0}),e[17]=s.request.http_version,e[18]=u,e[19]=h):h=e[19];let p;return e[20]!==n||e[21]!==d||e[22]!==h?(p=o.jsx("div",{className:"first-line request-line",children:o.jsxs("div",{children:[n," ",d," ",h]})}),e[20]=n,e[21]=d,e[22]=h,e[23]=p):p=e[23],p}function Pa(t){return!!_i(t)?.host}function Oa(t){return t.length>0}function Ma(t){const e=E.c(19),{flow:s}=t,i=G();let r;e[0]!==i||e[1]!==s?(r=p=>i(Ie(s,{response:{http_version:p}})),e[0]=i,e[1]=s,e[2]=r):r=e[2];let n;e[3]!==s.response.http_version||e[4]!==r?(n=o.jsx(bt,{content:s.response.http_version,onEditDone:r,isValid:ji,selectAllOnClick:!0}),e[3]=s.response.http_version,e[4]=r,e[5]=n):n=e[5];const l=s.response.status_code+"";let a;e[6]!==i||e[7]!==s?(a=p=>i(Ie(s,{response:{code:parseInt(p)}})),e[6]=i,e[7]=s,e[8]=a):a=e[8];let d;e[9]!==l||e[10]!==a?(d=o.jsx(bt,{content:l,onEditDone:a,isValid:qa,selectAllOnClick:!0}),e[9]=l,e[10]=a,e[11]=d):d=e[11];let u;e[12]!==i||e[13]!==s?(u=s.response.http_version!=="HTTP/2.0"&&o.jsxs(o.Fragment,{children:[" ",o.jsx(le,{content:s.response.reason,onEditDone:p=>i(Ie(s,{response:{msg:p}})),selectAllOnClick:!0})]}),e[12]=i,e[13]=s,e[14]=u):u=e[14];let h;return e[15]!==n||e[16]!==d||e[17]!==u?(h=o.jsxs("div",{className:"first-line response-line",children:[n," ",d,u]}),e[15]=n,e[16]=d,e[17]=u,e[18]=h):h=e[18],h}function qa(t){return/^\d+$/.test(t)}function Ha(t){const e=E.c(7),{flow:s,message:i}=t,r=G(),n=s.request===i?"request":"response";let l;e[0]!==r||e[1]!==s||e[2]!==n?(l=d=>r(Ie(s,{[n]:{headers:d}})),e[0]=r,e[1]=s,e[2]=n,e[3]=l):l=e[3];let a;return e[4]!==i.headers||e[5]!==l?(a=o.jsx(Rr,{className:"headers",data:i.headers,onChange:l}),e[4]=i.headers,e[5]=l,e[6]=a):a=e[6],a}function Va(t){const e=E.c(9),{flow:s,message:i}=t,r=G(),n=s.request===i?"request":"response";if(!!!je.get_first_header(i,/^trailer$/i))return null;let a,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("hr",{}),d=o.jsx("h5",{children:"HTTP Trailers"}),e[0]=a,e[1]=d):(a=e[0],d=e[1]);let u;e[2]!==r||e[3]!==s||e[4]!==n?(u=p=>r(Ie(s,{[n]:{trailers:p}})),e[2]=r,e[3]=s,e[4]=n,e[5]=u):u=e[5];let h;return e[6]!==i.trailers||e[7]!==u?(h=o.jsxs(o.Fragment,{children:[a,d,o.jsx(Rr,{className:"trailers",data:i.trailers,onChange:u})]}),e[6]=i.trailers,e[7]=u,e[8]=h):h=e[8],h}const Pr=I.memo(function(e){const s=E.c(20),{flow:i,message:r}=e,n=i.request===r?"request":"response",l=i.request===r?La:Ma;let a;s[0]!==l||s[1]!==i?(a=o.jsx(l,{flow:i}),s[0]=l,s[1]=i,s[2]=a):a=s[2];let d;s[3]!==i||s[4]!==r?(d=o.jsx(Ha,{flow:i,message:r}),s[3]=i,s[4]=r,s[5]=d):d=s[5];let u;s[6]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("hr",{}),s[6]=u):u=s[6];const h=i.id+n;let p;s[7]!==i||s[8]!==r||s[9]!==h?(p=o.jsx(Ta,{flow:i,message:r},h),s[7]=i,s[8]=r,s[9]=h,s[10]=p):p=s[10];let g;s[11]!==i||s[12]!==r?(g=o.jsx(Va,{flow:i,message:r}),s[11]=i,s[12]=r,s[13]=g):g=s[13];let _;return s[14]!==n||s[15]!==a||s[16]!==d||s[17]!==p||s[18]!==g?(_=o.jsxs("section",{className:n,children:[a,d,u,p,g]}),s[14]=n,s[15]=a,s[16]=d,s[17]=p,s[18]=g,s[19]=_):_=s[19],_});function Or(){const t=E.c(2),e=D(Ua);let s;return t[0]!==e?(s=o.jsx(Pr,{flow:e,message:e.request}),t[0]=e,t[1]=s):s=t[1],s}function Ua(t){return t.flows.selected[0]}Or.displayName="Request";function Mr(){const t=E.c(2),e=D(Ba);let s;return t[0]!==e?(s=o.jsx(Pr,{flow:e,message:e.response}),t[0]=e,t[1]=s):s=t[1],s}function Ba(t){return t.flows.selected[0]}Mr.displayName="Response";const Wa=t=>{const e=E.c(3),{message:s}=t,i=s.query?s.op_code:s.response_code,r=s.truncation?"(Truncated)":"";let n;return e[0]!==i||e[1]!==r?(n=o.jsxs("div",{children:[i," ",r]}),e[0]=i,e[1]=r,e[2]=n):n=e[2],n},Ka=t=>{const e=E.c(10),{message:s}=t,i=s.recursion_desired?"Recursive ":"";let r;e[0]!==i?(r=o.jsxs("h5",{children:[i,"Question"]}),e[0]=i,e[1]=r):r=e[1];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Name"}),o.jsx("th",{children:"Type"}),o.jsx("th",{children:"Class"})]})}),e[2]=n):n=e[2];let l;e[3]!==s.questions?(l=s.questions.map(Ya),e[3]=s.questions,e[4]=l):l=e[4];let a;e[5]!==l?(a=o.jsxs("table",{children:[n,o.jsx("tbody",{children:l})]}),e[5]=l,e[6]=a):a=e[6];let d;return e[7]!==r||e[8]!==a?(d=o.jsxs(o.Fragment,{children:[r,a]}),e[7]=r,e[8]=a,e[9]=d):d=e[9],d},ls=t=>{const e=E.c(7),{name:s,values:i}=t;let r;e[0]!==s?(r=o.jsx("h5",{children:s}),e[0]=s,e[1]=r):r=e[1];let n;e[2]!==i?(n=i.length>0?o.jsxs("table",{children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Name"}),o.jsx("th",{children:"Type"}),o.jsx("th",{children:"Class"}),o.jsx("th",{children:"TTL"}),o.jsx("th",{children:"Data"})]})}),o.jsx("tbody",{children:i.map(Ja)})]}):"—",e[2]=i,e[3]=n):n=e[3];let l;return e[4]!==r||e[5]!==n?(l=o.jsxs(o.Fragment,{children:[r,n]}),e[4]=r,e[5]=n,e[6]=l):l=e[6],l},qr=t=>{const e=E.c(24),{type:s,message:i}=t,r="dns-"+s,n=`first-line ${s}-line`;let l;e[0]!==i?(l=o.jsx(Wa,{message:i}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==l?(a=o.jsx("div",{className:n,children:l}),e[2]=n,e[3]=l,e[4]=a):a=e[4];let d;e[5]!==i?(d=o.jsx(Ka,{message:i}),e[5]=i,e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("hr",{}),e[7]=u):u=e[7];const h=`${i.authoritative_answer?"Authoritative ":""}${i.recursion_available?"Recursive ":""}Answer`;let p;e[8]!==i.answers||e[9]!==h?(p=o.jsx(ls,{name:h,values:i.answers}),e[8]=i.answers,e[9]=h,e[10]=p):p=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("hr",{}),e[11]=g):g=e[11];let _;e[12]!==i.authorities?(_=o.jsx(ls,{name:"Authority",values:i.authorities}),e[12]=i.authorities,e[13]=_):_=e[13];let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx("hr",{}),e[14]=j):j=e[14];let y;e[15]!==i.additionals?(y=o.jsx(ls,{name:"Additional",values:i.additionals}),e[15]=i.additionals,e[16]=y):y=e[16];let w;return e[17]!==r||e[18]!==_||e[19]!==y||e[20]!==a||e[21]!==d||e[22]!==p?(w=o.jsxs("section",{className:r,children:[a,d,u,p,g,_,j,y]}),e[17]=r,e[18]=_,e[19]=y,e[20]=a,e[21]=d,e[22]=p,e[23]=w):w=e[23],w};function Hr(){const t=E.c(2),e=D(za);let s;return t[0]!==e.request?(s=o.jsx(qr,{type:"request",message:e.request}),t[0]=e.request,t[1]=s):s=t[1],s}function za(t){return t.flows.selected[0]}Hr.displayName="Request";function Vr(){const t=E.c(2),e=D(Ga);let s;return t[0]!==e.response?(s=o.jsx(qr,{type:"response",message:e.response}),t[0]=e.response,t[1]=s):s=t[1],s}function Ga(t){return t.flows.selected[0]}Vr.displayName="Response";function Ya(t,e){return o.jsxs("tr",{children:[o.jsx("td",{children:t.name}),o.jsx("td",{children:t.type}),o.jsx("td",{children:t.class})]},e)}function Ja(t,e){return o.jsxs("tr",{children:[o.jsx("td",{children:t.name}),o.jsx("td",{children:t.type}),o.jsx("td",{children:t.class}),o.jsx("td",{children:t.ttl}),o.jsx("td",{children:JSON.stringify(t.data).replace(/^"|"$/g,"")})]},e)}function Mt(t,e){return e?(e=[e[0],e[1]],e[0].includes(":")&&(e[0]=`[${e[0]}]`),o.jsxs("tr",{children:[o.jsxs("td",{children:[t,":"]}),o.jsx("td",{children:e.join(":")})]})):o.jsx(o.Fragment,{})}function si(t){const e=E.c(26),{conn:s}=t;let i;if("address"in s){let u;e[0]!==s.address?(u=Mt("Address",s.address),e[0]=s.address,e[1]=u):u=e[1];let h;e[2]!==s.peername?(h=Mt("Resolved address",s.peername),e[2]=s.peername,e[3]=h):h=e[3];let p;e[4]!==s.sockname?(p=Mt("Source address",s.sockname),e[4]=s.sockname,e[5]=p):p=e[5];let g;e[6]!==u||e[7]!==h||e[8]!==p?(g=o.jsxs(o.Fragment,{children:[u,h,p]}),e[6]=u,e[7]=h,e[8]=p,e[9]=g):g=e[9],i=g}else{let u;e[10]!==s.peername?(u=Mt("Address",s.peername),e[10]=s.peername,e[11]=u):u=e[11],i=u}let r;e[12]!==s.sni?(r=s.sni?o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("abbr",{title:"TLS Server Name Indication",children:"SNI"}),":"]}),o.jsx("td",{children:s.sni})]}):null,e[12]=s.sni,e[13]=r):r=e[13];let n;e[14]!==s.alpn?(n=s.alpn?o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("abbr",{title:"ALPN protocol negotiated",children:"ALPN"}),":"]}),o.jsx("td",{children:s.alpn})]}):null,e[14]=s.alpn,e[15]=n):n=e[15];let l;e[16]!==s.tls_version?(l=s.tls_version?o.jsxs("tr",{children:[o.jsx("td",{children:"TLS Version:"}),o.jsx("td",{children:s.tls_version})]}):null,e[16]=s.tls_version,e[17]=l):l=e[17];let a;e[18]!==s.cipher?(a=s.cipher?o.jsxs("tr",{children:[o.jsx("td",{children:"TLS Cipher:"}),o.jsx("td",{children:s.cipher})]}):null,e[18]=s.cipher,e[19]=a):a=e[19];let d;return e[20]!==i||e[21]!==r||e[22]!==n||e[23]!==l||e[24]!==a?(d=o.jsx("table",{className:"connection-table",children:o.jsxs("tbody",{children:[i,r,n,l,a]})}),e[20]=i,e[21]=r,e[22]=n,e[23]=l,e[24]=a,e[25]=d):d=e[25],d}function ni(t){return o.jsx("dl",{className:"cert-attributes",children:t.map(([e,s])=>o.jsxs(I.Fragment,{children:[o.jsx("dt",{children:e}),o.jsx("dd",{children:s})]},e))})}function Qa(t){const e=E.c(46),{flow:s}=t,i=s.server_conn?.cert;if(!i){let W;return e[0]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(o.Fragment,{}),e[0]=W):W=e[0],W}let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("h4",{children:"Server Certificate"},"name"),e[1]=r):r=e[1];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("td",{children:"Type"}),e[2]=n):n=e[2];let l;e[3]!==i.keyinfo[0]||e[4]!==i.keyinfo[1]?(l=o.jsxs("tr",{children:[n,o.jsxs("td",{children:[i.keyinfo[0],", ",i.keyinfo[1]," bits"]})]}),e[3]=i.keyinfo[0],e[4]=i.keyinfo[1],e[5]=l):l=e[5];let a;e[6]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("td",{children:"SHA256 digest"}),e[6]=a):a=e[6];let d;e[7]!==i.sha256?(d=o.jsxs("tr",{children:[a,o.jsx("td",{children:i.sha256})]}),e[7]=i.sha256,e[8]=d):d=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("td",{children:"Valid from"}),e[9]=u):u=e[9];let h;e[10]!==i.notbefore?(h=at(i.notbefore,{includeMilliseconds:!1}),e[10]=i.notbefore,e[11]=h):h=e[11];let p;e[12]!==h?(p=o.jsxs("tr",{children:[u,o.jsx("td",{children:h})]}),e[12]=h,e[13]=p):p=e[13];let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("td",{children:"Valid to"}),e[14]=g):g=e[14];let _;e[15]!==i.notafter?(_=at(i.notafter,{includeMilliseconds:!1}),e[15]=i.notafter,e[16]=_):_=e[16];let j;e[17]!==_?(j=o.jsxs("tr",{children:[g,o.jsx("td",{children:_})]}),e[17]=_,e[18]=j):j=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("td",{children:"Subject Alternative Names"}),e[19]=y):y=e[19];let w;e[20]!==i.altnames?(w=i.altnames.join(", "),e[20]=i.altnames,e[21]=w):w=e[21];let $;e[22]!==w?($=o.jsxs("tr",{children:[y,o.jsx("td",{children:w})]}),e[22]=w,e[23]=$):$=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx("td",{children:"Subject"}),e[24]=N):N=e[24];let k;e[25]!==i.subject?(k=ni(i.subject),e[25]=i.subject,e[26]=k):k=e[26];let T;e[27]!==k?(T=o.jsxs("tr",{children:[N,o.jsx("td",{children:k})]}),e[27]=k,e[28]=T):T=e[28];let P;e[29]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx("td",{children:"Issuer"}),e[29]=P):P=e[29];let L;e[30]!==i.issuer?(L=ni(i.issuer),e[30]=i.issuer,e[31]=L):L=e[31];let O;e[32]!==L?(O=o.jsxs("tr",{children:[P,o.jsx("td",{children:L})]}),e[32]=L,e[33]=O):O=e[33];let M;e[34]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx("td",{children:"Serial"}),e[34]=M):M=e[34];let U;e[35]!==i.serial?(U=o.jsxs("tr",{children:[M,o.jsx("td",{children:i.serial})]}),e[35]=i.serial,e[36]=U):U=e[36];let V;return e[37]!==j||e[38]!==$||e[39]!==T||e[40]!==O||e[41]!==U||e[42]!==l||e[43]!==d||e[44]!==p?(V=o.jsxs(o.Fragment,{children:[r,o.jsx("table",{className:"certificate-table",children:o.jsxs("tbody",{children:[l,d,p,j,$,T,O,U]})})]}),e[37]=j,e[38]=$,e[39]=T,e[40]=O,e[41]=U,e[42]=l,e[43]=d,e[44]=p,e[45]=V):V=e[45],V}function Ur(t){const e=E.c(11),{flow:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("h4",{children:"Client Connection"}),e[0]=i):i=e[0];let r;e[1]!==s.client_conn?(r=o.jsx(si,{conn:s.client_conn}),e[1]=s.client_conn,e[2]=r):r=e[2];let n;e[3]!==s.server_conn?(n=s.server_conn?.address&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{children:"Server Connection"}),o.jsx(si,{conn:s.server_conn})]}),e[3]=s.server_conn,e[4]=n):n=e[4];let l;e[5]!==s?(l=o.jsx(Qa,{flow:s}),e[5]=s,e[6]=l):l=e[6];let a;return e[7]!==r||e[8]!==n||e[9]!==l?(a=o.jsxs("section",{className:"detail",children:[i,r,n,l]}),e[7]=r,e[8]=n,e[9]=l,e[10]=a):a=e[10],a}Ur.displayName="Connection";function Br(t){const e=E.c(7),{flow:s}=t,i=s.error.msg;let r;e[0]!==s.error.timestamp?(r=at(s.error.timestamp),e[0]=s.error.timestamp,e[1]=r):r=e[1];let n;e[2]!==r?(n=o.jsx("div",{children:o.jsx("small",{children:r})}),e[2]=r,e[3]=n):n=e[3];let l;return e[4]!==s.error.msg||e[5]!==n?(l=o.jsx("section",{className:"error",children:o.jsxs("div",{className:"alert alert-warning",children:[i,n]})}),e[4]=s.error.msg,e[5]=n,e[6]=l):l=e[6],l}Br.displayName="Error";function Xa(t){const e=E.c(4),{t:s,deltaTo:i,title:r}=t;let n;return e[0]!==i||e[1]!==s||e[2]!==r?(n=s?o.jsxs("tr",{children:[o.jsxs("td",{children:[r,":"]}),o.jsxs("td",{children:[at(s),i&&o.jsxs("span",{className:"text-muted",children:["(",mi(1e3*(s-i)),")"]})]})]}):o.jsx("tr",{}),e[0]=i,e[1]=s,e[2]=r,e[3]=n):n=e[3],n}function Wr(t){const e=E.c(26),{flow:s}=t;let i;s.type==="http"?i=s.request.timestamp_start:i=s.client_conn.timestamp_start;const r=s.server_conn?.timestamp_start;let n,l,a,d;if(e[0]!==s.client_conn.timestamp_end||e[1]!==s.client_conn.timestamp_start||e[2]!==s.client_conn.timestamp_tls_setup||e[3]!==s.request||e[4]!==s.response?.timestamp_end||e[5]!==s.response?.timestamp_start||e[6]!==s.server_conn?.timestamp_end||e[7]!==s.server_conn?.timestamp_tcp_setup||e[8]!==s.server_conn?.timestamp_tls_setup||e[9]!==s.type||e[10]!==i||e[11]!==r){const g=[{title:"Server conn. initiated",t:r,deltaTo:i},{title:"Server conn. TCP handshake",t:s.server_conn?.timestamp_tcp_setup,deltaTo:i},{title:"Server conn. TLS handshake",t:s.server_conn?.timestamp_tls_setup,deltaTo:i},{title:"Server conn. closed",t:s.server_conn?.timestamp_end,deltaTo:i},{title:"Client conn. established",t:s.client_conn.timestamp_start,deltaTo:s.type==="http"?i:void 0},{title:"Client conn. TLS handshake",t:s.client_conn.timestamp_tls_setup,deltaTo:i},{title:"Client conn. closed",t:s.client_conn.timestamp_end,deltaTo:i}];s.type==="http"&&g.push({title:"First request byte",t:s.request.timestamp_start},{title:"Request complete",t:s.request.timestamp_end,deltaTo:i},{title:"First response byte",t:s.response?.timestamp_start,deltaTo:i},{title:"Response complete",t:s.response?.timestamp_end,deltaTo:i}),a="timing",e[16]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("h4",{children:"Timing"}),e[16]=d):d=e[16],l="timing-table",n=g.filter(td).sort(ed).map(Za),e[0]=s.client_conn.timestamp_end,e[1]=s.client_conn.timestamp_start,e[2]=s.client_conn.timestamp_tls_setup,e[3]=s.request,e[4]=s.response?.timestamp_end,e[5]=s.response?.timestamp_start,e[6]=s.server_conn?.timestamp_end,e[7]=s.server_conn?.timestamp_tcp_setup,e[8]=s.server_conn?.timestamp_tls_setup,e[9]=s.type,e[10]=i,e[11]=r,e[12]=n,e[13]=l,e[14]=a,e[15]=d}else n=e[12],l=e[13],a=e[14],d=e[15];let u;e[17]!==n?(u=o.jsx("tbody",{children:n}),e[17]=n,e[18]=u):u=e[18];let h;e[19]!==l||e[20]!==u?(h=o.jsx("table",{className:l,children:u}),e[19]=l,e[20]=u,e[21]=h):h=e[21];let p;return e[22]!==a||e[23]!==d||e[24]!==h?(p=o.jsxs("section",{className:a,children:[d,h]}),e[22]=a,e[23]=d,e[24]=h,e[25]=p):p=e[25],p}function Za(t){const{title:e,t:s,deltaTo:i}=t;return o.jsx(Xa,{title:e,t:s,deltaTo:i},e)}function ed(t,e){return t.t-e.t}function td(t){return!!t.t}Wr.displayName="Timing";function ks({flow:t,messages_meta:e}){const s=G(),i=D(u=>u.ui.flow.contentViewFor[t.id+"messages"]||"Auto"),[r,n]=I.useState(D(u=>u.options.content_view_lines_cutoff)),l=I.useCallback(()=>n(Math.max(1024,r*2)),[r]),a=Dr(t,"messages",i,r+1,t.id+e.count)??[];let d=r;return o.jsxs("div",{className:"contentview",children:[o.jsxs("div",{className:"controls",children:[o.jsxs("h5",{children:[e.count," Messages"]}),o.jsx(Lr,{value:i,onChange:u=>s(pi({messageId:t.id+"messages",contentView:u}))})]}),a.map((u,h)=>{const p=`fa fa-fw fa-arrow-${u.from_client?"right text-primary":"left text-danger"}`,g=o.jsxs("div",{children:[o.jsxs("small",{children:[o.jsx("i",{className:p}),o.jsx("span",{className:"pull-right",children:u.timestamp&&at(u.timestamp)})]}),o.jsx(Ir,{content:u.text,maxLines:d,showMore:l})]},h);return d-=u.text.split(`
-`).length,g})]})}function Kr(t){const e=E.c(8),{flow:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("h4",{children:"WebSocket"}),e[0]=i):i=e[0];let r;e[1]!==s?(r=o.jsx(ks,{flow:s,messages_meta:s.websocket.messages_meta}),e[1]=s,e[2]=r):r=e[2];let n;e[3]!==s.websocket?(n=o.jsx(sd,{websocket:s.websocket}),e[3]=s.websocket,e[4]=n):n=e[4];let l;return e[5]!==r||e[6]!==n?(l=o.jsxs("section",{className:"websocket",children:[i,r,n]}),e[5]=r,e[6]=n,e[7]=l):l=e[7],l}Kr.displayName="WebSocket";function sd(t){const e=E.c(10),{websocket:s}=t;if(!s.timestamp_end)return null;const i=s.close_reason?`(${s.close_reason})`:"";let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("i",{className:"fa fa-fw fa-window-close text-muted"}),e[0]=r):r=e[0];const n=s.closed_by_client?"client":"server",l=s.close_code;let a;e[1]!==s.timestamp_end?(a=at(s.timestamp_end),e[1]=s.timestamp_end,e[2]=a):a=e[2];let d;e[3]!==a?(d=o.jsx("small",{className:"pull-right",children:a}),e[3]=a,e[4]=d):d=e[4];let u;return e[5]!==i||e[6]!==n||e[7]!==d||e[8]!==s.close_code?(u=o.jsxs("div",{children:[r,"  Closed by ",n," ","with code ",l," ",i,".",d]}),e[5]=i,e[6]=n,e[7]=d,e[8]=s.close_code,e[9]=u):u=e[9],u}function zr(t){const e=E.c(7),{flow:s}=t,i=G();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("h4",{children:"Comment"}),e[0]=r):r=e[0];let n;e[1]!==i||e[2]!==s?(n=a=>{i(Ie(s,{comment:a}))},e[1]=i,e[2]=s,e[3]=n):n=e[3];let l;return e[4]!==s.comment||e[5]!==n?(l=o.jsxs("section",{className:"timing",children:[r,o.jsx(le,{className:"kv-value",content:s.comment,onEditDone:n,placeholder:"empty",selectAllOnClick:!0})]}),e[4]=s.comment,e[5]=n,e[6]=l):l=e[6],l}zr.displayName="Comment";function Gr(t){const e=E.c(2),{flow:s}=t;let i;return e[0]!==s?(i=o.jsx("section",{className:"tcp",children:o.jsx(ks,{flow:s,messages_meta:s.messages_meta})}),e[0]=s,e[1]=i):i=e[1],i}Gr.displayName="Stream Data";function Yr(t){const e=E.c(2),{flow:s}=t;let i;return e[0]!==s?(i=o.jsx("section",{className:"udp",children:o.jsx(ks,{flow:s,messages_meta:s.messages_meta})}),e[0]=s,e[1]=i):i=e[1],i}Yr.displayName="Datagrams";const ii={request:Or,response:Mr,error:Br,connection:Ur,timing:Wr,websocket:Kr,tcpmessages:Gr,udpmessages:Yr,dnsrequest:Hr,dnsresponse:Vr,comment:zr};function vs(t){let e;switch(t.type){case"http":e=["request","response","websocket"].filter(s=>t[s]);break;case"tcp":e=["tcpmessages"];break;case"udp":e=["udpmessages"];break;case"dns":e=["request","response"].filter(s=>t[s]).map(s=>"dns"+s);break}return t.error&&e.push("error"),e.push("connection"),e.push("timing"),e.push("comment"),e}function nd(){const t=E.c(15),e=G(),s=D(rd);let i=D(id);if(s==null){let y;return t[0]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(o.Fragment,{}),t[0]=y):y=t[0],y}const r=vs(s);r.indexOf(i)<0&&(i==="response"&&s.error?i="error":i==="error"&&"response"in s?i="response":i=r[0]);const n=ii[i],l="flow-detail",a="nav-tabs nav-tabs-sm";let d;t[1]!==e?(d=()=>e(He([])),t[1]=e,t[2]=d):d=t[2];let u;t[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("i",{className:"fa fa-times-circle"}),t[3]=u):u=t[3];let h;t[4]!==d?(h=o.jsx("button",{"data-testid":"close-button-id",className:"close-button",onClick:d,children:u}),t[4]=d,t[5]=h):h=t[5];const p=r.map(y=>o.jsx("a",{href:"#",className:_e({active:i===y}),onClick:w=>{w.preventDefault(),e(Ut(y))},children:ii[y].displayName},y));let g;t[6]!==h||t[7]!==p?(g=o.jsxs("nav",{className:a,children:[h,p]}),t[6]=h,t[7]=p,t[8]=g):g=t[8];let _;t[9]!==n||t[10]!==s?(_=o.jsx(n,{flow:s}),t[9]=n,t[10]=s,t[11]=_):_=t[11];let j;return t[12]!==g||t[13]!==_?(j=o.jsxs("div",{className:l,children:[g,_]}),t[12]=g,t[13]=_,t[14]=j):j=t[14],j}function id(t){return t.ui.flow.tab}function rd(t){return t.flows.selected[0]}function od(t){if(t.ctrlKey||t.metaKey)return()=>{};const e=t.key;return t.preventDefault(),(s,i)=>{const{flows:r}=i(),n=r.selected,l=n[0];switch(e){case"k":case"ArrowUp":s(ht(r,-1));break;case"j":case"ArrowDown":s(ht(r,1));break;case" ":case"PageDown":s(ht(r,10));break;case"PageUp":s(ht(r,-10));break;case"End":s(ht(r,1e10));break;case"Home":s(ht(r,-1e10));break;case"Escape":i().ui.modal.activeModal?s(Wi()):s(He([]));break;case"ArrowLeft":{if(!l)break;const a=vs(l),d=i().ui.flow.tab,u=a[(Math.max(0,a.indexOf(d))-1+a.length)%a.length];s(Ut(u));break}case"Tab":case"ArrowRight":{if(!l)break;const a=vs(l),d=i().ui.flow.tab,u=a[(Math.max(0,a.indexOf(d))+1)%a.length];s(Ut(u));break}case"Delete":case"d":{s(Ii(n));break}case"n":{Bt("view.flows.create","get","https://example.com/");break}case"D":{s(Li(n));break}case"a":{s(ys(n));break}case"A":{s(Di());break}case"r":{s(ws(n));break}case"v":{s(Pi(n));break}case"x":{s(Fi(n));break}case"X":{s(Zl());break}case"z":{s(Oi());break}default:return}}}class ld extends I.Component{static defaultProps={axis:"x"};node=Ee.createRef();constructor(e,s){super(e,s),this.state={applied:!1,startPos:0,dragPointer:.1},this.onLostPointerCapture=this.onLostPointerCapture.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this)}onPointerDown(e){this.state.dragPointer===.1&&(e.target.setPointerCapture(e.pointerId),this.setState({startPos:this.props.axis==="x"?e.pageX:e.pageY,dragPointer:e.pointerId}))}onLostPointerCapture(e){if(this.state.dragPointer!==e.pointerId)return;const s=this.node.current,i=s.previousElementSibling,r=s.nextElementSibling;s.style.transform="",i.style.flex=`0 0 ${Math.max(0,(this.props.axis==="x"?i.offsetWidth+e.pageX:i.offsetHeight+e.pageY)-this.state.startPos)}px`,r.style.flex="1 1 auto",this.setState({applied:!0,dragPointer:.1}),this.onResize()}onPointerMove(e){this.state.dragPointer===e.pointerId&&(this.node.current.style.transform=this.props.axis==="x"?`translateX(${e.pageX-this.state.startPos}px)`:`translateY(${e.pageY-this.state.startPos}px)`)}onResize(){window.setTimeout(()=>window.dispatchEvent(new CustomEvent("resize")),1)}reset(e){this.state.applied&&(this.node.current?.previousElementSibling instanceof HTMLElement&&(this.node.current.previousElementSibling.style.flex=""),this.node.current?.nextElementSibling instanceof HTMLElement&&(this.node.current.nextElementSibling.style.flex=""),e||this.setState({applied:!1}),this.onResize())}componentWillUnmount(){this.reset(!0)}render(){return o.jsx("div",{ref:this.node,className:_e("splitter",this.props.axis==="x"?"splitter-x":"splitter-y"),children:o.jsx("div",{onLostPointerCapture:this.onLostPointerCapture,onPointerDown:this.onPointerDown,onPointerMove:this.onPointerMove})})}}const Es=t=>{const e=t.current;return e===null||e.scrollTop===0?!1:Math.ceil(e.scrollTop)+e.clientHeight>=e.scrollHeight},Jr=t=>{t.current&&!Es(t)&&(t.current.scrollTop=t.current.scrollHeight)};function kt(t=void 0){if(!t)return{start:0,end:0,paddingTop:0,paddingBottom:0};const{itemCount:e,rowHeight:s,viewportTop:i,viewportHeight:r,itemHeights:n}=t,l=i+r;let a=0,d=0,u=0,h=0;if(n){let p=0;for(let g=0;g<e;g++){const _=n[g]||s;p<=i&&g%2===0&&(u=p,a=g),p<=l?d=g+1:h+=_,p+=_}if(i>0&&p<i+r)return kt({itemCount:e,rowHeight:s,viewportTop:p-r,viewportHeight:r,itemHeights:n})}else{const p=Math.min(i,Math.max(0,e*s-r));a=Math.max(0,Math.floor(p/s)-1)&-2,d=Math.min(e,a+Math.ceil(r/s)+2),u=a*s,h=(e-d)*s}return{start:a,end:d,paddingTop:u,paddingBottom:h}}const Ts=({flow:t})=>o.jsx("td",{className:_e("col-tls",t.client_conn.tls_established?"col-tls-https":"col-tls-http")});Ts.headerName="";const Rs=({flow:t})=>{const e=D(s=>s.flows._listIndex.get(t.id));return o.jsx("td",{className:"col-index",children:e+1})};Rs.headerName="#";const As=({flow:t})=>o.jsx("td",{className:"col-icon",children:o.jsx("div",{className:_e("resource-icon",Si(t))})});As.headerName="";const Ds=({flow:t})=>{let e;return t.error&&(t.error.msg==="Connection killed."?e=o.jsx("i",{className:"fa fa-fw fa-times pull-right"}):e=o.jsx("i",{className:"fa fa-fw fa-exclamation pull-right"})),o.jsxs("td",{className:"col-path",children:[t.is_replay==="request"&&o.jsx("i",{className:"fa fa-fw fa-repeat pull-right"}),t.intercepted&&o.jsx("i",{className:"fa fa-fw fa-pause pull-right"}),e,o.jsx("span",{className:"marker pull-right",children:t.marked}),$i(t)]})};Ds.headerName="Path";const Fs=({flow:t})=>o.jsx("td",{className:"col-method",children:Ni(t)});Fs.headerName="Method";const Is=({flow:t})=>o.jsx("td",{className:"col-http-version",children:ki(t)});Is.headerName="Version";const Ls=({flow:t})=>{let e="darkred";return t.type!=="http"&&t.type!="dns"||!t.response?o.jsx("td",{className:"col-status"}):(100<=t.response.status_code&&t.response.status_code<200?e="green":200<=t.response.status_code&&t.response.status_code<300?e="darkgreen":300<=t.response.status_code&&t.response.status_code<400?e="lightblue":(400<=t.response.status_code&&t.response.status_code<500||500<=t.response.status_code&&t.response.status_code<600)&&(e="red"),o.jsx("td",{className:"col-status",style:{color:e},children:Ci(t)}))};Ls.headerName="Status";const Ps=({flow:t})=>o.jsx("td",{className:"col-size",children:hi(wi(t))});Ps.headerName="Size";const Os=({flow:t})=>{const e=Wt(t),s=yi(t);return o.jsx("td",{className:"col-time",children:e&&s?mi(1e3*(s-e)):"..."})};Os.headerName="Time";const Ms=({flow:t})=>{const e=Wt(t);return o.jsx("td",{className:"col-timestamp",children:e?at(e):"..."})};Ms.headerName="Start time";const Qt=({flow:t})=>{const e=G();let s=null;return t.intercepted?s=o.jsx("a",{href:"#",className:"quickaction",onClick:()=>e(ys([t])),children:o.jsx("i",{className:"fa fa-fw fa-play text-success"})}):xs(t)&&(s=o.jsx("a",{href:"#",className:"quickaction",onClick:()=>e(ws([t])),children:o.jsx("i",{className:"fa fa-fw fa-repeat text-primary"})})),o.jsx("td",{className:"col-quickactions",children:s?o.jsx("div",{children:s}):o.jsx(o.Fragment,{})})};Qt.headerName="";const qs=({flow:t})=>{const e=t.comment;return o.jsx("td",{className:"col-comment",children:e})};qs.headerName="Comment";const Qr={icon:As,index:Rs,method:Fs,version:Is,path:Ds,quickactions:Qt,size:Ps,status:Ls,time:Os,timestamp:Ms,tls:Ts,comment:qs},cd=Object.freeze(Object.defineProperty({__proto__:null,comment:qs,default:Qr,icon:As,index:Rs,method:Fs,path:Ds,quickactions:Qt,size:Ps,status:Ls,time:Os,timestamp:Ms,tls:Ts,version:Is},Symbol.toStringTag,{value:"Module"})),ad=I.memo(function(){const e=E.c(13),s=G(),i=D(dd),r=D(ud),n=D(fd),l=i?"sort-desc":"sort-asc";let a;if(e[0]!==s||e[1]!==n||e[2]!==r||e[3]!==i||e[4]!==l){const u=n.filter(zl).concat("quickactions");let h;e[6]!==s||e[7]!==r||e[8]!==i||e[9]!==l?(h=p=>o.jsx("th",{className:_e(`col-${p}`,r===p&&l),onClick:()=>s(Ui({column:p===r&&i?void 0:p,desc:p!==r?!1:!i})),children:Qr[p].headerName},p),e[6]=s,e[7]=r,e[8]=i,e[9]=l,e[10]=h):h=e[10],a=u.map(h),e[0]=s,e[1]=n,e[2]=r,e[3]=i,e[4]=l,e[5]=a}else a=e[5];let d;return e[11]!==a?(d=o.jsx("tr",{children:a}),e[11]=a,e[12]=d):d=e[12],d});function dd(t){return t.flows.sort.desc}function ud(t){return t.flows.sort.column}function fd(t){return t.options.web_columns}const pd=Ee.memo(function({flow:e,selected:s,highlighted:i}){const r=G(),n=D(u=>u.options.web_columns),l=_e({selected:s,highlighted:i,intercepted:e.intercepted,"has-request":e.type==="http"&&e.request,"has-response":e.type==="http"&&e.response}),a=I.useCallback(u=>{let h=u.target;for(;h.parentNode;){if(h.classList.contains("col-quickactions"))return;h=h.parentNode}u.metaKey||u.ctrlKey?r(ic(e)):u.shiftKey?(window.getSelection()?.empty(),r(rc(e))):r(He([e]))},[e]),d=n.map(u=>cd[u]).filter(u=>u).concat(Qt);return o.jsx("tr",{className:l,onClick:a,children:d.map(u=>o.jsx(u,{flow:e},u.name))})});class hd extends I.Component{static defaultProps={rowHeight:32};viewport=I.createRef();head=I.createRef();constructor(e,s){super(e,s),this.state={vScroll:kt(),viewportTop:0},this.onViewportUpdate=this.onViewportUpdate.bind(this)}componentDidMount(){window.addEventListener("resize",this.onViewportUpdate),this.onViewportUpdate()}componentWillUnmount(){window.removeEventListener("resize",this.onViewportUpdate)}getSnapshotBeforeUpdate(){return Es(this.viewport)}componentDidUpdate(e,s,i){i&&Jr(this.viewport),this.onViewportUpdate();const{onlySelectedId:r}=this.props;if(r&&r!==e.onlySelectedId){const{rowHeight:l,firstSelectedIndex:a}=this.props,d=this.viewport.current,u=this.head.current,h=u?u.offsetHeight:0,p=a*l+h,g=p+l,_=d.scrollTop,j=d.offsetHeight;p-h<_?d.scrollTop=p-h:g>_+j&&(d.scrollTop=g-j),this.onViewportUpdate()}}onViewportUpdate(){const e=this.viewport.current,s=e.scrollTop||0,i=kt({viewportTop:s,viewportHeight:e.offsetHeight||0,itemCount:this.props.flowView.length,rowHeight:this.props.rowHeight});if(this.state.viewportTop!==s||!Kt(this.state.vScroll,i)){const r=Math.min(s,i.end*this.props.rowHeight);this.setState({vScroll:i,viewportTop:r})}}render(){const{vScroll:e,viewportTop:s}=this.state,{flowView:i,selectedIds:r,highlightedIds:n}=this.props;return o.jsx("div",{className:"flow-table",onScroll:this.onViewportUpdate,ref:this.viewport,children:o.jsxs("table",{children:[o.jsx("thead",{ref:this.head,style:{transform:`translateY(${s}px)`},children:o.jsx(ad,{})}),o.jsxs("tbody",{children:[o.jsx("tr",{style:{height:e.paddingTop}}),i.slice(e.start,e.end).map(l=>o.jsx(pd,{flow:l,selected:r.has(l.id),highlighted:n.has(l.id)},l.id)),o.jsx("tr",{style:{height:e.paddingBottom}})]})]})})}}const md=zt(t=>({flowView:t.flows.view,highlightedIds:t.flows.highlightedIds,selectedIds:t.flows.selectedIds,onlySelectedId:t.flows.selected.length===1&&t.flows.selected[0].id,firstSelectedIndex:t.flows._viewIndex.get(t.flows.selected[0]?.id)}))(hd);function gd(){const t=E.c(3);let e,s;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={padding:"1em 2em"},s=o.jsx("h3",{children:"mitmproxy is running."}),t[0]=e,t[1]=s):(e=t[0],s=t[1]);let i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("div",{style:e,children:[s,o.jsxs("p",{children:["No flows have been recorded yet.",o.jsx("br",{}),"To start capturing traffic, please configure your settings in the Capture tab."]})]}),t[2]=i):i=t[2],i}function vd(t){const e=E.c(20);let{description:s,listen_addrs:i,is_running:r,wireguard_conf:n,type:l}=t;const a=I.useRef(null);let d,u;e[0]!==n?(d=()=>{n&&a.current&&Ll.toCanvas(a.current,n,{margin:0,scale:3})},u=[n],e[0]=n,e[1]=d,e[2]=u):(d=e[1],u=e[2]),I.useEffect(d,u);let h;const p=i.length===1||i.length===2&&i[0][1]===i[1][1],g=i.every(xd);if(p&&g){let y;e[3]!==i[0][1]?(y=Hn(["*",i[0][1]]),e[3]=i[0][1],e[4]=y):y=e[4],h=y}else{let y;e[5]!==i?(y=i.map(Hn).join(" and "),e[5]=i,e[6]=y):y=e[6],h=y}s=s[0].toUpperCase()+s.substr(1);let _;if(r){let y;e[9]!==s||e[10]!==h||e[11]!==l?(y=l==="local"?o.jsxs("div",{className:"text-success",children:[s," is active."]}):o.jsxs("div",{className:"text-success",children:[s," listening at ",h,"."]}),e[9]=s,e[10]=h,e[11]=l,e[12]=y):y=e[12];let w;e[13]!==n?(w=n&&o.jsxs("div",{className:"wireguard-config",children:[o.jsx("pre",{children:n}),o.jsx("canvas",{ref:a})]}),e[13]=n,e[14]=w):w=e[14];let $;e[15]!==y||e[16]!==w?($=o.jsxs(o.Fragment,{children:[y,w]}),e[15]=y,e[16]=w,e[17]=$):$=e[17],_=$}else{let y;e[7]!==s?(y=o.jsx(o.Fragment,{children:o.jsxs("div",{className:"text-warning",children:[s," starting..."]})}),e[7]=s,e[8]=y):y=e[8],_=y}let j;return e[18]!==_?(j=o.jsx("div",{children:_}),e[18]=_,e[19]=j):j=e[19],j}function xd(t){return["::","0.0.0.0"].includes(t[0])}function et(t){const e=E.c(5),{error:s,backendState:i}=t;let r;e[0]!==i||e[1]!==s?(r=s?o.jsx("div",{className:"text-danger",children:s}):i&&o.jsx(vd,{...i}),e[0]=i,e[1]=s,e[2]=r):r=e[2];let n;return e[3]!==r?(n=o.jsx("div",{className:"mode-status",children:r}),e[3]=r,e[4]=n):n=e[4],n}function tt(t){const e=E.c(13),{value:s,onChange:i,children:r,label:n}=t,l=I.useId(),a=`mode-checkbox-${l}`,d=`mode-checkbox-${l}`;let u;e[0]!==i||e[1]!==a||e[2]!==d||e[3]!==s?(u=o.jsx("input",{type:"checkbox",name:a,id:d,checked:s,onChange:i}),e[0]=i,e[1]=a,e[2]=d,e[3]=s,e[4]=u):u=e[4];const h=`mode-checkbox-${l}`;let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p={marginBottom:0,fontWeight:"normal"},e[5]=p):p=e[5];let g;e[6]!==n||e[7]!==h?(g=o.jsx("label",{htmlFor:h,style:p,children:n}),e[6]=n,e[7]=h,e[8]=g):g=e[8];let _;return e[9]!==r||e[10]!==u||e[11]!==g?(_=o.jsxs("div",{className:"mode-entry",children:[u,g,r]}),e[9]=r,e[10]=u,e[11]=g,e[12]=_):_=e[12],_}function st(t){const e=E.c(22),{children:s,iconClass:i,classname:r,isVisible:n}=t,l=I.useId();let a;e[0]!==l?(a=[...l].map(_d),e[0]=l,e[1]=a):a=e[1];const d="--"+a.join(""),u=I.useRef(null),h=I.useRef(null);let p;e[2]!==d?(p=()=>{u.current.style.anchorName=d,h.current.style.positionAnchor=d},e[2]=d,e[3]=p):p=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[4]=g):g=e[4],I.useEffect(p,g);let _;e[5]!==l||e[6]!==n?(_=()=>{n===!0&&document.getElementById(l)?.showPopover()},e[5]=l,e[6]=n,e[7]=_):_=e[7];let j;e[8]!==n?(j=[n],e[8]=n,e[9]=j):j=e[9],I.useEffect(_,j);const y=r?`mode-popover ${r}`:"mode-popover";let w;e[10]!==i?(w=o.jsx("i",{className:i,"aria-hidden":"true"}),e[10]=i,e[11]=w):w=e[11];let $;e[12]!==l||e[13]!==w?($=o.jsx("button",{popoverTarget:l,ref:u,children:w}),e[12]=l,e[13]=w,e[14]=$):$=e[14];let N;e[15]!==s||e[16]!==l?(N=o.jsx("div",{id:l,popover:"auto",ref:h,children:s}),e[15]=s,e[16]=l,e[17]=N):N=e[17];let k;return e[18]!==y||e[19]!==$||e[20]!==N?(k=o.jsxs("div",{className:y,children:[$,N]}),e[18]=y,e[19]=$,e[20]=N,e[21]=k):k=e[21],k}function _d(t){return t.charCodeAt(0).toString(16)}function jd(t){const e=E.c(44),{server:s}=t,{currentProcesses:i,isLoading:r}=D(bd),{selectedProcesses:n}=D(wd);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[0]=l):l=e[0];const[a,d]=I.useState(l),[u,h]=I.useState(""),p=G(),{platform:g}=D(yd);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=B=>{h(B.target.value)},e[1]=_):_=e[1];const j=_;let y;e[2]!==g?(y=B=>{const oe=g.startsWith("win32")?"\\":"/";return ps(B.executable,oe)[1]},e[2]=g,e[3]=y):y=e[3];const w=y;let $;e[4]!==p||e[5]!==w||e[6]!==n||e[7]!==s?($=B=>{const oe=typeof B=="string"?B:w(B),q=n?`${n}, ${oe}`:oe;p(St({server:s,value:q}))},e[4]=p,e[5]=w,e[6]=n,e[7]=s,e[8]=$):$=e[8];const N=$;let k;e[9]!==p||e[10]!==w||e[11]!==n||e[12]!==s?(k=B=>{const oe=n?.split(/,\s*/).filter(q=>q!==w(B)).join(", ");p(St({server:s,value:oe}))},e[9]=p,e[10]=w,e[11]=n,e[12]=s,e[13]=k):k=e[13];const T=k,P=B=>{L(B)&&n?T(B):N(B)},L=B=>{const oe=w(B);return n?.includes(oe)};let O;e[14]!==i||e[15]!==p?(O=()=>{i.length===0&&p($t())},e[14]=i,e[15]=p,e[16]=O):O=e[16];let M;e[17]===Symbol.for("react.memo_cache_sentinel")?(M=[],e[17]=M):M=e[17],I.useEffect(O,M);let U;e[18]!==i||e[19]!==u||e[20]!==w||e[21]!==a?(U=()=>{if(u){const B=i.filter(oe=>w(oe).toLowerCase().includes(u.toLowerCase()));d(B)}else a!==i&&d(i)},e[18]=i,e[19]=u,e[20]=w,e[21]=a,e[22]=U):U=e[22];let V;e[23]!==i||e[24]!==u?(V=[u,i],e[23]=i,e[24]=u,e[25]=V):V=e[25],I.useEffect(U,V);let W;e[26]!==N||e[27]!==u?(W=B=>{B.stopPropagation(),B.key==="Enter"&&(N(u),h(""))},e[26]=N,e[27]=u,e[28]=W):W=e[28];const J=W,[z,te]=I.useState(!1),Y="local-dropdown",Q="dropdown-header",X=n&&n?.length>0?"Add more":"all applications";let Z,de;e[29]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>te(!0),de=()=>te(!1),e[29]=Z,e[30]=de):(Z=e[29],de=e[30]);let me;e[31]!==u||e[32]!==J||e[33]!==X?(me=o.jsx("input",{type:"text",className:"autocomplete-input",placeholder:X,value:u,onChange:j,onKeyDown:J,onClick:Z,onBlur:de}),e[31]=u,e[32]=J,e[33]=X,e[34]=me):me=e[34];const we=st,Be="fa fa-chevron-down",Le="local-popover";let be;e[35]===Symbol.for("react.memo_cache_sentinel")?(be=o.jsx("h4",{children:"Current Applications running on machine"}),e[35]=be):be=e[35];const ke=r?o.jsx("i",{className:"fa fa-spinner","aria-hidden":"true"}):a.length>0?o.jsxs("ul",{className:"dropdown-list",children:[o.jsxs("li",{className:`dropdown-item ${n===""?"selected":""}`,onClick:()=>{p(St({server:s,value:""}))},role:"menuitem",children:[o.jsxs("div",{className:"process-details",children:[o.jsx("div",{className:"process-icon"}),o.jsx("span",{className:"process-name",children:"All applications"})]}),n===""&&o.jsx("i",{className:"fa fa-check","aria-hidden":"true"})]}),o.jsx("hr",{className:"process-separator"}),a.map((B,oe)=>o.jsxs("li",{className:`dropdown-item ${L(B)?"selected":""}`,onClick:()=>P(B),role:"menuitem",children:[o.jsxs("div",{className:"process-details",children:[o.jsx("img",{className:"process-icon",src:`./executable-icon?path=${B.executable}`,loading:"lazy"}),o.jsx("span",{className:"process-name",children:w(B)})]}),L(B)&&o.jsx("i",{className:"fa fa-check","aria-hidden":"true"})]},oe))]}):o.jsxs("span",{children:["Press ",o.jsx("strong",{children:"Enter"})," to capture traffic for programs matching: ",o.jsx("strong",{children:u})]});let C;e[36]!==we||e[37]!==z||e[38]!==be||e[39]!==ke?(C=o.jsxs(we,{iconClass:Be,classname:Le,isVisible:z,children:[be,ke]}),e[36]=we,e[37]=z,e[38]=be,e[39]=ke,e[40]=C):C=e[40];let fe;return e[41]!==me||e[42]!==C?(fe=o.jsx("div",{className:Y,children:o.jsxs("div",{className:Q,children:[me,C]})}),e[41]=me,e[42]=C,e[43]=fe):fe=e[43],fe}function yd(t){return t.backendState}function wd(t){return t.modes.local[0]}function bd(t){return t.processes}function Sd(){const t=E.c(9),e=D(Cd),s=D($d);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(Nd,{server:u,backendState:s[Zi(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n,l;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"Local Applications"}),l=o.jsx("p",{className:"mode-description",children:"Transparently Intercept local application(s)."}),t[5]=n,t[6]=l):(n=t[5],l=t[6]);let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function $d(t){return t.backendState.servers}function Cd(t){return t.modes.local}function Nd(t){const e=E.c(31),{server:s,backendState:i}=t,r=G(),n=D(Ed),l=s.error||i?.last_exception||n||void 0;let a;e[0]!==r||e[1]!==s?(a=k=>{const T=s.selectedProcesses?.split(/,\s*/).filter(P=>P!==k).join(", ");r(St({server:s,value:T}))},e[0]=r,e[1]=s,e[2]=a):a=e[2];const d=a;let u;e[3]!==r||e[4]!==s?(u=()=>r(cr({server:s,value:!s.active})),e[3]=r,e[4]=s,e[5]=u):u=e[5];let h;e[6]!==d||e[7]!==s.selectedProcesses?(h=s.selectedProcesses?.split(/,\s*/).filter(kd).map(k=>o.jsxs("div",{className:"selected-process",children:[k,o.jsx("i",{className:"fa fa-times","aria-hidden":"true",onClick:()=>d(k)})]},k)),e[6]=d,e[7]=s.selectedProcesses,e[8]=h):h=e[8];let p;e[9]!==h?(p=o.jsx("div",{className:"selected-processes",children:h}),e[9]=h,e[10]=p):p=e[10];let g;e[11]!==s?(g=o.jsx(jd,{server:s}),e[11]=s,e[12]=g):g=e[12];let _;e[13]!==r?(_=o.jsx("i",{className:"fa fa-refresh","aria-hidden":"true",onClick:()=>r($t())}),e[13]=r,e[14]=_):_=e[14];let j;e[15]!==g||e[16]!==_?(j=o.jsxs("div",{className:"dropdown-container",children:[g,_]}),e[15]=g,e[16]=_,e[17]=j):j=e[17];let y;e[18]!==p||e[19]!==j?(y=o.jsxs("div",{className:"processes-container",children:[p,j]}),e[18]=p,e[19]=j,e[20]=y):y=e[20];let w;e[21]!==s.active||e[22]!==u||e[23]!==y?(w=o.jsx(tt,{value:s.active,label:"Intercept traffic for",onChange:u,children:y}),e[21]=s.active,e[22]=u,e[23]=y,e[24]=w):w=e[24];let $;e[25]!==i||e[26]!==l?($=o.jsx(et,{error:l,backendState:i}),e[25]=i,e[26]=l,e[27]=$):$=e[27];let N;return e[28]!==$||e[29]!==w?(N=o.jsxs("div",{className:"mode-local",children:[w,$]}),e[28]=$,e[29]=w,e[30]=N):N=e[30],N}function kd(t){return t.trim()!==""}function Ed(t){return t.processes.error}function Td(){const t=E.c(9),e=D(Ad),s=D(Rd);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(Dd,{server:u,backendState:s[Xi(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n,l;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"Explicit HTTP(S) Proxy"}),l=o.jsx("p",{className:"mode-description",children:"You manually configure your client application or device to use an HTTP(S) proxy."}),t[5]=n,t[6]=l):(n=t[5],l=t[6]);let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function Rd(t){return t.backendState.servers}function Ad(t){return t.modes.regular}function Dd(t){const e=E.c(33),{server:s,backendState:i}=t,r=G(),n=s.error||i?.last_exception||void 0;let l;e[0]!==r||e[1]!==s?(l=()=>r(rr({server:s,value:!s.active})),e[0]=r,e[1]=s,e[2]=l):l=e[2];let a,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("h4",{children:"Advanced Configuration"}),d=o.jsx("p",{children:"Listen Host"}),e[3]=a,e[4]=d):(a=e[3],d=e[4]);const u=s.listen_host||"";let h;e[5]!==r||e[6]!==s?(h=T=>r(or({server:s,value:T})),e[5]=r,e[6]=s,e[7]=h):h=e[7];let p;e[8]!==u||e[9]!==h?(p=o.jsx(le,{className:"mode-input",content:u,onEditDone:h}),e[8]=u,e[9]=h,e[10]=p):p=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("p",{children:"Listen Port"}),e[11]=g):g=e[11];let _;e[12]!==s.listen_port?(_=s.listen_port?s.listen_port.toString():"",e[12]=s.listen_port,e[13]=_):_=e[13];let j;e[14]!==r||e[15]!==s?(j=T=>r(lr({server:s,value:parseInt(T)})),e[14]=r,e[15]=s,e[16]=j):j=e[16];let y;e[17]!==_||e[18]!==j?(y=o.jsx(le,{className:"mode-input",content:_,placeholder:"8080",onEditDone:j}),e[17]=_,e[18]=j,e[19]=y):y=e[19];let w;e[20]!==y||e[21]!==p?(w=o.jsxs(st,{iconClass:"fa fa-cog",children:[a,d,p,g,y]}),e[20]=y,e[21]=p,e[22]=w):w=e[22];let $;e[23]!==s.active||e[24]!==l||e[25]!==w?($=o.jsx(tt,{value:s.active,label:"Run HTTP/S Proxy",onChange:l,children:w}),e[23]=s.active,e[24]=l,e[25]=w,e[26]=$):$=e[26];let N;e[27]!==i||e[28]!==n?(N=o.jsx(et,{error:n,backendState:i}),e[27]=i,e[28]=n,e[29]=N):N=e[29];let k;return e[30]!==$||e[31]!==N?(k=o.jsxs("div",{children:[$,N]}),e[30]=$,e[31]=N,e[32]=k):k=e[32],k}function Fd(){const t=E.c(9),e=D(Ld),s=D(Id);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(Pd,{server:u,backendState:s[er(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n,l;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"WireGuard Server"}),l=o.jsx("p",{className:"mode-description",children:"Start a WireGuard™ server and connect an external device for transparent proxying."}),t[5]=n,t[6]=l):(n=t[5],l=t[6]);let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function Id(t){return t.backendState.servers}function Ld(t){return t.modes.wireguard}function Pd(t){const e=E.c(41),{server:s,backendState:i}=t,r=G(),n=s.error||i?.last_exception||void 0;let l;e[0]!==r||e[1]!==s?(l=()=>r(ar({server:s,value:!s.active})),e[0]=r,e[1]=s,e[2]=l):l=e[2];let a,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("h4",{children:"Advanced Configuration"}),d=o.jsx("p",{children:"Listen Host"}),e[3]=a,e[4]=d):(a=e[3],d=e[4]);const u=s.listen_host||"";let h;e[5]!==r||e[6]!==s?(h=M=>r(dr({server:s,value:M})),e[5]=r,e[6]=s,e[7]=h):h=e[7];let p;e[8]!==u||e[9]!==h?(p=o.jsx(le,{className:"mode-input",content:u,placeholder:"(all interfaces)",onEditDone:h}),e[8]=u,e[9]=h,e[10]=p):p=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("p",{children:"Listen Port"}),e[11]=g):g=e[11];let _;e[12]!==s.listen_port?(_=s.listen_port?s.listen_port.toString():"",e[12]=s.listen_port,e[13]=_):_=e[13];let j;e[14]!==r||e[15]!==s?(j=M=>r(ur({server:s,value:parseInt(M)})),e[14]=r,e[15]=s,e[16]=j):j=e[16];let y;e[17]!==_||e[18]!==j?(y=o.jsx(le,{className:"mode-input",content:_,placeholder:"51820",onEditDone:j}),e[17]=_,e[18]=j,e[19]=y):y=e[19];let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("p",{children:"Configuration File"}),e[20]=w):w=e[20];const $=s.file_path||"";let N;e[21]!==r||e[22]!==s?(N=M=>r(fr({server:s,value:M})),e[21]=r,e[22]=s,e[23]=N):N=e[23];let k;e[24]!==$||e[25]!==N?(k=o.jsx(le,{className:"mode-input",content:$,placeholder:"~/.mitmproxy/wireguard.conf",onEditDone:N}),e[24]=$,e[25]=N,e[26]=k):k=e[26];let T;e[27]!==y||e[28]!==k||e[29]!==p?(T=o.jsxs(st,{iconClass:"fa fa-cog",children:[a,d,p,g,y,w,k]}),e[27]=y,e[28]=k,e[29]=p,e[30]=T):T=e[30];let P;e[31]!==s.active||e[32]!==l||e[33]!==T?(P=o.jsx(tt,{value:s.active,label:"Run WireGuard Server",onChange:l,children:T}),e[31]=s.active,e[32]=l,e[33]=T,e[34]=P):P=e[34];let L;e[35]!==i||e[36]!==n?(L=o.jsx(et,{error:n,backendState:i}),e[35]=i,e[36]=n,e[37]=L):L=e[37];let O;return e[38]!==P||e[39]!==L?(O=o.jsxs("div",{children:[P,L]}),e[38]=P,e[39]=L,e[40]=O):O=e[40],O}function Od(){const t=E.c(15),e=G(),s=D(qd),i=D(Md);let r,n;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("h4",{className:"mode-title",children:"Reverse Proxy"}),n=o.jsx("p",{className:"mode-description",children:"Requests are forwarded to a preconfigured destination."}),t[0]=r,t[1]=n):(r=t[0],n=t[1]);let l;if(t[2]!==i||t[3]!==s){let p;t[5]!==i?(p=(g,_)=>o.jsx(Hd,{removable:_>0,server:g,backendState:i[Ns(g)]},g.ui_id),t[5]=i,t[6]=p):p=t[6],l=s.map(p),t[2]=i,t[3]=s,t[4]=l}else l=t[4];let a;t[7]!==e?(a=()=>e(na()),t[7]=e,t[8]=a):a=t[8];let d;t[9]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("i",{className:"fa fa-plus-square-o","aria-hidden":"true"}),t[9]=d):d=t[9];let u;t[10]!==a?(u=o.jsxs("div",{className:"mode-reverse-add-server",onClick:a,children:[d,"Add additional server"]}),t[10]=a,t[11]=u):u=t[11];let h;return t[12]!==l||t[13]!==u?(h=o.jsxs("div",{children:[r,n,o.jsxs("div",{className:"mode-reverse-servers",children:[l,u]})]}),t[12]=l,t[13]=u,t[14]=h):h=t[14],h}function Md(t){return t.backendState.servers}function qd(t){return t.modes.reverse}function Hd(t){const e=E.c(56),{removable:s,server:i,backendState:r}=t,n=G();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Object.values(Jt),e[0]=l):l=e[0];const a=l;let d;e[1]!==n||e[2]!==i?(d=async()=>{i.active&&await n(ms({server:i,value:!1})).unwrap(),await n(ia(i))},e[1]=n,e[2]=i,e[3]=d):d=e[3];const u=d,h=i.error||r?.last_exception||void 0,p=i.active;let g;e[4]!==n||e[5]!==i?(g=()=>{n(ms({server:i,value:!i.active}))},e[4]=n,e[5]=i,e[6]=g):g=e[6];const _=i.protocol;let j;e[7]!==n||e[8]!==i?(j=Z=>{n(mr({server:i,value:Z.target.value}))},e[7]=n,e[8]=i,e[9]=j):j=e[9];let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=a.map(Vd),e[10]=y):y=e[10];let w;e[11]!==i.protocol||e[12]!==j?(w=o.jsx("select",{name:"protocols",className:"mode-reverse-dropdown",value:_,onChange:j,children:y}),e[11]=i.protocol,e[12]=j,e[13]=w):w=e[13];let $;e[14]!==i.destination?($=i.destination?.toString()||"",e[14]=i.destination,e[15]=$):$=e[15];let N;e[16]!==n||e[17]!==i?(N=Z=>n(gr({server:i,value:Z})),e[16]=n,e[17]=i,e[18]=N):N=e[18];let k;e[19]!==N||e[20]!==$?(k=o.jsx(le,{className:"mode-reverse-input",content:$,onEditDone:N,placeholder:"example.com"}),e[19]=N,e[20]=$,e[21]=k):k=e[21];let T,P;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx("h4",{children:"Advanced Configuration"}),P=o.jsx("p",{children:"Listen Host"}),e[22]=T,e[23]=P):(T=e[22],P=e[23]);const L=i.listen_host||"";let O;e[24]!==n||e[25]!==i?(O=Z=>n(pr({server:i,value:Z})),e[24]=n,e[25]=i,e[26]=O):O=e[26];let M;e[27]!==L||e[28]!==O?(M=o.jsx(le,{className:"mode-input",content:L,onEditDone:O,placeholder:"*"}),e[27]=L,e[28]=O,e[29]=M):M=e[29];let U;e[30]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx("p",{children:"Listen Port"}),e[30]=U):U=e[30];const V=String(i.listen_port||"");let W;e[31]!==n||e[32]!==i?(W=Z=>n(hr({server:i,value:Z})),e[31]=n,e[32]=i,e[33]=W):W=e[33];let J;e[34]!==V||e[35]!==W?(J=o.jsx(le,{className:"mode-input",content:V,onEditDone:W,placeholder:"8080"}),e[34]=V,e[35]=W,e[36]=J):J=e[36];let z;e[37]!==M||e[38]!==J?(z=o.jsxs(st,{iconClass:"fa fa-cog",children:[T,P,M,U,J]}),e[37]=M,e[38]=J,e[39]=z):z=e[39];let te;e[40]!==u||e[41]!==s?(te=s&&o.jsx("i",{className:"fa fa-fw fa-trash fa-lg","aria-hidden":"true",onClick:u}),e[40]=u,e[41]=s,e[42]=te):te=e[42];let Y;e[43]!==i.active||e[44]!==k||e[45]!==z||e[46]!==te||e[47]!==g||e[48]!==w?(Y=o.jsxs(tt,{value:p,label:"Forward",onChange:g,children:[w,"traffic to",k,z,te]}),e[43]=i.active,e[44]=k,e[45]=z,e[46]=te,e[47]=g,e[48]=w,e[49]=Y):Y=e[49];let Q;e[50]!==r||e[51]!==h?(Q=o.jsx(et,{error:h,backendState:r}),e[50]=r,e[51]=h,e[52]=Q):Q=e[52];let X;return e[53]!==Y||e[54]!==Q?(X=o.jsxs("div",{children:[Y,Q]}),e[53]=Y,e[54]=Q,e[55]=X):X=e[55],X}function Vd(t){return o.jsx("option",{value:t,children:t},t)}function Ud(){const t=E.c(9),e=D(Wd),s=D(Bd);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(Kd,{server:u,backendState:s[tr(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"Transparent Proxy"}),t[5]=n):n=t[5];let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsxs("p",{className:"mode-description",children:["You"," ",o.jsx("a",{href:"https://docs.mitmproxy.org/stable/howto-transparent/",style:{textDecoration:"underline",color:"inherit"},children:"configure your routing table"})," ","to send traffic through mitmproxy."]}),t[6]=l):l=t[6];let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function Bd(t){return t.backendState.servers}function Wd(t){return t.modes.transparent}function Kd(t){const e=E.c(33),{server:s,backendState:i}=t,r=G(),n=s.error||i?.last_exception||void 0;let l;e[0]!==r||e[1]!==s?(l=()=>r(xr({server:s,value:!s.active})),e[0]=r,e[1]=s,e[2]=l):l=e[2];let a,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("h4",{children:"Advanced Configuration"}),d=o.jsx("p",{children:"Listen Host"}),e[3]=a,e[4]=d):(a=e[3],d=e[4]);const u=s.listen_host||"";let h;e[5]!==r||e[6]!==s?(h=T=>r(_r({server:s,value:T})),e[5]=r,e[6]=s,e[7]=h):h=e[7];let p;e[8]!==u||e[9]!==h?(p=o.jsx(le,{className:"mode-input",content:u,onEditDone:h}),e[8]=u,e[9]=h,e[10]=p):p=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("p",{children:"Listen Port"}),e[11]=g):g=e[11];let _;e[12]!==s.listen_port?(_=s.listen_port?s.listen_port.toString():"",e[12]=s.listen_port,e[13]=_):_=e[13];let j;e[14]!==r||e[15]!==s?(j=T=>r(jr({server:s,value:parseInt(T)})),e[14]=r,e[15]=s,e[16]=j):j=e[16];let y;e[17]!==_||e[18]!==j?(y=o.jsx(le,{className:"mode-input",content:_,placeholder:"8080",onEditDone:j}),e[17]=_,e[18]=j,e[19]=y):y=e[19];let w;e[20]!==y||e[21]!==p?(w=o.jsxs(st,{iconClass:"fa fa-cog",children:[a,d,p,g,y]}),e[20]=y,e[21]=p,e[22]=w):w=e[22];let $;e[23]!==s.active||e[24]!==l||e[25]!==w?($=o.jsx(tt,{value:s.active,label:"Run Transparent Proxy",onChange:l,children:w}),e[23]=s.active,e[24]=l,e[25]=w,e[26]=$):$=e[26];let N;e[27]!==i||e[28]!==n?(N=o.jsx(et,{error:n,backendState:i}),e[27]=i,e[28]=n,e[29]=N):N=e[29];let k;return e[30]!==$||e[31]!==N?(k=o.jsxs("div",{children:[$,N]}),e[30]=$,e[31]=N,e[32]=k):k=e[32],k}function zd(){const t=E.c(9),e=D(Yd),s=D(Gd);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(Jd,{server:u,backendState:s[sr(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n,l;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"SOCKS Proxy"}),l=o.jsx("p",{className:"mode-description",children:"You manually configure your client application or device to use a SOCKS5 proxy."}),t[5]=n,t[6]=l):(n=t[5],l=t[6]);let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function Gd(t){return t.backendState.servers}function Yd(t){return t.modes.socks}function Jd(t){const e=E.c(33),{server:s,backendState:i}=t,r=G(),n=s.error||i?.last_exception||void 0;let l;e[0]!==r||e[1]!==s?(l=()=>r(yr({server:s,value:!s.active})),e[0]=r,e[1]=s,e[2]=l):l=e[2];let a,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("h4",{children:"Advanced Configuration"}),d=o.jsx("p",{children:"Listen Host"}),e[3]=a,e[4]=d):(a=e[3],d=e[4]);const u=s.listen_host||"";let h;e[5]!==r||e[6]!==s?(h=T=>r(wr({server:s,value:T})),e[5]=r,e[6]=s,e[7]=h):h=e[7];let p;e[8]!==u||e[9]!==h?(p=o.jsx(le,{className:"mode-input",content:u,onEditDone:h}),e[8]=u,e[9]=h,e[10]=p):p=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("p",{children:"Listen Port"}),e[11]=g):g=e[11];let _;e[12]!==s.listen_port?(_=s.listen_port?s.listen_port.toString():"",e[12]=s.listen_port,e[13]=_):_=e[13];let j;e[14]!==r||e[15]!==s?(j=T=>r(br({server:s,value:parseInt(T)})),e[14]=r,e[15]=s,e[16]=j):j=e[16];let y;e[17]!==_||e[18]!==j?(y=o.jsx(le,{className:"mode-input",content:_,placeholder:"8080",onEditDone:j}),e[17]=_,e[18]=j,e[19]=y):y=e[19];let w;e[20]!==y||e[21]!==p?(w=o.jsxs(st,{iconClass:"fa fa-cog",children:[a,d,p,g,y]}),e[20]=y,e[21]=p,e[22]=w):w=e[22];let $;e[23]!==s.active||e[24]!==l||e[25]!==w?($=o.jsx(tt,{value:s.active,label:"Run SOCKS Proxy",onChange:l,children:w}),e[23]=s.active,e[24]=l,e[25]=w,e[26]=$):$=e[26];let N;e[27]!==i||e[28]!==n?(N=o.jsx(et,{error:n,backendState:i}),e[27]=i,e[28]=n,e[29]=N):N=e[29];let k;return e[30]!==$||e[31]!==N?(k=o.jsxs("div",{children:[$,N]}),e[30]=$,e[31]=N,e[32]=k):k=e[32],k}function Qd(){const t=E.c(9),e=D(Zd),s=D(Xd);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(eu,{server:u,backendState:s[nr(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n,l;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"Explicit HTTP(S) Proxy (With Upstream Proxy)"}),l=o.jsx("p",{className:"mode-description",children:"All requests are forwarded to a second HTTP(S) proxy server."}),t[5]=n,t[6]=l):(n=t[5],l=t[6]);let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function Xd(t){return t.backendState.servers}function Zd(t){return t.modes.upstream}function eu(t){const e=E.c(42),{server:s,backendState:i}=t,r=G(),n=s.error||i?.last_exception||void 0;let l;e[0]!==r||e[1]!==s?(l=()=>{r(Sr({server:s,value:!s.active}))},e[0]=r,e[1]=s,e[2]=l):l=e[2];let a;e[3]!==s.destination?(a=s.destination?.toString()||"",e[3]=s.destination,e[4]=a):a=e[4];let d;e[5]!==r||e[6]!==s?(d=O=>r(Nr({server:s,value:O})),e[5]=r,e[6]=s,e[7]=d):d=e[7];let u;e[8]!==a||e[9]!==d?(u=o.jsx(le,{className:"mode-upstream-input",content:a,onEditDone:d,placeholder:"http://example.com:8080"}),e[8]=a,e[9]=d,e[10]=u):u=e[10];let h,p;e[11]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("h4",{children:"Advanced Configuration"}),p=o.jsx("p",{children:"Listen Host"}),e[11]=h,e[12]=p):(h=e[11],p=e[12]);const g=s.listen_host||"";let _;e[13]!==r||e[14]!==s?(_=O=>r($r({server:s,value:O})),e[13]=r,e[14]=s,e[15]=_):_=e[15];let j;e[16]!==g||e[17]!==_?(j=o.jsx(le,{className:"mode-input",content:g,onEditDone:_}),e[16]=g,e[17]=_,e[18]=j):j=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("p",{children:"Listen Port"}),e[19]=y):y=e[19];let w;e[20]!==s.listen_port?(w=s.listen_port?s.listen_port.toString():"",e[20]=s.listen_port,e[21]=w):w=e[21];let $;e[22]!==r||e[23]!==s?($=O=>r(Cr({server:s,value:parseInt(O)})),e[22]=r,e[23]=s,e[24]=$):$=e[24];let N;e[25]!==w||e[26]!==$?(N=o.jsx(le,{className:"mode-input",content:w,placeholder:"8080",onEditDone:$}),e[25]=w,e[26]=$,e[27]=N):N=e[27];let k;e[28]!==N||e[29]!==j?(k=o.jsxs(st,{iconClass:"fa fa-cog",children:[h,p,j,y,N]}),e[28]=N,e[29]=j,e[30]=k):k=e[30];let T;e[31]!==s.active||e[32]!==l||e[33]!==k||e[34]!==u?(T=o.jsxs(tt,{value:s.active,label:"Run HTTP/S Proxy and forward requests to",onChange:l,children:[u,k]}),e[31]=s.active,e[32]=l,e[33]=k,e[34]=u,e[35]=T):T=e[35];let P;e[36]!==i||e[37]!==n?(P=o.jsx(et,{error:n,backendState:i}),e[36]=i,e[37]=n,e[38]=P):P=e[38];let L;return e[39]!==T||e[40]!==P?(L=o.jsxs("div",{children:[T,P]}),e[39]=T,e[40]=P,e[41]=L):L=e[41],L}function tu(){const t=E.c(9),e=D(nu),s=D(su);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(iu,{server:u,backendState:s[ir(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n,l;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"DNS Server"}),l=o.jsx("p",{className:"mode-description",children:"A recursive DNS resolver using the host's DNS configuration."}),t[5]=n,t[6]=l):(n=t[5],l=t[6]);let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function su(t){return t.backendState.servers}function nu(t){return t.modes.dns}function iu(t){const e=E.c(33),{server:s,backendState:i}=t,r=G(),n=s.error||i?.last_exception||void 0;let l;e[0]!==r||e[1]!==s?(l=()=>r(kr({server:s,value:!s.active})),e[0]=r,e[1]=s,e[2]=l):l=e[2];let a,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("h4",{children:"Advanced Configuration"}),d=o.jsx("p",{children:"Listen Host"}),e[3]=a,e[4]=d):(a=e[3],d=e[4]);const u=s.listen_host||"";let h;e[5]!==r||e[6]!==s?(h=T=>r(Er({server:s,value:T})),e[5]=r,e[6]=s,e[7]=h):h=e[7];let p;e[8]!==u||e[9]!==h?(p=o.jsx(le,{className:"mode-input",content:u,onEditDone:h}),e[8]=u,e[9]=h,e[10]=p):p=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("p",{children:"Listen Port"}),e[11]=g):g=e[11];let _;e[12]!==s.listen_port?(_=s.listen_port?s.listen_port.toString():"",e[12]=s.listen_port,e[13]=_):_=e[13];let j;e[14]!==r||e[15]!==s?(j=T=>r(Tr({server:s,value:parseInt(T)})),e[14]=r,e[15]=s,e[16]=j):j=e[16];let y;e[17]!==_||e[18]!==j?(y=o.jsx(le,{className:"mode-input",content:_,placeholder:"8080",onEditDone:j}),e[17]=_,e[18]=j,e[19]=y):y=e[19];let w;e[20]!==y||e[21]!==p?(w=o.jsxs(st,{iconClass:"fa fa-cog",children:[a,d,p,g,y]}),e[20]=y,e[21]=p,e[22]=w):w=e[22];let $;e[23]!==s.active||e[24]!==l||e[25]!==w?($=o.jsx(tt,{value:s.active,label:"Run DNS Server",onChange:l,children:w}),e[23]=s.active,e[24]=l,e[25]=w,e[26]=$):$=e[26];let N;e[27]!==i||e[28]!==n?(N=o.jsx(et,{error:n,backendState:i}),e[27]=i,e[28]=n,e[29]=N):N=e[29];let k;return e[30]!==$||e[31]!==N?(k=o.jsxs("div",{children:[$,N]}),e[30]=$,e[31]=N,e[32]=k):k=e[32],k}function ri(t){const e=E.c(10),{title:s,description:i}=t;let r;e[0]!==s?(r=o.jsx("h4",{className:"mode-title",children:s}),e[0]=s,e[1]=r):r=e[1];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("i",{className:"fa fa-exclamation-triangle","aria-hidden":"true"}),e[2]=n):n=e[2];let l;e[3]!==r?(l=o.jsxs("div",{className:"title-icon-container",children:[r,n]}),e[3]=r,e[4]=l):l=e[4];let a;e[5]!==i?(a=o.jsx("p",{className:"mode-description",children:i}),e[5]=i,e[6]=a):a=e[6];let d;return e[7]!==l||e[8]!==a?(d=o.jsxs("div",{className:"missing-mode-container",children:[l,a]}),e[7]=l,e[8]=a,e[9]=d):d=e[9],d}function ru(){const t=E.c(19),{platform:e,localModeUnavailable:s}=D(ou);let i,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("h2",{children:"Intercept Traffic"}),r=o.jsx("p",{children:"Configure how you want to intercept traffic with mitmproxy."}),t[0]=i,t[1]=r):(i=t[0],r=t[1]);let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h3",{children:"Recommended"}),t[2]=n):n=t[2];let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Td,{}),t[3]=l):l=t[3];let a;t[4]!==s?(a=s!==null?o.jsx(ri,{title:"Local Redirect Mode",description:s}):o.jsx(Sd,{}),t[4]=s,t[5]=a):a=t[5];let d,u;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Fd,{}),u=o.jsx(Od,{}),t[6]=d,t[7]=u):(d=t[6],u=t[7]);let h;t[8]!==a?(h=o.jsxs("div",{className:"modes-category green-left-border",children:[n,o.jsxs("div",{className:"modes-container",children:[l,a,d,u]})]}),t[8]=a,t[9]=h):h=t[9];let p;t[10]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("h3",{children:"Advanced"}),t[10]=p):p=t[10];let g,_,j;t[11]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(zd,{}),g=o.jsx(Qd,{}),_=o.jsx(tu,{}),t[11]=g,t[12]=_,t[13]=j):(g=t[11],_=t[12],j=t[13]);let y;t[14]!==e?(y=o.jsxs("div",{className:"modes-category gray-left-border",children:[p,o.jsxs("div",{className:"modes-container",children:[j,g,_,e.startsWith("win32")?o.jsx(ri,{title:"Transparent Proxy",description:"This mode is only supported on Linux and MacOS."}):o.jsx(Ud,{})]})]}),t[14]=e,t[15]=y):y=t[15];let w;return t[16]!==y||t[17]!==h?(w=o.jsxs("div",{className:"modes",children:[i,r,h,y]}),t[16]=y,t[17]=h,t[18]=w):w=t[18],w}function ou(t){return t.backendState}function lu(){const t=E.c(4),e=D(du),s=D(au),i=D(cu);let r;return t[0]!==i||t[1]!==s||t[2]!==e?(r=o.jsx("div",{className:"main-view",children:i===ve.Capture?o.jsx(ru,{}):o.jsxs(o.Fragment,{children:[s?o.jsx(md,{}):o.jsx(gd,{}),e&&o.jsxs(o.Fragment,{children:[o.jsx(ld,{},"splitter"),o.jsx(nd,{},"flowDetails")]})]})}),t[0]=i,t[1]=s,t[2]=e,t[3]=r):r=t[3],r}function cu(t){return t.ui.tabs.current}function au(t){return t.flows.list.length>0}function du(t){return t.flows.selected.length===1}function gt(t){const e=E.c(2),{children:s}=t;let i;return e[0]!==s?(i=window.MITMWEB_STATIC?null:o.jsx(o.Fragment,{children:s}),e[0]=s,e[1]=i):i=e[1],i}const uu=I.memo(function(){const e=E.c(20),s=G(),i=D(fu);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={placement:"bottom-start"},e[0]=r):r=e[0];let n;e[1]!==s?(n=o.jsx("li",{children:o.jsx(Fr,{icon:"fa-folder-open",text:" Open...",onClick:pu,onOpenFile:w=>{s(tc(w)),document.body.click()}})}),e[1]=s,e[2]=n):n=e[2];let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsxs(Ne,{onClick:hu,children:[o.jsx("i",{className:"fa fa-fw fa-floppy-o"})," Save"]}),e[3]=l):l=e[3];let a;e[4]!==i?(a=()=>location.replace("/flows/dump?filter="+i),e[4]=i,e[5]=a):a=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("i",{className:"fa fa-fw fa-floppy-o"}),e[6]=d):d=e[6];let u;e[7]!==a?(u=o.jsxs(Ne,{onClick:a,children:[d," Save filtered"]}),e[7]=a,e[8]=u):u=e[8];let h;e[9]!==s?(h=()=>confirm("Delete all flows?")&&s(Oi()),e[9]=s,e[10]=h):h=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("i",{className:"fa fa-fw fa-trash"}),e[11]=p):p=e[11];let g;e[12]!==h?(g=o.jsxs(Ne,{onClick:h,children:[p," Clear All"]}),e[12]=h,e[13]=g):g=e[13];let _;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(ka,{}),e[14]=_):_=e[14];let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsxs(gt,{children:[_,o.jsx("li",{children:o.jsxs("a",{href:"http://mitm.it/",target:"_blank",rel:"noreferrer",children:[o.jsx("i",{className:"fa fa-fw fa-external-link"})," Install Certificates..."]})})]}),e[15]=j):j=e[15];let y;return e[16]!==n||e[17]!==u||e[18]!==g?(y=o.jsxs(Et,{className:"pull-left special",text:"File",options:r,children:[n,l,u,g,j]}),e[16]=n,e[17]=u,e[18]=g,e[19]=y):y=e[19],y});function fu(t){return t.ui.filter[ge.Search]}function pu(t){return t.stopPropagation()}function hu(){return location.replace("/flows/dump")}const mu=I.memo(function(){const e=E.c(5),s=D(gu),i=D(vu);switch(s){case wt.INIT:{let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("span",{className:"connection-indicator init",children:"connecting…"}),e[0]=r):r=e[0],r}case wt.FETCHING:{let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("span",{className:"connection-indicator fetching",children:"fetching data…"}),e[1]=r):r=e[1],r}case wt.ESTABLISHED:{let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("span",{className:"connection-indicator established",children:"connected"}),e[2]=r):r=e[2],r}case wt.ERROR:{let r;return e[3]!==i?(r=o.jsx("span",{className:"connection-indicator error",title:i,children:"connection lost"}),e[3]=i,e[4]=r):r=e[4],r}default:Ct(s)}});function gu(t){return t.connection.state}function vu(t){return t.connection.message}Xr.title="Capture";function Xr(){const t=E.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(o.Fragment,{}),t[0]=e):e=t[0],e}const oi=function(){function t(i,r){function n(){this.constructor=i}n.prototype=r.prototype,i.prototype=new n}function e(i,r,n,l){this.message=i,this.expected=r,this.found=n,this.location=l,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,e)}t(e,Error);function s(i){var r=arguments.length>1?arguments[1]:{},n={},l={start:_n},a=_n,d={type:"other",description:"filter expression"},u=function(c){return c},h={type:"other",description:"whitespace"},p=/^[ \t\n\r]/,g={type:"class",value:"[ \\t\\n\\r]",description:"[ \\t\\n\\r]"},_={type:"other",description:"control character"},j=/^[|&!()~"]/,y={type:"class",value:'[|&!()~"]',description:'[|&!()~"]'},w={type:"other",description:"optional whitespace"},$="|",N={type:"literal",value:"|",description:'"|"'},k=function(c,f){return il(c,f)},T="&",P={type:"literal",value:"&",description:'"&"'},L=function(c,f){return rl(c,f)},O="!",M={type:"literal",value:"!",description:'"!"'},U=function(c){return ol(c)},V="(",W={type:"literal",value:"(",description:'"("'},J=")",z={type:"literal",value:")",description:'")"'},te=function(c){return ll(c)},Y="~all",Q={type:"literal",value:"~all",description:'"~all"'},X=function(){return Sn},Z="~a",de={type:"literal",value:"~a",description:'"~a"'},me=function(){return Cn},we="~b",Be={type:"literal",value:"~b",description:'"~b"'},Le=function(c){return cl(c)},be="~bq",ke={type:"literal",value:"~bq",description:'"~bq"'},C=function(c){return al(c)},fe="~bs",B={type:"literal",value:"~bs",description:'"~bs"'},oe=function(c){return dl(c)},q="~c",Se={type:"literal",value:"~c",description:'"~c"'},We=function(c){return ul(c)},Pe="~comment",ee={type:"literal",value:"~comment",description:'"~comment"'},Oe=function(c){return fl(c)},Te="~d",re={type:"literal",value:"~d",description:'"~d"'},ce=function(c){return pl(c)},he="~dns",Re={type:"literal",value:"~dns",description:'"~dns"'},nt=function(){return Nn},Je="~dst",Zt={type:"literal",value:"~dst",description:'"~dst"'},b=function(c){return hl(c)},S="~e",A={type:"literal",value:"~e",description:'"~e"'},H=function(){return kn},Tt="~h",es={type:"literal",value:"~h",description:'"~h"'},$e=function(c){return ml(c)},Ae="~hq",ut={type:"literal",value:"~hq",description:'"~hq"'},Ke=function(c){return gl(c)},vt="~hs",Rt={type:"literal",value:"~hs",description:'"~hs"'},it=function(c){return vl(c)},At="~http",ft={type:"literal",value:"~http",description:'"~http"'},De=function(){return En},Us="~marked",no={type:"literal",value:"~marked",description:'"~marked"'},io=function(){return Tn},Bs="~marker",ro={type:"literal",value:"~marker",description:'"~marker"'},oo=function(c){return xl(c)},Ws="~m",lo={type:"literal",value:"~m",description:'"~m"'},co=function(c){return _l(c)},Ks="~q",ao={type:"literal",value:"~q",description:'"~q"'},uo=function(){return Rn},zs="~replayq",fo={type:"literal",value:"~replayq",description:'"~replayq"'},po=function(){return An},Gs="~replays",ho={type:"literal",value:"~replays",description:'"~replays"'},mo=function(){return Dn},Ys="~replay",go={type:"literal",value:"~replay",description:'"~replay"'},vo=function(){return Fn},Js="~src",xo={type:"literal",value:"~src",description:'"~src"'},_o=function(c){return jl(c)},Qs="~s",jo={type:"literal",value:"~s",description:'"~s"'},yo=function(){return In},Xs="~tcp",wo={type:"literal",value:"~tcp",description:'"~tcp"'},bo=function(){return Ln},Zs="~udp",So={type:"literal",value:"~udp",description:'"~udp"'},$o=function(){return Pn},en="~tq",Co={type:"literal",value:"~tq",description:'"~tq"'},No=function(c){return yl(c)},tn="~ts",ko={type:"literal",value:"~ts",description:'"~ts"'},Eo=function(c){return wl(c)},sn="~t",To={type:"literal",value:"~t",description:'"~t"'},Ro=function(c){return bl(c)},nn="~u",Ao={type:"literal",value:"~u",description:'"~u"'},rn=function(c){return Sl(c)},on="~websocket",Do={type:"literal",value:"~websocket",description:'"~websocket"'},Fo=function(){return On},Io={type:"other",description:"integer"},ln=/^['"]/,cn={type:"class",value:`['"]`,description:`['"]`},an=/^[0-9]/,dn={type:"class",value:"[0-9]",description:"[0-9]"},Lo=function(c){return parseInt(c.join(""),10)},Po={type:"other",description:"string"},un='"',fn={type:"literal",value:'"',description:'"\\""'},ts=function(c){return c.join("")},pn="'",hn={type:"literal",value:"'",description:`"'"`},Oo=/^["\\]/,Mo={type:"class",value:'["\\\\]',description:'["\\\\]'},ss={type:"any",description:"any character"},xt=function(c){return c},mn="\\",gn={type:"literal",value:"\\",description:'"\\\\"'},qo=/^['\\]/,Ho={type:"class",value:"['\\\\]",description:"['\\\\]"},Vo=/^['"\\]/,Uo={type:"class",value:`['"\\\\]`,description:`['"\\\\]`},Bo="n",Wo={type:"literal",value:"n",description:'"n"'},Ko=function(){return`
-`},zo="r",Go={type:"literal",value:"r",description:'"r"'},Yo=function(){return"\r"},Jo="t",Qo={type:"literal",value:"t",description:'"t"'},Xo=function(){return"       "},m=0,Dt=[{line:1,column:1,seenCR:!1}],Me=0,ns=[],R=0,Ft;if("startRule"in r){if(!(r.startRule in l))throw new Error(`Can't start parsing from rule "`+r.startRule+'".');a=l[r.startRule]}function vn(c){var f=Dt[c],v,x;if(f)return f;for(v=c-1;!Dt[v];)v--;for(f=Dt[v],f={line:f.line,column:f.column,seenCR:f.seenCR};v<c;)x=i.charAt(v),x===`
-`?(f.seenCR||f.line++,f.column=1,f.seenCR=!1):x==="\r"||x==="\u2028"||x==="\u2029"?(f.line++,f.column=1,f.seenCR=!0):(f.column++,f.seenCR=!1),v++;return Dt[c]=f,f}function xn(c,f){var v=vn(c),x=vn(f);return{start:{offset:c,line:v.line,column:v.column},end:{offset:f,line:x.line,column:x.column}}}function F(c){m<Me||(m>Me&&(Me=m,ns=[]),ns.push(c))}function Zo(c,f,v,x){function qe(Fe){var Qe=1;for(Fe.sort(function(Pt,rt){return Pt.description<rt.description?-1:Pt.description>rt.description?1:0});Qe<Fe.length;)Fe[Qe-1]===Fe[Qe]?Fe.splice(Qe,1):Qe++}function Ce(Fe,Qe){function Pt($l){function Ot(Ge){return Ge.charCodeAt(0).toString(16).toUpperCase()}return $l.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(Ge){return"\\x0"+Ot(Ge)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(Ge){return"\\x"+Ot(Ge)}).replace(/[\u0100-\u0FFF]/g,function(Ge){return"\\u0"+Ot(Ge)}).replace(/[\u1000-\uFFFF]/g,function(Ge){return"\\u"+Ot(Ge)})}var rt=new Array(Fe.length),Mn,qn,_t;for(_t=0;_t<Fe.length;_t++)rt[_t]=Fe[_t].description;return Mn=Fe.length>1?rt.slice(0,-1).join(", ")+" or "+rt[Fe.length-1]:rt[0],qn=Qe?'"'+Pt(Qe)+'"':"end of input","Expected "+Mn+" but "+qn+" found."}return f!==null&&qe(f),new e(Ce(f,v),f,v,x)}function _n(){var c,f,v,x;return R++,c=m,f=ze(),f!==n?(v=is(),v!==n?(x=ze(),x!==n?(f=u(v),c=f):(m=c,c=n)):(m=c,c=n)):(m=c,c=n),R--,c===n&&(f=n,R===0&&F(d)),c}function K(){var c;return R++,p.test(i.charAt(m))?(c=i.charAt(m),m++):(c=n,R===0&&F(g)),R--,c===n&&R===0&&F(h),c}function el(){var c;return R++,j.test(i.charAt(m))?(c=i.charAt(m),m++):(c=n,R===0&&F(y)),R--,c===n&&R===0&&F(_),c}function ze(){var c,f;for(R++,c=[],f=K();f!==n;)c.push(f),f=K();return R--,c===n&&(f=n,R===0&&F(w)),c}function is(){var c,f,v,x,qe,Ce;return c=m,f=It(),f!==n?(v=ze(),v!==n?(i.charCodeAt(m)===124?(x=$,m++):(x=n,R===0&&F(N)),x!==n?(qe=ze(),qe!==n?(Ce=is(),Ce!==n?(f=k(f,Ce),c=f):(m=c,c=n)):(m=c,c=n)):(m=c,c=n)):(m=c,c=n)):(m=c,c=n),c===n&&(c=It()),c}function It(){var c,f,v,x,qe,Ce;if(c=m,f=Lt(),f!==n?(v=ze(),v!==n?(i.charCodeAt(m)===38?(x=T,m++):(x=n,R===0&&F(P)),x!==n?(qe=ze(),qe!==n?(Ce=It(),Ce!==n?(f=L(f,Ce),c=f):(m=c,c=n)):(m=c,c=n)):(m=c,c=n)):(m=c,c=n)):(m=c,c=n),c===n){if(c=m,f=Lt(),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=It(),x!==n?(f=L(f,x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;c===n&&(c=Lt())}return c}function Lt(){var c,f,v,x;return c=m,i.charCodeAt(m)===33?(f=O,m++):(f=n,R===0&&F(M)),f!==n?(v=ze(),v!==n?(x=Lt(),x!==n?(f=U(x),c=f):(m=c,c=n)):(m=c,c=n)):(m=c,c=n),c===n&&(c=tl()),c}function tl(){var c,f,v,x,qe,Ce;return c=m,i.charCodeAt(m)===40?(f=V,m++):(f=n,R===0&&F(W)),f!==n?(v=ze(),v!==n?(x=is(),x!==n?(qe=ze(),qe!==n?(i.charCodeAt(m)===41?(Ce=J,m++):(Ce=n,R===0&&F(z)),Ce!==n?(f=te(x),c=f):(m=c,c=n)):(m=c,c=n)):(m=c,c=n)):(m=c,c=n)):(m=c,c=n),c===n&&(c=sl()),c}function sl(){var c,f,v,x;if(c=m,i.substr(m,4)===Y?(f=Y,m+=4):(f=n,R===0&&F(Q)),f!==n&&(f=X()),c=f,c===n&&(c=m,i.substr(m,2)===Z?(f=Z,m+=2):(f=n,R===0&&F(de)),f!==n&&(f=me()),c=f,c===n)){if(c=m,i.substr(m,2)===we?(f=we,m+=2):(f=n,R===0&&F(Be)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=Le(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,3)===be?(f=be,m+=3):(f=n,R===0&&F(ke)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=C(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,3)===fe?(f=fe,m+=3):(f=n,R===0&&F(B)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=oe(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,2)===q?(f=q,m+=2):(f=n,R===0&&F(Se)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=nl(),x!==n?(f=We(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,8)===Pe?(f=Pe,m+=8):(f=n,R===0&&F(ee)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=Oe(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,2)===Te?(f=Te,m+=2):(f=n,R===0&&F(re)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=ce(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n&&(c=m,i.substr(m,4)===he?(f=he,m+=4):(f=n,R===0&&F(Re)),f!==n&&(f=nt()),c=f,c===n)){if(c=m,i.substr(m,4)===Je?(f=Je,m+=4):(f=n,R===0&&F(Zt)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=b(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n&&(c=m,i.substr(m,2)===S?(f=S,m+=2):(f=n,R===0&&F(A)),f!==n&&(f=H()),c=f,c===n)){if(c=m,i.substr(m,2)===Tt?(f=Tt,m+=2):(f=n,R===0&&F(es)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=$e(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,3)===Ae?(f=Ae,m+=3):(f=n,R===0&&F(ut)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=Ke(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,3)===vt?(f=vt,m+=3):(f=n,R===0&&F(Rt)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=it(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n&&(c=m,i.substr(m,5)===At?(f=At,m+=5):(f=n,R===0&&F(ft)),f!==n&&(f=De()),c=f,c===n&&(c=m,i.substr(m,7)===Us?(f=Us,m+=7):(f=n,R===0&&F(no)),f!==n&&(f=io()),c=f,c===n))){if(c=m,i.substr(m,7)===Bs?(f=Bs,m+=7):(f=n,R===0&&F(ro)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=oo(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,2)===Ws?(f=Ws,m+=2):(f=n,R===0&&F(lo)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=co(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n&&(c=m,i.substr(m,2)===Ks?(f=Ks,m+=2):(f=n,R===0&&F(ao)),f!==n&&(f=uo()),c=f,c===n&&(c=m,i.substr(m,8)===zs?(f=zs,m+=8):(f=n,R===0&&F(fo)),f!==n&&(f=po()),c=f,c===n&&(c=m,i.substr(m,8)===Gs?(f=Gs,m+=8):(f=n,R===0&&F(ho)),f!==n&&(f=mo()),c=f,c===n&&(c=m,i.substr(m,7)===Ys?(f=Ys,m+=7):(f=n,R===0&&F(go)),f!==n&&(f=vo()),c=f,c===n))))){if(c=m,i.substr(m,4)===Js?(f=Js,m+=4):(f=n,R===0&&F(xo)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=_o(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n&&(c=m,i.substr(m,2)===Qs?(f=Qs,m+=2):(f=n,R===0&&F(jo)),f!==n&&(f=yo()),c=f,c===n&&(c=m,i.substr(m,4)===Xs?(f=Xs,m+=4):(f=n,R===0&&F(wo)),f!==n&&(f=bo()),c=f,c===n&&(c=m,i.substr(m,4)===Zs?(f=Zs,m+=4):(f=n,R===0&&F(So)),f!==n&&(f=$o()),c=f,c===n)))){if(c=m,i.substr(m,3)===en?(f=en,m+=3):(f=n,R===0&&F(Co)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=No(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,3)===tn?(f=tn,m+=3):(f=n,R===0&&F(ko)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=Eo(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,2)===sn?(f=sn,m+=2):(f=n,R===0&&F(To)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=Ro(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,2)===nn?(f=nn,m+=2):(f=n,R===0&&F(Ao)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=rn(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;c===n&&(c=m,i.substr(m,10)===on?(f=on,m+=10):(f=n,R===0&&F(Do)),f!==n&&(f=Fo()),c=f,c===n&&(c=m,f=pe(),f!==n&&(f=rn(f)),c=f))}}}}}}}}}}}}}}}}}return c}function nl(){var c,f,v,x;if(R++,c=m,ln.test(i.charAt(m))?(f=i.charAt(m),m++):(f=n,R===0&&F(cn)),f===n&&(f=null),f!==n){if(v=[],an.test(i.charAt(m))?(x=i.charAt(m),m++):(x=n,R===0&&F(dn)),x!==n)for(;x!==n;)v.push(x),an.test(i.charAt(m))?(x=i.charAt(m),m++):(x=n,R===0&&F(dn));else v=n;v!==n?(ln.test(i.charAt(m))?(x=i.charAt(m),m++):(x=n,R===0&&F(cn)),x===n&&(x=null),x!==n?(f=Lo(v),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;return R--,c===n&&(f=n,R===0&&F(Io)),c}function pe(){var c,f,v,x;if(R++,c=m,i.charCodeAt(m)===34?(f=un,m++):(f=n,R===0&&F(fn)),f!==n){for(v=[],x=jn();x!==n;)v.push(x),x=jn();v!==n?(i.charCodeAt(m)===34?(x=un,m++):(x=n,R===0&&F(fn)),x!==n?(f=ts(v),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.charCodeAt(m)===39?(f=pn,m++):(f=n,R===0&&F(hn)),f!==n){for(v=[],x=yn();x!==n;)v.push(x),x=yn();v!==n?(i.charCodeAt(m)===39?(x=pn,m++):(x=n,R===0&&F(hn)),x!==n?(f=ts(v),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n)if(c=m,f=m,R++,v=el(),R--,v===n?f=void 0:(m=f,f=n),f!==n){if(v=[],x=wn(),x!==n)for(;x!==n;)v.push(x),x=wn();else v=n;v!==n?(f=ts(v),c=f):(m=c,c=n)}else m=c,c=n}return R--,c===n&&(f=n,R===0&&F(Po)),c}function jn(){var c,f,v;return c=m,f=m,R++,Oo.test(i.charAt(m))?(v=i.charAt(m),m++):(v=n,R===0&&F(Mo)),R--,v===n?f=void 0:(m=f,f=n),f!==n?(i.length>m?(v=i.charAt(m),m++):(v=n,R===0&&F(ss)),v!==n?(f=xt(v),c=f):(m=c,c=n)):(m=c,c=n),c===n&&(c=m,i.charCodeAt(m)===92?(f=mn,m++):(f=n,R===0&&F(gn)),f!==n?(v=bn(),v!==n?(f=xt(v),c=f):(m=c,c=n)):(m=c,c=n)),c}function yn(){var c,f,v;return c=m,f=m,R++,qo.test(i.charAt(m))?(v=i.charAt(m),m++):(v=n,R===0&&F(Ho)),R--,v===n?f=void 0:(m=f,f=n),f!==n?(i.length>m?(v=i.charAt(m),m++):(v=n,R===0&&F(ss)),v!==n?(f=xt(v),c=f):(m=c,c=n)):(m=c,c=n),c===n&&(c=m,i.charCodeAt(m)===92?(f=mn,m++):(f=n,R===0&&F(gn)),f!==n?(v=bn(),v!==n?(f=xt(v),c=f):(m=c,c=n)):(m=c,c=n)),c}function wn(){var c,f,v;return c=m,f=m,R++,v=K(),R--,v===n?f=void 0:(m=f,f=n),f!==n?(i.length>m?(v=i.charAt(m),m++):(v=n,R===0&&F(ss)),v!==n?(f=xt(v),c=f):(m=c,c=n)):(m=c,c=n),c}function bn(){var c,f;return Vo.test(i.charAt(m))?(c=i.charAt(m),m++):(c=n,R===0&&F(Uo)),c===n&&(c=m,i.charCodeAt(m)===110?(f=Bo,m++):(f=n,R===0&&F(Wo)),f!==n&&(f=Ko()),c=f,c===n&&(c=m,i.charCodeAt(m)===114?(f=zo,m++):(f=n,R===0&&F(Go)),f!==n&&(f=Yo()),c=f,c===n&&(c=m,i.charCodeAt(m)===116?(f=Jo,m++):(f=n,R===0&&F(Qo)),f!==n&&(f=Xo()),c=f))),c}function il(c,f){function v(){return c.apply(this,arguments)||f.apply(this,arguments)}return v.desc=c.desc+" or "+f.desc,v}function rl(c,f){function v(){return c.apply(this,arguments)&&f.apply(this,arguments)}return v.desc=c.desc+" and "+f.desc,v}function ol(c){function f(){return!c.apply(this,arguments)}return f.desc="not "+c.desc,f}function ll(c){function f(){return c.apply(this,arguments)}return f.desc="("+c.desc+")",f}function Sn(c){return!0}Sn.desc="all flows";var $n=[new RegExp("text/javascript"),new RegExp("application/x-javascript"),new RegExp("application/javascript"),new RegExp("text/css"),new RegExp("image/.*"),new RegExp("font/.*"),new RegExp("application/font.*")];function Cn(c){if(c.response){for(var f=mt.getContentType(c.response),v=$n.length;v--;)if($n[v].test(f))return!0}return!1}Cn.desc="is asset";function cl(c){c=new RegExp(c,"i");function f(v){return!0}return f.desc="body matches "+c,f}function al(c){c=new RegExp(c,"i");function f(v){return!0}return f.desc="body request matches "+c,f}function dl(c){c=new RegExp(c,"i");function f(v){return!0}return f.desc="body response matches "+c,f}function ul(c){function f(v){return v.response&&v.response.status_code===c}return f.desc="resp. code is "+c,f}function fl(c){c=new RegExp(c,"i");function f(v){return c.test(v.comment)}return f.desc="comment matches "+c,f}function pl(c){c=new RegExp(c,"i");function f(v){return v.request&&(c.test(v.request.host)||c.test(v.request.pretty_host))}return f.desc="domain matches "+c,f}function Nn(c){return c.type==="dns"}Nn.desc="is a DNS Flow";function hl(c){c=new RegExp(c,"i");function f(v){return!!v.server_conn.address&&c.test(v.server_conn.address[0]+":"+v.server_conn.address[1])}return f.desc="destination address matches "+c,f}function kn(c){return!!c.error}kn.desc="has error";function ml(c){c=new RegExp(c,"i");function f(v){return v.request&&ct.match_header(v.request,c)||v.response&&mt.match_header(v.response,c)}return f.desc="header matches "+c,f}function gl(c){c=new RegExp(c,"i");function f(v){return v.request&&ct.match_header(v.request,c)}return f.desc="req. header matches "+c,f}function vl(c){c=new RegExp(c,"i");function f(v){return v.response&&mt.match_header(v.response,c)}return f.desc="resp. header matches "+c,f}function En(c){return c.type==="http"}En.desc="is an HTTP Flow";function Tn(c){return c.marked}Tn.desc="is marked";function xl(c){c=new RegExp(c,"i");function f(v){return c.test(v.marked)}return f.desc="marker matches "+c,f}function _l(c){c=new RegExp(c,"i");function f(v){return v.request&&c.test(v.request.method)}return f.desc="method matches "+c,f}function Rn(c){return c.request&&!c.response}Rn.desc="has no response";function An(c){return c.is_replay==="request"}An.desc="request has been replayed";function Dn(c){return c.is_replay==="response"}Dn.desc="response has been replayed";function Fn(c){return!!c.is_replay}Fn.desc="flow has been replayed";function jl(c){c=new RegExp(c,"i");function f(v){return!!v.client_conn.peername&&c.test(v.client_conn.peername[0]+":"+v.client_conn.peername[1])}return f.desc="source address matches "+c,f}function In(c){return!!c.response}In.desc="has response";function Ln(c){return c.type==="tcp"}Ln.desc="is a TCP Flow";function Pn(c){return c.type==="udp"}Pn.desc="is a UDP Flow";function yl(c){c=new RegExp(c,"i");function f(v){return v.request&&c.test(ct.getContentType(v.request))}return f.desc="req. content type matches "+c,f}function wl(c){c=new RegExp(c,"i");function f(v){return v.response&&c.test(mt.getContentType(v.response))}return f.desc="resp. content type matches "+c,f}function bl(c){c=new RegExp(c,"i");function f(v){return v.request&&c.test(ct.getContentType(v.request))||v.response&&c.test(mt.getContentType(v.response))}return f.desc="content type matches "+c,f}function Sl(c){c=new RegExp(c,"i");function f(v){if(v.type==="dns"){const x=v.request?.questions[0];return x&&c.test(x.name)}return v.request&&c.test(ct.pretty_url(v.request))}return f.desc="url matches "+c,f}function On(c){return!!c.websocket}if(On.desc="is a Websocket Flow",Ft=a(),Ft!==n&&m===i.length)return Ft;throw Ft!==n&&m<i.length&&F({type:"end",description:"end of input"}),Zo(null,ns,Me<i.length?i.charAt(Me):null,Me<i.length?xn(Me,Me+1):xn(Me,Me))}return{SyntaxError:e,parse:s}}();class Ye extends I.Component{static xhr;static doc;constructor(e,s){super(e,s),this.state={doc:Ye.doc}}componentDidMount(){Ye.xhr||(Ye.xhr=ne("/filter-help").then(e=>e.json()),Ye.xhr.catch(()=>{Ye.xhr=null})),this.state.doc||Ye.xhr.then(e=>{Ye.doc=e,this.setState({doc:e})})}render(){const{doc:e}=this.state;return e?o.jsx("table",{className:"table table-condensed",children:o.jsxs("tbody",{children:[e.commands.map(s=>o.jsxs("tr",{onClick:()=>this.props.selectHandler(s[0].split(" ")[0]+" "),children:[o.jsx("td",{children:s[0].replace(" "," ")}),o.jsx("td",{children:s[1]})]},s[1])),o.jsx("tr",{children:o.jsx("td",{colSpan:2,children:o.jsxs("a",{href:"https://mitmproxy.org/docs/latest/concepts-filters/",target:"_blank",rel:"noreferrer",children:[o.jsx("i",{className:"fa fa-external-link"}),"  mitmproxy docs"]})})},"docs-link")]})}):o.jsx("i",{className:"fa fa-spinner fa-spin"})}}var Xt=(t=>(t.SEARCH="search",t.HIGHLIGHT="tag",t.INTERCEPT="pause",t))(Xt||{});class Hs extends I.Component{inputRef=Ee.createRef();constructor(e,s){super(e,s),this.state={value:this.props.value,focus:!1,mousefocus:!1},this.onChange=this.onChange.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onMouseEnter=this.onMouseEnter.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.selectFilter=this.selectFilter.bind(this)}UNSAFE_componentWillReceiveProps(e){this.setState({value:e.value})}isValid(e){try{return e&&oi.parse(e),!0}catch{return!1}}getDesc(){if(!this.state.value)return o.jsx(Ye,{selectHandler:this.selectFilter});try{return oi.parse(this.state.value).desc}catch(e){return""+e}}onChange(e){const s=e.target.value;this.setState({value:s}),this.isValid(s)&&this.props.onChange(s)}onFocus(){this.setState({focus:!0})}onBlur(){this.setState({focus:!1})}onMouseEnter(){this.setState({mousefocus:!0})}onMouseLeave(){this.setState({mousefocus:!1})}onKeyDown(e){(e.key==="Escape"||e.key==="Enter")&&(this.blur(),this.setState({mousefocus:!1})),e.stopPropagation()}selectFilter(e){this.setState({value:e}),this.inputRef.current?.focus()}blur(){this.inputRef.current?.blur()}select(){this.inputRef.current?.select()}render(){const{icon:e,color:s,placeholder:i}=this.props,{value:r,focus:n,mousefocus:l}=this.state;return o.jsxs("div",{className:_e("filter-input input-group",{"has-error":!this.isValid(r)}),children:[o.jsx("span",{className:"input-group-addon",children:o.jsx("i",{className:"fa fa-fw fa-"+e,style:{color:s}})}),o.jsx("input",{type:"text",ref:this.inputRef,placeholder:i,className:"form-control",value:r,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown}),(n||l)&&o.jsxs("div",{className:"popover bottom",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,children:[o.jsx("div",{className:"arrow"}),o.jsx("div",{className:"popover-content",children:this.getDesc()})]})]})}}Zr.title="Flow List";function Zr(){const t=E.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsxs("div",{className:"menu-group",children:[o.jsxs("div",{className:"menu-content",children:[o.jsx(ju,{}),o.jsx(wu,{})]}),o.jsx("div",{className:"menu-legend",children:"Find"})]}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"main-menu",children:[e,o.jsxs("div",{className:"menu-group",children:[o.jsxs("div",{className:"menu-content",children:[o.jsx(xu,{}),o.jsx(Su,{})]}),o.jsx("div",{className:"menu-legend",children:"Intercept"})]})]}),t[1]=s):s=t[1],s}function xu(){const t=E.c(5),e=G(),i=D(_u)||"";let r;t[0]!==e?(r=l=>e(Cs("intercept",l)),t[0]=e,t[1]=r):r=t[1];let n;return t[2]!==i||t[3]!==r?(n=o.jsx(Hs,{value:i,placeholder:"Intercept",icon:Xt.INTERCEPT,color:"hsl(208, 56%, 53%)",onChange:r}),t[2]=i,t[3]=r,t[4]=n):n=t[4],n}function _u(t){return t.options.intercept}function ju(){const t=E.c(5),e=G(),s=D(yu);let i;t[0]!==e?(i=n=>e(Ri(n)),t[0]=e,t[1]=i):i=t[1];let r;return t[2]!==i||t[3]!==s?(r=o.jsx(Hs,{value:s,placeholder:"Search",icon:Xt.SEARCH,color:"black",onChange:i}),t[2]=i,t[3]=s,t[4]=r):r=t[4],r}function yu(t){return t.ui.filter[ge.Search]}function wu(){const t=E.c(5),e=G(),s=D(bu);let i;t[0]!==e?(i=n=>e(Ai(n)),t[0]=e,t[1]=i):i=t[1];let r;return t[2]!==i||t[3]!==s?(r=o.jsx(Hs,{value:s,placeholder:"Highlight",icon:Xt.HIGHLIGHT,color:"hsl(48, 100%, 50%)",onChange:i}),t[2]=i,t[3]=s,t[4]=r):r=t[4],r}function bu(t){return t.ui.filter[ge.Highlight]}function Su(){const t=E.c(2),e=G();let s;return t[0]!==e?(s=o.jsx(ue,{className:"btn-sm",title:"[a]ccept all",icon:"fa-forward text-success",onClick:()=>e(Di()),children:"Resume All"}),t[0]=e,t[1]=s):s=t[1],s}function Vs(t){const e=E.c(6),{value:s,onChange:i,children:r}=t;let n;e[0]!==i||e[1]!==s?(n=o.jsx("input",{type:"checkbox",checked:s,onChange:i}),e[0]=i,e[1]=s,e[2]=n):n=e[2];let l;return e[3]!==r||e[4]!==n?(l=o.jsx("div",{className:"menu-entry",children:o.jsxs("label",{children:[n,r]})}),e[3]=r,e[4]=n,e[5]=l):l=e[5],l}function cs(t){const e=E.c(10),{name:s,children:i}=t,r=G();let n;e[0]!==s?(n=h=>h.options[s],e[0]=s,e[1]=n):n=e[1];const l=D(n),a=!!l;let d;e[2]!==r||e[3]!==s||e[4]!==l?(d=()=>r(Cs(s,!l)),e[2]=r,e[3]=s,e[4]=l,e[5]=d):d=e[5];let u;return e[6]!==i||e[7]!==a||e[8]!==d?(u=o.jsx(Vs,{value:a,onChange:d,children:i}),e[6]=i,e[7]=a,e[8]=d,e[9]=u):u=e[9],u}function $u(){const t=E.c(5),e=G(),s=D(Cu);let i;t[0]!==e?(i=()=>e(Gt()),t[0]=e,t[1]=i):i=t[1];let r;return t[2]!==i||t[3]!==s?(r=o.jsx(Vs,{value:s,onChange:i,children:"Display Event Log"}),t[2]=i,t[3]=s,t[4]=r):r=t[4],r}function Cu(t){return t.eventLog.visible}function Nu(){const t=E.c(5),e=G(),s=D(ku);let i;t[0]!==e?(i=()=>e(Ji()),t[0]=e,t[1]=i):i=t[1];let r;return t[2]!==i||t[3]!==s?(r=o.jsx(Vs,{value:s,onChange:i,children:"Display Command Bar"}),t[2]=i,t[3]=s,t[4]=r):r=t[4],r}function ku(t){return t.commandBar.visible}function as(t){const e=E.c(5),{children:s,resource:i}=t,r=`https://docs.mitmproxy.org/stable/${i}`;let n;e[0]!==s?(n=s||o.jsx("i",{className:"fa fa-question-circle"}),e[0]=s,e[1]=n):n=e[1];let l;return e[2]!==n||e[3]!==r?(l=o.jsx("a",{target:"_blank",href:r,rel:"noreferrer",children:n}),e[2]=n,e[3]=r,e[4]=l):l=e[4],l}eo.title="Options";function eo(){const t=E.c(16),e=G(),s=Eu;let i;t[0]!==e?(i=()=>e(s()),t[0]=e,t[1]=i):i=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("sup",{children:"alpha"}),t[2]=r):r=t[2];let n;t[3]!==i?(n=o.jsx("div",{className:"menu-content",children:o.jsxs(ue,{title:"Open Options",icon:"fa-cogs text-primary",onClick:i,children:["Edit Options ",r]})}),t[3]=i,t[4]=n):n=t[4];let l;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"menu-legend",children:"Options Editor"}),t[5]=l):l=t[5];let a;t[6]!==n?(a=o.jsxs("div",{className:"menu-group",children:[n,l]}),t[6]=n,t[7]=a):a=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsxs(cs,{name:"anticache",children:["Strip cache headers"," ",o.jsx(as,{resource:"overview/features/#anticache"})]}),t[8]=d):d=t[8];let u;t[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs(cs,{name:"showhost",children:["Use host header for display"," ",o.jsx(as,{resource:"concepts/options/#showhost"})]}),t[9]=u):u=t[9];let h;t[10]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsxs("div",{className:"menu-group",children:[o.jsxs("div",{className:"menu-content",children:[d,u,o.jsxs(cs,{name:"ssl_insecure",children:["Don't verify server certificates"," ",o.jsx(as,{resource:"concepts/options/#ssl_insecure"})]})]}),o.jsx("div",{className:"menu-legend",children:"Quick Options"})]}),t[10]=h):h=t[10];let p;t[11]!==a?(p=o.jsxs(gt,{children:[a,h]}),t[11]=a,t[12]=p):p=t[12];let g;t[13]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsxs("div",{className:"menu-group",children:[o.jsxs("div",{className:"menu-content",children:[o.jsx($u,{}),o.jsx(Nu,{})]}),o.jsx("div",{className:"menu-legend",children:"View Options"})]}),t[13]=g):g=t[13];let _;return t[14]!==p?(_=o.jsxs("div",{children:[p,g]}),t[14]=p,t[15]=_):_=t[15],_}function Eu(){return dc("OptionModal")}const yt=async(t,e)=>{const s=(async()=>{const i=await Bt("export",e,`@${t.id}`);if(i.value)return i.value;throw i.error?i.error:i})();try{await gi(s)}catch(i){alert(i)}};to.title="Flow";function to(){const t=E.c(63),e=G(),s=D(Tu),i=s[0];let r;t[0]!==s?(r=s.some(_s),t[0]=s,t[1]=r):r=t[1];const n=r;if(s.length===0){let X;return t[2]===Symbol.for("react.memo_cache_sentinel")?(X=o.jsx("div",{}),t[2]=X):X=t[2],X}let l;t[3]!==e||t[4]!==s?(l=()=>e(ws(s)),t[3]=e,t[4]=s,t[5]=l):l=t[5];let a;t[6]!==s?(a=s.some(xs),t[6]=s,t[7]=a):a=t[7];const d=!a;let u;t[8]!==l||t[9]!==d?(u=o.jsx(ue,{title:"[r]eplay flow",icon:"fa-repeat text-primary",onClick:l,disabled:d,children:"Replay"}),t[8]=l,t[9]=d,t[10]=u):u=t[10];let h;t[11]!==e||t[12]!==s?(h=o.jsx(ue,{title:"[D]uplicate flow",icon:"fa-copy text-info",onClick:()=>e(Li(s)),children:"Duplicate"}),t[11]=e,t[12]=s,t[13]=h):h=t[13];let p;t[14]!==s?(p=s.some(bi),t[14]=s,t[15]=p):p=t[15];const g=!p;let _;t[16]!==e||t[17]!==s?(_=()=>e(Pi(s)),t[16]=e,t[17]=s,t[18]=_):_=t[18];let j;t[19]!==g||t[20]!==_?(j=o.jsx(ue,{disabled:g,title:"revert changes to flow [V]",icon:"fa-history text-warning",onClick:_,children:"Revert"}),t[19]=g,t[20]=_,t[21]=j):j=t[21];let y;t[22]!==e||t[23]!==s?(y=o.jsx(ue,{title:"[d]elete flow",icon:"fa-trash text-danger",onClick:()=>{e(Ii(s))},children:"Delete"}),t[22]=e,t[23]=s,t[24]=y):y=t[24];let w;t[25]!==s?(w=o.jsx(Mu,{flows:s}),t[25]=s,t[26]=w):w=t[26];let $;t[27]!==y||t[28]!==w||t[29]!==u||t[30]!==h||t[31]!==j?($=o.jsxs("div",{className:"menu-content",children:[u,h,j,y,w]}),t[27]=y,t[28]=w,t[29]=u,t[30]=h,t[31]=j,t[32]=$):$=t[32];let N;t[33]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx("div",{className:"menu-legend",children:"Flow Modification"}),t[33]=N):N=t[33];let k;t[34]!==$?(k=o.jsx(gt,{children:o.jsxs("div",{className:"menu-group",children:[$,N]})}),t[34]=$,t[35]=k):k=t[35];let T;t[36]!==i?(T=o.jsxs("div",{className:"menu-content",children:[o.jsx(Ru,{flow:i}),o.jsx(Iu,{flow:i})]}),t[36]=i,t[37]=T):T=t[37];let P;t[38]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx("div",{className:"menu-legend",children:"Export"}),t[38]=P):P=t[38];let L;t[39]!==T?(L=o.jsxs("div",{className:"menu-group",children:[T,P]}),t[39]=T,t[40]=L):L=t[40];const O=!n;let M;t[41]!==e||t[42]!==s?(M=()=>e(ys(s)),t[41]=e,t[42]=s,t[43]=M):M=t[43];let U;t[44]!==O||t[45]!==M?(U=o.jsx(ue,{disabled:O,title:"[a]ccept intercepted flow",icon:"fa-play text-success",onClick:M,children:"Resume"}),t[44]=O,t[45]=M,t[46]=U):U=t[46];const V=!n;let W;t[47]!==e||t[48]!==s?(W=()=>e(Fi(s)),t[47]=e,t[48]=s,t[49]=W):W=t[49];let J;t[50]!==V||t[51]!==W?(J=o.jsx(ue,{disabled:V,title:"kill intercepted flow [x]",icon:"fa-times text-danger",onClick:W,children:"Abort"}),t[50]=V,t[51]=W,t[52]=J):J=t[52];let z;t[53]!==U||t[54]!==J?(z=o.jsxs("div",{className:"menu-content",children:[U,J]}),t[53]=U,t[54]=J,t[55]=z):z=t[55];let te;t[56]===Symbol.for("react.memo_cache_sentinel")?(te=o.jsx("div",{className:"menu-legend",children:"Interception"}),t[56]=te):te=t[56];let Y;t[57]!==z?(Y=o.jsx(gt,{children:o.jsxs("div",{className:"menu-group",children:[z,te]})}),t[57]=z,t[58]=Y):Y=t[58];let Q;return t[59]!==k||t[60]!==L||t[61]!==Y?(Q=o.jsxs("div",{className:"flow-menu",children:[k,L,Y]}),t[59]=k,t[60]=L,t[61]=Y,t[62]=Q):Q=t[62],Q}function Tu(t){return t.flows.selected}const qt=t=>{const e=window.open(t,"_blank","noopener,noreferrer");e&&(e.opener=null)};function Ru(t){const e=E.c(24),{flow:s}=t,i=D(Fu);if(s.type!=="http"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(ue,{icon:"fa-download",onClick:Du,disabled:!0,children:"Download"}),e[0]=r):r=e[0],r}if(s.request.contentLength&&!s.response?.contentLength){let r;e[1]!==s?(r=()=>qt(je.getContentURL(s,s.request)),e[1]=s,e[2]=r):r=e[2];const n=!i;let l;return e[3]!==r||e[4]!==n?(l=o.jsx(ue,{icon:"fa-download",onClick:r,disabled:n,children:"Download"}),e[3]=r,e[4]=n,e[5]=l):l=e[5],l}if(s.response){const r=s.response;if(!s.request.contentLength&&s.response.contentLength){let n;e[6]!==s||e[7]!==r?(n=()=>qt(je.getContentURL(s,r)),e[6]=s,e[7]=r,e[8]=n):n=e[8];const l=!i;let a;return e[9]!==n||e[10]!==l?(a=o.jsx(ue,{icon:"fa-download",onClick:n,disabled:l,children:"Download"}),e[9]=n,e[10]=l,e[11]=a):a=e[11],a}if(s.request.contentLength&&s.response.contentLength){const n=!i;let l;e[12]!==n?(l=o.jsx(ue,{icon:"fa-download",onClick:Au,disabled:n,children:"Download▾"}),e[12]=n,e[13]=l):l=e[13];let a;e[14]===Symbol.for("react.memo_cache_sentinel")?(a={placement:"bottom-start"},e[14]=a):a=e[14];let d;e[15]!==s?(d=o.jsx(Ne,{onClick:()=>qt(je.getContentURL(s,s.request)),children:"Download request"}),e[15]=s,e[16]=d):d=e[16];let u;e[17]!==s||e[18]!==r?(u=o.jsx(Ne,{onClick:()=>qt(je.getContentURL(s,r)),children:"Download response"}),e[17]=s,e[18]=r,e[19]=u):u=e[19];let h;return e[20]!==l||e[21]!==d||e[22]!==u?(h=o.jsxs(Et,{text:l,options:a,children:[d,u]}),e[20]=l,e[21]=d,e[22]=u,e[23]=h):h=e[23],h}}return null}function Au(){return 1}function Du(){return 0}function Fu(t){return t.flows.selected.length===1}function Iu(t){const e=E.c(20),{flow:s}=t,i=D(Pu),r=s.type!=="http"||!i;let n;e[0]!==r?(n=o.jsx(ue,{title:"Export flow.",icon:"fa-clone",onClick:Lu,disabled:r,children:"Export▾"}),e[0]=r,e[1]=n):n=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l={placement:"bottom-start"},e[2]=l):l=e[2];let a;e[3]!==s?(a=o.jsx(Ne,{onClick:()=>yt(s,"raw_request"),children:"Copy raw request"}),e[3]=s,e[4]=a):a=e[4];let d;e[5]!==s?(d=o.jsx(Ne,{onClick:()=>yt(s,"raw_response"),children:"Copy raw response"}),e[5]=s,e[6]=d):d=e[6];let u;e[7]!==s?(u=o.jsx(Ne,{onClick:()=>yt(s,"raw"),children:"Copy raw request and response"}),e[7]=s,e[8]=u):u=e[8];let h;e[9]!==s?(h=o.jsx(Ne,{onClick:()=>yt(s,"curl"),children:"Copy as cURL"}),e[9]=s,e[10]=h):h=e[10];let p;e[11]!==s?(p=o.jsx(Ne,{onClick:()=>yt(s,"httpie"),children:"Copy as HTTPie"}),e[11]=s,e[12]=p):p=e[12];let g;return e[13]!==n||e[14]!==a||e[15]!==d||e[16]!==u||e[17]!==h||e[18]!==p?(g=o.jsxs(Et,{className:"",text:n,options:l,children:[a,d,u,h,p]}),e[13]=n,e[14]=a,e[15]=d,e[16]=u,e[17]=h,e[18]=p,e[19]=g):g=e[19],g}function Lu(){return 1}function Pu(t){return t.flows.selected.length===1}const Ou={":red_circle:":"🔴",":orange_circle:":"🟠",":yellow_circle:":"🟡",":green_circle:":"🟢",":large_blue_circle:":"🔵",":purple_circle:":"🟣",":brown_circle:":"🟤"};function Mu(t){const e=E.c(5),{flows:s}=t,i=G();let r,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(ue,{title:"mark flow",icon:"fa-paint-brush text-success",onClick:qu,children:"Mark▾"}),n={placement:"bottom-start"},e[0]=r,e[1]=n):(r=e[0],n=e[1]);let l;return e[2]!==i||e[3]!==s?(l=o.jsxs(Et,{className:"",text:r,options:n,children:[o.jsx(Ne,{onClick:()=>i(Kn(s,"")),children:"⚪ (no marker)"}),Object.entries(Ou).map(a=>{const[d,u]=a;return o.jsxs(Ne,{onClick:()=>i(Kn(s,d)),children:[u," ",d.replace(/[:_]/g," ")]},d)})]}),e[2]=i,e[3]=s,e[4]=l):l=e[4],l}function qu(){return 1}const li={[ve.Capture]:Xr,[ve.FlowList]:Zr,[ve.Options]:eo,[ve.Flow]:to};function Hu(){const t=E.c(26),e=G(),s=D(Uu),i=D(Vu),[r,n]=I.useState(!1);let l;t[0]!==i.length?(l=[ve.Capture,ve.FlowList,ve.Options],i.length>0&&l.push(ve.Flow),t[0]=i.length,t[1]=l):l=t[1];let a;t[2]!==s||t[3]!==e||t[4]!==i.length||t[5]!==r?(a=()=>{i.length>0&&!r?(e(Vt(ve.Flow)),n(!0)):i.length===0&&(r&&n(!1),s===ve.Flow&&e(Vt(ve.FlowList)))},t[2]=s,t[3]=e,t[4]=i.length,t[5]=r,t[6]=a):a=t[6];let d;t[7]!==s||t[8]!==i||t[9]!==r?(d=[i,r,s],t[7]=s,t[8]=i,t[9]=r,t[10]=d):d=t[10],I.useEffect(a,d);let u;t[11]!==e?(u=function(k,T){T.preventDefault(),e(Vt(k))},t[11]=e,t[12]=u):u=t[12];const h=u,p=li[s];let g;t[13]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(uu,{}),t[13]=g):g=t[13];let _;t[14]!==s||t[15]!==l||t[16]!==h?(_=l.map(N=>o.jsx("a",{href:"#",className:_e({active:N===s}),onClick:k=>h(N,k),children:li[N].title},N)),t[14]=s,t[15]=l,t[16]=h,t[17]=_):_=t[17];let j;t[18]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(gt,{children:o.jsx(mu,{})}),t[18]=j):j=t[18];let y;t[19]!==_?(y=o.jsxs("nav",{className:"nav-tabs nav-tabs-lg",children:[g,_,j]}),t[19]=_,t[20]=y):y=t[20];let w;t[21]!==p?(w=o.jsx("div",{children:o.jsx(p,{})}),t[21]=p,t[22]=w):w=t[22];let $;return t[23]!==y||t[24]!==w?($=o.jsxs("header",{children:[y,w]}),t[23]=y,t[24]=w,t[25]=$):$=t[25],$}function Vu(t){return t.flows.selected}function Uu(t){return t.ui.tabs.current}const ds=function(){function t(i,r){function n(){this.constructor=i}n.prototype=r.prototype,i.prototype=new n}function e(i,r,n,l){this.message=i,this.expected=r,this.found=n,this.location=l,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,e)}t(e,Error);function s(i){var r=arguments.length>1?arguments[1]:{},n={},l={Expr:Te},a=Te,d=function(b,S){return[b,...S]},u=function(b){return[b]},h=function(){return""},p={type:"other",description:"string"},g='"',_={type:"literal",value:'"',description:'"\\""'},j=function(b){return b.join("")},y="'",w={type:"literal",value:"'",description:`"'"`},$=/^["\\]/,N={type:"class",value:'["\\\\]',description:'["\\\\]'},k={type:"any",description:"any character"},T=function(b){return b},P="\\",L={type:"literal",value:"\\",description:'"\\\\"'},O=/^['\\]/,M={type:"class",value:"['\\\\]",description:"['\\\\]"},U=/^['"\\]/,V={type:"class",value:`['"\\\\]`,description:`['"\\\\]`},W="n",J={type:"literal",value:"n",description:'"n"'},z=function(){return`
-`},te="r",Y={type:"literal",value:"r",description:'"r"'},Q=function(){return"\r"},X="t",Z={type:"literal",value:"t",description:'"t"'},de=function(){return"   "},me={type:"other",description:"whitespace"},we=/^[ \t\n\r]/,Be={type:"class",value:"[ \\t\\n\\r]",description:"[ \\t\\n\\r]"},Le={type:"other",description:"control character"},be=/^[|&!()~"]/,ke={type:"class",value:'[|&!()~"]',description:'[|&!()~"]'},C=0,fe=[{line:1,column:1,seenCR:!1}],B=0,oe=[],q=0,Se;if("startRule"in r){if(!(r.startRule in l))throw new Error(`Can't start parsing from rule "`+r.startRule+'".');a=l[r.startRule]}function We(b){var S=fe[b],A,H;if(S)return S;for(A=b-1;!fe[A];)A--;for(S=fe[A],S={line:S.line,column:S.column,seenCR:S.seenCR};A<b;)H=i.charAt(A),H===`
-`?(S.seenCR||S.line++,S.column=1,S.seenCR=!1):H==="\r"||H==="\u2028"||H==="\u2029"?(S.line++,S.column=1,S.seenCR=!0):(S.column++,S.seenCR=!1),A++;return fe[b]=S,S}function Pe(b,S){var A=We(b),H=We(S);return{start:{offset:b,line:A.line,column:A.column},end:{offset:S,line:H.line,column:H.column}}}function ee(b){C<B||(C>B&&(B=C,oe=[]),oe.push(b))}function Oe(b,S,A,H){function Tt($e){var Ae=1;for($e.sort(function(ut,Ke){return ut.description<Ke.description?-1:ut.description>Ke.description?1:0});Ae<$e.length;)$e[Ae-1]===$e[Ae]?$e.splice(Ae,1):Ae++}function es($e,Ae){function ut(At){function ft(De){return De.charCodeAt(0).toString(16).toUpperCase()}return At.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(De){return"\\x0"+ft(De)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(De){return"\\x"+ft(De)}).replace(/[\u0100-\u0FFF]/g,function(De){return"\\u0"+ft(De)}).replace(/[\u1000-\uFFFF]/g,function(De){return"\\u"+ft(De)})}var Ke=new Array($e.length),vt,Rt,it;for(it=0;it<$e.length;it++)Ke[it]=$e[it].description;return vt=$e.length>1?Ke.slice(0,-1).join(", ")+" or "+Ke[$e.length-1]:Ke[0],Rt=Ae?'"'+ut(Ae)+'"':"end of input","Expected "+vt+" but "+Rt+" found."}return S!==null&&Tt(S),new e(es(S,A),S,A,H)}function Te(){var b,S,A,H;if(b=C,S=re(),S!==n){if(A=[],H=Je(),H!==n)for(;H!==n;)A.push(H),H=Je();else A=n;A!==n?(H=Te(),H!==n?(S=d(S,H),b=S):(C=b,b=n)):(C=b,b=n)}else C=b,b=n;if(b===n&&(b=C,S=re(),S!==n&&(S=u(S)),b=S,b===n)){for(b=C,S=[],A=Je();A!==n;)S.push(A),A=Je();S!==n&&(S=h()),b=S}return b}function re(){var b,S,A,H;if(q++,b=C,i.charCodeAt(C)===34?(S=g,C++):(S=n,q===0&&ee(_)),S!==n){for(A=[],H=ce();H!==n;)A.push(H),H=ce();A!==n?(i.charCodeAt(C)===34?(H=g,C++):(H=n,q===0&&ee(_)),H!==n?(S=j(A),b=S):(C=b,b=n)):(C=b,b=n)}else C=b,b=n;if(b===n){if(b=C,i.charCodeAt(C)===39?(S=y,C++):(S=n,q===0&&ee(w)),S!==n){for(A=[],H=he();H!==n;)A.push(H),H=he();A!==n?(i.charCodeAt(C)===39?(H=y,C++):(H=n,q===0&&ee(w)),H!==n?(S=j(A),b=S):(C=b,b=n)):(C=b,b=n)}else C=b,b=n;if(b===n){if(b=C,S=C,q++,A=Zt(),q--,A===n?S=void 0:(C=S,S=n),S!==n){if(A=[],H=Re(),H!==n)for(;H!==n;)A.push(H),H=Re();else A=n;A!==n?(S=j(A),b=S):(C=b,b=n)}else C=b,b=n;if(b===n){if(b=C,i.charCodeAt(C)===34?(S=g,C++):(S=n,q===0&&ee(_)),S!==n){for(A=[],H=ce();H!==n;)A.push(H),H=ce();A!==n?(S=j(A),b=S):(C=b,b=n)}else C=b,b=n;if(b===n)if(b=C,i.charCodeAt(C)===39?(S=y,C++):(S=n,q===0&&ee(w)),S!==n){for(A=[],H=he();H!==n;)A.push(H),H=he();A!==n?(S=j(A),b=S):(C=b,b=n)}else C=b,b=n}}}return q--,b===n&&(S=n,q===0&&ee(p)),b}function ce(){var b,S,A;return b=C,S=C,q++,$.test(i.charAt(C))?(A=i.charAt(C),C++):(A=n,q===0&&ee(N)),q--,A===n?S=void 0:(C=S,S=n),S!==n?(i.length>C?(A=i.charAt(C),C++):(A=n,q===0&&ee(k)),A!==n?(S=T(A),b=S):(C=b,b=n)):(C=b,b=n),b===n&&(b=C,i.charCodeAt(C)===92?(S=P,C++):(S=n,q===0&&ee(L)),S!==n?(A=nt(),A!==n?(S=T(A),b=S):(C=b,b=n)):(C=b,b=n)),b}function he(){var b,S,A;return b=C,S=C,q++,O.test(i.charAt(C))?(A=i.charAt(C),C++):(A=n,q===0&&ee(M)),q--,A===n?S=void 0:(C=S,S=n),S!==n?(i.length>C?(A=i.charAt(C),C++):(A=n,q===0&&ee(k)),A!==n?(S=T(A),b=S):(C=b,b=n)):(C=b,b=n),b===n&&(b=C,i.charCodeAt(C)===92?(S=P,C++):(S=n,q===0&&ee(L)),S!==n?(A=nt(),A!==n?(S=T(A),b=S):(C=b,b=n)):(C=b,b=n)),b}function Re(){var b,S,A;return b=C,S=C,q++,A=Je(),q--,A===n?S=void 0:(C=S,S=n),S!==n?(i.length>C?(A=i.charAt(C),C++):(A=n,q===0&&ee(k)),A!==n?(S=T(A),b=S):(C=b,b=n)):(C=b,b=n),b}function nt(){var b,S;return U.test(i.charAt(C))?(b=i.charAt(C),C++):(b=n,q===0&&ee(V)),b===n&&(b=C,i.charCodeAt(C)===110?(S=W,C++):(S=n,q===0&&ee(J)),S!==n&&(S=z()),b=S,b===n&&(b=C,i.charCodeAt(C)===114?(S=te,C++):(S=n,q===0&&ee(Y)),S!==n&&(S=Q()),b=S,b===n&&(b=C,i.charCodeAt(C)===116?(S=X,C++):(S=n,q===0&&ee(Z)),S!==n&&(S=de()),b=S))),b}function Je(){var b;return q++,we.test(i.charAt(C))?(b=i.charAt(C),C++):(b=n,q===0&&ee(Be)),q--,b===n&&q===0&&ee(me),b}function Zt(){var b;return q++,be.test(i.charAt(C))?(b=i.charAt(C),C++):(b=n,q===0&&ee(ke)),q--,b===n&&q===0&&ee(Le),b}if(Se=a(),Se!==n&&C===i.length)return Se;throw Se!==n&&C<i.length&&ee({type:"end",description:"end of input"}),Oe(null,oe,B<i.length?i.charAt(B):null,B<i.length?Pe(B,B+1):Pe(B,B))}return{SyntaxError:e,parse:s}}();function us(t,e=""){if(!t)return[];const s=[];for(const i of Object.keys(t))i.startsWith(e)&&s.push(i);return s}function Bu(t){const e=E.c(6),{results:s}=t,i=I.useRef(null);let r,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{i&&i.current.addEventListener("DOMNodeInserted",Ku)},n=[],e[0]=r,e[1]=n):(r=e[0],n=e[1]),I.useEffect(r,n);let l;e[2]!==s?(l=s.map(Wu),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==l?(a=o.jsx("div",{className:"command-result",ref:i,children:l}),e[4]=l,e[5]=a):a=e[5],a}function Wu(t,e){return o.jsxs("div",{children:[o.jsx("div",{children:o.jsxs("strong",{children:["$ ",t.command]})}),t.result]},e)}function Ku(t){const e=t.currentTarget;e.scroll({top:e.scrollHeight,behavior:"auto"})}function zu(t){const e=E.c(20),{nextArgs:s,currentArg:i,help:r,description:n,availableCommands:l}=t;let a;if(e[0]!==i||e[1]!==s){a=[];for(let w=0;w<s.length;w++){if(w==i){a.push(o.jsx("mark",{children:s[w]},w));continue}a.push(o.jsxs("span",{children:[s[w]," "]},w))}e[0]=i,e[1]=s,e[2]=a}else a=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"arrow"}),e[3]=d):d=e[3];let u;e[4]!==a?(u=a.length>0&&o.jsxs("div",{children:[o.jsx("strong",{children:"Argument suggestion:"})," ",a]}),e[4]=a,e[5]=u):u=e[5];let h;e[6]!==r?(h=r?.includes("->")&&o.jsxs("div",{children:[o.jsx("strong",{children:"Signature help: "}),r]}),e[6]=r,e[7]=h):h=e[7];let p;e[8]!==n?(p=n&&o.jsxs("div",{children:["# ",n]}),e[8]=n,e[9]=p):p=e[9];let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("strong",{children:"Available Commands: "}),e[10]=g):g=e[10];let _;e[11]!==l?(_=JSON.stringify(l),e[11]=l,e[12]=_):_=e[12];let j;e[13]!==_?(j=o.jsxs("div",{children:[g,o.jsx("p",{className:"available-commands",children:_})]}),e[13]=_,e[14]=j):j=e[14];let y;return e[15]!==u||e[16]!==h||e[17]!==p||e[18]!==j?(y=o.jsxs("div",{className:"argument-suggestion popover top",children:[d,o.jsxs("div",{className:"popover-content",children:[u,h,p,j]})]}),e[15]=u,e[16]=h,e[17]=p,e[18]=j,e[19]=y):y=e[19],y}function Gu(){const t=E.c(45),[e,s]=I.useState(""),[i,r]=I.useState(""),[n,l]=I.useState(0);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[d,u]=I.useState(a);let h;t[1]===Symbol.for("react.memo_cache_sentinel")?(h=[],t[1]=h):h=t[1];const[p,g]=I.useState(h);let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_={},t[2]=_):_=t[2];const[j,y]=I.useState(_);let w;t[3]===Symbol.for("react.memo_cache_sentinel")?(w=[],t[3]=w):w=t[3];const[$,N]=I.useState(w),[k,T]=I.useState(0),[P,L]=I.useState(""),[O,M]=I.useState("");let U;t[4]===Symbol.for("react.memo_cache_sentinel")?(U=[],t[4]=U):U=t[4];const[V,W]=I.useState(U);let J;t[5]===Symbol.for("react.memo_cache_sentinel")?(J=[],t[5]=J):J=t[5];const[z,te]=I.useState(J),[Y,Q]=I.useState(void 0);let X,Z;t[6]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{ne("/commands",{method:"GET"}).then(ef).then(re=>{y(re),u(us(re)),g(Object.keys(re))}).catch(Zu)},Z=[],t[6]=X,t[7]=Z):(X=t[6],Z=t[7]),I.useEffect(X,Z);let de,me;t[8]===Symbol.for("react.memo_cache_sentinel")?(de=()=>{Bt("commands.history.get").then(re=>{te(re.value)}).catch(Xu)},me=[],t[8]=de,t[9]=me):(de=t[8],me=t[9]),I.useEffect(de,me);let we;t[10]!==j?(we=(re,ce)=>{const he=ds.parse(ce),Re=ds.parse(re);L(j[he[0]]?.signature_help),M(j[he[0]]?.help||""),u(us(j,Re[0])),g(us(j,he[0]));const nt=j[he[0]]?.parameters.map(Qu);nt&&(N([he[0],...nt]),T(he.length-1))},t[10]=j,t[11]=we):we=t[11];const Be=we;let Le;t[12]===Symbol.for("react.memo_cache_sentinel")?(Le=re=>{s(re.target.value),r(re.target.value),l(0)},t[12]=Le):Le=t[12];const be=Le;let ke;t[13]!==p||t[14]!==d||t[15]!==n||t[16]!==Y||t[17]!==z||t[18]!==e||t[19]!==V?(ke=re=>{if(re.key==="Enter"){const[ce,...he]=ds.parse(e);te([...z,e]),Bt("commands.history.add",e).catch(Ju),ne.post(`/commands/${ce}`,{arguments:he}).then(Yu).then(Re=>{Q(void 0),N([]),W([...V,{command:e,result:JSON.stringify(Re.value||Re.error)}])}).catch(Re=>{Q(void 0),N([]),W([...V,{command:e,result:Re.toString()}])}),L(""),M(""),s(""),r(""),l(0),u(p)}if(re.key==="ArrowUp"){let ce;Y===void 0?ce=z.length-1:ce=Math.max(0,Y-1),s(z[ce]),r(z[ce]),Q(ce)}if(re.key==="ArrowDown"){if(Y===void 0)return;if(Y==z.length-1)s(""),r(""),Q(void 0);else{const ce=Y+1;s(z[ce]),r(z[ce]),Q(ce)}}re.key==="Tab"&&(s(d[n]),l((n+1)%d.length),re.preventDefault()),re.stopPropagation()},t[13]=p,t[14]=d,t[15]=n,t[16]=Y,t[17]=z,t[18]=e,t[19]=V,t[20]=ke):ke=t[20];const C=ke;let fe;t[21]!==j||t[22]!==e||t[23]!==i||t[24]!==Be?(fe=re=>{if(!e){g(Object.keys(j));return}Be(i,e),re.stopPropagation()},t[21]=j,t[22]=e,t[23]=i,t[24]=Be,t[25]=fe):fe=t[25];const B=fe;let oe;t[26]===Symbol.for("react.memo_cache_sentinel")?(oe=o.jsx("div",{className:"command-title",children:"Command Result"}),t[26]=oe):oe=t[26];let q;t[27]!==V?(q=o.jsx(Bu,{results:V}),t[27]=V,t[28]=q):q=t[28];let Se;t[29]!==p||t[30]!==k||t[31]!==O||t[32]!==$||t[33]!==P?(Se=o.jsx(zu,{nextArgs:$,currentArg:k,help:P,description:O,availableCommands:p}),t[29]=p,t[30]=k,t[31]=O,t[32]=$,t[33]=P,t[34]=Se):Se=t[34];let We;t[35]===Symbol.for("react.memo_cache_sentinel")?(We=_e("command-input input-group"),t[35]=We):We=t[35];let Pe;t[36]===Symbol.for("react.memo_cache_sentinel")?(Pe=o.jsx("span",{className:"input-group-addon",children:o.jsx("i",{className:"fa fa-fw fa-terminal"})}),t[36]=Pe):Pe=t[36];const ee=e||"";let Oe;t[37]!==C||t[38]!==B||t[39]!==ee?(Oe=o.jsxs("div",{className:We,children:[Pe,o.jsx("input",{type:"text",placeholder:"Enter command",className:"form-control",value:ee,onChange:be,onKeyDown:C,onKeyUp:B})]}),t[37]=C,t[38]=B,t[39]=ee,t[40]=Oe):Oe=t[40];let Te;return t[41]!==q||t[42]!==Se||t[43]!==Oe?(Te=o.jsxs("div",{className:"command",children:[oe,q,Se,Oe]}),t[41]=q,t[42]=Se,t[43]=Oe,t[44]=Te):Te=t[44],Te}function Yu(t){return t.json()}function Ju(){return 0}function Qu(t){return t.name}function Xu(t){return console.error(t)}function Zu(t){return console.error(t)}function ef(t){return t.json()}function tf(t){const e=E.c(7),{checked:s,onToggle:i,text:r}=t,n="btn btn-toggle "+(s?"btn-primary":"btn-default"),l="fa fa-fw "+(s?"fa-check-square-o":"fa-square-o");let a;e[0]!==l?(a=o.jsx("i",{className:l}),e[0]=l,e[1]=a):a=e[1];let d;return e[2]!==i||e[3]!==n||e[4]!==a||e[5]!==r?(d=o.jsxs("div",{className:n,onClick:i,children:[a," ",r]}),e[2]=i,e[3]=n,e[4]=a,e[5]=r,e[6]=d):d=e[6],d}class sf extends I.Component{static defaultProps={rowHeight:18};heights;viewport=Ee.createRef();constructor(e){super(e),this.heights={},this.state={vScroll:kt()},this.onViewportUpdate=this.onViewportUpdate.bind(this)}componentDidMount(){window.addEventListener("resize",this.onViewportUpdate),this.onViewportUpdate()}componentWillUnmount(){window.removeEventListener("resize",this.onViewportUpdate)}getSnapshotBeforeUpdate(){return Es(this.viewport)}componentDidUpdate(e,s,i){i&&Jr(this.viewport),this.onViewportUpdate()}onViewportUpdate(){const e=this.viewport.current,s=kt({itemCount:this.props.events.length,rowHeight:this.props.rowHeight,viewportTop:e.scrollTop,viewportHeight:e.offsetHeight,itemHeights:this.props.events.map(i=>this.heights[i.id])});Kt(this.state.vScroll,s)||this.setState({vScroll:s})}setHeight(e,s){if(s&&!this.heights[e]){const i=s.offsetHeight;this.heights[e]!==i&&(this.heights[e]=i,this.onViewportUpdate())}}render(){const{vScroll:e}=this.state,{events:s}=this.props;return o.jsxs("pre",{ref:this.viewport,onScroll:this.onViewportUpdate,children:[o.jsx("div",{style:{height:e.paddingTop}}),s.slice(e.start,e.end).map(i=>o.jsxs("div",{ref:r=>{this.setHeight(i.id,r)},children:[o.jsx(nf,{event:i}),i.message]},i.id)),o.jsx("div",{style:{height:e.paddingBottom}})]})}}function nf(t){const e=E.c(4),{event:s}=t;let i;e[0]!==s.level?(i={web:"html5",debug:"bug",warn:"exclamation-triangle",error:"ban"}[s.level]||"info",e[0]=s.level,e[1]=i):i=e[1];const n=`fa fa-fw fa-${i}`;let l;return e[2]!==n?(l=o.jsx("i",{className:n}),e[2]=n,e[3]=l):l=e[3],l}class rf extends I.Component{static defaultProps={defaultHeight:200};dragStart;constructor(e,s){super(e,s),this.state={height:this.props.defaultHeight},this.onDragStart=this.onDragStart.bind(this),this.onDragMove=this.onDragMove.bind(this),this.onDragStop=this.onDragStop.bind(this)}onDragStart(e){e.preventDefault(),this.dragStart=this.state.height+e.pageY,window.addEventListener("mousemove",this.onDragMove),window.addEventListener("mouseup",this.onDragStop),window.addEventListener("dragend",this.onDragStop)}onDragMove(e){e.preventDefault(),this.setState({height:this.dragStart-e.pageY})}onDragStop(e){e.preventDefault(),window.removeEventListener("mousemove",this.onDragMove)}render(){const{height:e}=this.state,{filters:s,events:i,toggleFilter:r,close:n}=this.props;return o.jsxs("div",{className:"eventlog",style:{height:e},children:[o.jsxs("div",{onMouseDown:this.onDragStart,children:["Eventlog",o.jsxs("div",{className:"pull-right",children:[Object.values(Gi).map(l=>o.jsx(tf,{text:l,checked:s[l],onToggle:()=>r(l)},l)),o.jsx("i",{onClick:n,className:"fa fa-close"})]})]}),o.jsx(sf,{events:i})]})}}const of=zt(t=>({filters:t.eventLog.filters,events:t.eventLog.view}),{close:Gt,toggleFilter:zi})(rf);function lf(){const t=E.c(52),e=D(af),{mode:s,intercept:i,showhost:r,upstream_cert:n,rawtcp:l,http2:a,websocket:d,anticache:u,anticomp:h,stickyauth:p,stickycookie:g,stream_large_bodies:_,listen_host:j,listen_port:y,server:w,ssl_insecure:$}=D(cf);let N;t[0]!==s?(N=s&&(s.length!==1||s[0]!=="regular")&&o.jsx("span",{className:"label label-success",children:s.join(",")}),t[0]=s,t[1]=N):N=t[1];let k;t[2]!==i?(k=i&&o.jsxs("span",{className:"label label-success",children:["Intercept: ",i]}),t[2]=i,t[3]=k):k=t[3];let T;t[4]!==$?(T=$&&o.jsx("span",{className:"label label-danger",children:"ssl_insecure"}),t[4]=$,t[5]=T):T=t[5];let P;t[6]!==r?(P=r&&o.jsx("span",{className:"label label-success",children:"showhost"}),t[6]=r,t[7]=P):P=t[7];let L;t[8]!==n?(L=!n&&o.jsx("span",{className:"label label-success",children:"no-upstream-cert"}),t[8]=n,t[9]=L):L=t[9];let O;t[10]!==l?(O=!l&&o.jsx("span",{className:"label label-success",children:"no-raw-tcp"}),t[10]=l,t[11]=O):O=t[11];let M;t[12]!==a?(M=!a&&o.jsx("span",{className:"label label-success",children:"no-http2"}),t[12]=a,t[13]=M):M=t[13];let U;t[14]!==d?(U=!d&&o.jsx("span",{className:"label label-success",children:"no-websocket"}),t[14]=d,t[15]=U):U=t[15];let V;t[16]!==u?(V=u&&o.jsx("span",{className:"label label-success",children:"anticache"}),t[16]=u,t[17]=V):V=t[17];let W;t[18]!==h?(W=h&&o.jsx("span",{className:"label label-success",children:"anticomp"}),t[18]=h,t[19]=W):W=t[19];let J;t[20]!==p?(J=p&&o.jsxs("span",{className:"label label-success",children:["stickyauth: ",p]}),t[20]=p,t[21]=J):J=t[21];let z;t[22]!==g?(z=g&&o.jsxs("span",{className:"label label-success",children:["stickycookie: ",g]}),t[22]=g,t[23]=z):z=t[23];let te;t[24]!==_?(te=_&&o.jsxs("span",{className:"label label-success",children:["stream: ",hi(_)]}),t[24]=_,t[25]=te):te=t[25];let Y;t[26]!==j||t[27]!==y||t[28]!==w?(Y=w&&o.jsxs("span",{className:"label label-primary",title:"HTTP Proxy Server Address",children:[j||"*",":",y||8080]}),t[26]=j,t[27]=y,t[28]=w,t[29]=Y):Y=t[29];let Q;t[30]!==Y?(Q=o.jsx(gt,{children:Y}),t[30]=Y,t[31]=Q):Q=t[31];let X;t[32]!==e?(X=o.jsxs("span",{className:"label label-default",title:"Mitmproxy Version",children:["mitmproxy ",e]}),t[32]=e,t[33]=X):X=t[33];let Z;t[34]!==Q||t[35]!==X?(Z=o.jsxs("div",{className:"pull-right",children:[Q,X]}),t[34]=Q,t[35]=X,t[36]=Z):Z=t[36];let de;return t[37]!==N||t[38]!==k||t[39]!==J||t[40]!==z||t[41]!==te||t[42]!==Z||t[43]!==T||t[44]!==P||t[45]!==L||t[46]!==O||t[47]!==M||t[48]!==U||t[49]!==V||t[50]!==W?(de=o.jsxs("footer",{children:[N,k,T,P,L,O,M,U,V,W,J,z,te,Z]}),t[37]=N,t[38]=k,t[39]=J,t[40]=z,t[41]=te,t[42]=Z,t[43]=T,t[44]=P,t[45]=L,t[46]=O,t[47]=M,t[48]=U,t[49]=V,t[50]=W,t[51]=de):de=t[51],de}function cf(t){return t.options}function af(t){return t.backendState.version}function df(t){const e=E.c(3),{children:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"modal-backdrop fade in"}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsxs("div",{children:[i,o.jsx("div",{className:"modal modal-visible",id:"optionsModal",tabIndex:-1,role:"dialog","aria-labelledby":"options",children:o.jsx("div",{className:"modal-dialog modal-lg",role:"document",children:o.jsx("div",{className:"modal-content",children:s})})})]}),e[1]=s,e[2]=r):r=e[2],r}const uf=t=>{t.key!=="Escape"&&t.stopPropagation()};function so(t){const e=E.c(10);let s,i,r;e[0]!==t?({value:r,onChange:s,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);let n;e[4]!==s?(n=a=>s(a.target.checked),e[4]=s,e[5]=n):n=e[5];let l;return e[6]!==i||e[7]!==n||e[8]!==r?(l=o.jsx("div",{className:"checkbox",children:o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:r,onChange:n,...i}),"Enable"]})}),e[6]=i,e[7]=n,e[8]=r,e[9]=l):l=e[9],l}function ci(t){const e=E.c(10);let s,i,r;e[0]!==t?({value:r,onChange:s,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);const n=r||"";let l;e[4]!==s?(l=d=>s(d.target.value),e[4]=s,e[5]=l):l=e[5];let a;return e[6]!==i||e[7]!==n||e[8]!==l?(a=o.jsx("input",{type:"text",value:n,onChange:l,...i}),e[6]=i,e[7]=n,e[8]=l,e[9]=a):a=e[9],a}function ai(t){return function({onChange:s,...i}){return o.jsx(t,{onChange:r=>s(r||null),...i})}}function di(t){const e=E.c(10);let s,i,r;e[0]!==t?({value:r,onChange:s,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);let n;e[4]!==s?(n=a=>s(parseInt(a.target.value)),e[4]=s,e[5]=n):n=e[5];let l;return e[6]!==i||e[7]!==n||e[8]!==r?(l=o.jsx("input",{type:"number",value:r,onChange:n,...i}),e[6]=i,e[7]=n,e[8]=r,e[9]=l):l=e[9],l}function ff(t){const e=E.c(12);let s,i,r,n;if(e[0]!==t){const{value:d,onChange:u,choices:h,...p}=t;n=d,s=h,i=p,r=g=>u(g.target.value),e[0]=t,e[1]=s,e[2]=i,e[3]=r,e[4]=n}else s=e[1],i=e[2],r=e[3],n=e[4];let l;e[5]!==s?(l=s.map(pf),e[5]=s,e[6]=l):l=e[6];let a;return e[7]!==i||e[8]!==r||e[9]!==l||e[10]!==n?(a=o.jsx("select",{onChange:r,value:n,...i,children:l}),e[7]=i,e[8]=r,e[9]=l,e[10]=n,e[11]=a):a=e[11],a}function pf(t){return o.jsx("option",{value:t,children:t},t)}function hf(t){const e=E.c(13);let s,i,r;e[0]!==t?({value:r,onChange:s,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);const n=Math.max(r.length,1);let l;e[4]!==r?(l=r.join(`
-`),e[4]=r,e[5]=l):l=e[5];const[a,d]=Ee.useState(l);let u;e[6]!==s?(u=g=>{const _=g.target.value;d(_),s(_.split(`
-`).map(gf).filter(mf))},e[6]=s,e[7]=u):u=e[7];const h=u;let p;return e[8]!==h||e[9]!==n||e[10]!==i||e[11]!==a?(p=o.jsx("textarea",{rows:n,value:a,onChange:h,...i}),e[8]=h,e[9]=n,e[10]=i,e[11]=a,e[12]=p):p=e[12],p}function mf(t){return t!==""}function gf(t){return t.trim()}const vf={bool:so,str:ci,int:di,"optional str":ai(ci),"optional int":ai(di),"sequence of str":hf};function xf(t){const e=E.c(16),{choices:s,type:i,value:r,onChange:n,name:l,error:a}=t;let d,u;if(e[0]!==d||e[1]!==s||e[2]!==n||e[3]!==i||e[4]!==r){if(u={onChange:n,value:r},s)d=ff,u.choices=s;else if(d=vf[i],!d)throw`unknown option type ${i}`;d!==so&&(u.className="form-control"),e[0]=d,e[1]=s,e[2]=n,e[3]=i,e[4]=r,e[5]=u,e[6]=d}else u=e[5],d=e[6];let h;e[7]!==a?(h=_e({"has-error":a}),e[7]=a,e[8]=h):h=e[8];let p;e[9]!==d||e[10]!==l||e[11]!==u?(p=o.jsx(d,{name:l,onKeyDown:uf,...u}),e[9]=d,e[10]=l,e[11]=u,e[12]=p):p=e[12];let g;return e[13]!==h||e[14]!==p?(g=o.jsx("div",{className:h,children:p}),e[13]=h,e[14]=p,e[15]=g):g=e[15],g}function _f(t){const e=E.c(18),{name:s}=t,i=G();let r;e[0]!==s?(r=j=>j.options_meta[s]?.choices,e[0]=s,e[1]=r):r=e[1];const n=D(r);let l;e[2]!==s?(l=j=>j.options_meta[s]?.type,e[2]=s,e[3]=l):l=e[3];const a=D(l);let d;e[4]!==s?(d=j=>{const y=j.ui.optionsEditor[s];return y?y.value:j.options_meta[s]?.value},e[4]=s,e[5]=d):d=e[5];const u=D(d);let h;e[6]!==s?(h=j=>j.ui.optionsEditor[s]?.error,e[6]=s,e[7]=h):h=e[7];const p=D(h);let g;e[8]!==i||e[9]!==s?(g=j=>i(Cs(s,j)),e[8]=i,e[9]=s,e[10]=g):g=e[10];let _;return e[11]!==n||e[12]!==p||e[13]!==s||e[14]!==g||e[15]!==a||e[16]!==u?(_=o.jsx(xf,{name:s,choices:n,type:a,value:u,error:p,onChange:g}),e[11]=n,e[12]=p,e[13]=s,e[14]=g,e[15]=a,e[16]=u,e[17]=_):_=e[17],_}function jf(t){const e=E.c(4),{name:s}=t;let i;e[0]!==s?(i=l=>l.options_meta[s]?.help,e[0]=s,e[1]=i):i=e[1];const r=D(i);let n;return e[2]!==r?(n=o.jsx("div",{className:"help-block small",children:r}),e[2]=r,e[3]=n):n=e[3],n}function yf(t){const e=E.c(4),{name:s}=t;let i;e[0]!==s?(i=l=>l.options_meta[s]?.error,e[0]=s,e[1]=i):i=e[1];const r=D(i);if(!r)return null;let n;return e[2]!==r?(n=o.jsx("div",{className:"small text-danger",children:r}),e[2]=r,e[3]=n):n=e[3],n}function wf(t){const e=E.c(2);let{value:s,defaultVal:i}=t;if(s===i)return null;{if(typeof i=="boolean")i=i?"true":"false";else if(Array.isArray(i)){if(Ht.isEmpty(Ht.compact(s))&&Ht.isEmpty(i))return null;i="[ ]"}else i===""?i='""':i===null&&(i="null");let r;return e[0]!==i?(r=o.jsxs("div",{className:"small",children:["Default: ",o.jsxs("strong",{children:[" ",i," "]})," "]}),e[0]=i,e[1]=r):r=e[1],r}}const bf=zt((t,{name:e})=>({value:t.options[e],defaultVal:t.options_meta[e]?.default}))(wf);function Sf(){const t=E.c(24),e=G(),s=D(Cf,Kt);let i,r,n,l;if(t[0]!==e||t[1]!==s){const p=s.sort();let g;t[6]!==e?(g=()=>e(Wi()),t[6]=e,t[7]=g):g=t[7];let _;t[8]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("i",{className:"fa fa-fw fa-times"}),t[8]=_):_=t[8];let j;t[9]!==g?(j=o.jsx("button",{type:"button",className:"close","data-dismiss":"modal",onClick:g,children:_}),t[9]=g,t[10]=j):j=t[10];let y;t[11]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("div",{className:"modal-title",children:o.jsx("h4",{children:"Options"})}),t[11]=y):y=t[11],t[12]!==j?(l=o.jsxs("div",{className:"modal-header",children:[j,y]}),t[12]=j,t[13]=l):l=t[13],n="modal-body",i="form-horizontal",r=p.map($f),t[0]=e,t[1]=s,t[2]=i,t[3]=r,t[4]=n,t[5]=l}else i=t[2],r=t[3],n=t[4],l=t[5];let a;t[14]!==i||t[15]!==r?(a=o.jsx("div",{className:i,children:r}),t[14]=i,t[15]=r,t[16]=a):a=t[16];let d;t[17]!==n||t[18]!==a?(d=o.jsx("div",{className:n,children:a}),t[17]=n,t[18]=a,t[19]=d):d=t[19];let u;t[20]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"modal-footer"}),t[20]=u):u=t[20];let h;return t[21]!==l||t[22]!==d?(h=o.jsxs("div",{children:[l,d,u]}),t[21]=l,t[22]=d,t[23]=h):h=t[23],h}function $f(t){return o.jsxs("div",{className:"form-group",children:[o.jsxs("div",{className:"col-xs-6",children:[o.jsx("label",{htmlFor:t,children:t}),o.jsx(jf,{name:t})]}),o.jsxs("div",{className:"col-xs-6",children:[o.jsx(_f,{name:t}),o.jsx(yf,{name:t}),o.jsx(bf,{name:t})]})]},t)}function Cf(t){return Object.keys(t.options_meta)}function Nf(){const t=E.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(df,{children:o.jsx(Sf,{})}),t[0]=e):e=t[0],e}const kf={OptionModal:Nf};function Ef(){const t=E.c(3),e=D(Tf),s=e?kf[e]:void 0;if(s){let i;return t[0]!==s?(i=o.jsx(s,{}),t[0]=s,t[1]=i):i=t[1],i}else{let i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(o.Fragment,{}),t[2]=i):i=t[2],i}}function Tf(t){return t.ui.modal.activeModal}class Rf extends I.Component{state={};render=()=>{const{showEventLog:e,showCommandBar:s}=this.props;return this.state.error?(console.log("ERR",this.state),o.jsxs("div",{className:"container",children:[o.jsx("h1",{children:"mitmproxy has crashed."}),o.jsxs("pre",{children:[this.state.error.stack,o.jsx("br",{}),o.jsx("br",{}),"Component Stack:",this.state.errorInfo?.componentStack]}),o.jsxs("p",{children:["Please lodge a bug report at"," ",o.jsx("a",{href:"https://github.com/mitmproxy/mitmproxy/issues",children:"https://github.com/mitmproxy/mitmproxy/issues"}),"."]})]})):o.jsxs("div",{id:"container",tabIndex:0,children:[o.jsx(Hu,{}),o.jsx(lu,{}),s&&o.jsx(Gu,{},"commandbar"),e&&o.jsx(of,{},"eventlog"),o.jsx(lf,{}),o.jsx(Ef,{})]})};componentDidMount(){window.addEventListener("keydown",this.props.onKeyDown)}componentWillUnmount(){window.removeEventListener("keydown",this.props.onKeyDown)}componentDidCatch(e,s){this.setState({error:e,errorInfo:s})}}const Af=zt(t=>({showEventLog:t.eventLog.visible,showCommandBar:t.commandBar.visible}),{onKeyDown:od})(Rf),Ze={SEARCH:"s",HIGHLIGHT:"h",SHOW_EVENTLOG:"e",SHOW_COMMANDBAR:"c"};function Df(t){const[e,s]=window.location.hash.substr(1).split("?",2),i=e.substr(1).split("/");if(i[0]==="flows"){if(i.length==3){const[r,n]=i.slice(1);t.dispatch(Ut(n));const l=()=>{const d=t.getState().flows.byId.get(r);d!==void 0&&(a(),t.dispatch(He([d])))},a=t.subscribe(l);l()}}else i[0]==="capture"&&t.dispatch(Vt(ve.Capture));s&&s.split("&").forEach(r=>{const[n,l]=r.split("=",2),a=decodeURIComponent(l);switch(n){case Ze.SEARCH:t.dispatch(Ri(a));break;case Ze.HIGHLIGHT:t.dispatch(Ai(a));break;case Ze.SHOW_EVENTLOG:t.getState().eventLog.visible||t.dispatch(Gt());break;case Ze.SHOW_COMMANDBAR:t.getState().commandBar.visible||t.dispatch(Ji());break;default:console.error(`unimplemented query arg: ${r}`)}})}function Ff(t){const e=t.getState(),s={[Ze.SEARCH]:e.ui.filter[ge.Search],[Ze.HIGHLIGHT]:e.ui.filter[ge.Highlight],[Ze.SHOW_EVENTLOG]:e.eventLog.visible,[Ze.SHOW_COMMANDBAR]:e.commandBar.visible},i=Object.keys(s).filter(l=>s[l]).map(l=>`${l}=${encodeURIComponent(s[l])}`).join("&");let r;e.ui.tabs.current===ve.Capture?r="/capture":e.flows.selected.length>0?r=`/flows/${e.flows.selected[0].id}/${e.ui.flow.tab}`:r="/flows",i&&(r+="?"+i);let n=window.location.pathname;n==="blank"&&(n="/"),window.location.hash.substr(1)!==r&&history.replaceState(void 0,"",`${n}#${r}`)}function If(t){Df(t),t.subscribe(()=>Ff(t))}var lt=(t=>(t.State="state",t.Flows="flows",t.Events="events",t.Options="options",t))(lt||{});class Lf{activeFetches;store;filterState;socket;messageQueue;constructor(e){this.activeFetches={},this.store=e,this.filterState=Ti,this.messageQueue=[],this.connect(),this.store.subscribe(this.onStoreUpdate.bind(this))}connect(){this.socket=new WebSocket(location.origin.replace("http","ws")+location.pathname.replace(/\/$/,"")+"/updates"),this.socket.addEventListener("open",()=>this.onOpen()),this.socket.addEventListener("close",e=>this.onClose(e)),this.socket.addEventListener("message",e=>this.onMessage(JSON.parse(e.data))),this.socket.addEventListener("error",e=>this.onError(e))}async onOpen(){for(const e of this.messageQueue)this.socket.send(JSON.stringify(e));this.messageQueue=[],this.store.dispatch(Cc()),await Promise.all([this.fetchData("state"),this.fetchData("flows"),this.fetchData("events"),this.fetchData("options")]),this.store.dispatch(Nc())}onStoreUpdate(){const e=this.store.getState().ui.filter;if(e!==this.filterState){for(const s of Object.values(ge))this.filterState[s]!==e[s]&&this.sendMessage({type:"flows/updateFilter",payload:{name:s,expr:e[s]}});this.filterState=e}}fetchData(e){const s=[];return this.activeFetches[e]=s,ne(`./${e}`).then(i=>i.json()).then(i=>{this.activeFetches[e]===s&&this.receive(e,i)})}onMessage(e){switch(e.type){case"flows/add":return this.queueOrDispatch("flows",Mi(e.payload));case"flows/update":return this.queueOrDispatch("flows",qi(e.payload));case"flows/filterUpdate":return this.queueOrDispatch("flows",Vi(e.payload));case"flows/remove":return this.queueOrDispatch("flows",Hi(e.payload));case"events/add":return this.queueOrDispatch("events",Ss(e.payload));case"options/update":return this.queueOrDispatch("options",$s(e.payload));case"state/update":return this.queueOrDispatch("state",Ue(e.payload));case"flows/reset":return this.fetchData("flows");case"events/reset":return this.fetchData("events");default:Ct(e.type)}}sendMessage(e){this.socket.readyState===WebSocket.OPEN?this.socket.send(JSON.stringify(e)):this.socket.readyState===WebSocket.CONNECTING?this.messageQueue.push(e):console.error("WebSocket is not open. Cannot send:",e)}queueOrDispatch(e,s){const i=this.activeFetches[e];i!==void 0?i.push(s):this.store.dispatch(s)}receive(e,s){switch(e){case"state":this.store.dispatch(Ve(s));break;case"options":this.store.dispatch(Yt(s));break;case"events":this.store.dispatch(Ki(s));break;case"flows":this.store.dispatch(bs(s));break;default:Ct(e)}const i=this.activeFetches[e];delete this.activeFetches[e],i.forEach(r=>this.store.dispatch(r))}onClose(e){this.store.dispatch(kc(`Connection closed at ${new Date().toUTCString()} with error code ${e.code}.`)),console.error("websocket connection closed",e)}onError(...e){console.error("websocket connection errored",e)}}class Pf{store;constructor(e){this.store=e,this.onOpen()}onOpen(){this.fetchData(lt.Flows),this.fetchData(lt.Options)}fetchData(e){ne(`./${e}`).then(s=>s.json()).then(s=>{this.receive(e,s)})}receive(e,s){switch(e){case lt.Flows:this.store.dispatch(bs(s));break;case lt.Options:this.store.dispatch(Yt(s));break;case lt.State:throw"unreachable";case lt.Events:throw"unreachable";default:Ct(e)}}}window.MITMWEB_STATIC?window.backend=new Pf(Nt):window.backend=new Lf(Nt);If(Nt);window.addEventListener("error",t=>{Nt.dispatch(hc(`${t.message}
-${t.error.stack}`))});document.addEventListener("DOMContentLoaded",()=>{const t=document.getElementById("mitmproxy");Pl.createRoot(t).render(o.jsx(Ol,{store:Nt,children:o.jsx(Af,{})}))});
diff --git a/mitmproxy/tools/web/static/index-Bt--WL1e.js b/mitmproxy/tools/web/static/index-Bt--WL1e.js
new file mode 100644 (file)
index 0000000..aeaccff
--- /dev/null
@@ -0,0 +1,10 @@
+import{c as ae,R as Cl,a as xe,r as I,b as Ee,d as _e,j as o,e as E,f as ui,u as Nl,g as kl,h as fi,s as Kt,i as El,l as Ht,k as Tl,m as Rl,n as Al,y as Dl,o as Fl,p as Il,q as zt,Q as Ll,t as Pl,P as Ol}from"./vendor-BS4xPthR.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const l of n.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function s(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(r){if(r.ep)return;r.ep=!0;const n=s(r);fetch(r.href,n)}})();const Ml={tab:"request",contentViewFor:{}},ql=ae({name:"ui/flow",initialState:Ml,reducers:{selectTab(t,e){t.tab=e.payload},setContentViewFor(t,e){t.contentViewFor[e.payload.messageId]=e.payload.contentView}}}),{actions:Hl,reducer:Vl}=ql,{selectTab:Ut,setContentViewFor:pi}=Hl;window.React=Cl;const hi=function(t){if(t===0)return"0";const e=["b","kb","mb","gb","tb"];let s=0;for(;s<e.length&&!(Math.pow(1024,s+1)>t);s++);let i;return t%Math.pow(1024,s)===0?i=0:i=1,(t/Math.pow(1024,s)).toFixed(i)+e[s]},mi=function(t){let e=t;const s=["ms","s","min","h"],i=[1e3,60,60];let r=0;for(;Math.abs(e)>=i[r]&&r<i.length;)e=e/i[r],r++;return Math.round(e)+s[r]},at=function(t,{includeMilliseconds:e=!0}={}){const s=new Date(t*1e3),i=String(s.getFullYear()),r=String(s.getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0"),l=String(s.getHours()).padStart(2,"0"),a=String(s.getMinutes()).padStart(2,"0"),d=String(s.getSeconds()).padStart(2,"0"),u=String(s.getMilliseconds()).padStart(3,"0");let h=`${i}-${r}-${n} ${l}:${a}:${d}`;return e&&(h+=`.${u}`),h};function Hn(t){return t[0].includes(":")?`[${t[0]}]:${t[1]}`:`${t[0]}:${t[1]}`}function Ul(t){const e=document.cookie.match(new RegExp("\\b"+t+"=([^;]*)\\b"));return e?e[1]:void 0}let fs=()=>{const t=Ul("_xsrf");return fs=()=>t,fs()};function ne(t,e={}){return e.method&&e.method!=="GET"&&(e.headers=e.headers||{},e.headers["X-XSRFToken"]=fs()),t.startsWith("/")&&(t="."+t),fetch(t,{credentials:"same-origin",...e})}ne.put=(t,e,s={})=>ne(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),...s});ne.post=(t,e,s={})=>ne(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),...s});async function Bt(t,...e){return await(await ne(`/commands/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({arguments:e})})).json()}async function gi(t){try{await navigator.clipboard.write([new ClipboardItem({"text/plain":t})]);return}catch(i){console.warn(i)}const e=await t;try{await navigator.clipboard.writeText(e);return}catch(i){console.warn(i)}const s=document.createElement("textarea");s.value=e,s.style.position="absolute",s.style.opacity="0",document.body.appendChild(s);try{if(s.focus(),s.select(),!document.execCommand("copy"))throw"failed to copy"}catch{alert(e)}finally{s.remove()}}async function Bl(t){await gi(Promise.resolve(t?.text||""))}function ps(t,e){const s=t.lastIndexOf(e);if(s===-1)return["",t];const i=t.slice(0,s),r=t.slice(s+e.length);return[i,r]}function vi(t,e){const s=t.indexOf(e);if(s===-1)return[t,""];const i=t.slice(0,s),r=t.slice(s+e.length);return[i,r]}function Ct(t){throw new Error(`Unreachable: ${JSON.stringify(t)}`)}const xi={http:80,https:443},Vn=new WeakMap;class je{static getContentType(e){const s=je.get_first_header(e,/^Content-Type$/i);if(s)return s.split(";")[0].trim()}static get_first_header(e,s){let i=Vn.get(e);i||(i=new Map,Vn.set(e,i));let r=i.get(s);if(r===void 0){const n=e.headers.find(([l,a])=>s.test(l));r=n?n[1]:!1,i.set(s,r)}return r!==!1?r:void 0}static match_header(e,s){const i=e.headers;if(!i)return!1;let r=i.length;for(;r--;)if(s.test(i[r].join(" ")))return i[r];return!1}static getContentURL(e,s,i,r){e.type==="http"&&s===e.request?s="request":e.type==="http"&&s===e.response&&(s="response");const n=r?`?lines=${r}`:"";return`./flows/${e.id}/${s}/`+(i?`content/${encodeURIComponent(i)}.json${n}`:"content.data")}}class ct extends je{static pretty_url(e){let s="";return xi[e.scheme]!==e.port&&(s=":"+e.port),e.scheme+"://"+e.pretty_host+s+e.path}}class mt extends je{}const Wl=/^(?:(https?):\/\/)?([^/:]+)?(?::(\d+))?(\/.*)?$/i,_i=function(t){const e=Wl.exec(t);if(!e)return;const s=e[1],i=e[2],r=parseInt(e[3]),n=e[4],l=s?r||xi[s]:r,a={};return s&&(a.scheme=s),i&&(a.host=i),l&&(a.port=l),n&&(a.path=n),a},Kl=/^HTTP\/\d+(\.\d+)*$/i,ji=function(t){return Kl.test(t)};function Wt(t){switch(t.type){case"http":return t.request.timestamp_start;case"tcp":case"udp":return t.client_conn.timestamp_start;case"dns":return t.request.timestamp}}function yi(t){switch(t.type){case"http":if(t.websocket){if(t.websocket.timestamp_end)return t.websocket.timestamp_end;if(t.websocket.messages_meta.timestamp_last)return t.websocket.messages_meta.timestamp_last}return t.response?t.response.timestamp_end:void 0;case"tcp":return t.server_conn?.timestamp_end;case"udp":return t.messages_meta.timestamp_last;case"dns":return t.response?.timestamp}}const wi=t=>{switch(t.type){case"http":{let e=t.request.contentLength||0;return t.response&&(e+=t.response.contentLength||0),t.websocket&&(e+=t.websocket.messages_meta.contentLength||0),e}case"tcp":case"udp":return t.messages_meta.contentLength||0;case"dns":return t.response?.size??0}},xs=t=>t.type==="http"&&!t.websocket,bi=t=>t.modified,_s=t=>t.intercepted,Si=t=>{if(t.type!=="http")return t.client_conn.tls_version==="QUICv1"?"resource-icon-quic":`resource-icon-${t.type}`;if(t.websocket)return"resource-icon-websocket";if(!t.response)return"resource-icon-plain";const e=mt.getContentType(t.response)||"";return t.response.status_code===304?"resource-icon-not-modified":300<=t.response.status_code&&t.response.status_code<400?"resource-icon-redirect":e.indexOf("image")>=0?"resource-icon-image":e.indexOf("javascript")>=0?"resource-icon-js":e.indexOf("css")>=0?"resource-icon-css":e.indexOf("html")>=0?"resource-icon-document":"resource-icon-plain"},$i=t=>{switch(t.type){case"http":return ct.pretty_url(t.request);case"tcp":case"udp":return`${t.client_conn.peername.join(":")} ↔ ${t.server_conn?.address?.join(":")}`;case"dns":return`${t.request.questions.map(e=>`${e.name} ${e.type}`).join(", ")} = ${(t.response?.answers.map(e=>e.data).join(", ")??"...")||"?"}`}},Ci=t=>{switch(t.type){case"http":return t.response?.status_code;case"dns":return t.response?.response_code;default:return}},Ni=t=>{switch(t.type){case"http":return t.websocket?t.client_conn.tls_established?"WSS":"WS":t.request.method;case"dns":return t.request.op_code;default:return t.type.toUpperCase()}},ki=t=>{switch(t.type){case"http":return t.request.http_version;default:return""}},Ei={tls:t=>t.type==="http"&&t.request.scheme,icon:Si,index:()=>0,path:$i,method:Ni,version:ki,status:Ci,size:wi,time:t=>{const e=Wt(t),s=yi(t);return e&&s&&s-e},timestamp:Wt,quickactions:()=>0,comment:t=>t.comment};function zl(t){return t in Ei}var ge=(t=>(t.Search="search",t.Highlight="highlight",t))(ge||{});const Ti={search:"",highlight:""},Gl=ae({name:"ui/filters",initialState:Ti,reducers:{setFilter(t,e){t.search=e.payload},setHighlight(t,e){t.highlight=e.payload}}}),{actions:Yl,reducer:Jl}=Gl,{setFilter:Ri,setHighlight:Ai}=Yl;function rs(t,e){return t.toSorted?t.toSorted(e):[...t].sort(e)}function js(t,...e){if(t.toSpliced)return t.toSpliced(...e);{const s=[...t];return s.splice(...e),s}}function jt(t){return new Map(t.map((e,s)=>[e.id,s]))}function os(t){return new Set(t.map(e=>e.id))}function Un(t,e){return t.has(e)&&(t=new Set(t),t.delete(e)),t}function Bn(t,e,s){const i=js(t,s,1),r=new Map(e);r.delete(t[s].id);for(let n=i.length-1;n>=s;n--)r.set(i[n].id,n);return{view:i,_viewIndex:r}}function Ql(t,e,s,i){const r=[...t],n=r.length;let l=e,a=l.get(s.id);if(a+1<n&&i(s,r[a+1])>0){l=new Map(l);do{const d=r[a+1];r[a]=d,l.set(d.id,a),a++}while(a+1<n&&i(s,r[a+1])>0);l.set(s.id,a)}else if(a>0&&i(s,r[a-1])<0){l=new Map(l);do{const d=r[a-1];r[a]=d,l.set(d.id,a),a--}while(a>0&&i(s,r[a-1])<0);l.set(s.id,a)}return r[a]=s,{view:r,_viewIndex:l}}function Wn(t,e,s,i){const r=Xl(t,s,i),n=js(t,r,0,s),l=new Map(e);for(let a=n.length-1;a>=r;a--)l.set(n[a].id,a);return{view:n,_viewIndex:l}}function Xl(t,e,s){let i=0,r=t.length;if(r===0||s(t[r-1],e)<=0)return r;for(;i<r;){const n=i+r>>>1;s(e,t[n])>=0?i=n+1:r=n}return i}function ys(t){return t=t.filter(_s),()=>Promise.all(t.map(e=>ne(`/flows/${e.id}/resume`,{method:"POST"})))}function Di(){return()=>ne("/flows/resume",{method:"POST"})}function Fi(t){return t=t.filter(_s),()=>Promise.all(t.map(e=>ne(`/flows/${e.id}/kill`,{method:"POST"})))}function Zl(){return()=>ne("/flows/kill",{method:"POST"})}function Ii(t){return()=>Promise.all(t.map(e=>ne(`/flows/${e.id}`,{method:"DELETE"})))}function Li(t){return()=>Promise.all(t.map(e=>ne(`/flows/${e.id}/duplicate`,{method:"POST"})))}function ws(t){return t=t.filter(xs),()=>Promise.all(t.map(e=>ne(`/flows/${e.id}/replay`,{method:"POST"})))}function Pi(t){return t=t.filter(bi),()=>Promise.all(t.map(e=>ne(`/flows/${e.id}/revert`,{method:"POST"})))}function Kn(t,e){return()=>Promise.all(t.map(s=>Ie(s,{marked:e})()))}function Ie(t,e){return()=>ne.put(`/flows/${t.id}`,e)}function ec(t,e,s){const i=new FormData;return e=new window.Blob([e],{type:"plain/text"}),i.append("file",e),()=>ne(`/flows/${t.id}/${s}/content.data`,{method:"POST",body:i})}function Oi(){return()=>ne("/clear",{method:"POST"})}function tc(t){const e=new FormData;return e.append("file",t),()=>ne("/flows/dump",{method:"POST",body:e})}const Mi=xe("flows/add"),qi=xe("flows/update"),Hi=xe("flows/remove"),bs=xe("flows/receive"),Vi=xe("flows/filterUpdate"),Ui=xe("flows/sort"),He=xe("flows/select"),sc={list:[],_listIndex:new Map,byId:new Map,view:[],_viewIndex:new Map,sort:{column:void 0,desc:!1},selected:[],selectedIds:new Set,highlightedIds:new Set};function nc(t=sc,e){if(bs.match(e)){const{sort:s}=t,i=e.payload,r=jt(i),n=new Map(i.map(p=>[p.id,p])),l=rs(i,pt(s)),a=jt(l),d=t.selected.map(p=>n.get(p.id)).filter(p=>p!==void 0),u=os(d);return{list:i,_listIndex:r,byId:n,view:l,_viewIndex:a,sort:s,selected:d,selectedIds:u,highlightedIds:new Set}}else if(Mi.match(e)){const{flow:s,matching_filters:i}=e.payload;if(t._listIndex.has(s.id))return t;const{sort:r,selected:n,selectedIds:l}=t;let{view:a,_viewIndex:d,highlightedIds:u}=t;const h=new Map(t._listIndex);h.set(s.id,t.list.length);const p=[...t.list,s],g=new Map(t.byId);return g.set(s.id,s),(i[ge.Search]===!0||i[ge.Search]===void 0)&&({view:a,_viewIndex:d}=Wn(a,d,s,pt(r))),i[ge.Highlight]===!0&&(u=new Set(u),u.add(s.id)),{list:p,_listIndex:h,byId:g,view:a,_viewIndex:d,sort:r,selected:n,selectedIds:l,highlightedIds:u}}else if(qi.match(e)){const{flow:s,matching_filters:i}=e.payload,{_listIndex:r,sort:n,selectedIds:l}=t;let{view:a,_viewIndex:d,selected:u,highlightedIds:h}=t;const p=t._listIndex.get(s.id),g=[...t.list];p!==void 0?g[p]=s:g.push(s);const _=new Map(t.byId);_.set(s.id,s);const j=d.get(s.id),y=j!==void 0,w=i[ge.Search]===!0||i[ge.Search]===void 0;return w&&!y?{view:a,_viewIndex:d}=Wn(a,d,s,pt(n)):!w&&y?{view:a,_viewIndex:d}=Bn(a,d,j):w&&y&&({view:a,_viewIndex:d}=Ql(a,d,s,pt(n))),l.has(s.id)&&(u=u.map($=>$.id===s.id?s:$)),i[ge.Highlight]===!0?h.has(s.id)||(h=new Set(h),h.add(s.id)):h=Un(h,s.id),{list:g,_listIndex:r,byId:_,view:a,_viewIndex:d,sort:n,selected:u,selectedIds:l,highlightedIds:h}}else if(Hi.match(e)){const s=e.payload,{sort:i}=t;let{view:r,_viewIndex:n,selected:l,selectedIds:a}=t;const d=t._listIndex.get(s);if(d===void 0)return t;const u=js(t.list,d,1),h=jt(u),p=new Map(t.byId);p.delete(s);const g=n.get(s);if(g!==void 0&&({view:r,_viewIndex:n}=Bn(r,n,g)),a.has(s)){if(l.length===1&&g!==void 0){const j=r[g]??r[g-1];l=j?[j]:[]}else l=l.filter(j=>j.id!==s);a=os(l)}const _=Un(t.highlightedIds,s);return{list:u,_listIndex:h,byId:p,view:r,_viewIndex:n,sort:i,selected:l,selectedIds:a,highlightedIds:_}}else if(Vi.match(e)){const{name:s,matching_flow_ids:i}=e.payload;switch(s){case ge.Search:{const r=rs(i===null?t.list:i.map(l=>t.byId.get(l)).filter(l=>l!==void 0),pt(t.sort)),n=jt(r);return{...t,view:r,_viewIndex:n}}case ge.Highlight:return{...t,highlightedIds:new Set(i)};default:Ct(s)}}else if(Ui.match(e)){const s=e.payload;let i;s.column?i=rs(t.view,pt(s)):i=t.list.filter(n=>t._viewIndex.has(n.id));const r=jt(i);return{...t,sort:s,view:i,_viewIndex:r}}else return He.match(e)?{...t,selected:e.payload,selectedIds:os(e.payload)}:t}function pt({column:t,desc:e}){if(!t)return(i,r)=>0;const s=Ei[t];return(i,r)=>{const n=s(i),l=s(r);return n>l?e?-1:1:n<l?e?1:-1:0}}function ht(t,e){const s=t.selected[t.selected.length-1],i=t._viewIndex.get(s?.id),r=0,n=t.view.length-1;let l;i===void 0?l=e<0?r:n:(l=i+e,l=window.Math.max(l,r),l=window.Math.min(l,n));const a=t.view[l];return He(a?[a]:[])}function ic(t){return(e,s)=>{const{flows:i}=s();i.selectedIds.has(t.id)?e(He(i.selected.filter(r=>r!==t))):e(He([...i.selected,t]))}}function rc(t){return(e,s)=>{const{flows:i}=s(),r=i.selected[i.selected.length-1],n=i._viewIndex.get(t.id),l=i._viewIndex.get(r?.id);if(n===void 0||l===void 0)return e(He([t]));let a;return n<=l?a=i.view.slice(n,l+1):(a=i.view.slice(l+1,n+1),a.push(r)),e(He(a))}}const oc={activeModal:void 0},Bi=ae({name:"ui/modal",initialState:oc,reducers:{setActiveModal(t,e){t.activeModal=e.payload},hideModal(t){t.activeModal=void 0}}}),{actions:lc,reducer:cc}=Bi,ac=Bi.actions.hideModal.type,{setActiveModal:dc,hideModal:Wi}=lc,zn=(()=>{const t=document.createElement("div");return t.setAttribute("contenteditable","PLAINTEXT-ONLY"),t.contentEditable==="plaintext-only"?"plaintext-only":"true"})();class le extends I.Component{input=Ee.createRef();render(){const e=_e("inline-input",this.props.className);return o.jsx("span",{ref:this.input,tabIndex:0,className:e,placeholder:this.props.placeholder,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onInput:this.onInput,onPaste:this.onPaste,onMouseDown:this.onMouseDown,onClick:this.onClick,children:this.props.content})}componentDidUpdate(e){e.content!==this.props.content&&this.props.onInput?.(this.props.content)}isEditing=()=>this.input.current?.contentEditable===zn;startEditing=()=>{if(!this.input.current)return console.error("unreachable");this.isEditing()||(this.suppress_events=!0,this.input.current.blur(),this.input.current.contentEditable=zn,window.requestAnimationFrame(()=>{if(this.input.current){if(this.input.current.focus(),this.suppress_events=!1,this.props.selectAllOnClick){const e=document.createRange();e.selectNodeContents(this.input.current);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(e)}this.props.onEditStart?.()}}))};resetValue=()=>{if(!this.input.current)return console.error("unreachable");this.input.current.textContent=this.props.content,this.props.onInput?.(this.props.content)};finishEditing=()=>{if(!this.input.current)return console.error("unreachable");this.props.onEditDone(this.input.current.textContent||""),this.input.current.blur(),this.input.current.contentEditable="inherit"};onPaste=e=>{e.preventDefault();const s=e.clipboardData.getData("text/plain");document.execCommand("insertHTML",!1,s)};suppress_events=!1;onMouseDown=e=>{this.suppress_events=!0,window.addEventListener("mouseup",this.onMouseUp,{once:!0})};onMouseUp=e=>{const s=e.target===this.input.current,i=!window.getSelection()?.toString();this.props.selectAllOnClick?s&&i&&this.startEditing():s&&this.startEditing(),this.suppress_events=!1};onClick=e=>{};onFocus=e=>{if(!this.input.current)throw"unreachable";this.suppress_events||this.startEditing()};onInput=e=>{this.props.onInput?.(this.input.current?.textContent||"")};onBlur=e=>{this.suppress_events||this.finishEditing()};onKeyDown=e=>{switch(e.stopPropagation(),e.key){case"Escape":e.preventDefault(),this.resetValue(),this.finishEditing();break;case"Enter":e.shiftKey||(e.preventDefault(),this.finishEditing());break}this.props.onKeyDown?.(e)}}function bt(t){const e=E.c(15);let s;e[0]!==t.content||e[1]!==t.isValid?(s=t.isValid(t.content),e[0]=t.content,e[1]=t.isValid,e[2]=s):s=e[2];const[i,r]=I.useState(s),n=I.useRef(null);let l;e[3]!==t?(l=_=>{t.isValid(_)?t.onEditDone(_):n.current?.resetValue()},e[3]=t,e[4]=l):l=e[4];const a=l,d=i?"has-success":"has-warning";let u;e[5]!==t.className||e[6]!==d?(u=_e(t.className,d),e[5]=t.className,e[6]=d,e[7]=u):u=e[7];const h=u;let p;e[8]!==t?(p=_=>r(t.isValid(_)),e[8]=t,e[9]=p):p=e[9];let g;return e[10]!==h||e[11]!==a||e[12]!==t||e[13]!==p?(g=o.jsx(le,{...t,className:h,onInput:p,onEditDone:a,ref:n}),e[10]=h,e[11]=a,e[12]=t,e[13]=p,e[14]=g):g=e[14],g}const G=()=>Nl(),D=kl,uc=ui.withTypes(),Ss=xe("EVENTS_ADD"),Ki=xe("EVENTS_RECEIVE"),Gt=xe("events/toggleVisibility"),zi=xe("events/toggleFilter");var Gi=(t=>(t.debug="debug",t.info="info",t.web="web",t.warn="warn",t.error="error",t))(Gi||{});const fc={visible:!1,filters:{debug:!1,info:!0,web:!0,warn:!0,error:!0},list:[],view:[]};function pc(t=fc,e){if(Ss.match(e)){const s=e.payload;return{...t,list:[...t.list,s],view:t.filters[s.level]?[...t.view,s]:t.view}}else{if(Ki.match(e))return{...t,list:e.payload,view:e.payload.filter(s=>t.filters[s.level])};if(Gt.match(e))return{...t,visible:!t.visible};if(zi.match(e)){const s={...t.filters,[e.payload]:!t.filters[e.payload]};return{...t,filters:s,view:t.list.filter(i=>s[i.level])}}else return t}}function hc(t,e="web"){return Ss({id:Math.random().toString(),message:t,level:e})}const Gn={},mc=ae({name:"ui/optionsEditor",initialState:Gn,reducers:{startUpdate(t,e){t[e.payload.option]={isUpdating:!0,value:e.payload.value,error:!1}},updateSuccess(t,e){t[e.payload.option]=void 0},updateError(t,e){let s=t[e.payload.option].value;typeof s=="boolean"&&(s=!s),t[e.payload.option]={value:s,isUpdating:!1,error:e.payload.error}}},extraReducers:t=>{t.addCase(ac,()=>Gn)}}),{actions:gc,reducer:vc}=mc,{startUpdate:xc,updateSuccess:_c,updateError:jc}=gc;var ve=(t=>(t[t.Capture=0]="Capture",t[t.FlowList=1]="FlowList",t[t.Options=2]="Options",t[t.Flow=3]="Flow",t))(ve||{});const yc=ae({name:"ui/tabs",initialState:{current:1},reducers:{setCurrent(t,e){t.current=e.payload}}}),{actions:wc,reducer:bc}=yc,{setCurrent:Vt}=wc,Sc=fi({flow:Vl,modal:cc,optionsEditor:vc,tabs:bc,filter:Jl});var wt=(t=>(t.INIT="CONNECTION_INIT",t.FETCHING="CONNECTION_FETCHING",t.ESTABLISHED="CONNECTION_ESTABLISHED",t.ERROR="CONNECTION_ERROR",t))(wt||{});const $c={state:"CONNECTION_INIT",message:void 0},Yi=ae({name:"connection",initialState:$c,reducers:{startFetching:t=>{t.state==="CONNECTION_INIT"&&(t.state="CONNECTION_FETCHING")},finishFetching:t=>{t.state==="CONNECTION_FETCHING"&&(t.state="CONNECTION_ESTABLISHED")},connectionError:(t,e)=>{t.state="CONNECTION_ERROR",t.message=e.payload}}}),{startFetching:Cc,finishFetching:Nc,connectionError:kc}=Yi.actions,Ec=Yi.reducer,Tc={add_upstream_certs_to_client_chain:!1,allow_hosts:[],anticache:!1,anticomp:!1,block_global:!0,block_list:[],block_private:!1,body_size_limit:void 0,cert_passphrase:void 0,certs:[],ciphers_client:void 0,ciphers_server:void 0,client_certs:void 0,client_replay:[],client_replay_concurrency:1,command_history:!0,confdir:"~/.mitmproxy",connect_addr:void 0,connection_strategy:"eager",console_focus_follow:!1,content_view_lines_cutoff:512,dns_name_servers:[],dns_use_hosts_file:!0,export_preserve_original_ip:!1,hardump:"",http2:!0,http2_ping_keepalive:58,http3:!0,http_connect_send_host_header:!0,ignore_hosts:[],intercept:void 0,intercept_active:!1,keep_alt_svc_header:!1,keep_host_header:!1,key_size:2048,listen_host:"",listen_port:void 0,map_local:[],map_remote:[],mode:["regular"],modify_body:[],modify_headers:[],normalize_outbound_headers:!0,onboarding:!0,onboarding_host:"mitm.it",protobuf_definitions:void 0,proxy_debug:!1,proxyauth:void 0,rawtcp:!0,readfile_filter:void 0,request_client_cert:!1,rfile:void 0,save_stream_file:void 0,save_stream_filter:void 0,scripts:[],server:!0,server_replay:[],server_replay_extra:"forward",server_replay_ignore_content:!1,server_replay_ignore_host:!1,server_replay_ignore_params:[],server_replay_ignore_payload_params:[],server_replay_ignore_port:!1,server_replay_kill_extra:!1,server_replay_nopop:!1,server_replay_refresh:!0,server_replay_reuse:!1,server_replay_use_headers:[],show_ignored_hosts:!1,showhost:!1,ssl_insecure:!1,ssl_verify_upstream_trusted_ca:void 0,ssl_verify_upstream_trusted_confdir:void 0,stickyauth:void 0,stickycookie:void 0,store_streamed_bodies:!1,stream_large_bodies:void 0,strip_ech:!0,tcp_hosts:[],tcp_timeout:600,termlog_verbosity:"info",tls_ecdh_curve_client:void 0,tls_ecdh_curve_server:void 0,tls_version_client_max:"UNBOUNDED",tls_version_client_min:"TLS1_2",tls_version_server_max:"UNBOUNDED",tls_version_server_min:"TLS1_2",udp_hosts:[],upstream_auth:void 0,upstream_cert:!0,validate_inbound_headers:!0,view_filter:void 0,view_order:"time",view_order_reversed:!1,web_columns:["tls","icon","path","method","status","size","time"],web_debug:!1,web_host:"127.0.0.1",web_open_browser:!0,web_password:"",web_port:8081,web_static_viewer:"",websocket:!0},Yt=xe("OPTIONS_RECEIVE"),$s=xe("OPTIONS_UPDATE"),Rc=ae({name:"options",initialState:Tc,reducers:{},extraReducers:t=>{t.addCase(Yt,(e,s)=>{const i={};for(const[r,{value:n}]of Object.entries(s.payload))i[r]=n;return i}).addCase($s,(e,s)=>{for(const[i,{value:r}]of Object.entries(s.payload))e[i]=r})}}),Ac=Rc.reducer;async function Dc(t,e,s){try{const i=await ne.put("/options",{[t]:e});if(i.status===200)s(_c({option:t}));else throw await i.text()}catch(i){s(jc({option:t,error:i.toString()}))}}const Fc=Dc;function Cs(t,e){return s=>{s(xc({option:t,value:e})),Fc(t,e,s)}}const Ic={visible:!1},Lc=ae({name:"commandBar",initialState:Ic,reducers:{toggleVisibility(t){t.visible=!t.visible}}}),{actions:Pc,reducer:Oc}=Lc,{toggleVisibility:Ji}=Pc,Ve=xe("STATE_RECEIVE"),Ue=xe("STATE_UPDATE"),Mc={available:!1,version:"",contentViews:[],servers:{},platform:"",localModeUnavailable:null},qc=ae({name:"backendState",initialState:Mc,reducers:{},extraReducers:t=>{t.addCase(Ve,(e,s)=>({...e,available:!0,...s.payload})).addCase(Ue,(e,s)=>({...e,...s.payload}))}}),Hc=qc.reducer,Vc={},Uc=ae({name:"optionsMeta",initialState:Vc,reducers:{},extraReducers:t=>{t.addCase(Yt,(e,s)=>s.payload).addCase($s,(e,s)=>({...e,...s.payload}))}}),Bc=Uc.reducer,dt=(t,e)=>e.listen_host&&e.listen_port?`${t}@${e.listen_host}:${e.listen_port}`:e.listen_port?`${t}@${e.listen_port}`:t,Qi=t=>{let[e,s]=ps(t,"@");e||(e=s,s="");const[i,r]=vi(e,":");let n,l;if(s){let a;if(s.includes(":")?[n,a]=ps(s,":"):(n="",a=s),a&&(l=parseInt(a,10),isNaN(l)||l<0||l>65535))throw new Error(`invalid port: ${a}`)}return{full_spec:t,name:i,data:r,listen_host:n,listen_port:l}},Xi=t=>dt("regular",t),Yn=({listen_host:t,listen_port:e})=>({ui_id:Math.random(),active:!0,listen_host:t,listen_port:e}),Zi=t=>t.selectedProcesses?`local:${t.selectedProcesses}`:"local",Jn=({data:t})=>({ui_id:Math.random(),active:!0,selectedProcesses:t}),er=t=>{const e=t.file_path?`wireguard:${t.file_path}`:"wireguard";return dt(e,t)},Qn=({data:t,listen_host:e,listen_port:s})=>({ui_id:Math.random(),active:!0,listen_host:e,listen_port:s,file_path:t});var Jt=(t=>(t.HTTP="http",t.HTTPS="https",t.HTTP3="http3",t.TLS="tls",t.DTLS="dtls",t.TCP="tcp",t.UDP="udp",t.DNS="dns",t.QUIC="quic",t))(Jt||{}),ot=(t=>(t.CSS="css",t.JAVASCRIPT="javascript",t.XML="xml",t.YAML="yaml",t.NONE="none",t.ERROR="error",t))(ot||{});const hs=()=>({active:!1,protocol:Jt.HTTPS,destination:"",ui_id:Math.random()}),Ns=t=>dt(`reverse:${t.protocol}://${t.destination}`,t),Wc=({data:t,listen_host:e,listen_port:s})=>{let[i,r]=vi(t,"://");return r||(r=i,i=Jt.HTTPS),{ui_id:Math.random(),active:!0,protocol:i,destination:r,listen_host:e,listen_port:s}},tr=t=>dt("transparent",t),Xn=({listen_host:t,listen_port:e})=>({ui_id:Math.random(),active:!0,listen_host:t,listen_port:e}),sr=t=>dt("socks5",t),Zn=({listen_host:t,listen_port:e})=>({ui_id:Math.random(),active:!0,listen_host:t,listen_port:e}),nr=t=>dt(`upstream:${t.destination}`,t),ei=({data:t,listen_host:e,listen_port:s})=>({ui_id:Math.random(),active:!0,destination:t||"",listen_host:e,listen_port:s}),ir=t=>dt("dns",t),ti=({listen_host:t,listen_port:e})=>({ui_id:Math.random(),active:!0,listen_host:t,listen_port:e}),Xe=t=>t.active&&!t.error;async function Kc(t,e){const s=e.getState().modes,i=[...s.regular.filter(Xe).map(Xi),...s.local.filter(Xe).map(Zi),...s.wireguard.filter(Xe).map(er),...s.reverse.filter(Xe).map(Ns),...s.transparent.filter(Xe).map(tr),...s.socks.filter(Xe).map(sr),...s.upstream.filter(Xe).map(nr),...s.dns.filter(Xe).map(ir)],r=await ne.put("/options",{mode:i});if(r.status!==200)throw new Error(await r.text())}function ie(t){return uc(t,Kc)}function se(t,e,s){t.addCase(s.pending,(i,r)=>{const{server:n,value:l}=r.meta.arg,a=i.findIndex(d=>d.ui_id===n.ui_id);a>=0&&(i[a][e]=l,i[a].error=void 0)}),t.addCase(s.rejected,(i,r)=>{const{server:n}=r.meta.arg,l=i.findIndex(a=>a.ui_id===n.ui_id);l>=0&&(i[l].error=r.error.message)})}function ye(t,e){return function(i,r){if(r.payload.servers){const n=Object.values(r.payload.servers).filter(l=>l.type===t).map(l=>Qi(l.full_spec));if(n.length>0)return n.map(e);for(const l of i)l.active=!1}}}const rr=ie("modes/regular/setActive"),or=ie("modes/regular/setListenHost"),lr=ie("modes/regular/setListenPort"),zc=[{active:!0,ui_id:Math.random()}],Gc=ae({name:"modes/regular",initialState:zc,reducers:{},extraReducers:t=>{se(t,"active",rr),se(t,"listen_host",or),se(t,"listen_port",lr),t.addCase(Ve,ye("regular",Yn)),t.addCase(Ue,ye("regular",Yn))}}),Yc=Gc.reducer,cr=ie("modes/local/setActive"),St=ie("modes/local/setSelectedProcesses"),Jc=[{active:!1,selectedProcesses:"",ui_id:Math.random()}],Qc=ae({name:"modes/local",initialState:Jc,reducers:{},extraReducers:t=>{se(t,"active",cr),se(t,"selectedProcesses",St),t.addCase(Ve,ye("local",Jn)),t.addCase(Ue,ye("local",Jn))}}),Xc=Qc.reducer,ar=ie("modes/wireguard/setActive"),dr=ie("modes/wireguard/setListenHost"),ur=ie("modes/wireguard/setListenPort"),fr=ie("modes/wireguard/setFilePath"),Zc=[{active:!1,ui_id:Math.random()}],ea=ae({name:"modes/wireguard",initialState:Zc,reducers:{},extraReducers:t=>{se(t,"active",ar),se(t,"listen_host",dr),se(t,"listen_port",ur),se(t,"file_path",fr),t.addCase(Ve,ye("wireguard",Qn)),t.addCase(Ue,ye("wireguard",Qn))}}),ta=ea.reducer,ms=ie("modes/reverse/setActive"),pr=ie("modes/reverse/setListenHost"),hr=ie("modes/reverse/setListenPort"),mr=ie("modes/reverse/setProtocol"),gr=ie("modes/reverse/setDestination"),sa=[hs()],vr=ae({name:"modes/reverse",initialState:sa,reducers:{addServer:t=>{t.push(hs())},removeServer:(t,e)=>{const s=t.findIndex(i=>i.ui_id===e.payload.ui_id);s!==-1&&(t[s].active&&console.error("servers should be deactivated before removal"),t.splice(s,1))}},extraReducers:t=>{se(t,"active",ms),se(t,"listen_host",pr),se(t,"listen_port",hr),se(t,"protocol",mr),se(t,"destination",gr),t.addCase(Ve,e),t.addCase(Ue,e);function e(s,i){if(i.payload.servers){const r=Object.fromEntries(Object.entries(i.payload.servers).filter(([l,a])=>a.type==="reverse").map(([l,a])=>[l,Qi(l)])),n=[];for(const l of s){const a=Ns(l),d=a in r;delete r[a],n.push({...l,active:d})}for(const l of Object.values(r))n.push(Wc(l));return n.length>1&&Kt({...n[0],ui_id:void 0},{...hs(),ui_id:void 0})&&n.shift(),n}}}}),{addServer:na,removeServer:ia}=vr.actions,ra=vr.reducer,xr=ie("modes/transparent/setActive"),_r=ie("modes/transparent/setListenHost"),jr=ie("modes/transparent/setListenPort"),oa=[{active:!1,ui_id:Math.random()}],la=ae({name:"modes/transparent",initialState:oa,reducers:{},extraReducers:t=>{se(t,"active",xr),se(t,"listen_host",_r),se(t,"listen_port",jr),t.addCase(Ve,ye("transparent",Xn)),t.addCase(Ue,ye("transparent",Xn))}}),ca=la.reducer,yr=ie("modes/socks5/setActive"),wr=ie("modes/socks5/setListenHost"),br=ie("modes/socks5/setListenPort"),aa=[{active:!1,ui_id:Math.random()}],da=ae({name:"modes/socks5",initialState:aa,reducers:{},extraReducers:t=>{se(t,"active",yr),se(t,"listen_host",wr),se(t,"listen_port",br),t.addCase(Ve,ye("socks5",Zn)),t.addCase(Ue,ye("socks5",Zn))}}),ua=da.reducer,Sr=ie("modes/upstream/setActive"),$r=ie("modes/upstream/setListenHost"),Cr=ie("modes/upstream/setListenPort"),Nr=ie("modes/upstream/setDestination"),fa=[{active:!1,destination:"",ui_id:Math.random()}],pa=ae({name:"modes/upstream",initialState:fa,reducers:{},extraReducers:t=>{se(t,"active",Sr),se(t,"listen_host",$r),se(t,"listen_port",Cr),se(t,"destination",Nr),t.addCase(Ve,ye("upstream",ei)),t.addCase(Ue,ye("upstream",ei))}}),ha=pa.reducer,kr=ie("modes/dns/setActive"),Er=ie("modes/dns/setListenHost"),Tr=ie("modes/dns/setListenPort"),ma=[{active:!0,ui_id:Math.random()}],ga=ae({name:"modes/dns",initialState:ma,reducers:{},extraReducers:t=>{se(t,"active",kr),se(t,"listen_host",Er),se(t,"listen_port",Tr),t.addCase(Ve,ye("dns",ti)),t.addCase(Ue,ye("dns",ti))}}),va=ga.reducer,xa=fi({regular:Yc,local:Xc,wireguard:ta,reverse:ra,transparent:ca,socks:ua,upstream:ha,dns:va}),$t=ui("fetchProcesses",async(t,{rejectWithValue:e})=>{try{return(await ne("/processes")).json()}catch(s){return e(s.message)}}),_a={currentProcesses:[],isLoading:!1},ja=ae({name:"processes",initialState:_a,reducers:{},extraReducers:t=>{t.addCase($t.pending,e=>{e.isLoading=!0,e.error=void 0}),t.addCase($t.fulfilled,(e,s)=>{e.isLoading=!1,e.currentProcesses=s.payload}),t.addCase($t.rejected,(e,s)=>{e.isLoading=!1,e.error=s.payload})}}),ya=ja.reducer,wa={commandBar:Oc,eventLog:pc,flows:nc,connection:Ec,modes:xa,ui:Sc,options:Ac,options_meta:Bc,backendState:Hc,processes:ya},ba={immutableCheck:{warnAfter:5e5},serializableCheck:{warnAfter:5e5,ignoredPaths:["flows"]}},Nt=El({reducer:wa,middleware:t=>t(ba),devTools:!1});class Sa extends I.Component{container=Ee.createRef();nameInput=Ee.createRef();valueInput=Ee.createRef();render=()=>{const[e,s]=this.props.item;return o.jsxs("div",{ref:this.container,className:"kv-row",onClick:this.onClick,onKeyDownCapture:this.onKeyDown,children:[o.jsx(le,{ref:this.nameInput,className:"kv-key",content:e,onEditStart:this.props.onEditStart,onEditDone:i=>this.props.onEditDone([i,s]),selectAllOnClick:!0}),": ",o.jsx(le,{ref:this.valueInput,className:"kv-value",content:s,onEditStart:this.props.onEditStart,onEditDone:i=>this.props.onEditDone([e,i]),placeholder:"empty",selectAllOnClick:!0})]})};onClick=e=>{e.target===this.container.current&&this.props.onClickEmptyArea()};onKeyDown=e=>{e.target===this.valueInput.current?.input.current&&e.key==="Tab"&&this.props.onTabNext()}}class Rr extends I.Component{rowRefs={};currentlyEditing;justFinishedEditing;state={currentList:this.props.data||[],initialList:this.props.data};static getDerivedStateFromProps(e,s){return e.data!==s.initialList?{currentList:e.data||[],initialList:e.data}:null}render=()=>{this.rowRefs={};const e=this.state.currentList.map((s,i)=>o.jsx(Sa,{item:s,onEditStart:()=>this.currentlyEditing=i,onEditDone:r=>this.onEditDone(i,r),onClickEmptyArea:()=>this.onClickEmptyArea(i),onTabNext:()=>this.onTabNext(i),ref:r=>{this.rowRefs[i]=r}},i));return o.jsxs("div",{className:_e("kv-editor",this.props.className),onMouseDown:this.onMouseDown,children:[e,o.jsx("div",{onClick:s=>{s.preventDefault(),this.onClickEmptyArea(this.state.currentList.length-1)},className:"kv-add-row fa fa-plus-square-o",role:"button","aria-label":"Add"})]})};onEditDone=(e,s)=>{const i=[...this.state.currentList];s[0]?i[e]=s:i.splice(e,1),this.currentlyEditing=void 0,Ht.isEqual(this.state.currentList,i)||this.props.onChange(i),this.setState({currentList:i})};onClickEmptyArea=e=>{if(this.justFinishedEditing)return;const s=[...this.state.currentList];s.splice(e+1,0,["",""]),this.setState({currentList:s},()=>this.rowRefs[e+1]?.nameInput.current?.startEditing())};onTabNext=e=>{e==this.state.currentList.length-1&&this.onClickEmptyArea(e)};onMouseDown=e=>{this.justFinishedEditing=this.currentlyEditing}}function Ar(t,e){const s=E.c(6),[i,r]=I.useState(),[n,l]=I.useState();let a;s[0]!==n||s[1]!==t?(a=()=>{n&&n.abort();const u=new AbortController;return ne(t,{signal:u.signal}).then($a).then(h=>{r(h)}).catch(h=>{u.signal.aborted||r(`Error getting content: ${h}.`)}),l(u),()=>{u.signal.aborted||u.abort()}},s[0]=n,s[1]=t,s[2]=a):a=s[2];let d;return s[3]!==e||s[4]!==t?(d=[t,e],s[3]=e,s[4]=t,s[5]=d):d=s[5],I.useEffect(a,d),i}function $a(t){if(!t.ok)throw`${t.status} ${t.statusText}`.trim();return t.text()}function Dr(t,e,s,i,r){const n=E.c(11);let l;n[0]!==t||n[1]!==i||n[2]!==e||n[3]!==s?(l=je.getContentURL(t,e,s,i),n[0]=t,n[1]=i,n[2]=e,n[3]=s,n[4]=l):l=n[4];const d=Ar(l,r);let u;if(d)try{let h;n[5]!==d?(h=JSON.parse(d),n[5]=d,n[6]=h):h=n[6],u=h}catch{let h;n[7]!==d?(h={text:d,description:"Network Error",syntax_highlight:"error",view_name:"raw"},n[7]=d,n[8]=h):h=n[8];const p=h;if(e==="messages"){let g;n[9]!==p?(g=[p],n[9]=p,n[10]=g):g=n[10],u=g}else u=p}else u=void 0;return u}const Fr=Ee.memo(function({icon:e,text:s,className:i,title:r,onOpenFile:n,onClick:l}){let a;return o.jsxs("a",{href:"#",onClick:d=>{a.click(),l&&l(d)},className:i,title:r,children:[o.jsx("i",{className:"fa fa-fw "+e}),s,o.jsx("input",{ref:d=>{a=d},className:"hidden",type:"file",onChange:d=>{d.preventDefault(),d.target.files&&d.target.files.length>0&&n(d.target.files[0]),a.value=""}})]})});function ue(t){const e=E.c(11),{onClick:s,children:i,icon:r,disabled:n,className:l,title:a}=t;let d;e[0]!==l?(d=_e(l,"btn btn-default"),e[0]=l,e[1]=d):d=e[1];const u=n?void 0:s;let h;e[2]!==r?(h=r&&o.jsxs(o.Fragment,{children:[o.jsx("i",{className:"fa "+r})," "]}),e[2]=r,e[3]=h):h=e[3];let p;return e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==u||e[8]!==h||e[9]!==a?(p=o.jsxs("button",{className:d,onClick:u,disabled:n,title:a,children:[h,i]}),e[4]=i,e[5]=n,e[6]=d,e[7]=u,e[8]=h,e[9]=a,e[10]=p):p=e[10],p}function Ca(t){const e=E.c(11),{initialContent:s,onChange:i,language:r,readonly:n}=t,l=n===void 0?!1:n,a=Na;let d;e:switch(r){case ot.YAML:{let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=[Dl()],e[0]=p):p=e[0],d=p;break e}case ot.XML:{let p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=[Al()],e[1]=p):p=e[1],d=p;break e}case ot.JAVASCRIPT:{let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=[Rl()],e[2]=p):p=e[2],d=p;break e}case ot.CSS:{let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=[Tl()],e[3]=p):p=e[3],d=p;break e}case void 0:case null:case ot.NONE:case ot.ERROR:{let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[4]=p):p=e[4],d=p;break e}default:{console.error("Unexpected syntax highlighting language: ",r);let g;e[5]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[5]=g):g=e[5],d=g}}const u=d;let h;return e[6]!==u||e[7]!==s||e[8]!==i||e[9]!==l?(h=o.jsx("div",{className:"codeeditor",onKeyDown:a,children:o.jsx(Fl,{value:s,onChange:i,readOnly:l,extensions:u})}),e[6]=u,e[7]=s,e[8]=i,e[9]=l,e[10]=h):h=e[10],h}function Na(t){return t.stopPropagation()}const Ir=Ee.memo(function(e){const s=E.c(9),{content:i,maxLines:r,showMore:n}=e;if(i.length===0)return null;let l;if(s[0]!==i||s[1]!==r||s[2]!==n){let d;s[4]!==r||s[5]!==n?(d=(u,h)=>h===r?o.jsxs("button",{onClick:n,className:"btn btn-xs btn-info",children:[o.jsx("i",{className:"fa fa-angle-double-down","aria-hidden":"true"})," ","Show more"]},"showmore"):o.jsx("div",{children:u},h),s[4]=r,s[5]=n,s[6]=d):d=s[6],l=i.split(`
+`).map(d),s[0]=i,s[1]=r,s[2]=n,s[3]=l}else l=s[3];let a;return s[7]!==l?(a=o.jsx("pre",{children:l}),s[7]=l,s[8]=a):a=s[8],a}),ka=()=>{const t=E.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("li",{role:"separator",className:"divider"}),t[0]=e):e=t[0],e};function Ne(t){const e=E.c(8);let s,i,r;if(e[0]!==t){const{onClick:a,children:d,...u}=t;i=d,s=u,r=h=>{h.preventDefault(),a()},e[0]=t,e[1]=s,e[2]=i,e[3]=r}else s=e[1],i=e[2],r=e[3];const n=r;let l;return e[4]!==s||e[5]!==i||e[6]!==n?(l=o.jsx("li",{children:o.jsx("a",{href:"#",onClick:n,...s,children:i})}),e[4]=s,e[5]=i,e[6]=n,e[7]=l):l=e[7],l}const Et=Ee.memo(function({text:e,children:s,options:i,className:r,onOpen:n,...l}){const[a,d]=I.useState(!1),{refs:u,floatingStyles:h}=Il(i),p=_=>{d(_),n&&n(_)};I.useEffect(()=>{u.floating.current&&document.addEventListener("click",_=>{u.floating.current?.contains(_.target)?document.addEventListener("click",()=>p(!1),{once:!0}):(_.preventDefault(),_.stopPropagation(),p(!1))},{once:!0,capture:!0})},[u.floating.current]);let g;return a?g=o.jsx("ul",{className:"dropdown-menu show",ref:u.setFloating,style:h,children:s}):g=null,o.jsxs(o.Fragment,{children:[o.jsx("a",{href:"#",ref:u.setReference,className:_e(r,{open:a}),onClick:_=>{_.preventDefault(),p(!0)},...l,children:e}),g]})});function Lr(t){const e=E.c(16),{value:s,onChange:i}=t,r=D(Ea);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("i",{className:"fa fa-fw fa-files-o"}),e[0]=n):n=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("b",{children:"View:"}),e[1]=l):l=e[1];let a;e[2]!==s?(a=s.toLowerCase(),e[2]=s,e[3]=a):a=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("span",{className:"caret"}),e[4]=d):d=e[4];let u;e[5]!==a?(u=o.jsxs("span",{children:[n," ",l," ",a," ",d]}),e[5]=a,e[6]=u):u=e[6];const h=u;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p={placement:"top-end"},e[7]=p):p=e[7];let g;if(e[8]!==r||e[9]!==i){let j;e[11]!==i?(j=y=>o.jsx(Ne,{onClick:()=>i(y),children:y.toLowerCase().replace("_"," ")},y),e[11]=i,e[12]=j):j=e[12],g=r.map(j),e[8]=r,e[9]=i,e[10]=g}else g=e[10];let _;return e[13]!==h||e[14]!==g?(_=o.jsx(Et,{text:h,className:"btn btn-default btn-xs",options:p,children:g}),e[13]=h,e[14]=g,e[15]=_):_=e[15],_}function Ea(t){return t.backendState.contentViews||[]}function Ta(t){const e=E.c(8),{flow:s,message:i}=t,[r,n]=I.useState(!1);if(r){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>n(!1),e[0]=l):l=e[0];let a;return e[1]!==s||e[2]!==i?(a=o.jsx(Ra,{flow:s,message:i,stopEdit:l}),e[1]=s,e[2]=i,e[3]=a):a=e[3],a}else{let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=()=>n(!0),e[4]=l):l=e[4];let a;return e[5]!==s||e[6]!==i?(a=o.jsx(Aa,{flow:s,message:i,startEdit:l}),e[5]=s,e[6]=i,e[7]=a):a=e[7],a}}function Ra(t){const e=E.c(23),{flow:s,message:i,stopEdit:r}=t,n=G(),l=s.request===i?"request":"response";let a;e[0]!==s||e[1]!==i?(a=je.getContentURL(s,i),e[0]=s,e[1]=i,e[2]=a):a=e[2];const u=Ar(a,i.contentHash),[h,p]=I.useState();let g;e[3]!==u||e[4]!==n||e[5]!==h||e[6]!==s||e[7]!==l||e[8]!==r?(g=async()=>{await n(Ie(s,{[l]:{content:h||u||""}})),r()},e[3]=u,e[4]=n,e[5]=h,e[6]=s,e[7]=l,e[8]=r,e[9]=g):g=e[9];const _=g;let j;e[10]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx("h5",{children:"[Editing]"}),e[10]=j):j=e[10];let y;e[11]!==_?(y=o.jsx(ue,{onClick:_,icon:"fa-check text-success",className:"btn-xs",children:"Done"}),e[11]=_,e[12]=y):y=e[12];let w;e[13]!==r?(w=o.jsx(ue,{onClick:()=>r(),icon:"fa-times text-danger",className:"btn-xs",children:"Cancel"}),e[13]=r,e[14]=w):w=e[14];let $;e[15]!==y||e[16]!==w?($=o.jsxs("div",{className:"controls",children:[j,y," ",w]}),e[15]=y,e[16]=w,e[17]=$):$=e[17];const N=u||"";let k;e[18]!==N?(k=o.jsx(Ca,{initialContent:N,onChange:p}),e[18]=N,e[19]=k):k=e[19];let T;return e[20]!==$||e[21]!==k?(T=o.jsxs("div",{className:"contentview",children:[$,k]},"edit"),e[20]=$,e[21]=k,e[22]=T):T=e[22],T}function Aa(t){const e=E.c(43),{flow:s,message:i,startEdit:r}=t,n=G(),l=s.request===i?"request":"response";let a;e[0]!==s.id||e[1]!==l?(a=V=>V.ui.flow.contentViewFor[s.id+l]||"Auto",e[0]=s.id,e[1]=l,e[2]=a):a=e[2];const d=D(a),[u,h]=I.useState(D(Da));let p;e[3]!==u?(p=()=>h(Math.max(1024,u*2)),e[3]=u,e[4]=p):p=e[4];const g=p,_=Dr(s,i,d,u+1,i.contentHash);let j;if(i.contentLength===0)j="No content";else if(_===void 0)j="Loading...";else{const V=`${_.view_name} ${_.description}`;let W;e[5]!==V?(W=V.trimEnd(),e[5]=V,e[6]=W):W=e[6],j=W}let y;e[7]!==j?(y=o.jsx("h5",{children:j}),e[7]=j,e[8]=y):y=e[8];let w;e[9]!==_||e[10]!==s||e[11]!==i?(w=_&&_?.text.length>0&&o.jsx(Fa,{flow:s,message:i}),e[9]=_,e[10]=s,e[11]=i,e[12]=w):w=e[12];let $;e[13]!==r?($=o.jsx(ue,{onClick:r,icon:"fa-edit",className:"btn-xs",children:"Edit"}),e[13]=r,e[14]=$):$=e[14];let N;e[15]!==n||e[16]!==s||e[17]!==l?(N=o.jsx(Fr,{icon:"fa-upload",text:"Replace",title:"Upload a file to replace the content.",onOpenFile:V=>n(ec(s,V,l)),className:"btn btn-default btn-xs"}),e[15]=n,e[16]=s,e[17]=l,e[18]=N):N=e[18];let k;e[19]!==n||e[20]!==s.id||e[21]!==l?(k=V=>n(pi({messageId:s.id+l,contentView:V})),e[19]=n,e[20]=s.id,e[21]=l,e[22]=k):k=e[22];let T;e[23]!==d||e[24]!==k?(T=o.jsx(Lr,{value:d,onChange:k}),e[23]=d,e[24]=k,e[25]=T):T=e[25];let P;e[26]!==y||e[27]!==w||e[28]!==$||e[29]!==N||e[30]!==T?(P=o.jsxs("div",{className:"controls",children:[y,w," ",$," ",N," ",T]}),e[26]=y,e[27]=w,e[28]=$,e[29]=N,e[30]=T,e[31]=P):P=e[31];let L;e[32]!==s||e[33]!==i?(L=gs.matches(i)&&o.jsx(gs,{flow:s,message:i}),e[32]=s,e[33]=i,e[34]=L):L=e[34];const O=_?.text??"";let M;e[35]!==u||e[36]!==g||e[37]!==O?(M=o.jsx(Ir,{content:O,maxLines:u,showMore:g}),e[35]=u,e[36]=g,e[37]=O,e[38]=M):M=e[38];let U;return e[39]!==L||e[40]!==M||e[41]!==P?(U=o.jsxs("div",{className:"contentview",children:[P,L,M]},"view"),e[39]=L,e[40]=M,e[41]=P,e[42]=U):U=e[42],U}function Da(t){return t.options.content_view_lines_cutoff}function Fa({flow:t,message:e}){const s=t.request===e?"request":"response",i=D(u=>u.ui.flow.contentViewFor[t.id+s]||"Auto"),[r,n]=I.useState(!1),[l,a]=I.useState(!1),d=async()=>{try{const u=je.getContentURL(t,e,i);a(!0);const h=await ne(u);if(!h.ok)throw new Error(`${h.status} ${h.statusText}`.trim());const p=await h.json();await Bl(p),n(!0),setTimeout(()=>n(!1),2e3)}catch(u){console.error(u)}finally{a(!1)}};return o.jsx(ue,{onClick:d,icon:"fa-clipboard",className:"btn-xs",disabled:l,children:r?"Copied!":"Copy"})}const Ia=/^image\/(png|jpe?g|gif|webp|vnc.microsoft.icon|x-icon|svg\+xml)$/i;gs.matches=t=>Ia.test(je.getContentType(t)||"");function gs(t){const e=E.c(5),{flow:s,message:i}=t;let r;e[0]!==s||e[1]!==i?(r=je.getContentURL(s,i),e[0]=s,e[1]=i,e[2]=r):r=e[2];let n;return e[3]!==r?(n=o.jsx("div",{className:"flowview-image",children:o.jsx("img",{src:r,alt:"preview",className:"img-thumbnail"})}),e[3]=r,e[4]=n):n=e[4],n}function La(t){const e=E.c(24),{flow:s}=t,i=G();let r;e[0]!==i||e[1]!==s?(r=g=>i(Ie(s,{request:{method:g}})),e[0]=i,e[1]=s,e[2]=r):r=e[2];let n;e[3]!==s.request.method||e[4]!==r?(n=o.jsx(bt,{content:s.request.method,onEditDone:r,isValid:Oa,selectAllOnClick:!0}),e[3]=s.request.method,e[4]=r,e[5]=n):n=e[5];let l;e[6]!==s.request?(l=ct.pretty_url(s.request),e[6]=s.request,e[7]=l):l=e[7];let a;e[8]!==i||e[9]!==s?(a=g=>i(Ie(s,{request:{path:"",..._i(g)}})),e[8]=i,e[9]=s,e[10]=a):a=e[10];let d;e[11]!==l||e[12]!==a?(d=o.jsx(bt,{content:l,onEditDone:a,isValid:Pa}),e[11]=l,e[12]=a,e[13]=d):d=e[13];let u;e[14]!==i||e[15]!==s?(u=g=>i(Ie(s,{request:{http_version:g}})),e[14]=i,e[15]=s,e[16]=u):u=e[16];let h;e[17]!==s.request.http_version||e[18]!==u?(h=o.jsx(bt,{content:s.request.http_version,onEditDone:u,isValid:ji,selectAllOnClick:!0}),e[17]=s.request.http_version,e[18]=u,e[19]=h):h=e[19];let p;return e[20]!==n||e[21]!==d||e[22]!==h?(p=o.jsx("div",{className:"first-line request-line",children:o.jsxs("div",{children:[n," ",d," ",h]})}),e[20]=n,e[21]=d,e[22]=h,e[23]=p):p=e[23],p}function Pa(t){return!!_i(t)?.host}function Oa(t){return t.length>0}function Ma(t){const e=E.c(19),{flow:s}=t,i=G();let r;e[0]!==i||e[1]!==s?(r=p=>i(Ie(s,{response:{http_version:p}})),e[0]=i,e[1]=s,e[2]=r):r=e[2];let n;e[3]!==s.response.http_version||e[4]!==r?(n=o.jsx(bt,{content:s.response.http_version,onEditDone:r,isValid:ji,selectAllOnClick:!0}),e[3]=s.response.http_version,e[4]=r,e[5]=n):n=e[5];const l=s.response.status_code+"";let a;e[6]!==i||e[7]!==s?(a=p=>i(Ie(s,{response:{code:parseInt(p)}})),e[6]=i,e[7]=s,e[8]=a):a=e[8];let d;e[9]!==l||e[10]!==a?(d=o.jsx(bt,{content:l,onEditDone:a,isValid:qa,selectAllOnClick:!0}),e[9]=l,e[10]=a,e[11]=d):d=e[11];let u;e[12]!==i||e[13]!==s?(u=s.response.http_version!=="HTTP/2.0"&&o.jsxs(o.Fragment,{children:[" ",o.jsx(le,{content:s.response.reason,onEditDone:p=>i(Ie(s,{response:{msg:p}})),selectAllOnClick:!0})]}),e[12]=i,e[13]=s,e[14]=u):u=e[14];let h;return e[15]!==n||e[16]!==d||e[17]!==u?(h=o.jsxs("div",{className:"first-line response-line",children:[n," ",d,u]}),e[15]=n,e[16]=d,e[17]=u,e[18]=h):h=e[18],h}function qa(t){return/^\d+$/.test(t)}function Ha(t){const e=E.c(7),{flow:s,message:i}=t,r=G(),n=s.request===i?"request":"response";let l;e[0]!==r||e[1]!==s||e[2]!==n?(l=d=>r(Ie(s,{[n]:{headers:d}})),e[0]=r,e[1]=s,e[2]=n,e[3]=l):l=e[3];let a;return e[4]!==i.headers||e[5]!==l?(a=o.jsx(Rr,{className:"headers",data:i.headers,onChange:l}),e[4]=i.headers,e[5]=l,e[6]=a):a=e[6],a}function Va(t){const e=E.c(9),{flow:s,message:i}=t,r=G(),n=s.request===i?"request":"response";if(!!!je.get_first_header(i,/^trailer$/i))return null;let a,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("hr",{}),d=o.jsx("h5",{children:"HTTP Trailers"}),e[0]=a,e[1]=d):(a=e[0],d=e[1]);let u;e[2]!==r||e[3]!==s||e[4]!==n?(u=p=>r(Ie(s,{[n]:{trailers:p}})),e[2]=r,e[3]=s,e[4]=n,e[5]=u):u=e[5];let h;return e[6]!==i.trailers||e[7]!==u?(h=o.jsxs(o.Fragment,{children:[a,d,o.jsx(Rr,{className:"trailers",data:i.trailers,onChange:u})]}),e[6]=i.trailers,e[7]=u,e[8]=h):h=e[8],h}const Pr=I.memo(function(e){const s=E.c(20),{flow:i,message:r}=e,n=i.request===r?"request":"response",l=i.request===r?La:Ma;let a;s[0]!==l||s[1]!==i?(a=o.jsx(l,{flow:i}),s[0]=l,s[1]=i,s[2]=a):a=s[2];let d;s[3]!==i||s[4]!==r?(d=o.jsx(Ha,{flow:i,message:r}),s[3]=i,s[4]=r,s[5]=d):d=s[5];let u;s[6]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("hr",{}),s[6]=u):u=s[6];const h=i.id+n;let p;s[7]!==i||s[8]!==r||s[9]!==h?(p=o.jsx(Ta,{flow:i,message:r},h),s[7]=i,s[8]=r,s[9]=h,s[10]=p):p=s[10];let g;s[11]!==i||s[12]!==r?(g=o.jsx(Va,{flow:i,message:r}),s[11]=i,s[12]=r,s[13]=g):g=s[13];let _;return s[14]!==n||s[15]!==a||s[16]!==d||s[17]!==p||s[18]!==g?(_=o.jsxs("section",{className:n,children:[a,d,u,p,g]}),s[14]=n,s[15]=a,s[16]=d,s[17]=p,s[18]=g,s[19]=_):_=s[19],_});function Or(){const t=E.c(2),e=D(Ua);let s;return t[0]!==e?(s=o.jsx(Pr,{flow:e,message:e.request}),t[0]=e,t[1]=s):s=t[1],s}function Ua(t){return t.flows.selected[0]}Or.displayName="Request";function Mr(){const t=E.c(2),e=D(Ba);let s;return t[0]!==e?(s=o.jsx(Pr,{flow:e,message:e.response}),t[0]=e,t[1]=s):s=t[1],s}function Ba(t){return t.flows.selected[0]}Mr.displayName="Response";const Wa=t=>{const e=E.c(3),{message:s}=t,i=s.query?s.op_code:s.response_code,r=s.truncation?"(Truncated)":"";let n;return e[0]!==i||e[1]!==r?(n=o.jsxs("div",{children:[i," ",r]}),e[0]=i,e[1]=r,e[2]=n):n=e[2],n},Ka=t=>{const e=E.c(10),{message:s}=t,i=s.recursion_desired?"Recursive ":"";let r;e[0]!==i?(r=o.jsxs("h5",{children:[i,"Question"]}),e[0]=i,e[1]=r):r=e[1];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Name"}),o.jsx("th",{children:"Type"}),o.jsx("th",{children:"Class"})]})}),e[2]=n):n=e[2];let l;e[3]!==s.questions?(l=s.questions.map(Ya),e[3]=s.questions,e[4]=l):l=e[4];let a;e[5]!==l?(a=o.jsxs("table",{children:[n,o.jsx("tbody",{children:l})]}),e[5]=l,e[6]=a):a=e[6];let d;return e[7]!==r||e[8]!==a?(d=o.jsxs(o.Fragment,{children:[r,a]}),e[7]=r,e[8]=a,e[9]=d):d=e[9],d},ls=t=>{const e=E.c(7),{name:s,values:i}=t;let r;e[0]!==s?(r=o.jsx("h5",{children:s}),e[0]=s,e[1]=r):r=e[1];let n;e[2]!==i?(n=i.length>0?o.jsxs("table",{children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Name"}),o.jsx("th",{children:"Type"}),o.jsx("th",{children:"Class"}),o.jsx("th",{children:"TTL"}),o.jsx("th",{children:"Data"})]})}),o.jsx("tbody",{children:i.map(Ja)})]}):"—",e[2]=i,e[3]=n):n=e[3];let l;return e[4]!==r||e[5]!==n?(l=o.jsxs(o.Fragment,{children:[r,n]}),e[4]=r,e[5]=n,e[6]=l):l=e[6],l},qr=t=>{const e=E.c(24),{type:s,message:i}=t,r="dns-"+s,n=`first-line ${s}-line`;let l;e[0]!==i?(l=o.jsx(Wa,{message:i}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==l?(a=o.jsx("div",{className:n,children:l}),e[2]=n,e[3]=l,e[4]=a):a=e[4];let d;e[5]!==i?(d=o.jsx(Ka,{message:i}),e[5]=i,e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("hr",{}),e[7]=u):u=e[7];const h=`${i.authoritative_answer?"Authoritative ":""}${i.recursion_available?"Recursive ":""}Answer`;let p;e[8]!==i.answers||e[9]!==h?(p=o.jsx(ls,{name:h,values:i.answers}),e[8]=i.answers,e[9]=h,e[10]=p):p=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("hr",{}),e[11]=g):g=e[11];let _;e[12]!==i.authorities?(_=o.jsx(ls,{name:"Authority",values:i.authorities}),e[12]=i.authorities,e[13]=_):_=e[13];let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx("hr",{}),e[14]=j):j=e[14];let y;e[15]!==i.additionals?(y=o.jsx(ls,{name:"Additional",values:i.additionals}),e[15]=i.additionals,e[16]=y):y=e[16];let w;return e[17]!==r||e[18]!==_||e[19]!==y||e[20]!==a||e[21]!==d||e[22]!==p?(w=o.jsxs("section",{className:r,children:[a,d,u,p,g,_,j,y]}),e[17]=r,e[18]=_,e[19]=y,e[20]=a,e[21]=d,e[22]=p,e[23]=w):w=e[23],w};function Hr(){const t=E.c(2),e=D(za);let s;return t[0]!==e.request?(s=o.jsx(qr,{type:"request",message:e.request}),t[0]=e.request,t[1]=s):s=t[1],s}function za(t){return t.flows.selected[0]}Hr.displayName="Request";function Vr(){const t=E.c(2),e=D(Ga);let s;return t[0]!==e.response?(s=o.jsx(qr,{type:"response",message:e.response}),t[0]=e.response,t[1]=s):s=t[1],s}function Ga(t){return t.flows.selected[0]}Vr.displayName="Response";function Ya(t,e){return o.jsxs("tr",{children:[o.jsx("td",{children:t.name}),o.jsx("td",{children:t.type}),o.jsx("td",{children:t.class})]},e)}function Ja(t,e){return o.jsxs("tr",{children:[o.jsx("td",{children:t.name}),o.jsx("td",{children:t.type}),o.jsx("td",{children:t.class}),o.jsx("td",{children:t.ttl}),o.jsx("td",{children:JSON.stringify(t.data).replace(/^"|"$/g,"")})]},e)}function Mt(t,e){return e?(e=[e[0],e[1]],e[0].includes(":")&&(e[0]=`[${e[0]}]`),o.jsxs("tr",{children:[o.jsxs("td",{children:[t,":"]}),o.jsx("td",{children:e.join(":")})]})):o.jsx(o.Fragment,{})}function si(t){const e=E.c(26),{conn:s}=t;let i;if("address"in s){let u;e[0]!==s.address?(u=Mt("Address",s.address),e[0]=s.address,e[1]=u):u=e[1];let h;e[2]!==s.peername?(h=Mt("Resolved address",s.peername),e[2]=s.peername,e[3]=h):h=e[3];let p;e[4]!==s.sockname?(p=Mt("Source address",s.sockname),e[4]=s.sockname,e[5]=p):p=e[5];let g;e[6]!==u||e[7]!==h||e[8]!==p?(g=o.jsxs(o.Fragment,{children:[u,h,p]}),e[6]=u,e[7]=h,e[8]=p,e[9]=g):g=e[9],i=g}else{let u;e[10]!==s.peername?(u=Mt("Address",s.peername),e[10]=s.peername,e[11]=u):u=e[11],i=u}let r;e[12]!==s.sni?(r=s.sni?o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("abbr",{title:"TLS Server Name Indication",children:"SNI"}),":"]}),o.jsx("td",{children:s.sni})]}):null,e[12]=s.sni,e[13]=r):r=e[13];let n;e[14]!==s.alpn?(n=s.alpn?o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("abbr",{title:"ALPN protocol negotiated",children:"ALPN"}),":"]}),o.jsx("td",{children:s.alpn})]}):null,e[14]=s.alpn,e[15]=n):n=e[15];let l;e[16]!==s.tls_version?(l=s.tls_version?o.jsxs("tr",{children:[o.jsx("td",{children:"TLS Version:"}),o.jsx("td",{children:s.tls_version})]}):null,e[16]=s.tls_version,e[17]=l):l=e[17];let a;e[18]!==s.cipher?(a=s.cipher?o.jsxs("tr",{children:[o.jsx("td",{children:"TLS Cipher:"}),o.jsx("td",{children:s.cipher})]}):null,e[18]=s.cipher,e[19]=a):a=e[19];let d;return e[20]!==i||e[21]!==r||e[22]!==n||e[23]!==l||e[24]!==a?(d=o.jsx("table",{className:"connection-table",children:o.jsxs("tbody",{children:[i,r,n,l,a]})}),e[20]=i,e[21]=r,e[22]=n,e[23]=l,e[24]=a,e[25]=d):d=e[25],d}function ni(t){return o.jsx("dl",{className:"cert-attributes",children:t.map(([e,s])=>o.jsxs(I.Fragment,{children:[o.jsx("dt",{children:e}),o.jsx("dd",{children:s})]},e))})}function Qa(t){const e=E.c(46),{flow:s}=t,i=s.server_conn?.cert;if(!i){let W;return e[0]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(o.Fragment,{}),e[0]=W):W=e[0],W}let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("h4",{children:"Server Certificate"},"name"),e[1]=r):r=e[1];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("td",{children:"Type"}),e[2]=n):n=e[2];let l;e[3]!==i.keyinfo[0]||e[4]!==i.keyinfo[1]?(l=o.jsxs("tr",{children:[n,o.jsxs("td",{children:[i.keyinfo[0],", ",i.keyinfo[1]," bits"]})]}),e[3]=i.keyinfo[0],e[4]=i.keyinfo[1],e[5]=l):l=e[5];let a;e[6]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("td",{children:"SHA256 digest"}),e[6]=a):a=e[6];let d;e[7]!==i.sha256?(d=o.jsxs("tr",{children:[a,o.jsx("td",{children:i.sha256})]}),e[7]=i.sha256,e[8]=d):d=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("td",{children:"Valid from"}),e[9]=u):u=e[9];let h;e[10]!==i.notbefore?(h=at(i.notbefore,{includeMilliseconds:!1}),e[10]=i.notbefore,e[11]=h):h=e[11];let p;e[12]!==h?(p=o.jsxs("tr",{children:[u,o.jsx("td",{children:h})]}),e[12]=h,e[13]=p):p=e[13];let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("td",{children:"Valid to"}),e[14]=g):g=e[14];let _;e[15]!==i.notafter?(_=at(i.notafter,{includeMilliseconds:!1}),e[15]=i.notafter,e[16]=_):_=e[16];let j;e[17]!==_?(j=o.jsxs("tr",{children:[g,o.jsx("td",{children:_})]}),e[17]=_,e[18]=j):j=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("td",{children:"Subject Alternative Names"}),e[19]=y):y=e[19];let w;e[20]!==i.altnames?(w=i.altnames.join(", "),e[20]=i.altnames,e[21]=w):w=e[21];let $;e[22]!==w?($=o.jsxs("tr",{children:[y,o.jsx("td",{children:w})]}),e[22]=w,e[23]=$):$=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx("td",{children:"Subject"}),e[24]=N):N=e[24];let k;e[25]!==i.subject?(k=ni(i.subject),e[25]=i.subject,e[26]=k):k=e[26];let T;e[27]!==k?(T=o.jsxs("tr",{children:[N,o.jsx("td",{children:k})]}),e[27]=k,e[28]=T):T=e[28];let P;e[29]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx("td",{children:"Issuer"}),e[29]=P):P=e[29];let L;e[30]!==i.issuer?(L=ni(i.issuer),e[30]=i.issuer,e[31]=L):L=e[31];let O;e[32]!==L?(O=o.jsxs("tr",{children:[P,o.jsx("td",{children:L})]}),e[32]=L,e[33]=O):O=e[33];let M;e[34]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx("td",{children:"Serial"}),e[34]=M):M=e[34];let U;e[35]!==i.serial?(U=o.jsxs("tr",{children:[M,o.jsx("td",{children:i.serial})]}),e[35]=i.serial,e[36]=U):U=e[36];let V;return e[37]!==j||e[38]!==$||e[39]!==T||e[40]!==O||e[41]!==U||e[42]!==l||e[43]!==d||e[44]!==p?(V=o.jsxs(o.Fragment,{children:[r,o.jsx("table",{className:"certificate-table",children:o.jsxs("tbody",{children:[l,d,p,j,$,T,O,U]})})]}),e[37]=j,e[38]=$,e[39]=T,e[40]=O,e[41]=U,e[42]=l,e[43]=d,e[44]=p,e[45]=V):V=e[45],V}function Ur(t){const e=E.c(11),{flow:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("h4",{children:"Client Connection"}),e[0]=i):i=e[0];let r;e[1]!==s.client_conn?(r=o.jsx(si,{conn:s.client_conn}),e[1]=s.client_conn,e[2]=r):r=e[2];let n;e[3]!==s.server_conn?(n=s.server_conn?.address&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{children:"Server Connection"}),o.jsx(si,{conn:s.server_conn})]}),e[3]=s.server_conn,e[4]=n):n=e[4];let l;e[5]!==s?(l=o.jsx(Qa,{flow:s}),e[5]=s,e[6]=l):l=e[6];let a;return e[7]!==r||e[8]!==n||e[9]!==l?(a=o.jsxs("section",{className:"detail",children:[i,r,n,l]}),e[7]=r,e[8]=n,e[9]=l,e[10]=a):a=e[10],a}Ur.displayName="Connection";function Br(t){const e=E.c(7),{flow:s}=t,i=s.error.msg;let r;e[0]!==s.error.timestamp?(r=at(s.error.timestamp),e[0]=s.error.timestamp,e[1]=r):r=e[1];let n;e[2]!==r?(n=o.jsx("div",{children:o.jsx("small",{children:r})}),e[2]=r,e[3]=n):n=e[3];let l;return e[4]!==s.error.msg||e[5]!==n?(l=o.jsx("section",{className:"error",children:o.jsxs("div",{className:"alert alert-warning",children:[i,n]})}),e[4]=s.error.msg,e[5]=n,e[6]=l):l=e[6],l}Br.displayName="Error";function Xa(t){const e=E.c(4),{t:s,deltaTo:i,title:r}=t;let n;return e[0]!==i||e[1]!==s||e[2]!==r?(n=s?o.jsxs("tr",{children:[o.jsxs("td",{children:[r,":"]}),o.jsxs("td",{children:[at(s),i&&o.jsxs("span",{className:"text-muted",children:["(",mi(1e3*(s-i)),")"]})]})]}):o.jsx("tr",{}),e[0]=i,e[1]=s,e[2]=r,e[3]=n):n=e[3],n}function Wr(t){const e=E.c(26),{flow:s}=t;let i;s.type==="http"?i=s.request.timestamp_start:i=s.client_conn.timestamp_start;const r=s.server_conn?.timestamp_start;let n,l,a,d;if(e[0]!==s.client_conn.timestamp_end||e[1]!==s.client_conn.timestamp_start||e[2]!==s.client_conn.timestamp_tls_setup||e[3]!==s.request||e[4]!==s.response?.timestamp_end||e[5]!==s.response?.timestamp_start||e[6]!==s.server_conn?.timestamp_end||e[7]!==s.server_conn?.timestamp_tcp_setup||e[8]!==s.server_conn?.timestamp_tls_setup||e[9]!==s.type||e[10]!==i||e[11]!==r){const g=[{title:"Server conn. initiated",t:r,deltaTo:i},{title:"Server conn. TCP handshake",t:s.server_conn?.timestamp_tcp_setup,deltaTo:i},{title:"Server conn. TLS handshake",t:s.server_conn?.timestamp_tls_setup,deltaTo:i},{title:"Server conn. closed",t:s.server_conn?.timestamp_end,deltaTo:i},{title:"Client conn. established",t:s.client_conn.timestamp_start,deltaTo:s.type==="http"?i:void 0},{title:"Client conn. TLS handshake",t:s.client_conn.timestamp_tls_setup,deltaTo:i},{title:"Client conn. closed",t:s.client_conn.timestamp_end,deltaTo:i}];s.type==="http"&&g.push({title:"First request byte",t:s.request.timestamp_start},{title:"Request complete",t:s.request.timestamp_end,deltaTo:i},{title:"First response byte",t:s.response?.timestamp_start,deltaTo:i},{title:"Response complete",t:s.response?.timestamp_end,deltaTo:i}),a="timing",e[16]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("h4",{children:"Timing"}),e[16]=d):d=e[16],l="timing-table",n=g.filter(td).sort(ed).map(Za),e[0]=s.client_conn.timestamp_end,e[1]=s.client_conn.timestamp_start,e[2]=s.client_conn.timestamp_tls_setup,e[3]=s.request,e[4]=s.response?.timestamp_end,e[5]=s.response?.timestamp_start,e[6]=s.server_conn?.timestamp_end,e[7]=s.server_conn?.timestamp_tcp_setup,e[8]=s.server_conn?.timestamp_tls_setup,e[9]=s.type,e[10]=i,e[11]=r,e[12]=n,e[13]=l,e[14]=a,e[15]=d}else n=e[12],l=e[13],a=e[14],d=e[15];let u;e[17]!==n?(u=o.jsx("tbody",{children:n}),e[17]=n,e[18]=u):u=e[18];let h;e[19]!==l||e[20]!==u?(h=o.jsx("table",{className:l,children:u}),e[19]=l,e[20]=u,e[21]=h):h=e[21];let p;return e[22]!==a||e[23]!==d||e[24]!==h?(p=o.jsxs("section",{className:a,children:[d,h]}),e[22]=a,e[23]=d,e[24]=h,e[25]=p):p=e[25],p}function Za(t){const{title:e,t:s,deltaTo:i}=t;return o.jsx(Xa,{title:e,t:s,deltaTo:i},e)}function ed(t,e){return t.t-e.t}function td(t){return!!t.t}Wr.displayName="Timing";function ks({flow:t,messages_meta:e}){const s=G(),i=D(u=>u.ui.flow.contentViewFor[t.id+"messages"]||"Auto"),[r,n]=I.useState(D(u=>u.options.content_view_lines_cutoff)),l=I.useCallback(()=>n(Math.max(1024,r*2)),[r]),a=Dr(t,"messages",i,r+1,t.id+e.count)??[];let d=r;return o.jsxs("div",{className:"contentview",children:[o.jsxs("div",{className:"controls",children:[o.jsxs("h5",{children:[e.count," Messages"]}),o.jsx(Lr,{value:i,onChange:u=>s(pi({messageId:t.id+"messages",contentView:u}))})]}),a.map((u,h)=>{const p=`fa fa-fw fa-arrow-${u.from_client?"right text-primary":"left text-danger"}`,g=o.jsxs("div",{children:[o.jsxs("small",{children:[o.jsx("i",{className:p}),o.jsx("span",{className:"pull-right",children:u.timestamp&&at(u.timestamp)})]}),o.jsx(Ir,{content:u.text,maxLines:d,showMore:l})]},h);return d-=u.text.split(`
+`).length,g})]})}function Kr(t){const e=E.c(8),{flow:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("h4",{children:"WebSocket"}),e[0]=i):i=e[0];let r;e[1]!==s?(r=o.jsx(ks,{flow:s,messages_meta:s.websocket.messages_meta}),e[1]=s,e[2]=r):r=e[2];let n;e[3]!==s.websocket?(n=o.jsx(sd,{websocket:s.websocket}),e[3]=s.websocket,e[4]=n):n=e[4];let l;return e[5]!==r||e[6]!==n?(l=o.jsxs("section",{className:"websocket",children:[i,r,n]}),e[5]=r,e[6]=n,e[7]=l):l=e[7],l}Kr.displayName="WebSocket";function sd(t){const e=E.c(10),{websocket:s}=t;if(!s.timestamp_end)return null;const i=s.close_reason?`(${s.close_reason})`:"";let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("i",{className:"fa fa-fw fa-window-close text-muted"}),e[0]=r):r=e[0];const n=s.closed_by_client?"client":"server",l=s.close_code;let a;e[1]!==s.timestamp_end?(a=at(s.timestamp_end),e[1]=s.timestamp_end,e[2]=a):a=e[2];let d;e[3]!==a?(d=o.jsx("small",{className:"pull-right",children:a}),e[3]=a,e[4]=d):d=e[4];let u;return e[5]!==i||e[6]!==n||e[7]!==d||e[8]!==s.close_code?(u=o.jsxs("div",{children:[r,"  Closed by ",n," ","with code ",l," ",i,".",d]}),e[5]=i,e[6]=n,e[7]=d,e[8]=s.close_code,e[9]=u):u=e[9],u}function zr(t){const e=E.c(7),{flow:s}=t,i=G();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("h4",{children:"Comment"}),e[0]=r):r=e[0];let n;e[1]!==i||e[2]!==s?(n=a=>{i(Ie(s,{comment:a}))},e[1]=i,e[2]=s,e[3]=n):n=e[3];let l;return e[4]!==s.comment||e[5]!==n?(l=o.jsxs("section",{className:"timing",children:[r,o.jsx(le,{className:"kv-value",content:s.comment,onEditDone:n,placeholder:"empty",selectAllOnClick:!0})]}),e[4]=s.comment,e[5]=n,e[6]=l):l=e[6],l}zr.displayName="Comment";function Gr(t){const e=E.c(2),{flow:s}=t;let i;return e[0]!==s?(i=o.jsx("section",{className:"tcp",children:o.jsx(ks,{flow:s,messages_meta:s.messages_meta})}),e[0]=s,e[1]=i):i=e[1],i}Gr.displayName="Stream Data";function Yr(t){const e=E.c(2),{flow:s}=t;let i;return e[0]!==s?(i=o.jsx("section",{className:"udp",children:o.jsx(ks,{flow:s,messages_meta:s.messages_meta})}),e[0]=s,e[1]=i):i=e[1],i}Yr.displayName="Datagrams";const ii={request:Or,response:Mr,error:Br,connection:Ur,timing:Wr,websocket:Kr,tcpmessages:Gr,udpmessages:Yr,dnsrequest:Hr,dnsresponse:Vr,comment:zr};function vs(t){let e;switch(t.type){case"http":e=["request","response","websocket"].filter(s=>t[s]);break;case"tcp":e=["tcpmessages"];break;case"udp":e=["udpmessages"];break;case"dns":e=["request","response"].filter(s=>t[s]).map(s=>"dns"+s);break}return t.error&&e.push("error"),e.push("connection"),e.push("timing"),e.push("comment"),e}function nd(){const t=E.c(15),e=G(),s=D(rd);let i=D(id);if(s==null){let y;return t[0]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(o.Fragment,{}),t[0]=y):y=t[0],y}const r=vs(s);r.indexOf(i)<0&&(i==="response"&&s.error?i="error":i==="error"&&"response"in s?i="response":i=r[0]);const n=ii[i],l="flow-detail",a="nav-tabs nav-tabs-sm";let d;t[1]!==e?(d=()=>e(He([])),t[1]=e,t[2]=d):d=t[2];let u;t[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("i",{className:"fa fa-times-circle"}),t[3]=u):u=t[3];let h;t[4]!==d?(h=o.jsx("button",{"data-testid":"close-button-id",className:"close-button",onClick:d,children:u}),t[4]=d,t[5]=h):h=t[5];const p=r.map(y=>o.jsx("a",{href:"#",className:_e({active:i===y}),onClick:w=>{w.preventDefault(),e(Ut(y))},children:ii[y].displayName},y));let g;t[6]!==h||t[7]!==p?(g=o.jsxs("nav",{className:a,children:[h,p]}),t[6]=h,t[7]=p,t[8]=g):g=t[8];let _;t[9]!==n||t[10]!==s?(_=o.jsx(n,{flow:s}),t[9]=n,t[10]=s,t[11]=_):_=t[11];let j;return t[12]!==g||t[13]!==_?(j=o.jsxs("div",{className:l,children:[g,_]}),t[12]=g,t[13]=_,t[14]=j):j=t[14],j}function id(t){return t.ui.flow.tab}function rd(t){return t.flows.selected[0]}function od(t){if(t.ctrlKey||t.metaKey)return()=>{};const e=t.key;return t.preventDefault(),(s,i)=>{const{flows:r}=i(),n=r.selected,l=n[0];switch(e){case"k":case"ArrowUp":s(ht(r,-1));break;case"j":case"ArrowDown":s(ht(r,1));break;case" ":case"PageDown":s(ht(r,10));break;case"PageUp":s(ht(r,-10));break;case"End":s(ht(r,1e10));break;case"Home":s(ht(r,-1e10));break;case"Escape":i().ui.modal.activeModal?s(Wi()):s(He([]));break;case"ArrowLeft":{if(!l)break;const a=vs(l),d=i().ui.flow.tab,u=a[(Math.max(0,a.indexOf(d))-1+a.length)%a.length];s(Ut(u));break}case"Tab":case"ArrowRight":{if(!l)break;const a=vs(l),d=i().ui.flow.tab,u=a[(Math.max(0,a.indexOf(d))+1)%a.length];s(Ut(u));break}case"Delete":case"d":{s(Ii(n));break}case"n":{Bt("view.flows.create","get","https://example.com/");break}case"D":{s(Li(n));break}case"a":{s(ys(n));break}case"A":{s(Di());break}case"r":{s(ws(n));break}case"v":{s(Pi(n));break}case"x":{s(Fi(n));break}case"X":{s(Zl());break}case"z":{s(Oi());break}default:return}}}class ld extends I.Component{static defaultProps={axis:"x"};node=Ee.createRef();constructor(e,s){super(e,s),this.state={applied:!1,startPos:0,dragPointer:.1},this.onLostPointerCapture=this.onLostPointerCapture.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this)}onPointerDown(e){this.state.dragPointer===.1&&(e.target.setPointerCapture(e.pointerId),this.setState({startPos:this.props.axis==="x"?e.pageX:e.pageY,dragPointer:e.pointerId}))}onLostPointerCapture(e){if(this.state.dragPointer!==e.pointerId)return;const s=this.node.current,i=s.previousElementSibling,r=s.nextElementSibling;s.style.transform="",i.style.flex=`0 0 ${Math.max(0,(this.props.axis==="x"?i.offsetWidth+e.pageX:i.offsetHeight+e.pageY)-this.state.startPos)}px`,r.style.flex="1 1 auto",this.setState({applied:!0,dragPointer:.1}),this.onResize()}onPointerMove(e){this.state.dragPointer===e.pointerId&&(this.node.current.style.transform=this.props.axis==="x"?`translateX(${e.pageX-this.state.startPos}px)`:`translateY(${e.pageY-this.state.startPos}px)`)}onResize(){window.setTimeout(()=>window.dispatchEvent(new CustomEvent("resize")),1)}reset(e){this.state.applied&&(this.node.current?.previousElementSibling instanceof HTMLElement&&(this.node.current.previousElementSibling.style.flex=""),this.node.current?.nextElementSibling instanceof HTMLElement&&(this.node.current.nextElementSibling.style.flex=""),e||this.setState({applied:!1}),this.onResize())}componentWillUnmount(){this.reset(!0)}render(){return o.jsx("div",{ref:this.node,className:_e("splitter",this.props.axis==="x"?"splitter-x":"splitter-y"),children:o.jsx("div",{onLostPointerCapture:this.onLostPointerCapture,onPointerDown:this.onPointerDown,onPointerMove:this.onPointerMove})})}}const Es=t=>{const e=t.current;return e===null||e.scrollTop===0?!1:Math.ceil(e.scrollTop)+e.clientHeight>=e.scrollHeight},Jr=t=>{t.current&&!Es(t)&&(t.current.scrollTop=t.current.scrollHeight)};function kt(t=void 0){if(!t)return{start:0,end:0,paddingTop:0,paddingBottom:0};const{itemCount:e,rowHeight:s,viewportTop:i,viewportHeight:r,itemHeights:n}=t,l=i+r;let a=0,d=0,u=0,h=0;if(n){let p=0;for(let g=0;g<e;g++){const _=n[g]||s;p<=i&&g%2===0&&(u=p,a=g),p<=l?d=g+1:h+=_,p+=_}if(i>0&&p<i+r)return kt({itemCount:e,rowHeight:s,viewportTop:p-r,viewportHeight:r,itemHeights:n})}else{const p=Math.min(i,Math.max(0,e*s-r));a=Math.max(0,Math.floor(p/s)-1)&-2,d=Math.min(e,a+Math.ceil(r/s)+2),u=a*s,h=(e-d)*s}return{start:a,end:d,paddingTop:u,paddingBottom:h}}const Ts=({flow:t})=>o.jsx("td",{className:_e("col-tls",t.client_conn.tls_established?"col-tls-https":"col-tls-http")});Ts.headerName="";const Rs=({flow:t})=>{const e=D(s=>s.flows._listIndex.get(t.id));return o.jsx("td",{className:"col-index",children:e+1})};Rs.headerName="#";const As=({flow:t})=>o.jsx("td",{className:"col-icon",children:o.jsx("div",{className:_e("resource-icon",Si(t))})});As.headerName="";const Ds=({flow:t})=>{let e;return t.error&&(t.error.msg==="Connection killed."?e=o.jsx("i",{className:"fa fa-fw fa-times pull-right"}):e=o.jsx("i",{className:"fa fa-fw fa-exclamation pull-right"})),o.jsxs("td",{className:"col-path",children:[t.is_replay==="request"&&o.jsx("i",{className:"fa fa-fw fa-repeat pull-right"}),t.intercepted&&o.jsx("i",{className:"fa fa-fw fa-pause pull-right"}),e,o.jsx("span",{className:"marker pull-right",children:t.marked}),$i(t)]})};Ds.headerName="Path";const Fs=({flow:t})=>o.jsx("td",{className:"col-method",children:Ni(t)});Fs.headerName="Method";const Is=({flow:t})=>o.jsx("td",{className:"col-http-version",children:ki(t)});Is.headerName="Version";const Ls=({flow:t})=>{let e="darkred";return t.type!=="http"&&t.type!="dns"||!t.response?o.jsx("td",{className:"col-status"}):(100<=t.response.status_code&&t.response.status_code<200?e="green":200<=t.response.status_code&&t.response.status_code<300?e="darkgreen":300<=t.response.status_code&&t.response.status_code<400?e="lightblue":(400<=t.response.status_code&&t.response.status_code<500||500<=t.response.status_code&&t.response.status_code<600)&&(e="red"),o.jsx("td",{className:"col-status",style:{color:e},children:Ci(t)}))};Ls.headerName="Status";const Ps=({flow:t})=>o.jsx("td",{className:"col-size",children:hi(wi(t))});Ps.headerName="Size";const Os=({flow:t})=>{const e=Wt(t),s=yi(t);return o.jsx("td",{className:"col-time",children:e&&s?mi(1e3*(s-e)):"..."})};Os.headerName="Time";const Ms=({flow:t})=>{const e=Wt(t);return o.jsx("td",{className:"col-timestamp",children:e?at(e):"..."})};Ms.headerName="Start time";const Qt=({flow:t})=>{const e=G();let s=null;return t.intercepted?s=o.jsx("a",{href:"#",className:"quickaction",onClick:()=>e(ys([t])),children:o.jsx("i",{className:"fa fa-fw fa-play text-success"})}):xs(t)&&(s=o.jsx("a",{href:"#",className:"quickaction",onClick:()=>e(ws([t])),children:o.jsx("i",{className:"fa fa-fw fa-repeat text-primary"})})),o.jsx("td",{className:"col-quickactions",children:s?o.jsx("div",{children:s}):o.jsx(o.Fragment,{})})};Qt.headerName="";const qs=({flow:t})=>{const e=t.comment;return o.jsx("td",{className:"col-comment",children:e})};qs.headerName="Comment";const Qr={icon:As,index:Rs,method:Fs,version:Is,path:Ds,quickactions:Qt,size:Ps,status:Ls,time:Os,timestamp:Ms,tls:Ts,comment:qs},cd=Object.freeze(Object.defineProperty({__proto__:null,comment:qs,default:Qr,icon:As,index:Rs,method:Fs,path:Ds,quickactions:Qt,size:Ps,status:Ls,time:Os,timestamp:Ms,tls:Ts,version:Is},Symbol.toStringTag,{value:"Module"})),ad=I.memo(function(){const e=E.c(13),s=G(),i=D(dd),r=D(ud),n=D(fd),l=i?"sort-desc":"sort-asc";let a;if(e[0]!==s||e[1]!==n||e[2]!==r||e[3]!==i||e[4]!==l){const u=n.filter(zl).concat("quickactions");let h;e[6]!==s||e[7]!==r||e[8]!==i||e[9]!==l?(h=p=>o.jsx("th",{className:_e(`col-${p}`,r===p&&l),onClick:()=>s(Ui({column:p===r&&i?void 0:p,desc:p!==r?!1:!i})),children:Qr[p].headerName},p),e[6]=s,e[7]=r,e[8]=i,e[9]=l,e[10]=h):h=e[10],a=u.map(h),e[0]=s,e[1]=n,e[2]=r,e[3]=i,e[4]=l,e[5]=a}else a=e[5];let d;return e[11]!==a?(d=o.jsx("tr",{children:a}),e[11]=a,e[12]=d):d=e[12],d});function dd(t){return t.flows.sort.desc}function ud(t){return t.flows.sort.column}function fd(t){return t.options.web_columns}const pd=Ee.memo(function({flow:e,selected:s,highlighted:i}){const r=G(),n=D(u=>u.options.web_columns),l=_e({selected:s,highlighted:i,intercepted:e.intercepted,"has-request":e.type==="http"&&e.request,"has-response":e.type==="http"&&e.response}),a=I.useCallback(u=>{let h=u.target;for(;h.parentNode;){if(h.classList.contains("col-quickactions"))return;h=h.parentNode}u.metaKey||u.ctrlKey?r(ic(e)):u.shiftKey?(window.getSelection()?.empty(),r(rc(e))):r(He([e]))},[e]),d=n.map(u=>cd[u]).filter(u=>u).concat(Qt);return o.jsx("tr",{className:l,onClick:a,children:d.map(u=>o.jsx(u,{flow:e},u.name))})});class hd extends I.Component{static defaultProps={rowHeight:32};viewport=I.createRef();head=I.createRef();constructor(e,s){super(e,s),this.state={vScroll:kt(),viewportTop:0},this.onViewportUpdate=this.onViewportUpdate.bind(this)}componentDidMount(){window.addEventListener("resize",this.onViewportUpdate),this.onViewportUpdate()}componentWillUnmount(){window.removeEventListener("resize",this.onViewportUpdate)}getSnapshotBeforeUpdate(){return Es(this.viewport)}componentDidUpdate(e,s,i){i&&Jr(this.viewport),this.onViewportUpdate();const{onlySelectedId:r}=this.props;if(r&&r!==e.onlySelectedId){const{rowHeight:l,firstSelectedIndex:a}=this.props,d=this.viewport.current,u=this.head.current,h=u?u.offsetHeight:0,p=a*l+h,g=p+l,_=d.scrollTop,j=d.offsetHeight;p-h<_?d.scrollTop=p-h:g>_+j&&(d.scrollTop=g-j),this.onViewportUpdate()}}onViewportUpdate(){const e=this.viewport.current,s=e.scrollTop||0,i=kt({viewportTop:s,viewportHeight:e.offsetHeight||0,itemCount:this.props.flowView.length,rowHeight:this.props.rowHeight});if(this.state.viewportTop!==s||!Kt(this.state.vScroll,i)){const r=Math.min(s,i.end*this.props.rowHeight);this.setState({vScroll:i,viewportTop:r})}}render(){const{vScroll:e,viewportTop:s}=this.state,{flowView:i,selectedIds:r,highlightedIds:n}=this.props;return o.jsx("div",{className:"flow-table",onScroll:this.onViewportUpdate,ref:this.viewport,children:o.jsxs("table",{children:[o.jsx("thead",{ref:this.head,style:{transform:`translateY(${s}px)`},children:o.jsx(ad,{})}),o.jsxs("tbody",{children:[o.jsx("tr",{style:{height:e.paddingTop}}),i.slice(e.start,e.end).map(l=>o.jsx(pd,{flow:l,selected:r.has(l.id),highlighted:n.has(l.id)},l.id)),o.jsx("tr",{style:{height:e.paddingBottom}})]})]})})}}const md=zt(t=>({flowView:t.flows.view,highlightedIds:t.flows.highlightedIds,selectedIds:t.flows.selectedIds,onlySelectedId:t.flows.selected.length===1&&t.flows.selected[0].id,firstSelectedIndex:t.flows._viewIndex.get(t.flows.selected[0]?.id)}))(hd);function gd(){const t=E.c(3);let e,s;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={padding:"1em 2em"},s=o.jsx("h3",{children:"mitmproxy is running."}),t[0]=e,t[1]=s):(e=t[0],s=t[1]);let i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("div",{style:e,children:[s,o.jsxs("p",{children:["No flows have been recorded yet.",o.jsx("br",{}),"To start capturing traffic, please configure your settings in the Capture tab."]})]}),t[2]=i):i=t[2],i}function vd(t){const e=E.c(20);let{description:s,listen_addrs:i,is_running:r,wireguard_conf:n,type:l}=t;const a=I.useRef(null);let d,u;e[0]!==n?(d=()=>{n&&a.current&&Ll.toCanvas(a.current,n,{margin:0,scale:3})},u=[n],e[0]=n,e[1]=d,e[2]=u):(d=e[1],u=e[2]),I.useEffect(d,u);let h;const p=i.length===1||i.length===2&&i[0][1]===i[1][1],g=i.every(xd);if(p&&g){let y;e[3]!==i[0][1]?(y=Hn(["*",i[0][1]]),e[3]=i[0][1],e[4]=y):y=e[4],h=y}else{let y;e[5]!==i?(y=i.map(Hn).join(" and "),e[5]=i,e[6]=y):y=e[6],h=y}s=s[0].toUpperCase()+s.substr(1);let _;if(r){let y;e[9]!==s||e[10]!==h||e[11]!==l?(y=l==="local"?o.jsxs("div",{className:"text-success",children:[s," is active."]}):o.jsxs("div",{className:"text-success",children:[s," listening at ",h,"."]}),e[9]=s,e[10]=h,e[11]=l,e[12]=y):y=e[12];let w;e[13]!==n?(w=n&&o.jsxs("div",{className:"wireguard-config",children:[o.jsx("pre",{children:n}),o.jsx("canvas",{ref:a})]}),e[13]=n,e[14]=w):w=e[14];let $;e[15]!==y||e[16]!==w?($=o.jsxs(o.Fragment,{children:[y,w]}),e[15]=y,e[16]=w,e[17]=$):$=e[17],_=$}else{let y;e[7]!==s?(y=o.jsx(o.Fragment,{children:o.jsxs("div",{className:"text-warning",children:[s," starting..."]})}),e[7]=s,e[8]=y):y=e[8],_=y}let j;return e[18]!==_?(j=o.jsx("div",{children:_}),e[18]=_,e[19]=j):j=e[19],j}function xd(t){return["::","0.0.0.0"].includes(t[0])}function et(t){const e=E.c(5),{error:s,backendState:i}=t;let r;e[0]!==i||e[1]!==s?(r=s?o.jsx("div",{className:"text-danger",children:s}):i&&o.jsx(vd,{...i}),e[0]=i,e[1]=s,e[2]=r):r=e[2];let n;return e[3]!==r?(n=o.jsx("div",{className:"mode-status",children:r}),e[3]=r,e[4]=n):n=e[4],n}function tt(t){const e=E.c(13),{value:s,onChange:i,children:r,label:n}=t,l=I.useId(),a=`mode-checkbox-${l}`,d=`mode-checkbox-${l}`;let u;e[0]!==i||e[1]!==a||e[2]!==d||e[3]!==s?(u=o.jsx("input",{type:"checkbox",name:a,id:d,checked:s,onChange:i}),e[0]=i,e[1]=a,e[2]=d,e[3]=s,e[4]=u):u=e[4];const h=`mode-checkbox-${l}`;let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p={marginBottom:0,fontWeight:"normal"},e[5]=p):p=e[5];let g;e[6]!==n||e[7]!==h?(g=o.jsx("label",{htmlFor:h,style:p,children:n}),e[6]=n,e[7]=h,e[8]=g):g=e[8];let _;return e[9]!==r||e[10]!==u||e[11]!==g?(_=o.jsxs("div",{className:"mode-entry",children:[u,g,r]}),e[9]=r,e[10]=u,e[11]=g,e[12]=_):_=e[12],_}function st(t){const e=E.c(22),{children:s,iconClass:i,classname:r,isVisible:n}=t,l=I.useId();let a;e[0]!==l?(a=[...l].map(_d),e[0]=l,e[1]=a):a=e[1];const d="--"+a.join(""),u=I.useRef(null),h=I.useRef(null);let p;e[2]!==d?(p=()=>{u.current.style.anchorName=d,h.current.style.positionAnchor=d},e[2]=d,e[3]=p):p=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[4]=g):g=e[4],I.useEffect(p,g);let _;e[5]!==l||e[6]!==n?(_=()=>{n===!0&&document.getElementById(l)?.showPopover()},e[5]=l,e[6]=n,e[7]=_):_=e[7];let j;e[8]!==n?(j=[n],e[8]=n,e[9]=j):j=e[9],I.useEffect(_,j);const y=r?`mode-popover ${r}`:"mode-popover";let w;e[10]!==i?(w=o.jsx("i",{className:i,"aria-hidden":"true"}),e[10]=i,e[11]=w):w=e[11];let $;e[12]!==l||e[13]!==w?($=o.jsx("button",{popoverTarget:l,ref:u,children:w}),e[12]=l,e[13]=w,e[14]=$):$=e[14];let N;e[15]!==s||e[16]!==l?(N=o.jsx("div",{id:l,popover:"auto",ref:h,children:s}),e[15]=s,e[16]=l,e[17]=N):N=e[17];let k;return e[18]!==y||e[19]!==$||e[20]!==N?(k=o.jsxs("div",{className:y,children:[$,N]}),e[18]=y,e[19]=$,e[20]=N,e[21]=k):k=e[21],k}function _d(t){return t.charCodeAt(0).toString(16)}function jd(t){const e=E.c(44),{server:s}=t,{currentProcesses:i,isLoading:r}=D(bd),{selectedProcesses:n}=D(wd);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[0]=l):l=e[0];const[a,d]=I.useState(l),[u,h]=I.useState(""),p=G(),{platform:g}=D(yd);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=B=>{h(B.target.value)},e[1]=_):_=e[1];const j=_;let y;e[2]!==g?(y=B=>{const oe=g.startsWith("win32")?"\\":"/";return ps(B.executable,oe)[1]},e[2]=g,e[3]=y):y=e[3];const w=y;let $;e[4]!==p||e[5]!==w||e[6]!==n||e[7]!==s?($=B=>{const oe=typeof B=="string"?B:w(B),q=n?`${n}, ${oe}`:oe;p(St({server:s,value:q}))},e[4]=p,e[5]=w,e[6]=n,e[7]=s,e[8]=$):$=e[8];const N=$;let k;e[9]!==p||e[10]!==w||e[11]!==n||e[12]!==s?(k=B=>{const oe=n?.split(/,\s*/).filter(q=>q!==w(B)).join(", ");p(St({server:s,value:oe}))},e[9]=p,e[10]=w,e[11]=n,e[12]=s,e[13]=k):k=e[13];const T=k,P=B=>{L(B)&&n?T(B):N(B)},L=B=>{const oe=w(B);return n?.includes(oe)};let O;e[14]!==i||e[15]!==p?(O=()=>{i.length===0&&p($t())},e[14]=i,e[15]=p,e[16]=O):O=e[16];let M;e[17]===Symbol.for("react.memo_cache_sentinel")?(M=[],e[17]=M):M=e[17],I.useEffect(O,M);let U;e[18]!==i||e[19]!==u||e[20]!==w||e[21]!==a?(U=()=>{if(u){const B=i.filter(oe=>w(oe).toLowerCase().includes(u.toLowerCase()));d(B)}else a!==i&&d(i)},e[18]=i,e[19]=u,e[20]=w,e[21]=a,e[22]=U):U=e[22];let V;e[23]!==i||e[24]!==u?(V=[u,i],e[23]=i,e[24]=u,e[25]=V):V=e[25],I.useEffect(U,V);let W;e[26]!==N||e[27]!==u?(W=B=>{B.stopPropagation(),B.key==="Enter"&&(N(u),h(""))},e[26]=N,e[27]=u,e[28]=W):W=e[28];const J=W,[z,te]=I.useState(!1),Y="local-dropdown",Q="dropdown-header",X=n&&n?.length>0?"Add more":"all applications";let Z,de;e[29]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>te(!0),de=()=>te(!1),e[29]=Z,e[30]=de):(Z=e[29],de=e[30]);let me;e[31]!==u||e[32]!==J||e[33]!==X?(me=o.jsx("input",{type:"text",className:"autocomplete-input",placeholder:X,value:u,onChange:j,onKeyDown:J,onClick:Z,onBlur:de}),e[31]=u,e[32]=J,e[33]=X,e[34]=me):me=e[34];const we=st,Be="fa fa-chevron-down",Le="local-popover";let be;e[35]===Symbol.for("react.memo_cache_sentinel")?(be=o.jsx("h4",{children:"Current Applications running on machine"}),e[35]=be):be=e[35];const ke=r?o.jsx("i",{className:"fa fa-spinner","aria-hidden":"true"}):a.length>0?o.jsxs("ul",{className:"dropdown-list",children:[o.jsxs("li",{className:`dropdown-item ${n===""?"selected":""}`,onClick:()=>{p(St({server:s,value:""}))},role:"menuitem",children:[o.jsxs("div",{className:"process-details",children:[o.jsx("div",{className:"process-icon"}),o.jsx("span",{className:"process-name",children:"All applications"})]}),n===""&&o.jsx("i",{className:"fa fa-check","aria-hidden":"true"})]}),o.jsx("hr",{className:"process-separator"}),a.map((B,oe)=>o.jsxs("li",{className:`dropdown-item ${L(B)?"selected":""}`,onClick:()=>P(B),role:"menuitem",children:[o.jsxs("div",{className:"process-details",children:[o.jsx("img",{className:"process-icon",src:`./executable-icon?path=${B.executable}`,loading:"lazy"}),o.jsx("span",{className:"process-name",children:w(B)})]}),L(B)&&o.jsx("i",{className:"fa fa-check","aria-hidden":"true"})]},oe))]}):o.jsxs("span",{children:["Press ",o.jsx("strong",{children:"Enter"})," to capture traffic for programs matching: ",o.jsx("strong",{children:u})]});let C;e[36]!==we||e[37]!==z||e[38]!==be||e[39]!==ke?(C=o.jsxs(we,{iconClass:Be,classname:Le,isVisible:z,children:[be,ke]}),e[36]=we,e[37]=z,e[38]=be,e[39]=ke,e[40]=C):C=e[40];let fe;return e[41]!==me||e[42]!==C?(fe=o.jsx("div",{className:Y,children:o.jsxs("div",{className:Q,children:[me,C]})}),e[41]=me,e[42]=C,e[43]=fe):fe=e[43],fe}function yd(t){return t.backendState}function wd(t){return t.modes.local[0]}function bd(t){return t.processes}function Sd(){const t=E.c(9),e=D(Cd),s=D($d);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(Nd,{server:u,backendState:s[Zi(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n,l;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"Local Applications"}),l=o.jsx("p",{className:"mode-description",children:"Transparently Intercept local application(s)."}),t[5]=n,t[6]=l):(n=t[5],l=t[6]);let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function $d(t){return t.backendState.servers}function Cd(t){return t.modes.local}function Nd(t){const e=E.c(31),{server:s,backendState:i}=t,r=G(),n=D(Ed),l=s.error||i?.last_exception||n||void 0;let a;e[0]!==r||e[1]!==s?(a=k=>{const T=s.selectedProcesses?.split(/,\s*/).filter(P=>P!==k).join(", ");r(St({server:s,value:T}))},e[0]=r,e[1]=s,e[2]=a):a=e[2];const d=a;let u;e[3]!==r||e[4]!==s?(u=()=>r(cr({server:s,value:!s.active})),e[3]=r,e[4]=s,e[5]=u):u=e[5];let h;e[6]!==d||e[7]!==s.selectedProcesses?(h=s.selectedProcesses?.split(/,\s*/).filter(kd).map(k=>o.jsxs("div",{className:"selected-process",children:[k,o.jsx("i",{className:"fa fa-times","aria-hidden":"true",onClick:()=>d(k)})]},k)),e[6]=d,e[7]=s.selectedProcesses,e[8]=h):h=e[8];let p;e[9]!==h?(p=o.jsx("div",{className:"selected-processes",children:h}),e[9]=h,e[10]=p):p=e[10];let g;e[11]!==s?(g=o.jsx(jd,{server:s}),e[11]=s,e[12]=g):g=e[12];let _;e[13]!==r?(_=o.jsx("i",{className:"fa fa-refresh","aria-hidden":"true",onClick:()=>r($t())}),e[13]=r,e[14]=_):_=e[14];let j;e[15]!==g||e[16]!==_?(j=o.jsxs("div",{className:"dropdown-container",children:[g,_]}),e[15]=g,e[16]=_,e[17]=j):j=e[17];let y;e[18]!==p||e[19]!==j?(y=o.jsxs("div",{className:"processes-container",children:[p,j]}),e[18]=p,e[19]=j,e[20]=y):y=e[20];let w;e[21]!==s.active||e[22]!==u||e[23]!==y?(w=o.jsx(tt,{value:s.active,label:"Intercept traffic for",onChange:u,children:y}),e[21]=s.active,e[22]=u,e[23]=y,e[24]=w):w=e[24];let $;e[25]!==i||e[26]!==l?($=o.jsx(et,{error:l,backendState:i}),e[25]=i,e[26]=l,e[27]=$):$=e[27];let N;return e[28]!==$||e[29]!==w?(N=o.jsxs("div",{className:"mode-local",children:[w,$]}),e[28]=$,e[29]=w,e[30]=N):N=e[30],N}function kd(t){return t.trim()!==""}function Ed(t){return t.processes.error}function Td(){const t=E.c(9),e=D(Ad),s=D(Rd);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(Dd,{server:u,backendState:s[Xi(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n,l;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"Explicit HTTP(S) Proxy"}),l=o.jsx("p",{className:"mode-description",children:"You manually configure your client application or device to use an HTTP(S) proxy."}),t[5]=n,t[6]=l):(n=t[5],l=t[6]);let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function Rd(t){return t.backendState.servers}function Ad(t){return t.modes.regular}function Dd(t){const e=E.c(33),{server:s,backendState:i}=t,r=G(),n=s.error||i?.last_exception||void 0;let l;e[0]!==r||e[1]!==s?(l=()=>r(rr({server:s,value:!s.active})),e[0]=r,e[1]=s,e[2]=l):l=e[2];let a,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("h4",{children:"Advanced Configuration"}),d=o.jsx("p",{children:"Listen Host"}),e[3]=a,e[4]=d):(a=e[3],d=e[4]);const u=s.listen_host||"";let h;e[5]!==r||e[6]!==s?(h=T=>r(or({server:s,value:T})),e[5]=r,e[6]=s,e[7]=h):h=e[7];let p;e[8]!==u||e[9]!==h?(p=o.jsx(le,{className:"mode-input",content:u,onEditDone:h}),e[8]=u,e[9]=h,e[10]=p):p=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("p",{children:"Listen Port"}),e[11]=g):g=e[11];let _;e[12]!==s.listen_port?(_=s.listen_port?s.listen_port.toString():"",e[12]=s.listen_port,e[13]=_):_=e[13];let j;e[14]!==r||e[15]!==s?(j=T=>r(lr({server:s,value:parseInt(T)})),e[14]=r,e[15]=s,e[16]=j):j=e[16];let y;e[17]!==_||e[18]!==j?(y=o.jsx(le,{className:"mode-input",content:_,placeholder:"8080",onEditDone:j}),e[17]=_,e[18]=j,e[19]=y):y=e[19];let w;e[20]!==y||e[21]!==p?(w=o.jsxs(st,{iconClass:"fa fa-cog",children:[a,d,p,g,y]}),e[20]=y,e[21]=p,e[22]=w):w=e[22];let $;e[23]!==s.active||e[24]!==l||e[25]!==w?($=o.jsx(tt,{value:s.active,label:"Run HTTP/S Proxy",onChange:l,children:w}),e[23]=s.active,e[24]=l,e[25]=w,e[26]=$):$=e[26];let N;e[27]!==i||e[28]!==n?(N=o.jsx(et,{error:n,backendState:i}),e[27]=i,e[28]=n,e[29]=N):N=e[29];let k;return e[30]!==$||e[31]!==N?(k=o.jsxs("div",{children:[$,N]}),e[30]=$,e[31]=N,e[32]=k):k=e[32],k}function Fd(){const t=E.c(9),e=D(Ld),s=D(Id);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(Pd,{server:u,backendState:s[er(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n,l;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"WireGuard Server"}),l=o.jsx("p",{className:"mode-description",children:"Start a WireGuard™ server and connect an external device for transparent proxying."}),t[5]=n,t[6]=l):(n=t[5],l=t[6]);let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function Id(t){return t.backendState.servers}function Ld(t){return t.modes.wireguard}function Pd(t){const e=E.c(41),{server:s,backendState:i}=t,r=G(),n=s.error||i?.last_exception||void 0;let l;e[0]!==r||e[1]!==s?(l=()=>r(ar({server:s,value:!s.active})),e[0]=r,e[1]=s,e[2]=l):l=e[2];let a,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("h4",{children:"Advanced Configuration"}),d=o.jsx("p",{children:"Listen Host"}),e[3]=a,e[4]=d):(a=e[3],d=e[4]);const u=s.listen_host||"";let h;e[5]!==r||e[6]!==s?(h=M=>r(dr({server:s,value:M})),e[5]=r,e[6]=s,e[7]=h):h=e[7];let p;e[8]!==u||e[9]!==h?(p=o.jsx(le,{className:"mode-input",content:u,placeholder:"(all interfaces)",onEditDone:h}),e[8]=u,e[9]=h,e[10]=p):p=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("p",{children:"Listen Port"}),e[11]=g):g=e[11];let _;e[12]!==s.listen_port?(_=s.listen_port?s.listen_port.toString():"",e[12]=s.listen_port,e[13]=_):_=e[13];let j;e[14]!==r||e[15]!==s?(j=M=>r(ur({server:s,value:parseInt(M)})),e[14]=r,e[15]=s,e[16]=j):j=e[16];let y;e[17]!==_||e[18]!==j?(y=o.jsx(le,{className:"mode-input",content:_,placeholder:"51820",onEditDone:j}),e[17]=_,e[18]=j,e[19]=y):y=e[19];let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("p",{children:"Configuration File"}),e[20]=w):w=e[20];const $=s.file_path||"";let N;e[21]!==r||e[22]!==s?(N=M=>r(fr({server:s,value:M})),e[21]=r,e[22]=s,e[23]=N):N=e[23];let k;e[24]!==$||e[25]!==N?(k=o.jsx(le,{className:"mode-input",content:$,placeholder:"~/.mitmproxy/wireguard.conf",onEditDone:N}),e[24]=$,e[25]=N,e[26]=k):k=e[26];let T;e[27]!==y||e[28]!==k||e[29]!==p?(T=o.jsxs(st,{iconClass:"fa fa-cog",children:[a,d,p,g,y,w,k]}),e[27]=y,e[28]=k,e[29]=p,e[30]=T):T=e[30];let P;e[31]!==s.active||e[32]!==l||e[33]!==T?(P=o.jsx(tt,{value:s.active,label:"Run WireGuard Server",onChange:l,children:T}),e[31]=s.active,e[32]=l,e[33]=T,e[34]=P):P=e[34];let L;e[35]!==i||e[36]!==n?(L=o.jsx(et,{error:n,backendState:i}),e[35]=i,e[36]=n,e[37]=L):L=e[37];let O;return e[38]!==P||e[39]!==L?(O=o.jsxs("div",{children:[P,L]}),e[38]=P,e[39]=L,e[40]=O):O=e[40],O}function Od(){const t=E.c(15),e=G(),s=D(qd),i=D(Md);let r,n;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("h4",{className:"mode-title",children:"Reverse Proxy"}),n=o.jsx("p",{className:"mode-description",children:"Requests are forwarded to a preconfigured destination."}),t[0]=r,t[1]=n):(r=t[0],n=t[1]);let l;if(t[2]!==i||t[3]!==s){let p;t[5]!==i?(p=(g,_)=>o.jsx(Hd,{removable:_>0,server:g,backendState:i[Ns(g)]},g.ui_id),t[5]=i,t[6]=p):p=t[6],l=s.map(p),t[2]=i,t[3]=s,t[4]=l}else l=t[4];let a;t[7]!==e?(a=()=>e(na()),t[7]=e,t[8]=a):a=t[8];let d;t[9]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("i",{className:"fa fa-plus-square-o","aria-hidden":"true"}),t[9]=d):d=t[9];let u;t[10]!==a?(u=o.jsxs("div",{className:"mode-reverse-add-server",onClick:a,children:[d,"Add additional server"]}),t[10]=a,t[11]=u):u=t[11];let h;return t[12]!==l||t[13]!==u?(h=o.jsxs("div",{children:[r,n,o.jsxs("div",{className:"mode-reverse-servers",children:[l,u]})]}),t[12]=l,t[13]=u,t[14]=h):h=t[14],h}function Md(t){return t.backendState.servers}function qd(t){return t.modes.reverse}function Hd(t){const e=E.c(56),{removable:s,server:i,backendState:r}=t,n=G();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Object.values(Jt),e[0]=l):l=e[0];const a=l;let d;e[1]!==n||e[2]!==i?(d=async()=>{i.active&&await n(ms({server:i,value:!1})).unwrap(),await n(ia(i))},e[1]=n,e[2]=i,e[3]=d):d=e[3];const u=d,h=i.error||r?.last_exception||void 0,p=i.active;let g;e[4]!==n||e[5]!==i?(g=()=>{n(ms({server:i,value:!i.active}))},e[4]=n,e[5]=i,e[6]=g):g=e[6];const _=i.protocol;let j;e[7]!==n||e[8]!==i?(j=Z=>{n(mr({server:i,value:Z.target.value}))},e[7]=n,e[8]=i,e[9]=j):j=e[9];let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=a.map(Vd),e[10]=y):y=e[10];let w;e[11]!==i.protocol||e[12]!==j?(w=o.jsx("select",{name:"protocols",className:"mode-reverse-dropdown",value:_,onChange:j,children:y}),e[11]=i.protocol,e[12]=j,e[13]=w):w=e[13];let $;e[14]!==i.destination?($=i.destination?.toString()||"",e[14]=i.destination,e[15]=$):$=e[15];let N;e[16]!==n||e[17]!==i?(N=Z=>n(gr({server:i,value:Z})),e[16]=n,e[17]=i,e[18]=N):N=e[18];let k;e[19]!==N||e[20]!==$?(k=o.jsx(le,{className:"mode-reverse-input",content:$,onEditDone:N,placeholder:"example.com"}),e[19]=N,e[20]=$,e[21]=k):k=e[21];let T,P;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx("h4",{children:"Advanced Configuration"}),P=o.jsx("p",{children:"Listen Host"}),e[22]=T,e[23]=P):(T=e[22],P=e[23]);const L=i.listen_host||"";let O;e[24]!==n||e[25]!==i?(O=Z=>n(pr({server:i,value:Z})),e[24]=n,e[25]=i,e[26]=O):O=e[26];let M;e[27]!==L||e[28]!==O?(M=o.jsx(le,{className:"mode-input",content:L,onEditDone:O,placeholder:"*"}),e[27]=L,e[28]=O,e[29]=M):M=e[29];let U;e[30]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx("p",{children:"Listen Port"}),e[30]=U):U=e[30];const V=String(i.listen_port||"");let W;e[31]!==n||e[32]!==i?(W=Z=>n(hr({server:i,value:Z})),e[31]=n,e[32]=i,e[33]=W):W=e[33];let J;e[34]!==V||e[35]!==W?(J=o.jsx(le,{className:"mode-input",content:V,onEditDone:W,placeholder:"8080"}),e[34]=V,e[35]=W,e[36]=J):J=e[36];let z;e[37]!==M||e[38]!==J?(z=o.jsxs(st,{iconClass:"fa fa-cog",children:[T,P,M,U,J]}),e[37]=M,e[38]=J,e[39]=z):z=e[39];let te;e[40]!==u||e[41]!==s?(te=s&&o.jsx("i",{className:"fa fa-fw fa-trash fa-lg","aria-hidden":"true",onClick:u}),e[40]=u,e[41]=s,e[42]=te):te=e[42];let Y;e[43]!==i.active||e[44]!==k||e[45]!==z||e[46]!==te||e[47]!==g||e[48]!==w?(Y=o.jsxs(tt,{value:p,label:"Forward",onChange:g,children:[w,"traffic to",k,z,te]}),e[43]=i.active,e[44]=k,e[45]=z,e[46]=te,e[47]=g,e[48]=w,e[49]=Y):Y=e[49];let Q;e[50]!==r||e[51]!==h?(Q=o.jsx(et,{error:h,backendState:r}),e[50]=r,e[51]=h,e[52]=Q):Q=e[52];let X;return e[53]!==Y||e[54]!==Q?(X=o.jsxs("div",{children:[Y,Q]}),e[53]=Y,e[54]=Q,e[55]=X):X=e[55],X}function Vd(t){return o.jsx("option",{value:t,children:t},t)}function Ud(){const t=E.c(9),e=D(Wd),s=D(Bd);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(Kd,{server:u,backendState:s[tr(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"Transparent Proxy"}),t[5]=n):n=t[5];let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsxs("p",{className:"mode-description",children:["You"," ",o.jsx("a",{href:"https://docs.mitmproxy.org/stable/howto-transparent/",style:{textDecoration:"underline",color:"inherit"},children:"configure your routing table"})," ","to send traffic through mitmproxy."]}),t[6]=l):l=t[6];let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function Bd(t){return t.backendState.servers}function Wd(t){return t.modes.transparent}function Kd(t){const e=E.c(33),{server:s,backendState:i}=t,r=G(),n=s.error||i?.last_exception||void 0;let l;e[0]!==r||e[1]!==s?(l=()=>r(xr({server:s,value:!s.active})),e[0]=r,e[1]=s,e[2]=l):l=e[2];let a,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("h4",{children:"Advanced Configuration"}),d=o.jsx("p",{children:"Listen Host"}),e[3]=a,e[4]=d):(a=e[3],d=e[4]);const u=s.listen_host||"";let h;e[5]!==r||e[6]!==s?(h=T=>r(_r({server:s,value:T})),e[5]=r,e[6]=s,e[7]=h):h=e[7];let p;e[8]!==u||e[9]!==h?(p=o.jsx(le,{className:"mode-input",content:u,onEditDone:h}),e[8]=u,e[9]=h,e[10]=p):p=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("p",{children:"Listen Port"}),e[11]=g):g=e[11];let _;e[12]!==s.listen_port?(_=s.listen_port?s.listen_port.toString():"",e[12]=s.listen_port,e[13]=_):_=e[13];let j;e[14]!==r||e[15]!==s?(j=T=>r(jr({server:s,value:parseInt(T)})),e[14]=r,e[15]=s,e[16]=j):j=e[16];let y;e[17]!==_||e[18]!==j?(y=o.jsx(le,{className:"mode-input",content:_,placeholder:"8080",onEditDone:j}),e[17]=_,e[18]=j,e[19]=y):y=e[19];let w;e[20]!==y||e[21]!==p?(w=o.jsxs(st,{iconClass:"fa fa-cog",children:[a,d,p,g,y]}),e[20]=y,e[21]=p,e[22]=w):w=e[22];let $;e[23]!==s.active||e[24]!==l||e[25]!==w?($=o.jsx(tt,{value:s.active,label:"Run Transparent Proxy",onChange:l,children:w}),e[23]=s.active,e[24]=l,e[25]=w,e[26]=$):$=e[26];let N;e[27]!==i||e[28]!==n?(N=o.jsx(et,{error:n,backendState:i}),e[27]=i,e[28]=n,e[29]=N):N=e[29];let k;return e[30]!==$||e[31]!==N?(k=o.jsxs("div",{children:[$,N]}),e[30]=$,e[31]=N,e[32]=k):k=e[32],k}function zd(){const t=E.c(9),e=D(Yd),s=D(Gd);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(Jd,{server:u,backendState:s[sr(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n,l;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"SOCKS Proxy"}),l=o.jsx("p",{className:"mode-description",children:"You manually configure your client application or device to use a SOCKS5 proxy."}),t[5]=n,t[6]=l):(n=t[5],l=t[6]);let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function Gd(t){return t.backendState.servers}function Yd(t){return t.modes.socks}function Jd(t){const e=E.c(33),{server:s,backendState:i}=t,r=G(),n=s.error||i?.last_exception||void 0;let l;e[0]!==r||e[1]!==s?(l=()=>r(yr({server:s,value:!s.active})),e[0]=r,e[1]=s,e[2]=l):l=e[2];let a,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("h4",{children:"Advanced Configuration"}),d=o.jsx("p",{children:"Listen Host"}),e[3]=a,e[4]=d):(a=e[3],d=e[4]);const u=s.listen_host||"";let h;e[5]!==r||e[6]!==s?(h=T=>r(wr({server:s,value:T})),e[5]=r,e[6]=s,e[7]=h):h=e[7];let p;e[8]!==u||e[9]!==h?(p=o.jsx(le,{className:"mode-input",content:u,onEditDone:h}),e[8]=u,e[9]=h,e[10]=p):p=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("p",{children:"Listen Port"}),e[11]=g):g=e[11];let _;e[12]!==s.listen_port?(_=s.listen_port?s.listen_port.toString():"",e[12]=s.listen_port,e[13]=_):_=e[13];let j;e[14]!==r||e[15]!==s?(j=T=>r(br({server:s,value:parseInt(T)})),e[14]=r,e[15]=s,e[16]=j):j=e[16];let y;e[17]!==_||e[18]!==j?(y=o.jsx(le,{className:"mode-input",content:_,placeholder:"8080",onEditDone:j}),e[17]=_,e[18]=j,e[19]=y):y=e[19];let w;e[20]!==y||e[21]!==p?(w=o.jsxs(st,{iconClass:"fa fa-cog",children:[a,d,p,g,y]}),e[20]=y,e[21]=p,e[22]=w):w=e[22];let $;e[23]!==s.active||e[24]!==l||e[25]!==w?($=o.jsx(tt,{value:s.active,label:"Run SOCKS Proxy",onChange:l,children:w}),e[23]=s.active,e[24]=l,e[25]=w,e[26]=$):$=e[26];let N;e[27]!==i||e[28]!==n?(N=o.jsx(et,{error:n,backendState:i}),e[27]=i,e[28]=n,e[29]=N):N=e[29];let k;return e[30]!==$||e[31]!==N?(k=o.jsxs("div",{children:[$,N]}),e[30]=$,e[31]=N,e[32]=k):k=e[32],k}function Qd(){const t=E.c(9),e=D(Zd),s=D(Xd);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(eu,{server:u,backendState:s[nr(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n,l;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"Explicit HTTP(S) Proxy (With Upstream Proxy)"}),l=o.jsx("p",{className:"mode-description",children:"All requests are forwarded to a second HTTP(S) proxy server."}),t[5]=n,t[6]=l):(n=t[5],l=t[6]);let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function Xd(t){return t.backendState.servers}function Zd(t){return t.modes.upstream}function eu(t){const e=E.c(42),{server:s,backendState:i}=t,r=G(),n=s.error||i?.last_exception||void 0;let l;e[0]!==r||e[1]!==s?(l=()=>{r(Sr({server:s,value:!s.active}))},e[0]=r,e[1]=s,e[2]=l):l=e[2];let a;e[3]!==s.destination?(a=s.destination?.toString()||"",e[3]=s.destination,e[4]=a):a=e[4];let d;e[5]!==r||e[6]!==s?(d=O=>r(Nr({server:s,value:O})),e[5]=r,e[6]=s,e[7]=d):d=e[7];let u;e[8]!==a||e[9]!==d?(u=o.jsx(le,{className:"mode-upstream-input",content:a,onEditDone:d,placeholder:"http://example.com:8080"}),e[8]=a,e[9]=d,e[10]=u):u=e[10];let h,p;e[11]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("h4",{children:"Advanced Configuration"}),p=o.jsx("p",{children:"Listen Host"}),e[11]=h,e[12]=p):(h=e[11],p=e[12]);const g=s.listen_host||"";let _;e[13]!==r||e[14]!==s?(_=O=>r($r({server:s,value:O})),e[13]=r,e[14]=s,e[15]=_):_=e[15];let j;e[16]!==g||e[17]!==_?(j=o.jsx(le,{className:"mode-input",content:g,onEditDone:_}),e[16]=g,e[17]=_,e[18]=j):j=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("p",{children:"Listen Port"}),e[19]=y):y=e[19];let w;e[20]!==s.listen_port?(w=s.listen_port?s.listen_port.toString():"",e[20]=s.listen_port,e[21]=w):w=e[21];let $;e[22]!==r||e[23]!==s?($=O=>r(Cr({server:s,value:parseInt(O)})),e[22]=r,e[23]=s,e[24]=$):$=e[24];let N;e[25]!==w||e[26]!==$?(N=o.jsx(le,{className:"mode-input",content:w,placeholder:"8080",onEditDone:$}),e[25]=w,e[26]=$,e[27]=N):N=e[27];let k;e[28]!==N||e[29]!==j?(k=o.jsxs(st,{iconClass:"fa fa-cog",children:[h,p,j,y,N]}),e[28]=N,e[29]=j,e[30]=k):k=e[30];let T;e[31]!==s.active||e[32]!==l||e[33]!==k||e[34]!==u?(T=o.jsxs(tt,{value:s.active,label:"Run HTTP/S Proxy and forward requests to",onChange:l,children:[u,k]}),e[31]=s.active,e[32]=l,e[33]=k,e[34]=u,e[35]=T):T=e[35];let P;e[36]!==i||e[37]!==n?(P=o.jsx(et,{error:n,backendState:i}),e[36]=i,e[37]=n,e[38]=P):P=e[38];let L;return e[39]!==T||e[40]!==P?(L=o.jsxs("div",{children:[T,P]}),e[39]=T,e[40]=P,e[41]=L):L=e[41],L}function tu(){const t=E.c(9),e=D(nu),s=D(su);let i;if(t[0]!==s||t[1]!==e){let d;t[3]!==s?(d=u=>o.jsx(iu,{server:u,backendState:s[ir(u)]},u.ui_id),t[3]=s,t[4]=d):d=t[4],i=e.map(d),t[0]=s,t[1]=e,t[2]=i}else i=t[2];const r=i;let n,l;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h4",{className:"mode-title",children:"DNS Server"}),l=o.jsx("p",{className:"mode-description",children:"A recursive DNS resolver using the host's DNS configuration."}),t[5]=n,t[6]=l):(n=t[5],l=t[6]);let a;return t[7]!==r?(a=o.jsxs("div",{children:[n,l,r]}),t[7]=r,t[8]=a):a=t[8],a}function su(t){return t.backendState.servers}function nu(t){return t.modes.dns}function iu(t){const e=E.c(33),{server:s,backendState:i}=t,r=G(),n=s.error||i?.last_exception||void 0;let l;e[0]!==r||e[1]!==s?(l=()=>r(kr({server:s,value:!s.active})),e[0]=r,e[1]=s,e[2]=l):l=e[2];let a,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("h4",{children:"Advanced Configuration"}),d=o.jsx("p",{children:"Listen Host"}),e[3]=a,e[4]=d):(a=e[3],d=e[4]);const u=s.listen_host||"";let h;e[5]!==r||e[6]!==s?(h=T=>r(Er({server:s,value:T})),e[5]=r,e[6]=s,e[7]=h):h=e[7];let p;e[8]!==u||e[9]!==h?(p=o.jsx(le,{className:"mode-input",content:u,onEditDone:h}),e[8]=u,e[9]=h,e[10]=p):p=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("p",{children:"Listen Port"}),e[11]=g):g=e[11];let _;e[12]!==s.listen_port?(_=s.listen_port?s.listen_port.toString():"",e[12]=s.listen_port,e[13]=_):_=e[13];let j;e[14]!==r||e[15]!==s?(j=T=>r(Tr({server:s,value:parseInt(T)})),e[14]=r,e[15]=s,e[16]=j):j=e[16];let y;e[17]!==_||e[18]!==j?(y=o.jsx(le,{className:"mode-input",content:_,placeholder:"8080",onEditDone:j}),e[17]=_,e[18]=j,e[19]=y):y=e[19];let w;e[20]!==y||e[21]!==p?(w=o.jsxs(st,{iconClass:"fa fa-cog",children:[a,d,p,g,y]}),e[20]=y,e[21]=p,e[22]=w):w=e[22];let $;e[23]!==s.active||e[24]!==l||e[25]!==w?($=o.jsx(tt,{value:s.active,label:"Run DNS Server",onChange:l,children:w}),e[23]=s.active,e[24]=l,e[25]=w,e[26]=$):$=e[26];let N;e[27]!==i||e[28]!==n?(N=o.jsx(et,{error:n,backendState:i}),e[27]=i,e[28]=n,e[29]=N):N=e[29];let k;return e[30]!==$||e[31]!==N?(k=o.jsxs("div",{children:[$,N]}),e[30]=$,e[31]=N,e[32]=k):k=e[32],k}function ri(t){const e=E.c(10),{title:s,description:i}=t;let r;e[0]!==s?(r=o.jsx("h4",{className:"mode-title",children:s}),e[0]=s,e[1]=r):r=e[1];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("i",{className:"fa fa-exclamation-triangle","aria-hidden":"true"}),e[2]=n):n=e[2];let l;e[3]!==r?(l=o.jsxs("div",{className:"title-icon-container",children:[r,n]}),e[3]=r,e[4]=l):l=e[4];let a;e[5]!==i?(a=o.jsx("p",{className:"mode-description",children:i}),e[5]=i,e[6]=a):a=e[6];let d;return e[7]!==l||e[8]!==a?(d=o.jsxs("div",{className:"missing-mode-container",children:[l,a]}),e[7]=l,e[8]=a,e[9]=d):d=e[9],d}function ru(){const t=E.c(19),{platform:e,localModeUnavailable:s}=D(ou);let i,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("h2",{children:"Intercept Traffic"}),r=o.jsx("p",{children:"Configure how you want to intercept traffic with mitmproxy."}),t[0]=i,t[1]=r):(i=t[0],r=t[1]);let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("h3",{children:"Recommended"}),t[2]=n):n=t[2];let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Td,{}),t[3]=l):l=t[3];let a;t[4]!==s?(a=s!==null?o.jsx(ri,{title:"Local Redirect Mode",description:s}):o.jsx(Sd,{}),t[4]=s,t[5]=a):a=t[5];let d,u;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Fd,{}),u=o.jsx(Od,{}),t[6]=d,t[7]=u):(d=t[6],u=t[7]);let h;t[8]!==a?(h=o.jsxs("div",{className:"modes-category green-left-border",children:[n,o.jsxs("div",{className:"modes-container",children:[l,a,d,u]})]}),t[8]=a,t[9]=h):h=t[9];let p;t[10]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("h3",{children:"Advanced"}),t[10]=p):p=t[10];let g,_,j;t[11]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(zd,{}),g=o.jsx(Qd,{}),_=o.jsx(tu,{}),t[11]=g,t[12]=_,t[13]=j):(g=t[11],_=t[12],j=t[13]);let y;t[14]!==e?(y=o.jsxs("div",{className:"modes-category gray-left-border",children:[p,o.jsxs("div",{className:"modes-container",children:[j,g,_,e.startsWith("win32")?o.jsx(ri,{title:"Transparent Proxy",description:"This mode is only supported on Linux and MacOS."}):o.jsx(Ud,{})]})]}),t[14]=e,t[15]=y):y=t[15];let w;return t[16]!==y||t[17]!==h?(w=o.jsxs("div",{className:"modes",children:[i,r,h,y]}),t[16]=y,t[17]=h,t[18]=w):w=t[18],w}function ou(t){return t.backendState}function lu(){const t=E.c(4),e=D(du),s=D(au),i=D(cu);let r;return t[0]!==i||t[1]!==s||t[2]!==e?(r=o.jsx("div",{className:"main-view",children:i===ve.Capture?o.jsx(ru,{}):o.jsxs(o.Fragment,{children:[s?o.jsx(md,{}):o.jsx(gd,{}),e&&o.jsxs(o.Fragment,{children:[o.jsx(ld,{},"splitter"),o.jsx(nd,{},"flowDetails")]})]})}),t[0]=i,t[1]=s,t[2]=e,t[3]=r):r=t[3],r}function cu(t){return t.ui.tabs.current}function au(t){return t.flows.list.length>0}function du(t){return t.flows.selected.length===1}function gt(t){const e=E.c(2),{children:s}=t;let i;return e[0]!==s?(i=window.MITMWEB_STATIC?null:o.jsx(o.Fragment,{children:s}),e[0]=s,e[1]=i):i=e[1],i}const uu=I.memo(function(){const e=E.c(20),s=G(),i=D(fu);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={placement:"bottom-start"},e[0]=r):r=e[0];let n;e[1]!==s?(n=o.jsx("li",{children:o.jsx(Fr,{icon:"fa-folder-open",text:" Open...",onClick:pu,onOpenFile:w=>{s(tc(w)),document.body.click()}})}),e[1]=s,e[2]=n):n=e[2];let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsxs(Ne,{onClick:hu,children:[o.jsx("i",{className:"fa fa-fw fa-floppy-o"})," Save"]}),e[3]=l):l=e[3];let a;e[4]!==i?(a=()=>location.replace("/flows/dump?filter="+i),e[4]=i,e[5]=a):a=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("i",{className:"fa fa-fw fa-floppy-o"}),e[6]=d):d=e[6];let u;e[7]!==a?(u=o.jsxs(Ne,{onClick:a,children:[d," Save filtered"]}),e[7]=a,e[8]=u):u=e[8];let h;e[9]!==s?(h=()=>confirm("Delete all flows?")&&s(Oi()),e[9]=s,e[10]=h):h=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("i",{className:"fa fa-fw fa-trash"}),e[11]=p):p=e[11];let g;e[12]!==h?(g=o.jsxs(Ne,{onClick:h,children:[p," Clear All"]}),e[12]=h,e[13]=g):g=e[13];let _;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(ka,{}),e[14]=_):_=e[14];let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsxs(gt,{children:[_,o.jsx("li",{children:o.jsxs("a",{href:"http://mitm.it/",target:"_blank",rel:"noreferrer",children:[o.jsx("i",{className:"fa fa-fw fa-external-link"})," Install Certificates..."]})})]}),e[15]=j):j=e[15];let y;return e[16]!==n||e[17]!==u||e[18]!==g?(y=o.jsxs(Et,{className:"pull-left special",text:"File",options:r,children:[n,l,u,g,j]}),e[16]=n,e[17]=u,e[18]=g,e[19]=y):y=e[19],y});function fu(t){return t.ui.filter[ge.Search]}function pu(t){return t.stopPropagation()}function hu(){return location.replace("/flows/dump")}const mu=I.memo(function(){const e=E.c(5),s=D(gu),i=D(vu);switch(s){case wt.INIT:{let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("span",{className:"connection-indicator init",children:"connecting…"}),e[0]=r):r=e[0],r}case wt.FETCHING:{let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("span",{className:"connection-indicator fetching",children:"fetching data…"}),e[1]=r):r=e[1],r}case wt.ESTABLISHED:{let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("span",{className:"connection-indicator established",children:"connected"}),e[2]=r):r=e[2],r}case wt.ERROR:{let r;return e[3]!==i?(r=o.jsx("span",{className:"connection-indicator error",title:i,children:"connection lost"}),e[3]=i,e[4]=r):r=e[4],r}default:Ct(s)}});function gu(t){return t.connection.state}function vu(t){return t.connection.message}Xr.title="Capture";function Xr(){const t=E.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(o.Fragment,{}),t[0]=e):e=t[0],e}const oi=function(){function t(i,r){function n(){this.constructor=i}n.prototype=r.prototype,i.prototype=new n}function e(i,r,n,l){this.message=i,this.expected=r,this.found=n,this.location=l,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,e)}t(e,Error);function s(i){var r=arguments.length>1?arguments[1]:{},n={},l={start:_n},a=_n,d={type:"other",description:"filter expression"},u=function(c){return c},h={type:"other",description:"whitespace"},p=/^[ \t\n\r]/,g={type:"class",value:"[ \\t\\n\\r]",description:"[ \\t\\n\\r]"},_={type:"other",description:"control character"},j=/^[|&!()~"]/,y={type:"class",value:'[|&!()~"]',description:'[|&!()~"]'},w={type:"other",description:"optional whitespace"},$="|",N={type:"literal",value:"|",description:'"|"'},k=function(c,f){return il(c,f)},T="&",P={type:"literal",value:"&",description:'"&"'},L=function(c,f){return rl(c,f)},O="!",M={type:"literal",value:"!",description:'"!"'},U=function(c){return ol(c)},V="(",W={type:"literal",value:"(",description:'"("'},J=")",z={type:"literal",value:")",description:'")"'},te=function(c){return ll(c)},Y="~all",Q={type:"literal",value:"~all",description:'"~all"'},X=function(){return Sn},Z="~a",de={type:"literal",value:"~a",description:'"~a"'},me=function(){return Cn},we="~b",Be={type:"literal",value:"~b",description:'"~b"'},Le=function(c){return cl(c)},be="~bq",ke={type:"literal",value:"~bq",description:'"~bq"'},C=function(c){return al(c)},fe="~bs",B={type:"literal",value:"~bs",description:'"~bs"'},oe=function(c){return dl(c)},q="~c",Se={type:"literal",value:"~c",description:'"~c"'},We=function(c){return ul(c)},Pe="~comment",ee={type:"literal",value:"~comment",description:'"~comment"'},Oe=function(c){return fl(c)},Te="~d",re={type:"literal",value:"~d",description:'"~d"'},ce=function(c){return pl(c)},he="~dns",Re={type:"literal",value:"~dns",description:'"~dns"'},nt=function(){return Nn},Je="~dst",Zt={type:"literal",value:"~dst",description:'"~dst"'},b=function(c){return hl(c)},S="~e",A={type:"literal",value:"~e",description:'"~e"'},H=function(){return kn},Tt="~h",es={type:"literal",value:"~h",description:'"~h"'},$e=function(c){return ml(c)},Ae="~hq",ut={type:"literal",value:"~hq",description:'"~hq"'},Ke=function(c){return gl(c)},vt="~hs",Rt={type:"literal",value:"~hs",description:'"~hs"'},it=function(c){return vl(c)},At="~http",ft={type:"literal",value:"~http",description:'"~http"'},De=function(){return En},Us="~marked",no={type:"literal",value:"~marked",description:'"~marked"'},io=function(){return Tn},Bs="~marker",ro={type:"literal",value:"~marker",description:'"~marker"'},oo=function(c){return xl(c)},Ws="~m",lo={type:"literal",value:"~m",description:'"~m"'},co=function(c){return _l(c)},Ks="~q",ao={type:"literal",value:"~q",description:'"~q"'},uo=function(){return Rn},zs="~replayq",fo={type:"literal",value:"~replayq",description:'"~replayq"'},po=function(){return An},Gs="~replays",ho={type:"literal",value:"~replays",description:'"~replays"'},mo=function(){return Dn},Ys="~replay",go={type:"literal",value:"~replay",description:'"~replay"'},vo=function(){return Fn},Js="~src",xo={type:"literal",value:"~src",description:'"~src"'},_o=function(c){return jl(c)},Qs="~s",jo={type:"literal",value:"~s",description:'"~s"'},yo=function(){return In},Xs="~tcp",wo={type:"literal",value:"~tcp",description:'"~tcp"'},bo=function(){return Ln},Zs="~udp",So={type:"literal",value:"~udp",description:'"~udp"'},$o=function(){return Pn},en="~tq",Co={type:"literal",value:"~tq",description:'"~tq"'},No=function(c){return yl(c)},tn="~ts",ko={type:"literal",value:"~ts",description:'"~ts"'},Eo=function(c){return wl(c)},sn="~t",To={type:"literal",value:"~t",description:'"~t"'},Ro=function(c){return bl(c)},nn="~u",Ao={type:"literal",value:"~u",description:'"~u"'},rn=function(c){return Sl(c)},on="~websocket",Do={type:"literal",value:"~websocket",description:'"~websocket"'},Fo=function(){return On},Io={type:"other",description:"integer"},ln=/^['"]/,cn={type:"class",value:`['"]`,description:`['"]`},an=/^[0-9]/,dn={type:"class",value:"[0-9]",description:"[0-9]"},Lo=function(c){return parseInt(c.join(""),10)},Po={type:"other",description:"string"},un='"',fn={type:"literal",value:'"',description:'"\\""'},ts=function(c){return c.join("")},pn="'",hn={type:"literal",value:"'",description:`"'"`},Oo=/^["\\]/,Mo={type:"class",value:'["\\\\]',description:'["\\\\]'},ss={type:"any",description:"any character"},xt=function(c){return c},mn="\\",gn={type:"literal",value:"\\",description:'"\\\\"'},qo=/^['\\]/,Ho={type:"class",value:"['\\\\]",description:"['\\\\]"},Vo=/^['"\\]/,Uo={type:"class",value:`['"\\\\]`,description:`['"\\\\]`},Bo="n",Wo={type:"literal",value:"n",description:'"n"'},Ko=function(){return`
+`},zo="r",Go={type:"literal",value:"r",description:'"r"'},Yo=function(){return"\r"},Jo="t",Qo={type:"literal",value:"t",description:'"t"'},Xo=function(){return"       "},m=0,Dt=[{line:1,column:1,seenCR:!1}],Me=0,ns=[],R=0,Ft;if("startRule"in r){if(!(r.startRule in l))throw new Error(`Can't start parsing from rule "`+r.startRule+'".');a=l[r.startRule]}function vn(c){var f=Dt[c],v,x;if(f)return f;for(v=c-1;!Dt[v];)v--;for(f=Dt[v],f={line:f.line,column:f.column,seenCR:f.seenCR};v<c;)x=i.charAt(v),x===`
+`?(f.seenCR||f.line++,f.column=1,f.seenCR=!1):x==="\r"||x==="\u2028"||x==="\u2029"?(f.line++,f.column=1,f.seenCR=!0):(f.column++,f.seenCR=!1),v++;return Dt[c]=f,f}function xn(c,f){var v=vn(c),x=vn(f);return{start:{offset:c,line:v.line,column:v.column},end:{offset:f,line:x.line,column:x.column}}}function F(c){m<Me||(m>Me&&(Me=m,ns=[]),ns.push(c))}function Zo(c,f,v,x){function qe(Fe){var Qe=1;for(Fe.sort(function(Pt,rt){return Pt.description<rt.description?-1:Pt.description>rt.description?1:0});Qe<Fe.length;)Fe[Qe-1]===Fe[Qe]?Fe.splice(Qe,1):Qe++}function Ce(Fe,Qe){function Pt($l){function Ot(Ge){return Ge.charCodeAt(0).toString(16).toUpperCase()}return $l.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(Ge){return"\\x0"+Ot(Ge)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(Ge){return"\\x"+Ot(Ge)}).replace(/[\u0100-\u0FFF]/g,function(Ge){return"\\u0"+Ot(Ge)}).replace(/[\u1000-\uFFFF]/g,function(Ge){return"\\u"+Ot(Ge)})}var rt=new Array(Fe.length),Mn,qn,_t;for(_t=0;_t<Fe.length;_t++)rt[_t]=Fe[_t].description;return Mn=Fe.length>1?rt.slice(0,-1).join(", ")+" or "+rt[Fe.length-1]:rt[0],qn=Qe?'"'+Pt(Qe)+'"':"end of input","Expected "+Mn+" but "+qn+" found."}return f!==null&&qe(f),new e(Ce(f,v),f,v,x)}function _n(){var c,f,v,x;return R++,c=m,f=ze(),f!==n?(v=is(),v!==n?(x=ze(),x!==n?(f=u(v),c=f):(m=c,c=n)):(m=c,c=n)):(m=c,c=n),R--,c===n&&(f=n,R===0&&F(d)),c}function K(){var c;return R++,p.test(i.charAt(m))?(c=i.charAt(m),m++):(c=n,R===0&&F(g)),R--,c===n&&R===0&&F(h),c}function el(){var c;return R++,j.test(i.charAt(m))?(c=i.charAt(m),m++):(c=n,R===0&&F(y)),R--,c===n&&R===0&&F(_),c}function ze(){var c,f;for(R++,c=[],f=K();f!==n;)c.push(f),f=K();return R--,c===n&&(f=n,R===0&&F(w)),c}function is(){var c,f,v,x,qe,Ce;return c=m,f=It(),f!==n?(v=ze(),v!==n?(i.charCodeAt(m)===124?(x=$,m++):(x=n,R===0&&F(N)),x!==n?(qe=ze(),qe!==n?(Ce=is(),Ce!==n?(f=k(f,Ce),c=f):(m=c,c=n)):(m=c,c=n)):(m=c,c=n)):(m=c,c=n)):(m=c,c=n),c===n&&(c=It()),c}function It(){var c,f,v,x,qe,Ce;if(c=m,f=Lt(),f!==n?(v=ze(),v!==n?(i.charCodeAt(m)===38?(x=T,m++):(x=n,R===0&&F(P)),x!==n?(qe=ze(),qe!==n?(Ce=It(),Ce!==n?(f=L(f,Ce),c=f):(m=c,c=n)):(m=c,c=n)):(m=c,c=n)):(m=c,c=n)):(m=c,c=n),c===n){if(c=m,f=Lt(),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=It(),x!==n?(f=L(f,x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;c===n&&(c=Lt())}return c}function Lt(){var c,f,v,x;return c=m,i.charCodeAt(m)===33?(f=O,m++):(f=n,R===0&&F(M)),f!==n?(v=ze(),v!==n?(x=Lt(),x!==n?(f=U(x),c=f):(m=c,c=n)):(m=c,c=n)):(m=c,c=n),c===n&&(c=tl()),c}function tl(){var c,f,v,x,qe,Ce;return c=m,i.charCodeAt(m)===40?(f=V,m++):(f=n,R===0&&F(W)),f!==n?(v=ze(),v!==n?(x=is(),x!==n?(qe=ze(),qe!==n?(i.charCodeAt(m)===41?(Ce=J,m++):(Ce=n,R===0&&F(z)),Ce!==n?(f=te(x),c=f):(m=c,c=n)):(m=c,c=n)):(m=c,c=n)):(m=c,c=n)):(m=c,c=n),c===n&&(c=sl()),c}function sl(){var c,f,v,x;if(c=m,i.substr(m,4)===Y?(f=Y,m+=4):(f=n,R===0&&F(Q)),f!==n&&(f=X()),c=f,c===n&&(c=m,i.substr(m,2)===Z?(f=Z,m+=2):(f=n,R===0&&F(de)),f!==n&&(f=me()),c=f,c===n)){if(c=m,i.substr(m,2)===we?(f=we,m+=2):(f=n,R===0&&F(Be)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=Le(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,3)===be?(f=be,m+=3):(f=n,R===0&&F(ke)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=C(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,3)===fe?(f=fe,m+=3):(f=n,R===0&&F(B)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=oe(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,2)===q?(f=q,m+=2):(f=n,R===0&&F(Se)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=nl(),x!==n?(f=We(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,8)===Pe?(f=Pe,m+=8):(f=n,R===0&&F(ee)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=Oe(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,2)===Te?(f=Te,m+=2):(f=n,R===0&&F(re)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=ce(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n&&(c=m,i.substr(m,4)===he?(f=he,m+=4):(f=n,R===0&&F(Re)),f!==n&&(f=nt()),c=f,c===n)){if(c=m,i.substr(m,4)===Je?(f=Je,m+=4):(f=n,R===0&&F(Zt)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=b(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n&&(c=m,i.substr(m,2)===S?(f=S,m+=2):(f=n,R===0&&F(A)),f!==n&&(f=H()),c=f,c===n)){if(c=m,i.substr(m,2)===Tt?(f=Tt,m+=2):(f=n,R===0&&F(es)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=$e(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,3)===Ae?(f=Ae,m+=3):(f=n,R===0&&F(ut)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=Ke(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,3)===vt?(f=vt,m+=3):(f=n,R===0&&F(Rt)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=it(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n&&(c=m,i.substr(m,5)===At?(f=At,m+=5):(f=n,R===0&&F(ft)),f!==n&&(f=De()),c=f,c===n&&(c=m,i.substr(m,7)===Us?(f=Us,m+=7):(f=n,R===0&&F(no)),f!==n&&(f=io()),c=f,c===n))){if(c=m,i.substr(m,7)===Bs?(f=Bs,m+=7):(f=n,R===0&&F(ro)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=oo(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,2)===Ws?(f=Ws,m+=2):(f=n,R===0&&F(lo)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=co(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n&&(c=m,i.substr(m,2)===Ks?(f=Ks,m+=2):(f=n,R===0&&F(ao)),f!==n&&(f=uo()),c=f,c===n&&(c=m,i.substr(m,8)===zs?(f=zs,m+=8):(f=n,R===0&&F(fo)),f!==n&&(f=po()),c=f,c===n&&(c=m,i.substr(m,8)===Gs?(f=Gs,m+=8):(f=n,R===0&&F(ho)),f!==n&&(f=mo()),c=f,c===n&&(c=m,i.substr(m,7)===Ys?(f=Ys,m+=7):(f=n,R===0&&F(go)),f!==n&&(f=vo()),c=f,c===n))))){if(c=m,i.substr(m,4)===Js?(f=Js,m+=4):(f=n,R===0&&F(xo)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=_o(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n&&(c=m,i.substr(m,2)===Qs?(f=Qs,m+=2):(f=n,R===0&&F(jo)),f!==n&&(f=yo()),c=f,c===n&&(c=m,i.substr(m,4)===Xs?(f=Xs,m+=4):(f=n,R===0&&F(wo)),f!==n&&(f=bo()),c=f,c===n&&(c=m,i.substr(m,4)===Zs?(f=Zs,m+=4):(f=n,R===0&&F(So)),f!==n&&(f=$o()),c=f,c===n)))){if(c=m,i.substr(m,3)===en?(f=en,m+=3):(f=n,R===0&&F(Co)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=No(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,3)===tn?(f=tn,m+=3):(f=n,R===0&&F(ko)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=Eo(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,2)===sn?(f=sn,m+=2):(f=n,R===0&&F(To)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=Ro(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.substr(m,2)===nn?(f=nn,m+=2):(f=n,R===0&&F(Ao)),f!==n){if(v=[],x=K(),x!==n)for(;x!==n;)v.push(x),x=K();else v=n;v!==n?(x=pe(),x!==n?(f=rn(x),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;c===n&&(c=m,i.substr(m,10)===on?(f=on,m+=10):(f=n,R===0&&F(Do)),f!==n&&(f=Fo()),c=f,c===n&&(c=m,f=pe(),f!==n&&(f=rn(f)),c=f))}}}}}}}}}}}}}}}}}return c}function nl(){var c,f,v,x;if(R++,c=m,ln.test(i.charAt(m))?(f=i.charAt(m),m++):(f=n,R===0&&F(cn)),f===n&&(f=null),f!==n){if(v=[],an.test(i.charAt(m))?(x=i.charAt(m),m++):(x=n,R===0&&F(dn)),x!==n)for(;x!==n;)v.push(x),an.test(i.charAt(m))?(x=i.charAt(m),m++):(x=n,R===0&&F(dn));else v=n;v!==n?(ln.test(i.charAt(m))?(x=i.charAt(m),m++):(x=n,R===0&&F(cn)),x===n&&(x=null),x!==n?(f=Lo(v),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;return R--,c===n&&(f=n,R===0&&F(Io)),c}function pe(){var c,f,v,x;if(R++,c=m,i.charCodeAt(m)===34?(f=un,m++):(f=n,R===0&&F(fn)),f!==n){for(v=[],x=jn();x!==n;)v.push(x),x=jn();v!==n?(i.charCodeAt(m)===34?(x=un,m++):(x=n,R===0&&F(fn)),x!==n?(f=ts(v),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n){if(c=m,i.charCodeAt(m)===39?(f=pn,m++):(f=n,R===0&&F(hn)),f!==n){for(v=[],x=yn();x!==n;)v.push(x),x=yn();v!==n?(i.charCodeAt(m)===39?(x=pn,m++):(x=n,R===0&&F(hn)),x!==n?(f=ts(v),c=f):(m=c,c=n)):(m=c,c=n)}else m=c,c=n;if(c===n)if(c=m,f=m,R++,v=el(),R--,v===n?f=void 0:(m=f,f=n),f!==n){if(v=[],x=wn(),x!==n)for(;x!==n;)v.push(x),x=wn();else v=n;v!==n?(f=ts(v),c=f):(m=c,c=n)}else m=c,c=n}return R--,c===n&&(f=n,R===0&&F(Po)),c}function jn(){var c,f,v;return c=m,f=m,R++,Oo.test(i.charAt(m))?(v=i.charAt(m),m++):(v=n,R===0&&F(Mo)),R--,v===n?f=void 0:(m=f,f=n),f!==n?(i.length>m?(v=i.charAt(m),m++):(v=n,R===0&&F(ss)),v!==n?(f=xt(v),c=f):(m=c,c=n)):(m=c,c=n),c===n&&(c=m,i.charCodeAt(m)===92?(f=mn,m++):(f=n,R===0&&F(gn)),f!==n?(v=bn(),v!==n?(f=xt(v),c=f):(m=c,c=n)):(m=c,c=n)),c}function yn(){var c,f,v;return c=m,f=m,R++,qo.test(i.charAt(m))?(v=i.charAt(m),m++):(v=n,R===0&&F(Ho)),R--,v===n?f=void 0:(m=f,f=n),f!==n?(i.length>m?(v=i.charAt(m),m++):(v=n,R===0&&F(ss)),v!==n?(f=xt(v),c=f):(m=c,c=n)):(m=c,c=n),c===n&&(c=m,i.charCodeAt(m)===92?(f=mn,m++):(f=n,R===0&&F(gn)),f!==n?(v=bn(),v!==n?(f=xt(v),c=f):(m=c,c=n)):(m=c,c=n)),c}function wn(){var c,f,v;return c=m,f=m,R++,v=K(),R--,v===n?f=void 0:(m=f,f=n),f!==n?(i.length>m?(v=i.charAt(m),m++):(v=n,R===0&&F(ss)),v!==n?(f=xt(v),c=f):(m=c,c=n)):(m=c,c=n),c}function bn(){var c,f;return Vo.test(i.charAt(m))?(c=i.charAt(m),m++):(c=n,R===0&&F(Uo)),c===n&&(c=m,i.charCodeAt(m)===110?(f=Bo,m++):(f=n,R===0&&F(Wo)),f!==n&&(f=Ko()),c=f,c===n&&(c=m,i.charCodeAt(m)===114?(f=zo,m++):(f=n,R===0&&F(Go)),f!==n&&(f=Yo()),c=f,c===n&&(c=m,i.charCodeAt(m)===116?(f=Jo,m++):(f=n,R===0&&F(Qo)),f!==n&&(f=Xo()),c=f))),c}function il(c,f){function v(){return c.apply(this,arguments)||f.apply(this,arguments)}return v.desc=c.desc+" or "+f.desc,v}function rl(c,f){function v(){return c.apply(this,arguments)&&f.apply(this,arguments)}return v.desc=c.desc+" and "+f.desc,v}function ol(c){function f(){return!c.apply(this,arguments)}return f.desc="not "+c.desc,f}function ll(c){function f(){return c.apply(this,arguments)}return f.desc="("+c.desc+")",f}function Sn(c){return!0}Sn.desc="all flows";var $n=[new RegExp("text/javascript"),new RegExp("application/x-javascript"),new RegExp("application/javascript"),new RegExp("text/css"),new RegExp("image/.*"),new RegExp("font/.*"),new RegExp("application/font.*")];function Cn(c){if(c.response){for(var f=mt.getContentType(c.response),v=$n.length;v--;)if($n[v].test(f))return!0}return!1}Cn.desc="is asset";function cl(c){c=new RegExp(c,"i");function f(v){return!0}return f.desc="body matches "+c,f}function al(c){c=new RegExp(c,"i");function f(v){return!0}return f.desc="body request matches "+c,f}function dl(c){c=new RegExp(c,"i");function f(v){return!0}return f.desc="body response matches "+c,f}function ul(c){function f(v){return v.response&&v.response.status_code===c}return f.desc="resp. code is "+c,f}function fl(c){c=new RegExp(c,"i");function f(v){return c.test(v.comment)}return f.desc="comment matches "+c,f}function pl(c){c=new RegExp(c,"i");function f(v){return v.request&&(c.test(v.request.host)||c.test(v.request.pretty_host))}return f.desc="domain matches "+c,f}function Nn(c){return c.type==="dns"}Nn.desc="is a DNS Flow";function hl(c){c=new RegExp(c,"i");function f(v){return!!v.server_conn.address&&c.test(v.server_conn.address[0]+":"+v.server_conn.address[1])}return f.desc="destination address matches "+c,f}function kn(c){return!!c.error}kn.desc="has error";function ml(c){c=new RegExp(c,"i");function f(v){return v.request&&ct.match_header(v.request,c)||v.response&&mt.match_header(v.response,c)}return f.desc="header matches "+c,f}function gl(c){c=new RegExp(c,"i");function f(v){return v.request&&ct.match_header(v.request,c)}return f.desc="req. header matches "+c,f}function vl(c){c=new RegExp(c,"i");function f(v){return v.response&&mt.match_header(v.response,c)}return f.desc="resp. header matches "+c,f}function En(c){return c.type==="http"}En.desc="is an HTTP Flow";function Tn(c){return c.marked}Tn.desc="is marked";function xl(c){c=new RegExp(c,"i");function f(v){return c.test(v.marked)}return f.desc="marker matches "+c,f}function _l(c){c=new RegExp(c,"i");function f(v){return v.request&&c.test(v.request.method)}return f.desc="method matches "+c,f}function Rn(c){return c.request&&!c.response}Rn.desc="has no response";function An(c){return c.is_replay==="request"}An.desc="request has been replayed";function Dn(c){return c.is_replay==="response"}Dn.desc="response has been replayed";function Fn(c){return!!c.is_replay}Fn.desc="flow has been replayed";function jl(c){c=new RegExp(c,"i");function f(v){return!!v.client_conn.peername&&c.test(v.client_conn.peername[0]+":"+v.client_conn.peername[1])}return f.desc="source address matches "+c,f}function In(c){return!!c.response}In.desc="has response";function Ln(c){return c.type==="tcp"}Ln.desc="is a TCP Flow";function Pn(c){return c.type==="udp"}Pn.desc="is a UDP Flow";function yl(c){c=new RegExp(c,"i");function f(v){return v.request&&c.test(ct.getContentType(v.request))}return f.desc="req. content type matches "+c,f}function wl(c){c=new RegExp(c,"i");function f(v){return v.response&&c.test(mt.getContentType(v.response))}return f.desc="resp. content type matches "+c,f}function bl(c){c=new RegExp(c,"i");function f(v){return v.request&&c.test(ct.getContentType(v.request))||v.response&&c.test(mt.getContentType(v.response))}return f.desc="content type matches "+c,f}function Sl(c){c=new RegExp(c,"i");function f(v){if(v.type==="dns"){const x=v.request?.questions[0];return x&&c.test(x.name)}return v.request&&c.test(ct.pretty_url(v.request))}return f.desc="url matches "+c,f}function On(c){return!!c.websocket}if(On.desc="is a Websocket Flow",Ft=a(),Ft!==n&&m===i.length)return Ft;throw Ft!==n&&m<i.length&&F({type:"end",description:"end of input"}),Zo(null,ns,Me<i.length?i.charAt(Me):null,Me<i.length?xn(Me,Me+1):xn(Me,Me))}return{SyntaxError:e,parse:s}}();class Ye extends I.Component{static xhr;static doc;constructor(e,s){super(e,s),this.state={doc:Ye.doc}}componentDidMount(){Ye.xhr||(Ye.xhr=ne("/filter-help").then(e=>e.json()),Ye.xhr.catch(()=>{Ye.xhr=null})),this.state.doc||Ye.xhr.then(e=>{Ye.doc=e,this.setState({doc:e})})}render(){const{doc:e}=this.state;return e?o.jsx("table",{className:"table table-condensed",children:o.jsxs("tbody",{children:[e.commands.map(s=>o.jsxs("tr",{onClick:()=>this.props.selectHandler(s[0].split(" ")[0]+" "),children:[o.jsx("td",{children:s[0].replace(" "," ")}),o.jsx("td",{children:s[1]})]},s[1])),o.jsx("tr",{children:o.jsx("td",{colSpan:2,children:o.jsxs("a",{href:"https://mitmproxy.org/docs/latest/concepts-filters/",target:"_blank",rel:"noreferrer",children:[o.jsx("i",{className:"fa fa-external-link"}),"  mitmproxy docs"]})})},"docs-link")]})}):o.jsx("i",{className:"fa fa-spinner fa-spin"})}}var Xt=(t=>(t.SEARCH="search",t.HIGHLIGHT="tag",t.INTERCEPT="pause",t))(Xt||{});class Hs extends I.Component{inputRef=Ee.createRef();constructor(e,s){super(e,s),this.state={value:this.props.value,focus:!1,mousefocus:!1},this.onChange=this.onChange.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onMouseEnter=this.onMouseEnter.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.selectFilter=this.selectFilter.bind(this)}UNSAFE_componentWillReceiveProps(e){this.setState({value:e.value})}isValid(e){try{return e&&oi.parse(e),!0}catch{return!1}}getDesc(){if(!this.state.value)return o.jsx(Ye,{selectHandler:this.selectFilter});try{return oi.parse(this.state.value).desc}catch(e){return""+e}}onChange(e){const s=e.target.value;this.setState({value:s}),this.isValid(s)&&this.props.onChange(s)}onFocus(){this.setState({focus:!0})}onBlur(){this.setState({focus:!1})}onMouseEnter(){this.setState({mousefocus:!0})}onMouseLeave(){this.setState({mousefocus:!1})}onKeyDown(e){(e.key==="Escape"||e.key==="Enter")&&(this.blur(),this.setState({mousefocus:!1})),e.stopPropagation()}selectFilter(e){this.setState({value:e}),this.inputRef.current?.focus()}blur(){this.inputRef.current?.blur()}select(){this.inputRef.current?.select()}render(){const{icon:e,color:s,placeholder:i}=this.props,{value:r,focus:n,mousefocus:l}=this.state;return o.jsxs("div",{className:_e("filter-input input-group",{"has-error":!this.isValid(r)}),children:[o.jsx("span",{className:"input-group-addon",children:o.jsx("i",{className:"fa fa-fw fa-"+e,style:{color:s}})}),o.jsx("input",{type:"text",ref:this.inputRef,placeholder:i,className:"form-control",value:r,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown}),(n||l)&&o.jsxs("div",{className:"popover bottom",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,children:[o.jsx("div",{className:"arrow"}),o.jsx("div",{className:"popover-content",children:this.getDesc()})]})]})}}Zr.title="Flow List";function Zr(){const t=E.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsxs("div",{className:"menu-group",children:[o.jsxs("div",{className:"menu-content",children:[o.jsx(ju,{}),o.jsx(wu,{})]}),o.jsx("div",{className:"menu-legend",children:"Find"})]}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"main-menu",children:[e,o.jsxs("div",{className:"menu-group",children:[o.jsxs("div",{className:"menu-content",children:[o.jsx(xu,{}),o.jsx(Su,{})]}),o.jsx("div",{className:"menu-legend",children:"Intercept"})]})]}),t[1]=s):s=t[1],s}function xu(){const t=E.c(5),e=G(),i=D(_u)||"";let r;t[0]!==e?(r=l=>e(Cs("intercept",l)),t[0]=e,t[1]=r):r=t[1];let n;return t[2]!==i||t[3]!==r?(n=o.jsx(Hs,{value:i,placeholder:"Intercept",icon:Xt.INTERCEPT,color:"hsl(208, 56%, 53%)",onChange:r}),t[2]=i,t[3]=r,t[4]=n):n=t[4],n}function _u(t){return t.options.intercept}function ju(){const t=E.c(5),e=G(),s=D(yu);let i;t[0]!==e?(i=n=>e(Ri(n)),t[0]=e,t[1]=i):i=t[1];let r;return t[2]!==i||t[3]!==s?(r=o.jsx(Hs,{value:s,placeholder:"Search",icon:Xt.SEARCH,color:"black",onChange:i}),t[2]=i,t[3]=s,t[4]=r):r=t[4],r}function yu(t){return t.ui.filter[ge.Search]}function wu(){const t=E.c(5),e=G(),s=D(bu);let i;t[0]!==e?(i=n=>e(Ai(n)),t[0]=e,t[1]=i):i=t[1];let r;return t[2]!==i||t[3]!==s?(r=o.jsx(Hs,{value:s,placeholder:"Highlight",icon:Xt.HIGHLIGHT,color:"hsl(48, 100%, 50%)",onChange:i}),t[2]=i,t[3]=s,t[4]=r):r=t[4],r}function bu(t){return t.ui.filter[ge.Highlight]}function Su(){const t=E.c(2),e=G();let s;return t[0]!==e?(s=o.jsx(ue,{className:"btn-sm",title:"[a]ccept all",icon:"fa-forward text-success",onClick:()=>e(Di()),children:"Resume All"}),t[0]=e,t[1]=s):s=t[1],s}function Vs(t){const e=E.c(6),{value:s,onChange:i,children:r}=t;let n;e[0]!==i||e[1]!==s?(n=o.jsx("input",{type:"checkbox",checked:s,onChange:i}),e[0]=i,e[1]=s,e[2]=n):n=e[2];let l;return e[3]!==r||e[4]!==n?(l=o.jsx("div",{className:"menu-entry",children:o.jsxs("label",{children:[n,r]})}),e[3]=r,e[4]=n,e[5]=l):l=e[5],l}function cs(t){const e=E.c(10),{name:s,children:i}=t,r=G();let n;e[0]!==s?(n=h=>h.options[s],e[0]=s,e[1]=n):n=e[1];const l=D(n),a=!!l;let d;e[2]!==r||e[3]!==s||e[4]!==l?(d=()=>r(Cs(s,!l)),e[2]=r,e[3]=s,e[4]=l,e[5]=d):d=e[5];let u;return e[6]!==i||e[7]!==a||e[8]!==d?(u=o.jsx(Vs,{value:a,onChange:d,children:i}),e[6]=i,e[7]=a,e[8]=d,e[9]=u):u=e[9],u}function $u(){const t=E.c(5),e=G(),s=D(Cu);let i;t[0]!==e?(i=()=>e(Gt()),t[0]=e,t[1]=i):i=t[1];let r;return t[2]!==i||t[3]!==s?(r=o.jsx(Vs,{value:s,onChange:i,children:"Display Event Log"}),t[2]=i,t[3]=s,t[4]=r):r=t[4],r}function Cu(t){return t.eventLog.visible}function Nu(){const t=E.c(5),e=G(),s=D(ku);let i;t[0]!==e?(i=()=>e(Ji()),t[0]=e,t[1]=i):i=t[1];let r;return t[2]!==i||t[3]!==s?(r=o.jsx(Vs,{value:s,onChange:i,children:"Display Command Bar"}),t[2]=i,t[3]=s,t[4]=r):r=t[4],r}function ku(t){return t.commandBar.visible}function as(t){const e=E.c(5),{children:s,resource:i}=t,r=`https://docs.mitmproxy.org/stable/${i}`;let n;e[0]!==s?(n=s||o.jsx("i",{className:"fa fa-question-circle"}),e[0]=s,e[1]=n):n=e[1];let l;return e[2]!==n||e[3]!==r?(l=o.jsx("a",{target:"_blank",href:r,rel:"noreferrer",children:n}),e[2]=n,e[3]=r,e[4]=l):l=e[4],l}eo.title="Options";function eo(){const t=E.c(16),e=G(),s=Eu;let i;t[0]!==e?(i=()=>e(s()),t[0]=e,t[1]=i):i=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("sup",{children:"alpha"}),t[2]=r):r=t[2];let n;t[3]!==i?(n=o.jsx("div",{className:"menu-content",children:o.jsxs(ue,{title:"Open Options",icon:"fa-cogs text-primary",onClick:i,children:["Edit Options ",r]})}),t[3]=i,t[4]=n):n=t[4];let l;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"menu-legend",children:"Options Editor"}),t[5]=l):l=t[5];let a;t[6]!==n?(a=o.jsxs("div",{className:"menu-group",children:[n,l]}),t[6]=n,t[7]=a):a=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsxs(cs,{name:"anticache",children:["Strip cache headers"," ",o.jsx(as,{resource:"overview/features/#anticache"})]}),t[8]=d):d=t[8];let u;t[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs(cs,{name:"showhost",children:["Use host header for display"," ",o.jsx(as,{resource:"concepts/options/#showhost"})]}),t[9]=u):u=t[9];let h;t[10]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsxs("div",{className:"menu-group",children:[o.jsxs("div",{className:"menu-content",children:[d,u,o.jsxs(cs,{name:"ssl_insecure",children:["Don't verify server certificates"," ",o.jsx(as,{resource:"concepts/options/#ssl_insecure"})]})]}),o.jsx("div",{className:"menu-legend",children:"Quick Options"})]}),t[10]=h):h=t[10];let p;t[11]!==a?(p=o.jsxs(gt,{children:[a,h]}),t[11]=a,t[12]=p):p=t[12];let g;t[13]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsxs("div",{className:"menu-group",children:[o.jsxs("div",{className:"menu-content",children:[o.jsx($u,{}),o.jsx(Nu,{})]}),o.jsx("div",{className:"menu-legend",children:"View Options"})]}),t[13]=g):g=t[13];let _;return t[14]!==p?(_=o.jsxs("div",{children:[p,g]}),t[14]=p,t[15]=_):_=t[15],_}function Eu(){return dc("OptionModal")}const yt=async(t,e)=>{const s=(async()=>{const i=await Bt("export",e,`@${t.id}`);if(i.value)return i.value;throw i.error?i.error:i})();try{await gi(s)}catch(i){alert(i)}};to.title="Flow";function to(){const t=E.c(63),e=G(),s=D(Tu),i=s[0];let r;t[0]!==s?(r=s.some(_s),t[0]=s,t[1]=r):r=t[1];const n=r;if(s.length===0){let X;return t[2]===Symbol.for("react.memo_cache_sentinel")?(X=o.jsx("div",{}),t[2]=X):X=t[2],X}let l;t[3]!==e||t[4]!==s?(l=()=>e(ws(s)),t[3]=e,t[4]=s,t[5]=l):l=t[5];let a;t[6]!==s?(a=s.some(xs),t[6]=s,t[7]=a):a=t[7];const d=!a;let u;t[8]!==l||t[9]!==d?(u=o.jsx(ue,{title:"[r]eplay flow",icon:"fa-repeat text-primary",onClick:l,disabled:d,children:"Replay"}),t[8]=l,t[9]=d,t[10]=u):u=t[10];let h;t[11]!==e||t[12]!==s?(h=o.jsx(ue,{title:"[D]uplicate flow",icon:"fa-copy text-info",onClick:()=>e(Li(s)),children:"Duplicate"}),t[11]=e,t[12]=s,t[13]=h):h=t[13];let p;t[14]!==s?(p=s.some(bi),t[14]=s,t[15]=p):p=t[15];const g=!p;let _;t[16]!==e||t[17]!==s?(_=()=>e(Pi(s)),t[16]=e,t[17]=s,t[18]=_):_=t[18];let j;t[19]!==g||t[20]!==_?(j=o.jsx(ue,{disabled:g,title:"revert changes to flow [V]",icon:"fa-history text-warning",onClick:_,children:"Revert"}),t[19]=g,t[20]=_,t[21]=j):j=t[21];let y;t[22]!==e||t[23]!==s?(y=o.jsx(ue,{title:"[d]elete flow",icon:"fa-trash text-danger",onClick:()=>{e(Ii(s))},children:"Delete"}),t[22]=e,t[23]=s,t[24]=y):y=t[24];let w;t[25]!==s?(w=o.jsx(Mu,{flows:s}),t[25]=s,t[26]=w):w=t[26];let $;t[27]!==y||t[28]!==w||t[29]!==u||t[30]!==h||t[31]!==j?($=o.jsxs("div",{className:"menu-content",children:[u,h,j,y,w]}),t[27]=y,t[28]=w,t[29]=u,t[30]=h,t[31]=j,t[32]=$):$=t[32];let N;t[33]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx("div",{className:"menu-legend",children:"Flow Modification"}),t[33]=N):N=t[33];let k;t[34]!==$?(k=o.jsx(gt,{children:o.jsxs("div",{className:"menu-group",children:[$,N]})}),t[34]=$,t[35]=k):k=t[35];let T;t[36]!==i?(T=o.jsxs("div",{className:"menu-content",children:[o.jsx(Ru,{flow:i}),o.jsx(Iu,{flow:i})]}),t[36]=i,t[37]=T):T=t[37];let P;t[38]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx("div",{className:"menu-legend",children:"Export"}),t[38]=P):P=t[38];let L;t[39]!==T?(L=o.jsxs("div",{className:"menu-group",children:[T,P]}),t[39]=T,t[40]=L):L=t[40];const O=!n;let M;t[41]!==e||t[42]!==s?(M=()=>e(ys(s)),t[41]=e,t[42]=s,t[43]=M):M=t[43];let U;t[44]!==O||t[45]!==M?(U=o.jsx(ue,{disabled:O,title:"[a]ccept intercepted flow",icon:"fa-play text-success",onClick:M,children:"Resume"}),t[44]=O,t[45]=M,t[46]=U):U=t[46];const V=!n;let W;t[47]!==e||t[48]!==s?(W=()=>e(Fi(s)),t[47]=e,t[48]=s,t[49]=W):W=t[49];let J;t[50]!==V||t[51]!==W?(J=o.jsx(ue,{disabled:V,title:"kill intercepted flow [x]",icon:"fa-times text-danger",onClick:W,children:"Abort"}),t[50]=V,t[51]=W,t[52]=J):J=t[52];let z;t[53]!==U||t[54]!==J?(z=o.jsxs("div",{className:"menu-content",children:[U,J]}),t[53]=U,t[54]=J,t[55]=z):z=t[55];let te;t[56]===Symbol.for("react.memo_cache_sentinel")?(te=o.jsx("div",{className:"menu-legend",children:"Interception"}),t[56]=te):te=t[56];let Y;t[57]!==z?(Y=o.jsx(gt,{children:o.jsxs("div",{className:"menu-group",children:[z,te]})}),t[57]=z,t[58]=Y):Y=t[58];let Q;return t[59]!==k||t[60]!==L||t[61]!==Y?(Q=o.jsxs("div",{className:"flow-menu",children:[k,L,Y]}),t[59]=k,t[60]=L,t[61]=Y,t[62]=Q):Q=t[62],Q}function Tu(t){return t.flows.selected}const qt=t=>{const e=window.open(t,"_blank","noopener,noreferrer");e&&(e.opener=null)};function Ru(t){const e=E.c(24),{flow:s}=t,i=D(Fu);if(s.type!=="http"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(ue,{icon:"fa-download",onClick:Du,disabled:!0,children:"Download"}),e[0]=r):r=e[0],r}if(s.request.contentLength&&!s.response?.contentLength){let r;e[1]!==s?(r=()=>qt(je.getContentURL(s,s.request)),e[1]=s,e[2]=r):r=e[2];const n=!i;let l;return e[3]!==r||e[4]!==n?(l=o.jsx(ue,{icon:"fa-download",onClick:r,disabled:n,children:"Download"}),e[3]=r,e[4]=n,e[5]=l):l=e[5],l}if(s.response){const r=s.response;if(!s.request.contentLength&&s.response.contentLength){let n;e[6]!==s||e[7]!==r?(n=()=>qt(je.getContentURL(s,r)),e[6]=s,e[7]=r,e[8]=n):n=e[8];const l=!i;let a;return e[9]!==n||e[10]!==l?(a=o.jsx(ue,{icon:"fa-download",onClick:n,disabled:l,children:"Download"}),e[9]=n,e[10]=l,e[11]=a):a=e[11],a}if(s.request.contentLength&&s.response.contentLength){const n=!i;let l;e[12]!==n?(l=o.jsx(ue,{icon:"fa-download",onClick:Au,disabled:n,children:"Download▾"}),e[12]=n,e[13]=l):l=e[13];let a;e[14]===Symbol.for("react.memo_cache_sentinel")?(a={placement:"bottom-start"},e[14]=a):a=e[14];let d;e[15]!==s?(d=o.jsx(Ne,{onClick:()=>qt(je.getContentURL(s,s.request)),children:"Download request"}),e[15]=s,e[16]=d):d=e[16];let u;e[17]!==s||e[18]!==r?(u=o.jsx(Ne,{onClick:()=>qt(je.getContentURL(s,r)),children:"Download response"}),e[17]=s,e[18]=r,e[19]=u):u=e[19];let h;return e[20]!==l||e[21]!==d||e[22]!==u?(h=o.jsxs(Et,{text:l,options:a,children:[d,u]}),e[20]=l,e[21]=d,e[22]=u,e[23]=h):h=e[23],h}}return null}function Au(){return 1}function Du(){return 0}function Fu(t){return t.flows.selected.length===1}function Iu(t){const e=E.c(20),{flow:s}=t,i=D(Pu),r=s.type!=="http"||!i;let n;e[0]!==r?(n=o.jsx(ue,{title:"Export flow.",icon:"fa-clone",onClick:Lu,disabled:r,children:"Export▾"}),e[0]=r,e[1]=n):n=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l={placement:"bottom-start"},e[2]=l):l=e[2];let a;e[3]!==s?(a=o.jsx(Ne,{onClick:()=>yt(s,"raw_request"),children:"Copy raw request"}),e[3]=s,e[4]=a):a=e[4];let d;e[5]!==s?(d=o.jsx(Ne,{onClick:()=>yt(s,"raw_response"),children:"Copy raw response"}),e[5]=s,e[6]=d):d=e[6];let u;e[7]!==s?(u=o.jsx(Ne,{onClick:()=>yt(s,"raw"),children:"Copy raw request and response"}),e[7]=s,e[8]=u):u=e[8];let h;e[9]!==s?(h=o.jsx(Ne,{onClick:()=>yt(s,"curl"),children:"Copy as cURL"}),e[9]=s,e[10]=h):h=e[10];let p;e[11]!==s?(p=o.jsx(Ne,{onClick:()=>yt(s,"httpie"),children:"Copy as HTTPie"}),e[11]=s,e[12]=p):p=e[12];let g;return e[13]!==n||e[14]!==a||e[15]!==d||e[16]!==u||e[17]!==h||e[18]!==p?(g=o.jsxs(Et,{className:"",text:n,options:l,children:[a,d,u,h,p]}),e[13]=n,e[14]=a,e[15]=d,e[16]=u,e[17]=h,e[18]=p,e[19]=g):g=e[19],g}function Lu(){return 1}function Pu(t){return t.flows.selected.length===1}const Ou={":red_circle:":"🔴",":orange_circle:":"🟠",":yellow_circle:":"🟡",":green_circle:":"🟢",":large_blue_circle:":"🔵",":purple_circle:":"🟣",":brown_circle:":"🟤"};function Mu(t){const e=E.c(5),{flows:s}=t,i=G();let r,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(ue,{title:"mark flow",icon:"fa-paint-brush text-success",onClick:qu,children:"Mark▾"}),n={placement:"bottom-start"},e[0]=r,e[1]=n):(r=e[0],n=e[1]);let l;return e[2]!==i||e[3]!==s?(l=o.jsxs(Et,{className:"",text:r,options:n,children:[o.jsx(Ne,{onClick:()=>i(Kn(s,"")),children:"⚪ (no marker)"}),Object.entries(Ou).map(a=>{const[d,u]=a;return o.jsxs(Ne,{onClick:()=>i(Kn(s,d)),children:[u," ",d.replace(/[:_]/g," ")]},d)})]}),e[2]=i,e[3]=s,e[4]=l):l=e[4],l}function qu(){return 1}const li={[ve.Capture]:Xr,[ve.FlowList]:Zr,[ve.Options]:eo,[ve.Flow]:to};function Hu(){const t=E.c(26),e=G(),s=D(Uu),i=D(Vu),[r,n]=I.useState(!1);let l;t[0]!==i.length?(l=[ve.Capture,ve.FlowList,ve.Options],i.length>0&&l.push(ve.Flow),t[0]=i.length,t[1]=l):l=t[1];let a;t[2]!==s||t[3]!==e||t[4]!==i.length||t[5]!==r?(a=()=>{i.length>0&&!r?(e(Vt(ve.Flow)),n(!0)):i.length===0&&(r&&n(!1),s===ve.Flow&&e(Vt(ve.FlowList)))},t[2]=s,t[3]=e,t[4]=i.length,t[5]=r,t[6]=a):a=t[6];let d;t[7]!==s||t[8]!==i||t[9]!==r?(d=[i,r,s],t[7]=s,t[8]=i,t[9]=r,t[10]=d):d=t[10],I.useEffect(a,d);let u;t[11]!==e?(u=function(k,T){T.preventDefault(),e(Vt(k))},t[11]=e,t[12]=u):u=t[12];const h=u,p=li[s];let g;t[13]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(uu,{}),t[13]=g):g=t[13];let _;t[14]!==s||t[15]!==l||t[16]!==h?(_=l.map(N=>o.jsx("a",{href:"#",className:_e({active:N===s}),onClick:k=>h(N,k),children:li[N].title},N)),t[14]=s,t[15]=l,t[16]=h,t[17]=_):_=t[17];let j;t[18]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(gt,{children:o.jsx(mu,{})}),t[18]=j):j=t[18];let y;t[19]!==_?(y=o.jsxs("nav",{className:"nav-tabs nav-tabs-lg",children:[g,_,j]}),t[19]=_,t[20]=y):y=t[20];let w;t[21]!==p?(w=o.jsx("div",{children:o.jsx(p,{})}),t[21]=p,t[22]=w):w=t[22];let $;return t[23]!==y||t[24]!==w?($=o.jsxs("header",{children:[y,w]}),t[23]=y,t[24]=w,t[25]=$):$=t[25],$}function Vu(t){return t.flows.selected}function Uu(t){return t.ui.tabs.current}const ds=function(){function t(i,r){function n(){this.constructor=i}n.prototype=r.prototype,i.prototype=new n}function e(i,r,n,l){this.message=i,this.expected=r,this.found=n,this.location=l,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,e)}t(e,Error);function s(i){var r=arguments.length>1?arguments[1]:{},n={},l={Expr:Te},a=Te,d=function(b,S){return[b,...S]},u=function(b){return[b]},h=function(){return""},p={type:"other",description:"string"},g='"',_={type:"literal",value:'"',description:'"\\""'},j=function(b){return b.join("")},y="'",w={type:"literal",value:"'",description:`"'"`},$=/^["\\]/,N={type:"class",value:'["\\\\]',description:'["\\\\]'},k={type:"any",description:"any character"},T=function(b){return b},P="\\",L={type:"literal",value:"\\",description:'"\\\\"'},O=/^['\\]/,M={type:"class",value:"['\\\\]",description:"['\\\\]"},U=/^['"\\]/,V={type:"class",value:`['"\\\\]`,description:`['"\\\\]`},W="n",J={type:"literal",value:"n",description:'"n"'},z=function(){return`
+`},te="r",Y={type:"literal",value:"r",description:'"r"'},Q=function(){return"\r"},X="t",Z={type:"literal",value:"t",description:'"t"'},de=function(){return"   "},me={type:"other",description:"whitespace"},we=/^[ \t\n\r]/,Be={type:"class",value:"[ \\t\\n\\r]",description:"[ \\t\\n\\r]"},Le={type:"other",description:"control character"},be=/^[|&!()~"]/,ke={type:"class",value:'[|&!()~"]',description:'[|&!()~"]'},C=0,fe=[{line:1,column:1,seenCR:!1}],B=0,oe=[],q=0,Se;if("startRule"in r){if(!(r.startRule in l))throw new Error(`Can't start parsing from rule "`+r.startRule+'".');a=l[r.startRule]}function We(b){var S=fe[b],A,H;if(S)return S;for(A=b-1;!fe[A];)A--;for(S=fe[A],S={line:S.line,column:S.column,seenCR:S.seenCR};A<b;)H=i.charAt(A),H===`
+`?(S.seenCR||S.line++,S.column=1,S.seenCR=!1):H==="\r"||H==="\u2028"||H==="\u2029"?(S.line++,S.column=1,S.seenCR=!0):(S.column++,S.seenCR=!1),A++;return fe[b]=S,S}function Pe(b,S){var A=We(b),H=We(S);return{start:{offset:b,line:A.line,column:A.column},end:{offset:S,line:H.line,column:H.column}}}function ee(b){C<B||(C>B&&(B=C,oe=[]),oe.push(b))}function Oe(b,S,A,H){function Tt($e){var Ae=1;for($e.sort(function(ut,Ke){return ut.description<Ke.description?-1:ut.description>Ke.description?1:0});Ae<$e.length;)$e[Ae-1]===$e[Ae]?$e.splice(Ae,1):Ae++}function es($e,Ae){function ut(At){function ft(De){return De.charCodeAt(0).toString(16).toUpperCase()}return At.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(De){return"\\x0"+ft(De)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(De){return"\\x"+ft(De)}).replace(/[\u0100-\u0FFF]/g,function(De){return"\\u0"+ft(De)}).replace(/[\u1000-\uFFFF]/g,function(De){return"\\u"+ft(De)})}var Ke=new Array($e.length),vt,Rt,it;for(it=0;it<$e.length;it++)Ke[it]=$e[it].description;return vt=$e.length>1?Ke.slice(0,-1).join(", ")+" or "+Ke[$e.length-1]:Ke[0],Rt=Ae?'"'+ut(Ae)+'"':"end of input","Expected "+vt+" but "+Rt+" found."}return S!==null&&Tt(S),new e(es(S,A),S,A,H)}function Te(){var b,S,A,H;if(b=C,S=re(),S!==n){if(A=[],H=Je(),H!==n)for(;H!==n;)A.push(H),H=Je();else A=n;A!==n?(H=Te(),H!==n?(S=d(S,H),b=S):(C=b,b=n)):(C=b,b=n)}else C=b,b=n;if(b===n&&(b=C,S=re(),S!==n&&(S=u(S)),b=S,b===n)){for(b=C,S=[],A=Je();A!==n;)S.push(A),A=Je();S!==n&&(S=h()),b=S}return b}function re(){var b,S,A,H;if(q++,b=C,i.charCodeAt(C)===34?(S=g,C++):(S=n,q===0&&ee(_)),S!==n){for(A=[],H=ce();H!==n;)A.push(H),H=ce();A!==n?(i.charCodeAt(C)===34?(H=g,C++):(H=n,q===0&&ee(_)),H!==n?(S=j(A),b=S):(C=b,b=n)):(C=b,b=n)}else C=b,b=n;if(b===n){if(b=C,i.charCodeAt(C)===39?(S=y,C++):(S=n,q===0&&ee(w)),S!==n){for(A=[],H=he();H!==n;)A.push(H),H=he();A!==n?(i.charCodeAt(C)===39?(H=y,C++):(H=n,q===0&&ee(w)),H!==n?(S=j(A),b=S):(C=b,b=n)):(C=b,b=n)}else C=b,b=n;if(b===n){if(b=C,S=C,q++,A=Zt(),q--,A===n?S=void 0:(C=S,S=n),S!==n){if(A=[],H=Re(),H!==n)for(;H!==n;)A.push(H),H=Re();else A=n;A!==n?(S=j(A),b=S):(C=b,b=n)}else C=b,b=n;if(b===n){if(b=C,i.charCodeAt(C)===34?(S=g,C++):(S=n,q===0&&ee(_)),S!==n){for(A=[],H=ce();H!==n;)A.push(H),H=ce();A!==n?(S=j(A),b=S):(C=b,b=n)}else C=b,b=n;if(b===n)if(b=C,i.charCodeAt(C)===39?(S=y,C++):(S=n,q===0&&ee(w)),S!==n){for(A=[],H=he();H!==n;)A.push(H),H=he();A!==n?(S=j(A),b=S):(C=b,b=n)}else C=b,b=n}}}return q--,b===n&&(S=n,q===0&&ee(p)),b}function ce(){var b,S,A;return b=C,S=C,q++,$.test(i.charAt(C))?(A=i.charAt(C),C++):(A=n,q===0&&ee(N)),q--,A===n?S=void 0:(C=S,S=n),S!==n?(i.length>C?(A=i.charAt(C),C++):(A=n,q===0&&ee(k)),A!==n?(S=T(A),b=S):(C=b,b=n)):(C=b,b=n),b===n&&(b=C,i.charCodeAt(C)===92?(S=P,C++):(S=n,q===0&&ee(L)),S!==n?(A=nt(),A!==n?(S=T(A),b=S):(C=b,b=n)):(C=b,b=n)),b}function he(){var b,S,A;return b=C,S=C,q++,O.test(i.charAt(C))?(A=i.charAt(C),C++):(A=n,q===0&&ee(M)),q--,A===n?S=void 0:(C=S,S=n),S!==n?(i.length>C?(A=i.charAt(C),C++):(A=n,q===0&&ee(k)),A!==n?(S=T(A),b=S):(C=b,b=n)):(C=b,b=n),b===n&&(b=C,i.charCodeAt(C)===92?(S=P,C++):(S=n,q===0&&ee(L)),S!==n?(A=nt(),A!==n?(S=T(A),b=S):(C=b,b=n)):(C=b,b=n)),b}function Re(){var b,S,A;return b=C,S=C,q++,A=Je(),q--,A===n?S=void 0:(C=S,S=n),S!==n?(i.length>C?(A=i.charAt(C),C++):(A=n,q===0&&ee(k)),A!==n?(S=T(A),b=S):(C=b,b=n)):(C=b,b=n),b}function nt(){var b,S;return U.test(i.charAt(C))?(b=i.charAt(C),C++):(b=n,q===0&&ee(V)),b===n&&(b=C,i.charCodeAt(C)===110?(S=W,C++):(S=n,q===0&&ee(J)),S!==n&&(S=z()),b=S,b===n&&(b=C,i.charCodeAt(C)===114?(S=te,C++):(S=n,q===0&&ee(Y)),S!==n&&(S=Q()),b=S,b===n&&(b=C,i.charCodeAt(C)===116?(S=X,C++):(S=n,q===0&&ee(Z)),S!==n&&(S=de()),b=S))),b}function Je(){var b;return q++,we.test(i.charAt(C))?(b=i.charAt(C),C++):(b=n,q===0&&ee(Be)),q--,b===n&&q===0&&ee(me),b}function Zt(){var b;return q++,be.test(i.charAt(C))?(b=i.charAt(C),C++):(b=n,q===0&&ee(ke)),q--,b===n&&q===0&&ee(Le),b}if(Se=a(),Se!==n&&C===i.length)return Se;throw Se!==n&&C<i.length&&ee({type:"end",description:"end of input"}),Oe(null,oe,B<i.length?i.charAt(B):null,B<i.length?Pe(B,B+1):Pe(B,B))}return{SyntaxError:e,parse:s}}();function us(t,e=""){if(!t)return[];const s=[];for(const i of Object.keys(t))i.startsWith(e)&&s.push(i);return s}function Bu(t){const e=E.c(6),{results:s}=t,i=I.useRef(null);let r,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{i&&i.current.addEventListener("DOMNodeInserted",Ku)},n=[],e[0]=r,e[1]=n):(r=e[0],n=e[1]),I.useEffect(r,n);let l;e[2]!==s?(l=s.map(Wu),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==l?(a=o.jsx("div",{className:"command-result",ref:i,children:l}),e[4]=l,e[5]=a):a=e[5],a}function Wu(t,e){return o.jsxs("div",{children:[o.jsx("div",{children:o.jsxs("strong",{children:["$ ",t.command]})}),t.result]},e)}function Ku(t){const e=t.currentTarget;e.scroll({top:e.scrollHeight,behavior:"auto"})}function zu(t){const e=E.c(20),{nextArgs:s,currentArg:i,help:r,description:n,availableCommands:l}=t;let a;if(e[0]!==i||e[1]!==s){a=[];for(let w=0;w<s.length;w++){if(w==i){a.push(o.jsx("mark",{children:s[w]},w));continue}a.push(o.jsxs("span",{children:[s[w]," "]},w))}e[0]=i,e[1]=s,e[2]=a}else a=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"arrow"}),e[3]=d):d=e[3];let u;e[4]!==a?(u=a.length>0&&o.jsxs("div",{children:[o.jsx("strong",{children:"Argument suggestion:"})," ",a]}),e[4]=a,e[5]=u):u=e[5];let h;e[6]!==r?(h=r?.includes("->")&&o.jsxs("div",{children:[o.jsx("strong",{children:"Signature help: "}),r]}),e[6]=r,e[7]=h):h=e[7];let p;e[8]!==n?(p=n&&o.jsxs("div",{children:["# ",n]}),e[8]=n,e[9]=p):p=e[9];let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("strong",{children:"Available Commands: "}),e[10]=g):g=e[10];let _;e[11]!==l?(_=JSON.stringify(l),e[11]=l,e[12]=_):_=e[12];let j;e[13]!==_?(j=o.jsxs("div",{children:[g,o.jsx("p",{className:"available-commands",children:_})]}),e[13]=_,e[14]=j):j=e[14];let y;return e[15]!==u||e[16]!==h||e[17]!==p||e[18]!==j?(y=o.jsxs("div",{className:"argument-suggestion popover top",children:[d,o.jsxs("div",{className:"popover-content",children:[u,h,p,j]})]}),e[15]=u,e[16]=h,e[17]=p,e[18]=j,e[19]=y):y=e[19],y}function Gu(){const t=E.c(45),[e,s]=I.useState(""),[i,r]=I.useState(""),[n,l]=I.useState(0);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[d,u]=I.useState(a);let h;t[1]===Symbol.for("react.memo_cache_sentinel")?(h=[],t[1]=h):h=t[1];const[p,g]=I.useState(h);let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_={},t[2]=_):_=t[2];const[j,y]=I.useState(_);let w;t[3]===Symbol.for("react.memo_cache_sentinel")?(w=[],t[3]=w):w=t[3];const[$,N]=I.useState(w),[k,T]=I.useState(0),[P,L]=I.useState(""),[O,M]=I.useState("");let U;t[4]===Symbol.for("react.memo_cache_sentinel")?(U=[],t[4]=U):U=t[4];const[V,W]=I.useState(U);let J;t[5]===Symbol.for("react.memo_cache_sentinel")?(J=[],t[5]=J):J=t[5];const[z,te]=I.useState(J),[Y,Q]=I.useState(void 0);let X,Z;t[6]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{ne("/commands",{method:"GET"}).then(ef).then(re=>{y(re),u(us(re)),g(Object.keys(re))}).catch(Zu)},Z=[],t[6]=X,t[7]=Z):(X=t[6],Z=t[7]),I.useEffect(X,Z);let de,me;t[8]===Symbol.for("react.memo_cache_sentinel")?(de=()=>{Bt("commands.history.get").then(re=>{te(re.value)}).catch(Xu)},me=[],t[8]=de,t[9]=me):(de=t[8],me=t[9]),I.useEffect(de,me);let we;t[10]!==j?(we=(re,ce)=>{const he=ds.parse(ce),Re=ds.parse(re);L(j[he[0]]?.signature_help),M(j[he[0]]?.help||""),u(us(j,Re[0])),g(us(j,he[0]));const nt=j[he[0]]?.parameters.map(Qu);nt&&(N([he[0],...nt]),T(he.length-1))},t[10]=j,t[11]=we):we=t[11];const Be=we;let Le;t[12]===Symbol.for("react.memo_cache_sentinel")?(Le=re=>{s(re.target.value),r(re.target.value),l(0)},t[12]=Le):Le=t[12];const be=Le;let ke;t[13]!==p||t[14]!==d||t[15]!==n||t[16]!==Y||t[17]!==z||t[18]!==e||t[19]!==V?(ke=re=>{if(re.key==="Enter"){const[ce,...he]=ds.parse(e);te([...z,e]),Bt("commands.history.add",e).catch(Ju),ne.post(`/commands/${ce}`,{arguments:he}).then(Yu).then(Re=>{Q(void 0),N([]),W([...V,{command:e,result:JSON.stringify(Re.value||Re.error)}])}).catch(Re=>{Q(void 0),N([]),W([...V,{command:e,result:Re.toString()}])}),L(""),M(""),s(""),r(""),l(0),u(p)}if(re.key==="ArrowUp"){let ce;Y===void 0?ce=z.length-1:ce=Math.max(0,Y-1),s(z[ce]),r(z[ce]),Q(ce)}if(re.key==="ArrowDown"){if(Y===void 0)return;if(Y==z.length-1)s(""),r(""),Q(void 0);else{const ce=Y+1;s(z[ce]),r(z[ce]),Q(ce)}}re.key==="Tab"&&(s(d[n]),l((n+1)%d.length),re.preventDefault()),re.stopPropagation()},t[13]=p,t[14]=d,t[15]=n,t[16]=Y,t[17]=z,t[18]=e,t[19]=V,t[20]=ke):ke=t[20];const C=ke;let fe;t[21]!==j||t[22]!==e||t[23]!==i||t[24]!==Be?(fe=re=>{if(!e){g(Object.keys(j));return}Be(i,e),re.stopPropagation()},t[21]=j,t[22]=e,t[23]=i,t[24]=Be,t[25]=fe):fe=t[25];const B=fe;let oe;t[26]===Symbol.for("react.memo_cache_sentinel")?(oe=o.jsx("div",{className:"command-title",children:"Command Result"}),t[26]=oe):oe=t[26];let q;t[27]!==V?(q=o.jsx(Bu,{results:V}),t[27]=V,t[28]=q):q=t[28];let Se;t[29]!==p||t[30]!==k||t[31]!==O||t[32]!==$||t[33]!==P?(Se=o.jsx(zu,{nextArgs:$,currentArg:k,help:P,description:O,availableCommands:p}),t[29]=p,t[30]=k,t[31]=O,t[32]=$,t[33]=P,t[34]=Se):Se=t[34];let We;t[35]===Symbol.for("react.memo_cache_sentinel")?(We=_e("command-input input-group"),t[35]=We):We=t[35];let Pe;t[36]===Symbol.for("react.memo_cache_sentinel")?(Pe=o.jsx("span",{className:"input-group-addon",children:o.jsx("i",{className:"fa fa-fw fa-terminal"})}),t[36]=Pe):Pe=t[36];const ee=e||"";let Oe;t[37]!==C||t[38]!==B||t[39]!==ee?(Oe=o.jsxs("div",{className:We,children:[Pe,o.jsx("input",{type:"text",placeholder:"Enter command",className:"form-control",value:ee,onChange:be,onKeyDown:C,onKeyUp:B})]}),t[37]=C,t[38]=B,t[39]=ee,t[40]=Oe):Oe=t[40];let Te;return t[41]!==q||t[42]!==Se||t[43]!==Oe?(Te=o.jsxs("div",{className:"command",children:[oe,q,Se,Oe]}),t[41]=q,t[42]=Se,t[43]=Oe,t[44]=Te):Te=t[44],Te}function Yu(t){return t.json()}function Ju(){return 0}function Qu(t){return t.name}function Xu(t){return console.error(t)}function Zu(t){return console.error(t)}function ef(t){return t.json()}function tf(t){const e=E.c(7),{checked:s,onToggle:i,text:r}=t,n="btn btn-toggle "+(s?"btn-primary":"btn-default"),l="fa fa-fw "+(s?"fa-check-square-o":"fa-square-o");let a;e[0]!==l?(a=o.jsx("i",{className:l}),e[0]=l,e[1]=a):a=e[1];let d;return e[2]!==i||e[3]!==n||e[4]!==a||e[5]!==r?(d=o.jsxs("div",{className:n,onClick:i,children:[a," ",r]}),e[2]=i,e[3]=n,e[4]=a,e[5]=r,e[6]=d):d=e[6],d}class sf extends I.Component{static defaultProps={rowHeight:18};heights;viewport=Ee.createRef();constructor(e){super(e),this.heights={},this.state={vScroll:kt()},this.onViewportUpdate=this.onViewportUpdate.bind(this)}componentDidMount(){window.addEventListener("resize",this.onViewportUpdate),this.onViewportUpdate()}componentWillUnmount(){window.removeEventListener("resize",this.onViewportUpdate)}getSnapshotBeforeUpdate(){return Es(this.viewport)}componentDidUpdate(e,s,i){i&&Jr(this.viewport),this.onViewportUpdate()}onViewportUpdate(){const e=this.viewport.current,s=kt({itemCount:this.props.events.length,rowHeight:this.props.rowHeight,viewportTop:e.scrollTop,viewportHeight:e.offsetHeight,itemHeights:this.props.events.map(i=>this.heights[i.id])});Kt(this.state.vScroll,s)||this.setState({vScroll:s})}setHeight(e,s){if(s&&!this.heights[e]){const i=s.offsetHeight;this.heights[e]!==i&&(this.heights[e]=i,this.onViewportUpdate())}}render(){const{vScroll:e}=this.state,{events:s}=this.props;return o.jsxs("pre",{ref:this.viewport,onScroll:this.onViewportUpdate,children:[o.jsx("div",{style:{height:e.paddingTop}}),s.slice(e.start,e.end).map(i=>o.jsxs("div",{ref:r=>{this.setHeight(i.id,r)},children:[o.jsx(nf,{event:i}),i.message]},i.id)),o.jsx("div",{style:{height:e.paddingBottom}})]})}}function nf(t){const e=E.c(4),{event:s}=t;let i;e[0]!==s.level?(i={web:"html5",debug:"bug",warn:"exclamation-triangle",error:"ban"}[s.level]||"info",e[0]=s.level,e[1]=i):i=e[1];const n=`fa fa-fw fa-${i}`;let l;return e[2]!==n?(l=o.jsx("i",{className:n}),e[2]=n,e[3]=l):l=e[3],l}class rf extends I.Component{static defaultProps={defaultHeight:200};dragStart;constructor(e,s){super(e,s),this.state={height:this.props.defaultHeight},this.onDragStart=this.onDragStart.bind(this),this.onDragMove=this.onDragMove.bind(this),this.onDragStop=this.onDragStop.bind(this)}onDragStart(e){e.preventDefault(),this.dragStart=this.state.height+e.pageY,window.addEventListener("mousemove",this.onDragMove),window.addEventListener("mouseup",this.onDragStop),window.addEventListener("dragend",this.onDragStop)}onDragMove(e){e.preventDefault(),this.setState({height:this.dragStart-e.pageY})}onDragStop(e){e.preventDefault(),window.removeEventListener("mousemove",this.onDragMove)}render(){const{height:e}=this.state,{filters:s,events:i,toggleFilter:r,close:n}=this.props;return o.jsxs("div",{className:"eventlog",style:{height:e},children:[o.jsxs("div",{onMouseDown:this.onDragStart,children:["Eventlog",o.jsxs("div",{className:"pull-right",children:[Object.values(Gi).map(l=>o.jsx(tf,{text:l,checked:s[l],onToggle:()=>r(l)},l)),o.jsx("i",{onClick:n,className:"fa fa-close"})]})]}),o.jsx(sf,{events:i})]})}}const of=zt(t=>({filters:t.eventLog.filters,events:t.eventLog.view}),{close:Gt,toggleFilter:zi})(rf);function lf(){const t=E.c(52),e=D(af),{mode:s,intercept:i,showhost:r,upstream_cert:n,rawtcp:l,http2:a,websocket:d,anticache:u,anticomp:h,stickyauth:p,stickycookie:g,stream_large_bodies:_,listen_host:j,listen_port:y,server:w,ssl_insecure:$}=D(cf);let N;t[0]!==s?(N=s&&(s.length!==1||s[0]!=="regular")&&o.jsx("span",{className:"label label-success",children:s.join(",")}),t[0]=s,t[1]=N):N=t[1];let k;t[2]!==i?(k=i&&o.jsxs("span",{className:"label label-success",children:["Intercept: ",i]}),t[2]=i,t[3]=k):k=t[3];let T;t[4]!==$?(T=$&&o.jsx("span",{className:"label label-danger",children:"ssl_insecure"}),t[4]=$,t[5]=T):T=t[5];let P;t[6]!==r?(P=r&&o.jsx("span",{className:"label label-success",children:"showhost"}),t[6]=r,t[7]=P):P=t[7];let L;t[8]!==n?(L=!n&&o.jsx("span",{className:"label label-success",children:"no-upstream-cert"}),t[8]=n,t[9]=L):L=t[9];let O;t[10]!==l?(O=!l&&o.jsx("span",{className:"label label-success",children:"no-raw-tcp"}),t[10]=l,t[11]=O):O=t[11];let M;t[12]!==a?(M=!a&&o.jsx("span",{className:"label label-success",children:"no-http2"}),t[12]=a,t[13]=M):M=t[13];let U;t[14]!==d?(U=!d&&o.jsx("span",{className:"label label-success",children:"no-websocket"}),t[14]=d,t[15]=U):U=t[15];let V;t[16]!==u?(V=u&&o.jsx("span",{className:"label label-success",children:"anticache"}),t[16]=u,t[17]=V):V=t[17];let W;t[18]!==h?(W=h&&o.jsx("span",{className:"label label-success",children:"anticomp"}),t[18]=h,t[19]=W):W=t[19];let J;t[20]!==p?(J=p&&o.jsxs("span",{className:"label label-success",children:["stickyauth: ",p]}),t[20]=p,t[21]=J):J=t[21];let z;t[22]!==g?(z=g&&o.jsxs("span",{className:"label label-success",children:["stickycookie: ",g]}),t[22]=g,t[23]=z):z=t[23];let te;t[24]!==_?(te=_&&o.jsxs("span",{className:"label label-success",children:["stream: ",hi(_)]}),t[24]=_,t[25]=te):te=t[25];let Y;t[26]!==j||t[27]!==y||t[28]!==w?(Y=w&&o.jsxs("span",{className:"label label-primary",title:"HTTP Proxy Server Address",children:[j||"*",":",y||8080]}),t[26]=j,t[27]=y,t[28]=w,t[29]=Y):Y=t[29];let Q;t[30]!==Y?(Q=o.jsx(gt,{children:Y}),t[30]=Y,t[31]=Q):Q=t[31];let X;t[32]!==e?(X=o.jsxs("span",{className:"label label-default",title:"Mitmproxy Version",children:["mitmproxy ",e]}),t[32]=e,t[33]=X):X=t[33];let Z;t[34]!==Q||t[35]!==X?(Z=o.jsxs("div",{className:"pull-right",children:[Q,X]}),t[34]=Q,t[35]=X,t[36]=Z):Z=t[36];let de;return t[37]!==N||t[38]!==k||t[39]!==J||t[40]!==z||t[41]!==te||t[42]!==Z||t[43]!==T||t[44]!==P||t[45]!==L||t[46]!==O||t[47]!==M||t[48]!==U||t[49]!==V||t[50]!==W?(de=o.jsxs("footer",{children:[N,k,T,P,L,O,M,U,V,W,J,z,te,Z]}),t[37]=N,t[38]=k,t[39]=J,t[40]=z,t[41]=te,t[42]=Z,t[43]=T,t[44]=P,t[45]=L,t[46]=O,t[47]=M,t[48]=U,t[49]=V,t[50]=W,t[51]=de):de=t[51],de}function cf(t){return t.options}function af(t){return t.backendState.version}function df(t){const e=E.c(3),{children:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"modal-backdrop fade in"}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsxs("div",{children:[i,o.jsx("div",{className:"modal modal-visible",id:"optionsModal",tabIndex:-1,role:"dialog","aria-labelledby":"options",children:o.jsx("div",{className:"modal-dialog modal-lg",role:"document",children:o.jsx("div",{className:"modal-content",children:s})})})]}),e[1]=s,e[2]=r):r=e[2],r}const uf=t=>{t.key!=="Escape"&&t.stopPropagation()};function so(t){const e=E.c(10);let s,i,r;e[0]!==t?({value:r,onChange:s,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);let n;e[4]!==s?(n=a=>s(a.target.checked),e[4]=s,e[5]=n):n=e[5];let l;return e[6]!==i||e[7]!==n||e[8]!==r?(l=o.jsx("div",{className:"checkbox",children:o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:r,onChange:n,...i}),"Enable"]})}),e[6]=i,e[7]=n,e[8]=r,e[9]=l):l=e[9],l}function ci(t){const e=E.c(10);let s,i,r;e[0]!==t?({value:r,onChange:s,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);const n=r||"";let l;e[4]!==s?(l=d=>s(d.target.value),e[4]=s,e[5]=l):l=e[5];let a;return e[6]!==i||e[7]!==n||e[8]!==l?(a=o.jsx("input",{type:"text",value:n,onChange:l,...i}),e[6]=i,e[7]=n,e[8]=l,e[9]=a):a=e[9],a}function ai(t){return function({onChange:s,...i}){return o.jsx(t,{onChange:r=>s(r||null),...i})}}function di(t){const e=E.c(10);let s,i,r;e[0]!==t?({value:r,onChange:s,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);let n;e[4]!==s?(n=a=>s(parseInt(a.target.value)),e[4]=s,e[5]=n):n=e[5];let l;return e[6]!==i||e[7]!==n||e[8]!==r?(l=o.jsx("input",{type:"number",value:r,onChange:n,...i}),e[6]=i,e[7]=n,e[8]=r,e[9]=l):l=e[9],l}function ff(t){const e=E.c(12);let s,i,r,n;if(e[0]!==t){const{value:d,onChange:u,choices:h,...p}=t;n=d,s=h,i=p,r=g=>u(g.target.value),e[0]=t,e[1]=s,e[2]=i,e[3]=r,e[4]=n}else s=e[1],i=e[2],r=e[3],n=e[4];let l;e[5]!==s?(l=s.map(pf),e[5]=s,e[6]=l):l=e[6];let a;return e[7]!==i||e[8]!==r||e[9]!==l||e[10]!==n?(a=o.jsx("select",{onChange:r,value:n,...i,children:l}),e[7]=i,e[8]=r,e[9]=l,e[10]=n,e[11]=a):a=e[11],a}function pf(t){return o.jsx("option",{value:t,children:t},t)}function hf(t){const e=E.c(13);let s,i,r;e[0]!==t?({value:r,onChange:s,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);const n=Math.max(r.length,1);let l;e[4]!==r?(l=r.join(`
+`),e[4]=r,e[5]=l):l=e[5];const[a,d]=Ee.useState(l);let u;e[6]!==s?(u=g=>{const _=g.target.value;d(_),s(_.split(`
+`).map(gf).filter(mf))},e[6]=s,e[7]=u):u=e[7];const h=u;let p;return e[8]!==h||e[9]!==n||e[10]!==i||e[11]!==a?(p=o.jsx("textarea",{rows:n,value:a,onChange:h,...i}),e[8]=h,e[9]=n,e[10]=i,e[11]=a,e[12]=p):p=e[12],p}function mf(t){return t!==""}function gf(t){return t.trim()}const vf={bool:so,str:ci,int:di,"optional str":ai(ci),"optional int":ai(di),"sequence of str":hf};function xf(t){const e=E.c(16),{choices:s,type:i,value:r,onChange:n,name:l,error:a}=t;let d,u;if(e[0]!==d||e[1]!==s||e[2]!==n||e[3]!==i||e[4]!==r){if(u={onChange:n,value:r},s)d=ff,u.choices=s;else if(d=vf[i],!d)throw`unknown option type ${i}`;d!==so&&(u.className="form-control"),e[0]=d,e[1]=s,e[2]=n,e[3]=i,e[4]=r,e[5]=u,e[6]=d}else u=e[5],d=e[6];let h;e[7]!==a?(h=_e({"has-error":a}),e[7]=a,e[8]=h):h=e[8];let p;e[9]!==d||e[10]!==l||e[11]!==u?(p=o.jsx(d,{name:l,onKeyDown:uf,...u}),e[9]=d,e[10]=l,e[11]=u,e[12]=p):p=e[12];let g;return e[13]!==h||e[14]!==p?(g=o.jsx("div",{className:h,children:p}),e[13]=h,e[14]=p,e[15]=g):g=e[15],g}function _f(t){const e=E.c(18),{name:s}=t,i=G();let r;e[0]!==s?(r=j=>j.options_meta[s]?.choices,e[0]=s,e[1]=r):r=e[1];const n=D(r);let l;e[2]!==s?(l=j=>j.options_meta[s]?.type,e[2]=s,e[3]=l):l=e[3];const a=D(l);let d;e[4]!==s?(d=j=>{const y=j.ui.optionsEditor[s];return y?y.value:j.options_meta[s]?.value},e[4]=s,e[5]=d):d=e[5];const u=D(d);let h;e[6]!==s?(h=j=>j.ui.optionsEditor[s]?.error,e[6]=s,e[7]=h):h=e[7];const p=D(h);let g;e[8]!==i||e[9]!==s?(g=j=>i(Cs(s,j)),e[8]=i,e[9]=s,e[10]=g):g=e[10];let _;return e[11]!==n||e[12]!==p||e[13]!==s||e[14]!==g||e[15]!==a||e[16]!==u?(_=o.jsx(xf,{name:s,choices:n,type:a,value:u,error:p,onChange:g}),e[11]=n,e[12]=p,e[13]=s,e[14]=g,e[15]=a,e[16]=u,e[17]=_):_=e[17],_}function jf(t){const e=E.c(4),{name:s}=t;let i;e[0]!==s?(i=l=>l.options_meta[s]?.help,e[0]=s,e[1]=i):i=e[1];const r=D(i);let n;return e[2]!==r?(n=o.jsx("div",{className:"help-block small",children:r}),e[2]=r,e[3]=n):n=e[3],n}function yf(t){const e=E.c(4),{name:s}=t;let i;e[0]!==s?(i=l=>l.options_meta[s]?.error,e[0]=s,e[1]=i):i=e[1];const r=D(i);if(!r)return null;let n;return e[2]!==r?(n=o.jsx("div",{className:"small text-danger",children:r}),e[2]=r,e[3]=n):n=e[3],n}function wf(t){const e=E.c(2);let{value:s,defaultVal:i}=t;if(s===i)return null;{if(typeof i=="boolean")i=i?"true":"false";else if(Array.isArray(i)){if(Ht.isEmpty(Ht.compact(s))&&Ht.isEmpty(i))return null;i="[ ]"}else i===""?i='""':i===null&&(i="null");let r;return e[0]!==i?(r=o.jsxs("div",{className:"small",children:["Default: ",o.jsxs("strong",{children:[" ",i," "]})," "]}),e[0]=i,e[1]=r):r=e[1],r}}const bf=zt((t,{name:e})=>({value:t.options[e],defaultVal:t.options_meta[e]?.default}))(wf);function Sf(){const t=E.c(24),e=G(),s=D(Cf,Kt);let i,r,n,l;if(t[0]!==e||t[1]!==s){const p=s.sort();let g;t[6]!==e?(g=()=>e(Wi()),t[6]=e,t[7]=g):g=t[7];let _;t[8]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("i",{className:"fa fa-fw fa-times"}),t[8]=_):_=t[8];let j;t[9]!==g?(j=o.jsx("button",{type:"button",className:"close","data-dismiss":"modal",onClick:g,children:_}),t[9]=g,t[10]=j):j=t[10];let y;t[11]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("div",{className:"modal-title",children:o.jsx("h4",{children:"Options"})}),t[11]=y):y=t[11],t[12]!==j?(l=o.jsxs("div",{className:"modal-header",children:[j,y]}),t[12]=j,t[13]=l):l=t[13],n="modal-body",i="form-horizontal",r=p.map($f),t[0]=e,t[1]=s,t[2]=i,t[3]=r,t[4]=n,t[5]=l}else i=t[2],r=t[3],n=t[4],l=t[5];let a;t[14]!==i||t[15]!==r?(a=o.jsx("div",{className:i,children:r}),t[14]=i,t[15]=r,t[16]=a):a=t[16];let d;t[17]!==n||t[18]!==a?(d=o.jsx("div",{className:n,children:a}),t[17]=n,t[18]=a,t[19]=d):d=t[19];let u;t[20]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"modal-footer"}),t[20]=u):u=t[20];let h;return t[21]!==l||t[22]!==d?(h=o.jsxs("div",{children:[l,d,u]}),t[21]=l,t[22]=d,t[23]=h):h=t[23],h}function $f(t){return o.jsxs("div",{className:"form-group",children:[o.jsxs("div",{className:"col-xs-6",children:[o.jsx("label",{htmlFor:t,children:t}),o.jsx(jf,{name:t})]}),o.jsxs("div",{className:"col-xs-6",children:[o.jsx(_f,{name:t}),o.jsx(yf,{name:t}),o.jsx(bf,{name:t})]})]},t)}function Cf(t){return Object.keys(t.options_meta)}function Nf(){const t=E.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(df,{children:o.jsx(Sf,{})}),t[0]=e):e=t[0],e}const kf={OptionModal:Nf};function Ef(){const t=E.c(3),e=D(Tf),s=e?kf[e]:void 0;if(s){let i;return t[0]!==s?(i=o.jsx(s,{}),t[0]=s,t[1]=i):i=t[1],i}else{let i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(o.Fragment,{}),t[2]=i):i=t[2],i}}function Tf(t){return t.ui.modal.activeModal}class Rf extends I.Component{state={};render=()=>{const{showEventLog:e,showCommandBar:s}=this.props;return this.state.error?(console.log("ERR",this.state),o.jsxs("div",{className:"container",children:[o.jsx("h1",{children:"mitmproxy has crashed."}),o.jsxs("pre",{children:[this.state.error.stack,o.jsx("br",{}),o.jsx("br",{}),"Component Stack:",this.state.errorInfo?.componentStack]}),o.jsxs("p",{children:["Please lodge a bug report at"," ",o.jsx("a",{href:"https://github.com/mitmproxy/mitmproxy/issues",children:"https://github.com/mitmproxy/mitmproxy/issues"}),"."]})]})):o.jsxs("div",{id:"container",tabIndex:0,children:[o.jsx(Hu,{}),o.jsx(lu,{}),s&&o.jsx(Gu,{},"commandbar"),e&&o.jsx(of,{},"eventlog"),o.jsx(lf,{}),o.jsx(Ef,{})]})};componentDidMount(){window.addEventListener("keydown",this.props.onKeyDown)}componentWillUnmount(){window.removeEventListener("keydown",this.props.onKeyDown)}componentDidCatch(e,s){this.setState({error:e,errorInfo:s})}}const Af=zt(t=>({showEventLog:t.eventLog.visible,showCommandBar:t.commandBar.visible}),{onKeyDown:od})(Rf),Ze={SEARCH:"s",HIGHLIGHT:"h",SHOW_EVENTLOG:"e",SHOW_COMMANDBAR:"c"};function Df(t){const[e,s]=window.location.hash.substr(1).split("?",2),i=e.substr(1).split("/");if(i[0]==="flows"){if(i.length==3){const[r,n]=i.slice(1);t.dispatch(Ut(n));const l=()=>{const d=t.getState().flows.byId.get(r);d!==void 0&&(a(),t.dispatch(He([d])))},a=t.subscribe(l);l()}}else i[0]==="capture"&&t.dispatch(Vt(ve.Capture));s&&s.split("&").forEach(r=>{const[n,l]=r.split("=",2),a=decodeURIComponent(l);switch(n){case Ze.SEARCH:t.dispatch(Ri(a));break;case Ze.HIGHLIGHT:t.dispatch(Ai(a));break;case Ze.SHOW_EVENTLOG:t.getState().eventLog.visible||t.dispatch(Gt());break;case Ze.SHOW_COMMANDBAR:t.getState().commandBar.visible||t.dispatch(Ji());break;default:console.error(`unimplemented query arg: ${r}`)}})}function Ff(t){const e=t.getState(),s={[Ze.SEARCH]:e.ui.filter[ge.Search],[Ze.HIGHLIGHT]:e.ui.filter[ge.Highlight],[Ze.SHOW_EVENTLOG]:e.eventLog.visible,[Ze.SHOW_COMMANDBAR]:e.commandBar.visible},i=Object.keys(s).filter(l=>s[l]).map(l=>`${l}=${encodeURIComponent(s[l])}`).join("&");let r;e.ui.tabs.current===ve.Capture?r="/capture":e.flows.selected.length>0?r=`/flows/${e.flows.selected[0].id}/${e.ui.flow.tab}`:r="/flows",i&&(r+="?"+i);let n=window.location.pathname;n==="blank"&&(n="/"),window.location.hash.substr(1)!==r&&history.replaceState(void 0,"",`${n}#${r}`)}function If(t){Df(t),t.subscribe(()=>Ff(t))}var lt=(t=>(t.State="state",t.Flows="flows",t.Events="events",t.Options="options",t))(lt||{});class Lf{activeFetches;store;filterState;socket;messageQueue;constructor(e){this.activeFetches={},this.store=e,this.filterState=Ti,this.messageQueue=[],this.connect(),this.store.subscribe(this.onStoreUpdate.bind(this))}connect(){this.socket=new WebSocket(location.origin.replace("http","ws")+location.pathname.replace(/\/$/,"")+"/updates"),this.socket.addEventListener("open",()=>this.onOpen()),this.socket.addEventListener("close",e=>this.onClose(e)),this.socket.addEventListener("message",e=>this.onMessage(JSON.parse(e.data))),this.socket.addEventListener("error",e=>this.onError(e))}async onOpen(){for(const e of this.messageQueue)this.socket.send(JSON.stringify(e));this.messageQueue=[],this.store.dispatch(Cc()),await Promise.all([this.fetchData("state"),this.fetchData("flows"),this.fetchData("events"),this.fetchData("options")]),this.store.dispatch(Nc())}onStoreUpdate(){const e=this.store.getState().ui.filter;if(e!==this.filterState){for(const s of Object.values(ge))this.filterState[s]!==e[s]&&this.sendMessage({type:"flows/updateFilter",payload:{name:s,expr:e[s]}});this.filterState=e}}fetchData(e){const s=[];return this.activeFetches[e]=s,ne(`./${e}`).then(i=>i.json()).then(i=>{this.activeFetches[e]===s&&this.receive(e,i)})}onMessage(e){switch(e.type){case"flows/add":return this.queueOrDispatch("flows",Mi(e.payload));case"flows/update":return this.queueOrDispatch("flows",qi(e.payload));case"flows/filterUpdate":return this.queueOrDispatch("flows",Vi(e.payload));case"flows/remove":return this.queueOrDispatch("flows",Hi(e.payload));case"events/add":return this.queueOrDispatch("events",Ss(e.payload));case"options/update":return this.queueOrDispatch("options",$s(e.payload));case"state/update":return this.queueOrDispatch("state",Ue(e.payload));case"flows/reset":return this.fetchData("flows");case"events/reset":return this.fetchData("events");default:Ct(e.type)}}sendMessage(e){this.socket.readyState===WebSocket.OPEN?this.socket.send(JSON.stringify(e)):this.socket.readyState===WebSocket.CONNECTING?this.messageQueue.push(e):console.error("WebSocket is not open. Cannot send:",e)}queueOrDispatch(e,s){const i=this.activeFetches[e];i!==void 0?i.push(s):this.store.dispatch(s)}receive(e,s){switch(e){case"state":this.store.dispatch(Ve(s));break;case"options":this.store.dispatch(Yt(s));break;case"events":this.store.dispatch(Ki(s));break;case"flows":this.store.dispatch(bs(s));break;default:Ct(e)}const i=this.activeFetches[e];delete this.activeFetches[e],i.forEach(r=>this.store.dispatch(r))}onClose(e){this.store.dispatch(kc(`Connection closed at ${new Date().toUTCString()} with error code ${e.code}.`)),console.error("websocket connection closed",e)}onError(...e){console.error("websocket connection errored",e)}}class Pf{store;constructor(e){this.store=e,this.onOpen()}onOpen(){this.fetchData(lt.Flows),this.fetchData(lt.Options)}fetchData(e){ne(`./${e}`).then(s=>s.json()).then(s=>{this.receive(e,s)})}receive(e,s){switch(e){case lt.Flows:this.store.dispatch(bs(s));break;case lt.Options:this.store.dispatch(Yt(s));break;case lt.State:throw"unreachable";case lt.Events:throw"unreachable";default:Ct(e)}}}window.MITMWEB_STATIC?window.backend=new Pf(Nt):window.backend=new Lf(Nt);If(Nt);window.addEventListener("error",t=>{Nt.dispatch(hc(`${t.message}
+${t.error.stack}`))});document.addEventListener("DOMContentLoaded",()=>{const t=document.getElementById("mitmproxy");Pl.createRoot(t).render(o.jsx(Ol,{store:Nt,children:o.jsx(Af,{})}))});
index e4842b025c7803f83a46bc27bfbe7685a207b10b..dd0e6c45f802604d52c360e33e2dd2ab2e8e884e 100644 (file)
@@ -2,7 +2,7 @@ import os
 import subprocess
 import sys
 
-VERSION = "13.0.0.dev"
+VERSION = "12.2.1"
 MITMPROXY = "mitmproxy " + VERSION
 
 # Serialization format version. This is displayed nowhere, it just needs to be incremented by one