(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{105:function(e){e.exports=JSON.parse('{"a":"/shlink-web-client/feature/update-react-datepicker"}')},111:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(39),c=r(0),a=function(e){var t=e.color,r=void 0===t?n.c:t,a=e.className;return Object(c.jsx)("svg",{className:a,viewBox:"0 0 512 512",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:Object(c.jsxs)("g",{fill:r,children:[Object(c.jsx)("path",{d:" M 23.71 85.08 C 17.22 49.81 49.44 14.86 85.08 18.12 C 118.83 19.21 145.72 53.33 139.45 86.37 C 155.64 102.30 171.32 118.83 187.87 134.36 C 198.32 111.73 208.84 89.12 219.57 66.62 C 226.05 53.84 243.47 48.74 255.73 56.27 C 263.76 62.10 270.34 69.69 277.25 76.75 C 286.28 86.61 285.72 102.89 276.31 112.31 C 223.38 165.37 170.38 218.37 117.35 271.34 C 107.72 280.99 91.01 281.25 81.11 271.86 C 74.39 264.94 66.82 258.69 61.24 250.77 C 53.72 238.52 58.85 221.07 71.64 214.62 C 94.11 203.87 116.72 193.38 139.33 182.91 C 123.81 166.36 107.30 150.68 91.37 134.49 C 60.20 140.28 27.37 116.78 23.71 85.08 Z"}),Object(c.jsx)("path",{d:" M 205.21 201.23 C 225.32 181.36 260.88 181.11 281.14 200.86 C 299.25 218.75 317.37 236.65 335.10 254.93 C 356.73 278.01 352.01 318.70 326.03 336.56 C 320.07 330.47 313.73 324.65 308.12 318.28 C 323.86 309.39 328.76 286.18 316.63 272.39 C 301.73 256.95 286.30 242.03 271.24 226.75 C 264.49 219.65 256.80 212.00 246.37 211.52 C 224.65 208.64 205.52 233.36 214.49 253.58 C 221.09 266.81 234.22 275.12 243.62 286.24 C 240.43 295.96 238.09 306.13 238.29 316.46 C 225.55 304.29 213.16 291.73 200.89 279.09 C 180.97 257.57 183.10 220.45 205.21 201.23 Z"}),Object(c.jsx)("path",{d:" M 273.90 352.07 C 252.28 328.99 256.98 288.31 282.96 270.46 C 288.93 276.54 295.26 282.36 300.88 288.72 C 285.14 297.62 280.23 320.82 292.38 334.61 C 307.27 350.05 322.70 364.96 337.75 380.25 C 344.51 387.35 352.20 395.00 362.64 395.48 C 384.35 398.37 403.49 373.64 394.51 353.42 C 387.92 340.18 374.78 331.88 365.38 320.76 C 368.56 311.04 370.91 300.86 370.71 290.54 C 383.45 302.70 395.84 315.27 408.11 327.91 C 428.03 349.43 425.90 386.55 403.78 405.77 C 383.68 425.64 348.13 425.89 327.86 406.14 C 309.75 388.25 291.60 370.37 273.90 352.07 Z"}),Object(c.jsx)("path",{d:" M 422.11 403.83 C 431.96 394.07 441.60 384.06 451.66 374.51 C 460.90 383.74 471.89 392.70 474.89 406.11 C 480.16 429.97 484.08 454.13 488.76 478.12 C 490.00 483.41 484.47 488.29 479.35 486.63 C 454.66 481.52 429.55 478.12 405.14 471.84 C 393.17 467.97 385.20 457.75 376.55 449.27 C 386.39 439.49 396.13 429.60 406.06 419.91 C 416.37 433.45 435.74 414.00 422.11 403.83 Z"})]})})}},112:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(3),c=r(2),a=r(24),s=r(44),i=r(26),o=r(50),l=r(0);function u(e,t){return function(r){var u=Object(a.h)(),d=r.selectServer,j=r.selectedServer;return Object(c.useEffect)((function(){u.serverId&&d(u.serverId)}),[u.serverId]),j?Object(i.c)(j)?Object(l.jsx)(t,{}):Object(l.jsx)(e,Object(n.a)({},r)):Object(l.jsx)(o.a,{children:Object(l.jsx)(s.a,{loading:!0})})}}},115:function(e,t,r){"use strict";var n=r(16),c=r(29),a=r(0);t.a=function(e){var t=e.to,r=void 0===t?"/":t,s=e.children,i=void 0===s?"Home":s;return Object(a.jsx)("div",{className:"home",children:Object(a.jsxs)(c.a,{className:"p-4",children:[Object(a.jsx)("h2",{children:"Oops! We could not find requested route."}),Object(a.jsx)("p",{children:"Use your browser's back button to navigate to the page you have previously come from, or just press this button."}),Object(a.jsx)("br",{}),Object(a.jsx)(n.b,{to:r,className:"btn btn-outline-primary btn-lg",children:i})]})})}},126:function(e,t,r){"use strict";var n=r(4),c=r(16),a=r(6),s=r.n(a),i=r(11),o=r(12),l=r(0),u=function(e){var t=e.id,r=e.name;return Object(l.jsxs)(n.s,{tag:c.b,to:"/server/".concat(t),className:"servers-list__server-item",children:[r,Object(l.jsx)(i.a,{icon:o.j,className:"servers-list__server-item-icon"})]})};t.a=function(e){var t=e.servers,r=e.children,c=e.embedded,a=void 0!==c&&c;return Object(l.jsxs)(l.Fragment,{children:[r&&Object(l.jsx)("h5",{className:"mb-md-3",children:r}),t.length>0&&Object(l.jsx)(n.r,{className:s()("servers-list__list-group",{"servers-list__list-group--embedded":a}),children:t.map((function(e){var t=e.id,r=e.name;return Object(l.jsx)(u,{id:t,name:r},t)}))})]})}},15:function(e,t,r){"use strict";r.d(t,"d",(function(){return o})),r.d(t,"f",(function(){return l})),r.d(t,"e",(function(){return u})),r.d(t,"c",(function(){return d})),r.d(t,"a",(function(){return j})),r.d(t,"b",(function(){return b}));var n=r(7),c=r(2),a=r(181),s=r(24),i=r(42),o=function(e,t){return function(){var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3,s=Object(c.useState)(r),i=Object(n.a)(s,2),o=i[0],l=i[1],u=Object(c.useRef)(void 0),d=function(){l(!r),u.current&&t(u.current),u.current=e((function(){return l(r)}),a)};return[o,d]}},l=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=Object(c.useState)(e),r=Object(n.a)(t,2),a=r[0],s=r[1];return[a,function(){return s(!a)},function(){return s(!0)},function(){return s(!1)}]},u=function(e,t){var r=function(e){return function(t){t.event.composedPath().some((function(e){var t=e.classList;return null===t||void 0===t?void 0:t.contains("visits-table")}))||document.querySelector(".modal")||e()}};return Object(a.useSwipeable)({delta:40,onSwipedLeft:r(t),onSwipedRight:r(e)})},d=function(e,t){var r=Object(c.useState)(t),a=Object(n.a)(r,2),s=a[0],o=a[1];return[s,function(t){var r=window,n=r.location,c=r.history,a=Object(i.a)(n.search);a[e]=t,c.pushState(null,"","".concat(n.pathname,"?").concat(Object(i.b)(a))),o(t)}]},j=function(e,t){var r=Object(c.useRef)(!0);Object(c.useEffect)((function(){!r.current&&e(),r.current=!1}),t)},b=function(){var e=Object(s.g)();return function(){return e(-1)}}},178:function(e,t,r){"use strict";(function(e){var n=r(179),c=r.n(n),a=r(180),s=r(207),i=r(208),o=r(209),l=r(210),u=r(184),d=r(205),j=r(69),b=r(99),h=r(186);t.a=function(t,r){t.constant("window",e.window),t.constant("console",e.console),t.constant("axios",c.a),t.service("ImageDownloader",h.a,"axios","window"),t.serviceFactory("ScrollToTop",a.a),t.serviceFactory("MainHeader",s.a,"ServersDropdown"),t.serviceFactory("Home",(function(){return i.a})),t.decorator("Home",j.a),t.decorator("Home",r(["servers"],["resetSelectedServer"])),t.serviceFactory("MenuLayout",o.a,"TagsList","ShortUrlsList","AsideMenu","CreateShortUrl","ShortUrlVisits","TagVisits","OrphanVisits","NonOrphanVisits","ServerError","Overview","EditShortUrl","ManageDomains"),t.decorator("MenuLayout",r(["selectedServer"],["selectServer","sidebarPresent","sidebarNotPresent"])),t.serviceFactory("AsideMenu",l.a,"DeleteServerButton"),t.serviceFactory("ShlinkVersionsContainer",(function(){return d.a})),t.decorator("ShlinkVersionsContainer",r(["selectedServer","sidebar"])),t.serviceFactory("ErrorHandler",u.a,"window","console"),t.serviceFactory("sidebarPresent",(function(){return b.c})),t.serviceFactory("sidebarNotPresent",(function(){return b.b}))}}).call(this,r(60))},180:function(e,t,r){"use strict";var n=r(2),c=r(24),a=r(0);t.a=function(){return function(e){var t=e.children,r=Object(c.f)();return Object(n.useEffect)((function(){scrollTo(0,0)}),[r]),Object(a.jsx)(a.Fragment,{children:t})}}},184:function(e,t,r){"use strict";var n=r(19),c=r(18),a=r(34),s=r(33),i=r(2),o=r(4),l=r(29),u=r(0);t.a=function(e,t){var r=e.location,d=t.error;return function(e){Object(a.a)(i,e);var t=Object(s.a)(i);function i(e){var r;return Object(n.a)(this,i),(r=t.call(this,e)).state={hasError:!1},r}return Object(c.a)(i,[{key:"componentDidCatch",value:function(e){d(e)}},{key:"render",value:function(){return this.state.hasError?Object(u.jsx)("div",{className:"home",children:Object(u.jsxs)(l.a,{className:"p-4",children:[Object(u.jsx)("h1",{children:"Oops! This is awkward :S"}),Object(u.jsx)("p",{children:"It seems that something went wrong. Try refreshing the page or just click this button."}),Object(u.jsx)("br",{}),Object(u.jsx)(o.b,{outline:!0,color:"primary",onClick:function(){return r.reload()},children:"Take me back"})]})}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(){return{hasError:!0}}}]),i}(i.Component)}},186:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(8),c=r.n(n),a=r(13),s=r(19),i=r(18),o=r(78),l=function(){function e(t,r){Object(s.a)(this,e),this.axios=t,this.window=r}return Object(i.a)(e,[{key:"saveImage",value:function(){var e=Object(a.a)(c.a.mark((function e(t,r){var n,a,s;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.axios.get(t,{responseType:"blob"});case 2:n=e.sent,a=n.data,s=URL.createObjectURL(a),Object(o.b)(this.window,s,r);case 6:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}()}]),e}()},196:function(e,t,r){"use strict";(function(e){var n=r(15),c=r(197),a=r(198);t.a=function(t){t.constant("localStorage",e.localStorage),t.service("Storage",c.a,"localStorage"),t.service("ColorGenerator",a.a,"Storage"),t.constant("setTimeout",e.setTimeout),t.constant("clearTimeout",e.clearTimeout),t.serviceFactory("useStateFlagTimeout",n.d,"setTimeout","clearTimeout")}}).call(this,r(60))},197:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(18),c=r(19),a=function(e){return"".concat("shlink",".").concat(e)},s=Object(n.a)((function e(t){var r=this;Object(c.a)(this,e),this.localStorage=t,this.get=function(e){var t=r.localStorage.getItem(a(e));return t?JSON.parse(t):void 0},this.set=function(e,t){return r.localStorage.setItem(a(e),JSON.stringify(t))}}))},198:function(e,t,r){"use strict";r.d(t,"a",(function(){return O}));var n=r(22),c=r(18),a=r(19),s=r(129),i=r(28),o="0123456789ABCDEF",l=Math.floor,u=Math.random,d=Math.sqrt,j=Math.round,b=function(e){return e.toLowerCase().trim()},h=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return j(d(.299*Math.pow(e,2)+.587*Math.pow(t,2)+.114*Math.pow(r,2)))},O=Object(c.a)((function e(t){var r,c=this;Object(a.a)(this,e),this.storage=t,this.colors=void 0,this.lights=void 0,this.getColorForKey=function(e){var t=b(e),r=c.colors[t];return r||c.setColorForKey(t,"#".concat(Object(i.e)(6,(function(){return o[l(u()*o.length)]})).join("")))},this.setColorForKey=function(e,t){var r=b(e);return c.colors[r]=t,c.storage.set("colors",c.colors),t},this.isColorLightForKey=function(e){var t=c.getColorForKey(e).substring(1);if(Object(s.a)(c.lights[t])){var r=function(e){var t;return(null!==(t=e.match(/../g))&&void 0!==t?t:[]).map((function(e){return parseInt(e,16)||0}))}(t);c.lights[t]=h.apply(void 0,Object(n.a)(r))>=128}return c.lights[t]},this.colors=null!==(r=this.storage.get("colors"))&&void 0!==r?r:{},this.lights={}}))},205:function(e,t,r){"use strict";var n=r(6),c=r.n(n),a=r(310),s=r(38),i=r(57),o=r(26),l=r(0),u=Object(a.a)(Object(i.c)(),i.b),d=function(e){var t=e.project,r=e.version;return Object(l.jsx)(s.a,{href:"https://github.com/shlinkio/".concat(t,"/releases/").concat(r),className:"text-muted",children:Object(l.jsx)("b",{children:r})})},j=function(e){var t=e.selectedServer,r=e.clientVersion,n=u(void 0===r?"%_VERSION_%":r);return Object(l.jsxs)("small",{className:"text-muted",children:[Object(o.d)(t)&&Object(l.jsxs)(l.Fragment,{children:["Server: ",Object(l.jsx)(d,{project:"shlink",version:t.printableVersion})," - "]}),"Client: ",Object(l.jsx)(d,{project:"shlink-web-client",version:n})]})};t.a=function(e){var t=e.selectedServer,r=e.sidebar,n=c()("text-center",{"shlink-versions-container--with-sidebar":r.sidebarPresent});return Object(l.jsx)("div",{className:n,children:Object(l.jsx)(j,{selectedServer:t})})}},207:function(e,t,r){"use strict";var n=r(7),c=r(12),a=r(11),s=r(2),i=r(24),o=r(16),l=r(4),u=r(6),d=r.n(u),j=r(15),b=r(111),h=r(0);t.a=function(e){return function(){var t=Object(j.f)(),r=Object(n.a)(t,4),u=r[0],O=r[1],v=r[3],f=Object(i.f)(),m=f.pathname;Object(s.useEffect)(v,[f]);var g="/settings",x=d()("main-header__toggle-icon",{"main-header__toggle-icon--opened":u});return Object(h.jsxs)(l.A,{color:"primary",dark:!0,fixed:"top",className:"main-header",expand:"md",children:[Object(h.jsxs)(l.B,{tag:o.b,to:"/",children:[Object(h.jsx)(b.a,{className:"main-header__brand-logo",color:"white"})," Shlink"]}),Object(h.jsx)(l.C,{onClick:O,children:Object(h.jsx)(a.a,{icon:c.i,className:x})}),Object(h.jsx)(l.j,{navbar:!0,isOpen:u,children:Object(h.jsxs)(l.x,{navbar:!0,className:"ms-auto",children:[Object(h.jsx)(l.y,{children:Object(h.jsxs)(l.z,{tag:o.b,to:g,active:m.startsWith(g),children:[Object(h.jsx)(a.a,{icon:c.l}),"\xa0 Settings"]})}),Object(h.jsx)(e,{})]})})]})}}},208:function(e,t,r){"use strict";var n=r(2),c=r(319),a=r(213),s=r(24),i=r(16),o=r(4),l=r(38),u=r(11),d=r(12),j=r(126),b=r(111),h=r(0);t.a=function(e){var t=e.servers,r=Object(s.g)(),O=Object(c.a)(t),v=!Object(a.a)(O);return Object(n.useEffect)((function(){var e=O.find((function(e){return e.autoConnect}));e&&r("/server/".concat(e.id))}),[]),Object(h.jsx)("div",{className:"home",children:Object(h.jsx)(o.d,{className:"home__main-card",children:Object(h.jsxs)(o.I,{className:"g-0",children:[Object(h.jsx)("div",{className:"col-md-5 d-none d-md-block",children:Object(h.jsx)("div",{className:"home__logo-wrapper",children:Object(h.jsx)("div",{className:"home__logo",children:Object(h.jsx)(b.a,{})})})}),Object(h.jsxs)("div",{className:"col-md-7 home__servers-container",children:[Object(h.jsx)("div",{className:"home__title-wrapper",children:Object(h.jsx)("h1",{className:"home__title",children:"Welcome!"})}),Object(h.jsx)(j.a,{embedded:!0,servers:O,children:!v&&Object(h.jsxs)("div",{className:"p-4 text-center",children:[Object(h.jsx)("p",{className:"mb-5",children:"This application will help you manage your Shlink servers."}),Object(h.jsx)("p",{children:Object(h.jsxs)(i.b,{to:"/server/create",className:"btn btn-outline-primary btn-lg me-2",children:[Object(h.jsx)(u.a,{icon:d.F})," ",Object(h.jsx)("span",{className:"ms-1",children:"Add a server"})]})}),Object(h.jsx)("p",{className:"mb-0 mt-5",children:Object(h.jsx)(l.a,{href:"https://shlink.io/documentation",children:Object(h.jsxs)("small",{children:[Object(h.jsx)("span",{className:"me-1",children:"Learn more about Shlink"})," ",Object(h.jsx)(u.a,{icon:d.p})]})})})]})})]})]})})})}},209:function(e,t,r){"use strict";var n=r(3),c=r(7),a=r(2),s=r(24),i=r(12),o=r(11),l=r(6),u=r.n(l),d=r(112),j=r(15),b=r(31),h=r(26),O=r(115),v=r(0);t.a=function(e,t,r,l,f,m,g,x,p,S,y,C){return Object(d.a)((function(d){var N=d.selectedServer,k=d.sidebarNotPresent,w=d.sidebarPresent,_=Object(s.f)(),U=Object(j.f)(),T=Object(c.a)(U,4),R=T[0],E=T[1],D=T[2],L=T[3],V=Object(h.d)(N);if(Object(a.useEffect)((function(){return L()}),[_]),Object(a.useEffect)((function(){return V&&w(),function(){return k()}}),[]),!V)return Object(v.jsx)(p,{});var I=Object(b.h)(N),F=Object(b.g)(N),A=Object(b.e)(N),M=u()("menu-layout__burger-icon",{"menu-layout__burger-icon--active":R}),G=Object(j.e)(D,L);return Object(v.jsxs)(v.Fragment,{children:[Object(v.jsx)(o.a,{icon:i.c,className:M,onClick:E}),Object(v.jsx)("div",Object(n.a)(Object(n.a)({},G),{},{className:"menu-layout__swipeable",children:Object(v.jsxs)("div",{className:"menu-layout__swipeable-inner",children:[Object(v.jsx)(r,{selectedServer:N,showOnMobile:R}),Object(v.jsx)("div",{className:"menu-layout__container",onClick:function(){return L()},children:Object(v.jsx)("div",{className:"container-xl",children:Object(v.jsxs)(s.d,{children:[Object(v.jsx)(s.b,{index:!0,element:Object(v.jsx)(s.a,{replace:!0,to:"overview"})}),Object(v.jsx)(s.b,{path:"/overview",element:Object(v.jsx)(S,{})}),Object(v.jsx)(s.b,{path:"/list-short-urls/:page",element:Object(v.jsx)(t,{})}),Object(v.jsx)(s.b,{path:"/create-short-url",element:Object(v.jsx)(l,{})}),Object(v.jsx)(s.b,{path:"/short-code/:shortCode/visits/*",element:Object(v.jsx)(f,{})}),Object(v.jsx)(s.b,{path:"/short-code/:shortCode/edit",element:Object(v.jsx)(y,{})}),Object(v.jsx)(s.b,{path:"/tag/:tag/visits/*",element:Object(v.jsx)(m,{})}),I&&Object(v.jsx)(s.b,{path:"/orphan-visits/*",element:Object(v.jsx)(g,{})}),F&&Object(v.jsx)(s.b,{path:"/non-orphan-visits/*",element:Object(v.jsx)(x,{})}),Object(v.jsx)(s.b,{path:"/manage-tags",element:Object(v.jsx)(e,{})}),A&&Object(v.jsx)(s.b,{path:"/manage-domains",element:Object(v.jsx)(C,{})}),Object(v.jsx)(s.b,{path:"*",element:Object(v.jsx)(O.a,{to:"/server/".concat(N.id,"/list-short-urls/1"),children:"List short URLs"})})]})})})]})}))]})}),p)}},21:function(e,t,r){"use strict";r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return c}));var n=function(e,t){return function(r,n){var c=n.type,a=e[c],s=null!==r&&void 0!==r?r:t;return a?a(s,n):s}},c=function(e){return function(){return{type:e}}}},210:function(e,t,r){"use strict";var n=r(3),c=r(30),a=r(12),s=r(11),i=r(16),o=r(24),l=r(6),u=r.n(l),d=r(26),j=r(31),b=r(0),h=["children","to","className"],O=function(e){var t=e.children,r=e.to,a=e.className,s=Object(c.a)(e,h);return Object(b.jsx)(i.c,Object(n.a)(Object(n.a)({className:function(e){var t=e.isActive;return u()("aside-menu__item",a,{"aside-menu__item--selected":t})},to:r},s),{},{children:t}))};t.a=function(e){return function(t){var r=t.selectedServer,n=t.showOnMobile,c=void 0!==n&&n,i=Object(d.e)(r),l=i?r.id:"",h=Object(o.f)().pathname,v=Object(j.e)(r),f=u()("aside-menu",{"aside-menu--hidden":!c}),m=function(e){return"/server/".concat(l).concat(e)};return Object(b.jsx)("aside",{className:f,children:Object(b.jsxs)("nav",{className:"nav flex-column aside-menu__nav",children:[Object(b.jsxs)(O,{to:m("/overview"),children:[Object(b.jsx)(s.a,{fixedWidth:!0,icon:a.u}),Object(b.jsx)("span",{className:"aside-menu__item-text",children:"Overview"})]}),Object(b.jsxs)(O,{to:m("/list-short-urls/1"),className:u()({"aside-menu__item--selected":null!==h.match("/list-short-urls")}),children:[Object(b.jsx)(s.a,{fixedWidth:!0,icon:a.x}),Object(b.jsx)("span",{className:"aside-menu__item-text",children:"List short URLs"})]}),Object(b.jsxs)(O,{to:m("/create-short-url"),children:[Object(b.jsx)(s.a,{fixedWidth:!0,icon:a.w,flip:"horizontal"}),Object(b.jsx)("span",{className:"aside-menu__item-text",children:"Create short URL"})]}),Object(b.jsxs)(O,{to:m("/manage-tags"),children:[Object(b.jsx)(s.a,{fixedWidth:!0,icon:a.O}),Object(b.jsx)("span",{className:"aside-menu__item-text",children:"Manage tags"})]}),v&&Object(b.jsxs)(O,{to:m("/manage-domains"),children:[Object(b.jsx)(s.a,{fixedWidth:!0,icon:a.t}),Object(b.jsx)("span",{className:"aside-menu__item-text",children:"Manage domains"})]}),Object(b.jsxs)(O,{to:m("/edit"),className:"aside-menu__item--push",children:[Object(b.jsx)(s.a,{fixedWidth:!0,icon:a.C}),Object(b.jsx)("span",{className:"aside-menu__item-text",children:"Edit this server"})]}),i&&Object(b.jsx)(e,{className:"aside-menu__item aside-menu__item--danger",textClassName:"aside-menu__item-text",server:r})]})})}}},216:function(e,t,r){e.exports=r(304)},26:function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"e",(function(){return a})),r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return i})),r.d(t,"a",(function(){return o})),r.d(t,"f",(function(){return l}));var n=r(308),c=function(e){return!(null===e||void 0===e||!e.url)&&!(null===e||void 0===e||!e.apiKey)},a=function(e){return!(null===e||void 0===e||!e.hasOwnProperty("id"))},s=function(e){return!(null===e||void 0===e||!e.hasOwnProperty("version"))},i=function(e){return!(null===e||void 0===e||!e.hasOwnProperty("serverNotFound"))},o=function(e){return a(e)?e.id:""},l=function(e){return Object(n.a)(["id","autoConnect"],e)}},28:function(e,t,r){"use strict";r.d(t,"e",(function(){return i})),r.d(t,"c",(function(){return o})),r.d(t,"b",(function(){return l})),r.d(t,"d",(function(){return u})),r.d(t,"a",(function(){return d}));var n=r(311),c=r(129),a=r(213),s=r(310),i=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Object(n.a)(r,e+1).map(t)},o=function(e){return!Object(c.a)(e)&&!Object(a.a)(e)},l=function(e){return Object(s.a)((function(e){return e.preventDefault()}),e)},u=function(e){return Object(a.a)(e)?null:e},d=function(e){return"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1))}},29:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(3),c=r(30),a=r(4),s=r(0),i=["title","children","bodyClassName"],o=function(e){var t=e.title,r=e.children,o=e.bodyClassName,l=Object(c.a)(e,i);return Object(s.jsxs)(a.d,Object(n.a)(Object(n.a)({},l),{},{children:[t&&Object(s.jsx)(a.g,{children:t}),Object(s.jsx)(a.e,{className:o,children:r})]}))}},291:function(e,t){},293:function(e,t){},304:function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"processStatsFromVisits",(function(){return Ua})),r.d(n,"normalizeVisits",(function(){return Ta}));var c,a=r(40),s=r(124),i=r(16),o=r(105),l=r(10),u=r(3),d=r(177),j=r(347),b=r(351),h=r(26),O=r(8),v=r.n(O),f=r(13),m=r(18),g=r(19),x=r(30),p=r(206),S=r(129),y=r(213),C=r(42),N=r(7),k=function(e,t,r){return e!==t?"ASC":r?{ASC:"DESC",DESC:void 0}[r]:"ASC"},w=function(e,t){var r=t.field,n=t.dir;return r&&n?e.sort((function(e,t){var c="ASC"===n?1:-1,a="ASC"===n?-1:1;return e[r]>t[r]?c:a})):e},_=function(e){return e.dir?"".concat(e.field,"-").concat(e.dir):void 0},U=function(e){var t=e.split("-"),r=Object(N.a)(t,2);return{field:r[0],dir:r[1]}},T=["orderBy"],R=function(e){return e?"".concat(e,"/rest/v2"):""},E=Object(p.a)(S.a),D=function(e){var t=e.orderBy,r=void 0===t?{}:t,n=Object(x.a)(e,T);return Object(u.a)(Object(u.a)({},n),{},{orderBy:_(r)})},L=Object(m.a)((function e(t,r,n){var c=this;Object(g.a)(this,e),this.axios=t,this.baseUrl=r,this.apiKey=n,this.listShortUrls=Object(f.a)(v.a.mark((function e(){var t,r=arguments;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:{},e.abrupt("return",c.performRequest("/short-urls","GET",D(t)).then((function(e){return e.data.shortUrls})));case 2:case"end":return e.stop()}}),e)}))),this.createShortUrl=function(){var e=Object(f.a)(v.a.mark((function e(t){var r;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(p.a)((function(e){return Object(y.a)(e)||Object(S.a)(e)}),t),e.abrupt("return",c.performRequest("/short-urls","POST",{},r).then((function(e){return e.data})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.getShortUrlVisits=function(){var e=Object(f.a)(v.a.mark((function e(t,r){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/short-urls/".concat(t,"/visits"),"GET",r).then((function(e){return e.data.visits})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),this.getTagVisits=function(){var e=Object(f.a)(v.a.mark((function e(t,r){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/tags/".concat(t,"/visits"),"GET",r).then((function(e){return e.data.visits})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),this.getOrphanVisits=function(){var e=Object(f.a)(v.a.mark((function e(t){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/visits/orphan","GET",t).then((function(e){return e.data.visits})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.getNonOrphanVisits=function(){var e=Object(f.a)(v.a.mark((function e(t){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/visits/non-orphan","GET",t).then((function(e){return e.data.visits})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.getVisitsOverview=Object(f.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/visits","GET").then((function(e){return e.data.visits})));case 1:case"end":return e.stop()}}),e)}))),this.getShortUrl=function(){var e=Object(f.a)(v.a.mark((function e(t,r){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/short-urls/".concat(t),"GET",{domain:r}).then((function(e){return e.data})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),this.deleteShortUrl=function(){var e=Object(f.a)(v.a.mark((function e(t,r){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/short-urls/".concat(t),"DELETE",{domain:r}).then((function(){})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),this.updateShortUrlTags=function(){var e=Object(f.a)(v.a.mark((function e(t,r,n){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/short-urls/".concat(t,"/tags"),"PUT",{domain:r},{tags:n}).then((function(e){return e.data.tags})));case 1:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),this.updateShortUrl=function(){var e=Object(f.a)(v.a.mark((function e(t,r,n){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/short-urls/".concat(t),"PATCH",{domain:r},n).then((function(e){return e.data})));case 1:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),this.listTags=Object(f.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/tags","GET",{withStats:"true"}).then((function(e){return e.data.tags})).then((function(e){return{tags:e.data,stats:e.stats}})));case 1:case"end":return e.stop()}}),e)}))),this.deleteTags=function(){var e=Object(f.a)(v.a.mark((function e(t){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/tags","DELETE",{tags:t}).then((function(){return{tags:t}})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.editTag=function(){var e=Object(f.a)(v.a.mark((function e(t,r){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/tags","PUT",{},{oldName:t,newName:r}).then((function(){return{oldName:t,newName:r}})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),this.health=Object(f.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/health","GET").then((function(e){return e.data})));case 1:case"end":return e.stop()}}),e)}))),this.mercureInfo=Object(f.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/mercure-info","GET").then((function(e){return e.data})));case 1:case"end":return e.stop()}}),e)}))),this.listDomains=Object(f.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/domains","GET").then((function(e){return e.data.domains})));case 1:case"end":return e.stop()}}),e)}))),this.editDomainRedirects=function(){var e=Object(f.a)(v.a.mark((function e(t){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/domains/redirects","PATCH",{},t).then((function(e){return e.data})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.performRequest=function(){var e=Object(f.a)(v.a.mark((function e(t){var r,n,a,s=arguments;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:"GET",n=s.length>2&&void 0!==s[2]?s[2]:{},a=s.length>3&&void 0!==s[3]?s[3]:{},e.abrupt("return",c.axios({method:r,url:"".concat(R(c.baseUrl)).concat(t),headers:{"X-Api-Key":c.apiKey},params:E(n),data:a,paramsSerializer:C.b}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()})),V={},I=function(e){return function(t){var r,n=function(e){return"function"===typeof e}(t)?(r=t,Object(b.a)("selectedServer",r())):t;if(!Object(h.b)(n))throw new Error("There's no selected server or it is not found");var c=n.url,a=n.apiKey,s="".concat(c,"_").concat(a);return V[s]||(V[s]=new L(e,c,a)),V[s]}},F=function(e){e.serviceFactory("buildShlinkApiClient",I,"axios")},A=r(178),M=r(12),G=r(11),P=r(310),B=r(248),H=r(2),W=r(6),q=r.n(W),z=r(0),K=function(e){var t=e.onChange,r=e.className,n=e.large,a=void 0===n||n,s=e.noBorder,i=void 0!==s&&s,o=e.initialValue,l=void 0===o?"":o,u=Object(H.useState)(l),d=Object(N.a)(u,2),j=d[0],b=d[1],h=function(){c&&clearTimeout(c),c=null},O=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500;b(e),h(),c=setTimeout((function(){t(e),h()}),r)};return Object(z.jsxs)("div",{className:q()("search-field",r),children:[Object(z.jsx)("input",{type:"text",className:q()("form-control search-field__input",{"form-control-lg":a,"search-field__input--no-border":i}),placeholder:"Search...",value:j,onChange:function(e){return O(e.target.value)}}),Object(z.jsx)(G.a,{icon:M.I,className:"search-field__icon"}),Object(z.jsx)("div",{className:"close search-field__close",hidden:""===j,id:"search-field__close",onClick:function(){return O("",0)},children:"\xd7"})]})},Q=function(e){var t=e.text,r=e.children,n=e.clearable,c=e.className,a=void 0===c?"":c,s=e.colorGenerator,i=e.onClick,o=e.onClose;return Object(z.jsxs)("span",{className:q()("badge tag",a,{"tag--light-bg":s.isColorLightForKey(t)}),style:{backgroundColor:s.getColorForKey(t),cursor:n||!i?"auto":"pointer"},onClick:i,children:[null!==r&&void 0!==r?r:t,n&&Object(z.jsx)("span",{className:"close tag__close-selected-tag",onClick:o,children:"\xd7"})]})},J=r(4),Z=r(15),Y=function(e){var t=e.text,r=e.disabled,n=void 0!==r&&r,c=e.className,a=void 0===c?"":c,s=e.children,i=e.dropdownClassName,o=e.right,l=void 0!==o&&o,u=e.minWidth,d=Object(Z.f)(),j=Object(N.a)(d,2),b=j[0],h=j[1],O="dropdown-btn__toggle btn-block ".concat(a),v={minWidth:u&&"".concat(u,"px")};return Object(z.jsxs)(J.k,{isOpen:b,toggle:h,disabled:n,className:i,children:[Object(z.jsx)(J.n,{caret:!0,className:O,color:"primary",children:t}),Object(z.jsx)(J.m,{className:"w-100",end:l,style:v,children:s})]})},X=r(70),$=r(252),ee=r(141),te=r(204),re=r(321),ne=r(322),ce=r(306),ae=r(320),se=(r(305),r(249)),ie=r(250),oe=r(251),le=function(e){return"string"!==typeof e},ue=function(e,t){return e&&le(e)?t?Object(ce.default)(e,t):Object(ae.a)(e):e},de=function(e){return ue(e,void 0)},je=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"yyyy-MM-dd";return function(t){return ue(t,e)}}(),be=function(e){return le(e)?e:Object(B.default)(e)},he=function(e,t,r){try{return Object(se.default)(be(e),{start:be(null!==t&&void 0!==t?t:e),end:be(null!==r&&void 0!==r?r:e)})}catch(n){return!1}},Oe=function(e,t){return Object(ie.default)(e,t)||Object(oe.default)(e,t)},ve=function(e){return void 0===e||Object(y.a)(Object(te.a)(Boolean,e))},fe=function(e){return"string"===typeof e},me={today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",last180Days:"Last 180 days",last365Days:"Last 365 days",all:void 0},ge=Object.keys(me).filter((function(e){return"all"!==e})),xe=function(e){if(e&&"all"!==e)return fe(e)?me[e]:function(e){if(e&&!ve(e))return e.startDate&&!e.endDate?"Since ".concat(je(e.startDate)):!e.startDate&&e.endDate?"Until ".concat(je(e.endDate)):"".concat(je(e.startDate)," - ").concat(je(e.endDate))}(e)},pe=function(e){return Object(X.default)(Object($.default)(new Date,e))},Se=function(e){return{startDate:e,endDate:Object(ee.default)(new Date)}},ye=function(e){if(!e||"all"===e)return{};switch(e){case"today":return Se(Object(X.default)(new Date));case"yesterday":return{startDate:pe(1),endDate:Object(ee.default)(Object($.default)(new Date,1))};case"last7Days":return Se(pe(7));case"last30Days":return Se(pe(30));case"last90Days":return Se(pe(90));case"last180Days":return Se(pe(180));case"last365Days":return Se(pe(365))}return{}},Ce=function(e){var t=be(e);return Object(re.a)([[function(){return Oe(Object(X.default)(new Date),t)},function(){return"today"}],[function(){return Oe(pe(1),t)},function(){return"yesterday"}],[function(){return Oe(pe(7),t)},function(){return"last7Days"}],[function(){return Oe(pe(30),t)},function(){return"last30Days"}],[function(){return Oe(pe(90),t)},function(){return"last90Days"}],[function(){return Oe(pe(180),t)},function(){return"last180Days"}],[function(){return Oe(pe(365),t)},function(){return"last365Days"}],[ne.a,function(){return"all"}]])()},Ne=r(188),ke=r.n(Ne),we=r(56),_e=function(e){var t=e.className,r=e.isClearable,n=e.selected,c=!r||Object(S.a)(n),a=Object(H.useRef)();return Object(z.jsxs)("div",{className:"date-input-container",children:[Object(z.jsx)(ke.a,Object(u.a)(Object(u.a)({},e),{},{dateFormat:"yyyy-MM-dd",className:q()("date-input-container__input form-control",t),ref:a})),c&&Object(z.jsx)(G.a,{icon:we.b,className:"date-input-container__icon",onClick:function(){var e;return null===(e=a.current)||void 0===e?void 0:e.input.focus()}})]})},Ue=function(e){var t=e.startDate,r=void 0===t?null:t,n=e.endDate,c=void 0===n?null:n,a=e.disabled,s=void 0!==a&&a,i=e.onStartDateChange,o=e.onEndDateChange;return Object(z.jsxs)("div",{className:"row",children:[Object(z.jsx)("div",{className:"col-md-6",children:Object(z.jsx)(_e,{selected:r,placeholderText:"Since...",isClearable:!0,maxDate:null!==c&&void 0!==c?c:void 0,disabled:s,onChange:i})}),Object(z.jsx)("div",{className:"col-md-6",children:Object(z.jsx)(_e,{className:"mt-2 mt-md-0",selected:c,placeholderText:"Until...",isClearable:!0,minDate:null!==r&&void 0!==r?r:void 0,disabled:s,onChange:o})})]})},Te=function(e){var t=e.active,r=e.allText,n=e.onChange;return Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)(J.l,{active:"all"===t,onClick:function(){return n("all")},children:r}),Object(z.jsx)(J.l,{divider:!0}),ge.map((function(e){return Object(z.jsx)(J.l,{active:t===e,onClick:function(){return n(e)},children:xe(e)},e)}))]})},Re=function(e){var t,r=e.onDatesChange,n=e.initialDateRange,c=e.defaultText,a=e.disabled,s=e.updatable,i=void 0!==s&&s,o=fe(n),l=Object(H.useState)(o?n:void 0),d=Object(N.a)(l,2),j=d[0],b=d[1],h=Object(H.useState)(o?void 0:n),O=Object(N.a)(h,2),v=O[0],f=O[1],m=function(e){b(ve(e)?"all":void 0),f(e),r(e)},g=function(e){b(e),f(void 0),r(ye(e))};return i&&Object(Z.a)((function(){var e=fe(n);e&&g(n),n&&!e&&m(n)}),[n]),Object(z.jsxs)(Y,{disabled:a,text:null!==(t=xe(null!==j&&void 0!==j?j:v))&&void 0!==t?t:c,children:[Object(z.jsx)(Te,{allText:c,active:j,onChange:g}),Object(z.jsx)(J.l,{divider:!0}),Object(z.jsx)(J.l,{header:!0,children:"Custom:"}),Object(z.jsx)(J.l,{text:!0,children:Object(z.jsx)(Ue,Object(u.a)(Object(u.a)({},v),{},{onStartDateChange:function(e){return m(Object(u.a)(Object(u.a)({},v),{},{startDate:e}))},onEndDateChange:function(e){return m(Object(u.a)(Object(u.a)({},v),{},{endDate:e}))}}))})]})},Ee=r(31),De=r(350),Le=r(312),Ve=function(e){var t=e.checked,r=void 0!==t&&t,n=e.onChange,c=void 0===n?Le.a:n,a=e.className,s=e.children,i=e.type,o=e.inline,l=void 0!==o&&o,u=Object(H.useRef)(Object(De.a)()).current,d={"form-switch":"switch"===i,"form-checkbox":"checkbox"===i},j=l?{display:"inline-block"}:{};return Object(z.jsxs)("span",{className:q()("form-check",d,a),style:j,children:[Object(z.jsx)("input",{type:"checkbox",className:"form-check-input",id:u,checked:r,onChange:function(e){return c(e.target.checked,e)}}),Object(z.jsx)("label",{className:"form-check-label",htmlFor:u,children:s})]})},Ie=function(e){return Object(z.jsx)(Ve,Object(u.a)({type:"switch"},e))},Fe=["children","tooltip"],Ae=function(e){var t=e.children,r=e.tooltip,n=void 0===r?{}:r,c=Object(x.a)(e,Fe),a=Object(H.useRef)();return Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)("span",{ref:function(e){a.current=null!==e&&void 0!==e?e:void 0},children:Object(z.jsx)(Ie,Object(u.a)({},c))}),Object(z.jsx)(J.L,Object(u.a)(Object(u.a)({target:function(){return a.current}},n),{},{children:t}))]})},Me=r(24),Ge=["orderBy"],Pe=["orderBy"],Be=function(){var e=Object(Me.g)(),t=Object(Me.f)(),r=Object(Me.h)(),n=Object(H.useMemo)(Object(P.a)((function(){return Object(C.a)(t.search)}),(function(e){var t=e.orderBy,r=Object(x.a)(e,Ge);return t?Object(u.a)(Object(u.a)({},r),{},{orderBy:U(t)}):r})),[t.search]);return[n,function(t){var c=Object(u.a)(Object(u.a)({},n),t),a=c.orderBy,s=Object(x.a)(c,Pe),i=Object(u.a)(Object(u.a)({},s),{},{orderBy:a&&_(a)}),o=Object(C.b)(i),l=Object(y.a)(o)?"":"?".concat(o);e("/server/".concat(r.serverId,"/list-short-urls/1").concat(l))}]},He=function(e){return e?Object(B.default)(e):null},We=function(e){return function(t){var r,n=t.selectedServer,c=Be(),a=Object(N.a)(c,2),s=a[0],i=s.search,o=s.tags,l=s.startDate,u=s.endDate,d=s.tagsMode,j=void 0===d?"any":d,b=a[1],h=null!==(r=null===o||void 0===o?void 0:o.split(","))&&void 0!==r?r:[],O=Object(P.a)((function(e){var t,r,n=e.startDate,c=e.endDate;return{startDate:null!==(t=de(n))&&void 0!==t?t:void 0,endDate:null!==(r=de(c))&&void 0!==r?r:void 0}}),b),v=Object(P.a)((function(e){return Object(y.a)(e)?void 0:e}),(function(e){return b({search:e})})),f=Object(P.a)((function(e){return h.filter((function(t){return t!==e}))}),(function(e){return 0===e.length?void 0:e.join(",")}),(function(e){return b({tags:e})})),m=Object(Ee.a)(n),g=Object(P.a)((function(){return"any"===j?"all":"any"}),(function(e){return b({tagsMode:e})}));return Object(z.jsxs)("div",{className:"short-urls-filtering-bar-container",children:[Object(z.jsx)(K,{initialValue:i,onChange:v}),Object(z.jsx)("div",{className:"mt-3",children:Object(z.jsx)("div",{className:"row",children:Object(z.jsx)("div",{className:"col-lg-8 offset-lg-4 col-xl-6 offset-xl-6",children:Object(z.jsx)(Re,{defaultText:"All short URLs",initialDateRange:{startDate:He(l),endDate:He(u)},onDatesChange:O})})})}),h.length>0&&Object(z.jsxs)("h4",{className:"mt-3",children:[m&&h.length>1&&Object(z.jsx)("div",{className:"float-end ms-2 mt-1",children:Object(z.jsx)(Ae,{checked:"all"===j,tooltip:{placement:"left"},onChange:g,children:"all"===j?"Short URLs including all tags.":"Short URLs including any tag."})}),Object(z.jsx)(G.a,{icon:M.O,className:"short-urls-filtering-bar__tags-icon me-1"}),h.map((function(t){return Object(z.jsx)(Q,{colorGenerator:e,text:t,clearable:!0,onClose:function(){return f(t)}},t)}))]})]})}},qe=r(22),ze=r(323);function Ke(e){var t,r=e.items,n=e.order,c=e.onChange,a=e.isButton,s=void 0===a||a,i=e.right,o=void 0!==i&&i,l=function(e){return function(){var t=k(e,n.field,n.dir);c(t?e:void 0,t)}};return Object(z.jsxs)(J.K,{children:[Object(z.jsxs)(J.n,{caret:!0,color:s?"primary":"link",className:q()({"dropdown-btn__toggle btn-block":s,"btn-sm p-0":!s}),children:[!s&&Object(z.jsx)(z.Fragment,{children:"Order by"}),s&&!n.field&&Object(z.jsx)(z.Fragment,{children:"Order by..."}),s&&n.field&&'Order by: "'.concat(r[n.field],'" - "').concat(null!==(t=n.dir)&&void 0!==t?t:"DESC",'"')]}),Object(z.jsxs)(J.m,{end:o,className:q()("w-100",{"ordering-dropdown__menu--link":!s}),children:[Object(ze.a)(r).map((function(e){var t=Object(N.a)(e,2),r=t[0],c=t[1];return Object(z.jsxs)(J.l,{active:n.field===r,onClick:l(r),children:[c,n.field===r&&Object(z.jsx)(G.a,{icon:"ASC"===n.dir?M.L:M.K,className:"ordering-dropdown__sort-icon"})]},r)})),Object(z.jsx)(J.l,{divider:!0}),Object(z.jsx)(J.l,{disabled:!n.field,onClick:function(){return c()},children:Object(z.jsx)("i",{children:"Clear selection"})})]})]})}var Qe=r(189);function Je(e,t){var r=new Set;return function(n){var c=n.createNewVisits,a=n.loadMercureInfo,s=n.mercureInfo,i=s.interval,o=Object(Me.h)();return Object(H.useEffect)((function(){var e=t(n,o),l=function(e,t,r,n){var c=e.mercureHubUrl,a=e.token,s=e.loading,i=e.error;if(!s&&!i&&c){var o=function(e){var t=e.data;return r(JSON.parse(t))},l=function(e){return 401===e.status&&n()},u=t.map((function(e){var t=new URL(c);t.searchParams.append("topic",e);var r=new Qe.EventSourcePolyfill(t,{headers:{Authorization:"Bearer ".concat(a)}});return r.onmessage=o,r.onerror=l,r}));return function(){return u.forEach((function(e){return e.close()}))}}}(s,e,(function(e){return i?r.add(e):c([e])}),a);if(!i)return l;var u=setInterval((function(){c(Object(qe.a)(r)),r.clear()}),1e3*i*60);return Object(P.a)((function(){return clearInterval(u)}),(function(){return null===l||void 0===l?void 0:l()}))}),[s]),Object(z.jsx)(e,Object(u.a)({},n))}}var Ze=Object(m.a)((function e(){Object(g.a)(this,e)}));function Ye(e){var t=e.currentOrder,r=e.field,n=e.className,c=void 0===n?"ms-1":n;return t.dir&&t.field===r?Object(z.jsx)(G.a,{icon:"ASC"===t.dir?M.f:M.e,className:c}):null}Ze.visits="https://shlink.io/new-visit",Ze.orphanVisits="https://shlink.io/new-orphan-visit",Ze.shortUrlVisits=function(e){return"https://shlink.io/new-visit/".concat(e)};var Xe,$e,et,tt,rt,nt,ct,at,st,it,ot,lt,ut,dt,jt,bt,ht,Ot,vt,ft=r(352),mt=r(324),gt=r(21),xt="shlink/realTimeUpdates/SET_SETTINGS",pt={field:"dateCreated",dir:"DESC"},St={realTimeUpdates:{enabled:!0},shortUrlCreation:{validateUrls:!1},ui:{theme:"light"},visits:{defaultInterval:"last30Days"},shortUrlsList:{defaultOrdering:pt}},yt=Object(gt.b)(Object(l.a)({},xt,(function(e,t){return Object(ft.a)(e,Object(mt.a)("type",t))})),St),Ct=function(e){return{type:xt,realTimeUpdates:{enabled:e}}},Nt=function(e){return{type:xt,realTimeUpdates:{interval:e}}},kt=function(e){return{type:xt,shortUrlCreation:e}},wt=function(e){return{type:xt,shortUrlsList:e}},_t=function(e){return{type:xt,ui:e}},Ut=function(e){return{type:xt,visits:e}},Tt=function(e){return{type:xt,tags:e}},Rt=r(311),Et=r(187),Dt=r(325),Lt=Math.ceil,Vt=new Intl.NumberFormat("en-US"),It=function(e){return Vt.format(Number(e))},Ft="...",At=function(e,t){var r=Object(Rt.a)(Object(Et.a)(2,e-2),Object(Dt.a)(t-1,e+2)+1);return e-2>2&&r.unshift(Ft),e+2=u,children:Object(z.jsx)(J.F,{next:!0,tag:i.b,to:d(o+1)})})]})},Ht={dateCreated:"Created at",shortCode:"Short URL",longUrl:"Long URL",title:"Title",visits:"Visits"},Wt=function(e,t){return Je((function(r){var n,c,a,s=r.listShortUrls,i=r.shortUrlsList,o=r.selectedServer,l=r.settings,u=Object(h.a)(o),d=Object(Me.h)().page,j=Object(Me.f)(),b=Be(),O=Object(N.a)(b,2),v=O[0],f=v.tags,m=v.search,g=v.startDate,x=v.endDate,p=v.orderBy,S=v.tagsMode,y=O[1],C=Object(H.useState)(null!==(n=null!==p&&void 0!==p?p:null===(c=l.shortUrlsList)||void 0===c?void 0:c.defaultOrdering)&&void 0!==n?n:pt),w=Object(N.a)(C,2),_=w[0],U=w[1],T=Object(H.useMemo)((function(){var e;return null!==(e=null===f||void 0===f?void 0:f.split(","))&&void 0!==e?e:[]}),[f]),R=(null!==(a=null===i||void 0===i?void 0:i.shortUrls)&&void 0!==a?a:{}).pagination,E=function(e,t){y({orderBy:{field:e,dir:t}}),U({field:e,dir:t})},D=Object(P.a)((function(e){return Object(qe.a)(new Set([].concat(Object(qe.a)(T),[e]))).join(",")}),(function(e){return y({tags:e})}));return Object(H.useEffect)((function(){s({page:d,searchTerm:m,tags:T,startDate:g,endDate:x,orderBy:_,tagsMode:S})}),[d,m,T,g,x,_,S]),Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)("div",{className:"mb-3",children:Object(z.jsx)(t,{})}),Object(z.jsx)("div",{className:"d-block d-lg-none mb-3",children:Object(z.jsx)(Ke,{items:Ht,order:_,onChange:E})}),Object(z.jsxs)(J.d,{body:!0,className:"pb-1",children:[Object(z.jsx)(e,{selectedServer:o,shortUrlsList:i,orderByColumn:function(e){return function(){return E(e,k(e,_.field,_.dir))}},renderOrderIcon:function(e){return Object(z.jsx)(Ye,{currentOrder:_,field:e})},onTagClick:D}),Object(z.jsx)(Bt,{paginator:R,serverId:u,currentQueryString:j.search})]})]})}),(function(){return[Ze.visits]}))},qt=r(38),zt=r(122),Kt=r.n(zt),Qt=function(e){var t=e.text,r=e.onCopy;return Object(z.jsx)(Kt.a,{text:t,onCopy:r,children:Object(z.jsx)(G.a,{icon:we.d,className:"ms-2 copy-to-clipboard-icon"})})},Jt=r(326),Zt=r(353),Yt=function(e){var t=e.date,r=e.format,n=void 0===r?"yyyy-MM-dd HH:mm":r,c=e.relative,a=void 0!==c&&c,s=le(t)?t:Object(B.default)(t);return Object(z.jsx)("time",{dateTime:"".concat(Object(Jt.a)(s),"000"),children:a?"".concat(Object(Zt.a)(new Date,s)," ago"):Object(ce.default)(s,n)})},Xt=["selectedServer","shortUrl","suffix","children"],$t=function(e,t,r){var n=e.id,c=t.shortCode,a=t.domain,s=a?"?domain=".concat(a):"";return"/server/".concat(n,"/short-code/").concat(c,"/").concat(r).concat(s)},er=function(e){var t=e.selectedServer,r=e.shortUrl,n=e.suffix,c=e.children,a=Object(x.a)(e,Xt);return t&&Object(h.e)(t)&&r?Object(z.jsx)(i.b,Object(u.a)(Object(u.a)({to:$t(t,r,n)},a),{},{children:c})):Object(z.jsx)("span",Object(u.a)(Object(u.a)({},a),{},{children:c}))},tr=function(e){var t,r=e.visitsCount,n=e.shortUrl,c=e.selectedServer,a=e.active,s=void 0!==a&&a,i=null===n||void 0===n||null===(t=n.meta)||void 0===t?void 0:t.maxVisits,o=Object(z.jsx)(er,{selectedServer:c,shortUrl:n,suffix:"visits",children:Object(z.jsx)("strong",{className:q()("short-url-visits-count__amount",{"short-url-visits-count__amount--big":s}),children:It(r)})});if(!i)return o;var l=It(i),u=Object(H.useRef)();return Object(z.jsxs)(z.Fragment,{children:[Object(z.jsxs)("span",{className:"indivisible",children:[o,Object(z.jsxs)("small",{className:"short-urls-visits-count__max-visits-control",ref:function(e){u.current=e},children:[" ","/ ",l," ",Object(z.jsx)("sup",{children:Object(z.jsx)(G.a,{icon:M.v})})]})]}),Object(z.jsxs)(J.L,{target:function(){return u.current},placement:"bottom",children:["This short URL will not accept more than ",Object(z.jsx)("b",{children:l})," visits."]})]})},rr=function(e,t,r){return function(n){var c,a,s=n.shortUrl,i=n.selectedServer,o=n.onTagClick,l=r(),u=Object(N.a)(l,2),d=u[0],j=u[1],b=r(!1,500),h=Object(N.a)(b,2),O=h[0],v=h[1],f=Object(H.useRef)(!0);return Object(H.useEffect)((function(){f.current?f.current=!1:v()}),[s.visitsCount]),Object(z.jsxs)("tr",{className:"responsive-table__row",children:[Object(z.jsx)("td",{className:"indivisible short-urls-row__cell responsive-table__cell","data-th":"Created at",children:Object(z.jsx)(Yt,{date:s.dateCreated})}),Object(z.jsx)("td",{className:"responsive-table__cell short-urls-row__cell","data-th":"Short URL",children:Object(z.jsxs)("span",{className:"indivisible short-urls-row__cell--relative",children:[Object(z.jsx)(qt.a,{href:s.shortUrl}),Object(z.jsx)(Qt,{text:s.shortUrl,onCopy:j}),Object(z.jsx)("span",{className:"badge bg-warning text-black short-urls-row__copy-hint",hidden:!d,children:"Copied short URL!"})]})}),Object(z.jsx)("td",{className:"responsive-table__cell short-urls-row__cell short-urls-row__cell--break","data-th":"".concat(s.title?"Title":"Long URL"),children:Object(z.jsx)(qt.a,{href:s.longUrl,children:null!==(c=s.title)&&void 0!==c?c:s.longUrl})}),s.title&&Object(z.jsx)("td",{className:"short-urls-row__cell responsive-table__cell short-urls-row__cell--break d-lg-none","data-th":"Long URL",children:Object(z.jsx)(qt.a,{href:s.longUrl})}),Object(z.jsx)("td",{className:"responsive-table__cell short-urls-row__cell","data-th":"Tags",children:(a=s.tags,Object(y.a)(a)?Object(z.jsx)("i",{className:"indivisible",children:Object(z.jsx)("small",{children:"No tags"})}):a.map((function(e){return Object(z.jsx)(Q,{colorGenerator:t,text:e,onClick:function(){return null===o||void 0===o?void 0:o(e)}},e)})))}),Object(z.jsx)("td",{className:"responsive-table__cell short-urls-row__cell text-lg-end","data-th":"Visits",children:Object(z.jsx)(tr,{visitsCount:s.visitsCount,shortUrl:s,selectedServer:i,active:O})}),Object(z.jsx)("td",{className:"responsive-table__cell short-urls-row__cell",children:Object(z.jsx)(e,{selectedServer:i,shortUrl:s})})]})}},nr=function(e){var t=e.isOpen,r=e.toggle,n=e.children,c=e.right,a=void 0===c||c;return Object(z.jsxs)(J.c,{toggle:r,isOpen:t,children:[Object(z.jsxs)(J.n,{size:"sm",caret:!0,outline:!0,className:"dropdown-btn-menu__dropdown-toggle",children:["\xa0",Object(z.jsx)(G.a,{icon:M.o}),"\xa0"]}),Object(z.jsx)(J.m,{end:a,children:n})]})},cr=function(e,t){return function(r){var n=r.shortUrl,c=r.selectedServer,a=Object(Z.f)(),s=Object(N.a)(a,2),i=s[0],o=s[1],l=Object(Z.f)(),u=Object(N.a)(l,2),d=u[0],j=u[1],b=Object(Z.f)(),h=Object(N.a)(b,2),O=h[0],v=h[1];return Object(z.jsxs)(nr,{toggle:o,isOpen:i,children:[Object(z.jsxs)(J.l,{tag:er,selectedServer:c,shortUrl:n,suffix:"visits",children:[Object(z.jsx)(G.a,{icon:M.g,fixedWidth:!0})," Visit stats"]}),Object(z.jsxs)(J.l,{tag:er,selectedServer:c,shortUrl:n,suffix:"edit",children:[Object(z.jsx)(G.a,{icon:M.n,fixedWidth:!0})," Edit short URL"]}),Object(z.jsxs)(J.l,{onClick:j,children:[Object(z.jsx)(G.a,{icon:M.G,fixedWidth:!0})," QR code"]}),Object(z.jsx)(t,{shortUrl:n,isOpen:d,toggle:j}),Object(z.jsx)(J.l,{divider:!0}),Object(z.jsxs)(J.l,{className:"dropdown-item--danger",onClick:v,children:[Object(z.jsx)(G.a,{icon:M.z,fixedWidth:!0})," Delete short URL"]}),Object(z.jsx)(e,{shortUrl:n,isOpen:O,toggle:v})]})}},ar=function(e,t){return function(r){var n=r.createShortUrl,c=r.shortUrlCreationResult,a=r.resetCreateShortUrl,s=r.selectedServer,i=r.basicMode,o=void 0!==i&&i,l=r.settings.shortUrlCreation,d=Object(H.useMemo)((function(){return function(e){var t,r;return{longUrl:"",tags:[],customSlug:"",title:void 0,shortCodeLength:void 0,domain:"",validSince:void 0,validUntil:void 0,maxVisits:void 0,findIfExists:!1,validateUrl:null!==(t=null===e||void 0===e?void 0:e.validateUrls)&&void 0!==t&&t,forwardQuery:null===(r=null===e||void 0===e?void 0:e.forwardQuery)||void 0===r||r}}(l)}),[l]);return Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)(e,{initialState:d,saving:c.saving,selectedServer:s,mode:o?"create-basic":"create",onSave:function(){var e=Object(f.a)(v.a.mark((function e(t){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a(),e.abrupt("return",n(t));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),Object(z.jsx)(t,Object(u.a)(Object(u.a)({},c),{},{resetCreateShortUrl:a,canBeClosed:o}))]})}},sr=r(28),ir=r(29),or=function(e){var t=e.children,r=e.type,n=e.className,c=e.small,a=void 0!==c&&c;return Object(z.jsx)(J.I,{className:n,children:Object(z.jsx)("div",{className:q()({"col-md-10 offset-md-1":!a,"col-12":a}),children:Object(z.jsx)(ir.a,{className:q()("text-center",{"bg-main":"success"===r,"bg-danger":"error"===r,"bg-warning":"warning"===r,"text-white":"warning"!==r}),bodyClassName:q()({"p-2":a}),children:t})})})},lr=function(e){var t;return null===(t=e.response)||void 0===t?void 0:t.data},ur=function(e){return"INVALID_SHORTCODE_DELETION"===(null===e||void 0===e?void 0:e.type)||"INVALID_SHORT_URL_DELETION"===(null===e||void 0===e?void 0:e.type)},dr=function(e){var t,r,n=e.errorData,c=e.fallbackMessage;return Object(z.jsxs)(z.Fragment,{children:[null!==(t=null===n||void 0===n?void 0:n.detail)&&void 0!==t?t:c,(r=n,"INVALID_ARGUMENT"===(null===r||void 0===r?void 0:r.type)&&Object(z.jsxs)("p",{className:"mb-0",children:["Invalid elements: [",n.invalidElements.join(", "),"]"]}))]})},jr=function(e){var t=e.shortUrl,r=e.toggle,n=e.isOpen,c=e.shortUrlDeletion,a=e.resetDeleteShortUrl,s=e.deleteShortUrl,i=Object(H.useState)(""),o=Object(N.a)(i,2),l=o[0],u=o[1];Object(H.useEffect)((function(){return a}),[]);var d=c.error,j=c.errorData,b=Object(P.a)(a,r),h=Object(sr.b)((function(){var e=t.shortCode,n=t.domain;s(e,n).then(r).catch(Le.a)}));return Object(z.jsx)(J.t,{isOpen:n,toggle:b,centered:!0,children:Object(z.jsxs)("form",{onSubmit:h,children:[Object(z.jsx)(J.w,{toggle:b,children:Object(z.jsx)("span",{className:"text-danger",children:"Delete short URL"})}),Object(z.jsxs)(J.u,{children:[Object(z.jsxs)("p",{children:[Object(z.jsx)("b",{className:"text-danger",children:"Caution!"})," You are about to delete a short URL."]}),Object(z.jsx)("p",{children:"This action cannot be undone. Once you have deleted it, all the visits stats will be lost."}),Object(z.jsxs)("p",{children:["Write ",Object(z.jsx)("b",{children:t.shortCode})," to confirm deletion."]}),Object(z.jsx)("input",{type:"text",className:"form-control",placeholder:"Insert the short code (".concat(t.shortCode,")"),value:l,onChange:function(e){return u(e.target.value)}}),d&&Object(z.jsx)(or,{type:ur(j)?"warning":"error",small:!0,className:"mt-2",children:Object(z.jsx)(dr,{errorData:j,fallbackMessage:"Something went wrong while deleting the URL :("})})]}),Object(z.jsxs)(J.v,{children:[Object(z.jsx)("button",{type:"button",className:"btn btn-link",onClick:b,children:"Cancel"}),Object(z.jsx)("button",{type:"submit",className:"btn btn-danger",disabled:l!==t.shortCode||c.loading,children:c.loading?"Deleting...":"Delete"})]})]})})},br=function(e){return function(t){var r=t.error,n=t.errorData,c=t.result,a=t.resetCreateShortUrl,s=t.canBeClosed,i=void 0!==s&&s,o=e(),l=Object(N.a)(o,2),u=l[0],d=l[1];if(Object(H.useEffect)((function(){a()}),[]),r)return Object(z.jsxs)(or,{type:"error",className:"mt-3",children:[i&&Object(z.jsx)(G.a,{icon:M.Q,className:"float-end pointer",onClick:a}),Object(z.jsx)(dr,{errorData:n,fallbackMessage:"An error occurred while creating the URL :("})]});if(Object(S.a)(c))return null;var j=c.shortUrl;return Object(z.jsxs)(or,{type:"success",className:"mt-3",children:[i&&Object(z.jsx)(G.a,{icon:M.Q,className:"float-end pointer",onClick:a}),Object(z.jsx)("b",{children:"Great!"})," The short URL is ",Object(z.jsx)("b",{children:j}),Object(z.jsx)(Kt.a,{text:j,onCopy:d,children:Object(z.jsxs)("button",{className:"btn btn-light btn-sm create-short-url-result__copy-btn",id:"copyBtn",type:"button",children:[Object(z.jsx)(G.a,{icon:we.d})," Copy"]})}),Object(z.jsx)(J.J,{placement:"left",isOpen:u,target:"copyBtn",children:"Copied!"})]})}},hr=r(327),Or=r(328),vr=r(190),fr=function(e,t,r){return Object(S.a)(r)?e.shortCode===t&&!e.domain:e.shortCode===t&&e.domain===r},mr="shlink/visitCreation/CREATE_VISITS",gr=function(e){return{type:mr,createdVisits:e}},xr="shlink/deleteShortUrl/DELETE_SHORT_URL_START",pr="shlink/deleteShortUrl/DELETE_SHORT_URL_ERROR",Sr="shlink/deleteShortUrl/SHORT_URL_DELETED",yr="shlink/deleteShortUrl/RESET_DELETE_SHORT_URL",Cr={shortCode:"",loading:!1,error:!1},Nr=Object(gt.b)((Xe={},Object(l.a)(Xe,xr,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!0,error:!1})})),Object(l.a)(Xe,pr,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{errorData:r,loading:!1,error:!0})})),Object(l.a)(Xe,Sr,(function(e,t){var r=t.shortCode;return Object(u.a)(Object(u.a)({},e),{},{shortCode:r,loading:!1,error:!1})})),Object(l.a)(Xe,yr,(function(){return Cr})),Xe),Cr),kr=function(e){return function(t,r){return function(){var n=Object(f.a)(v.a.mark((function n(c,a){var s,i;return v.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return c({type:xr}),s=e(a),i=s.deleteShortUrl,n.prev=2,n.next=5,i(t,r);case 5:c({type:Sr,shortCode:t,domain:r}),n.next=12;break;case 8:throw n.prev=8,n.t0=n.catch(2),c({type:pr,errorData:lr(n.t0)}),n.t0;case 12:case"end":return n.stop()}}),n,null,[[2,8]])})));return function(e,t){return n.apply(this,arguments)}}()}},wr=Object(gt.a)(yr),_r="shlink/createShortUrl/CREATE_SHORT_URL_START",Ur="shlink/createShortUrl/CREATE_SHORT_URL_ERROR",Tr="shlink/createShortUrl/CREATE_SHORT_URL",Rr="shlink/createShortUrl/RESET_CREATE_SHORT_URL",Er={result:null,saving:!1,error:!1},Dr=Object(gt.b)(($e={},Object(l.a)($e,_r,(function(e){return Object(u.a)(Object(u.a)({},e),{},{saving:!0,error:!1})})),Object(l.a)($e,Ur,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{saving:!1,error:!0,errorData:r})})),Object(l.a)($e,Tr,(function(e,t){return{result:t.result,saving:!1,error:!1}})),Object(l.a)($e,Rr,(function(){return Er})),$e),Er),Lr=function(e){return function(t){return function(){var r=Object(f.a)(v.a.mark((function r(n,c){var a,s,i;return v.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n({type:_r}),a=e(c),s=a.createShortUrl,r.prev=2,r.next=5,s(t);case 5:i=r.sent,n({type:Tr,result:i}),r.next=13;break;case 9:throw r.prev=9,r.t0=r.catch(2),n({type:Ur,errorData:lr(r.t0)}),r.t0;case 13:case"end":return r.stop()}}),r,null,[[2,9]])})));return function(e,t){return r.apply(this,arguments)}}()}},Vr=Object(gt.a)(Rr),Ir="shlink/shortUrlEdition/EDIT_SHORT_URL_START",Fr="shlink/shortUrlEdition/EDIT_SHORT_URL_ERROR",Ar="shlink/shortUrlEdition/SHORT_URL_EDITED",Mr=Object(gt.b)((et={},Object(l.a)(et,Ir,(function(e){return Object(u.a)(Object(u.a)({},e),{},{saving:!0,error:!1})})),Object(l.a)(et,Fr,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{saving:!1,error:!0,errorData:r})})),Object(l.a)(et,Ar,(function(e,t){return{shortUrl:t.shortUrl,saving:!1,error:!1}})),et),{saving:!1,error:!1}),Gr=function(e){return function(t,r,n){return function(){var c=Object(f.a)(v.a.mark((function c(a,s){var i,o,l,u,d,j,b,h,O;return v.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return a({type:Ir}),i=s(),o=i.selectedServer,l=!Object(Ee.m)(o),u=e(s),d=u.updateShortUrl,j=u.updateShortUrlTags,c.prev=4,c.next=7,Promise.all([d(t,r,n),l&&n.tags?j(t,r,n.tags):void 0]);case 7:b=c.sent,h=Object(N.a)(b,1),O=h[0],a({shortUrl:O,type:Ar}),c.next=17;break;case 13:throw c.prev=13,c.t0=c.catch(4),a({type:Fr,errorData:lr(c.t0)}),c.t0;case 17:case"end":return c.stop()}}),c,null,[[4,13]])})));return function(e,t){return c.apply(this,arguments)}}()}},Pr="shlink/shortUrlsList/LIST_SHORT_URLS_START",Br="shlink/shortUrlsList/LIST_SHORT_URLS_ERROR",Hr="shlink/shortUrlsList/LIST_SHORT_URLS",Wr=Object(gt.b)((tt={},Object(l.a)(tt,Pr,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!0,error:!1})})),Object(l.a)(tt,Br,(function(){return{loading:!1,error:!0}})),Object(l.a)(tt,Hr,(function(e,t){return{loading:!1,error:!1,shortUrls:t.shortUrls}})),Object(l.a)(tt,Sr,Object(P.a)((function(e,t){var r=t.shortCode,n=t.domain;return e.shortUrls?Object(hr.a)(["shortUrls","data"],Object(p.a)((function(e){return fr(e,r,n)}),e.shortUrls.data),e):e}),(function(e){return e.shortUrls?Object(hr.a)(["shortUrls","pagination","totalItems"],e.shortUrls.pagination.totalItems-1,e):e}))),Object(l.a)(tt,mr,(function(e,t){var r,n,c=t.createdVisits;return Object(hr.a)(["shortUrls","data"],null===(r=e.shortUrls)||void 0===r||null===(n=r.data)||void 0===n?void 0:n.map((function(e){var t=Object(Or.a)(c.filter((function(t){var r=t.shortUrl;return r&&fr(e,r.shortCode,r.domain)})));return null!==t&&void 0!==t&&t.shortUrl?Object(vr.a)("visitsCount",t.shortUrl.visitsCount,e):e})),e)})),Object(l.a)(tt,Tr,Object(P.a)((function(e,t){var r=t.result;return e.shortUrls?Object(hr.a)(["shortUrls","data"],[r].concat(Object(qe.a)(e.shortUrls.data.slice(0,4))),e):e}),(function(e){return e.shortUrls?Object(hr.a)(["shortUrls","pagination","totalItems"],e.shortUrls.pagination.totalItems+1,e):e}))),Object(l.a)(tt,Ar,(function(e,t){var r=t.shortUrl;return e.shortUrls?Object(hr.a)(["shortUrls","data"],e.shortUrls.data.map((function(e){var t=r.shortCode,n=r.domain;return fr(e,t,n)?r:e})),e):e})),tt),{loading:!0,error:!1}),qr=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(){var r=Object(f.a)(v.a.mark((function r(n,c){var a,s,i;return v.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n({type:Pr}),a=e(c),s=a.listShortUrls,r.prev=2,r.next=5,s(t);case 5:i=r.sent,n({type:Hr,shortUrls:i}),r.next=12;break;case 9:r.prev=9,r.t0=r.catch(2),n({type:Br});case 12:case"end":return r.stop()}}),r,null,[[2,9]])})));return function(e,t){return r.apply(this,arguments)}}()}},zr=function(e){return function(t){var r=t.orderByColumn,n=t.renderOrderIcon,c=t.shortUrlsList,a=t.onTagClick,s=t.selectedServer,i=t.className,o=c.error,l=c.loading,u=c.shortUrls,d=q()({"short-urls-table__header-cell--with-action":!!r}),j=q()("short-urls-table__header-cell",d),b=q()("table table-hover responsive-table",i),h=Object(Ee.l)(s);return Object(z.jsxs)("table",{className:b,children:[Object(z.jsx)("thead",{className:"responsive-table__header short-urls-table__header",children:Object(z.jsxs)("tr",{children:[Object(z.jsxs)("th",{className:j,onClick:null===r||void 0===r?void 0:r("dateCreated"),children:["Created at ",null===n||void 0===n?void 0:n("dateCreated")]}),Object(z.jsxs)("th",{className:j,onClick:null===r||void 0===r?void 0:r("shortCode"),children:["Short URL ",null===n||void 0===n?void 0:n("shortCode")]}),!h&&Object(z.jsxs)("th",{className:j,onClick:null===r||void 0===r?void 0:r("longUrl"),children:["Long URL ",null===n||void 0===n?void 0:n("longUrl")]})||Object(z.jsxs)("th",{className:"short-urls-table__header-cell",children:[Object(z.jsxs)("span",{className:d,onClick:null===r||void 0===r?void 0:r("title"),children:["Title ",null===n||void 0===n?void 0:n("title")]}),"\xa0\xa0/\xa0\xa0",Object(z.jsxs)("span",{className:d,onClick:null===r||void 0===r?void 0:r("longUrl"),children:[Object(z.jsx)("span",{className:"indivisible",children:"Long URL"})," ",null===n||void 0===n?void 0:n("longUrl")]})]}),Object(z.jsx)("th",{className:"short-urls-table__header-cell",children:"Tags"}),Object(z.jsx)("th",{className:j,onClick:null===r||void 0===r?void 0:r("visits"),children:Object(z.jsxs)("span",{className:"indivisible",children:["Visits ",null===n||void 0===n?void 0:n("visits")]})}),Object(z.jsx)("th",{className:"short-urls-table__header-cell",children:"\xa0"})]})}),Object(z.jsx)("tbody",{children:o?Object(z.jsx)("tr",{children:Object(z.jsx)("td",{colSpan:6,className:"text-center table-danger text-dark",children:"Something went wrong while loading short URLs :("})}):l?Object(z.jsx)("tr",{children:Object(z.jsx)("td",{colSpan:6,className:"text-center",children:"Loading..."})}):!l&&Object(y.a)(null===u||void 0===u?void 0:u.data)?Object(z.jsx)("tr",{children:Object(z.jsx)("td",{colSpan:6,className:"text-center",children:"No results found"})}):null===u||void 0===u?void 0:u.data.map((function(t){return Object(z.jsx)(e,{shortUrl:t,selectedServer:s,onTagClick:a},t.shortUrl)}))})]})}},Kr=function(e){var t=e.format,r=e.setFormat;return Object(z.jsxs)(Y,{text:"Format (".concat(t,")"),children:[Object(z.jsx)(J.l,{active:"png"===t,onClick:function(){return r("png")},children:"PNG"}),Object(z.jsx)(J.l,{active:"svg"===t,onClick:function(){return r("svg")},children:"SVG"})]})},Qr=function(e){var t=e.errorCorrection,r=e.setErrorCorrection;return Object(z.jsxs)(Y,{text:"Error correction (".concat(t,")"),children:[Object(z.jsxs)(J.l,{active:"L"===t,onClick:function(){return r("L")},children:[Object(z.jsx)("b",{children:"L"}),"ow"]}),Object(z.jsxs)(J.l,{active:"M"===t,onClick:function(){return r("M")},children:[Object(z.jsx)("b",{children:"M"}),"edium"]}),Object(z.jsxs)(J.l,{active:"Q"===t,onClick:function(){return r("Q")},children:[Object(z.jsx)("b",{children:"Q"}),"uartile"]}),Object(z.jsxs)(J.l,{active:"H"===t,onClick:function(){return r("H")},children:[Object(z.jsx)("b",{children:"H"}),"igh"]})]})},Jr=function(e,t){return function(r){var n=r.shortUrl,c=n.shortUrl,a=n.shortCode,s=r.toggle,i=r.isOpen,o=r.selectedServer,l=Object(H.useState)(300),u=Object(N.a)(l,2),d=u[0],j=u[1],b=Object(H.useState)(0),h=Object(N.a)(b,2),O=h[0],m=h[1],g=Object(H.useState)("png"),x=Object(N.a)(g,2),p=x[0],S=x[1],k=Object(H.useState)("L"),w=Object(N.a)(k,2),_=w[0],U=w[1],T=Object(H.useMemo)((function(){return{useSizeInPath:!Object(Ee.j)(o),marginIsSupported:Object(Ee.i)(o),errorCorrectionIsSupported:Object(Ee.k)(o)}}),[o]),R=T.marginIsSupported!==T.errorCorrectionIsSupported,E=Object(H.useMemo)((function(){return function(e,t,r){var n=t.size,c=t.format,a=t.margin,s=t.errorCorrection,i=r.useSizeInPath,o=r.marginIsSupported,l=r.errorCorrectionIsSupported,u="".concat(e,"/qr-code").concat(i?"/".concat(n):""),d=Object(C.b)({size:i?void 0:n,format:c,margin:o&&a>0?a:void 0,errorCorrection:l?s:void 0});return"".concat(u).concat(Object(y.a)(d)?"":"?".concat(d))}(c,{size:d,format:p,margin:O,errorCorrection:_},T)}),[c,d,p,O,_,T]),D=Object(H.useMemo)((function(){return d+O}),[d,O]),L=Object(H.useMemo)((function(){if(!(D<500))return D<800?"lg":"xl"}),[D]);return Object(z.jsxs)(J.t,{isOpen:i,toggle:s,centered:!0,size:L,children:[Object(z.jsxs)(J.w,{toggle:s,children:["QR code for ",Object(z.jsx)(qt.a,{href:c,children:c})]}),Object(z.jsxs)(J.u,{children:[Object(z.jsxs)(J.I,{children:[Object(z.jsxs)(J.o,{className:"d-grid ".concat(R?"col-md-4":"col-md-6"),children:[Object(z.jsxs)("label",{children:["Size: ",d,"px"]}),Object(z.jsx)("input",{type:"range",className:"form-control-range",value:d,step:10,min:50,max:1e3,onChange:function(e){return j(Number(e.target.value))}})]}),T.marginIsSupported&&Object(z.jsxs)(J.o,{className:"d-grid ".concat(R?"col-md-4":"col-md-6"),children:[Object(z.jsxs)("label",{children:["Margin: ",O,"px"]}),Object(z.jsx)("input",{type:"range",className:"form-control-range",value:O,step:1,min:0,max:100,onChange:function(e){return m(Number(e.target.value))}})]}),Object(z.jsx)(J.o,{className:R?"col-md-4":"col-md-6",children:Object(z.jsx)(Kr,{format:p,setFormat:S})}),T.errorCorrectionIsSupported&&Object(z.jsx)(J.o,{className:"col-md-6",children:Object(z.jsx)(Qr,{errorCorrection:_,setErrorCorrection:U})})]}),Object(z.jsxs)("div",{className:"text-center",children:[Object(z.jsxs)("div",{className:"mb-3",children:[Object(z.jsx)(qt.a,{href:E}),Object(z.jsx)(Qt,{text:E})]}),Object(z.jsx)("img",{src:E,className:"qr-code-modal__img",alt:"QR code"}),Object(z.jsx)(t,{minVersion:"2.9.0",children:Object(z.jsx)("div",{className:"mt-3",children:Object(z.jsxs)(J.b,{block:!0,color:"primary",onClick:Object(f.a)(v.a.mark((function t(){return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.saveImage(E,"".concat(a,"-qr-code.").concat(p)));case 1:case"end":return t.stop()}}),t)}))),children:["Download ",Object(z.jsx)(G.a,{icon:M.r,className:"ms-1"})]})})})]})]})]})}},Zr=r(329),Yr=r(330),Xr=function(e){return Object(z.jsx)(Ve,Object(u.a)({type:"checkbox"},e))},$r=function(e){var t=e.isOpen,r=e.toggle;return Object(z.jsxs)(J.t,{isOpen:t,toggle:r,centered:!0,size:"lg",children:[Object(z.jsx)(J.w,{toggle:r,children:"Info"}),Object(z.jsxs)(J.u,{children:[Object(z.jsxs)("p",{children:["When the\xa0",Object(z.jsx)("b",{children:Object(z.jsx)("i",{children:'"Use existing URL if found"'})}),"\xa0checkbox is checked, the server will return an existing short URL if it matches provided params."]}),Object(z.jsx)("p",{children:"These are the checks performed by Shlink in order to determine if an existing short URL should be returned:"}),Object(z.jsxs)("ul",{children:[Object(z.jsx)("li",{children:"When only the long URL is provided: The most recent match will be returned, or a new short URL will be created if none is found."}),Object(z.jsxs)("li",{children:["When long URL and custom slug and/or domain are provided: Same as in previous case, but it will try to match the short URL using both the long URL and the slug, the long URL and the domain, or the three of them.",Object(z.jsx)("br",{}),"If the slug is being used by another long URL, an error will be returned."]}),Object(z.jsx)("li",{children:"When other params are provided: Same as in previous cases, but it will try to match existing short URLs with all provided data. If any of them does not match, a new short URL will be created"})]})]})]})},en=function(){var e=Object(Z.f)(),t=Object(N.a)(e,2),r=t[0],n=t[1];return Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)("span",{title:"What does this mean?",children:Object(z.jsx)(G.a,{icon:M.v,style:{cursor:"pointer"},onClick:n})}),Object(z.jsx)($r,{isOpen:r,toggle:n})]})},tn=function(e){var t=e.className,r=void 0===t?"":t,n=e.placement,c=e.children,a=Object(H.useRef)();return Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)("span",{className:r,ref:function(e){a.current=e},children:Object(z.jsx)(G.a,{icon:M.v})}),Object(z.jsx)(J.L,{target:function(){return a.current},placement:n,children:c})]})},rn=function(e){var t=e.children,r=e.infoTooltip,n=e.checked,c=e.onChange;return Object(z.jsxs)("p",{children:[Object(z.jsx)(Xr,{inline:!0,checked:n,className:r?"me-2":"",onChange:c,children:t}),r&&Object(z.jsx)(tn,{placement:"right",children:r})]})},nn=Object(P.a)(Zr.a,Object(Yr.a)(/ /g,"-")),cn=function(e){return"string"===typeof e?Object(B.default)(e):e},an=function(e){return{"col-sm-6":e,"col-sm-12":!e}},sn=function(e,t){return function(r){var n,c=r.mode,a=r.saving,s=r.onSave,i=r.initialState,o=r.selectedServer,d=Object(H.useState)(i),j=Object(N.a)(d,2),b=j[0],h=j[1],O="edit"===c,m="create-basic"===c,g=Object(sr.c)(i.title),x=function(){var e=Object(sr.c)(b.title);return Object(re.a)([[function(){return!e&&!g},function(){}],[function(){return!e&&g},function(){return null}],[ne.a,function(){return b.title}]])()},p=Object(sr.b)(Object(f.a)(v.a.mark((function e(){var t,r;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s(Object(u.a)(Object(u.a)({},b),{},{validSince:null!==(t=de(b.validSince))&&void 0!==t?t:null,validUntil:null!==(r=de(b.validUntil))&&void 0!==r?r:null,maxVisits:Object(sr.c)(b.maxVisits)?Number(b.maxVisits):null,title:x()})).then((function(){return!O&&h(i)})).catch((function(){})));case 1:case"end":return e.stop()}}),e)}))));Object(H.useEffect)((function(){h(i)}),[i]);var S=function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"text",c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return Object(z.jsx)(J.o,Object(u.a)(Object(u.a)({},a),{},{children:Object(z.jsx)(J.p,Object(u.a)({id:e,type:n,placeholder:t,value:null!==(r=b[e])&&void 0!==r?r:"",onChange:function(t){return h(Object(u.a)(Object(u.a)({},b),{},Object(l.a)({},e,t.target.value)))}},c))}))},C=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object(z.jsx)(_e,Object(u.a)({selected:b[e]?cn(b[e]):null,placeholderText:t,isClearable:!0,onChange:function(t){return h(Object(u.a)(Object(u.a)({},b),{},Object(l.a)({},e,t)))}},r))},k=Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)(J.o,{children:Object(z.jsx)(J.p,{bsSize:"lg",type:"url",placeholder:"URL to be shortened",required:!0,value:b.longUrl,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{longUrl:e.target.value}))}})}),Object(z.jsxs)(J.I,{children:[m&&S("customSlug","Custom slug","text",{bsSize:"lg"},{className:"col-lg-6"}),Object(z.jsx)("div",{className:m?"col-lg-6":"col-12 mb-0",children:Object(z.jsx)(e,{selectedTags:null!==(n=b.tags)&&void 0!==n?n:[],onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{tags:e.map(nn)}))}})})]})]}),w=Object(Ee.l)(o),_=w||!O,U=q()("mb-3",an(_)),T=Object(Ee.c)(o),R=Object(Ee.f)(o),E=T||R,D=q()("mb-3",an(E));return Object(z.jsxs)("form",{className:"short-url-form",onSubmit:p,children:[m&&k,!m&&Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)(ir.a,{title:"Basic options",className:"mb-3",children:k}),Object(z.jsxs)(J.I,{children:[_&&Object(z.jsx)("div",{className:"col-sm-6 mb-3",children:Object(z.jsxs)(ir.a,{title:"Customize the short URL",children:[w&&S("title","Title"),!O&&Object(z.jsxs)(z.Fragment,{children:[Object(z.jsxs)(J.I,{children:[Object(z.jsx)("div",{className:"col-lg-6",children:S("customSlug","Custom slug","text",{disabled:Object(sr.c)(b.shortCodeLength)})}),Object(z.jsx)("div",{className:"col-lg-6",children:S("shortCodeLength","Short code length","number",{min:4,disabled:Object(sr.c)(b.customSlug)})})]}),Object(z.jsx)(t,{value:b.domain,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{domain:e}))}})]})]})}),Object(z.jsx)("div",{className:U,children:Object(z.jsxs)(ir.a,{title:"Limit access to the short URL",children:[S("maxVisits","Maximum number of visits allowed","number",{min:1}),Object(z.jsx)("div",{className:"mb-3",children:C("validSince","Enabled since...",{maxDate:b.validUntil?cn(b.validUntil):void 0})}),C("validUntil","Enabled until...",{minDate:b.validSince?cn(b.validSince):void 0})]})})]}),Object(z.jsxs)(J.I,{children:[Object(z.jsx)("div",{className:D,children:Object(z.jsxs)(ir.a,{title:"Extra checks",children:[Object(z.jsx)(rn,{infoTooltip:"If checked, Shlink will try to reach the long URL, failing in case it's not publicly accessible.",checked:b.validateUrl,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{validateUrl:e}))},children:"Validate URL"}),!O&&Object(z.jsxs)("p",{children:[Object(z.jsx)(Xr,{inline:!0,className:"me-2",checked:b.findIfExists,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{findIfExists:e}))},children:"Use existing URL if found"}),Object(z.jsx)(en,{})]})]})}),E&&Object(z.jsx)("div",{className:"col-sm-6 mb-3",children:Object(z.jsxs)(ir.a,{title:"Configure behavior",children:[T&&Object(z.jsx)(rn,{infoTooltip:"This short URL will be included in the robots.txt for your Shlink instance, allowing web crawlers (like Google) to index it.",checked:b.crawlable,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{crawlable:e}))},children:"Make it crawlable"}),R&&Object(z.jsx)(rn,{infoTooltip:"When this short URL is visited, any query params appended to it will be forwarded to the long URL.",checked:b.forwardQuery,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{forwardQuery:e}))},children:"Forward query params on redirect"})]})})]})]}),Object(z.jsx)("div",{className:"text-center",children:Object(z.jsx)(J.b,{outline:!0,color:"primary",disabled:a||Object(y.a)(b.longUrl),className:"btn-xs-block",children:a?"Saving...":"Save"})})]})}},on=r(44),ln=function(e){return function(t){var r,n=t.settings.shortUrlCreation,c=t.selectedServer,a=t.shortUrlDetail,s=t.getShortUrlDetail,i=t.shortUrlEdition,o=t.editShortUrl,l=Object(Me.f)().search,u=Object(Me.h)(),d=Object(Z.b)(),j=a.loading,b=a.error,h=a.errorData,O=a.shortUrl,m=i.saving,g=i.error,x=i.errorData,p=Object(C.a)(l).domain,S=Object(H.useMemo)((function(){return function(e,t){var r,n,c,a,s,i,o=null!==(r=null===t||void 0===t?void 0:t.validateUrls)&&void 0!==r&&r;return e?{longUrl:e.longUrl,tags:e.tags,title:null!==(n=e.title)&&void 0!==n?n:void 0,domain:null!==(c=e.domain)&&void 0!==c?c:void 0,validSince:null!==(a=e.meta.validSince)&&void 0!==a?a:void 0,validUntil:null!==(s=e.meta.validUntil)&&void 0!==s?s:void 0,maxVisits:null!==(i=e.meta.maxVisits)&&void 0!==i?i:void 0,crawlable:e.crawlable,forwardQuery:e.forwardQuery,validateUrl:o}:{longUrl:"",validateUrl:o}}(O,n)}),[O,n]),y=Object(Z.f)(),k=Object(N.a)(y,4),w=k[0],_=k[2],U=k[3];return Object(H.useEffect)((function(){u.shortCode&&s(u.shortCode,p)}),[]),j?Object(z.jsx)(on.a,{loading:!0}):b?Object(z.jsx)(or,{type:"error",children:Object(z.jsx)(dr,{errorData:h,fallbackMessage:"An error occurred while loading short URL detail :("})}):Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)("header",{className:"mb-3",children:Object(z.jsx)(J.d,{body:!0,children:Object(z.jsxs)("h2",{className:"d-sm-flex justify-content-between align-items-center mb-0",children:[Object(z.jsx)(J.b,{color:"link",size:"lg",className:"p-0 me-3",onClick:d,children:Object(z.jsx)(G.a,{icon:M.a})}),Object(z.jsx)("span",{className:"text-center",children:Object(z.jsxs)("small",{children:["Edit ",Object(z.jsx)(qt.a,{href:null!==(r=null===O||void 0===O?void 0:O.shortUrl)&&void 0!==r?r:""})]})}),Object(z.jsx)("span",{})]})})}),Object(z.jsx)(e,{initialState:S,saving:m,selectedServer:c,mode:"edit",onSave:function(){var e=Object(f.a)(v.a.mark((function e(t){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(O){e.next=2;break}return e.abrupt("return");case 2:U(),o(O.shortCode,O.domain,t).then(_).catch(U);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),g&&Object(z.jsx)(or,{type:"error",className:"mt-3",children:Object(z.jsx)(dr,{errorData:x,fallbackMessage:"An error occurred while updating short URL :("})}),w&&Object(z.jsx)(or,{type:"success",className:"mt-3",children:"Short URL properly edited."})]})}},un="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_START",dn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_ERROR",jn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL",bn={loading:!1,error:!1},hn=Object(gt.b)((rt={},Object(l.a)(rt,un,(function(){return{loading:!0,error:!1}})),Object(l.a)(rt,dn,(function(e,t){return{loading:!1,error:!0,errorData:t.errorData}})),Object(l.a)(rt,jn,(function(e,t){var r=t.shortUrl;return Object(u.a)({shortUrl:r},bn)})),rt),bn),On=function(e){return function(t,r){return function(){var n=Object(f.a)(v.a.mark((function n(c,a){var s,i,o,l,u;return v.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(c({type:un}),n.prev=1,o=a(),l=o.shortUrlsList,null===(s=null===l||void 0===l||null===(i=l.shortUrls)||void 0===i?void 0:i.data.find((function(e){return fr(e,t,r)})))||void 0===s){n.next=7;break}n.t0=s,n.next=10;break;case 7:return n.next=9,e(a).getShortUrl(t,r);case 9:n.t0=n.sent;case 10:u=n.t0,c({shortUrl:u,type:jn}),n.next=17;break;case 14:n.prev=14,n.t1=n.catch(1),c({type:dn,errorData:lr(n.t1)});case 17:case"end":return n.stop()}}),n,null,[[1,14]])})));return function(e,t){return n.apply(this,arguments)}}()}},vn=function(e,t){e.serviceFactory("ShortUrlsList",Wt,"ShortUrlsTable","ShortUrlsFilteringBar"),e.decorator("ShortUrlsList",t(["selectedServer","mercureInfo","shortUrlsList","settings"],["listShortUrls","createNewVisits","loadMercureInfo"])),e.serviceFactory("ShortUrlsTable",zr,"ShortUrlsRow"),e.serviceFactory("ShortUrlsRow",rr,"ShortUrlsRowMenu","ColorGenerator","useStateFlagTimeout"),e.serviceFactory("ShortUrlsRowMenu",cr,"DeleteShortUrlModal","QrCodeModal"),e.serviceFactory("CreateShortUrlResult",br,"useStateFlagTimeout"),e.serviceFactory("ShortUrlForm",sn,"TagsSelector","DomainSelector"),e.serviceFactory("CreateShortUrl",ar,"ShortUrlForm","CreateShortUrlResult"),e.decorator("CreateShortUrl",t(["shortUrlCreationResult","selectedServer","settings"],["createShortUrl","resetCreateShortUrl"])),e.serviceFactory("EditShortUrl",ln,"ShortUrlForm"),e.decorator("EditShortUrl",t(["shortUrlDetail","shortUrlEdition","selectedServer","settings"],["getShortUrlDetail","editShortUrl"])),e.serviceFactory("DeleteShortUrlModal",(function(){return jr})),e.decorator("DeleteShortUrlModal",t(["shortUrlDeletion"],["deleteShortUrl","resetDeleteShortUrl"])),e.serviceFactory("QrCodeModal",Jr,"ImageDownloader","ForServerVersion"),e.decorator("QrCodeModal",t(["selectedServer"])),e.serviceFactory("ShortUrlsFilteringBar",We,"ColorGenerator"),e.decorator("ShortUrlsFilteringBar",t(["selectedServer"])),e.serviceFactory("listShortUrls",qr,"buildShlinkApiClient"),e.serviceFactory("createShortUrl",Lr,"buildShlinkApiClient"),e.serviceFactory("resetCreateShortUrl",(function(){return Vr})),e.serviceFactory("deleteShortUrl",kr,"buildShlinkApiClient"),e.serviceFactory("resetDeleteShortUrl",(function(){return wr})),e.serviceFactory("getShortUrlDetail",On,"buildShlinkApiClient"),e.serviceFactory("editShortUrl",Gr,"buildShlinkApiClient")},fn=r(191),mn=r.n(fn),gn=r(50),xn=function(e){var t=e.children,r=e.label,n=e.className,c=void 0===n?"":n,a=e.labelClassName,s=void 0===a?"":a,i=e.noMargin,o=void 0!==i&&i;return Object(z.jsxs)("div",{className:"".concat(c," ").concat(o?"":"mb-3"),children:[Object(z.jsx)("label",{className:"form-label ".concat(s),children:r}),t]})},pn=function(e){var t=e.children,r=e.value,n=e.onChange,c=e.type,a=e.required,s=e.placeholder,i=e.className,o=e.labelClassName;return Object(z.jsx)(xn,{label:Object(z.jsxs)(z.Fragment,{children:[t,":"]}),className:null!==i&&void 0!==i?i:"",labelClassName:o,children:Object(z.jsx)("input",{className:"form-control",type:null!==c&&void 0!==c?c:"text",value:r,required:null===a||void 0===a||a,placeholder:s,onChange:function(e){return n(e.target.value)}})})},Sn=function(e){var t=e.onSubmit,r=e.initialValues,n=e.children,c=e.title,a=Object(H.useState)(""),s=Object(N.a)(a,2),i=s[0],o=s[1],l=Object(H.useState)(""),u=Object(N.a)(l,2),d=u[0],j=u[1],b=Object(H.useState)(""),h=Object(N.a)(b,2),O=h[0],v=h[1],f=Object(sr.b)((function(){return t({name:i,url:d,apiKey:O})}));return Object(H.useEffect)((function(){r&&o(r.name),r&&j(r.url),r&&v(r.apiKey)}),[r]),Object(z.jsxs)("form",{className:"server-form",onSubmit:f,children:[Object(z.jsxs)(ir.a,{className:"mb-3",title:c,children:[Object(z.jsx)(pn,{value:i,onChange:o,children:"Name"}),Object(z.jsx)(pn,{type:"url",value:d,onChange:j,children:"URL"}),Object(z.jsx)(pn,{value:O,onChange:v,children:"API key"})]}),Object(z.jsx)("div",{className:"text-end",children:n})]})},yn=function(e){var t=e.isOpen,r=e.duplicatedServers,n=e.onDiscard,c=e.onSave,a=r.length>1;return Object(z.jsxs)(J.t,{centered:!0,isOpen:t,children:[Object(z.jsxs)(J.w,{children:["Duplicated server",a&&"s"]}),Object(z.jsxs)(J.u,{children:[Object(z.jsx)("p",{children:a?"The next servers already exist:":"There is already a server with:"}),Object(z.jsx)("ul",{children:r.map((function(e,t){var r=e.url,n=e.apiKey;return a?Object(z.jsxs)("li",{children:[Object(z.jsx)("b",{children:r})," - ",Object(z.jsx)("b",{children:n})]},t):Object(z.jsxs)(H.Fragment,{children:[Object(z.jsxs)("li",{children:["URL: ",Object(z.jsx)("b",{children:r})]}),Object(z.jsxs)("li",{children:["API key: ",Object(z.jsx)("b",{children:n})]})]},t)}))}),Object(z.jsxs)("span",{children:[a?"Do you want to ignore duplicated servers":"Do you want to save this server anyway","?"]})]}),Object(z.jsxs)(J.v,{children:[Object(z.jsx)(J.b,{color:"link",onClick:n,children:a?"Ignore duplicated":"Discard"}),Object(z.jsx)(J.b,{color:"primary",onClick:c,children:"Save anyway"})]})]})},Cn=function(e){var t=e.type;return Object(z.jsx)("div",{className:"mt-3",children:Object(z.jsxs)(or,{type:t,children:["success"===t&&"Servers properly imported. You can now select one from the list :)","error"===t&&"The servers could not be imported. Make sure the format is correct."]})})},Nn=function(e,t){return function(r){var n=r.servers,c=r.createServer,a=Object(Me.g)(),s=Object(Z.b)(),i=!!Object.keys(n).length,o=t(!1,4e3),l=Object(N.a)(o,2),d=l[0],j=l[1],b=t(!1,4e3),h=Object(N.a)(b,2),O=h[0],v=h[1],f=Object(Z.f)(),m=Object(N.a)(f,2),g=m[0],x=m[1],p=Object(H.useState)(),S=Object(N.a)(p,2),y=S[0],C=S[1],k=function(){if(y){var e=Object(De.a)();c(Object(u.a)(Object(u.a)({},y),{},{id:e})),a("/server/".concat(e))}};return Object(H.useEffect)((function(){Object.values(n).some((function(e){var t=e.url,r=e.apiKey;return(null===y||void 0===y?void 0:y.url)===t&&(null===y||void 0===y?void 0:y.apiKey)===r}))?x():k()}),[y]),Object(z.jsxs)(gn.a,{children:[Object(z.jsxs)(Sn,{title:Object(z.jsx)("h5",{className:"mb-0",children:"Add new server"}),onSubmit:C,children:[!i&&Object(z.jsx)(e,{tooltipPlacement:"top",onImport:j,onImportError:v}),i&&Object(z.jsx)(J.b,{outline:!0,onClick:s,children:"Cancel"}),Object(z.jsx)(J.b,{outline:!0,color:"primary",className:"ms-2",children:"Create server"})]}),d&&Object(z.jsx)(Cn,{type:"success"}),O&&Object(z.jsx)(Cn,{type:"error"}),Object(z.jsx)(yn,{isOpen:g,duplicatedServers:y?[y]:[],onDiscard:s,onSave:k})]})}},kn=r(319),wn=function(e){var t=e.servers,r=e.selectedServer,n=Object(kn.a)(t);return Object(z.jsxs)(J.K,{nav:!0,inNavbar:!0,children:[Object(z.jsxs)(J.n,{nav:!0,caret:!0,children:[Object(z.jsx)(G.a,{icon:M.J})," ",Object(z.jsx)("span",{className:"ms-1",children:"Servers"})]}),Object(z.jsx)(J.m,{end:!0,style:{right:0},children:Object(y.a)(n)?Object(z.jsxs)(J.l,{tag:i.b,to:"/server/create",children:[Object(z.jsx)(G.a,{icon:M.F})," ",Object(z.jsx)("span",{className:"ms-1",children:"Add a server"})]}):Object(z.jsxs)(z.Fragment,{children:[n.map((function(e){var t=e.name,n=e.id;return Object(z.jsx)(J.l,{tag:i.b,to:"/server/".concat(n),active:Object(h.a)(r)===n,children:t},n)})),Object(z.jsx)(J.l,{divider:!0}),Object(z.jsxs)(J.l,{tag:i.b,to:"/manage-servers",children:[Object(z.jsx)(G.a,{icon:M.J})," ",Object(z.jsx)("span",{className:"ms-1",children:"Manage servers"})]})]})})]})},_n=function(e){var t=e.server,r=e.toggle,n=e.isOpen,c=e.deleteServer,a=e.redirectHome,s=void 0===a||a,i=Object(Me.g)();return Object(z.jsxs)(J.t,{isOpen:n,toggle:r,centered:!0,children:[Object(z.jsx)(J.w,{toggle:r,children:Object(z.jsx)("span",{className:"text-danger",children:"Remove server"})}),Object(z.jsxs)(J.u,{children:[Object(z.jsxs)("p",{children:["Are you sure you want to remove ",Object(z.jsx)("b",{children:t?t.name:""}),"?"]}),Object(z.jsx)("p",{children:Object(z.jsx)("i",{children:"No data will be deleted, only the access to this server will be removed from this device. You can create it again at any moment."})})]}),Object(z.jsxs)(J.v,{children:[Object(z.jsx)("button",{className:"btn btn-link",onClick:r,children:"Cancel"}),Object(z.jsx)("button",{className:"btn btn-danger",onClick:function(){return c(t),r(),void(s&&i("/"))},children:"Delete"})]})]})},Un=function(e){return function(t){var r=t.server,n=t.className,c=t.children,a=t.textClassName,s=Object(Z.f)(),i=Object(N.a)(s,4),o=i[0],l=i[2],u=i[3];return Object(z.jsxs)(z.Fragment,{children:[Object(z.jsxs)("span",{className:n,onClick:l,children:[!c&&Object(z.jsx)(G.a,{fixedWidth:!0,icon:M.z}),Object(z.jsx)("span",{className:a,children:null!==c&&void 0!==c?c:"Remove this server"})]}),Object(z.jsx)(e,{server:r,isOpen:o,toggle:u})]})}},Tn=r(112),Rn=function(e){return Object(Tn.a)((function(e){var t=e.editServer,r=e.selectedServer,n=Object(Z.b)();if(!Object(h.e)(r))return null;return Object(z.jsx)(gn.a,{children:Object(z.jsxs)(Sn,{title:Object(z.jsxs)("h5",{className:"mb-0",children:['Edit "',r.name,'"']}),initialValues:r,onSubmit:function(e){t(r.id,e),n()},children:[Object(z.jsx)(J.b,{outline:!0,className:"me-2",onClick:n,children:"Cancel"}),Object(z.jsx)(J.b,{outline:!0,color:"primary",children:"Save"})]})})}),e)},En=r(349),Dn=function(e){return function(t){var r=t.url,n=t.apiKey;return e.some((function(e){return e.url===r&&e.apiKey===n}))}},Ln=function(e){var t=e.importServersFromFile;return function(e){var r=e.createServers,n=e.servers,c=e.fileRef,a=e.children,s=e.onImport,i=void 0===s?function(){}:s,o=e.onImportError,l=void 0===o?function(){}:o,u=e.tooltipPlacement,d=void 0===u?"bottom":u,j=e.className,b=void 0===j?"":j,h=null!==c&&void 0!==c?c:Object(H.useRef)(),O=Object(H.useState)(),m=Object(N.a)(O,2),g=m[0],x=m[1],p=Object(H.useState)([]),S=Object(N.a)(p,2),y=S[0],C=S[1],k=Object(Z.f)(),w=Object(N.a)(k,4),_=w[0],U=w[2],T=w[3],R=Object(P.a)(r,i),E=Object(P.a)((function(){return R(null!==g&&void 0!==g?g:[])}),T),D=Object(P.a)((function(){return R((null!==g&&void 0!==g?g:[]).filter(Object(En.a)(Dn(y))))}),T),L=function(){var e=Object(f.a)(v.a.mark((function e(r){var n,c;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=r.target,e.abrupt("return",t(null===(n=c.files)||void 0===n?void 0:n[0]).then(x).then((function(){c.value=null})).catch(l));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(H.useEffect)((function(){if(g){var e=Object.values(n),t=g.filter(Dn(e)),r=!!t.length;r?C(t):R(g),r&&U()}}),[g]),Object(z.jsxs)(z.Fragment,{children:[Object(z.jsxs)(J.b,{outline:!0,id:"importBtn",className:b,onClick:function(){var e;return null===(e=h.current)||void 0===e?void 0:e.click()},children:[Object(z.jsx)(G.a,{icon:M.s,fixedWidth:!0})," ",null!==a&&void 0!==a?a:"Import from file"]}),Object(z.jsxs)(J.L,{placement:d,target:"importBtn",children:["You can create servers by importing a CSV file with columns ",Object(z.jsx)("b",{children:"name"}),", ",Object(z.jsx)("b",{children:"apiKey"})," and ",Object(z.jsx)("b",{children:"url"}),"."]}),Object(z.jsx)("input",{type:"file",accept:"text/csv",className:"import-servers-btn__csv-select",ref:h,onChange:L}),Object(z.jsx)(yn,{isOpen:_,duplicatedServers:y,onDiscard:D,onSave:E})]})}},Vn=r(309),In=r(57),Fn="shlink/selectedServer/SELECT_SERVER",An="shlink/selectedServer/RESET_SELECTED_SERVER",Mn=Object(P.a)((function(e){return"latest"===e?"999.999.999":e}),Object(In.c)("1.0.0")),Gn=Object(Vn.a)(Le.a,function(){var e=Object(f.a)(v.a.mark((function e(t,r){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",r().then((function(e){var t=e.version;return{version:Mn(t),printableVersion:Object(In.b)(t)}})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),Pn=Object(gt.b)((nt={},Object(l.a)(nt,An,(function(){return null})),Object(l.a)(nt,Fn,(function(e,t){return t.selectedServer})),nt),null),Bn=Object(gt.a)(An),Hn=function(e,t){return function(r){return function(){var n=Object(f.a)(v.a.mark((function n(c,a){var s,i,o,l,d,j,b,h;return v.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(c(Bn()),s=a(),i=s.servers,o=i[r]){n.next=6;break}return c({type:Fn,selectedServer:{serverNotFound:!0}}),n.abrupt("return");case 6:return n.prev=6,l=e(o),d=l.health,n.next=10,Gn(r,d);case 10:j=n.sent,b=j.version,h=j.printableVersion,c({type:Fn,selectedServer:Object(u.a)(Object(u.a)({},o),{},{version:b,printableVersion:h})}),c(t()),n.next=20;break;case 17:n.prev=17,n.t0=n.catch(6),c({type:Fn,selectedServer:Object(u.a)(Object(u.a)({},o),{},{serverNotReachable:!0})});case 20:case"end":return n.stop()}}),n,null,[[6,17]])})));return function(e,t){return n.apply(this,arguments)}}()}},Wn=r(331),qn=r(113),zn=r(88),Kn="shlink/servers/EDIT_SERVER",Qn="shlink/servers/DELETE_SERVER",Jn="shlink/servers/CREATE_SERVERS",Zn="shlink/servers/SET_AUTO_CONNECT",Yn=Object(gt.b)((ct={},Object(l.a)(ct,Jn,(function(e,t){var r=t.newServers;return Object(u.a)(Object(u.a)({},e),r)})),Object(l.a)(ct,Qn,(function(e,t){var r=t.serverId;return Object(mt.a)(r,e)})),Object(l.a)(ct,Kn,(function(e,t){var r=t.serverId,n=t.serverData;return e[r]?Object(vr.a)(r,Object(u.a)(Object(u.a)({},e[r]),n),e):e})),Object(l.a)(ct,Zn,(function(e,t){var r=t.serverId,n=t.autoConnect;return e[r]?n?Object(Wn.a)(Object(ze.a)(e).map((function(e){var t=Object(N.a)(e,2),n=t[0],c=t[1];return[n,Object(u.a)(Object(u.a)({},c),{},{autoConnect:n===r})]}))):Object(vr.a)(r,Object(u.a)(Object(u.a)({},e[r]),{},{autoConnect:n}),e):e})),ct),{}),Xn=Object(qn.a)((function(e,t){return Object(vr.a)(t.id,t,e)}),{}),$n=Object(P.a)(Object(zn.a)((function(e){return e.id?e:Object(vr.a)("id",Object(De.a)(),e)})),Xn,(function(e){return{type:Jn,newServers:e}})),ec=function(e){return $n([e])},tc=function(e,t){return{type:Kn,serverId:e,serverData:t}},rc=function(e){var t=e.id;return{type:Qn,serverId:t}},nc=function(e,t){var r=e.id;return{type:Zn,serverId:r,autoConnect:t}},cc=Object(P.a)(Object(b.a)("data"),(function(e){return Array.isArray(e)?e.filter(h.b):[]})),ac=function(e){var t=e.get;return function(){return function(){var e=Object(f.a)(v.a.mark((function e(r){var n,c;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t("".concat(o.a,"/servers.json"));case 2:n=e.sent,c=cc(n),r($n(c));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}},sc=function(e){var t=e.minVersion,r=e.maxVersion,n=e.selectedServer,c=e.children;if(!Object(h.d)(n))return null;var a=n.version;return Object(In.a)(a,{maxVersion:r,minVersion:t})?Object(z.jsx)(z.Fragment,{children:c}):null},ic=r(126),oc=function(e){return function(t){var r=t.servers,n=t.selectedServer;return Object(z.jsx)(gn.a,{children:Object(z.jsxs)("div",{className:"server-error__container flex-column",children:[Object(z.jsxs)(on.a,{className:"w-100 mb-3 mb-md-5",type:"error",fullWidth:!0,children:[!Object(h.e)(n)&&"Could not find this Shlink server.",Object(h.e)(n)&&Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)("p",{children:"Oops! Could not connect to this Shlink server."}),"Make sure you have internet connection, and the server is properly configured and on-line."]})]}),Object(z.jsxs)(ic.a,{servers:Object.values(r),children:["These are the Shlink servers currently configured. Choose one of them or ",Object(z.jsx)(i.b,{to:"/server/create",children:"add a new one"}),"."]}),Object(h.e)(n)&&Object(z.jsx)("div",{className:"container mt-3 mt-md-5",children:Object(z.jsxs)("h5",{children:["Alternatively, if you think you may have miss-configured this server, you can ",Object(z.jsx)(e,{server:n,className:"server-error__delete-btn",children:"remove it"})," or\xa0",Object(z.jsx)(i.b,{to:"/server/".concat(n.id,"/edit"),children:"edit it"}),"."]})})]})})}},lc=r(69),uc=function(e){var t=e.children,r=e.title,n=e.link;return Object(z.jsxs)(J.d,Object(u.a)(Object(u.a)({className:"highlight-card",body:!0},function(e){return e?{tag:i.b,to:e}:{}}(n)),{},{children:[n&&Object(z.jsx)(G.a,{size:"3x",className:"highlight-card__link-icon",icon:we.a}),Object(z.jsx)(J.i,{tag:"h5",className:"highlight-card__title",children:r}),Object(z.jsx)(J.h,{tag:"h2",children:t})]}))},dc=function(e,t,r){return Je((function(n){var c,a=n.shortUrlsList,s=n.listShortUrls,o=n.listTags,l=n.tagsList,u=n.selectedServer,d=n.loadVisitsOverview,j=n.visitsOverview,b=a.loading,O=a.shortUrls,v=l.loading,f=j.loading,m=j.visitsCount,g=j.orphanVisitsCount,x=Object(h.a)(u),p=Object(Ee.h)(u),S=Object(Ee.g)(u),y=Object(Me.g)();return Object(H.useEffect)((function(){s({itemsPerPage:5,orderBy:{field:"dateCreated",dir:"DESC"}}),o(),d()}),[]),Object(z.jsxs)(z.Fragment,{children:[Object(z.jsxs)(J.I,{children:[Object(z.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(z.jsx)(uc,{title:"Visits",link:S&&"/server/".concat(x,"/non-orphan-visits"),children:f?"Loading...":It(m)})}),Object(z.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(z.jsxs)(uc,{title:"Orphan visits",link:p&&"/server/".concat(x,"/orphan-visits"),children:[Object(z.jsx)(r,{minVersion:"2.6.0",children:f?"Loading...":It(null!==g&&void 0!==g?g:0)}),Object(z.jsx)(r,{maxVersion:"2.5.*",children:Object(z.jsx)("small",{className:"text-muted",children:Object(z.jsx)("i",{children:"Shlink 2.6 is needed"})})})]})}),Object(z.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(z.jsx)(uc,{title:"Short URLs",link:"/server/".concat(x,"/list-short-urls/1"),children:b?"Loading...":It(null!==(c=null===O||void 0===O?void 0:O.pagination.totalItems)&&void 0!==c?c:0)})}),Object(z.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(z.jsx)(uc,{title:"Tags",link:"/server/".concat(x,"/manage-tags"),children:v?"Loading...":It(l.tags.length)})})]}),Object(z.jsxs)(J.d,{className:"mb-3",children:[Object(z.jsxs)(J.g,{children:[Object(z.jsx)("span",{className:"d-sm-none",children:"Create a short URL"}),Object(z.jsx)("h5",{className:"d-none d-sm-inline",children:"Create a short URL"}),Object(z.jsx)(i.b,{className:"float-end",to:"/server/".concat(x,"/create-short-url"),children:"Advanced options \xbb"})]}),Object(z.jsx)(J.e,{children:Object(z.jsx)(t,{basicMode:!0})})]}),Object(z.jsxs)(J.d,{children:[Object(z.jsxs)(J.g,{children:[Object(z.jsx)("span",{className:"d-sm-none",children:"Recently created URLs"}),Object(z.jsx)("h5",{className:"d-none d-sm-inline",children:"Recently created URLs"}),Object(z.jsx)(i.b,{className:"float-end",to:"/server/".concat(x,"/list-short-urls/1"),children:"See all \xbb"})]}),Object(z.jsx)(J.e,{children:Object(z.jsx)(e,{shortUrlsList:a,selectedServer:u,className:"mb-0",onTagClick:function(e){return y("/server/".concat(x,"/list-short-urls/1?tags=").concat(encodeURIComponent(e)))}})})]})]})}),(function(){return[Ze.visits,Ze.orphanVisits]}))},jc=function(e,t,r,n){return function(c){var a=c.servers,s=Object.values(a),o=Object(H.useState)(s),l=Object(N.a)(o,2),u=l[0],d=l[1],j=u.some((function(e){return!!e.autoConnect})),b=r(!1,4e3),h=Object(N.a)(b,2),O=h[0],m=h[1];return Object(H.useEffect)((function(){d(Object.values(a))}),[a]),Object(z.jsxs)(gn.a,{children:[Object(z.jsx)(K,{className:"mb-3",onChange:function(e){return d(s.filter((function(t){var r=t.name,n=t.url;return"".concat(r," ").concat(n).match(e)})))}}),Object(z.jsxs)(J.I,{className:"mb-3",children:[Object(z.jsxs)("div",{className:"col-md-6 d-flex d-md-block mb-2 mb-md-0",children:[Object(z.jsx)(t,{className:"flex-fill",onImportError:m,children:"Import servers"}),s.length>0&&Object(z.jsxs)(J.b,{outline:!0,className:"ms-2 flex-fill",onClick:Object(f.a)(v.a.mark((function t(){return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.exportServers());case 1:case"end":return t.stop()}}),t)}))),children:[Object(z.jsx)(G.a,{icon:M.r,fixedWidth:!0})," Export servers"]})]}),Object(z.jsx)("div",{className:"col-md-6 text-md-end d-flex d-md-block",children:Object(z.jsxs)(J.b,{outline:!0,color:"primary",className:"flex-fill",tag:i.b,to:"/server/create",children:[Object(z.jsx)(G.a,{icon:M.F,fixedWidth:!0})," Add a server"]})})]}),Object(z.jsx)(ir.a,{children:Object(z.jsxs)("table",{className:"table table-hover responsive-table mb-0",children:[Object(z.jsx)("thead",{className:"responsive-table__header",children:Object(z.jsxs)("tr",{children:[j&&Object(z.jsx)("th",{style:{width:"50px"}}),Object(z.jsx)("th",{children:"Name"}),Object(z.jsx)("th",{children:"Base URL"}),Object(z.jsx)("th",{})]})}),Object(z.jsxs)("tbody",{children:[!u.length&&Object(z.jsx)("tr",{className:"text-center",children:Object(z.jsx)("td",{colSpan:4,children:"No servers found."})}),u.map((function(e){return Object(z.jsx)(n,{server:e,hasAutoConnect:j},e.id)}))]})]})}),O&&Object(z.jsx)("div",{className:"mt-3",children:Object(z.jsx)(or,{type:"error",children:"The servers could not be imported. Make sure the format is correct."})})]})}},bc=function(e){return function(t){var r=t.server,n=t.hasAutoConnect;return Object(z.jsxs)("tr",{className:"responsive-table__row",children:[n&&Object(z.jsx)("td",{className:"responsive-table__cell","data-th":"Auto-connect",children:r.autoConnect&&Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)(G.a,{icon:M.h,className:"text-primary",id:"autoConnectIcon"}),Object(z.jsx)(J.L,{target:"autoConnectIcon",placement:"right",children:"Auto-connect to this server"})]})}),Object(z.jsx)("th",{className:"responsive-table__cell","data-th":"Name",children:Object(z.jsx)(i.b,{to:"/server/".concat(r.id),children:r.name})}),Object(z.jsx)("td",{className:"responsive-table__cell","data-th":"Base URL",children:r.url}),Object(z.jsx)("td",{className:"responsive-table__cell text-end",children:Object(z.jsx)(e,{server:r})})]})}},hc=function(e){return function(t){var r=t.server,n=t.setAutoConnect,c=Object(Z.f)(),a=Object(N.a)(c,2),s=a[0],o=a[1],l=Object(Z.f)(),u=Object(N.a)(l,4),d=u[0],j=u[2],b=u[3],h="/server/".concat(r.id),O=r.autoConnect,v=O?M.b:we.c;return Object(z.jsxs)(nr,{isOpen:s,toggle:o,children:[Object(z.jsxs)(J.l,{tag:i.b,to:h,children:[Object(z.jsx)(G.a,{icon:M.E,fixedWidth:!0})," Connect"]}),Object(z.jsxs)(J.l,{tag:i.b,to:"".concat(h,"/edit"),children:[Object(z.jsx)(G.a,{icon:M.n,fixedWidth:!0})," Edit server"]}),Object(z.jsxs)(J.l,{onClick:function(){return n(r,!r.autoConnect)},children:[Object(z.jsx)(G.a,{icon:v,fixedWidth:!0})," ",O?"Do not a":"A","uto-connect"]}),Object(z.jsx)(J.l,{divider:!0}),Object(z.jsxs)(J.l,{className:"dropdown-item--danger",onClick:j,children:[Object(z.jsx)(G.a,{icon:M.z,fixedWidth:!0})," Remove server"]}),Object(z.jsx)(e,{redirectHome:!1,server:r,isOpen:d,toggle:b})]})}},Oc=function(e){return"string"===typeof e.url&&"string"===typeof e.apiKey&&"string"===typeof e.name},vc=function(e){return Array.isArray(e)&&e.every(Oc)},fc=Object(m.a)((function e(t,r){var n=this;Object(g.a)(this,e),this.csvJson=t,this.fileReaderFactory=r,this.importServersFromFile=function(){var e=Object(f.a)(v.a.mark((function e(t){var r;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}throw new Error("No file provided");case 2:return r=n.fileReaderFactory(),e.abrupt("return",new Promise((function(e,c){r.addEventListener("loadend",(function(t){try{var r,a,s,i=null!==(r=null===(a=t.target)||void 0===a||null===(s=a.result)||void 0===s?void 0:s.toString())&&void 0!==r?r:"",o=n.csvJson.toObject(i);if(!vc(o))throw new Error("Provided file does not have the right format.");e(o)}catch(t){c(t)}})),r.readAsText(t)})));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()})),mc=r(78),gc=Object(m.a)((function e(t,r,n){var c=this;Object(g.a)(this,e),this.storage=t,this.window=r,this.csvjson=n,this.exportServers=Object(f.a)(v.a.mark((function e(){var t,r,n;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Object(kn.a)(null!==(t=c.storage.get("servers"))&&void 0!==t?t:{}).map(h.f);try{n=c.csvjson.toCSV(r,{headers:"key"}),Object(mc.a)(c.window,n,"shlink-servers.csv")}catch(a){console.error(a)}case 2:case"end":return e.stop()}}),e)})))})),xc=function(e,t){e.serviceFactory("ManageServers",jc,"ServersExporter","ImportServersBtn","useStateFlagTimeout","ManageServersRow"),e.decorator("ManageServers",lc.a),e.decorator("ManageServers",t(["selectedServer","servers"],["resetSelectedServer"])),e.serviceFactory("ManageServersRow",bc,"ManageServersRowDropdown"),e.serviceFactory("ManageServersRowDropdown",hc,"DeleteServerModal"),e.decorator("ManageServersRowDropdown",t(null,["setAutoConnect"])),e.serviceFactory("CreateServer",Nn,"ImportServersBtn","useStateFlagTimeout"),e.decorator("CreateServer",lc.a),e.decorator("CreateServer",t(["selectedServer","servers"],["createServer","resetSelectedServer"])),e.serviceFactory("EditServer",Rn,"ServerError"),e.decorator("EditServer",t(["selectedServer"],["editServer","selectServer","resetSelectedServer"])),e.serviceFactory("ServersDropdown",(function(){return wn})),e.decorator("ServersDropdown",t(["servers","selectedServer"])),e.serviceFactory("DeleteServerModal",(function(){return _n})),e.decorator("DeleteServerModal",t(null,["deleteServer"])),e.serviceFactory("DeleteServerButton",Un,"DeleteServerModal"),e.serviceFactory("ImportServersBtn",Ln,"ServersImporter"),e.decorator("ImportServersBtn",t(["servers"],["createServers"])),e.serviceFactory("ForServerVersion",(function(){return sc})),e.decorator("ForServerVersion",t(["selectedServer"])),e.serviceFactory("ServerError",oc,"DeleteServerButton"),e.decorator("ServerError",t(["servers","selectedServer"])),e.serviceFactory("Overview",dc,"ShortUrlsTable","CreateShortUrl","ForServerVersion"),e.decorator("Overview",t(["shortUrlsList","tagsList","selectedServer","mercureInfo","visitsOverview"],["listShortUrls","listTags","createNewVisits","loadMercureInfo","loadVisitsOverview"])),e.constant("csvjson",mn.a),e.constant("fileReaderFactory",(function(){return new FileReader})),e.service("ServersImporter",fc,"csvjson","fileReaderFactory"),e.service("ServersExporter",gc,"Storage","window","csvjson"),e.serviceFactory("selectServer",Hn,"buildShlinkApiClient","loadMercureInfo"),e.serviceFactory("createServer",(function(){return ec})),e.serviceFactory("createServers",(function(){return $n})),e.serviceFactory("deleteServer",(function(){return rc})),e.serviceFactory("editServer",(function(){return tc})),e.serviceFactory("setAutoConnect",(function(){return nc})),e.serviceFactory("fetchServers",ac,"axios"),e.serviceFactory("resetSelectedServer",(function(){return Bn}))},pc=r(355),Sc=r(332),yc=r(333),Cc=r(334),Nc=function(){return Object(z.jsx)(pc.a,{attribution:'© OpenStreetMap contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"})},kc=function(e){return 0===e.length?{}:e.length>1?{bounds:e.map(Object(b.a)("latLong"))}:{zoom:10,center:Object(N.a)(e,1)[0].latLong}},wc=function(e){var t=e.toggle,r=e.isOpen,n=e.title,c=e.locations,a=void 0===c?[]:c;return Object(z.jsx)(J.t,{toggle:t,isOpen:r,className:"map-modal__modal",contentClassName:"map-modal__modal-content",children:Object(z.jsxs)(J.u,{className:"map-modal__modal-body",children:[Object(z.jsxs)("h3",{className:"map-modal__modal-title",children:[n,Object(z.jsx)("button",{type:"button",className:"btn-close float-end",onClick:t})]}),Object(z.jsxs)(Sc.a,Object(u.a)(Object(u.a)({},kc(a)),{},{children:[Object(z.jsx)(Nc,{}),a.map((function(e,t){var r=e.cityName,n=e.latLong,c=e.count;return Object(z.jsx)(yc.a,{position:n,children:Object(z.jsxs)(Cc.a,{children:[Object(z.jsx)("b",{children:c})," visit",c>1?"s":""," from ",Object(z.jsx)("b",{children:r})]})},t)}))]}))]})})},_c=function(e){var t=e.visits,r=e.goBack,n=e.shortUrl,c=e.children,a=e.title;return Object(z.jsx)("header",{children:Object(z.jsxs)(J.d,{body:!0,children:[Object(z.jsxs)("h2",{className:"d-flex justify-content-between align-items-center mb-0",children:[Object(z.jsx)(J.b,{color:"link",size:"lg",className:"p-0 me-3",onClick:r,children:Object(z.jsx)(G.a,{icon:M.a})}),Object(z.jsx)("span",{className:"text-center d-none d-sm-block",children:Object(z.jsx)("small",{children:a})}),Object(z.jsxs)("span",{className:"badge badge-main ms-3",children:["Visits:"," ",Object(z.jsx)(tr,{visitsCount:t.length,shortUrl:n})]})]}),Object(z.jsx)("h3",{className:"text-center d-block d-sm-none mb-0 mt-3",children:Object(z.jsx)("small",{children:a})}),c&&Object(z.jsx)("div",{className:"mt-md-2",children:c})]})})},Uc=function(e){var t,r,n=e.shortUrlDetail,c=e.shortUrlVisits,a=e.goBack,s=n.shortUrl,i=n.loading,o=c.visits,l=null!==(t=null===s||void 0===s?void 0:s.shortUrl)&&void 0!==t?t:"",u=null!==(r=null===s||void 0===s?void 0:s.longUrl)&&void 0!==r?r:"",d=null===s||void 0===s?void 0:s.title,j=Object(z.jsxs)(z.Fragment,{children:["Visits for ",Object(z.jsx)(qt.a,{href:l})]});return Object(z.jsxs)(_c,{title:j,goBack:a,visits:o,shortUrl:s,children:[Object(z.jsx)("hr",{}),Object(z.jsxs)("div",{children:["Created: ",s?Object(z.jsxs)("span",{children:[Object(z.jsx)("b",{id:"created",className:"short-url-visits-header__created-at",children:Object(z.jsx)(Yt,{date:s.dateCreated,relative:!0})}),Object(z.jsx)(J.L,{placement:"bottom",target:"created",children:Object(z.jsx)(Yt,{date:s.dateCreated})})]}):Object(z.jsx)("small",{children:"Loading..."})]}),Object(z.jsxs)("div",{children:["".concat(d?"Title":"Long URL",": "),i&&Object(z.jsx)("small",{children:"Loading..."}),!i&&Object(z.jsx)(qt.a,{href:u,children:null!==d&&void 0!==d?d:u})]})]})},Tc=r(346),Rc=["children"],Ec=function(e){var t=e.children,r=Object(x.a)(e,Rc);return Object(z.jsx)(J.z,Object(u.a)(Object(u.a)({className:"nav-pills__nav-link",tag:i.c},r),{},{children:t}))},Dc=function(e){var t=e.children,r=e.fill,n=void 0!==r&&r,c=e.className,a=void 0===c?"":c;return Object(z.jsx)(J.d,{className:"nav-pills__nav p-0 overflow-hidden ".concat(a),body:!0,children:Object(z.jsx)(J.x,{pills:!0,fill:n,children:H.Children.map(t,(function(e){if(!Object(H.isValidElement)(e)||e.type!==Ec)throw new Error("Only NavPillItem children are allowed inside NavPills.");return e}))})})},Lc=r(87),Vc=r(339),Ic=r(340),Fc=r(342),Ac=r(336),Mc=r(193),Gc=r(337),Pc=r(211),Bc=r(72),Hc=r(338),Wc=r(341),qc=r(192),zc=r.n(qc),Kc=r(335),Qc="Others",Jc=["Android Browser","Chrome","Chromium","Firefox","Internet Explorer","Microsoft Edge","Opera","Safari","Samsung Internet for Android","Vivaldi","WeChat"],Zc=function(e){var t,r;return Object(sr.c)(e)?null!==(t=null===(r=e.split("/")[e.includes("://")?2:0])||void 0===r?void 0:r.split(":")[0])&&void 0!==t?t:"":"Direct"},Yc=function(e,t){return Object.values(Object(u.a)(Object(u.a)({},Object(Kc.a)(t,t.map((function(){return 0})))),e))},Xc=function(e,t){var r=e.native,n=Object(N.a)(t,1)[0];null!==r&&void 0!==r&&r.target&&(r.target.style.cursor=n?"pointer":"default")},$c=function(e){var t=e.dataset,r=e.formattedValue;return"".concat(t.label,": ").concat(It(r))},ea=function(e){var t=e.label,r=e.formattedValue;return"".concat(t,": ").concat(It(r))},ta=r(39),ra={monthly:"Month",weekly:"Week",daily:"Day",hourly:"Hour"},na={hourly:function(e){return{hours:e}},daily:function(e){return{days:e}},weekly:function(e){return{weeks:e}},monthly:function(e){return{months:e}}},ca={hourly:Ac.a,daily:Mc.a,weekly:Gc.a,monthly:Pc.a},aa={hourly:function(e){return Object(ce.default)(e,"yyyy-MM-dd HH:00")},daily:function(e){return Object(ce.default)(e,"yyyy-MM-dd")},weekly:function(e){var t=Object(ce.default)(Object(Bc.a)(e),"yyyy-MM-dd"),r=Object(ce.default)(Object(Hc.a)(e),"yyyy-MM-dd");return"".concat(t," - ").concat(r)},monthly:function(e){return Object(ce.default)(e,"yyyy-MM")}},sa=function(e,t){return Object(Ic.a)((function(t){return aa[e](Object(B.default)(t.date))}),t)},ia=function(e,t,r,n){if(n)return[Object.keys(t),Object.values(t)];var c=function(e,t){var r=ca[e],n=aa[e],c=Object(B.default)(t[0].date),a=Object(B.default)(t[t.length-1].date),s=r(c,a),i=na[e];return[n(a)].concat(Object(qe.a)(Object(sr.e)(s,(function(e){return n(Object(Wc.a)(a,i(e)))}))))}(r,e);return[c,Yc(t,c)]},oa=function(e,t,r){return{label:t,data:e,fill:!1,tension:.2,borderColor:r,backgroundColor:r}},la=null,ua=function(e,t,r){return function(n){var c=Object(N.a)(n,1)[0];if(r&&c){var a,s=c.index;if(la===e[s])r([]),la=null;else r(e[s]&&t[e[s]]||[]),la=null!==(a=e[s])&&void 0!==a?a:null}}},da=function(e){var t=e.title,r=e.visits,n=e.highlightedVisits,c=e.highlightedLabel,a=void 0===c?"Selected":c,s=e.setSelectedVisits,i=Object(H.useState)(r.length>0?function(e){var t,r=new Date,n=Object(B.default)(e);return null!==(t=Object(re.a)([[function(){return Object(Mc.a)(r,n)<=2},Object(Vc.a)("hourly")],[function(){return Object(Pc.a)(r,n)<=1},Object(Vc.a)("daily")],[function(){return Object(Pc.a)(r,n)<=6},Object(Vc.a)("weekly")]])())&&void 0!==t?t:"monthly"}(r[r.length-1].date):"monthly"),o=Object(N.a)(i,2),l=o[0],u=o[1],d=Object(Z.f)(!0),j=Object(N.a)(d,2),b=j[0],h=j[1],O=Object(H.useMemo)((function(){return function(e,t){return t.reduce((function(t,r){var n,c=aa[e](Object(B.default)(r.date));return t[c]=null!==(n=t[c])&&void 0!==n?n:[],t[c].push(r),t}),{})}(l,r)}),[l,r]),v=Object(H.useMemo)((function(){return sa(l,Object(Fc.a)(r))}),[l,r]),f=Object(H.useMemo)((function(){return ia(r,v,l,b)}),[r,l,b]),m=Object(N.a)(f,2),g=m[0],x=m[1],p=Object(H.useMemo)((function(){return Yc(sa(l,Object(Fc.a)(n)),g)}),[n,l,g]),S=function(){var e=oa(x,"Visits",ta.c);return 0===n.length?[e]:[e,oa(p,a,ta.a)]},y={maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{intersect:!1,axis:"x",callbacks:{label:$c}}},scales:{y:{beginAtZero:!0,ticks:{precision:0,callback:It}},x:{title:{display:!0,text:ra[l]}}},onHover:Xc},C=function(){return Object(z.jsx)(Lc.c,{data:{labels:g,datasets:S()},options:y,getElementAtEvent:ua(g,O,s)})};return Object(z.jsxs)(J.d,{children:[Object(z.jsxs)(J.g,{children:[t,Object(z.jsx)("div",{className:"float-end",children:Object(z.jsxs)(J.K,{children:[Object(z.jsx)(J.n,{caret:!0,color:"link",className:"btn-sm p-0",children:"Group by"}),Object(z.jsx)(J.m,{end:!0,children:Object.entries(ra).map((function(e){var t=Object(N.a)(e,2),r=t[0],n=t[1];return Object(z.jsx)(J.l,{active:l===r,onClick:function(){return u(r)},children:n},r)}))})]})}),Object(z.jsx)("div",{className:"float-end me-2",children:Object(z.jsx)(Ie,{checked:b,onChange:h,children:Object(z.jsx)("small",{children:"Skip dates with no visits"})})})]}),Object(z.jsxs)(J.e,{className:"line-chart-card__body",children:[n.length>0&&C(),0===n.length&&C()]})]})},ja=r(343),ba=function(e){var t=e.pagesCount,r=e.currentPage,n=e.setCurrentPage,c=e.centered,a=void 0===c||c;if(t<2)return null;var s=function(e){return function(){return!Mt(e)&&n(e)}};return Object(z.jsxs)(J.D,{listClassName:q()("flex-wrap mb-0 simple-paginator",{"justify-content-center":a}),children:[Object(z.jsx)(J.E,{disabled:r<=1,children:Object(z.jsx)(J.F,{previous:!0,tag:"span",onClick:s(r-1)})}),At(r,t).map((function(e,t){return Object(z.jsx)(J.E,{disabled:Mt(e),active:r===e,children:Object(z.jsx)(J.F,{tag:"span",onClick:s(e),children:Gt(e)})},Pt(e,t))})),Object(z.jsx)(J.E,{disabled:r>=t,children:Object(z.jsx)(J.F,{next:!0,tag:"span",onClick:s(r+1)})})]})},ha=["browser","os","referer","country","city"],Oa=function(e,t){return t.filter((function(t){return function(e,t){var r=e.browser,n=e.os,c=e.referer,a=e.country,s=e.city,i=Object(x.a)(e,ha);return"".concat(r," ").concat(n," ").concat(c," ").concat(a," ").concat(s," ").concat(i.visitedUrl).toLowerCase().includes(t.toLowerCase())}(t,e)}))},va=function(e,t,r){var n=function(e,t){return w(t,e)}(r,t?Oa(t,e):Object(qe.a)(e)),c=n.length;return{visitsGroups:Object(ja.a)(20,n),total:c}},fa=function(e){var t,r,n=e.visits,c=e.selectedVisits,a=void 0===c?[]:c,s=e.setSelectedVisits,i=e.selectedServer,o=e.matchMedia,l=void 0===o?window.matchMedia:o,u=e.isOrphanVisits,d=void 0!==u&&u,j="visits-table__header-cell visits-table__sticky",b=function(){return l("(max-width: 767px)").matches},h=Object(H.useState)(b()),O=Object(N.a)(h,2),v=O[0],f=O[1],m=Object(H.useState)(void 0),g=Object(N.a)(m,2),x=g[0],p=g[1],S=Object(H.useState)({}),y=Object(N.a)(S,2),C=y[0],w=y[1],_=Object(H.useMemo)((function(){return va(n,x,C)}),[x,C]),U=Object(H.useRef)(!0),T=Object(H.useState)(1),R=Object(N.a)(T,2),E=R[0],D=R[1],L=20*E,V=L-20,I=Object(Ee.b)(i),F=7+Number(I)+Number(d),A=function(e){return function(){return w({field:e,dir:k(e,C.field,C.dir)})}},P=function(e){return Object(z.jsx)(Ye,{currentOrder:C,field:e,className:"visits-table__header-icon"})};return Object(H.useEffect)((function(){var e=function(){return f(b())};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),Object(H.useEffect)((function(){D(1),!U.current&&s([]),U.current=!1}),[x]),Object(z.jsx)("div",{className:"table-responsive-md",children:Object(z.jsxs)("table",{className:"table table-bordered table-hover table-sm visits-table",children:[Object(z.jsxs)("thead",{className:"visits-table__header",children:[Object(z.jsxs)("tr",{children:[Object(z.jsx)("th",{className:"".concat(j," text-center"),onClick:function(){return s(a.length<_.total?_.visitsGroups.flat():[])},children:Object(z.jsx)(G.a,{icon:M.h,className:q()({"text-primary":a.length>0})})}),I&&Object(z.jsxs)("th",{className:"".concat(j," text-center"),onClick:A("potentialBot"),children:[Object(z.jsx)(G.a,{icon:M.H}),P("potentialBot")]}),Object(z.jsxs)("th",{className:j,onClick:A("date"),children:["Date",P("date")]}),Object(z.jsxs)("th",{className:j,onClick:A("country"),children:["Country",P("country")]}),Object(z.jsxs)("th",{className:j,onClick:A("city"),children:["City",P("city")]}),Object(z.jsxs)("th",{className:j,onClick:A("browser"),children:["Browser",P("browser")]}),Object(z.jsxs)("th",{className:j,onClick:A("os"),children:["OS",P("os")]}),Object(z.jsxs)("th",{className:j,onClick:A("referer"),children:["Referrer",P("referer")]}),d&&Object(z.jsxs)("th",{className:j,onClick:A("visitedUrl"),children:["Visited URL",P("visitedUrl")]})]}),Object(z.jsx)("tr",{children:Object(z.jsx)("td",{colSpan:F,className:"p-0",children:Object(z.jsx)(K,{noBorder:!0,large:!1,onChange:p})})})]}),Object(z.jsxs)("tbody",{children:[!(null!==(t=_.visitsGroups[E-1])&&void 0!==t&&t.length)&&Object(z.jsx)("tr",{children:Object(z.jsx)("td",{colSpan:F,className:"text-center",children:"No visits found with current filtering"})}),null===(r=_.visitsGroups[E-1])||void 0===r?void 0:r.map((function(e,t){var r=a.includes(e);return Object(z.jsxs)("tr",{style:{cursor:"pointer"},className:q()({"table-active":r}),onClick:function(){return s(r?a.filter((function(t){return t!==e})):[].concat(Object(qe.a)(a),[e]))},children:[Object(z.jsx)("td",{className:"text-center",children:r&&Object(z.jsx)(G.a,{icon:M.h,className:"text-primary"})}),I&&Object(z.jsx)("td",{className:"text-center",children:e.potentialBot&&Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)(G.a,{icon:M.H,id:"botIcon".concat(t)}),Object(z.jsx)(J.L,{placement:"right",target:"botIcon".concat(t),children:"Potentially a visit from a bot or crawler"})]})}),Object(z.jsx)("td",{children:Object(z.jsx)(Yt,{date:e.date})}),Object(z.jsx)("td",{children:e.country}),Object(z.jsx)("td",{children:e.city}),Object(z.jsx)("td",{children:e.browser}),Object(z.jsx)("td",{children:e.os}),Object(z.jsx)("td",{children:e.referer}),d&&Object(z.jsx)("td",{children:e.visitedUrl})]},t)}))]}),_.total>20&&Object(z.jsx)("tfoot",{children:Object(z.jsx)("tr",{children:Object(z.jsx)("td",{colSpan:F,className:"visits-table__footer-cell visits-table__sticky",children:Object(z.jsxs)("div",{className:"row",children:[Object(z.jsx)("div",{className:"col-md-6",children:Object(z.jsx)(ba,{pagesCount:Math.ceil(_.total/20),currentPage:E,setCurrentPage:D,centered:v})}),Object(z.jsx)("div",{className:q()("col-md-6",{"d-flex align-items-center flex-row-reverse":!v,"text-center mt-3":v}),children:Object(z.jsxs)("div",{children:["Visits ",Object(z.jsx)("b",{children:It(V+1)})," to"," ",Object(z.jsx)("b",{children:It(Object(Dt.a)(L,_.total))})," of"," ",Object(z.jsx)("b",{children:It(_.total)})]})})]})})})})]})})},ma=function(e){var t=e.modalTitle,r=e.activeCities,n=e.locations,c=void 0===n?[]:n,a=Object(Z.f)(),s=Object(N.a)(a,4),i=s[0],o=s[2],l=s[3],u=Object(Z.f)(),d=Object(N.a)(u,3),j=d[0],b=d[1],h=d[2],O=Object(H.useState)([]),v=Object(N.a)(O,2),f=v[0],m=v[1],g=Object(H.useRef)(),x=function(e){return function(){m(e?c.filter((function(e){var t=e.cityName;return r.includes(t)})):c),o()}};return Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)("button",{className:"btn btn-link open-map-modal-btn__btn",ref:g,onClick:function(){if(!r)return m(c),void o();h()},children:Object(z.jsx)(G.a,{icon:M.y})}),Object(z.jsx)(J.L,{placement:"left",target:function(){return g.current},children:"Show in map"}),Object(z.jsx)(J.k,{isOpen:j,toggle:b,inNavbar:!0,children:Object(z.jsxs)(J.m,{end:!0,children:[Object(z.jsx)(J.l,{onClick:x(!1),children:"Show all locations"}),Object(z.jsx)(J.l,{onClick:x(!0),children:"Show locations in current page"})]})}),Object(z.jsx)(wc,{toggle:l,isOpen:i,title:t,locations:f})]})},ga=r(344),xa=function(e){return e.hasOwnProperty("visitedUrl")},pa=Object(P.a)(Object(ga.a)((function(e){return xa(e.visit)?"orphanVisits":"regularVisits"})),(function(e){return Object(u.a)({orphanVisits:[],regularVisits:[]},e)})),Sa=function(e,t){return Object(Ic.a)(Object(b.a)(t),e)},ya=function(e){var t,r,n=e.page,c=e.itemsPerPage,a=e.filter,s=e.dateRange;return{page:n,itemsPerPage:c,startDate:null!==(t=(null===s||void 0===s?void 0:s.startDate)&&de(null===s||void 0===s?void 0:s.startDate))&&void 0!==t?t:void 0,endDate:null!==(r=(null===s||void 0===s?void 0:s.endDate)&&de(null===s||void 0===s?void 0:s.endDate))&&void 0!==r?r:void 0,excludeBots:(null===a||void 0===a?void 0:a.excludeBots)||void 0}},Ca=function(e,t){return!Object(S.a)(e)&&Object(sr.c)(e[t])},Na=function(e){return"number"===typeof e?e:e?parseFloat(e):0},ka=function(e){return function(t,r){var n=Ca(r,e)?r[e]:"Unknown";t[n]=(t[n]||0)+1}},wa=ka("country"),_a=ka("city"),Ua=function(e){return e.reduce((function(e,t){return function(e,t){var r=t.os;e[r]=(e[r]||0)+1}(e.os,t),function(e,t){var r=t.browser;e[r]=(e[r]||0)+1}(e.browsers,t),function(e,t){var r=t.referer;e[r]=(e[r]||0)+1}(e.referrers,t),wa(e.countries,t),_a(e.cities,t),function(e,t){if(Ca(t,"city")&&"Unknown"!==t.city){var r=t.city,n=t.latitude,c=t.longitude,a=e[r]||{cityName:r,count:0,latLong:[Na(n),Na(c)]};a.count++,e[r]=a}}(e.citiesForMap,t),function(e,t){if(function(e){return e.hasOwnProperty("visitedUrl")}(t)){var r=t.visitedUrl;e[r]=(e[r]||0)+1}}(e.visitedUrls,t),e}),{os:{},browsers:{},referrers:{},countries:{},cities:{},citiesForMap:{},visitedUrls:{}})},Ta=Object(zn.a)((function(e){var t=e.userAgent,r=e.date,n=e.referer,c=e.visitLocation,a=e.potentialBot,s=void 0!==a&&a,i=Object(u.a)(Object(u.a)({date:r,potentialBot:s},function(e){if(!Object(sr.c)(e))return{browser:Qc,os:Qc};var t=zc.a.parse(e),r=t.browser.name,n=t.os.name;return{os:null!==n&&void 0!==n?n:Qc,browser:r&&Jc.includes(r)?r:Qc}}(t)),{},{referer:Zc(n),country:(null===c||void 0===c?void 0:c.countryName)||"Unknown",city:(null===c||void 0===c?void 0:c.cityName)||"Unknown",latitude:null===c||void 0===c?void 0:c.latitude,longitude:null===c||void 0===c?void 0:c.longitude});return xa(e)?Object(u.a)(Object(u.a)({},i),{},{type:e.type,visitedUrl:e.visitedUrl}):i})),Ra=function(e){var t=e.onChange,r=e.selected,n=void 0===r?{}:r,c=e.className,a=e.isOrphanVisits,s=e.botsSupported;if(!s&&!a)return null;var i=n.orphanVisitsType,o=n.excludeBots,l=void 0!==o&&o,d=function(e){return{active:i===e,onClick:function(){return t(Object(u.a)(Object(u.a)({},n),{},{orphanVisitsType:e===(null===n||void 0===n?void 0:n.orphanVisitsType)?void 0:e}))}}};return Object(z.jsxs)(Y,{text:"Filters",dropdownClassName:c,className:"me-3",right:!0,minWidth:250,children:[s&&Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)(J.l,{header:!0,children:"Bots:"}),Object(z.jsx)(J.l,{active:l,onClick:function(){return t(Object(u.a)(Object(u.a)({},n),{},{excludeBots:!(null!==n&&void 0!==n&&n.excludeBots)}))},children:"Exclude potential bots"})]}),s&&a&&Object(z.jsx)(J.l,{divider:!0}),a&&Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)(J.l,{header:!0,children:"Orphan visits type:"}),Object(z.jsx)(J.l,Object(u.a)(Object(u.a)({},d("base_url")),{},{children:"Base URL"})),Object(z.jsx)(J.l,Object(u.a)(Object(u.a)({},d("invalid_short_url")),{},{children:"Invalid short URL"})),Object(z.jsx)(J.l,Object(u.a)(Object(u.a)({},d("regular_404")),{},{children:"Regular 404"}))]}),Object(z.jsx)(J.l,{divider:!0}),Object(z.jsx)(J.l,{disabled:!Object(sr.c)(n),onClick:function(){return t({})},children:Object(z.jsx)("i",{children:"Clear filters"})})]})},Ea=r(51),Da=function(e){var t,r,n=e.chart.config,c=null!==(t=n.data)&&void 0!==t?t:{},a=c.labels,s=void 0===a?[]:a,i=c.datasets,o=void 0===i?[]:i,l=Object(N.a)(o,1)[0].backgroundColor,u=(null!==(r=n.options)&&void 0!==r?r:{}).defaultColor;return Object(z.jsx)("ul",{className:"doughnut-chart-legend",children:s.map((function(e,t){var r;return Object(z.jsxs)("li",{className:"doughnut-chart-legend__item d-flex",children:[Object(z.jsx)("div",{className:"doughnut-chart-legend__item-color",style:{backgroundColor:null!==(r=l[t])&&void 0!==r?r:u}}),Object(z.jsx)("small",{className:"doughnut-chart-legend__item-text flex-fill",children:e})]},e)}))})},La=function(e){return[{data:e,backgroundColor:["#97BBCD","#F7464A","#46BFBD","#FDB45C","#949FB1","#57A773","#414066","#08B2E3","#B6C454","#DCDCDC","#463730"],borderColor:Object(ta.h)()?ta.e:ta.f,borderWidth:2}]},Va=Object(H.memo)((function(e){var t=e.stats,r=Object(H.useState)(),n=Object(N.a)(r,2),c=n[0],a=n[1],s=Object(Ea.a)(t),i=Object(kn.a)(t),o={plugins:{legend:{display:!1},tooltip:{intersect:!0,callbacks:{label:ea}}}},l=function(e,t){return{labels:e,datasets:La(t)}}(s,i);return Object(z.jsxs)("div",{className:"row",children:[Object(z.jsx)("div",{className:"col-sm-12 col-md-7",children:Object(z.jsx)(Lc.b,{height:300,data:l,options:o,ref:function(e){a(null!==e&&void 0!==e?e:void 0)}})}),Object(z.jsx)("div",{className:"col-sm-12 col-md-5",children:c&&Object(z.jsx)(Da,{chart:c})})]})})),Ia=function(e){var t=e.title,r=e.footer,n=e.children;return Object(z.jsxs)(J.d,{children:[Object(z.jsx)(J.g,{className:"chart-card__header",children:"function"===typeof t?t():t}),Object(z.jsx)(J.e,{children:n}),r&&Object(z.jsx)(J.f,{className:"chart-card__footer--sticky",children:r})]})},Fa=function(e){var t=e.title,r=e.stats;return Object(z.jsx)(Ia,{title:t,children:Object(z.jsx)(Va,{stats:r})})},Aa=r(97),Ma=r(348),Ga=r(345),Pa=function(e){var t=e.toggleClassName,r=e.ranges,n=e.value,c=e.setValue;return Object(z.jsxs)(J.K,{children:[Object(z.jsx)(J.n,{caret:!0,color:"link",className:t,children:"Paginate"}),Object(z.jsxs)(J.m,{end:!0,children:[r.map((function(e){return Object(z.jsxs)(J.l,{active:e===n,onClick:function(){return c(e)},children:[Object(z.jsx)("b",{children:e})," items per page"]},e)})),Object(z.jsx)(J.l,{divider:!0}),Object(z.jsx)(J.l,{disabled:n===1/0,onClick:function(){return c(1/0)},children:Object(z.jsx)("i",{children:"Clear pagination"})})]})]})},Ba=function(e){return e.startsWith("hidden")?"":e},Ha=function(e,t,r){var n={data:e,label:r?"Non-selected":"Visits",backgroundColor:ta.d,borderColor:ta.c,borderWidth:2};return t.every((function(e){return 0===e}))?[n]:[n,{label:null!==r&&void 0!==r?r:"Selected",data:t,backgroundColor:ta.b,borderColor:ta.a,borderWidth:2}]},Wa=function(e,t){return function(r){var n=Object(N.a)(r,1)[0];t&&n&&t(e[n.index])}},qa=function(e){var t=e.stats,r=e.highlightedStats,n=e.highlightedLabel,c=e.onClick,a=e.max,s=Object(Ea.a)(t).map(Ba),i=Object(kn.a)(function(e){return!!e&&Object.keys(e).length>0}(r)?Object(Ea.a)(r).reduce((function(e,t){return e[t]&&(e[t]-=r[t]),e}),Object(u.a)({},t)):t),o=Yc(null!==r&&void 0!==r?r:{},s),l={plugins:{legend:{display:!1},tooltip:{mode:"y",filter:function(e){return""!==e.label},callbacks:{label:$c}}},scales:{x:{beginAtZero:!0,stacked:!0,max:a,ticks:{precision:0,callback:It}},y:{stacked:!0}},onHover:Xc,indexAxis:"y"},d=function(e,t,r,n){return{labels:e,datasets:Ha(t,r,n)}}(s,i,o,n),j=function(e){return e.length>20?10*e.length:void 0}(s),b=function(e){return Object(z.jsx)(Lc.a,{data:d,options:l,height:j,getElementAtEvent:Wa(s,c)},"".concat(j,"_").concat(e))};return Object(z.jsxs)(z.Fragment,{children:[void 0!==r&&b("with_stats"),void 0===r&&b("without_stats")]})},za=["stats","highlightedStats","title","sortingItems","extraHeaderContent","withPagination"],Ka=function(e){return"String"===Object(Aa.a)(e)?Object(Ma.a)(e):e},Qa=function(e){return Object(N.a)(e,1)[0]},Ja=function(e){return Object(N.a)(e,2)[1]},Za=function(e){var t=e.stats,r=e.highlightedStats,n=e.title,c=e.sortingItems,a=e.extraHeaderContent,s=e.withPagination,i=void 0===s||s,o=Object(x.a)(e,za),l=Object(H.useState)({}),d=Object(N.a)(l,2),j=d[0],b=d[1],h=Object(H.useState)(1),O=Object(N.a)(h,2),v=O[0],f=O[1],m=Object(H.useState)(50),g=Object(N.a)(m,2),p=g[0],S=g[1],y=function(e){var t=e[v-1];if(v0?r:void 0,c),k=C.currentPageStats,w=C.currentPageHighlightedStats,_=C.pagination,U=C.max,T=Object.keys(k);return Object(z.jsx)(Ia,{title:function(){return Object(z.jsxs)(z.Fragment,{children:[n,Object(z.jsx)("div",{className:"float-end",children:Object(z.jsx)(Ke,{isButton:!1,right:!0,items:c,order:j,onChange:function(e,t){b({field:e,dir:t}),f(1)}})}),i&&Object.keys(t).length>50&&Object(z.jsx)("div",{className:"float-end",children:Object(z.jsx)(Pa,{toggleClassName:"btn-sm p-0 me-3",ranges:[50,100,200,500],value:p,setValue:function(e){S(e),f(1)}})}),a&&Object(z.jsx)("div",{className:"float-end",children:a(_?T:void 0)})]})},footer:_,children:Object(z.jsx)(qa,Object(u.a)({stats:k,highlightedStats:w,max:U},o))})},Ya={byTime:{title:"By time",subPath:"by-time",icon:M.d},byContext:{title:"By context",subPath:"by-context",icon:M.g},byLocation:{title:"By location",subPath:"by-location",icon:M.y},list:{title:"List",subPath:"list",icon:M.x}},Xa=function(e){var t,r,n=e.children,c=e.visitsInfo,a=e.getVisits,s=e.cancelGetVisits,i=e.domain,o=e.settings,l=e.exportCsv,u=e.selectedServer,d=e.isOrphanVisits,j=void 0!==d&&d,b=c.visits,h=c.loading,O=c.loadingLarge,v=c.error,f=c.errorData,m=c.progress,g=c.fallbackInterval,x=Object(H.useState)(null!==(t=null!==g&&void 0!==g?g:null===(r=o.visits)||void 0===r?void 0:r.defaultInterval)&&void 0!==t?t:"last30Days"),p=Object(N.a)(x,2),S=p[0],C=p[1],k=Object(H.useState)(ye(S)),w=Object(N.a)(k,2),_=w[0],U=w[1],T=Object(H.useState)([]),R=Object(N.a)(T,2),E=R[0],D=R[1],L=Object(H.useState)(),V=Object(N.a)(L,2),I=V[0],F=V[1],A=Object(H.useState)({}),P=Object(N.a)(A,2),B=P[0],W=P[1],K=Object(Ee.b)(u),Q=Object(H.useRef)(!0),Z=function(e){var t=i?"?domain=".concat(i):"";return e?"".concat(e).concat(t):"".concat(t)},Y=Object(H.useMemo)((function(){return Ta(b)}),[b]),X=Object(H.useMemo)((function(){return Ua(Y)}),[Y]),$=X.os,ee=X.browsers,te=X.referrers,re=X.countries,ne=X.cities,ce=X.citiesForMap,ae=X.visitedUrls,se=Object(kn.a)(ce),ie=function(e){at=void 0,D(e)},oe=function(e){return function(t){var r="".concat(e,"_").concat(t);at===r?(D([]),F(void 0),at=void 0):(D(Y.filter(Object(Tc.a)(e,t))),F(t),at=r)}};Object(H.useEffect)((function(){return s}),[]),Object(H.useEffect)((function(){a({dateRange:_,filter:B},Q.current),Q.current=!1}),[_,B]),Object(H.useEffect)((function(){g&&C(g)}),[g]);return Object(z.jsxs)(z.Fragment,{children:[n,Object(z.jsx)("section",{className:"mt-3",children:Object(z.jsxs)("div",{className:"row flex-md-row-reverse",children:[Object(z.jsx)("div",{className:"col-lg-7 col-xl-6",children:Object(z.jsxs)("div",{className:"d-md-flex",children:[Object(z.jsx)("div",{className:"flex-fill",children:Object(z.jsx)(Re,{updatable:!0,disabled:h,initialDateRange:S,defaultText:"All visits",onDatesChange:U})}),Object(z.jsx)(Ra,{className:"ms-0 ms-md-2 mt-3 mt-md-0",isOrphanVisits:j,botsSupported:K,selected:B,onChange:W})]})}),b.length>0&&Object(z.jsx)("div",{className:"col-lg-5 col-xl-6 mt-3 mt-lg-0",children:Object(z.jsxs)("div",{className:"d-flex",children:[Object(z.jsxs)(J.b,{outline:!0,disabled:0===E.length,className:"btn-md-block me-2",onClick:function(){return ie([])},children:["Clear selection ",E.length>0&&Object(z.jsxs)(z.Fragment,{children:["(",It(E.length),")"]})]}),Object(z.jsxs)(J.b,{outline:!0,color:"primary",className:"btn-md-block",onClick:function(){return l(Y)},children:[Object(z.jsx)(G.a,{icon:M.r})," Export (",It(Y.length),")"]})]})})]})}),Object(z.jsx)("section",{className:"mt-3",children:O?Object(z.jsxs)(on.a,{loading:!0,children:["This is going to take a while... :S",Object(z.jsx)(J.H,{value:m,striped:100===m,className:"mt-3"})]}):h?Object(z.jsx)(on.a,{loading:!0}):v?Object(z.jsx)(or,{type:"error",children:Object(z.jsx)(dr,{errorData:f,fallbackMessage:"An error occurred while loading visits :("})}):Object(y.a)(b)?Object(z.jsx)(on.a,{children:"There are no visits matching current filter :("}):Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)(Dc,{fill:!0,children:Object.values(Ya).map((function(e,t){var r=e.title,n=e.icon,c=e.subPath;return Object(z.jsxs)(Ec,{to:Z(c),replace:!0,children:[Object(z.jsx)(G.a,{icon:n}),Object(z.jsx)("span",{className:"ms-2 d-none d-sm-inline",children:r})]},t)}))}),Object(z.jsx)(J.I,{children:Object(z.jsxs)(Me.d,{children:[Object(z.jsx)(Me.b,{path:Ya.byTime.subPath,element:Object(z.jsx)("div",{className:"col-12 mt-3",children:Object(z.jsx)(da,{title:"Visits during time",visits:Y,highlightedVisits:E,highlightedLabel:I,setSelectedVisits:ie})})}),Object(z.jsx)(Me.b,{path:Ya.byContext.subPath,element:Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)("div",{className:q()("mt-3 col-lg-6",{"col-xl-4":!j}),children:Object(z.jsx)(Fa,{title:"Operating systems",stats:$})}),Object(z.jsx)("div",{className:q()("mt-3 col-lg-6",{"col-xl-4":!j}),children:Object(z.jsx)(Fa,{title:"Browsers",stats:ee})}),Object(z.jsx)("div",{className:q()("mt-3",{"col-xl-4":!j,"col-lg-6":j}),children:Object(z.jsx)(Za,{title:"Referrers",stats:te,withPagination:!1,highlightedStats:Sa(E,"referer"),highlightedLabel:I,sortingItems:{name:"Referrer name",amount:"Visits amount"},onClick:oe("referer")})}),j&&Object(z.jsx)("div",{className:"mt-3 col-lg-6",children:Object(z.jsx)(Za,{title:"Visited URLs",stats:ae,highlightedLabel:I,highlightedStats:Sa(E,"visitedUrl"),sortingItems:{visitedUrl:"Visited URL",amount:"Visits amount"},onClick:oe("visitedUrl")})})]})}),Object(z.jsx)(Me.b,{path:Ya.byLocation.subPath,element:Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)("div",{className:"col-lg-6 mt-3",children:Object(z.jsx)(Za,{title:"Countries",stats:re,highlightedStats:Sa(E,"country"),highlightedLabel:I,sortingItems:{name:"Country name",amount:"Visits amount"},onClick:oe("country")})}),Object(z.jsx)("div",{className:"col-lg-6 mt-3",children:Object(z.jsx)(Za,{title:"Cities",stats:ne,highlightedStats:Sa(E,"city"),highlightedLabel:I,extraHeaderContent:function(e){return se.length>0&&Object(z.jsx)(ma,{modalTitle:"Cities",locations:se,activeCities:e})},sortingItems:{name:"City name",amount:"Visits amount"},onClick:oe("city")})})]})}),Object(z.jsx)(Me.b,{path:Ya.list.subPath,element:Object(z.jsx)("div",{className:"col-12",children:Object(z.jsx)(fa,{visits:Y,selectedVisits:E,setSelectedVisits:ie,isOrphanVisits:j,selectedServer:u})})}),Object(z.jsx)(Me.b,{path:"*",element:Object(z.jsx)(Me.a,{replace:!0,to:Z(Ya.byTime.subPath)})})]})})]})})]})},$a=function(e){var t=e.exportVisits;return Je((function(e){var r=e.shortUrlVisits,n=e.shortUrlDetail,c=e.getShortUrlVisits,a=e.getShortUrlDetail,s=e.cancelGetShortUrlVisits,i=e.settings,o=e.selectedServer,l=Object(Me.h)().shortCode,d=void 0===l?"":l,j=Object(Me.f)().search,b=Object(Z.b)(),h=Object(C.a)(j).domain;return Object(H.useEffect)((function(){a(d,h)}),[]),Object(z.jsx)(Xa,{getVisits:function(e,t){return c(d,Object(u.a)(Object(u.a)({},ya(e)),{},{domain:h}),t)},cancelGetVisits:s,visitsInfo:r,domain:h,settings:i,exportCsv:function(e){var r;return t("short-url_".concat(null===(r=n.shortUrl)||void 0===r?void 0:r.shortUrl.replace(/https?:\/\//g,""),"_visits.csv"),e)},selectedServer:o,children:Object(z.jsx)(Uc,{shortUrlDetail:n,shortUrlVisits:r,goBack:b})})}),(function(e,t){return[Ze.shortUrlVisits(t.shortCode)]}))},es=function(e){var t=e.tagVisits,r=e.goBack,n=e.colorGenerator,c=t.visits,a=t.tag,s=Object(z.jsxs)("span",{className:"d-flex align-items-center justify-content-center",children:[Object(z.jsx)("span",{className:"me-2",children:"Visits for"}),Object(z.jsx)(Q,{text:a,colorGenerator:n})]});return Object(z.jsx)(_c,{title:s,goBack:r,visits:c})},ts=function(e,t){var r=t.exportVisits;return Je((function(t){var n=t.getTagVisits,c=t.tagVisits,a=t.cancelGetTagVisits,s=t.settings,i=t.selectedServer,o=Object(Z.b)(),l=Object(Me.h)().tag,u=void 0===l?"":l;return Object(z.jsx)(Xa,{getVisits:function(e,t){return n(u,ya(e),t)},cancelGetVisits:a,visitsInfo:c,settings:s,exportCsv:function(e){return r("tag_".concat(u,"_visits.csv"),e)},selectedServer:i,children:Object(z.jsx)(es,{tagVisits:c,goBack:o,colorGenerator:e})})}),(function(){return[Ze.visits]}))},rs=function(e){var t=e.orphanVisits,r=e.goBack,n=t.visits;return Object(z.jsx)(_c,{title:"Orphan visits",goBack:r,visits:n})},ns=function(e){var t=e.exportVisits;return Je((function(e){var r=e.getOrphanVisits,n=e.orphanVisits,c=e.cancelGetOrphanVisits,a=e.settings,s=e.selectedServer,i=Object(Z.b)();return Object(z.jsx)(Xa,{getVisits:function(e,t){var n;return r(ya(e),null===(n=e.filter)||void 0===n?void 0:n.orphanVisitsType,t)},cancelGetVisits:c,visitsInfo:n,settings:a,exportCsv:function(e){return t("orphan_visits.csv",e)},selectedServer:s,isOrphanVisits:!0,children:Object(z.jsx)(rs,{orphanVisits:n,goBack:i})})}),(function(){return[Ze.orphanVisits]}))},cs=function(e){var t=e.nonOrphanVisits,r=e.goBack,n=t.visits;return Object(z.jsx)(_c,{title:"Non-orphan visits",goBack:r,visits:n})},as=function(e){var t=e.exportVisits;return Je((function(e){var r=e.getNonOrphanVisits,n=e.nonOrphanVisits,c=e.cancelGetNonOrphanVisits,a=e.settings,s=e.selectedServer,i=Object(Z.b)();return Object(z.jsx)(Xa,{getVisits:function(e,t){return r(ya(e),t)},cancelGetVisits:c,visitsInfo:n,settings:a,exportCsv:function(e){return t("non_orphan_visits.csv",e)},selectedServer:s,children:Object(z.jsx)(cs,{nonOrphanVisits:n,goBack:i})})}),(function(){return[Ze.visits]}))},ss=r(354),is=5e3,os=function(e){return e.currentPage>=e.pagesCount},ls=function(e,t){return 100*t/e},us=function(){var e=Object(f.a)(v.a.mark((function e(t,r,n,c,a,s){var i,o,l,d,j,h,O;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a({type:c.start}),i=function(){var e=Object(f.a)(v.a.mark((function e(r){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.all(r.map(function(){var e=Object(f.a)(v.a.mark((function e(r){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(r,is).then(Object(b.a)("data")));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())).then(ss.a));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),o=function(){var e=Object(f.a)(v.a.mark((function e(t){var r,n,l=arguments;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:0,!s()){e.next=3;break}return e.abrupt("return",[]);case 3:return e.next=5,i(t[r]);case 5:if(n=e.sent,a({type:c.progress,progress:ls(t.length,r+2)}),!(r0&&void 0!==d[0]?d[0]:1,e.next=3,t(r,is);case 3:if(n=e.sent,s=n.pagination,i=n.data,s&&!os(s)){e.next=8;break}return e.abrupt("return",i);case 8:return l=Object(Rt.a)(2,s.pagesCount+1),u=Object(ja.a)(4,l),s.pagesCount-1>4&&a({type:c.large}),e.t0=i,e.next=14,o(u);case 14:return e.t1=e.sent,e.abrupt("return",e.t0.concat.call(e.t0,e.t1));case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.prev=4,e.next=7,Promise.all([l(),r()]);case 7:d=e.sent,j=Object(N.a)(d,2),h=j[0],O=j[1],a(!h.length&&O?{type:c.fallbackToInterval,fallbackInterval:Ce(O.date)}:Object(u.a)(Object(u.a)({},n),{},{visits:h,type:c.finish})),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),a({type:c.error,errorData:lr(e.t0)});case 17:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(t,r,n,c,a,s){return e.apply(this,arguments)}}(),ds=function(e,t){return e?Object(f.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t({page:1,itemsPerPage:1}).then((function(e){return e.data[0]})));case 1:case"end":return e.stop()}}),e)}))):Object(f.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.resolve(void 0));case 1:case"end":return e.stop()}}),e)})))},js="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_START",bs="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_ERROR",hs="shlink/shortUrlVisits/GET_SHORT_URL_VISITS",Os="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_LARGE",vs="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_CANCEL",fs="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_PROGRESS_CHANGED",ms="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_FALLBACK_TO_INTERVAL",gs={visits:[],shortCode:"",domain:void 0,loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},xs=Object(gt.b)((st={},Object(l.a)(st,js,(function(){return Object(u.a)(Object(u.a)({},gs),{},{loading:!0})})),Object(l.a)(st,bs,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},gs),{},{error:!0,errorData:r})})),Object(l.a)(st,hs,(function(e,t){var r=t.visits,n=t.query,c=t.shortCode,a=t.domain;return Object(u.a)(Object(u.a)({},e),{},{visits:r,shortCode:c,domain:a,query:n,loading:!1,error:!1})})),Object(l.a)(st,Os,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(st,vs,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(st,fs,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(st,ms,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(st,mr,(function(e,t){var r=t.createdVisits,n=e.shortCode,c=e.domain,a=e.visits,s=e.query,i=void 0===s?{}:s,o=i.startDate,l=i.endDate,d=r.filter((function(e){var t=e.shortUrl,r=e.visit;return t&&fr(t,n,c)&&he(r.date,o,l)})).map((function(e){return e.visit}));return 0===d.length?e:Object(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(qe.a)(d),Object(qe.a)(a))})})),st),gs),ps=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(){var c=Object(f.a)(v.a.mark((function c(a,s){var i,o,l,d,j,b,h;return v.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return i=e(s),o=i.getShortUrlVisits,l=function(){var e=Object(f.a)(v.a.mark((function e(n,c){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(t,Object(u.a)(Object(u.a)({},r),{},{page:n,itemsPerPage:c})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),d=ds(n,function(){var e=Object(f.a)(v.a.mark((function e(n){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(t,Object(u.a)(Object(u.a)({},n),{},{domain:r.domain})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),j=function(){return s().shortUrlVisits.cancelLoad},b={shortCode:t,query:r,domain:r.domain},h={start:js,large:Os,finish:hs,error:bs,progress:fs,fallbackToInterval:ms},c.abrupt("return",us(l,d,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},Ss=Object(gt.a)(vs),ys="shlink/tagVisits/GET_TAG_VISITS_START",Cs="shlink/tagVisits/GET_TAG_VISITS_ERROR",Ns="shlink/tagVisits/GET_TAG_VISITS",ks="shlink/tagVisits/GET_TAG_VISITS_LARGE",ws="shlink/tagVisits/GET_TAG_VISITS_CANCEL",_s="shlink/tagVisits/GET_TAG_VISITS_PROGRESS_CHANGED",Us="shlink/tagVisits/GET_TAG_VISITS_FALLBACK_TO_INTERVAL",Ts={visits:[],tag:"",loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},Rs=Object(gt.b)((it={},Object(l.a)(it,ys,(function(){return Object(u.a)(Object(u.a)({},Ts),{},{loading:!0})})),Object(l.a)(it,Cs,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},Ts),{},{error:!0,errorData:r})})),Object(l.a)(it,Ns,(function(e,t){var r=t.visits,n=t.tag,c=t.query;return Object(u.a)(Object(u.a)({},e),{},{visits:r,tag:n,query:c,loading:!1,error:!1})})),Object(l.a)(it,ks,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(it,ws,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(it,_s,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(it,Us,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(it,mr,(function(e,t){var r=t.createdVisits,n=e.tag,c=e.visits,a=e.query,s=void 0===a?{}:a,i=s.startDate,o=s.endDate,l=r.filter((function(e){var t=e.shortUrl,r=e.visit;return(null===t||void 0===t?void 0:t.tags.includes(n))&&he(r.date,i,o)})).map((function(e){return e.visit}));return Object(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(qe.a)(l),Object(qe.a)(c))})})),it),Ts),Es=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(){var c=Object(f.a)(v.a.mark((function c(a,s){var i,o,l,d,j,b,h;return v.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return i=e(s),o=i.getTagVisits,l=function(){var e=Object(f.a)(v.a.mark((function e(n,c){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(t,Object(u.a)(Object(u.a)({},r),{},{page:n,itemsPerPage:c})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),d=ds(n,function(){var e=Object(f.a)(v.a.mark((function e(r){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(t,r));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),j=function(){return s().tagVisits.cancelLoad},b={tag:t,query:r},h={start:ys,large:ks,finish:Ns,error:Cs,progress:_s,fallbackToInterval:Us},c.abrupt("return",us(l,d,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},Ds=Object(gt.a)(ws),Ls="shlink/orphanVisits/GET_ORPHAN_VISITS_START",Vs="shlink/orphanVisits/GET_ORPHAN_VISITS_ERROR",Is="shlink/orphanVisits/GET_ORPHAN_VISITS",Fs="shlink/orphanVisits/GET_ORPHAN_VISITS_LARGE",As="shlink/orphanVisits/GET_ORPHAN_VISITS_CANCEL",Ms="shlink/orphanVisits/GET_ORPHAN_VISITS_PROGRESS_CHANGED",Gs="shlink/orphanVisits/GET_ORPHAN_VISITS_FALLBACK_TO_INTERVAL",Ps={visits:[],loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},Bs=Object(gt.b)((ot={},Object(l.a)(ot,Ls,(function(){return Object(u.a)(Object(u.a)({},Ps),{},{loading:!0})})),Object(l.a)(ot,Vs,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},Ps),{},{error:!0,errorData:r})})),Object(l.a)(ot,Is,(function(e,t){var r=t.visits,n=t.query;return Object(u.a)(Object(u.a)({},e),{},{visits:r,query:n,loading:!1,error:!1})})),Object(l.a)(ot,Fs,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(ot,As,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(ot,Ms,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(ot,Gs,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(ot,mr,(function(e,t){var r=t.createdVisits,n=e.visits,c=e.query,a=void 0===c?{}:c,s=a.startDate,i=a.endDate,o=r.filter((function(e){var t=e.visit;return!e.shortUrl&&he(t.date,s,i)})).map((function(e){return e.visit}));return Object(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(qe.a)(o),Object(qe.a)(n))})})),ot),Ps),Hs=function(e,t){return!t||t===e.type},Ws=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(){var c=Object(f.a)(v.a.mark((function c(a,s){var i,o,l,d,j,b,h;return v.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return i=e(s),o=i.getOrphanVisits,l=function(){var e=Object(f.a)(v.a.mark((function e(n,c){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(Object(u.a)(Object(u.a)({},t),{},{page:n,itemsPerPage:c})).then((function(e){var t=e.data.filter((function(e){return xa(e)&&Hs(e,r)}));return Object(u.a)(Object(u.a)({},e),{},{data:t})})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),d=ds(n,o),j=function(){return s().orphanVisits.cancelLoad},b={query:t},h={start:Ls,large:Fs,finish:Is,error:Vs,progress:Ms,fallbackToInterval:Gs},c.abrupt("return",us(l,d,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},qs=Object(gt.a)(As),zs="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_START",Ks="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_ERROR",Qs="shlink/orphanVisits/GET_NON_ORPHAN_VISITS",Js="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_LARGE",Zs="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_CANCEL",Ys="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_PROGRESS_CHANGED",Xs="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_FALLBACK_TO_INTERVAL",$s={visits:[],loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},ei=Object(gt.b)((lt={},Object(l.a)(lt,zs,(function(){return Object(u.a)(Object(u.a)({},$s),{},{loading:!0})})),Object(l.a)(lt,Ks,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},$s),{},{error:!0,errorData:r})})),Object(l.a)(lt,Qs,(function(e,t){var r=t.visits,n=t.query;return Object(u.a)(Object(u.a)({},e),{},{visits:r,query:n,loading:!1,error:!1})})),Object(l.a)(lt,Js,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(lt,Zs,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(lt,Ys,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(lt,Xs,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(lt,mr,(function(e,t){var r=t.createdVisits,n=e.visits,c=e.query,a=void 0===c?{}:c,s=a.startDate,i=a.endDate,o=r.filter((function(e){var t=e.visit;return he(t.date,s,i)})).map((function(e){return e.visit}));return Object(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(qe.a)(o),Object(qe.a)(n))})})),lt),$s),ti=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(){var n=Object(f.a)(v.a.mark((function n(c,a){var s,i,o,l,d,j,b;return v.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=e(a),i=s.getNonOrphanVisits,o=function(){var e=Object(f.a)(v.a.mark((function e(r,n){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i(Object(u.a)(Object(u.a)({},t),{},{page:r,itemsPerPage:n})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),l=ds(r,i),d=function(){return a().orphanVisits.cancelLoad},j={query:t},b={start:zs,large:Js,finish:Qs,error:Ks,progress:Ys,fallbackToInterval:Xs},n.abrupt("return",us(o,l,j,b,c,d));case 7:case"end":return n.stop()}}),n)})));return function(e,t){return n.apply(this,arguments)}}()}},ri=Object(gt.a)(Zs),ni=["visitsCount","orphanVisitsCount"],ci="shlink/visitsOverview/GET_OVERVIEW_START",ai="shlink/visitsOverview/GET_OVERVIEW_ERROR",si="shlink/visitsOverview/GET_OVERVIEW",ii={visitsCount:0,orphanVisitsCount:0,loading:!1,error:!1},oi=Object(gt.b)((ut={},Object(l.a)(ut,ci,(function(){return Object(u.a)(Object(u.a)({},ii),{},{loading:!0})})),Object(l.a)(ut,ai,(function(){return Object(u.a)(Object(u.a)({},ii),{},{error:!0})})),Object(l.a)(ut,si,(function(e,t){var r=t.visitsCount,n=t.orphanVisitsCount;return Object(u.a)(Object(u.a)({},ii),{},{visitsCount:r,orphanVisitsCount:n})})),Object(l.a)(ut,mr,(function(e,t){var r=e.visitsCount,n=e.orphanVisitsCount,c=void 0===n?0:n,a=Object(x.a)(e,ni),s=t.createdVisits,i=pa(s),o=i.regularVisits,l=i.orphanVisits;return Object(u.a)(Object(u.a)({},a),{},{visitsCount:r+o.length,orphanVisitsCount:c+l.length})})),ut),ii),li=function(e){return function(){return function(){var t=Object(f.a)(v.a.mark((function t(r,n){var c,a,s;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r({type:ci}),t.prev=1,c=e(n),a=c.getVisitsOverview,t.next=5,a();case 5:s=t.sent,r(Object(u.a)({type:si},s)),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(1),r({type:ai});case 12:case"end":return t.stop()}}),t,null,[[1,9]])})));return function(e,r){return t.apply(this,arguments)}}()}},ui=Object(m.a)((function e(t,r){var n=this;Object(g.a)(this,e),this.window=t,this.csvjson=r,this.exportVisits=function(e,t){if(t.length){var r=n.csvjson.toCSV(t,{headers:"key"});Object(mc.a)(n.window,r,e)}}})),di=function(e,t){e.serviceFactory("MapModal",(function(){return wc})),e.serviceFactory("ShortUrlVisits",$a,"VisitsExporter"),e.decorator("ShortUrlVisits",t(["shortUrlVisits","shortUrlDetail","mercureInfo","settings","selectedServer"],["getShortUrlVisits","getShortUrlDetail","cancelGetShortUrlVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("TagVisits",ts,"ColorGenerator","VisitsExporter"),e.decorator("TagVisits",t(["tagVisits","mercureInfo","settings","selectedServer"],["getTagVisits","cancelGetTagVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("OrphanVisits",ns,"VisitsExporter"),e.decorator("OrphanVisits",t(["orphanVisits","mercureInfo","settings","selectedServer"],["getOrphanVisits","cancelGetOrphanVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("NonOrphanVisits",as,"VisitsExporter"),e.decorator("NonOrphanVisits",t(["nonOrphanVisits","mercureInfo","settings","selectedServer"],["getNonOrphanVisits","cancelGetNonOrphanVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("VisitsParser",(function(){return n})),e.service("VisitsExporter",ui,"window","csvjson"),e.serviceFactory("getShortUrlVisits",ps,"buildShlinkApiClient"),e.serviceFactory("cancelGetShortUrlVisits",(function(){return Ss})),e.serviceFactory("getTagVisits",Es,"buildShlinkApiClient"),e.serviceFactory("cancelGetTagVisits",(function(){return Ds})),e.serviceFactory("getOrphanVisits",Ws,"buildShlinkApiClient"),e.serviceFactory("cancelGetOrphanVisits",(function(){return qs})),e.serviceFactory("getNonOrphanVisits",ti,"buildShlinkApiClient"),e.serviceFactory("cancelGetNonOrphanVisits",(function(){return ri})),e.serviceFactory("createNewVisits",(function(){return gr})),e.serviceFactory("loadVisitsOverview",li,"buildShlinkApiClient")},ji=r(194),bi=r.n(ji),hi=function(e){var t=e.tag,r=e.colorGenerator;return Object(z.jsx)("div",{style:{backgroundColor:r.getColorForKey(t)},className:"tag-bullet"})},Oi=function(e){return{id:e,name:e}},vi=function(e){return function(t){var r,n,c=t.selectedTags,a=t.onChange,s=t.placeholder,i=t.listTags,o=t.tagsList,l=t.settings;Object(H.useEffect)((function(){i()}),[]);var u=null!==(r=null===(n=l.shortUrlCreation)||void 0===n?void 0:n.tagFilteringMode)&&void 0!==r?r:"startsWith";return Object(z.jsx)(bi.a,{tags:c.map(Oi),tagComponent:function(t){var r=t.tag,n=t.onDelete;return Object(z.jsx)(Q,{colorGenerator:e,text:r.name,clearable:!0,className:"react-tags__tag",onClose:n})},suggestions:o.tags.filter((function(e){return!c.includes(e)})).map(Oi),suggestionComponent:function(t){var r=t.item;return Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)(hi,{tag:"".concat(r.name),colorGenerator:e}),r.name]})},allowNew:!0,addOnBlur:!0,placeholderText:null!==s&&void 0!==s?s:"Add tags to the URL",minQueryLength:1,delimiters:["Enter","Tab",","],suggestionsTransform:"includes"===u?function(e,t){return t.filter((function(t){return t.name.includes(e)}))}:void 0,onDelete:function(e){var t=Object(qe.a)(c);t.splice(e,1),a(t)},onAddition:function(e){var t=e.name;return a(Object(qe.a)(new Set([].concat(Object(qe.a)(c),Object(qe.a)(t.toLowerCase().split(","))))))}})}},fi=function(e,t,r){return function(n){var c=n.tag,a=n.selectedServer,s=n.displayed,o=n.toggle,l=Object(Z.f)(),u=Object(N.a)(l,2),d=u[0],j=u[1],b=Object(Z.f)(),O=Object(N.a)(b,2),v=O[0],f=O[1],m=Object(Z.f)(),g=Object(N.a)(m,3),x=g[0],p=g[2],S=Object(H.useRef)(),y=Object(h.a)(a);return Object(H.useEffect)((function(){var e;(e=S.current)&&e.scrollWidth>e.clientWidth&&p()}),[S.current]),Object(z.jsxs)(J.d,{className:"tag-card",children:[Object(z.jsxs)(J.g,{className:"tag-card__header",children:[Object(z.jsx)(J.b,{color:"link",size:"sm",className:"tag-card__btn tag-card__btn--last",onClick:j,children:Object(z.jsx)(G.a,{icon:M.R})}),Object(z.jsx)(J.b,{color:"link",size:"sm",className:"tag-card__btn",onClick:f,children:Object(z.jsx)(G.a,{icon:M.D})}),Object(z.jsxs)("h5",{className:"tag-card__tag-title text-ellipsis",title:x?c.tag:void 0,ref:function(e){S.current=null!==e&&void 0!==e?e:void 0},children:[Object(z.jsx)(hi,{tag:c.tag,colorGenerator:r}),Object(z.jsx)("span",{className:"tag-card__tag-name",onClick:o,children:c.tag})]})]}),Object(z.jsx)(J.j,{isOpen:s,children:Object(z.jsxs)(J.e,{className:"tag-card__body",children:[Object(z.jsxs)(i.b,{to:"/server/".concat(y,"/list-short-urls/1?tags=").concat(encodeURIComponent(c.tag)),className:"btn btn-outline-secondary btn-block d-flex justify-content-between align-items-center mb-1",children:[Object(z.jsxs)("span",{className:"text-ellipsis",children:[Object(z.jsx)(G.a,{icon:M.w,className:"me-2"}),"Short URLs"]}),Object(z.jsx)("b",{children:It(c.shortUrls)})]}),Object(z.jsxs)(i.b,{to:"/server/".concat(y,"/tag/").concat(c.tag,"/visits"),className:"btn btn-outline-secondary btn-block d-flex justify-content-between align-items-center",children:[Object(z.jsxs)("span",{className:"text-ellipsis",children:[Object(z.jsx)(G.a,{icon:M.q,className:"me-2"}),"Visits"]}),Object(z.jsx)("b",{children:It(c.visits)})]})]})}),Object(z.jsx)(e,{tag:c.tag,toggle:j,isOpen:d}),Object(z.jsx)(t,{tag:c.tag,toggle:f,isOpen:v})]})}},mi=function(e){var t=e.tag,r=e.toggle,n=e.isOpen,c=e.deleteTag,a=e.tagDelete,s=e.tagDeleted,i=a.deleting,o=a.error,l=a.errorData,u=function(){var e=Object(f.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c(t);case 2:s(t),r();case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(z.jsxs)(J.t,{toggle:r,isOpen:n,centered:!0,children:[Object(z.jsx)(J.w,{toggle:r,children:Object(z.jsx)("span",{className:"text-danger",children:"Delete tag"})}),Object(z.jsxs)(J.u,{children:["Are you sure you want to delete tag ",Object(z.jsx)("b",{children:t}),"?",o&&Object(z.jsx)(or,{type:"error",small:!0,className:"mt-2",children:Object(z.jsx)(dr,{errorData:l,fallbackMessage:"Something went wrong while deleting the tag :("})})]}),Object(z.jsxs)(J.v,{children:[Object(z.jsx)("button",{className:"btn btn-link",onClick:r,children:"Cancel"}),Object(z.jsx)("button",{className:"btn btn-danger",disabled:i,onClick:u,children:i?"Deleting tag...":"Delete tag"})]})]})},gi=r(195),xi=function(e){var t=e.getColorForKey;return function(e){var r=e.tag,n=e.editTag,c=e.toggle,a=e.tagEdited,s=e.isOpen,i=e.tagEdit,o=Object(H.useState)(r),l=Object(N.a)(o,2),u=l[0],d=l[1],j=Object(H.useState)(t(r)),b=Object(N.a)(j,2),h=b[0],O=b[1],m=Object(Z.f)(),g=Object(N.a)(m,4),x=g[0],p=g[1],S=g[3],y=i.editing,C=i.error,k=i.errorData,w=Object(sr.b)(Object(f.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n(r,u,h).then((function(){return a(r,u,h)})).then(c).catch((function(){})));case 1:case"end":return e.stop()}}),e)}))));return Object(z.jsx)(J.t,{isOpen:s,toggle:c,centered:!0,onClosed:S,children:Object(z.jsxs)("form",{onSubmit:w,children:[Object(z.jsx)(J.w,{toggle:c,children:"Edit tag"}),Object(z.jsxs)(J.u,{children:[Object(z.jsxs)(J.q,{children:[Object(z.jsx)("div",{id:"colorPickerBtn",className:"input-group-text edit-tag-modal__color-picker-toggle",style:{backgroundColor:h,borderColor:h},onClick:p,children:Object(z.jsx)(G.a,{icon:M.B,className:"edit-tag-modal__color-icon"})}),Object(z.jsx)(J.G,{isOpen:x,toggle:p,target:"colorPickerBtn",placement:"right",hideArrow:!0,popperClassName:"edit-tag-modal__popover",children:Object(z.jsx)(gi.a,{color:h,onChange:O})}),Object(z.jsx)(J.p,{value:u,placeholder:"Tag",required:!0,onChange:function(e){var t=e.target;return d(t.value)}})]}),C&&Object(z.jsx)(or,{type:"error",small:!0,className:"mt-2",children:Object(z.jsx)(dr,{errorData:k,fallbackMessage:"Something went wrong while editing the tag :("})})]}),Object(z.jsxs)(J.v,{children:[Object(z.jsx)(J.b,{type:"button",color:"link",onClick:c,children:"Cancel"}),Object(z.jsx)(J.b,{color:"primary",disabled:y,children:y?"Saving...":"Save"})]})]})})}},pi={tag:"Tag",shortUrls:"Short URLs",visits:"Visits"},Si=function(e){var t,r=e.mode,n=e.onChange,c=e.renderTitle;return Object(z.jsxs)(Y,{text:null!==(t=null===c||void 0===c?void 0:c(r))&&void 0!==t?t:"Display mode: ".concat(r),children:[Object(z.jsxs)(J.l,{active:"cards"===r,onClick:function(){return n("cards")},children:[Object(z.jsx)(G.a,{icon:M.P,fixedWidth:!0,className:"me-1"})," Cards"]}),Object(z.jsxs)(J.l,{active:"list"===r,onClick:function(){return n("list")},children:[Object(z.jsx)(G.a,{icon:M.c,fixedWidth:!0,className:"me-1"})," List"]})]})},yi=function(e,t){return Je((function(r){var n,c,a,s,i=r.filterTags,o=r.forceListTags,l=r.tagsList,u=r.selectedServer,d=r.settings,j=Object(H.useState)(null!==(n=null===(c=d.tags)||void 0===c?void 0:c.defaultMode)&&void 0!==n?n:"cards"),b=Object(N.a)(j,2),h=b[0],O=b[1],v=Object(H.useState)(null!==(a=null===(s=d.tags)||void 0===s?void 0:s.defaultOrdering)&&void 0!==a?a:{}),f=Object(N.a)(v,2),m=f[0],g=f[1],x=Object(P.a)((function(){return l.filteredTags.map((function(e){var t,r,n,c;return{tag:e,shortUrls:null!==(t=null===(r=l.stats[e])||void 0===r?void 0:r.shortUrlsCount)&&void 0!==t?t:0,visits:null!==(n=null===(c=l.stats[e])||void 0===c?void 0:c.visitsCount)&&void 0!==n?n:0}}))}),(function(e){return w(e,m)}));if(Object(H.useEffect)((function(){o()}),[]),l.loading)return Object(z.jsx)(on.a,{loading:!0});if(l.error)return Object(z.jsx)(or,{type:"error",children:Object(z.jsx)(dr,{errorData:l.errorData,fallbackMessage:"Error loading tags :("})});var p=function(e){return function(){var t=k(e,m.field,m.dir);g({field:t?e:void 0,dir:t})}};return Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)(K,{className:"mb-3",onChange:i}),Object(z.jsxs)(J.I,{className:"mb-3",children:[Object(z.jsx)("div",{className:"col-lg-6",children:Object(z.jsx)(Si,{mode:h,onChange:O})}),Object(z.jsx)("div",{className:"col-lg-6 mt-3 mt-lg-0",children:Object(z.jsx)(Ke,{items:pi,order:m,onChange:function(e,t){return g({field:e,dir:t})}})})]}),function(){if(l.filteredTags.length<1)return Object(z.jsx)(on.a,{children:"No tags found"});var r=x();return"cards"===h?Object(z.jsx)(e,{sortedTags:r,selectedServer:u}):Object(z.jsx)(t,{sortedTags:r,selectedServer:u,currentOrder:m,orderByColumn:p})}()]})}),(function(){return[Ze.visits]}))},Ci="shlink/deleteTag/DELETE_TAG_START",Ni="shlink/deleteTag/DELETE_TAG_ERROR",ki="shlink/deleteTag/DELETE_TAG",wi="shlink/deleteTag/TAG_DELETED",_i=Object(gt.b)((dt={},Object(l.a)(dt,Ci,(function(){return{deleting:!0,error:!1}})),Object(l.a)(dt,Ni,(function(e,t){return{deleting:!1,error:!0,errorData:t.errorData}})),Object(l.a)(dt,ki,(function(){return{deleting:!1,error:!1}})),dt),{deleting:!1,error:!1}),Ui=function(e){return function(t){return function(){var r=Object(f.a)(v.a.mark((function r(n,c){var a,s;return v.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n({type:Ci}),a=e(c),s=a.deleteTags,r.prev=2,r.next=5,s([t]);case 5:n({type:ki}),r.next=12;break;case 8:throw r.prev=8,r.t0=r.catch(2),n({type:Ni,errorData:lr(r.t0)}),r.t0;case 12:case"end":return r.stop()}}),r,null,[[2,8]])})));return function(e,t){return r.apply(this,arguments)}}()}},Ti=function(e){return{type:wi,tag:e}},Ri="shlink/editTag/EDIT_TAG_START",Ei="shlink/editTag/EDIT_TAG_ERROR",Di="shlink/editTag/EDIT_TAG",Li="shlink/editTag/TAG_EDITED",Vi=Object(gt.b)((jt={},Object(l.a)(jt,Ri,(function(e){return Object(u.a)(Object(u.a)({},e),{},{editing:!0,error:!1})})),Object(l.a)(jt,Ei,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{editing:!1,error:!0,errorData:r})})),Object(l.a)(jt,Di,(function(e,t){return Object(u.a)(Object(u.a)({},Object(j.a)(["oldName","newName"],t)),{},{editing:!1,error:!1})})),jt),{oldName:"",newName:"",editing:!1,error:!1}),Ii=function(e,t){return function(r,n,c){return function(){var a=Object(f.a)(v.a.mark((function a(s,i){var o,l;return v.a.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return s({type:Ri}),o=e(i),l=o.editTag,a.prev=2,a.next=5,l(r,n);case 5:t.setColorForKey(n,c),s({type:Di,oldName:r,newName:n}),a.next=13;break;case 9:throw a.prev=9,a.t0=a.catch(2),s({type:Ei,errorData:lr(a.t0)}),a.t0;case 13:case"end":return a.stop()}}),a,null,[[2,9]])})));return function(e,t){return a.apply(this,arguments)}}()}},Fi=function(e,t,r){return{type:Li,oldName:e,newName:t,color:r}},Ai=["tags"],Mi="shlink/tagsList/LIST_TAGS_START",Gi="shlink/tagsList/LIST_TAGS_ERROR",Pi="shlink/tagsList/LIST_TAGS",Bi="shlink/tagsList/FILTER_TAGS",Hi={tags:[],filteredTags:[],stats:{},loading:!1,error:!1},Wi=function(e,t){return function(r){return r===e?t:r}},qi=function(e,t){return Object(p.a)((function(e){return e===t}),e)},zi=function(e){return Object.entries(e.reduce((function(e,t){var r=t.shortUrl;return null===r||void 0===r||r.tags.forEach((function(t){e[t]=(e[t]||0)+1})),e}),{}))},Ki=Object(gt.b)((bt={},Object(l.a)(bt,Mi,(function(){return Object(u.a)(Object(u.a)({},Hi),{},{loading:!0})})),Object(l.a)(bt,Gi,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},Hi),{},{error:!0,errorData:r})})),Object(l.a)(bt,Pi,(function(e,t){var r=t.tags,n=t.stats;return Object(u.a)(Object(u.a)({},Hi),{},{stats:n,tags:r,filteredTags:r})})),Object(l.a)(bt,wi,(function(e,t){var r=t.tag;return Object(u.a)(Object(u.a)({},e),{},{tags:qi(e.tags,r),filteredTags:qi(e.filteredTags,r)})})),Object(l.a)(bt,Li,(function(e,t){var r=t.oldName,n=t.newName;return Object(u.a)(Object(u.a)({},e),{},{tags:e.tags.map(Wi(r,n)).sort(),filteredTags:e.filteredTags.map(Wi(r,n)).sort()})})),Object(l.a)(bt,Bi,(function(e,t){var r=t.searchTerm;return Object(u.a)(Object(u.a)({},e),{},{filteredTags:e.tags.filter((function(e){return e.toLowerCase().match(r)}))})})),Object(l.a)(bt,mr,(function(e,t){var r,n,c=t.createdVisits;return Object(u.a)(Object(u.a)({},e),{},{stats:(r=zi(c),n=e.stats,r.reduce((function(e,t){var r=Object(N.a)(t,2),n=r[0],c=r[1];if(!e[n])return e;var a=e[n];return a.visitsCount=a.visitsCount+c,e[n]=a,e}),Object(u.a)({},n)))})})),Object(l.a)(bt,Tr,(function(e,t){var r=e.tags,n=Object(x.a)(e,Ai),c=t.result;return Object(u.a)(Object(u.a)({},n),{},{tags:r.concat(c.tags.filter((function(e){return!r.includes(e)})))})})),bt),Hi),Qi=function(e){return{type:Bi,searchTerm:e}},Ji=Math.ceil,Zi=function(e){return function(t){var r=t.sortedTags,n=t.selectedServer,c=Object(H.useState)(),a=Object(N.a)(c,2),s=a[0],i=a[1],o=r.length,l=Object(ja.a)(Ji(o/4),r);return Object(z.jsx)(J.I,{children:l.map((function(t,r){return Object(z.jsx)("div",{className:"col-md-6 col-xl-3",children:t.map((function(t){return Object(z.jsx)(e,{tag:t,selectedServer:n,displayed:s===t.tag,toggle:function(){return i(s!==t.tag?t.tag:void 0)}},t.tag)}))},r)}))})}},Yi=function(e){return function(t){var r,n=t.sortedTags,c=t.selectedServer,a=t.orderByColumn,s=t.currentOrder,i=Object(H.useRef)(!0),o=Object(Me.f)().search,l=Object(C.a)(o).page,u=void 0===l?1:l,d=Object(Z.c)("page",Number(u)),j=Object(N.a)(d,2),b=j[0],h=j[1],O=Object(ja.a)(20,n),v=O.length>1,f=null!==(r=O[b-1])&&void 0!==r?r:[];return Object(H.useEffect)((function(){!i.current&&h(1),i.current=!1}),[n]),Object(H.useEffect)((function(){scrollTo(0,0)}),[b]),Object(z.jsxs)(ir.a,{bodyClassName:v?"pb-1":"",children:[Object(z.jsxs)("table",{className:"table table-hover responsive-table mb-0",children:[Object(z.jsxs)("thead",{className:"responsive-table__header",children:[Object(z.jsxs)("tr",{children:[Object(z.jsxs)("th",{className:"tags-table__header-cell",onClick:a("tag"),children:["Tag ",Object(z.jsx)(Ye,{currentOrder:s,field:"tag"})]}),Object(z.jsxs)("th",{className:"tags-table__header-cell text-lg-end",onClick:a("shortUrls"),children:["Short URLs ",Object(z.jsx)(Ye,{currentOrder:s,field:"shortUrls"})]}),Object(z.jsxs)("th",{className:"tags-table__header-cell text-lg-end",onClick:a("visits"),children:["Visits ",Object(z.jsx)(Ye,{currentOrder:s,field:"visits"})]}),Object(z.jsx)("th",{className:"tags-table__header-cell"})]}),Object(z.jsx)("tr",{children:Object(z.jsx)("th",{colSpan:4,className:"p-0 border-top-0"})})]}),Object(z.jsxs)("tbody",{children:[0===f.length&&Object(z.jsx)("tr",{children:Object(z.jsx)("td",{colSpan:4,className:"text-center",children:"No results found"})}),f.map((function(t){return Object(z.jsx)(e,{tag:t,selectedServer:c},t.tag)}))]})]}),v&&Object(z.jsx)("div",{className:"sticky-card-paginator",children:Object(z.jsx)(ba,{pagesCount:O.length,currentPage:b,setCurrentPage:h})})]},b)}},Xi=function(e,t,r){return function(n){var c=n.tag,a=n.selectedServer,s=Object(Z.f)(),o=Object(N.a)(s,2),l=o[0],u=o[1],d=Object(Z.f)(),j=Object(N.a)(d,2),b=j[0],O=j[1],v=Object(Z.f)(),f=Object(N.a)(v,2),m=f[0],g=f[1],x=Object(h.a)(a);return Object(z.jsxs)("tr",{className:"responsive-table__row",children:[Object(z.jsxs)("th",{className:"responsive-table__cell","data-th":"Tag",children:[Object(z.jsx)(hi,{tag:c.tag,colorGenerator:r})," ",c.tag]}),Object(z.jsx)("td",{className:"responsive-table__cell text-lg-end","data-th":"Short URLs",children:Object(z.jsx)(i.b,{to:"/server/".concat(x,"/list-short-urls/1?tags=").concat(encodeURIComponent(c.tag)),children:It(c.shortUrls)})}),Object(z.jsx)("td",{className:"responsive-table__cell text-lg-end","data-th":"Visits",children:Object(z.jsx)(i.b,{to:"/server/".concat(x,"/tag/").concat(c.tag,"/visits"),children:It(c.visits)})}),Object(z.jsx)("td",{className:"responsive-table__cell text-lg-end",children:Object(z.jsxs)(nr,{toggle:g,isOpen:m,children:[Object(z.jsxs)(J.l,{onClick:O,children:[Object(z.jsx)(G.a,{icon:M.D,fixedWidth:!0,className:"me-1"})," Edit"]}),Object(z.jsxs)(J.l,{onClick:u,children:[Object(z.jsx)(G.a,{icon:M.R,fixedWidth:!0,className:"me-1"})," Delete"]})]})}),Object(z.jsx)(t,{tag:c.tag,toggle:O,isOpen:b}),Object(z.jsx)(e,{tag:c.tag,toggle:u,isOpen:l})]})}},$i=function(e,t){e.serviceFactory("TagsSelector",vi,"ColorGenerator"),e.decorator("TagsSelector",t(["tagsList","settings"],["listTags"])),e.serviceFactory("TagCard",fi,"DeleteTagConfirmModal","EditTagModal","ColorGenerator"),e.serviceFactory("DeleteTagConfirmModal",(function(){return mi})),e.decorator("DeleteTagConfirmModal",t(["tagDelete"],["deleteTag","tagDeleted"])),e.serviceFactory("EditTagModal",xi,"ColorGenerator"),e.decorator("EditTagModal",t(["tagEdit"],["editTag","tagEdited"])),e.serviceFactory("TagsCards",Zi,"TagCard"),e.serviceFactory("TagsTableRow",Xi,"DeleteTagConfirmModal","EditTagModal","ColorGenerator"),e.serviceFactory("TagsTable",Yi,"TagsTableRow"),e.serviceFactory("TagsList",yi,"TagsCards","TagsTable"),e.decorator("TagsList",t(["tagsList","selectedServer","mercureInfo","settings"],["forceListTags","filterTags","createNewVisits","loadMercureInfo"]));var r=function(e){return function(t){return function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function(){return function(){var r=Object(f.a)(v.a.mark((function r(n,c){var a,s,i,o,l,u,d,j;return v.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a=c(),s=a.tagsList,t||!s.loading&&Object(y.a)(s.tags)){r.next=3;break}return r.abrupt("return");case 3:return n({type:Mi}),r.prev=4,i=e(c),o=i.listTags,r.next=8,o();case 8:l=r.sent,u=l.tags,d=l.stats,j=(void 0===d?[]:d).reduce((function(e,t){var r=t.tag,n=t.shortUrlsCount,c=t.visitsCount;return e[r]={shortUrlsCount:n,visitsCount:c},e}),{}),n({tags:u,stats:j,type:Pi}),r.next=19;break;case 16:r.prev=16,r.t0=r.catch(4),n({type:Gi,errorData:lr(r.t0)});case 19:case"end":return r.stop()}}),r,null,[[4,16]])})));return function(e,t){return r.apply(this,arguments)}}()}}(t.buildShlinkApiClient,e)}};e.factory("listTags",r(!1)),e.factory("forceListTags",r(!0)),e.serviceFactory("filterTags",(function(){return Qi})),e.serviceFactory("tagDeleted",(function(){return Ti})),e.serviceFactory("tagEdited",(function(){return Fi})),e.serviceFactory("deleteTag",Ui,"buildShlinkApiClient"),e.serviceFactory("editTag",Ii,"buildShlinkApiClient","ColorGenerator")},eo=r(196),to="shlink/mercure/GET_MERCURE_INFO_START",ro="shlink/mercure/GET_MERCURE_INFO_ERROR",no="shlink/mercure/GET_MERCURE_INFO",co=Object(gt.b)((ht={},Object(l.a)(ht,to,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!0,error:!1})})),Object(l.a)(ht,ro,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!1,error:!0})})),Object(l.a)(ht,no,(function(e,t){return Object(u.a)(Object(u.a)({},t),{},{loading:!1,error:!1})})),ht),{loading:!0,error:!1}),ao=function(e){return function(){return function(){var t=Object(f.a)(v.a.mark((function t(r,n){var c,a,s,i,o;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r({type:to}),c=n(),a=c.settings,s=e(n),i=s.mercureInfo,a.realTimeUpdates.enabled){t.next=6;break}return r({type:ro}),t.abrupt("return");case 6:return t.prev=6,t.next=9,i();case 9:o=t.sent,r(Object(u.a)({type:no,interval:a.realTimeUpdates.interval},o)),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(6),r({type:ro});case 16:case"end":return t.stop()}}),t,null,[[6,13]])})));return function(e,r){return t.apply(this,arguments)}}()}},so=function(e){e.serviceFactory("loadMercureInfo",ao,"buildShlinkApiClient")},io=function(e){var t=e.children;return Object(z.jsx)("small",{className:"form-text text-muted d-block",children:t})},oo=function(e){var t,r=e.settings.realTimeUpdates,n=e.toggleRealTimeUpdates,c=e.setRealTimeUpdatesInterval;return Object(z.jsxs)(ir.a,{title:"Real-time updates",className:"h-100",children:[Object(z.jsx)(J.o,{children:Object(z.jsxs)(Ie,{checked:r.enabled,onChange:n,children:["Enable or disable real-time updates.",Object(z.jsxs)(io,{children:["Real-time updates are currently being ",Object(z.jsx)("b",{children:r.enabled?"processed":"ignored"}),"."]})]})}),Object(z.jsxs)(xn,{noMargin:!0,label:"Real-time updates frequency (in minutes):",labelClassName:q()("form-label",{"text-muted":!r.enabled}),children:[Object(z.jsx)(J.p,{type:"number",min:0,placeholder:"Immediate",disabled:!r.enabled,value:(t=r.interval,t?"".concat(t):""),onChange:function(e){var t=e.target;return c(Number(t.value))}}),r.enabled&&Object(z.jsxs)(io,{children:[void 0!==r.interval&&r.interval>0&&Object(z.jsxs)("span",{children:["Updates will be reflected in the UI every ",Object(z.jsx)("b",{children:r.interval})," minute",r.interval>1&&"s","."]}),!r.interval&&"Updates will be reflected in the UI as soon as they happen."]})]})]})},lo=function(e){var t=e.items;return Object(z.jsx)(z.Fragment,{children:t.map((function(e,t){return Object(z.jsx)("div",{className:"mb-3",children:e},t)}))})},uo=function(e,t,r,n,c,a){return function(){return Object(z.jsxs)(gn.a,{children:[Object(z.jsxs)(Dc,{className:"mb-3",children:[Object(z.jsx)(Ec,{to:"general",children:"General"}),Object(z.jsx)(Ec,{to:"short-urls",children:"Short URLs"}),Object(z.jsx)(Ec,{to:"other-items",children:"Other items"})]}),Object(z.jsxs)(Me.d,{children:[Object(z.jsx)(Me.b,{path:"general",element:Object(z.jsx)(lo,{items:[Object(z.jsx)(n,{},"one"),Object(z.jsx)(e,{},"two")]})}),Object(z.jsx)(Me.b,{path:"short-urls",element:Object(z.jsx)(lo,{items:[Object(z.jsx)(t,{},"one"),Object(z.jsx)(r,{},"two")]})}),Object(z.jsx)(Me.b,{path:"other-items",element:Object(z.jsx)(lo,{items:[Object(z.jsx)(a,{},"one"),Object(z.jsx)(c,{},"two")]})}),Object(z.jsx)(Me.b,{path:"*",element:Object(z.jsx)(Me.a,{replace:!0,to:"general"})})]})]})}},jo=function(e){return"includes"===e?"Suggest tags including input":"Suggest tags starting with input"},bo=function(e){var t,r,n,c,a,s=e.settings,i=e.setShortUrlCreationSettings,o=null!==(t=s.shortUrlCreation)&&void 0!==t?t:{validateUrls:!1},l=function(e){return function(){return i(Object(u.a)(Object(u.a)({},null!==o&&void 0!==o?o:{validateUrls:!1}),{},{tagFilteringMode:e}))}};return Object(z.jsxs)(ir.a,{title:"Short URLs form",className:"h-100",children:[Object(z.jsx)(J.o,{children:Object(z.jsxs)(Ie,{checked:null!==(r=o.validateUrls)&&void 0!==r&&r,onChange:function(e){return i(Object(u.a)(Object(u.a)({},o),{},{validateUrls:e}))},children:["Request validation on long URLs when creating new short URLs.",Object(z.jsxs)(io,{children:["The initial state of the ",Object(z.jsx)("b",{children:"Validate URL"})," checkbox will be ",Object(z.jsx)("b",{children:o.validateUrls?"checked":"unchecked"}),"."]})]})}),Object(z.jsx)(J.o,{children:Object(z.jsxs)(Ie,{checked:null===(n=o.forwardQuery)||void 0===n||n,onChange:function(e){return i(Object(u.a)(Object(u.a)({},o),{},{forwardQuery:e}))},children:["Make all new short URLs forward their query params to the long URL.",Object(z.jsxs)(io,{children:["The initial state of the ",Object(z.jsx)("b",{children:"Forward query params on redirect"})," checkbox will be ",Object(z.jsx)("b",{children:null===(c=o.forwardQuery)||void 0===c||c?"checked":"unchecked"}),"."]})]})}),Object(z.jsxs)(xn,{noMargin:!0,label:"Tag suggestions search mode:",children:[Object(z.jsxs)(Y,{text:jo(o.tagFilteringMode),children:[Object(z.jsx)(J.l,{active:!o.tagFilteringMode||"startsWith"===o.tagFilteringMode,onClick:l("startsWith"),children:jo("startsWith")}),Object(z.jsx)(J.l,{active:"includes"===o.tagFilteringMode,onClick:l("includes"),children:jo("includes")})]}),Object(z.jsx)(io,{children:(a=o.tagFilteringMode,"includes"===a?Object(z.jsxs)(z.Fragment,{children:["The list of suggested tags will contain those ",Object(z.jsx)("b",{children:"including"})," provided input."]}):Object(z.jsxs)(z.Fragment,{children:["The list of suggested tags will contain those ",Object(z.jsx)("b",{children:"starting with"})," provided input."]}))})]})]})},ho=function(e){var t=e.settings.ui,r=e.setUiSettings;return Object(z.jsxs)(ir.a,{title:"User interface",className:"h-100",children:[Object(z.jsx)(G.a,{icon:"dark"===(null===t||void 0===t?void 0:t.theme)?M.A:M.M,className:"user-interface__theme-icon"}),Object(z.jsx)(Ie,{checked:"dark"===(null===t||void 0===t?void 0:t.theme),onChange:function(e){var n=e?"dark":"light";r(Object(u.a)(Object(u.a)({},t),{},{theme:n})),Object(ta.g)(n)},children:"Use dark theme."})]})},Oo=function(e){var t,r=e.onChange,n=e.active,c=e.allText;return Object(z.jsx)(Y,{text:null!==(t=xe(n))&&void 0!==t?t:c,children:Object(z.jsx)(Te,{allText:c,active:n,onChange:r})})},vo=function(e){var t,r,n=e.settings,c=e.setVisitsSettings;return Object(z.jsx)(ir.a,{title:"Visits",className:"h-100",children:Object(z.jsx)(xn,{noMargin:!0,label:"Default interval to load on visits sections:",children:Object(z.jsx)(Oo,{allText:"All visits",active:null!==(t=null===(r=n.visits)||void 0===r?void 0:r.defaultInterval)&&void 0!==t?t:"last30Days",onChange:function(e){return c({defaultInterval:e})}})})})},fo=function(e){var t,r,n,c=e.settings.tags,a=e.setTagsSettings;return Object(z.jsxs)(ir.a,{title:"Tags",className:"h-100",children:[Object(z.jsxs)(xn,{label:"Default display mode when managing tags:",children:[Object(z.jsx)(Si,{mode:null!==(t=null===c||void 0===c?void 0:c.defaultMode)&&void 0!==t?t:"cards",renderTitle:function(e){return Object(sr.a)(e)},onChange:function(e){return a(Object(u.a)(Object(u.a)({},c),{},{defaultMode:e}))}}),Object(z.jsxs)(io,{children:["Tags will be displayed as ",Object(z.jsx)("b",{children:null!==(r=null===c||void 0===c?void 0:c.defaultMode)&&void 0!==r?r:"cards"}),"."]})]}),Object(z.jsx)(xn,{noMargin:!0,label:"Default ordering for tags list:",children:Object(z.jsx)(Ke,{items:pi,order:null!==(n=null===c||void 0===c?void 0:c.defaultOrdering)&&void 0!==n?n:{},onChange:function(e,t){return a(Object(u.a)(Object(u.a)({},c),{},{defaultOrdering:{field:e,dir:t}}))}})})]})},mo=function(e){var t,r=e.settings.shortUrlsList,n=e.setShortUrlsListSettings;return Object(z.jsx)(ir.a,{title:"Short URLs list",className:"h-100",children:Object(z.jsx)(xn,{noMargin:!0,label:"Default ordering for short URLs list:",children:Object(z.jsx)(Ke,{items:Ht,order:null!==(t=null===r||void 0===r?void 0:r.defaultOrdering)&&void 0!==t?t:pt,onChange:function(e,t){return n({defaultOrdering:{field:e,dir:t}})}})})})},go=function(e,t){e.serviceFactory("Settings",uo,"RealTimeUpdatesSettings","ShortUrlCreationSettings","ShortUrlsListSettings","UserInterfaceSettings","VisitsSettings","TagsSettings"),e.decorator("Settings",lc.a),e.decorator("Settings",t(null,["resetSelectedServer"])),e.serviceFactory("RealTimeUpdatesSettings",(function(){return oo})),e.decorator("RealTimeUpdatesSettings",t(["settings"],["toggleRealTimeUpdates","setRealTimeUpdatesInterval"])),e.serviceFactory("ShortUrlCreationSettings",(function(){return bo})),e.decorator("ShortUrlCreationSettings",t(["settings"],["setShortUrlCreationSettings"])),e.serviceFactory("UserInterfaceSettings",(function(){return ho})),e.decorator("UserInterfaceSettings",t(["settings"],["setUiSettings"])),e.serviceFactory("VisitsSettings",(function(){return vo})),e.decorator("VisitsSettings",t(["settings"],["setVisitsSettings"])),e.serviceFactory("TagsSettings",(function(){return fo})),e.decorator("TagsSettings",t(["settings"],["setTagsSettings"])),e.serviceFactory("ShortUrlsListSettings",(function(){return mo})),e.decorator("ShortUrlsListSettings",t(["settings"],["setShortUrlsListSettings"])),e.serviceFactory("toggleRealTimeUpdates",(function(){return Ct})),e.serviceFactory("setRealTimeUpdatesInterval",(function(){return Nt})),e.serviceFactory("setShortUrlCreationSettings",(function(){return kt})),e.serviceFactory("setShortUrlsListSettings",(function(){return wt})),e.serviceFactory("setUiSettings",(function(){return _t})),e.serviceFactory("setVisitsSettings",(function(){return Ut})),e.serviceFactory("setTagsSettings",(function(){return Tt}))},xo=r(199),po=function(e,t){var r=e.split("://"),n=Object(N.a)(r,2),c=n[0],a=n[1].split("/"),s=Object(xo.a)(a).slice(1),i=s.length?"/".concat(s.join("/")):"";return"".concat(c,"://").concat(t).concat(i)},So="shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS",yo=function(e){return function(t,r){return function(){var n=Object(f.a)(v.a.mark((function n(c,a){var s,i,o;return v.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return c({type:"shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS_START"}),s=e(a),i=s.editDomainRedirects,n.prev=2,n.next=5,i(Object(u.a)({domain:t},r));case 5:o=n.sent,c({type:So,domain:t,redirects:o}),n.next=12;break;case 9:n.prev=9,n.t0=n.catch(2),c({type:"shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS_ERROR",errorData:lr(n.t0)});case 12:case"end":return n.stop()}}),n,null,[[2,9]])})));return function(e,t){return n.apply(this,arguments)}}()}},Co=["url"],No="shlink/domainsList/LIST_DOMAINS_START",ko="shlink/domainsList/LIST_DOMAINS_ERROR",wo="shlink/domainsList/LIST_DOMAINS",_o="shlink/domainsList/FILTER_DOMAINS",Uo="shlink/domainsList/VALIDATE_DOMAIN",To={domains:[],filteredDomains:[],loading:!1,error:!1},Ro=function(e,t){return function(r){return r.domain!==e?r:Object(u.a)(Object(u.a)({},r),{},{redirects:t})}},Eo=function(e,t){return function(r){return r.domain!==e?r:Object(u.a)(Object(u.a)({},r),{},{status:t})}},Do=Object(gt.b)((Ot={},Object(l.a)(Ot,No,(function(){return Object(u.a)(Object(u.a)({},To),{},{loading:!0})})),Object(l.a)(Ot,ko,(function(e){var t=e.errorData;return Object(u.a)(Object(u.a)({},To),{},{error:!0,errorData:t})})),Object(l.a)(Ot,wo,(function(e,t){var r=t.domains,n=t.defaultRedirects;return Object(u.a)(Object(u.a)({},To),{},{domains:r,filteredDomains:r,defaultRedirects:n})})),Object(l.a)(Ot,_o,(function(e,t){var r=t.searchTerm;return Object(u.a)(Object(u.a)({},e),{},{filteredDomains:e.domains.filter((function(e){return e.domain.toLowerCase().match(r)}))})})),Object(l.a)(Ot,So,(function(e,t){var r=t.domain,n=t.redirects;return Object(u.a)(Object(u.a)({},e),{},{domains:e.domains.map(Ro(r,n)),filteredDomains:e.filteredDomains.map(Ro(r,n))})})),Object(l.a)(Ot,Uo,(function(e,t){var r=t.domain,n=t.status;return Object(u.a)(Object(u.a)({},e),{},{domains:e.domains.map(Eo(r,n)),filteredDomains:e.filteredDomains.map(Eo(r,n))})})),Ot),To),Lo=function(e){return function(){return function(){var t=Object(f.a)(v.a.mark((function t(r,n){var c,a,s,i,o;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r({type:No}),c=e(n),a=c.listDomains,t.prev=2,t.next=5,a().then((function(e){var t=e.data,r=e.defaultRedirects;return{domains:t.map((function(e){return Object(u.a)(Object(u.a)({},e),{},{status:"validating"})})),defaultRedirects:r}}));case 5:s=t.sent,i=s.domains,o=s.defaultRedirects,r({type:wo,domains:i,defaultRedirects:o}),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(2),r({type:ko,errorData:lr(t.t0)});case 14:case"end":return t.stop()}}),t,null,[[2,11]])})));return function(e,r){return t.apply(this,arguments)}}()}},Vo=function(e){return{type:_o,searchTerm:e}},Io=function(e){return function(t){return function(){var r=Object(f.a)(v.a.mark((function r(n,c){var a,s,i,o,l,d,j,b;return v.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a=c(),s=a.selectedServer,Object(h.b)(s)){r.next=4;break}return n({type:Uo,domain:t,status:"invalid"}),r.abrupt("return");case 4:return r.prev=4,i=s.url,o=Object(x.a)(s,Co),l=e(Object(u.a)(Object(u.a)({},o),{},{url:po(i,t)})),d=l.health,r.next=9,d();case 9:j=r.sent,b=j.status,n({type:Uo,domain:t,status:"pass"===b?"valid":"invalid"}),r.next=17;break;case 14:r.prev=14,r.t0=r.catch(4),n({type:Uo,domain:t,status:"invalid"});case 17:case"end":return r.stop()}}),r,null,[[4,14]])})));return function(e,t){return r.apply(this,arguments)}}()}},Fo=function(e){var t=e.listDomains,r=e.value,n=e.domainsList,c=e.onChange,a=Object(Z.f)(),s=Object(N.a)(a,4),i=s[0],o=s[2],l=s[3],u=n.domains,d=Object(y.a)(r),j=function(){return c("")};return Object(H.useEffect)((function(){t()}),[]),i?Object(z.jsxs)(J.q,{children:[Object(z.jsx)(J.p,{value:null!==r&&void 0!==r?r:"",placeholder:"Domain",onChange:function(e){return c(e.target.value)}}),Object(z.jsx)(J.b,{id:"backToDropdown",outline:!0,type:"button",className:"domains-dropdown__back-btn",onClick:Object(P.a)(j,l),children:Object(z.jsx)(G.a,{icon:M.S})}),Object(z.jsx)(J.L,{target:"backToDropdown",placement:"left",trigger:"hover",children:"Existing domains"})]}):Object(z.jsxs)(Y,{text:d?"Domain":"Domain: ".concat(r),className:d?"domains-dropdown__toggle-btn":"domains-dropdown__toggle-btn--active",children:[u.map((function(e){var t=e.domain,n=e.isDefault;return Object(z.jsxs)(J.l,{active:r===t||n&&d,onClick:function(){return c(t)},children:[t,n&&Object(z.jsx)("span",{className:"float-end text-muted",children:"default"})]},t)})),Object(z.jsx)(J.l,{divider:!0}),Object(z.jsx)(J.l,{onClick:Object(P.a)(j,o),children:Object(z.jsx)("i",{children:"New domain"})})]})},Ao=["isLast"],Mo=function(e){var t=e.isLast,r=Object(x.a)(e,Ao);return Object(z.jsx)(pn,Object(u.a)(Object(u.a)({},r),{},{required:!1,type:"url",placeholder:"No redirect",className:t?"mb-0":""}))},Go=function(e){var t,r,n,c,a,s,i=e.isOpen,o=e.toggle,l=e.domain,u=e.editDomainRedirects,d=Object(H.useState)(null!==(t=null===(r=l.redirects)||void 0===r?void 0:r.baseUrlRedirect)&&void 0!==t?t:""),j=Object(N.a)(d,2),b=j[0],h=j[1],O=Object(H.useState)(null!==(n=null===(c=l.redirects)||void 0===c?void 0:c.regular404Redirect)&&void 0!==n?n:""),m=Object(N.a)(O,2),g=m[0],x=m[1],p=Object(H.useState)(null!==(a=null===(s=l.redirects)||void 0===s?void 0:s.invalidShortUrlRedirect)&&void 0!==a?a:""),S=Object(N.a)(p,2),y=S[0],C=S[1],k=Object(sr.b)(Object(f.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",u(l.domain,{baseUrlRedirect:Object(sr.d)(b),regular404Redirect:Object(sr.d)(g),invalidShortUrlRedirect:Object(sr.d)(y)}).then(o));case 1:case"end":return e.stop()}}),e)}))));return Object(z.jsx)(J.t,{isOpen:i,toggle:o,centered:!0,children:Object(z.jsxs)("form",{onSubmit:k,children:[Object(z.jsxs)(J.w,{toggle:o,children:["Edit redirects for ",Object(z.jsx)("b",{children:l.domain})]}),Object(z.jsxs)(J.u,{children:[Object(z.jsxs)(Mo,{value:b,onChange:h,children:[Object(z.jsxs)(tn,{className:"me-2",placement:"bottom",children:["Visitors accessing the base url, as in ",Object(z.jsxs)("b",{children:["https://",l.domain,"/"]}),", will be redirected to this URL."]}),"Base URL"]}),Object(z.jsxs)(Mo,{value:g,onChange:x,children:[Object(z.jsxs)(tn,{className:"me-2",placement:"bottom",children:["Visitors accessing a url not matching a short URL pattern, as in ",Object(z.jsxs)("b",{children:["https://",l.domain,"/???/[...]"]}),", will be redirected to this URL."]}),"Regular 404"]}),Object(z.jsxs)(Mo,{value:y,isLast:!0,onChange:C,children:[Object(z.jsx)(tn,{className:"me-2",placement:"bottom",children:"Visitors accessing a url matching a short URL pattern, but not matching an existing short code, will be redirected to this URL."}),"Invalid short URL"]})]}),Object(z.jsxs)(J.v,{children:[Object(z.jsx)(J.b,{color:"link",type:"button",onClick:o,children:"Cancel"}),Object(z.jsx)(J.b,{color:"primary",children:"Save"})]})]})})},Po=function(e){var t=e.status,r=e.matchMedia,n=void 0===r?window.matchMedia:r,c=Object(H.useRef)(),a=function(){return n("(max-width: 991px)").matches},s=Object(H.useState)(a()),i=Object(N.a)(s,2),o=i[0],l=i[1];return Object(H.useEffect)((function(){var e=function(){return l(a())};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),"validating"===t?Object(z.jsx)(G.a,{fixedWidth:!0,icon:M.k,spin:!0}):Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)("span",{ref:function(e){c.current=e},children:"valid"===t?Object(z.jsx)(G.a,{fixedWidth:!0,icon:M.h,className:"text-muted"}):Object(z.jsx)(G.a,{fixedWidth:!0,icon:M.Q,className:"text-danger"})}),Object(z.jsx)(J.L,{target:function(){return c.current},placement:o?"top-start":"left",autohide:"valid"===t,children:"valid"===t?"Congratulations! This domain is properly configured.":Object(z.jsxs)("span",{children:["Oops! There is some missing configuration, and short URLs shared with this domain will not work.",Object(z.jsx)("br",{}),"Check the ",Object(z.jsx)(qt.a,{href:"https://slnk.to/multi-domain-docs",children:"documentation"})," in order to find out what is missing."]})})]})},Bo=function(e){var t=e.fallback;return Object(z.jsxs)("span",{className:"text-muted",children:[!t&&Object(z.jsx)("small",{children:"No redirect"}),t&&Object(z.jsxs)(z.Fragment,{children:[t," ",Object(z.jsx)("small",{children:"(as fallback)"})]})]})},Ho=function(){return Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)(G.a,{fixedWidth:!0,icon:M.m,className:"text-primary",id:"defaultDomainIcon"}),Object(z.jsx)(J.L,{target:"defaultDomainIcon",placement:"right",children:"Default domain"})]})},Wo=function(e){var t,r,n,c=e.domain,a=e.editDomainRedirects,s=e.checkDomainHealth,i=e.defaultRedirects,o=e.selectedServer,l=Object(Z.f)(),u=Object(N.a)(l,2),d=u[0],j=u[1],b=c.domain,h=c.isDefault,O=c.redirects,v=c.status,f=!h||Object(Ee.d)(o);return Object(H.useEffect)((function(){s(c.domain)}),[]),Object(z.jsxs)("tr",{className:"responsive-table__row",children:[Object(z.jsx)("td",{className:"responsive-table__cell","data-th":"Is default domain",children:h&&Object(z.jsx)(Ho,{})}),Object(z.jsx)("th",{className:"responsive-table__cell","data-th":"Domain",children:b}),Object(z.jsx)("td",{className:"responsive-table__cell","data-th":"Base path redirect",children:null!==(t=null===O||void 0===O?void 0:O.baseUrlRedirect)&&void 0!==t?t:Object(z.jsx)(Bo,{fallback:null===i||void 0===i?void 0:i.baseUrlRedirect})}),Object(z.jsx)("td",{className:"responsive-table__cell","data-th":"Regular 404 redirect",children:null!==(r=null===O||void 0===O?void 0:O.regular404Redirect)&&void 0!==r?r:Object(z.jsx)(Bo,{fallback:null===i||void 0===i?void 0:i.regular404Redirect})}),Object(z.jsx)("td",{className:"responsive-table__cell","data-th":"Invalid short URL redirect",children:null!==(n=null===O||void 0===O?void 0:O.invalidShortUrlRedirect)&&void 0!==n?n:Object(z.jsx)(Bo,{fallback:null===i||void 0===i?void 0:i.invalidShortUrlRedirect})}),Object(z.jsx)("td",{className:"responsive-table__cell text-lg-center","data-th":"Status",children:Object(z.jsx)(Po,{status:v})}),Object(z.jsxs)("td",{className:"responsive-table__cell text-end",children:[Object(z.jsx)("span",{id:f?void 0:"defaultDomainBtn",children:Object(z.jsx)(J.b,{outline:!0,size:"sm",disabled:!f,onClick:f?j:void 0,children:Object(z.jsx)(G.a,{fixedWidth:!0,icon:f?M.n:M.b})})}),!f&&Object(z.jsxs)(J.L,{target:"defaultDomainBtn",placement:"left",children:["Redirects for default domain cannot be edited here.",Object(z.jsx)("br",{}),"Use config options or env vars directly on the server."]})]}),Object(z.jsx)(Go,{domain:c,isOpen:d,toggle:j,editDomainRedirects:a})]})},qo=["","Domain","Base path redirect","Regular 404 redirect","Invalid short URL redirect","",""],zo=function(e){var t,r=e.listDomains,n=e.domainsList,c=e.filterDomains,a=e.editDomainRedirects,s=e.checkDomainHealth,i=e.selectedServer,o=n.filteredDomains,l=n.defaultRedirects,u=n.loading,d=n.error,j=n.errorData,b=null!==l&&void 0!==l?l:null===(t=o.find((function(e){return e.isDefault})))||void 0===t?void 0:t.redirects;if(Object(H.useEffect)((function(){r()}),[]),u)return Object(z.jsx)(on.a,{loading:!0});return Object(z.jsxs)(z.Fragment,{children:[Object(z.jsx)(K,{className:"mb-3",onChange:c}),d?Object(z.jsx)(or,{type:"error",children:Object(z.jsx)(dr,{errorData:j,fallbackMessage:"Error loading domains :("})}):Object(z.jsx)(ir.a,{children:Object(z.jsxs)("table",{className:"table table-hover responsive-table mb-0",children:[Object(z.jsx)("thead",{className:"responsive-table__header",children:Object(z.jsx)("tr",{children:qo.map((function(e,t){return Object(z.jsx)("th",{children:e},t)}))})}),Object(z.jsxs)("tbody",{children:[o.length<1&&Object(z.jsx)("tr",{children:Object(z.jsx)("td",{colSpan:qo.length,className:"text-center",children:"No results found"})}),o.map((function(e){return Object(z.jsx)(Wo,{domain:e,editDomainRedirects:a,checkDomainHealth:s,defaultRedirects:b,selectedServer:i},e.domain)}))]})]})})]})},Ko=function(e,t){e.serviceFactory("DomainSelector",(function(){return Fo})),e.decorator("DomainSelector",t(["domainsList"],["listDomains"])),e.serviceFactory("ManageDomains",(function(){return zo})),e.decorator("ManageDomains",t(["domainsList","selectedServer"],["listDomains","filterDomains","editDomainRedirects","checkDomainHealth"])),e.serviceFactory("listDomains",Lo,"buildShlinkApiClient"),e.serviceFactory("filterDomains",(function(){return Vo})),e.serviceFactory("editDomainRedirects",yo,"buildShlinkApiClient"),e.serviceFactory("checkDomainHealth",Io,"buildShlinkApiClient")},Qo="shlink/appUpdates/APP_UPDATE_AVAILABLE",Jo="shlink/appUpdates/RESET_APP_UPDATE",Zo=Object(gt.b)((vt={},Object(l.a)(vt,Qo,(function(){return!0})),Object(l.a)(vt,Jo,(function(){return!1})),vt),!1),Yo=Object(gt.a)(Qo),Xo=Object(gt.a)(Jo),$o=r(115),el=function(e){var t=e.isOpen,r=e.toggle,n=e.forceUpdate,c=Object(Z.f)(),a=Object(N.a)(c,3),s=a[0],i=a[2];return Object(z.jsxs)(J.a,{className:"app-update-banner",isOpen:t,toggle:r,tag:ir.a,color:"secondary",children:[Object(z.jsx)("h4",{className:"mb-4",children:"This app has just been updated!"}),Object(z.jsxs)("p",{className:"mb-0",children:["Restart it to enjoy the new features.",Object(z.jsxs)(J.b,{disabled:s,className:"ms-2",color:"secondary",size:"sm",onClick:function(){i(),n()},children:[!s&&Object(z.jsxs)(z.Fragment,{children:["Restart now ",Object(z.jsx)(G.a,{icon:M.N,className:"ms-1"})]}),s&&Object(z.jsx)(z.Fragment,{children:"Restarting..."})]})]})]})},tl=r(27),rl=function(){var e=Object(f.a)(v.a.mark((function e(){var t,r,n,c,a,s,i;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=navigator.serviceWorker)||void 0===r?void 0:r.getRegistrations();case 2:if(e.t1=t=e.sent,e.t0=null!==e.t1,!e.t0){e.next=6;break}e.t0=void 0!==t;case 6:if(!e.t0){e.next=10;break}e.t2=t,e.next=11;break;case 10:e.t2=[];case 11:n=e.t2,c=Object(tl.a)(n);try{for(c.s();!(a=c.n()).done;)s=a.value,null===(i=s.waiting)||void 0===i||i.addEventListener("statechange",(function(e){var t;"activated"===(null===(t=e.target)||void 0===t?void 0:t.state)&&window.location.reload()})),null===i||void 0===i||i.postMessage({type:"SKIP_WAITING"})}catch(o){c.e(o)}finally{c.f()}case 14:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),nl=function(e,t,r,n,c,a,s,i){return function(o){var l=o.fetchServers,u=o.servers,d=o.settings,j=o.appUpdated,b=o.resetAppUpdate,h="/"===Object(Me.f)().pathname;return Object(H.useEffect)((function(){var e,t;0===Object.keys(u).length&&l(),Object(ta.g)(null!==(e=null===(t=d.ui)||void 0===t?void 0:t.theme)&&void 0!==e?e:"light")}),[]),Object(z.jsxs)("div",{className:"container-fluid app-container",children:[Object(z.jsx)(e,{}),Object(z.jsxs)("div",{className:"app",children:[Object(z.jsx)("div",{className:q()("shlink-wrapper",{"d-flex d-md-block align-items-center":h}),children:Object(z.jsxs)(Me.d,{children:[Object(z.jsx)(Me.b,{index:!0,element:Object(z.jsx)(t,{})}),Object(z.jsx)(Me.b,{path:"/settings/*",element:Object(z.jsx)(a,{})}),Object(z.jsx)(Me.b,{path:"/manage-servers",element:Object(z.jsx)(s,{})}),Object(z.jsx)(Me.b,{path:"/server/create",element:Object(z.jsx)(n,{})}),Object(z.jsx)(Me.b,{path:"/server/:serverId/edit",element:Object(z.jsx)(c,{})}),Object(z.jsx)(Me.b,{path:"/server/:serverId/*",element:Object(z.jsx)(r,{})}),Object(z.jsx)(Me.b,{path:"*",element:Object(z.jsx)($o.a,{})})]})}),Object(z.jsx)("div",{className:"shlink-footer",children:Object(z.jsx)(i,{})})]}),Object(z.jsx)(el,{isOpen:j,toggle:b,forceUpdate:rl})]})}},cl=function(e,t){e.serviceFactory("App",nl,"MainHeader","Home","MenuLayout","CreateServer","EditServer","Settings","ManageServers","ShlinkVersionsContainer"),e.decorator("App",t(["servers","settings","appUpdated"],["fetchServers","resetAppUpdate"])),e.serviceFactory("appUpdateAvailable",(function(){return Yo})),e.serviceFactory("resetAppUpdate",(function(){return Xo}))},al=new d.a,sl=al.container,il=function(e,t){return Object(u.a)(Object(u.a)({},e),{},Object(l.a)({},t,function(e,t){return function(){return e[t].apply(e,arguments)}}(sl,t)))},ol=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Object(s.b)(e?Object(j.a)(e):null,t.reduce(il,{}))};cl(al,ol),Object(A.a)(al,ol),F(al),vn(al,ol),xc(al,ol),$i(al,ol),di(al,ol),Object(eo.a)(al),so(al),go(al,ol),Ko(al,ol);var ll=r(200),ul=r(92),dl=r(154),jl=r(99),bl=Object(ul.b)({servers:Yn,selectedServer:Pn,shortUrlsList:Wr,shortUrlCreationResult:Dr,shortUrlDeletion:Nr,shortUrlEdition:Mr,shortUrlVisits:xs,tagVisits:Rs,orphanVisits:Bs,nonOrphanVisits:ei,shortUrlDetail:hn,tagsList:Ki,tagDelete:_i,tagEdit:Vi,mercureInfo:co,settings:yt,domainsList:Do,visitsOverview:oi,appUpdated:Zo,sidebar:jl.a}),hl=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||ul.c,Ol={states:["settings","servers"],namespace:"shlink",namespaceSeparator:".",debounce:300},vl=function(e){var t,r,n,c;return e.settings?("last180days"===(null===(t=e.settings.visits)||void 0===t?void 0:t.defaultInterval)&&e.settings.visits&&(e.settings.visits.defaultInterval="last180Days"),e.settings.tags=Object(u.a)(Object(u.a)({},e.settings.tags),{},{defaultMode:null!==(r=null===(n=e.settings.tags)||void 0===n?void 0:n.defaultMode)&&void 0!==r?r:null===(c=e.settings.ui)||void 0===c?void 0:c.tagsMode}),e.settings.ui&&delete e.settings.ui.tagsMode,e):e}(Object(dl.load)(Ol)),fl=Object(ul.d)(bl,vl,hl(Object(ul.a)(Object(dl.save)(Ol),ll.a))),ml=r(53),gl=r.n(ml),xl=r(201),pl=r(202),Sl=r(203),yl=Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function Cl(e,t){navigator.serviceWorker.register(e).then((function(e){e.onupdatefound=function(){var r=e.installing;null!=r&&(r.onstatechange=function(){"installed"===r.state&&(navigator.serviceWorker.controller?(console.log("New content is available and will be used when all tabs for this page are closed. See https://cra.link/PWA."),t&&t.onUpdate&&t.onUpdate(e)):(console.log("Content is cached for offline use."),t&&t.onSuccess&&t.onSuccess(e)))})}})).catch((function(e){console.error("Error during service worker registration:",e)}))}r(302),r(303);delete gl.a.Icon.Default.prototype._getIconUrl,gl.a.Icon.Default.mergeOptions({iconRetinaUrl:xl.a,iconUrl:pl.a,shadowUrl:Sl.a});var Nl=sl.App,kl=sl.ScrollToTop,wl=sl.ErrorHandler,_l=sl.appUpdateAvailable;Object(a.render)(Object(z.jsx)(s.a,{store:fl,children:Object(z.jsx)(i.a,{basename:o.a,children:Object(z.jsx)(wl,{children:Object(z.jsx)(kl,{children:Object(z.jsx)(Nl,{})})})})}),document.getElementById("root")),function(e){if("serviceWorker"in navigator){var t;if(new URL(null!==(t="/shlink-web-client/feature/update-react-datepicker")?t:"",window.location.href).origin!==window.location.origin)return;window.addEventListener("load",(function(){var t="".concat("/shlink-web-client/feature/update-react-datepicker","/service-worker.js");yl?(!function(e,t){fetch(e,{headers:{"Service-Worker":"script"}}).then((function(r){var n=r.headers.get("content-type");404===r.status||null!=n&&-1===n.indexOf("javascript")?navigator.serviceWorker.ready.then((function(e){e.unregister().then((function(){window.location.reload()}))})):Cl(e,t)})).catch((function(){console.log("No internet connection found. App is running in offline mode.")}))}(t,e),navigator.serviceWorker.ready.then((function(){console.log("This web app is being served cache-first by a service worker. To learn more, visit https://cra.link/PWA")}))):Cl(t,e)}))}}({onUpdate:function(){fl.dispatch(_l())}})},31:function(e,t,r){"use strict";r.d(t,"j",(function(){return s})),r.d(t,"l",(function(){return i})),r.d(t,"h",(function(){return o})),r.d(t,"i",(function(){return l})),r.d(t,"m",(function(){return u})),r.d(t,"b",(function(){return d})),r.d(t,"c",(function(){return j})),r.d(t,"k",(function(){return b})),r.d(t,"e",(function(){return h})),r.d(t,"f",(function(){return O})),r.d(t,"d",(function(){return v})),r.d(t,"g",(function(){return f})),r.d(t,"a",(function(){return m}));var n=r(26),c=r(57),a=function(e){return function(t){return Object(n.d)(t)&&Object(c.a)(t.version,e)}},s=a({minVersion:"2.5.0"}),i=a({minVersion:"2.6.0"}),o=i,l=i,u=i,d=a({minVersion:"2.7.0"}),j=d,b=a({minVersion:"2.8.0"}),h=b,O=a({minVersion:"2.9.0"}),v=a({minVersion:"2.10.0"}),f=a({minVersion:"3.0.0"}),m=f},39:function(e,t,r){"use strict";r.d(t,"c",(function(){return n})),r.d(t,"d",(function(){return c})),r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return s})),r.d(t,"f",(function(){return i})),r.d(t,"e",(function(){return o})),r.d(t,"g",(function(){return l})),r.d(t,"h",(function(){return u}));var n="#4696e5",c="rgba(70, 150, 229, 0.4)",a="#f77f28",s="rgba(247, 127, 40, 0.4)",i="white",o="#161b22",l=function(e){var t,r;return null===(t=document.getElementsByTagName("html"))||void 0===t||null===(r=t[0])||void 0===r?void 0:r.setAttribute("data-theme",e)},u=function(){var e,t;return"dark"===(null===(e=document.getElementsByTagName("html"))||void 0===e||null===(t=e[0])||void 0===t?void 0:t.getAttribute("data-theme"))}},42:function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return s}));var n=r(153),c=r.n(n),a=function(e){return c.a.parse(e,{ignoreQueryPrefix:!0})},s=function(e){return c.a.stringify(e,{arrayFormat:"brackets"})}},44:function(e,t,r){"use strict";var n=r(4),c=r(6),a=r.n(c),s=r(12),i=r(11),o=r(0),l=function(e){return{error:"border-danger",default:""}[e]},u=function(e){return{error:"text-danger",default:"text-muted"}[e]};t.a=function(e){var t=e.className,r=e.children,c=e.loading,d=void 0!==c&&c,j=e.type,b=void 0===j?"default":j,h=e.fullWidth,O=void 0!==h&&h,v=a()({"col-md-12":O,"col-md-10 offset-md-1":!O});return Object(o.jsx)(n.I,{className:a()("g-0",t),children:Object(o.jsx)("div",{className:v,children:Object(o.jsx)(n.d,{className:l(b),body:!0,children:Object(o.jsxs)("h3",{className:a()("text-center mb-0",u(b)),children:[d&&Object(o.jsx)(i.a,{icon:s.k,spin:!0}),d&&Object(o.jsx)("span",{className:"ms-2",children:null!==r&&void 0!==r?r:"Loading..."}),!d&&r]})})})})}},50:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),c=function(e){var t=e.children;return Object(n.jsx)("div",{className:"no-menu-wrapper container-xl",children:t})}},57:function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return u}));var n=r(130),c=r(309),a=r(312),s=r(28),i=function(e,t){var r=t.maxVersion,c=t.minVersion;if(!Object(s.c)(e))return!1;var a=!c||Object(n.a)(e,c,">=");return(!r||Object(n.a)(e,r,"<="))&&a},o=Object(c.a)(a.a,(function(e){try{return Object(n.a)(e,e,"=")}catch(t){return!1}})),l=function(e){return o(e)?"v".concat(e):e},u=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"latest";return function(t){return o(t)?t:e}}},69:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(3),c=r(2),a=r(0);function s(e){return function(t){return Object(c.useEffect)((function(){t.resetSelectedServer()}),[]),Object(a.jsx)(e,Object(n.a)({},t))}}},78:function(e,t,r){"use strict";r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return c}));var n=function(e,t,r){var n=e.document,c=n.createElement("a");c.setAttribute("href",t),c.setAttribute("download",r),c.style.visibility="hidden",n.body.appendChild(c),c.click(),n.body.removeChild(c)},c=function(e,t,r){var c=new Blob([t],{type:"text/csv;charset=utf-8;"}),a=URL.createObjectURL(c);n(e,a,r)}},99:function(e,t,r){"use strict";r.d(t,"c",(function(){return o})),r.d(t,"b",(function(){return l}));var n,c=r(10),a=r(21),s="shlink/common/SIDEBAR_PRESENT",i="shlink/common/SIDEBAR_NOT_PRESENT";t.a=Object(a.b)((n={},Object(c.a)(n,s,(function(){return{sidebarPresent:!0}})),Object(c.a)(n,i,(function(){return{sidebarPresent:!1}})),n),{sidebarPresent:!1});var o=Object(a.a)(s),l=Object(a.a)(i)}},[[216,1,2]]]); //# sourceMappingURL=main.a399f1db.chunk.js.map