shlink-web-client/dependabot/npm_and_yarn/urijs-1.19.10/static/js/main.2b1a7f50.chunk.js

2 lines
No EOL
200 KiB
JavaScript

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