text: (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6657],{90530:function(t,e,n){"use strict";n.d(e,{Z:function(){return R},H:function(){return P}});var r=n(67105),o=n(24246),a=n(59972),c=n(88742),i=n.n(c),u=n(40505),s=n(27378),l=n(38944),d=n(2576),p=n(46121),f=n(97165),h=null;function _(){if(null===h){var t=document.createElement("canvas");h=!(!t.getContext||!t.getContext("2d"))&&0===t.toDataURL("image/webp").indexOf("data:image/webp")}return h}var v=n(61213),m=n(18213),g=n(45158),b=n(76244),w=n(2157),x=n.n(w),y=function(){var t=(0,u.Z)(i().mark((function t(e){var n,r,o,a,c,u,s;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.deploymentId,r=e.teamId,o=e.withReachable,t.next=3,(0,v.Z)(100);case 3:return a="/api/screenshot".concat((0,f.c)({deploymentId:n,teamId:r,withStatus:o})),c=(0,g.P)(a,"GET SCREENSHOT"),t.next=7,fetch(a,{headers:{accept:_()?"image/webp,image/apng,image/*,*/*;q=0.8":"*/*"}});case 7:if(200===(u=t.sent).status){t.next=24;break}return t.prev=9,t.t0=g.b,t.t1=c,t.next=14,u.text();case 14:t.t2=t.sent,t.t3=u.status,(0,t.t0)(t.t1,t.t2,t.t3),t.next=22;break;case 19:t.prev=19,t.t4=t.catch(9),(0,g.b)(c,t.t4,u.status);case 22:throw(0,b.B)({category:"Dashboard",action:"status: "+u.status,label:"Screenshot API Error"}),new Error("An error occurred when loading the screenshot.");case 24:return(0,g.b)(c,null,200),t.next=27,u.blob();case 27:return s=t.sent,t.abrupt("return",[URL.createObjectURL(s),o?"1"===u.headers.get("x-vercel-screenshot-reachable"):null]);case 29:case"end":return t.stop()}}),t,null,[[9,19]])})));return function(e){return t.apply(this,arguments)}}(),Z=new Map,k=function(t){var e,n,c=t.deployment,i=t.noBorderRadius,u=void 0!==i&&i,f=t.withReachable,h=void 0!==f&&f,_=t.withImageWrapper,v=void 0===_||_,g=t.onReady,b=t.height,w=(0,s.useState)(!0),k=w[0],P=w[1],E=(0,s.useState)(!1),R=E[0],O=E[1],j=(0,m.ZP)().teamData,T=(0,s.useState)(c?null===(e=Z.get(c.id))||void 0===e?void 0:e[0]:null),C=T[0],I=T[1];return(0,s.useEffect)((function(){if(c&&c.status&&j&&!R){if(Z.has(c.id)){var t=Z.get(c.id),e=(0,a.Z)(t,2),n=e[0],r=e[1];return I(n),P(!n),void(g&&g(r))}var o=j.team;P(!0),O(!0),y({deploymentId:c.id,teamId:null===o||void 0===o?void 0:o.id,withReachable:h}).then((function(t){var e=(0,a.Z)(t,2),n=e[0],r=e[1];I(n),P(!1),Z.set(c.id,[n,r]),g&&g(r)})).catch((function(){I(null),P(!1),O(!1)}))}}),[c,j,R,h]),k?(0,o.jsx)(p.Z,{width:"100%",height:b||"100%",squared:u,style:b?{}:{paddingTop:"31.25% ",paddingBottom:"31.25% "},className:x().skeleton}):c&&C?v?(0,o.jsx)("div",{className:(0,l.Z)(x().imageWrapper,(n={},(0,r.Z)(n,x()["no-border-radius"],u),(0,r.Z)(n,x()["fixed-height"],b),n)),style:b?(0,r.Z)({},"--height",(0,d.Z)(b)):{},children:(0,o.jsx)("img",{src:C,className:x().image,alt:"Preview Screenshot of ".concat(c.url)})}):(0,o.jsx)("img",{src:C,className:x().image,alt:"Preview Screenshot of ".concat(c.url)}):null};function P(t){return E.apply(this,arguments)}function E(){return(E=(0,u.Z)(i().mark((function t(e){var n,r,o,c,u,s;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.deploymentId,r=e.teamId,o=e.withReachable,c=void 0!==o&&o,!Z.has(n)){t.next=3;break}return t.abrupt("return");case 3:return t.prev=3,u=y({deploymentId:n,teamId:r,withReachable:c}).then((function(t){var e=(0,a.Z)(t,2),r=e[0],o=e[1];Z.set(n,[r,o])})),s=new Promise((function(t){return setTimeout(t,1e4)})),t.next=8,Promise.race([u,s]);case 8:t.next=12;break;case 10:t.prev=10,t.t0=t.catch(3);case 12:case"end":return t.stop()}}),t,null,[[3,10]])})))).apply(this,arguments)}var R=s.memo(k)},61918:function(t,e,n){"use strict";n.d(e,{Z:function(){return m}});var r=n(24246),o=n(67105),a=n(59972),c=n(27378),i=n(38944),u=n(48389),s=n.n(u),l=n(55911),d=n(58093),p=n(13970);var f=n(18326),h=n.n(f);function _(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function v(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?_(Object(n),!0).forEach((function(e){(0,o.Z)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var m=function(t){var e,n=t.text,u=t.position,f=void 0===u?"top":u,_=t.tip,m=void 0===_||_,g=t.delay,b=void 0===g||g,w=t.delayTime,x=void 0===w?0:w,y=t.invert,Z=void 0===y||y,k=t.center,P=void 0===k||k,E=t.cursor,R=t.wrap,O=void 0===R||R,j=t.maxWidth,T=void 0===j?"250px":j,C=t.padding,I=t.fill,S=void 0===I||I,L=t.type,N=t.style,W=t.shown,M=void 0===W?0:W,D=t.className,H=t.children,B=t.sticky,J=void 0!==B&&B,q=t.alwaysOn,A=void 0!==q&&q,F=t.boxAlign,V=void 0===F?"center":F,z=(0,c.useState)(M),K=z[0],U=z[1],X=(0,c.useState)({top:0,left:0,width:0,height:0}),G=X[0],Q=X[1],Y=(0,c.useRef)(null),$=(0,p.Z)(L,S),tt="tooltip-".concat((0,d.Z)()),et=(0,c.useCallback)((function(){if(Y&&Y.current){var t=Y.current.getBoundingClientRect(),e=t.height,n=t.width,r=t.top,o=t.left;r+=window.scrollY,o+=window.scrollX,Q({top:r,left:o,height:e,width:n})}}),[Q]),nt=(0,c.useCallback)((function(t){A||(et(),U((function(e){return e|t})))}),[et,A]),rt=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.maxWait,o=(0,c.useRef)(null),a=(0,c.useRef)([]),i=n.leading,u=(0,c.useRef)(!1),s=(0,c.useRef)(null),l=(0,c.useRef)(!1),d=(0,c.useRef)(t);d.current=t;var p=(0,c.useCallback)((function(){clearTimeout(s.current),clearTimeout(o.current),o.current=null,a.current=[],s.current=null,u.current=!1}),[]);(0,c.useEffect)((function(){return function(){l.current=!0}}),[]);var f=(0,c.useCallback)((function(){for(var t=arguments.length,n=new Array(t),c=0;c<t;c++)n[c]=arguments[c];if(a.current=n,clearTimeout(s.current),!s.current&&i&&!u.current)return d.current.apply(d,n),void(u.current=!0);s.current=setTimeout((function(){p(),l.current||d.current.apply(d,n)}),e),r&&!o.current&&(o.current=setTimeout((function(){var t=a.current;p(),l.current||d.current.apply(null,t)}),r))}),[r,e,p,i]),h=function(){s.current&&(d.current.apply(null,a.current),p())};return[f,p,h]}(nt,x),ot=(0,a.Z)(rt,2),at=ot[0],ct=ot[1],it=(0,c.useCallback)((function(t){A||(ct(),U((function(e){return e&~t})))}),[ct,A]);(0,c.useEffect)((function(){et(),U(M)}),[et,U,M]);var ut=(0,c.useCallback)((function(t){"Escape"===t.key&&it(3)}),[it]),st=(0,c.useCallback)(s()(et,150),[et]);(0,c.useEffect)((function(){var t=function(){window.removeEventListener("keydown",ut),window.removeEventListener("resize",st)};return K>0?(window.addEventListener("keydown",ut),window.addEventListener("resize",st)):t(),t}),[ut,st,K]);var lt=(0,c.useMemo)((function(){switch(f){case"top":return"left"===V?"translate(\n            calc(0px),\n            calc(-100% - 10px)\n          )":"translate(\n          calc(-50% + ".concat(Math.ceil(G.width/2),"px),\n          calc(-100% - 10px)\n        )");case"bottom":return"left"===V?"translate(\n            calc(0px),\n            calc(".concat(~~G.height,"px + 10px)\n          )"):"translate(\n          calc(-50% + ".concat(Math.ceil(G.width/2),"px),\n          calc(").concat(~~G.height,"px + 10px)\n        )");case"left":return"translate(\n          calc(-100% - 10px),\n          calc(-50% + ".concat(Math.ceil(G.height/2),"px)\n        )");case"right":return"translate(\n          calc(".concat(Math.ceil(G.width),"px + 10px),\n          calc(-50% + ").concat(Math.ceil(G.height/2),"px)\n        )");default:return""}}),[f,V,G]);return(0,r.jsxs)("span",{tabIndex:0,onMouseEnter:x?function(){return at(1)}:function(){return nt(1)},onFocus:function(t){t.target===Y.current&&J&&!A&&nt(2)},onMouseLeave:function(){return it(1)},onBlur:function(){return it(2)},ref:Y,"aria-describedby":K?tt:void 0,className:(0,i.Z)(h().container,D),style:v({cursor:E},N),children:[K>0&&(0,r.jsx)(l.Z,{children:(0,r.jsxs)("div",{className:(0,i.Z)(h().tooltip,$,(e={},(0,o.Z)(e,h().top,"top"===f),(0,o.Z)(e,h().left,"left"===f),(0,o.Z)(e,h().right,"right"===f),(0,o.Z)(e,h().bottom,"bottom"===f),(0,o.Z)(e,h()["box-align-left"],"left"===V),(0,o.Z)(e,h().delay,b),(0,o.Z)(e,h().tip,m),(0,o.Z)(e,h().wrap,O),(0,o.Z)(e,"invert-theme",Z),(0,o.Z)(e,h().center,P),e)),role:"tooltip",id:tt,style:{padding:C,maxWidth:T,transform:lt,top:G.top,left:G.left},children:[m&&(0,r.jsx)("i",{className:h().triangle}),n]})}),H]})}},61213:function(t,e,n){"use strict";function r(t){return new Promise((function(e){setTimeout(e,t)}))}n.d(e,{Z:function(){return r}})},32572:function(t,e,n){"use strict";n.d(e,{Z:function(){return s},G:function(){return d}});var r=n(70053),o=n(93632),a=n(61659),c=n(55888),i=n(18213),u=n(97165);function s(t,e){var n=(0,a.LP)(),c=(0,i.ZP)().teamData;return(0,r.ZP)(c?d(t):null,(function(t){return(0,o.Z)("".concat(t).concat(t.includes("?url")?"":(0,u.c)({teamId:null!==c&&void 0!==c&&c.team?c.team.id:null})),n,{throwOnHTTPError:!0}).then(l)}),e)}function l(t){return t&&(t.host=t.url,t.isPrivate=!t.public),t}function d(t){return t?(t=t.replace(/^https?:\/\//,"")).startsWith("dpl_")?"".concat((0,c.PP)("v13"),"/").concat(t):"".concat((0,c.PP)("v13"),"/get?url=").concat(t):""}},2157:function(t){t.exports={container:"screenshot_container__3FYtQ",error:"screenshot_error__ETxTp",errorHeader:"screenshot_errorHeader__K_JIR",secondary:"screenshot_secondary__XWbb9",fallback:"screenshot_fallback__EVR4u",highlight:"screenshot_highlight__R5Lti","no-border":"screenshot_no-border__2gWbk","no-border-radius":"screenshot_no-border-radius__VZ-2Q",imageWrapper:"screenshot_imageWrapper__gwcHR","fixed-height":"screenshot_fixed-height__3naEE",statusText:"screenshot_statusText__2t895",image:"screenshot_image__Me6wJ","error-message":"screenshot_error-message__3Syim"}},18326:function(t){t.exports={container:"tooltip_container__qCVFL",absolute:"tooltip_absolute__3rWab",relative:"tooltip_relative__1X2gJ",tooltip:"tooltip_tooltip__1lCTq",fadeIn:"tooltip_fadeIn__14KSo",delay:"tooltip_delay__2pv3Z",wrap:"tooltip_wrap__3dyHz",center:"tooltip_center__17hgV",tip:"tooltip_tip__H9kwP",triangle:"tooltip_triangle__30dJr",top:"tooltip_top__iuL-C",bottom:"tooltip_bottom__1KFD_",left:"tooltip_left__2C-sN",right:"tooltip_right__1b4_W","box-align-left":"tooltip_box-align-left__2fcJr"}}}]);