shlink-web-client/feature/bootstrap5/static/js/main.5083eae8.chunk.js

2 lines
No EOL
200 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{119:function(e){e.exports=JSON.parse('{"a":"/shlink-web-client/feature/bootstrap5"}')},125:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(38),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"})]})})}},126:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(3),c=r(2),a=r(23),s=r(44),i=r(25),o=r(51),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})})}}},129:function(e,t,r){"use strict";var n=r(16),c=r(28),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})]})})}},140: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(8),c=r(2),a=r(229),s=r(23),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)}}},226:function(e,t,r){"use strict";(function(e){var n=r(227),c=r.n(n),a=r(228),s=r(257),i=r(258),o=r(259),l=r(260),u=r(231),d=r(255),j=r(84),b=r(233);t.a=function(t,r){t.constant("window",e.window),t.constant("console",e.console),t.constant("axios",c.a),t.service("ImageDownloader",b.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"])),t.serviceFactory("AsideMenu",l.a,"DeleteServerButton"),t.serviceFactory("ShlinkVersionsContainer",(function(){return d.a})),t.decorator("ShlinkVersionsContainer",r(["selectedServer"])),t.serviceFactory("ErrorHandler",u.a,"window","console")}}).call(this,r(45))},228:function(e,t,r){"use strict";var n=r(2),c=r(23),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})}}},231:function(e,t,r){"use strict";var n=r(18),c=r(22),a=r(34),s=r(33),i=r(2),o=r(4),l=r(28),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)}},233:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(7),c=r.n(n),a=r(13),s=r(18),i=r(22),o=r(85),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}()},246:function(e,t,r){"use strict";(function(e){var n=r(15),c=r(247),a=r(248);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(45))},247:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(18),c=function(e){return"".concat("shlink",".").concat(e)},a=function e(t){var r=this;Object(n.a)(this,e),this.localStorage=t,this.get=function(e){var t=r.localStorage.getItem(c(e));return t?JSON.parse(t):void 0},this.set=function(e,t){return r.localStorage.setItem(c(e),JSON.stringify(t))}}},248:function(e,t,r){"use strict";r.d(t,"a",(function(){return h}));var n=r(21),c=r(18),a=r(143),s=r(27),i="0123456789ABCDEF",o=Math.floor,l=Math.random,u=Math.sqrt,d=Math.round,j=function(e){return e.toLowerCase().trim()},b=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 d(u(.299*Math.pow(e,2)+.587*Math.pow(t,2)+.114*Math.pow(r,2)))},h=function e(t){var r,u=this;Object(c.a)(this,e),this.storage=t,this.colors=void 0,this.lights=void 0,this.getColorForKey=function(e){var t=j(e),r=u.colors[t];return r||u.setColorForKey(t,"#".concat(Object(s.e)(6,(function(){return i[o(l()*i.length)]})).join("")))},this.setColorForKey=function(e,t){var r=j(e);return u.colors[r]=t,u.storage.set("colors",u.colors),t},this.isColorLightForKey=function(e){var t=u.getColorForKey(e).substring(1);if(Object(a.a)(u.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);u.lights[t]=b.apply(void 0,Object(n.a)(r))>=128}return u.lights[t]},this.colors=null!==(r=this.storage.get("colors"))&&void 0!==r?r:{},this.lights={}}},25: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(470),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)}},255:function(e,t,r){"use strict";var n=r(6),c=r.n(n),a=r(25),s=r(472),i=r(37),o=r(59),l=r(0),u=Object(s.a)(Object(o.c)(),o.b),d=function(e){var t=e.project,r=e.version;return Object(l.jsx)(i.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(a.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=c()("text-center",{"shlink-versions-container--with-server":Object(a.d)(t)});return Object(l.jsx)("div",{className:r,children:Object(l.jsx)(j,{selectedServer:t})})}},257:function(e,t,r){"use strict";var n=r(8),c=r(12),a=r(11),s=r(2),i=r(23),o=r(16),l=r(4),u=r(6),d=r.n(u),j=r(15),b=r(125),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,{})]})})]})}}},258:function(e,t,r){"use strict";var n=r(2),c=r(482),a=r(263),s=r(23),i=r(16),o=r(4),l=r(37),u=r(11),d=r(12),j=r(140),b=r(125),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,{noGutters:!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})]})})})]})})]})]})})})}},259:function(e,t,r){"use strict";var n=r(3),c=r(8),a=r(2),s=r(23),i=r(12),o=r(11),l=r(6),u=r.n(l),d=r(126),j=r(15),b=r(31),h=r(25),O=r(129),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=Object(s.f)(),w=Object(j.f)(),_=Object(c.a)(w,4),U=_[0],T=_[1],R=_[2],E=_[3];if(Object(a.useEffect)((function(){return E()}),[k]),!Object(h.d)(N))return Object(v.jsx)(p,{});var D=Object(b.h)(N),L=Object(b.g)(N),V=Object(b.e)(N),I=u()("menu-layout__burger-icon",{"menu-layout__burger-icon--active":U}),F=Object(j.e)(R,E);return Object(v.jsxs)(v.Fragment,{children:[Object(v.jsx)(o.a,{icon:i.c,className:I,onClick:T}),Object(v.jsx)("div",Object(n.a)(Object(n.a)({},F),{},{className:"menu-layout__swipeable",children:Object(v.jsxs)("div",{className:"menu-layout__swipeable-inner",children:[Object(v.jsx)(r,{selectedServer:N,showOnMobile:U}),Object(v.jsx)("div",{className:"menu-layout__container",onClick:function(){return E()},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,{})}),D&&Object(v.jsx)(s.b,{path:"/orphan-visits/*",element:Object(v.jsx)(g,{})}),L&&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,{})}),V&&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)}},260:function(e,t,r){"use strict";var n=r(3),c=r(29),a=r(12),s=r(11),i=r(16),o=r(23),l=r(6),u=r.n(l),d=r(25),j=r(31),b=r(0),h=function(e){var t=e.children,r=e.to,a=e.className,s=Object(c.a)(e,["children","to","className"]);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:"",O=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)(h,{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)(h,{to:m("/list-short-urls/1"),className:u()({"aside-menu__item--selected":null!==O.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)(h,{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)(h,{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)(h,{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)(h,{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})]})})}}},266:function(e,t,r){e.exports=r(465)},27: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(473),c=r(143),a=r(263),s=r(472),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))}},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(3),c=r(29),a=r(4),s=r(0),i=function(e){var t=e.title,r=e.children,i=e.bodyClassName,o=Object(c.a)(e,["title","children","bodyClassName"]);return Object(s.jsxs)(a.d,Object(n.a)(Object(n.a)({},o),{},{children:[t&&Object(s.jsx)(a.g,{children:t}),Object(s.jsx)(a.e,{className:i,children:r})]}))}},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(25),c=r(59),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},347:function(e,t){},349:function(e,t){},38: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(180),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,{noGutters:!0,className: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]})})})})}},465:function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"processStatsFromVisits",(function(){return Sa})),r.d(n,"normalizeVisits",(function(){return ya}));var c,a=r(40),s=r(138),i=r(16),o=r(119),l=r(10),u=r(3),d=r(225),j=r(510),b=r(514),h=r(25),O=r(7),v=r.n(O),f=r(13),m=r(18),g=r(29),x=r(256),p=r(143),S=r(263),y=r(42),C=r(8),N=function(e,t,r){return e!==t?"ASC":r?{ASC:"DESC",DESC:void 0}[r]:"ASC"},k=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},w=function(e){return e.dir?"".concat(e.field,"-").concat(e.dir):void 0},_=function(e){var t=e.split("-"),r=Object(C.a)(t,2);return{field:r[0],dir:r[1]}},U=function(e){return e?"".concat(e,"/rest/v2"):""},T=Object(x.a)(p.a),R=function(e){var t=e.orderBy,r=void 0===t?{}:t,n=Object(g.a)(e,["orderBy"]);return Object(u.a)(Object(u.a)({},n),{},{orderBy:w(r)})},E=function e(t,r,n){var c=this;Object(m.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",R(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(x.a)((function(e){return Object(S.a)(e)||Object(p.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(U(c.baseUrl)).concat(t),headers:{"X-Api-Key":c.apiKey},params:T(n),data:a,paramsSerializer:y.b}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},D={},L=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 D[s]||(D[s]=new E(e,c,a)),D[s]}},V=function(e){e.serviceFactory("buildShlinkApiClient",L,"axios")},I=r(226),F=r(12),A=r(11),M=r(472),G=r(300),P=r(2),B=r(6),H=r.n(B),W=r(0),q=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(P.useState)(l),d=Object(C.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(W.jsxs)("div",{className:H()("search-field",r),children:[Object(W.jsx)("input",{type:"text",className:H()("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(W.jsx)(A.a,{icon:F.I,className:"search-field__icon"}),Object(W.jsx)("div",{className:"close search-field__close",hidden:""===j,id:"search-field__close",onClick:function(){return O("",0)},children:"\xd7"})]})},z=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(W.jsxs)("span",{className:H()("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(W.jsx)("span",{className:"close tag__close-selected-tag",onClick:o,children:"\xd7"})]})},K=r(4),Q=r(15),J=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(Q.f)(),j=Object(C.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(W.jsxs)(K.k,{isOpen:b,toggle:h,disabled:n,className:i,children:[Object(W.jsx)(K.n,{caret:!0,className:O,color:"primary",children:t}),Object(W.jsx)(K.m,{className:"w-100",right:l,style:v,children:s})]})},Z=r(75),Y=r(304),X=r(167),$=r(254),ee=r(484),te=r(485),re=r(468),ne=r(483),ce=(r(466),r(301)),ae=r(302),se=r(303),ie=function(e){return"string"!==typeof e},oe=function(e,t){return e&&ie(e)?t?Object(re.default)(e,t):Object(ne.a)(e):e},le=function(e){return oe(e,void 0)},ue=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"yyyy-MM-dd";return function(t){return oe(t,e)}}(),de=function(e){return ie(e)?e:Object(G.default)(e)},je=function(e,t,r){try{return Object(ce.default)(de(e),{start:de(null!==t&&void 0!==t?t:e),end:de(null!==r&&void 0!==r?r:e)})}catch(n){return!1}},be=function(e,t){return Object(ae.default)(e,t)||Object(se.default)(e,t)},he=function(e){return void 0===e||Object(S.a)(Object($.a)(Boolean,e))},Oe=function(e){return"string"===typeof e},ve={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},fe=Object.keys(ve).filter((function(e){return"all"!==e})),me=function(e){if(e&&"all"!==e)return Oe(e)?ve[e]:function(e){if(e&&!he(e))return e.startDate&&!e.endDate?"Since ".concat(ue(e.startDate)):!e.startDate&&e.endDate?"Until ".concat(ue(e.endDate)):"".concat(ue(e.startDate)," - ").concat(ue(e.endDate))}(e)},ge=function(e){return Object(Z.default)(Object(Y.default)(new Date,e))},xe=function(e){return{startDate:e,endDate:Object(X.default)(new Date)}},pe=function(e){if(!e||"all"===e)return{};switch(e){case"today":return xe(Object(Z.default)(new Date));case"yesterday":return{startDate:ge(1),endDate:Object(X.default)(Object(Y.default)(new Date,1))};case"last7Days":return xe(ge(7));case"last30Days":return xe(ge(30));case"last90Days":return xe(ge(90));case"last180Days":return xe(ge(180));case"last365Days":return xe(ge(365))}return{}},Se=function(e){var t=de(e);return Object(ee.a)([[function(){return be(Object(Z.default)(new Date),t)},function(){return"today"}],[function(){return be(ge(1),t)},function(){return"yesterday"}],[function(){return be(ge(7),t)},function(){return"last7Days"}],[function(){return be(ge(30),t)},function(){return"last30Days"}],[function(){return be(ge(90),t)},function(){return"last90Days"}],[function(){return be(ge(180),t)},function(){return"last180Days"}],[function(){return be(ge(365),t)},function(){return"last365Days"}],[te.a,function(){return"all"}]])()},ye=r(235),Ce=r.n(ye),Ne=r(58),ke=function(e){var t=e.className,r=e.isClearable,n=e.selected,c=!r||Object(p.a)(n),a=Object(P.useRef)();return Object(W.jsxs)("div",{className:"date-input-container",children:[Object(W.jsx)(Ce.a,Object(u.a)(Object(u.a)({},e),{},{dateFormat:"yyyy-MM-dd",className:H()("date-input-container__input form-control",t),ref:a})),c&&Object(W.jsx)(A.a,{icon:Ne.b,className:"date-input-container__icon",onClick:function(){var e;return null===(e=a.current)||void 0===e?void 0:e.input.focus()}})]})},we=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(W.jsxs)("div",{className:"row",children:[Object(W.jsx)("div",{className:"col-md-6",children:Object(W.jsx)(ke,{selected:r,placeholderText:"Since...",isClearable:!0,maxDate:null!==c&&void 0!==c?c:void 0,disabled:s,onChange:i})}),Object(W.jsx)("div",{className:"col-md-6",children:Object(W.jsx)(ke,{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})})]})},_e=function(e){var t=e.active,r=e.allText,n=e.onChange;return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(K.l,{active:"all"===t,onClick:function(){return n("all")},children:r}),Object(W.jsx)(K.l,{divider:!0}),fe.map((function(e){return Object(W.jsx)(K.l,{active:t===e,onClick:function(){return n(e)},children:me(e)},e)}))]})},Ue=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=Oe(n),l=Object(P.useState)(o?n:void 0),d=Object(C.a)(l,2),j=d[0],b=d[1],h=Object(P.useState)(o?void 0:n),O=Object(C.a)(h,2),v=O[0],f=O[1],m=function(e){b(he(e)?"all":void 0),f(e),r(e)},g=function(e){b(e),f(void 0),r(pe(e))};return i&&Object(Q.a)((function(){var e=Oe(n);e&&g(n),n&&!e&&m(n)}),[n]),Object(W.jsxs)(J,{disabled:a,text:null!==(t=me(null!==j&&void 0!==j?j:v))&&void 0!==t?t:c,children:[Object(W.jsx)(_e,{allText:c,active:j,onChange:g}),Object(W.jsx)(K.l,{divider:!0}),Object(W.jsx)(K.l,{header:!0,children:"Custom:"}),Object(W.jsx)(K.l,{text:!0,children:Object(W.jsx)(we,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}))}}))})]})},Te=r(31),Re=r(513),Ee=r(474),De=function(e){var t=e.checked,r=void 0!==t&&t,n=e.onChange,c=void 0===n?Ee.a:n,a=e.className,s=e.children,i=e.type,o=e.inline,l=void 0!==o&&o,u=Object(P.useRef)(Object(Re.a)()).current,d={"form-switch":"switch"===i,"form-checkbox":"checkbox"===i},j=l?{display:"inline-block"}:{};return Object(W.jsxs)("span",{className:H()("form-check",d,a),style:j,children:[Object(W.jsx)("input",{type:"checkbox",className:"form-check-input",id:u,checked:r,onChange:function(e){return c(e.target.checked,e)}}),Object(W.jsx)("label",{className:"form-check-label",htmlFor:u,children:s})]})},Le=function(e){return Object(W.jsx)(De,Object(u.a)({type:"switch"},e))},Ve=function(e){var t=e.children,r=e.tooltip,n=void 0===r?{}:r,c=Object(g.a)(e,["children","tooltip"]),a=Object(P.useRef)();return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("span",{ref:function(e){a.current=null!==e&&void 0!==e?e:void 0},children:Object(W.jsx)(Le,Object(u.a)({},c))}),Object(W.jsx)(K.L,Object(u.a)(Object(u.a)({target:function(){return a.current}},n),{},{children:t}))]})},Ie=r(23),Fe=function(){var e=Object(Ie.g)(),t=Object(Ie.f)(),r=Object(Ie.h)(),n=Object(P.useMemo)(Object(M.a)((function(){return Object(y.a)(t.search)}),(function(e){var t=e.orderBy,r=Object(g.a)(e,["orderBy"]);return t?Object(u.a)(Object(u.a)({},r),{},{orderBy:_(t)}):r})),[t.search]);return[n,function(t){var c=Object(u.a)(Object(u.a)({},n),t),a=c.orderBy,s=Object(g.a)(c,["orderBy"]),i=Object(u.a)(Object(u.a)({},s),{},{orderBy:a&&w(a)}),o=Object(y.b)(i),l=Object(S.a)(o)?"":"?".concat(o);e("/server/".concat(r.serverId,"/list-short-urls/1").concat(l))}]},Ae=function(e){return e?Object(G.default)(e):null},Me=function(e){return function(t){var r,n=t.selectedServer,c=Fe(),a=Object(C.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(M.a)((function(e){var t,r,n=e.startDate,c=e.endDate;return{startDate:null!==(t=le(n))&&void 0!==t?t:void 0,endDate:null!==(r=le(c))&&void 0!==r?r:void 0}}),b),v=Object(M.a)((function(e){return Object(S.a)(e)?void 0:e}),(function(e){return b({search:e})})),f=Object(M.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(Te.a)(n),g=Object(M.a)((function(){return"any"===j?"all":"any"}),(function(e){return b({tagsMode:e})}));return Object(W.jsxs)("div",{className:"short-urls-filtering-bar-container",children:[Object(W.jsx)(q,{initialValue:i,onChange:v}),Object(W.jsx)("div",{className:"mt-3",children:Object(W.jsx)("div",{className:"row",children:Object(W.jsx)("div",{className:"col-lg-8 offset-lg-4 col-xl-6 offset-xl-6",children:Object(W.jsx)(Ue,{defaultText:"All short URLs",initialDateRange:{startDate:Ae(l),endDate:Ae(u)},onDatesChange:O})})})}),h.length>0&&Object(W.jsxs)("h4",{className:"mt-3",children:[m&&h.length>1&&Object(W.jsx)("div",{className:"float-end ms-2 mt-1",children:Object(W.jsx)(Ve,{checked:"all"===j,tooltip:{placement:"left"},onChange:g,children:"all"===j?"Short URLs including all tags.":"Short URLs including any tag."})}),Object(W.jsx)(A.a,{icon:F.O,className:"short-urls-filtering-bar__tags-icon me-1"}),h.map((function(t){return Object(W.jsx)(z,{colorGenerator:e,text:t,clearable:!0,onClose:function(){return f(t)}},t)}))]})]})}},Ge=r(21),Pe=r(486);function Be(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=N(e,n.field,n.dir);c(t?e:void 0,t)}};return Object(W.jsxs)(K.K,{children:[Object(W.jsxs)(K.n,{caret:!0,color:s?"primary":"link",className:H()({"dropdown-btn__toggle btn-block":s,"btn-sm p-0":!s}),children:[!s&&Object(W.jsx)(W.Fragment,{children:"Order by"}),s&&!n.field&&Object(W.jsx)(W.Fragment,{children:"Order by..."}),s&&n.field&&'Order by: "'.concat(r[n.field],'" - "').concat(null!==(t=n.dir)&&void 0!==t?t:"DESC",'"')]}),Object(W.jsxs)(K.m,{right:o,className:H()("w-100",{"ordering-dropdown__menu--link":!s}),children:[Object(Pe.a)(r).map((function(e){var t=Object(C.a)(e,2),r=t[0],c=t[1];return Object(W.jsxs)(K.l,{active:n.field===r,onClick:l(r),children:[c,n.field===r&&Object(W.jsx)(A.a,{icon:"ASC"===n.dir?F.L:F.K,className:"ordering-dropdown__sort-icon"})]},r)})),Object(W.jsx)(K.l,{divider:!0}),Object(W.jsx)(K.l,{disabled:!n.field,onClick:function(){return c()},children:Object(W.jsx)("i",{children:"Clear selection"})})]})]})}var He=r(237);function We(e,t){var r=new Set;return function(n){var c=n.createNewVisits,a=n.loadMercureInfo,s=n.mercureInfo,i=s.interval,o=Object(Ie.h)();return Object(P.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 He.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(Ge.a)(r)),r.clear()}),1e3*i*60);return Object(M.a)((function(){return clearInterval(u)}),(function(){return null===l||void 0===l?void 0:l()}))}),[s]),Object(W.jsx)(e,Object(u.a)({},n))}}var qe=function e(){Object(m.a)(this,e)};function ze(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(W.jsx)(A.a,{icon:"ASC"===t.dir?F.f:F.e,className:c}):null}qe.visits="https://shlink.io/new-visit",qe.orphanVisits="https://shlink.io/new-orphan-visit",qe.shortUrlVisits=function(e){return"https://shlink.io/new-visit/".concat(e)};var Ke,Qe,Je,Ze,Ye,Xe,$e,et,tt,rt,nt,ct,at,st,it,ot,lt,ut,dt,jt=r(515),bt=r(487),ht=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}},Ot=function(e){return function(){return{type:e}}},vt="shlink/realTimeUpdates/SET_SETTINGS",ft={field:"dateCreated",dir:"DESC"},mt={realTimeUpdates:{enabled:!0},shortUrlCreation:{validateUrls:!1},ui:{theme:"light"},visits:{defaultInterval:"last30Days"},shortUrlsList:{defaultOrdering:ft}},gt=ht(Object(l.a)({},vt,(function(e,t){return Object(jt.a)(e,Object(bt.a)("type",t))})),mt),xt=function(e){return{type:vt,realTimeUpdates:{enabled:e}}},pt=function(e){return{type:vt,realTimeUpdates:{interval:e}}},St=function(e){return{type:vt,shortUrlCreation:e}},yt=function(e){return{type:vt,shortUrlsList:e}},Ct=function(e){return{type:vt,ui:e}},Nt=function(e){return{type:vt,visits:e}},kt=function(e){return{type:vt,tags:e}},wt=r(473),_t=r(234),Ut=r(488),Tt=Math.ceil,Rt=new Intl.NumberFormat("en-US"),Et=function(e){return Rt.format(Number(e))},Dt="...",Lt=function(e,t){var r=Object(wt.a)(Object(_t.a)(2,e-2),Object(Ut.a)(t-1,e+2)+1);return e-2>2&&r.unshift(Dt),e+2<t-1&&r.push(Dt),r.unshift(1),r.push(t),r},Vt=function(e){return e===Dt},It=function(e){return Vt(e)?e:Et(e)},Ft=function(e,t){return Vt(e)?"".concat(e,"_").concat(t):"".concat(e)},At=function(e){var t=e.paginator,r=e.serverId,n=e.currentQueryString,c=void 0===n?"":n,a=null!==t&&void 0!==t?t:{},s=a.currentPage,o=void 0===s?0:s,l=a.pagesCount,u=void 0===l?0:l,d=function(e){return"/server/".concat(r,"/list-short-urls/").concat(e).concat(c)};if(u<=1)return null;return Object(W.jsxs)(K.D,{className:"sticky-card-paginator",listClassName:"flex-wrap justify-content-center mb-0",children:[Object(W.jsx)(K.E,{disabled:1===o,children:Object(W.jsx)(K.F,{previous:!0,tag:i.b,to:d(o-1)})}),Lt(o,u).map((function(e,t){return Object(W.jsx)(K.E,{disabled:Vt(e),active:o===e,children:Object(W.jsx)(K.F,{tag:i.b,to:d(e),children:It(e)})},Ft(e,t))})),Object(W.jsx)(K.E,{disabled:o>=u,children:Object(W.jsx)(K.F,{next:!0,tag:i.b,to:d(o+1)})})]})},Mt={dateCreated:"Created at",shortCode:"Short URL",longUrl:"Long URL",title:"Title",visits:"Visits"},Gt=function(e,t){return We((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(Ie.h)().page,j=Object(Ie.f)(),b=Fe(),O=Object(C.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],k=Object(P.useState)(null!==(n=null!==p&&void 0!==p?p:null===(c=l.shortUrlsList)||void 0===c?void 0:c.defaultOrdering)&&void 0!==n?n:ft),w=Object(C.a)(k,2),_=w[0],U=w[1],T=Object(P.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(M.a)((function(e){return Object(Ge.a)(new Set([].concat(Object(Ge.a)(T),[e]))).join(",")}),(function(e){return y({tags:e})}));return Object(P.useEffect)((function(){s({page:d,searchTerm:m,tags:T,startDate:g,endDate:x,orderBy:_,tagsMode:S})}),[d,m,T,g,x,_,S]),Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("div",{className:"mb-3",children:Object(W.jsx)(t,{})}),Object(W.jsx)("div",{className:"d-block d-lg-none mb-3",children:Object(W.jsx)(Be,{items:Mt,order:_,onChange:E})}),Object(W.jsxs)(K.d,{body:!0,className:"pb-1",children:[Object(W.jsx)(e,{selectedServer:o,shortUrlsList:i,orderByColumn:function(e){return function(){return E(e,N(e,_.field,_.dir))}},renderOrderIcon:function(e){return Object(W.jsx)(ze,{currentOrder:_,field:e})},onTagClick:D}),Object(W.jsx)(At,{paginator:R,serverId:u,currentQueryString:j.search})]})]})}),(function(){return[qe.visits]}))},Pt=r(37),Bt=r(136),Ht=r.n(Bt),Wt=function(e){var t=e.text,r=e.onCopy;return Object(W.jsx)(Ht.a,{text:t,onCopy:r,children:Object(W.jsx)(A.a,{icon:Ne.d,className:"ms-2 copy-to-clipboard-icon"})})},qt=r(489),zt=r(516),Kt=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=ie(t)?t:Object(G.default)(t);return Object(W.jsx)("time",{dateTime:"".concat(Object(qt.a)(s),"000"),children:a?"".concat(Object(zt.a)(new Date,s)," ago"):Object(re.default)(s,n)})},Qt=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)},Jt=function(e){var t=e.selectedServer,r=e.shortUrl,n=e.suffix,c=e.children,a=Object(g.a)(e,["selectedServer","shortUrl","suffix","children"]);return t&&Object(h.e)(t)&&r?Object(W.jsx)(i.b,Object(u.a)(Object(u.a)({to:Qt(t,r,n)},a),{},{children:c})):Object(W.jsx)("span",Object(u.a)(Object(u.a)({},a),{},{children:c}))},Zt=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(W.jsx)(Jt,{selectedServer:c,shortUrl:n,suffix:"visits",children:Object(W.jsx)("strong",{className:H()("short-url-visits-count__amount",{"short-url-visits-count__amount--big":s}),children:Et(r)})});if(!i)return o;var l=Et(i),u=Object(P.useRef)();return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsxs)("span",{className:"indivisible",children:[o,Object(W.jsxs)("small",{className:"short-urls-visits-count__max-visits-control",ref:function(e){u.current=e},children:[" ","/ ",l," ",Object(W.jsx)("sup",{children:Object(W.jsx)(A.a,{icon:F.v})})]})]}),Object(W.jsxs)(K.L,{target:function(){return u.current},placement:"bottom",children:["This short URL will not accept more than ",Object(W.jsx)("b",{children:l})," visits."]})]})},Yt=function(e,t,r){return function(n){var c,a,s=n.shortUrl,i=n.selectedServer,o=n.onTagClick,l=r(),u=Object(C.a)(l,2),d=u[0],j=u[1],b=r(!1,500),h=Object(C.a)(b,2),O=h[0],v=h[1],f=Object(P.useRef)(!0);return Object(P.useEffect)((function(){f.current?f.current=!1:v()}),[s.visitsCount]),Object(W.jsxs)("tr",{className:"responsive-table__row",children:[Object(W.jsx)("td",{className:"indivisible short-urls-row__cell responsive-table__cell","data-th":"Created at",children:Object(W.jsx)(Kt,{date:s.dateCreated})}),Object(W.jsx)("td",{className:"responsive-table__cell short-urls-row__cell","data-th":"Short URL",children:Object(W.jsxs)("span",{className:"indivisible short-urls-row__cell--relative",children:[Object(W.jsx)(Pt.a,{href:s.shortUrl}),Object(W.jsx)(Wt,{text:s.shortUrl,onCopy:j}),Object(W.jsx)("span",{className:"badge bg-warning text-black short-urls-row__copy-hint",hidden:!d,children:"Copied short URL!"})]})}),Object(W.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(W.jsx)(Pt.a,{href:s.longUrl,children:null!==(c=s.title)&&void 0!==c?c:s.longUrl})}),s.title&&Object(W.jsx)("td",{className:"short-urls-row__cell responsive-table__cell short-urls-row__cell--break d-lg-none","data-th":"Long URL",children:Object(W.jsx)(Pt.a,{href:s.longUrl})}),Object(W.jsx)("td",{className:"responsive-table__cell short-urls-row__cell","data-th":"Tags",children:(a=s.tags,Object(S.a)(a)?Object(W.jsx)("i",{className:"indivisible",children:Object(W.jsx)("small",{children:"No tags"})}):a.map((function(e){return Object(W.jsx)(z,{colorGenerator:t,text:e,onClick:function(){return null===o||void 0===o?void 0:o(e)}},e)})))}),Object(W.jsx)("td",{className:"responsive-table__cell short-urls-row__cell text-lg-end","data-th":"Visits",children:Object(W.jsx)(Zt,{visitsCount:s.visitsCount,shortUrl:s,selectedServer:i,active:O})}),Object(W.jsx)("td",{className:"responsive-table__cell short-urls-row__cell",children:Object(W.jsx)(e,{selectedServer:i,shortUrl:s})})]})}},Xt=function(e){var t=e.isOpen,r=e.toggle,n=e.children,c=e.right,a=void 0===c||c;return Object(W.jsxs)(K.c,{toggle:r,isOpen:t,children:[Object(W.jsxs)(K.n,{size:"sm",caret:!0,outline:!0,className:"dropdown-btn-menu__dropdown-toggle",children:["\xa0",Object(W.jsx)(A.a,{icon:F.o}),"\xa0"]}),Object(W.jsx)(K.m,{right:a,children:n})]})},$t=function(e,t){return function(r){var n=r.shortUrl,c=r.selectedServer,a=Object(Q.f)(),s=Object(C.a)(a,2),i=s[0],o=s[1],l=Object(Q.f)(),u=Object(C.a)(l,2),d=u[0],j=u[1],b=Object(Q.f)(),h=Object(C.a)(b,2),O=h[0],v=h[1];return Object(W.jsxs)(Xt,{toggle:o,isOpen:i,children:[Object(W.jsxs)(K.l,{tag:Jt,selectedServer:c,shortUrl:n,suffix:"visits",children:[Object(W.jsx)(A.a,{icon:F.g,fixedWidth:!0})," Visit stats"]}),Object(W.jsxs)(K.l,{tag:Jt,selectedServer:c,shortUrl:n,suffix:"edit",children:[Object(W.jsx)(A.a,{icon:F.n,fixedWidth:!0})," Edit short URL"]}),Object(W.jsxs)(K.l,{onClick:j,children:[Object(W.jsx)(A.a,{icon:F.G,fixedWidth:!0})," QR code"]}),Object(W.jsx)(t,{shortUrl:n,isOpen:d,toggle:j}),Object(W.jsx)(K.l,{divider:!0}),Object(W.jsxs)(K.l,{className:"dropdown-item--danger",onClick:v,children:[Object(W.jsx)(A.a,{icon:F.z,fixedWidth:!0})," Delete short URL"]}),Object(W.jsx)(e,{shortUrl:n,isOpen:O,toggle:v})]})}},er=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(P.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(W.jsxs)(W.Fragment,{children:[Object(W.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(W.jsx)(t,Object(u.a)(Object(u.a)({},c),{},{resetCreateShortUrl:a,canBeClosed:o}))]})}},tr=r(27),rr=r(28),nr=function(e){var t=e.children,r=e.type,n=e.className,c=e.small,a=void 0!==c&&c;return Object(W.jsx)(K.I,{className:n,children:Object(W.jsx)("div",{className:H()({"col-md-10 offset-md-1":!a,"col-12":a}),children:Object(W.jsx)(rr.a,{className:H()("text-center",{"bg-main":"success"===r,"bg-danger":"error"===r,"bg-warning":"warning"===r,"text-white":"warning"!==r}),bodyClassName:H()({"p-2":a}),children:t})})})},cr=function(e){var t;return null===(t=e.response)||void 0===t?void 0:t.data},ar=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)},sr=function(e){var t,r,n=e.errorData,c=e.fallbackMessage;return Object(W.jsxs)(W.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(W.jsxs)("p",{className:"mb-0",children:["Invalid elements: [",n.invalidElements.join(", "),"]"]}))]})},ir=function(e){var t=e.shortUrl,r=e.toggle,n=e.isOpen,c=e.shortUrlDeletion,a=e.resetDeleteShortUrl,s=e.deleteShortUrl,i=Object(P.useState)(""),o=Object(C.a)(i,2),l=o[0],u=o[1];Object(P.useEffect)((function(){return a}),[]);var d=c.error,j=c.errorData,b=Object(M.a)(a,r),h=Object(tr.b)((function(){var e=t.shortCode,n=t.domain;s(e,n).then(r).catch(Ee.a)}));return Object(W.jsx)(K.t,{isOpen:n,toggle:b,centered:!0,children:Object(W.jsxs)("form",{onSubmit:h,children:[Object(W.jsx)(K.w,{toggle:b,children:Object(W.jsx)("span",{className:"text-danger",children:"Delete short URL"})}),Object(W.jsxs)(K.u,{children:[Object(W.jsxs)("p",{children:[Object(W.jsx)("b",{className:"text-danger",children:"Caution!"})," You are about to delete a short URL."]}),Object(W.jsx)("p",{children:"This action cannot be undone. Once you have deleted it, all the visits stats will be lost."}),Object(W.jsxs)("p",{children:["Write ",Object(W.jsx)("b",{children:t.shortCode})," to confirm deletion."]}),Object(W.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(W.jsx)(nr,{type:ar(j)?"warning":"error",small:!0,className:"mt-2",children:Object(W.jsx)(sr,{errorData:j,fallbackMessage:"Something went wrong while deleting the URL :("})})]}),Object(W.jsxs)(K.v,{children:[Object(W.jsx)("button",{type:"button",className:"btn btn-link",onClick:b,children:"Cancel"}),Object(W.jsx)("button",{type:"submit",className:"btn btn-danger",disabled:l!==t.shortCode||c.loading,children:c.loading?"Deleting...":"Delete"})]})]})})},or=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(C.a)(o,2),u=l[0],d=l[1];if(Object(P.useEffect)((function(){a()}),[]),r)return Object(W.jsxs)(nr,{type:"error",className:"mt-3",children:[i&&Object(W.jsx)(A.a,{icon:F.Q,className:"float-end pointer",onClick:a}),Object(W.jsx)(sr,{errorData:n,fallbackMessage:"An error occurred while creating the URL :("})]});if(Object(p.a)(c))return null;var j=c.shortUrl;return Object(W.jsxs)(nr,{type:"success",className:"mt-3",children:[i&&Object(W.jsx)(A.a,{icon:F.Q,className:"float-end pointer",onClick:a}),Object(W.jsx)("b",{children:"Great!"})," The short URL is ",Object(W.jsx)("b",{children:j}),Object(W.jsx)(Ht.a,{text:j,onCopy:d,children:Object(W.jsxs)("button",{className:"btn btn-light btn-sm create-short-url-result__copy-btn",id:"copyBtn",type:"button",children:[Object(W.jsx)(A.a,{icon:Ne.d})," Copy"]})}),Object(W.jsx)(K.J,{placement:"left",isOpen:u,target:"copyBtn",children:"Copied!"})]})}},lr=r(490),ur=r(491),dr=r(238),jr=function(e,t,r){return Object(p.a)(r)?e.shortCode===t&&!e.domain:e.shortCode===t&&e.domain===r},br="shlink/visitCreation/CREATE_VISITS",hr=function(e){return{type:br,createdVisits:e}},Or="shlink/deleteShortUrl/DELETE_SHORT_URL_START",vr="shlink/deleteShortUrl/DELETE_SHORT_URL_ERROR",fr="shlink/deleteShortUrl/SHORT_URL_DELETED",mr="shlink/deleteShortUrl/RESET_DELETE_SHORT_URL",gr={shortCode:"",loading:!1,error:!1},xr=ht((Ke={},Object(l.a)(Ke,Or,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!0,error:!1})})),Object(l.a)(Ke,vr,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{errorData:r,loading:!1,error:!0})})),Object(l.a)(Ke,fr,(function(e,t){var r=t.shortCode;return Object(u.a)(Object(u.a)({},e),{},{shortCode:r,loading:!1,error:!1})})),Object(l.a)(Ke,mr,(function(){return gr})),Ke),gr),pr=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:Or}),s=e(a),i=s.deleteShortUrl,n.prev=2,n.next=5,i(t,r);case 5:c({type:fr,shortCode:t,domain:r}),n.next=12;break;case 8:throw n.prev=8,n.t0=n.catch(2),c({type:vr,errorData:cr(n.t0)}),n.t0;case 12:case"end":return n.stop()}}),n,null,[[2,8]])})));return function(e,t){return n.apply(this,arguments)}}()}},Sr=Ot(mr),yr="shlink/createShortUrl/CREATE_SHORT_URL_START",Cr="shlink/createShortUrl/CREATE_SHORT_URL_ERROR",Nr="shlink/createShortUrl/CREATE_SHORT_URL",kr="shlink/createShortUrl/RESET_CREATE_SHORT_URL",wr={result:null,saving:!1,error:!1},_r=ht((Qe={},Object(l.a)(Qe,yr,(function(e){return Object(u.a)(Object(u.a)({},e),{},{saving:!0,error:!1})})),Object(l.a)(Qe,Cr,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{saving:!1,error:!0,errorData:r})})),Object(l.a)(Qe,Nr,(function(e,t){return{result:t.result,saving:!1,error:!1}})),Object(l.a)(Qe,kr,(function(){return wr})),Qe),wr),Ur=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:yr}),a=e(c),s=a.createShortUrl,r.prev=2,r.next=5,s(t);case 5:i=r.sent,n({type:Nr,result:i}),r.next=13;break;case 9:throw r.prev=9,r.t0=r.catch(2),n({type:Cr,errorData:cr(r.t0)}),r.t0;case 13:case"end":return r.stop()}}),r,null,[[2,9]])})));return function(e,t){return r.apply(this,arguments)}}()}},Tr=Ot(kr),Rr="shlink/shortUrlEdition/EDIT_SHORT_URL_START",Er="shlink/shortUrlEdition/EDIT_SHORT_URL_ERROR",Dr="shlink/shortUrlEdition/SHORT_URL_EDITED",Lr=ht((Je={},Object(l.a)(Je,Rr,(function(e){return Object(u.a)(Object(u.a)({},e),{},{saving:!0,error:!1})})),Object(l.a)(Je,Er,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{saving:!1,error:!0,errorData:r})})),Object(l.a)(Je,Dr,(function(e,t){return{shortUrl:t.shortUrl,saving:!1,error:!1}})),Je),{saving:!1,error:!1}),Vr=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:Rr}),i=s(),o=i.selectedServer,l=!Object(Te.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(C.a)(b,1),O=h[0],a({shortUrl:O,type:Dr}),c.next=17;break;case 13:throw c.prev=13,c.t0=c.catch(4),a({type:Er,errorData:cr(c.t0)}),c.t0;case 17:case"end":return c.stop()}}),c,null,[[4,13]])})));return function(e,t){return c.apply(this,arguments)}}()}},Ir="shlink/shortUrlsList/LIST_SHORT_URLS_START",Fr="shlink/shortUrlsList/LIST_SHORT_URLS_ERROR",Ar="shlink/shortUrlsList/LIST_SHORT_URLS",Mr=ht((Ze={},Object(l.a)(Ze,Ir,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!0,error:!1})})),Object(l.a)(Ze,Fr,(function(){return{loading:!1,error:!0}})),Object(l.a)(Ze,Ar,(function(e,t){return{loading:!1,error:!1,shortUrls:t.shortUrls}})),Object(l.a)(Ze,fr,Object(M.a)((function(e,t){var r=t.shortCode,n=t.domain;return e.shortUrls?Object(lr.a)(["shortUrls","data"],Object(x.a)((function(e){return jr(e,r,n)}),e.shortUrls.data),e):e}),(function(e){return e.shortUrls?Object(lr.a)(["shortUrls","pagination","totalItems"],e.shortUrls.pagination.totalItems-1,e):e}))),Object(l.a)(Ze,br,(function(e,t){var r,n,c=t.createdVisits;return Object(lr.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(ur.a)(c.filter((function(t){var r=t.shortUrl;return r&&jr(e,r.shortCode,r.domain)})));return null!==t&&void 0!==t&&t.shortUrl?Object(dr.a)("visitsCount",t.shortUrl.visitsCount,e):e})),e)})),Object(l.a)(Ze,Nr,Object(M.a)((function(e,t){var r=t.result;return e.shortUrls?Object(lr.a)(["shortUrls","data"],[r].concat(Object(Ge.a)(e.shortUrls.data.slice(0,4))),e):e}),(function(e){return e.shortUrls?Object(lr.a)(["shortUrls","pagination","totalItems"],e.shortUrls.pagination.totalItems+1,e):e}))),Object(l.a)(Ze,Dr,(function(e,t){var r=t.shortUrl;return e.shortUrls?Object(lr.a)(["shortUrls","data"],e.shortUrls.data.map((function(e){var t=r.shortCode,n=r.domain;return jr(e,t,n)?r:e})),e):e})),Ze),{loading:!0,error:!1}),Gr=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:Ir}),a=e(c),s=a.listShortUrls,r.prev=2,r.next=5,s(t);case 5:i=r.sent,n({type:Ar,shortUrls:i}),r.next=12;break;case 9:r.prev=9,r.t0=r.catch(2),n({type:Fr});case 12:case"end":return r.stop()}}),r,null,[[2,9]])})));return function(e,t){return r.apply(this,arguments)}}()}},Pr=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=H()({"short-urls-table__header-cell--with-action":!!r}),j=H()("short-urls-table__header-cell",d),b=H()("table table-hover responsive-table",i),h=Object(Te.l)(s);return Object(W.jsxs)("table",{className:b,children:[Object(W.jsx)("thead",{className:"responsive-table__header short-urls-table__header",children:Object(W.jsxs)("tr",{children:[Object(W.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(W.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(W.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(W.jsxs)("th",{className:"short-urls-table__header-cell",children:[Object(W.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(W.jsxs)("span",{className:d,onClick:null===r||void 0===r?void 0:r("longUrl"),children:[Object(W.jsx)("span",{className:"indivisible",children:"Long URL"})," ",null===n||void 0===n?void 0:n("longUrl")]})]}),Object(W.jsx)("th",{className:"short-urls-table__header-cell",children:"Tags"}),Object(W.jsx)("th",{className:j,onClick:null===r||void 0===r?void 0:r("visits"),children:Object(W.jsxs)("span",{className:"indivisible",children:["Visits ",null===n||void 0===n?void 0:n("visits")]})}),Object(W.jsx)("th",{className:"short-urls-table__header-cell",children:"\xa0"})]})}),Object(W.jsx)("tbody",{children:o?Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:6,className:"text-center table-danger text-dark",children:"Something went wrong while loading short URLs :("})}):l?Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:6,className:"text-center",children:"Loading..."})}):!l&&Object(S.a)(null===u||void 0===u?void 0:u.data)?Object(W.jsx)("tr",{children:Object(W.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(W.jsx)(e,{shortUrl:t,selectedServer:s,onTagClick:a},t.shortUrl)}))})]})}},Br=function(e){var t=e.format,r=e.setFormat;return Object(W.jsxs)(J,{text:"Format (".concat(t,")"),children:[Object(W.jsx)(K.l,{active:"png"===t,onClick:function(){return r("png")},children:"PNG"}),Object(W.jsx)(K.l,{active:"svg"===t,onClick:function(){return r("svg")},children:"SVG"})]})},Hr=function(e){var t=e.errorCorrection,r=e.setErrorCorrection;return Object(W.jsxs)(J,{text:"Error correction (".concat(t,")"),children:[Object(W.jsxs)(K.l,{active:"L"===t,onClick:function(){return r("L")},children:[Object(W.jsx)("b",{children:"L"}),"ow"]}),Object(W.jsxs)(K.l,{active:"M"===t,onClick:function(){return r("M")},children:[Object(W.jsx)("b",{children:"M"}),"edium"]}),Object(W.jsxs)(K.l,{active:"Q"===t,onClick:function(){return r("Q")},children:[Object(W.jsx)("b",{children:"Q"}),"uartile"]}),Object(W.jsxs)(K.l,{active:"H"===t,onClick:function(){return r("H")},children:[Object(W.jsx)("b",{children:"H"}),"igh"]})]})},Wr=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(P.useState)(300),u=Object(C.a)(l,2),d=u[0],j=u[1],b=Object(P.useState)(0),h=Object(C.a)(b,2),O=h[0],m=h[1],g=Object(P.useState)("png"),x=Object(C.a)(g,2),p=x[0],N=x[1],k=Object(P.useState)("L"),w=Object(C.a)(k,2),_=w[0],U=w[1],T=Object(P.useMemo)((function(){return{useSizeInPath:!Object(Te.j)(o),marginIsSupported:Object(Te.i)(o),errorCorrectionIsSupported:Object(Te.k)(o)}}),[o]),R=T.marginIsSupported!==T.errorCorrectionIsSupported,E=Object(P.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(y.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(S.a)(d)?"":"?".concat(d))}(c,{size:d,format:p,margin:O,errorCorrection:_},T)}),[c,d,p,O,_,T]),D=Object(P.useMemo)((function(){return d+O}),[d,O]),L=Object(P.useMemo)((function(){if(!(D<500))return D<800?"lg":"xl"}),[D]);return Object(W.jsxs)(K.t,{isOpen:i,toggle:s,centered:!0,size:L,children:[Object(W.jsxs)(K.w,{toggle:s,children:["QR code for ",Object(W.jsx)(Pt.a,{href:c,children:c})]}),Object(W.jsxs)(K.u,{children:[Object(W.jsxs)(K.I,{children:[Object(W.jsxs)(K.o,{className:"d-grid ".concat(R?"col-md-4":"col-md-6"),children:[Object(W.jsxs)("label",{children:["Size: ",d,"px"]}),Object(W.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(W.jsxs)(K.o,{className:"d-grid ".concat(R?"col-md-4":"col-md-6"),children:[Object(W.jsxs)("label",{children:["Margin: ",O,"px"]}),Object(W.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(W.jsx)(K.o,{className:R?"col-md-4":"col-md-6",children:Object(W.jsx)(Br,{format:p,setFormat:N})}),T.errorCorrectionIsSupported&&Object(W.jsx)(K.o,{className:"col-md-6",children:Object(W.jsx)(Hr,{errorCorrection:_,setErrorCorrection:U})})]}),Object(W.jsxs)("div",{className:"text-center",children:[Object(W.jsxs)("div",{className:"mb-3",children:[Object(W.jsx)(Pt.a,{href:E}),Object(W.jsx)(Wt,{text:E})]}),Object(W.jsx)("img",{src:E,className:"qr-code-modal__img",alt:"QR code"}),Object(W.jsx)(t,{minVersion:"2.9.0",children:Object(W.jsx)("div",{className:"mt-3",children:Object(W.jsxs)(K.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(W.jsx)(A.a,{icon:F.r,className:"ms-1"})]})})})]})]})]})}},qr=r(492),zr=r(493),Kr=function(e){return Object(W.jsx)(De,Object(u.a)({type:"checkbox"},e))},Qr=function(e){var t=e.isOpen,r=e.toggle;return Object(W.jsxs)(K.t,{isOpen:t,toggle:r,centered:!0,size:"lg",children:[Object(W.jsx)(K.w,{toggle:r,children:"Info"}),Object(W.jsxs)(K.u,{children:[Object(W.jsxs)("p",{children:["When the\xa0",Object(W.jsx)("b",{children:Object(W.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(W.jsx)("p",{children:"These are the checks performed by Shlink in order to determine if an existing short URL should be returned:"}),Object(W.jsxs)("ul",{children:[Object(W.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(W.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(W.jsx)("br",{}),"If the slug is being used by another long URL, an error will be returned."]}),Object(W.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"})]})]})]})},Jr=function(){var e=Object(Q.f)(),t=Object(C.a)(e,2),r=t[0],n=t[1];return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("span",{title:"What does this mean?",children:Object(W.jsx)(A.a,{icon:F.v,style:{cursor:"pointer"},onClick:n})}),Object(W.jsx)(Qr,{isOpen:r,toggle:n})]})},Zr=function(e){var t=e.className,r=void 0===t?"":t,n=e.placement,c=e.children,a=Object(P.useRef)();return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("span",{className:r,ref:function(e){a.current=e},children:Object(W.jsx)(A.a,{icon:F.v})}),Object(W.jsx)(K.L,{target:function(){return a.current},placement:n,children:c})]})},Yr=function(e){var t=e.children,r=e.infoTooltip,n=e.checked,c=e.onChange;return Object(W.jsxs)("p",{children:[Object(W.jsx)(Kr,{inline:!0,checked:n,className:r?"me-2":"",onChange:c,children:t}),r&&Object(W.jsx)(Zr,{placement:"right",children:r})]})},Xr=Object(M.a)(qr.a,Object(zr.a)(/ /g,"-")),$r=function(e){return"string"===typeof e?Object(G.default)(e):e},en=function(e){return{"col-sm-6":e,"col-sm-12":!e}},tn=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(P.useState)(i),j=Object(C.a)(d,2),b=j[0],h=j[1],O="edit"===c,m="create-basic"===c,g=Object(tr.c)(i.title),x=function(){var e=Object(tr.c)(b.title);return Object(ee.a)([[function(){return!e&&!g},function(){}],[function(){return!e&&g},function(){return null}],[te.a,function(){return b.title}]])()},p=Object(tr.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=le(b.validSince))&&void 0!==t?t:null,validUntil:null!==(r=le(b.validUntil))&&void 0!==r?r:null,maxVisits:Object(tr.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(P.useEffect)((function(){h(i)}),[i]);var y=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(W.jsx)(K.o,Object(u.a)(Object(u.a)({},a),{},{children:Object(W.jsx)(K.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))}))},N=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object(W.jsx)(ke,Object(u.a)({selected:b[e]?$r(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(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(K.o,{children:Object(W.jsx)(K.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(W.jsxs)(K.I,{children:[m&&y("customSlug","Custom slug","text",{bsSize:"lg"},{className:"col-lg-6"}),Object(W.jsx)("div",{className:m?"col-lg-6":"col-12 mb-0",children:Object(W.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(Xr)}))}})})]})]}),w=Object(Te.l)(o),_=w||!O,U=H()("mb-3",en(_)),T=Object(Te.c)(o),R=Object(Te.f)(o),E=T||R,D=H()("mb-3",en(E));return Object(W.jsxs)("form",{className:"short-url-form",onSubmit:p,children:[m&&k,!m&&Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(rr.a,{title:"Basic options",className:"mb-3",children:k}),Object(W.jsxs)(K.I,{children:[_&&Object(W.jsx)("div",{className:"col-sm-6 mb-3",children:Object(W.jsxs)(rr.a,{title:"Customize the short URL",children:[w&&y("title","Title"),!O&&Object(W.jsxs)(W.Fragment,{children:[Object(W.jsxs)(K.I,{children:[Object(W.jsx)("div",{className:"col-lg-6",children:y("customSlug","Custom slug","text",{disabled:Object(tr.c)(b.shortCodeLength)})}),Object(W.jsx)("div",{className:"col-lg-6",children:y("shortCodeLength","Short code length","number",{min:4,disabled:Object(tr.c)(b.customSlug)})})]}),Object(W.jsx)(t,{value:b.domain,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{domain:e}))}})]})]})}),Object(W.jsx)("div",{className:U,children:Object(W.jsxs)(rr.a,{title:"Limit access to the short URL",children:[y("maxVisits","Maximum number of visits allowed","number",{min:1}),Object(W.jsx)("div",{className:"mb-3",children:N("validSince","Enabled since...",{maxDate:b.validUntil?$r(b.validUntil):void 0})}),N("validUntil","Enabled until...",{minDate:b.validSince?$r(b.validSince):void 0})]})})]}),Object(W.jsxs)(K.I,{children:[Object(W.jsx)("div",{className:D,children:Object(W.jsxs)(rr.a,{title:"Extra checks",children:[Object(W.jsx)(Yr,{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(W.jsxs)("p",{children:[Object(W.jsx)(Kr,{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(W.jsx)(Jr,{})]})]})}),E&&Object(W.jsx)("div",{className:"col-sm-6 mb-3",children:Object(W.jsxs)(rr.a,{title:"Configure behavior",children:[T&&Object(W.jsx)(Yr,{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(W.jsx)(Yr,{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(W.jsx)("div",{className:"text-center",children:Object(W.jsx)(K.b,{outline:!0,color:"primary",disabled:a||Object(S.a)(b.longUrl),className:"btn-xs-block",children:a?"Saving...":"Save"})})]})}},rn=r(44),nn=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(Ie.f)().search,u=Object(Ie.h)(),d=Object(Q.b)(),j=a.loading,b=a.error,h=a.errorData,O=a.shortUrl,m=i.saving,g=i.error,x=i.errorData,p=Object(y.a)(l).domain,S=Object(P.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]),N=Object(Q.f)(),k=Object(C.a)(N,4),w=k[0],_=k[2],U=k[3];return Object(P.useEffect)((function(){u.shortCode&&s(u.shortCode,p)}),[]),j?Object(W.jsx)(rn.a,{loading:!0}):b?Object(W.jsx)(nr,{type:"error",children:Object(W.jsx)(sr,{errorData:h,fallbackMessage:"An error occurred while loading short URL detail :("})}):Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("header",{className:"mb-3",children:Object(W.jsx)(K.d,{body:!0,children:Object(W.jsxs)("h2",{className:"d-sm-flex justify-content-between align-items-center mb-0",children:[Object(W.jsx)(K.b,{color:"link",size:"lg",className:"p-0 me-3",onClick:d,children:Object(W.jsx)(A.a,{icon:F.a})}),Object(W.jsx)("span",{className:"text-center",children:Object(W.jsxs)("small",{children:["Edit ",Object(W.jsx)(Pt.a,{href:null!==(r=null===O||void 0===O?void 0:O.shortUrl)&&void 0!==r?r:""})]})}),Object(W.jsx)("span",{})]})})}),Object(W.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(W.jsx)(nr,{type:"error",className:"mt-3",children:Object(W.jsx)(sr,{errorData:x,fallbackMessage:"An error occurred while updating short URL :("})}),w&&Object(W.jsx)(nr,{type:"success",className:"mt-3",children:"Short URL properly edited."})]})}},cn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_START",an="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_ERROR",sn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL",on={loading:!1,error:!1},ln=ht((Ye={},Object(l.a)(Ye,cn,(function(){return{loading:!0,error:!1}})),Object(l.a)(Ye,an,(function(e,t){return{loading:!1,error:!0,errorData:t.errorData}})),Object(l.a)(Ye,sn,(function(e,t){var r=t.shortUrl;return Object(u.a)({shortUrl:r},on)})),Ye),on),un=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:cn}),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 jr(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:sn}),n.next=17;break;case 14:n.prev=14,n.t1=n.catch(1),c({type:an,errorData:cr(n.t1)});case 17:case"end":return n.stop()}}),n,null,[[1,14]])})));return function(e,t){return n.apply(this,arguments)}}()}},dn=function(e,t){e.serviceFactory("ShortUrlsList",Gt,"ShortUrlsTable","ShortUrlsFilteringBar"),e.decorator("ShortUrlsList",t(["selectedServer","mercureInfo","shortUrlsList","settings"],["listShortUrls","createNewVisits","loadMercureInfo"])),e.serviceFactory("ShortUrlsTable",Pr,"ShortUrlsRow"),e.serviceFactory("ShortUrlsRow",Yt,"ShortUrlsRowMenu","ColorGenerator","useStateFlagTimeout"),e.serviceFactory("ShortUrlsRowMenu",$t,"DeleteShortUrlModal","QrCodeModal"),e.serviceFactory("CreateShortUrlResult",or,"useStateFlagTimeout"),e.serviceFactory("ShortUrlForm",tn,"TagsSelector","DomainSelector"),e.serviceFactory("CreateShortUrl",er,"ShortUrlForm","CreateShortUrlResult"),e.decorator("CreateShortUrl",t(["shortUrlCreationResult","selectedServer","settings"],["createShortUrl","resetCreateShortUrl"])),e.serviceFactory("EditShortUrl",nn,"ShortUrlForm"),e.decorator("EditShortUrl",t(["shortUrlDetail","shortUrlEdition","selectedServer","settings"],["getShortUrlDetail","editShortUrl"])),e.serviceFactory("DeleteShortUrlModal",(function(){return ir})),e.decorator("DeleteShortUrlModal",t(["shortUrlDeletion"],["deleteShortUrl","resetDeleteShortUrl"])),e.serviceFactory("QrCodeModal",Wr,"ImageDownloader","ForServerVersion"),e.decorator("QrCodeModal",t(["selectedServer"])),e.serviceFactory("ShortUrlsFilteringBar",Me,"ColorGenerator"),e.decorator("ShortUrlsFilteringBar",t(["selectedServer"])),e.serviceFactory("listShortUrls",Gr,"buildShlinkApiClient"),e.serviceFactory("createShortUrl",Ur,"buildShlinkApiClient"),e.serviceFactory("resetCreateShortUrl",(function(){return Tr})),e.serviceFactory("deleteShortUrl",pr,"buildShlinkApiClient"),e.serviceFactory("resetDeleteShortUrl",(function(){return Sr})),e.serviceFactory("getShortUrlDetail",un,"buildShlinkApiClient"),e.serviceFactory("editShortUrl",Vr,"buildShlinkApiClient")},jn=r(239),bn=r.n(jn),hn=r(51),On=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(W.jsxs)("div",{className:"".concat(c," ").concat(o?"":"mb-3"),children:[Object(W.jsx)("label",{className:"form-label ".concat(s),children:r}),t]})},vn=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(W.jsx)(On,{label:Object(W.jsxs)(W.Fragment,{children:[t,":"]}),className:null!==i&&void 0!==i?i:"",labelClassName:o,children:Object(W.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)}})})},fn=function(e){var t=e.onSubmit,r=e.initialValues,n=e.children,c=e.title,a=Object(P.useState)(""),s=Object(C.a)(a,2),i=s[0],o=s[1],l=Object(P.useState)(""),u=Object(C.a)(l,2),d=u[0],j=u[1],b=Object(P.useState)(""),h=Object(C.a)(b,2),O=h[0],v=h[1],f=Object(tr.b)((function(){return t({name:i,url:d,apiKey:O})}));return Object(P.useEffect)((function(){r&&o(r.name),r&&j(r.url),r&&v(r.apiKey)}),[r]),Object(W.jsxs)("form",{className:"server-form",onSubmit:f,children:[Object(W.jsxs)(rr.a,{className:"mb-3",title:c,children:[Object(W.jsx)(vn,{value:i,onChange:o,children:"Name"}),Object(W.jsx)(vn,{type:"url",value:d,onChange:j,children:"URL"}),Object(W.jsx)(vn,{value:O,onChange:v,children:"API key"})]}),Object(W.jsx)("div",{className:"text-end",children:n})]})},mn=function(e){var t=e.isOpen,r=e.duplicatedServers,n=e.onDiscard,c=e.onSave,a=r.length>1;return Object(W.jsxs)(K.t,{centered:!0,isOpen:t,children:[Object(W.jsxs)(K.w,{children:["Duplicated server",a&&"s"]}),Object(W.jsxs)(K.u,{children:[Object(W.jsx)("p",{children:a?"The next servers already exist:":"There is already a server with:"}),Object(W.jsx)("ul",{children:r.map((function(e,t){var r=e.url,n=e.apiKey;return a?Object(W.jsxs)("li",{children:[Object(W.jsx)("b",{children:r})," - ",Object(W.jsx)("b",{children:n})]},t):Object(W.jsxs)(P.Fragment,{children:[Object(W.jsxs)("li",{children:["URL: ",Object(W.jsx)("b",{children:r})]}),Object(W.jsxs)("li",{children:["API key: ",Object(W.jsx)("b",{children:n})]})]},t)}))}),Object(W.jsxs)("span",{children:[a?"Do you want to ignore duplicated servers":"Do you want to save this server anyway","?"]})]}),Object(W.jsxs)(K.v,{children:[Object(W.jsx)(K.b,{color:"link",onClick:n,children:a?"Ignore duplicated":"Discard"}),Object(W.jsx)(K.b,{color:"primary",onClick:c,children:"Save anyway"})]})]})},gn=function(e){var t=e.type;return Object(W.jsx)("div",{className:"mt-3",children:Object(W.jsxs)(nr,{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."]})})},xn=function(e,t){return function(r){var n=r.servers,c=r.createServer,a=Object(Ie.g)(),s=Object(Q.b)(),i=!!Object.keys(n).length,o=t(!1,4e3),l=Object(C.a)(o,2),d=l[0],j=l[1],b=t(!1,4e3),h=Object(C.a)(b,2),O=h[0],v=h[1],f=Object(Q.f)(),m=Object(C.a)(f,2),g=m[0],x=m[1],p=Object(P.useState)(),S=Object(C.a)(p,2),y=S[0],N=S[1],k=function(){if(y){var e=Object(Re.a)();c(Object(u.a)(Object(u.a)({},y),{},{id:e})),a("/server/".concat(e))}};return Object(P.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(W.jsxs)(hn.a,{children:[Object(W.jsxs)(fn,{title:Object(W.jsx)("h5",{className:"mb-0",children:"Add new server"}),onSubmit:N,children:[!i&&Object(W.jsx)(e,{tooltipPlacement:"top",onImport:j,onImportError:v}),i&&Object(W.jsx)(K.b,{outline:!0,onClick:s,children:"Cancel"}),Object(W.jsx)(K.b,{outline:!0,color:"primary",className:"ms-2",children:"Create server"})]}),d&&Object(W.jsx)(gn,{type:"success"}),O&&Object(W.jsx)(gn,{type:"error"}),Object(W.jsx)(mn,{isOpen:g,duplicatedServers:y?[y]:[],onDiscard:s,onSave:k})]})}},pn=r(482),Sn=function(e){var t=e.servers,r=e.selectedServer,n=Object(pn.a)(t);return Object(W.jsxs)(K.K,{nav:!0,inNavbar:!0,children:[Object(W.jsxs)(K.n,{nav:!0,caret:!0,children:[Object(W.jsx)(A.a,{icon:F.J})," ",Object(W.jsx)("span",{className:"ms-1",children:"Servers"})]}),Object(W.jsx)(K.m,{right:!0,style:{right:0},children:Object(S.a)(n)?Object(W.jsxs)(K.l,{tag:i.b,to:"/server/create",children:[Object(W.jsx)(A.a,{icon:F.F})," ",Object(W.jsx)("span",{className:"ms-1",children:"Add a server"})]}):Object(W.jsxs)(W.Fragment,{children:[n.map((function(e){var t=e.name,n=e.id;return Object(W.jsx)(K.l,{tag:i.b,to:"/server/".concat(n),active:Object(h.a)(r)===n,children:t},n)})),Object(W.jsx)(K.l,{divider:!0}),Object(W.jsxs)(K.l,{tag:i.b,to:"/manage-servers",children:[Object(W.jsx)(A.a,{icon:F.J})," ",Object(W.jsx)("span",{className:"ms-1",children:"Manage servers"})]})]})})]})},yn=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(Ie.g)();return Object(W.jsxs)(K.t,{isOpen:n,toggle:r,centered:!0,children:[Object(W.jsx)(K.w,{toggle:r,children:Object(W.jsx)("span",{className:"text-danger",children:"Remove server"})}),Object(W.jsxs)(K.u,{children:[Object(W.jsxs)("p",{children:["Are you sure you want to remove ",Object(W.jsx)("b",{children:t?t.name:""}),"?"]}),Object(W.jsx)("p",{children:Object(W.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(W.jsxs)(K.v,{children:[Object(W.jsx)("button",{className:"btn btn-link",onClick:r,children:"Cancel"}),Object(W.jsx)("button",{className:"btn btn-danger",onClick:function(){return c(t),r(),void(s&&i("/"))},children:"Delete"})]})]})},Cn=function(e){return function(t){var r=t.server,n=t.className,c=t.children,a=t.textClassName,s=Object(Q.f)(),i=Object(C.a)(s,4),o=i[0],l=i[2],u=i[3];return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsxs)("span",{className:n,onClick:l,children:[!c&&Object(W.jsx)(A.a,{fixedWidth:!0,icon:F.z}),Object(W.jsx)("span",{className:a,children:null!==c&&void 0!==c?c:"Remove this server"})]}),Object(W.jsx)(e,{server:r,isOpen:o,toggle:u})]})}},Nn=r(126),kn=function(e){return Object(Nn.a)((function(e){var t=e.editServer,r=e.selectedServer,n=Object(Q.b)();if(!Object(h.e)(r))return null;return Object(W.jsx)(hn.a,{children:Object(W.jsxs)(fn,{title:Object(W.jsxs)("h5",{className:"mb-0",children:['Edit "',r.name,'"']}),initialValues:r,onSubmit:function(e){t(r.id,e),n()},children:[Object(W.jsx)(K.b,{outline:!0,className:"me-2",onClick:n,children:"Cancel"}),Object(W.jsx)(K.b,{outline:!0,color:"primary",children:"Save"})]})})}),e)},wn=r(512),_n=function(e){return function(t){var r=t.url,n=t.apiKey;return e.some((function(e){return e.url===r&&e.apiKey===n}))}},Un=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(P.useRef)(),O=Object(P.useState)(),m=Object(C.a)(O,2),g=m[0],x=m[1],p=Object(P.useState)([]),S=Object(C.a)(p,2),y=S[0],N=S[1],k=Object(Q.f)(),w=Object(C.a)(k,4),_=w[0],U=w[2],T=w[3],R=Object(M.a)(r,i),E=Object(M.a)((function(){return R(null!==g&&void 0!==g?g:[])}),T),D=Object(M.a)((function(){return R((null!==g&&void 0!==g?g:[]).filter(Object(wn.a)(_n(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(P.useEffect)((function(){if(g){var e=Object.values(n),t=g.filter(_n(e)),r=!!t.length;r?N(t):R(g),r&&U()}}),[g]),Object(W.jsxs)(W.Fragment,{children:[Object(W.jsxs)(K.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(W.jsx)(A.a,{icon:F.s,fixedWidth:!0})," ",null!==a&&void 0!==a?a:"Import from file"]}),Object(W.jsxs)(K.L,{placement:d,target:"importBtn",children:["You can create servers by importing a CSV file with columns ",Object(W.jsx)("b",{children:"name"}),", ",Object(W.jsx)("b",{children:"apiKey"})," and ",Object(W.jsx)("b",{children:"url"}),"."]}),Object(W.jsx)("input",{type:"file",accept:"text/csv",className:"import-servers-btn__csv-select",ref:h,onChange:L}),Object(W.jsx)(mn,{isOpen:_,duplicatedServers:y,onDiscard:D,onSave:E})]})}},Tn=r(471),Rn=r(59),En="shlink/selectedServer/SELECT_SERVER",Dn="shlink/selectedServer/RESET_SELECTED_SERVER",Ln=Object(M.a)((function(e){return"latest"===e?"999.999.999":e}),Object(Rn.c)("1.0.0")),Vn=Object(Tn.a)(Ee.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:Ln(t),printableVersion:Object(Rn.b)(t)}})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),In=ht((Xe={},Object(l.a)(Xe,Dn,(function(){return null})),Object(l.a)(Xe,En,(function(e,t){return t.selectedServer})),Xe),null),Fn=Ot(Dn),An=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(Fn()),s=a(),i=s.servers,o=i[r]){n.next=6;break}return c({type:En,selectedServer:{serverNotFound:!0}}),n.abrupt("return");case 6:return n.prev=6,l=e(o),d=l.health,n.next=10,Vn(r,d);case 10:j=n.sent,b=j.version,h=j.printableVersion,c({type:En,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:En,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)}}()}},Mn=r(494),Gn=r(127),Pn=r(95),Bn="shlink/servers/EDIT_SERVER",Hn="shlink/servers/DELETE_SERVER",Wn="shlink/servers/CREATE_SERVERS",qn="shlink/servers/SET_AUTO_CONNECT",zn=ht(($e={},Object(l.a)($e,Wn,(function(e,t){var r=t.newServers;return Object(u.a)(Object(u.a)({},e),r)})),Object(l.a)($e,Hn,(function(e,t){var r=t.serverId;return Object(bt.a)(r,e)})),Object(l.a)($e,Bn,(function(e,t){var r=t.serverId,n=t.serverData;return e[r]?Object(dr.a)(r,Object(u.a)(Object(u.a)({},e[r]),n),e):e})),Object(l.a)($e,qn,(function(e,t){var r=t.serverId,n=t.autoConnect;return e[r]?n?Object(Mn.a)(Object(Pe.a)(e).map((function(e){var t=Object(C.a)(e,2),n=t[0],c=t[1];return[n,Object(u.a)(Object(u.a)({},c),{},{autoConnect:n===r})]}))):Object(dr.a)(r,Object(u.a)(Object(u.a)({},e[r]),{},{autoConnect:n}),e):e})),$e),{}),Kn=Object(Gn.a)((function(e,t){return Object(dr.a)(t.id,t,e)}),{}),Qn=Object(M.a)(Object(Pn.a)((function(e){return e.id?e:Object(dr.a)("id",Object(Re.a)(),e)})),Kn,(function(e){return{type:Wn,newServers:e}})),Jn=function(e){return Qn([e])},Zn=function(e,t){return{type:Bn,serverId:e,serverData:t}},Yn=function(e){var t=e.id;return{type:Hn,serverId:t}},Xn=function(e,t){var r=e.id;return{type:qn,serverId:r,autoConnect:t}},$n=Object(M.a)(Object(b.a)("data"),(function(e){return Array.isArray(e)?e.filter(h.b):[]})),ec=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=$n(n),r(Qn(c));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}},tc=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(Rn.a)(a,{maxVersion:r,minVersion:t})?Object(W.jsx)(W.Fragment,{children:c}):null},rc=r(140),nc=function(e){return function(t){var r=t.servers,n=t.selectedServer;return Object(W.jsx)(hn.a,{children:Object(W.jsxs)("div",{className:"server-error__container flex-column",children:[Object(W.jsxs)(rn.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(W.jsxs)(W.Fragment,{children:[Object(W.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(W.jsxs)(rc.a,{servers:Object.values(r),children:["These are the Shlink servers currently configured. Choose one of them or ",Object(W.jsx)(i.b,{to:"/server/create",children:"add a new one"}),"."]}),Object(h.e)(n)&&Object(W.jsx)("div",{className:"container mt-3 mt-md-5",children:Object(W.jsxs)("h5",{children:["Alternatively, if you think you may have miss-configured this server, you can ",Object(W.jsx)(e,{server:n,className:"server-error__delete-btn",children:"remove it"})," or\xa0",Object(W.jsx)(i.b,{to:"/server/".concat(n.id,"/edit"),children:"edit it"}),"."]})})]})})}},cc=r(84),ac=function(e){var t=e.children,r=e.title,n=e.link;return Object(W.jsxs)(K.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(W.jsx)(A.a,{size:"3x",className:"highlight-card__link-icon",icon:Ne.a}),Object(W.jsx)(K.i,{tag:"h5",className:"highlight-card__title",children:r}),Object(W.jsx)(K.h,{tag:"h2",children:t})]}))},sc=function(e,t,r){return We((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(Te.h)(u),S=Object(Te.g)(u),y=Object(Ie.g)();return Object(P.useEffect)((function(){s({itemsPerPage:5,orderBy:{field:"dateCreated",dir:"DESC"}}),o(),d()}),[]),Object(W.jsxs)(W.Fragment,{children:[Object(W.jsxs)(K.I,{children:[Object(W.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(W.jsx)(ac,{title:"Visits",link:S&&"/server/".concat(x,"/non-orphan-visits"),children:f?"Loading...":Et(m)})}),Object(W.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(W.jsxs)(ac,{title:"Orphan visits",link:p&&"/server/".concat(x,"/orphan-visits"),children:[Object(W.jsx)(r,{minVersion:"2.6.0",children:f?"Loading...":Et(null!==g&&void 0!==g?g:0)}),Object(W.jsx)(r,{maxVersion:"2.5.*",children:Object(W.jsx)("small",{className:"text-muted",children:Object(W.jsx)("i",{children:"Shlink 2.6 is needed"})})})]})}),Object(W.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(W.jsx)(ac,{title:"Short URLs",link:"/server/".concat(x,"/list-short-urls/1"),children:b?"Loading...":Et(null!==(c=null===O||void 0===O?void 0:O.pagination.totalItems)&&void 0!==c?c:0)})}),Object(W.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(W.jsx)(ac,{title:"Tags",link:"/server/".concat(x,"/manage-tags"),children:v?"Loading...":Et(l.tags.length)})})]}),Object(W.jsxs)(K.d,{className:"mb-3",children:[Object(W.jsxs)(K.g,{children:[Object(W.jsx)("span",{className:"d-sm-none",children:"Create a short URL"}),Object(W.jsx)("h5",{className:"d-none d-sm-inline",children:"Create a short URL"}),Object(W.jsx)(i.b,{className:"float-end",to:"/server/".concat(x,"/create-short-url"),children:"Advanced options \xbb"})]}),Object(W.jsx)(K.e,{children:Object(W.jsx)(t,{basicMode:!0})})]}),Object(W.jsxs)(K.d,{children:[Object(W.jsxs)(K.g,{children:[Object(W.jsx)("span",{className:"d-sm-none",children:"Recently created URLs"}),Object(W.jsx)("h5",{className:"d-none d-sm-inline",children:"Recently created URLs"}),Object(W.jsx)(i.b,{className:"float-end",to:"/server/".concat(x,"/list-short-urls/1"),children:"See all \xbb"})]}),Object(W.jsx)(K.e,{children:Object(W.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[qe.visits,qe.orphanVisits]}))},ic=function(e,t,r,n){return function(c){var a=c.servers,s=Object.values(a),o=Object(P.useState)(s),l=Object(C.a)(o,2),u=l[0],d=l[1],j=u.some((function(e){return!!e.autoConnect})),b=r(!1,4e3),h=Object(C.a)(b,2),O=h[0],m=h[1];return Object(P.useEffect)((function(){d(Object.values(a))}),[a]),Object(W.jsxs)(hn.a,{children:[Object(W.jsx)(q,{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(W.jsxs)(K.I,{className:"mb-3",children:[Object(W.jsxs)("div",{className:"col-md-6 d-flex d-md-block mb-2 mb-md-0",children:[Object(W.jsx)(t,{className:"flex-fill",onImportError:m,children:"Import servers"}),s.length>0&&Object(W.jsxs)(K.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(W.jsx)(A.a,{icon:F.r,fixedWidth:!0})," Export servers"]})]}),Object(W.jsx)("div",{className:"col-md-6 text-md-end d-flex d-md-block",children:Object(W.jsxs)(K.b,{outline:!0,color:"primary",className:"flex-fill",tag:i.b,to:"/server/create",children:[Object(W.jsx)(A.a,{icon:F.F,fixedWidth:!0})," Add a server"]})})]}),Object(W.jsx)(rr.a,{children:Object(W.jsxs)("table",{className:"table table-hover responsive-table mb-0",children:[Object(W.jsx)("thead",{className:"responsive-table__header",children:Object(W.jsxs)("tr",{children:[j&&Object(W.jsx)("th",{style:{width:"50px"}}),Object(W.jsx)("th",{children:"Name"}),Object(W.jsx)("th",{children:"Base URL"}),Object(W.jsx)("th",{})]})}),Object(W.jsxs)("tbody",{children:[!u.length&&Object(W.jsx)("tr",{className:"text-center",children:Object(W.jsx)("td",{colSpan:4,children:"No servers found."})}),u.map((function(e){return Object(W.jsx)(n,{server:e,hasAutoConnect:j},e.id)}))]})]})}),O&&Object(W.jsx)("div",{className:"mt-3",children:Object(W.jsx)(nr,{type:"error",children:"The servers could not be imported. Make sure the format is correct."})})]})}},oc=function(e){return function(t){var r=t.server,n=t.hasAutoConnect;return Object(W.jsxs)("tr",{className:"responsive-table__row",children:[n&&Object(W.jsx)("td",{className:"responsive-table__cell","data-th":"Auto-connect",children:r.autoConnect&&Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(A.a,{icon:F.h,className:"text-primary",id:"autoConnectIcon"}),Object(W.jsx)(K.L,{target:"autoConnectIcon",placement:"right",children:"Auto-connect to this server"})]})}),Object(W.jsx)("th",{className:"responsive-table__cell","data-th":"Name",children:Object(W.jsx)(i.b,{to:"/server/".concat(r.id),children:r.name})}),Object(W.jsx)("td",{className:"responsive-table__cell","data-th":"Base URL",children:r.url}),Object(W.jsx)("td",{className:"responsive-table__cell text-end",children:Object(W.jsx)(e,{server:r})})]})}},lc=function(e){return function(t){var r=t.server,n=t.setAutoConnect,c=Object(Q.f)(),a=Object(C.a)(c,2),s=a[0],o=a[1],l=Object(Q.f)(),u=Object(C.a)(l,4),d=u[0],j=u[2],b=u[3],h="/server/".concat(r.id),O=r.autoConnect,v=O?F.b:Ne.c;return Object(W.jsxs)(Xt,{isOpen:s,toggle:o,children:[Object(W.jsxs)(K.l,{tag:i.b,to:h,children:[Object(W.jsx)(A.a,{icon:F.E,fixedWidth:!0})," Connect"]}),Object(W.jsxs)(K.l,{tag:i.b,to:"".concat(h,"/edit"),children:[Object(W.jsx)(A.a,{icon:F.n,fixedWidth:!0})," Edit server"]}),Object(W.jsxs)(K.l,{onClick:function(){return n(r,!r.autoConnect)},children:[Object(W.jsx)(A.a,{icon:v,fixedWidth:!0})," ",O?"Do not a":"A","uto-connect"]}),Object(W.jsx)(K.l,{divider:!0}),Object(W.jsxs)(K.l,{className:"dropdown-item--danger",onClick:j,children:[Object(W.jsx)(A.a,{icon:F.z,fixedWidth:!0})," Remove server"]}),Object(W.jsx)(e,{redirectHome:!1,server:r,isOpen:d,toggle:b})]})}},uc=function(e){return"string"===typeof e.url&&"string"===typeof e.apiKey&&"string"===typeof e.name},dc=function(e){return Array.isArray(e)&&e.every(uc)},jc=function e(t,r){var n=this;Object(m.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(!dc(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)}}()},bc=r(85),hc=function e(t,r,n){var c=this;Object(m.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(pn.a)(null!==(t=c.storage.get("servers"))&&void 0!==t?t:{}).map(h.f);try{n=c.csvjson.toCSV(r,{headers:"key"}),Object(bc.a)(c.window,n,"shlink-servers.csv")}catch(a){console.error(a)}case 2:case"end":return e.stop()}}),e)})))},Oc=function(e,t){e.serviceFactory("ManageServers",ic,"ServersExporter","ImportServersBtn","useStateFlagTimeout","ManageServersRow"),e.decorator("ManageServers",t(["servers"])),e.serviceFactory("ManageServersRow",oc,"ManageServersRowDropdown"),e.serviceFactory("ManageServersRowDropdown",lc,"DeleteServerModal"),e.decorator("ManageServersRowDropdown",t(null,["setAutoConnect"])),e.serviceFactory("CreateServer",xn,"ImportServersBtn","useStateFlagTimeout"),e.decorator("CreateServer",cc.a),e.decorator("CreateServer",t(["selectedServer","servers"],["createServer","resetSelectedServer"])),e.serviceFactory("EditServer",kn,"ServerError"),e.decorator("EditServer",t(["selectedServer"],["editServer","selectServer"])),e.serviceFactory("ServersDropdown",(function(){return Sn})),e.decorator("ServersDropdown",t(["servers","selectedServer"])),e.serviceFactory("DeleteServerModal",(function(){return yn})),e.decorator("DeleteServerModal",t(null,["deleteServer"])),e.serviceFactory("DeleteServerButton",Cn,"DeleteServerModal"),e.serviceFactory("ImportServersBtn",Un,"ServersImporter"),e.decorator("ImportServersBtn",t(["servers"],["createServers"])),e.serviceFactory("ForServerVersion",(function(){return tc})),e.decorator("ForServerVersion",t(["selectedServer"])),e.serviceFactory("ServerError",nc,"DeleteServerButton"),e.decorator("ServerError",t(["servers","selectedServer"])),e.serviceFactory("Overview",sc,"ShortUrlsTable","CreateShortUrl","ForServerVersion"),e.decorator("Overview",t(["shortUrlsList","tagsList","selectedServer","mercureInfo","visitsOverview"],["listShortUrls","listTags","createNewVisits","loadMercureInfo","loadVisitsOverview"])),e.constant("csvjson",bn.a),e.constant("fileReaderFactory",(function(){return new FileReader})),e.service("ServersImporter",jc,"csvjson","fileReaderFactory"),e.service("ServersExporter",hc,"Storage","window","csvjson"),e.serviceFactory("selectServer",An,"buildShlinkApiClient","loadMercureInfo"),e.serviceFactory("createServer",(function(){return Jn})),e.serviceFactory("createServers",(function(){return Qn})),e.serviceFactory("deleteServer",(function(){return Yn})),e.serviceFactory("editServer",(function(){return Zn})),e.serviceFactory("setAutoConnect",(function(){return Xn})),e.serviceFactory("fetchServers",ec,"axios"),e.serviceFactory("resetSelectedServer",(function(){return Fn}))},vc=r(518),fc=r(495),mc=r(496),gc=r(497),xc=function(){return Object(W.jsx)(vc.a,{attribution:'&copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"})},pc=function(e){return 0===e.length?{}:e.length>1?{bounds:e.map(Object(b.a)("latLong"))}:{zoom:10,center:Object(C.a)(e,1)[0].latLong}},Sc=function(e){var t=e.toggle,r=e.isOpen,n=e.title,c=e.locations,a=void 0===c?[]:c;return Object(W.jsx)(K.t,{toggle:t,isOpen:r,className:"map-modal__modal",contentClassName:"map-modal__modal-content",children:Object(W.jsxs)(K.u,{className:"map-modal__modal-body",children:[Object(W.jsxs)("h3",{className:"map-modal__modal-title",children:[n,Object(W.jsx)("button",{type:"button",className:"btn-close float-end",onClick:t})]}),Object(W.jsxs)(fc.a,Object(u.a)(Object(u.a)({},pc(a)),{},{children:[Object(W.jsx)(xc,{}),a.map((function(e,t){var r=e.cityName,n=e.latLong,c=e.count;return Object(W.jsx)(mc.a,{position:n,children:Object(W.jsxs)(gc.a,{children:[Object(W.jsx)("b",{children:c})," visit",c>1?"s":""," from ",Object(W.jsx)("b",{children:r})]})},t)}))]}))]})})},yc=function(e){var t=e.visits,r=e.goBack,n=e.shortUrl,c=e.children,a=e.title;return Object(W.jsx)("header",{children:Object(W.jsxs)(K.d,{body:!0,children:[Object(W.jsxs)("h2",{className:"d-flex justify-content-between align-items-center mb-0",children:[Object(W.jsx)(K.b,{color:"link",size:"lg",className:"p-0 me-3",onClick:r,children:Object(W.jsx)(A.a,{icon:F.a})}),Object(W.jsx)("span",{className:"text-center d-none d-sm-block",children:Object(W.jsx)("small",{children:a})}),Object(W.jsxs)("span",{className:"badge badge-main ms-3",children:["Visits:"," ",Object(W.jsx)(Zt,{visitsCount:t.length,shortUrl:n})]})]}),Object(W.jsx)("h3",{className:"text-center d-block d-sm-none mb-0 mt-3",children:Object(W.jsx)("small",{children:a})}),c&&Object(W.jsx)("div",{className:"mt-md-2",children:c})]})})},Cc=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(W.jsxs)(W.Fragment,{children:["Visits for ",Object(W.jsx)(Pt.a,{href:l})]});return Object(W.jsxs)(yc,{title:j,goBack:a,visits:o,shortUrl:s,children:[Object(W.jsx)("hr",{}),Object(W.jsxs)("div",{children:["Created: ",s?Object(W.jsxs)("span",{children:[Object(W.jsx)("b",{id:"created",className:"short-url-visits-header__created-at",children:Object(W.jsx)(Kt,{date:s.dateCreated,relative:!0})}),Object(W.jsx)(K.L,{placement:"bottom",target:"created",children:Object(W.jsx)(Kt,{date:s.dateCreated})})]}):Object(W.jsx)("small",{children:"Loading..."})]}),Object(W.jsxs)("div",{children:["".concat(d?"Title":"Long URL",": "),i&&Object(W.jsx)("small",{children:"Loading..."}),!i&&Object(W.jsx)(Pt.a,{href:u,children:null!==d&&void 0!==d?d:u})]})]})},Nc=r(509),kc=function(e){var t=e.children,r=Object(g.a)(e,["children"]);return Object(W.jsx)(K.z,Object(u.a)(Object(u.a)({className:"nav-pills__nav-link",tag:i.c},r),{},{children:t}))},wc=function(e){var t=e.children,r=e.fill,n=void 0!==r&&r,c=e.className,a=void 0===c?"":c;return Object(W.jsx)(K.d,{className:"nav-pills__nav p-0 overflow-hidden ".concat(a),body:!0,children:Object(W.jsx)(K.x,{pills:!0,fill:n,children:P.Children.map(t,(function(e){if(!Object(P.isValidElement)(e)||e.type!==kc)throw new Error("Only NavPillItem children are allowed inside NavPills.");return e}))})})},_c=r(94),Uc=r(502),Tc=r(503),Rc=r(505),Ec=r(499),Dc=r(243),Lc=r(500),Vc=r(261),Ic=r(77),Fc=r(501),Ac=r(504),Mc=r(242),Gc=r.n(Mc),Pc=r(498),Bc="Others",Hc=["Android Browser","Chrome","Chromium","Firefox","Internet Explorer","Microsoft Edge","Opera","Safari","Samsung Internet for Android","Vivaldi","WeChat"],Wc=function(e){var t,r;return Object(tr.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"},qc=function(e,t){return Object.values(Object(u.a)(Object(u.a)({},Object(Pc.a)(t,t.map((function(){return 0})))),e))},zc=function(e,t){var r=e.native,n=Object(C.a)(t,1)[0];null!==r&&void 0!==r&&r.target&&(r.target.style.cursor=n?"pointer":"default")},Kc=function(e){var t=e.dataset,r=e.formattedValue;return"".concat(t.label,": ").concat(Et(r))},Qc=function(e){var t=e.label,r=e.formattedValue;return"".concat(t,": ").concat(Et(r))},Jc=r(38),Zc={monthly:"Month",weekly:"Week",daily:"Day",hourly:"Hour"},Yc={hourly:function(e){return{hours:e}},daily:function(e){return{days:e}},weekly:function(e){return{weeks:e}},monthly:function(e){return{months:e}}},Xc={hourly:Ec.a,daily:Dc.a,weekly:Lc.a,monthly:Vc.a},$c={hourly:function(e){return Object(re.default)(e,"yyyy-MM-dd HH:00")},daily:function(e){return Object(re.default)(e,"yyyy-MM-dd")},weekly:function(e){var t=Object(re.default)(Object(Ic.a)(e),"yyyy-MM-dd"),r=Object(re.default)(Object(Fc.a)(e),"yyyy-MM-dd");return"".concat(t," - ").concat(r)},monthly:function(e){return Object(re.default)(e,"yyyy-MM")}},ea=function(e,t){return Object(Tc.a)((function(t){return $c[e](Object(G.default)(t.date))}),t)},ta=function(e,t,r,n){if(n)return[Object.keys(t),Object.values(t)];var c=function(e,t){var r=Xc[e],n=$c[e],c=Object(G.default)(t[0].date),a=Object(G.default)(t[t.length-1].date),s=r(c,a),i=Yc[e];return[n(a)].concat(Object(Ge.a)(Object(tr.e)(s,(function(e){return n(Object(Ac.a)(a,i(e)))}))))}(r,e);return[c,qc(t,c)]},ra=function(e,t,r){return{label:t,data:e,fill:!1,tension:.2,borderColor:r,backgroundColor:r}},na=null,ca=function(e,t,r){return function(n){var c=Object(C.a)(n,1)[0];if(r&&c){var a,s=c.index;if(na===e[s])r([]),na=null;else r(e[s]&&t[e[s]]||[]),na=null!==(a=e[s])&&void 0!==a?a:null}}},aa=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(P.useState)(r.length>0?function(e){var t,r=new Date,n=Object(G.default)(e);return null!==(t=Object(ee.a)([[function(){return Object(Dc.a)(r,n)<=2},Object(Uc.a)("hourly")],[function(){return Object(Vc.a)(r,n)<=1},Object(Uc.a)("daily")],[function(){return Object(Vc.a)(r,n)<=6},Object(Uc.a)("weekly")]])())&&void 0!==t?t:"monthly"}(r[r.length-1].date):"monthly"),o=Object(C.a)(i,2),l=o[0],u=o[1],d=Object(Q.f)(!0),j=Object(C.a)(d,2),b=j[0],h=j[1],O=Object(P.useMemo)((function(){return function(e,t){return t.reduce((function(t,r){var n,c=$c[e](Object(G.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(P.useMemo)((function(){return ea(l,Object(Rc.a)(r))}),[l,r]),f=Object(P.useMemo)((function(){return ta(r,v,l,b)}),[r,l,b]),m=Object(C.a)(f,2),g=m[0],x=m[1],p=Object(P.useMemo)((function(){return qc(ea(l,Object(Rc.a)(n)),g)}),[n,l,g]),S=function(){var e=ra(x,"Visits",Jc.c);return 0===n.length?[e]:[e,ra(p,a,Jc.a)]},y={maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{intersect:!1,axis:"x",callbacks:{label:Kc}}},scales:{y:{beginAtZero:!0,ticks:{precision:0,callback:Et}},x:{title:{display:!0,text:Zc[l]}}},onHover:zc},N=function(){return Object(W.jsx)(_c.c,{data:{labels:g,datasets:S()},options:y,getElementAtEvent:ca(g,O,s)})};return Object(W.jsxs)(K.d,{children:[Object(W.jsxs)(K.g,{children:[t,Object(W.jsx)("div",{className:"float-end",children:Object(W.jsxs)(K.K,{children:[Object(W.jsx)(K.n,{caret:!0,color:"link",className:"btn-sm p-0",children:"Group by"}),Object(W.jsx)(K.m,{right:!0,children:Object.entries(Zc).map((function(e){var t=Object(C.a)(e,2),r=t[0],n=t[1];return Object(W.jsx)(K.l,{active:l===r,onClick:function(){return u(r)},children:n},r)}))})]})}),Object(W.jsx)("div",{className:"float-end me-2",children:Object(W.jsx)(Le,{checked:b,onChange:h,children:Object(W.jsx)("small",{children:"Skip dates with no visits"})})})]}),Object(W.jsxs)(K.e,{className:"line-chart-card__body",children:[n.length>0&&N(),0===n.length&&N()]})]})},sa=r(506),ia=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!Vt(e)&&n(e)}};return Object(W.jsxs)(K.D,{listClassName:H()("flex-wrap mb-0 simple-paginator",{"justify-content-center":a}),children:[Object(W.jsx)(K.E,{disabled:r<=1,children:Object(W.jsx)(K.F,{previous:!0,tag:"span",onClick:s(r-1)})}),Lt(r,t).map((function(e,t){return Object(W.jsx)(K.E,{disabled:Vt(e),active:r===e,children:Object(W.jsx)(K.F,{tag:"span",onClick:s(e),children:It(e)})},Ft(e,t))})),Object(W.jsx)(K.E,{disabled:r>=t,children:Object(W.jsx)(K.F,{next:!0,tag:"span",onClick:s(r+1)})})]})},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(g.a)(e,["browser","os","referer","country","city"]);return"".concat(r," ").concat(n," ").concat(c," ").concat(a," ").concat(s," ").concat(i.visitedUrl).toLowerCase().includes(t.toLowerCase())}(t,e)}))},la=function(e,t,r){var n=function(e,t){return k(t,e)}(r,t?oa(t,e):Object(Ge.a)(e)),c=n.length;return{visitsGroups:Object(sa.a)(20,n),total:c}},ua=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(P.useState)(b()),O=Object(C.a)(h,2),v=O[0],f=O[1],m=Object(P.useState)(void 0),g=Object(C.a)(m,2),x=g[0],p=g[1],S=Object(P.useState)({}),y=Object(C.a)(S,2),k=y[0],w=y[1],_=Object(P.useMemo)((function(){return la(n,x,k)}),[x,k]),U=Object(P.useRef)(!0),T=Object(P.useState)(1),R=Object(C.a)(T,2),E=R[0],D=R[1],L=20*E,V=L-20,I=Object(Te.b)(i),M=7+Number(I)+Number(d),G=function(e){return function(){return w({field:e,dir:N(e,k.field,k.dir)})}},B=function(e){return Object(W.jsx)(ze,{currentOrder:k,field:e,className:"visits-table__header-icon"})};return Object(P.useEffect)((function(){var e=function(){return f(b())};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),Object(P.useEffect)((function(){D(1),!U.current&&s([]),U.current=!1}),[x]),Object(W.jsx)("div",{className:"table-responsive-md",children:Object(W.jsxs)("table",{className:"table table-bordered table-hover table-sm visits-table",children:[Object(W.jsxs)("thead",{className:"visits-table__header",children:[Object(W.jsxs)("tr",{children:[Object(W.jsx)("th",{className:"".concat(j," text-center"),onClick:function(){return s(a.length<_.total?_.visitsGroups.flat():[])},children:Object(W.jsx)(A.a,{icon:F.h,className:H()({"text-primary":a.length>0})})}),I&&Object(W.jsxs)("th",{className:"".concat(j," text-center"),onClick:G("potentialBot"),children:[Object(W.jsx)(A.a,{icon:F.H}),B("potentialBot")]}),Object(W.jsxs)("th",{className:j,onClick:G("date"),children:["Date",B("date")]}),Object(W.jsxs)("th",{className:j,onClick:G("country"),children:["Country",B("country")]}),Object(W.jsxs)("th",{className:j,onClick:G("city"),children:["City",B("city")]}),Object(W.jsxs)("th",{className:j,onClick:G("browser"),children:["Browser",B("browser")]}),Object(W.jsxs)("th",{className:j,onClick:G("os"),children:["OS",B("os")]}),Object(W.jsxs)("th",{className:j,onClick:G("referer"),children:["Referrer",B("referer")]}),d&&Object(W.jsxs)("th",{className:j,onClick:G("visitedUrl"),children:["Visited URL",B("visitedUrl")]})]}),Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:M,className:"p-0",children:Object(W.jsx)(q,{noBorder:!0,large:!1,onChange:p})})})]}),Object(W.jsxs)("tbody",{children:[!(null!==(t=_.visitsGroups[E-1])&&void 0!==t&&t.length)&&Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:M,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(W.jsxs)("tr",{style:{cursor:"pointer"},className:H()({"table-active":r}),onClick:function(){return s(r?a.filter((function(t){return t!==e})):[].concat(Object(Ge.a)(a),[e]))},children:[Object(W.jsx)("td",{className:"text-center",children:r&&Object(W.jsx)(A.a,{icon:F.h,className:"text-primary"})}),I&&Object(W.jsx)("td",{className:"text-center",children:e.potentialBot&&Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(A.a,{icon:F.H,id:"botIcon".concat(t)}),Object(W.jsx)(K.L,{placement:"right",target:"botIcon".concat(t),children:"Potentially a visit from a bot or crawler"})]})}),Object(W.jsx)("td",{children:Object(W.jsx)(Kt,{date:e.date})}),Object(W.jsx)("td",{children:e.country}),Object(W.jsx)("td",{children:e.city}),Object(W.jsx)("td",{children:e.browser}),Object(W.jsx)("td",{children:e.os}),Object(W.jsx)("td",{children:e.referer}),d&&Object(W.jsx)("td",{children:e.visitedUrl})]},t)}))]}),_.total>20&&Object(W.jsx)("tfoot",{children:Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:M,className:"visits-table__footer-cell visits-table__sticky",children:Object(W.jsxs)("div",{className:"row",children:[Object(W.jsx)("div",{className:"col-md-6",children:Object(W.jsx)(ia,{pagesCount:Math.ceil(_.total/20),currentPage:E,setCurrentPage:D,centered:v})}),Object(W.jsx)("div",{className:H()("col-md-6",{"d-flex align-items-center flex-row-reverse":!v,"text-center mt-3":v}),children:Object(W.jsxs)("div",{children:["Visits ",Object(W.jsx)("b",{children:Et(V+1)})," to"," ",Object(W.jsx)("b",{children:Et(Object(Ut.a)(L,_.total))})," of"," ",Object(W.jsx)("b",{children:Et(_.total)})]})})]})})})})]})})},da=function(e){var t=e.modalTitle,r=e.activeCities,n=e.locations,c=void 0===n?[]:n,a=Object(Q.f)(),s=Object(C.a)(a,4),i=s[0],o=s[2],l=s[3],u=Object(Q.f)(),d=Object(C.a)(u,3),j=d[0],b=d[1],h=d[2],O=Object(P.useState)([]),v=Object(C.a)(O,2),f=v[0],m=v[1],g=Object(P.useRef)(),x=function(e){return function(){m(e?c.filter((function(e){var t=e.cityName;return r.includes(t)})):c),o()}};return Object(W.jsxs)(W.Fragment,{children:[Object(W.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(W.jsx)(A.a,{icon:F.y})}),Object(W.jsx)(K.L,{placement:"left",target:function(){return g.current},children:"Show in map"}),Object(W.jsx)(K.k,{isOpen:j,toggle:b,inNavbar:!0,children:Object(W.jsxs)(K.m,{right:!0,children:[Object(W.jsx)(K.l,{onClick:x(!1),children:"Show all locations"}),Object(W.jsx)(K.l,{onClick:x(!0),children:"Show locations in current page"})]})}),Object(W.jsx)(Sc,{toggle:l,isOpen:i,title:t,locations:f})]})},ja=r(507),ba=function(e){return e.hasOwnProperty("visitedUrl")},ha=Object(M.a)(Object(ja.a)((function(e){return ba(e.visit)?"orphanVisits":"regularVisits"})),(function(e){return Object(u.a)({orphanVisits:[],regularVisits:[]},e)})),Oa=function(e,t){return Object(Tc.a)(Object(b.a)(t),e)},va=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)&&le(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)&&le(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}},fa=function(e,t){return!Object(p.a)(e)&&Object(tr.c)(e[t])},ma=function(e){return"number"===typeof e?e:e?parseFloat(e):0},ga=function(e){return function(t,r){var n=fa(r,e)?r[e]:"Unknown";t[n]=(t[n]||0)+1}},xa=ga("country"),pa=ga("city"),Sa=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),xa(e.countries,t),pa(e.cities,t),function(e,t){if(fa(t,"city")&&"Unknown"!==t.city){var r=t.city,n=t.latitude,c=t.longitude,a=e[r]||{cityName:r,count:0,latLong:[ma(n),ma(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:{}})},ya=Object(Pn.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(tr.c)(e))return{browser:Bc,os:Bc};var t=Gc.a.parse(e),r=t.browser.name,n=t.os.name;return{os:null!==n&&void 0!==n?n:Bc,browser:r&&Hc.includes(r)?r:Bc}}(t)),{},{referer:Wc(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 ba(e)?Object(u.a)(Object(u.a)({},i),{},{type:e.type,visitedUrl:e.visitedUrl}):i})),Ca=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(W.jsxs)(J,{text:"Filters",dropdownClassName:c,className:"me-3",right:!0,minWidth:250,children:[s&&Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(K.l,{header:!0,children:"Bots:"}),Object(W.jsx)(K.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(W.jsx)(K.l,{divider:!0}),a&&Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(K.l,{header:!0,children:"Orphan visits type:"}),Object(W.jsx)(K.l,Object(u.a)(Object(u.a)({},d("base_url")),{},{children:"Base URL"})),Object(W.jsx)(K.l,Object(u.a)(Object(u.a)({},d("invalid_short_url")),{},{children:"Invalid short URL"})),Object(W.jsx)(K.l,Object(u.a)(Object(u.a)({},d("regular_404")),{},{children:"Regular 404"}))]}),Object(W.jsx)(K.l,{divider:!0}),Object(W.jsx)(K.l,{disabled:!Object(tr.c)(n),onClick:function(){return t({})},children:Object(W.jsx)("i",{children:"Clear filters"})})]})},Na=r(52),ka=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(C.a)(o,1)[0].backgroundColor,u=(null!==(r=n.options)&&void 0!==r?r:{}).defaultColor;return Object(W.jsx)("ul",{className:"doughnut-chart-legend",children:s.map((function(e,t){var r;return Object(W.jsxs)("li",{className:"doughnut-chart-legend__item d-flex",children:[Object(W.jsx)("div",{className:"doughnut-chart-legend__item-color",style:{backgroundColor:null!==(r=l[t])&&void 0!==r?r:u}}),Object(W.jsx)("small",{className:"doughnut-chart-legend__item-text flex-fill",children:e})]},e)}))})},wa=function(e){return[{data:e,backgroundColor:["#97BBCD","#F7464A","#46BFBD","#FDB45C","#949FB1","#57A773","#414066","#08B2E3","#B6C454","#DCDCDC","#463730"],borderColor:Object(Jc.h)()?Jc.e:Jc.f,borderWidth:2}]},_a=Object(P.memo)((function(e){var t=e.stats,r=Object(P.useState)(),n=Object(C.a)(r,2),c=n[0],a=n[1],s=Object(Na.a)(t),i=Object(pn.a)(t),o={plugins:{legend:{display:!1},tooltip:{intersect:!0,callbacks:{label:Qc}}}},l=function(e,t){return{labels:e,datasets:wa(t)}}(s,i);return Object(W.jsxs)("div",{className:"row",children:[Object(W.jsx)("div",{className:"col-sm-12 col-md-7",children:Object(W.jsx)(_c.b,{height:300,data:l,options:o,ref:function(e){a(null!==e&&void 0!==e?e:void 0)}})}),Object(W.jsx)("div",{className:"col-sm-12 col-md-5",children:c&&Object(W.jsx)(ka,{chart:c})})]})})),Ua=function(e){var t=e.title,r=e.footer,n=e.children;return Object(W.jsxs)(K.d,{children:[Object(W.jsx)(K.g,{className:"chart-card__header",children:"function"===typeof t?t():t}),Object(W.jsx)(K.e,{children:n}),r&&Object(W.jsx)(K.f,{className:"chart-card__footer--sticky",children:r})]})},Ta=function(e){var t=e.title,r=e.stats;return Object(W.jsx)(Ua,{title:t,children:Object(W.jsx)(_a,{stats:r})})},Ra=r(106),Ea=r(511),Da=r(508),La=function(e){var t=e.toggleClassName,r=e.ranges,n=e.value,c=e.setValue;return Object(W.jsxs)(K.K,{children:[Object(W.jsx)(K.n,{caret:!0,color:"link",className:t,children:"Paginate"}),Object(W.jsxs)(K.m,{right:!0,children:[r.map((function(e){return Object(W.jsxs)(K.l,{active:e===n,onClick:function(){return c(e)},children:[Object(W.jsx)("b",{children:e})," items per page"]},e)})),Object(W.jsx)(K.l,{divider:!0}),Object(W.jsx)(K.l,{disabled:n===1/0,onClick:function(){return c(1/0)},children:Object(W.jsx)("i",{children:"Clear pagination"})})]})]})},Va=function(e){return e.startsWith("hidden")?"":e},Ia=function(e,t,r){var n={data:e,label:r?"Non-selected":"Visits",backgroundColor:Jc.d,borderColor:Jc.c,borderWidth:2};return t.every((function(e){return 0===e}))?[n]:[n,{label:null!==r&&void 0!==r?r:"Selected",data:t,backgroundColor:Jc.b,borderColor:Jc.a,borderWidth:2}]},Fa=function(e,t){return function(r){var n=Object(C.a)(r,1)[0];t&&n&&t(e[n.index])}},Aa=function(e){var t=e.stats,r=e.highlightedStats,n=e.highlightedLabel,c=e.onClick,a=e.max,s=Object(Na.a)(t).map(Va),i=Object(pn.a)(function(e){return!!e&&Object.keys(e).length>0}(r)?Object(Na.a)(r).reduce((function(e,t){return e[t]&&(e[t]-=r[t]),e}),Object(u.a)({},t)):t),o=qc(null!==r&&void 0!==r?r:{},s),l={plugins:{legend:{display:!1},tooltip:{mode:"y",filter:function(e){return""!==e.label},callbacks:{label:Kc}}},scales:{x:{beginAtZero:!0,stacked:!0,max:a,ticks:{precision:0,callback:Et}},y:{stacked:!0}},onHover:zc,indexAxis:"y"},d=function(e,t,r,n){return{labels:e,datasets:Ia(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(W.jsx)(_c.a,{data:d,options:l,height:j,getElementAtEvent:Fa(s,c)},"".concat(j,"_").concat(e))};return Object(W.jsxs)(W.Fragment,{children:[void 0!==r&&b("with_stats"),void 0===r&&b("without_stats")]})},Ma=function(e){return"String"===Object(Ra.a)(e)?Object(Ea.a)(e):e},Ga=function(e){return Object(C.a)(e,1)[0]},Pa=function(e){return Object(C.a)(e,2)[1]},Ba=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(g.a)(e,["stats","highlightedStats","title","sortingItems","extraHeaderContent","withPagination"]),l=Object(P.useState)({}),d=Object(C.a)(l,2),j=d[0],b=d[1],h=Object(P.useState)(1),O=Object(C.a)(h,2),v=O[0],f=O[1],m=Object(P.useState)(50),x=Object(C.a)(m,2),p=x[0],S=x[1],y=function(e){var t=e[v-1];if(v<e.length)return t;var r=e[0].length;return[].concat(Object(Ge.a)(t),Object(Ge.a)(Object(tr.e)(r-t.length,(function(e){return["hidden_".concat(e),0]}))))},N=function(e,t,r){var n=function(e,t){var r=Object(Pe.a)(e),n=j.field?Object(Da.a)(Object(M.a)(j.field===Object.keys(t)[0]?Ga:Pa,Ma),r):r;return j.dir&&"ASC"!==j.dir?Object(Rc.a)(n):n}(e,r),c=n.map(Ga),a=t&&Object(Pe.a)(Object(u.a)(Object(u.a)({},Object(Pc.a)(c,c.map((function(){return 0})))),t));if(n.length<=p)return{currentPageStats:Object(Mn.a)(n),currentPageHighlightedStats:a&&Object(Mn.a)(a)};var s,i,o=Object(sa.a)(p,n),l=a&&Object(sa.a)(p,a);return{currentPageStats:Object(Mn.a)(y(o)),currentPageHighlightedStats:l&&Object(Mn.a)(y(l)),pagination:(i=o.length,Object(W.jsx)(ia,{currentPage:v,pagesCount:i,setCurrentPage:f})),max:(s=Math.max.apply(Math,Object(Ge.a)(n.map(Pa))),10*Tt(s/10))}}(t,r&&Object.keys(r).length>0?r:void 0,c),k=N.currentPageStats,w=N.currentPageHighlightedStats,_=N.pagination,U=N.max,T=Object.keys(k);return Object(W.jsx)(Ua,{title:function(){return Object(W.jsxs)(W.Fragment,{children:[n,Object(W.jsx)("div",{className:"float-end",children:Object(W.jsx)(Be,{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(W.jsx)("div",{className:"float-end",children:Object(W.jsx)(La,{toggleClassName:"btn-sm p-0 me-3",ranges:[50,100,200,500],value:p,setValue:function(e){S(e),f(1)}})}),a&&Object(W.jsx)("div",{className:"float-end",children:a(_?T:void 0)})]})},footer:_,children:Object(W.jsx)(Aa,Object(u.a)({stats:k,highlightedStats:w,max:U},o))})},Ha={byTime:{title:"By time",subPath:"by-time",icon:F.d},byContext:{title:"By context",subPath:"by-context",icon:F.g},byLocation:{title:"By location",subPath:"by-location",icon:F.y},list:{title:"List",subPath:"list",icon:F.x}},Wa=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(P.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(C.a)(x,2),y=p[0],N=p[1],k=Object(P.useState)(pe(y)),w=Object(C.a)(k,2),_=w[0],U=w[1],T=Object(P.useState)([]),R=Object(C.a)(T,2),E=R[0],D=R[1],L=Object(P.useState)(),V=Object(C.a)(L,2),I=V[0],M=V[1],G=Object(P.useState)({}),B=Object(C.a)(G,2),q=B[0],z=B[1],Q=Object(Te.b)(u),J=Object(P.useRef)(!0),Z=function(e){var t=i?"?domain=".concat(i):"";return e?"".concat(e).concat(t):"".concat(t)},Y=Object(P.useMemo)((function(){return ya(b)}),[b]),X=Object(P.useMemo)((function(){return Sa(Y)}),[Y]),$=X.os,ee=X.browsers,te=X.referrers,re=X.countries,ne=X.cities,ce=X.citiesForMap,ae=X.visitedUrls,se=Object(pn.a)(ce),ie=function(e){et=void 0,D(e)},oe=function(e){return function(t){var r="".concat(e,"_").concat(t);et===r?(D([]),M(void 0),et=void 0):(D(Y.filter(Object(Nc.a)(e,t))),M(t),et=r)}};Object(P.useEffect)((function(){return s}),[]),Object(P.useEffect)((function(){a({dateRange:_,filter:q},J.current),J.current=!1}),[_,q]),Object(P.useEffect)((function(){g&&N(g)}),[g]);return Object(W.jsxs)(W.Fragment,{children:[n,Object(W.jsx)("section",{className:"mt-3",children:Object(W.jsxs)("div",{className:"row flex-md-row-reverse",children:[Object(W.jsx)("div",{className:"col-lg-7 col-xl-6",children:Object(W.jsxs)("div",{className:"d-md-flex",children:[Object(W.jsx)("div",{className:"flex-fill",children:Object(W.jsx)(Ue,{updatable:!0,disabled:h,initialDateRange:y,defaultText:"All visits",onDatesChange:U})}),Object(W.jsx)(Ca,{className:"ms-0 ms-md-2 mt-3 mt-md-0",isOrphanVisits:j,botsSupported:Q,selected:q,onChange:z})]})}),b.length>0&&Object(W.jsx)("div",{className:"col-lg-5 col-xl-6 mt-3 mt-lg-0",children:Object(W.jsxs)("div",{className:"d-flex",children:[Object(W.jsxs)(K.b,{outline:!0,disabled:0===E.length,className:"btn-md-block me-2",onClick:function(){return ie([])},children:["Clear selection ",E.length>0&&Object(W.jsxs)(W.Fragment,{children:["(",Et(E.length),")"]})]}),Object(W.jsxs)(K.b,{outline:!0,color:"primary",className:"btn-md-block",onClick:function(){return l(Y)},children:[Object(W.jsx)(A.a,{icon:F.r})," Export (",Et(Y.length),")"]})]})})]})}),Object(W.jsx)("section",{className:"mt-3",children:O?Object(W.jsxs)(rn.a,{loading:!0,children:["This is going to take a while... :S",Object(W.jsx)(K.H,{value:m,striped:100===m,className:"mt-3"})]}):h?Object(W.jsx)(rn.a,{loading:!0}):v?Object(W.jsx)(nr,{type:"error",children:Object(W.jsx)(sr,{errorData:f,fallbackMessage:"An error occurred while loading visits :("})}):Object(S.a)(b)?Object(W.jsx)(rn.a,{children:"There are no visits matching current filter :("}):Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(wc,{fill:!0,children:Object.values(Ha).map((function(e,t){var r=e.title,n=e.icon,c=e.subPath;return Object(W.jsxs)(kc,{to:Z(c),replace:!0,children:[Object(W.jsx)(A.a,{icon:n}),Object(W.jsx)("span",{className:"ms-2 d-none d-sm-inline",children:r})]},t)}))}),Object(W.jsx)(K.I,{children:Object(W.jsxs)(Ie.d,{children:[Object(W.jsx)(Ie.b,{path:Ha.byTime.subPath,element:Object(W.jsx)("div",{className:"col-12 mt-3",children:Object(W.jsx)(aa,{title:"Visits during time",visits:Y,highlightedVisits:E,highlightedLabel:I,setSelectedVisits:ie})})}),Object(W.jsx)(Ie.b,{path:Ha.byContext.subPath,element:Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("div",{className:H()("mt-3 col-lg-6",{"col-xl-4":!j}),children:Object(W.jsx)(Ta,{title:"Operating systems",stats:$})}),Object(W.jsx)("div",{className:H()("mt-3 col-lg-6",{"col-xl-4":!j}),children:Object(W.jsx)(Ta,{title:"Browsers",stats:ee})}),Object(W.jsx)("div",{className:H()("mt-3",{"col-xl-4":!j,"col-lg-6":j}),children:Object(W.jsx)(Ba,{title:"Referrers",stats:te,withPagination:!1,highlightedStats:Oa(E,"referer"),highlightedLabel:I,sortingItems:{name:"Referrer name",amount:"Visits amount"},onClick:oe("referer")})}),j&&Object(W.jsx)("div",{className:"mt-3 col-lg-6",children:Object(W.jsx)(Ba,{title:"Visited URLs",stats:ae,highlightedLabel:I,highlightedStats:Oa(E,"visitedUrl"),sortingItems:{visitedUrl:"Visited URL",amount:"Visits amount"},onClick:oe("visitedUrl")})})]})}),Object(W.jsx)(Ie.b,{path:Ha.byLocation.subPath,element:Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("div",{className:"col-lg-6 mt-3",children:Object(W.jsx)(Ba,{title:"Countries",stats:re,highlightedStats:Oa(E,"country"),highlightedLabel:I,sortingItems:{name:"Country name",amount:"Visits amount"},onClick:oe("country")})}),Object(W.jsx)("div",{className:"col-lg-6 mt-3",children:Object(W.jsx)(Ba,{title:"Cities",stats:ne,highlightedStats:Oa(E,"city"),highlightedLabel:I,extraHeaderContent:function(e){return se.length>0&&Object(W.jsx)(da,{modalTitle:"Cities",locations:se,activeCities:e})},sortingItems:{name:"City name",amount:"Visits amount"},onClick:oe("city")})})]})}),Object(W.jsx)(Ie.b,{path:Ha.list.subPath,element:Object(W.jsx)("div",{className:"col-12",children:Object(W.jsx)(ua,{visits:Y,selectedVisits:E,setSelectedVisits:ie,isOrphanVisits:j,selectedServer:u})})}),Object(W.jsx)(Ie.b,{path:"*",element:Object(W.jsx)(Ie.a,{replace:!0,to:Z(Ha.byTime.subPath)})})]})})]})})]})},qa=function(e){var t=e.exportVisits;return We((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(Ie.h)().shortCode,d=void 0===l?"":l,j=Object(Ie.f)().search,b=Object(Q.b)(),h=Object(y.a)(j).domain;return Object(P.useEffect)((function(){a(d,h)}),[]),Object(W.jsx)(Wa,{getVisits:function(e,t){return c(d,Object(u.a)(Object(u.a)({},va(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(W.jsx)(Cc,{shortUrlDetail:n,shortUrlVisits:r,goBack:b})})}),(function(e,t){return[qe.shortUrlVisits(t.shortCode)]}))},za=function(e){var t=e.tagVisits,r=e.goBack,n=e.colorGenerator,c=t.visits,a=t.tag,s=Object(W.jsxs)("span",{className:"d-flex align-items-center justify-content-center",children:[Object(W.jsx)("span",{className:"me-2",children:"Visits for"}),Object(W.jsx)(z,{text:a,colorGenerator:n})]});return Object(W.jsx)(yc,{title:s,goBack:r,visits:c})},Ka=function(e,t){var r=t.exportVisits;return We((function(t){var n=t.getTagVisits,c=t.tagVisits,a=t.cancelGetTagVisits,s=t.settings,i=t.selectedServer,o=Object(Q.b)(),l=Object(Ie.h)().tag,u=void 0===l?"":l;return Object(W.jsx)(Wa,{getVisits:function(e,t){return n(u,va(e),t)},cancelGetVisits:a,visitsInfo:c,settings:s,exportCsv:function(e){return r("tag_".concat(u,"_visits.csv"),e)},selectedServer:i,children:Object(W.jsx)(za,{tagVisits:c,goBack:o,colorGenerator:e})})}),(function(){return[qe.visits]}))},Qa=function(e){var t=e.orphanVisits,r=e.goBack,n=t.visits;return Object(W.jsx)(yc,{title:"Orphan visits",goBack:r,visits:n})},Ja=function(e){var t=e.exportVisits;return We((function(e){var r=e.getOrphanVisits,n=e.orphanVisits,c=e.cancelGetOrphanVisits,a=e.settings,s=e.selectedServer,i=Object(Q.b)();return Object(W.jsx)(Wa,{getVisits:function(e,t){var n;return r(va(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(W.jsx)(Qa,{orphanVisits:n,goBack:i})})}),(function(){return[qe.orphanVisits]}))},Za=function(e){var t=e.nonOrphanVisits,r=e.goBack,n=t.visits;return Object(W.jsx)(yc,{title:"Non-orphan visits",goBack:r,visits:n})},Ya=function(e){var t=e.exportVisits;return We((function(e){var r=e.getNonOrphanVisits,n=e.nonOrphanVisits,c=e.cancelGetNonOrphanVisits,a=e.settings,s=e.selectedServer,i=Object(Q.b)();return Object(W.jsx)(Wa,{getVisits:function(e,t){return r(va(e),t)},cancelGetVisits:c,visitsInfo:n,settings:a,exportCsv:function(e){return t("non_orphan_visits.csv",e)},selectedServer:s,children:Object(W.jsx)(Za,{nonOrphanVisits:n,goBack:i})})}),(function(){return[qe.visits]}))},Xa=r(517),$a=5e3,es=function(e){return e.currentPage>=e.pagesCount},ts=function(e,t){return 100*t/e},rs=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,$a).then(Object(b.a)("data")));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())).then(Xa.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:ts(t.length,r+2)}),!(r<t.length-1)){e.next=13;break}return e.t0=n,e.next=11,o(t,r+1);case 11:return e.t1=e.sent,e.abrupt("return",e.t0.concat.call(e.t0,e.t1));case 13:return e.abrupt("return",n);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),l=function(){var e=Object(f.a)(v.a.mark((function e(){var r,n,s,i,l,u,d=arguments;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=d.length>0&&void 0!==d[0]?d[0]:1,e.next=3,t(r,$a);case 3:if(n=e.sent,s=n.pagination,i=n.data,s&&!es(s)){e.next=8;break}return e.abrupt("return",i);case 8:return l=Object(wt.a)(2,s.pagesCount+1),u=Object(sa.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(C.a)(d,2),h=j[0],O=j[1],a(!h.length&&O?{type:c.fallbackToInterval,fallbackInterval:Se(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:cr(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)}}(),ns=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)})))},cs="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_START",as="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_ERROR",ss="shlink/shortUrlVisits/GET_SHORT_URL_VISITS",is="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_LARGE",os="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_CANCEL",ls="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_PROGRESS_CHANGED",us="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_FALLBACK_TO_INTERVAL",ds={visits:[],shortCode:"",domain:void 0,loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},js=ht((tt={},Object(l.a)(tt,cs,(function(){return Object(u.a)(Object(u.a)({},ds),{},{loading:!0})})),Object(l.a)(tt,as,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},ds),{},{error:!0,errorData:r})})),Object(l.a)(tt,ss,(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)(tt,is,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(tt,os,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(tt,ls,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(tt,us,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(tt,br,(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&&jr(t,n,c)&&je(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(Ge.a)(d),Object(Ge.a)(a))})})),tt),ds),bs=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=ns(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:cs,large:is,finish:ss,error:as,progress:ls,fallbackToInterval:us},c.abrupt("return",rs(l,d,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},hs=Ot(os),Os="shlink/tagVisits/GET_TAG_VISITS_START",vs="shlink/tagVisits/GET_TAG_VISITS_ERROR",fs="shlink/tagVisits/GET_TAG_VISITS",ms="shlink/tagVisits/GET_TAG_VISITS_LARGE",gs="shlink/tagVisits/GET_TAG_VISITS_CANCEL",xs="shlink/tagVisits/GET_TAG_VISITS_PROGRESS_CHANGED",ps="shlink/tagVisits/GET_TAG_VISITS_FALLBACK_TO_INTERVAL",Ss={visits:[],tag:"",loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},ys=ht((rt={},Object(l.a)(rt,Os,(function(){return Object(u.a)(Object(u.a)({},Ss),{},{loading:!0})})),Object(l.a)(rt,vs,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},Ss),{},{error:!0,errorData:r})})),Object(l.a)(rt,fs,(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)(rt,ms,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(rt,gs,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(rt,xs,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(rt,ps,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(rt,br,(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))&&je(r.date,i,o)})).map((function(e){return e.visit}));return Object(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(Ge.a)(l),Object(Ge.a)(c))})})),rt),Ss),Cs=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=ns(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:Os,large:ms,finish:fs,error:vs,progress:xs,fallbackToInterval:ps},c.abrupt("return",rs(l,d,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},Ns=Ot(gs),ks="shlink/orphanVisits/GET_ORPHAN_VISITS_START",ws="shlink/orphanVisits/GET_ORPHAN_VISITS_ERROR",_s="shlink/orphanVisits/GET_ORPHAN_VISITS",Us="shlink/orphanVisits/GET_ORPHAN_VISITS_LARGE",Ts="shlink/orphanVisits/GET_ORPHAN_VISITS_CANCEL",Rs="shlink/orphanVisits/GET_ORPHAN_VISITS_PROGRESS_CHANGED",Es="shlink/orphanVisits/GET_ORPHAN_VISITS_FALLBACK_TO_INTERVAL",Ds={visits:[],loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},Ls=ht((nt={},Object(l.a)(nt,ks,(function(){return Object(u.a)(Object(u.a)({},Ds),{},{loading:!0})})),Object(l.a)(nt,ws,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},Ds),{},{error:!0,errorData:r})})),Object(l.a)(nt,_s,(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)(nt,Us,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(nt,Ts,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(nt,Rs,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(nt,Es,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(nt,br,(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&&je(t.date,s,i)})).map((function(e){return e.visit}));return Object(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(Ge.a)(o),Object(Ge.a)(n))})})),nt),Ds),Vs=function(e,t){return!t||t===e.type},Is=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 ba(e)&&Vs(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=ns(n,o),j=function(){return s().orphanVisits.cancelLoad},b={query:t},h={start:ks,large:Us,finish:_s,error:ws,progress:Rs,fallbackToInterval:Es},c.abrupt("return",rs(l,d,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},Fs=Ot(Ts),As="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_START",Ms="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_ERROR",Gs="shlink/orphanVisits/GET_NON_ORPHAN_VISITS",Ps="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_LARGE",Bs="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_CANCEL",Hs="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_PROGRESS_CHANGED",Ws="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_FALLBACK_TO_INTERVAL",qs={visits:[],loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},zs=ht((ct={},Object(l.a)(ct,As,(function(){return Object(u.a)(Object(u.a)({},qs),{},{loading:!0})})),Object(l.a)(ct,Ms,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},qs),{},{error:!0,errorData:r})})),Object(l.a)(ct,Gs,(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)(ct,Ps,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(ct,Bs,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(ct,Hs,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(ct,Ws,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(ct,br,(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 je(t.date,s,i)})).map((function(e){return e.visit}));return Object(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(Ge.a)(o),Object(Ge.a)(n))})})),ct),qs),Ks=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=ns(r,i),d=function(){return a().orphanVisits.cancelLoad},j={query:t},b={start:As,large:Ps,finish:Gs,error:Ms,progress:Hs,fallbackToInterval:Ws},n.abrupt("return",rs(o,l,j,b,c,d));case 7:case"end":return n.stop()}}),n)})));return function(e,t){return n.apply(this,arguments)}}()}},Qs=Ot(Bs),Js="shlink/visitsOverview/GET_OVERVIEW_START",Zs="shlink/visitsOverview/GET_OVERVIEW_ERROR",Ys="shlink/visitsOverview/GET_OVERVIEW",Xs={visitsCount:0,orphanVisitsCount:0,loading:!1,error:!1},$s=ht((at={},Object(l.a)(at,Js,(function(){return Object(u.a)(Object(u.a)({},Xs),{},{loading:!0})})),Object(l.a)(at,Zs,(function(){return Object(u.a)(Object(u.a)({},Xs),{},{error:!0})})),Object(l.a)(at,Ys,(function(e,t){var r=t.visitsCount,n=t.orphanVisitsCount;return Object(u.a)(Object(u.a)({},Xs),{},{visitsCount:r,orphanVisitsCount:n})})),Object(l.a)(at,br,(function(e,t){var r=e.visitsCount,n=e.orphanVisitsCount,c=void 0===n?0:n,a=Object(g.a)(e,["visitsCount","orphanVisitsCount"]),s=t.createdVisits,i=ha(s),o=i.regularVisits,l=i.orphanVisits;return Object(u.a)(Object(u.a)({},a),{},{visitsCount:r+o.length,orphanVisitsCount:c+l.length})})),at),Xs),ei=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:Js}),t.prev=1,c=e(n),a=c.getVisitsOverview,t.next=5,a();case 5:s=t.sent,r(Object(u.a)({type:Ys},s)),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(1),r({type:Zs});case 12:case"end":return t.stop()}}),t,null,[[1,9]])})));return function(e,r){return t.apply(this,arguments)}}()}},ti=function e(t,r){var n=this;Object(m.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(bc.a)(n.window,r,e)}}},ri=function(e,t){e.serviceFactory("MapModal",(function(){return Sc})),e.serviceFactory("ShortUrlVisits",qa,"VisitsExporter"),e.decorator("ShortUrlVisits",t(["shortUrlVisits","shortUrlDetail","mercureInfo","settings","selectedServer"],["getShortUrlVisits","getShortUrlDetail","cancelGetShortUrlVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("TagVisits",Ka,"ColorGenerator","VisitsExporter"),e.decorator("TagVisits",t(["tagVisits","mercureInfo","settings","selectedServer"],["getTagVisits","cancelGetTagVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("OrphanVisits",Ja,"VisitsExporter"),e.decorator("OrphanVisits",t(["orphanVisits","mercureInfo","settings","selectedServer"],["getOrphanVisits","cancelGetOrphanVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("NonOrphanVisits",Ya,"VisitsExporter"),e.decorator("NonOrphanVisits",t(["nonOrphanVisits","mercureInfo","settings","selectedServer"],["getNonOrphanVisits","cancelGetNonOrphanVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("VisitsParser",(function(){return n})),e.service("VisitsExporter",ti,"window","csvjson"),e.serviceFactory("getShortUrlVisits",bs,"buildShlinkApiClient"),e.serviceFactory("cancelGetShortUrlVisits",(function(){return hs})),e.serviceFactory("getTagVisits",Cs,"buildShlinkApiClient"),e.serviceFactory("cancelGetTagVisits",(function(){return Ns})),e.serviceFactory("getOrphanVisits",Is,"buildShlinkApiClient"),e.serviceFactory("cancelGetOrphanVisits",(function(){return Fs})),e.serviceFactory("getNonOrphanVisits",Ks,"buildShlinkApiClient"),e.serviceFactory("cancelGetNonOrphanVisits",(function(){return Qs})),e.serviceFactory("createNewVisits",(function(){return hr})),e.serviceFactory("loadVisitsOverview",ei,"buildShlinkApiClient")},ni=r(244),ci=r.n(ni),ai=function(e){var t=e.tag,r=e.colorGenerator;return Object(W.jsx)("div",{style:{backgroundColor:r.getColorForKey(t)},className:"tag-bullet"})},si=function(e){return{id:e,name:e}},ii=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(P.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(W.jsx)(ci.a,{tags:c.map(si),tagComponent:function(t){var r=t.tag,n=t.onDelete;return Object(W.jsx)(z,{colorGenerator:e,text:r.name,clearable:!0,className:"react-tags__tag",onClose:n})},suggestions:o.tags.filter((function(e){return!c.includes(e)})).map(si),suggestionComponent:function(t){var r=t.item;return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(ai,{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(Ge.a)(c);t.splice(e,1),a(t)},onAddition:function(e){var t=e.name;return a(Object(Ge.a)(new Set([].concat(Object(Ge.a)(c),Object(Ge.a)(t.toLowerCase().split(","))))))}})}},oi=function(e,t,r){return function(n){var c=n.tag,a=n.selectedServer,s=n.displayed,o=n.toggle,l=Object(Q.f)(),u=Object(C.a)(l,2),d=u[0],j=u[1],b=Object(Q.f)(),O=Object(C.a)(b,2),v=O[0],f=O[1],m=Object(Q.f)(),g=Object(C.a)(m,3),x=g[0],p=g[2],S=Object(P.useRef)(),y=Object(h.a)(a);return Object(P.useEffect)((function(){var e;(e=S.current)&&e.scrollWidth>e.clientWidth&&p()}),[S.current]),Object(W.jsxs)(K.d,{className:"tag-card",children:[Object(W.jsxs)(K.g,{className:"tag-card__header",children:[Object(W.jsx)(K.b,{color:"link",size:"sm",className:"tag-card__btn tag-card__btn--last",onClick:j,children:Object(W.jsx)(A.a,{icon:F.R})}),Object(W.jsx)(K.b,{color:"link",size:"sm",className:"tag-card__btn",onClick:f,children:Object(W.jsx)(A.a,{icon:F.D})}),Object(W.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(W.jsx)(ai,{tag:c.tag,colorGenerator:r}),Object(W.jsx)("span",{className:"tag-card__tag-name",onClick:o,children:c.tag})]})]}),Object(W.jsx)(K.j,{isOpen:s,children:Object(W.jsxs)(K.e,{className:"tag-card__body",children:[Object(W.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(W.jsxs)("span",{className:"text-ellipsis",children:[Object(W.jsx)(A.a,{icon:F.w,className:"me-2"}),"Short URLs"]}),Object(W.jsx)("b",{children:Et(c.shortUrls)})]}),Object(W.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(W.jsxs)("span",{className:"text-ellipsis",children:[Object(W.jsx)(A.a,{icon:F.q,className:"me-2"}),"Visits"]}),Object(W.jsx)("b",{children:Et(c.visits)})]})]})}),Object(W.jsx)(e,{tag:c.tag,toggle:j,isOpen:d}),Object(W.jsx)(t,{tag:c.tag,toggle:f,isOpen:v})]})}},li=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(W.jsxs)(K.t,{toggle:r,isOpen:n,centered:!0,children:[Object(W.jsx)(K.w,{toggle:r,children:Object(W.jsx)("span",{className:"text-danger",children:"Delete tag"})}),Object(W.jsxs)(K.u,{children:["Are you sure you want to delete tag ",Object(W.jsx)("b",{children:t}),"?",o&&Object(W.jsx)(nr,{type:"error",small:!0,className:"mt-2",children:Object(W.jsx)(sr,{errorData:l,fallbackMessage:"Something went wrong while deleting the tag :("})})]}),Object(W.jsxs)(K.v,{children:[Object(W.jsx)("button",{className:"btn btn-link",onClick:r,children:"Cancel"}),Object(W.jsx)("button",{className:"btn btn-danger",disabled:i,onClick:u,children:i?"Deleting tag...":"Delete tag"})]})]})},ui=r(245),di=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(P.useState)(r),l=Object(C.a)(o,2),u=l[0],d=l[1],j=Object(P.useState)(t(r)),b=Object(C.a)(j,2),h=b[0],O=b[1],m=Object(Q.f)(),g=Object(C.a)(m,4),x=g[0],p=g[1],S=g[3],y=i.editing,N=i.error,k=i.errorData,w=Object(tr.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(W.jsx)(K.t,{isOpen:s,toggle:c,centered:!0,onClosed:S,children:Object(W.jsxs)("form",{onSubmit:w,children:[Object(W.jsx)(K.w,{toggle:c,children:"Edit tag"}),Object(W.jsxs)(K.u,{children:[Object(W.jsxs)(K.q,{children:[Object(W.jsx)("div",{id:"colorPickerBtn",className:"input-group-text edit-tag-modal__color-picker-toggle",style:{backgroundColor:h,borderColor:h},onClick:p,children:Object(W.jsx)(A.a,{icon:F.B,className:"edit-tag-modal__color-icon"})}),Object(W.jsx)(K.G,{isOpen:x,toggle:p,target:"colorPickerBtn",placement:"right",hideArrow:!0,popperClassName:"edit-tag-modal__popover",children:Object(W.jsx)(ui.a,{color:h,onChange:O})}),Object(W.jsx)(K.p,{value:u,placeholder:"Tag",required:!0,onChange:function(e){var t=e.target;return d(t.value)}})]}),N&&Object(W.jsx)(nr,{type:"error",small:!0,className:"mt-2",children:Object(W.jsx)(sr,{errorData:k,fallbackMessage:"Something went wrong while editing the tag :("})})]}),Object(W.jsxs)(K.v,{children:[Object(W.jsx)(K.b,{type:"button",color:"link",onClick:c,children:"Cancel"}),Object(W.jsx)(K.b,{color:"primary",disabled:y,children:y?"Saving...":"Save"})]})]})})}},ji={tag:"Tag",shortUrls:"Short URLs",visits:"Visits"},bi=function(e){var t,r=e.mode,n=e.onChange,c=e.renderTitle;return Object(W.jsxs)(J,{text:null!==(t=null===c||void 0===c?void 0:c(r))&&void 0!==t?t:"Display mode: ".concat(r),children:[Object(W.jsxs)(K.l,{active:"cards"===r,onClick:function(){return n("cards")},children:[Object(W.jsx)(A.a,{icon:F.P,fixedWidth:!0,className:"me-1"})," Cards"]}),Object(W.jsxs)(K.l,{active:"list"===r,onClick:function(){return n("list")},children:[Object(W.jsx)(A.a,{icon:F.c,fixedWidth:!0,className:"me-1"})," List"]})]})},hi=function(e,t){return We((function(r){var n,c,a,s,i=r.filterTags,o=r.forceListTags,l=r.tagsList,u=r.selectedServer,d=r.settings,j=Object(P.useState)(null!==(n=null===(c=d.tags)||void 0===c?void 0:c.defaultMode)&&void 0!==n?n:"cards"),b=Object(C.a)(j,2),h=b[0],O=b[1],v=Object(P.useState)(null!==(a=null===(s=d.tags)||void 0===s?void 0:s.defaultOrdering)&&void 0!==a?a:{}),f=Object(C.a)(v,2),m=f[0],g=f[1],x=Object(M.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 k(e,m)}));if(Object(P.useEffect)((function(){o()}),[]),l.loading)return Object(W.jsx)(rn.a,{loading:!0});if(l.error)return Object(W.jsx)(nr,{type:"error",children:Object(W.jsx)(sr,{errorData:l.errorData,fallbackMessage:"Error loading tags :("})});var p=function(e){return function(){var t=N(e,m.field,m.dir);g({field:t?e:void 0,dir:t})}};return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(q,{className:"mb-3",onChange:i}),Object(W.jsxs)(K.I,{className:"mb-3",children:[Object(W.jsx)("div",{className:"col-lg-6",children:Object(W.jsx)(bi,{mode:h,onChange:O})}),Object(W.jsx)("div",{className:"col-lg-6 mt-3 mt-lg-0",children:Object(W.jsx)(Be,{items:ji,order:m,onChange:function(e,t){return g({field:e,dir:t})}})})]}),function(){if(l.filteredTags.length<1)return Object(W.jsx)(rn.a,{children:"No tags found"});var r=x();return"cards"===h?Object(W.jsx)(e,{sortedTags:r,selectedServer:u}):Object(W.jsx)(t,{sortedTags:r,selectedServer:u,currentOrder:m,orderByColumn:p})}()]})}),(function(){return[qe.visits]}))},Oi="shlink/deleteTag/DELETE_TAG_START",vi="shlink/deleteTag/DELETE_TAG_ERROR",fi="shlink/deleteTag/DELETE_TAG",mi="shlink/deleteTag/TAG_DELETED",gi=ht((st={},Object(l.a)(st,Oi,(function(){return{deleting:!0,error:!1}})),Object(l.a)(st,vi,(function(e,t){return{deleting:!1,error:!0,errorData:t.errorData}})),Object(l.a)(st,fi,(function(){return{deleting:!1,error:!1}})),st),{deleting:!1,error:!1}),xi=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:Oi}),a=e(c),s=a.deleteTags,r.prev=2,r.next=5,s([t]);case 5:n({type:fi}),r.next=12;break;case 8:throw r.prev=8,r.t0=r.catch(2),n({type:vi,errorData:cr(r.t0)}),r.t0;case 12:case"end":return r.stop()}}),r,null,[[2,8]])})));return function(e,t){return r.apply(this,arguments)}}()}},pi=function(e){return{type:mi,tag:e}},Si="shlink/editTag/EDIT_TAG_START",yi="shlink/editTag/EDIT_TAG_ERROR",Ci="shlink/editTag/EDIT_TAG",Ni="shlink/editTag/TAG_EDITED",ki=ht((it={},Object(l.a)(it,Si,(function(e){return Object(u.a)(Object(u.a)({},e),{},{editing:!0,error:!1})})),Object(l.a)(it,yi,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{editing:!1,error:!0,errorData:r})})),Object(l.a)(it,Ci,(function(e,t){return Object(u.a)(Object(u.a)({},Object(j.a)(["oldName","newName"],t)),{},{editing:!1,error:!1})})),it),{oldName:"",newName:"",editing:!1,error:!1}),wi=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:Si}),o=e(i),l=o.editTag,a.prev=2,a.next=5,l(r,n);case 5:t.setColorForKey(n,c),s({type:Ci,oldName:r,newName:n}),a.next=13;break;case 9:throw a.prev=9,a.t0=a.catch(2),s({type:yi,errorData:cr(a.t0)}),a.t0;case 13:case"end":return a.stop()}}),a,null,[[2,9]])})));return function(e,t){return a.apply(this,arguments)}}()}},_i=function(e,t,r){return{type:Ni,oldName:e,newName:t,color:r}},Ui="shlink/tagsList/LIST_TAGS_START",Ti="shlink/tagsList/LIST_TAGS_ERROR",Ri="shlink/tagsList/LIST_TAGS",Ei="shlink/tagsList/FILTER_TAGS",Di={tags:[],filteredTags:[],stats:{},loading:!1,error:!1},Li=function(e,t){return function(r){return r===e?t:r}},Vi=function(e,t){return Object(x.a)((function(e){return e===t}),e)},Ii=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}),{}))},Fi=ht((ot={},Object(l.a)(ot,Ui,(function(){return Object(u.a)(Object(u.a)({},Di),{},{loading:!0})})),Object(l.a)(ot,Ti,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},Di),{},{error:!0,errorData:r})})),Object(l.a)(ot,Ri,(function(e,t){var r=t.tags,n=t.stats;return Object(u.a)(Object(u.a)({},Di),{},{stats:n,tags:r,filteredTags:r})})),Object(l.a)(ot,mi,(function(e,t){var r=t.tag;return Object(u.a)(Object(u.a)({},e),{},{tags:Vi(e.tags,r),filteredTags:Vi(e.filteredTags,r)})})),Object(l.a)(ot,Ni,(function(e,t){var r=t.oldName,n=t.newName;return Object(u.a)(Object(u.a)({},e),{},{tags:e.tags.map(Li(r,n)).sort(),filteredTags:e.filteredTags.map(Li(r,n)).sort()})})),Object(l.a)(ot,Ei,(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)(ot,br,(function(e,t){var r,n,c=t.createdVisits;return Object(u.a)(Object(u.a)({},e),{},{stats:(r=Ii(c),n=e.stats,r.reduce((function(e,t){var r=Object(C.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)(ot,Nr,(function(e,t){var r=e.tags,n=Object(g.a)(e,["tags"]),c=t.result;return Object(u.a)(Object(u.a)({},n),{},{tags:r.concat(c.tags.filter((function(e){return!r.includes(e)})))})})),ot),Di),Ai=function(e){return{type:Ei,searchTerm:e}},Mi=Math.ceil,Gi=function(e){return function(t){var r=t.sortedTags,n=t.selectedServer,c=Object(P.useState)(),a=Object(C.a)(c,2),s=a[0],i=a[1],o=r.length,l=Object(sa.a)(Mi(o/4),r);return Object(W.jsx)(K.I,{children:l.map((function(t,r){return Object(W.jsx)("div",{className:"col-md-6 col-xl-3",children:t.map((function(t){return Object(W.jsx)(e,{tag:t,selectedServer:n,displayed:s===t.tag,toggle:function(){return i(s!==t.tag?t.tag:void 0)}},t.tag)}))},r)}))})}},Pi=function(e){return function(t){var r,n=t.sortedTags,c=t.selectedServer,a=t.orderByColumn,s=t.currentOrder,i=Object(P.useRef)(!0),o=Object(Ie.f)().search,l=Object(y.a)(o).page,u=void 0===l?1:l,d=Object(Q.c)("page",Number(u)),j=Object(C.a)(d,2),b=j[0],h=j[1],O=Object(sa.a)(20,n),v=O.length>1,f=null!==(r=O[b-1])&&void 0!==r?r:[];return Object(P.useEffect)((function(){!i.current&&h(1),i.current=!1}),[n]),Object(P.useEffect)((function(){scrollTo(0,0)}),[b]),Object(W.jsxs)(rr.a,{bodyClassName:v?"pb-1":"",children:[Object(W.jsxs)("table",{className:"table table-hover responsive-table mb-0",children:[Object(W.jsxs)("thead",{className:"responsive-table__header",children:[Object(W.jsxs)("tr",{children:[Object(W.jsxs)("th",{className:"tags-table__header-cell",onClick:a("tag"),children:["Tag ",Object(W.jsx)(ze,{currentOrder:s,field:"tag"})]}),Object(W.jsxs)("th",{className:"tags-table__header-cell text-lg-end",onClick:a("shortUrls"),children:["Short URLs ",Object(W.jsx)(ze,{currentOrder:s,field:"shortUrls"})]}),Object(W.jsxs)("th",{className:"tags-table__header-cell text-lg-end",onClick:a("visits"),children:["Visits ",Object(W.jsx)(ze,{currentOrder:s,field:"visits"})]}),Object(W.jsx)("th",{className:"tags-table__header-cell"})]}),Object(W.jsx)("tr",{children:Object(W.jsx)("th",{colSpan:4,className:"p-0 border-top-0"})})]}),Object(W.jsxs)("tbody",{children:[0===f.length&&Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:4,className:"text-center",children:"No results found"})}),f.map((function(t){return Object(W.jsx)(e,{tag:t,selectedServer:c},t.tag)}))]})]}),v&&Object(W.jsx)("div",{className:"sticky-card-paginator",children:Object(W.jsx)(ia,{pagesCount:O.length,currentPage:b,setCurrentPage:h})})]},b)}},Bi=function(e,t,r){return function(n){var c=n.tag,a=n.selectedServer,s=Object(Q.f)(),o=Object(C.a)(s,2),l=o[0],u=o[1],d=Object(Q.f)(),j=Object(C.a)(d,2),b=j[0],O=j[1],v=Object(Q.f)(),f=Object(C.a)(v,2),m=f[0],g=f[1],x=Object(h.a)(a);return Object(W.jsxs)("tr",{className:"responsive-table__row",children:[Object(W.jsxs)("th",{className:"responsive-table__cell","data-th":"Tag",children:[Object(W.jsx)(ai,{tag:c.tag,colorGenerator:r})," ",c.tag]}),Object(W.jsx)("td",{className:"responsive-table__cell text-lg-end","data-th":"Short URLs",children:Object(W.jsx)(i.b,{to:"/server/".concat(x,"/list-short-urls/1?tags=").concat(encodeURIComponent(c.tag)),children:Et(c.shortUrls)})}),Object(W.jsx)("td",{className:"responsive-table__cell text-lg-end","data-th":"Visits",children:Object(W.jsx)(i.b,{to:"/server/".concat(x,"/tag/").concat(c.tag,"/visits"),children:Et(c.visits)})}),Object(W.jsx)("td",{className:"responsive-table__cell text-lg-end",children:Object(W.jsxs)(Xt,{toggle:g,isOpen:m,children:[Object(W.jsxs)(K.l,{onClick:O,children:[Object(W.jsx)(A.a,{icon:F.D,fixedWidth:!0,className:"me-1"})," Edit"]}),Object(W.jsxs)(K.l,{onClick:u,children:[Object(W.jsx)(A.a,{icon:F.R,fixedWidth:!0,className:"me-1"})," Delete"]})]})}),Object(W.jsx)(t,{tag:c.tag,toggle:O,isOpen:b}),Object(W.jsx)(e,{tag:c.tag,toggle:u,isOpen:l})]})}},Hi=function(e,t){e.serviceFactory("TagsSelector",ii,"ColorGenerator"),e.decorator("TagsSelector",t(["tagsList","settings"],["listTags"])),e.serviceFactory("TagCard",oi,"DeleteTagConfirmModal","EditTagModal","ColorGenerator"),e.serviceFactory("DeleteTagConfirmModal",(function(){return li})),e.decorator("DeleteTagConfirmModal",t(["tagDelete"],["deleteTag","tagDeleted"])),e.serviceFactory("EditTagModal",di,"ColorGenerator"),e.decorator("EditTagModal",t(["tagEdit"],["editTag","tagEdited"])),e.serviceFactory("TagsCards",Gi,"TagCard"),e.serviceFactory("TagsTableRow",Bi,"DeleteTagConfirmModal","EditTagModal","ColorGenerator"),e.serviceFactory("TagsTable",Pi,"TagsTableRow"),e.serviceFactory("TagsList",hi,"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(S.a)(s.tags)){r.next=3;break}return r.abrupt("return");case 3:return n({type:Ui}),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:Ri}),r.next=19;break;case 16:r.prev=16,r.t0=r.catch(4),n({type:Ti,errorData:cr(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 Ai})),e.serviceFactory("tagDeleted",(function(){return pi})),e.serviceFactory("tagEdited",(function(){return _i})),e.serviceFactory("deleteTag",xi,"buildShlinkApiClient"),e.serviceFactory("editTag",wi,"buildShlinkApiClient","ColorGenerator")},Wi=r(246),qi="shlink/mercure/GET_MERCURE_INFO_START",zi="shlink/mercure/GET_MERCURE_INFO_ERROR",Ki="shlink/mercure/GET_MERCURE_INFO",Qi=ht((lt={},Object(l.a)(lt,qi,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!0,error:!1})})),Object(l.a)(lt,zi,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!1,error:!0})})),Object(l.a)(lt,Ki,(function(e,t){return Object(u.a)(Object(u.a)({},t),{},{loading:!1,error:!1})})),lt),{loading:!0,error:!1}),Ji=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:qi}),c=n(),a=c.settings,s=e(n),i=s.mercureInfo,a.realTimeUpdates.enabled){t.next=6;break}return r({type:zi}),t.abrupt("return");case 6:return t.prev=6,t.next=9,i();case 9:o=t.sent,r(Object(u.a)({type:Ki,interval:a.realTimeUpdates.interval},o)),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(6),r({type:zi});case 16:case"end":return t.stop()}}),t,null,[[6,13]])})));return function(e,r){return t.apply(this,arguments)}}()}},Zi=function(e){e.serviceFactory("loadMercureInfo",Ji,"buildShlinkApiClient")},Yi=function(e){var t=e.children;return Object(W.jsx)("small",{className:"form-text text-muted d-block",children:t})},Xi=function(e){var t,r=e.settings.realTimeUpdates,n=e.toggleRealTimeUpdates,c=e.setRealTimeUpdatesInterval;return Object(W.jsxs)(rr.a,{title:"Real-time updates",className:"h-100",children:[Object(W.jsx)(K.o,{children:Object(W.jsxs)(Le,{checked:r.enabled,onChange:n,children:["Enable or disable real-time updates.",Object(W.jsxs)(Yi,{children:["Real-time updates are currently being ",Object(W.jsx)("b",{children:r.enabled?"processed":"ignored"}),"."]})]})}),Object(W.jsxs)(On,{noMargin:!0,label:"Real-time updates frequency (in minutes):",labelClassName:H()("form-label",{"text-muted":!r.enabled}),children:[Object(W.jsx)(K.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(W.jsxs)(Yi,{children:[void 0!==r.interval&&r.interval>0&&Object(W.jsxs)("span",{children:["Updates will be reflected in the UI every ",Object(W.jsx)("b",{children:r.interval})," minute",r.interval>1&&"s","."]}),!r.interval&&"Updates will be reflected in the UI as soon as they happen."]})]})]})},$i=function(e){var t=e.items;return Object(W.jsx)(W.Fragment,{children:t.map((function(e,t){return Object(W.jsx)("div",{className:"mb-3",children:e},t)}))})},eo=function(e,t,r,n,c,a){return function(){return Object(W.jsxs)(hn.a,{children:[Object(W.jsxs)(wc,{className:"mb-3",children:[Object(W.jsx)(kc,{to:"general",children:"General"}),Object(W.jsx)(kc,{to:"short-urls",children:"Short URLs"}),Object(W.jsx)(kc,{to:"other-items",children:"Other items"})]}),Object(W.jsxs)(Ie.d,{children:[Object(W.jsx)(Ie.b,{path:"general",element:Object(W.jsx)($i,{items:[Object(W.jsx)(n,{},"one"),Object(W.jsx)(e,{},"two")]})}),Object(W.jsx)(Ie.b,{path:"short-urls",element:Object(W.jsx)($i,{items:[Object(W.jsx)(t,{},"one"),Object(W.jsx)(r,{},"two")]})}),Object(W.jsx)(Ie.b,{path:"other-items",element:Object(W.jsx)($i,{items:[Object(W.jsx)(a,{},"one"),Object(W.jsx)(c,{},"two")]})}),Object(W.jsx)(Ie.b,{path:"*",element:Object(W.jsx)(Ie.a,{replace:!0,to:"general"})})]})]})}},to=function(e){return"includes"===e?"Suggest tags including input":"Suggest tags starting with input"},ro=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(W.jsxs)(rr.a,{title:"Short URLs form",className:"h-100",children:[Object(W.jsx)(K.o,{children:Object(W.jsxs)(Le,{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(W.jsxs)(Yi,{children:["The initial state of the ",Object(W.jsx)("b",{children:"Validate URL"})," checkbox will be ",Object(W.jsx)("b",{children:o.validateUrls?"checked":"unchecked"}),"."]})]})}),Object(W.jsx)(K.o,{children:Object(W.jsxs)(Le,{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(W.jsxs)(Yi,{children:["The initial state of the ",Object(W.jsx)("b",{children:"Forward query params on redirect"})," checkbox will be ",Object(W.jsx)("b",{children:null===(c=o.forwardQuery)||void 0===c||c?"checked":"unchecked"}),"."]})]})}),Object(W.jsxs)(On,{noMargin:!0,label:"Tag suggestions search mode:",children:[Object(W.jsxs)(J,{text:to(o.tagFilteringMode),children:[Object(W.jsx)(K.l,{active:!o.tagFilteringMode||"startsWith"===o.tagFilteringMode,onClick:l("startsWith"),children:to("startsWith")}),Object(W.jsx)(K.l,{active:"includes"===o.tagFilteringMode,onClick:l("includes"),children:to("includes")})]}),Object(W.jsx)(Yi,{children:(a=o.tagFilteringMode,"includes"===a?Object(W.jsxs)(W.Fragment,{children:["The list of suggested tags will contain those ",Object(W.jsx)("b",{children:"including"})," provided input."]}):Object(W.jsxs)(W.Fragment,{children:["The list of suggested tags will contain those ",Object(W.jsx)("b",{children:"starting with"})," provided input."]}))})]})]})},no=function(e){var t=e.settings.ui,r=e.setUiSettings;return Object(W.jsxs)(rr.a,{title:"User interface",className:"h-100",children:[Object(W.jsx)(A.a,{icon:"dark"===(null===t||void 0===t?void 0:t.theme)?F.A:F.M,className:"user-interface__theme-icon"}),Object(W.jsx)(Le,{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(Jc.g)(n)},children:"Use dark theme."})]})},co=function(e){var t,r=e.onChange,n=e.active,c=e.allText;return Object(W.jsx)(J,{text:null!==(t=me(n))&&void 0!==t?t:c,children:Object(W.jsx)(_e,{allText:c,active:n,onChange:r})})},ao=function(e){var t,r,n=e.settings,c=e.setVisitsSettings;return Object(W.jsx)(rr.a,{title:"Visits",className:"h-100",children:Object(W.jsx)(On,{noMargin:!0,label:"Default interval to load on visits sections:",children:Object(W.jsx)(co,{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})}})})})},so=function(e){var t,r,n,c=e.settings.tags,a=e.setTagsSettings;return Object(W.jsxs)(rr.a,{title:"Tags",className:"h-100",children:[Object(W.jsxs)(On,{label:"Default display mode when managing tags:",children:[Object(W.jsx)(bi,{mode:null!==(t=null===c||void 0===c?void 0:c.defaultMode)&&void 0!==t?t:"cards",renderTitle:function(e){return Object(tr.a)(e)},onChange:function(e){return a(Object(u.a)(Object(u.a)({},c),{},{defaultMode:e}))}}),Object(W.jsxs)(Yi,{children:["Tags will be displayed as ",Object(W.jsx)("b",{children:null!==(r=null===c||void 0===c?void 0:c.defaultMode)&&void 0!==r?r:"cards"}),"."]})]}),Object(W.jsx)(On,{noMargin:!0,label:"Default ordering for tags list:",children:Object(W.jsx)(Be,{items:ji,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}}))}})})]})},io=function(e){var t,r=e.settings.shortUrlsList,n=e.setShortUrlsListSettings;return Object(W.jsx)(rr.a,{title:"Short URLs list",className:"h-100",children:Object(W.jsx)(On,{noMargin:!0,label:"Default ordering for short URLs list:",children:Object(W.jsx)(Be,{items:Mt,order:null!==(t=null===r||void 0===r?void 0:r.defaultOrdering)&&void 0!==t?t:ft,onChange:function(e,t){return n({defaultOrdering:{field:e,dir:t}})}})})})},oo=function(e,t){e.serviceFactory("Settings",eo,"RealTimeUpdatesSettings","ShortUrlCreationSettings","ShortUrlsListSettings","UserInterfaceSettings","VisitsSettings","TagsSettings"),e.decorator("Settings",cc.a),e.decorator("Settings",t(null,["resetSelectedServer"])),e.serviceFactory("RealTimeUpdatesSettings",(function(){return Xi})),e.decorator("RealTimeUpdatesSettings",t(["settings"],["toggleRealTimeUpdates","setRealTimeUpdatesInterval"])),e.serviceFactory("ShortUrlCreationSettings",(function(){return ro})),e.decorator("ShortUrlCreationSettings",t(["settings"],["setShortUrlCreationSettings"])),e.serviceFactory("UserInterfaceSettings",(function(){return no})),e.decorator("UserInterfaceSettings",t(["settings"],["setUiSettings"])),e.serviceFactory("VisitsSettings",(function(){return ao})),e.decorator("VisitsSettings",t(["settings"],["setVisitsSettings"])),e.serviceFactory("TagsSettings",(function(){return so})),e.decorator("TagsSettings",t(["settings"],["setTagsSettings"])),e.serviceFactory("ShortUrlsListSettings",(function(){return io})),e.decorator("ShortUrlsListSettings",t(["settings"],["setShortUrlsListSettings"])),e.serviceFactory("toggleRealTimeUpdates",(function(){return xt})),e.serviceFactory("setRealTimeUpdatesInterval",(function(){return pt})),e.serviceFactory("setShortUrlCreationSettings",(function(){return St})),e.serviceFactory("setShortUrlsListSettings",(function(){return yt})),e.serviceFactory("setUiSettings",(function(){return Ct})),e.serviceFactory("setVisitsSettings",(function(){return Nt})),e.serviceFactory("setTagsSettings",(function(){return kt}))},lo=r(249),uo=function(e,t){var r=e.split("://"),n=Object(C.a)(r,2),c=n[0],a=n[1].split("/"),s=Object(lo.a)(a).slice(1),i=s.length?"/".concat(s.join("/")):"";return"".concat(c,"://").concat(t).concat(i)},jo="shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS",bo=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:jo,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:cr(n.t0)});case 12:case"end":return n.stop()}}),n,null,[[2,9]])})));return function(e,t){return n.apply(this,arguments)}}()}},ho="shlink/domainsList/LIST_DOMAINS_START",Oo="shlink/domainsList/LIST_DOMAINS_ERROR",vo="shlink/domainsList/LIST_DOMAINS",fo="shlink/domainsList/FILTER_DOMAINS",mo="shlink/domainsList/VALIDATE_DOMAIN",go={domains:[],filteredDomains:[],loading:!1,error:!1},xo=function(e,t){return function(r){return r.domain!==e?r:Object(u.a)(Object(u.a)({},r),{},{redirects:t})}},po=function(e,t){return function(r){return r.domain!==e?r:Object(u.a)(Object(u.a)({},r),{},{status:t})}},So=ht((ut={},Object(l.a)(ut,ho,(function(){return Object(u.a)(Object(u.a)({},go),{},{loading:!0})})),Object(l.a)(ut,Oo,(function(e){var t=e.errorData;return Object(u.a)(Object(u.a)({},go),{},{error:!0,errorData:t})})),Object(l.a)(ut,vo,(function(e,t){var r=t.domains,n=t.defaultRedirects;return Object(u.a)(Object(u.a)({},go),{},{domains:r,filteredDomains:r,defaultRedirects:n})})),Object(l.a)(ut,fo,(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)(ut,jo,(function(e,t){var r=t.domain,n=t.redirects;return Object(u.a)(Object(u.a)({},e),{},{domains:e.domains.map(xo(r,n)),filteredDomains:e.filteredDomains.map(xo(r,n))})})),Object(l.a)(ut,mo,(function(e,t){var r=t.domain,n=t.status;return Object(u.a)(Object(u.a)({},e),{},{domains:e.domains.map(po(r,n)),filteredDomains:e.filteredDomains.map(po(r,n))})})),ut),go),yo=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:ho}),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:vo,domains:i,defaultRedirects:o}),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(2),r({type:Oo,errorData:cr(t.t0)});case 14:case"end":return t.stop()}}),t,null,[[2,11]])})));return function(e,r){return t.apply(this,arguments)}}()}},Co=function(e){return{type:fo,searchTerm:e}},No=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:mo,domain:t,status:"invalid"}),r.abrupt("return");case 4:return r.prev=4,i=s.url,o=Object(g.a)(s,["url"]),l=e(Object(u.a)(Object(u.a)({},o),{},{url:uo(i,t)})),d=l.health,r.next=9,d();case 9:j=r.sent,b=j.status,n({type:mo,domain:t,status:"pass"===b?"valid":"invalid"}),r.next=17;break;case 14:r.prev=14,r.t0=r.catch(4),n({type:mo,domain:t,status:"invalid"});case 17:case"end":return r.stop()}}),r,null,[[4,14]])})));return function(e,t){return r.apply(this,arguments)}}()}},ko=function(e){var t=e.listDomains,r=e.value,n=e.domainsList,c=e.onChange,a=Object(Q.f)(),s=Object(C.a)(a,4),i=s[0],o=s[2],l=s[3],u=n.domains,d=Object(S.a)(r),j=function(){return c("")};return Object(P.useEffect)((function(){t()}),[]),i?Object(W.jsxs)(K.q,{children:[Object(W.jsx)(K.p,{value:null!==r&&void 0!==r?r:"",placeholder:"Domain",onChange:function(e){return c(e.target.value)}}),Object(W.jsx)(K.b,{id:"backToDropdown",outline:!0,type:"button",className:"domains-dropdown__back-btn",onClick:Object(M.a)(j,l),children:Object(W.jsx)(A.a,{icon:F.S})}),Object(W.jsx)(K.L,{target:"backToDropdown",placement:"left",trigger:"hover",children:"Existing domains"})]}):Object(W.jsxs)(J,{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(W.jsxs)(K.l,{active:r===t||n&&d,onClick:function(){return c(t)},children:[t,n&&Object(W.jsx)("span",{className:"float-end text-muted",children:"default"})]},t)})),Object(W.jsx)(K.l,{divider:!0}),Object(W.jsx)(K.l,{onClick:Object(M.a)(j,o),children:Object(W.jsx)("i",{children:"New domain"})})]})},wo=function(e){var t=e.isLast,r=Object(g.a)(e,["isLast"]);return Object(W.jsx)(vn,Object(u.a)(Object(u.a)({},r),{},{required:!1,type:"url",placeholder:"No redirect",className:t?"mb-0":""}))},_o=function(e){var t,r,n,c,a,s,i=e.isOpen,o=e.toggle,l=e.domain,u=e.editDomainRedirects,d=Object(P.useState)(null!==(t=null===(r=l.redirects)||void 0===r?void 0:r.baseUrlRedirect)&&void 0!==t?t:""),j=Object(C.a)(d,2),b=j[0],h=j[1],O=Object(P.useState)(null!==(n=null===(c=l.redirects)||void 0===c?void 0:c.regular404Redirect)&&void 0!==n?n:""),m=Object(C.a)(O,2),g=m[0],x=m[1],p=Object(P.useState)(null!==(a=null===(s=l.redirects)||void 0===s?void 0:s.invalidShortUrlRedirect)&&void 0!==a?a:""),S=Object(C.a)(p,2),y=S[0],N=S[1],k=Object(tr.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(tr.d)(b),regular404Redirect:Object(tr.d)(g),invalidShortUrlRedirect:Object(tr.d)(y)}).then(o));case 1:case"end":return e.stop()}}),e)}))));return Object(W.jsx)(K.t,{isOpen:i,toggle:o,centered:!0,children:Object(W.jsxs)("form",{onSubmit:k,children:[Object(W.jsxs)(K.w,{toggle:o,children:["Edit redirects for ",Object(W.jsx)("b",{children:l.domain})]}),Object(W.jsxs)(K.u,{children:[Object(W.jsxs)(wo,{value:b,onChange:h,children:[Object(W.jsxs)(Zr,{className:"me-2",placement:"bottom",children:["Visitors accessing the base url, as in ",Object(W.jsxs)("b",{children:["https://",l.domain,"/"]}),", will be redirected to this URL."]}),"Base URL"]}),Object(W.jsxs)(wo,{value:g,onChange:x,children:[Object(W.jsxs)(Zr,{className:"me-2",placement:"bottom",children:["Visitors accessing a url not matching a short URL pattern, as in ",Object(W.jsxs)("b",{children:["https://",l.domain,"/???/[...]"]}),", will be redirected to this URL."]}),"Regular 404"]}),Object(W.jsxs)(wo,{value:y,isLast:!0,onChange:N,children:[Object(W.jsx)(Zr,{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(W.jsxs)(K.v,{children:[Object(W.jsx)(K.b,{color:"link",type:"button",onClick:o,children:"Cancel"}),Object(W.jsx)(K.b,{color:"primary",children:"Save"})]})]})})},Uo=function(e){var t=e.status,r=e.matchMedia,n=void 0===r?window.matchMedia:r,c=Object(P.useRef)(),a=function(){return n("(max-width: 991px)").matches},s=Object(P.useState)(a()),i=Object(C.a)(s,2),o=i[0],l=i[1];return Object(P.useEffect)((function(){var e=function(){return l(a())};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),"validating"===t?Object(W.jsx)(A.a,{fixedWidth:!0,icon:F.k,spin:!0}):Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("span",{ref:function(e){c.current=e},children:"valid"===t?Object(W.jsx)(A.a,{fixedWidth:!0,icon:F.h,className:"text-muted"}):Object(W.jsx)(A.a,{fixedWidth:!0,icon:F.Q,className:"text-danger"})}),Object(W.jsx)(K.L,{target:function(){return c.current},placement:o?"top-start":"left",autohide:"valid"===t,children:"valid"===t?"Congratulations! This domain is properly configured.":Object(W.jsxs)("span",{children:["Oops! There is some missing configuration, and short URLs shared with this domain will not work.",Object(W.jsx)("br",{}),"Check the ",Object(W.jsx)(Pt.a,{href:"https://slnk.to/multi-domain-docs",children:"documentation"})," in order to find out what is missing."]})})]})},To=function(e){var t=e.fallback;return Object(W.jsxs)("span",{className:"text-muted",children:[!t&&Object(W.jsx)("small",{children:"No redirect"}),t&&Object(W.jsxs)(W.Fragment,{children:[t," ",Object(W.jsx)("small",{children:"(as fallback)"})]})]})},Ro=function(){return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(A.a,{fixedWidth:!0,icon:F.m,className:"text-primary",id:"defaultDomainIcon"}),Object(W.jsx)(K.L,{target:"defaultDomainIcon",placement:"right",children:"Default domain"})]})},Eo=function(e){var t,r,n,c=e.domain,a=e.editDomainRedirects,s=e.checkDomainHealth,i=e.defaultRedirects,o=e.selectedServer,l=Object(Q.f)(),u=Object(C.a)(l,2),d=u[0],j=u[1],b=c.domain,h=c.isDefault,O=c.redirects,v=c.status,f=!h||Object(Te.d)(o);return Object(P.useEffect)((function(){s(c.domain)}),[]),Object(W.jsxs)("tr",{className:"responsive-table__row",children:[Object(W.jsx)("td",{className:"responsive-table__cell","data-th":"Is default domain",children:h&&Object(W.jsx)(Ro,{})}),Object(W.jsx)("th",{className:"responsive-table__cell","data-th":"Domain",children:b}),Object(W.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(W.jsx)(To,{fallback:null===i||void 0===i?void 0:i.baseUrlRedirect})}),Object(W.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(W.jsx)(To,{fallback:null===i||void 0===i?void 0:i.regular404Redirect})}),Object(W.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(W.jsx)(To,{fallback:null===i||void 0===i?void 0:i.invalidShortUrlRedirect})}),Object(W.jsx)("td",{className:"responsive-table__cell text-lg-center","data-th":"Status",children:Object(W.jsx)(Uo,{status:v})}),Object(W.jsxs)("td",{className:"responsive-table__cell text-end",children:[Object(W.jsx)("span",{id:f?void 0:"defaultDomainBtn",children:Object(W.jsx)(K.b,{outline:!0,size:"sm",disabled:!f,onClick:f?j:void 0,children:Object(W.jsx)(A.a,{fixedWidth:!0,icon:f?F.n:F.b})})}),!f&&Object(W.jsxs)(K.L,{target:"defaultDomainBtn",placement:"left",children:["Redirects for default domain cannot be edited here.",Object(W.jsx)("br",{}),"Use config options or env vars directly on the server."]})]}),Object(W.jsx)(_o,{domain:c,isOpen:d,toggle:j,editDomainRedirects:a})]})},Do=["","Domain","Base path redirect","Regular 404 redirect","Invalid short URL redirect","",""],Lo=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(P.useEffect)((function(){r()}),[]),u)return Object(W.jsx)(rn.a,{loading:!0});return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(q,{className:"mb-3",onChange:c}),d?Object(W.jsx)(nr,{type:"error",children:Object(W.jsx)(sr,{errorData:j,fallbackMessage:"Error loading domains :("})}):Object(W.jsx)(rr.a,{children:Object(W.jsxs)("table",{className:"table table-hover responsive-table mb-0",children:[Object(W.jsx)("thead",{className:"responsive-table__header",children:Object(W.jsx)("tr",{children:Do.map((function(e,t){return Object(W.jsx)("th",{children:e},t)}))})}),Object(W.jsxs)("tbody",{children:[o.length<1&&Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:Do.length,className:"text-center",children:"No results found"})}),o.map((function(e){return Object(W.jsx)(Eo,{domain:e,editDomainRedirects:a,checkDomainHealth:s,defaultRedirects:b,selectedServer:i},e.domain)}))]})]})})]})},Vo=function(e,t){e.serviceFactory("DomainSelector",(function(){return ko})),e.decorator("DomainSelector",t(["domainsList"],["listDomains"])),e.serviceFactory("ManageDomains",(function(){return Lo})),e.decorator("ManageDomains",t(["domainsList","selectedServer"],["listDomains","filterDomains","editDomainRedirects","checkDomainHealth"])),e.serviceFactory("listDomains",yo,"buildShlinkApiClient"),e.serviceFactory("filterDomains",(function(){return Co})),e.serviceFactory("editDomainRedirects",bo,"buildShlinkApiClient"),e.serviceFactory("checkDomainHealth",No,"buildShlinkApiClient")},Io="shlink/appUpdates/APP_UPDATE_AVAILABLE",Fo="shlink/appUpdates/RESET_APP_UPDATE",Ao=ht((dt={},Object(l.a)(dt,Io,(function(){return!0})),Object(l.a)(dt,Fo,(function(){return!1})),dt),!1),Mo=Ot(Io),Go=Ot(Fo),Po=r(129),Bo=function(e){var t=e.isOpen,r=e.toggle,n=e.forceUpdate,c=Object(Q.f)(),a=Object(C.a)(c,3),s=a[0],i=a[2];return Object(W.jsxs)(K.a,{className:"app-update-banner",isOpen:t,toggle:r,tag:rr.a,color:"secondary",children:[Object(W.jsx)("h4",{className:"mb-4",children:"This app has just been updated!"}),Object(W.jsxs)("p",{className:"mb-0",children:["Restart it to enjoy the new features.",Object(W.jsxs)(K.b,{disabled:s,className:"ms-2",color:"secondary",size:"sm",onClick:function(){i(),n()},children:[!s&&Object(W.jsxs)(W.Fragment,{children:["Restart now ",Object(W.jsx)(A.a,{icon:F.N,className:"ms-1"})]}),s&&Object(W.jsx)(W.Fragment,{children:"Restarting..."})]})]})]})},Ho=r(30),Wo=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(Ho.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)}}(),qo=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(Ie.f)().pathname;return Object(P.useEffect)((function(){var e,t;0===Object.keys(u).length&&l(),Object(Jc.g)(null!==(e=null===(t=d.ui)||void 0===t?void 0:t.theme)&&void 0!==e?e:"light")}),[]),Object(W.jsxs)("div",{className:"container-fluid app-container",children:[Object(W.jsx)(e,{}),Object(W.jsxs)("div",{className:"app",children:[Object(W.jsx)("div",{className:H()("shlink-wrapper",{"d-flex d-md-block align-items-center":h}),children:Object(W.jsxs)(Ie.d,{children:[Object(W.jsx)(Ie.b,{index:!0,element:Object(W.jsx)(t,{})}),Object(W.jsx)(Ie.b,{path:"/settings/*",element:Object(W.jsx)(a,{})}),Object(W.jsx)(Ie.b,{path:"/manage-servers",element:Object(W.jsx)(s,{})}),Object(W.jsx)(Ie.b,{path:"/server/create",element:Object(W.jsx)(n,{})}),Object(W.jsx)(Ie.b,{path:"/server/:serverId/edit",element:Object(W.jsx)(c,{})}),Object(W.jsx)(Ie.b,{path:"/server/:serverId/*",element:Object(W.jsx)(r,{})}),Object(W.jsx)(Ie.b,{path:"*",element:Object(W.jsx)(Po.a,{})})]})}),Object(W.jsx)("div",{className:"shlink-footer",children:Object(W.jsx)(i,{})})]}),Object(W.jsx)(Bo,{isOpen:j,toggle:b,forceUpdate:Wo})]})}},zo=function(e,t){e.serviceFactory("App",qo,"MainHeader","Home","MenuLayout","CreateServer","EditServer","Settings","ManageServers","ShlinkVersionsContainer"),e.decorator("App",t(["servers","settings","appUpdated"],["fetchServers","resetAppUpdate"])),e.serviceFactory("appUpdateAvailable",(function(){return Mo})),e.serviceFactory("resetAppUpdate",(function(){return Go}))},Ko=new d.a,Qo=Ko.container,Jo=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)}}(Qo,t)))},Zo=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(Jo,{}))};zo(Ko,Zo),Object(I.a)(Ko,Zo),V(Ko),dn(Ko,Zo),Oc(Ko,Zo),Hi(Ko,Zo),ri(Ko,Zo),Object(Wi.a)(Ko),Zi(Ko),oo(Ko,Zo),Vo(Ko,Zo);var Yo=r(250),Xo=r(67),$o=r(184),el=Object(Xo.c)({servers:zn,selectedServer:In,shortUrlsList:Mr,shortUrlCreationResult:_r,shortUrlDeletion:xr,shortUrlEdition:Lr,shortUrlVisits:js,tagVisits:ys,orphanVisits:Ls,nonOrphanVisits:zs,shortUrlDetail:ln,tagsList:Fi,tagDelete:gi,tagEdit:ki,mercureInfo:Qi,settings:gt,domainsList:So,visitsOverview:$s,appUpdated:Ao}),tl=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||Xo.d,rl={states:["settings","servers"],namespace:"shlink",namespaceSeparator:".",debounce:300},nl=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($o.load)(rl)),cl=Object(Xo.e)(el,nl,tl(Object(Xo.a)(Object($o.save)(rl),Yo.a))),al=r(54),sl=r.n(al),il=r(251),ol=r(252),ll=r(253),ul=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 dl(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(463),r(464);delete sl.a.Icon.Default.prototype._getIconUrl,sl.a.Icon.Default.mergeOptions({iconRetinaUrl:il.a,iconUrl:ol.a,shadowUrl:ll.a});var jl=Qo.App,bl=Qo.ScrollToTop,hl=Qo.ErrorHandler,Ol=Qo.appUpdateAvailable;Object(a.render)(Object(W.jsx)(s.a,{store:cl,children:Object(W.jsx)(i.a,{basename:o.a,children:Object(W.jsx)(hl,{children:Object(W.jsx)(bl,{children:Object(W.jsx)(jl,{})})})})}),document.getElementById("root")),function(e){if("serviceWorker"in navigator){var t;if(new URL(null!==(t="/shlink-web-client/feature/bootstrap5")?t:"",window.location.href).origin!==window.location.origin)return;window.addEventListener("load",(function(){var t="".concat("/shlink-web-client/feature/bootstrap5","/service-worker.js");ul?(!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()}))})):dl(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")}))):dl(t,e)}))}}({onUpdate:function(){cl.dispatch(Ol())}})},51: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})}},59: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(144),c=r(471),a=r(474),s=r(27),i=function(e,t){var r=t.maxVersion,c=t.minVersion;if(!Object(s.c)(e))return!1;var a=!c||Object(n.compare)(e,c,">=");return(!r||Object(n.compare)(e,r,"<="))&&a},o=Object(c.a)(a.a,(function(e){try{return Object(n.compare)(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}}},84: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))}}},85: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)}}},[[266,1,2]]]);
//# sourceMappingURL=main.5083eae8.chunk.js.map