diff --git a/redux-hooks/assets/index-BolCBtSy.js b/redux-hooks/assets/index-DXlA2lIk.js similarity index 98% rename from redux-hooks/assets/index-BolCBtSy.js rename to redux-hooks/assets/index-DXlA2lIk.js index 538c9671..9f1b54b9 100644 --- a/redux-hooks/assets/index-BolCBtSy.js +++ b/redux-hooks/assets/index-DXlA2lIk.js @@ -569,7 +569,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `);n.setAttribute(Du,""),n.innerHTML=l}};function jT(e){e()}function MR(e,t){var n=typeof t=="function"?t:Ng;if(e.length===0)n();else{var r=jT;it.mutateApproach===_G&&(r=hl.requestAnimationFrame||jT),r(function(){var i=gY(),o=$_.begin("mutate");e.map(i),o(),n()})}}var V_=!1;function PR(){V_=!0}function K2(){V_=!1}var Xg=null;function MT(e){if(mT&&it.observeMutations){var t=e.treeCallback,n=t===void 0?Ng:t,r=e.nodeCallback,i=r===void 0?Ng:r,o=e.pseudoElementsCallback,l=o===void 0?Ng:o,c=e.observeMutationsRoot,f=c===void 0?sn:c;Xg=new mT(function(h){if(!V_){var m=ml();Af(h).forEach(function(y){if(y.type==="childList"&&y.addedNodes.length>0&&!OT(y.addedNodes[0])&&(it.searchPseudoElements&&l(y.target),n(y.target)),y.type==="attributes"&&y.target.parentNode&&it.searchPseudoElements&&l([y.target],!0),y.type==="attributes"&&OT(y.target)&&~OG.indexOf(y.attributeName))if(y.attributeName==="class"&&mY(y.target)){var x=vy(I_(y.target)),b=x.prefix,C=x.iconName;y.target.setAttribute(R_,b||m),C&&y.target.setAttribute(D_,C)}else pY(y.target)&&i(y.target)})}}),is&&Xg.observe(f,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}}function xY(){Xg&&Xg.disconnect()}function wY(e){var t=e.getAttribute("style"),n=[];return t&&(n=t.split(";").reduce(function(r,i){var o=i.split(":"),l=o[0],c=o.slice(1);return l&&c.length>0&&(r[l]=c.join(":").trim()),r},{})),n}function _Y(e){var t=e.getAttribute("data-prefix"),n=e.getAttribute("data-icon"),r=e.innerText!==void 0?e.innerText.trim():"",i=vy(I_(e));return i.prefix||(i.prefix=ml()),t&&n&&(i.prefix=t,i.iconName=n),i.iconName&&i.prefix||(i.prefix&&r.length>0&&(i.iconName=GG(i.prefix,e.innerText)||B_(i.prefix,vR(e.innerText))),!i.iconName&&it.autoFetchSvg&&e.firstChild&&e.firstChild.nodeType===Node.TEXT_NODE&&(i.iconName=e.firstChild.data)),i}function SY(e){var t=Af(e.attributes).reduce(function(n,r){return n.name!=="class"&&n.name!=="style"&&(n[r.name]=r.value),n},{});return t}function CY(){return{iconName:null,prefix:null,transform:Ja,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}}}function PT(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{styleParser:!0},n=_Y(e),r=n.iconName,i=n.prefix,o=n.rest,l=SY(e),c=H2("parseNodeAttributes",{},e),f=t.styleParser?wY(e):[];return Fe({iconName:r,prefix:i,transform:Ja,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:o,styles:f,attributes:l}},c)}var EY=_a.styles;function LR(e){var t=it.autoReplaceSvg==="nest"?PT(e,{styleParser:!1}):PT(e);return~t.extra.classes.indexOf(fR)?pl("generateLayersText",e,t):pl("generateSvgReplacementMutation",e,t)}function AY(){return[].concat(Ea(rR),Ea(iR))}function LT(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!is)return Promise.resolve();var n=sn.documentElement.classList,r=function(y){return n.add("".concat(vT,"-").concat(y))},i=function(y){return n.remove("".concat(vT,"-").concat(y))},o=it.autoFetchSvg?AY():UN.concat(Object.keys(EY));o.includes("fa")||o.push("fa");var l=[".".concat(fR,":not([").concat(Du,"])")].concat(o.map(function(m){return".".concat(m,":not([").concat(Du,"])")})).join(", ");if(l.length===0)return Promise.resolve();var c=[];try{c=Af(e.querySelectorAll(l))}catch{}if(c.length>0)r("pending"),i("complete");else return Promise.resolve();var f=$_.begin("onTree"),h=c.reduce(function(m,y){try{var x=LR(y);x&&m.push(x)}catch(b){uR||b.name==="MissingIcon"&&console.error(b)}return m},[]);return new Promise(function(m,y){Promise.all(h).then(function(x){MR(x,function(){r("active"),r("complete"),i("pending"),typeof t=="function"&&t(),f(),m()})}).catch(function(x){f(),y(x)})})}function TY(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;LR(e).then(function(n){n&&MR([n],t)})}function OY(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=(t||{}).icon?t:q2(t||{}),i=n.mask;return i&&(i=(i||{}).icon?i:q2(i||{})),e(r,Fe(Fe({},n),{},{mask:i}))}}var jY=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.transform,i=r===void 0?Ja:r,o=n.symbol,l=o===void 0?!1:o,c=n.mask,f=c===void 0?null:c,h=n.maskId,m=h===void 0?null:h,y=n.classes,x=y===void 0?[]:y,b=n.attributes,C=b===void 0?{}:b,_=n.styles,A=_===void 0?{}:_;if(t){var O=t.prefix,P=t.iconName,N=t.icon;return yy(Fe({type:"icon"},t),function(){return ku("beforeDOMElementCreation",{iconDefinition:t,params:n}),F_({icons:{main:G2(N),mask:f?G2(f.icon):{found:!1,width:null,height:null,icon:{}}},prefix:O,iconName:P,transform:Fe(Fe({},Ja),i),symbol:l,maskId:m,extra:{attributes:C,styles:A,classes:x}})})}},MY={mixout:function(){return{icon:OY(jY)}},hooks:function(){return{mutationObserverCallbacks:function(n){return n.treeCallback=LT,n.nodeCallback=TY,n}}},provides:function(t){t.i2svg=function(n){var r=n.node,i=r===void 0?sn:r,o=n.callback,l=o===void 0?function(){}:o;return LT(i,l)},t.generateSvgReplacementMutation=function(n,r){var i=r.iconName,o=r.prefix,l=r.transform,c=r.symbol,f=r.mask,h=r.maskId,m=r.extra;return new Promise(function(y,x){Promise.all([Y2(i,o),f.iconName?Y2(f.iconName,f.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(function(b){var C=my(b,2),_=C[0],A=C[1];y([n,F_({icons:{main:_,mask:A},prefix:o,iconName:i,transform:l,symbol:c,maskId:h,extra:m,watchable:!0})])}).catch(x)})},t.generateAbstractIcon=function(n){var r=n.children,i=n.attributes,o=n.main,l=n.transform,c=n.styles,f=py(c);f.length>0&&(i.style=f);var h;return z_(l)&&(h=pl("generateAbstractTransformGrouping",{main:o,transform:l,containerWidth:o.width,iconWidth:o.width})),r.push(h||o.icon),{children:r,attributes:i}}}},PY={mixout:function(){return{layer:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.classes,o=i===void 0?[]:i;return yy({type:"layer"},function(){ku("beforeDOMElementCreation",{assembler:n,params:r});var l=[];return n(function(c){Array.isArray(c)?c.map(function(f){l=l.concat(f.abstract)}):l=l.concat(c.abstract)}),[{tag:"span",attributes:{class:["".concat(it.cssPrefix,"-layers")].concat(Ea(o)).join(" ")},children:l}]})}}}},LY={mixout:function(){return{counter:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};r.title;var i=r.classes,o=i===void 0?[]:i,l=r.attributes,c=l===void 0?{}:l,f=r.styles,h=f===void 0?{}:f;return yy({type:"counter",content:n},function(){return ku("beforeDOMElementCreation",{content:n,params:r}),cY({content:n.toString(),extra:{attributes:c,styles:h,classes:["".concat(it.cssPrefix,"-layers-counter")].concat(Ea(o))}})})}}}},NY={mixout:function(){return{text:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.transform,o=i===void 0?Ja:i,l=r.classes,c=l===void 0?[]:l,f=r.attributes,h=f===void 0?{}:f,m=r.styles,y=m===void 0?{}:m;return yy({type:"text",content:n},function(){return ku("beforeDOMElementCreation",{content:n,params:r}),AT({content:n,transform:Fe(Fe({},Ja),o),extra:{attributes:h,styles:y,classes:["".concat(it.cssPrefix,"-layers-text")].concat(Ea(c))}})})}}},provides:function(t){t.generateLayersText=function(n,r){var i=r.transform,o=r.extra,l=null,c=null;if(IN){var f=parseInt(getComputedStyle(n).fontSize,10),h=n.getBoundingClientRect();l=h.width/f,c=h.height/f}return Promise.resolve([n,AT({content:n.innerHTML,width:l,height:c,transform:i,extra:o,watchable:!0})])}}},NR=new RegExp('"',"ug"),NT=[1105920,1112319],RT=Fe(Fe(Fe(Fe({},{FontAwesome:{normal:"fas",400:"fas"}}),pq),xG),Cq),Z2=Object.keys(RT).reduce(function(e,t){return e[t.toLowerCase()]=RT[t],e},{}),RY=Object.keys(Z2).reduce(function(e,t){var n=Z2[t];return e[t]=n[900]||Ea(Object.entries(n))[0][1],e},{});function DY(e){var t=e.replace(NR,"");return vR(Ea(t)[0]||"")}function kY(e){var t=e.getPropertyValue("font-feature-settings").includes("ss01"),n=e.getPropertyValue("content"),r=n.replace(NR,""),i=r.codePointAt(0),o=i>=NT[0]&&i<=NT[1],l=r.length===2?r[0]===r[1]:!1;return o||l||t}function IY(e,t){var n=e.replace(/^['"]|['"]$/g,"").toLowerCase(),r=parseInt(t),i=isNaN(r)?"normal":r;return(Z2[n]||{})[i]||RY[n]}function DT(e,t){var n="".concat(wG).concat(t.replace(":","-"));return new Promise(function(r,i){if(e.getAttribute(n)!==null)return r();var o=Af(e.children),l=o.filter(function(W){return W.getAttribute(U2)===t})[0],c=hl.getComputedStyle(e,t),f=c.getPropertyValue("font-family"),h=f.match(AG),m=c.getPropertyValue("font-weight"),y=c.getPropertyValue("content");if(l&&!h)return e.removeChild(l),r();if(h&&y!=="none"&&y!==""){var x=c.getPropertyValue("content"),b=IY(f,m),C=DY(x),_=h[0].startsWith("FontAwesome"),A=kY(c),O=B_(b,C),P=O;if(_){var N=YG(C);N.iconName&&N.prefix&&(O=N.iconName,b=N.prefix)}if(O&&!A&&(!l||l.getAttribute(R_)!==b||l.getAttribute(D_)!==P)){e.setAttribute(n,P),l&&e.removeChild(l);var F=CY(),U=F.extra;U.attributes[U2]=t,Y2(O,b).then(function(W){var X=F_(Fe(Fe({},F),{},{icons:{main:W,mask:AR()},prefix:b,iconName:P,extra:U,watchable:!0})),ae=sn.createElementNS("http://www.w3.org/2000/svg","svg");t==="::before"?e.insertBefore(ae,e.firstChild):e.appendChild(ae),ae.outerHTML=X.map(function(ce){return Jh(ce)}).join(` `),e.removeAttribute(n),r()}).catch(i)}else r()}else r()})}function zY(e){return Promise.all([DT(e,"::before"),DT(e,"::after")])}function UY(e){return e.parentNode!==document.head&&!~SG.indexOf(e.tagName.toUpperCase())&&!e.getAttribute(U2)&&(!e.parentNode||e.parentNode.tagName!=="svg")}var BY=function(t){return!!t&&lR.some(function(n){return t.includes(n)})},FY=function(t){if(!t)return[];var n=new Set,r=t.split(/,(?![^()]*\))/).map(function(f){return f.trim()});r=r.flatMap(function(f){return f.includes("(")?f:f.split(",").map(function(h){return h.trim()})});var i=Lg(r),o;try{for(i.s();!(o=i.n()).done;){var l=o.value;if(BY(l)){var c=lR.reduce(function(f,h){return f.replace(h,"")},l);c!==""&&c!=="*"&&n.add(c)}}}catch(f){i.e(f)}finally{i.f()}return n};function kT(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(is){var n;if(t)n=e;else if(it.searchPseudoElementsFullScan)n=e.querySelectorAll("*");else{var r=new Set,i=Lg(document.styleSheets),o;try{for(i.s();!(o=i.n()).done;){var l=o.value;try{var c=Lg(l.cssRules),f;try{for(c.s();!(f=c.n()).done;){var h=f.value,m=FY(h.selectorText),y=Lg(m),x;try{for(y.s();!(x=y.n()).done;){var b=x.value;r.add(b)}}catch(_){y.e(_)}finally{y.f()}}}catch(_){c.e(_)}finally{c.f()}}catch(_){it.searchPseudoElementsWarnings&&console.warn("Font Awesome: cannot parse stylesheet: ".concat(l.href," (").concat(_.message,`) If it declares any Font Awesome CSS pseudo-elements, they will not be rendered as SVG icons. Add crossorigin="anonymous" to the , enable searchPseudoElementsFullScan for slower but more thorough DOM parsing, or suppress this warning by setting searchPseudoElementsWarnings to false.`))}}}catch(_){i.e(_)}finally{i.f()}if(!r.size)return;var C=Array.from(r).join(", ");try{n=e.querySelectorAll(C)}catch{}}return new Promise(function(_,A){var O=Af(n).filter(UY).map(zY),P=$_.begin("searchPseudoElements");PR(),Promise.all(O).then(function(){P(),K2(),_()}).catch(function(){P(),K2(),A()})})}}var $Y={hooks:function(){return{mutationObserverCallbacks:function(n){return n.pseudoElementsCallback=kT,n}}},provides:function(t){t.pseudoElements2svg=function(n){var r=n.node,i=r===void 0?sn:r;it.searchPseudoElements&&kT(i)}}},IT=!1,VY={mixout:function(){return{dom:{unwatch:function(){PR(),IT=!0}}}},hooks:function(){return{bootstrap:function(){MT(H2("mutationObserverCallbacks",{}))},noAuto:function(){xY()},watch:function(n){var r=n.observeMutationsRoot;IT?K2():MT(H2("mutationObserverCallbacks",{observeMutationsRoot:r}))}}}},zT=function(t){var n={size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0};return t.toLowerCase().split(" ").reduce(function(r,i){var o=i.toLowerCase().split("-"),l=o[0],c=o.slice(1).join("-");if(l&&c==="h")return r.flipX=!0,r;if(l&&c==="v")return r.flipY=!0,r;if(c=parseFloat(c),isNaN(c))return r;switch(l){case"grow":r.size=r.size+c;break;case"shrink":r.size=r.size-c;break;case"left":r.x=r.x-c;break;case"right":r.x=r.x+c;break;case"up":r.y=r.y-c;break;case"down":r.y=r.y+c;break;case"rotate":r.rotate=r.rotate+c;break}return r},n)},HY={mixout:function(){return{parse:{transform:function(n){return zT(n)}}}},hooks:function(){return{parseNodeAttributes:function(n,r){var i=r.getAttribute("data-fa-transform");return i&&(n.transform=zT(i)),n}}},provides:function(t){t.generateAbstractTransformGrouping=function(n){var r=n.main,i=n.transform,o=n.containerWidth,l=n.iconWidth,c={transform:"translate(".concat(o/2," 256)")},f="translate(".concat(i.x*32,", ").concat(i.y*32,") "),h="scale(".concat(i.size/16*(i.flipX?-1:1),", ").concat(i.size/16*(i.flipY?-1:1),") "),m="rotate(".concat(i.rotate," 0 0)"),y={transform:"".concat(f," ").concat(h," ").concat(m)},x={transform:"translate(".concat(l/2*-1," -256)")},b={outer:c,inner:y,path:x};return{tag:"g",attributes:Fe({},b.outer),children:[{tag:"g",attributes:Fe({},b.inner),children:[{tag:r.icon.tag,children:r.icon.children,attributes:Fe(Fe({},r.icon.attributes),b.path)}]}]}}}},Lb={x:0,y:0,width:"100%",height:"100%"};function UT(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return e.attributes&&(e.attributes.fill||t)&&(e.attributes.fill="black"),e}function qY(e){return e.tag==="g"?e.children:[e]}var GY={hooks:function(){return{parseNodeAttributes:function(n,r){var i=r.getAttribute("data-fa-mask"),o=i?vy(i.split(" ").map(function(l){return l.trim()})):AR();return o.prefix||(o.prefix=ml()),n.mask=o,n.maskId=r.getAttribute("data-fa-mask-id"),n}}},provides:function(t){t.generateAbstractMask=function(n){var r=n.children,i=n.attributes,o=n.main,l=n.mask,c=n.maskId,f=n.transform,h=o.width,m=o.icon,y=l.width,x=l.icon,b=IG({transform:f,containerWidth:y,iconWidth:h}),C={tag:"rect",attributes:Fe(Fe({},Lb),{},{fill:"white"})},_=m.children?{children:m.children.map(UT)}:{},A={tag:"g",attributes:Fe({},b.inner),children:[UT(Fe({tag:m.tag,attributes:Fe(Fe({},m.attributes),b.path)},_))]},O={tag:"g",attributes:Fe({},b.outer),children:[A]},P="mask-".concat(c||bT()),N="clip-".concat(c||bT()),F={tag:"mask",attributes:Fe(Fe({},Lb),{},{id:P,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[C,O]},U={tag:"defs",children:[{tag:"clipPath",attributes:{id:N},children:qY(x)},F]};return r.push(U,{tag:"rect",attributes:Fe({fill:"currentColor","clip-path":"url(#".concat(N,")"),mask:"url(#".concat(P,")")},Lb)}),{children:r,attributes:i}}}},YY={provides:function(t){var n=!1;hl.matchMedia&&(n=hl.matchMedia("(prefers-reduced-motion: reduce)").matches),t.missingIconAbstract=function(){var r=[],i={fill:"currentColor"},o={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};r.push({tag:"path",attributes:Fe(Fe({},i),{},{d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"})});var l=Fe(Fe({},o),{},{attributeName:"opacity"}),c={tag:"circle",attributes:Fe(Fe({},i),{},{cx:"256",cy:"364",r:"28"}),children:[]};return n||c.children.push({tag:"animate",attributes:Fe(Fe({},o),{},{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:Fe(Fe({},l),{},{values:"1;0;1;1;0;1;"})}),r.push(c),r.push({tag:"path",attributes:Fe(Fe({},i),{},{opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"}),children:n?[]:[{tag:"animate",attributes:Fe(Fe({},l),{},{values:"1;0;0;0;0;1;"})}]}),n||r.push({tag:"path",attributes:Fe(Fe({},i),{},{opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"}),children:[{tag:"animate",attributes:Fe(Fe({},l),{},{values:"0;0;1;1;0;0;"})}]}),{tag:"g",attributes:{class:"missing"},children:r}}}},WY={hooks:function(){return{parseNodeAttributes:function(n,r){var i=r.getAttribute("data-fa-symbol"),o=i===null?!1:i===""?!0:i;return n.symbol=o,n}}}},KY=[BG,MY,PY,LY,NY,$Y,VY,HY,GY,YY,WY];nY(KY,{mixoutsTo:Ii});Ii.noAuto;var Oh=Ii.config;Ii.library;Ii.dom;var RR=Ii.parse;Ii.findIconDefinition;Ii.toHtml;var ZY=Ii.icon;Ii.layer;Ii.text;Ii.counter;function XY(e){return e=e-0,e===e}function DR(e){return XY(e)?e:(e=e.replace(/[_-]+(.)?/g,(t,n)=>n?n.toUpperCase():""),e.charAt(0).toLowerCase()+e.slice(1))}function QY(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Vc=new Map,JY=1e3;function eW(e){if(Vc.has(e))return Vc.get(e);const t={};let n=0;const r=e.length;for(;n0){const f=l.slice(0,c).trim(),h=l.slice(c+1).trim();if(f&&h){const m=DR(f);t[m.startsWith("webkit")?QY(m):m]=h}}}n=o+1}if(Vc.size===JY){const i=Vc.keys().next().value;i&&Vc.delete(i)}return Vc.set(e,t),t}function kR(e,t,n={}){if(typeof t=="string")return t;const r=(t.children||[]).map(h=>kR(e,h)),i=t.attributes||{},o={};for(const[h,m]of Object.entries(i))switch(!0){case h==="class":{o.className=m;break}case h==="style":{o.style=eW(String(m));break}case h.startsWith("aria-"):case h.startsWith("data-"):{o[h.toLowerCase()]=m;break}default:o[DR(h)]=m}const{style:l,"aria-label":c,...f}=n;return l&&(o.style=o.style?{...o.style,...l}:l),c&&(o["aria-label"]=c,o["aria-hidden"]="false"),e(t.tag,{...f,...o},...r)}var tW=kR.bind(null,uf.createElement),BT=(e,t)=>{const n=w.useId();return e||(t?n:void 0)},nW=class{constructor(e="react-fontawesome"){this.enabled=!1;let t=!1;try{t=typeof process<"u"&&!1}catch{}this.scope=e,this.enabled=t}log(...e){this.enabled&&console.log(`[${this.scope}]`,...e)}warn(...e){this.enabled&&console.warn(`[${this.scope}]`,...e)}error(...e){this.enabled&&console.error(`[${this.scope}]`,...e)}},rW="searchPseudoElementsFullScan"in Oh?"7.0.0":"6.0.0",iW=Number.parseInt(rW)>=7,wh="fa",ko={beat:"fa-beat",fade:"fa-fade",beatFade:"fa-beat-fade",bounce:"fa-bounce",shake:"fa-shake",spin:"fa-spin",spinPulse:"fa-spin-pulse",spinReverse:"fa-spin-reverse",pulse:"fa-pulse"},aW={left:"fa-pull-left",right:"fa-pull-right"},oW={90:"fa-rotate-90",180:"fa-rotate-180",270:"fa-rotate-270"},sW={"2xs":"fa-2xs",xs:"fa-xs",sm:"fa-sm",lg:"fa-lg",xl:"fa-xl","2xl":"fa-2xl","1x":"fa-1x","2x":"fa-2x","3x":"fa-3x","4x":"fa-4x","5x":"fa-5x","6x":"fa-6x","7x":"fa-7x","8x":"fa-8x","9x":"fa-9x","10x":"fa-10x"},Io={border:"fa-border",fixedWidth:"fa-fw",flip:"fa-flip",flipHorizontal:"fa-flip-horizontal",flipVertical:"fa-flip-vertical",inverse:"fa-inverse",rotateBy:"fa-rotate-by",swapOpacity:"fa-swap-opacity",widthAuto:"fa-width-auto"};function lW(e){const t=Oh.cssPrefix||Oh.familyPrefix||wh;return t===wh?e:e.replace(new RegExp(`(?<=^|\\s)${wh}-`,"g"),`${t}-`)}function uW(e){const{beat:t,fade:n,beatFade:r,bounce:i,shake:o,spin:l,spinPulse:c,spinReverse:f,pulse:h,fixedWidth:m,inverse:y,border:x,flip:b,size:C,rotation:_,pull:A,swapOpacity:O,rotateBy:P,widthAuto:N,className:F}=e,U=[];return F&&U.push(...F.split(" ")),t&&U.push(ko.beat),n&&U.push(ko.fade),r&&U.push(ko.beatFade),i&&U.push(ko.bounce),o&&U.push(ko.shake),l&&U.push(ko.spin),f&&U.push(ko.spinReverse),c&&U.push(ko.spinPulse),h&&U.push(ko.pulse),m&&U.push(Io.fixedWidth),y&&U.push(Io.inverse),x&&U.push(Io.border),b===!0&&U.push(Io.flip),(b==="horizontal"||b==="both")&&U.push(Io.flipHorizontal),(b==="vertical"||b==="both")&&U.push(Io.flipVertical),C!=null&&U.push(sW[C]),_!=null&&_!==0&&U.push(oW[_]),A!=null&&U.push(aW[A]),O&&U.push(Io.swapOpacity),iW?(P&&U.push(Io.rotateBy),N&&U.push(Io.widthAuto),(Oh.cssPrefix||Oh.familyPrefix||wh)===wh?U:U.map(lW)):U}var cW=e=>typeof e=="object"&&"icon"in e&&!!e.icon;function FT(e){if(e)return cW(e)?e:RR.icon(e)}function fW(e){return Object.keys(e)}var $T=new nW("FontAwesomeIcon"),IR={border:!1,className:"",mask:void 0,maskId:void 0,fixedWidth:!1,inverse:!1,flip:!1,icon:void 0,listItem:!1,pull:void 0,pulse:!1,rotation:void 0,rotateBy:!1,size:void 0,spin:!1,spinPulse:!1,spinReverse:!1,beat:!1,fade:!1,beatFade:!1,bounce:!1,shake:!1,symbol:!1,title:"",titleId:void 0,transform:void 0,swapOpacity:!1,widthAuto:!1},dW=new Set(Object.keys(IR)),Be=uf.forwardRef((e,t)=>{const n={...IR,...e},{icon:r,mask:i,symbol:o,title:l,titleId:c,maskId:f,transform:h}=n,m=BT(f,!!i),y=BT(c,!!l),x=FT(r);if(!x)return $T.error("Icon lookup is undefined",r),null;const b=uW(n),C=typeof h=="string"?RR.transform(h):h,_=FT(i),A=ZY(x,{...b.length>0&&{classes:b},...C&&{transform:C},..._&&{mask:_},symbol:o,title:l,titleId:y,maskId:m});if(!A)return $T.error("Could not find icon",x),null;const{abstract:O}=A,P={ref:t};for(const N of fW(n))dW.has(N)||(P[N]=n[N]);return tW(O[0],P)});Be.displayName="FontAwesomeIcon";function by(){return typeof window<"u"}function Tf(e){return zR(e)?(e.nodeName||"").toLowerCase():"#document"}function Mi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function as(e){var t;return(t=(zR(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zR(e){return by()?e instanceof Node||e instanceof Mi(e).Node:!1}function Er(e){return by()?e instanceof Element||e instanceof Mi(e).Element:!1}function Ni(e){return by()?e instanceof HTMLElement||e instanceof Mi(e).HTMLElement:!1}function X2(e){return!by()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Mi(e).ShadowRoot}const hW=new Set(["inline","contents"]);function em(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Aa(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!hW.has(i)}const mW=new Set(["table","td","th"]);function pW(e){return mW.has(Tf(e))}const gW=[":popover-open",":modal"];function xy(e){return gW.some(t=>{try{return e.matches(t)}catch{return!1}})}const vW=["transform","translate","scale","rotate","perspective"],yW=["transform","translate","scale","rotate","perspective","filter"],bW=["paint","layout","strict","content"];function H_(e){const t=q_(),n=Er(e)?Aa(e):e;return vW.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||yW.some(r=>(n.willChange||"").includes(r))||bW.some(r=>(n.contain||"").includes(r))}function xW(e){let t=gl(e);for(;Ni(t)&&!ff(t);){if(H_(t))return t;if(xy(t))return null;t=gl(t)}return null}function q_(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const wW=new Set(["html","body","#document"]);function ff(e){return wW.has(Tf(e))}function Aa(e){return Mi(e).getComputedStyle(e)}function wy(e){return Er(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gl(e){if(Tf(e)==="html")return e;const t=e.assignedSlot||e.parentNode||X2(e)&&e.host||as(e);return X2(t)?t.host:t}function UR(e){const t=gl(e);return ff(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ni(t)&&em(t)?t:UR(t)}function BR(e,t,n){var r;t===void 0&&(t=[]);const i=UR(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),l=Mi(i);return o?(Q2(l),t.concat(l,l.visualViewport||[],em(i)?i:[],[])):t.concat(i,BR(i,[]))}function Q2(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const _W=["top","right","bottom","left"],VT=["start","end"],HT=_W.reduce((e,t)=>e.concat(t,t+"-"+VT[0],t+"-"+VT[1]),[]),jh=Math.min,nf=Math.max,Qg=Math.round,to=e=>({x:e,y:e}),SW={left:"right",right:"left",bottom:"top",top:"bottom"},CW={start:"end",end:"start"};function EW(e,t,n){return nf(e,jh(t,n))}function tm(e,t){return typeof e=="function"?e(t):e}function vl(e){return e.split("-")[0]}function no(e){return e.split("-")[1]}function AW(e){return e==="x"?"y":"x"}function G_(e){return e==="y"?"height":"width"}const TW=new Set(["top","bottom"]);function Eu(e){return TW.has(vl(e))?"y":"x"}function Y_(e){return AW(Eu(e))}function FR(e,t,n){n===void 0&&(n=!1);const r=no(e),i=Y_(e),o=G_(i);let l=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=ev(l)),[l,ev(l)]}function OW(e){const t=ev(e);return[Jg(e),t,Jg(t)]}function Jg(e){return e.replace(/start|end/g,t=>CW[t])}const qT=["left","right"],GT=["right","left"],jW=["top","bottom"],MW=["bottom","top"];function PW(e,t,n){switch(e){case"top":case"bottom":return n?t?GT:qT:t?qT:GT;case"left":case"right":return t?jW:MW;default:return[]}}function LW(e,t,n,r){const i=no(e);let o=PW(vl(e),n==="start",r);return i&&(o=o.map(l=>l+"-"+i),t&&(o=o.concat(o.map(Jg)))),o}function ev(e){return e.replace(/left|right|bottom|top/g,t=>SW[t])}function NW(e){return{top:0,right:0,bottom:0,left:0,...e}}function $R(e){return typeof e!="number"?NW(e):{top:e,right:e,bottom:e,left:e}}function tv(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}const RW="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function DW(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&X2(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function tg(e){return e?.ownerDocument||document}function kW(e){return Ni(e)&&e.matches(RW)}function Mh(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var IW=typeof document<"u",zW=function(){},yl=IW?w.useLayoutEffect:zW;const UW={...u_};function ol(e){const t=w.useRef(e);return yl(()=>{t.current=e}),t}const BW=UW.useInsertionEffect,FW=BW||(e=>e());function fh(e){const t=w.useRef(()=>{});return FW(()=>{t.current=e}),w.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:l}=n,c=o.filter(Boolean),f=await(l.isRTL==null?void 0:l.isRTL(t));let h=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:m,y}=YT(h,r,f),x=r,b={},C=0;for(let _=0;_({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:l,elements:c,middlewareData:f}=t,{element:h,padding:m=0}=tm(e,t)||{};if(h==null)return{};const y=$R(m),x={x:n,y:r},b=Y_(i),C=G_(b),_=await l.getDimensions(h),A=b==="y",O=A?"top":"left",P=A?"bottom":"right",N=A?"clientHeight":"clientWidth",F=o.reference[C]+o.reference[b]-x[b]-o.floating[C],U=x[b]-o.reference[b],W=await(l.getOffsetParent==null?void 0:l.getOffsetParent(h));let X=W?W[N]:0;(!X||!await(l.isElement==null?void 0:l.isElement(W)))&&(X=c.floating[N]||o.floating[C]);const ae=F/2-U/2,ce=X/2-_[C]/2-1,re=jh(y[O],ce),J=jh(y[P],ce),oe=re,we=X-_[C]-J,se=X/2-_[C]/2+ae,ue=EW(oe,se,we),Y=!f.arrow&&no(i)!=null&&se!==ue&&o.reference[C]/2-(seno(i)===e),...n.filter(i=>no(i)!==e)]:n.filter(i=>vl(i)===i)).filter(i=>e?no(i)===e||(t?Jg(i)!==i:!1):!0)}const qW=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,i;const{rects:o,middlewareData:l,placement:c,platform:f,elements:h}=t,{crossAxis:m=!1,alignment:y,allowedPlacements:x=HT,autoAlignment:b=!0,...C}=tm(e,t),_=y!==void 0||x===HT?HW(y||null,b,x):x,A=await VR(t,C),O=((n=l.autoPlacement)==null?void 0:n.index)||0,P=_[O];if(P==null)return{};const N=FR(P,o,await(f.isRTL==null?void 0:f.isRTL(h.floating)));if(c!==P)return{reset:{placement:_[0]}};const F=[A[vl(P)],A[N[0]],A[N[1]]],U=[...((r=l.autoPlacement)==null?void 0:r.overflows)||[],{placement:P,overflows:F}],W=_[O+1];if(W)return{data:{index:O+1,overflows:U},reset:{placement:W}};const X=U.map(re=>{const J=no(re.placement);return[re.placement,J&&m?re.overflows.slice(0,2).reduce((oe,we)=>oe+we,0):re.overflows[0],re.overflows]}).sort((re,J)=>re[1]-J[1]),ce=((i=X.filter(re=>re[2].slice(0,no(re[0])?2:3).every(J=>J<=0))[0])==null?void 0:i[0])||X[0][0];return ce!==c?{data:{index:O+1,overflows:U},reset:{placement:ce}}:{}}}},GW=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:l,initialPlacement:c,platform:f,elements:h}=t,{mainAxis:m=!0,crossAxis:y=!0,fallbackPlacements:x,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:_=!0,...A}=tm(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const O=vl(i),P=Eu(c),N=vl(c)===c,F=await(f.isRTL==null?void 0:f.isRTL(h.floating)),U=x||(N||!_?[ev(c)]:OW(c)),W=C!=="none";!x&&W&&U.push(...LW(c,_,C,F));const X=[c,...U],ae=await VR(t,A),ce=[];let re=((r=o.flip)==null?void 0:r.overflows)||[];if(m&&ce.push(ae[O]),y){const se=FR(i,l,F);ce.push(ae[se[0]],ae[se[1]])}if(re=[...re,{placement:i,overflows:ce}],!ce.every(se=>se<=0)){var J,oe;const se=(((J=o.flip)==null?void 0:J.index)||0)+1,ue=X[se];if(ue&&(!(y==="alignment"?P!==Eu(ue):!1)||re.every(z=>Eu(z.placement)===P?z.overflows[0]>0:!0)))return{data:{index:se,overflows:re},reset:{placement:ue}};let Y=(oe=re.filter(k=>k.overflows[0]<=0).sort((k,z)=>k.overflows[1]-z.overflows[1])[0])==null?void 0:oe.placement;if(!Y)switch(b){case"bestFit":{var we;const k=(we=re.filter(z=>{if(W){const H=Eu(z.placement);return H===P||H==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(H=>H>0).reduce((H,I)=>H+I,0)]).sort((z,H)=>z[1]-H[1])[0])==null?void 0:we[0];k&&(Y=k);break}case"initialPlacement":Y=c;break}if(i!==Y)return{reset:{placement:Y}}}return{}}}},YW=new Set(["left","top"]);async function WW(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),l=vl(n),c=no(n),f=Eu(n)==="y",h=YW.has(l)?-1:1,m=o&&f?-1:1,y=tm(t,e);let{mainAxis:x,crossAxis:b,alignmentAxis:C}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return c&&typeof C=="number"&&(b=c==="end"?C*-1:C),f?{x:b*m,y:x*h}:{x:x*h,y:b*m}}const KW=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:l,middlewareData:c}=t,f=await WW(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+f.x,y:o+f.y,data:{...f,placement:l}}}}};function HR(e){const t=Aa(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Ni(e),o=i?e.offsetWidth:n,l=i?e.offsetHeight:r,c=Qg(n)!==o||Qg(r)!==l;return c&&(n=o,r=l),{width:n,height:r,$:c}}function qR(e){return Er(e)?e:e.contextElement}function rf(e){const t=qR(e);if(!Ni(t))return to(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=HR(t);let l=(o?Qg(n.width):n.width)/r,c=(o?Qg(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const ZW=to(0);function GR(e){const t=Mi(e);return!q_()||!t.visualViewport?ZW:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function XW(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Mi(e)?!1:t}function Ph(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=qR(e);let l=to(1);t&&(r?Er(r)&&(l=rf(r)):l=rf(e));const c=XW(o,n,r)?GR(o):to(0);let f=(i.left+c.x)/l.x,h=(i.top+c.y)/l.y,m=i.width/l.x,y=i.height/l.y;if(o){const x=Mi(o),b=r&&Er(r)?Mi(r):r;let C=x,_=Q2(C);for(;_&&r&&b!==C;){const A=rf(_),O=_.getBoundingClientRect(),P=Aa(_),N=O.left+(_.clientLeft+parseFloat(P.paddingLeft))*A.x,F=O.top+(_.clientTop+parseFloat(P.paddingTop))*A.y;f*=A.x,h*=A.y,m*=A.x,y*=A.y,f+=N,h+=F,C=Mi(_),_=Q2(C)}}return tv({width:m,height:y,x:f,y:h})}function _y(e,t){const n=wy(e).scrollLeft;return t?t.left+n:Ph(as(e)).left+n}function YR(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-_y(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function QW(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",l=as(r),c=t?xy(t.floating):!1;if(r===l||c&&o)return n;let f={scrollLeft:0,scrollTop:0},h=to(1);const m=to(0),y=Ni(r);if((y||!y&&!o)&&((Tf(r)!=="body"||em(l))&&(f=wy(r)),Ni(r))){const b=Ph(r);h=rf(r),m.x=b.x+r.clientLeft,m.y=b.y+r.clientTop}const x=l&&!y&&!o?YR(l,f):to(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-f.scrollLeft*h.x+m.x+x.x,y:n.y*h.y-f.scrollTop*h.y+m.y+x.y}}function JW(e){return Array.from(e.getClientRects())}function eK(e){const t=as(e),n=wy(e),r=e.ownerDocument.body,i=nf(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=nf(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+_y(e);const c=-n.scrollTop;return Aa(r).direction==="rtl"&&(l+=nf(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:l,y:c}}const WT=25;function tK(e,t){const n=Mi(e),r=as(e),i=n.visualViewport;let o=r.clientWidth,l=r.clientHeight,c=0,f=0;if(i){o=i.width,l=i.height;const m=q_();(!m||m&&t==="fixed")&&(c=i.offsetLeft,f=i.offsetTop)}const h=_y(r);if(h<=0){const m=r.ownerDocument,y=m.body,x=getComputedStyle(y),b=m.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,C=Math.abs(r.clientWidth-y.clientWidth-b);C<=WT&&(o-=C)}else h<=WT&&(o+=h);return{width:o,height:l,x:c,y:f}}const nK=new Set(["absolute","fixed"]);function rK(e,t){const n=Ph(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Ni(e)?rf(e):to(1),l=e.clientWidth*o.x,c=e.clientHeight*o.y,f=i*o.x,h=r*o.y;return{width:l,height:c,x:f,y:h}}function KT(e,t,n){let r;if(t==="viewport")r=tK(e,n);else if(t==="document")r=eK(as(e));else if(Er(t))r=rK(t,n);else{const i=GR(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return tv(r)}function WR(e,t){const n=gl(e);return n===t||!Er(n)||ff(n)?!1:Aa(n).position==="fixed"||WR(n,t)}function iK(e,t){const n=t.get(e);if(n)return n;let r=BR(e,[]).filter(c=>Er(c)&&Tf(c)!=="body"),i=null;const o=Aa(e).position==="fixed";let l=o?gl(e):e;for(;Er(l)&&!ff(l);){const c=Aa(l),f=H_(l);!f&&c.position==="fixed"&&(i=null),(o?!f&&!i:!f&&c.position==="static"&&!!i&&nK.has(i.position)||em(l)&&!f&&WR(e,l))?r=r.filter(m=>m!==l):i=c,l=gl(l)}return t.set(e,r),r}function aK(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const l=[...n==="clippingAncestors"?xy(t)?[]:iK(t,this._c):[].concat(n),r],c=l[0],f=l.reduce((h,m)=>{const y=KT(t,m,i);return h.top=nf(y.top,h.top),h.right=jh(y.right,h.right),h.bottom=jh(y.bottom,h.bottom),h.left=nf(y.left,h.left),h},KT(t,c,i));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function oK(e){const{width:t,height:n}=HR(e);return{width:t,height:n}}function sK(e,t,n){const r=Ni(t),i=as(t),o=n==="fixed",l=Ph(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const f=to(0);function h(){f.x=_y(i)}if(r||!r&&!o)if((Tf(t)!=="body"||em(i))&&(c=wy(t)),r){const b=Ph(t,!0,o,t);f.x=b.x+t.clientLeft,f.y=b.y+t.clientTop}else i&&h();o&&!r&&i&&h();const m=i&&!r&&!o?YR(i,c):to(0),y=l.left+c.scrollLeft-f.x-m.x,x=l.top+c.scrollTop-f.y-m.y;return{x:y,y:x,width:l.width,height:l.height}}function Nb(e){return Aa(e).position==="static"}function ZT(e,t){if(!Ni(e)||Aa(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return as(e)===n&&(n=n.ownerDocument.body),n}function KR(e,t){const n=Mi(e);if(xy(e))return n;if(!Ni(e)){let i=gl(e);for(;i&&!ff(i);){if(Er(i)&&!Nb(i))return i;i=gl(i)}return n}let r=ZT(e,t);for(;r&&pW(r)&&Nb(r);)r=ZT(r,t);return r&&ff(r)&&Nb(r)&&!H_(r)?n:r||xW(e)||n}const lK=async function(e){const t=this.getOffsetParent||KR,n=this.getDimensions,r=await n(e.floating);return{reference:sK(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function uK(e){return Aa(e).direction==="rtl"}const cK={convertOffsetParentRelativeRectToViewportRelativeRect:QW,getDocumentElement:as,getClippingRect:aK,getOffsetParent:KR,getElementRects:lK,getClientRects:JW,getDimensions:oK,getScale:rf,isElement:Er,isRTL:uK},fK=KW,dK=qW,hK=GW,XT=VW,mK=(e,t,n)=>{const r=new Map,i={platform:cK,...n},o={...i.platform,_c:r};return $W(e,t,{...i,platform:o})};var pK=typeof document<"u",gK=function(){},Dg=pK?w.useLayoutEffect:gK;function nv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!nv(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!nv(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function ZR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function QT(e,t){const n=ZR(e);return Math.round(t*n)/n}function Rb(e){const t=w.useRef(e);return Dg(()=>{t.current=e}),t}function vK(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:l}={},transform:c=!0,whileElementsMounted:f,open:h}=e,[m,y]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[x,b]=w.useState(r);nv(x,r)||b(r);const[C,_]=w.useState(null),[A,O]=w.useState(null),P=w.useCallback(z=>{z!==W.current&&(W.current=z,_(z))},[]),N=w.useCallback(z=>{z!==X.current&&(X.current=z,O(z))},[]),F=o||C,U=l||A,W=w.useRef(null),X=w.useRef(null),ae=w.useRef(m),ce=f!=null,re=Rb(f),J=Rb(i),oe=Rb(h),we=w.useCallback(()=>{if(!W.current||!X.current)return;const z={placement:t,strategy:n,middleware:x};J.current&&(z.platform=J.current),mK(W.current,X.current,z).then(H=>{const I={...H,isPositioned:oe.current!==!1};se.current&&!nv(ae.current,I)&&(ae.current=I,Of.flushSync(()=>{y(I)}))})},[x,t,n,J,oe]);Dg(()=>{h===!1&&ae.current.isPositioned&&(ae.current.isPositioned=!1,y(z=>({...z,isPositioned:!1})))},[h]);const se=w.useRef(!1);Dg(()=>(se.current=!0,()=>{se.current=!1}),[]),Dg(()=>{if(F&&(W.current=F),U&&(X.current=U),F&&U){if(re.current)return re.current(F,U,we);we()}},[F,U,we,re,ce]);const ue=w.useMemo(()=>({reference:W,floating:X,setReference:P,setFloating:N}),[P,N]),Y=w.useMemo(()=>({reference:F,floating:U}),[F,U]),k=w.useMemo(()=>{const z={position:n,left:0,top:0};if(!Y.floating)return z;const H=QT(Y.floating,m.x),I=QT(Y.floating,m.y);return c?{...z,transform:"translate("+H+"px, "+I+"px)",...ZR(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:I}},[n,c,Y.floating,m.x,m.y]);return w.useMemo(()=>({...m,update:we,refs:ue,elements:Y,floatingStyles:k}),[m,we,ue,Y,k])}const yK=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?XT({element:r.current,padding:i}).fn(n):{}:r?XT({element:r,padding:i}).fn(n):{}}}},bK=(e,t)=>({...fK(e),options:[e,t]}),xK=(e,t)=>({...hK(e),options:[e,t]}),wK=(e,t)=>({...dK(e),options:[e,t]}),_K=(e,t)=>({...yK(e),options:[e,t]}),SK="data-floating-ui-focusable",JT="active",eO="selected",CK={...u_};let tO=!1,EK=0;const nO=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+EK++;function AK(){const[e,t]=w.useState(()=>tO?nO():void 0);return yl(()=>{e==null&&t(nO())},[]),w.useEffect(()=>{tO=!0},[]),e}const TK=CK.useId,OK=TK||AK;function jK(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(i=>i(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const MK=w.createContext(null),PK=w.createContext(null),XR=()=>{var e;return((e=w.useContext(MK))==null?void 0:e.id)||null},QR=()=>w.useContext(PK);function LK(e){return"data-floating-ui-"+e}function ya(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const rO=LK("safe-polygon");function Db(e,t,n){if(n&&!Mh(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[t]}return e?.[t]}function kb(e){return typeof e=="function"?e():e}function NK(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:i,events:o,elements:l}=e,{enabled:c=!0,delay:f=0,handleClose:h=null,mouseOnly:m=!1,restMs:y=0,move:x=!0}=t,b=QR(),C=XR(),_=ol(h),A=ol(f),O=ol(n),P=ol(y),N=w.useRef(),F=w.useRef(-1),U=w.useRef(),W=w.useRef(-1),X=w.useRef(!0),ae=w.useRef(!1),ce=w.useRef(()=>{}),re=w.useRef(!1),J=fh(()=>{var k;const z=(k=i.current.openEvent)==null?void 0:k.type;return z?.includes("mouse")&&z!=="mousedown"});w.useEffect(()=>{if(!c)return;function k(z){let{open:H}=z;H||(ya(F),ya(W),X.current=!0,re.current=!1)}return o.on("openchange",k),()=>{o.off("openchange",k)}},[c,o]),w.useEffect(()=>{if(!c||!_.current||!n)return;function k(H){J()&&r(!1,H,"hover")}const z=tg(l.floating).documentElement;return z.addEventListener("mouseleave",k),()=>{z.removeEventListener("mouseleave",k)}},[l.floating,n,r,c,_,J]);const oe=w.useCallback(function(k,z,H){z===void 0&&(z=!0),H===void 0&&(H="hover");const I=Db(A.current,"close",N.current);I&&!U.current?(ya(F),F.current=window.setTimeout(()=>r(!1,k,H),I)):z&&(ya(F),r(!1,k,H))},[A,r]),we=fh(()=>{ce.current(),U.current=void 0}),se=fh(()=>{if(ae.current){const k=tg(l.floating).body;k.style.pointerEvents="",k.removeAttribute(rO),ae.current=!1}}),ue=fh(()=>i.current.openEvent?["click","mousedown"].includes(i.current.openEvent.type):!1);w.useEffect(()=>{if(!c)return;function k(q){if(ya(F),X.current=!1,m&&!Mh(N.current)||kb(P.current)>0&&!Db(A.current,"open"))return;const ee=Db(A.current,"open",N.current);ee?F.current=window.setTimeout(()=>{O.current||r(!0,q,"hover")},ee):n||r(!0,q,"hover")}function z(q){if(ue()){se();return}ce.current();const ee=tg(l.floating);if(ya(W),re.current=!1,_.current&&i.current.floatingContext){n||ya(F),U.current=_.current({...i.current.floatingContext,tree:b,x:q.clientX,y:q.clientY,onClose(){se(),we(),ue()||oe(q,!0,"safe-polygon")}});const pe=U.current;ee.addEventListener("mousemove",pe),ce.current=()=>{ee.removeEventListener("mousemove",pe)};return}(N.current==="touch"?!DW(l.floating,q.relatedTarget):!0)&&oe(q)}function H(q){ue()||i.current.floatingContext&&(_.current==null||_.current({...i.current.floatingContext,tree:b,x:q.clientX,y:q.clientY,onClose(){se(),we(),ue()||oe(q)}})(q))}function I(){ya(F)}function j(q){ue()||oe(q,!1)}if(Er(l.domReference)){const q=l.domReference,ee=l.floating;return n&&q.addEventListener("mouseleave",H),x&&q.addEventListener("mousemove",k,{once:!0}),q.addEventListener("mouseenter",k),q.addEventListener("mouseleave",z),ee&&(ee.addEventListener("mouseleave",H),ee.addEventListener("mouseenter",I),ee.addEventListener("mouseleave",j)),()=>{n&&q.removeEventListener("mouseleave",H),x&&q.removeEventListener("mousemove",k),q.removeEventListener("mouseenter",k),q.removeEventListener("mouseleave",z),ee&&(ee.removeEventListener("mouseleave",H),ee.removeEventListener("mouseenter",I),ee.removeEventListener("mouseleave",j))}}},[l,c,e,m,x,oe,we,se,r,n,O,b,A,_,i,ue,P]),yl(()=>{var k;if(c&&n&&(k=_.current)!=null&&(k=k.__options)!=null&&k.blockPointerEvents&&J()){ae.current=!0;const H=l.floating;if(Er(l.domReference)&&H){var z;const I=tg(l.floating).body;I.setAttribute(rO,"");const j=l.domReference,q=b==null||(z=b.nodesRef.current.find(ee=>ee.id===C))==null||(z=z.context)==null?void 0:z.elements.floating;return q&&(q.style.pointerEvents=""),I.style.pointerEvents="none",j.style.pointerEvents="auto",H.style.pointerEvents="auto",()=>{I.style.pointerEvents="",j.style.pointerEvents="",H.style.pointerEvents=""}}}},[c,n,C,l,b,_,J]),yl(()=>{n||(N.current=void 0,re.current=!1,we(),se())},[n,we,se]),w.useEffect(()=>()=>{we(),ya(F),ya(W),se()},[c,l.domReference,we,se]);const Y=w.useMemo(()=>{function k(z){N.current=z.pointerType}return{onPointerDown:k,onPointerEnter:k,onMouseMove(z){const{nativeEvent:H}=z;function I(){!X.current&&!O.current&&r(!0,H,"hover")}m&&!Mh(N.current)||n||kb(P.current)===0||re.current&&z.movementX**2+z.movementY**2<2||(ya(W),N.current==="touch"?I():(re.current=!0,W.current=window.setTimeout(I,kb(P.current))))}}},[m,r,n,O,P]);return w.useMemo(()=>c?{reference:Y}:{},[c,Y])}function iO(e){return Ni(e.target)&&e.target.tagName==="BUTTON"}function RK(e){return Ni(e.target)&&e.target.tagName==="A"}function aO(e){return kW(e)}function DK(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:i,elements:{domReference:o}}=e,{enabled:l=!0,event:c="click",toggle:f=!0,ignoreMouse:h=!1,keyboardHandlers:m=!0,stickIfOpen:y=!0}=t,x=w.useRef(),b=w.useRef(!1),C=w.useMemo(()=>({onPointerDown(_){x.current=_.pointerType},onMouseDown(_){const A=x.current;_.button===0&&c!=="click"&&(Mh(A,!0)&&h||(n&&f&&(!(i.current.openEvent&&y)||i.current.openEvent.type==="mousedown")?r(!1,_.nativeEvent,"click"):(_.preventDefault(),r(!0,_.nativeEvent,"click"))))},onClick(_){const A=x.current;if(c==="mousedown"&&x.current){x.current=void 0;return}Mh(A,!0)&&h||(n&&f&&(!(i.current.openEvent&&y)||i.current.openEvent.type==="click")?r(!1,_.nativeEvent,"click"):r(!0,_.nativeEvent,"click"))},onKeyDown(_){x.current=void 0,!(_.defaultPrevented||!m||iO(_))&&(_.key===" "&&!aO(o)&&(_.preventDefault(),b.current=!0),!RK(_)&&_.key==="Enter"&&r(!(n&&f),_.nativeEvent,"click"))},onKeyUp(_){_.defaultPrevented||!m||iO(_)||aO(o)||_.key===" "&&b.current&&(b.current=!1,r(!(n&&f),_.nativeEvent,"click"))}}),[i,o,c,h,m,r,n,y,f]);return w.useMemo(()=>l?{reference:C}:{},[l,C])}function kK(e){const{open:t=!1,onOpenChange:n,elements:r}=e,i=OK(),o=w.useRef({}),[l]=w.useState(()=>jK()),c=XR()!=null,[f,h]=w.useState(r.reference),m=fh((b,C,_)=>{o.current.openEvent=b?C:void 0,l.emit("openchange",{open:b,event:C,reason:_,nested:c}),n?.(b,C,_)}),y=w.useMemo(()=>({setPositionReference:h}),[]),x=w.useMemo(()=>({reference:f||r.reference||null,floating:r.floating||null,domReference:r.reference}),[f,r.reference,r.floating]);return w.useMemo(()=>({dataRef:o,open:t,onOpenChange:m,elements:x,events:l,floatingId:i,refs:y}),[t,m,x,l,i,y])}function JR(e){e===void 0&&(e={});const{nodeId:t}=e,n=kK({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[o,l]=w.useState(null),[c,f]=w.useState(null),m=i?.domReference||o,y=w.useRef(null),x=QR();yl(()=>{m&&(y.current=m)},[m]);const b=vK({...e,elements:{...i,...c&&{reference:c}}}),C=w.useCallback(N=>{const F=Er(N)?{getBoundingClientRect:()=>N.getBoundingClientRect(),getClientRects:()=>N.getClientRects(),contextElement:N}:N;f(F),b.refs.setReference(F)},[b.refs]),_=w.useCallback(N=>{(Er(N)||N===null)&&(y.current=N,l(N)),(Er(b.refs.reference.current)||b.refs.reference.current===null||N!==null&&!Er(N))&&b.refs.setReference(N)},[b.refs]),A=w.useMemo(()=>({...b.refs,setReference:_,setPositionReference:C,domReference:y}),[b.refs,_,C]),O=w.useMemo(()=>({...b.elements,domReference:m}),[b.elements,m]),P=w.useMemo(()=>({...b,...r,refs:A,elements:O,nodeId:t}),[b,A,O,t,r]);return yl(()=>{r.dataRef.current.floatingContext=P;const N=x?.nodesRef.current.find(F=>F.id===t);N&&(N.context=P)}),w.useMemo(()=>({...b,context:P,refs:A,elements:O}),[b,A,O,P])}function Ib(e,t,n){const r=new Map,i=n==="item";let o=e;if(i&&e){const{[JT]:l,[eO]:c,...f}=e;o=f}return{...n==="floating"&&{tabIndex:-1,[SK]:""},...o,...t.map(l=>{const c=l?l[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((l,c)=>(c&&Object.entries(c).forEach(f=>{let[h,m]=f;if(!(i&&[JT,eO].includes(h)))if(h.indexOf("on")===0){if(r.has(h)||r.set(h,[]),typeof m=="function"){var y;(y=r.get(h))==null||y.push(m),l[h]=function(){for(var x,b=arguments.length,C=new Array(b),_=0;_A(...C)).find(A=>A!==void 0)}}}else l[h]=m}),l),{})}}function e6(e){e===void 0&&(e=[]);const t=e.map(c=>c?.reference),n=e.map(c=>c?.floating),r=e.map(c=>c?.item),i=w.useCallback(c=>Ib(c,e,"reference"),t),o=w.useCallback(c=>Ib(c,e,"floating"),n),l=w.useCallback(c=>Ib(c,e,"item"),r);return w.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:l}),[i,o,l])}const oO=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase());function Hc(e,t){return typeof e=="function"?e(t):e}function IK(e,t){const[n,r]=w.useState(e);return e&&!n&&r(!0),w.useEffect(()=>{if(!e&&n){const i=setTimeout(()=>r(!1),t);return()=>clearTimeout(i)}},[e,n,t]),n}function zK(e,t){t===void 0&&(t={});const{open:n,elements:{floating:r}}=e,{duration:i=250}=t,l=(typeof i=="number"?i:i.close)||0,[c,f]=w.useState("unmounted"),h=IK(n,l);return!h&&c==="close"&&f("unmounted"),yl(()=>{if(r){if(n){f("initial");const m=requestAnimationFrame(()=>{Of.flushSync(()=>{f("open")})});return()=>{cancelAnimationFrame(m)}}f("close")}},[n,r]),{isMounted:h,status:c}}function UK(e,t){t===void 0&&(t={});const{initial:n={opacity:0},open:r,close:i,common:o,duration:l=250}=t,c=e.placement,f=c.split("-")[0],h=w.useMemo(()=>({side:f,placement:c}),[f,c]),m=typeof l=="number",y=(m?l:l.open)||0,x=(m?l:l.close)||0,[b,C]=w.useState(()=>({...Hc(o,h),...Hc(n,h)})),{isMounted:_,status:A}=zK(e,{duration:l}),O=ol(n),P=ol(r),N=ol(i),F=ol(o);return yl(()=>{const U=Hc(O.current,h),W=Hc(N.current,h),X=Hc(F.current,h),ae=Hc(P.current,h)||Object.keys(U).reduce((ce,re)=>(ce[re]="",ce),{});if(A==="initial"&&C(ce=>({transitionProperty:ce.transitionProperty,...X,...U})),A==="open"&&C({transitionProperty:Object.keys(ae).map(oO).join(","),transitionDuration:y+"ms",...X,...ae}),A==="close"){const ce=W||U;C({transitionProperty:Object.keys(ce).map(oO).join(","),transitionDuration:x+"ms",...X,...ce})}},[x,N,O,P,F,y,A,h]),{isMounted:_,styles:b}}var t6={prefix:"far",iconName:"clone",icon:[512,512,[],"f24d","M288 464L64 464c-8.8 0-16-7.2-16-16l0-224c0-8.8 7.2-16 16-16l48 0 0-48-48 0c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l224 0c35.3 0 64-28.7 64-64l0-48-48 0 0 48c0 8.8-7.2 16-16 16zM224 304c-8.8 0-16-7.2-16-16l0-224c0-8.8 7.2-16 16-16l224 0c8.8 0 16 7.2 16 16l0 224c0 8.8-7.2 16-16 16l-224 0zm-64-16c0 35.3 28.7 64 64 64l224 0c35.3 0 64-28.7 64-64l0-224c0-35.3-28.7-64-64-64L224 0c-35.3 0-64 28.7-64 64l0 224z"]},BK={prefix:"far",iconName:"image",icon:[448,512,[],"f03e","M64 80c-8.8 0-16 7.2-16 16l0 320c0 8.8 7.2 16 16 16l320 0c8.8 0 16-7.2 16-16l0-320c0-8.8-7.2-16-16-16L64 80zM0 96C0 60.7 28.7 32 64 32l320 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zm128 32a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm136 72c8.5 0 16.4 4.5 20.7 11.8l80 136c4.4 7.4 4.4 16.6 .1 24.1S352.6 384 344 384l-240 0c-8.9 0-17.2-5-21.3-12.9s-3.5-17.5 1.6-24.8l56-80c4.5-6.4 11.8-10.2 19.7-10.2s15.2 3.8 19.7 10.2l17.2 24.6 46.5-79c4.3-7.3 12.2-11.8 20.7-11.8z"]},FK={prefix:"far",iconName:"circle",icon:[512,512,[128308,128309,128992,128993,128994,128995,128996,9679,9898,9899,11044,61708,61915],"f111","M464 256a208 208 0 1 0 -416 0 208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0 256 256 0 1 1 -512 0z"]},$K={prefix:"far",iconName:"circle-right",icon:[512,512,[61838,"arrow-alt-circle-right"],"f35a","M464 256a208 208 0 1 1 -416 0 208 208 0 1 1 416 0zM0 256a256 256 0 1 0 512 0 256 256 0 1 0 -512 0zm387.3 11.3c6.2-6.2 6.2-16.4 0-22.6l-104-104c-4.6-4.6-11.5-5.9-17.4-3.5S256 145.5 256 152l0 72-104 0c-13.3 0-24 10.7-24 24l0 16c0 13.3 10.7 24 24 24l104 0 0 72c0 6.5 3.9 12.3 9.9 14.8s12.9 1.1 17.4-3.5l104-104z"]},VK=$K;const HK=({children:e,summary:t,summaryClasses:n,...r})=>{const i=w.useRef(null),[o,l]=w.useState(!1);return w.useEffect(()=>{const c=i.current,f=()=>l(!!c?.open);return c?.addEventListener("toggle",f),()=>c?.removeEventListener("toggle",f)},[]),g.jsxs("details",{ref:i,...r,children:[g.jsx("summary",{className:Oe("focus-ring px-1 -mx-1 rounded-sm",n),children:t}),o&&g.jsx("div",{className:"mt-3 flex flex-col gap-y-3",children:e})]})},qK=w.forwardRef(({className:e,...t},n)=>g.jsx("div",{className:Oe("px-4 py-3 rounded-t-md","bg-lm-primary dark:bg-dm-primary border-b border-lm-border dark:border-dm-border",e),...t,ref:n})),GK=w.forwardRef(({className:e,...t},n)=>g.jsx("div",{className:Oe("p-4 bg-lm-primary dark:bg-dm-primary first:rounded-t-md","first:rounded-t-md last:rounded-b-md",e),...t,ref:n})),YK=w.forwardRef(({className:e,...t},n)=>g.jsx("div",{className:Oe("px-4 py-3 rounded-b-md","bg-lm-primary dark:bg-dm-primary border-t border-lm-border dark:border-dm-border",e),...t,ref:n})),WK=w.forwardRef(({className:e,...t},n)=>g.jsx("div",{className:Oe("group/card rounded-md shadow-md","border border-lm-border dark:border-dm-border bg-lm-primary dark:bg-dm-primary",e),...t,ref:n})),ln=Object.assign(WK,{Body:GK,Header:qK,Footer:YK}),Nt=w.forwardRef(({bodyClassName:e,children:t,...n},r)=>{const{title:i,titleSize:o="md",...l}="title"in n?n:{...n,title:void 0,titleSize:void 0};return g.jsxs(ln,{...l,ref:r,children:[i&&g.jsxs(ln.Header,{children:[o==="lg"&&g.jsx("h4",{children:i}),o==="md"&&g.jsx("h5",{children:i}),o==="sm"&&g.jsx("h6",{children:i})]}),g.jsx(ln.Body,{className:e,children:t})]})});function KK({id:e,items:t,onSelectItem:n,onActiveItemChange:r,renderItem:i,className:o,noItemsMessage:l="No items",anchor:c,"aria-label":f="Items",...h}){const[m,y]=w.useState(0),x=w.useCallback(b=>{if(y(b),r){const[C,_]=[...t.entries()][b];r(C,_)}},[t,r]);return w.useEffect(()=>{const b=c?.current;if(!b)return;const C=_=>{["Enter","ArrowUp","ArrowDown"].includes(_.key)&&_.preventDefault(),_.key==="ArrowDown"?x(Math.min(m+1,t.size-1)):_.key==="ArrowUp"?x(Math.max(m-1,0)):_.key==="Enter"&&n([...t.values()][m])};return b.addEventListener("keydown",C),()=>b.removeEventListener("keydown",C)},[m,c,x,t,n]),g.jsxs(ln,{id:e,className:Oe("py-1 flex flex-col",o),role:"listbox","aria-orientation":"vertical","aria-label":f,...h,children:[t.size===0&&g.jsx("i",{role:"option","aria-disabled":!0,"aria-selected":!1,"data-testid":"no-items",className:"px-2 py-1",children:l}),[...t.entries()].map(([b,C],_)=>g.jsx("button",{id:`${e}_${b}`,type:"button",role:"option","aria-selected":_===m,className:Oe("px-2 py-1 text-left truncate",{"bg-lm-secondary dark:bg-dm-secondary":_===m}),tabIndex:-1,onClick:()=>n(C),onMouseOver:()=>x(_),children:i(C)},b))]})}const nm=w.createContext(void 0),jf=w.createContext({responsive:!0,size:"md"}),ZK=({children:e,className:t})=>{const{responsive:n}=w.useContext(jf);return g.jsx(nm.Provider,{value:{section:"head"},children:g.jsx("thead",{className:Oe({"hidden lg:table-header-group":n},t),children:e})})},XK=({children:e,className:t})=>{const{responsive:n}=w.useContext(jf);return g.jsx(nm.Provider,{value:{section:"body"},children:g.jsx("tbody",{className:Oe({"lg:table-row-group flex flex-col gap-y-3":n},t),children:e})})},QK=({children:e,className:t})=>{const{responsive:n}=w.useContext(jf);return g.jsx(nm.Provider,{value:{section:"footer"},children:g.jsx("tfoot",{className:Oe({"lg:table-row-group flex flex-col gap-y-3 mt-4":n},t),children:e})})},JK=({children:e,className:t,...n})=>{const r=w.useContext(nm)?.section==="body",{responsive:i}=w.useContext(jf);return g.jsx("tr",{className:Oe("group",{"lg:table-row flex flex-col":i,"lg:border-0 border-y-2 border-lm-border dark:border-dm-border":i,"hover:bg-lm-primary dark:hover:bg-dm-primary":r,"group-[&]/card:hover:bg-lm-secondary dark:group-[&]/card:hover:bg-dm-secondary":r},t),...n,children:e})},eZ=({children:e,className:t,columnName:n,type:r,...i})=>{const o=w.useContext(nm),l=r??(o?.section!=="body"?"th":"td"),{responsive:c,size:f}=w.useContext(jf);return g.jsx(l,{"data-column":c?n:void 0,className:Oe("border-lm-border dark:border-dm-border",{"p-1":f==="sm","p-2":f==="md","p-3":f==="lg","border-b-1":!c,"block lg:table-cell not-last:border-b-1 lg:border-b-1":c,"text-left":l==="th","before:lg:hidden before:content-[attr(data-column)] before:font-bold before:mr-1":c&&l==="td"},t),...i,children:e})},tZ=({header:e,footer:t,children:n,responsive:r=!0,size:i="md",...o})=>g.jsx(jf.Provider,{value:{responsive:r,size:i},children:g.jsxs("table",{className:"w-full",...o,children:[g.jsx(ZK,{children:e}),g.jsx(XK,{children:n}),t&&g.jsx(QK,{children:t})]})}),$e=Object.assign(tZ,{Row:JK,Cell:eZ}),Tt=w.forwardRef(({className:e,disabled:t,variant:n="primary",size:r="md",inline:i=!1,solid:o=!1,type:l="button",...c},f)=>{const h="to"in c&&typeof c.to=="string",m=h?Ir:"button",y=h?void 0:l;return g.jsx(m,{ref:f,className:Oe({"inline-flex":i,flex:!i},"gap-2 items-center justify-center","border rounded-md no-underline","transition-colors",{"focus-ring":n==="primary","focus-ring-secondary":n==="secondary","focus-ring-danger":n==="danger"},{"px-1.5 py-1 text-sm":r==="sm","px-3 py-1.5":r==="md","px-4 py-2 text-lg":r==="lg"},{"border-lm-brand dark:border-dm-brand":n==="primary","text-lm-brand dark:text-dm-brand":n==="primary"&&!o,"border-zinc-500":n==="secondary","text-zinc-500":n==="secondary"&&!o,"border-danger":n==="danger","text-danger":n==="danger"&&!o},o&&{"text-white":!0,"bg-lm-brand dark:bg-dm-brand":n==="primary","highlight:bg-lm-brand-dark dark:highlight:bg-dm-brand-dark":n==="primary","highlight:border-lm-brand-dark dark:highlight:border-dm-brand-dark":n==="primary","bg-zinc-500":n==="secondary","highlight:bg-zinc-600 highlight:border-zinc-600":n==="secondary","bg-danger":n==="danger","highlight:bg-danger-dark highlight:border-danger-dark":n==="danger"},!t&&{"highlight:text-white":!o,"highlight:bg-lm-brand dark:highlight:bg-dm-brand":n==="primary","highlight:bg-zinc-500":n==="secondary","highlight:bg-danger":n==="danger"},{"cursor-pointer":!t,"pointer-events-none opacity-65":t},e),disabled:h?void 0:t,"aria-disabled":h?t:void 0,type:y,...c})}),n6=w.forwardRef(({className:e,onChange:t,...n},r)=>{const i=w.useCallback(o=>t?.(o.target.checked,o),[t]);return g.jsx("input",{ref:r,type:"checkbox",className:Oe("appearance-none focus-ring cursor-[inherit]","border-1 border-lm-input-border dark:border-dm-input-border","bg-lm-primary dark:bg-dm-primary checked:bg-lm-brand dark:checked:bg-dm-brand bg-no-repeat","group-[&]/card:bg-lm-input group-[&]/card:dark:bg-dm-input",e),onChange:i,...n})}),W_=w.forwardRef(({className:e,...t},n)=>g.jsx(n6,{ref:n,className:Oe("rounded-sm w-4 h-4 checked:bg-(image:--tick) bg-center",e),...t})),Iu=w.forwardRef(({onClick:e,className:t,label:n="Close",size:r="lg",solid:i},o)=>g.jsx("button",{ref:o,type:"button",onClick:e,className:Oe("rounded-md focus-ring cursor-pointer",{"opacity-50 highlight:opacity-80 transition-opacity":!i},t),"aria-label":n,children:g.jsx(Be,{icon:dy,size:r==="lg"?"xl":r==="md"?"lg":void 0})})),Ti=w.forwardRef(({borderless:e=!1,size:t="md",feedback:n,variant:r="default",className:i,disabled:o,...l},c)=>g.jsx("input",{ref:c,className:Oe("outline-none",r==="default"&&["w-full",{"focus-ring":!n,"focus-ring-danger":n==="error","px-2 py-1 text-sm":t==="sm","px-3 py-1.5":t==="md","px-4 py-2 text-xl":t==="lg","rounded-md border":!e,"border-lm-input-border dark:border-dm-input-border":!e&&!n,"border-danger":!e&&n==="error","bg-lm-disabled-input dark:bg-dm-disabled-input":o,"bg-lm-primary dark:bg-dm-primary":!o,"group-[&]/card:bg-lm-input group-[&]/card:dark:bg-dm-input":!o}],i),disabled:o,...l})),Ma=({required:e,children:t,className:n,...r})=>g.jsxs("label",{className:Oe("cursor-pointer",n),...r,children:[t,e&&g.jsx("span",{className:"text-danger ml-1","data-testid":"required-indicator",children:"*"})]}),K_=({children:e,helpText:t,error:n,"data-testid":r})=>g.jsxs("div",{className:"flex flex-col gap-1","data-testid":r,children:[e,t&&g.jsx("small",{"data-testid":r?`${r}-help-text`:"help-text",className:"text-gray-500 dark:text-gray-400",children:t}),n&&g.jsx("span",{"data-testid":r?`${r}-error`:"error",className:"text-danger",children:n})]}),di=w.forwardRef(({label:e,inputClassName:t,required:n,hiddenRequired:r,error:i,helpText:o,"data-testid":l,...c},f)=>{const h=w.useId();return g.jsxs(K_,{error:i,helpText:o,"data-testid":l,children:[g.jsx(Ma,{htmlFor:h,required:n,children:e}),g.jsx(Ti,{ref:f,id:h,className:t,required:n||r,feedback:i?"error":void 0,...c})]})}),nZ=w.forwardRef(({containerClassName:e,className:t,size:n,...r},i)=>{const{flag:o,toggle:l,setToFalse:c}=Cn(),f=w.useRef(null),h=w.useCallback(({relatedTarget:m})=>{f.current?.contains(m)||c()},[f,c]);return g.jsxs("div",{className:Oe("group relative",e),ref:f,onBlurCapture:h,children:[g.jsx(Ti,{ref:i,type:o?"text":"password",className:Oe({"pr-10":n!=="sm","pr-8":n==="sm"},t),size:n,"data-testid":"input",...r}),g.jsx("button",{type:"button",onClick:l,title:o?"Hide password":"Show password","aria-label":o?"Hide password":"Show password",className:Oe("absolute top-[50%] translate-y-[-50%] px-1 cursor-pointer","text-placeholder hover:text-lm-text hover:dark:text-dm-text transition-colors",{"right-1.5":n!=="sm","scale-85 right-1":n==="sm"}),tabIndex:-1,children:g.jsx(Be,{icon:o?EH:GV})})]})}),rZ=w.forwardRef(({label:e,inputClassName:t,required:n,hiddenRequired:r,error:i,helpText:o,"data-testid":l,...c},f)=>{const h=w.useId();return g.jsxs(K_,{error:i,helpText:o,"data-testid":l,children:[g.jsx(Ma,{htmlFor:h,required:n,children:e}),g.jsx(nZ,{ref:f,id:h,className:t,required:n||r,feedback:i?"error":void 0,...c})]})}),iZ=w.forwardRef(({className:e,size:t="md",feedback:n,disabled:r,...i},o)=>g.jsx("select",{ref:o,className:Oe("w-full rounded-md border appearance-none pr-9","bg-(image:--chevron-down) bg-no-repeat bg-position-[right_0.75rem_center] bg-size-[16px_12px]",{"focus-ring":!n,"focus-ring-danger":n==="error","border-lm-input-border dark:border-dm-input-border":!n,"border-danger":n==="error","pl-2 py-1 text-sm":t==="sm","pl-3 py-1.5":t==="md","pl-4 py-2 text-xl":t==="lg","bg-lm-disabled-input dark:bg-dm-disabled-input":r,"bg-lm-primary dark:bg-dm-primary group-[&]/card:bg-lm-input group-[&]/card:dark:bg-dm-input":!r},e),disabled:r,...i})),Z_=w.forwardRef(({selectClassName:e,label:t,error:n,helpText:r,required:i,hiddenRequired:o,"data-testid":l,...c},f)=>{const h=w.useId();return g.jsxs(K_,{error:n,helpText:r,"data-testid":l,children:[g.jsx(Ma,{htmlFor:h,required:i,children:t}),g.jsx(iZ,{ref:f,id:h,className:e,required:i||o,feedback:n?"error":void 0,...c})]})}),Mf=w.forwardRef(({onChange:e,containerClassName:t,inputClassName:n,size:r="lg",loading:i=!1,variant:o="default",immediate:l=!1,...c},f)=>{const{setTimeout:h,clearCurrentTimeout:m}=s6(500),y=w.useCallback(x=>{!x||l?(m(),e(x)):h(()=>e(x))},[m,l,e,h]);return g.jsxs("div",{className:Oe("group relative focus-within:z-10",t),children:[o==="default"&&g.jsx(Be,{icon:i?O_:VV,spin:i,className:Oe("absolute top-[50%] translate-y-[-50%] transition-colors","text-placeholder group-focus-within:text-lm-text dark:group-focus-within:text-dm-text",{"left-3":r!=="sm","scale-85 left-2":r==="sm"})}),g.jsx(Ti,{ref:f,variant:o,type:"search",className:Oe(o==="default"&&{"pl-9":r!=="sm","pl-7":r==="sm"},n),placeholder:"Search...",onChange:x=>y(x.target.value),size:r,...c})]})});function aZ({searchResults:e,onSearch:t,onSelectSearchResult:n,renderSearchResult:r,size:i="md",listboxSpan:o="full",onFocus:l,containerClassName:c,listboxClassName:f,...h},m){const y=w.useId(),[x,b]=w.useState(),C=w.useRef(null);w.useImperativeHandle(m,()=>C.current);const _=w.useMemo(()=>e?x??[...e.keys()][0]:void 0,[x,e]),A=w.useCallback(O=>{n(O),t(""),C.current.value=""},[t,n,C]);return g.jsxs("div",{className:Oe("relative",c),onBlur:O=>{O.currentTarget.contains(O.relatedTarget)||t("")},children:[g.jsx(Mf,{onChange:t,size:i,ref:C,role:"combobox","aria-autocomplete":"list","aria-expanded":!!e,"aria-controls":y,"aria-activedescendant":_?`${y}_${_}`:void 0,autoComplete:"off",autoCorrect:"off",onFocus:O=>{l?.(O),t(O.target.value)},...h}),e&&g.jsx(KK,{id:y,items:e,anchor:C,onSelectItem:A,onActiveItemChange:b,renderItem:r,className:Oe("absolute top-full mt-1 z-10",{"min-w-60":o==="auto","w-full":o==="full"},f),"aria-label":"Matching items",noItemsMessage:"No results found matching search"})]})}const r6=w.forwardRef(aZ),oZ=({name:e,color:t})=>g.jsxs("div",{className:"inline-flex items-center gap-2",children:[g.jsx("div",{"aria-hidden":!0,className:"w-4 h-4 rounded-full",style:{backgroundColor:t}}),e]}),sZ=({tag:e,color:t,size:n,onRemove:r})=>g.jsxs("li",{className:Oe("inline-flex items-center gap-1 font-bold [&]:rounded-md",{"px-1 text-sm":n==="sm","py-0.25 px-1.5":n==="md","py-0.5 px-1.5":n==="lg"}),style:{backgroundColor:t,color:X_(t)?"#000":"#fff"},onClick:i=>i.stopPropagation(),children:[e,g.jsx(Iu,{label:`Remove ${e}`,solid:!0,size:"sm",onClick:()=>r(e)})]}),sO="#99a1af",lZ=({tags:e,selectedTags:t=[],onTagsChange:n,getColorForTag:r,searchMode:i="startsWith",immutable:o=!1,size:l="md",disabled:c,containerClassName:f,...h})=>{const{searchResults:m,onSearch:y}=o6({tags:e,selectedTags:t,searchMode:i,allowAdding:!o}),x=w.useCallback(_=>{const A=(_.match(/Add\s+"([^"]+)"\s+tag/)?.[1]??_).split(",").map(J_);n?.([...new Set([...t,...A])])},[n,t]),b=w.useCallback(_=>n?.(t.filter(A=>A!==_)),[n,t]),C=w.useRef(null);return g.jsxs("div",{className:Oe("rounded-md flex flex-wrap gap-1","border border-lm-input-border dark:border-dm-input-border","cursor-text focus-within:focus-within-ring",{"p-0.5":l==="sm","p-1.25":l==="md","p-2":l==="lg","bg-lm-disabled-input dark:bg-dm-disabled-input":c,"bg-lm-primary dark:bg-dm-primary":!c,"group-[&]/card:bg-lm-input group-[&]/card:dark:bg-dm-input":!c},f),onClick:_=>{_.target!==C.current&&C.current?.focus()},children:[g.jsx("ul",{className:"m-0 p-0 flex flex-wrap gap-1",children:t.map((_,A)=>{const O=r?.(_)??sO;return g.jsx(sZ,{tag:_,color:O,onRemove:b,size:l},`${_}${A}`)})}),g.jsx(r6,{variant:"unstyled",listboxSpan:"auto",containerClassName:"flex items-center",listboxClassName:"whitespace-nowrap",inputClassName:Oe("no-clear-button",{"px-1 text-sm":l==="sm","px-2 h-[26px]":l==="md","px-3 text-xl":l==="lg"}),searchResults:m,onSearch:y,onSelectSearchResult:x,renderSearchResult:_=>_.match(/Add\s+"([^"]+)"\s+tag/)?_:g.jsx(oZ,{name:_,color:r?.(_)??sO}),onKeyDown:_=>{_.key==="Backspace"&&!m&&b(t[t.length-1])},size:l,disabled:c,ref:C,immediate:!0,...h})]})},uZ=w.forwardRef(({className:e,...t},n)=>g.jsx(n6,{ref:n,className:Oe("rounded-full w-8 h-4","bg-(image:--circle-grey-dark) dark:bg-(image:--circle-grey-light) checked:bg-(image:--circle-white)","focus-visible:not-checked:bg-(image:--circle-blue-light)","checked:bg-right transition-[background-position]",e),...t}));function cZ(e,{elementsSelector:t,focusFirstItem:n=!1,vertical:r=!0,horizontal:i=!0}){const o=w.useMemo(()=>{const f=[];return r&&f.push("ArrowDown"),i&&f.push("ArrowRight"),f},[i,r]),l=w.useMemo(()=>{const f=[];return r&&f.push("ArrowUp"),i&&f.push("ArrowLeft"),f},[i,r]),c=w.useMemo(()=>[...o,...l],[o,l]);w.useEffect(()=>{const f=e.current;if(!f)return()=>{};const h=new AbortController,m=()=>[...f.querySelectorAll(t)],y=m(),x=Math.max(y.findIndex(b=>b.dataset.selected==="true"),0);return y.forEach((b,C)=>{b.tabIndex=C===x?0:-1,n&&C===x&&b.focus()}),f.addEventListener("keydown",b=>{if(!c.includes(b.key))return;b.preventDefault();const C=m(),_=C.findIndex(O=>O.tabIndex===0),A=o.includes(b.key)?C[_+1]??C[0]:C[_-1]??C[C.length-1];C.forEach(O=>{O.tabIndex=-1}),A.tabIndex=0,A.focus()},{signal:h.signal}),()=>h.abort()},[c,e,t,n,o])}const fZ=()=>{const e=uo();return w.useCallback(()=>e(-1),[e])},dZ=128;function X_(e){const[t,n,r]=(e.match(/../g)??[]).map(i=>parseInt(i,16)||0);return Math.round(Math.sqrt(.299*t**2+.587*n**2+.114*r**2))>=dZ}const i6=({text:e,className:t,size:n="lg",initialCopied:r=!1,navigator_:i=globalThis.navigator,...o})=>{const[l,c]=Sy({initialValue:r}),f=w.useCallback(()=>i.clipboard.writeText(e).then(c),[i.clipboard,e,c]);return g.jsx("button",{type:"button",className:Oe("focus-ring rounded-sm cursor-pointer",{"text-md":n==="sm","text-lg":n==="md","text-xl":n==="lg"},t),"aria-label":`Copy ${e} to clipboard`,title:"Copy to clipboard",onClick:f,...o,children:g.jsx(Be,{icon:l?Ru:t6})})},a6=e=>{const t=new URLSearchParams(e),n={};return t.forEach((r,i)=>{if(i.endsWith("[]")){const o=i.slice(0,-2);n[o]??=[],n[o].push(r)}else n[i]=r}),n},Q_=e=>{const t=new URLSearchParams;for(const[n,r]of Object.entries(e))r!==void 0&&(Array.isArray(r)?r.forEach(i=>t.append(`${n}[]`,`${i}`)):t.append(n,`${r}`));return t.toString()},Zu=()=>{const{search:e}=Or();return w.useMemo(()=>a6(e),[e])},hZ=/\s+/g,J_=e=>e.trim().toLowerCase().replace(hZ,"-"),mZ=new Intl.NumberFormat("en-US"),Sn=e=>mZ.format(Number(e)),lO=10,pZ=e=>Math.ceil(e/lO)*lO,qc=2,rv="...",gZ=(e,t)=>Array.from({length:t-e},(n,r)=>e+r),vZ=(e,t)=>{const n=gZ(Math.max(qc,e-qc),Math.min(t-1,e+qc)+1);return e-qc>qc&&n.unshift(rv),e+qce===rv,yZ=e=>_h(e)?e:Sn(e),bZ=(e,t)=>_h(e)?`${e}_${t}`:`${e}`;function o6({tags:e,selectedTags:t,searchMode:n,searchLimit:r=5,allowAdding:i=!1}){const[o,l]=w.useState(),c=w.useCallback(f=>{const h=f.toLowerCase().trim();if(!h){l(void 0);return}const m=e.filter(y=>t.includes(y)?!1:y.toLowerCase()[n](h)).slice(0,r);i&&m.push(`Add "${h.split(",").map(J_).join(",")}" tag`),l(new Map(m.map(y=>[y,y])))},[i,r,n,t,e]);return{searchResults:o,onSearch:c}}function s6(e,t=globalThis.setTimeout,n=globalThis.clearTimeout){const r=w.useRef(null),i=w.useCallback(()=>{r.current&&n(r.current)},[n]),o=w.useCallback((l,c)=>{i(),r.current=t(()=>{l(),r.current=null},c??e)},[i,e,t]);return w.useEffect(()=>i,[i]),w.useMemo(()=>({setTimeout:o,clearCurrentTimeout:i}),[i,o])}const xZ=2e3,Sy=({initialValue:e=!1,delay:t=xZ}={},n=globalThis.setTimeout,r=globalThis.clearTimeout)=>{const{setTimeout:i}=s6(t,n,r),[o,l]=w.useState(e),c=w.useRef(e),f=w.useCallback(()=>{l(!c.current),i(()=>l(c.current))},[i]);return[o,f]};function Cn(e=!1){const[t,n]=w.useState(e),r=w.useCallback(()=>n(l=>!l),[]),i=w.useCallback(()=>n(!0),[]),o=w.useCallback(()=>n(!1),[]);return{flag:t,toggle:r,setToTrue:i,setToFalse:o}}const l6=w.createContext({}),wZ=({className:e,selected:t,disabled:n,onClick:r,...i})=>{const o="to"in i&&typeof i.to=="string",l=o?Ir:"button",{onItemClick:c}=w.useContext(l6);return g.jsx(l,{role:"menuitem","data-selected":t,className:Oe("flex items-center gap-2","w-full px-3 py-1.5 focus-ring","no-underline text-inherit",{"cursor-pointer":!n,"pointer-events-none opacity-50":n,"bg-lm-secondary dark:bg-dm-secondary":t&&!n,"highlight:bg-lm-secondary dark:highlight:bg-dm-secondary highlight:z-1 relative":!t&&!n},e),tabIndex:-1,disabled:o?void 0:n,"aria-disabled":o?n:void 0,type:o?void 0:"button",onClick:f=>{r?.(f),c?.()},...i})},_Z=()=>g.jsx("div",{role:"separator","aria-hidden":!0,className:"border-b border-lm-border dark:border-dm-border my-2"}),SZ=({children:e})=>g.jsx("div",{role:"heading","aria-level":6,"aria-hidden":!0,className:Oe("flex items-center w-full px-3 py-1.5","text-gray-500 text-sm font-semibold"),onClick:t=>t.stopPropagation(),children:e}),CZ=({className:e,...t})=>g.jsx("div",{className:Oe("px-3 py-1.5",e),...t}),EZ=({children:e,className:t,focusableElementsSelector:n='[role="menuitem"]:not([disabled]):not([aria-disabled])',focusFirstItem:r=!1,onItemClick:i,...o})=>{const l=w.useRef(null);return cZ(l,{elementsSelector:n,focusFirstItem:r}),g.jsx(ln,{ref:l,role:"menu",className:Oe("py-2 whitespace-nowrap",t),...o,children:g.jsx(l6.Provider,{value:{onItemClick:i},children:e})})},dh=Object.assign(EZ,{Item:wZ,Separator:_Z,Title:SZ,Misc:CZ}),AZ=({children:e,menuAlignment:t="left",buttonVariant:n="button",buttonContent:r,buttonClassName:i,buttonSize:o="md",buttonDisabled:l=!1,containerClassName:c,menuClassName:f,caretless:h,buttonLabel:m,menuOffset:y=3})=>{const[x,b]=w.useState(!1),C=w.useCallback(()=>b(!1),[]),_=w.useRef(null),{refs:A,floatingStyles:O,context:P}=JR({open:x,onOpenChange:b,placement:t==="right"?"bottom-end":"bottom-start",middleware:[xK(),bK(y)],elements:{reference:_.current}}),N=DK(P),{getReferenceProps:F,getFloatingProps:U}=e6([N]),W=w.useId(),X=w.useRef(null);return w.useEffect(()=>{const ae=X.current;if(!ae||!x)return()=>{};const ce=new AbortController;return document.body.addEventListener("click",re=>{re.composedPath().includes(ae)||C()},{signal:ce.signal}),()=>ce.abort()},[C,x]),g.jsxs("div",{ref:X,className:Oe("relative inline-block",c),onKeyDown:ae=>{ae.key==="Escape"&&C()},onBlur:ae=>{ae.relatedTarget&&!X.current.contains(ae.relatedTarget)&&C()},children:[g.jsxs("button",{ref:_,...F(),type:"button","aria-haspopup":!0,"aria-expanded":x,"aria-controls":W,"aria-label":m,disabled:l,className:Oe("flex items-center rounded-md focus-ring",{"justify-between":!h,"cursor-pointer":!l,"pointer-events-none opacity-50":l,"border border-lm-border dark:border-dm-border":n==="button","bg-lm-primary dark:bg-dm-primary":n==="button","group-[&]/card:bg-lm-input group-[&]/card:dark:bg-dm-input":n==="button","text-lm-brand dark:text-dm-brand":n==="link","highlight:text-lm-brand-dark dark:highlight:text-dm-brand-dark highlight:underline":n==="link","px-1.5 py-1 text-sm":n!=="text"&&o==="sm","px-3 py-1.5":n!=="text"&&o==="md","px-4 py-2 text-lg":n!=="text"&&o==="lg","gap-x-1.5":o==="sm","gap-x-2":o!=="sm"},i),onKeyDown:ae=>{ae.key==="ArrowDown"&&(ae.preventDefault(),b(!0))},children:[r,!h&&g.jsx(Be,{icon:PN,size:"xs",widthAuto:!0})]}),x&&g.jsx("div",{ref:A.setFloating,style:O,className:"min-w-full z-500",...U(),children:g.jsx(dh,{className:f,id:W,focusableElementsSelector:'[role="menuitem"]:not([disabled]):not([aria-disabled]),input:not([disabled]),select:not([disabled])',focusFirstItem:!0,onItemClick:C,children:e})})]})},qe=Object.assign(AZ,{Item:dh.Item,Separator:dh.Separator,Title:dh.Title,Misc:dh.Misc}),Cy=w.forwardRef(({className:e,disabled:t,size:n="md",type:r="button",...i},o)=>g.jsx("button",{className:Oe("inline-flex rounded-md focus-ring","text-lm-brand dark:text-dm-brand","highlight:text-lm-brand-dark dark:highlight:text-dm-brand-dark highlight:underline",{"px-1.5 py-1 text-sm":n==="sm","px-3 py-1.5":n==="md","px-4 py-2 text-lg":n==="lg","cursor-pointer":!t,"pointer-events-none opacity-65":t},e),disabled:t,type:r,...i,ref:o})),TZ=({className:e,active:t,...n})=>g.jsx("li",{role:"menuitem",className:"w-full flex","data-active":t,children:g.jsx(Ir,{className:Oe("px-2 py-3","max-md:w-full max-md:px-3 max-md:py-2","text-white no-underline highlight:opacity-100 transition-opacity",{"opacity-60":!t,"opacity-100":t},e),...n})}),OZ=({containerClassName:e,buttonClassName:t,menuClassName:n,active:r,...i})=>g.jsx("li",{role:"menuitem","aria-haspopup":!0,className:"w-full flex","data-active":r,children:g.jsx(qe,{containerClassName:Oe("max-md:w-full",e),buttonVariant:"text",buttonClassName:Oe("px-2 py-3","max-md:w-full max-md:px-3 max-md:py-2","text-white highlight:opacity-100 transition-opacity",{"opacity-60":!r,"opacity-100":r},t),menuAlignment:"right",menuOffset:-3,menuClassName:Oe("mx-2",n),...i})}),jZ=({className:e,brand:t,children:n})=>{const{flag:r,toggle:i,setToFalse:o}=Cn(),l=w.useId(),c=w.useId(),{pathname:f}=Or();return w.useEffect(()=>o(),[f,o]),g.jsxs("nav",{className:Oe("w-full relative","bg-lm-main dark:bg-dm-main","flex max-md:flex-col items-center justify-between",e),children:[g.jsxs("div",{className:"w-full relative",children:[g.jsx("h4",{className:Oe("text-white px-4 py-3","max-md:w-full max-md:flex max-md:flex-col items-center"),children:t}),g.jsx(Tt,{id:c,variant:"secondary",className:Oe("absolute right-0 top-[50%] translate-y-[-50%]","md:hidden mx-2 [&]:px-2","opacity-60 highlight:opacity-100 transition-opacity","[&]:text-white [&]:border-white [&]:highlight:bg-transparent"),onClick:i,"aria-label":`${r?"Hide":"Show"} menu`,"aria-controls":l,children:g.jsx(Be,{icon:r?WV:dH})})]}),g.jsx("ul",{id:l,"aria-labelledby":c,role:"menu",className:Oe("m-0 p-0","max-md:w-full md:mr-2 max-md:absolute max-md:top-full z-2000","flex max-md:flex-col items-center","bg-lm-main dark:bg-dm-main",{"max-md:hidden":!r}),children:n})]})},J2=Object.assign(jZ,{MenuItem:TZ,Dropdown:OZ}),u6=w.createContext(null),MZ=({className:e,to:t,...n})=>{const r=w.useContext(u6);return g.jsx(__,{role:"menuitem",to:t,className:({isActive:i})=>Oe("px-4 pt-2 pb-[calc(0.5rem-3px)] border-b-3","highlight:text-lm-brand dark:highlight:text-dm-brand","font-bold text-center no-underline transition-colors","rounded-none outline-none focus-visible:inset-ring-2","focus-visible:inset-ring-lm-brand/50 dark:focus-visible:inset-ring-dm-brand/50",{"text-lm-brand dark:text-dm-brand":i,"border-b-lm-brand dark:border-b-dm-brand active":i,"border-b-transparent text-gray-500":!i,"flex-grow":r?.fill},e),...n})},PZ=({children:e,className:t,fill:n})=>g.jsx(u6.Provider,{value:{fill:n},children:g.jsx(ln,{role:"menubar",className:Oe("flex overflow-hidden",t),children:e})}),nl=Object.assign(PZ,{Pill:MZ}),c6=["border border-r-0 last:border-r border-lm-border dark:border-dm-border","rounded-none first:rounded-l last:rounded-r"],f6=(e=!1)=>Oe(c6,"px-3 py-2 cursor-pointer no-underline","focus-ring focus-visible:z-1",!e&&["text-lm-brand dark:text-dm-brand","bg-lm-primary dark:bg-dm-primary","highlight:bg-lm-secondary dark:highlight:bg-dm-secondary"],e&&"bg-lm-main dark:bg-dm-main text-white"),ew=({children:e})=>g.jsx("span",{"aria-hidden":!0,className:Oe(c6,"px-3 py-2 text-gray-400"),children:e}),d6=()=>g.jsx(ew,{children:rv});function LZ({children:e,active:t,isEllipsis:n,href:r,...i}){const o=w.useMemo(()=>f6(t),[t]);return n?g.jsx(d6,{}):g.jsx(Ir,{className:o,to:r,...i,"data-active":t,children:e})}function NZ({children:e,active:t,isEllipsis:n,...r}){const i=w.useMemo(()=>f6(t),[t]);return n?g.jsx(d6,{}):g.jsx("button",{type:"button",className:i,...r,"data-active":t,children:e})}const Ey=({currentPage:e,pagesCount:t,...n})=>{const r="urlForPage"in n,i=r?LZ:NZ,o=w.useCallback(l=>r?{href:_h(l)?void 0:n.urlForPage(l)}:{onClick:()=>!_h(l)&&n.onPageChange(l)},[r,n]);return t<2?null:g.jsxs("div",{className:"select-none flex","data-testid":"paginator",children:[e===1?g.jsx(ew,{children:g.jsx(Be,{size:"xs",icon:uT})}):g.jsx(i,{...o(Math.max(1,e-1)),"aria-label":"Previous",children:g.jsx(Be,{size:"xs",icon:uT})}),vZ(e,t).map((l,c)=>g.jsx(i,{active:l===e,isEllipsis:_h(l),...o(l),children:yZ(l)},bZ(l,c))),e===t?g.jsx(ew,{children:g.jsx(Be,{size:"xs",icon:Wg})}):g.jsx(i,{...o(Math.min(t,e+1)),"aria-label":"Next",children:g.jsx(Be,{size:"xs",icon:Wg})})]})},RZ=({buttonLabel:e="Options",buttonSize:t="md",...n})=>g.jsx(qe,{buttonContent:g.jsx(Be,{icon:ZV,widthAuto:!0,className:Oe({"px-1":t==="sm"})}),caretless:!0,buttonLabel:e,buttonSize:t,...n}),tn=Object.assign(RZ,{Item:qe.Item,Separator:qe.Separator,Title:qe.Title,Misc:qe.Misc}),DZ=({open:e,children:t,className:n,onClose:r,...i})=>{const o=w.useRef(null);return w.useEffect(()=>{const l=document.body,c=l.style.overflow,f=l.style.paddingRight;if(e){const h=window.outerWidth-l.clientWidth,m=l.scrollHeight>l.clientHeight;l.style.overflow="hidden",m&&(l.style.paddingRight=`${h}px`),o.current?.showModal()}else o.current?.close();return()=>{l.style.overflow=c,l.style.paddingRight=f}},[e]),Of.createPortal(g.jsx("dialog",{ref:o,className:Oe("bg-transparent backdrop:bg-black/50",n),onCancel:l=>{l.preventDefault(),r()},...i,children:e&&t}),document.body)},co=({open:e,onClose:t,variant:n="default",title:r,children:i,className:o,...l})=>{const{size:c="md",confirmText:f="Confirm",cancelText:h="Cancel",confirmDisabled:m,onConfirm:y,onClosed:x,...b}="onConfirm"in l?l:{...l},[C,_]=w.useState(e),A=w.useRef(null),O=w.useRef("cancel"),P=w.useCallback(N=>{N.preventDefault(),N.stopPropagation(),O.current="confirm",y?.()},[y]);return w.useEffect(()=>{if(e){O.current="cancel",_(!0);return}const N=A.current;if(N){delete A.current.dataset.open;let F=!1;const U=W=>{F||W.target!==N||(F=!0,_(!1),x?.(O.current))};return N.addEventListener("transitionend",U),()=>{N.removeEventListener("transitionend",U)}}},[x,e]),w.useEffect(()=>{const N=A.current;C&&N&&(N.dataset.open="")},[C]),g.jsx(DZ,{open:C,onClose:t,className:Oe({"flex w-screen h-screen max-w-screen max-h-screen":C,"overflow-hidden":n==="cover"},o),...b,children:g.jsx("form",{"data-testid":"transition-container",ref:A,className:Oe("w-full m-auto p-4 sm:p-6","-translate-y-4 data-open:translate-y-0 opacity-0 data-open:opacity-100","transition-[opacity_,_translate] duration-300",n!=="cover"&&{"sm:w-sm":c==="sm","md:w-lg":c==="md","md:w-4xl":c==="lg","md:w-6xl":c==="xl"},{"h-full":n==="cover"}),onSubmit:P,children:g.jsx(ln,{className:Oe("w-full",{"h-full relative overflow-auto":n==="cover"}),children:n==="cover"?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:Oe("px-4 py-3 absolute top-0 left-0 right-0 z-3000","flex items-center justify-between","text-white bg-linear-to-b from-black/70 to-black/10","[text-shadow:_0_2px_4px_rgb(0_0_0/_0.8)]"),children:[g.jsx("h5",{children:r}),g.jsx(Iu,{onClick:t,label:"Close dialog"})]}),i]}):g.jsxs(g.Fragment,{children:[g.jsxs(ln.Header,{className:Oe("sticky top-0","flex items-center justify-between gap-x-2"),children:[g.jsx("h5",{className:Oe({"text-danger":n==="danger"}),children:r}),g.jsx(Iu,{onClick:t,label:"Close dialog"})]}),g.jsx(ln.Body,{children:i}),y&&g.jsxs(ln.Footer,{"data-testid":"footer",className:Oe("flex justify-end items-center gap-x-2","[&]:px-3 sticky bottom-0"),children:[g.jsx(Cy,{onClick:t,children:h}),g.jsx(Tt,{solid:!0,variant:n==="danger"?"danger":"primary",disabled:m,type:"submit",children:f})]})]})})})})},Ko=({className:e,children:t,loading:n=!1,variant:r="default"})=>g.jsx(Nt,{className:Oe({"[&]:border-danger":r==="error"},e),children:g.jsxs("h3",{className:Oe("text-center",{"text-gray-500 dark:text-gray-400":r==="default","text-danger":r==="error"}),children:[n&&g.jsxs(g.Fragment,{children:[g.jsx(Be,{icon:O_,spin:!0}),g.jsx("span",{className:"ml-2",children:t??"Loading..."})]}),!n&&t]})}),Gr=({variant:e,className:t,size:n="md",children:r})=>g.jsx("div",{className:Oe("rounded-md text-center",{"p-2":n==="sm","p-4":n==="md","p-6":n==="lg","[&]:text-white":e!=="warning","bg-lm-brand dark:bg-dm-brand":e==="success","bg-danger":e==="error","bg-warning text-black":e==="warning"},t),children:r}),os=({placement:e="auto"}={})=>{const t=w.useRef(null),n=(()=>{const _=[];return e==="auto"&&_.push(wK()),_.push(_K({element:t})),_})(),[r,i]=w.useState(!1),{refs:o,floatingStyles:l,context:c,middlewareData:f}=JR({placement:e==="auto"?void 0:e,open:r,onOpenChange:i,middleware:n}),h=NK(c,{delay:{open:300},move:!0}),{getFloatingProps:m,getReferenceProps:y}=e6([h]),{isMounted:x,styles:b}=UK(c,{duration:200}),C=w.useMemo(()=>{const _=c.placement.split("-")[0];return{top:"bottom",right:"left",bottom:"top",left:"right"}[_]??""},[c.placement]);return{anchor:{...y(),ref:o.setReference},tooltip:{...m(),refSetter:o.setFloating,isMounted:x,styles:{...l,...b},arrowPos:f.arrow,arrowRef:t,arrowSide:C}}},ss=({children:e,isMounted:t,styles:n,refSetter:r,arrowRef:i,arrowPos:o,arrowSide:l,...c})=>t&&g.jsx("div",{role:"tooltip","aria-live":"polite",className:Oe("z-500 max-w-64",{"pt-2.5":l==="top","pb-2.5":l==="bottom","pr-2.5":l==="right","pl-2.5":l==="left"}),ref:r,style:n,...c,children:g.jsxs("div",{className:"relative px-1.5 py-1 rounded bg-black/90 text-white text-center",children:[g.jsx("span",{className:"sr-only",children:"Tooltip: "}),e,g.jsx("div",{ref:i,className:Oe("absolute","border-l-6 border-r-6 border-b-6 border-l-transparent border-r-transparent border-b-black/90",{"rotate-180":l==="bottom","rotate-90 mr-[-3px]":l==="right","rotate-270 ml-[-3px]":l==="left"}),style:{left:o?.x,top:o?.y,[l]:`${-(i.current?.offsetWidth??0)/2}px`},"data-testid":"arrow"})]})});function h6(e){if(e.currentField!==e.newField)return"ASC";const t={ASC:"DESC",DESC:void 0};return e.currentOrderDir?t[e.currentOrderDir]:"ASC"}function eS(e){const t=h6(e);return{field:t?e.newField:void 0,dir:t}}const m6=(e,{field:t,dir:n})=>!t||!n?e:e.sort((r,i)=>{const o=n==="ASC"?1:-1,l=n==="ASC"?-1:1;return r[t]>i[t]?o:l}),kZ=e=>e.dir?`${e.field}-${e.dir}`:void 0,IZ=e=>{const[t,n]=e.split("-");return{field:t,dir:n}};function rm({items:e,order:t,onChange:n,prefixed:r=!0,buttonVariant:i="button",...o}){const l=w.useCallback(f=>{const h=eS({currentOrderDir:t.dir,currentField:t.field,newField:f});n(h)},[n,t.dir,t.field]),c=i==="button";return g.jsxs(qe,{buttonContent:g.jsxs(g.Fragment,{children:[!c&&"Order by",c&&!t.field&&g.jsx("i",{children:"Order by..."}),c&&t.field&&g.jsxs(g.Fragment,{children:[r&&"Order by: ",e[t.field]," - ",t.dir??"DESC"]})]}),buttonVariant:i,...o,children:[Object.entries(e).map(([f,h])=>g.jsxs(qe.Item,{selected:t.field===f,onClick:()=>l(f),className:"flex items-center justify-between gap-2",children:[h,t.field===f&&g.jsx(Be,{icon:t.dir==="ASC"?tH:CH})]},f)),g.jsx(qe.Separator,{}),g.jsx(qe.Item,{disabled:!t.field,onClick:()=>n({}),children:g.jsx("i",{children:"Clear selection"})})]})}const zZ="#4696e5",UZ="rgba(70, 150, 229, 0.4)",BZ="#2078CF",FZ="rgba(32, 120, 207, 0.4)",Lh=()=>ls()?zZ:BZ,$Z=()=>ls()?UZ:FZ,tw="#f77f28",VZ="rgba(247, 127, 40, 0.4)",HZ="white",qZ="#161b22",GZ=e=>document.querySelector("html")?.setAttribute("data-theme",e),ls=()=>document.querySelector("html")?.getAttribute("data-theme")==="dark",tS=(e=window.matchMedia.bind(window))=>e("(prefers-color-scheme: dark)").matches?"dark":"light",YZ=({isOpen:e,onClose:t,forceUpdate:n})=>{const{flag:r,setToTrue:i}=Cn(),o=w.useCallback(()=>{i(),n()},[n,i]);return e?g.jsxs(ln,{role:"alert",className:Oe("w-[700px] max-w-[calc(100%-30px)]","fixed top-[35px] left-[50%] translate-x-[-50%] z-[1040]"),children:[g.jsxs(ln.Header,{className:"flex items-center justify-between",children:[g.jsx("h5",{children:"This app has just been updated!"}),g.jsx(Iu,{onClick:t})]}),g.jsxs(ln.Body,{className:"flex gap-4 items-center justify-between max-md:flex-col",children:["Restart it to enjoy the new features.",g.jsxs(Tt,{disabled:r,variant:"secondary",solid:!0,onClick:o,children:[!r&&g.jsxs(g.Fragment,{children:["Restart now ",g.jsx(Be,{icon:RV})]}),r&&g.jsx(g.Fragment,{children:"Restarting..."})]})]})]}):null},p6=({children:e,title:t})=>g.jsx("div",{className:"pt-4",children:g.jsxs(Nt,{className:"p-4 w-full lg:w-[65%] m-auto",children:[g.jsx("h2",{children:t}),e]})}),g6=({to:e="/",children:t="Home"})=>g.jsxs(p6,{title:"Oops! We could not find requested route.",children:[g.jsx("p",{children:"Use your browser's back button to navigate to the page you have previously come from, or just press this button."}),g.jsx("br",{}),g.jsx(Tt,{inline:!0,to:e,size:"lg",children:t})]});function oa(e){return w.useMemo(()=>e,[e])}function Pa(e,t){return(n,r=globalThis.console)=>(t.forEach(i=>{const o=n[i];e[i]=o}),e)}const v6=(e,t)=>e.reduce((n,r)=>{const i=t(r);return n[i]=(n[i]||0)+1,n},{}),y6=(e,t)=>e.reduce((n,r)=>{const i=t(r);return(n[i]=n[i]||[]).push(r),n},{}),zb=e=>Object.prototype.toString.call(e)==="[object Object]",b6=(e,t)=>{const n={};return(...r)=>{const i=e(...r);if(n[i])return n[i];const o=t(...r);return n[i]=o,o}},Pf=(e,t)=>{const n={...e};return!zb(e)||!zb(t)||Object.keys(t).forEach(r=>{zb(t[r])?n[r]=r in e&&e[r]!==void 0?Pf(e[r],t[r]):{...t[r]}:n[r]=t[r]}),n},x6=(e,t)=>Array.from({length:t-e},(n,r)=>e+r),WZ=(e,t)=>[...e].sort((n,r)=>{const i=t(n),o=t(r);return i===o?0:i{const n=[];for(let r=0;rObject.fromEntries(e.map((n,r)=>[n,t[r]])),nS=(e,t,n=1)=>x6(n,e+1).map(t),KZ=e=>Array.isArray(e)&&e.length===0||typeof e=="string"&&e===""||typeof e=="object"&&Object.keys(e).length===0,Su=e=>e!=null&&!KZ(e),Ub=e=>e||null,nw=e=>e?"true":"false",Bb=e=>e===void 0?void 0:nw(e),ZZ=e=>{if(e.length<2)return e[0]??"";const[t,...n]=e.reverse();return`${n.reverse().join(", ")} and ${t}`},cO="[&]:p-0 [&]:md:w-1/4 [&]:rounded-none",XZ=({onChange:e,className:t})=>{const n=Fn("qrCodes",Lf),{color:r,bgColor:i}=n;return g.jsxs(Nt,{title:"Colors",className:t,bodyClassName:"flex flex-col gap-4",children:[g.jsx(di,{label:"Default color:",helpText:g.jsxs(g.Fragment,{children:["QR codes will initially use ",g.jsx("b",{"data-testid":"color",children:r})," color."]}),type:"color",value:r,onChange:o=>e({...n,color:o.target.value}),inputClassName:cO}),g.jsx(di,{label:"Default background color:",helpText:g.jsxs(g.Fragment,{children:["QR codes will initially use ",g.jsx("b",{"data-testid":"bg-color",children:i})," background color."]}),type:"color",value:i,onChange:o=>e({...n,bgColor:o.target.value}),inputClassName:cO})]})},w6=({errorCorrection:e,onChange:t})=>g.jsxs(qe,{buttonContent:e?`Error correction (${e})`:g.jsx("i",{children:"Default error correction"}),buttonClassName:"w-full",children:[g.jsxs(qe.Item,{selected:e==="L",onClick:()=>t("L"),children:[g.jsx("b",{children:"L"}),"ow"]}),g.jsxs(qe.Item,{selected:e==="M",onClick:()=>t("M"),children:[g.jsx("b",{children:"M"}),"edium"]}),g.jsxs(qe.Item,{selected:e==="Q",onClick:()=>t("Q"),children:[g.jsx("b",{children:"Q"}),"uartile"]}),g.jsxs(qe.Item,{selected:e==="H",onClick:()=>t("H"),children:[g.jsx("b",{children:"H"}),"igh"]})]}),QZ=["png","svg","webp","jpeg"],_6=({format:e,onChange:t})=>g.jsx(qe,{buttonContent:`Format (${e})`,buttonClassName:"w-full",children:QZ.map(n=>g.jsx(qe.Item,{selected:e===n,onClick:()=>t(n),children:n},n))}),Zo=({className:e,size:t,...n})=>g.jsx("span",{className:Oe("text-gray-500 dark:text-gray-400",{"text-sm":t==="sm","text-lg":t==="lg"},e),...n}),JZ=({onChange:e})=>{const t=Fn("qrCodes",Lf),{format:n,errorCorrection:r}=t;return g.jsxs(Nt,{title:"Format",className:"card",bodyClassName:"flex flex-col gap-4",children:[g.jsxs("div",{className:"flex flex-col gap-1",children:[g.jsx(_6,{format:n,onChange:i=>e({...t,format:i})}),g.jsxs(Zo,{size:"sm",children:["When downloading a QR code, it will use ",g.jsx("b",{"data-testid":"format",children:n})," format by default."]})]}),g.jsxs("div",{className:"flex flex-col gap-1",children:[g.jsx(w6,{errorCorrection:r,onChange:i=>e({...t,errorCorrection:i})}),g.jsxs(Zo,{size:"sm",children:["QR codes will initially have a ",g.jsx("b",{"data-testid":"error-correction",children:r})," error correction."]})]})]})},eX=({onChange:e,className:t})=>{const n=Fn("qrCodes",Lf),{size:r,margin:i}=n;return g.jsxs(Nt,{title:"Size",className:t,bodyClassName:"flex flex-col gap-4",children:[g.jsx(di,{label:"Default dimensions:",helpText:g.jsxs(g.Fragment,{children:["QR codes will be initially generated with ",g.jsxs("b",{"data-testid":"size",children:[r,"x",r,"px"]}),"."]}),type:"range",value:r,step:10,min:50,max:1e3,onChange:o=>e({...n,size:Number(o.target.value)}),inputClassName:"[&]:p-0"}),g.jsx(di,{label:"Default margin:",helpText:g.jsxs(g.Fragment,{children:["QR codes will be initially generated with a ",g.jsxs("b",{"data-testid":"margin",children:[i,"px"]})," margin."]}),type:"range",value:i,step:1,min:0,max:100,onChange:o=>e({...n,margin:Number(o.target.value)}),inputClassName:"[&]:p-0"})]})},bl=({children:e,helpText:t,"data-testid":n,...r})=>g.jsxs("div",{"data-testid":n,children:[g.jsxs(Ma,{className:"flex items-center gap-x-2",children:[g.jsx(uZ,{...r}),e]}),t&&g.jsx(Zo,{size:"sm","data-testid":n?`${n}-help-text`:"help-text",className:"pl-10",children:t})]}),tX=({toggleRealTimeUpdates:e,onIntervalChange:t})=>{const{enabled:n,interval:r}=Fn("realTimeUpdates",{enabled:!0});return g.jsxs(Nt,{title:"Real-time updates",className:"h-full",bodyClassName:"flex flex-col gap-y-4",children:[g.jsx(bl,{checked:n,onChange:e,helpText:g.jsxs(g.Fragment,{children:["Real-time updates are currently being ",g.jsx("b",{children:n?"processed":"ignored"}),"."]}),children:"Enable or disable real-time updates."}),g.jsxs("div",{children:[g.jsx(di,{label:g.jsx("span",{className:Oe({"dark:text-gray-400":!n}),children:"Real-time updates frequency (in minutes):"}),type:"number",min:0,placeholder:"Immediate",disabled:!n,value:`${r??""}`,onChange:({target:i})=>t(Number(i.value))}),n&&g.jsx(Zo,{size:"sm",children:r?g.jsxs("span",{children:["Updates will be reflected in the UI every ",g.jsx("b",{children:r})," minute",r>1&&"s","."]}):"Updates will be reflected in the UI as soon as they happen."})]})]})},Fb=e=>e==="includes"?"Suggest tags including input":"Suggest tags starting with input",nX=e=>e==="includes"?g.jsxs(g.Fragment,{children:["The list of suggested tags will contain those ",g.jsx("b",{children:"including"})," provided input."]}):g.jsxs(g.Fragment,{children:["The list of suggested tags will contain those ",g.jsx("b",{children:"starting with"})," provided input."]}),rX=({onChange:e})=>{const t=Fn("shortUrlCreation"),n=r=>()=>e({...t,tagFilteringMode:r});return g.jsxs(Nt,{title:"Short URLs form",className:"card",bodyClassName:"flex flex-col gap-4",children:[g.jsx(bl,{"data-testid":"forward-query",checked:t?.forwardQuery??!0,onChange:r=>e({...t,forwardQuery:r}),helpText:g.jsxs(g.Fragment,{children:["The initial state of the ",g.jsx("b",{children:"Forward query params on redirect"})," checkbox will be ",g.jsx("b",{children:t?.forwardQuery??!0?"checked":"unchecked"}),"."]}),children:"Make all new short URLs forward their query params to the long URL."}),g.jsxs("div",{className:"flex flex-col",children:[g.jsx(Ma,{className:"mb-1.5",children:"Tag suggestions search mode:"}),g.jsxs(qe,{buttonContent:Fb(t?.tagFilteringMode),buttonClassName:"w-full",children:[g.jsx(qe.Item,{selected:!t?.tagFilteringMode||t.tagFilteringMode==="startsWith",onClick:n("startsWith"),children:Fb("startsWith")}),g.jsx(qe.Item,{selected:t?.tagFilteringMode==="includes",onClick:n("includes"),children:Fb("includes")})]}),g.jsx(Zo,{size:"sm",className:"mt-0.5",children:nX(t?.tagFilteringMode)})]})]})},iX={dateCreated:"Created at",shortCode:"Short URL",longUrl:"Long URL",title:"Title",visits:"Visits"},aX=({onChange:e,defaultOrdering:t})=>{const n=Fn("shortUrlsList"),r=n?.confirmDeletions??!0;return g.jsxs(Nt,{title:"Short URLs list",className:"card",bodyClassName:"flex flex-col gap-4",children:[g.jsx(bl,{checked:r,onChange:i=>e({...n,confirmDeletions:i}),helpText:g.jsxs(g.Fragment,{children:["When deleting a short URL, confirmation ",g.jsx("b",{children:r?"will":"won't"})," be required."]}),children:"Request confirmation before deleting a short URL."}),g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsx(Ma,{children:"Default ordering for short URLs list:"}),g.jsx(rm,{buttonClassName:"w-full",items:iX,order:n?.defaultOrdering??t,onChange:i=>e({defaultOrdering:!i.dir&&!i.field?void 0:i})})]})]})},oX={tag:"Tag",shortUrls:"Short URLs",visits:"Visits"},sX=({onChange:e})=>{const t=Fn("tags",{});return g.jsx(Nt,{title:"Tags",className:"card",children:g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsx(Ma,{children:"Default ordering for tags list:"}),g.jsx(rm,{buttonClassName:"w-full",items:oX,order:t.defaultOrdering??{},onChange:n=>e({...t,defaultOrdering:!n.field&&!n.dir?void 0:n})})]})})},lX=({onChange:e,_matchMedia:t})=>{const n=Fn("ui"),r=w.useMemo(()=>n?.theme??tS(t),[n?.theme,t]);return g.jsxs(Nt,{title:"User interface",bodyClassName:"flex justify-between items-center",children:[g.jsx(bl,{checked:r==="dark",onChange:i=>e({...n,theme:i?"dark":"light"}),children:"Use dark theme."}),g.jsx(Be,{icon:r==="dark"?fH:nH})]})},fO={potentialBot:"Potential bot",date:"Date",country:"Country",region:"Region",city:"City",browser:"Browser",os:"OS",userAgent:"User agent",referer:"Referrer",visitedUrl:"Visited URL"},kg={browser:["userAgent"],os:["userAgent"],userAgent:["browser","os"]};Object.freeze(kg);const uX=({onChange:e})=>{const t=Fn("visitsList"),n=w.useMemo(()=>Pf(Ay,t?.columns??{}),[t?.columns]),r=w.useCallback((i,o)=>{const l={...n,[i]:o};o&&kg[i]?.forEach(c=>{l[c]=!1}),e({columns:l})},[n,e]);return g.jsxs(Nt,{title:"Visits list",children:[g.jsx("p",{className:"mb-2",children:"Columns to show in visits table:"}),g.jsx("ul",{className:"flex flex-col gap-y-1",children:Object.entries(fO).map(([i,o])=>g.jsx("li",{children:g.jsx(bl,{checked:n[i],onChange:l=>r(i,l),children:g.jsxs("span",{className:"inline-flex gap-2",children:[o,kg[i]&&g.jsxs(Zo,{children:["(excludes ",ZZ(kg[i].map(l=>fO[l])),")"]})]})})},i))})]})},S6={today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",last180Days:"Last 180 days",last365Days:"Last 365 days"},cX=(e,t)=>!e||e==="all"?t:S6[e],fX=({onChange:e,active:t,allText:n})=>g.jsxs(qe,{buttonContent:cX(t,n),buttonClassName:"w-full",children:[g.jsx(qe.Item,{selected:t==="all",onClick:()=>e("all"),children:n}),g.jsx(qe.Separator,{}),Object.entries(S6).map(([r,i])=>g.jsx(qe.Item,{selected:t===r,onClick:()=>e(r),children:i},r))]}),dO=e=>e?.defaultInterval??"last30Days",dX=({onChange:e})=>{const t=Fn("visits"),n=w.useCallback(({defaultInterval:r,...i})=>e({defaultInterval:r??dO(t),...i}),[e,t]);return g.jsxs(Nt,{title:"Visits",className:"card",bodyClassName:"flex flex-col gap-4",children:[g.jsx(bl,{"data-testid":"exclude-bots",checked:!!t?.excludeBots,onChange:r=>n({excludeBots:r}),helpText:g.jsxs(g.Fragment,{children:["The visits coming from potential bots will be ",g.jsx("b",{children:t?.excludeBots?"excluded":"included"}),"."]}),children:"Exclude bots wherever possible (this option‘s effect might depend on Shlink server‘s version)."}),g.jsx(bl,{"data-testid":"compare-visits",checked:!!t?.loadPrevInterval,onChange:r=>n({loadPrevInterval:r}),helpText:g.jsxs(g.Fragment,{children:["When loading visits, previous period ",g.jsx("b",{children:t?.loadPrevInterval?"will":"won't"})," be loaded by default."]}),children:"Compare visits with previous period."}),g.jsxs("div",{className:"flex flex-col",children:[g.jsx(Ma,{className:"mb-1.5",children:"Default interval to load on visits sections:"}),g.jsx(fX,{allText:"All visits",active:dO(t),onChange:r=>n({defaultInterval:r})})]})]})},Xd=({children:e,className:t})=>g.jsx("div",{className:Oe("flex flex-col gap-4",t),children:e}),hX=({settings:e,onUpdateSettings:t,defaultShortUrlsListOrdering:n})=>{const r=w.useCallback(f=>t?.(Pf(e,f)),[e,t]),i=w.useCallback(f=>r({realTimeUpdates:{enabled:f}}),[r]),o=w.useCallback(f=>r({realTimeUpdates:{interval:f}}),[r]),l=w.useCallback((f,h)=>r({[f]:h}),[r]),c=w.useCallback(f=>l("qrCodes",f),[l]);return g.jsxs(A6,{value:e,children:[g.jsxs(nl,{className:"mb-4 sticky top-(--header-height) z-2",children:[g.jsx(nl.Pill,{to:"../general",children:"General"}),g.jsx(nl.Pill,{to:"../short-urls",children:"Short URLs"}),g.jsx(nl.Pill,{to:"../visits",children:"Visits"}),g.jsx(nl.Pill,{to:"../tags",children:"Tags"}),g.jsx(nl.Pill,{to:"../qr-codes",children:"QR codes"})]}),g.jsxs(sy,{children:[g.jsx(ft,{path:"general",element:g.jsxs(Xd,{children:[g.jsx(lX,{onChange:f=>l("ui",f)}),g.jsx(tX,{toggleRealTimeUpdates:i,onIntervalChange:o})]})}),g.jsx(ft,{path:"short-urls",element:g.jsxs(Xd,{children:[g.jsx(rX,{onChange:f=>l("shortUrlCreation",f)}),g.jsx(aX,{defaultOrdering:n,onChange:f=>l("shortUrlsList",f)})]})}),g.jsx(ft,{path:"visits",element:g.jsxs(Xd,{children:[g.jsx(dX,{onChange:f=>l("visits",f)}),g.jsx(uX,{onChange:f=>l("visitsList",f)})]})}),g.jsx(ft,{path:"tags",element:g.jsx(Xd,{children:g.jsx(sX,{onChange:f=>l("tags",f)})})}),g.jsx(ft,{path:"qr-codes",element:g.jsxs(Xd,{children:[g.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[g.jsx(eX,{onChange:c,className:"w-full"}),g.jsx(XZ,{onChange:c,className:"w-full"})]}),g.jsx(JZ,{onChange:c})]})}),g.jsx(ft,{path:"*",element:g.jsx(b_,{replace:!0,to:"../general"})})]})]})},Lf={size:300,margin:0,color:"#000000",bgColor:"#ffffff",errorCorrection:"L",format:"png"};Object.freeze(Lf);const Ay={potentialBot:!0,date:!0,country:!0,region:!1,city:!0,browser:!0,os:!0,userAgent:!1,referer:!0,visitedUrl:!0};Object.freeze(Ay);const C6={realTimeUpdates:{enabled:!0},shortUrlCreation:{},visits:{defaultInterval:"last30Days"},visitsList:{columns:Ay},shortUrlsList:{defaultOrdering:{field:"dateCreated",dir:"DESC"}},qrCodes:Lf},E6=w.createContext(C6),{Provider:A6}=E6,rS=()=>w.useContext(E6)??C6;function Fn(e,t){return rS()[e]??t}const Nf=({children:e,className:t})=>g.jsx("div",{className:Oe("container mx-auto p-5 pt-8 max-md:p-3 max-md:py-4",t),children:e});function Cr(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var mX=typeof Symbol=="function"&&Symbol.observable||"@@observable",hO=mX,$b=()=>Math.random().toString(36).substring(7).split("").join("."),pX={INIT:`@@redux/INIT${$b()}`,REPLACE:`@@redux/REPLACE${$b()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$b()}`},iv=pX;function iS(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function T6(e,t,n){if(typeof e!="function")throw new Error(Cr(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Cr(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Cr(1));return n(T6)(e,t)}let r=e,i=t,o=new Map,l=o,c=0,f=!1;function h(){l===o&&(l=new Map,o.forEach((A,O)=>{l.set(O,A)}))}function m(){if(f)throw new Error(Cr(3));return i}function y(A){if(typeof A!="function")throw new Error(Cr(4));if(f)throw new Error(Cr(5));let O=!0;h();const P=c++;return l.set(P,A),function(){if(O){if(f)throw new Error(Cr(6));O=!1,h(),l.delete(P),o=null}}}function x(A){if(!iS(A))throw new Error(Cr(7));if(typeof A.type>"u")throw new Error(Cr(8));if(typeof A.type!="string")throw new Error(Cr(17));if(f)throw new Error(Cr(9));try{f=!0,i=r(i,A)}finally{f=!1}return(o=l).forEach(P=>{P()}),A}function b(A){if(typeof A!="function")throw new Error(Cr(10));r=A,x({type:iv.REPLACE})}function C(){const A=y;return{subscribe(O){if(typeof O!="object"||O===null)throw new Error(Cr(11));function P(){const F=O;F.next&&F.next(m())}return P(),{unsubscribe:A(P)}},[hO](){return this}}}return x({type:iv.INIT}),{dispatch:x,subscribe:y,getState:m,replaceReducer:b,[hO]:C}}function gX(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:iv.INIT})>"u")throw new Error(Cr(12));if(typeof n(void 0,{type:iv.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Cr(13))})}function Ty(e){const t=Object.keys(e),n={};for(let o=0;o"u")throw c&&c.type,new Error(Cr(14));h[y]=C,f=f||C!==b}return f=f||r.length!==Object.keys(l).length,f?h:l}}function av(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function vX(...e){return t=>(n,r)=>{const i=t(n,r);let o=()=>{throw new Error(Cr(15))};const l={getState:i.getState,dispatch:(f,...h)=>o(f,...h)},c=e.map(f=>f(l));return o=av(...c)(i.dispatch),{...i,dispatch:o}}}function O6(e){return iS(e)&&"type"in e&&typeof e.type=="string"}var j6=Symbol.for("immer-nothing"),mO=Symbol.for("immer-draftable"),Ri=Symbol.for("immer-state");function xa(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Nh=Object.getPrototypeOf;function zu(e){return!!e&&!!e[Ri]}function Xo(e){return e?M6(e)||Array.isArray(e)||!!e[mO]||!!e.constructor?.[mO]||im(e)||jy(e):!1}var yX=Object.prototype.constructor.toString(),pO=new WeakMap;function M6(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=pO.get(n);return r===void 0&&(r=Function.toString.call(n),pO.set(n,r)),r===yX}function ov(e,t,n=!0){Oy(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Oy(e){const t=e[Ri];return t?t.type_:Array.isArray(e)?1:im(e)?2:jy(e)?3:0}function rw(e,t){return Oy(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function P6(e,t,n){const r=Oy(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function bX(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function im(e){return e instanceof Map}function jy(e){return e instanceof Set}function bu(e){return e.copy_||e.base_}function iw(e,t){if(im(e))return new Map(e);if(jy(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=M6(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Ri];let i=Reflect.ownKeys(r);for(let o=0;o1&&Object.defineProperties(e,{set:ng,add:ng,clear:ng,delete:ng}),Object.freeze(e),t&&Object.values(e).forEach(n=>aS(n,!0))),e}function xX(){xa(2)}var ng={value:xX};function My(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var wX={};function Uu(e){const t=wX[e];return t||xa(0,e),t}var Rh;function L6(){return Rh}function _X(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function gO(e,t){t&&(Uu("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function aw(e){ow(e),e.drafts_.forEach(SX),e.drafts_=null}function ow(e){e===Rh&&(Rh=e.parent_)}function vO(e){return Rh=_X(Rh,e)}function SX(e){const t=e[Ri];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function yO(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Ri].modified_&&(aw(t),xa(4)),Xo(e)&&(e=sv(t,e),t.parent_||lv(t,e)),t.patches_&&Uu("Patches").generateReplacementPatches_(n[Ri].base_,e,t.patches_,t.inversePatches_)):e=sv(t,n,[]),aw(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==j6?e:void 0}function sv(e,t,n){if(My(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[Ri];if(!i)return ov(t,(o,l)=>bO(e,i,t,o,l,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return lv(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const o=i.copy_;let l=o,c=!1;i.type_===3&&(l=new Set(o),o.clear(),c=!0),ov(l,(f,h)=>bO(e,i,o,f,h,n,c),r),lv(e,o,!1),n&&e.patches_&&Uu("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function bO(e,t,n,r,i,o,l){if(i==null||typeof i!="object"&&!l)return;const c=My(i);if(!(c&&!l)){if(zu(i)){const f=o&&t&&t.type_!==3&&!rw(t.assigned_,r)?o.concat(r):void 0,h=sv(e,i,f);if(P6(n,r,h),zu(h))e.canAutoFreeze_=!1;else return}else l&&n.add(i);if(Xo(i)&&!c){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&c)return;sv(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(im(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&lv(e,i)}}}function lv(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&aS(t,n)}function CX(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:L6(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=oS;n&&(i=[r],o=Dh);const{revoke:l,proxy:c}=Proxy.revocable(i,o);return r.draft_=c,r.revoke_=l,c}var oS={get(e,t){if(t===Ri)return e;const n=bu(e);if(!rw(n,t))return EX(e,n,t);const r=n[t];return e.finalized_||!Xo(r)?r:r===Vb(e.base_,t)?(Hb(e),e.copy_[t]=lw(r,e)):r},has(e,t){return t in bu(e)},ownKeys(e){return Reflect.ownKeys(bu(e))},set(e,t,n){const r=N6(bu(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Vb(bu(e),t),o=i?.[Ri];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(bX(n,i)&&(n!==void 0||rw(e.base_,t)))return!0;Hb(e),sw(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Vb(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Hb(e),sw(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=bu(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){xa(11)},getPrototypeOf(e){return Nh(e.base_)},setPrototypeOf(){xa(12)}},Dh={};ov(oS,(e,t)=>{Dh[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Dh.deleteProperty=function(e,t){return Dh.set.call(this,e,t,void 0)};Dh.set=function(e,t,n){return oS.set.call(this,e[0],t,n,e[0])};function Vb(e,t){const n=e[Ri];return(n?bu(n):e)[t]}function EX(e,t,n){const r=N6(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}function N6(e,t){if(!(t in e))return;let n=Nh(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Nh(n)}}function sw(e){e.modified_||(e.modified_=!0,e.parent_&&sw(e.parent_))}function Hb(e){e.copy_||(e.copy_=iw(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var AX=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const l=this;return function(f=o,...h){return l.produce(f,m=>n.call(this,m,...h))}}typeof n!="function"&&xa(6),r!==void 0&&typeof r!="function"&&xa(7);let i;if(Xo(t)){const o=vO(this),l=lw(t,void 0);let c=!0;try{i=n(l),c=!1}finally{c?aw(o):ow(o)}return gO(o,r),yO(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===j6&&(i=void 0),this.autoFreeze_&&aS(i,!0),r){const o=[],l=[];Uu("Patches").generateReplacementPatches_(t,i,o,l),r(o,l)}return i}else xa(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(l,...c)=>this.produceWithPatches(l,f=>t(f,...c));let r,i;return[this.produce(t,n,(l,c)=>{r=l,i=c}),r,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Xo(e)||xa(8),zu(e)&&(e=Vo(e));const t=vO(this),n=lw(e,void 0);return n[Ri].isManual_=!0,ow(t),n}finishDraft(e,t){const n=e&&e[Ri];(!n||!n.isManual_)&&xa(9);const{scope_:r}=n;return gO(r,t),yO(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=Uu("Patches").applyPatches_;return zu(e)?r(e,t):this.produce(e,i=>r(i,t))}};function lw(e,t){const n=im(e)?Uu("MapSet").proxyMap_(e,t):jy(e)?Uu("MapSet").proxySet_(e,t):CX(e,t);return(t?t.scope_:L6()).drafts_.push(n),n}function Vo(e){return zu(e)||xa(10,e),R6(e)}function R6(e){if(!Xo(e)||My(e))return e;const t=e[Ri];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=iw(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=iw(e,!0);return ov(n,(i,o)=>{P6(n,i,R6(o))},r),t&&(t.finalized_=!1),n}var uw=new AX,D6=uw.produce,TX=uw.setUseStrictIteration.bind(uw);function OX(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function jX(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function MX(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var xO=e=>Array.isArray(e)?e:[e];function PX(e){const t=Array.isArray(e[0])?e[0]:e;return MX(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function LX(e,t){const n=[],{length:r}=e;for(let i=0;i{n=rg(),l.resetResultsCount()},l.resultsCount=()=>o,l.resetResultsCount=()=>{o=0},l}function kX(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let o=0,l=0,c,f={},h=i.pop();typeof h=="object"&&(f=h,h=i.pop()),OX(h,`createSelector expects an output function after the inputs, but received: [${typeof h}]`);const m={...n,...f},{memoize:y,memoizeOptions:x=[],argsMemoize:b=k6,argsMemoizeOptions:C=[]}=m,_=xO(x),A=xO(C),O=PX(i),P=y(function(){return o++,h.apply(null,arguments)},..._),N=b(function(){l++;const U=LX(O,arguments);return c=P.apply(null,U),c},...A);return Object.assign(N,{resultFunc:h,memoizedResultFunc:P,dependencies:O,dependencyRecomputations:()=>l,resetDependencyRecomputations:()=>{l=0},lastResult:()=>c,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:y,argsMemoize:b})};return Object.assign(r,{withTypes:()=>r}),r}var Ce=kX(k6),IX=Object.assign((e,t=Ce)=>{jX(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(o=>e[o]);return t(r,(...o)=>o.reduce((l,c,f)=>(l[n[f]]=c,l),{}))},{withTypes:()=>IX});function I6(e){return({dispatch:n,getState:r})=>i=>o=>typeof o=="function"?o(n,r,e):i(o)}var zX=I6(),UX=I6,BX=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?av:av.apply(null,arguments)},FX=e=>e&&typeof e.match=="function";function un(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(Pi(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>O6(r)&&r.type===e,n}var z6=class hh extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,hh.prototype)}static get[Symbol.species](){return hh}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new hh(...t[0].concat(this)):new hh(...t.concat(this))}};function _O(e){return Xo(e)?D6(e,()=>{}):e}function ig(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function $X(e){return typeof e=="boolean"}var VX=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=t??{};let l=new z6;return n&&($X(n)?l.push(zX):l.push(UX(n.extraArgument))),l},U6="RTK_autoBatch",ir=()=>e=>({payload:e,meta:{[U6]:!0}}),SO=e=>t=>{setTimeout(t,e)},B6=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,o=!1,l=!1;const c=new Set,f=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:SO(10):e.type==="callback"?e.queueNotification:SO(e.timeout),h=()=>{l=!1,o&&(o=!1,c.forEach(m=>m()))};return Object.assign({},r,{subscribe(m){const y=()=>i&&m(),x=r.subscribe(y);return c.add(m),()=>{x(),c.delete(m)}},dispatch(m){try{return i=!m?.meta?.[U6],o=!i,o&&(l||(l=!0,f(h))),r.dispatch(m)}finally{i=!0}}})},HX=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new z6(e);return r&&i.push(B6(typeof r=="object"?r:void 0)),i};function sS(e){const t=VX(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:o=!0,preloadedState:l=void 0,enhancers:c=void 0}=e||{};let f;if(typeof n=="function")f=n;else if(iS(n))f=Ty(n);else throw new Error(Pi(1));let h;typeof r=="function"?h=r(t):h=t();let m=av;i&&(m=BX({trace:!1,...typeof i=="object"&&i}));const y=vX(...h),x=HX(y);let b=typeof c=="function"?c(x):x();const C=m(...b);return T6(f,l,C)}function F6(e){const t={},n=[];let r;const i={addCase(o,l){const c=typeof o=="string"?o:o.type;if(!c)throw new Error(Pi(28));if(c in t)throw new Error(Pi(29));return t[c]=l,i},addAsyncThunk(o,l){return l.pending&&(t[o.pending.type]=l.pending),l.rejected&&(t[o.rejected.type]=l.rejected),l.fulfilled&&(t[o.fulfilled.type]=l.fulfilled),l.settled&&n.push({matcher:o.settled,reducer:l.settled}),i},addMatcher(o,l){return n.push({matcher:o,reducer:l}),i},addDefaultCase(o){return r=o,i}};return e(i),[t,n,r]}TX(!1);function qX(e){return typeof e=="function"}function GX(e,t){let[n,r,i]=F6(t),o;if(qX(e))o=()=>_O(e());else{const c=_O(e);o=()=>c}function l(c=o(),f){let h=[n[f.type],...r.filter(({matcher:m})=>m(f)).map(({reducer:m})=>m)];return h.filter(m=>!!m).length===0&&(h=[i]),h.reduce((m,y)=>{if(y)if(zu(m)){const b=y(m,f);return b===void 0?m:b}else{if(Xo(m))return D6(m,x=>y(x,f));{const x=y(m,f);if(x===void 0){if(m===null)return m;throw Error("A case reducer on a non-draftable value must not return undefined")}return x}}return m},c)}return l.getInitialState=o,l}var YX=(e,t)=>FX(e)?e.match(t):e(t);function WX(...e){return t=>e.some(n=>YX(n,t))}var KX="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",$6=(e=21)=>{let t="",n=e;for(;n--;)t+=KX[Math.random()*64|0];return t},ZX=["name","message","stack","code"],qb=class{constructor(e,t){this.payload=e,this.meta=t}_type},CO=class{constructor(e,t){this.payload=e,this.meta=t}_type},XX=e=>{if(typeof e=="object"&&e!==null){const t={};for(const n of ZX)typeof e[n]=="string"&&(t[n]=e[n]);return t}return{message:String(e)}},EO="External signal was aborted",V6=(()=>{function e(t,n,r){const i=un(t+"/fulfilled",(f,h,m,y)=>({payload:f,meta:{...y||{},arg:m,requestId:h,requestStatus:"fulfilled"}})),o=un(t+"/pending",(f,h,m)=>({payload:void 0,meta:{...m||{},arg:h,requestId:f,requestStatus:"pending"}})),l=un(t+"/rejected",(f,h,m,y,x)=>({payload:y,error:(r&&r.serializeError||XX)(f||"Rejected"),meta:{...x||{},arg:m,requestId:h,rejectedWithValue:!!y,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function c(f,{signal:h}={}){return(m,y,x)=>{const b=r?.idGenerator?r.idGenerator(f):$6(),C=new AbortController;let _,A;function O(N){A=N,C.abort()}h&&(h.aborted?O(EO):h.addEventListener("abort",()=>O(EO),{once:!0}));const P=async function(){let N;try{let U=r?.condition?.(f,{getState:y,extra:x});if(JX(U)&&(U=await U),U===!1||C.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const W=new Promise((X,ae)=>{_=()=>{ae({name:"AbortError",message:A||"Aborted"})},C.signal.addEventListener("abort",_)});m(o(b,f,r?.getPendingMeta?.({requestId:b,arg:f},{getState:y,extra:x}))),N=await Promise.race([W,Promise.resolve(n(f,{dispatch:m,getState:y,extra:x,requestId:b,signal:C.signal,abort:O,rejectWithValue:(X,ae)=>new qb(X,ae),fulfillWithValue:(X,ae)=>new CO(X,ae)})).then(X=>{if(X instanceof qb)throw X;return X instanceof CO?i(X.payload,b,f,X.meta):i(X,b,f)})])}catch(U){N=U instanceof qb?l(null,b,f,U.payload,U.meta):l(U,b,f)}finally{_&&C.signal.removeEventListener("abort",_)}return r&&!r.dispatchConditionRejection&&l.match(N)&&N.meta.condition||m(N),N}();return Object.assign(P,{abort:O,requestId:b,arg:f,unwrap(){return P.then(QX)}})}}return Object.assign(c,{pending:o,rejected:l,fulfilled:i,settled:WX(l,i),typePrefix:t})}return e.withTypes=()=>e,e})();function QX(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function JX(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var eQ=Symbol.for("rtk-slice-createasyncthunk");function tQ(e,t){return`${e}/${t}`}function nQ({creators:e}={}){const t=e?.asyncThunk?.[eQ];return function(r){const{name:i,reducerPath:o=i}=r;if(!i)throw new Error(Pi(11));const l=(typeof r.reducers=="function"?r.reducers(iQ()):r.reducers)||{},c=Object.keys(l),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},h={addCase(N,F){const U=typeof N=="string"?N:N.type;if(!U)throw new Error(Pi(12));if(U in f.sliceCaseReducersByType)throw new Error(Pi(13));return f.sliceCaseReducersByType[U]=F,h},addMatcher(N,F){return f.sliceMatchers.push({matcher:N,reducer:F}),h},exposeAction(N,F){return f.actionCreators[N]=F,h},exposeCaseReducer(N,F){return f.sliceCaseReducersByName[N]=F,h}};c.forEach(N=>{const F=l[N],U={reducerName:N,type:tQ(i,N),createNotation:typeof r.reducers=="function"};oQ(F)?lQ(U,F,h,t):aQ(U,F,h)});function m(){const[N={},F=[],U=void 0]=typeof r.extraReducers=="function"?F6(r.extraReducers):[r.extraReducers],W={...N,...f.sliceCaseReducersByType};return GX(r.initialState,X=>{for(let ae in W)X.addCase(ae,W[ae]);for(let ae of f.sliceMatchers)X.addMatcher(ae.matcher,ae.reducer);for(let ae of F)X.addMatcher(ae.matcher,ae.reducer);U&&X.addDefaultCase(U)})}const y=N=>N,x=new Map,b=new WeakMap;let C;function _(N,F){return C||(C=m()),C(N,F)}function A(){return C||(C=m()),C.getInitialState()}function O(N,F=!1){function U(X){let ae=X[N];return typeof ae>"u"&&F&&(ae=ig(b,U,A)),ae}function W(X=y){const ae=ig(x,F,()=>new WeakMap);return ig(ae,X,()=>{const ce={};for(const[re,J]of Object.entries(r.selectors??{}))ce[re]=rQ(J,X,()=>ig(b,X,A),F);return ce})}return{reducerPath:N,getSelectors:W,get selectors(){return W(U)},selectSlice:U}}const P={name:i,reducer:_,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:A,...O(o),injectInto(N,{reducerPath:F,...U}={}){const W=F??o;return N.inject({reducerPath:W,reducer:_},U),{...P,...O(W,!0)}}};return P}}function rQ(e,t,n,r){function i(o,...l){let c=t(o);return typeof c>"u"&&r&&(c=n()),e(c,...l)}return i.unwrapped=e,i}var jt=nQ();function iQ(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function aQ({type:e,reducerName:t,createNotation:n},r,i){let o,l;if("reducer"in r){if(n&&!sQ(r))throw new Error(Pi(17));o=r.reducer,l=r.prepare}else o=r;i.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,l?un(e,l):un(e))}function oQ(e){return e._reducerDefinitionType==="asyncThunk"}function sQ(e){return e._reducerDefinitionType==="reducerWithPrepare"}function lQ({type:e,reducerName:t},n,r,i){if(!i)throw new Error(Pi(18));const{payloadCreator:o,fulfilled:l,pending:c,rejected:f,settled:h,options:m}=n,y=i(e,o,m);r.exposeAction(t,y),l&&r.addCase(y.fulfilled,l),c&&r.addCase(y.pending,c),f&&r.addCase(y.rejected,f),h&&r.addMatcher(y.settled,h),r.exposeCaseReducer(t,{fulfilled:l||ag,pending:c||ag,rejected:f||ag,settled:h||ag})}function ag(){}var uQ="task",H6="listener",q6="completed",lS="cancelled",cQ=`task-${lS}`,fQ=`task-${q6}`,cw=`${H6}-${lS}`,dQ=`${H6}-${q6}`,Py=class{constructor(e){this.code=e,this.message=`${uQ} ${lS} (reason: ${e})`}name="TaskAbortError";message},uS=(e,t)=>{if(typeof e!="function")throw new TypeError(Pi(32))},uv=()=>{},G6=(e,t=uv)=>(e.catch(t),e),Y6=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),ju=(e,t)=>{const n=e.signal;n.aborted||("reason"in n||Object.defineProperty(n,"reason",{enumerable:!0,value:t,configurable:!0,writable:!0}),e.abort(t))},Mu=e=>{if(e.aborted){const{reason:t}=e;throw new Py(t)}};function W6(e,t){let n=uv;return new Promise((r,i)=>{const o=()=>i(new Py(e.reason));if(e.aborted){o();return}n=Y6(e,o),t.finally(()=>n()).then(r,i)}).finally(()=>{n=uv})}var hQ=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof Py?"cancelled":"rejected",error:n}}finally{t?.()}},cv=e=>t=>G6(W6(e,t).then(n=>(Mu(e),n))),K6=e=>{const t=cv(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:of}=Object,AO={},Ly="listenerMiddleware",mQ=(e,t)=>{const n=r=>Y6(e,()=>ju(r,e.reason));return(r,i)=>{uS(r);const o=new AbortController;n(o);const l=hQ(async()=>{Mu(e),Mu(o.signal);const c=await r({pause:cv(o.signal),delay:K6(o.signal),signal:o.signal});return Mu(o.signal),c},()=>ju(o,fQ));return i?.autoJoin&&t.push(l.catch(uv)),{result:cv(e)(l),cancel(){ju(o,cQ)}}}},pQ=(e,t)=>{const n=async(r,i)=>{Mu(t);let o=()=>{};const c=[new Promise((f,h)=>{let m=e({predicate:r,effect:(y,x)=>{x.unsubscribe(),f([y,x.getState(),x.getOriginalState()])}});o=()=>{m(),h()}})];i!=null&&c.push(new Promise(f=>setTimeout(f,i,null)));try{const f=await W6(t,Promise.race(c));return Mu(t),f}finally{o()}};return(r,i)=>G6(n(r,i))},Z6=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:o}=e;if(t)i=un(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(Pi(21));return uS(o),{predicate:i,type:t,effect:o}},X6=of(e=>{const{type:t,predicate:n,effect:r}=Z6(e);return{id:$6(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(Pi(22))}}},{withTypes:()=>X6}),TO=(e,t)=>{const{type:n,effect:r,predicate:i}=Z6(t);return Array.from(e.values()).find(o=>(typeof n=="string"?o.type===n:o.predicate===i)&&o.effect===r)},fw=e=>{e.pending.forEach(t=>{ju(t,cw)})},gQ=(e,t)=>()=>{for(const n of t.keys())fw(n);e.clear()},OO=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},Q6=of(un(`${Ly}/add`),{withTypes:()=>Q6}),vQ=un(`${Ly}/removeAll`),J6=of(un(`${Ly}/remove`),{withTypes:()=>J6}),yQ=(...e)=>{console.error(`${Ly}/error`,...e)},am=(e={})=>{const t=new Map,n=new Map,r=b=>{const C=n.get(b)??0;n.set(b,C+1)},i=b=>{const C=n.get(b)??1;C===1?n.delete(b):n.set(b,C-1)},{extra:o,onError:l=yQ}=e;uS(l);const c=b=>(b.unsubscribe=()=>t.delete(b.id),t.set(b.id,b),C=>{b.unsubscribe(),C?.cancelActive&&fw(b)}),f=b=>{const C=TO(t,b)??X6(b);return c(C)};of(f,{withTypes:()=>f});const h=b=>{const C=TO(t,b);return C&&(C.unsubscribe(),b.cancelActive&&fw(C)),!!C};of(h,{withTypes:()=>h});const m=async(b,C,_,A)=>{const O=new AbortController,P=pQ(f,O.signal),N=[];try{b.pending.add(O),r(b),await Promise.resolve(b.effect(C,of({},_,{getOriginalState:A,condition:(F,U)=>P(F,U).then(Boolean),take:P,delay:K6(O.signal),pause:cv(O.signal),extra:o,signal:O.signal,fork:mQ(O.signal,N),unsubscribe:b.unsubscribe,subscribe:()=>{t.set(b.id,b)},cancelActiveListeners:()=>{b.pending.forEach((F,U,W)=>{F!==O&&(ju(F,cw),W.delete(F))})},cancel:()=>{ju(O,cw),b.pending.delete(O)},throwIfCancelled:()=>{Mu(O.signal)}})))}catch(F){F instanceof Py||OO(l,F,{raisedBy:"effect"})}finally{await Promise.all(N),ju(O,dQ),i(b),b.pending.delete(O)}},y=gQ(t,n);return{middleware:b=>C=>_=>{if(!O6(_))return C(_);if(Q6.match(_))return f(_.payload);if(vQ.match(_)){y();return}if(J6.match(_))return h(_.payload);let A=b.getState();const O=()=>{if(A===AO)throw new Error(Pi(23));return A};let P;try{if(P=C(_),t.size>0){const N=b.getState(),F=Array.from(t.values());for(const U of F){let W=!1;try{W=U.predicate(_,N,A)}catch(X){W=!1,OO(l,X,{raisedBy:"predicate"})}W&&m(U,_,b,O)}}}finally{A=AO}return P},startListening:f,stopListening:h,clearListeners:y}};function Pi(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const eD={field:"dateCreated",dir:"DESC"},bQ={realTimeUpdates:{enabled:!0},shortUrlCreation:{},ui:{theme:tS()},visits:{defaultInterval:"last30Days"},shortUrlsList:{defaultOrdering:eD}},{reducer:xQ,actions:tD}=jt({name:"shlink/settings",initialState:bQ,reducers:{setSettings:(e,{payload:t})=>Pf(e,t)}}),{setSettings:h_e}=tD,wQ=xQ,_Q=()=>{const e=KL(),t=w.useCallback(r=>e(tD.setSettings(r)),[e]);return{settings:ZL(r=>r.settings),setSettings:t}},SQ=()=>{const{settings:e,setSettings:t}=_Q();return g.jsx(Nf,{children:g.jsx(hX,{settings:e,onUpdateSettings:t,defaultShortUrlsListOrdering:eD})})},CQ=async()=>{(await navigator.serviceWorker?.getRegistrations()??[]).forEach(({waiting:t})=>{t?.addEventListener("statechange",n=>{n.target?.state==="activated"&&window.location.reload()}),t?.postMessage({type:"SKIP_WAITING"})})},nD=({fetchServers:e,servers:t,settings:n,appUpdated:r,resetAppUpdate:i})=>{const{MainHeader:o,Home:l,ShlinkWebComponentContainer:c,CreateServer:f,EditServer:h,ManageServers:m,ShlinkVersionsContainer:y}=oa(nD),x=Or(),b=w.useRef(t),C=x.pathname==="/";return w.useEffect(()=>{Object.keys(b.current).length===0&&e()},[e]),w.useEffect(()=>{GZ(n.ui?.theme??tS())},[n.ui?.theme]),g.jsxs("div",{className:"h-full",children:[g.jsxs(g.Fragment,{children:[g.jsx(o,{}),g.jsxs("div",{className:"h-full pt-(--header-height)",children:[g.jsx("div",{"data-testid":"shlink-wrapper",className:Oe("min-h-full pb-[calc(var(--footer-height)+var(--footer-margin))] -mb-[calc(var(--footer-height)+var(--footer-margin))]",{"flex items-center pt-4":C}),children:g.jsxs(sy,{children:[g.jsx(ft,{index:!0,element:g.jsx(l,{})}),g.jsx(ft,{path:"/settings",children:["","*"].map(_=>g.jsx(ft,{path:_,element:g.jsx(SQ,{})},_))}),g.jsx(ft,{path:"/manage-servers",element:g.jsx(m,{})}),g.jsx(ft,{path:"/server/create",element:g.jsx(f,{})}),g.jsx(ft,{path:"/server/:serverId/edit",element:g.jsx(h,{})}),g.jsx(ft,{path:"/server/:serverId",children:["","*"].map(_=>g.jsx(ft,{path:_,element:g.jsx(c,{})},_))}),g.jsx(ft,{path:"*",element:g.jsx(g6,{})})]})}),g.jsx("div",{className:"h-(--footer-height) mt-(--footer-margin) md:px-4",children:g.jsx(y,{})})]})]}),g.jsx(YZ,{isOpen:r,onClose:i,forceUpdate:CQ})]})},EQ=Pa(nD,["MainHeader","Home","ShlinkWebComponentContainer","CreateServer","EditServer","ManageServers","ShlinkVersionsContainer"]),{actions:AQ,reducer:TQ}=jt({name:"shlink/appUpdates",initialState:!1,reducers:{appUpdateAvailable:()=>!0,resetAppUpdate:()=>!1}}),{appUpdateAvailable:OQ,resetAppUpdate:jQ}=AQ,MQ=TQ,PQ=(e,t)=>{e.factory("App",EQ),e.decorator("App",t(["servers","settings","appUpdated"],["fetchServers","resetAppUpdate"])),e.serviceFactory("appUpdateAvailable",()=>OQ),e.serviceFactory("resetAppUpdate",()=>jQ)},jO={"Content-Type":"application/json"},MO=e=>e?.body?e?{...e,headers:{...e.headers??{},...jO}}:{headers:jO}:e;let LQ=class{#t;constructor(t=globalThis.fetch.bind(globalThis)){this.#t=t}async jsonRequest(t,n){const r=await this.#t(t,MO(n)),i=await r.json();if(!r.ok)throw i;return i}async emptyRequest(t,n){const r=await this.#t(t,MO(n));if(!r.ok)throw await r.json()}};var Gb={},og={exports:{}},PO;function NQ(){return PO||(PO=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isPlainObject=t.clone=t.recursive=t.merge=t.main=void 0,e.exports=t=n,t.default=n;function n(){for(var h=[],m=0;mH.length)&&(I=H.length);for(var j=0,q=Array(I);j0&&(t=`${t} ${i}`)}catch{}return`${e.name} ${t}`.toLowerCase().replace(/[^a-zA-Z0-9-_.~]/g,"-")}function kQ(e){const t={};return e.forEach(n=>{t[n.id]=n}),t}const IQ=(e,{url:t,apiKey:n})=>e.some(r=>r.url===t&&r.apiKey===n);function zQ(e,t){const n=Object.values(e),{duplicatedServers:r=[],newServers:i=[]}=y6(t,o=>IQ(n,o)?"duplicatedServers":"newServers");return{duplicatedServers:r,newServers:i}}function fv(e,t){const n=new Set(Object.keys(e)),r=[];return t.forEach(i=>{const o=DQ(i);let l=o,c=1;for(;n.has(l);)l=`${o}-${c}`,c++;r.push({...i,id:l}),n.add(l)}),r}const UQ={},{actions:BQ,reducer:FQ}=jt({name:"shlink/servers",initialState:UQ,reducers:{editServer:{prepare:(e,t)=>({payload:{serverId:e,serverData:t}}),reducer:(e,{payload:t})=>{const{serverId:n,serverData:r}=t;return e[n]?{...e,[n]:{...e[n],...r}}:e}},deleteServer:(e,{payload:t})=>(delete e[t.id],e),setAutoConnect:{prepare:({id:e},t)=>({payload:{serverId:e,autoConnect:t}}),reducer:(e,{payload:t})=>{const{serverId:n,autoConnect:r}=t;return e[n]?r?Object.fromEntries(Object.entries(e).map(([i,o])=>[i,{...o,autoConnect:i===n}])):{...e,[n]:{...e[n],autoConnect:r}}:e}},createServers:{prepare:e=>({payload:kQ(e)}),reducer:(e,{payload:t})=>({...e,...t})}}}),{editServer:$Q,deleteServer:VQ,setAutoConnect:HQ,createServers:iD}=BQ,qQ=FQ,GQ=()=>Ty({appUpdated:MQ,servers:qQ,selectedServer:lJ,settings:wQ}),YQ=e=>(e.settings&&e.settings.visits&&e.settings.visits.defaultInterval==="last180days"&&(e.settings.visits.defaultInterval="last180Days"),e),aD={states:["settings","servers"],namespace:"shlink",namespaceSeparator:".",debounce:300},WQ=()=>YQ(rD.load(aD)),KQ=(e=WQ())=>sS({devTools:!1,reducer:GQ(),preloadedState:e,middleware:t=>t({immutableCheck:!1,serializableCheck:!1}).concat(rD.save(aD))}),ZQ=KL.withTypes(),XQ=ZL.withTypes(),oD=(e,t)=>V6(e,t,{serializeError:n=>n}),QQ=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,NO=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(QQ);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},RO=e=>e==="*"||e==="x"||e==="X",DO=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},JQ=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],eJ=(e,t)=>{if(RO(e)||RO(t))return 0;const[n,r]=JQ(DO(e),DO(t));return n>r?1:n{for(let n=0;n{const n=NO(e),r=NO(t),i=n.pop(),o=r.pop(),l=kO(n,r);return l!==0?l:i&&o?kO(i.split("."),o.split(".")):i||o?i?-1:1:0},dw=(e,t,n)=>{nJ(n);const r=tJ(e,t);return sD[n].includes(r)},sD={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},IO=Object.keys(sD),nJ=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(IO.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${IO.join("|")}`)},lD=b6(e=>e,e=>{try{return dw(e,e,"=")}catch{return!1}}),uD=e=>lD(e)?`v${e}`:e,cD=(e,t="latest")=>lD(e)?e:t,cS="shlink/selectedServer",rJ="1.0.0",iJ="999.999.999",aJ="latest",oJ=e=>cD(e===aJ?iJ:e,rJ),sJ=b6(e=>`${e.id}_${e.url}_${e.apiKey}`,async(e,t)=>t().then(({version:n})=>({version:oJ(n),printableVersion:uD(n)}))),zO=null,fS=un(`${cS}/resetSelectedServer`),dS=oD(`${cS}/selectServer`,async({serverId:e,buildShlinkApiClient:t},{dispatch:n,getState:r})=>{n(fS());const{servers:i}=r(),o=i[e];if(!o)return{serverNotFound:!0};try{const l=t(o),{version:c,printableVersion:f}=await sJ(o,()=>l.health());return{...o,version:c,printableVersion:f}}catch{return{...o,serverNotReachable:!0}}}),{reducer:lJ}=jt({name:cS,initialState:zO,reducers:{},extraReducers:e=>{e.addCase(fS,()=>zO),e.addCase(dS.fulfilled,(t,{payload:n})=>n)}}),Xu=()=>{const e=ZQ(),t=w.useCallback(()=>e(fS()),[e]),n=w.useCallback(i=>e(dS(i)),[e]);return{selectedServer:XQ(({selectedServer:i})=>i),resetSelectedServer:t,selectServer:n}};function hw(e){return t=>{const{resetSelectedServer:n}=Xu();return w.useEffect(()=>{n()},[n]),g.jsx(e,{...t})}}let uJ=class extends w.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){const{console:n=globalThis.console}=this.props;n.error(t)}render(){const{hasError:t}=this.state,{location:n=globalThis.location}=this.props;if(t)return g.jsxs(p6,{title:"Oops! This is awkward :S",children:[g.jsx("p",{children:"It seems that something went wrong. Try refreshing the page or just click this button."}),g.jsx("br",{}),g.jsx(Tt,{size:"lg",onClick:()=>n.reload(),children:"Take me back"})]});const{children:r}=this.props;return r}};const Li=({href:e,children:t,rel:n,...r})=>g.jsx("a",{target:"_blank",rel:`noopener noreferrer${n?` ${n}`:""}`,href:e,...r,children:t??e}),cJ=({id:e,name:t})=>g.jsxs(Ir,{to:`/server/${e}`,className:Oe("servers-list__server-item","flex items-center justify-between gap-x-2 px-4 py-3","rounded-none hover:bg-lm-secondary hover:dark:bg-dm-secondary","border-b last:border-0 border-lm-border dark:border-dm-border"),children:[g.jsx("span",{className:"truncate",children:t}),g.jsx(Be,{icon:Wg})]}),fD=({servers:e,borderless:t})=>g.jsx(g.Fragment,{children:e.length>0&&g.jsx("div",{"data-testid":"list",className:Oe("w-full border-lm-border dark:border-dm-border","md:max-h-56 md:overflow-y-auto -mb-1 scroll-thin",{"border-y":!t}),children:e.map(({id:n,name:r})=>g.jsx(cJ,{id:n,name:r},n))})}),dD=({color:e=Lh(),className:t})=>g.jsx("svg",{className:t,viewBox:"0 0 512 512",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:g.jsxs("g",{fill:e,children:[g.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"}),g.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"}),g.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"}),g.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"})]})}),fJ=({servers:e})=>{const t=uo(),n=Object.values(e),r=n.length>0;return w.useEffect(()=>{const i=n.find(({autoConnect:o})=>o);i&&t(`/server/${i.id}`)},[n,t]),g.jsx("div",{className:"px-3 w-full",children:g.jsx(ln,{className:"mx-auto max-w-[720px] overflow-hidden",children:g.jsxs("div",{className:"flex flex-col md:flex-row",children:[g.jsx("div",{className:"p-6 hidden md:flex items-center w-[40%]",children:g.jsx("div",{className:"w-full",children:g.jsx(dD,{})})}),g.jsxs("div",{className:"md:border-l border-lm-border dark:border-dm-border flex-grow",children:[g.jsx("h1",{className:Oe("p-4 text-center border-lm-border dark:border-dm-border",{"border-b":!r}),children:"Welcome!"}),r?g.jsx(fD,{servers:n}):g.jsxs("div",{className:"p-6 text-center flex flex-col gap-12 text-xl",children:[g.jsx("p",{children:"This application will help you manage your Shlink servers."}),g.jsx("p",{children:g.jsxs(Tt,{to:"/server/create",size:"lg",inline:!0,children:[g.jsx(Be,{icon:Zh,widthAuto:!0})," Add a server"]})}),g.jsx("p",{children:g.jsx(Li,{href:"https://shlink.io/documentation",children:g.jsxs("small",{children:[g.jsx("span",{className:"mr-2",children:"Learn more about Shlink"}),g.jsx(Be,{icon:BV})]})})})]})]})]})})})},hD=()=>{const{ServersDropdown:e}=oa(hD),{pathname:t}=Or(),n="/settings";return g.jsxs(J2,{className:"[&]:fixed top-0 z-900",brand:g.jsxs(Ir,{to:"/",className:"[&]:text-white no-underline flex items-center gap-2",children:[g.jsx(dD,{className:"w-7",color:"white"})," ",g.jsx("small",{className:"font-normal",children:"Shlink"})]}),children:[g.jsxs(J2.MenuItem,{to:n,active:t.startsWith(n),className:"flex items-center gap-1.5",children:[g.jsx(Be,{icon:DV})," Settings"]}),g.jsx(e,{})]})},dJ=Pa(hD,["ServersDropdown"]),hJ=({children:e})=>{const t=Or();return w.useEffect(()=>{scrollTo(0,0)},[t]),g.jsx(g.Fragment,{children:e})},mJ="%_VERSION_%",pJ=e=>uD(cD(e)),UO=({project:e,version:t})=>g.jsx(Li,{href:`https://github.com/shlinkio/${e}/releases/${t}`,className:"text-gray-500",children:g.jsx("b",{children:t})}),gJ=({selectedServer:e,clientVersion:t=mJ})=>{const n=pJ(t);return g.jsxs("small",{className:"text-gray-500",children:[T_(e)&&g.jsxs(g.Fragment,{children:["Server: ",g.jsx(UO,{project:"shlink",version:e.printableVersion})," - "]}),"Client: ",g.jsx(UO,{project:"shlink-web-client",version:n})]})},vJ=()=>{const{selectedServer:e}=Xu();return g.jsx("div",{className:Oe("text-center",{"md:ml-(--aside-menu-width)":T_(e)}),children:g.jsx(gJ,{selectedServer:e})})},hS={INVALID_ARGUMENT:"https://shlink.io/api/error/invalid-data",INVALID_SHORT_URL_DELETION:"https://shlink.io/api/error/invalid-short-url-deletion",DOMAIN_NOT_FOUND:"https://shlink.io/api/error/domain-not-found",FORBIDDEN_OPERATION:"https://shlink.io/api/error/forbidden-tag-operation",INVALID_SLUG:"https://shlink.io/api/error/non-unique-slug",INVALID_SHORTCODE:"https://shlink.io/api/error/short-url-not-found",TAG_CONFLICT:"https://shlink.io/api/error/tag-conflict",TAG_NOT_FOUND:"https://shlink.io/api/error/tag-not-found",MERCURE_NOT_CONFIGURED:"https://shlink.io/api/error/mercure-not-configured",INVALID_AUTHORIZATION:"https://shlink.io/api/error/missing-authentication",INVALID_API_KEY:"https://shlink.io/api/error/invalid-api-key",NOT_FOUND:"https://shlink.io/api/error/not-found",INVALID_URL:"https://shlink.io/api/error/invalid-url"};Object.freeze(hS);var mh={exports:{}};var yJ=mh.exports,BO;function bJ(){return BO||(BO=1,function(e,t){(function(n){var r=n.setTimeout,i=n.clearTimeout,o=n.XMLHttpRequest,l=n.XDomainRequest,c=n.ActiveXObject,f=n.EventSource,h=n.document,m=n.Promise,y=n.fetch,x=n.Response,b=n.TextDecoder,C=n.TextEncoder,_=n.AbortController;if(typeof window<"u"&&typeof h<"u"&&!("readyState"in h)&&h.body==null&&(h.readyState="loading",window.addEventListener("load",function(ie){h.readyState="complete"},!1)),o==null&&c!=null&&(o=function(){return new c("Microsoft.XMLHTTP")}),Object.create==null&&(Object.create=function(ie){function xe(){}return xe.prototype=ie,new xe}),Date.now||(Date.now=function(){return new Date().getTime()}),_==null){var A=y;y=function(ie,xe){var Ee=xe.signal;return A(ie,{headers:xe.headers,credentials:xe.credentials,cache:xe.cache}).then(function(Me){var Ue=Me.body.getReader();return Ee._reader=Ue,Ee._aborted&&Ee._reader.cancel(),{status:Me.status,statusText:Me.statusText,headers:Me.headers,body:{getReader:function(){return Ue}}}})},_=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){this.signal._reader!=null&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function O(){this.bitsNeeded=0,this.codePoint=0}O.prototype.decode=function(ie){function xe(Qe,We,ze){if(ze===1)return Qe>=128>>We&&Qe<=2048>>We&&Qe<=57344>>We&&Qe<=65536>>We&&Qe<>6>15?3:We>31?2:1;if(Qe===6*2)return We>15?3:2;if(Qe===6*3)return 3;throw new Error}for(var Me=65533,Ue="",ke=this.bitsNeeded,Ve=this.codePoint,ot=0;ot191||!xe(Ve<<6|Ge&63,ke-6,Ee(ke,Ve)))&&(ke=0,Ve=Me,Ue+=String.fromCharCode(Ve)),ke===0?(Ge>=0&&Ge<=127?(ke=0,Ve=Ge):Ge>=192&&Ge<=223?(ke=6*1,Ve=Ge&31):Ge>=224&&Ge<=239?(ke=6*2,Ve=Ge&15):Ge>=240&&Ge<=247?(ke=6*3,Ve=Ge&7):(ke=0,Ve=Me),ke!==0&&!xe(Ve,ke,Ee(ke,Ve))&&(ke=0,Ve=Me)):(ke-=6,Ve=Ve<<6|Ge&63),ke===0&&(Ve<=65535?Ue+=String.fromCharCode(Ve):(Ue+=String.fromCharCode(55296+(Ve-65535-1>>10)),Ue+=String.fromCharCode(56320+(Ve-65535-1&1023))))}return this.bitsNeeded=ke,this.codePoint=Ve,Ue};var P=function(){try{return new b().decode(new C().encode("test"),{stream:!0})==="test"}catch(ie){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+ie)}return!1};(b==null||C==null||!P())&&(b=O);var N=function(){};function F(ie){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=N,this.onload=N,this.onerror=N,this.onreadystatechange=N,this._contentType="",this._xhr=ie,this._sendTimeout=0,this._abort=N}F.prototype.open=function(ie,xe){this._abort(!0);var Ee=this,Me=this._xhr,Ue=1,ke=0;this._abort=function(ze){Ee._sendTimeout!==0&&(i(Ee._sendTimeout),Ee._sendTimeout=0),(Ue===1||Ue===2||Ue===3)&&(Ue=4,Me.onload=N,Me.onerror=N,Me.onabort=N,Me.onprogress=N,Me.onreadystatechange=N,Me.abort(),ke!==0&&(i(ke),ke=0),ze||(Ee.readyState=4,Ee.onabort(null),Ee.onreadystatechange())),Ue=0};var Ve=function(){if(Ue===1){var ze=0,nt="",Pt=void 0;if("contentType"in Me)ze=200,nt="OK",Pt=Me.contentType;else try{ze=Me.status,nt=Me.statusText,Pt=Me.getResponseHeader("Content-Type")}catch{ze=0,nt="",Pt=void 0}ze!==0&&(Ue=2,Ee.readyState=2,Ee.status=ze,Ee.statusText=nt,Ee._contentType=Pt,Ee.onreadystatechange())}},ot=function(){if(Ve(),Ue===2||Ue===3){Ue=3;var ze="";try{ze=Me.responseText}catch{}Ee.readyState=3,Ee.responseText=ze,Ee.onprogress()}},Ge=function(ze,nt){if((nt==null||nt.preventDefault==null)&&(nt={preventDefault:N}),ot(),Ue===1||Ue===2||Ue===3){if(Ue=4,ke!==0&&(i(ke),ke=0),Ee.readyState=4,ze==="load")Ee.onload(nt);else if(ze==="error")Ee.onerror(nt);else if(ze==="abort")Ee.onabort(nt);else throw new TypeError;Ee.onreadystatechange()}},Qe=function(ze){Me!=null&&(Me.readyState===4?(!("onload"in Me)||!("onerror"in Me)||!("onabort"in Me))&&Ge(Me.responseText===""?"error":"load",ze):Me.readyState===3?"onprogress"in Me||ot():Me.readyState===2&&Ve())},We=function(){ke=r(function(){We()},500),Me.readyState===3&&ot()};"onload"in Me&&(Me.onload=function(ze){Ge("load",ze)}),"onerror"in Me&&(Me.onerror=function(ze){Ge("error",ze)}),"onabort"in Me&&(Me.onabort=function(ze){Ge("abort",ze)}),"onprogress"in Me&&(Me.onprogress=ot),"onreadystatechange"in Me&&(Me.onreadystatechange=function(ze){Qe(ze)}),("contentType"in Me||!("ontimeout"in o.prototype))&&(xe+=(xe.indexOf("?")===-1?"?":"&")+"padding=true"),Me.open(ie,xe,!0),"readyState"in Me&&(ke=r(function(){We()},0))},F.prototype.abort=function(){this._abort(!1)},F.prototype.getResponseHeader=function(ie){return this._contentType},F.prototype.setRequestHeader=function(ie,xe){var Ee=this._xhr;"setRequestHeader"in Ee&&Ee.setRequestHeader(ie,xe)},F.prototype.getAllResponseHeaders=function(){return this._xhr.getAllResponseHeaders!=null&&this._xhr.getAllResponseHeaders()||""},F.prototype.send=function(){if((!("ontimeout"in o.prototype)||!("sendAsBinary"in o.prototype)&&!("mozAnon"in o.prototype))&&h!=null&&h.readyState!=null&&h.readyState!=="complete"){var ie=this;ie._sendTimeout=r(function(){ie._sendTimeout=0,ie.send()},4);return}var xe=this._xhr;"withCredentials"in xe&&(xe.withCredentials=this.withCredentials);try{xe.send(void 0)}catch(Ee){throw Ee}};function U(ie){return ie.replace(/[A-Z]/g,function(xe){return String.fromCharCode(xe.charCodeAt(0)+32)})}function W(ie){for(var xe=Object.create(null),Ee=ie.split(`\r +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o(H,I){if(H){if(typeof H=="string")return l(H,I);var j=Object.prototype.toString.call(H).slice(8,-1);return j==="Object"&&H.constructor&&(j=H.constructor.name),j==="Map"||j==="Set"?Array.from(H):j==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(j)?l(H,I):void 0}}function l(H,I){(I==null||I>H.length)&&(I=H.length);for(var j=0,q=Array(I);j(e.settings&&e.settings.visits&&e.settings.visits.defaultInterval==="last180days"&&(e.settings.visits.defaultInterval="last180Days"),e);function kQ(e){let t=e.url;try{const{host:n,pathname:r}=new URL(t);t=n;const i=r.substring(1);i.length>0&&(t=`${t} ${i}`)}catch{}return`${e.name} ${t}`.toLowerCase().replace(/[^a-zA-Z0-9-_.~]/g,"-")}function IQ(e){const t={};return e.forEach(n=>{t[n.id]=n}),t}const zQ=(e,{url:t,apiKey:n})=>e.some(r=>r.url===t&&r.apiKey===n);function UQ(e,t){const n=Object.values(e),{duplicatedServers:r=[],newServers:i=[]}=y6(t,o=>zQ(n,o)?"duplicatedServers":"newServers");return{duplicatedServers:r,newServers:i}}function fv(e,t){const n=new Set(Object.keys(e)),r=[];return t.forEach(i=>{const o=kQ(i);let l=o,c=1;for(;n.has(l);)l=`${o}-${c}`,c++;r.push({...i,id:l}),n.add(l)}),r}const BQ={},{actions:FQ,reducer:$Q}=jt({name:"shlink/servers",initialState:BQ,reducers:{editServer:{prepare:(e,t)=>({payload:{serverId:e,serverData:t}}),reducer:(e,{payload:t})=>{const{serverId:n,serverData:r}=t;return e[n]?{...e,[n]:{...e[n],...r}}:e}},deleteServer:(e,{payload:t})=>(delete e[t.id],e),setAutoConnect:{prepare:({id:e},t)=>({payload:{serverId:e,autoConnect:t}}),reducer:(e,{payload:t})=>{const{serverId:n,autoConnect:r}=t;return e[n]?r?Object.fromEntries(Object.entries(e).map(([i,o])=>[i,{...o,autoConnect:i===n}])):{...e,[n]:{...e[n],autoConnect:r}}:e}},createServers:{prepare:e=>({payload:IQ(e)}),reducer:(e,{payload:t})=>({...e,...t})}}}),{editServer:VQ,deleteServer:HQ,setAutoConnect:qQ,createServers:iD}=FQ,GQ=$Q,YQ=()=>Ty({appUpdated:MQ,servers:GQ,selectedServer:lJ,settings:wQ}),aD={states:["settings","servers"],namespace:"shlink",namespaceSeparator:".",debounce:300},WQ=()=>DQ(rD.load(aD)),KQ=(e=WQ())=>sS({devTools:!1,reducer:YQ(),preloadedState:e,middleware:t=>t({immutableCheck:!1,serializableCheck:!1}).concat(rD.save(aD))}),ZQ=KL.withTypes(),XQ=ZL.withTypes(),oD=(e,t)=>V6(e,t,{serializeError:n=>n}),QQ=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,NO=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(QQ);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},RO=e=>e==="*"||e==="x"||e==="X",DO=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},JQ=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],eJ=(e,t)=>{if(RO(e)||RO(t))return 0;const[n,r]=JQ(DO(e),DO(t));return n>r?1:n{for(let n=0;n{const n=NO(e),r=NO(t),i=n.pop(),o=r.pop(),l=kO(n,r);return l!==0?l:i&&o?kO(i.split("."),o.split(".")):i||o?i?-1:1:0},dw=(e,t,n)=>{nJ(n);const r=tJ(e,t);return sD[n].includes(r)},sD={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},IO=Object.keys(sD),nJ=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(IO.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${IO.join("|")}`)},lD=b6(e=>e,e=>{try{return dw(e,e,"=")}catch{return!1}}),uD=e=>lD(e)?`v${e}`:e,cD=(e,t="latest")=>lD(e)?e:t,cS="shlink/selectedServer",rJ="1.0.0",iJ="999.999.999",aJ="latest",oJ=e=>cD(e===aJ?iJ:e,rJ),sJ=b6(e=>`${e.id}_${e.url}_${e.apiKey}`,async(e,t)=>t().then(({version:n})=>({version:oJ(n),printableVersion:uD(n)}))),zO=null,fS=un(`${cS}/resetSelectedServer`),dS=oD(`${cS}/selectServer`,async({serverId:e,buildShlinkApiClient:t},{dispatch:n,getState:r})=>{n(fS());const{servers:i}=r(),o=i[e];if(!o)return{serverNotFound:!0};try{const l=t(o),{version:c,printableVersion:f}=await sJ(o,()=>l.health());return{...o,version:c,printableVersion:f}}catch{return{...o,serverNotReachable:!0}}}),{reducer:lJ}=jt({name:cS,initialState:zO,reducers:{},extraReducers:e=>{e.addCase(fS,()=>zO),e.addCase(dS.fulfilled,(t,{payload:n})=>n)}}),Xu=()=>{const e=ZQ(),t=w.useCallback(()=>e(fS()),[e]),n=w.useCallback(i=>e(dS(i)),[e]);return{selectedServer:XQ(({selectedServer:i})=>i),resetSelectedServer:t,selectServer:n}};function hw(e){return t=>{const{resetSelectedServer:n}=Xu();return w.useEffect(()=>{n()},[n]),g.jsx(e,{...t})}}let uJ=class extends w.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){const{console:n=globalThis.console}=this.props;n.error(t)}render(){const{hasError:t}=this.state,{location:n=globalThis.location}=this.props;if(t)return g.jsxs(p6,{title:"Oops! This is awkward :S",children:[g.jsx("p",{children:"It seems that something went wrong. Try refreshing the page or just click this button."}),g.jsx("br",{}),g.jsx(Tt,{size:"lg",onClick:()=>n.reload(),children:"Take me back"})]});const{children:r}=this.props;return r}};const Li=({href:e,children:t,rel:n,...r})=>g.jsx("a",{target:"_blank",rel:`noopener noreferrer${n?` ${n}`:""}`,href:e,...r,children:t??e}),cJ=({id:e,name:t})=>g.jsxs(Ir,{to:`/server/${e}`,className:Oe("servers-list__server-item","flex items-center justify-between gap-x-2 px-4 py-3","rounded-none hover:bg-lm-secondary hover:dark:bg-dm-secondary","border-b last:border-0 border-lm-border dark:border-dm-border"),children:[g.jsx("span",{className:"truncate",children:t}),g.jsx(Be,{icon:Wg})]}),fD=({servers:e,borderless:t})=>g.jsx(g.Fragment,{children:e.length>0&&g.jsx("div",{"data-testid":"list",className:Oe("w-full border-lm-border dark:border-dm-border","md:max-h-56 md:overflow-y-auto -mb-1 scroll-thin",{"border-y":!t}),children:e.map(({id:n,name:r})=>g.jsx(cJ,{id:n,name:r},n))})}),dD=({color:e=Lh(),className:t})=>g.jsx("svg",{className:t,viewBox:"0 0 512 512",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:g.jsxs("g",{fill:e,children:[g.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"}),g.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"}),g.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"}),g.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"})]})}),fJ=({servers:e})=>{const t=uo(),n=Object.values(e),r=n.length>0;return w.useEffect(()=>{const i=n.find(({autoConnect:o})=>o);i&&t(`/server/${i.id}`)},[n,t]),g.jsx("div",{className:"px-3 w-full",children:g.jsx(ln,{className:"mx-auto max-w-[720px] overflow-hidden",children:g.jsxs("div",{className:"flex flex-col md:flex-row",children:[g.jsx("div",{className:"p-6 hidden md:flex items-center w-[40%]",children:g.jsx("div",{className:"w-full",children:g.jsx(dD,{})})}),g.jsxs("div",{className:"md:border-l border-lm-border dark:border-dm-border flex-grow",children:[g.jsx("h1",{className:Oe("p-4 text-center border-lm-border dark:border-dm-border",{"border-b":!r}),children:"Welcome!"}),r?g.jsx(fD,{servers:n}):g.jsxs("div",{className:"p-6 text-center flex flex-col gap-12 text-xl",children:[g.jsx("p",{children:"This application will help you manage your Shlink servers."}),g.jsx("p",{children:g.jsxs(Tt,{to:"/server/create",size:"lg",inline:!0,children:[g.jsx(Be,{icon:Zh,widthAuto:!0})," Add a server"]})}),g.jsx("p",{children:g.jsx(Li,{href:"https://shlink.io/documentation",children:g.jsxs("small",{children:[g.jsx("span",{className:"mr-2",children:"Learn more about Shlink"}),g.jsx(Be,{icon:BV})]})})})]})]})]})})})},hD=()=>{const{ServersDropdown:e}=oa(hD),{pathname:t}=Or(),n="/settings";return g.jsxs(J2,{className:"[&]:fixed top-0 z-900",brand:g.jsxs(Ir,{to:"/",className:"[&]:text-white no-underline flex items-center gap-2",children:[g.jsx(dD,{className:"w-7",color:"white"})," ",g.jsx("small",{className:"font-normal",children:"Shlink"})]}),children:[g.jsxs(J2.MenuItem,{to:n,active:t.startsWith(n),className:"flex items-center gap-1.5",children:[g.jsx(Be,{icon:DV})," Settings"]}),g.jsx(e,{})]})},dJ=Pa(hD,["ServersDropdown"]),hJ=({children:e})=>{const t=Or();return w.useEffect(()=>{scrollTo(0,0)},[t]),g.jsx(g.Fragment,{children:e})},mJ="%_VERSION_%",pJ=e=>uD(cD(e)),UO=({project:e,version:t})=>g.jsx(Li,{href:`https://github.com/shlinkio/${e}/releases/${t}`,className:"text-gray-500",children:g.jsx("b",{children:t})}),gJ=({selectedServer:e,clientVersion:t=mJ})=>{const n=pJ(t);return g.jsxs("small",{className:"text-gray-500",children:[T_(e)&&g.jsxs(g.Fragment,{children:["Server: ",g.jsx(UO,{project:"shlink",version:e.printableVersion})," - "]}),"Client: ",g.jsx(UO,{project:"shlink-web-client",version:n})]})},vJ=()=>{const{selectedServer:e}=Xu();return g.jsx("div",{className:Oe("text-center",{"md:ml-(--aside-menu-width)":T_(e)}),children:g.jsx(gJ,{selectedServer:e})})},hS={INVALID_ARGUMENT:"https://shlink.io/api/error/invalid-data",INVALID_SHORT_URL_DELETION:"https://shlink.io/api/error/invalid-short-url-deletion",DOMAIN_NOT_FOUND:"https://shlink.io/api/error/domain-not-found",FORBIDDEN_OPERATION:"https://shlink.io/api/error/forbidden-tag-operation",INVALID_SLUG:"https://shlink.io/api/error/non-unique-slug",INVALID_SHORTCODE:"https://shlink.io/api/error/short-url-not-found",TAG_CONFLICT:"https://shlink.io/api/error/tag-conflict",TAG_NOT_FOUND:"https://shlink.io/api/error/tag-not-found",MERCURE_NOT_CONFIGURED:"https://shlink.io/api/error/mercure-not-configured",INVALID_AUTHORIZATION:"https://shlink.io/api/error/missing-authentication",INVALID_API_KEY:"https://shlink.io/api/error/invalid-api-key",NOT_FOUND:"https://shlink.io/api/error/not-found",INVALID_URL:"https://shlink.io/api/error/invalid-url"};Object.freeze(hS);var mh={exports:{}};var yJ=mh.exports,BO;function bJ(){return BO||(BO=1,function(e,t){(function(n){var r=n.setTimeout,i=n.clearTimeout,o=n.XMLHttpRequest,l=n.XDomainRequest,c=n.ActiveXObject,f=n.EventSource,h=n.document,m=n.Promise,y=n.fetch,x=n.Response,b=n.TextDecoder,C=n.TextEncoder,_=n.AbortController;if(typeof window<"u"&&typeof h<"u"&&!("readyState"in h)&&h.body==null&&(h.readyState="loading",window.addEventListener("load",function(ie){h.readyState="complete"},!1)),o==null&&c!=null&&(o=function(){return new c("Microsoft.XMLHTTP")}),Object.create==null&&(Object.create=function(ie){function xe(){}return xe.prototype=ie,new xe}),Date.now||(Date.now=function(){return new Date().getTime()}),_==null){var A=y;y=function(ie,xe){var Ee=xe.signal;return A(ie,{headers:xe.headers,credentials:xe.credentials,cache:xe.cache}).then(function(Me){var Ue=Me.body.getReader();return Ee._reader=Ue,Ee._aborted&&Ee._reader.cancel(),{status:Me.status,statusText:Me.statusText,headers:Me.headers,body:{getReader:function(){return Ue}}}})},_=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){this.signal._reader!=null&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function O(){this.bitsNeeded=0,this.codePoint=0}O.prototype.decode=function(ie){function xe(Qe,We,ze){if(ze===1)return Qe>=128>>We&&Qe<=2048>>We&&Qe<=57344>>We&&Qe<=65536>>We&&Qe<>6>15?3:We>31?2:1;if(Qe===6*2)return We>15?3:2;if(Qe===6*3)return 3;throw new Error}for(var Me=65533,Ue="",ke=this.bitsNeeded,Ve=this.codePoint,ot=0;ot191||!xe(Ve<<6|Ge&63,ke-6,Ee(ke,Ve)))&&(ke=0,Ve=Me,Ue+=String.fromCharCode(Ve)),ke===0?(Ge>=0&&Ge<=127?(ke=0,Ve=Ge):Ge>=192&&Ge<=223?(ke=6*1,Ve=Ge&31):Ge>=224&&Ge<=239?(ke=6*2,Ve=Ge&15):Ge>=240&&Ge<=247?(ke=6*3,Ve=Ge&7):(ke=0,Ve=Me),ke!==0&&!xe(Ve,ke,Ee(ke,Ve))&&(ke=0,Ve=Me)):(ke-=6,Ve=Ve<<6|Ge&63),ke===0&&(Ve<=65535?Ue+=String.fromCharCode(Ve):(Ue+=String.fromCharCode(55296+(Ve-65535-1>>10)),Ue+=String.fromCharCode(56320+(Ve-65535-1&1023))))}return this.bitsNeeded=ke,this.codePoint=Ve,Ue};var P=function(){try{return new b().decode(new C().encode("test"),{stream:!0})==="test"}catch(ie){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+ie)}return!1};(b==null||C==null||!P())&&(b=O);var N=function(){};function F(ie){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=N,this.onload=N,this.onerror=N,this.onreadystatechange=N,this._contentType="",this._xhr=ie,this._sendTimeout=0,this._abort=N}F.prototype.open=function(ie,xe){this._abort(!0);var Ee=this,Me=this._xhr,Ue=1,ke=0;this._abort=function(ze){Ee._sendTimeout!==0&&(i(Ee._sendTimeout),Ee._sendTimeout=0),(Ue===1||Ue===2||Ue===3)&&(Ue=4,Me.onload=N,Me.onerror=N,Me.onabort=N,Me.onprogress=N,Me.onreadystatechange=N,Me.abort(),ke!==0&&(i(ke),ke=0),ze||(Ee.readyState=4,Ee.onabort(null),Ee.onreadystatechange())),Ue=0};var Ve=function(){if(Ue===1){var ze=0,nt="",Pt=void 0;if("contentType"in Me)ze=200,nt="OK",Pt=Me.contentType;else try{ze=Me.status,nt=Me.statusText,Pt=Me.getResponseHeader("Content-Type")}catch{ze=0,nt="",Pt=void 0}ze!==0&&(Ue=2,Ee.readyState=2,Ee.status=ze,Ee.statusText=nt,Ee._contentType=Pt,Ee.onreadystatechange())}},ot=function(){if(Ve(),Ue===2||Ue===3){Ue=3;var ze="";try{ze=Me.responseText}catch{}Ee.readyState=3,Ee.responseText=ze,Ee.onprogress()}},Ge=function(ze,nt){if((nt==null||nt.preventDefault==null)&&(nt={preventDefault:N}),ot(),Ue===1||Ue===2||Ue===3){if(Ue=4,ke!==0&&(i(ke),ke=0),Ee.readyState=4,ze==="load")Ee.onload(nt);else if(ze==="error")Ee.onerror(nt);else if(ze==="abort")Ee.onabort(nt);else throw new TypeError;Ee.onreadystatechange()}},Qe=function(ze){Me!=null&&(Me.readyState===4?(!("onload"in Me)||!("onerror"in Me)||!("onabort"in Me))&&Ge(Me.responseText===""?"error":"load",ze):Me.readyState===3?"onprogress"in Me||ot():Me.readyState===2&&Ve())},We=function(){ke=r(function(){We()},500),Me.readyState===3&&ot()};"onload"in Me&&(Me.onload=function(ze){Ge("load",ze)}),"onerror"in Me&&(Me.onerror=function(ze){Ge("error",ze)}),"onabort"in Me&&(Me.onabort=function(ze){Ge("abort",ze)}),"onprogress"in Me&&(Me.onprogress=ot),"onreadystatechange"in Me&&(Me.onreadystatechange=function(ze){Qe(ze)}),("contentType"in Me||!("ontimeout"in o.prototype))&&(xe+=(xe.indexOf("?")===-1?"?":"&")+"padding=true"),Me.open(ie,xe,!0),"readyState"in Me&&(ke=r(function(){We()},0))},F.prototype.abort=function(){this._abort(!1)},F.prototype.getResponseHeader=function(ie){return this._contentType},F.prototype.setRequestHeader=function(ie,xe){var Ee=this._xhr;"setRequestHeader"in Ee&&Ee.setRequestHeader(ie,xe)},F.prototype.getAllResponseHeaders=function(){return this._xhr.getAllResponseHeaders!=null&&this._xhr.getAllResponseHeaders()||""},F.prototype.send=function(){if((!("ontimeout"in o.prototype)||!("sendAsBinary"in o.prototype)&&!("mozAnon"in o.prototype))&&h!=null&&h.readyState!=null&&h.readyState!=="complete"){var ie=this;ie._sendTimeout=r(function(){ie._sendTimeout=0,ie.send()},4);return}var xe=this._xhr;"withCredentials"in xe&&(xe.withCredentials=this.withCredentials);try{xe.send(void 0)}catch(Ee){throw Ee}};function U(ie){return ie.replace(/[A-Z]/g,function(xe){return String.fromCharCode(xe.charCodeAt(0)+32)})}function W(ie){for(var xe=Object.create(null),Ee=ie.split(`\r `),Me=0;Me"u"?typeof window<"u"?window:typeof self<"u"?self:yJ:globalThis)}(mh,mh.exports)),mh.exports}var xJ=bJ();const mS=6048e5,wJ=864e5,mD=6e4,pS=36e5,sg=43200,FO=1440,$O=Symbol.for("constructDateFrom");function Tr(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&$O in e?e[$O](t):e instanceof Date?new e.constructor(t):new Date(t)}function St(e,t){return Tr(t||e,e)}function gS(e,t,n){const r=St(e,n?.in);return isNaN(t)?Tr(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function _J(e,t,n){const r=St(e,n?.in);if(isNaN(t))return Tr(e,NaN);if(!t)return r;const i=r.getDate(),o=Tr(e,r.getTime());o.setMonth(r.getMonth()+t+1,0);const l=o.getDate();return i>=l?o:(r.setFullYear(o.getFullYear(),o.getMonth(),i),r)}function SJ(e,t,n){const{years:r=0,months:i=0,weeks:o=0,days:l=0,hours:c=0,minutes:f=0,seconds:h=0}=t,m=St(e,n?.in),y=i||r?_J(m,i+r*12):m,x=l||o?gS(y,l+o*7):y,b=f+c*60,_=(h+b*60)*1e3;return Tr(e,+x+_)}let CJ={};function om(){return CJ}function Bu(e,t){const n=om(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=St(e,t?.in),o=i.getDay(),l=(o=o.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function df(e){const t=St(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Qu(e,...t){const n=Tr.bind(null,e||t.find(r=>typeof r=="object"));return t.map(n)}function Fu(e,t){const n=St(e,t?.in);return n.setHours(0,0,0,0),n}function Ny(e,t,n){const[r,i]=Qu(n?.in,e,t),o=Fu(r),l=Fu(i),c=+o-df(o),f=+l-df(l);return Math.round((c-f)/wJ)}function EJ(e,t){const n=pD(e,t),r=Tr(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),kh(r)}function gD(e,t){let n,r=t?.in;return e.forEach(i=>{!r&&typeof i=="object"&&(r=Tr.bind(null,i));const o=St(i,r);(!n||n{!r&&typeof i=="object"&&(r=Tr.bind(null,i));const o=St(i,r);(!n||n>o||isNaN(+o))&&(n=o)}),Tr(r,n||NaN)}function Ig(e,t){const n=+St(e)-+St(t);return n<0?-1:n>0?1:n}function TJ(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function OJ(e){return!(!TJ(e)&&typeof e!="number"||isNaN(+St(e)))}function dv(e,t,n){const[r,i]=Qu(n?.in,e,t),o=r.getFullYear()-i.getFullYear(),l=r.getMonth()-i.getMonth();return o*12+l}function jJ(e,t,n){const[r,i]=Qu(n?.in,e,t),o=Bu(r,n),l=Bu(i,n),c=+o-df(o),f=+l-df(l);return Math.round((c-f)/mS)}function vD(e,t,n){const[r,i]=Qu(n?.in,e,t),o=VO(r,i),l=Math.abs(Ny(r,i));r.setDate(r.getDate()-o*l);const c=+(VO(r,i)===-o),f=o*(l-c);return f===0?0:f}function VO(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function yD(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function MJ(e,t,n){const[r,i]=Qu(n?.in,e,t),o=(+r-+i)/pS;return yD(n?.roundingMethod)(o)}function PJ(e,t){return+St(e)-+St(t)}function hf(e,t){const n=St(e,t?.in);return n.setHours(23,59,59,999),n}function LJ(e,t){const n=St(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function NJ(e,t){const n=St(e,t?.in);return+hf(n,t)==+LJ(n,t)}function RJ(e,t,n){const[r,i,o]=Qu(n?.in,e,e,t),l=Ig(i,o),c=Math.abs(dv(i,o));if(c<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-l*c);let f=Ig(i,o)===-l;NJ(r)&&c===1&&Ig(r,o)===1&&(f=!1);const h=l*(c-+f);return h===0?0:h}function DJ(e,t,n){const r=PJ(e,t)/1e3;return yD(n?.roundingMethod)(r)}function kJ(e,t){const n=St(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function IJ(e,t){const n=t?.weekStartsOn,r=St(e,t?.in),i=r.getDay(),o=(i{let r;const i=UJ[e];return typeof i=="string"?r=i:t===1?r=i.one:r=i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Yb(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const FJ={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},$J={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},VJ={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},HJ={date:Yb({formats:FJ,defaultWidth:"full"}),time:Yb({formats:$J,defaultWidth:"full"}),dateTime:Yb({formats:VJ,defaultWidth:"full"})},qJ={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},GJ=(e,t,n,r)=>qJ[e];function Qd(e){return(t,n)=>{const r=n?.context?String(n.context):"standalone";let i;if(r==="formatting"&&e.formattingValues){const l=e.defaultFormattingWidth||e.defaultWidth,c=n?.width?String(n.width):l;i=e.formattingValues[c]||e.formattingValues[l]}else{const l=e.defaultWidth,c=n?.width?String(n.width):e.defaultWidth;i=e.values[c]||e.values[l]}const o=e.argumentCallback?e.argumentCallback(t):t;return i[o]}}const YJ={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},WJ={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},KJ={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ZJ={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},XJ={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},QJ={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},JJ=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},eee={ordinalNumber:JJ,era:Qd({values:YJ,defaultWidth:"wide"}),quarter:Qd({values:WJ,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Qd({values:KJ,defaultWidth:"wide"}),day:Qd({values:ZJ,defaultWidth:"wide"}),dayPeriod:Qd({values:XJ,defaultWidth:"wide",formattingValues:QJ,defaultFormattingWidth:"wide"})};function Jd(e){return(t,n={})=>{const r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;const l=o[0],c=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],f=Array.isArray(c)?nee(c,y=>y.test(l)):tee(c,y=>y.test(l));let h;h=e.valueCallback?e.valueCallback(f):f,h=n.valueCallback?n.valueCallback(h):h;const m=t.slice(l.length);return{value:h,rest:m}}}function tee(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function nee(e,t){for(let n=0;n{const r=t.match(e.matchPattern);if(!r)return null;const i=r[0],o=t.match(e.parsePattern);if(!o)return null;let l=e.valueCallback?e.valueCallback(o[0]):o[0];l=n.valueCallback?n.valueCallback(l):l;const c=t.slice(i.length);return{value:l,rest:c}}}const iee=/^(\d+)(th|st|nd|rd)?/i,aee=/\d+/i,oee={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},see={any:[/^b/i,/^(a|c)/i]},lee={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},uee={any:[/1/i,/2/i,/3/i,/4/i]},cee={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},fee={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},dee={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},hee={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},mee={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},pee={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},gee={ordinalNumber:ree({matchPattern:iee,parsePattern:aee,valueCallback:e=>parseInt(e,10)}),era:Jd({matchPatterns:oee,defaultMatchWidth:"wide",parsePatterns:see,defaultParseWidth:"any"}),quarter:Jd({matchPatterns:lee,defaultMatchWidth:"wide",parsePatterns:uee,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Jd({matchPatterns:cee,defaultMatchWidth:"wide",parsePatterns:fee,defaultParseWidth:"any"}),day:Jd({matchPatterns:dee,defaultMatchWidth:"wide",parsePatterns:hee,defaultParseWidth:"any"}),dayPeriod:Jd({matchPatterns:mee,defaultMatchWidth:"any",parsePatterns:pee,defaultParseWidth:"any"})},bD={code:"en-US",formatDistance:BJ,formatLong:HJ,formatRelative:GJ,localize:eee,match:gee,options:{weekStartsOn:0,firstWeekContainsDate:1}};function vee(e,t){const n=St(e,t?.in);return Ny(n,kJ(n))+1}function yee(e,t){const n=St(e,t?.in),r=+kh(n)-+EJ(n);return Math.round(r/mS)+1}function xD(e,t){const n=St(e,t?.in),r=n.getFullYear(),i=om(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,l=Tr(t?.in||e,0);l.setFullYear(r+1,0,o),l.setHours(0,0,0,0);const c=Bu(l,t),f=Tr(t?.in||e,0);f.setFullYear(r,0,o),f.setHours(0,0,0,0);const h=Bu(f,t);return+n>=+c?r+1:+n>=+h?r:r-1}function bee(e,t){const n=om(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=xD(e,t),o=Tr(t?.in||e,0);return o.setFullYear(i,0,r),o.setHours(0,0,0,0),Bu(o,t)}function xee(e,t){const n=St(e,t?.in),r=+Bu(n,t)-+bee(n,t);return Math.round(r/mS)+1}function _t(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Js={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return _t(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):_t(n+1,2)},d(e,t){return _t(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return _t(e.getHours()%12||12,t.length)},H(e,t){return _t(e.getHours(),t.length)},m(e,t){return _t(e.getMinutes(),t.length)},s(e,t){return _t(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return _t(i,t.length)}},Gc={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},HO={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return Js.y(e,t)},Y:function(e,t,n,r){const i=xD(e,r),o=i>0?i:1-i;if(t==="YY"){const l=o%100;return _t(l,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):_t(o,t.length)},R:function(e,t){const n=pD(e);return _t(n,t.length)},u:function(e,t){const n=e.getFullYear();return _t(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return _t(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return _t(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Js.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return _t(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const i=xee(e,r);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):_t(i,t.length)},I:function(e,t,n){const r=yee(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):_t(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Js.d(e,t)},D:function(e,t,n){const r=vee(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):_t(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return _t(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return _t(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),i=r===0?7:r;switch(t){case"i":return String(i);case"ii":return _t(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let i;switch(r===12?i=Gc.noon:r===0?i=Gc.midnight:i=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let i;switch(r>=17?i=Gc.evening:r>=12?i=Gc.afternoon:r>=4?i=Gc.morning:i=Gc.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Js.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Js.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):_t(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):_t(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Js.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Js.s(e,t)},S:function(e,t){return Js.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return GO(r);case"XXXX":case"XX":return xu(r);case"XXXXX":case"XXX":default:return xu(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return GO(r);case"xxxx":case"xx":return xu(r);case"xxxxx":case"xxx":default:return xu(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+qO(r,":");case"OOOO":default:return"GMT"+xu(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+qO(r,":");case"zzzz":default:return"GMT"+xu(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return _t(r,t.length)},T:function(e,t,n){return _t(+e,t.length)}};function qO(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Math.trunc(r/60),o=r%60;return o===0?n+String(i):n+String(i)+t+_t(o,2)}function GO(e,t){return e%60===0?(e>0?"-":"+")+_t(Math.abs(e)/60,2):xu(e,t)}function xu(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=_t(Math.trunc(r/60),2),o=_t(r%60,2);return n+i+t+o}const YO=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},wD=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},wee=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return YO(e,t);let o;switch(r){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",YO(r,t)).replace("{{time}}",wD(i,t))},_ee={p:wD,P:wee},See=/^D+$/,Cee=/^Y+$/,Eee=["D","DD","YY","YYYY"];function Aee(e){return See.test(e)}function Tee(e){return Cee.test(e)}function Oee(e,t,n){const r=jee(e,t,n);if(console.warn(r),Eee.includes(e))throw new RangeError(r)}function jee(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Mee=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Pee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Lee=/^'([^]*?)'?$/,Nee=/''/g,Ree=/[a-zA-Z]/;function hv(e,t,n){const r=om(),i=r.locale??bD,o=r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,l=r.weekStartsOn??r.locale?.options?.weekStartsOn??0,c=St(e,n?.in);if(!OJ(c))throw new RangeError("Invalid time value");let f=t.match(Pee).map(m=>{const y=m[0];if(y==="p"||y==="P"){const x=_ee[y];return x(m,i.formatLong)}return m}).join("").match(Mee).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const y=m[0];if(y==="'")return{isToken:!1,value:Dee(m)};if(HO[y])return{isToken:!0,value:m};if(y.match(Ree))throw new RangeError("Format string contains an unescaped latin alphabet character `"+y+"`");return{isToken:!1,value:m}});i.localize.preprocessor&&(f=i.localize.preprocessor(c,f));const h={firstWeekContainsDate:o,weekStartsOn:l,locale:i};return f.map(m=>{if(!m.isToken)return m.value;const y=m.value;(Tee(y)||Aee(y))&&Oee(y,t,String(e));const x=HO[y[0]];return x(c,y,i.localize,h)}).join("")}function Dee(e){const t=e.match(Lee);return t?t[1].replace(Nee,"'"):e}function kee(e,t,n){const r=om(),i=n?.locale??r.locale??bD,o=2520,l=Ig(e,t);if(isNaN(l))throw new RangeError("Invalid time value");const c=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:l}),[f,h]=Qu(n?.in,...l>0?[t,e]:[e,t]),m=DJ(h,f),y=(df(h)-df(f))/1e3,x=Math.round((m-y)/60);let b;if(x<2)return x===0?i.formatDistance("lessThanXMinutes",1,c):i.formatDistance("xMinutes",x,c);if(x<45)return i.formatDistance("xMinutes",x,c);if(x<90)return i.formatDistance("aboutXHours",1,c);if(x+St(t)}function mv(e,t){return+St(e)<+St(t)}function mw(e,t){return+St(e)==+St(t)}function Bee(e,t,n){const r=+St(e,n?.in),[i,o]=[+St(t.start,n?.in),+St(t.end,n?.in)].sort((l,c)=>l-c);return r>=i&&r<=o}function pv(e,t,n){return gS(e,-t,n)}function xl(e,t){const n=()=>Tr(t?.in,NaN),i=Hee(e);let o;if(i.date){const h=qee(i.date,2);o=Gee(h.restDateString,h.year)}if(!o||isNaN(+o))return n();const l=+o;let c=0,f;if(i.time&&(c=Yee(i.time),isNaN(c)))return n();if(i.timezone){if(f=Wee(i.timezone),isNaN(f))return n()}else{const h=new Date(l+c),m=St(0,t?.in);return m.setFullYear(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate()),m.setHours(h.getUTCHours(),h.getUTCMinutes(),h.getUTCSeconds(),h.getUTCMilliseconds()),m}return St(l+c+f,t?.in)}const lg={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Fee=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,$ee=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Vee=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Hee(e){const t={},n=e.split(lg.dateTimeDelimiter);let r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],lg.timeZoneDelimiter.test(t.date)&&(t.date=e.split(lg.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){const i=lg.timezone.exec(r);i?(t.time=r.replace(i[1],""),t.timezone=i[1]):t.time=r}return t}function qee(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};const i=r[1]?parseInt(r[1]):null,o=r[2]?parseInt(r[2]):null;return{year:o===null?i:o*100,restDateString:e.slice((r[1]||r[2]).length)}}function Gee(e,t){if(t===null)return new Date(NaN);const n=e.match(Fee);if(!n)return new Date(NaN);const r=!!n[4],i=eh(n[1]),o=eh(n[2])-1,l=eh(n[3]),c=eh(n[4]),f=eh(n[5])-1;if(r)return Jee(t,c,f)?Kee(t,c,f):new Date(NaN);{const h=new Date(0);return!Xee(t,o,l)||!Qee(t,i)?new Date(NaN):(h.setUTCFullYear(t,o,Math.max(i,l)),h)}}function eh(e){return e?parseInt(e):1}function Yee(e){const t=e.match($ee);if(!t)return NaN;const n=Wb(t[1]),r=Wb(t[2]),i=Wb(t[3]);return ete(n,r,i)?n*pS+r*mD+i*1e3:NaN}function Wb(e){return e&&parseFloat(e.replace(",","."))||0}function Wee(e){if(e==="Z")return 0;const t=e.match(Vee);if(!t)return 0;const n=t[1]==="+"?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return tte(r,i)?n*(r*pS+i*mD):NaN}function Kee(e,t,n){const r=new Date(0);r.setUTCFullYear(e,0,4);const i=r.getUTCDay()||7,o=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+o),r}const Zee=[31,null,31,30,31,30,31,31,30,31,30,31];function _D(e){return e%400===0||e%4===0&&e%100!==0}function Xee(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Zee[t]||(_D(e)?29:28))}function Qee(e,t){return t>=1&&t<=(_D(e)?366:365)}function Jee(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function ete(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function tte(e,t){return t>=0&&t<=59}var zg={exports:{}},nte=zg.exports,WO;function rte(){return WO||(WO=1,function(e,t){(function(n,r){e.exports=r()})(nte,()=>(()=>{var n={873:(l,c)=>{var f,h,m=function(){var y=function(se,ue){var Y=se,k=O[ue],z=null,H=0,I=null,j=[],q={},ee=function(V,Z){z=function(ne){for(var me=new Array(ne),ie=0;ie=7&&ve(V),I==null&&(I=G(Y,k,j)),R(I,Z)},le=function(V,Z){for(var ne=-1;ne<=7;ne+=1)if(!(V+ne<=-1||H<=V+ne))for(var me=-1;me<=7;me+=1)Z+me<=-1||H<=Z+me||(z[V+ne][Z+me]=0<=ne&&ne<=6&&(me==0||me==6)||0<=me&&me<=6&&(ne==0||ne==6)||2<=ne&&ne<=4&&2<=me&&me<=4)},pe=function(){for(var V=8;V>ne&1)==1;z[Math.floor(ne/3)][ne%3+H-8-3]=me}for(ne=0;ne<18;ne+=1)me=!V&&(Z>>ne&1)==1,z[ne%3+H-8-3][Math.floor(ne/3)]=me},D=function(V,Z){for(var ne=k<<3|Z,me=P.getBCHTypeInfo(ne),ie=0;ie<15;ie+=1){var xe=!V&&(me>>ie&1)==1;ie<6?z[ie][8]=xe:ie<8?z[ie+1][8]=xe:z[H-15+ie][8]=xe}for(ie=0;ie<15;ie+=1)xe=!V&&(me>>ie&1)==1,ie<8?z[8][H-ie-1]=xe:ie<9?z[8][15-ie-1+1]=xe:z[8][15-ie-1]=xe;z[H-8][8]=!V},R=function(V,Z){for(var ne=-1,me=H-1,ie=7,xe=0,Ee=P.getMaskFunction(Z),Me=H-1;Me>0;Me-=2)for(Me==6&&(Me-=1);;){for(var Ue=0;Ue<2;Ue+=1)if(z[me][Me-Ue]==null){var ke=!1;xe>>ie&1)==1),Ee(me,Me-Ue)&&(ke=!ke),z[me][Me-Ue]=ke,(ie-=1)==-1&&(xe+=1,ie=7)}if((me+=ne)<0||H<=me){me-=ne,ne=-ne;break}}},G=function(V,Z,ne){for(var me=U.getRSBlocks(V,Z),ie=W(),xe=0;xe8*Me)throw"code length overflow. ("+ie.getLengthInBits()+">"+8*Me+")";for(ie.getLengthInBits()+4<=8*Me&&ie.put(0,4);ie.getLengthInBits()%8!=0;)ie.putBit(!1);for(;!(ie.getLengthInBits()>=8*Me||(ie.put(236,8),ie.getLengthInBits()>=8*Me));)ie.put(17,8);return function(Ue,ke){for(var Ve=0,ot=0,Ge=0,Qe=new Array(ke.length),We=new Array(ke.length),ze=0;ze=0?Ot.getAt(gt):0}}var $t=0;for(at=0;atke)&&(Ee=ke,Me=Ue)}return Me}())},q.createTableTag=function(V,Z){V=V||2;var ne="";ne+='";for(var ie=0;ie';ne+=""}return(ne+="")+"
"},q.createSvgTag=function(V,Z,ne,me){var ie={};typeof arguments[0]=="object"&&(V=(ie=arguments[0]).cellSize,Z=ie.margin,ne=ie.alt,me=ie.title),V=V||2,Z=Z===void 0?4*V:Z,(ne=typeof ne=="string"?{text:ne}:ne||{}).text=ne.text||null,ne.id=ne.text?ne.id||"qrcode-description":null,(me=typeof me=="string"?{text:me}:me||{}).text=me.text||null,me.id=me.text?me.id||"qrcode-title":null;var xe,Ee,Me,Ue,ke=q.getModuleCount()*V+2*Z,Ve="";for(Ue="l"+V+",0 0,"+V+" -"+V+",0 0,-"+V+"z ",Ve+=''+te(me.text)+"":"",Ve+=ne.text?''+te(ne.text)+"":"",Ve+='',Ve+='"},q.createDataURL=function(V,Z){V=V||2,Z=Z===void 0?4*V:Z;var ne=q.getModuleCount()*V+2*Z,me=Z,ie=ne-Z;return we(ne,ne,function(xe,Ee){if(me<=xe&&xe"};var te=function(V){for(var Z="",ne=0;ne":Z+=">";break;case"&":Z+="&";break;case'"':Z+=""";break;default:Z+=me}}return Z};return q.createASCII=function(V,Z){if((V=V||1)<2)return function(Qe){Qe=Qe===void 0?2:Qe;var We,ze,nt,Pt,at,Lt=1*q.getModuleCount()+2*Qe,Ot=Qe,gt=Lt-Qe,$t={"██":"█","█ ":"▀"," █":"▄"," ":" "},On={"██":"▀","█ ":"▀"," █":" "," ":" "},vt="";for(We=0;We=gt?On[at]:$t[at];vt+=` `}return Lt%2&&Qe>0?vt.substring(0,vt.length-Lt-1)+Array(Lt+1).join("▀"):vt.substring(0,vt.length-1)}(Z);V-=1,Z=Z===void 0?2*V:Z;var ne,me,ie,xe,Ee=q.getModuleCount()*V+2*Z,Me=Z,Ue=Ee-Z,ke=Array(V+1).join("██"),Ve=Array(V+1).join(" "),ot="",Ge="";for(ne=0;ne"u" A`).concat(r,",").concat(r,",0,").concat(+(ce>180),",").concat(+(m>0),",").concat(N.x,",").concat(N.y,` A`).concat(o,",").concat(o,",0,0,").concat(+(m<0),",").concat(F.x,",").concat(F.y,"Z")}else P+="L".concat(t,",").concat(n,"Z");return P},Lae={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Nk=e=>{var t=sr(e,Lae),{cx:n,cy:r,innerRadius:i,outerRadius:o,cornerRadius:l,forceCornerRadius:c,cornerIsExternal:f,startAngle:h,endAngle:m,className:y}=t;if(o0&&Math.abs(h-m)<360?_=Pae({cx:n,cy:r,innerRadius:i,outerRadius:o,cornerRadius:Math.min(C,b/2),forceCornerRadius:c,cornerIsExternal:f,startAngle:h,endAngle:m}):_=Lk({cx:n,cy:r,innerRadius:i,outerRadius:o,startAngle:h,endAngle:m}),w.createElement("path",Mw({},zr(t),{className:x,d:_}))};function Nae(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(KD(t)){if(e==="centric"){var{cx:r,cy:i,innerRadius:o,outerRadius:l,angle:c}=t,f=Kn(r,i,o,c),h=Kn(r,i,l,c);return[{x:f.x,y:f.y},{x:h.x,y:h.y}]}return Pk(t)}}var Xx={},Qx={},Jx={},BM;function Rae(){return BM||(BM=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ak();function n(r){return t.isSymbol(r)?NaN:Number(r)}e.toNumber=n}(Jx)),Jx}var FM;function Dae(){return FM||(FM=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Rae();function n(r){return r?(r=t.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}e.toFinite=n}(Qx)),Qx}var $M;function kae(){return $M||($M=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ok(),n=Dae();function r(i,o,l){l&&typeof l!="number"&&t.isIterateeCall(i,o,l)&&(o=l=void 0),i=n.toFinite(i),o===void 0?(o=i,i=0):o=n.toFinite(o),l=l===void 0?it?1:e>=t?0:NaN}function Uae(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function LS(e){let t,n,r;e.length!==2?(t=ll,n=(c,f)=>ll(e(c),f),r=(c,f)=>e(c)-f):(t=e===ll||e===Uae?e:Bae,n=e,r=e);function i(c,f,h=0,m=c.length){if(h>>1;n(c[y],f)<0?h=y+1:m=y}while(h>>1;n(c[y],f)<=0?h=y+1:m=y}while(hh&&r(c[y-1],f)>-r(c[y],f)?y-1:y}return{left:i,center:l,right:o}}function Bae(){return 0}function Dk(e){return e===null?NaN:+e}function*Fae(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const $ae=LS(ll),dm=$ae.right;LS(Dk).center;class HM extends Map{constructor(t,n=qae){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(qM(this,t))}has(t){return super.has(qM(this,t))}set(t,n){return super.set(Vae(this,t),n)}delete(t){return super.delete(Hae(this,t))}}function qM({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Vae({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Hae({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function qae(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Gae(e=ll){if(e===ll)return kk;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function kk(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const Yae=Math.sqrt(50),Wae=Math.sqrt(10),Kae=Math.sqrt(2);function Tv(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),l=o>=Yae?10:o>=Wae?5:o>=Kae?2:1;let c,f,h;return i<0?(h=Math.pow(10,-i)/l,c=Math.round(e*h),f=Math.round(t*h),c/ht&&--f,h=-h):(h=Math.pow(10,i)*l,c=Math.round(e/h),f=Math.round(t/h),c*ht&&--f),f0))return[];if(e===t)return[e];const r=t=i))return[];const c=o-i+1,f=new Array(c);if(r)if(l<0)for(let h=0;h=r)&&(n=r);return n}function YM(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function Ik(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?kk:Gae(i);r>n;){if(r-n>600){const f=r-n+1,h=t-n+1,m=Math.log(f),y=.5*Math.exp(2*m/3),x=.5*Math.sqrt(m*y*(f-y)/f)*(h-f/2<0?-1:1),b=Math.max(n,Math.floor(t-h*y/f+x)),C=Math.min(r,Math.floor(t+(f-h)*y/f+x));Ik(e,t,b,C,i)}const o=e[t];let l=n,c=r;for(ih(e,n,t),i(e[r],o)>0&&ih(e,n,r);l0;)--c}i(e[n],o)===0?ih(e,n,c):(++c,ih(e,c,r)),c<=t&&(n=c+1),t<=c&&(r=c-1)}return e}function ih(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Zae(e,t,n){if(e=Float64Array.from(Fae(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return YM(e);if(t>=1)return GM(e);var r,i=(r-1)*t,o=Math.floor(i),l=GM(Ik(e,o).subarray(0,o+1)),c=YM(e.subarray(o+1));return l+(c-l)*(i-o)}}function Xae(e,t,n=Dk){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),l=+n(e[o],o,e),c=+n(e[o+1],o+1,e);return l+(c-l)*(i-o)}}function Qae(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?mg(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?mg(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=toe.exec(e))?new fi(t[1],t[2],t[3],1):(t=noe.exec(e))?new fi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=roe.exec(e))?mg(t[1],t[2],t[3],t[4]):(t=ioe.exec(e))?mg(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=aoe.exec(e))?eP(t[1],t[2]/100,t[3]/100,1):(t=ooe.exec(e))?eP(t[1],t[2]/100,t[3]/100,t[4]):WM.hasOwnProperty(e)?XM(WM[e]):e==="transparent"?new fi(NaN,NaN,NaN,0):null}function XM(e){return new fi(e>>16&255,e>>8&255,e&255,1)}function mg(e,t,n,r){return r<=0&&(e=t=n=NaN),new fi(e,t,n,r)}function uoe(e){return e instanceof hm||(e=Fh(e)),e?(e=e.rgb(),new fi(e.r,e.g,e.b,e.opacity)):new fi}function Dw(e,t,n,r){return arguments.length===1?uoe(e):new fi(e,t,n,r??1)}function fi(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}DS(fi,Dw,Uk(hm,{brighter(e){return e=e==null?Ov:Math.pow(Ov,e),new fi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Uh:Math.pow(Uh,e),new fi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new fi(Pu(this.r),Pu(this.g),Pu(this.b),jv(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:QM,formatHex:QM,formatHex8:coe,formatRgb:JM,toString:JM}));function QM(){return`#${Au(this.r)}${Au(this.g)}${Au(this.b)}`}function coe(){return`#${Au(this.r)}${Au(this.g)}${Au(this.b)}${Au((isNaN(this.opacity)?1:this.opacity)*255)}`}function JM(){const e=jv(this.opacity);return`${e===1?"rgb(":"rgba("}${Pu(this.r)}, ${Pu(this.g)}, ${Pu(this.b)}${e===1?")":`, ${e})`}`}function jv(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Pu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Au(e){return e=Pu(e),(e<16?"0":"")+e.toString(16)}function eP(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new wa(e,t,n,r)}function Bk(e){if(e instanceof wa)return new wa(e.h,e.s,e.l,e.opacity);if(e instanceof hm||(e=Fh(e)),!e)return new wa;if(e instanceof wa)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),l=NaN,c=o-i,f=(o+i)/2;return c?(t===o?l=(n-r)/c+(n0&&f<1?0:l,new wa(l,c,f,e.opacity)}function foe(e,t,n,r){return arguments.length===1?Bk(e):new wa(e,t,n,r??1)}function wa(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}DS(wa,foe,Uk(hm,{brighter(e){return e=e==null?Ov:Math.pow(Ov,e),new wa(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Uh:Math.pow(Uh,e),new wa(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new fi(t2(e>=240?e-240:e+120,i,r),t2(e,i,r),t2(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new wa(tP(this.h),pg(this.s),pg(this.l),jv(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=jv(this.opacity);return`${e===1?"hsl(":"hsla("}${tP(this.h)}, ${pg(this.s)*100}%, ${pg(this.l)*100}%${e===1?")":`, ${e})`}`}}));function tP(e){return e=(e||0)%360,e<0?e+360:e}function pg(e){return Math.max(0,Math.min(1,e||0))}function t2(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const kS=e=>()=>e;function doe(e,t){return function(n){return e+n*t}}function hoe(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function moe(e){return(e=+e)==1?Fk:function(t,n){return n-t?hoe(t,n,e):kS(isNaN(t)?n:t)}}function Fk(e,t){var n=t-e;return n?doe(e,n):kS(isNaN(e)?t:e)}const nP=function e(t){var n=moe(t);function r(i,o){var l=n((i=Dw(i)).r,(o=Dw(o)).r),c=n(i.g,o.g),f=n(i.b,o.b),h=Fk(i.opacity,o.opacity);return function(m){return i.r=l(m),i.g=c(m),i.b=f(m),i.opacity=h(m),i+""}}return r.gamma=e,r}(1);function poe(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;in&&(o=t.slice(n,o),c[l]?c[l]+=o:c[++l]=o),(r=r[0])===(i=i[0])?c[l]?c[l]+=i:c[++l]=i:(c[++l]=null,f.push({i:l,x:Mv(r,i)})),n=n2.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Aoe(e,t,n){var r=e[0],i=e[1],o=t[0],l=t[1];return i2?Toe:Aoe,f=h=null,y}function y(x){return x==null||isNaN(x=+x)?o:(f||(f=c(e.map(r),t,n)))(r(l(x)))}return y.invert=function(x){return l(i((h||(h=c(t,e.map(r),Mv)))(x)))},y.domain=function(x){return arguments.length?(e=Array.from(x,Pv),m()):e.slice()},y.range=function(x){return arguments.length?(t=Array.from(x),m()):t.slice()},y.rangeRound=function(x){return t=Array.from(x),n=IS,m()},y.clamp=function(x){return arguments.length?(l=x?!0:qr,m()):l!==qr},y.interpolate=function(x){return arguments.length?(n=x,m()):n},y.unknown=function(x){return arguments.length?(o=x,y):o},function(x,b){return r=x,i=b,m()}}function zS(){return qy()(qr,qr)}function Ooe(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Lv(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function gf(e){return e=Lv(Math.abs(e)),e?e[1]:NaN}function joe(e,t){return function(n,r){for(var i=n.length,o=[],l=0,c=e[0],f=0;i>0&&c>0&&(f+c+1>r&&(c=Math.max(1,r-f)),o.push(n.substring(i-=c,i+c)),!((f+=c+1)>r));)c=e[l=(l+1)%e.length];return o.reverse().join(t)}}function Moe(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Poe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $h(e){if(!(t=Poe.exec(e)))throw new Error("invalid format: "+e);var t;return new US({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}$h.prototype=US.prototype;function US(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}US.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Loe(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var $k;function Noe(e,t){var n=Lv(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-($k=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,l=r.length;return o===l?r:o>l?r+new Array(o-l+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Lv(e,Math.max(0,t+o-1))[0]}function iP(e,t){var n=Lv(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const aP={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Ooe,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>iP(e*100,t),r:iP,s:Noe,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function oP(e){return e}var sP=Array.prototype.map,lP=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Roe(e){var t=e.grouping===void 0||e.thousands===void 0?oP:joe(sP.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?oP:Moe(sP.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",c=e.minus===void 0?"−":e.minus+"",f=e.nan===void 0?"NaN":e.nan+"";function h(y){y=$h(y);var x=y.fill,b=y.align,C=y.sign,_=y.symbol,A=y.zero,O=y.width,P=y.comma,N=y.precision,F=y.trim,U=y.type;U==="n"?(P=!0,U="g"):aP[U]||(N===void 0&&(N=12),F=!0,U="g"),(A||x==="0"&&b==="=")&&(A=!0,x="0",b="=");var W=_==="$"?n:_==="#"&&/[boxX]/.test(U)?"0"+U.toLowerCase():"",X=_==="$"?r:/[%p]/.test(U)?l:"",ae=aP[U],ce=/[defgprs%]/.test(U);N=N===void 0?6:/[gprs]/.test(U)?Math.max(1,Math.min(21,N)):Math.max(0,Math.min(20,N));function re(J){var oe=W,we=X,se,ue,Y;if(U==="c")we=ae(J)+we,J="";else{J=+J;var k=J<0||1/J<0;if(J=isNaN(J)?f:ae(Math.abs(J),N),F&&(J=Loe(J)),k&&+J==0&&C!=="+"&&(k=!1),oe=(k?C==="("?C:c:C==="-"||C==="("?"":C)+oe,we=(U==="s"?lP[8+$k/3]:"")+we+(k&&C==="("?")":""),ce){for(se=-1,ue=J.length;++seY||Y>57){we=(Y===46?i+J.slice(se+1):J.slice(se))+we,J=J.slice(0,se);break}}}P&&!A&&(J=t(J,1/0));var z=oe.length+J.length+we.length,H=z>1)+oe+J+we+H.slice(z);break;default:J=H+oe+J+we;break}return o(J)}return re.toString=function(){return y+""},re}function m(y,x){var b=h((y=$h(y),y.type="f",y)),C=Math.max(-8,Math.min(8,Math.floor(gf(x)/3)))*3,_=Math.pow(10,-C),A=lP[8+C/3];return function(O){return b(_*O)+A}}return{format:h,formatPrefix:m}}var gg,BS,Vk;Doe({thousands:",",grouping:[3],currency:["$",""]});function Doe(e){return gg=Roe(e),BS=gg.format,Vk=gg.formatPrefix,gg}function koe(e){return Math.max(0,-gf(Math.abs(e)))}function Ioe(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(gf(t)/3)))*3-gf(Math.abs(e)))}function zoe(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,gf(t)-gf(e))+1}function Hk(e,t,n,r){var i=Nw(e,t,n),o;switch(r=$h(r??",f"),r.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=Ioe(i,l))&&(r.precision=o),Vk(r,l)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=zoe(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=koe(i))&&(r.precision=o-(r.type==="%")*2);break}}return BS(r)}function Pl(e){var t=e.domain;return e.ticks=function(n){var r=t();return Pw(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return Hk(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,l=r[i],c=r[o],f,h,m=10;for(c0;){if(h=Lw(l,c,n),h===f)return r[i]=l,r[o]=c,t(r);if(h>0)l=Math.floor(l/h)*h,c=Math.ceil(c/h)*h;else if(h<0)l=Math.ceil(l*h)/h,c=Math.floor(c*h)/h;else break;f=h}return e},e}function qk(){var e=zS();return e.copy=function(){return mm(e,qk())},sa.apply(e,arguments),Pl(e)}function Gk(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Pv),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Gk(e).unknown(t)},e=arguments.length?Array.from(e,Pv):[0,1],Pl(n)}function Yk(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],o=e[r],l;return oMath.pow(e,t)}function Voe(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function fP(e){return(t,n)=>-e(-t,n)}function FS(e){const t=e(uP,cP),n=t.domain;let r=10,i,o;function l(){return i=Voe(r),o=$oe(r),n()[0]<0?(i=fP(i),o=fP(o),e(Uoe,Boe)):e(uP,cP),t}return t.base=function(c){return arguments.length?(r=+c,l()):r},t.domain=function(c){return arguments.length?(n(c),l()):n()},t.ticks=c=>{const f=n();let h=f[0],m=f[f.length-1];const y=m0){for(;x<=b;++x)for(C=1;Cm)break;O.push(_)}}else for(;x<=b;++x)for(C=r-1;C>=1;--C)if(_=x>0?C/o(-x):C*o(x),!(_m)break;O.push(_)}O.length*2{if(c==null&&(c=10),f==null&&(f=r===10?"s":","),typeof f!="function"&&(!(r%1)&&(f=$h(f)).precision==null&&(f.trim=!0),f=BS(f)),c===1/0)return f;const h=Math.max(1,r*c/t.ticks().length);return m=>{let y=m/o(Math.round(i(m)));return y*rn(Yk(n(),{floor:c=>o(Math.floor(i(c))),ceil:c=>o(Math.ceil(i(c)))})),t}function Wk(){const e=FS(qy()).domain([1,10]);return e.copy=()=>mm(e,Wk()).base(e.base()),sa.apply(e,arguments),e}function dP(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function hP(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function $S(e){var t=1,n=e(dP(t),hP(t));return n.constant=function(r){return arguments.length?e(dP(t=+r),hP(t)):t},Pl(n)}function Kk(){var e=$S(qy());return e.copy=function(){return mm(e,Kk()).constant(e.constant())},sa.apply(e,arguments)}function mP(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Hoe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function qoe(e){return e<0?-e*e:e*e}function VS(e){var t=e(qr,qr),n=1;function r(){return n===1?e(qr,qr):n===.5?e(Hoe,qoe):e(mP(n),mP(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Pl(t)}function HS(){var e=VS(qy());return e.copy=function(){return mm(e,HS()).exponent(e.exponent())},sa.apply(e,arguments),e}function Goe(){return HS.apply(null,arguments).exponent(.5)}function pP(e){return Math.sign(e)*e*e}function Yoe(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function Zk(){var e=zS(),t=[0,1],n=!1,r;function i(o){var l=Yoe(e(o));return isNaN(l)?r:n?Math.round(l):l}return i.invert=function(o){return e.invert(pP(o))},i.domain=function(o){return arguments.length?(e.domain(o),i):e.domain()},i.range=function(o){return arguments.length?(e.range((t=Array.from(o,Pv)).map(pP)),i):t.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(n=!!o,i):n},i.clamp=function(o){return arguments.length?(e.clamp(o),i):e.clamp()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return Zk(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},sa.apply(i,arguments),Pl(i)}function Xk(){var e=[],t=[],n=[],r;function i(){var l=0,c=Math.max(1,t.length);for(n=new Array(c-1);++l0?n[c-1]:e[0],c=n?[r[n-1],t]:[r[h-1],r[h]]},l.unknown=function(f){return arguments.length&&(o=f),l},l.thresholds=function(){return r.slice()},l.copy=function(){return Qk().domain([e,t]).range(i).unknown(o)},sa.apply(Pl(l),arguments)}function Jk(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[dm(e,o,0,r)]:n}return i.domain=function(o){return arguments.length?(e=Array.from(o),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var l=t.indexOf(o);return[e[l-1],e[l]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return Jk().domain(e).range(t).unknown(n)},sa.apply(i,arguments)}const r2=new Date,i2=new Date;function ur(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{const l=i(o),c=i.ceil(o);return o-l(t(o=new Date(+o),l==null?1:Math.floor(l)),o),i.range=(o,l,c)=>{const f=[];if(o=i.ceil(o),c=c==null?1:Math.floor(c),!(o0))return f;let h;do f.push(h=new Date(+o)),t(o,c),e(o);while(hur(l=>{if(l>=l)for(;e(l),!o(l);)l.setTime(l-1)},(l,c)=>{if(l>=l)if(c<0)for(;++c<=0;)for(;t(l,-1),!o(l););else for(;--c>=0;)for(;t(l,1),!o(l););}),n&&(i.count=(o,l)=>(r2.setTime(+o),i2.setTime(+l),e(r2),e(i2),Math.floor(n(r2,i2))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?l=>r(l)%o===0:l=>i.count(0,l)%o===0):i)),i}const Nv=ur(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Nv.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ur(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Nv);Nv.range;const Bo=1e3,na=Bo*60,Fo=na*60,Jo=Fo*24,qS=Jo*7,gP=Jo*30,a2=Jo*365,Tu=ur(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Bo)},(e,t)=>(t-e)/Bo,e=>e.getUTCSeconds());Tu.range;const GS=ur(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Bo)},(e,t)=>{e.setTime(+e+t*na)},(e,t)=>(t-e)/na,e=>e.getMinutes());GS.range;const YS=ur(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*na)},(e,t)=>(t-e)/na,e=>e.getUTCMinutes());YS.range;const WS=ur(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Bo-e.getMinutes()*na)},(e,t)=>{e.setTime(+e+t*Fo)},(e,t)=>(t-e)/Fo,e=>e.getHours());WS.range;const KS=ur(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Fo)},(e,t)=>(t-e)/Fo,e=>e.getUTCHours());KS.range;const pm=ur(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*na)/Jo,e=>e.getDate()-1);pm.range;const Gy=ur(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Jo,e=>e.getUTCDate()-1);Gy.range;const e8=ur(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Jo,e=>Math.floor(e/Jo));e8.range;function ec(e){return ur(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*na)/qS)}const Yy=ec(0),Rv=ec(1),Woe=ec(2),Koe=ec(3),vf=ec(4),Zoe=ec(5),Xoe=ec(6);Yy.range;Rv.range;Woe.range;Koe.range;vf.range;Zoe.range;Xoe.range;function tc(e){return ur(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/qS)}const Wy=tc(0),Dv=tc(1),Qoe=tc(2),Joe=tc(3),yf=tc(4),ese=tc(5),tse=tc(6);Wy.range;Dv.range;Qoe.range;Joe.range;yf.range;ese.range;tse.range;const ZS=ur(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());ZS.range;const XS=ur(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());XS.range;const es=ur(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());es.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ur(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});es.range;const ts=ur(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ts.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ur(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});ts.range;function t8(e,t,n,r,i,o){const l=[[Tu,1,Bo],[Tu,5,5*Bo],[Tu,15,15*Bo],[Tu,30,30*Bo],[o,1,na],[o,5,5*na],[o,15,15*na],[o,30,30*na],[i,1,Fo],[i,3,3*Fo],[i,6,6*Fo],[i,12,12*Fo],[r,1,Jo],[r,2,2*Jo],[n,1,qS],[t,1,gP],[t,3,3*gP],[e,1,a2]];function c(h,m,y){const x=mA).right(l,x);if(b===l.length)return e.every(Nw(h/a2,m/a2,y));if(b===0)return Nv.every(Math.max(Nw(h,m,y),1));const[C,_]=l[x/l[b-1][2]53)return null;"w"in V||(V.w=1),"Z"in V?(ne=s2(ah(V.y,0,1)),me=ne.getUTCDay(),ne=me>4||me===0?Dv.ceil(ne):Dv(ne),ne=Gy.offset(ne,(V.V-1)*7),V.y=ne.getUTCFullYear(),V.m=ne.getUTCMonth(),V.d=ne.getUTCDate()+(V.w+6)%7):(ne=o2(ah(V.y,0,1)),me=ne.getDay(),ne=me>4||me===0?Rv.ceil(ne):Rv(ne),ne=pm.offset(ne,(V.V-1)*7),V.y=ne.getFullYear(),V.m=ne.getMonth(),V.d=ne.getDate()+(V.w+6)%7)}else("W"in V||"U"in V)&&("w"in V||(V.w="u"in V?V.u%7:"W"in V?1:0),me="Z"in V?s2(ah(V.y,0,1)).getUTCDay():o2(ah(V.y,0,1)).getDay(),V.m=0,V.d="W"in V?(V.w+6)%7+V.W*7-(me+5)%7:V.w+V.U*7-(me+6)%7);return"Z"in V?(V.H+=V.Z/100|0,V.M+=V.Z%100,s2(V)):o2(V)}}function ae(R,G,te,V){for(var Z=0,ne=G.length,me=te.length,ie,xe;Z=me)return-1;if(ie=G.charCodeAt(Z++),ie===37){if(ie=G.charAt(Z++),xe=U[ie in vP?G.charAt(Z++):ie],!xe||(V=xe(R,te,V))<0)return-1}else if(ie!=te.charCodeAt(V++))return-1}return V}function ce(R,G,te){var V=h.exec(G.slice(te));return V?(R.p=m.get(V[0].toLowerCase()),te+V[0].length):-1}function re(R,G,te){var V=b.exec(G.slice(te));return V?(R.w=C.get(V[0].toLowerCase()),te+V[0].length):-1}function J(R,G,te){var V=y.exec(G.slice(te));return V?(R.w=x.get(V[0].toLowerCase()),te+V[0].length):-1}function oe(R,G,te){var V=O.exec(G.slice(te));return V?(R.m=P.get(V[0].toLowerCase()),te+V[0].length):-1}function we(R,G,te){var V=_.exec(G.slice(te));return V?(R.m=A.get(V[0].toLowerCase()),te+V[0].length):-1}function se(R,G,te){return ae(R,t,G,te)}function ue(R,G,te){return ae(R,n,G,te)}function Y(R,G,te){return ae(R,r,G,te)}function k(R){return l[R.getDay()]}function z(R){return o[R.getDay()]}function H(R){return f[R.getMonth()]}function I(R){return c[R.getMonth()]}function j(R){return i[+(R.getHours()>=12)]}function q(R){return 1+~~(R.getMonth()/3)}function ee(R){return l[R.getUTCDay()]}function le(R){return o[R.getUTCDay()]}function pe(R){return f[R.getUTCMonth()]}function he(R){return c[R.getUTCMonth()]}function ve(R){return i[+(R.getUTCHours()>=12)]}function D(R){return 1+~~(R.getUTCMonth()/3)}return{format:function(R){var G=W(R+="",N);return G.toString=function(){return R},G},parse:function(R){var G=X(R+="",!1);return G.toString=function(){return R},G},utcFormat:function(R){var G=W(R+="",F);return G.toString=function(){return R},G},utcParse:function(R){var G=X(R+="",!0);return G.toString=function(){return R},G}}}var vP={"-":"",_:" ",0:"0"},br=/^\s*\d+/,sse=/^%/,lse=/[\\^$*+?|[\]().{}]/g;function zt(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o[t.toLowerCase(),n]))}function cse(e,t,n){var r=br.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function fse(e,t,n){var r=br.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function dse(e,t,n){var r=br.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function hse(e,t,n){var r=br.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function mse(e,t,n){var r=br.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function yP(e,t,n){var r=br.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function bP(e,t,n){var r=br.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function pse(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function gse(e,t,n){var r=br.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function vse(e,t,n){var r=br.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function xP(e,t,n){var r=br.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function yse(e,t,n){var r=br.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function wP(e,t,n){var r=br.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function bse(e,t,n){var r=br.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function xse(e,t,n){var r=br.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function wse(e,t,n){var r=br.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function _se(e,t,n){var r=br.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Sse(e,t,n){var r=sse.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Cse(e,t,n){var r=br.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Ese(e,t,n){var r=br.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function _P(e,t){return zt(e.getDate(),t,2)}function Ase(e,t){return zt(e.getHours(),t,2)}function Tse(e,t){return zt(e.getHours()%12||12,t,2)}function Ose(e,t){return zt(1+pm.count(es(e),e),t,3)}function n8(e,t){return zt(e.getMilliseconds(),t,3)}function jse(e,t){return n8(e,t)+"000"}function Mse(e,t){return zt(e.getMonth()+1,t,2)}function Pse(e,t){return zt(e.getMinutes(),t,2)}function Lse(e,t){return zt(e.getSeconds(),t,2)}function Nse(e){var t=e.getDay();return t===0?7:t}function Rse(e,t){return zt(Yy.count(es(e)-1,e),t,2)}function r8(e){var t=e.getDay();return t>=4||t===0?vf(e):vf.ceil(e)}function Dse(e,t){return e=r8(e),zt(vf.count(es(e),e)+(es(e).getDay()===4),t,2)}function kse(e){return e.getDay()}function Ise(e,t){return zt(Rv.count(es(e)-1,e),t,2)}function zse(e,t){return zt(e.getFullYear()%100,t,2)}function Use(e,t){return e=r8(e),zt(e.getFullYear()%100,t,2)}function Bse(e,t){return zt(e.getFullYear()%1e4,t,4)}function Fse(e,t){var n=e.getDay();return e=n>=4||n===0?vf(e):vf.ceil(e),zt(e.getFullYear()%1e4,t,4)}function $se(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+zt(t/60|0,"0",2)+zt(t%60,"0",2)}function SP(e,t){return zt(e.getUTCDate(),t,2)}function Vse(e,t){return zt(e.getUTCHours(),t,2)}function Hse(e,t){return zt(e.getUTCHours()%12||12,t,2)}function qse(e,t){return zt(1+Gy.count(ts(e),e),t,3)}function i8(e,t){return zt(e.getUTCMilliseconds(),t,3)}function Gse(e,t){return i8(e,t)+"000"}function Yse(e,t){return zt(e.getUTCMonth()+1,t,2)}function Wse(e,t){return zt(e.getUTCMinutes(),t,2)}function Kse(e,t){return zt(e.getUTCSeconds(),t,2)}function Zse(e){var t=e.getUTCDay();return t===0?7:t}function Xse(e,t){return zt(Wy.count(ts(e)-1,e),t,2)}function a8(e){var t=e.getUTCDay();return t>=4||t===0?yf(e):yf.ceil(e)}function Qse(e,t){return e=a8(e),zt(yf.count(ts(e),e)+(ts(e).getUTCDay()===4),t,2)}function Jse(e){return e.getUTCDay()}function ele(e,t){return zt(Dv.count(ts(e)-1,e),t,2)}function tle(e,t){return zt(e.getUTCFullYear()%100,t,2)}function nle(e,t){return e=a8(e),zt(e.getUTCFullYear()%100,t,2)}function rle(e,t){return zt(e.getUTCFullYear()%1e4,t,4)}function ile(e,t){var n=e.getUTCDay();return e=n>=4||n===0?yf(e):yf.ceil(e),zt(e.getUTCFullYear()%1e4,t,4)}function ale(){return"+0000"}function CP(){return"%"}function EP(e){return+e}function AP(e){return Math.floor(+e/1e3)}var Yc,o8,s8;ole({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function ole(e){return Yc=ose(e),o8=Yc.format,Yc.parse,s8=Yc.utcFormat,Yc.utcParse,Yc}function sle(e){return new Date(e)}function lle(e){return e instanceof Date?+e:+new Date(+e)}function QS(e,t,n,r,i,o,l,c,f,h){var m=zS(),y=m.invert,x=m.domain,b=h(".%L"),C=h(":%S"),_=h("%I:%M"),A=h("%I %p"),O=h("%a %d"),P=h("%b %d"),N=h("%B"),F=h("%Y");function U(W){return(f(W)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,o)=>Zae(e,o/r))},n.copy=function(){return f8(t).domain(e)},fs.apply(n,arguments)}function Zy(){var e=0,t=.5,n=1,r=1,i,o,l,c,f,h=qr,m,y=!1,x;function b(_){return isNaN(_=+_)?x:(_=.5+((_=+m(_))-o)*(r*_e.chartData,tC=Ce([Nl],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Xy=(e,t,n,r)=>r?tC(e):Nl(e);function Hu(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(Bn(t)&&Bn(n))return!0}return!1}function TP(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function p8(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,o;if(Bn(n))i=n;else if(typeof n=="function")return;if(Bn(r))o=r;else if(typeof r=="function")return;var l=[i,o];if(Hu(l))return l}}function hle(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(Hu(r))return TP(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,o]=e,l,c;if(i==="auto")t!=null&&(l=Math.min(...t));else if(Xe(i))l=i;else if(typeof i=="function")try{t!=null&&(l=i(t?.[0]))}catch{}else if(typeof i=="string"&&uM.test(i)){var f=uM.exec(i);if(f==null||t==null)l=void 0;else{var h=+f[1];l=t[0]-h}}else l=t?.[0];if(o==="auto")t!=null&&(c=Math.max(...t));else if(Xe(o))c=o;else if(typeof o=="function")try{t!=null&&(c=o(t?.[1]))}catch{}else if(typeof o=="string"&&cM.test(o)){var m=cM.exec(o);if(m==null||t==null)c=void 0;else{var y=+m[1];c=t[1]+y}}else c=t?.[1];var x=[l,c];if(Hu(x))return t==null?x:TP(x,t,n)}}}var kf=1e9,mle={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},rC,gn=!0,ra="[DecimalError] ",Lu=ra+"Invalid argument: ",nC=ra+"Exponent out of range: ",If=Math.floor,_u=Math.pow,ple=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Oi,vr=1e7,on=7,g8=9007199254740991,kv=If(g8/on),Ye={};Ye.absoluteValue=Ye.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};Ye.comparedTo=Ye.cmp=function(e){var t,n,r,i,o=this;if(e=new o.constructor(e),o.s!==e.s)return o.s||-e.s;if(o.e!==e.e)return o.e>e.e^o.s<0?1:-1;for(r=o.d.length,i=e.d.length,t=0,n=re.d[t]^o.s<0?1:-1;return r===i?0:r>i^o.s<0?1:-1};Ye.decimalPlaces=Ye.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*on;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Ye.dividedBy=Ye.div=function(e){return Ho(this,new this.constructor(e))};Ye.dividedToIntegerBy=Ye.idiv=function(e){var t=this,n=t.constructor;return Jt(Ho(t,new n(e),0,1),n.precision)};Ye.equals=Ye.eq=function(e){return!this.cmp(e)};Ye.exponent=function(){return Zn(this)};Ye.greaterThan=Ye.gt=function(e){return this.cmp(e)>0};Ye.greaterThanOrEqualTo=Ye.gte=function(e){return this.cmp(e)>=0};Ye.isInteger=Ye.isint=function(){return this.e>this.d.length-2};Ye.isNegative=Ye.isneg=function(){return this.s<0};Ye.isPositive=Ye.ispos=function(){return this.s>0};Ye.isZero=function(){return this.s===0};Ye.lessThan=Ye.lt=function(e){return this.cmp(e)<0};Ye.lessThanOrEqualTo=Ye.lte=function(e){return this.cmp(e)<1};Ye.logarithm=Ye.log=function(e){var t,n=this,r=n.constructor,i=r.precision,o=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(Oi))throw Error(ra+"NaN");if(n.s<1)throw Error(ra+(n.s?"NaN":"-Infinity"));return n.eq(Oi)?new r(0):(gn=!1,t=Ho(Vh(n,o),Vh(e,o),o),gn=!0,Jt(t,i))};Ye.minus=Ye.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?b8(t,e):v8(t,(e.s=-e.s,e))};Ye.modulo=Ye.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(ra+"NaN");return n.s?(gn=!1,t=Ho(n,e,0,1).times(e),gn=!0,n.minus(t)):Jt(new r(n),i)};Ye.naturalExponential=Ye.exp=function(){return y8(this)};Ye.naturalLogarithm=Ye.ln=function(){return Vh(this)};Ye.negated=Ye.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Ye.plus=Ye.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?v8(t,e):b8(t,(e.s=-e.s,e))};Ye.precision=Ye.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Lu+e);if(t=Zn(i)+1,r=i.d.length-1,n=r*on+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};Ye.squareRoot=Ye.sqrt=function(){var e,t,n,r,i,o,l,c=this,f=c.constructor;if(c.s<1){if(!c.s)return new f(0);throw Error(ra+"NaN")}for(e=Zn(c),gn=!1,i=Math.sqrt(+c),i==0||i==1/0?(t=eo(c.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=If((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new f(t)):r=new f(i.toString()),n=f.precision,i=l=n+3;;)if(o=r,r=o.plus(Ho(c,o,l+2)).times(.5),eo(o.d).slice(0,l)===(t=eo(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),i==l&&t=="4999"){if(Jt(o,n+1,0),o.times(o).eq(c)){r=o;break}}else if(t!="9999")break;l+=4}return gn=!0,Jt(r,n)};Ye.times=Ye.mul=function(e){var t,n,r,i,o,l,c,f,h,m=this,y=m.constructor,x=m.d,b=(e=new y(e)).d;if(!m.s||!e.s)return new y(0);for(e.s*=m.s,n=m.e+e.e,f=x.length,h=b.length,f=0;){for(t=0,i=f+r;i>r;)c=o[i]+b[r]*x[i-r-1]+t,o[i--]=c%vr|0,t=c/vr|0;o[i]=(o[i]+t)%vr|0}for(;!o[--l];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,gn?Jt(e,y.precision):e};Ye.toDecimalPlaces=Ye.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(oo(e,0,kf),t===void 0?t=r.rounding:oo(t,0,8),Jt(n,e+Zn(n)+1,t))};Ye.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=qu(r,!0):(oo(e,0,kf),t===void 0?t=i.rounding:oo(t,0,8),r=Jt(new i(r),e+1,t),n=qu(r,!0,e+1)),n};Ye.toFixed=function(e,t){var n,r,i=this,o=i.constructor;return e===void 0?qu(i):(oo(e,0,kf),t===void 0?t=o.rounding:oo(t,0,8),r=Jt(new o(i),e+Zn(i)+1,t),n=qu(r.abs(),!1,e+Zn(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Ye.toInteger=Ye.toint=function(){var e=this,t=e.constructor;return Jt(new t(e),Zn(e)+1,t.rounding)};Ye.toNumber=function(){return+this};Ye.toPower=Ye.pow=function(e){var t,n,r,i,o,l,c=this,f=c.constructor,h=12,m=+(e=new f(e));if(!e.s)return new f(Oi);if(c=new f(c),!c.s){if(e.s<1)throw Error(ra+"Infinity");return c}if(c.eq(Oi))return c;if(r=f.precision,e.eq(Oi))return Jt(c,r);if(t=e.e,n=e.d.length-1,l=t>=n,o=c.s,l){if((n=m<0?-m:m)<=g8){for(i=new f(Oi),t=Math.ceil(r/on+4),gn=!1;n%2&&(i=i.times(c),jP(i.d,t)),n=If(n/2),n!==0;)c=c.times(c),jP(c.d,t);return gn=!0,e.s<0?new f(Oi).div(i):Jt(i,r)}}else if(o<0)throw Error(ra+"NaN");return o=o<0&&e.d[Math.max(t,n)]&1?-1:1,c.s=1,gn=!1,i=e.times(Vh(c,r+h)),gn=!0,i=y8(i),i.s=o,i};Ye.toPrecision=function(e,t){var n,r,i=this,o=i.constructor;return e===void 0?(n=Zn(i),r=qu(i,n<=o.toExpNeg||n>=o.toExpPos)):(oo(e,1,kf),t===void 0?t=o.rounding:oo(t,0,8),i=Jt(new o(i),e,t),n=Zn(i),r=qu(i,e<=n||n<=o.toExpNeg,e)),r};Ye.toSignificantDigits=Ye.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(oo(e,1,kf),t===void 0?t=r.rounding:oo(t,0,8)),Jt(new r(n),e,t)};Ye.toString=Ye.valueOf=Ye.val=Ye.toJSON=Ye[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Zn(e),n=e.constructor;return qu(e,t<=n.toExpNeg||t>=n.toExpPos)};function v8(e,t){var n,r,i,o,l,c,f,h,m=e.constructor,y=m.precision;if(!e.s||!t.s)return t.s||(t=new m(e)),gn?Jt(t,y):t;if(f=e.d,h=t.d,l=e.e,i=t.e,f=f.slice(),o=l-i,o){for(o<0?(r=f,o=-o,c=h.length):(r=h,i=l,c=f.length),l=Math.ceil(y/on),c=l>c?l+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=f.length,o=h.length,c-o<0&&(o=c,r=h,h=f,f=r),n=0;o;)n=(f[--o]=f[o]+h[o]+n)/vr|0,f[o]%=vr;for(n&&(f.unshift(n),++i),c=f.length;f[--c]==0;)f.pop();return t.d=f,t.e=i,gn?Jt(t,y):t}function oo(e,t,n){if(e!==~~e||en)throw Error(Lu+e)}function eo(e){var t,n,r,i=e.length-1,o="",l=e[0];if(i>0){for(o+=l,t=1;tl?1:-1;else for(c=f=0;ci[c]?1:-1;break}return f}function n(r,i,o){for(var l=0;o--;)r[o]-=l,l=r[o]1;)r.shift()}return function(r,i,o,l){var c,f,h,m,y,x,b,C,_,A,O,P,N,F,U,W,X,ae,ce=r.constructor,re=r.s==i.s?1:-1,J=r.d,oe=i.d;if(!r.s)return new ce(r);if(!i.s)throw Error(ra+"Division by zero");for(f=r.e-i.e,X=oe.length,U=J.length,b=new ce(re),C=b.d=[],h=0;oe[h]==(J[h]||0);)++h;if(oe[h]>(J[h]||0)&&--f,o==null?P=o=ce.precision:l?P=o+(Zn(r)-Zn(i))+1:P=o,P<0)return new ce(0);if(P=P/on+2|0,h=0,X==1)for(m=0,oe=oe[0],P++;(h1&&(oe=e(oe,m),J=e(J,m),X=oe.length,U=J.length),F=X,_=J.slice(0,X),A=_.length;A=vr/2&&++W;do m=0,c=t(oe,_,X,A),c<0?(O=_[0],X!=A&&(O=O*vr+(_[1]||0)),m=O/W|0,m>1?(m>=vr&&(m=vr-1),y=e(oe,m),x=y.length,A=_.length,c=t(y,_,x,A),c==1&&(m--,n(y,X16)throw Error(nC+Zn(e));if(!e.s)return new m(Oi);for(gn=!1,c=y,l=new m(.03125);e.abs().gte(.1);)e=e.times(l),h+=5;for(r=Math.log(_u(2,h))/Math.LN10*2+5|0,c+=r,n=i=o=new m(Oi),m.precision=c;;){if(i=Jt(i.times(e),c),n=n.times(++f),l=o.plus(Ho(i,n,c)),eo(l.d).slice(0,c)===eo(o.d).slice(0,c)){for(;h--;)o=Jt(o.times(o),c);return m.precision=y,t==null?(gn=!0,Jt(o,y)):o}o=l}}function Zn(e){for(var t=e.e*on,n=e.d[0];n>=10;n/=10)t++;return t}function l2(e,t,n){if(t>e.LN10.sd())throw gn=!0,n&&(e.precision=n),Error(ra+"LN10 precision limit exceeded");return Jt(new e(e.LN10),t)}function rl(e){for(var t="";e--;)t+="0";return t}function Vh(e,t){var n,r,i,o,l,c,f,h,m,y=1,x=10,b=e,C=b.d,_=b.constructor,A=_.precision;if(b.s<1)throw Error(ra+(b.s?"NaN":"-Infinity"));if(b.eq(Oi))return new _(0);if(t==null?(gn=!1,h=A):h=t,b.eq(10))return t==null&&(gn=!0),l2(_,h);if(h+=x,_.precision=h,n=eo(C),r=n.charAt(0),o=Zn(b),Math.abs(o)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)b=b.times(e),n=eo(b.d),r=n.charAt(0),y++;o=Zn(b),r>1?(b=new _("0."+n),o++):b=new _(r+"."+n.slice(1))}else return f=l2(_,h+2,A).times(o+""),b=Vh(new _(r+"."+n.slice(1)),h-x).plus(f),_.precision=A,t==null?(gn=!0,Jt(b,A)):b;for(c=l=b=Ho(b.minus(Oi),b.plus(Oi),h),m=Jt(b.times(b),h),i=3;;){if(l=Jt(l.times(m),h),f=c.plus(Ho(l,new _(i),h)),eo(f.d).slice(0,h)===eo(c.d).slice(0,h))return c=c.times(2),o!==0&&(c=c.plus(l2(_,h+2,A).times(o+""))),c=Ho(c,new _(y),h),_.precision=A,t==null?(gn=!0,Jt(c,A)):c;c=f,i+=2}}function OP(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=If(n/on),e.d=[],r=(n+1)%on,n<0&&(r+=on),rkv||e.e<-kv))throw Error(nC+n)}else e.s=0,e.e=0,e.d=[0];return e}function Jt(e,t,n){var r,i,o,l,c,f,h,m,y=e.d;for(l=1,o=y[0];o>=10;o/=10)l++;if(r=t-l,r<0)r+=on,i=t,h=y[m=0];else{if(m=Math.ceil((r+1)/on),o=y.length,m>=o)return e;for(h=o=y[m],l=1;o>=10;o/=10)l++;r%=on,i=r-on+l}if(n!==void 0&&(o=_u(10,l-i-1),c=h/o%10|0,f=t<0||y[m+1]!==void 0||h%o,f=n<4?(c||f)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||f||n==6&&(r>0?i>0?h/_u(10,l-i):0:y[m-1])%10&1||n==(e.s<0?8:7))),t<1||!y[0])return f?(o=Zn(e),y.length=1,t=t-o-1,y[0]=_u(10,(on-t%on)%on),e.e=If(-t/on)||0):(y.length=1,y[0]=e.e=e.s=0),e;if(r==0?(y.length=m,o=1,m--):(y.length=m+1,o=_u(10,on-r),y[m]=i>0?(h/_u(10,l-i)%_u(10,i)|0)*o:0),f)for(;;)if(m==0){(y[0]+=o)==vr&&(y[0]=1,++e.e);break}else{if(y[m]+=o,y[m]!=vr)break;y[m--]=0,o=1}for(r=y.length;y[--r]===0;)y.pop();if(gn&&(e.e>kv||e.e<-kv))throw Error(nC+Zn(e));return e}function b8(e,t){var n,r,i,o,l,c,f,h,m,y,x=e.constructor,b=x.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new x(e),gn?Jt(t,b):t;if(f=e.d,y=t.d,r=t.e,h=e.e,f=f.slice(),l=h-r,l){for(m=l<0,m?(n=f,l=-l,c=y.length):(n=y,r=h,c=f.length),i=Math.max(Math.ceil(b/on),c)+2,l>i&&(l=i,n.length=1),n.reverse(),i=l;i--;)n.push(0);n.reverse()}else{for(i=f.length,c=y.length,m=i0;--i)f[c++]=0;for(i=y.length;i>l;){if(f[--i]0?o=o.charAt(0)+"."+o.slice(1)+rl(r):l>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+rl(-i-1)+o,n&&(r=n-l)>0&&(o+=rl(r))):i>=l?(o+=rl(i+1-l),n&&(r=n-i-1)>0&&(o=o+"."+rl(r))):((r=i+1)0&&(i+1===l&&(o+="."),o+=rl(r))),e.s<0?"-"+o:o}function jP(e,t){if(e.length>t)return e.length=t,!0}function x8(e){var t,n,r;function i(o){var l=this;if(!(l instanceof i))return new i(o);if(l.constructor=i,o instanceof i){l.s=o.s,l.e=o.e,l.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(Lu+o);if(o>0)l.s=1;else if(o<0)o=-o,l.s=-1;else{l.s=0,l.e=0,l.d=[0];return}if(o===~~o&&o<1e7){l.e=0,l.d=[o];return}return OP(l,o.toString())}else if(typeof o!="string")throw Error(Lu+o);if(o.charCodeAt(0)===45?(o=o.slice(1),l.s=-1):l.s=1,ple.test(o))OP(l,o);else throw Error(Lu+o)}if(i.prototype=Ye,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=x8,i.config=i.set=gle,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(Lu+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Lu+n+": "+r);return this}var rC=x8(mle);Oi=new rC(1);const qt=rC;var vle=e=>e,w8={},_8=e=>e===w8,MP=e=>function t(){return arguments.length===0||arguments.length===1&&_8(arguments.length<=0?void 0:arguments[0])?t:e(...arguments)},S8=(e,t)=>e===1?t:MP(function(){for(var n=arguments.length,r=new Array(n),i=0;il!==w8).length;return o>=e?t(...r):S8(e-o,MP(function(){for(var l=arguments.length,c=new Array(l),f=0;f_8(m)?c.shift():m);return t(...h,...c)}))}),Qy=e=>S8(e.length,e),zw=(e,t)=>{for(var n=[],r=e;rArray.isArray(t)?t.map(e):Object.keys(t).map(n=>t[n]).map(e)),ble=function(){for(var t=arguments.length,n=new Array(t),r=0;rf(c),o(...arguments))}},Uw=e=>Array.isArray(e)?e.reverse():e.split("").reverse().join(""),C8=e=>{var t=null,n=null;return function(){for(var r=arguments.length,i=new Array(r),o=0;o{var f;return l===((f=t)===null||f===void 0?void 0:f[c])})||(t=i,n=e(...i)),n}};function E8(e){var t;return e===0?t=1:t=Math.floor(new qt(e).abs().log(10).toNumber())+1,t}function A8(e,t,n){for(var r=new qt(e),i=0,o=[];r.lt(t)&&i<1e5;)o.push(r.toNumber()),r=r.add(n),i++;return o}Qy((e,t,n)=>{var r=+e,i=+t;return r+n*(i-r)});Qy((e,t,n)=>{var r=t-+e;return r=r||1/0,(n-e)/r});Qy((e,t,n)=>{var r=t-+e;return r=r||1/0,Math.max(0,Math.min(1,(n-e)/r))});var T8=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},O8=(e,t,n)=>{if(e.lte(0))return new qt(0);var r=E8(e.toNumber()),i=new qt(10).pow(r),o=e.div(i),l=r!==1?.05:.1,c=new qt(Math.ceil(o.div(l).toNumber())).add(n).mul(l),f=c.mul(i);return t?new qt(f.toNumber()):new qt(Math.ceil(f.toNumber()))},xle=(e,t,n)=>{var r=new qt(1),i=new qt(e);if(!i.isint()&&n){var o=Math.abs(e);o<1?(r=new qt(10).pow(E8(e)-1),i=new qt(Math.floor(i.div(r).toNumber())).mul(r)):o>1&&(i=new qt(Math.floor(e)))}else e===0?i=new qt(Math.floor((t-1)/2)):n||(i=new qt(Math.floor(e)));var l=Math.floor((t-1)/2),c=ble(yle(f=>i.add(new qt(f-l).mul(r)).toNumber()),zw);return c(0,t)},j8=function(t,n,r,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-t)/(r-1)))return{step:new qt(0),tickMin:new qt(0),tickMax:new qt(0)};var l=O8(new qt(n).sub(t).div(r-1),i,o),c;t<=0&&n>=0?c=new qt(0):(c=new qt(t).add(n).div(2),c=c.sub(new qt(c).mod(l)));var f=Math.ceil(c.sub(t).div(l).toNumber()),h=Math.ceil(new qt(n).sub(c).div(l).toNumber()),m=f+h+1;return m>r?j8(t,n,r,i,o+1):(m0?h+(r-m):h,f=n>0?f:f+(r-m)),{step:l,tickMin:c.sub(new qt(f).mul(l)),tickMax:c.add(new qt(h).mul(l))})};function wle(e){var[t,n]=e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(r,2),[l,c]=T8([t,n]);if(l===-1/0||c===1/0){var f=c===1/0?[l,...zw(0,r-1).map(()=>1/0)]:[...zw(0,r-1).map(()=>-1/0),c];return t>n?Uw(f):f}if(l===c)return xle(l,r,i);var{step:h,tickMin:m,tickMax:y}=j8(l,c,o,i,0),x=A8(m,y.add(new qt(.1).mul(h)),h);return t>n?Uw(x):x}function _le(e,t){var[n,r]=e,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,l]=T8([n,r]);if(o===-1/0||l===1/0)return[n,r];if(o===l)return[o];var c=Math.max(t,2),f=O8(new qt(l).sub(o).div(c-1),i,0),h=[...A8(new qt(o),new qt(l),f),l];return i===!1&&(h=h.map(m=>Math.round(m))),n>r?Uw(h):h}var Sle=C8(wle),Cle=C8(_le),M8=e=>e.rootProps.maxBarSize,Ele=e=>e.rootProps.barGap,P8=e=>e.rootProps.barCategoryGap,Ale=e=>e.rootProps.barSize,gm=e=>e.rootProps.stackOffset,iC=e=>e.options.chartName,aC=e=>e.rootProps.syncId,L8=e=>e.rootProps.syncMethod,oC=e=>e.options.eventEmitter,Un={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},zo={allowDuplicatedCategory:!0,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"category"},Ai={allowDataOverflow:!1,allowDuplicatedCategory:!0,radiusAxisId:0,scale:"auto",tick:!0,tickCount:5,type:"number"},Jy=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t},Tle={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:zo.angleAxisId,includeHidden:!1,name:void 0,reversed:zo.reversed,scale:zo.scale,tick:zo.tick,tickCount:void 0,ticks:void 0,type:zo.type,unit:void 0},Ole={allowDataOverflow:Ai.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:Ai.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Ai.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Ai.scale,tick:Ai.tick,tickCount:Ai.tickCount,ticks:void 0,type:Ai.type,unit:void 0},jle={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:zo.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:zo.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:zo.scale,tick:zo.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},Mle={allowDataOverflow:Ai.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:Ai.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Ai.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Ai.scale,tick:Ai.tick,tickCount:Ai.tickCount,ticks:void 0,type:"category",unit:void 0},sC=(e,t)=>e.polarAxis.angleAxis[t]!=null?e.polarAxis.angleAxis[t]:e.layout.layoutType==="radial"?jle:Tle,lC=(e,t)=>e.polarAxis.radiusAxis[t]!=null?e.polarAxis.radiusAxis[t]:e.layout.layoutType==="radial"?Mle:Ole,e0=e=>e.polarOptions,uC=Ce([us,cs,lr],Mk),N8=Ce([e0,uC],(e,t)=>{if(e!=null)return kr(e.innerRadius,t,0)}),R8=Ce([e0,uC],(e,t)=>{if(e!=null)return kr(e.outerRadius,t,t*.8)}),Ple=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]},D8=Ce([e0],Ple);Ce([sC,D8],Jy);var k8=Ce([uC,N8,R8],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});Ce([lC,k8],Jy);var I8=Ce([Mt,e0,N8,R8,us,cs],(e,t,n,r,i,o)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var{cx:l,cy:c,startAngle:f,endAngle:h}=t;return{cx:kr(l,i,i/2),cy:kr(c,o,o/2),innerRadius:n,outerRadius:r,startAngle:f,endAngle:h,clockWise:!1}}}),bn=(e,t)=>t,vm=(e,t,n)=>n;function cC(e){return e?.id}function z8(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:o}=n,l=new Map;return e.forEach(c=>{var f,h=(f=c.data)!==null&&f!==void 0?f:r;if(!(h==null||h.length===0)){var m=cC(c);h.forEach((y,x)=>{var b=o==null||i?x:String(nn(y,o,null)),C=nn(y,c.dataKey,0),_;l.has(b)?_=l.get(b):_={},Object.assign(_,{[m]:C}),l.set(b,_)})}}),Array.from(l.values())}function t0(e){return e.stackId!=null&&e.dataKey!=null}var n0=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function r0(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function Lle(e,t){if(e.length===t.length){for(var n=0;n{var t=Mt(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},zf=e=>e.tooltip.settings.axisId;function PP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Iv(e){for(var t=1;te.cartesianAxis.xAxis[t],ds=(e,t)=>{var n=U8(e,t);return n??Ci},Ei={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Bw,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:lm},B8=(e,t)=>e.cartesianAxis.yAxis[t],hs=(e,t)=>{var n=B8(e,t);return n??Ei},kle={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},fC=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??kle},En=(e,t,n)=>{switch(t){case"xAxis":return ds(e,n);case"yAxis":return hs(e,n);case"zAxis":return fC(e,n);case"angleAxis":return sC(e,n);case"radiusAxis":return lC(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Ile=(e,t,n)=>{switch(t){case"xAxis":return ds(e,n);case"yAxis":return hs(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},ym=(e,t,n)=>{switch(t){case"xAxis":return ds(e,n);case"yAxis":return hs(e,n);case"angleAxis":return sC(e,n);case"radiusAxis":return lC(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},F8=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function dC(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var i0=e=>e.graphicalItems.cartesianItems,zle=Ce([bn,vm],dC),hC=(e,t,n)=>e.filter(n).filter(r=>t?.includeHidden===!0?!0:!r.hide),bm=Ce([i0,En,zle],hC,{memoizeOptions:{resultEqualityCheck:r0}}),$8=Ce([bm],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(t0)),V8=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),Ule=Ce([bm],V8),mC=e=>e.map(t=>t.data).filter(Boolean).flat(1),Ble=Ce([bm],mC,{memoizeOptions:{resultEqualityCheck:r0}}),pC=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},gC=Ce([Ble,Xy],pC),vC=(e,t,n)=>t?.dataKey!=null?e.map(r=>({value:nn(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(i=>({value:nn(i,r)}))):e.map(r=>({value:r})),a0=Ce([gC,En,bm],vC);function H8(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function Bg(e){if(ci(e)||e instanceof Date){var t=Number(e);if(Bn(t))return t}}function LP(e){if(Array.isArray(e)){var t=[Bg(e[0]),Bg(e[1])];return Hu(t)?t:void 0}var n=Bg(e);if(n!=null)return[n,n]}function ns(e){return e.map(Bg).filter(vne)}function Fle(e,t,n){return!n||typeof t!="number"||Ta(t)?[]:n.length?ns(n.flatMap(r=>{var i=nn(e,r.dataKey),o,l;if(Array.isArray(i)?[o,l]=i:o=l=i,!(!Bn(o)||!Bn(l)))return[t-o,t+l]})):[]}var fr=e=>{var t=cr(e),n=zf(e);return ym(e,t,n)},q8=Ce([fr],e=>e?.dataKey),$le=Ce([$8,Xy,fr],z8),G8=(e,t,n)=>{var r={},i=t.reduce((o,l)=>(l.stackId==null||(o[l.stackId]==null&&(o[l.stackId]=[]),o[l.stackId].push(l)),o),r);return Object.fromEntries(Object.entries(i).map(o=>{var[l,c]=o,f=c.map(cC);return[l,{stackedData:Lre(e,f,n),graphicalItems:c}]}))},Fw=Ce([$le,$8,gm],G8),Y8=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:o}=t;if(r==null&&n!=="zAxis"){var l=Ire(e,i,o);if(!(l!=null&&l[0]===0&&l[1]===0))return l}},Vle=Ce([En],e=>e.allowDataOverflow),yC=e=>{var t;if(e==null||!("domain"in e))return Bw;if(e.domain!=null)return e.domain;if(e.ticks!=null){if(e.type==="number"){var n=ns(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e?.domain)!==null&&t!==void 0?t:Bw},bC=Ce([En],yC),xC=Ce([bC,Vle],p8),Hle=Ce([Fw,Nl,bn,xC],Y8,{memoizeOptions:{resultEqualityCheck:n0}}),o0=e=>e.errorBars,qle=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>H8(n,r)),zv=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var o,l;if(n.length>0&&e.forEach(c=>{n.forEach(f=>{var h,m,y=(h=r[f.id])===null||h===void 0?void 0:h.filter(O=>H8(i,O)),x=nn(c,(m=t.dataKey)!==null&&m!==void 0?m:f.dataKey),b=Fle(c,x,y);if(b.length>=2){var C=Math.min(...b),_=Math.max(...b);(o==null||Cl)&&(l=_)}var A=LP(x);A!=null&&(o=o==null?A[0]:Math.min(o,A[0]),l=l==null?A[1]:Math.max(l,A[1]))})}),t?.dataKey!=null&&e.forEach(c=>{var f=LP(nn(c,t.dataKey));f!=null&&(o=o==null?f[0]:Math.min(o,f[0]),l=l==null?f[1]:Math.max(l,f[1]))}),Bn(o)&&Bn(l))return[o,l]},Gle=Ce([gC,En,Ule,o0,bn],wC,{memoizeOptions:{resultEqualityCheck:n0}});function Yle(e){var{value:t}=e;if(ci(t)||t instanceof Date)return t}var Wle=(e,t,n)=>{var r=e.map(Yle).filter(i=>i!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&qD(r))?Rk(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},W8=e=>e.referenceElements.dots,Uf=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),Kle=Ce([W8,bn,vm],Uf),K8=e=>e.referenceElements.areas,Zle=Ce([K8,bn,vm],Uf),Z8=e=>e.referenceElements.lines,Xle=Ce([Z8,bn,vm],Uf),X8=(e,t)=>{var n=ns(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]},Qle=Ce(Kle,bn,X8),Q8=(e,t)=>{var n=ns(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]},Jle=Ce([Zle,bn],Q8);function eue(e){var t;if(e.x!=null)return ns([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:ns(n)}function tue(e){var t;if(e.y!=null)return ns([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:ns(n)}var J8=(e,t)=>{var n=e.flatMap(r=>t==="xAxis"?eue(r):tue(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]},nue=Ce([Xle,bn],J8),rue=Ce(Qle,nue,Jle,(e,t,n)=>zv(e,n,t)),_C=(e,t,n,r,i,o,l,c)=>{if(n!=null)return n;var f=l==="vertical"&&c==="xAxis"||l==="horizontal"&&c==="yAxis",h=f?zv(r,o,i):zv(o,i);return hle(t,h,e.allowDataOverflow)},iue=Ce([En,bC,xC,Hle,Gle,rue,Mt,bn],_C,{memoizeOptions:{resultEqualityCheck:n0}}),aue=[0,1],SC=(e,t,n,r,i,o,l)=>{if(!((e==null||n==null||n.length===0)&&l===void 0)){var{dataKey:c,type:f}=e,h=jl(t,o);if(h&&c==null){var m;return Rk(0,(m=n?.length)!==null&&m!==void 0?m:0)}return f==="category"?Wle(r,e,h):i==="expand"?aue:l}},CC=Ce([En,Mt,gC,a0,gm,bn,iue],SC),eI=(e,t,n,r,i)=>{if(e!=null){var{scale:o,type:l}=e;if(o==="auto")return t==="radial"&&i==="radiusAxis"?"band":t==="radial"&&i==="angleAxis"?"linear":l==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?"point":l==="category"?"band":"linear";if(typeof o=="string"){var c="scale".concat(sm(o));return c in ph?c:"point"}}},Bf=Ce([En,Mt,F8,iC,bn],eI);function oue(e){if(e!=null){if(e in ph)return ph[e]();var t="scale".concat(sm(e));if(t in ph)return ph[t]()}}function EC(e,t,n,r){if(!(n==null||r==null)){if(typeof e.scale=="function")return e.scale.copy().domain(n).range(r);var i=oue(t);if(i!=null){var o=i.domain(n).range(r);return Tre(o),o}}}var AC=(e,t,n)=>{var r=yC(t);if(!(n!=="auto"&&n!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&Hu(e))return Sle(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&Hu(e))return Cle(e,t.tickCount,t.allowDecimals)}},TC=Ce([CC,ym,Bf],AC),OC=(e,t,n,r)=>{if(r!=="angleAxis"&&e?.type==="number"&&Hu(t)&&Array.isArray(n)&&n.length>0){var i=t[0],o=n[0],l=t[1],c=n[n.length-1];return[Math.min(i,o),Math.max(l,c)]}return t},sue=Ce([En,CC,TC,bn],OC),lue=Ce(a0,En,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(ns(e.map(c=>c.value))).sort((c,f)=>c-f);if(r.length<2)return 1/0;var i=r[r.length-1]-r[0];if(i===0)return 1/0;for(var o=0;or,(e,t,n,r,i)=>{if(!Bn(e))return 0;var o=t==="vertical"?r.height:r.width;if(i==="gap")return e*o/2;if(i==="no-gap"){var l=kr(n,e*o),c=e*o/2;return c-l-(c-l)/o*l}return 0}),uue=(e,t)=>{var n=ds(e,t);return n==null||typeof n.padding!="string"?0:tI(e,"xAxis",t,n.padding)},cue=(e,t)=>{var n=hs(e,t);return n==null||typeof n.padding!="string"?0:tI(e,"yAxis",t,n.padding)},fue=Ce(ds,uue,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((n=i.left)!==null&&n!==void 0?n:0)+t,right:((r=i.right)!==null&&r!==void 0?r:0)+t}}),due=Ce(hs,cue,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((n=i.top)!==null&&n!==void 0?n:0)+t,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+t}}),hue=Ce([lr,fue,$y,Fy,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:o}=r;return i?[o.left,n.width-o.right]:[e.left+t.left,e.left+e.width-t.right]}),mue=Ce([lr,Mt,due,$y,Fy,(e,t,n)=>n],(e,t,n,r,i,o)=>{var{padding:l}=i;return o?[r.height-l.bottom,l.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),xm=(e,t,n,r)=>{var i;switch(t){case"xAxis":return hue(e,n,r);case"yAxis":return mue(e,n,r);case"zAxis":return(i=fC(e,n))===null||i===void 0?void 0:i.range;case"angleAxis":return D8(e);case"radiusAxis":return k8(e,n);default:return}},nI=Ce([En,xm],Jy),wl=Ce([En,Bf,sue,nI],EC);Ce([bm,o0,bn],qle);function rI(e,t){return e.idt.id?1:0}var s0=(e,t)=>t,l0=(e,t,n)=>n,pue=Ce(Uy,s0,l0,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(rI)),gue=Ce(By,s0,l0,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(rI)),iI=(e,t)=>({width:e.width,height:t.height}),vue=(e,t)=>{var n=typeof t.width=="number"?t.width:lm;return{width:n,height:e.height}},aI=Ce(lr,ds,iI),yue=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},bue=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},xue=Ce(cs,lr,pue,s0,l0,(e,t,n,r,i)=>{var o={},l;return n.forEach(c=>{var f=iI(t,c);l==null&&(l=yue(t,r,e));var h=r==="top"&&!i||r==="bottom"&&i;o[c.id]=l-Number(h)*f.height,l+=(h?-1:1)*f.height}),o}),wue=Ce(us,lr,gue,s0,l0,(e,t,n,r,i)=>{var o={},l;return n.forEach(c=>{var f=vue(t,c);l==null&&(l=bue(t,r,e));var h=r==="left"&&!i||r==="right"&&i;o[c.id]=l-Number(h)*f.width,l+=(h?-1:1)*f.width}),o}),_ue=(e,t)=>{var n=ds(e,t);if(n!=null)return xue(e,n.orientation,n.mirror)},Sue=Ce([lr,ds,_ue,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),Cue=(e,t)=>{var n=hs(e,t);if(n!=null)return wue(e,n.orientation,n.mirror)},Eue=Ce([lr,hs,Cue,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),oI=Ce(lr,hs,(e,t)=>{var n=typeof t.width=="number"?t.width:lm;return{width:n,height:e.height}}),NP=(e,t,n)=>{switch(t){case"xAxis":return aI(e,n).width;case"yAxis":return oI(e,n).height;default:return}},sI=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:o,dataKey:l}=n,c=jl(e,r),f=t.map(h=>h.value);if(l&&c&&o==="category"&&i&&qD(f))return f}},jC=Ce([Mt,a0,En,bn],sI),lI=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:o}=n,l=jl(e,r);if(l&&(i==="number"||o!=="auto"))return t.map(c=>c.value)}},MC=Ce([Mt,a0,ym,bn],lI),RP=Ce([Mt,Ile,Bf,wl,jC,MC,xm,TC,bn],(e,t,n,r,i,o,l,c,f)=>{if(t!=null){var h=jl(e,f);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:f,categoricalDomain:o,duplicateDomain:i,isCategorical:h,niceTicks:c,range:l,realScaleType:n,scale:r}}}),Aue=(e,t,n,r,i,o,l,c,f)=>{if(!(t==null||r==null)){var h=jl(e,f),{type:m,ticks:y,tickCount:x}=t,b=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,C=m==="category"&&r.bandwidth?r.bandwidth()/b:0;C=f==="angleAxis"&&o!=null&&o.length>=2?yr(o[0]-o[1])*2*C:C;var _=y||i;if(_){var A=_.map((O,P)=>{var N=l?l.indexOf(O):O;return{index:P,coordinate:r(N)+C,value:O,offset:C}});return A.filter(O=>Bn(O.coordinate))}return h&&c?c.map((O,P)=>({coordinate:r(O)+C,value:O,index:P,offset:C})).filter(O=>Bn(O.coordinate)):r.ticks?r.ticks(x).map(O=>({coordinate:r(O)+C,value:O,offset:C})):r.domain().map((O,P)=>({coordinate:r(O)+C,value:l?l[O]:O,index:P,offset:C}))}},uI=Ce([Mt,ym,Bf,wl,TC,xm,jC,MC,bn],Aue),Tue=(e,t,n,r,i,o,l)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var c=jl(e,l),{tickCount:f}=t,h=0;return h=l==="angleAxis"&&r?.length>=2?yr(r[0]-r[1])*2*h:h,c&&o?o.map((m,y)=>({coordinate:n(m)+h,value:m,index:y,offset:h})):n.ticks?n.ticks(f).map(m=>({coordinate:n(m)+h,value:m,offset:h})):n.domain().map((m,y)=>({coordinate:n(m)+h,value:i?i[m]:m,index:y,offset:h}))}},_l=Ce([Mt,ym,wl,xm,jC,MC,bn],Tue),Sl=Ce(En,wl,(e,t)=>{if(!(e==null||t==null))return Iv(Iv({},e),{},{scale:t})}),Oue=Ce([En,Bf,CC,nI],EC);Ce((e,t,n)=>fC(e,n),Oue,(e,t)=>{if(!(e==null||t==null))return Iv(Iv({},e),{},{scale:t})});var jue=Ce([Mt,Uy,By],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),cI=e=>e.options.defaultTooltipEventType,fI=e=>e.options.validateTooltipEventTypes;function dI(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function PC(e,t){var n=cI(e),r=fI(e);return dI(t,n,r)}function Mue(e){return Ze(t=>PC(t,e))}var hI=(e,t)=>{var n,r=Number(t);if(!(Ta(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},Pue=e=>e.tooltip.settings,al={active:!1,index:null,dataKey:void 0,coordinate:void 0},Lue={itemInteraction:{click:al,hover:al},axisInteraction:{click:al,hover:al},keyboardInteraction:al,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},mI=jt({name:"tooltip",initialState:Lue,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:ir()},removeTooltipEntrySettings:{reducer(e,t){var n=Vo(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:ir()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate,e.keyboardInteraction.dataKey=t.payload.activeDataKey}}}),{addTooltipEntrySettings:Nue,removeTooltipEntrySettings:Rue,setTooltipSettingsState:Due,setActiveMouseOverItemIndex:pI,mouseLeaveItem:kue,mouseLeaveChart:gI,setActiveClickItemIndex:Iue,setMouseOverAxisIndex:vI,setMouseClickAxisIndex:zue,setSyncInteraction:$w,setKeyboardInteraction:Vw}=mI.actions,Uue=mI.reducer;function DP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function vg(e){for(var t=1;t{if(t==null)return al;var i=Vue(e,t,n);if(i==null)return al;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var o=e.settings.active===!0;if(Hue(i)){if(o)return vg(vg({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r};return vg(vg({},al),{},{coordinate:i.coordinate})},LC=(e,t)=>{var n=e?.index;if(n==null)return null;var r=Number(n);if(!Bn(r))return n;var i=0,o=1/0;return t.length>0&&(o=t.length-1),String(Math.max(i,Math.min(r,o)))},bI=(e,t,n,r,i,o,l,c)=>{if(!(o==null||c==null)){var f=l[0],h=f==null?void 0:c(f.positions,o);if(h!=null)return h;var m=i?.[Number(o)];if(m)switch(n){case"horizontal":return{x:m.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:m.coordinate}}}},xI=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;return n==="hover"?i=e.itemInteraction.hover.dataKey:i=e.itemInteraction.click.dataKey,i==null&&r!=null?[e.tooltipItemPayloads[0]]:e.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.dataKey)===i})},wm=e=>e.options.tooltipPayloadSearcher,Ff=e=>e.tooltip;function kP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function IP(e){for(var t=1;t{if(!(t==null||o==null)){var{chartData:c,computedData:f,dataStartIndex:h,dataEndIndex:m}=n,y=[];return e.reduce((x,b)=>{var C,{dataDefinedOnItem:_,settings:A}=b,O=Wue(_,c),P=Array.isArray(O)?uk(O,h,m):O,N=(C=A?.dataKey)!==null&&C!==void 0?C:r,F=A?.nameKey,U;if(r&&Array.isArray(P)&&!Array.isArray(P[0])&&l==="axis"?U=GD(P,r,i):U=o(P,t,f,F),Array.isArray(U))U.forEach(X=>{var ae=IP(IP({},A),{},{name:X.name,unit:X.unit,color:void 0,fill:void 0});x.push(fM({tooltipEntrySettings:ae,dataKey:X.dataKey,payload:X.payload,value:nn(X.payload,X.dataKey),name:X.name}))});else{var W;x.push(fM({tooltipEntrySettings:A,dataKey:N,payload:U,value:nn(U,N),name:(W=nn(U,F))!==null&&W!==void 0?W:A?.name}))}return x},y)}},NC=Ce([fr,Mt,F8,iC,cr],eI),Kue=Ce([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Zue=Ce([cr,zf],dC),_m=Ce([Kue,fr,Zue],hC,{memoizeOptions:{resultEqualityCheck:r0}}),Xue=Ce([_m],e=>e.filter(t0)),Que=Ce([_m],mC,{memoizeOptions:{resultEqualityCheck:r0}}),$f=Ce([Que,Nl],pC),Jue=Ce([Xue,Nl,fr],z8),RC=Ce([$f,fr,_m],vC),_I=Ce([fr],yC),ece=Ce([fr],e=>e.allowDataOverflow),SI=Ce([_I,ece],p8),tce=Ce([_m],e=>e.filter(t0)),nce=Ce([Jue,tce,gm],G8),rce=Ce([nce,Nl,cr,SI],Y8),ice=Ce([_m],V8),ace=Ce([$f,fr,ice,o0,cr],wC,{memoizeOptions:{resultEqualityCheck:n0}}),oce=Ce([W8,cr,zf],Uf),sce=Ce([oce,cr],X8),lce=Ce([K8,cr,zf],Uf),uce=Ce([lce,cr],Q8),cce=Ce([Z8,cr,zf],Uf),fce=Ce([cce,cr],J8),dce=Ce([sce,fce,uce],zv),hce=Ce([fr,_I,SI,rce,ace,dce,Mt,cr],_C),CI=Ce([fr,Mt,$f,RC,gm,cr,hce],SC),mce=Ce([CI,fr,NC],AC),pce=Ce([fr,CI,mce,cr],OC),EI=e=>{var t=cr(e),n=zf(e),r=!1;return xm(e,t,n,r)},AI=Ce([fr,EI],Jy),TI=Ce([fr,NC,pce,AI],EC),gce=Ce([Mt,RC,fr,cr],sI),vce=Ce([Mt,RC,fr,cr],lI),yce=(e,t,n,r,i,o,l,c)=>{if(t){var{type:f}=t,h=jl(e,c);if(r){var m=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,y=f==="category"&&r.bandwidth?r.bandwidth()/m:0;return y=c==="angleAxis"&&i!=null&&i?.length>=2?yr(i[0]-i[1])*2*y:y,h&&l?l.map((x,b)=>({coordinate:r(x)+y,value:x,index:b,offset:y})):r.domain().map((x,b)=>({coordinate:r(x)+y,value:o?o[x]:x,index:b,offset:y}))}}},ms=Ce([Mt,fr,NC,TI,EI,gce,vce,cr],yce),DC=Ce([cI,fI,Pue],(e,t,n)=>dI(n.shared,e,t)),OI=e=>e.tooltip.settings.trigger,kC=e=>e.tooltip.settings.defaultIndex,u0=Ce([Ff,DC,OI,kC],yI),Cl=Ce([u0,$f],LC),jI=Ce([ms,Cl],hI),MI=Ce([u0],e=>{if(e)return e.dataKey}),PI=Ce([Ff,DC,OI,kC],xI),bce=Ce([us,cs,Mt,lr,ms,kC,PI,wm],bI),xce=Ce([u0,bce],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),wce=Ce([u0],e=>e.active),_ce=Ce([PI,Cl,Nl,q8,jI,wm,DC],wI),Sce=Ce([_ce],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function zP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function UP(e){for(var t=1;tZe(fr),Oce=()=>{var e=Tce(),t=Ze(ms),n=Ze(TI);return pf(!e||!n?void 0:UP(UP({},e),{},{scale:n}),t)};function BP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Wc(e){for(var t=1;t{var i=t.find(o=>o&&o.index===n);if(i){if(e==="horizontal")return{x:i.coordinate,y:r.chartY};if(e==="vertical")return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}},Nce=(e,t,n,r)=>{var i=t.find(h=>h&&h.index===n);if(i){if(e==="centric"){var o=i.coordinate,{radius:l}=r;return Wc(Wc(Wc({},r),Kn(r.cx,r.cy,l,o)),{},{angle:o,radius:l})}var c=i.coordinate,{angle:f}=r;return Wc(Wc(Wc({},r),Kn(r.cx,r.cy,c,f)),{},{angle:f,radius:c})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function Rce(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var LI=(e,t,n,r,i)=>{var o,l=-1,c=(o=t?.length)!==null&&o!==void 0?o:0;if(c<=1||e==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var f=0;f0?n[f-1].coordinate:n[c-1].coordinate,m=n[f].coordinate,y=f>=c-1?n[0].coordinate:n[f+1].coordinate,x=void 0;if(yr(m-h)!==yr(y-m)){var b=[];if(yr(y-m)===yr(i[1]-i[0])){x=y;var C=m+i[1]-i[0];b[0]=Math.min(C,(C+h)/2),b[1]=Math.max(C,(C+h)/2)}else{x=h;var _=y+i[1]-i[0];b[0]=Math.min(m,(_+m)/2),b[1]=Math.max(m,(_+m)/2)}var A=[Math.min(m,(x+m)/2),Math.max(m,(x+m)/2)];if(e>A[0]&&e<=A[1]||e>=b[0]&&e<=b[1]){({index:l}=n[f]);break}}else{var O=Math.min(h,y),P=Math.max(h,y);if(e>(O+m)/2&&e<=(P+m)/2){({index:l}=n[f]);break}}}else if(t){for(var N=0;N0&&N(t[N].coordinate+t[N-1].coordinate)/2&&e<=(t[N].coordinate+t[N+1].coordinate)/2||N===c-1&&e>(t[N].coordinate+t[N-1].coordinate)/2){({index:l}=t[N]);break}}return l},Dce=()=>Ze(iC),IC=(e,t)=>t,NI=(e,t,n)=>n,zC=(e,t,n,r)=>r,kce=Ce(ms,e=>zy(e,t=>t.coordinate)),UC=Ce([Ff,IC,NI,zC],yI),RI=Ce([UC,$f],LC),Ice=(e,t,n)=>{if(t!=null){var r=Ff(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},DI=Ce([Ff,IC,NI,zC],xI),Uv=Ce([us,cs,Mt,lr,ms,zC,DI,wm],bI),zce=Ce([UC,Uv],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),kI=Ce([ms,RI],hI),Uce=Ce([DI,RI,Nl,q8,kI,wm,IC],wI),Bce=Ce([UC],e=>({isActive:e.active,activeIndex:e.index})),Fce=(e,t,n,r,i,o,l)=>{if(!(!e||!n||!r||!i)&&Rce(e,l)){var c=zre(e,t),f=LI(c,o,i,n,r),h=Lce(t,i,f,e);return{activeIndex:String(f),activeCoordinate:h}}},$ce=(e,t,n,r,i,o,l)=>{if(!(!e||!r||!i||!o||!n)){var c=jae(e,n);if(c){var f=Ure(c,t),h=LI(f,l,o,r,i),m=Nce(t,o,h,c);return{activeIndex:String(h),activeCoordinate:m}}}},Vce=(e,t,n,r,i,o,l,c)=>{if(!(!e||!t||!r||!i||!o))return t==="horizontal"||t==="vertical"?Fce(e,t,r,i,o,l,c):$ce(e,t,n,r,i,o,l)},Hce=Ce(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElementId:r.elementId}}),qce=Ce(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(Un)),n=Array.from(new Set(t));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:Lle}});function FP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function $P(e){for(var t=1;t$P($P({},e),{},{[t]:{elementId:void 0,panoramaElementId:void 0,consumers:0}}),Kce)},Xce=new Set(Object.values(Un));function Qce(e){return Xce.has(e)}var II=jt({name:"zIndex",initialState:Zce,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,elementId:void 0,panoramaElementId:void 0}},prepare:ir()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!Qce(n)&&delete e.zIndexMap[n])},prepare:ir()},registerZIndexPortalId:{reducer:(e,t)=>{var{zIndex:n,elementId:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElementId=r:e.zIndexMap[n].elementId=r:e.zIndexMap[n]={consumers:0,elementId:i?void 0:r,panoramaElementId:i?r:void 0}},prepare:ir()},unregisterZIndexPortalId:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElementId=void 0:e.zIndexMap[n].elementId=void 0)},prepare:ir()}}}),{registerZIndexPortal:Jce,unregisterZIndexPortal:efe,registerZIndexPortalId:tfe,unregisterZIndexPortalId:nfe}=II.actions,rfe=II.reducer;function Kr(e){var{zIndex:t,children:n}=e,r=gie(),i=r&&t!==void 0&&t!==0,o=jr(),l=cn();w.useLayoutEffect(()=>i?(l(Jce({zIndex:t})),()=>{l(efe({zIndex:t}))}):Ju,[l,t,i]);var c=Ze(h=>Hce(h,t,o));if(!i)return n;if(!c)return null;var f=document.getElementById(c);return f?Of.createPortal(n,f):null}function Hw(){return Hw=Object.assign?Object.assign.bind():function(e){for(var t=1;tw.useContext(zI),u2={exports:{}},HP;function ffe(){return HP||(HP=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(f,h,m){this.fn=f,this.context=h,this.once=m||!1}function o(f,h,m,y,x){if(typeof m!="function")throw new TypeError("The listener must be a function");var b=new i(m,y||f,x),C=n?n+h:h;return f._events[C]?f._events[C].fn?f._events[C]=[f._events[C],b]:f._events[C].push(b):(f._events[C]=b,f._eventsCount++),f}function l(f,h){--f._eventsCount===0?f._events=new r:delete f._events[h]}function c(){this._events=new r,this._eventsCount=0}c.prototype.eventNames=function(){var h=[],m,y;if(this._eventsCount===0)return h;for(y in m=this._events)t.call(m,y)&&h.push(n?y.slice(1):y);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(m)):h},c.prototype.listeners=function(h){var m=n?n+h:h,y=this._events[m];if(!y)return[];if(y.fn)return[y.fn];for(var x=0,b=y.length,C=new Array(b);x{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),pfe=UI.reducer,{createEventEmitter:gfe}=UI.actions;function vfe(e){return e.tooltip.syncInteraction}var yfe={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},BI=jt({name:"chartData",initialState:yfe,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:GP,setDataStartEndIndexes:bfe,setComputedData:y_e}=BI.actions,xfe=BI.reducer,wfe=["x","y"];function YP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Kc(e){for(var t=1;tf.rootProps.className);w.useEffect(()=>{if(e==null)return Ju;var f=(h,m,y)=>{if(t!==y&&e===h){if(r==="index"){var x;if(l&&m!==null&&m!==void 0&&(x=m.payload)!==null&&x!==void 0&&x.coordinate&&m.payload.sourceViewBox){var b=m.payload.coordinate,{x:C,y:_}=b,A=Efe(b,wfe),{x:O,y:P,width:N,height:F}=m.payload.sourceViewBox,U=Kc(Kc({},A),{},{x:l.x+(N?(C-O)/N:0)*l.width,y:l.y+(F?(_-P)/F:0)*l.height});n(Kc(Kc({},m),{},{payload:Kc(Kc({},m.payload),{},{coordinate:U})}))}else n(m);return}if(i!=null){var W;if(typeof r=="function"){var X={activeTooltipIndex:m.payload.index==null?void 0:Number(m.payload.index),isTooltipActive:m.payload.active,activeIndex:m.payload.index==null?void 0:Number(m.payload.index),activeLabel:m.payload.label,activeDataKey:m.payload.dataKey,activeCoordinate:m.payload.coordinate},ae=r(i,X);W=i[ae]}else r==="value"&&(W=i.find(Y=>String(Y.value)===m.payload.label));var{coordinate:ce}=m.payload;if(W==null||m.payload.active===!1||ce==null||l==null){n($w({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0}));return}var{x:re,y:J}=ce,oe=Math.min(re,l.x+l.width),we=Math.min(J,l.y+l.height),se={x:o==="horizontal"?W.coordinate:oe,y:o==="horizontal"?we:W.coordinate},ue=$w({active:m.payload.active,coordinate:se,dataKey:m.payload.dataKey,index:String(W.index),label:m.payload.label,sourceViewBox:m.payload.sourceViewBox});n(ue)}}};return Hh.on(qw,f),()=>{Hh.off(qw,f)}},[c,n,t,e,r,i,o,l])}function Ofe(){var e=Ze(aC),t=Ze(oC),n=cn();w.useEffect(()=>{if(e==null)return Ju;var r=(i,o,l)=>{t!==l&&e===i&&n(bfe(o))};return Hh.on(qP,r),()=>{Hh.off(qP,r)}},[n,t,e])}function jfe(){var e=cn();w.useEffect(()=>{e(gfe())},[e]),Tfe(),Ofe()}function Mfe(e,t,n,r,i,o){var l=Ze(b=>Ice(b,e,t)),c=Ze(oC),f=Ze(aC),h=Ze(L8),m=Ze(vfe),y=m?.active,x=Vy();w.useEffect(()=>{if(!y&&f!=null&&c!=null){var b=$w({active:o,coordinate:n,dataKey:l,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:x});Hh.emit(qw,f,b,c)}},[y,n,l,i,r,c,f,h,o,x])}function WP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function KP(e){for(var t=1;t{X(Due({shared:P,trigger:N,axisId:W,active:i,defaultIndex:ae}))},[X,P,N,W,i,ae]);var ce=Vy(),re=Ek(),J=Mue(P),{activeIndex:oe,isActive:we}=(t=Ze(ve=>Bce(ve,J,N,ae)))!==null&&t!==void 0?t:{},se=Ze(ve=>Uce(ve,J,N,ae)),ue=Ze(ve=>kI(ve,J,N,ae)),Y=Ze(ve=>zce(ve,J,N,ae)),k=se,z=cfe(),H=(n=i??we)!==null&&n!==void 0?n:!1,[I,j]=gre([k,H]),q=J==="axis"?ue:void 0;Mfe(J,N,Y,q,oe,H);var ee=U??z;if(ee==null||ce==null||J==null)return null;var le=k??ZP;H||(le=ZP),h&&le.length&&(le=Qne(le.filter(ve=>ve.value!=null&&(ve.hide!==!0||r.includeHidden)),x,Rfe));var pe=le.length>0,he=w.createElement(Mie,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:m,active:H,coordinate:Y,hasPayload:pe,offset:y,position:b,reverseDirection:C,useTranslate3d:_,viewBox:ce,wrapperStyle:A,lastBoundingBox:I,innerRef:j,hasPortalFromProps:!!U},Dfe(f,KP(KP({},r),{},{payload:le,label:q,active:H,activeIndex:oe,coordinate:Y,accessibilityLayer:re})));return w.createElement(w.Fragment,null,Of.createPortal(he,ee),H&&w.createElement(ufe,{cursor:O,tooltipEventType:J,coordinate:Y,payload:le,index:oe}))}var ul=e=>null;ul.displayName="Cell";function Ife(e,t,n){return(t=zfe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zfe(e){var t=Ufe(e,"string");return typeof t=="symbol"?t:t+""}function Ufe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class Bfe{constructor(t){Ife(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function XP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ffe(e){for(var t=1;t{try{var n=document.getElementById(JP);n||(n=document.createElement("span"),n.setAttribute("id",JP),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Gfe,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},Sh=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Ml.isSsr)return{width:0,height:0};if(!FI.enableCache)return e5(t,n);var r=Yfe(t,n),i=QP.get(r);if(i)return i;var o=e5(t,n);return QP.set(r,o),o},t5=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,n5=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Wfe=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Kfe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,$I={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},Zfe=Object.keys($I),ef="NaN";function Xfe(e,t){return e*$I[t]}class ui{static parse(t){var n,[,r,i]=(n=Kfe.exec(t))!==null&&n!==void 0?n:[];return new ui(parseFloat(r),i??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,Ta(t)&&(this.unit=""),n!==""&&!Wfe.test(n)&&(this.num=NaN,this.unit=""),Zfe.includes(n)&&(this.num=Xfe(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new ui(NaN,""):new ui(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new ui(NaN,""):new ui(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new ui(NaN,""):new ui(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new ui(NaN,""):new ui(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Ta(this.num)}}function VI(e){if(e.includes(ef))return ef;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,o]=(n=t5.exec(t))!==null&&n!==void 0?n:[],l=ui.parse(r??""),c=ui.parse(o??""),f=i==="*"?l.multiply(c):l.divide(c);if(f.isNaN())return ef;t=t.replace(t5,f.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var h,[,m,y,x]=(h=n5.exec(t))!==null&&h!==void 0?h:[],b=ui.parse(m??""),C=ui.parse(x??""),_=y==="+"?b.add(C):b.subtract(C);if(_.isNaN())return ef;t=t.replace(n5,_.toString())}return t}var r5=/\(([^()]*)\)/;function Qfe(e){for(var t=e,n;(n=r5.exec(t))!=null;){var[,r]=n;t=t.replace(r5,VI(r))}return t}function Jfe(e){var t=e.replace(/\s+/g,"");return t=Qfe(t),t=VI(t),t}function ede(e){try{return Jfe(e)}catch{return ef}}function c2(e){var t=ede(e.slice(5,-1));return t===ef?"":t}var tde=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],nde=["dx","dy","angle","className","breakAll"];function Gw(){return Gw=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];yn(t)||(n?i=t.toString().split(""):i=t.toString().split(HI));var o=i.map(c=>({word:c,width:Sh(c,r).width})),l=n?0:Sh(" ",r).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}};function ide(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var GI=(e,t,n,r)=>e.reduce((i,o)=>{var{word:l,width:c}=o,f=i[i.length-1];if(f&&c!=null&&(t==null||r||f.width+c+ne.reduce((t,n)=>t.width>n.width?t:n),ade="…",a5=(e,t,n,r,i,o,l,c)=>{var f=e.slice(0,t),h=qI({breakAll:n,style:r,children:f+ade});if(!h)return[!1,[]];var m=GI(h.wordsWithComputedWidth,o,l,c),y=m.length>i||YI(m).width>Number(o);return[y,m]},ode=(e,t,n,r,i)=>{var{maxLines:o,children:l,style:c,breakAll:f}=e,h=Xe(o),m=String(l),y=GI(t,r,n,i);if(!h||i)return y;var x=y.length>o||YI(y).width>Number(r);if(!x)return y;for(var b=0,C=m.length-1,_=0,A;b<=C&&_<=m.length-1;){var O=Math.floor((b+C)/2),P=O-1,[N,F]=a5(m,P,f,c,o,r,n,i),[U]=a5(m,O,f,c,o,r,n,i);if(!N&&!U&&(b=O+1),N&&U&&(C=O-1),!N&&U){A=F;break}_++}return A||y},o5=e=>{var t=yn(e)?[]:e.toString().split(HI);return[{words:t,width:void 0}]},sde=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:o,maxLines:l}=e;if((t||n)&&!Ml.isSsr){var c,f,h=qI({breakAll:o,children:r,style:i});if(h){var{wordsWithComputedWidth:m,spaceWidth:y}=h;c=m,f=y}else return o5(r);return ode({breakAll:o,children:r,maxLines:l,style:i},c,f,t,!!n)}return o5(r)},WI="#808080",lde={breakAll:!1,capHeight:"0.71em",fill:WI,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},c0=w.forwardRef((e,t)=>{var n=sr(e,lde),{x:r,y:i,lineHeight:o,capHeight:l,fill:c,scaleToFit:f,textAnchor:h,verticalAnchor:m}=n,y=i5(n,tde),x=w.useMemo(()=>sde({breakAll:y.breakAll,children:y.children,maxLines:y.maxLines,scaleToFit:f,style:y.style,width:y.width}),[y.breakAll,y.children,y.maxLines,f,y.style,y.width]),{dx:b,dy:C,angle:_,className:A,breakAll:O}=y,P=i5(y,nde);if(!ci(r)||!ci(i)||x.length===0)return null;var N=Number(r)+(Xe(b)?b:0),F=Number(i)+(Xe(C)?C:0);if(!Bn(N)||!Bn(F))return null;var U;switch(m){case"start":U=c2("calc(".concat(l,")"));break;case"middle":U=c2("calc(".concat((x.length-1)/2," * -").concat(o," + (").concat(l," / 2))"));break;default:U=c2("calc(".concat(x.length-1," * -").concat(o,")"));break}var W=[];if(f){var X=x[0].width,{width:ae}=y;W.push("scale(".concat(Xe(ae)&&Xe(X)?ae/X:1,")"))}return _&&W.push("rotate(".concat(_,", ").concat(N,", ").concat(F,")")),W.length&&(P.transform=W.join(" ")),w.createElement("text",Gw({},zr(P),{ref:t,x:N,y:F,className:Oe("recharts-text",A),textAnchor:h,fill:c.includes("url")?WI:c}),x.map((ce,re)=>{var J=ce.words.join(O?"":" ");return w.createElement("tspan",{x:N,dy:re===0?U:o,key:"".concat(J,"-").concat(re)},J)}))});c0.displayName="Text";var ude=["labelRef"];function cde(e,t){if(e==null)return{};var n,r,i=fde(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:o,height:l,children:c}=e,f=w.useMemo(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:o,height:l}),[t,n,r,i,o,l]);return w.createElement(KI.Provider,{value:f},c)},XI=()=>{var e=w.useContext(KI),t=Vy();return e||yk(t)},pde=w.createContext(null),gde=()=>{var e=w.useContext(pde),t=Ze(I8);return e||t},vde=e=>{var{value:t,formatter:n}=e,r=yn(e.children)?t:e.children;return typeof n=="function"?n(r):r},$C=e=>e!=null&&typeof e=="function",yde=(e,t)=>{var n=yr(t-e),r=Math.min(Math.abs(t-e),360);return n*r},bde=(e,t,n,r,i)=>{var{offset:o,className:l}=e,{cx:c,cy:f,innerRadius:h,outerRadius:m,startAngle:y,endAngle:x,clockWise:b}=i,C=(h+m)/2,_=yde(y,x),A=_>=0?1:-1,O,P;switch(t){case"insideStart":O=y+A*o,P=b;break;case"insideEnd":O=x-A*o,P=!b;break;case"end":O=x+A*o,P=b;break;default:throw new Error("Unsupported position ".concat(t))}P=_<=0?P:!P;var N=Kn(c,f,C,O),F=Kn(c,f,C,O+(P?1:-1)*359),U="M".concat(N.x,",").concat(N.y,` A`).concat(C,",").concat(C,",0,1,").concat(P?0:1,`, - `).concat(F.x,",").concat(F.y),W=yn(e.id)?Ih("recharts-radial-line-"):e.id;return w.createElement("text",Uo({},r,{dominantBaseline:"central",className:Oe("recharts-radial-bar-label",l)}),w.createElement("defs",null,w.createElement("path",{id:W,d:U})),w.createElement("textPath",{xlinkHref:"#".concat(W)},n))},xde=(e,t,n)=>{var{cx:r,cy:i,innerRadius:o,outerRadius:l,startAngle:c,endAngle:f}=e,h=(c+f)/2;if(n==="outside"){var{x:m,y}=Kn(r,i,l+t,h);return{x:m,y,textAnchor:m>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var x=(o+l)/2,{x:b,y:C}=Kn(r,i,x,h);return{x:b,y:C,textAnchor:"middle",verticalAnchor:"middle"}},Yw=e=>"cx"in e&&Xe(e.cx),wde=(e,t)=>{var{parentViewBox:n,offset:r,position:i}=e,o;n!=null&&!Yw(n)&&(o=n);var{x:l,y:c,upperWidth:f,lowerWidth:h,height:m}=t,y=l,x=l+(f-h)/2,b=(y+x)/2,C=(f+h)/2,_=y+f/2,A=m>=0?1:-1,O=A*r,P=A>0?"end":"start",N=A>0?"start":"end",F=f>=0?1:-1,U=F*r,W=F>0?"end":"start",X=F>0?"start":"end";if(i==="top"){var ae={x:y+f/2,y:c-O,textAnchor:"middle",verticalAnchor:P};return zn(zn({},ae),o?{height:Math.max(c-o.y,0),width:f}:{})}if(i==="bottom"){var ce={x:x+h/2,y:c+m+O,textAnchor:"middle",verticalAnchor:N};return zn(zn({},ce),o?{height:Math.max(o.y+o.height-(c+m),0),width:h}:{})}if(i==="left"){var re={x:b-U,y:c+m/2,textAnchor:W,verticalAnchor:"middle"};return zn(zn({},re),o?{width:Math.max(re.x-o.x,0),height:m}:{})}if(i==="right"){var J={x:b+C+U,y:c+m/2,textAnchor:X,verticalAnchor:"middle"};return zn(zn({},J),o?{width:Math.max(o.x+o.width-J.x,0),height:m}:{})}var oe=o?{width:C,height:m}:{};return i==="insideLeft"?zn({x:b+U,y:c+m/2,textAnchor:X,verticalAnchor:"middle"},oe):i==="insideRight"?zn({x:b+C-U,y:c+m/2,textAnchor:W,verticalAnchor:"middle"},oe):i==="insideTop"?zn({x:y+f/2,y:c+O,textAnchor:"middle",verticalAnchor:N},oe):i==="insideBottom"?zn({x:x+h/2,y:c+m-O,textAnchor:"middle",verticalAnchor:P},oe):i==="insideTopLeft"?zn({x:y+U,y:c+O,textAnchor:X,verticalAnchor:N},oe):i==="insideTopRight"?zn({x:y+f-U,y:c+O,textAnchor:W,verticalAnchor:N},oe):i==="insideBottomLeft"?zn({x:x+U,y:c+m-O,textAnchor:X,verticalAnchor:P},oe):i==="insideBottomRight"?zn({x:x+h-U,y:c+m-O,textAnchor:W,verticalAnchor:P},oe):i&&typeof i=="object"&&(Xe(i.x)||Qo(i.x))&&(Xe(i.y)||Qo(i.y))?zn({x:l+kr(i.x,C),y:c+kr(i.y,m),textAnchor:"end",verticalAnchor:"end"},oe):zn({x:_,y:c+m/2,textAnchor:"middle",verticalAnchor:"middle"},oe)},_de={offset:5,zIndex:Un.label};function il(e){var t=sr(e,_de),{viewBox:n,position:r,value:i,children:o,content:l,className:c="",textBreakAll:f,labelRef:h}=t,m=gde(),y=XI(),x=r==="center"?y:m??y,b,C,_;if(n==null?b=x:Yw(n)?b=n:b=yk(n),!b||yn(i)&&yn(o)&&!w.isValidElement(l)&&typeof l!="function")return null;var A=zn(zn({},t),{},{viewBox:b});if(w.isValidElement(l)){var{labelRef:O}=A,P=cde(A,ude);return w.cloneElement(l,P)}if(typeof l=="function"){if(C=w.createElement(l,A),w.isValidElement(C))return C}else C=vde(t);var N=zr(t);if(Yw(b)){if(r==="insideStart"||r==="insideEnd"||r==="end")return bde(t,r,C,N,b);_=xde(b,t.offset,t.position)}else _=wde(t,b);return w.createElement(Kr,{zIndex:t.zIndex},w.createElement(c0,Uo({ref:h,className:Oe("recharts-label",c)},N,_,{textAnchor:ide(N.textAnchor)?N.textAnchor:_.textAnchor,breakAll:f}),C))}il.displayName="Label";var Sde=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?w.createElement(il,Uo({key:"label-implicit"},r)):ci(e)?w.createElement(il,Uo({key:"label-implicit",value:e},r)):w.isValidElement(e)?e.type===il?w.cloneElement(e,zn({key:"label-implicit"},r)):w.createElement(il,Uo({key:"label-implicit",content:e},r)):$C(e)?w.createElement(il,Uo({key:"label-implicit",content:e},r)):e&&typeof e=="object"?w.createElement(il,Uo({},e,{key:"label-implicit"},r)):null};function QI(e){var{label:t,labelRef:n}=e,r=XI();return Sde(t,r,n)||null}var f2={},d2={},l5;function Cde(){return l5||(l5=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n[n.length-1]}e.last=t}(d2)),d2}var h2={},u5;function Ede(){return u5||(u5=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Array.isArray(n)?n:Array.from(n)}e.toArray=t}(h2)),h2}var c5;function Ade(){return c5||(c5=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Cde(),n=Ede(),r=AS();function i(o){if(r.isArrayLike(o))return t.last(n.toArray(o))}e.last=i}(f2)),f2}var m2,f5;function Tde(){return f5||(f5=1,m2=Ade().last),m2}var Ode=Tde();const jde=aa(Ode);var Mde=["valueAccessor"],Pde=["dataKey","clockWise","id","textBreakAll","zIndex"];function Bv(){return Bv=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?jde(e.value):e.value,JI=w.createContext(void 0),e7=JI.Provider,t7=w.createContext(void 0),Rde=t7.Provider;function Dde(){return w.useContext(JI)}function kde(){return w.useContext(t7)}function Fg(e){var{valueAccessor:t=Nde}=e,n=d5(e,Mde),{dataKey:r,clockWise:i,id:o,textBreakAll:l,zIndex:c}=n,f=d5(n,Pde),h=Dde(),m=kde(),y=h||m;return!y||!y.length?null:w.createElement(Kr,{zIndex:c??Un.label},w.createElement(ar,{className:"recharts-label-list"},y.map((x,b)=>{var C,_=yn(r)?t(x,b):nn(x&&x.payload,r),A=yn(o)?{}:{id:"".concat(o,"-").concat(b)};return w.createElement(il,Bv({key:"label-".concat(b)},zr(x),f,A,{fill:(C=n.fill)!==null&&C!==void 0?C:x.fill,parentViewBox:x.parentViewBox,value:_,textBreakAll:l,viewBox:x.viewBox,index:b,zIndex:0}))})))}Fg.displayName="LabelList";function VC(e){var{label:t}=e;return t?t===!0?w.createElement(Fg,{key:"labelList-implicit"}):w.isValidElement(t)||$C(t)?w.createElement(Fg,{key:"labelList-implicit",content:t}):typeof t=="object"?w.createElement(Fg,Bv({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function Ww(){return Ww=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,o=Oe("recharts-dot",i);return Xe(t)&&Xe(n)&&Xe(r)?w.createElement("circle",Ww({},Di(e),ES(e),{className:o,cx:t,cy:n,r})):null},r7=e=>e.graphicalItems.polarItems,Ide=Ce([bn,vm],dC),f0=Ce([r7,En,Ide],hC),zde=Ce([f0],mC),d0=Ce([zde,tC],pC),Ude=Ce([d0,En,f0],vC);Ce([d0,En,f0],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(i=>{var o,l=nn(r,(o=t.dataKey)!==null&&o!==void 0?o:i.dataKey);return{value:l,errorDomain:[]}})).filter(Boolean):t?.dataKey!=null?e.map(r=>({value:nn(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var h5=()=>{},Bde=Ce([d0,En,f0,o0,bn],wC),Fde=Ce([En,bC,xC,h5,Bde,h5,Mt,bn],_C),i7=Ce([En,Mt,d0,Ude,gm,bn,Fde],SC),$de=Ce([i7,En,Bf],AC);Ce([En,i7,$de,bn],OC);var Vde={radiusAxis:{},angleAxis:{}},a7=jt({name:"polarAxis",initialState:Vde,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:b_e,removeRadiusAxis:x_e,addAngleAxis:w_e,removeAngleAxis:__e}=a7.actions,Hde=a7.reducer;function m5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function p5(e){for(var t=1;tt,HC=Ce([r7,Wde],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),Kde=[],qC=(e,t,n)=>n?.length===0?Kde:n,o7=Ce([tC,HC,qC],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i;if(t?.data!=null&&t.data.length>0?i=t.data:i=r,(!i||!i.length)&&n!=null&&(i=n.map(o=>p5(p5({},t.presentationProps),o.props))),i!=null)return i}}),Zde=Ce([o7,HC,qC],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,i)=>{var o,l=nn(r,t.nameKey,t.name),c;return n!=null&&(o=n[i])!==null&&o!==void 0&&(o=o.props)!==null&&o!==void 0&&o.fill?c=n[i].props.fill:typeof r=="object"&&r!=null&&"fill"in r?c=r.fill:c=t.fill,{value:Rf(l,t.dataKey),color:c,payload:r,type:t.legendType}})}),Xde=Ce([o7,HC,qC,lr],(e,t,n,r)=>{if(!(t==null||e==null))return Zhe({offset:r,pieSettings:t,displayedData:e,cells:n})}),p2={exports:{}},Ft={};var g5;function Qde(){if(g5)return Ft;g5=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,h=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,y=e?Symbol.for("react.suspense"):60113,x=e?Symbol.for("react.suspense_list"):60120,b=e?Symbol.for("react.memo"):60115,C=e?Symbol.for("react.lazy"):60116,_=e?Symbol.for("react.block"):60121,A=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,P=e?Symbol.for("react.scope"):60119;function N(U){if(typeof U=="object"&&U!==null){var W=U.$$typeof;switch(W){case t:switch(U=U.type,U){case f:case h:case r:case o:case i:case y:return U;default:switch(U=U&&U.$$typeof,U){case c:case m:case C:case b:case l:return U;default:return W}}case n:return W}}}function F(U){return N(U)===h}return Ft.AsyncMode=f,Ft.ConcurrentMode=h,Ft.ContextConsumer=c,Ft.ContextProvider=l,Ft.Element=t,Ft.ForwardRef=m,Ft.Fragment=r,Ft.Lazy=C,Ft.Memo=b,Ft.Portal=n,Ft.Profiler=o,Ft.StrictMode=i,Ft.Suspense=y,Ft.isAsyncMode=function(U){return F(U)||N(U)===f},Ft.isConcurrentMode=F,Ft.isContextConsumer=function(U){return N(U)===c},Ft.isContextProvider=function(U){return N(U)===l},Ft.isElement=function(U){return typeof U=="object"&&U!==null&&U.$$typeof===t},Ft.isForwardRef=function(U){return N(U)===m},Ft.isFragment=function(U){return N(U)===r},Ft.isLazy=function(U){return N(U)===C},Ft.isMemo=function(U){return N(U)===b},Ft.isPortal=function(U){return N(U)===n},Ft.isProfiler=function(U){return N(U)===o},Ft.isStrictMode=function(U){return N(U)===i},Ft.isSuspense=function(U){return N(U)===y},Ft.isValidElementType=function(U){return typeof U=="string"||typeof U=="function"||U===r||U===h||U===o||U===i||U===y||U===x||typeof U=="object"&&U!==null&&(U.$$typeof===C||U.$$typeof===b||U.$$typeof===l||U.$$typeof===c||U.$$typeof===m||U.$$typeof===A||U.$$typeof===O||U.$$typeof===P||U.$$typeof===_)},Ft.typeOf=N,Ft}var v5;function Jde(){return v5||(v5=1,p2.exports=Qde()),p2.exports}var ehe=Jde(),y5=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",b5=null,g2=null,s7=e=>{if(e===b5&&Array.isArray(g2))return g2;var t=[];return w.Children.forEach(e,n=>{yn(n)||(ehe.isFragment(n)?t=t.concat(s7(n.props.children)):t.push(n))}),g2=t,b5=e,t};function GC(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>y5(i)):r=[y5(t)],s7(e).forEach(i=>{var o=Vu(i,"type.displayName")||Vu(i,"type.name");o&&r.indexOf(o)!==-1&&n.push(i)}),n}var l7=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,v2={},x5;function the(){return x5||(x5=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const i=n[Symbol.toStringTag];return i==null||!Object.getOwnPropertyDescriptor(n,Symbol.toStringTag)?.writable?!1:n.toString()===`[object ${i}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t}(v2)),v2}var y2,w5;function nhe(){return w5||(w5=1,y2=the().isPlainObject),y2}var rhe=nhe();const ihe=aa(rhe);function _5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function S5(e){for(var t=1;t{var o=n-r,l;return l="M ".concat(e,",").concat(t),l+="L ".concat(e+n,",").concat(t),l+="L ".concat(e+n-o/2,",").concat(t+i),l+="L ".concat(e+n-o/2-r,",").concat(t+i),l+="L ".concat(e,",").concat(t," Z"),l},lhe={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},uhe=e=>{var t=sr(e,lhe),{x:n,y:r,upperWidth:i,lowerWidth:o,height:l,className:c}=t,{animationEasing:f,animationDuration:h,animationBegin:m,isUpdateAnimationActive:y}=t,x=w.useRef(null),[b,C]=w.useState(-1),_=w.useRef(i),A=w.useRef(o),O=w.useRef(l),P=w.useRef(n),N=w.useRef(r),F=fm(e,"trapezoid-");if(w.useEffect(()=>{if(x.current&&x.current.getTotalLength)try{var se=x.current.getTotalLength();se&&C(se)}catch{}},[]),n!==+n||r!==+r||i!==+i||o!==+o||l!==+l||i===0&&o===0||l===0)return null;var U=Oe("recharts-trapezoid",c);if(!y)return w.createElement("g",null,w.createElement("path",Fv({},zr(t),{className:U,d:C5(n,r,i,o,l)})));var W=_.current,X=A.current,ae=O.current,ce=P.current,re=N.current,J="0px ".concat(b===-1?1:b,"px"),oe="".concat(b,"px 0px"),we=Ak(["strokeDasharray"],h,f);return w.createElement(cm,{animationId:F,key:F,canBegin:b>0,duration:h,easing:f,isActive:y,begin:m},se=>{var ue=mn(W,i,se),Y=mn(X,o,se),k=mn(ae,l,se),z=mn(ce,n,se),H=mn(re,r,se);x.current&&(_.current=ue,A.current=Y,O.current=k,P.current=z,N.current=H);var I=se>0?{transition:we,strokeDasharray:oe}:{strokeDasharray:J};return w.createElement("path",Fv({},zr(t),{className:U,d:C5(z,H,ue,Y,k),ref:x,style:S5(S5({},I),t.style)}))})},che=["option","shapeType","propTransformer","activeClassName","isActive"];function fhe(e,t){if(e==null)return{};var n,r,i=dhe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r{var n=cn();return(r,i)=>o=>{e?.(r,i,o),n(pI({activeIndex:String(i),activeDataKey:t,activeCoordinate:r.tooltipPosition}))}},KC=e=>{var t=cn();return(n,r)=>i=>{e?.(n,r,i),t(kue())}},ZC=(e,t)=>{var n=cn();return(r,i)=>o=>{e?.(r,i,o),n(Iue({activeIndex:String(i),activeDataKey:t,activeCoordinate:r.tooltipPosition}))}};function XC(e){var{fn:t,args:n}=e,r=cn(),i=jr();return w.useLayoutEffect(()=>{if(!i){var o=t(n);return r(Nue(o)),()=>{r(Rue(o))}}},[t,n,r,i]),null}function u7(e){var{legendPayload:t}=e,n=cn(),r=jr();return w.useLayoutEffect(()=>r?Ju:(n(Sk(t)),()=>{n(Ck(t))}),[n,r,t]),null}function bhe(e){var{legendPayload:t}=e,n=cn(),r=Ze(Mt);return w.useLayoutEffect(()=>r!=="centric"&&r!=="radial"?Ju:(n(Sk(t)),()=>{n(Ck(t))}),[n,r,t]),null}var b2,xhe=()=>{var[e]=w.useState(()=>Ih("uid-"));return e},whe=(b2=u_.useId)!==null&&b2!==void 0?b2:xhe;function c7(e,t){var n=whe();return t||(e?"".concat(e,"-").concat(n):n)}var _he=w.createContext(void 0),QC=e=>{var{id:t,type:n,children:r}=e,i=c7("recharts-".concat(n),t);return w.createElement(_he.Provider,{value:i},r(i))},She={cartesianItems:[],polarItems:[]},f7=jt({name:"graphicalItems",initialState:She,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:ir()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Vo(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:ir()},removeCartesianGraphicalItem:{reducer(e,t){var n=Vo(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:ir()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:ir()},removePolarGraphicalItem:{reducer(e,t){var n=Vo(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:ir()}}}),{addCartesianGraphicalItem:Che,replaceCartesianGraphicalItem:Ehe,removeCartesianGraphicalItem:Ahe,addPolarGraphicalItem:The,removePolarGraphicalItem:Ohe}=f7.actions,jhe=f7.reducer;function d7(e){var t=cn(),n=w.useRef(null);return w.useLayoutEffect(()=>{n.current===null?t(Che(e)):n.current!==e&&t(Ehe({prev:n.current,next:e})),n.current=e},[t,e]),w.useLayoutEffect(()=>()=>{n.current&&(t(Ahe(n.current)),n.current=null)},[t]),null}function Mhe(e){var t=cn();return w.useLayoutEffect(()=>(t(The(e)),()=>{t(Ohe(e))}),[t,e]),null}var Phe=["onMouseEnter","onClick","onMouseLeave"],Lhe=["id"],Nhe=["id"];function JC(e,t){if(e==null)return{};var n,r,i=Rhe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;rGC(e.children,ul),[e.children]),n=Ze(r=>Zde(r,e.id,t));return n==null?null:w.createElement(bhe,{legendPayload:n})}function Uhe(e){var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:o,fill:l,name:c,hide:f,tooltipType:h}=e;return{dataDefinedOnItem:r.map(m=>m.tooltipPayload),positions:r.map(m=>m.tooltipPosition),settings:{stroke:i,strokeWidth:o,fill:l,dataKey:t,nameKey:n,name:Rf(c,t),hide:f,type:h,color:l,unit:""}}}var Bhe=(e,t)=>e>t?"start":ekr(typeof t=="function"?t(e):t,n,n*.8),$he=(e,t,n)=>{var{top:r,left:i,width:o,height:l}=t,c=Mk(o,l),f=i+kr(e.cx,o,o/2),h=r+kr(e.cy,l,l/2),m=kr(e.innerRadius,c,0),y=Fhe(n,e.outerRadius,c),x=e.maxRadius||Math.sqrt(o*o+l*l)/2;return{cx:f,cy:h,innerRadius:m,outerRadius:y,maxRadius:x}},Vhe=(e,t)=>{var n=yr(t-e),r=Math.min(Math.abs(t-e),360);return n*r};function Hhe(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var qhe=(e,t)=>{if(w.isValidElement(e))return w.cloneElement(e,t);if(typeof e=="function")return e(t);var n=Oe("recharts-pie-label-line",typeof e!="boolean"?e.className:"");return w.createElement(MS,El({},t,{type:"linear",className:n}))},Ghe=(e,t,n)=>{if(w.isValidElement(e))return w.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),w.isValidElement(r)))return r;var i=Oe("recharts-pie-label-text",Hhe(e));return w.createElement(c0,El({},t,{alignmentBaseline:"middle",className:i}),r)};function Yhe(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:o,dataKey:l}=n;if(!r||!i||!t)return null;var c=Di(n),f=$u(i),h=$u(o),m=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,y=t.map((x,b)=>{var C=(x.startAngle+x.endAngle)/2,_=Kn(x.cx,x.cy,x.outerRadius+m,C),A=pn(pn(pn(pn({},c),x),{},{stroke:"none"},f),{},{index:b,textAnchor:Bhe(_.x,x.cx)},_),O=pn(pn(pn(pn({},c),x),{},{fill:"none",stroke:x.fill},h),{},{index:b,points:[Kn(x.cx,x.cy,x.outerRadius,C),_],key:"line"});return w.createElement(Kr,{zIndex:Un.label,key:"label-".concat(x.startAngle,"-").concat(x.endAngle,"-").concat(x.midAngle,"-").concat(b)},w.createElement(ar,null,o&&qhe(o,O),Ghe(i,A,nn(x,l))))});return w.createElement(ar,{className:"recharts-pie-labels"},y)}function Whe(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i=="object"&&i!=null&&"position"in i?w.createElement(VC,{label:i}):w.createElement(Yhe,{sectors:t,props:n,showLabels:r})}function Khe(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i}=e,o=Ze(Cl),{onMouseEnter:l,onClick:c,onMouseLeave:f}=i,h=JC(i,Phe),m=WC(l,i.dataKey),y=KC(f),x=ZC(c,i.dataKey);return t==null||t.length===0?null:w.createElement(w.Fragment,null,t.map((b,C)=>{if(b?.startAngle===0&&b?.endAngle===0&&t.length!==1)return null;var _=n&&String(C)===o,A=o?r:null,O=_?n:A,P=pn(pn({},b),{},{stroke:b.stroke,tabIndex:-1,[hk]:C,[mk]:i.dataKey});return w.createElement(ar,El({key:"sector-".concat(b?.startAngle,"-").concat(b?.endAngle,"-").concat(b.midAngle,"-").concat(C),tabIndex:-1,className:"recharts-pie-sector"},Iy(h,b,C),{onMouseEnter:m(b,C),onMouseLeave:y(b,C),onClick:x(b,C)}),w.createElement(YC,El({option:O,isActive:_,shapeType:"sector"},P)))}))}function Zhe(e){var t,{pieSettings:n,displayedData:r,cells:i,offset:o}=e,{cornerRadius:l,startAngle:c,endAngle:f,dataKey:h,nameKey:m,tooltipType:y}=n,x=Math.abs(n.minAngle),b=Vhe(c,f),C=Math.abs(b),_=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,A=r.filter(W=>nn(W,h,0)!==0).length,O=(C>=360?A:A-1)*_,P=C-A*x-O,N=r.reduce((W,X)=>{var ae=nn(X,h,0);return W+(Xe(ae)?ae:0)},0),F;if(N>0){var U;F=r.map((W,X)=>{var ae=nn(W,h,0),ce=nn(W,m,X),re=$he(n,o,W),J=(Xe(ae)?ae:0)/N,oe,we=pn(pn({},W),i&&i[X]&&i[X].props);X?oe=U.endAngle+yr(b)*_*(ae!==0?1:0):oe=c;var se=oe+yr(b)*((ae!==0?x:0)+J*P),ue=(oe+se)/2,Y=(re.innerRadius+re.outerRadius)/2,k=[{name:ce,value:ae,payload:we,dataKey:h,type:y}],z=Kn(re.cx,re.cy,Y,ue);return U=pn(pn(pn(pn({},n.presentationProps),{},{percent:J,cornerRadius:typeof l=="string"?parseFloat(l):l,name:ce,tooltipPayload:k,midAngle:ue,middleRadius:Y,tooltipPosition:z},we),re),{},{value:ae,startAngle:oe,endAngle:se,payload:we,paddingAngle:yr(b)*_}),U})}return F}function Xhe(e){var{showLabels:t,sectors:n,children:r}=e,i=w.useMemo(()=>!t||!n?[]:n.map(o=>({value:o.value,payload:o.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:o.cx,cy:o.cy,innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,clockWise:!1},fill:o.fill})),[n,t]);return w.createElement(Rde,{value:t?i:void 0},r)}function Qhe(e){var{props:t,previousSectorsRef:n}=e,{sectors:r,isAnimationActive:i,animationBegin:o,animationDuration:l,animationEasing:c,activeShape:f,inactiveShape:h,onAnimationStart:m,onAnimationEnd:y}=t,x=fm(t,"recharts-pie-"),b=n.current,[C,_]=w.useState(!1),A=w.useCallback(()=>{typeof y=="function"&&y(),_(!1)},[y]),O=w.useCallback(()=>{typeof m=="function"&&m(),_(!0)},[m]);return w.createElement(Xhe,{showLabels:!C,sectors:r},w.createElement(cm,{animationId:x,begin:o,duration:l,isActive:i,easing:c,onAnimationStart:O,onAnimationEnd:A,key:x},P=>{var N=[],F=r&&r[0],U=F?.startAngle;return r?.forEach((W,X)=>{var ae=b&&b[X],ce=X>0?Vu(W,"paddingAngle",0):0;if(ae){var re=mn(ae.endAngle-ae.startAngle,W.endAngle-W.startAngle,P),J=pn(pn({},W),{},{startAngle:U+ce,endAngle:U+re+ce});N.push(J),U=J.endAngle}else{var{endAngle:oe,startAngle:we}=W,se=mn(0,oe-we,P),ue=pn(pn({},W),{},{startAngle:U+ce,endAngle:U+se+ce});N.push(ue),U=ue.endAngle}}),n.current=N,w.createElement(ar,null,w.createElement(Khe,{sectors:N,activeShape:f,inactiveShape:h,allOtherPieProps:t}))}),w.createElement(Whe,{showLabels:!C,sectors:r,props:t}),t.children)}var Jhe={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:!Ml.isSsr,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:Un.area};function eme(e){var{id:t}=e,n=JC(e,Lhe),{hide:r,className:i,rootTabIndex:o}=e,l=w.useMemo(()=>GC(e.children,ul),[e.children]),c=Ze(m=>Xde(m,t,l)),f=w.useRef(null),h=Oe("recharts-pie",i);return r||c==null?(f.current=null,w.createElement(ar,{tabIndex:o,className:h})):w.createElement(Kr,{zIndex:e.zIndex},w.createElement(XC,{fn:Uhe,args:pn(pn({},e),{},{sectors:c})}),w.createElement(ar,{tabIndex:o,className:h},w.createElement(Qhe,{props:pn(pn({},n),{},{sectors:c}),previousSectorsRef:f})))}function Kw(e){var t=sr(e,Jhe),{id:n}=t,r=JC(t,Nhe),i=Di(r);return w.createElement(QC,{id:n,type:"pie"},o=>w.createElement(w.Fragment,null,w.createElement(Mhe,{type:"pie",id:o,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),w.createElement(zhe,El({},r,{id:o})),w.createElement(eme,El({},r,{id:o}))))}Kw.displayName="Pie";var tme=["points"];function O5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function x2(e){for(var t=1;t{var A,O,P=x2(x2(x2({r:3},l),y),{},{index:_,cx:(A=C.x)!==null&&A!==void 0?A:void 0,cy:(O=C.y)!==null&&O!==void 0?O:void 0,dataKey:o,value:C.value,payload:C.payload,points:t});return w.createElement(sme,{key:"dot-".concat(_),option:n,dotProps:P,className:i})}),b={};return c&&f!=null&&(b.clipPath="url(#clipPath-".concat(m?"":"dots-").concat(f,")")),w.createElement(Kr,{zIndex:h},w.createElement(ar,Vv({className:r},b),x))}function j5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function M5(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),wme=Ce([xme,us,cs],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),e3=()=>Ze(wme),_me=()=>Ze(Sce);function P5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function w2(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:o}=e;if(i===!1||t.x==null||t.y==null)return null;var l={index:n,dataKey:o,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=w2(w2(w2({},l),$u(i)),ES(i)),f;return w.isValidElement(i)?f=w.cloneElement(i,c):typeof i=="function"?f=i(c):f=w.createElement(n7,c),w.createElement(ar,{className:"recharts-active-dot"},f)};function Tme(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,zIndex:o=Un.activeDot}=e,l=Ze(Cl),c=_me();if(t==null||c==null)return null;var f=t.find(h=>c.includes(h.payload));return yn(f)?null:w.createElement(Kr,{zIndex:o},w.createElement(Ame,{point:f,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r}))}var Ome="Invariant failed";function jme(e,t){throw new Error(Ome)}var Mme=["x","y"];function Zw(){return Zw=Object.assign?Object.assign.bind():function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:0;return(r,i)=>{if(Xe(t))return t;var o=Xe(r)||yn(r);return o?t(r,i):(o||jme(),n)}},zme={},m7=jt({name:"errorBars",initialState:zme,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(o=>o.dataKey===r.dataKey&&o.direction===r.direction?i:o))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:E_e,replaceErrorBar:A_e,removeErrorBar:T_e}=m7.actions,Ume=m7.reducer,Bme=["children"];function Fme(e,t){if(e==null)return{};var n,r,i=$me(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0},Hme=w.createContext(Vme);function p7(e){var{children:t}=e,n=Fme(e,Bme);return w.createElement(Hme.Provider,{value:n},t)}function t3(e,t){var n,r,i=Ze(h=>ds(h,e)),o=Ze(h=>hs(h,t)),l=(n=i?.allowDataOverflow)!==null&&n!==void 0?n:Ci.allowDataOverflow,c=(r=o?.allowDataOverflow)!==null&&r!==void 0?r:Ei.allowDataOverflow,f=l||c;return{needClip:f,needClipX:l,needClipY:c}}function g7(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=e3(),{needClipX:o,needClipY:l,needClip:c}=t3(t,n);if(!c||!i)return null;var{x:f,y:h,width:m,height:y}=i;return w.createElement("clipPath",{id:"clipPath-".concat(r)},w.createElement("rect",{x:o?f:f-m/2,y:l?h:h-y/2,width:o?m:m*2,height:l?y:y*2}))}function qme(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&Bn(e.zIndex)?e.zIndex:t}var Gme=["onMouseEnter","onMouseLeave","onClick"],Yme=["value","background","tooltipPosition"],Wme=["id"],Kme=["onMouseEnter","onClick","onMouseLeave"];function rs(){return rs=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,fill:r,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:r,value:Rf(n,t),payload:e}]};function tpe(e){var{dataKey:t,stroke:n,strokeWidth:r,fill:i,name:o,hide:l,unit:c}=e;return{dataDefinedOnItem:void 0,positions:void 0,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:Rf(o,t),hide:l,type:e.tooltipType,color:e.fill,unit:c}}}function npe(e){var t=Ze(Cl),{data:n,dataKey:r,background:i,allOtherBarProps:o}=e,{onMouseEnter:l,onMouseLeave:c,onClick:f}=o,h=qv(o,Gme),m=WC(l,r),y=KC(c),x=ZC(f,r);if(!i||n==null)return null;var b=$u(i);return w.createElement(Kr,{zIndex:qme(i,Un.barBackground)},n.map((C,_)=>{var{value:A,background:O,tooltipPosition:P}=C,N=qv(C,Yme);if(!O)return null;var F=m(C,_),U=y(C,_),W=x(C,_),X=Hr(Hr(Hr(Hr(Hr({option:i,isActive:String(_)===t},N),{},{fill:"#eee"},O),b),Iy(h,C,_)),{},{onMouseEnter:F,onMouseLeave:U,onClick:W,dataKey:r,index:_,className:"recharts-bar-background-rectangle"});return w.createElement(Hv,rs({key:"background-bar-".concat(_)},X))}))}function rpe(e){var{showLabels:t,children:n,rects:r}=e,i=r?.map(o=>{var l={x:o.x,y:o.y,width:o.width,lowerWidth:o.width,upperWidth:o.width,height:o.height};return Hr(Hr({},l),{},{value:o.value,payload:o.payload,parentViewBox:o.parentViewBox,viewBox:l,fill:o.fill})});return w.createElement(e7,{value:t?i:void 0},n)}function ipe(e){var{shape:t,activeBar:n,baseProps:r,entry:i,index:o,dataKey:l}=e,c=Ze(Cl),f=Ze(MI),h=n&&String(o)===c&&(f==null||l===f),m=h?n:t;return h?w.createElement(Kr,{zIndex:Un.activeBar},w.createElement(Hv,rs({},r,{name:String(r.name)},i,{isActive:h,option:m,index:o,dataKey:l}))):w.createElement(Hv,rs({},r,{name:String(r.name)},i,{isActive:h,option:m,index:o,dataKey:l}))}function ape(e){var{shape:t,baseProps:n,entry:r,index:i,dataKey:o}=e;return w.createElement(Hv,rs({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:o}))}function ope(e){var t,{data:n,props:r}=e,i=(t=Di(r))!==null&&t!==void 0?t:{},{id:o}=i,l=qv(i,Wme),{shape:c,dataKey:f,activeBar:h}=r,{onMouseEnter:m,onClick:y,onMouseLeave:x}=r,b=qv(r,Kme),C=WC(m,f),_=KC(x),A=ZC(y,f);return n?w.createElement(w.Fragment,null,n.map((O,P)=>w.createElement(ar,rs({key:"rectangle-".concat(O?.x,"-").concat(O?.y,"-").concat(O?.value,"-").concat(P),className:"recharts-bar-rectangle"},Iy(b,O,P),{onMouseEnter:C(O,P),onMouseLeave:_(O,P),onClick:A(O,P)}),h?w.createElement(ipe,{shape:c,activeBar:h,baseProps:l,entry:O,index:P,dataKey:f}):w.createElement(ape,{shape:c,baseProps:l,entry:O,index:P,dataKey:f})))):null}function spe(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:i,isAnimationActive:o,animationBegin:l,animationDuration:c,animationEasing:f,onAnimationEnd:h,onAnimationStart:m}=t,y=n.current,x=fm(t,"recharts-bar-"),[b,C]=w.useState(!1),_=!b,A=w.useCallback(()=>{typeof h=="function"&&h(),C(!1)},[h]),O=w.useCallback(()=>{typeof m=="function"&&m(),C(!0)},[m]);return w.createElement(rpe,{showLabels:_,rects:r},w.createElement(cm,{animationId:x,begin:l,duration:c,isActive:o,easing:f,onAnimationEnd:A,onAnimationStart:O,key:x},P=>{var N=P===1?r:r?.map((F,U)=>{var W=y&&y[U];if(W)return Hr(Hr({},F),{},{x:mn(W.x,F.x,P),y:mn(W.y,F.y,P),width:mn(W.width,F.width,P),height:mn(W.height,F.height,P)});if(i==="horizontal"){var X=mn(0,F.height,P),ae=mn(F.stackedBarStart,F.y,P);return Hr(Hr({},F),{},{y:ae,height:X})}var ce=mn(0,F.width,P),re=mn(F.stackedBarStart,F.x,P);return Hr(Hr({},F),{},{width:ce,x:re})});return P>0&&(n.current=N??null),N==null?null:w.createElement(ar,null,w.createElement(ope,{props:t,data:N}))}),w.createElement(VC,{label:t.label}),t.children)}function lpe(e){var t=w.useRef(null);return w.createElement(spe,{previousRectanglesRef:t,props:e})}var v7=0,upe=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:nn(e,t)}};class cpe extends w.PureComponent{render(){var{hide:t,data:n,dataKey:r,className:i,xAxisId:o,yAxisId:l,needClip:c,background:f,id:h}=this.props;if(t||n==null)return null;var m=Oe("recharts-bar",i),y=h;return w.createElement(ar,{className:m,id:h},c&&w.createElement("defs",null,w.createElement(g7,{clipPathId:y,xAxisId:o,yAxisId:l})),w.createElement(ar,{className:"recharts-bar-rectangles",clipPath:c?"url(#clipPath-".concat(y,")"):void 0},w.createElement(npe,{data:n,dataKey:r,background:f,allOtherBarProps:this.props}),w.createElement(lpe,this.props)))}}var fpe={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",hide:!1,isAnimationActive:!Ml.isSsr,legendType:"rect",minPointSize:v7,xAxisId:0,yAxisId:0,zIndex:Un.bar};function dpe(e){var{xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:o,activeBar:l,animationBegin:c,animationDuration:f,animationEasing:h,isAnimationActive:m}=e,{needClip:y}=t3(t,n),x=um(),b=jr(),C=GC(e.children,ul),_=Ze(P=>Bpe(P,t,n,b,e.id,C));if(x!=="vertical"&&x!=="horizontal")return null;var A,O=_?.[0];return O==null||O.height==null||O.width==null?A=0:A=x==="vertical"?O.height/2:O.width/2,w.createElement(p7,{xAxisId:t,yAxisId:n,data:_,dataPointFormatter:upe,errorBarOffset:A},w.createElement(cpe,rs({},e,{layout:x,needClip:y,data:_,xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:o,activeBar:l,animationBegin:c,animationDuration:f,animationEasing:h,isAnimationActive:m})))}function hpe(e){var{layout:t,barSettings:{dataKey:n,minPointSize:r},pos:i,bandSize:o,xAxis:l,yAxis:c,xAxisTicks:f,yAxisTicks:h,stackedData:m,displayedData:y,offset:x,cells:b,parentViewBox:C,dataStartIndex:_}=e,A=t==="horizontal"?c:l,O=m?A.scale.domain():null,P=Rre({numericAxis:A}),N=A.scale(P);return y.map((F,U)=>{var W,X,ae,ce,re,J;m?W=Ore(m[U+_],O):(W=nn(F,n),Array.isArray(W)||(W=[P,W]));var oe=Ime(r,v7)(W[1],U);if(t==="horizontal"){var we,[se,ue]=[c.scale(W[0]),c.scale(W[1])];X=lM({axis:l,ticks:f,bandSize:o,offset:i.offset,entry:F,index:U}),ae=(we=ue??se)!==null&&we!==void 0?we:void 0,ce=i.size;var Y=se-ue;if(re=Ta(Y)?0:Y,J={x:X,y:x.top,width:ce,height:x.height},Math.abs(oe)>0&&Math.abs(re)0&&Math.abs(ce)w.createElement(w.Fragment,null,w.createElement(u7,{legendPayload:epe(t)}),w.createElement(XC,{fn:tpe,args:t}),w.createElement(d7,{type:"bar",id:r,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:Nre(t.stackId),hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:n}),w.createElement(Kr,{zIndex:t.zIndex},w.createElement(dpe,rs({},t,{id:r})))))}var $g=w.memo(mpe);$g.displayName="Bar";function R5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function bg(e){for(var t=1;tt,bpe=(e,t,n)=>n,xpe=(e,t,n,r)=>r,wpe=(e,t,n,r,i)=>i,Sm=Ce([i0,wpe],(e,t)=>e.filter(n=>n.type==="bar").find(n=>n.id===t)),_pe=Ce([Sm],e=>e?.maxBarSize),Spe=(e,t,n,r,i,o)=>o,D5=(e,t,n)=>{var r=n??e;if(!yn(r))return kr(r,t,0)},Cpe=Ce([Mt,i0,ype,bpe,xpe],(e,t,n,r,i)=>t.filter(o=>e==="horizontal"?o.xAxisId===n:o.yAxisId===r).filter(o=>o.isPanorama===i).filter(o=>o.hide===!1).filter(o=>o.type==="bar")),Epe=(e,t,n,r)=>{var i=Mt(e);return i==="horizontal"?Fw(e,"yAxis",n,r):Fw(e,"xAxis",t,r)},Ape=(e,t,n)=>{var r=Mt(e);return r==="horizontal"?NP(e,"xAxis",t):NP(e,"yAxis",n)},Tpe=(e,t,n)=>{var r={},i=e.filter(t0),o=e.filter(h=>h.stackId==null),l=i.reduce((h,m)=>(h[m.stackId]||(h[m.stackId]=[]),h[m.stackId].push(m),h),r),c=Object.entries(l).map(h=>{var[m,y]=h,x=y.map(C=>C.dataKey),b=D5(t,n,y[0].barSize);return{stackId:m,dataKeys:x,barSize:b}}),f=o.map(h=>{var m=[h.dataKey].filter(x=>x!=null),y=D5(t,n,h.barSize);return{stackId:void 0,dataKeys:m,barSize:y}});return[...c,...f]},Ope=Ce([Cpe,Ale,Ape],Tpe),jpe=(e,t,n,r,i)=>{var o,l,c=Sm(e,t,n,r,i);if(c!=null){var f=Mt(e),h=M8(e),{maxBarSize:m}=c,y=yn(m)?h:m,x,b;return f==="horizontal"?(x=Sl(e,"xAxis",t,r),b=_l(e,"xAxis",t,r)):(x=Sl(e,"yAxis",n,r),b=_l(e,"yAxis",n,r)),(o=(l=pf(x,b,!0))!==null&&l!==void 0?l:y)!==null&&o!==void 0?o:0}},y7=(e,t,n,r)=>{var i=Mt(e),o,l;return i==="horizontal"?(o=Sl(e,"xAxis",t,r),l=_l(e,"xAxis",t,r)):(o=Sl(e,"yAxis",n,r),l=_l(e,"yAxis",n,r)),pf(o,l)};function Mpe(e,t,n,r,i){var o=r.length;if(!(o<1)){var l=kr(e,n,0,!0),c,f=[];if(Bn(r[0].barSize)){var h=!1,m=n/o,y=r.reduce((O,P)=>O+(P.barSize||0),0);y+=(o-1)*l,y>=n&&(y-=(o-1)*l,l=0),y>=n&&m>0&&(h=!0,m*=.9,y=o*m);var x=(n-y)/2>>0,b={offset:x-l,size:0};c=r.reduce((O,P)=>{var N,F={stackId:P.stackId,dataKeys:P.dataKeys,position:{offset:b.offset+b.size+l,size:h?m:(N=P.barSize)!==null&&N!==void 0?N:0}},U=[...O,F];return b=U[U.length-1].position,U},f)}else{var C=kr(t,n,0,!0);n-2*C-(o-1)*l<=0&&(l=0);var _=(n-2*C-(o-1)*l)/o;_>1&&(_>>=0);var A=Bn(i)?Math.min(_,i):_;c=r.reduce((O,P,N)=>[...O,{stackId:P.stackId,dataKeys:P.dataKeys,position:{offset:C+(_+l)*N+(_-A)/2,size:A}}],f)}return c}}var Ppe=(e,t,n,r,i,o,l)=>{var c=yn(l)?t:l,f=Mpe(n,r,i!==o?i:o,e,c);return i!==o&&f!=null&&(f=f.map(h=>bg(bg({},h),{},{position:bg(bg({},h.position),{},{offset:h.position.offset-i/2})}))),f},Lpe=Ce([Ope,M8,Ele,P8,jpe,y7,_pe],Ppe),Npe=(e,t,n,r)=>Sl(e,"xAxis",t,r),Rpe=(e,t,n,r)=>Sl(e,"yAxis",n,r),Dpe=(e,t,n,r)=>_l(e,"xAxis",t,r),kpe=(e,t,n,r)=>_l(e,"yAxis",n,r),Ipe=Ce([Lpe,Sm],(e,t)=>{if(!(e==null||t==null)){var n=e.find(r=>r.stackId===t.stackId&&t.dataKey!=null&&r.dataKeys.includes(t.dataKey));if(n!=null)return n.position}}),zpe=(e,t)=>{var n=cC(t);if(!(!e||n==null||t==null)){var{stackId:r}=t;if(r!=null){var i=e[r];if(i){var{stackedData:o}=i;if(o)return o.find(l=>l.key===n)}}}},Upe=Ce([Epe,Sm],zpe),Bpe=Ce([lr,OS,Npe,Rpe,Dpe,kpe,Ipe,Mt,Xy,y7,Upe,Sm,Spe],(e,t,n,r,i,o,l,c,f,h,m,y,x)=>{var{chartData:b,dataStartIndex:C,dataEndIndex:_}=f;if(!(y==null||l==null||t==null||c!=="horizontal"&&c!=="vertical"||n==null||r==null||i==null||o==null||h==null)){var{data:A}=y,O;if(A!=null&&A.length>0?O=A:O=b?.slice(C,_+1),O!=null)return hpe({layout:c,barSettings:y,pos:l,parentViewBox:t,bandSize:h,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:o,stackedData:m,displayedData:O,offset:e,cells:x,dataStartIndex:C})}}),b7=e=>{var{chartData:t}=e,n=cn(),r=jr();return w.useEffect(()=>r?()=>{}:(n(GP(t)),()=>{n(GP(void 0))}),[t,n,r]),null},k5={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},x7=jt({name:"brush",initialState:k5,reducers:{setBrushSettings(e,t){return t.payload==null?k5:t.payload}}}),{setBrushSettings:O_e}=x7.actions,Fpe=x7.reducer;function I5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function xg(e){for(var t=1;t{var{x:n,y:r}=e,{x:i,y:o}=t;return{x:Math.min(n,i),y:Math.min(r,o),width:Math.abs(i-n),height:Math.abs(o-r)}};class h0{static create(t){return new h0(t)}constructor(t){this.scale=t}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(t){var{bandAware:n,position:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t!==void 0){if(r)switch(r){case"start":return this.scale(t);case"middle":{var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+i}case"end":{var o=this.bandwidth?this.bandwidth():0;return this.scale(t)+o}default:return this.scale(t)}if(n){var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+l}return this.scale(t)}}isInRange(t){var n=this.range(),r=n[0],i=n[n.length-1];return r<=i?t>=r&&t<=i:t>=i&&t<=r}}w7(h0,"EPS",1e-4);var qpe=e=>{var t=Object.keys(e).reduce((n,r)=>xg(xg({},n),{},{[r]:h0.create(e[r])}),{});return xg(xg({},t),{},{apply(n){var{bandAware:r,position:i}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.fromEntries(Object.entries(n).map(o=>{var[l,c]=o;return[l,t[l].apply(c,{bandAware:r,position:i})]}))},isInRange(n){return Object.keys(n).every(r=>t[r].isInRange(n[r]))}})};function Gpe(e){return(e%180+180)%180}var Ype=function(t){var{width:n,height:r}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=Gpe(i),l=o*Math.PI/180,c=Math.atan(r/n),f=l>c&&l{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=Vo(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=Vo(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=Vo(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:j_e,removeDot:M_e,addArea:Kpe,removeArea:Zpe,addLine:P_e,removeLine:L_e}=_7.actions,Xpe=_7.reducer,S7=w.createContext(void 0),Qpe=e=>{var{children:t}=e,[n]=w.useState("".concat(Ih("recharts"),"-clip")),r=e3();if(r==null)return null;var{x:i,y:o,width:l,height:c}=r;return w.createElement(S7.Provider,{value:n},w.createElement("defs",null,w.createElement("clipPath",{id:n},w.createElement("rect",{x:i,y:o,height:c,width:l}))),t)},Jpe=()=>w.useContext(S7);function z5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function U5(e){for(var t=1;t{var{x1:c,x2:f,y1:h,y2:m}=l;if(i==null||o==null)return null;var y=qpe({x:i,y:o}),x={x:e?y.x.apply(c,{position:"start"}):y.x.rangeMin,y:n?y.y.apply(h,{position:"start"}):y.y.rangeMin},b={x:t?y.x.apply(f,{position:"end"}):y.x.rangeMax,y:r?y.y.apply(m,{position:"end"}):y.y.rangeMax};return l.ifOverflow==="discard"&&(!y.isInRange(x)||!y.isInRange(b))?null:Hpe(x,b)},ige=(e,t)=>{var n;return w.isValidElement(e)?n=w.cloneElement(e,t):typeof e=="function"?n=e(t):n=w.createElement(PS,Gv({},t,{className:"recharts-reference-area-rect"})),n};function age(e){var t=cn();return w.useEffect(()=>(t(Kpe(e)),()=>{t(Zpe(e))})),null}function oge(e){var{x1:t,x2:n,y1:r,y2:i,className:o,shape:l,xAxisId:c,yAxisId:f}=e,h=Jpe(),m=jr(),y=Ze(F=>wl(F,"xAxis",c,m)),x=Ze(F=>wl(F,"yAxis",f,m));if(y==null||!x==null)return null;var b=ci(t),C=ci(n),_=ci(r),A=ci(i);if(!b&&!C&&!_&&!A&&!l)return null;var O=rge(b,C,_,A,y,x,e);if(!O&&!l)return null;var P=e.ifOverflow==="hidden",N=P?"url(#".concat(h,")"):void 0;return w.createElement(Kr,{zIndex:e.zIndex},w.createElement(ar,{className:Oe("recharts-reference-area",o)},ige(l,U5(U5({clipPath:N},zr(e)),O)),O!=null&&w.createElement(ZI,Gv({},O,{lowerWidth:O.width,upperWidth:O.width}),w.createElement(QI,{label:e.label}),e.children)))}var sge={ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1,zIndex:Un.area};function C7(e){var t=sr(e,sge);return w.createElement(w.Fragment,null,w.createElement(age,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2}),w.createElement(oge,t))}C7.displayName="ReferenceArea";function bf(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function E7(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],r=0;re*i)return!1;var o=n();return e*(t-e*o/2-r)>=0&&e*(t+e*o/2-i)<=0}function cge(e,t){return E7(e,t+1)}function fge(e,t,n,r,i){for(var o=(r||[]).slice(),{start:l,end:c}=t,f=0,h=1,m=l,y=function(){var C=r?.[f];if(C===void 0)return{v:E7(r,h)};var _=f,A,O=()=>(A===void 0&&(A=n(C,_)),A),P=C.coordinate,N=f===0||Yv(e,P,O,m,c);N||(f=0,m=l,h+=1),N&&(m=P+e*(O()/2+i),f+=h)},x;h<=o.length;)if(x=y(),x)return x.v;return[]}function B5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Nr(e){for(var t=1;t(C===void 0&&(C=n(b,x)),C);if(x===l-1){var A=e*(b.coordinate+e*_()/2-f);o[x]=b=Nr(Nr({},b),{},{tickCoord:A>0?b.coordinate-A*e:b.coordinate})}else o[x]=b=Nr(Nr({},b),{},{tickCoord:b.coordinate});if(b.tickCoord!=null){var O=Yv(e,b.tickCoord,_,c,f);O&&(f=b.tickCoord-e*(_()/2+i),o[x]=Nr(Nr({},b),{},{isShow:!0}))}},m=l-1;m>=0;m--)h(m);return o}function gge(e,t,n,r,i,o){var l=(r||[]).slice(),c=l.length,{start:f,end:h}=t;if(o){var m=r[c-1],y=n(m,c-1),x=e*(m.coordinate+e*y/2-h);if(l[c-1]=m=Nr(Nr({},m),{},{tickCoord:x>0?m.coordinate-x*e:m.coordinate}),m.tickCoord!=null){var b=Yv(e,m.tickCoord,()=>y,f,h);b&&(h=m.tickCoord-e*(y/2+i),l[c-1]=Nr(Nr({},m),{},{isShow:!0}))}}for(var C=o?c-1:c,_=function(P){var N=l[P],F,U=()=>(F===void 0&&(F=n(N,P)),F);if(P===0){var W=e*(N.coordinate-e*U()/2-f);l[P]=N=Nr(Nr({},N),{},{tickCoord:W<0?N.coordinate-W*e:N.coordinate})}else l[P]=N=Nr(Nr({},N),{},{tickCoord:N.coordinate});if(N.tickCoord!=null){var X=Yv(e,N.tickCoord,U,f,h);X&&(f=N.tickCoord+e*(U()/2+i),l[P]=Nr(Nr({},N),{},{isShow:!0}))}},A=0;A{var U=typeof h=="function"?h(N.value,F):N.value;return C==="width"?lge(Sh(U,{fontSize:t,letterSpacing:n}),_,y):Sh(U,{fontSize:t,letterSpacing:n})[C]},O=i.length>=2?yr(i[1].coordinate-i[0].coordinate):1,P=uge(o,O,C);return f==="equidistantPreserveStart"?fge(O,P,A,i,l):(f==="preserveStart"||f==="preserveStartEnd"?b=gge(O,P,A,i,l,f==="preserveStartEnd"):b=pge(O,P,A,i,l),b.filter(N=>N.isShow))}var vge=e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:o=0}=e,l=0;if(t){Array.from(t).forEach(m=>{if(m){var y=m.getBoundingClientRect();y.width>l&&(l=y.width)}});var c=n?n.getBoundingClientRect().width:0,f=i+o,h=l+f+c+(n?r:0);return Math.round(h)}return 0},yge=["axisLine","width","height","className","hide","ticks","axisType"],bge=["viewBox"],xge=["viewBox"];function Xw(e,t){if(e==null)return{};var n,r,i=wge(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r{var{ticks:n=[],tick:r,tickLine:i,stroke:o,tickFormatter:l,unit:c,padding:f,tickTextProps:h,orientation:m,mirror:y,x,y:b,width:C,height:_,tickSize:A,tickMargin:O,fontSize:P,letterSpacing:N,getTicksConfig:F,events:U,axisType:W}=e,X=n3(Wn(Wn({},F),{},{ticks:n}),P,N),ae=Tge(m,y),ce=Oge(m,y),re=Di(F),J=$u(r),oe={};typeof i=="object"&&(oe=i);var we=Wn(Wn({},re),{},{fill:"none"},oe),se=X.map(k=>Wn({entry:k},Age(k,x,b,C,_,m,A,y,O))),ue=se.map(k=>{var{entry:z,line:H}=k;return w.createElement(ar,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(z.value,"-").concat(z.coordinate,"-").concat(z.tickCoord)},i&&w.createElement("line",Gu({},we,H,{className:Oe("recharts-cartesian-axis-tick-line",Vu(i,"className"))})))}),Y=se.map((k,z)=>{var{entry:H,tick:I}=k,j=Wn(Wn(Wn(Wn({textAnchor:ae,verticalAnchor:ce},re),{},{stroke:"none",fill:o},J),I),{},{index:z,payload:H,visibleTicksCount:X.length,tickFormatter:l,padding:f},h);return w.createElement(ar,Gu({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(H.value,"-").concat(H.coordinate,"-").concat(H.tickCoord)},Iy(U,H,z)),r&&w.createElement(jge,{option:r,tickProps:j,value:"".concat(typeof l=="function"?l(H.value,z):H.value).concat(c||"")}))});return w.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(W,"-ticks")},Y.length>0&&w.createElement(Kr,{zIndex:Un.label},w.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(W,"-tick-labels"),ref:t},Y)),ue.length>0&&w.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(W,"-tick-lines")},ue))}),Pge=w.forwardRef((e,t)=>{var{axisLine:n,width:r,height:i,className:o,hide:l,ticks:c,axisType:f}=e,h=Xw(e,yge),[m,y]=w.useState(""),[x,b]=w.useState(""),C=w.useRef(null);w.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var A;return vge({ticks:C.current,label:(A=e.labelRef)===null||A===void 0?void 0:A.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var _=w.useCallback(A=>{if(A){var O=A.getElementsByClassName("recharts-cartesian-axis-tick-value");C.current=O;var P=O[0];if(P){var N=window.getComputedStyle(P),F=N.fontSize,U=N.letterSpacing;(F!==m||U!==x)&&(y(F),b(U))}}},[m,x]);return l||r!=null&&r<=0||i!=null&&i<=0?null:w.createElement(Kr,{zIndex:e.zIndex},w.createElement(ar,{className:Oe("recharts-cartesian-axis",o)},w.createElement(Ege,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:Di(e)}),w.createElement(Mge,{ref:_,axisType:f,events:h,fontSize:m,getTicksConfig:e,height:e.height,letterSpacing:x,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:c,unit:e.unit,width:e.width,x:e.x,y:e.y}),w.createElement(ZI,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},w.createElement(QI,{label:e.label,labelRef:e.labelRef}),e.children)))}),Lge=w.memo(Pge,(e,t)=>{var{viewBox:n}=e,r=Xw(e,bge),{viewBox:i}=t,o=Xw(t,xge);return bf(n,i)&&bf(r,o)}),i3=w.forwardRef((e,t)=>{var n=sr(e,r3);return w.createElement(Lge,Gu({},n,{ref:t}))});i3.displayName="CartesianAxis";var Nge=["x1","y1","x2","y2","key"],Rge=["offset"],Dge=["xAxisId","yAxisId"],kge=["xAxisId","yAxisId"];function $5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Rr(e){for(var t=1;t{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:n,x:r,y:i,width:o,height:l,ry:c}=e;return w.createElement("rect",{x:r,y:i,ry:c,width:o,height:l,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function A7(e){var{option:t,lineItemProps:n}=e,r;if(w.isValidElement(t))r=w.cloneElement(t,n);else if(typeof t=="function")r=t(n);else{var i,{x1:o,y1:l,x2:c,y2:f,key:h}=n,m=Wv(n,Nge),y=(i=Di(m))!==null&&i!==void 0?i:{},{offset:x}=y,b=Wv(y,Rge);r=w.createElement("line",Ou({},b,{x1:o,y1:l,x2:c,y2:f,fill:"none",key:h}))}return r}function $ge(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:o,yAxisId:l}=e,c=Wv(e,Dge),f=i.map((h,m)=>{var y=Rr(Rr({},c),{},{x1:t,y1:h,x2:t+n,y2:h,key:"line-".concat(m),index:m});return w.createElement(A7,{key:"line-".concat(m),option:r,lineItemProps:y})});return w.createElement("g",{className:"recharts-cartesian-grid-horizontal"},f)}function Vge(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:o,yAxisId:l}=e,c=Wv(e,kge),f=i.map((h,m)=>{var y=Rr(Rr({},c),{},{x1:h,y1:t,x2:h,y2:t+n,key:"line-".concat(m),index:m});return w.createElement(A7,{option:r,lineItemProps:y,key:"line-".concat(m)})});return w.createElement("g",{className:"recharts-cartesian-grid-vertical"},f)}function Hge(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:o,height:l,horizontalPoints:c,horizontal:f=!0}=e;if(!f||!t||!t.length||c==null)return null;var h=c.map(y=>Math.round(y+i-i)).sort((y,x)=>y-x);i!==h[0]&&h.unshift(0);var m=h.map((y,x)=>{var b=!h[x+1],C=b?i+l-y:h[x+1]-y;if(C<=0)return null;var _=x%t.length;return w.createElement("rect",{key:"react-".concat(x),y,x:r,height:C,width:o,stroke:"none",fill:t[_],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return w.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},m)}function qge(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:o,width:l,height:c,verticalPoints:f}=e;if(!t||!n||!n.length)return null;var h=f.map(y=>Math.round(y+i-i)).sort((y,x)=>y-x);i!==h[0]&&h.unshift(0);var m=h.map((y,x)=>{var b=!h[x+1],C=b?i+l-y:h[x+1]-y;if(C<=0)return null;var _=x%n.length;return w.createElement("rect",{key:"react-".concat(x),x:y,y:o,width:C,height:c,stroke:"none",fill:n[_],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return w.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},m)}var Gge=(e,t)=>{var{xAxis:n,width:r,height:i,offset:o}=e;return ck(n3(Rr(Rr(Rr({},r3),n),{},{ticks:fk(n),viewBox:{x:0,y:0,width:r,height:i}})),o.left,o.left+o.width,t)},Yge=(e,t)=>{var{yAxis:n,width:r,height:i,offset:o}=e;return ck(n3(Rr(Rr(Rr({},r3),n),{},{ticks:fk(n),viewBox:{x:0,y:0,width:r,height:i}})),o.top,o.top+o.height,t)},Wge={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Un.grid};function a3(e){var t=xk(),n=wk(),r=bk(),i=Rr(Rr({},sr(e,Wge)),{},{x:Xe(e.x)?e.x:r.left,y:Xe(e.y)?e.y:r.top,width:Xe(e.width)?e.width:r.width,height:Xe(e.height)?e.height:r.height}),{xAxisId:o,yAxisId:l,x:c,y:f,width:h,height:m,syncWithTicks:y,horizontalValues:x,verticalValues:b}=i,C=jr(),_=Ze(ce=>RP(ce,"xAxis",o,C)),A=Ze(ce=>RP(ce,"yAxis",l,C));if(!ao(h)||!ao(m)||!Xe(c)||!Xe(f))return null;var O=i.verticalCoordinatesGenerator||Gge,P=i.horizontalCoordinatesGenerator||Yge,{horizontalPoints:N,verticalPoints:F}=i;if((!N||!N.length)&&typeof P=="function"){var U=x&&x.length,W=P({yAxis:A?Rr(Rr({},A),{},{ticks:U?x:A.ticks}):void 0,width:t??h,height:n??m,offset:r},U?!0:y);wv(Array.isArray(W),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof W,"]")),Array.isArray(W)&&(N=W)}if((!F||!F.length)&&typeof O=="function"){var X=b&&b.length,ae=O({xAxis:_?Rr(Rr({},_),{},{ticks:X?b:_.ticks}):void 0,width:t??h,height:n??m,offset:r},X?!0:y);wv(Array.isArray(ae),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof ae,"]")),Array.isArray(ae)&&(F=ae)}return w.createElement(Kr,{zIndex:i.zIndex},w.createElement("g",{className:"recharts-cartesian-grid"},w.createElement(Fge,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),w.createElement(Hge,Ou({},i,{horizontalPoints:N})),w.createElement(qge,Ou({},i,{verticalPoints:F})),w.createElement($ge,Ou({},i,{offset:r,horizontalPoints:N,xAxis:_,yAxis:A})),w.createElement(Vge,Ou({},i,{offset:r,verticalPoints:F,xAxis:_,yAxis:A}))))}a3.displayName="CartesianGrid";var T7=(e,t,n,r)=>Sl(e,"xAxis",t,r),O7=(e,t,n,r)=>_l(e,"xAxis",t,r),j7=(e,t,n,r)=>Sl(e,"yAxis",n,r),M7=(e,t,n,r)=>_l(e,"yAxis",n,r),Kge=Ce([Mt,T7,j7,O7,M7],(e,t,n,r,i)=>jl(e,"xAxis")?pf(t,r,!1):pf(n,i,!1)),Zge=(e,t,n,r,i)=>i;function Xge(e){return e.type==="line"}var Qge=Ce([i0,Zge],(e,t)=>e.filter(Xge).find(n=>n.id===t)),Jge=Ce([Mt,T7,j7,O7,M7,Qge,Kge,Xy],(e,t,n,r,i,o,l,c)=>{var{chartData:f,dataStartIndex:h,dataEndIndex:m}=c;if(!(o==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||l==null)){var{dataKey:y,data:x}=o,b;if(x!=null&&x.length>0?b=x:b=f?.slice(h,m+1),b!=null)return xve({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:y,bandSize:l,displayedData:b})}});function eve(e){var t=$u(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:o}=t,l=Number(i),c=Number(o);return(Number.isNaN(l)||l<0)&&(l=n),(Number.isNaN(c)||c<0)&&(c=r),{r:l,strokeWidth:c}}return{r:n,strokeWidth:r}}var tve=["id"],nve=["type","layout","connectNulls","needClip","shape"],rve=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function qh(){return qh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:r,value:Rf(n,t),payload:e}]};function uve(e){var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:o,name:l,hide:c,unit:f}=e;return{dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:o,dataKey:t,nameKey:void 0,name:Rf(l,t),hide:c,type:e.tooltipType,color:e.stroke,unit:f}}}var P7=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function cve(e,t){for(var n=e.length%2!==0?[...e,0]:e,r=[],i=0;i{var r=n.reduce((y,x)=>y+x);if(!r)return P7(t,e);for(var i=Math.floor(e/r),o=e%r,l=t-e,c=[],f=0,h=0;fo){c=[...n.slice(0,f),o-h];break}var m=c.length%2===0?[0,l]:[l];return[...cve(n,i),...c,...m].map(y=>"".concat(y,"px")).join(", ")};function dve(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:o,needClip:l}=r,{id:c}=r,f=o3(r,tve),h=Di(f);return w.createElement(ume,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:o,baseProps:h,needClip:l,clipPathId:t})}function hve(e){var{showLabels:t,children:n,points:r}=e,i=w.useMemo(()=>r?.map(o=>{var l,c,f={x:(l=o.x)!==null&&l!==void 0?l:0,y:(c=o.y)!==null&&c!==void 0?c:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Qa(Qa({},f),{},{value:o.value,payload:o.payload,viewBox:f,parentViewBox:void 0,fill:void 0})}),[r]);return w.createElement(e7,{value:t?i:void 0},n)}function H5(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:o}=e,{type:l,layout:c,connectNulls:f,needClip:h,shape:m}=o,y=o3(o,nve),x=Qa(Qa({},zr(y)),{},{fill:"none",className:"recharts-line-curve",clipPath:h?"url(#clipPath-".concat(t,")"):void 0,points:r,type:l,layout:c,connectNulls:f,strokeDasharray:i??o.strokeDasharray});return w.createElement(w.Fragment,null,r?.length>1&&w.createElement(YC,qh({shapeType:"curve",option:m},x,{pathRef:n})),w.createElement(dve,{points:r,clipPathId:t,props:o}))}function mve(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function pve(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:o}=e,{points:l,strokeDasharray:c,isAnimationActive:f,animationBegin:h,animationDuration:m,animationEasing:y,animateNewValues:x,width:b,height:C,onAnimationEnd:_,onAnimationStart:A}=n,O=i.current,P=fm(n,"recharts-line-"),[N,F]=w.useState(!1),U=!N,W=w.useCallback(()=>{typeof _=="function"&&_(),F(!1)},[_]),X=w.useCallback(()=>{typeof A=="function"&&A(),F(!0)},[A]),ae=mve(r.current),ce=o.current;return w.createElement(hve,{points:l,showLabels:U},n.children,w.createElement(cm,{animationId:P,begin:h,duration:m,isActive:f,easing:y,onAnimationEnd:W,onAnimationStart:X,key:P},re=>{var J=mn(ce,ae+ce,re),oe=Math.min(J,ae),we;if(f)if(c){var se="".concat(c).split(/[,\s]+/gim).map(k=>parseFloat(k));we=fve(oe,ae,se)}else we=P7(ae,oe);else we=c==null?void 0:String(c);if(O){var ue=O.length/l.length,Y=re===1?l:l.map((k,z)=>{var H=Math.floor(z*ue);if(O[H]){var I=O[H];return Qa(Qa({},k),{},{x:mn(I.x,k.x,re),y:mn(I.y,k.y,re)})}return x?Qa(Qa({},k),{},{x:mn(b*2,k.x,re),y:mn(C/2,k.y,re)}):Qa(Qa({},k),{},{x:k.x,y:k.y})});return i.current=Y,w.createElement(H5,{props:n,points:Y,clipPathId:t,pathRef:r,strokeDasharray:we})}return re>0&&ae>0&&(i.current=l,o.current=oe),w.createElement(H5,{props:n,points:l,clipPathId:t,pathRef:r,strokeDasharray:we})}),w.createElement(VC,{label:n.label}))}function gve(e){var{clipPathId:t,props:n}=e,r=w.useRef(null),i=w.useRef(0),o=w.useRef(null);return w.createElement(pve,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:o})}var vve=(e,t)=>{var n,r;return{x:(n=e.x)!==null&&n!==void 0?n:void 0,y:(r=e.y)!==null&&r!==void 0?r:void 0,value:e.value,errorVal:nn(e.payload,t)}};class yve extends w.Component{render(){var{hide:t,dot:n,points:r,className:i,xAxisId:o,yAxisId:l,top:c,left:f,width:h,height:m,id:y,needClip:x,zIndex:b}=this.props;if(t)return null;var C=Oe("recharts-line",i),_=y,{r:A,strokeWidth:O}=eve(n),P=l7(n),N=A*2+O;return w.createElement(Kr,{zIndex:b},w.createElement(ar,{className:C},x&&w.createElement("defs",null,w.createElement(g7,{clipPathId:_,xAxisId:o,yAxisId:l}),!P&&w.createElement("clipPath",{id:"clipPath-dots-".concat(_)},w.createElement("rect",{x:f-N/2,y:c-N/2,width:h+N,height:m+N}))),w.createElement(p7,{xAxisId:o,yAxisId:l,data:r,dataPointFormatter:vve,errorBarOffset:0},w.createElement(gve,{props:this.props,clipPathId:_}))),w.createElement(Tme,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey}))}}var L7={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:!Ml.isSsr,label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Un.line};function bve(e){var t=sr(e,L7),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:o,animationEasing:l,connectNulls:c,dot:f,hide:h,isAnimationActive:m,label:y,legendType:x,xAxisId:b,yAxisId:C,id:_}=t,A=o3(t,rve),{needClip:O}=t3(b,C),P=e3(),N=um(),F=jr(),U=Ze(re=>Jge(re,b,C,F,_));if(N!=="horizontal"&&N!=="vertical"||U==null||P==null)return null;var{height:W,width:X,x:ae,y:ce}=P;return w.createElement(yve,qh({},A,{id:_,connectNulls:c,dot:f,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:o,animationEasing:l,isAnimationActive:m,hide:h,label:y,legendType:x,xAxisId:b,yAxisId:C,points:U,layout:N,height:W,width:X,left:ae,top:ce,needClip:O}))}function xve(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:o,dataKey:l,bandSize:c,displayedData:f}=e;return f.map((h,m)=>{var y=nn(h,l);if(t==="horizontal"){var x=sM({axis:n,ticks:i,bandSize:c,entry:h,index:m}),b=yn(y)?null:r.scale(y);return{x,y:b,value:y,payload:h}}var C=yn(y)?null:n.scale(y),_=sM({axis:r,ticks:o,bandSize:c,entry:h,index:m});return C==null||_==null?null:{x:C,y:_,value:y,payload:h}}).filter(Boolean)}function wve(e){var t=sr(e,L7),n=jr();return w.createElement(QC,{id:t.id,type:"line"},r=>w.createElement(w.Fragment,null,w.createElement(u7,{legendPayload:lve(t)}),w.createElement(XC,{fn:uve,args:t}),w.createElement(d7,{type:"line",id:r,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),w.createElement(bve,qh({},t,{id:r}))))}var N7=w.memo(wve);N7.displayName="Line";var _ve=["dangerouslySetInnerHTML","ticks"],Sve=["id"],Cve=["domain"],Eve=["domain"];function Qw(){return Qw=Object.assign?Object.assign.bind():function(e){for(var t=1;t(t(mme(e)),()=>{t(pme(e))}),[e,t]),null}var Ove=e=>{var{xAxisId:t,className:n}=e,r=Ze(OS),i=jr(),o="xAxis",l=Ze(A=>wl(A,o,t,i)),c=Ze(A=>uI(A,o,t,i)),f=Ze(A=>aI(A,t)),h=Ze(A=>Sue(A,t)),m=Ze(A=>U8(A,t));if(f==null||h==null||m==null)return null;var{dangerouslySetInnerHTML:y,ticks:x}=e,b=Kv(e,_ve),{id:C}=m,_=Kv(m,Sve);return w.createElement(i3,Qw({},b,_,{scale:l,x:h.x,y:h.y,width:f.width,height:f.height,className:Oe("recharts-".concat(o," ").concat(o),n),viewBox:r,ticks:c,axisType:o}))},jve={allowDataOverflow:Ci.allowDataOverflow,allowDecimals:Ci.allowDecimals,allowDuplicatedCategory:Ci.allowDuplicatedCategory,height:Ci.height,hide:!1,mirror:Ci.mirror,orientation:Ci.orientation,padding:Ci.padding,reversed:Ci.reversed,scale:Ci.scale,tickCount:Ci.tickCount,type:Ci.type,xAxisId:0},Mve=e=>{var t,n,r,i,o,l=sr(e,jve);return w.createElement(w.Fragment,null,w.createElement(Tve,{interval:(t=l.interval)!==null&&t!==void 0?t:"preserveEnd",id:l.xAxisId,scale:l.scale,type:l.type,padding:l.padding,allowDataOverflow:l.allowDataOverflow,domain:l.domain,dataKey:l.dataKey,allowDuplicatedCategory:l.allowDuplicatedCategory,allowDecimals:l.allowDecimals,tickCount:l.tickCount,includeHidden:(n=l.includeHidden)!==null&&n!==void 0?n:!1,reversed:l.reversed,ticks:l.ticks,height:l.height,orientation:l.orientation,mirror:l.mirror,hide:l.hide,unit:l.unit,name:l.name,angle:(r=l.angle)!==null&&r!==void 0?r:0,minTickGap:(i=l.minTickGap)!==null&&i!==void 0?i:5,tick:(o=l.tick)!==null&&o!==void 0?o:!0,tickFormatter:l.tickFormatter}),w.createElement(Ove,l))},Pve=(e,t)=>{var{domain:n}=e,r=Kv(e,Cve),{domain:i}=t,o=Kv(t,Eve);return bf(r,o)?Array.isArray(n)&&n.length===2&&Array.isArray(i)&&i.length===2?n[0]===i[0]&&n[1]===i[1]:bf({domain:n},{domain:i}):!1},s3=w.memo(Mve,Pve);s3.displayName="XAxis";var Lve=["dangerouslySetInnerHTML","ticks"],Nve=["id"],Rve=["domain"],Dve=["domain"];function Jw(){return Jw=Object.assign?Object.assign.bind():function(e){for(var t=1;t(t(gme(e)),()=>{t(vme(e))}),[e,t]),null}var zve=e=>{var{yAxisId:t,className:n,width:r,label:i}=e,o=w.useRef(null),l=w.useRef(null),c=Ze(OS),f=jr(),h=cn(),m="yAxis",y=Ze(U=>wl(U,m,t,f)),x=Ze(U=>oI(U,t)),b=Ze(U=>Eue(U,t)),C=Ze(U=>uI(U,m,t,f)),_=Ze(U=>B8(U,t));if(w.useLayoutEffect(()=>{if(!(r!=="auto"||!x||$C(i)||w.isValidElement(i)||_==null)){var U=o.current;if(U){var W=U.getCalculatedWidth();Math.round(x.width)!==Math.round(W)&&h(yme({id:t,width:W}))}}},[C,x,h,i,t,r,_]),x==null||b==null||_==null)return null;var{dangerouslySetInnerHTML:A,ticks:O}=e,P=Zv(e,Lve),{id:N}=_,F=Zv(_,Nve);return w.createElement(i3,Jw({},P,F,{ref:o,labelRef:l,scale:y,x:b.x,y:b.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:x.width,height:x.height,className:Oe("recharts-".concat(m," ").concat(m),n),viewBox:c,ticks:C,axisType:m}))},Uve={allowDataOverflow:Ei.allowDataOverflow,allowDecimals:Ei.allowDecimals,allowDuplicatedCategory:Ei.allowDuplicatedCategory,hide:!1,mirror:Ei.mirror,orientation:Ei.orientation,padding:Ei.padding,reversed:Ei.reversed,scale:Ei.scale,tickCount:Ei.tickCount,type:Ei.type,width:Ei.width,yAxisId:0},Bve=e=>{var t,n,r,i,o,l=sr(e,Uve);return w.createElement(w.Fragment,null,w.createElement(Ive,{interval:(t=l.interval)!==null&&t!==void 0?t:"preserveEnd",id:l.yAxisId,scale:l.scale,type:l.type,domain:l.domain,allowDataOverflow:l.allowDataOverflow,dataKey:l.dataKey,allowDuplicatedCategory:l.allowDuplicatedCategory,allowDecimals:l.allowDecimals,tickCount:l.tickCount,padding:l.padding,includeHidden:(n=l.includeHidden)!==null&&n!==void 0?n:!1,reversed:l.reversed,ticks:l.ticks,width:l.width,orientation:l.orientation,mirror:l.mirror,hide:l.hide,unit:l.unit,name:l.name,angle:(r=l.angle)!==null&&r!==void 0?r:0,minTickGap:(i=l.minTickGap)!==null&&i!==void 0?i:5,tick:(o=l.tick)!==null&&o!==void 0?o:!0,tickFormatter:l.tickFormatter}),w.createElement(zve,l))},Fve=(e,t)=>{var{domain:n}=e,r=Zv(e,Rve),{domain:i}=t,o=Zv(t,Dve);return bf(r,o)?Array.isArray(n)&&n.length===2&&Array.isArray(i)&&i.length===2?n[0]===i[0]&&n[1]===i[1]:bf({domain:n},{domain:i}):!1},l3=w.memo(Bve,Fve);l3.displayName="YAxis";var $ve=(e,t)=>t,u3=Ce([$ve,Mt,I8,cr,AI,ms,kce,lr],Vce),c3=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},R7=un("mouseClick"),D7=am();D7.startListening({actionCreator:R7,effect:(e,t)=>{var n=e.payload,r=u3(t.getState(),c3(n));r?.activeIndex!=null&&t.dispatch(zue({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var e_=un("mouseMove"),k7=am();k7.startListening({actionCreator:e_,effect:(e,t)=>{var n=e.payload,r=t.getState(),i=PC(r,r.tooltip.settings.shared),o=u3(r,c3(n));i==="axis"&&(o?.activeIndex!=null?t.dispatch(vI({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(gI()))}});var q5={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0},I7=jt({name:"rootProps",initialState:q5,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:q5.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue}}}),Vve=I7.reducer,{updateOptions:Hve}=I7.actions,z7=jt({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:qve}=z7.actions,Gve=z7.reducer,U7=un("keyDown"),B7=un("focus"),f3=am();f3.startListening({actionCreator:U7,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,o=e.payload;if(!(o!=="ArrowRight"&&o!=="ArrowLeft"&&o!=="Enter")){var l=Number(LC(i,$f(n))),c=ms(n);if(o==="Enter"){var f=Uv(n,"axis","hover",String(i.index));t.dispatch(Vw({active:!i.active,activeIndex:i.index,activeDataKey:i.dataKey,activeCoordinate:f}));return}var h=jue(n),m=h==="left-to-right"?1:-1,y=o==="ArrowRight"?1:-1,x=l+y*m;if(!(c==null||x>=c.length||x<0)){var b=Uv(n,"axis","hover",String(x));t.dispatch(Vw({active:!0,activeIndex:x.toString(),activeDataKey:void 0,activeCoordinate:b}))}}}}});f3.startListening({actionCreator:B7,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var o="0",l=Uv(n,"axis","hover",String(o));t.dispatch(Vw({activeDataKey:void 0,active:!0,activeIndex:o,activeCoordinate:l}))}}}});var ea=un("externalEvent"),F7=am();F7.startListening({actionCreator:ea,effect:(e,t)=>{if(e.payload.handler!=null){var n=t.getState(),r={activeCoordinate:xce(n),activeDataKey:MI(n),activeIndex:Cl(n),activeLabel:jI(n),activeTooltipIndex:Cl(n),isTooltipActive:wce(n)};e.payload.handler(r,e.payload.reactEvent)}}});var Yve=Ce([Ff],e=>e.tooltipItemPayloads),Wve=Ce([Yve,wm,(e,t,n)=>t,(e,t,n)=>n],(e,t,n,r)=>{var i=e.find(c=>c.settings.dataKey===r);if(i!=null){var{positions:o}=i;if(o!=null){var l=t(o,n);return l}}}),$7=un("touchMove"),V7=am();V7.startListening({actionCreator:$7,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),i=PC(r,r.tooltip.settings.shared);if(i==="axis"){var o=u3(r,c3({clientX:n.touches[0].clientX,clientY:n.touches[0].clientY,currentTarget:n.currentTarget}));o?.activeIndex!=null&&t.dispatch(vI({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var l,c=n.touches[0];if(document.elementFromPoint==null)return;var f=document.elementFromPoint(c.clientX,c.clientY);if(!f||!f.getAttribute)return;var h=f.getAttribute(hk),m=(l=f.getAttribute(mk))!==null&&l!==void 0?l:void 0,y=Wve(t.getState(),h,m);t.dispatch(pI({activeDataKey:m,activeIndex:h,activeCoordinate:y}))}}}});var Kve=Ty({brush:Fpe,cartesianAxis:bme,chartData:xfe,errorBars:Ume,graphicalItems:jhe,layout:_re,legend:yie,options:pfe,polarAxis:Hde,polarOptions:Gve,referenceElements:Xpe,rootProps:Vve,tooltip:Uue,zIndex:rfe}),Zve=function(t){return sS({reducer:Kve,preloadedState:t,middleware:n=>n({serializableCheck:!1}).concat([D7.middleware,k7.middleware,f3.middleware,F7.middleware,V7.middleware]),enhancers:n=>{var r=n;return typeof n=="function"&&(r=n()),r.concat(B6({type:"raf"}))},devTools:Ml.devToolsEnabled})};function H7(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=jr(),o=w.useRef(null);if(i)return n;o.current==null&&(o.current=Zve(t));var l=TS;return w.createElement(d_,{context:l,store:o.current},n)}function q7(e){var{layout:t,margin:n}=e,r=cn(),i=jr();return w.useEffect(()=>{i||(r(bre(t)),r(yre(n)))},[r,i,t,n]),null}function G7(e){var t=cn();return w.useEffect(()=>{t(Hve(e))},[t,e]),null}function G5(e){var{zIndex:t,isPanorama:n}=e,r=n?"recharts-zindex-panorama-":"recharts-zindex-",i=c7("".concat(r).concat(t)),o=cn();return w.useLayoutEffect(()=>(o(tfe({zIndex:t,elementId:i,isPanorama:n})),()=>{o(nfe({zIndex:t,isPanorama:n}))}),[o,t,i,n]),w.createElement("g",{id:i})}function Y5(e){var{children:t,isPanorama:n}=e,r=Ze(qce);if(!r||r.length===0)return t;var i=r.filter(l=>l<0),o=r.filter(l=>l>0);return w.createElement(w.Fragment,null,i.map(l=>w.createElement(G5,{key:l,zIndex:l,isPanorama:n})),t,o.map(l=>w.createElement(G5,{key:l,zIndex:l,isPanorama:n})))}var Xve=["children"];function Qve(e,t){if(e==null)return{};var n,r,i=Jve(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r{var n=xk(),r=wk(),i=Ek();if(!ao(n)||!ao(r))return null;var{children:o,otherAttributes:l,title:c,desc:f}=e,h,m;return l!=null&&(typeof l.tabIndex=="number"?h=l.tabIndex:h=i?0:void 0,typeof l.role=="string"?m=l.role:m=i?"application":void 0),w.createElement(TD,Xv({},l,{title:c,desc:f,role:m,tabIndex:h,width:n,height:r,style:eye,ref:t}),o)}),nye=e=>{var{children:t}=e,n=Ze($y);if(!n)return null;var{width:r,height:i,y:o,x:l}=n;return w.createElement(TD,{width:r,height:i,x:l,y:o},t)},W5=w.forwardRef((e,t)=>{var{children:n}=e,r=Qve(e,Xve),i=jr();return i?w.createElement(nye,null,w.createElement(Y5,{isPanorama:!0},n)):w.createElement(tye,Xv({ref:t},r),w.createElement(Y5,{isPanorama:!1},n))});function rye(){var e=cn(),[t,n]=w.useState(null),r=Ze(Bre);return w.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),o=i.width/t.offsetWidth;Bn(o)&&o!==r&&e(wre(o))}},[t,e,r]),n}function K5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function iye(e){for(var t=1;t(jfe(),null);function Qv(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var uye=w.forwardRef((e,t)=>{var n,r,i=w.useRef(null),[o,l]=w.useState({containerWidth:Qv((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:Qv((r=e.style)===null||r===void 0?void 0:r.height)}),c=w.useCallback((h,m)=>{l(y=>{var x=Math.round(h),b=Math.round(m);return y.containerWidth===x&&y.containerHeight===b?y:{containerWidth:x,containerHeight:b}})},[]),f=w.useCallback(h=>{if(typeof t=="function"&&t(h),h!=null&&typeof ResizeObserver<"u"){var{width:m,height:y}=h.getBoundingClientRect();c(m,y);var x=C=>{var{width:_,height:A}=C[0].contentRect;c(_,A)},b=new ResizeObserver(x);b.observe(h),i.current=b}},[t,c]);return w.useEffect(()=>()=>{var h=i.current;h?.disconnect()},[c]),w.createElement(w.Fragment,null,w.createElement(Hy,{width:o.containerWidth,height:o.containerHeight}),w.createElement("div",Yu({ref:f},e)))}),cye=w.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,o]=w.useState({containerWidth:Qv(n),containerHeight:Qv(r)}),l=w.useCallback((f,h)=>{o(m=>{var y=Math.round(f),x=Math.round(h);return m.containerWidth===y&&m.containerHeight===x?m:{containerWidth:y,containerHeight:x}})},[]),c=w.useCallback(f=>{if(typeof t=="function"&&t(f),f!=null){var{width:h,height:m}=f.getBoundingClientRect();l(h,m)}},[t,l]);return w.createElement(w.Fragment,null,w.createElement(Hy,{width:i.containerWidth,height:i.containerHeight}),w.createElement("div",Yu({ref:c},e)))}),fye=w.forwardRef((e,t)=>{var{width:n,height:r}=e;return w.createElement(w.Fragment,null,w.createElement(Hy,{width:n,height:r}),w.createElement("div",Yu({ref:t},e)))}),dye=w.forwardRef((e,t)=>{var{width:n,height:r}=e;return Qo(n)||Qo(r)?w.createElement(cye,Yu({},e,{ref:t})):w.createElement(fye,Yu({},e,{ref:t}))});function hye(e){return e===!0?uye:dye}var mye=w.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:o,onContextMenu:l,onDoubleClick:c,onMouseDown:f,onMouseEnter:h,onMouseLeave:m,onMouseMove:y,onMouseUp:x,onTouchEnd:b,onTouchMove:C,onTouchStart:_,style:A,width:O,responsive:P,dispatchTouchEvents:N=!0}=e,F=w.useRef(null),U=cn(),[W,X]=w.useState(null),[ae,ce]=w.useState(null),re=rye(),J=jS(),oe=J?.width>0?J.width:O,we=J?.height>0?J.height:i,se=w.useCallback(R=>{re(R),typeof t=="function"&&t(R),X(R),ce(R),R!=null&&(F.current=R)},[re,t,X,ce]),ue=w.useCallback(R=>{U(R7(R)),U(ea({handler:o,reactEvent:R}))},[U,o]),Y=w.useCallback(R=>{U(e_(R)),U(ea({handler:h,reactEvent:R}))},[U,h]),k=w.useCallback(R=>{U(gI()),U(ea({handler:m,reactEvent:R}))},[U,m]),z=w.useCallback(R=>{U(e_(R)),U(ea({handler:y,reactEvent:R}))},[U,y]),H=w.useCallback(()=>{U(B7())},[U]),I=w.useCallback(R=>{U(U7(R.key))},[U]),j=w.useCallback(R=>{U(ea({handler:l,reactEvent:R}))},[U,l]),q=w.useCallback(R=>{U(ea({handler:c,reactEvent:R}))},[U,c]),ee=w.useCallback(R=>{U(ea({handler:f,reactEvent:R}))},[U,f]),le=w.useCallback(R=>{U(ea({handler:x,reactEvent:R}))},[U,x]),pe=w.useCallback(R=>{U(ea({handler:_,reactEvent:R}))},[U,_]),he=w.useCallback(R=>{N&&U($7(R)),U(ea({handler:C,reactEvent:R}))},[U,N,C]),ve=w.useCallback(R=>{U(ea({handler:b,reactEvent:R}))},[U,b]),D=hye(P);return w.createElement(zI.Provider,{value:W},w.createElement(Lte.Provider,{value:ae},w.createElement(D,{width:oe??A?.width,height:we??A?.height,className:Oe("recharts-wrapper",r),style:iye({position:"relative",cursor:"default",width:oe,height:we},A),onClick:ue,onContextMenu:j,onDoubleClick:q,onFocus:H,onKeyDown:I,onMouseDown:ee,onMouseEnter:Y,onMouseLeave:k,onMouseMove:z,onMouseUp:le,onTouchEnd:ve,onTouchMove:he,onTouchStart:pe,ref:se},w.createElement(lye,null),n)))}),pye=["width","height","responsive","children","className","style","compact","title","desc"];function gye(e,t){if(e==null)return{};var n,r,i=vye(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:o,className:l,style:c,compact:f,title:h,desc:m}=e,y=gye(e,pye),x=Di(y);return f?w.createElement(w.Fragment,null,w.createElement(Hy,{width:n,height:r}),w.createElement(W5,{otherAttributes:x,title:h,desc:m},o)):w.createElement(mye,{className:l,style:c,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},w.createElement(W5,{otherAttributes:x,title:h,desc:m,ref:t},w.createElement(Qpe,null,o)))});function t_(){return t_=Object.assign?Object.assign.bind():function(e){for(var t=1;tw.createElement(W7,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:xye,tooltipPayloadSearcher:BC,categoricalChartProps:e,ref:t}));function _ye(e){var t=cn();return w.useEffect(()=>{t(qve(e))},[t,e]),null}var Sye=["layout"];function n_(){return n_=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=sr(e,Mye);return w.createElement(Oye,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:jye,tooltipPayloadSearcher:BC,categoricalChartProps:n,ref:t})}),Lye=["axis"],Nye=w.forwardRef((e,t)=>w.createElement(W7,{chartName:"ComposedChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Lye,tooltipPayloadSearcher:BC,categoricalChartProps:e,ref:t}));function K7(e,t){const n=w.useRef(t);w.useEffect(function(){t!==n.current&&e.attributionControl!=null&&(n.current!=null&&e.attributionControl.removeAttribution(n.current),t!=null&&e.attributionControl.addAttribution(t)),n.current=t},[e,t])}const Rye=1;function Dye(e){return Object.freeze({__version:Rye,map:e})}function kye(e,t){return Object.freeze({...e,...t})}const d3=w.createContext(null);function Z7(){const e=w.use(d3);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return e}function Iye(e){function t(n,r){const{instance:i,context:o}=e(n).current;w.useImperativeHandle(r,()=>i);const{children:l}=n;return l==null?null:uf.createElement(d3,{value:o},l)}return w.forwardRef(t)}function zye(e){function t(n,r){const[i,o]=w.useState(!1),{instance:l}=e(n,o).current;w.useImperativeHandle(r,()=>l),w.useEffect(function(){i&&l.update()},[l,i,n.children]);const c=l._contentNode;return c?Of.createPortal(n.children,c):null}return w.forwardRef(t)}function Uye(e){function t(n,r){const{instance:i}=e(n).current;return w.useImperativeHandle(r,()=>i),null}return w.forwardRef(t)}function X7(e,t){const n=w.useRef(void 0);w.useEffect(function(){return t!=null&&e.instance.on(t),n.current=t,function(){n.current!=null&&e.instance.off(n.current),n.current=null}},[e,t])}function h3(e,t){const n=e.pane??t.pane;return n?{...e,pane:n}:e}function Bye(e,t){return function(r,i){const o=Z7(),l=e(h3(r,o),o);return K7(o.map,r.attribution),X7(l.current,r.eventHandlers),t(l.current,o,r,i),l}}var gh={exports:{}};var Fye=gh.exports,Z5;function $ye(){return Z5||(Z5=1,function(e,t){(function(n,r){r(t)})(Fye,function(n){var r="1.9.4";function i(u){var p,S,M,B;for(S=1,M=arguments.length;S"u"||!L||!L.Mixin)){u=N(u)?u:[u];for(var p=0;p0?Math.floor(u):Math.ceil(u)};z.prototype={clone:function(){return new z(this.x,this.y)},add:function(u){return this.clone()._add(I(u))},_add:function(u){return this.x+=u.x,this.y+=u.y,this},subtract:function(u){return this.clone()._subtract(I(u))},_subtract:function(u){return this.x-=u.x,this.y-=u.y,this},divideBy:function(u){return this.clone()._divideBy(u)},_divideBy:function(u){return this.x/=u,this.y/=u,this},multiplyBy:function(u){return this.clone()._multiplyBy(u)},_multiplyBy:function(u){return this.x*=u,this.y*=u,this},scaleBy:function(u){return new z(this.x*u.x,this.y*u.y)},unscaleBy:function(u){return new z(this.x/u.x,this.y/u.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=H(this.x),this.y=H(this.y),this},distanceTo:function(u){u=I(u);var p=u.x-this.x,S=u.y-this.y;return Math.sqrt(p*p+S*S)},equals:function(u){return u=I(u),u.x===this.x&&u.y===this.y},contains:function(u){return u=I(u),Math.abs(u.x)<=Math.abs(this.x)&&Math.abs(u.y)<=Math.abs(this.y)},toString:function(){return"Point("+x(this.x)+", "+x(this.y)+")"}};function I(u,p,S){return u instanceof z?u:N(u)?new z(u[0],u[1]):u==null?u:typeof u=="object"&&"x"in u&&"y"in u?new z(u.x,u.y):new z(u,p,S)}function j(u,p){if(u)for(var S=p?[u,p]:u,M=0,B=S.length;M=this.min.x&&S.x<=this.max.x&&p.y>=this.min.y&&S.y<=this.max.y},intersects:function(u){u=q(u);var p=this.min,S=this.max,M=u.min,B=u.max,K=B.x>=p.x&&M.x<=S.x,fe=B.y>=p.y&&M.y<=S.y;return K&&fe},overlaps:function(u){u=q(u);var p=this.min,S=this.max,M=u.min,B=u.max,K=B.x>p.x&&M.xp.y&&M.y=p.lat&&B.lat<=S.lat&&M.lng>=p.lng&&B.lng<=S.lng},intersects:function(u){u=le(u);var p=this._southWest,S=this._northEast,M=u.getSouthWest(),B=u.getNorthEast(),K=B.lat>=p.lat&&M.lat<=S.lat,fe=B.lng>=p.lng&&M.lng<=S.lng;return K&&fe},overlaps:function(u){u=le(u);var p=this._southWest,S=this._northEast,M=u.getSouthWest(),B=u.getNorthEast(),K=B.lat>p.lat&&M.latp.lng&&M.lng1,fn=function(){var u=!1;try{var p=Object.defineProperty({},"passive",{get:function(){u=!0}});window.addEventListener("testPassiveEventSupport",y,p),window.removeEventListener("testPassiveEventSupport",y,p)}catch{}return u}(),Qn=function(){return!!document.createElement("canvas").getContext}(),xn=!!(document.createElementNS&&me("svg").createSVGRect),Jn=!!xn&&function(){var u=document.createElement("div");return u.innerHTML="",(u.firstChild&&u.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),Mn=!xn&&function(){try{var u=document.createElement("div");u.innerHTML='';var p=u.firstChild;return p.style.behavior="url(#default#VML)",p&&typeof p.adj=="object"}catch{return!1}}(),Zr=navigator.platform.indexOf("Mac")===0,Xr=navigator.platform.indexOf("Linux")===0;function Dn(u){return navigator.userAgent.toLowerCase().indexOf(u)>=0}var et={ie:Ee,ielt9:Me,edge:Ue,webkit:ke,android:Ve,android23:ot,androidStock:Qe,opera:We,chrome:ze,gecko:nt,safari:Pt,phantom:at,opera12:Lt,win:Ot,ie3d:gt,webkit3d:$t,gecko3d:On,any3d:vt,mobile:Ui,mobileWebkit:Xn,mobileWebkit3d:Dl,msPointer:Ur,pointer:fo,touch:Bi,touchNative:ho,mobileOpera:Da,mobileGecko:hi,retina:jn,passiveEvents:fn,canvas:Qn,svg:xn,vml:Mn,inlineSvg:Jn,mac:Zr,linux:Xr},Yf=et.msPointer?"MSPointerDown":"pointerdown",Wf=et.msPointer?"MSPointerMove":"pointermove",la=et.msPointer?"MSPointerUp":"pointerup",$n=et.msPointer?"MSPointerCancel":"pointercancel",dr={touchstart:Yf,touchmove:Wf,touchend:la,touchcancel:$n},mo={touchstart:vs,touchmove:Ia,touchend:Ia,touchcancel:Ia},ka={},Pm=!1;function C0(u,p,S){return p==="touchstart"&&gs(),mo[p]?(S=mo[p].bind(this,S),u.addEventListener(dr[p],S,!1),S):(console.warn("wrong event specified:",p),y)}function Lm(u,p,S){if(!dr[p]){console.warn("wrong event specified:",p);return}u.removeEventListener(dr[p],S,!1)}function kl(u){ka[u.pointerId]=u}function Kf(u){ka[u.pointerId]&&(ka[u.pointerId]=u)}function po(u){delete ka[u.pointerId]}function gs(){Pm||(document.addEventListener(Yf,kl,!0),document.addEventListener(Wf,Kf,!0),document.addEventListener(la,po,!0),document.addEventListener($n,po,!0),Pm=!0)}function Ia(u,p){if(p.pointerType!==(p.MSPOINTER_TYPE_MOUSE||"mouse")){p.touches=[];for(var S in ka)p.touches.push(ka[S]);p.changedTouches=[p],u(p)}}function vs(u,p){p.MSPOINTER_TYPE_TOUCH&&p.pointerType===p.MSPOINTER_TYPE_TOUCH&&Pn(p),Ia(u,p)}function Vn(u){var p={},S,M;for(M in u)S=u[M],p[M]=S&&S.bind?S.bind(u):S;return u=p,p.type="dblclick",p.detail=2,p.isTrusted=!1,p._simulated=!0,p}var Nm=200;function Rm(u,p){u.addEventListener("dblclick",p);var S=0,M;function B(K){if(K.detail!==1){M=K.detail;return}if(!(K.pointerType==="mouse"||K.sourceCapabilities&&!K.sourceCapabilities.firesTouchEvents)){var fe=Vl(K);if(!(fe.some(function(Ae){return Ae instanceof HTMLLabelElement&&Ae.attributes.for})&&!fe.some(function(Ae){return Ae instanceof HTMLInputElement||Ae instanceof HTMLSelectElement}))){var be=Date.now();be-S<=Nm?(M++,M===2&&p(Vn(K))):M=1,S=be}}}return u.addEventListener("click",B),{dblclick:p,simDblclick:B}}function go(u,p){u.removeEventListener("dblclick",p.dblclick),u.removeEventListener("click",p.simDblclick)}var za=Ul(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Il=Ul(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Zf=Il==="webkitTransition"||Il==="OTransition"?Il+"End":"transitionend";function Xf(u){return typeof u=="string"?document.getElementById(u):u}function zl(u,p){var S=u.style[p]||u.currentStyle&&u.currentStyle[p];if((!S||S==="auto")&&document.defaultView){var M=document.defaultView.getComputedStyle(u,null);S=M?M[p]:null}return S==="auto"?null:S}function yt(u,p,S){var M=document.createElement(u);return M.className=p||"",S&&S.appendChild(M),M}function Gt(u){var p=u.parentNode;p&&p.removeChild(u)}function Qr(u){for(;u.firstChild;)u.removeChild(u.firstChild)}function er(u){var p=u.parentNode;p&&p.lastChild!==u&&p.appendChild(u)}function vo(u){var p=u.parentNode;p&&p.firstChild!==u&&p.insertBefore(u,p.firstChild)}function Qf(u,p){if(u.classList!==void 0)return u.classList.contains(p);var S=nc(u);return S.length>0&&new RegExp("(^|\\s)"+p+"(\\s|$)").test(S)}function ut(u,p){if(u.classList!==void 0)for(var S=C(p),M=0,B=S.length;M0?2*window.devicePixelRatio:1;function xr(u){return et.edge?u.wheelDeltaY/2:u.deltaY&&u.deltaMode===0?-u.deltaY/Dm:u.deltaY&&u.deltaMode===1?-u.deltaY*20:u.deltaY&&u.deltaMode===2?-u.deltaY*60:u.deltaX||u.deltaZ?0:u.wheelDelta?(u.wheelDeltaY||u.wheelDelta)/2:u.detail&&Math.abs(u.detail)<32765?-u.detail*20:u.detail?u.detail/-32765*60:0}function ca(u,p){var S=p.relatedTarget;if(!S)return!0;try{for(;S&&S!==u;)S=S.parentNode}catch{return!1}return S!==u}var oc={__proto__:null,on:lt,off:Bt,stopPropagation:gi,disableScrollPropagation:$i,disableClickPropagation:bo,preventDefault:Pn,stop:Ba,getPropagationPath:Vl,getMousePosition:Hl,getWheelDelta:xr,isExternalTarget:ca,addListener:lt,removeListener:Bt},Ss=k.extend({run:function(u,p,S,M){this.stop(),this._el=u,this._inProgress=!0,this._duration=S||.25,this._easeOutPower=1/Math.max(M||.5,.2),this._startPos=Ua(u),this._offset=p.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=J(this._animate,this),this._step()},_step:function(u){var p=+new Date-this._startTime,S=this._duration*1e3;pthis.options.maxZoom)?this.setZoom(u):this},panInsideBounds:function(u,p){this._enforcingBounds=!0;var S=this.getCenter(),M=this._limitCenter(S,this._zoom,le(u));return S.equals(M)||this.panTo(M,p),this._enforcingBounds=!1,this},panInside:function(u,p){p=p||{};var S=I(p.paddingTopLeft||p.padding||[0,0]),M=I(p.paddingBottomRight||p.padding||[0,0]),B=this.project(this.getCenter()),K=this.project(u),fe=this.getPixelBounds(),be=q([fe.min.add(S),fe.max.subtract(M)]),Ae=be.getSize();if(!be.contains(K)){this._enforcingBounds=!0;var Ne=K.subtract(be.getCenter()),He=be.extend(K).getSize().subtract(Ae);B.x+=Ne.x<0?-He.x:He.x,B.y+=Ne.y<0?-He.y:He.y,this.panTo(this.unproject(B),p),this._enforcingBounds=!1}return this},invalidateSize:function(u){if(!this._loaded)return this;u=i({animate:!1,pan:!0},u===!0?{animate:!0}:u);var p=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var S=this.getSize(),M=p.divideBy(2).round(),B=S.divideBy(2).round(),K=M.subtract(B);return!K.x&&!K.y?this:(u.animate&&u.pan?this.panBy(K):(u.pan&&this._rawPanBy(K),this.fire("move"),u.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(l(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:p,newSize:S}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(u){if(u=this._locateOptions=i({timeout:1e4,watch:!1},u),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var p=l(this._handleGeolocationResponse,this),S=l(this._handleGeolocationError,this);return u.watch?this._locationWatchId=navigator.geolocation.watchPosition(p,S,u):navigator.geolocation.getCurrentPosition(p,S,u),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(u){if(this._container._leaflet_id){var p=u.code,S=u.message||(p===1?"permission denied":p===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:p,message:"Geolocation error: "+S+"."})}},_handleGeolocationResponse:function(u){if(this._container._leaflet_id){var p=u.coords.latitude,S=u.coords.longitude,M=new pe(p,S),B=M.toBounds(u.coords.accuracy*2),K=this._locateOptions;if(K.setView){var fe=this.getBoundsZoom(B);this.setView(M,K.maxZoom?Math.min(fe,K.maxZoom):fe)}var be={latlng:M,bounds:B,timestamp:u.timestamp};for(var Ae in u.coords)typeof u.coords[Ae]=="number"&&(be[Ae]=u.coords[Ae]);this.fire("locationfound",be)}},addHandler:function(u,p){if(!p)return this;var S=this[u]=new p(this);return this._handlers.push(S),this.options[u]&&S.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),Gt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(oe(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var u;for(u in this._layers)this._layers[u].remove();for(u in this._panes)Gt(this._panes[u]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(u,p){var S="leaflet-pane"+(u?" leaflet-"+u.replace("Pane","")+"-pane":""),M=yt("div",S,p||this._mapPane);return u&&(this._panes[u]=M),M},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var u=this.getPixelBounds(),p=this.unproject(u.getBottomLeft()),S=this.unproject(u.getTopRight());return new ee(p,S)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(u,p,S){u=le(u),S=I(S||[0,0]);var M=this.getZoom()||0,B=this.getMinZoom(),K=this.getMaxZoom(),fe=u.getNorthWest(),be=u.getSouthEast(),Ae=this.getSize().subtract(S),Ne=q(this.project(be,M),this.project(fe,M)).getSize(),He=et.any3d?this.options.zoomSnap:1,tt=Ae.x/Ne.x,ht=Ae.y/Ne.y,tr=p?Math.max(tt,ht):Math.min(tt,ht);return M=this.getScaleZoom(tr,M),He&&(M=Math.round(M/(He/100))*(He/100),M=p?Math.ceil(M/He)*He:Math.floor(M/He)*He),Math.max(B,Math.min(K,M))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new z(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(u,p){var S=this._getTopLeftPoint(u,p);return new j(S,S.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(u){return this.options.crs.getProjectedBounds(u===void 0?this.getZoom():u)},getPane:function(u){return typeof u=="string"?this._panes[u]:u},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(u,p){var S=this.options.crs;return p=p===void 0?this._zoom:p,S.scale(u)/S.scale(p)},getScaleZoom:function(u,p){var S=this.options.crs;p=p===void 0?this._zoom:p;var M=S.zoom(u*S.scale(p));return isNaN(M)?1/0:M},project:function(u,p){return p=p===void 0?this._zoom:p,this.options.crs.latLngToPoint(he(u),p)},unproject:function(u,p){return p=p===void 0?this._zoom:p,this.options.crs.pointToLatLng(I(u),p)},layerPointToLatLng:function(u){var p=I(u).add(this.getPixelOrigin());return this.unproject(p)},latLngToLayerPoint:function(u){var p=this.project(he(u))._round();return p._subtract(this.getPixelOrigin())},wrapLatLng:function(u){return this.options.crs.wrapLatLng(he(u))},wrapLatLngBounds:function(u){return this.options.crs.wrapLatLngBounds(le(u))},distance:function(u,p){return this.options.crs.distance(he(u),he(p))},containerPointToLayerPoint:function(u){return I(u).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(u){return I(u).add(this._getMapPanePos())},containerPointToLatLng:function(u){var p=this.containerPointToLayerPoint(I(u));return this.layerPointToLatLng(p)},latLngToContainerPoint:function(u){return this.layerPointToContainerPoint(this.latLngToLayerPoint(he(u)))},mouseEventToContainerPoint:function(u){return Hl(u,this._container)},mouseEventToLayerPoint:function(u){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(u))},mouseEventToLatLng:function(u){return this.layerPointToLatLng(this.mouseEventToLayerPoint(u))},_initContainer:function(u){var p=this._container=Xf(u);if(p){if(p._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");lt(p,"scroll",this._onScroll,this),this._containerId=f(p)},_initLayout:function(){var u=this._container;this._fadeAnimated=this.options.fadeAnimation&&et.any3d,ut(u,"leaflet-container"+(et.touch?" leaflet-touch":"")+(et.retina?" leaflet-retina":"")+(et.ielt9?" leaflet-oldie":"")+(et.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var p=zl(u,"position");p!=="absolute"&&p!=="relative"&&p!=="fixed"&&p!=="sticky"&&(u.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var u=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Xt(this._mapPane,new z(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ut(u.markerPane,"leaflet-zoom-hide"),ut(u.shadowPane,"leaflet-zoom-hide"))},_resetView:function(u,p,S){Xt(this._mapPane,new z(0,0));var M=!this._loaded;this._loaded=!0,p=this._limitZoom(p),this.fire("viewprereset");var B=this._zoom!==p;this._moveStart(B,S)._move(u,p)._moveEnd(B),this.fire("viewreset"),M&&this.fire("load")},_moveStart:function(u,p){return u&&this.fire("zoomstart"),p||this.fire("movestart"),this},_move:function(u,p,S,M){p===void 0&&(p=this._zoom);var B=this._zoom!==p;return this._zoom=p,this._lastCenter=u,this._pixelOrigin=this._getNewPixelOrigin(u),M?S&&S.pinch&&this.fire("zoom",S):((B||S&&S.pinch)&&this.fire("zoom",S),this.fire("move",S)),this},_moveEnd:function(u){return u&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return oe(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(u){Xt(this._mapPane,this._getMapPanePos().subtract(u))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(u){this._targets={},this._targets[f(this._container)]=this;var p=u?Bt:lt;p(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&p(window,"resize",this._onResize,this),et.any3d&&this.options.transform3DLimit&&(u?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){oe(this._resizeRequest),this._resizeRequest=J(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var u=this._getMapPanePos();Math.max(Math.abs(u.x),Math.abs(u.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(u,p){for(var S=[],M,B=p==="mouseout"||p==="mouseover",K=u.target||u.srcElement,fe=!1;K;){if(M=this._targets[f(K)],M&&(p==="click"||p==="preclick")&&this._draggableMoved(M)){fe=!0;break}if(M&&M.listens(p,!0)&&(B&&!ca(K,u)||(S.push(M),B))||K===this._container)break;K=K.parentNode}return!S.length&&!fe&&!B&&this.listens(p,!0)&&(S=[this]),S},_isClickDisabled:function(u){for(;u&&u!==this._container;){if(u._leaflet_disable_click)return!0;u=u.parentNode}},_handleDOMEvent:function(u){var p=u.target||u.srcElement;if(!(!this._loaded||p._leaflet_disable_events||u.type==="click"&&this._isClickDisabled(p))){var S=u.type;S==="mousedown"&&ws(p),this._fireDOMEvent(u,S)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(u,p,S){if(u.type==="click"){var M=i({},u);M.type="preclick",this._fireDOMEvent(M,M.type,S)}var B=this._findEventTargets(u,p);if(S){for(var K=[],fe=0;fe0?Math.round(u-p)/2:Math.max(0,Math.ceil(u))-Math.max(0,Math.floor(p))},_limitZoom:function(u){var p=this.getMinZoom(),S=this.getMaxZoom(),M=et.any3d?this.options.zoomSnap:1;return M&&(u=Math.round(u/M)*M),Math.max(p,Math.min(S,u))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){dn(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(u,p){var S=this._getCenterOffset(u)._trunc();return(p&&p.animate)!==!0&&!this.getSize().contains(S)?!1:(this.panBy(S,p),!0)},_createAnimProxy:function(){var u=this._proxy=yt("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(u),this.on("zoomanim",function(p){var S=za,M=this._proxy.style[S];ua(this._proxy,this.project(p.center,p.zoom),this.getZoomScale(p.zoom,1)),M===this._proxy.style[S]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Gt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var u=this.getCenter(),p=this.getZoom();ua(this._proxy,this.project(u,p),this.getZoomScale(p,1))},_catchTransitionEnd:function(u){this._animatingZoom&&u.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(u,p,S){if(this._animatingZoom)return!0;if(S=S||{},!this._zoomAnimated||S.animate===!1||this._nothingToAnimate()||Math.abs(p-this._zoom)>this.options.zoomAnimationThreshold)return!1;var M=this.getZoomScale(p),B=this._getCenterOffset(u)._divideBy(1-1/M);return S.animate!==!0&&!this.getSize().contains(B)?!1:(J(function(){this._moveStart(!0,S.noMoveStart||!1)._animateZoom(u,p,!0)},this),!0)},_animateZoom:function(u,p,S,M){this._mapPane&&(S&&(this._animatingZoom=!0,this._animateToCenter=u,this._animateToZoom=p,ut(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:u,zoom:p,noUpdate:M}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(l(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&dn(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function rd(u,p){return new Ct(u,p)}var Br=se.extend({options:{position:"topright"},initialize:function(u){_(this,u)},getPosition:function(){return this.options.position},setPosition:function(u){var p=this._map;return p&&p.removeControl(this),this.options.position=u,p&&p.addControl(this),this},getContainer:function(){return this._container},addTo:function(u){this.remove(),this._map=u;var p=this._container=this.onAdd(u),S=this.getPosition(),M=u._controlCorners[S];return ut(p,"leaflet-control"),S.indexOf("bottom")!==-1?M.insertBefore(p,M.firstChild):M.appendChild(p),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Gt(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(u){this._map&&u&&u.screenX>0&&u.screenY>0&&this._map.getContainer().focus()}}),fa=function(u){return new Br(u)};Ct.include({addControl:function(u){return u.addTo(this),this},removeControl:function(u){return u.remove(),this},_initControlPos:function(){var u=this._controlCorners={},p="leaflet-",S=this._controlContainer=yt("div",p+"control-container",this._container);function M(B,K){var fe=p+B+" "+p+K;u[B+K]=yt("div",fe,S)}M("top","left"),M("top","right"),M("bottom","left"),M("bottom","right")},_clearControlPos:function(){for(var u in this._controlCorners)Gt(this._controlCorners[u]);Gt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ql=Br.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(u,p,S,M){return S1,this._baseLayersList.style.display=u?"":"none"),this._separator.style.display=p&&u?"":"none",this},_onLayerChange:function(u){this._handlingClick||this._update();var p=this._getLayer(f(u.target)),S=p.overlay?u.type==="add"?"overlayadd":"overlayremove":u.type==="add"?"baselayerchange":null;S&&this._map.fire(S,p)},_createRadioElement:function(u,p){var S='",M=document.createElement("div");return M.innerHTML=S,M.firstChild},_addItem:function(u){var p=document.createElement("label"),S=this._map.hasLayer(u.layer),M;u.overlay?(M=document.createElement("input"),M.type="checkbox",M.className="leaflet-control-layers-selector",M.defaultChecked=S):M=this._createRadioElement("leaflet-base-layers_"+f(this),S),this._layerControlInputs.push(M),M.layerId=f(u.layer),lt(M,"click",this._onInputClick,this);var B=document.createElement("span");B.innerHTML=" "+u.name;var K=document.createElement("span");p.appendChild(K),K.appendChild(M),K.appendChild(B);var fe=u.overlay?this._overlaysList:this._baseLayersList;return fe.appendChild(p),this._checkDisabledLayers(),p},_onInputClick:function(){if(!this._preventClick){var u=this._layerControlInputs,p,S,M=[],B=[];this._handlingClick=!0;for(var K=u.length-1;K>=0;K--)p=u[K],S=this._getLayer(p.layerId).layer,p.checked?M.push(S):p.checked||B.push(S);for(K=0;K=0;B--)p=u[B],S=this._getLayer(p.layerId).layer,p.disabled=S.options.minZoom!==void 0&&MS.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var u=this._section;this._preventClick=!0,lt(u,"click",Pn),this.expand();var p=this;setTimeout(function(){Bt(u,"click",Pn),p._preventClick=!1})}}),km=function(u,p,S){return new ql(u,p,S)},id=Br.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(u){var p="leaflet-control-zoom",S=yt("div",p+" leaflet-bar"),M=this.options;return this._zoomInButton=this._createButton(M.zoomInText,M.zoomInTitle,p+"-in",S,this._zoomIn),this._zoomOutButton=this._createButton(M.zoomOutText,M.zoomOutTitle,p+"-out",S,this._zoomOut),this._updateDisabled(),u.on("zoomend zoomlevelschange",this._updateDisabled,this),S},onRemove:function(u){u.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(u){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(u.shiftKey?3:1))},_createButton:function(u,p,S,M,B){var K=yt("a",S,M);return K.innerHTML=u,K.href="#",K.title=p,K.setAttribute("role","button"),K.setAttribute("aria-label",p),bo(K),lt(K,"click",Ba),lt(K,"click",B,this),lt(K,"click",this._refocusOnMap,this),K},_updateDisabled:function(){var u=this._map,p="leaflet-disabled";dn(this._zoomInButton,p),dn(this._zoomOutButton,p),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||u._zoom===u.getMinZoom())&&(ut(this._zoomOutButton,p),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||u._zoom===u.getMaxZoom())&&(ut(this._zoomInButton,p),this._zoomInButton.setAttribute("aria-disabled","true"))}});Ct.mergeOptions({zoomControl:!0}),Ct.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new id,this.addControl(this.zoomControl))});var E0=function(u){return new id(u)},Im=Br.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(u){var p="leaflet-control-scale",S=yt("div",p),M=this.options;return this._addScales(M,p+"-line",S),u.on(M.updateWhenIdle?"moveend":"move",this._update,this),u.whenReady(this._update,this),S},onRemove:function(u){u.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(u,p,S){u.metric&&(this._mScale=yt("div",p,S)),u.imperial&&(this._iScale=yt("div",p,S))},_update:function(){var u=this._map,p=u.getSize().y/2,S=u.distance(u.containerPointToLatLng([0,p]),u.containerPointToLatLng([this.options.maxWidth,p]));this._updateScales(S)},_updateScales:function(u){this.options.metric&&u&&this._updateMetric(u),this.options.imperial&&u&&this._updateImperial(u)},_updateMetric:function(u){var p=this._getRoundNum(u),S=p<1e3?p+" m":p/1e3+" km";this._updateScale(this._mScale,S,p/u)},_updateImperial:function(u){var p=u*3.2808399,S,M,B;p>5280?(S=p/5280,M=this._getRoundNum(S),this._updateScale(this._iScale,M+" mi",M/S)):(B=this._getRoundNum(p),this._updateScale(this._iScale,B+" ft",B/p))},_updateScale:function(u,p,S){u.style.width=Math.round(this.options.maxWidth*S)+"px",u.innerHTML=p},_getRoundNum:function(u){var p=Math.pow(10,(Math.floor(u)+"").length-1),S=u/p;return S=S>=10?10:S>=5?5:S>=3?3:S>=2?2:1,p*S}}),ad=function(u){return new Im(u)},A0='',od=Br.extend({options:{position:"bottomright",prefix:''+(et.inlineSvg?A0+" ":"")+"Leaflet"},initialize:function(u){_(this,u),this._attributions={}},onAdd:function(u){u.attributionControl=this,this._container=yt("div","leaflet-control-attribution"),bo(this._container);for(var p in u._layers)u._layers[p].getAttribution&&this.addAttribution(u._layers[p].getAttribution());return this._update(),u.on("layeradd",this._addAttribution,this),this._container},onRemove:function(u){u.off("layeradd",this._addAttribution,this)},_addAttribution:function(u){u.layer.getAttribution&&(this.addAttribution(u.layer.getAttribution()),u.layer.once("remove",function(){this.removeAttribution(u.layer.getAttribution())},this))},setPrefix:function(u){return this.options.prefix=u,this._update(),this},addAttribution:function(u){return u?(this._attributions[u]||(this._attributions[u]=0),this._attributions[u]++,this._update(),this):this},removeAttribution:function(u){return u?(this._attributions[u]&&(this._attributions[u]--,this._update()),this):this},_update:function(){if(this._map){var u=[];for(var p in this._attributions)this._attributions[p]&&u.push(p);var S=[];this.options.prefix&&S.push(this.options.prefix),u.length&&S.push(u.join(", ")),this._container.innerHTML=S.join(' ')}}});Ct.mergeOptions({attributionControl:!0}),Ct.addInitHook(function(){this.options.attributionControl&&new od().addTo(this)});var T0=function(u){return new od(u)};Br.Layers=ql,Br.Zoom=id,Br.Scale=Im,Br.Attribution=od,fa.layers=km,fa.zoom=E0,fa.scale=ad,fa.attribution=T0;var Vi=se.extend({initialize:function(u){this._map=u},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Vi.addTo=function(u,p){return u.addHandler(p,this),this};var O0={Events:Y},sd=et.touch?"touchstart mousedown":"mousedown",Fa=k.extend({options:{clickTolerance:3},initialize:function(u,p,S,M){_(this,M),this._element=u,this._dragStartTarget=p||u,this._preventOutline=S},enable:function(){this._enabled||(lt(this._dragStartTarget,sd,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Fa._dragging===this&&this.finishDrag(!0),Bt(this._dragStartTarget,sd,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(u){if(this._enabled&&(this._moved=!1,!Qf(this._element,"leaflet-zoom-anim"))){if(u.touches&&u.touches.length!==1){Fa._dragging===this&&this.finishDrag();return}if(!(Fa._dragging||u.shiftKey||u.which!==1&&u.button!==1&&!u.touches)&&(Fa._dragging=this,this._preventOutline&&ws(this._element),rc(),bs(),!this._moving)){this.fire("down");var p=u.touches?u.touches[0]:u,S=ac(this._element);this._startPoint=new z(p.clientX,p.clientY),this._startPos=Ua(this._element),this._parentScale=Fl(S);var M=u.type==="mousedown";lt(document,M?"mousemove":"touchmove",this._onMove,this),lt(document,M?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(u){if(this._enabled){if(u.touches&&u.touches.length>1){this._moved=!0;return}var p=u.touches&&u.touches.length===1?u.touches[0]:u,S=new z(p.clientX,p.clientY)._subtract(this._startPoint);!S.x&&!S.y||Math.abs(S.x)+Math.abs(S.y)K&&(fe=be,K=Ae);K>S&&(p[fe]=1,cd(u,p,S,M,fe),cd(u,p,S,fe,B))}function M0(u,p){for(var S=[u[0]],M=1,B=0,K=u.length;Mp&&(S.push(u[M]),B=M);return Bp.max.x&&(S|=2),u.yp.max.y&&(S|=8),S}function P0(u,p){var S=p.x-u.x,M=p.y-u.y;return S*S+M*M}function Gl(u,p,S,M){var B=p.x,K=p.y,fe=S.x-B,be=S.y-K,Ae=fe*fe+be*be,Ne;return Ae>0&&(Ne=((u.x-B)*fe+(u.y-K)*be)/Ae,Ne>1?(B=S.x,K=S.y):Ne>0&&(B+=fe*Ne,K+=be*Ne)),fe=u.x-B,be=u.y-K,M?fe*fe+be*be:new z(B,K)}function ei(u){return!N(u[0])||typeof u[0][0]!="object"&&typeof u[0][0]<"u"}function lc(u){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),ei(u)}function Cs(u,p){var S,M,B,K,fe,be,Ae,Ne;if(!u||u.length===0)throw new Error("latlngs not passed");ei(u)||(console.warn("latlngs are not flat! Only the first ring will be used"),u=u[0]);var He=he([0,0]),tt=le(u),ht=tt.getNorthWest().distanceTo(tt.getSouthWest())*tt.getNorthEast().distanceTo(tt.getNorthWest());ht<1700&&(He=ld(u));var tr=u.length,Ln=[];for(S=0;SM){Ae=(K-M)/B,Ne=[be.x-Ae*(be.x-fe.x),be.y-Ae*(be.y-fe.y)];break}var Rt=p.unproject(I(Ne));return he([Rt.lat+He.lat,Rt.lng+He.lng])}var L0={__proto__:null,simplify:Bm,pointToSegmentDistance:Fm,closestPointOnSegment:j0,clipSegment:Hm,_getEdgeIntersection:sc,_getBitCode:xo,_sqClosestPointOnSegment:Gl,isFlat:ei,_flat:lc,polylineCenter:Cs},uc={project:function(u){return new z(u.lng,u.lat)},unproject:function(u){return new pe(u.y,u.x)},bounds:new j([-180,-90],[180,90])},cc={R:6378137,R_MINOR:6356752314245179e-9,bounds:new j([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(u){var p=Math.PI/180,S=this.R,M=u.lat*p,B=this.R_MINOR/S,K=Math.sqrt(1-B*B),fe=K*Math.sin(M),be=Math.tan(Math.PI/4-M/2)/Math.pow((1-fe)/(1+fe),K/2);return M=-S*Math.log(Math.max(be,1e-10)),new z(u.lng*p*S,M)},unproject:function(u){for(var p=180/Math.PI,S=this.R,M=this.R_MINOR/S,B=Math.sqrt(1-M*M),K=Math.exp(-u.y/S),fe=Math.PI/2-2*Math.atan(K),be=0,Ae=.1,Ne;be<15&&Math.abs(Ae)>1e-7;be++)Ne=B*Math.sin(fe),Ne=Math.pow((1-Ne)/(1+Ne),B/2),Ae=Math.PI/2-2*Math.atan(K*Ne)-fe,fe+=Ae;return new pe(fe*p,u.x*p/S)}},qm={__proto__:null,LonLat:uc,Mercator:cc,SphericalMercator:G},Gm=i({},D,{code:"EPSG:3395",projection:cc,transformation:function(){var u=.5/(Math.PI*cc.R);return V(u,.5,-u,.5)}()}),fd=i({},D,{code:"EPSG:4326",projection:uc,transformation:V(1/180,1,-1/180,.5)}),Es=i({},ve,{projection:uc,transformation:V(1,0,-1,0),scale:function(u){return Math.pow(2,u)},zoom:function(u){return Math.log(u)/Math.LN2},distance:function(u,p){var S=p.lng-u.lng,M=p.lat-u.lat;return Math.sqrt(S*S+M*M)},infinite:!0});ve.Earth=D,ve.EPSG3395=Gm,ve.EPSG3857=Z,ve.EPSG900913=ne,ve.EPSG4326=fd,ve.Simple=Es;var vi=k.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(u){return u.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(u){return u&&u.removeLayer(this),this},getPane:function(u){return this._map.getPane(u?this.options[u]||u:this.options.pane)},addInteractiveTarget:function(u){return this._map._targets[f(u)]=this,this},removeInteractiveTarget:function(u){return delete this._map._targets[f(u)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(u){var p=u.target;if(p.hasLayer(this)){if(this._map=p,this._zoomAnimated=p._zoomAnimated,this.getEvents){var S=this.getEvents();p.on(S,this),this.once("remove",function(){p.off(S,this)},this)}this.onAdd(p),this.fire("add"),p.fire("layeradd",{layer:this})}}});Ct.include({addLayer:function(u){if(!u._layerAdd)throw new Error("The provided object is not a Layer.");var p=f(u);return this._layers[p]?this:(this._layers[p]=u,u._mapToAdd=this,u.beforeAdd&&u.beforeAdd(this),this.whenReady(u._layerAdd,u),this)},removeLayer:function(u){var p=f(u);return this._layers[p]?(this._loaded&&u.onRemove(this),delete this._layers[p],this._loaded&&(this.fire("layerremove",{layer:u}),u.fire("remove")),u._map=u._mapToAdd=null,this):this},hasLayer:function(u){return f(u)in this._layers},eachLayer:function(u,p){for(var S in this._layers)u.call(p,this._layers[S]);return this},_addLayers:function(u){u=u?N(u)?u:[u]:[];for(var p=0,S=u.length;pthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&p[0]instanceof pe&&p[0].equals(p[S-1])&&p.pop(),p},_setLatLngs:function(u){da.prototype._setLatLngs.call(this,u),ei(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return ei(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var u=this._renderer._bounds,p=this.options.weight,S=new z(p,p);if(u=new j(u.min.subtract(S),u.max.add(S)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(u))){if(this.options.noClip){this._parts=this._rings;return}for(var M=0,B=this._rings.length,K;Mu.y!=B.y>u.y&&u.x<(B.x-M.x)*(u.y-M.y)/(B.y-M.y)+M.x&&(p=!p);return p||da.prototype._containsPoint.call(this,u,!0)}});function D0(u,p){return new Os(u,p)}var ha=Hi.extend({initialize:function(u,p){_(this,p),this._layers={},u&&this.addData(u)},addData:function(u){var p=N(u)?u:u.features,S,M,B;if(p){for(S=0,M=p.length;S0&&B.push(B[0].slice()),B}function $a(u,p){return u.feature?i({},u.feature,{geometry:p}):mc(p)}function mc(u){return u.type==="Feature"||u.type==="FeatureCollection"?u:{type:"Feature",properties:{},geometry:u}}var Va={toGeoJSON:function(u){return $a(this,{type:"Point",coordinates:hc(this.getLatLng(),u)})}};Zl.include(Va),fc.include(Va),Ts.include(Va),da.include({toGeoJSON:function(u){var p=!ei(this._latlngs),S=Ql(this._latlngs,p?1:0,!1,u);return $a(this,{type:(p?"Multi":"")+"LineString",coordinates:S})}}),Os.include({toGeoJSON:function(u){var p=!ei(this._latlngs),S=p&&!ei(this._latlngs[0]),M=Ql(this._latlngs,S?2:p?1:0,!0,u);return p||(M=[M]),$a(this,{type:(S?"Multi":"")+"Polygon",coordinates:M})}}),As.include({toMultiPoint:function(u){var p=[];return this.eachLayer(function(S){p.push(S.toGeoJSON(u).geometry.coordinates)}),$a(this,{type:"MultiPoint",coordinates:p})},toGeoJSON:function(u){var p=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(p==="MultiPoint")return this.toMultiPoint(u);var S=p==="GeometryCollection",M=[];return this.eachLayer(function(B){if(B.toGeoJSON){var K=B.toGeoJSON(u);if(S)M.push(K.geometry);else{var fe=mc(K);fe.type==="FeatureCollection"?M.push.apply(M,fe.features):M.push(fe)}}}),S?$a(this,{geometries:M,type:"GeometryCollection"}):{type:"FeatureCollection",features:M}}});function pc(u,p){return new ha(u,p)}var Jl=pc,Ms=vi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(u,p,S){this._url=u,this._bounds=le(p),_(this,S)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ut(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Gt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(u){return this.options.opacity=u,this._image&&this._updateOpacity(),this},setStyle:function(u){return u.opacity&&this.setOpacity(u.opacity),this},bringToFront:function(){return this._map&&er(this._image),this},bringToBack:function(){return this._map&&vo(this._image),this},setUrl:function(u){return this._url=u,this._image&&(this._image.src=u),this},setBounds:function(u){return this._bounds=le(u),this._map&&this._reset(),this},getEvents:function(){var u={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(u.zoomanim=this._animateZoom),u},setZIndex:function(u){return this.options.zIndex=u,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var u=this._url.tagName==="IMG",p=this._image=u?this._url:yt("img");if(ut(p,"leaflet-image-layer"),this._zoomAnimated&&ut(p,"leaflet-zoom-animated"),this.options.className&&ut(p,this.options.className),p.onselectstart=y,p.onmousemove=y,p.onload=l(this.fire,this,"load"),p.onerror=l(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(p.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),u){this._url=p.src;return}p.src=this._url,p.alt=this.options.alt},_animateZoom:function(u){var p=this._map.getZoomScale(u.zoom),S=this._map._latLngBoundsToNewLayerBounds(this._bounds,u.zoom,u.center).min;ua(this._image,S,p)},_reset:function(){var u=this._image,p=new j(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),S=p.getSize();Xt(u,p.min),u.style.width=S.x+"px",u.style.height=S.y+"px"},_updateOpacity:function(){rn(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var u=this.options.errorOverlayUrl;u&&this._url!==u&&(this._url=u,this._image.src=u)},getCenter:function(){return this._bounds.getCenter()}}),Xm=function(u,p,S){return new Ms(u,p,S)},Ha=Ms.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var u=this._url.tagName==="VIDEO",p=this._image=u?this._url:yt("video");if(ut(p,"leaflet-image-layer"),this._zoomAnimated&&ut(p,"leaflet-zoom-animated"),this.options.className&&ut(p,this.options.className),p.onselectstart=y,p.onmousemove=y,p.onloadeddata=l(this.fire,this,"load"),u){for(var S=p.getElementsByTagName("source"),M=[],B=0;B0?M:[p.src];return}N(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(p.style,"objectFit")&&(p.style.objectFit="fill"),p.autoplay=!!this.options.autoplay,p.loop=!!this.options.loop,p.muted=!!this.options.muted,p.playsInline=!!this.options.playsInline;for(var K=0;KB?(p.height=B+"px",ut(u,K)):dn(u,K),this._containerWidth=this._container.offsetWidth},_animateZoom:function(u){var p=this._map._latLngToNewLayerPoint(this._latlng,u.zoom,u.center),S=this._getAnchor();Xt(this._container,p.add(S))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var u=this._map,p=parseInt(zl(this._container,"marginBottom"),10)||0,S=this._container.offsetHeight+p,M=this._containerWidth,B=new z(this._containerLeft,-S-this._containerBottom);B._add(Ua(this._container));var K=u.layerPointToContainerPoint(B),fe=I(this.options.autoPanPadding),be=I(this.options.autoPanPaddingTopLeft||fe),Ae=I(this.options.autoPanPaddingBottomRight||fe),Ne=u.getSize(),He=0,tt=0;K.x+M+Ae.x>Ne.x&&(He=K.x+M-Ne.x+Ae.x),K.x-He-be.x<0&&(He=K.x-be.x),K.y+S+Ae.y>Ne.y&&(tt=K.y+S-Ne.y+Ae.y),K.y-tt-be.y<0&&(tt=K.y-be.y),(He||tt)&&(this.options.keepInView&&(this._autopanning=!0),u.fire("autopanstart").panBy([He,tt]))}},_getAnchor:function(){return I(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Jm=function(u,p){return new eu(u,p)};Ct.mergeOptions({closePopupOnClick:!0}),Ct.include({openPopup:function(u,p,S){return this._initOverlay(eu,u,p,S).openOn(this),this},closePopup:function(u){return u=arguments.length?u:this._popup,u&&u.close(),this}}),vi.include({bindPopup:function(u,p){return this._popup=this._initOverlay(eu,this._popup,u,p),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(u){return this._popup&&(this instanceof Hi||(this._popup._source=this),this._popup._prepareOpen(u||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(u){return this._popup&&this._popup.setContent(u),this},getPopup:function(){return this._popup},_openPopup:function(u){if(!(!this._popup||!this._map)){Ba(u);var p=u.layer||u.target;if(this._popup._source===p&&!(p instanceof Gi)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(u.latlng);return}this._popup._source=p,this.openPopup(u.latlng)}},_movePopup:function(u){this._popup.setLatLng(u.latlng)},_onKeyPress:function(u){u.originalEvent.keyCode===13&&this._openPopup(u)}});var tu=mr.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(u){mr.prototype.onAdd.call(this,u),this.setOpacity(this.options.opacity),u.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(u){mr.prototype.onRemove.call(this,u),u.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var u=mr.prototype.getEvents.call(this);return this.options.permanent||(u.preclick=this.close),u},_initLayout:function(){var u="leaflet-tooltip",p=u+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=yt("div",p),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+f(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(u){var p,S,M=this._map,B=this._container,K=M.latLngToContainerPoint(M.getCenter()),fe=M.layerPointToContainerPoint(u),be=this.options.direction,Ae=B.offsetWidth,Ne=B.offsetHeight,He=I(this.options.offset),tt=this._getAnchor();be==="top"?(p=Ae/2,S=Ne):be==="bottom"?(p=Ae/2,S=0):be==="center"?(p=Ae/2,S=Ne/2):be==="right"?(p=0,S=Ne/2):be==="left"?(p=Ae,S=Ne/2):fe.xthis.options.maxZoom||SM?this._retainParent(B,K,fe,M):!1)},_retainChildren:function(u,p,S,M){for(var B=2*u;B<2*u+2;B++)for(var K=2*p;K<2*p+2;K++){var fe=new z(B,K);fe.z=S+1;var be=this._tileCoordsToKey(fe),Ae=this._tiles[be];if(Ae&&Ae.active){Ae.retain=!0;continue}else Ae&&Ae.loaded&&(Ae.retain=!0);S+1this.options.maxZoom||this.options.minZoom!==void 0&&B1){this._setView(u,S);return}for(var tt=B.min.y;tt<=B.max.y;tt++)for(var ht=B.min.x;ht<=B.max.x;ht++){var tr=new z(ht,tt);if(tr.z=this._tileZoom,!!this._isValidTile(tr)){var Ln=this._tiles[this._tileCoordsToKey(tr)];Ln?Ln.current=!0:fe.push(tr)}}if(fe.sort(function(Rt,Dt){return Rt.distanceTo(K)-Dt.distanceTo(K)}),fe.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Fr=document.createDocumentFragment();for(ht=0;htS.max.x)||!p.wrapLat&&(u.yS.max.y))return!1}if(!this.options.bounds)return!0;var M=this._tileCoordsToBounds(u);return le(this.options.bounds).overlaps(M)},_keyToBounds:function(u){return this._tileCoordsToBounds(this._keyToTileCoords(u))},_tileCoordsToNwSe:function(u){var p=this._map,S=this.getTileSize(),M=u.scaleBy(S),B=M.add(S),K=p.unproject(M,u.z),fe=p.unproject(B,u.z);return[K,fe]},_tileCoordsToBounds:function(u){var p=this._tileCoordsToNwSe(u),S=new ee(p[0],p[1]);return this.options.noWrap||(S=this._map.wrapLatLngBounds(S)),S},_tileCoordsToKey:function(u){return u.x+":"+u.y+":"+u.z},_keyToTileCoords:function(u){var p=u.split(":"),S=new z(+p[0],+p[1]);return S.z=+p[2],S},_removeTile:function(u){var p=this._tiles[u];p&&(Gt(p.el),delete this._tiles[u],this.fire("tileunload",{tile:p.el,coords:this._keyToTileCoords(u)}))},_initTile:function(u){ut(u,"leaflet-tile");var p=this.getTileSize();u.style.width=p.x+"px",u.style.height=p.y+"px",u.onselectstart=y,u.onmousemove=y,et.ielt9&&this.options.opacity<1&&rn(u,this.options.opacity)},_addTile:function(u,p){var S=this._getTilePos(u),M=this._tileCoordsToKey(u),B=this.createTile(this._wrapCoords(u),l(this._tileReady,this,u));this._initTile(B),this.createTile.length<2&&J(l(this._tileReady,this,u,null,B)),Xt(B,S),this._tiles[M]={el:B,coords:u,current:!0},p.appendChild(B),this.fire("tileloadstart",{tile:B,coords:u})},_tileReady:function(u,p,S){p&&this.fire("tileerror",{error:p,tile:S,coords:u});var M=this._tileCoordsToKey(u);S=this._tiles[M],S&&(S.loaded=+new Date,this._map._fadeAnimated?(rn(S.el,0),oe(this._fadeFrame),this._fadeFrame=J(this._updateOpacity,this)):(S.active=!0,this._pruneTiles()),p||(ut(S.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:S.el,coords:u})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),et.ielt9||!this._map._fadeAnimated?J(this._pruneTiles,this):setTimeout(l(this._pruneTiles,this),250)))},_getTilePos:function(u){return u.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(u){var p=new z(this._wrapX?m(u.x,this._wrapX):u.x,this._wrapY?m(u.y,this._wrapY):u.y);return p.z=u.z,p},_pxBoundsToTileRange:function(u){var p=this.getTileSize();return new j(u.min.unscaleBy(p).floor(),u.max.unscaleBy(p).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var u in this._tiles)if(!this._tiles[u].loaded)return!1;return!0}});function tp(u){return new Ls(u)}var qa=Ls.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(u,p){this._url=u,p=_(this,p),p.detectRetina&&et.retina&&p.maxZoom>0?(p.tileSize=Math.floor(p.tileSize/2),p.zoomReverse?(p.zoomOffset--,p.minZoom=Math.min(p.maxZoom,p.minZoom+1)):(p.zoomOffset++,p.maxZoom=Math.max(p.minZoom,p.maxZoom-1)),p.minZoom=Math.max(0,p.minZoom)):p.zoomReverse?p.minZoom=Math.min(p.maxZoom,p.minZoom):p.maxZoom=Math.max(p.minZoom,p.maxZoom),typeof p.subdomains=="string"&&(p.subdomains=p.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(u,p){return this._url===u&&p===void 0&&(p=!0),this._url=u,p||this.redraw(),this},createTile:function(u,p){var S=document.createElement("img");return lt(S,"load",l(this._tileOnLoad,this,p,S)),lt(S,"error",l(this._tileOnError,this,p,S)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(S.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(S.referrerPolicy=this.options.referrerPolicy),S.alt="",S.src=this.getTileUrl(u),S},getTileUrl:function(u){var p={r:et.retina?"@2x":"",s:this._getSubdomain(u),x:u.x,y:u.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var S=this._globalTileRange.max.y-u.y;this.options.tms&&(p.y=S),p["-y"]=S}return P(this._url,i(p,this.options))},_tileOnLoad:function(u,p){et.ielt9?setTimeout(l(u,this,null,p),0):u(null,p)},_tileOnError:function(u,p,S){var M=this.options.errorTileUrl;M&&p.getAttribute("src")!==M&&(p.src=M),u(S,p)},_onTileRemove:function(u){u.tile.onload=null},_getZoomForUrl:function(){var u=this._tileZoom,p=this.options.maxZoom,S=this.options.zoomReverse,M=this.options.zoomOffset;return S&&(u=p-u),u+M},_getSubdomain:function(u){var p=Math.abs(u.x+u.y)%this.options.subdomains.length;return this.options.subdomains[p]},_abortLoading:function(){var u,p;for(u in this._tiles)if(this._tiles[u].coords.z!==this._tileZoom&&(p=this._tiles[u].el,p.onload=y,p.onerror=y,!p.complete)){p.src=U;var S=this._tiles[u].coords;Gt(p),delete this._tiles[u],this.fire("tileabort",{tile:p,coords:S})}},_removeTile:function(u){var p=this._tiles[u];if(p)return p.el.setAttribute("src",U),Ls.prototype._removeTile.call(this,u)},_tileReady:function(u,p,S){if(!(!this._map||S&&S.getAttribute("src")===U))return Ls.prototype._tileReady.call(this,u,p,S)}});function ti(u,p){return new qa(u,p)}var nu=qa.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(u,p){this._url=u;var S=i({},this.defaultWmsParams);for(var M in p)M in this.options||(S[M]=p[M]);p=_(this,p);var B=p.detectRetina&&et.retina?2:1,K=this.getTileSize();S.width=K.x*B,S.height=K.y*B,this.wmsParams=S},onAdd:function(u){this._crs=this.options.crs||u.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var p=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[p]=this._crs.code,qa.prototype.onAdd.call(this,u)},getTileUrl:function(u){var p=this._tileCoordsToNwSe(u),S=this._crs,M=q(S.project(p[0]),S.project(p[1])),B=M.min,K=M.max,fe=(this._wmsVersion>=1.3&&this._crs===fd?[B.y,B.x,K.y,K.x]:[B.x,B.y,K.x,K.y]).join(","),be=qa.prototype.getTileUrl.call(this,u);return be+A(this.wmsParams,be,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+fe},setParams:function(u,p){return i(this.wmsParams,u),p||this.redraw(),this}});function ni(u,p){return new nu(u,p)}qa.WMS=nu,ti.wms=ni;var Mr=vi.extend({options:{padding:.1},initialize:function(u){_(this,u),f(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),ut(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var u={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(u.zoomanim=this._onAnimZoom),u},_onAnimZoom:function(u){this._updateTransform(u.center,u.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(u,p){var S=this._map.getZoomScale(p,this._zoom),M=this._map.getSize().multiplyBy(.5+this.options.padding),B=this._map.project(this._center,p),K=M.multiplyBy(-S).add(B).subtract(this._map._getNewPixelOrigin(u,p));et.any3d?ua(this._container,K,S):Xt(this._container,K)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var u in this._layers)this._layers[u]._reset()},_onZoomEnd:function(){for(var u in this._layers)this._layers[u]._project()},_updatePaths:function(){for(var u in this._layers)this._layers[u]._update()},_update:function(){var u=this.options.padding,p=this._map.getSize(),S=this._map.containerPointToLayerPoint(p.multiplyBy(-u)).round();this._bounds=new j(S,S.add(p.multiplyBy(1+u*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),vc=Mr.extend({options:{tolerance:0},getEvents:function(){var u=Mr.prototype.getEvents.call(this);return u.viewprereset=this._onViewPreReset,u},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Mr.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var u=this._container=document.createElement("canvas");lt(u,"mousemove",this._onMouseMove,this),lt(u,"click dblclick mousedown mouseup contextmenu",this._onClick,this),lt(u,"mouseout",this._handleMouseOut,this),u._leaflet_disable_events=!0,this._ctx=u.getContext("2d")},_destroyContainer:function(){oe(this._redrawRequest),delete this._ctx,Gt(this._container),Bt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var u;this._redrawBounds=null;for(var p in this._layers)u=this._layers[p],u._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Mr.prototype._update.call(this);var u=this._bounds,p=this._container,S=u.getSize(),M=et.retina?2:1;Xt(p,u.min),p.width=M*S.x,p.height=M*S.y,p.style.width=S.x+"px",p.style.height=S.y+"px",et.retina&&this._ctx.scale(2,2),this._ctx.translate(-u.min.x,-u.min.y),this.fire("update")}},_reset:function(){Mr.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(u){this._updateDashArray(u),this._layers[f(u)]=u;var p=u._order={layer:u,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=p),this._drawLast=p,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(u){this._requestRedraw(u)},_removePath:function(u){var p=u._order,S=p.next,M=p.prev;S?S.prev=M:this._drawLast=M,M?M.next=S:this._drawFirst=S,delete u._order,delete this._layers[f(u)],this._requestRedraw(u)},_updatePath:function(u){this._extendRedrawBounds(u),u._project(),u._update(),this._requestRedraw(u)},_updateStyle:function(u){this._updateDashArray(u),this._requestRedraw(u)},_updateDashArray:function(u){if(typeof u.options.dashArray=="string"){var p=u.options.dashArray.split(/[, ]+/),S=[],M,B;for(B=0;B')}}catch{}return function(u){return document.createElement("<"+u+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),dd={_initContainer:function(){this._container=yt("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Mr.prototype._update.call(this),this.fire("update"))},_initPath:function(u){var p=u._container=Ga("shape");ut(p,"leaflet-vml-shape "+(this.options.className||"")),p.coordsize="1 1",u._path=Ga("path"),p.appendChild(u._path),this._updateStyle(u),this._layers[f(u)]=u},_addPath:function(u){var p=u._container;this._container.appendChild(p),u.options.interactive&&u.addInteractiveTarget(p)},_removePath:function(u){var p=u._container;Gt(p),u.removeInteractiveTarget(p),delete this._layers[f(u)]},_updateStyle:function(u){var p=u._stroke,S=u._fill,M=u.options,B=u._container;B.stroked=!!M.stroke,B.filled=!!M.fill,M.stroke?(p||(p=u._stroke=Ga("stroke")),B.appendChild(p),p.weight=M.weight+"px",p.color=M.color,p.opacity=M.opacity,M.dashArray?p.dashStyle=N(M.dashArray)?M.dashArray.join(" "):M.dashArray.replace(/( *, *)/g," "):p.dashStyle="",p.endcap=M.lineCap.replace("butt","flat"),p.joinstyle=M.lineJoin):p&&(B.removeChild(p),u._stroke=null),M.fill?(S||(S=u._fill=Ga("fill")),B.appendChild(S),S.color=M.fillColor||M.color,S.opacity=M.fillOpacity):S&&(B.removeChild(S),u._fill=null)},_updateCircle:function(u){var p=u._point.round(),S=Math.round(u._radius),M=Math.round(u._radiusY||S);this._setPath(u,u._empty()?"M0 0":"AL "+p.x+","+p.y+" "+S+","+M+" 0,"+65535*360)},_setPath:function(u,p){u._path.v=p},_bringToFront:function(u){er(u._container)},_bringToBack:function(u){vo(u._container)}},Yi=et.vml?Ga:me,Ns=Mr.extend({_initContainer:function(){this._container=Yi("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Yi("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Gt(this._container),Bt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Mr.prototype._update.call(this);var u=this._bounds,p=u.getSize(),S=this._container;(!this._svgSize||!this._svgSize.equals(p))&&(this._svgSize=p,S.setAttribute("width",p.x),S.setAttribute("height",p.y)),Xt(S,u.min),S.setAttribute("viewBox",[u.min.x,u.min.y,p.x,p.y].join(" ")),this.fire("update")}},_initPath:function(u){var p=u._path=Yi("path");u.options.className&&ut(p,u.options.className),u.options.interactive&&ut(p,"leaflet-interactive"),this._updateStyle(u),this._layers[f(u)]=u},_addPath:function(u){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(u._path),u.addInteractiveTarget(u._path)},_removePath:function(u){Gt(u._path),u.removeInteractiveTarget(u._path),delete this._layers[f(u)]},_updatePath:function(u){u._project(),u._update()},_updateStyle:function(u){var p=u._path,S=u.options;p&&(S.stroke?(p.setAttribute("stroke",S.color),p.setAttribute("stroke-opacity",S.opacity),p.setAttribute("stroke-width",S.weight),p.setAttribute("stroke-linecap",S.lineCap),p.setAttribute("stroke-linejoin",S.lineJoin),S.dashArray?p.setAttribute("stroke-dasharray",S.dashArray):p.removeAttribute("stroke-dasharray"),S.dashOffset?p.setAttribute("stroke-dashoffset",S.dashOffset):p.removeAttribute("stroke-dashoffset")):p.setAttribute("stroke","none"),S.fill?(p.setAttribute("fill",S.fillColor||S.color),p.setAttribute("fill-opacity",S.fillOpacity),p.setAttribute("fill-rule",S.fillRule||"evenodd")):p.setAttribute("fill","none"))},_updatePoly:function(u,p){this._setPath(u,ie(u._parts,p))},_updateCircle:function(u){var p=u._point,S=Math.max(Math.round(u._radius),1),M=Math.max(Math.round(u._radiusY),1)||S,B="a"+S+","+M+" 0 1,0 ",K=u._empty()?"M0 0":"M"+(p.x-S)+","+p.y+B+S*2+",0 "+B+-S*2+",0 ";this._setPath(u,K)},_setPath:function(u,p){u._path.setAttribute("d",p)},_bringToFront:function(u){er(u._path)},_bringToBack:function(u){vo(u._path)}});et.vml&&Ns.include(dd);function iu(u){return et.svg||et.vml?new Ns(u):null}Ct.include({getRenderer:function(u){var p=u.options.renderer||this._getPaneRenderer(u.options.pane)||this.options.renderer||this._renderer;return p||(p=this._renderer=this._createRenderer()),this.hasLayer(p)||this.addLayer(p),p},_getPaneRenderer:function(u){if(u==="overlayPane"||u===void 0)return!1;var p=this._paneRenderers[u];return p===void 0&&(p=this._createRenderer({pane:u}),this._paneRenderers[u]=p),p},_createRenderer:function(u){return this.options.preferCanvas&&ru(u)||iu(u)}});var wo=Os.extend({initialize:function(u,p){Os.prototype.initialize.call(this,this._boundsToLatLngs(u),p)},setBounds:function(u){return this.setLatLngs(this._boundsToLatLngs(u))},_boundsToLatLngs:function(u){return u=le(u),[u.getSouthWest(),u.getNorthWest(),u.getNorthEast(),u.getSouthEast()]}});function z0(u,p){return new wo(u,p)}Ns.create=Yi,Ns.pointsToPath=ie,ha.geometryToLayer=hr,ha.coordsToLatLng=dc,ha.coordsToLatLngs=Xl,ha.latLngToCoords=hc,ha.latLngsToCoords=Ql,ha.getFeature=$a,ha.asFeature=mc,Ct.mergeOptions({boxZoom:!0});var Pr=Vi.extend({initialize:function(u){this._map=u,this._container=u._container,this._pane=u._panes.overlayPane,this._resetStateTimeout=0,u.on("unload",this._destroy,this)},addHooks:function(){lt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Bt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Gt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(u){if(!u.shiftKey||u.which!==1&&u.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),bs(),rc(),this._startPoint=this._map.mouseEventToContainerPoint(u),lt(document,{contextmenu:Ba,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(u){this._moved||(this._moved=!0,this._box=yt("div","leaflet-zoom-box",this._container),ut(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(u);var p=new j(this._point,this._startPoint),S=p.getSize();Xt(this._box,p.min),this._box.style.width=S.x+"px",this._box.style.height=S.y+"px"},_finish:function(){this._moved&&(Gt(this._box),dn(this._container,"leaflet-crosshair")),Fi(),Bl(),Bt(document,{contextmenu:Ba,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(u){if(!(u.which!==1&&u.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(l(this._resetState,this),0);var p=new ee(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(p).fire("boxzoomend",{boxZoomBounds:p})}},_onKeyDown:function(u){u.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Ct.addInitHook("addHandler","boxZoom",Pr),Ct.mergeOptions({doubleClickZoom:!0});var yc=Vi.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(u){var p=this._map,S=p.getZoom(),M=p.options.zoomDelta,B=u.originalEvent.shiftKey?S-M:S+M;p.options.doubleClickZoom==="center"?p.setZoom(B):p.setZoomAround(u.containerPoint,B)}});Ct.addInitHook("addHandler","doubleClickZoom",yc),Ct.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Wi=Vi.extend({addHooks:function(){if(!this._draggable){var u=this._map;this._draggable=new Fa(u._mapPane,u._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),u.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),u.on("zoomend",this._onZoomEnd,this),u.whenReady(this._onZoomEnd,this))}ut(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){dn(this._map._container,"leaflet-grab"),dn(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var u=this._map;if(u._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var p=le(this._map.options.maxBounds);this._offsetLimit=q(this._map.latLngToContainerPoint(p.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(p.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;u.fire("movestart").fire("dragstart"),u.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(u){if(this._map.options.inertia){var p=this._lastTime=+new Date,S=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(S),this._times.push(p),this._prunePositions(p)}this._map.fire("move",u).fire("drag",u)},_prunePositions:function(u){for(;this._positions.length>1&&u-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var u=this._map.getSize().divideBy(2),p=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=p.subtract(u).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(u,p){return u-(u-p)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var u=this._draggable._newPos.subtract(this._draggable._startPos),p=this._offsetLimit;u.xp.max.x&&(u.x=this._viscousLimit(u.x,p.max.x)),u.y>p.max.y&&(u.y=this._viscousLimit(u.y,p.max.y)),this._draggable._newPos=this._draggable._startPos.add(u)}},_onPreDragWrap:function(){var u=this._worldWidth,p=Math.round(u/2),S=this._initialWorldOffset,M=this._draggable._newPos.x,B=(M-p+S)%u+p-S,K=(M+p+S)%u-p-S,fe=Math.abs(B+S)0?K:-K))-p;this._delta=0,this._startTime=null,fe&&(u.options.scrollWheelZoom==="center"?u.setZoom(p+fe):u.setZoomAround(this._lastMousePos,p+fe))}});Ct.addInitHook("addHandler","scrollWheelZoom",au);var _o=600;Ct.mergeOptions({tapHold:et.touchNative&&et.safari&&et.mobile,tapTolerance:15});var bc=Vi.extend({addHooks:function(){lt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Bt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(u){if(clearTimeout(this._holdTimeout),u.touches.length===1){var p=u.touches[0];this._startPos=this._newPos=new z(p.clientX,p.clientY),this._holdTimeout=setTimeout(l(function(){this._cancel(),this._isTapValid()&&(lt(document,"touchend",Pn),lt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",p))},this),_o),lt(document,"touchend touchcancel contextmenu",this._cancel,this),lt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function u(){Bt(document,"touchend",Pn),Bt(document,"touchend touchcancel",u)},_cancel:function(){clearTimeout(this._holdTimeout),Bt(document,"touchend touchcancel contextmenu",this._cancel,this),Bt(document,"touchmove",this._onMove,this)},_onMove:function(u){var p=u.touches[0];this._newPos=new z(p.clientX,p.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(u,p){var S=new MouseEvent(u,{bubbles:!0,cancelable:!0,view:window,screenX:p.screenX,screenY:p.screenY,clientX:p.clientX,clientY:p.clientY});S._simulated=!0,p.target.dispatchEvent(S)}});Ct.addInitHook("addHandler","tapHold",bc),Ct.mergeOptions({touchZoom:et.touch,bounceAtZoomLimits:!0});var md=Vi.extend({addHooks:function(){ut(this._map._container,"leaflet-touch-zoom"),lt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){dn(this._map._container,"leaflet-touch-zoom"),Bt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(u){var p=this._map;if(!(!u.touches||u.touches.length!==2||p._animatingZoom||this._zooming)){var S=p.mouseEventToContainerPoint(u.touches[0]),M=p.mouseEventToContainerPoint(u.touches[1]);this._centerPoint=p.getSize()._divideBy(2),this._startLatLng=p.containerPointToLatLng(this._centerPoint),p.options.touchZoom!=="center"&&(this._pinchStartLatLng=p.containerPointToLatLng(S.add(M)._divideBy(2))),this._startDist=S.distanceTo(M),this._startZoom=p.getZoom(),this._moved=!1,this._zooming=!0,p._stop(),lt(document,"touchmove",this._onTouchMove,this),lt(document,"touchend touchcancel",this._onTouchEnd,this),Pn(u)}},_onTouchMove:function(u){if(!(!u.touches||u.touches.length!==2||!this._zooming)){var p=this._map,S=p.mouseEventToContainerPoint(u.touches[0]),M=p.mouseEventToContainerPoint(u.touches[1]),B=S.distanceTo(M)/this._startDist;if(this._zoom=p.getScaleZoom(B,this._startZoom),!p.options.bounceAtZoomLimits&&(this._zoomp.getMaxZoom()&&B>1)&&(this._zoom=p._limitZoom(this._zoom)),p.options.touchZoom==="center"){if(this._center=this._startLatLng,B===1)return}else{var K=S._add(M)._divideBy(2)._subtract(this._centerPoint);if(B===1&&K.x===0&&K.y===0)return;this._center=p.unproject(p.project(this._pinchStartLatLng,this._zoom).subtract(K),this._zoom)}this._moved||(p._moveStart(!0,!1),this._moved=!0),oe(this._animRequest);var fe=l(p._move,p,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=J(fe,this,!0),Pn(u)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,oe(this._animRequest),Bt(document,"touchmove",this._onTouchMove,this),Bt(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});Ct.addInitHook("addHandler","touchZoom",md),Ct.BoxZoom=Pr,Ct.DoubleClickZoom=yc,Ct.Drag=Wi,Ct.Keyboard=hd,Ct.ScrollWheelZoom=au,Ct.TapHold=bc,Ct.TouchZoom=md,n.Bounds=j,n.Browser=et,n.CRS=ve,n.Canvas=vc,n.Circle=fc,n.CircleMarker=Ts,n.Class=se,n.Control=Br,n.DivIcon=ep,n.DivOverlay=mr,n.DomEvent=oc,n.DomUtil=_s,n.Draggable=Fa,n.Evented=k,n.FeatureGroup=Hi,n.GeoJSON=ha,n.GridLayer=Ls,n.Handler=Vi,n.Icon=qi,n.ImageOverlay=Ms,n.LatLng=pe,n.LatLngBounds=ee,n.Layer=vi,n.LayerGroup=As,n.LineUtil=L0,n.Map=Ct,n.Marker=Zl,n.Mixin=O0,n.Path=Gi,n.Point=z,n.PolyUtil=ud,n.Polygon=Os,n.Polyline=da,n.Popup=eu,n.PosAnimation=Ss,n.Projection=qm,n.Rectangle=wo,n.Renderer=Mr,n.SVG=Ns,n.SVGOverlay=gc,n.TileLayer=qa,n.Tooltip=tu,n.Transformation=te,n.Util=we,n.VideoOverlay=Ha,n.bind=l,n.bounds=q,n.canvas=ru,n.circle=Zm,n.circleMarker=Km,n.control=fa,n.divIcon=I0,n.extend=i,n.featureGroup=Ym,n.geoJSON=pc,n.geoJson=Jl,n.gridLayer=tp,n.icon=Yl,n.imageOverlay=Xm,n.latLng=he,n.latLngBounds=le,n.layerGroup=N0,n.map=rd,n.marker=Wm,n.point=I,n.polygon=D0,n.polyline=R0,n.popup=Jm,n.rectangle=z0,n.setOptions=_,n.stamp=f,n.svg=iu,n.svgOverlay=Qm,n.tileLayer=ti,n.tooltip=k0,n.transformation=V,n.version=r,n.videoOverlay=Ps;var pd=window.L;n.noConflict=function(){return window.L=pd,this},window.L=n})}(gh,gh.exports)),gh.exports}var Cm=$ye();const X5=aa(Cm);function m3(e,t,n){return Object.freeze({instance:e,context:t,container:n})}function p3(e,t){return t==null?function(r,i){const o=w.useRef(void 0);return o.current||(o.current=e(r,i)),o}:function(r,i){const o=w.useRef(void 0);o.current||(o.current=e(r,i));const l=w.useRef(r),{instance:c}=o.current;return w.useEffect(function(){l.current!==r&&(t(c,r,l.current),l.current=r)},[c,r,t]),o}}function Vye(e,t){w.useEffect(function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){t.layerContainer?.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function Q7(e){return function(n){const r=Z7(),i=e(h3(n,r),r);return K7(r.map,n.attribution),X7(i.current,n.eventHandlers),Vye(i.current,r),i}}function Hye(e,t){const n=p3(e,t),r=Q7(n);return Iye(r)}function qye(e,t){const n=p3(e),r=Bye(n,t);return zye(r)}function Gye(e,t){const n=p3(e,t),r=Q7(n);return Uye(r)}function Yye(e,t,n){const{opacity:r,zIndex:i}=t;r!=null&&r!==n.opacity&&e.setOpacity(r),i!=null&&i!==n.zIndex&&e.setZIndex(i)}function Wye({bounds:e,boundsOptions:t,center:n,children:r,className:i,id:o,placeholder:l,style:c,whenReady:f,zoom:h,...m},y){const[x]=w.useState({className:i,id:o,style:c}),[b,C]=w.useState(null),_=w.useRef(void 0);w.useImperativeHandle(y,()=>b?.map??null,[b]);const A=w.useCallback(P=>{if(P!==null&&!_.current){const N=new Cm.Map(P,m);_.current=N,n!=null&&h!=null?N.setView(n,h):e!=null&&N.fitBounds(e,t),f!=null&&N.whenReady(f),C(Dye(N))}},[]);w.useEffect(()=>()=>{b?.map.remove()},[b]);const O=b?uf.createElement(d3,{value:b},r):l??null;return uf.createElement("div",{...x,ref:A},O)}const Kye=w.forwardRef(Wye),Zye=Hye(function({position:t,...n},r){const i=new Cm.Marker(t,n);return m3(i,kye(r,{overlayContainer:i}))},function(t,n,r){n.position!==r.position&&t.setLatLng(n.position),n.icon!=null&&n.icon!==r.icon&&t.setIcon(n.icon),n.zIndexOffset!=null&&n.zIndexOffset!==r.zIndexOffset&&t.setZIndexOffset(n.zIndexOffset),n.opacity!=null&&n.opacity!==r.opacity&&t.setOpacity(n.opacity),t.dragging!=null&&n.draggable!==r.draggable&&(n.draggable===!0?t.dragging.enable():t.dragging.disable())}),Xye=qye(function(t,n){const r=new Cm.Popup(t,n.overlayContainer);return m3(r,n)},function(t,n,{position:r},i){w.useEffect(function(){const{instance:l}=t;function c(h){h.popup===l&&(l.update(),i(!0))}function f(h){h.popup===l&&i(!1)}return n.map.on({popupopen:c,popupclose:f}),n.overlayContainer==null?(r!=null&&l.setLatLng(r),l.openOn(n.map)):n.overlayContainer.bindPopup(l),function(){n.map.off({popupopen:c,popupclose:f}),n.overlayContainer?.unbindPopup(),n.map.removeLayer(l)}},[t,n,i,r])}),Qye=Gye(function({url:t,...n},r){const i=new Cm.TileLayer(t,h3(n,r));return m3(i,r)},function(t,n,r){Yye(t,n,r);const{url:i}=n;i!=null&&i!==r.url&&t.setUrl(i)}),Jye={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},J7={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},_n={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv",bot:"bot"},Vr={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},el={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class De{static getFirstMatch(t,n){const r=n.match(t);return r&&r.length>0&&r[1]||""}static getSecondMatch(t,n){const r=n.match(t);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(t,n,r){if(t.test(n))return r}static getWindowsVersionName(t){switch(t){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(t){const n=t.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),n[0]===10)switch(n[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(t){const n=t.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),!(n[0]===1&&n[1]<5)){if(n[0]===1&&n[1]<6)return"Cupcake";if(n[0]===1&&n[1]>=6)return"Donut";if(n[0]===2&&n[1]<2)return"Eclair";if(n[0]===2&&n[1]===2)return"Froyo";if(n[0]===2&&n[1]>2)return"Gingerbread";if(n[0]===3)return"Honeycomb";if(n[0]===4&&n[1]<1)return"Ice Cream Sandwich";if(n[0]===4&&n[1]<4)return"Jelly Bean";if(n[0]===4&&n[1]>=4)return"KitKat";if(n[0]===5)return"Lollipop";if(n[0]===6)return"Marshmallow";if(n[0]===7)return"Nougat";if(n[0]===8)return"Oreo";if(n[0]===9)return"Pie"}}static getVersionPrecision(t){return t.split(".").length}static compareVersions(t,n,r=!1){const i=De.getVersionPrecision(t),o=De.getVersionPrecision(n);let l=Math.max(i,o),c=0;const f=De.map([t,n],h=>{const m=l-De.getVersionPrecision(h),y=h+new Array(m+1).join(".0");return De.map(y.split("."),x=>new Array(20-x.length).join("0")+x).reverse()});for(r&&(c=l-Math.min(i,o)),l-=1;l>=c;){if(f[0][l]>f[1][l])return 1;if(f[0][l]===f[1][l]){if(l===c)return 0;l-=1}else if(f[0][l]{r[f]=l[f]})}return t}static getBrowserAlias(t){return Jye[t]}static getBrowserTypeByAlias(t){return J7[t]||""}}const Zt=/version\/(\d+(\.?_?\d+)+)/i,e0e=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},n=De.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},n=De.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/PaleMoon/i],describe(e){const t={name:"Pale Moon"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},n=De.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},n=De.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},n=De.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},n=De.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},n=De.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},n=De.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=De.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},n=De.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},n=De.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},n=De.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},n=De.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},n=De.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},n=De.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},n=De.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},n=De.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},n=De.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},n=De.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},n=De.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},n=De.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},n=De.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},n=De.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},n=De.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},n=De.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},n=De.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},n=De.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t={name:"Android Browser"},n=De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},n=De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},n=De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/.*/i],describe(e){const t=/^(.*)\/(.*) /,n=/^(.*)\/(.*)[ \t]\((.*)/,i=e.search("\\(")!==-1?n:t;return{name:De.getFirstMatch(i,e),version:De.getSecondMatch(i,e)}}}],t0e=[{test:[/Roku\/DVP/],describe(e){const t=De.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:Vr.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=De.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:Vr.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=De.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=De.getWindowsVersionName(t);return{name:Vr.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:Vr.iOS},n=De.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe(e){const t=De.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=De.getMacOSVersionName(t),r={name:Vr.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=De.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:Vr.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t=De.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=De.getAndroidVersionName(t),r={name:Vr.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=De.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:Vr.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=De.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||De.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||De.getFirstMatch(/\bbb(\d+)/i,e);return{name:Vr.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=De.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:Vr.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=De.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:Vr.Tizen,version:t}}},{test:[/linux/i],describe(){return{name:Vr.Linux}}},{test:[/CrOS/],describe(){return{name:Vr.ChromeOS}}},{test:[/PlayStation 4/],describe(e){const t=De.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:Vr.PlayStation4,version:t}}}],n0e=[{test:[/googlebot/i],describe(){return{type:_n.bot,vendor:"Google"}}},{test:[/huawei/i],describe(e){const t=De.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:_n.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:_n.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:_n.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:_n.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:_n.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:_n.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:_n.tablet}}},{test(e){const t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe(e){const t=De.getFirstMatch(/(ipod|iphone)/i,e);return{type:_n.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:_n.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe(e){const t=De.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,e),n={type:_n.mobile,vendor:"Nokia"};return t&&(n.model=t),n}},{test:[/[^-]mobi/i],describe(){return{type:_n.mobile}}},{test(e){return e.getBrowserName(!0)==="blackberry"},describe(){return{type:_n.mobile,vendor:"BlackBerry"}}},{test(e){return e.getBrowserName(!0)==="bada"},describe(){return{type:_n.mobile}}},{test(e){return e.getBrowserName()==="windows phone"},describe(){return{type:_n.mobile,vendor:"Microsoft"}}},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return e.getOSName(!0)==="android"&&t>=3},describe(){return{type:_n.tablet}}},{test(e){return e.getOSName(!0)==="android"},describe(){return{type:_n.mobile}}},{test(e){return e.getOSName(!0)==="macos"},describe(){return{type:_n.desktop,vendor:"Apple"}}},{test(e){return e.getOSName(!0)==="windows"},describe(){return{type:_n.desktop}}},{test(e){return e.getOSName(!0)==="linux"},describe(){return{type:_n.desktop}}},{test(e){return e.getOSName(!0)==="playstation 4"},describe(){return{type:_n.tv}}},{test(e){return e.getOSName(!0)==="roku"},describe(){return{type:_n.tv}}}],r0e=[{test(e){return e.getBrowserName(!0)==="microsoft edge"},describe(e){if(/\sedg\//i.test(e))return{name:el.Blink};const n=De.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:el.EdgeHTML,version:n}}},{test:[/trident/i],describe(e){const t={name:el.Trident},n=De.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){return e.test(/presto/i)},describe(e){const t={name:el.Presto},n=De.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe(e){const t={name:el.Gecko},n=De.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:el.Blink}}},{test:[/(apple)?webkit/i],describe(e){const t={name:el.WebKit},n=De.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];class Q5{constructor(t,n=!1){if(t==null||t==="")throw new Error("UserAgent parameter can't be empty");this._ua=t,this.parsedResult={},n!==!0&&this.parse()}getUA(){return this._ua}test(t){return t.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const t=De.find(e0e,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(t){return t?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const t=De.find(t0e,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os}getOSName(t){const{name:n}=this.getOS();return t?String(n).toLowerCase()||"":n||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(t=!1){const{type:n}=this.getPlatform();return t?String(n).toLowerCase()||"":n||""}parsePlatform(){this.parsedResult.platform={};const t=De.find(n0e,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(t){return t?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const t=De.find(r0e,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return De.assign({},this.parsedResult)}satisfies(t){const n={};let r=0;const i={};let o=0;if(Object.keys(t).forEach(c=>{const f=t[c];typeof f=="string"?(i[c]=f,o+=1):typeof f=="object"&&(n[c]=f,r+=1)}),r>0){const c=Object.keys(n),f=De.find(c,m=>this.isOS(m));if(f){const m=this.satisfies(n[f]);if(m!==void 0)return m}const h=De.find(c,m=>this.isPlatform(m));if(h){const m=this.satisfies(n[h]);if(m!==void 0)return m}}if(o>0){const c=Object.keys(i),f=De.find(c,h=>this.isBrowser(h,!0));if(f!==void 0)return this.compareVersion(i[f])}}isBrowser(t,n=!1){const r=this.getBrowserName().toLowerCase();let i=t.toLowerCase();const o=De.getBrowserTypeByAlias(i);return n&&o&&(i=o.toLowerCase()),i===r}compareVersion(t){let n=[0],r=t,i=!1;const o=this.getBrowserVersion();if(typeof o=="string")return t[0]===">"||t[0]==="<"?(r=t.substr(1),t[1]==="="?(i=!0,r=t.substr(2)):n=[],t[0]===">"?n.push(1):n.push(-1)):t[0]==="="?r=t.substr(1):t[0]==="~"&&(i=!0,r=t.substr(1)),n.indexOf(De.compareVersions(o,r,i))>-1}isOS(t){return this.getOSName(!0)===String(t).toLowerCase()}isPlatform(t){return this.getPlatformType(!0)===String(t).toLowerCase()}isEngine(t){return this.getEngineName(!0)===String(t).toLowerCase()}is(t,n=!1){return this.isBrowser(t,n)||this.isOS(t)||this.isPlatform(t)}some(t=[]){return t.some(n=>this.is(n))}}class i0e{static getParser(t,n=!1){if(typeof t!="string")throw new Error("UserAgent should be a string");return new Q5(t,n)}static parse(t){return new Q5(t).getResult()}static get BROWSER_MAP(){return J7}static get ENGINE_MAP(){return el}static get OS_MAP(){return Vr}static get PLATFORMS_MAP(){return _n}}const a0e=e=>e?.type===hS.INVALID_ARGUMENT,o0e=e=>e?.type===hS.INVALID_SHORT_URL_DELETION,s0e=e=>!!e&&typeof e=="object"&&["type","detail","title","status"].every(t=>t in e),zi=e=>s0e(e)?e:void 0,g3=e=>"error"in e,so=({errorData:e,fallbackMessage:t})=>g.jsxs(g.Fragment,{children:[e?.detail??t,a0e(e)&&g.jsxs("p",{children:["Invalid elements: [",e.invalidElements.join(", "),"]"]})]}),e9=w.createContext(""),l0e=e9.Provider,ps=()=>w.useContext(e9),t9=w.createContext(void 0),{Provider:v3}=t9,m0=()=>w.useContext(t9),u0e=5,y3=()=>{const[e,t]=w.useState([]),n=w.useMemo(()=>e.length>=u0e,[e.length]),r=w.useCallback(c=>!n&&t(f=>[...f,c]),[n]),i=w.useCallback(c=>!n&&e.every(f=>f.name!==c),[e,n]),o=w.useCallback(c=>t(f=>f.filter(h=>h!==c)),[]),l=w.useCallback(()=>t([]),[]);return{itemsToCompare:e,addItemToCompare:r,removeItemToCompare:o,clearItemsToCompare:l,canAddItemWithName:i}},b3=({className:e,type:t})=>{const n=ps(),r=m0(),i=w.useMemo(()=>r?encodeURIComponent(r.itemsToCompare.map(f=>f.query).join(",")):"",[r]);if(!r||r.itemsToCompare.length===0)return null;const{itemsToCompare:o,clearItemsToCompare:l,removeItemToCompare:c}=r;return g.jsx("div",{className:Oe("sticky top-(--header-height) z-10",e),children:g.jsxs(Nt,{bodyClassName:"flex flex-col lg:flex-row gap-4 items-center",children:[g.jsx("ul",{className:"flex flex-wrap gap-1 grow items-center",children:o.map((f,h)=>g.jsxs("li",{className:Oe("flex items-center gap-1 text-sm font-bold text-white py-0.5 px-1.5 rounded",{"bg-gray-500":!f.style?.backgroundColor}),style:f.style,children:[f.name,g.jsx(Iu,{label:`Remove ${f.name}`,className:"text-xs",onClick:()=>c(f)})]},`${f.name}_${h}`))}),g.jsxs("div",{className:"flex gap-2 max-lg:w-full",children:[g.jsxs(Tt,{className:"grow whitespace-nowrap",disabled:o.length<2,to:o.length>1?`${n}/${t}/compare-visits?${t}=${i}`:void 0,children:[g.jsx(Be,{icon:cy}),"Compare (",o.length,"/5)",g.jsx(Be,{icon:Wg})]}),g.jsx(Tt,{"aria-label":"Close compare",variant:"secondary",onClick:l,children:g.jsx(Be,{icon:dy})})]})]})})},c0e=(e,{maxVersion:t,minVersion:n})=>{const r=!n||dw(e,n,">=");return(!t||dw(e,t,"<="))&&r},n9={ipRedirectCondition:{minVersion:"4.2.0"},geolocationRedirectCondition:{minVersion:"4.3.0"},filterShortUrlsByDomain:{minVersion:"4.3.0"},advancedQueryRedirectConditions:{minVersion:"4.5.0"},desktopDeviceTypes:{minVersion:"4.5.0"},filterShortUrlsByExcludedTags:{minVersion:"4.6.0"},filterVisitsByDomain:{minVersion:"4.6.0"}};Object.freeze(n9);const vu=(e,t)=>c0e(t==="latest"?"999.99.99":t,n9[e]),r9=e=>({ipRedirectCondition:vu("ipRedirectCondition",e),geolocationRedirectCondition:vu("geolocationRedirectCondition",e),filterShortUrlsByDomain:vu("filterShortUrlsByDomain",e),advancedQueryRedirectConditions:vu("advancedQueryRedirectConditions",e),desktopDeviceTypes:vu("advancedQueryRedirectConditions",e),filterShortUrlsByExcludedTags:vu("filterShortUrlsByExcludedTags",e),filterVisitsByDomain:vu("filterVisitsByDomain",e)}),i9=w.createContext(r9("0.0.0")),f0e=i9.Provider,d0e=e=>w.useMemo(()=>r9(e),[e]),cl=e=>w.useContext(i9)[e],fl="DEFAULT",_2=({children:e,onChange:t,infoTitle:n,...r})=>g.jsx(di,{...r,onChange:i=>t(i.target.value),label:g.jsxs(g.Fragment,{children:[g.jsx(Be,{className:"mr-1.5",icon:hy,title:n}),e]}),type:"url",placeholder:"No redirect"}),h0e=({isOpen:e,onClose:t,domain:n,editDomainRedirects:r})=>{const[i,o]=w.useState(n.redirects?.baseUrlRedirect??""),[l,c]=w.useState(n.redirects?.regular404Redirect??""),[f,h]=w.useState(n.redirects?.invalidShortUrlRedirect??""),[m,y]=w.useState(!1),x=w.useCallback(async()=>{y(!0);try{await r({domain:n.domain,redirects:{baseUrlRedirect:Ub(i),regular404Redirect:Ub(l),invalidShortUrlRedirect:Ub(f)}}),t()}finally{y(!1)}},[r,n.domain,i,l,f,t]);return g.jsx(co,{title:`Edit redirects for ${n.domain}`,open:e,onClose:t,onConfirm:x,confirmText:m?"Saving...":"Save",confirmDisabled:m,children:g.jsxs("div",{className:"flex flex-col gap-y-3",children:[g.jsx(_2,{value:i,onChange:o,infoTitle:`Visitors accessing the base url, as in https://${n.domain}/, will be redirected to this URL.`,children:"Base URL"}),g.jsx(_2,{value:l,onChange:c,infoTitle:`Visitors accessing a url not matching a short URL pattern, as in https://${n.domain}/???/[...], will be redirected to this URL.`,children:"Regular 404"}),g.jsx(_2,{value:f,onChange:h,infoTitle:"Visitors accessing a url matching a short URL pattern, but not matching an existing short code, will be redirected to this URL.",children:"Invalid short URL"})]})})},m0e=({domain:e,editDomainRedirects:t})=>{const{flag:n,setToTrue:r,setToFalse:i}=Cn(),o=ps(),l=m0(),c=cl("filterShortUrlsByDomain");return g.jsxs(g.Fragment,{children:[g.jsxs(tn,{menuAlignment:"right",children:[g.jsxs(tn.Item,{className:"gap-1.5",to:`${o}/domain/${e.domain}${e.isDefault?`_${fl}`:""}/visits`,children:[g.jsx(Be,{icon:P_})," Visit stats"]}),g.jsxs(tn.Item,{className:"gap-1.5",disabled:!l||!l.canAddItemWithName(e.domain),onClick:()=>l?.addItemToCompare({name:e.domain,query:e.domain}),children:[g.jsx(Be,{icon:cy})," Compare visits"]}),c&&g.jsxs(tn.Item,{className:"gap-1.5",to:`${o}/list-short-urls/1?domain=${e.isDefault?fl:e.domain}`,children:[g.jsx(Be,{icon:M_})," Short URLs"]}),g.jsx(tn.Separator,{}),g.jsxs(tn.Item,{onClick:r,className:"gap-1.5",children:[g.jsx(Be,{icon:j_})," Edit redirects"]})]}),g.jsx(h0e,{domain:e,isOpen:n,onClose:i,editDomainRedirects:t})]})},p0e=({status:e})=>{const{anchor:t,tooltip:n}=os();return e==="validating"?g.jsx(Be,{icon:O_,spin:!0}):g.jsxs("span",{...t,children:[g.jsx(Be,{icon:e==="valid"?Ru:cH,className:Oe({"text-danger":e!=="valid"})}),g.jsx(ss,{...n,children:e==="valid"?g.jsxs(g.Fragment,{children:["Congratulations!",g.jsx("br",{}),"This domain is properly configured."]}):g.jsxs("span",{children:["Oops! There is some missing configuration, and short URLs shared with this domain will not work.",g.jsx("br",{}),"Check the ",g.jsx(Li,{href:"https://slnk.to/multi-domain-docs",children:"documentation"})," in order to find out what is missing."]})})]})},S2=({fallback:e})=>g.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:[!e&&g.jsx("small",{children:"No redirect"}),e&&g.jsxs(g.Fragment,{children:[e," ",g.jsx("small",{children:"(as fallback)"})]})]}),g0e=()=>{const{anchor:e,tooltip:t}=os();return g.jsxs(g.Fragment,{children:[g.jsx(Be,{...e,icon:LH,className:"text-lm-brand dark:text-dm-brand","data-testid":"default-domain-icon"}),g.jsx(ss,{...t,children:"Default domain foo"})]})},v0e=({domain:e,editDomainRedirects:t,checkDomainHealth:n,defaultRedirects:r})=>{const{domain:i,isDefault:o,redirects:l,status:c}=e;return w.useEffect(()=>{n(e.domain)},[n,e.domain]),g.jsxs($e.Row,{className:"relative",children:[g.jsx($e.Cell,{columnName:"Is default domain:",children:o&&g.jsx(g0e,{})}),g.jsx($e.Cell,{columnName:"Domain:",children:g.jsx("b",{children:i})}),g.jsx($e.Cell,{columnName:"Base path redirect:",children:l?.baseUrlRedirect??g.jsx(S2,{fallback:r?.baseUrlRedirect})}),g.jsx($e.Cell,{columnName:"Regular 404 redirect:",children:l?.regular404Redirect??g.jsx(S2,{fallback:r?.regular404Redirect})}),g.jsx($e.Cell,{columnName:"Invalid short URL redirect:",children:l?.invalidShortUrlRedirect??g.jsx(S2,{fallback:r?.invalidShortUrlRedirect})}),g.jsx($e.Cell,{className:"lg:text-center max-lg:border-none",columnName:"Status:",children:g.jsx(p0e,{status:c})}),g.jsx($e.Cell,{className:"text-right max-lg:absolute max-lg:top-1 max-lg:right-1 max-lg:p-0",children:g.jsx(m0e,{domain:e,editDomainRedirects:t})})]})},J5=[{value:"Is default domain",isHidden:!0},{value:"Domain",isHidden:!1},{value:"Base path redirect",isHidden:!1},{value:"Regular 404 redirect",isHidden:!1},{value:"Invalid short URL redirect",isHidden:!1},{value:"Domain status",isHidden:!0},{value:"Options",isHidden:!0}],y0e=({domainsList:e,filterDomains:t,editDomainRedirects:n,checkDomainHealth:r})=>{const{filteredDomains:i,defaultRedirects:o,loading:l,error:c,errorData:f}=e,h=o??i.find(({isDefault:y})=>y)?.redirects,m=y3();return l?g.jsx(Ko,{loading:!0}):g.jsx(v3,{value:m,children:g.jsxs("div",{className:"flex flex-col gap-y-4",children:[g.jsx(Mf,{onChange:t}),g.jsx(b3,{type:"domains"}),c&&g.jsx(Gr,{variant:"error",children:g.jsx(so,{errorData:f,fallbackMessage:"Error loading domains :("})}),!c&&g.jsx(Nt,{className:"card",children:g.jsxs($e,{header:g.jsx($e.Row,{children:J5.map((y,x)=>g.jsx($e.Cell,{children:g.jsx("span",{className:y.isHidden?"sr-only":void 0,children:y.value})},x))}),children:[i.length<1&&g.jsx($e.Row,{children:g.jsx($e.Cell,{colSpan:J5.length,className:"text-center",children:"No results found"})}),i.map(y=>g.jsx(v0e,{domain:y,editDomainRedirects:n,checkDomainHealth:r,defaultRedirects:h},y.domain))]})})]})})},or=(e,t)=>V6(e,t,{serializeError:n=>n}),b0e="shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS",x0e=e=>or(b0e,async({domain:t,redirects:n})=>{const r=await e().editDomainRedirects({domain:t,...n});return{domain:t,redirects:r}}),wg="shlink/domainsList",_g={domains:[],filteredDomains:[],loading:!1,error:!1},eL=({domain:e,redirects:t})=>n=>n.domain!==e?n:{...n,redirects:t},tL=(e,t)=>n=>n.domain!==e?n:{...n,status:t},w0e=(e,t,n)=>{const r=or(`${wg}/listDomains`,async()=>{const{data:c,defaultRedirects:f}=await e().listDomains();return{domains:c.map(h=>({...h,status:"validating"})),defaultRedirects:f}}),i=or(`${wg}/checkDomainHealth`,async c=>{try{const{status:f}=await e().health({domain:c});return{domain:c,status:f==="pass"?"valid":"invalid"}}catch{return{domain:c,status:"invalid"}}}),o=un(`${wg}/filterDomains`),{reducer:l}=jt({name:wg,initialState:_g,reducers:{},extraReducers:c=>{c.addCase(r.pending,()=>({..._g,loading:!0})),c.addCase(r.rejected,(f,{error:h})=>({..._g,error:!0,errorData:zi(h)})),c.addCase(r.fulfilled,(f,{payload:h})=>({..._g,...h,filteredDomains:h.domains})),c.addCase(i.fulfilled,({domains:f,filteredDomains:h,...m},{payload:y})=>({...m,domains:f.map(tL(y.domain,y.status)),filteredDomains:h.map(tL(y.domain,y.status))})),c.addCase(o,(f,{payload:h})=>({...f,filteredDomains:f.domains.filter(({domain:m})=>m.toLowerCase().match(h.toLowerCase()))})),c.addCase(t.fulfilled,(f,{payload:h})=>({...f,domains:f.domains.map(eL(h)),filteredDomains:f.filteredDomains.map(eL(h))})),c.addCase(n.fulfilled,(f,{payload:h})=>{h.domain===null||f.domains.some(m=>m.domain===h.domain)||f.domains.push({domain:h.domain,status:"validating",isDefault:!1,redirects:{baseUrlRedirect:null,regular404Redirect:null,invalidShortUrlRedirect:null}})})}});return{reducer:l,listDomains:r,checkDomainHealth:i,filterDomains:o}},_0e=(e,t)=>{e.serviceFactory("ManageDomains",()=>y0e),e.decorator("ManageDomains",t(["domainsList"],["filterDomains","editDomainRedirects","checkDomainHealth"])),e.serviceFactory("domainsListReducerCreator",w0e,"apiClientFactory","editDomainRedirects","createShortUrl"),e.serviceFactory("domainsListReducer",n=>n.reducer,"domainsListReducerCreator"),e.serviceFactory("listDomains",n=>n.listDomains,"domainsListReducerCreator"),e.serviceFactory("filterDomains",n=>n.filterDomains,"domainsListReducerCreator"),e.serviceFactory("editDomainRedirects",x0e,"apiClientFactory"),e.serviceFactory("checkDomainHealth",n=>n.checkDomainHealth,"domainsListReducerCreator")},nL="shlink/mercure",S0e={loading:!0,error:!1},C0e=e=>{const t=or(`${nL}/loadMercureInfo`,r=>{if(r&&r.realTimeUpdates&&!r.realTimeUpdates.enabled)throw new Error("Real time updates not enabled");return e().mercureInfo()}),{reducer:n}=jt({name:nL,initialState:S0e,reducers:{},extraReducers:r=>{r.addCase(t.pending,i=>({...i,loading:!0,error:!1})),r.addCase(t.rejected,i=>({...i,loading:!1,error:!0})),r.addCase(t.fulfilled,(i,{payload:o})=>({...o,loading:!1,error:!1}))}});return{loadMercureInfo:t,reducer:n}},E0e=e=>{e.serviceFactory("mercureInfoReducerCreator",C0e,"apiClientFactory"),e.serviceFactory("mercureInfoReducer",t=>t.reducer,"mercureInfoReducerCreator"),e.serviceFactory("loadMercureInfo",t=>t.loadMercureInfo,"mercureInfoReducerCreator")};function An(e){return w.useMemo(()=>e,[e])}function Tn(e,t){return(n,r=globalThis.console)=>(t.forEach(i=>{const o=n[i];e[i]=o}),e)}const A0e=(e,t,n,r)=>{const{mercureHubUrl:i,token:o,loading:l,error:c}=e;if(l||c||!i)return;const f=({data:y})=>n(JSON.parse(y)),h=({status:y})=>y===401&&r(),m=t.map(y=>{const x=new URL(i);x.searchParams.append("topic",y);const b=new xJ.EventSourcePolyfill(x,{headers:{Authorization:`Bearer ${o}`}});return b.onmessage=f,b.onerror=h,b});return()=>m.forEach(y=>y.close())};function Na(e,t){const n=new Set;return r=>{const{createNewVisits:i,loadMercureInfo:o,mercureInfo:l}=r,c=Ef();return w.useEffect(()=>{const{interval:f}=l,h=b=>f?n.add(b):i([b]),m=t(c),y=A0e(l,m,h,o);if(!f)return y;const x=setInterval(()=>{i([...n]),n.clear()},f*1e3*60);return()=>{clearInterval(x),y?.()}},[i,o,l,c]),g.jsx(e,{...r})}}class ia{static visits="https://shlink.io/new-visit";static orphanVisits="https://shlink.io/new-orphan-visit";static shortUrlVisits=t=>`https://shlink.io/new-visit/${t}`}const Vf=un("shlink/visitCreation/createNewVisits",e=>({payload:{createdVisits:e}})),Ch=(e,t,n)=>n==null?e.shortCode===t&&!e.domain:e.shortCode===t&&e.domain===n,T0e=(e,t)=>!e.domain&&t===fl?!0:e.domain===t,O0e=e=>e?{longUrl:e.longUrl,tags:e.tags,title:e.title??void 0,domain:e.domain??void 0,validSince:e.meta.validSince??void 0,validUntil:e.meta.validUntil??void 0,maxVisits:e.meta.maxVisits??void 0,crawlable:e.crawlable,forwardQuery:e.forwardQuery}:{longUrl:""},a9=e=>e.replaceAll("/","__"),x3=e=>e.replaceAll("__","/"),w3=({domain:e,shortCode:t})=>`${e??fl}__${a9(t)}`,o9=e=>{const[t,n]=e.split(/__(.+)/);if(!n)throw new Error(`It was not possible to parse domain and short code from "${e}"`);return{domain:t===fl?null:t,shortCode:x3(n)}},_3="shlink/shortUrlDeletion",rL={shortCode:"",loading:!1,deleted:!1,error:!1},j0e=e=>or(`${_3}/deleteShortUrl`,async({shortCode:t,domain:n})=>(await e().deleteShortUrl({shortCode:t,domain:n}),{shortCode:t,domain:n})),s9=un(`${_3}/shortUrlDeleted`),M0e=e=>{const{actions:t,reducer:n}=jt({name:_3,initialState:rL,reducers:{resetDeleteShortUrl:()=>rL},extraReducers:i=>{i.addCase(e.pending,o=>({...o,loading:!0,error:!1,deleted:!1})),i.addCase(e.rejected,(o,{error:l})=>({...o,errorData:zi(l),loading:!1,error:!0,deleted:!1})),i.addCase(e.fulfilled,(o,{payload:l})=>({...o,shortCode:l.shortCode,loading:!1,error:!1,deleted:!0}))}}),{resetDeleteShortUrl:r}=t;return{reducer:n,resetDeleteShortUrl:r}},l9="shlink/shortUrlsList",u9=5,P0e={loading:!0,error:!1},L0e=e=>or(`${l9}/listShortUrls`,t=>e().listShortUrls(t??{})),N0e=(e,t,n)=>jt({name:l9,initialState:P0e,reducers:{},extraReducers:r=>{r.addCase(e.pending,i=>({...i,loading:!0,error:!1})),r.addCase(e.rejected,()=>({loading:!1,error:!0})),r.addCase(e.fulfilled,(i,{payload:o})=>({loading:!1,error:!1,shortUrls:o})),r.addCase(n.fulfilled,(i,{payload:o})=>{i.shortUrls&&(i.shortUrls.data=[o,...i.shortUrls.data.slice(0,u9-1)],i.shortUrls.pagination.totalItems+=1)}),r.addCase(t.fulfilled,(i,{payload:o})=>{i.shortUrls&&(i.shortUrls.data=i.shortUrls.data.map(l=>{const{shortCode:c,domain:f}=o;return Ch(l,c,f)?o:l}))}),r.addCase(s9,(i,{payload:o})=>{i.shortUrls&&(i.shortUrls.data=i.shortUrls.data.filter(l=>!Ch(l,o.shortCode,o.domain)),i.shortUrls.pagination.totalItems-=1)}),r.addCase(Vf,(i,{payload:o})=>{i.shortUrls&&(i.shortUrls.data=i.shortUrls.data.map(l=>o.createdVisits.findLast(({shortUrl:c})=>c&&Ch(l,c.shortCode,c.domain))?.shortUrl??l))})}}),r_=({children:e,title:t,link:n,tooltip:r})=>{const{anchor:i,tooltip:o}=os({placement:"bottom"});return g.jsxs(g.Fragment,{children:[g.jsx(Ir,{to:n,className:"no-underline text-inherit",...i,children:g.jsxs(Nt,{className:Oe("text-center border-t-3 border-t-lm-main dark:border-t-dm-main relative"),children:[g.jsx(Be,{icon:VK,size:"3x",className:"absolute right-[5px] bottom-[5px] opacity-10 -rotate-45"}),g.jsx("div",{role:"heading","aria-level":5,className:"text-xl uppercase text-placeholder font-bold mb-2",children:t}),g.jsx("div",{className:"text-4xl font-semibold",children:e})]})}),r&&g.jsx(ss,{...o,children:r})]})},iL=({loading:e,excludeBots:t,visitsSummary:n,...r})=>g.jsx(r_,{tooltip:n.bots!==void 0?g.jsxs(g.Fragment,{children:[t?"Plus":"Including"," ",g.jsx("b",{"data-testid":"tooltip-amount",children:Sn(n.bots)})," potential bot visits"]}):void 0,...r,children:e?"Loading...":Sn(t&&n.nonBots!==void 0?n.nonBots:n.total)}),aL=({children:e,titleLinkText:t,titleLink:n,title:r})=>g.jsxs(ln,{className:"card",children:[g.jsxs(ln.Header,{className:"flex justify-between items-center",children:[g.jsx("span",{className:"sm:hidden",children:r}),g.jsx("h5",{className:"hidden sm:inline",children:r}),g.jsxs(Ir,{to:n,children:[t," »"]})]}),g.jsx(ln.Body,{children:e})]}),c9=Na(({shortUrlsList:e,listShortUrls:t,tagsList:n,loadVisitsOverview:r,visitsOverview:i})=>{const{ShortUrlsTable:o,CreateShortUrl:l}=An(c9),{loading:c,shortUrls:f}=e,{loading:h}=n,{loading:m,nonOrphanVisits:y,orphanVisits:x}=i,b=ps(),C=uo(),_=Fn("visits");return w.useEffect(()=>{t({itemsPerPage:u9,orderBy:{field:"dateCreated",dir:"DESC"}}),r()},[t,r]),g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-4 gap-4",children:[g.jsx(iL,{title:"Visits",link:`${b}/non-orphan-visits`,excludeBots:_?.excludeBots??!1,loading:m,visitsSummary:y}),g.jsx(iL,{title:"Orphan visits",link:`${b}/orphan-visits`,excludeBots:_?.excludeBots??!1,loading:m,visitsSummary:x}),g.jsx(r_,{title:"Short URLs",link:`${b}/list-short-urls/1`,children:c?"Loading...":Sn(f?.pagination.totalItems??0)}),g.jsx(r_,{title:"Tags",link:`${b}/manage-tags`,children:h?"Loading...":Sn(n.tags.length)})]}),g.jsx(aL,{title:"Create a short URL",titleLinkText:"Advanced options",titleLink:`${b}/create-short-url`,children:g.jsx(l,{basicMode:!0})}),g.jsx(aL,{title:"Recently created URLs",titleLinkText:"See all",titleLink:`${b}/list-short-urls/1`,children:g.jsx(o,{shortUrlsList:e,onTagClick:A=>C(`${b}/list-short-urls/1?tags=${encodeURIComponent(A)}`)})})]})},()=>[ia.visits,ia.orphanVisits]),R0e=Tn(c9,["ShortUrlsTable","CreateShortUrl"]);function D0e(e,t){e.factory("Overview",R0e),e.decorator("Overview",t(["shortUrlsList","tagsList","mercureInfo","visitsOverview"],["listShortUrls","createNewVisits","loadMercureInfo","loadVisitsOverview"]))}const f9="shlink/setShortUrlRedirectRules",oL={saving:!1,saved:!1,error:!1},k0e=e=>or(`${f9}/setShortUrlRedirectRules`,({shortUrl:t,data:n})=>{const{shortCode:r,domain:i}=t;return e().setShortUrlRedirectRules({shortCode:r,domain:i},n)}),I0e=e=>{const{reducer:t,actions:n}=jt({name:f9,initialState:oL,reducers:{resetSetRules:()=>oL},extraReducers:i=>{i.addCase(e.pending,()=>({saving:!0,saved:!1,error:!1})),i.addCase(e.rejected,(o,{error:l})=>({saving:!1,saved:!1,error:!0,errorData:zi(l)})),i.addCase(e.fulfilled,()=>({saving:!1,error:!1,saved:!0}))}}),{resetSetRules:r}=n;return{reducer:t,resetSetRules:r}},d9="shlink/getShortUrlRedirectRules",z0e={loading:!0,error:!1},U0e=e=>or(`${d9}/getShortUrlRedirectRules`,({shortCode:t,domain:n})=>e().getShortUrlRedirectRules({shortCode:t,domain:n})),B0e=e=>jt({name:d9,initialState:z0e,reducers:{},extraReducers:t=>{t.addCase(e.pending,()=>({loading:!0,error:!1})),t.addCase(e.rejected,()=>({loading:!1,error:!0})),t.addCase(e.fulfilled,(n,{payload:r})=>({loading:!1,error:!1,...r}))}});function Yr(e){e.preventDefault()}function Rl(e){e.stopPropagation()}function h9(){const e=new Map;return[function(t,n){e.get(t)&&e.get(t).forEach(r=>{r(n)})},function(t,n){const r=e.get(t)??[];r.push(n),e.set(t,r)}]}var[m9,p9]=h9();function F0e(e,t){return e.source===t.source&&e.flags.split("").sort().join("")===t.flags.split("").sort().join("")}function Gh(e,t,n=!0,r=["__key"]){if(e===t)return!0;if(typeof t=="object"&&typeof e=="object"&&e!==null&&t!==null){if(e instanceof Map||e instanceof Set)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&t instanceof RegExp)return F0e(e,t);if(e===null||t===null)return!1;const i=e,o=t;if(Object.keys(i).length!==Object.keys(o).length)return!1;for(const l of r)if((l in i||l in o)&&i[l]!==o[l])return!1;for(const l in i)if(!(l in o)||i[l]!==o[l]&&!n||n&&!Gh(i[l],o[l],n,r))return!1;return!0}return!1}function g9(e){return e.split(" ").filter(t=>t)}function Hf(e){return{x:e.clientX,y:e.clientY}}Array();var S3=typeof window<"u",Dr=new WeakMap,lo=new WeakMap;function v9(){if(!S3)return!1;if("userAgentData"in navigator)return navigator.userAgentData.mobile===!0;const e=navigator.userAgent,t=/android|iphone|ipod/i.test(e),n=/iPad/.test(e)||e.includes("Macintosh")&&navigator.maxTouchPoints>1;return t||n}var $0e={affectedNodes:[],coordinates:{x:0,y:0},currentTargetValue:void 0,on:p9,emit:m9,originalZIndex:void 0,pointerSelection:!1,preventEnter:!1,rootUserSelect:void 0,nodePointerdown:void 0,longPress:!1,scrolling:!1,longPressTimeout:void 0,remapJustFinished:!1,selectedNodes:[],selectedParent:void 0,preventSynthDrag:!1,pointerDown:void 0,lastScrollContainerX:null,lastScrollContainerY:null,rootScrollWidth:void 0,rootScrollHeight:void 0,dragItemRect:void 0,windowScrollX:void 0,windowScrollY:void 0,lastScrollDirectionX:void 0,lastScrollDirectionY:void 0,scrollDebounceTimeout:void 0,frameIdX:void 0,frameIdY:void 0},Ie=$0e,Al=!1,sL,C2;function V0e(){Ie.scrollDebounceTimeout&&clearTimeout(Ie.scrollDebounceTimeout),Ie.longPressTimeout&&clearTimeout(Ie.longPressTimeout),Ie.frameIdX!==void 0&&cancelAnimationFrame(Ie.frameIdX),Ie.frameIdY!==void 0&&cancelAnimationFrame(Ie.frameIdY),Ie={affectedNodes:[],coordinates:{x:0,y:0},on:p9,emit:m9,currentTargetValue:void 0,originalZIndex:void 0,pointerId:void 0,preventEnter:!1,remapJustFinished:!1,selectedNodes:[],nodePointerdown:void 0,rootUserSelect:void 0,preventSynthDrag:!1,scrolling:!1,selectedParent:void 0,pointerSelection:!1,synthScrollDirection:void 0,draggedNodeDisplay:void 0,synthDragScrolling:!1,longPress:!1,pointerDown:void 0,longPressTimeout:void 0,lastScrollContainerX:null,lastScrollContainerY:null,rootScrollWidth:void 0,rootScrollHeight:void 0,dragItemRect:void 0,windowScrollX:void 0,windowScrollY:void 0,lastScrollDirectionX:void 0,lastScrollDirectionY:void 0,scrollDebounceTimeout:void 0,frameIdX:void 0,frameIdY:void 0}}function y9(e){return Object.assign(Ie,e),e.initialParent.data.emit("dragStarted",Ie),Al=!1,Ie.emit("dragStarted",Ie),Ie}function H0e(){Ie.activeState&&Wu(Ie.activeState.parent,void 0,Ie),Ie.selectedState&&Nu(Ie.selectedState.nodes,Ie.selectedState.parent,Ie),Ie.selectedState=Ie.activeState=void 0}function q0e(){if(Ie.pointerDown&&(Ie.pointerDown.node.el.draggable=!0),Ie.pointerDown=void 0,!ki(Ie))return;const e=Ie.currentParent.data.config;ki(Ie)&&e.handleEnd(Ie)}function G0e(e){e.key==="Escape"&&(Ie.selectedState&&Nu(Ie.selectedState.nodes,Ie.selectedState.parent,Ie),Ie.activeState&&Wu(Ie.activeState.parent,void 0,Ie),Ie.selectedState=Ie.activeState=void 0)}function Y0e(e){if(!Wr(Ie))return;Al=!0;const t=Ie.initialParent.data.config.handleEnd;t(Ie)}function W0e(e){if(!Wr(Ie))return;Yr(e);const{x:t,y:n}=Hf(e);Wr(Ie)&&v0({x:t,y:n},e,Ie)}function K0e(e){if(!Ie.pointerDown||!Ie.pointerDown.validated)return;const t=Ie.pointerDown.parent.data.config;if(!(e.pointerType==="mouse"&&!v9()))if(ki(Ie))ki(Ie)&&lL(e,Ie);else{if(Yr(e),t.longPress&&!Ie.longPress){clearTimeout(Ie.longPressTimeout),Ie.longPress=!1;return}const n=t.draggedNodes(Ie.pointerDown);t.dragstartClasses(Ie.pointerDown.node,n,t,!0);const r=Ie.pointerDown.node.el.getBoundingClientRect(),i=C1e(Ie.pointerDown.node,Ie.pointerDown.parent,e,Ie,n,r);lL(e,i,!0)}}function Z0e({parent:e,getValues:t,setValues:n,config:r={}}){if(!S3)return;sL||(sL=Jv(document,{dragover:W0e,pointerdown:H0e,pointerup:q0e,keydown:G0e,drop:Y0e,pointermove:K0e,pointercancel:Si(r.handlePointercancel),touchmove:c=>{Wr(Ie)&&c.cancelable&&Yr(c)},contextmenu:c=>{ki(Ie)&&Yr(c)}})),x9(e);const[i,o]=h9(),l={getValues:t,setValues:n,config:{dragDropEffect:r.dragDropEffect??"move",dragEffectAllowed:r.dragEffectAllowed??"move",draggedNodes:u1e,dragstartClasses:h1e,handleNodeKeydown:p1e,handleDragstart:f1e,handleNodeDragover:A1e,handleParentDragover:T1e,handleNodeDrop:v1e,handleNodeFocus:y1e,handleNodeBlur:b1e,handlePointercancel:w1e,handleEnd:_1e,handleDragend:x1e,handleParentFocus:Q0e,handleNodePointerup:S1e,handleNodePointerover:g1e,handleParentPointerover:O1e,handleParentScroll:c1e,handleNodePointerdown:d1e,handleNodeDragenter:M1e,handleNodeDragleave:P1e,handleParentDrop:e1e,multiDrag:r.multiDrag??!1,nativeDrag:r.nativeDrag??!0,performSort:X0e,performTransfer:J0e,root:r.root??document,setupNode:n1e,setupNodeRemap:w9,reapplyDragClasses:r1e,tearDownNode:a1e,tearDownNodeRemap:i1e,remapFinished:s1e,threshold:{horizontal:0,vertical:0},...r},enabledNodes:[],abortControllers:{},privateClasses:[],on:o,emit:i};new MutationObserver(o1e).observe(e,{childList:!0}),Dr.set(e,l),r.plugins?.forEach(c=>{c(e)?.tearDown?.()}),r.plugins?.forEach(c=>{c(e)?.tearDown?.()}),r.plugins?.forEach(c=>{c(e)?.setup?.()}),t1e(e,l),p0(e,!0)}function b9(e,t,n,r,i,o){const{x:l,y:c}=Hf(n),f=e.el.getBoundingClientRect();return{affectedNodes:[],ascendingDirection:!1,clonedDraggedEls:[],coordinates:{x:l,y:c},draggedNode:{el:e.el,data:e.data},draggedNodes:r,incomingDirection:void 0,initialIndex:e.data.index,initialParent:{el:t.el,data:t.data},currentParent:{el:t.el,data:t.data},longPress:t.data.config.longPress??!1,longPressTimeout:void 0,currentTargetValue:e.data.value,scrollEls:[],startLeft:i||l-(f?.left??0),startTop:o||c-(f?.top??0),targetIndex:e.data.index,transferred:!1}}function X0e({parent:e,draggedNodes:t,targetNodes:n}){p0(e.el);const r=t.map(f=>f.data.value),i=xf(e.el,e.data),o=t[0].data.index,l=[...e.data.enabledNodes],c=[...i.filter(f=>!r.some(h=>Gh(f,h)))];c.splice(n[0].data.index,0,...r),"draggedNode"in Ie&&(Ie.currentTargetValue=n[0].data.value),i_(e.el,e.data,[...c]),e.data.config.onSort&&e.data.config.onSort({parent:{el:e.el,data:e.data},previousValues:[...i],previousNodes:[...l],nodes:[...e.data.enabledNodes],values:[...c],draggedNodes:t,previousPosition:o,position:n[0].data.index,targetNodes:n,state:Ie})}function Wu(e,t,n){if(!t){n.activeState=void 0;return}n.activeState={node:t,parent:e}}function Nu(e,t,n){const r=t.data.config.selectedClass;if(!n.selectedState)return;const i=Array.from(e);dl(e.map(o=>o.el),r);for(const o of i){o.el.setAttribute("aria-selected","false");const l=n.selectedState.nodes.findIndex(c=>c.el===o.el);l!==-1&&n.selectedState.nodes.splice(l,1)}}function Sg(e,t,n,r,i=!1){r.pointerSelection=i;for(const o of t)o.el.setAttribute("aria-selected","true"),lf([o.el],e.data.config.selectedClass,!0);r.selectedState={nodes:t,parent:e},Wu(e,n,r)}function Q0e(e,t){const n=e.targetData.parent.data.enabledNodes[0];n&&(t.selectedState&&t.selectedState.parent.el!==e.targetData.parent.el?Wu(e.targetData.parent,n,t):t.selectedState||Wu(e.targetData.parent,n,t))}function J0e({currentParent:e,targetParent:t,initialParent:n,draggedNodes:r,initialIndex:i,targetNodes:o,state:l}){p0(n.el);const c=r.map(x=>x.data.value),f=[...xf(e.el,e.data).filter(x=>!c.some(b=>Gh(x,b)))],h=xf(t.el,t.data),m=n.el===t.el&&t.data.config.sortable===!1;let y;o.length?(m?y=i:t.data.config.sortable===!1?y=t.data.enabledNodes.length:y=o[0].data.index,h.splice(y,0,...c)):(y=m?i:t.data.enabledNodes.length,h.splice(y,0,...c)),i_(e.el,e.data,f),i_(t.el,t.data,h),t.data.config.onTransfer&&t.data.config.onTransfer({sourceParent:e,targetParent:t,initialParent:n,draggedNodes:r,targetIndex:y,state:l,targetNodes:o}),e.data.config.onTransfer&&e.data.config.onTransfer({sourceParent:e,targetParent:t,initialParent:n,draggedNodes:r,targetIndex:y,state:l,targetNodes:o||[]})}function xf(e,t){return[...t.getValues(e)]}function i_(e,t,n){t.setValues(n,e)}function e1e(e,t){Rl(e.e),Al=!0;const n=t.initialParent.data.config.handleEnd;n(t)}function x9(e){const t=Dr.get(e);t&&t.abortControllers.mainParent&&t.abortControllers.mainParent.abort()}function Wr(e){return"draggedNode"in e&&!!e.draggedNode}function ki(e){return"synthDragging"in e&&!!e.synthDragging}function t1e(e,t){t.abortControllers.mainParent=Jv(e,{dragover:Cg(t.config.handleParentDragover),handleParentPointerover:t.config.handleParentPointerover,scroll:Cg(t.config.handleParentScroll),drop:Cg(t.config.handleParentDrop),hasNestedParent:n=>{const r=Dr.get(n.target);r&&(r.nestedParent=n.detail.parent)},focus:Cg(t.config.handleParentFocus)}),t.config.externalDragHandle&&t.config.externalDragHandle.el&&t.config.externalDragHandle.callback&&(t.abortControllers.externalDragHandle=Jv(t.config.externalDragHandle.el,{pointerdown:n=>{if(!t.config.externalDragHandle||!t.config.externalDragHandle.callback)return;const r=t.config.externalDragHandle.callback();if(!y0(r)){console.warn("No draggable item found from external drag handle callback");return}const i=lo.get(r);if(!i)return;const o=r.parentNode;if(!(o instanceof HTMLElement))return;const l=Dr.get(o);l&&(Ie.pointerDown={parent:{el:o,data:l},node:{el:r,data:i},validated:!0},r.draggable=!0)}}))}function n1e(e){const t=e.parent.data.config;e.node.data.abortControllers.mainNode=Jv(e.node.el,{keydown:Si(t.handleNodeKeydown),dragstart:Si(t.handleDragstart),dragover:Si(t.handleNodeDragover),dragenter:Si(t.handleNodeDragenter),dragleave:Si(t.handleNodeDragleave),dragend:Si(t.handleDragend),drop:Si(t.handleNodeDrop),focus:Si(t.handleNodeFocus),blur:Si(t.handleNodeBlur),pointerup:Si(t.handleNodePointerup),pointercancel:Si(t.handlePointercancel),pointerdown:Si(t.handleNodePointerdown),handleNodePointerover:t.handleNodePointerover,touchmove:n=>{Wr(Ie)&&n.cancelable&&Yr(n)},contextmenu:n=>{ki(Ie)&&Yr(n)}}),e.node.el.draggable=!0,t.reapplyDragClasses(e.node.el,e.parent.data),e.parent.data.config.plugins?.forEach(n=>{n(e.parent.el)?.setupNode?.(e)})}function w9(e){lo.set(e.node.el,e.node.data),e.parent.data.config.plugins?.forEach(t=>{t(e.parent.el)?.setupNodeRemap?.(e)})}function r1e(e,t){if(!Wr(Ie))return;const n=ki(Ie)?t.config.synthDropZoneClass:t.config.dropZoneClass;Ie.draggedNode.el===e&&lf([e],n,!0)}function i1e(e){e.parent.data.config.plugins?.forEach(t=>{t(e.parent.el)?.tearDownNodeRemap?.(e)})}function a1e(e){e.parent.data.config.plugins?.forEach(t=>{t(e.parent.el)?.tearDownNode?.(e)}),e.node.el.draggable=!1,e.node.data?.abortControllers?.mainNode&&e.node.data?.abortControllers?.mainNode.abort()}function o1e(e){if(e.length===1&&e[0].addedNodes.length===1&&!(e[0].addedNodes[0]instanceof HTMLElement))return;const t=e[0].target;!(t instanceof HTMLElement)||!Dr.get(t)||p0(t)}function p0(e,t){const n=Dr.get(e);if(!n)return;n.privateClasses=Array.from(e.classList);const r=[],i=n.config;for(let c=0;cx.data.value===m.value);y&&(y.el=f)}l.push({el:f,data:m}),(t||!h)&&i.setupNode({parent:{el:e,data:n},node:{el:f,data:m}}),w9({parent:{el:e,data:n},node:{el:f,data:m}})}Dr.set(e,{...n,enabledNodes:l}),i.remapFinished(n),n.config.plugins?.forEach(c=>{c(e)?.remapFinished?.()})}function s1e(){Ie.remapJustFinished=!0,"draggedNode"in Ie&&(Ie.affectedNodes=[])}function l1e(e){return!!e.targetData.parent.data.config.nativeDrag}function u1e(e){if(e.parent.data.config.multiDrag){if(Ie.selectedState)return[e.node,...Ie.selectedState?.nodes.filter(t=>t.el!==e.node.el)]}else return[e.node];return[]}function c1e(e){Wr(Ie)&&(Ie.emit("scrollStarted",Ie),!ki(Ie)&&(Ie.preventEnter=!0,C2&&clearTimeout(C2),C2=setTimeout(()=>{Ie.preventEnter=!1,Ie.emit("scrollEnded",Ie)},100)))}function f1e(e,t){const n=e.targetData.parent.data.config;if(!n.nativeDrag||!l1e(e)||!_9({x:e.e.clientX,y:e.e.clientY,node:e.targetData.node,config:n})){Yr(e.e);return}let r=n.draggedNodes({parent:e.targetData.parent,node:e.targetData.node});r.length===0&&(r=[e.targetData.node]),n.dragstartClasses(e.targetData.node,r,n);const i=m1e(e,r);if(n.onDragstart){const o={parent:e.targetData.parent,values:xf(e.targetData.parent.el,e.targetData.parent.data),draggedNode:i.draggedNode,draggedNodes:i.draggedNodes,position:i.initialIndex,state:i};n.onDragstart(o)}}function d1e(e,t){if(Rl(e.e),t.pointerDown={parent:e.targetData.parent,node:e.targetData.node,validated:!1},!_9({x:e.e.clientX,y:e.e.clientY,node:e.targetData.node,config:e.targetData.parent.data.config}))return;t.pointerDown.validated=!0,E1e(e,t,e.targetData.node);const n=e.targetData.parent.data;let r=[e.targetData.node];const i=e.e.ctrlKey||e.e.metaKey,o=e.e.shiftKey,l=e.targetData.node;if(i&&n.config.multiDrag){t.selectedState?t.selectedState.nodes.findIndex(c=>c.el===l.el)===-1?r=[...t.selectedState.nodes,l]:r=t.selectedState.nodes.filter(c=>c.el!==l.el):r=[l],Sg(e.targetData.parent,r,e.targetData.node,t,!0);return}if(o&&n.config.multiDrag){const c=e.targetData.parent.data.enabledNodes;if(t.selectedState&&t.activeState)if(t.selectedState.parent.el!==e.targetData.parent.el){Nu(t.selectedState.nodes,t.selectedState.parent,t),t.selectedState=void 0;for(let f=0;f<=l.data.index;f++)r.push(c[f])}else{const[f,h]=t.activeState.node.data.indexc.el===e.targetData.node.el)===-1&&(t.selectedState.parent.el!==e.targetData.parent.el?Nu(t.selectedState.nodes,e.targetData.parent,t):n.config.multiDrag&&v9()?r.push(...t.selectedState.nodes):Nu(t.selectedState.nodes,e.targetData.parent,t),Sg(e.targetData.parent,r,e.targetData.node,t,!0)):Sg(e.targetData.parent,[e.targetData.node],e.targetData.node,t,!0)}function h1e(e,t,n,r=!1){lf(t.map(i=>i.el),r?n.synthDraggingClass:n.draggingClass),setTimeout(()=>{dl(t.map(i=>i.el),r?n.synthDraggingClass:n.draggingClass),lf(t.map(i=>i.el),r?n.synthDragPlaceholderClass:n.dragPlaceholderClass),lf(t.map(i=>i.el),r?n.synthDropZoneClass:n.dropZoneClass),dl(t.map(i=>i.el),n.selectedClass)})}function m1e(e,t){Rl(e.e);const n=y9(b9(e.targetData.node,e.targetData.parent,e.e,t));if(e.e.dataTransfer){const r=e.targetData.parent.data.config;e.e.dataTransfer.dropEffect=r.dragDropEffect,e.e.dataTransfer.effectAllowed=r.dragEffectAllowed;let i;if(e.e.dataTransfer.setData("text/plain",""),r.dragImage)i=r.dragImage(e,t);else{if(!r.multiDrag||t.length===1)return e.targetData.node.el.style.zIndex="9999",e.targetData.node.el.style.boxSizing="border-box",e.e.dataTransfer.setDragImage(e.targetData.node.el,e.e.offsetX,e.e.offsetY),n.originalZIndex=e.targetData.node.el.style.zIndex,n;{const o=document.createElement("div");o.setAttribute("id","dnd-dragged-node-clone"),o.setAttribute("popover","manual");for(const c of t){const f=c.el.cloneNode(!0);f.id=c.el.id+"-clone",f.style.pointerEvents="none",o.appendChild(f)}const{width:l}=t[0].el.getBoundingClientRect();Object.assign(o.style,{display:"flex",flexDirection:"column",width:`${l}px`,position:"absolute",pointerEvents:"none",zIndex:"9999",left:"-9999px",boxSizing:"border-box",background:"transparent",overflow:"hidden"}),e.targetData.parent.el.appendChild(o),o.showPopover(),o.getBoundingClientRect(),i=o,e.e.dataTransfer.setDragImage(i,e.e.offsetX,e.e.offsetY)}}setTimeout(()=>{i?.remove()})}return n}function _9({x:e,y:t,node:n,config:r}){if(r.externalDragHandle)return!1;if(!r.dragHandle)return!0;const i=n.el.querySelectorAll(r.dragHandle);if(!i)return!1;const o=r.root.elementFromPoint(e,t);if(!o)return!1;for(const l of Array.from(i))if(o===l||l.contains(o))return!0;return!1}function p1e(e){}function g1e(e){e.detail.targetData.parent.el===e.detail.state.currentParent.el?C9(e.detail,e.detail.state):g0(e.detail,e.detail.state)}function v1e(e,t){const n=e.targetData.parent.data.config;n.nativeDrag&&(Rl(e.e),Al=!0,n.handleEnd(t))}function y1e(e){e.e.target!==e.e.currentTarget&&Ie.pointerDown&&(Ie.pointerDown.node.el.draggable=!1)}function b1e(e){e.e.target!==e.e.currentTarget&&Ie.pointerDown&&(Ie.pointerDown.node.el.draggable=!0)}function x1e(e,t){const n=e.targetData.parent.data.config;if(n.nativeDrag){if(Yr(e.e),Rl(e.e),Al){Al=!1;return}n.handleEnd(t)}}function w1e(e,t){if(!ki(t))return;if(Yr(e.e),Al){Al=!1;return}const n=Dr.get(t.initialParent.el)?.config;n?.onDragend&&n.onDragend({parent:t.currentParent,values:xf(t.currentParent.el,t.currentParent.data),draggedNode:t.draggedNode,draggedNodes:t.draggedNodes,state:t}),n?.handleEnd(t)}function _1e(e){e.draggedNode&&(e.draggedNode.el.draggable=!0);const t=e.draggedNodes.map(m=>m.el),n=e.initialParent.data,r=ki(e),i=Dr.get(e.initialParent.el)?.config,o=r?i?.synthDropZoneClass:i?.dropZoneClass,l=n?.config?.longPressClass,c=r?n?.config?.synthDragPlaceholderClass:n?.config?.dragPlaceholderClass,f=e.originalZIndex;ki(e)&&(e.clonedDraggedNode&&e.clonedDraggedNode.remove(),e.longPressTimeout&&clearTimeout(e.longPressTimeout)),a_(e),e.lastScrollDirectionX=void 0,e.lastScrollDirectionY=void 0,e.preventEnter=!1,e.scrollDebounceTimeout&&(clearTimeout(e.scrollDebounceTimeout),e.scrollDebounceTimeout=void 0),f!==void 0&&e.draggedNode&&(e.draggedNode.el.style.zIndex=f),requestAnimationFrame(()=>{dl(t,o),dl(t,l),dl(t,c)}),Nu(e.draggedNodes,e.currentParent,e),Wu(e.currentParent,void 0,e);const h={...e};i?.onDragend?.({parent:h.currentParent,values:xf(h.currentParent.el,h.currentParent.data),draggedNode:h.draggedNode,draggedNodes:h.draggedNodes,state:h}),e.emit("dragEnded",h),V0e()}function S1e(e,t){Rl(e.e),!t.pointerSelection&&t.selectedState&&Nu(t.selectedState.nodes,e.targetData.parent,t);const n=e.targetData.parent.data.config;t.pointerSelection=!1,"longPressTimeout"in t&&t.longPressTimeout&&clearTimeout(t.longPressTimeout),t.longPress=!1,dl(e.targetData.parent.data.enabledNodes.map(r=>r.el),n.longPressClass),Wr(t)&&n.handleEnd(t)}function C1e(e,t,n,r,i,o){const l=t.data.config;let c,f;const h=["display","flexDirection","alignItems","justifyContent","padding","paddingTop","margin","marginTop","marginBottom","marginLeft","marginRight","paddingBottom","paddingLeft","paddingRight","border","borderRadius","background","backgroundColor","boxShadow","font","color","lineHeight","gap","width","height","boxSizing","overflow"],m=(b,C)=>{const _=window.getComputedStyle(b);h.forEach(A=>{C.style[A]=_[A]})},y=(b,C={})=>{Object.assign(b.style,{position:"absolute",zIndex:"9999",pointerEvents:"none",willChange:"transform",boxSizing:"border-box",opacity:"0",overflow:"hidden",width:`${o.width}px`,height:`${o.height}px`,...C})};if(l.synthDragImage)f=l.synthDragImage(e,t,n,i),c=f.dragImage,c.setAttribute("popover","manual"),y(c);else if(!l.multiDrag||i.length===1)c=e.el.cloneNode(!0),m(e.el,c),c.setAttribute("popover","manual"),y(c);else{const b=document.createElement("div");b.setAttribute("popover","manual"),i.forEach(C=>{const _=C.el.cloneNode(!0);m(C.el,_),_.style.pointerEvents="none",_.style.margin="0",b.append(_)}),b.style.display="flex",b.style.flexDirection="column",b.style.padding="0",b.style.margin="0",b.style.position="absolute",b.style.zIndex="9999",b.style.pointerEvents="none",c=b}c.id="dnd-dragged-node-clone",t.el.appendChild(c),c.showPopover();const x={clonedDraggedEls:[],clonedDraggedNode:c,synthDragScrolling:!1,synthDragging:!0,rootScrollWidth:document.scrollingElement?.scrollWidth,rootScrollHeight:document.scrollingElement?.scrollHeight};return y9({...b9(e,t,n,i,f?.offsetX,f?.offsetY),...x})}function E1e(e,t,n){const r=e.targetData.parent.data.config;t.longPressTimeout=setTimeout(()=>{t&&(t.longPress=!0,r.longPressClass&&e.e.cancelable&&lf([n.el],r.longPressClass),Yr(e.e))},r.longPressDuration||1e3)}function a_(e,t=!0,n=!0){t&&(e.frameIdX!==void 0&&(cancelAnimationFrame(e.frameIdX),e.frameIdX=void 0),e.lastScrollDirectionX=void 0),n&&(e.frameIdY!==void 0&&(cancelAnimationFrame(e.frameIdY),e.frameIdY=void 0),e.lastScrollDirectionY=void 0),!e.frameIdX&&!e.frameIdY&&(e.preventEnter=!1)}function S9(e,t=!1){const{x:n,y:r}=e.coordinates,i=e.startLeft??0,o=e.startTop??0,l=window.scrollX??0,c=window.scrollY??0,f=n-i+l,h=r-o+c;e.clonedDraggedNode.style.transform=`translate3d(${f}px, ${h}px, 0px)`,t&&(e.clonedDraggedNode.style.opacity="1",dl(e.draggedNodes.map(m=>m.el),e.initialParent.data.config?.longPressClass))}function lL(e,t,n=!1){const r=Hf(e);t.coordinates.x=r.x,t.coordinates.y=r.y,S9(t,n),t.scrollDebounceTimeout&&(clearTimeout(t.scrollDebounceTimeout),t.scrollDebounceTimeout=void 0),t.scrollDebounceTimeout=setTimeout(()=>{ki(t)&&v0(t.coordinates,e,t)},16);const i=D1e(r);if(!i){document.dispatchEvent(new CustomEvent("handleRootPointerover",{detail:{e,state:t}}));return}const o={e,targetData:i,state:t};"node"in i?i.node.el.dispatchEvent(new CustomEvent("handleNodePointerover",{detail:o})):i.parent.el.dispatchEvent(new CustomEvent("handleParentPointerover",{detail:o}))}function A1e(e,t){if(!e.targetData.parent.data.config.nativeDrag)return;const{x:n,y:r}=Hf(e.e);t.coordinates.y=r,t.coordinates.x=n,Yr(e.e),Rl(e.e),Wr(t)&&v0({x:n,y:r},e.e,t),e.targetData.parent.el===t.currentParent?.el?C9(e,t):g0(e,t)}function T1e(e,t){if(!e.targetData.parent.data.config.nativeDrag)return;Yr(e.e),Rl(e.e);const{x:n,y:r}=Hf(e.e);Wr(t)&&v0({x:n,y:r},e.e,t),g0(e,t)}function O1e(e){e.detail.targetData.parent.el!==e.detail.state.currentParent.el&&g0(e.detail,e.detail.state)}function j1e({currentParent:e,targetParent:t,initialParent:n,draggedNodes:r,state:i}){if(t.el===e.el)return!1;const o=t.data.config;if(r[0].el.contains(t.el)||o.dropZone===!1)return!1;const l=n.data.config;return o.accepts?o.accepts(t,n,e,i):!(!o.group||o.group!==l.group)}function M1e(e,t){Yr(e.e)}function P1e(e,t){Yr(e.e)}function L1e(e,t,n,r){if(t.affectedNodes.map(m=>m.data.value).includes(e.targetData.node.data.value))return!1;if(t.remapJustFinished)return t.remapJustFinished=!1,(e.targetData.node.data.value===t.currentTargetValue||t.draggedNodes.map(m=>m.el).includes(e.targetData.node.el))&&(t.currentTargetValue=e.targetData.node.data.value),!1;if(t.preventEnter)return!1;if(t.draggedNodes.map(m=>m.el).includes(e.targetData.node.el))return t.currentTargetValue=void 0,!1;if(e.targetData.node.data.value===t.currentTargetValue||e.targetData.parent.el!==t.currentParent?.el||e.targetData.parent.data.config.sortable===!1||e.targetData.node.el.contains(t.draggedNodes[0].el))return!1;const i=e.targetData.node.el.getBoundingClientRect(),o=t.draggedNode.el.getBoundingClientRect(),l=i.y-o.y,c=i.x-o.x;let f;Math.abs(l)>Math.abs(c)?f=l>0?"above":"below":f=c>0?"left":"right";const h=t.currentParent.data.config.threshold;switch(f){case"left":if(n>i.x+i.width*h.horizontal)return t.incomingDirection="left",!0;break;case"right":if(ni.y+i.height*h.vertical)return t.incomingDirection="above",!0;break;case"below":if(re.targetData.node.data.index?[e.targetData.node.data.index,t.draggedNode.data.index]:[t.draggedNode.data.index,e.targetData.node.data.index];t.targetIndex=e.targetData.node.data.index,t.affectedNodes=e.targetData.parent.data.enabledNodes.filter(o=>i[0]<=o.data.index&&o.data.index<=i[1]&&o.el!==t.draggedNode.el),e.targetData.parent.data.config.performSort({parent:e.targetData.parent,draggedNodes:t.draggedNodes,targetNodes:[e.targetData.node]})}function Si(e){function t(n){const r=lo.get(n);if(!r)return;const i=Dr.get(n.parentNode);if(i)return{node:{el:n,data:r},parent:{el:n.parentNode,data:i}}}return n=>{const r=t(n.currentTarget);if(r)return e({e:n,targetData:r},Ie)}}function g0(e,t){Yr(e.e),j1e({currentParent:t.currentParent,targetParent:e.targetData.parent,initialParent:t.initialParent,draggedNodes:t.draggedNodes,state:t})&&(e.targetData.parent.data.config.performTransfer({currentParent:t.currentParent,targetParent:e.targetData.parent,initialParent:t.initialParent,draggedNodes:t.draggedNodes,initialIndex:t.initialIndex,state:t,targetNodes:"node"in e.targetData?[e.targetData.node]:[]}),t.currentParent=e.targetData.parent,t.transferred=!0)}function Cg(e){function t(n){const r=Dr.get(n);if(r)return{parent:{el:n,data:r}}}return n=>{const r=t(n.currentTarget);if(r)return e({e:n,targetData:r},Ie)}}function lf(e,t,n=!1){function r(i,o){lo.set(i,o)}for(const i of e){const o=lo.get(i),l=N1e(i,t,o,n);l&&r(i,l)}}function N1e(e,t,n,r=!1){if(!t)return;const i=g9(t);if(!i.length)return;if(!n){e.classList.add(...i);return}const o=[];for(const l of i)e.classList.contains(l)?e.classList.contains(l)&&r===!1&&o.push(l):e.classList.add(l);return n.privateClasses=o,n}function dl(e,t){if(!t)return;const n=g9(t);if(n.length)for(const r of e){if(!y0(r)){r.classList.remove(...n);continue}const i=lo.get(r)||Dr.get(r);if(i)for(const o of n)i.privateClasses.includes(o)||r.classList.remove(o)}}function uL(e,t,n,r,i){const o=i.axis==="x",l=e===document.scrollingElement,c=o?"scrollLeft":"scrollTop",f=o?"clientWidth":"clientHeight",h=o?"offsetWidth":"offsetHeight",m=o?"scrollWidth":"scrollHeight",y=o?t.clientX:t.clientY,x=o?r.left:r.top,b=o?n.overflowX:n.overflowY;if(l){const C=e[c],_=e[f],A=C>0,O=C+_<(o?i.state.rootScrollWidth||0:e[m]);return o?{left:A&&y<_*.075,right:O&&y>_*(1-.075)}:{up:A&&y<_*.075,down:O&&y>_*(1-.075)}}if((b==="auto"||b==="scroll")&&e!==document.body&&e!==document.documentElement){const C=e[m],_=e[h],A=e[c],O=A>0,P=Ax+_*(1-.075)}:{up:O&&yx+_*(1-.075)}}return o?{left:!1,right:!1}:{up:!1,down:!1}}function R1e(e,t,n,r){if(!Wr(n)||!n.draggedNode)return;n.preventEnter=!0;const i=r.axis==="x",o=r.direction==="positive"?1:-1,l=20,c=i?"lastScrollDirectionX":"lastScrollDirectionY",f=i?"frameIdX":"frameIdY";n[f]!==void 0&&(cancelAnimationFrame(n[f]),n[f]=void 0),n[c]=r.direction;const h=()=>{if(!Wr(n)||!n.draggedNode){n[f]!==void 0&&(cancelAnimationFrame(n[f]),n[f]=void 0);return}const m=i?"scrollLeft":"scrollTop",y=i?"clientWidth":"clientHeight",x=i?"scrollWidth":"scrollHeight",b=e[m],C=e[y],_=e[x];if(!(o>0?b+C<_:b>0)){n[f]=void 0,n[c]=void 0;return}e[m]+=l*o,ki(n)&&S9(n),n[f]=requestAnimationFrame(h)};n[f]=requestAnimationFrame(h)}function cL(e,t,n){const r=e.getBoundingClientRect();return t>=r.left&&t<=r.right&&n>=r.top&&n<=r.bottom}function v0(e,t,n){if(!Wr(n)||!n.draggedNode)return;a_(n);const{x:r,y:i}=e;let o=!1;const l=(f,h,m)=>{R1e(m,t,n,{axis:f,direction:h}),o=!0},c=f=>{const h=window.getComputedStyle(f),m=f.getBoundingClientRect(),y=uL(f,t,h,m,{axis:"x",state:n}),x=uL(f,t,h,m,{axis:"y"});(y.left||y.right)&&(n.lastScrollContainerX=f,l("x",y.right?"positive":"negative",f)),(x.up||x.down)&&(n.lastScrollContainerY=f,l("y",x.down?"positive":"negative",f))};if(n.lastScrollContainerX&&cL(n.lastScrollContainerX,r,i)&&c(n.lastScrollContainerX),!o&&n.lastScrollContainerY&&cL(n.lastScrollContainerY,r,i)&&c(n.lastScrollContainerY),!o){let f=document.elementFromPoint(r,i);for(;f&&!(o&&n.lastScrollContainerX&&n.lastScrollContainerY);)f instanceof HTMLElement&&c(f),f=f.parentElement}if(!o){const f=document.scrollingElement;f instanceof HTMLElement&&c(f)}o||a_(n)}function D1e(e){let t=document.elementFromPoint(e.x,e.y);if(!y0(t))return;let n,r=!0;for(;t&&r;){if(lo.has(t)||Dr.has(t)){r=!1,n=Dr.has(t);break}t=t.parentNode}if(n){const i=Dr.get(t);return i?{parent:{el:t,data:i}}:void 0}else{const i=lo.get(t);if(!i)return;const o=Dr.get(t.parentNode);return o?{node:{el:t,data:i},parent:{el:t.parentNode,data:o}}:void 0}}function y0(e){return e instanceof HTMLElement&&e.parentNode instanceof HTMLElement}function Jv(e,t){const n=new AbortController;for(const r in t){const i=t[r];e.addEventListener(r,i,{signal:n.signal,passive:!1,capture:r==="focus"||r==="blur"})}return n}function k1e(e){if(e instanceof HTMLElement)return e;if("current"in e&&e.current instanceof HTMLElement)return e.current;console.warn("Invalid parent element",e)}function I1e(e,t){const n=k1e(e);n&&t(n)}var ey=new WeakMap;function z1e(e){const t=ey.get(e);return t?t[0]:(console.warn("No values found for parent element"),[])}function U1e(e,t){const n=ey.get(t);n&&n[1](e),ey.set(t,[e,n[1]])}function B1e(e,t){return n=>{ey.set(n,t),Z0e({parent:n,getValues:z1e,setValues:U1e,config:e})}}function fL(e){S3&&(Array.isArray(e)||(e=[e]),e.forEach(t=>{const{parent:n,state:r,...i}=t;I1e(n,B1e(i,r))}))}function F1e(e,t={}){const n=w.useRef(null),[r,i]=w.useState(e);function o(l={}){fL({parent:n,state:[r,i],...l})}return w.useEffect(()=>{fL({parent:n,state:[r,i],...t})},[r]),w.useEffect(()=>()=>{n.current&&x9(n.current)},[]),[n,r,i,o]}const b0=()=>{const e=uo(),t=ps(),n=Zu(),r=w.useMemo(()=>{const{orderBy:o,tags:l,excludeTags:c,excludeBots:f,excludeMaxVisitsReached:h,excludePastValidUntil:m,...y}=n,x=o?IZ(o):void 0,b=l?.split(",")??[];return{...y,orderBy:x,tags:b,excludeTags:c?.split(",")??[],excludeBots:f!==void 0?f==="true":void 0,excludeMaxVisitsReached:h!==void 0?h==="true":void 0,excludePastValidUntil:m!==void 0?m==="true":void 0}},[n]),i=w.useCallback(o=>{const l={...r,...o},{orderBy:c,tags:f,excludeTags:h,excludeBots:m,excludeMaxVisitsReached:y,excludePastValidUntil:x,...b}=l,C={...b,orderBy:c&&kZ(c),tags:f.length>0?f.join(","):void 0,excludeTags:h.length>0?h.join(","):void 0,excludeBots:Bb(m),excludeMaxVisitsReached:Bb(y),excludePastValidUntil:Bb(x)},_=Q_(C),A=_?`?${_}`:"";e(`${t}/list-short-urls/1${A}`)},[r,e,t]);return[r,i]},C3=()=>{const{domain:e}=Zu(),{shortCode:t=""}=Ef();return w.useMemo(()=>({shortCode:x3(t),domain:e}),[e,t])},x0=()=>{const e=fZ();return g.jsx(Cy,{size:"lg",className:"[&]:p-1 mr-4",onClick:e,"aria-label":"Go back",children:g.jsx(Be,{icon:xH})})},$1e={AF:"Afghanistan",AL:"Albania",DZ:"Algeria",AS:"American Samoa",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antarctica",AG:"Antigua and Barbuda",AR:"Argentina",AM:"Armenia",AW:"Aruba",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BS:"Bahamas",BH:"Bahrain",BD:"Bangladesh",BB:"Barbados",BY:"Belarus",BE:"Belgium",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivia",BA:"Bosnia and Herzegovina",BW:"Botswana",BR:"Brazil",IO:"British Indian Ocean Territory",VG:"British Virgin Islands",BN:"Brunei",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",KH:"Cambodia",CM:"Cameroon",CA:"Canada",CV:"Cape Verde",KY:"Cayman Islands",CF:"Central African Republic",TD:"Chad",CL:"Chile",CN:"China",CX:"Christmas Island",CC:"Cocos Islands",CO:"Colombia",KM:"Comoros",CK:"Cook Islands",CR:"Costa Rica",HR:"Croatia",CU:"Cuba",CW:"Curacao",CY:"Cyprus",CZ:"Czech Republic",CD:"Democratic Republic of the Congo",DK:"Denmark",DJ:"Djibouti",DM:"Dominica",DO:"Dominican Republic",TL:"East Timor",EC:"Ecuador",EG:"Egypt",SV:"El Salvador",GQ:"Equatorial Guinea",ER:"Eritrea",EE:"Estonia",ET:"Ethiopia",FK:"Falkland Islands",FO:"Faroe Islands",FJ:"Fiji",FI:"Finland",FR:"France",PF:"French Polynesia",GA:"Gabon",GM:"Gambia",GE:"Georgia",DE:"Germany",GH:"Ghana",GI:"Gibraltar",GR:"Greece",GL:"Greenland",GD:"Grenada",GU:"Guam",GT:"Guatemala",GG:"Guernsey",GN:"Guinea",GW:"Guinea-Bissau",GY:"Guyana",HT:"Haiti",HN:"Honduras",HK:"Hong Kong",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran",IQ:"Iraq",IE:"Ireland",IM:"Isle of Man",IL:"Israel",IT:"Italy",CI:"Ivory Coast",JM:"Jamaica",JP:"Japan",JE:"Jersey",JO:"Jordan",KZ:"Kazakhstan",KE:"Kenya",KI:"Kiribati",XK:"Kosovo",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Laos",LV:"Latvia",LB:"Lebanon",LS:"Lesotho",LR:"Liberia",LY:"Libya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MO:"Macao",MK:"Macedonia",MG:"Madagascar",MW:"Malawi",MY:"Malaysia",MV:"Maldives",ML:"Mali",MT:"Malta",MH:"Marshall Islands",MR:"Mauritania",MU:"Mauritius",YT:"Mayotte",MX:"Mexico",FM:"Micronesia",MD:"Moldova",MC:"Monaco",MN:"Mongolia",ME:"Montenegro",MS:"Montserrat",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar",NA:"Namibia",NR:"Nauru",NP:"Nepal",NL:"Netherlands",AN:"Netherlands Antilles",NC:"New Caledonia",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NU:"Niue",KP:"North Korea",MP:"Northern Mariana Islands",NO:"Norway",OM:"Oman",PK:"Pakistan",PW:"Palau",PS:"Palestine",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PN:"Pitcairn",PL:"Poland",PT:"Portugal",PR:"Puerto Rico",QA:"Qatar",CG:"Republic of the Congo",RE:"Reunion",RO:"Romania",RU:"Russia",RW:"Rwanda",BL:"Saint Barthelemy",SH:"Saint Helena",KN:"Saint Kitts and Nevis",LC:"Saint Lucia",MF:"Saint Martin",PM:"Saint Pierre and Miquelon",VC:"Saint Vincent and the Grenadines",WS:"Samoa",SM:"San Marino",ST:"Sao Tome and Principe",SA:"Saudi Arabia",SN:"Senegal",RS:"Serbia",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapore",SX:"Sint Maarten",SK:"Slovakia",SI:"Slovenia",SB:"Solomon Islands",SO:"Somalia",ZA:"South Africa",KR:"South Korea",SS:"South Sudan",ES:"Spain",LK:"Sri Lanka",SD:"Sudan",SR:"Suriname",SJ:"Svalbard and Jan Mayen",SZ:"Swaziland",SE:"Sweden",CH:"Switzerland",SY:"Syria",TW:"Taiwan",TJ:"Tajikistan",TZ:"Tanzania",TH:"Thailand",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad and Tobago",TN:"Tunisia",TR:"Turkey",TM:"Turkmenistan",TC:"Turks and Caicos Islands",TV:"Tuvalu",VI:"U.S. Virgin Islands",UG:"Uganda",UA:"Ukraine",AE:"United Arab Emirates",GB:"United Kingdom",US:"United States",UY:"Uruguay",UZ:"Uzbekistan",VU:"Vanuatu",VA:"Vatican",VE:"Venezuela",VN:"Vietnam",WF:"Wallis and Futuna",EH:"Western Sahara",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe"},V1e=({deviceType:e,onDeviceTypeChange:t})=>{const n=cl("desktopDeviceTypes"),r=w.useMemo(()=>{const i={android:"Android",ios:"iOS"};return n&&(i.mobile="Any mobile device",i.windows="Windows",i.macos="MacOS",i.linux="Linux",i.chromeos="ChromeOS"),i.desktop="Any desktop device",i},[n]);return g.jsxs(Z_,{label:"Device type:",value:e??void 0,onChange:i=>t(i.target.value),hiddenRequired:!0,children:[!e&&g.jsx("option",{value:"",children:"- Select type -"}),Object.entries(r).map(([i,o])=>g.jsx("option",{value:i,children:o},i))]})},E3=({value:e,onValueChange:t,label:n,placeholder:r})=>g.jsx(di,{label:`${n}:`,value:e??"",onChange:i=>t(i.target.value),placeholder:r,hiddenRequired:!0}),H1e=({language:e,onLanguageChange:t})=>g.jsx(E3,{value:e,onValueChange:t,label:"Language",placeholder:"en-US / en"}),E2=({name:e,value:t,onNameChange:n,onValueChange:r})=>g.jsxs(g.Fragment,{children:[g.jsx(di,{label:"Param name:",value:e??"",onChange:i=>n(i.target.value),placeholder:"hello",hiddenRequired:!0}),typeof t=="string"&&g.jsx(di,{label:"Param value:",value:t,onChange:i=>r(i.target.value),placeholder:"world",hiddenRequired:!0})]}),q1e=({ipAddress:e,onIpAddressChange:t})=>g.jsx(E3,{value:e,onValueChange:t,label:"IP address",placeholder:"192.168.1.10"}),G1e=({countryCode:e,onCountryCodeChange:t})=>g.jsxs(Z_,{label:"Country:",value:e??void 0,onChange:n=>t(n.target.value),hiddenRequired:!0,children:[!e&&g.jsx("option",{value:"",children:"- Select country -"}),Object.entries($1e).map(([n,r])=>g.jsx("option",{value:n,children:r},n))]}),Y1e=({cityName:e,onCityNameChange:t})=>g.jsx(E3,{value:e,onValueChange:t,label:"City name",placeholder:"New York"}),W1e=({condition:e,onConditionChange:t,onDelete:n})=>{const r=w.useCallback(m=>t({type:m,matchValue:null,matchKey:null}),[t]),i=w.useCallback(m=>t({...e,matchValue:m}),[e,t]),o=w.useCallback(m=>t({...e,matchKey:m}),[e,t]),l=cl("ipRedirectCondition"),c=cl("geolocationRedirectCondition"),f=cl("advancedQueryRedirectConditions"),h=w.useMemo(()=>{const m={device:"Device type",language:"Language","query-param":"Query param"};return f&&(m["any-value-query-param"]="Any value query param",m["valueless-query-param"]="Valueless query param"),l&&(m["ip-address"]="IP address"),c&&(m["geolocation-country-code"]="Country (geolocation)",m["geolocation-city-name"]="City name (geolocation)"),m},[f,c,l]);return g.jsxs("div",{className:Oe("flex flex-col gap-2","border border-lm-border dark:border-dm-border","rounded-md relative p-4 h-full"),children:[g.jsxs("div",{children:[g.jsx(Tt,{variant:"secondary","aria-label":"Remove condition",onClick:n,className:Oe("absolute -top-3.5 -right-3.5 [&]:px-2","[&]:rounded-full bg-lm-primary dark:bg-dm-primary"),children:g.jsx(Be,{icon:fy,widthAuto:!0})}),g.jsx(Z_,{label:"Type:",value:e.type,onChange:m=>r(m.target.value),hiddenRequired:!0,children:Object.entries(h).map(([m,y])=>g.jsx("option",{value:m,children:y},m))})]}),e.type==="device"&&g.jsx(V1e,{deviceType:e.matchValue,onDeviceTypeChange:i}),e.type==="language"&&g.jsx(H1e,{language:e.matchValue,onLanguageChange:i}),e.type==="query-param"&&g.jsx(E2,{name:e.matchKey,value:e.matchValue??"",onNameChange:o,onValueChange:i}),e.type==="any-value-query-param"&&g.jsx(E2,{name:e.matchKey,onNameChange:o,onValueChange:i}),e.type==="valueless-query-param"&&g.jsx(E2,{name:e.matchKey,onNameChange:o,onValueChange:i}),e.type==="ip-address"&&g.jsx(q1e,{ipAddress:e.matchValue,onIpAddressChange:i}),e.type==="geolocation-country-code"&&g.jsx(G1e,{countryCode:e.matchValue,onCountryCodeChange:i}),e.type==="geolocation-city-name"&&g.jsx(Y1e,{cityName:e.matchValue,onCityNameChange:i})]})},E9=({isOpen:e,onClose:t,onSave:n,initialData:r})=>{const[i,o]=w.useState(r??{longUrl:"",conditions:[]}),l=w.useCallback(()=>{i&&n(i),t()},[n,i,t]),c=w.useCallback(()=>o(({longUrl:x,conditions:b})=>({longUrl:x,conditions:[...b,{type:"device",matchValue:null,matchKey:null}]})),[]),f=w.useCallback((x,b)=>o(({longUrl:C,conditions:_})=>{const A=[..._];return A[x]=b,{longUrl:C,conditions:A}}),[]),h=w.useCallback(x=>o(({longUrl:b,conditions:C})=>{const _=[...C];return _.splice(x,1),{longUrl:b,conditions:_}}),[]),m=w.useRef(null),y=w.useCallback(()=>o(r??{longUrl:"",conditions:[]}),[r]);return w.useEffect(()=>{const x=new MutationObserver(()=>{m.current&&e&&(m.current.focus(),x.disconnect())});return x.observe(document.body,{childList:!0,subtree:!0}),()=>x.disconnect()},[e]),g.jsxs(co,{size:"xl",title:"Redirect rule",open:e,onClose:t,onClosed:y,onConfirm:l,confirmDisabled:i.conditions.length===0,confirmText:"Confirm",children:[g.jsx(di,{label:"Long URL:",type:"url",placeholder:"https://www.example.com",value:i.longUrl,onChange:x=>o(b=>({...b,longUrl:x.target.value})),hiddenRequired:!0,ref:m}),g.jsx("hr",{}),g.jsxs("div",{className:"flex justify-between",children:[g.jsx("b",{children:"Conditions:"}),g.jsx(Tt,{className:"[&]:px-1.5",variant:"secondary","aria-label":"Add condition",onClick:c,children:g.jsx(Be,{icon:Zh})})]}),i.conditions.length===0&&g.jsx("div",{className:"text-center",children:g.jsx("i",{children:"Add conditions..."})}),i.conditions.length>0&&g.jsx("div",{className:"pr-3 mt-6 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:i.conditions.map((x,b)=>g.jsx(W1e,{condition:x,onConditionChange:C=>f(b,C),onDelete:()=>h(b)},`${b}_${x.type}`))})]})},K1e=({priority:e,isLast:t,redirectRule:n,onDelete:r,onMoveUp:i,onMoveDown:o,onUpdate:l})=>{const{flag:c,setToTrue:f,setToFalse:h}=Cn();return g.jsxs(Nt,{children:[g.jsxs("div",{className:"flex align-center gap-4",children:[g.jsx("div",{className:"flex flex-col my-auto hidden md:block cursor-grab drag-n-drop-handler",children:g.jsx(Be,{icon:pH})}),g.jsxs("div",{className:"flex flex-col my-auto",children:[g.jsx(Tt,{variant:"secondary","aria-label":`Move rule with priority ${e} up`,disabled:e===1,onClick:i,className:"[&]:px-2 rounded-b-none mb-[-1px]",children:g.jsx(Be,{icon:oH})}),g.jsx(Tt,{variant:"secondary","aria-label":`Move rule with priority ${e} down`,disabled:t,onClick:o,className:"[&]:px-2 rounded-t-none",children:g.jsx(Be,{icon:jH})})]}),g.jsxs("div",{className:"grow",children:[g.jsxs("div",{className:"mb-2",children:[g.jsx("b",{children:"Long URL:"})," ",g.jsx(Li,{href:n.longUrl,"data-testid":"rule-long-url"})]}),g.jsxs("div",{className:"flex flex-col lg:flex-row gap-2",children:[g.jsx("b",{children:"Conditions:"}),n.conditions.map((m,y)=>g.jsxs("div",{className:"rounded-sm bg-gray-600 px-1 text-white",children:[m.type==="device"&&g.jsxs(g.Fragment,{children:["Device is ",m.matchValue]}),m.type==="language"&&g.jsxs(g.Fragment,{children:[m.matchValue," language is accepted"]}),m.type==="query-param"&&g.jsxs(g.Fragment,{children:["Query string contains ",m.matchKey,"=",m.matchValue]}),m.type==="ip-address"&&g.jsxs(g.Fragment,{children:["IP address matches ",m.matchValue]}),m.type==="geolocation-country-code"&&g.jsxs(g.Fragment,{children:["Country code is ",m.matchValue]}),m.type==="geolocation-city-name"&&g.jsxs(g.Fragment,{children:["City name is ",m.matchValue]})]},`${m.type}_${y}`))]})]}),g.jsxs("div",{className:"flex flex-col sm:flex-row gap-1 my-auto",children:[g.jsx(Tt,{className:"[&]:px-1.5",variant:"secondary","aria-label":`Edit rule with priority ${e}`,onClick:f,children:g.jsx(Be,{icon:ON})}),g.jsx(Tt,{className:"[&]:px-2",variant:"danger","aria-label":`Delete rule with priority ${e}`,onClick:r,children:g.jsx(Be,{icon:sH})})]})]}),g.jsx(E9,{onSave:l,isOpen:c,onClose:h,initialData:n})]})},Z1e=({shortUrlRedirectRules:e,getShortUrlRedirectRules:t,getShortUrlsDetails:n,shortUrlsDetails:r,setShortUrlRedirectRules:i,shortUrlRedirectRulesSaving:o,resetSetRules:l})=>{const c=C3(),{shortUrls:f}=r,h=c&&f?.get(c),[m,y,x]=F1e([],{dragHandle:".drag-n-drop-handler",dropZoneClass:"opacity-25"}),{saving:b,saved:C,errorData:_}=o,{flag:A,setToFalse:O,setToTrue:P}=Cn(),N=w.useCallback(re=>x((J=[])=>[...J,re]),[x]),F=w.useCallback(re=>x((J=[])=>{const oe=[...J];return oe.splice(re,1),oe}),[x]),U=w.useCallback((re,J)=>x((oe=[])=>{const we=[...oe];return we[re]=J,we}),[x]),W=w.useCallback((re,J)=>x((oe=[])=>{if(!oe[J])return oe;const we=[...oe],se=we[J];return we[J]=we[re],we[re]=se,we}),[x]),X=w.useCallback(re=>W(re,re-1),[W]),ae=w.useCallback(re=>W(re,re+1),[W]),ce=w.useCallback(re=>{re.preventDefault(),y&&i({shortUrl:c,data:{redirectRules:y}})},[c,y,i]);return w.useEffect(()=>(t(c),n([c]),l),[t,n,c,l]),w.useEffect(()=>{e.redirectRules&&x(e.redirectRules)},[x,e.redirectRules]),g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsx("header",{children:g.jsxs(Nt,{children:[g.jsxs("h2",{className:"sm:flex justify-between items-center",children:[g.jsx(x0,{}),g.jsxs("div",{className:"text-center grow",children:[r.loading&&g.jsx(g.Fragment,{children:"Loading..."}),!r.loading&&g.jsxs("small",{children:["Redirect rules for ",g.jsx(Li,{href:h?.shortUrl??""})]})]})]}),g.jsx("hr",{}),g.jsxs("div",{children:[g.jsx("p",{children:"Configure dynamic conditions that will be checked at runtime."}),g.jsxs("p",{children:["If no conditions match, visitors will be redirected to: ",g.jsx(Li,{href:e.defaultLongUrl??""})]})]})]})}),g.jsx("div",{children:g.jsxs(Tt,{onClick:P,children:[g.jsx(Be,{icon:Zh})," Add rule"]})}),g.jsxs("form",{onSubmit:ce,children:[e.loading&&g.jsx(Ko,{loading:!0}),y.length===0&&!e.loading&&g.jsx(Nt,{className:"text-center",children:g.jsx("i",{children:"This short URL has no dynamic redirect rules"})}),g.jsx("div",{className:"flex flex-col gap-2",ref:m,children:y.map((re,J)=>g.jsx(K1e,{redirectRule:re,priority:J+1,isLast:J===y.length-1,onDelete:()=>F(J),onMoveUp:()=>X(J),onMoveDown:()=>ae(J),onUpdate:oe=>U(J,oe)},`${re.longUrl}_${J}`))}),g.jsx("div",{className:"text-center mt-4",children:g.jsx(Tt,{type:"submit",inline:!0,className:"max-md:w-full",disabled:b,"data-testid":"save-button",children:b?"Saving...":"Save rules"})})]}),_&&g.jsx(Gr,{variant:"error",children:g.jsx(so,{errorData:_,fallbackMessage:"An error occurred while saving short URL redirect rules :("})}),C&&g.jsx(Gr,{variant:"success",children:"Redirect rules properly saved."}),g.jsx(E9,{isOpen:A,onClose:O,onSave:N})]})},X1e=(e,t)=>{e.serviceFactory("ShortUrlRedirectRules",()=>Z1e),e.decorator("ShortUrlRedirectRules",t(["shortUrlRedirectRules","shortUrlsDetails","shortUrlRedirectRulesSaving"],["getShortUrlRedirectRules","getShortUrlsDetails","setShortUrlRedirectRules","resetSetRules"])),e.serviceFactory("getShortUrlRedirectRules",U0e,"apiClientFactory"),e.serviceFactory("setShortUrlRedirectRules",k0e,"apiClientFactory"),e.serviceFactory("resetSetRules",n=>n.resetSetRules,"setShortUrlRedirectRulesReducerCreator"),e.serviceFactory("shortUrlRedirectRulesReducerCreator",B0e,"getShortUrlRedirectRules"),e.serviceFactory("shortUrlRedirectRulesReducer",n=>n.reducer,"shortUrlRedirectRulesReducerCreator"),e.serviceFactory("setShortUrlRedirectRulesReducerCreator",I0e,"setShortUrlRedirectRules"),e.serviceFactory("setShortUrlRedirectRulesReducer",n=>n.reducer,"setShortUrlRedirectRulesReducerCreator")},Q1e=({creation:e,resetCreateShortUrl:t,canBeClosed:n=!1})=>{const{error:r,saved:i}=e;if(w.useEffect(()=>{t()},[t]),r)return g.jsxs(Gr,{variant:"error",className:"mt-4 relative",children:[n&&g.jsx("div",{className:"absolute right-1.5 top-1.5","data-testid":"error-close-button",children:g.jsx(Iu,{onClick:t})}),g.jsx(so,{errorData:e.errorData,fallbackMessage:"An error occurred while creating the URL :("})]});if(!i)return null;const{shortUrl:o}=e.result;return g.jsxs(Gr,{variant:"success",className:"mt-4 relative",children:[n&&g.jsx("div",{className:"absolute right-1.5 top-1.5","data-testid":"success-close-button",children:g.jsx(Iu,{onClick:t})}),g.jsxs("div",{className:"flex items-center justify-center gap-1",children:[g.jsxs("span",{children:[g.jsx("b",{children:"Great!"})," The short URL is ",g.jsx("b",{children:o})]}),g.jsx(i6,{text:o})]})]})},A9=({createShortUrl:e,shortUrlCreation:t,resetCreateShortUrl:n,basicMode:r=!1})=>{const{ShortUrlForm:i}=An(A9),o=Fn("shortUrlCreation"),{"long-url":l=""}=Zu(),c=w.useMemo(()=>({longUrl:l,tags:[],customSlug:"",title:void 0,shortCodeLength:void 0,domain:"",validSince:void 0,validUntil:void 0,maxVisits:void 0,findIfExists:!1,forwardQuery:o?.forwardQuery??!0}),[l,o?.forwardQuery]);return g.jsxs(g.Fragment,{children:[g.jsx(i,{initialState:c,saving:t.saving,basicMode:r,onSave:async f=>(n(),e(f))}),g.jsx(Q1e,{creation:t,resetCreateShortUrl:n,canBeClosed:r})]})},J1e=Tn(A9,["ShortUrlForm"]),T9=({shortUrlsDetails:e,getShortUrlsDetails:t,shortUrlEdition:n,editShortUrl:r})=>{const{ShortUrlForm:i}=An(T9),o=C3(),{loading:l,error:c,errorData:f,shortUrls:h}=e,m=o&&h?.get(o),{saving:y,saved:x,error:b,errorData:C}=n,_=w.useMemo(()=>O0e(m),[m]);return w.useEffect(()=>{o&&t([o])},[t,o]),l?g.jsx(Ko,{loading:!0}):c?g.jsx(Gr,{variant:"error",children:g.jsx(so,{errorData:f,fallbackMessage:"An error occurred while loading short URL detail :("})}):g.jsxs("div",{className:"flex flex-col gap-y-4",children:[g.jsx("header",{children:g.jsx(Nt,{children:g.jsxs("h2",{className:"sm:flex items-center",children:[g.jsx(x0,{}),g.jsx("div",{className:"text-center grow",children:g.jsxs("small",{children:["Edit ",g.jsx(Li,{href:m?.shortUrl??""})]})})]})})}),g.jsx(i,{initialState:_,saving:y,onSave:async A=>{m&&r({...m,data:A})}}),x&&b&&g.jsx(Gr,{variant:"error",children:g.jsx(so,{errorData:C,fallbackMessage:"An error occurred while updating short URL :("})}),x&&!b&&g.jsx(Gr,{variant:"success",children:"Short URL properly edited."})]})},ebe=Tn(T9,["ShortUrlForm"]),A2="delete",tbe=({shortUrl:e,onClose:t,isOpen:n,shortUrlDeletion:r,resetDeleteShortUrl:i,deleteShortUrl:o,shortUrlDeleted:l})=>{const[c,f]=w.useState("");w.useEffect(()=>i,[i]);const{loading:h,error:m,deleted:y,errorData:x}=r,b=w.useCallback(()=>{i(),t()},[i,t]),C=w.useCallback(()=>o(e).then(_=>!g3(_)&&t()),[o,e,t]);return g.jsx(co,{open:n,title:"Delete short URL",variant:"danger",confirmText:h?"Deleting...":"Delete",confirmDisabled:c!==A2||h,onConfirm:C,onClose:b,onClosed:()=>y&&l(e),children:g.jsxs("div",{className:"flex flex-col gap-y-2",children:[g.jsxs("p",{children:[g.jsx("b",{className:"text-danger",children:"Caution!"})," You are about to delete a short URL."]}),g.jsx("p",{children:"This action cannot be undone. Once you have deleted it, all the visits stats will be lost."}),g.jsx(di,{label:g.jsxs(g.Fragment,{children:["Type ",g.jsx("b",{children:A2})," to confirm deletion."]}),type:"text",placeholder:A2,value:c,onChange:_=>f(_.target.value),onKeyDown:_=>_.key==="Enter"&&C()}),m&&g.jsx(Gr,{variant:o0e(x)?"warning":"error",size:"sm",className:"mt-2",children:g.jsx(so,{errorData:x,fallbackMessage:"Something went wrong while deleting the URL :("})})]})})},O9=({amount:e=0,loading:t=!1,...n})=>g.jsxs(Tt,{...n,disabled:t,solid:!ls(),children:[g.jsx(Be,{icon:mH})," ",t?"Exporting...":g.jsxs(g.Fragment,{children:["Export (",Sn(e),")"]})]}),dL=20,j9=({amount:e=0})=>{const{apiClientFactory:t,ReportExporter:n}=An(j9),[{tags:r,search:i,startDate:o,endDate:l,orderBy:c,tagsMode:f}]=b0(),{flag:h,setToTrue:m,setToFalse:y}=Cn(),x=w.useCallback(async()=>{const b=e/dL,C=async(A=1)=>{const{data:O}=await t().listShortUrls({page:`${A}`,tags:r,searchTerm:i,startDate:o,endDate:l,orderBy:c,tagsMode:f,itemsPerPage:dL});return A>=b?O:O.concat(await C(A+1))};m();const _=await C();n.exportShortUrls(_.map(A=>{const{hostname:O,pathname:P}=new URL(A.shortUrl),N=P.substring(1);return{createdAt:A.dateCreated,domain:O,shortCode:N,shortUrl:A.shortUrl,longUrl:A.longUrl,title:A.title??"",tags:A.tags.join("|"),visits:A.visitsSummary.total}})),y()},[e,t,l,c,n,i,o,m,y,r,f]);return g.jsx(O9,{loading:h,className:"max-xl:w-full",amount:e,onClick:x})},nbe=Tn(j9,["apiClientFactory","ReportExporter"]),rbe="yyyy-MM-dd",M9="yyyy-MM-dd HH:mm",Tl=()=>new Date,A3=e=>typeof e!="string",T3=(e,t)=>!e||!A3(e)?e:t?hv(e,t):Iee(e),Ol=e=>T3(e,void 0),sl=e=>T3(e,rbe),Yh=e=>T3(e,M9),ji=e=>A3(e)?e:xl(e),Em=(e,t,n)=>{const r=ji(e),i=t&&ji(t),o=n&&ji(n);if(i&&o)try{return Bee(r,{start:i,end:o})}catch{return!1}return i?mw(r,i)||Uee(r,i):o?mw(r,o)||mv(r,o):!0},yu=(e,t)=>mw(e,t)||mv(e,t),ty=({date:e,format:t=M9,relative:n=!1})=>{const r=A3(e)?e:xl(e);return g.jsx("time",{dateTime:`${zee(r)}000`,children:n?`${kee(Tl(),r)} ago`:hv(r,t)})},P9=(e,{shortCode:t,domain:n},r)=>{const i=n?`?domain=${n}`:"";return`${e}/short-code/${a9(t)}/${r}${i}`},L9=({shortUrl:e,suffix:t,asLink:n,children:r,...i})=>{const o=ps();return!n||!e?g.jsx("span",{...i,children:r}):g.jsx(Ir,{to:P9(o,e,t),...i,children:r})},ibe=e=>{const{meta:t,visitsSummary:n}=e,{maxVisits:r,validSince:i,validUntil:o}=t,l=n.total;return r&&l>=r?{icon:_H,className:"text-danger",description:`This short URL cannot be currently visited because it has reached the maximum amount of ${r} visit${r>1?"s":""}`}:o&&mv(ji(o),Tl())?{icon:lT,className:"text-danger",description:`This short URL cannot be visited since ${Yh(ji(o))}`}:i&&mv(Tl(),ji(i))?{icon:lT,className:"text-warning",description:`This short URL will start working on ${Yh(ji(i))}`}:{icon:Ru,className:"text-lm-brand dark:text-dm-brand",description:"This short URL can be visited normally"}},abe=({shortUrl:e})=>{const{icon:t,className:n,description:r}=w.useMemo(()=>ibe(e),[e]);return g.jsx("span",{className:"cursor-help",title:r,children:g.jsx(Be,{icon:t,className:n})})},N9=({visitsCount:e,shortUrl:t,active:n=!1,asLink:r=!1})=>{const{anchor:i,tooltip:o}=os(),{maxVisits:l,validSince:c,validUntil:f}=t?.meta??{},h=!!l||!!c||!!f,m=g.jsx(L9,{shortUrl:t,suffix:"visits",asLink:r,children:g.jsx("strong",{className:Oe("inline-block transition-all duration-300",{"scale-150":n}),children:Sn(e)})});return h?g.jsxs(g.Fragment,{children:[g.jsxs("span",{className:"whitespace-nowrap",children:[m,g.jsxs("small",{className:"cursor-help",...i,children:[l&&g.jsxs(g.Fragment,{children:[" / ",Sn(l)]}),g.jsx("sup",{className:"ml-1",children:g.jsx(Be,{icon:hy})})]})]}),g.jsx(ss,{...o,children:g.jsxs("ul",{className:"flex flex-col gap-y-2",children:[l&&g.jsxs("li",{children:["This short URL will not accept more than ",g.jsx("b",{children:Sn(l)})," visit",l===1?"":"s","."]}),c&&g.jsxs("li",{children:["This short URL will not accept visits before ",g.jsx("b",{className:"whitespace-nowrap",children:Yh(ji(c))}),"."]}),f&&g.jsxs("li",{children:["This short URL will not accept visits after ",g.jsx("b",{className:"whitespace-nowrap",children:Yh(ji(f))}),"."]})]})})]}):m},wf=({className:e,...t})=>g.jsx("button",{type:"button",className:Oe("rounded-sm focus-ring cursor-pointer",e),...t}),obe=e=>!!e.onClose,sbe=e=>!!e.onClick,w0=e=>{const{text:t,children:n,className:r,colorGenerator:i}=e,o=sbe(e),l=obe(e),c=o?wf:"span",f=w.useMemo(()=>i.stylesForKey(t),[t,i]);return g.jsxs(c,{className:Oe("inline-flex items-center gap-1","font-bold [&]:rounded-md",{"text-sm px-1.5 py-0.5":!l,"py-1 px-2":l,"cursor-pointer":o},r),style:f,onClick:o?e.onClick:void 0,"data-testid":"tag",children:[n??t,l&&g.jsx(wf,{"aria-label":`Remove ${t}`,className:"p-0 text-lg leading-5.5",onClick:e.onClose,children:g.jsx(Be,{icon:dy,size:"sm"})})]})},lbe=({tags:e,onTagClick:t,colorGenerator:n})=>e.length===0?g.jsx("i",{className:"whitespace-nowrap",children:g.jsx("small",{children:"No tags"})}):g.jsx("div",{className:"inline-flex flex-wrap gap-1 items-center",children:e.map(r=>g.jsx(w0,{text:r,colorGenerator:n,onClick:()=>t?.(r)},r))}),R9=({shortUrl:e,onTagClick:t})=>{const{ShortUrlsRowMenu:n,ColorGenerator:r,useTimeoutToggle:i}=An(R9),[o,l]=i({initialValue:!1,delay:500}),c=w.useRef(!0),[{excludeBots:f}]=b0(),h=Fn("visits"),m=f??h?.excludeBots;return w.useEffect(()=>{c.current||l(),c.current=!1},[e.visitsSummary.total,e.visitsSummary.nonBots,l]),g.jsxs($e.Row,{className:"relative",children:[g.jsx($e.Cell,{className:"whitespace-nowrap",columnName:"Created at:",children:g.jsx(ty,{date:e.dateCreated})}),g.jsx($e.Cell,{columnName:"Short URL:",children:g.jsxs("span",{className:"lg:whitespace-nowrap inline-flex items-center gap-x-2",children:[g.jsx(Li,{href:e.shortUrl,className:"max-md:break-all lg:truncate max-w-72"}),g.jsx(i6,{text:e.shortUrl})]})}),g.jsx($e.Cell,{className:"break-all",columnName:`${e.title?"Title":"Long URL"}:`,children:g.jsx(Li,{href:e.longUrl,children:e.title??e.longUrl})}),e.title&&g.jsx($e.Cell,{className:"break-all [&]:lg:hidden",columnName:"Long URL:",children:g.jsx(Li,{href:e.longUrl})}),g.jsx($e.Cell,{columnName:"Tags:",children:g.jsx(lbe,{tags:e.tags,colorGenerator:r,onTagClick:t})}),g.jsx($e.Cell,{className:"lg:text-right",columnName:"Visits:",children:g.jsx(N9,{visitsCount:m?e.visitsSummary.nonBots:e.visitsSummary.total,shortUrl:e,active:o,asLink:!0})}),g.jsx($e.Cell,{columnName:"Status:",className:"max-lg:border-none",children:g.jsxs("div",{className:"inline-flex gap-2",children:[g.jsx(abe,{shortUrl:e}),e.hasRedirectRules&&g.jsx(L9,{asLink:!0,shortUrl:e,suffix:"redirect-rules",title:"This short URL has dynamic redirect rules",children:g.jsx(Be,{icon:TN})})]})}),g.jsx($e.Cell,{className:"text-right max-lg:absolute max-lg:top-1 max-lg:right-1 max-lg:p-0",children:g.jsx(n,{shortUrl:e})})]})},ube=Tn(R9,["ShortUrlsRowMenu","ColorGenerator","useTimeoutToggle"]),D9=w.forwardRef(({name:e,color:t,onChange:n,className:r},i)=>g.jsxs("div",{className:Oe("relative rounded w-12",r),style:{backgroundColor:t,borderColor:t},children:[g.jsx(Ti,{className:"w-full h-full cursor-pointer relative z-1 opacity-0",type:"color",value:t,onChange:o=>n(o.target.value),ref:i,name:e,"aria-label":e.replace("-"," ")}),g.jsx(Be,{icon:qV,className:"absolute top-1/2 left-1/2 -translate-1/2",style:{color:X_(t.substring(1))?"#000":"#fff"}})]})),hL=({color:e,onChange:t,name:n})=>{const r=w.useRef(null);return g.jsxs("div",{className:"flex",children:[g.jsx(D9,{name:`${n}-picker`,color:e,onChange:t,className:"rounded-r-none",ref:r}),g.jsx(Ti,{readOnly:!0,value:e,onClick:()=>r.current?.click(),"aria-label":n,"data-testid":"text-input",className:"grow rounded-l-none"})]})};function cbe(e){switch(e){case"L":return 1;case"M":return .5;default:return .3}}const fbe=w.forwardRef(({data:e,color:t="#000000",bgColor:n="#ffffff",margin:r=0,errorCorrection:i="L",size:o=300,drawType:l="canvas",logo:c},f)=>{const h=w.useRef(null),m=w.useRef(new ate),y=w.useCallback((b,C)=>m.current.download({name:b,extension:C}),[]),x=w.useCallback(b=>new Promise((C,_)=>{const A=m.current.getRawData(b),O=new FileReader;O.onload=()=>{const{result:P}=O;P&&C(P.toString())},O.onerror=_,A.then(P=>{P instanceof Blob?O.readAsDataURL(P):_(new Error("QR code image blob not available"))})}),[]);return w.useImperativeHandle(f,()=>({download:y,getDataUri:x}),[y,x]),w.useEffect(()=>{const b=h.current;m.current.append(b)},[]),w.useEffect(()=>{m.current.update({type:l,data:e,width:o+r,height:o+r,margin:r,dotsOptions:{color:t},backgroundOptions:{color:n},qrOptions:{errorCorrectionLevel:i},imageOptions:{margin:5,imageSize:cbe(i)},image:c})},[n,t,e,l,i,c,r,o]),g.jsxs(g.Fragment,{children:[g.jsx("style",{dangerouslySetInnerHTML:{__html:"#qr-code-canvas-container canvas { max-width: 100% }"}}),g.jsx("div",{ref:h,id:"qr-code-canvas-container"})]})}),dbe=async({text:e,onCopy:t},n=navigator)=>{const r=typeof e=="string"?e:await e;return n.clipboard?.writeText(r).then(()=>t?.({text:r,copied:!0})).catch(()=>t?.({text:r,copied:!1}))},mL=({name:e,value:t,step:n,min:r,max:i,onChange:o})=>{const l=w.useId();return g.jsxs("div",{className:"flex flex-col gap-1",children:[g.jsxs("label",{htmlFor:l,className:"capitalize",children:[e,": ",t,"px"]}),g.jsx("input",{id:l,type:"range",value:t,step:n,min:r,max:i,onChange:c=>o(Number(c.target.value))})]})},hbe=({shortUrl:{shortUrl:e,shortCode:t},onClose:n,isOpen:r,qrDrawType:i})=>{const o=Fn("qrCodes",Lf),[{size:l,margin:c,color:f,bgColor:h,errorCorrection:m,format:y},x]=w.useState(o),b=w.useCallback(ae=>x(ce=>({...ce,...ae})),[]),C=w.useRef(null),[_,A]=w.useState(),O=w.useCallback(ae=>{const ce=ae.target.files?.[0];ce&&A({url:URL.createObjectURL(new Blob([ce],{type:ce.type})),name:ce.name})},[]),P=w.useRef(null),N=w.useCallback(()=>P.current?.download(`${t}-qr-code`,y),[y,t]),[F,U]=Sy({}),W=w.useCallback(()=>{const ae=P.current?.getDataUri(y)??"";return dbe({text:ae,onCopy:U})},[y,U]),X=w.useCallback(()=>{x(o),A(void 0)},[o]);return g.jsx(co,{size:"lg",open:r,onClose:n,title:g.jsxs(g.Fragment,{children:["QR code for ",g.jsx(Li,{href:e})]}),onClosed:X,children:g.jsxs("div",{className:"flex flex-col-reverse lg:flex-row gap-4",children:[g.jsx("div",{className:"grow flex items-center justify-around",children:g.jsxs("div",{className:"flex flex-col gap-1 items-center","data-testid":"qr-code-container",children:[g.jsx(fbe,{ref:P,data:e,size:l,margin:c,errorCorrection:m,color:f,bgColor:h,logo:_?.url,drawType:i}),g.jsxs("div",{className:"italic",children:["Preview (",l+c,"x",l+c,")"]})]})}),g.jsxs("div",{className:"flex flex-col gap-2 lg:w-64",children:[g.jsx(mL,{name:"size",value:l,onChange:ae=>b({size:ae}),step:10,min:50,max:1e3}),g.jsx(mL,{name:"margin",value:c,onChange:ae=>b({margin:ae}),step:1,min:0,max:100}),g.jsx(w6,{errorCorrection:m,onChange:ae=>b({errorCorrection:ae})}),g.jsx(hL,{name:"color",color:f,onChange:ae=>b({color:ae})}),g.jsx(hL,{name:"background",color:h,onChange:ae=>b({bgColor:ae})}),!_&&g.jsxs(g.Fragment,{children:[g.jsxs(Tt,{variant:"secondary",onClick:()=>C.current?.click(),children:[g.jsx(Be,{icon:BK}),"Select logo"]}),g.jsx("input",{ref:C,type:"file",accept:"image/*","aria-hidden":!0,tabIndex:-1,className:"hidden",onChange:O,"data-testid":"logo-input"})]}),_&&g.jsxs(Tt,{variant:"secondary",onClick:()=>A(void 0),children:[g.jsx(Be,{icon:fy}),g.jsxs("div",{className:"truncate",children:["Clear logo (",_.name,")"]})]}),g.jsx("div",{className:"my-auto",children:g.jsx("hr",{className:"my-2"})}),g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx(_6,{format:y,onChange:ae=>b({format:ae})}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Tt,{onClick:W,"aria-label":"Copy data URI",title:"Copy data URI",className:"h-full",children:g.jsx(Be,{icon:F?Ru:t6})}),g.jsxs(Tt,{solid:!0,onClick:N,className:"grow",children:["Download ",g.jsx(Be,{icon:AN})]})]})]})]})]})})},k9=({shortUrl:e,deleteShortUrl:t,shortUrlDeleted:n})=>{const{DeleteShortUrlModal:r}=An(k9),{flag:i,setToTrue:o,setToFalse:l}=Cn(),{flag:c,setToTrue:f,setToFalse:h}=Cn(),m=m0(),{confirmDeletions:y=!0}=Fn("shortUrlsList",{}),x=w.useCallback(async()=>{const _=await t(e);g3(_)||n(e)},[t,e,n]),b=ps(),C=w.useCallback(_=>P9(b,e,_),[b,e]);return g.jsxs(g.Fragment,{children:[g.jsxs(tn,{menuAlignment:"right",children:[g.jsxs(tn.Item,{to:C("visits"),className:"gap-1.5",children:[g.jsx(Be,{icon:P_})," Visit stats"]}),m&&g.jsxs(g.Fragment,{children:[g.jsxs(tn.Item,{className:"gap-1.5",disabled:!m.canAddItemWithName(e.shortUrl),onClick:()=>m.addItemToCompare({name:e.shortUrl,query:w3(e)}),children:[g.jsx(Be,{icon:cy})," Compare visits"]}),g.jsx(tn.Separator,{})]}),g.jsxs(tn.Item,{to:C("edit"),className:"gap-1.5",children:[g.jsx(Be,{icon:j_})," Edit short URL"]}),g.jsxs(tn.Item,{to:C("redirect-rules"),className:"gap-1.5",children:[g.jsx(Be,{icon:TN})," Manage redirect rules"]}),g.jsxs(tn.Item,{onClick:o,className:"gap-1.5",children:[g.jsx(Be,{icon:NH})," QR code"]}),g.jsx(tn.Separator,{}),g.jsxs(tn.Item,{className:"[&]:text-danger gap-1.5",onClick:y?f:x,children:[g.jsx(Be,{icon:LN})," Delete short URL"]})]}),g.jsx(hbe,{shortUrl:e,isOpen:i,onClose:l}),g.jsx(r,{shortUrl:e,deleteShortUrl:t,shortUrlDeleted:n,isOpen:c,onClose:h})]})},mbe=Tn(k9,["DeleteShortUrlModal"]),I9="shlink/shortUrlCreation",pL={saving:!1,saved:!1,error:!1},pbe=e=>or(`${I9}/createShortUrl`,t=>e().createShortUrl(t)),gbe=e=>{const{reducer:t,actions:n}=jt({name:I9,initialState:pL,reducers:{resetCreateShortUrl:()=>pL},extraReducers:i=>{i.addCase(e.pending,()=>({saving:!0,saved:!1,error:!1})),i.addCase(e.rejected,(o,{error:l})=>({saving:!1,saved:!1,error:!0,errorData:zi(l)})),i.addCase(e.fulfilled,(o,{payload:l})=>({result:l,saving:!1,saved:!0,error:!1}))}}),{resetCreateShortUrl:r}=n;return{reducer:t,resetCreateShortUrl:r}},z9="shlink/shortUrlEdition",vbe={saving:!1,saved:!1,error:!1},ybe=e=>or(`${z9}/editShortUrl`,({shortCode:t,domain:n,data:r})=>e().updateShortUrl({shortCode:t,domain:n},r)),bbe=e=>jt({name:z9,initialState:vbe,reducers:{},extraReducers:t=>{t.addCase(e.pending,n=>({...n,saving:!0,error:!1,saved:!1})),t.addCase(e.rejected,(n,{error:r})=>({...n,saving:!1,error:!0,saved:!1,errorData:zi(r)})),t.addCase(e.fulfilled,(n,{payload:r})=>({shortUrl:r,saving:!1,error:!1,saved:!0}))}}),gL="shlink/shortUrlsDetails",vL={loading:!1,error:!1},xbe=e=>{const t=or(`${gL}/getShortUrlsDetails`,async(r,{getState:i})=>{const{shortUrlsList:o}=i(),l=await Promise.all(r.map(async c=>{const{shortCode:f,domain:h}=c,m=o?.shortUrls?.data.find(y=>Ch(y,f,h));return[c,m??await e().getShortUrl({shortCode:f,domain:h})]}));return new Map(l)}),{reducer:n}=jt({name:gL,initialState:vL,reducers:{},extraReducers:r=>{r.addCase(t.pending,()=>({loading:!0,error:!1})),r.addCase(t.rejected,(i,{error:o})=>({loading:!1,error:!0,errorData:zi(o)})),r.addCase(t.fulfilled,(i,{payload:o})=>({...vL,shortUrls:o}))}});return{reducer:n,getShortUrlsDetails:t}},wbe=({domains:e,value:t,onChange:n})=>{const{flag:r,setToTrue:i,setToFalse:o}=Cn(),l=!t,c=w.useCallback(()=>{n(""),o()},[n,o]),f=w.useCallback(()=>{n(""),i()},[n,i]);return r?g.jsxs("div",{className:"flex",children:[g.jsx(Ti,{value:t??"",placeholder:"Domain",onChange:h=>n(h.target.value),className:"flex-grow rounded-r-none [&]:border-r-0"}),g.jsx(Tt,{variant:"secondary",type:"button",className:"rounded-l-none","aria-label":"Back to domains list",title:"Existing domains",onClick:c,children:g.jsx(Be,{icon:TH})})]}):g.jsxs(qe,{buttonContent:l?"Domain":`Domain: ${t}`,buttonClassName:Oe("w-full",{"text-placeholder":l}),children:[e.map(({domain:h,isDefault:m})=>g.jsxs(qe.Item,{selected:(t===h||m)&&l,onClick:()=>n(h),className:"flex justify-between items-center",children:[h,m&&g.jsx(Zo,{children:"default"})]},h)),g.jsx(qe.Separator,{}),g.jsx(qe.Item,{onClick:f,children:g.jsx("i",{children:"New domain"})})]})},_be=({minDate:e,maxDate:t,value:n,onChange:r,withTime:i=!1,...o})=>{const l=w.useCallback(({target:f})=>{if(!f.value){r?.(null);return}r?.(ji(f.value))},[r]),c=w.useMemo(()=>i?Yh:sl,[i]);return g.jsx(Ti,{...o,type:i?"datetime-local":"date",value:c(n)??"",max:c(t)??void 0,min:c(e)??void 0,onChange:l})},ny=({label:e,id:t,...n})=>{const r=w.useId();return g.jsxs(g.Fragment,{children:[g.jsxs("label",{htmlFor:t??r,className:"mb-1",children:[e,":"]}),g.jsx(_be,{id:t??r,...n})]})},Sbe=({className:e,placement:t,children:n})=>{const{anchor:r,tooltip:i}=os({placement:t});return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:e,...r,"data-placement":t,"data-testid":"tooltip-anchor",children:g.jsx(Be,{icon:hy})}),g.jsx(ss,{...i,children:n})]})},yL=({children:e,infoTooltip:t,checked:n,onChange:r})=>g.jsxs("div",{className:"flex items-center gap-x-2",children:[g.jsxs(Ma,{className:"inline-flex items-center gap-x-1.5",children:[g.jsx(W_,{checked:n,onChange:r}),e]}),g.jsx(Sbe,{placement:"right",children:t})]}),Cbe=e=>g.jsx(co,{...e,title:"Info",size:"lg",children:g.jsxs("div",{className:"flex flex-col gap-y-2",children:[g.jsxs("p",{children:["When the ",g.jsx("b",{children:g.jsx("i",{children:'"Use existing URL if found"'})})," checkbox is checked, the server will return an existing short URL if it matches provided params."]}),g.jsx("p",{children:"These are the checks performed by Shlink in order to determine if an existing short URL should be returned:"}),g.jsxs("ul",{className:"list-disc pl-5",children:[g.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."}),g.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.",g.jsx("br",{}),"If the slug is being used by another long URL, an error will be returned."]}),g.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"})]})]})}),Ebe=()=>{const{flag:e,setToFalse:t,setToTrue:n}=Cn();return g.jsxs(g.Fragment,{children:[g.jsx(wf,{title:"What does this mean?",onClick:n,children:g.jsx(Be,{icon:hy})}),g.jsx(Cbe,{open:e,onClose:t})]})},Eg=e=>typeof e=="string"?xl(e):e,Abe=e=>"shortCodeLength"in e&&"customSlug"in e&&"domain"in e,U9=({basicMode:e=!1,saving:t,onSave:n,initialState:r,tagsList:i,domainsList:o})=>{const{TagsSelector:l}=An(U9),[c,f]=w.useState(r),h=Abe(c),m=w.useCallback(()=>f(r),[r]),y=w.useCallback((_,A)=>Su(_)?_:Su(A)?null:void 0,[]),x=w.useCallback(_=>f(A=>({...A,tags:_})),[]),b=w.useCallback(async _=>(_.preventDefault(),n(c).then(A=>h&&!g3(A)&&m()).catch(()=>{})),[h,n,m,c]),C=w.useMemo(()=>g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsx(Ti,{size:"lg",type:"url",placeholder:"URL to be shortened",required:!0,value:c.longUrl,onChange:_=>f(A=>({...A,longUrl:_.target.value}))}),g.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e&&h&&g.jsx("div",{className:"w-full lg:w-1/2",children:g.jsx(Ti,{size:"lg",placeholder:"Custom slug",value:c.customSlug??"",onChange:_=>f(A=>({...A,customSlug:_.target.value}))})}),g.jsx("div",{className:Oe("w-full",{"lg:w-1/2":e}),children:g.jsx(l,{tags:i.tags,selectedTags:c.tags??[],onChange:x,placeholder:"Add tags to the URL"})})]})]}),[l,e,x,h,c,i.tags]);return g.jsxs("form",{name:"shortUrlForm",onSubmit:b,className:"flex flex-col gap-4",children:[e&&C,!e&&g.jsxs(g.Fragment,{children:[g.jsx("div",{children:g.jsx("div",{className:"w-full",children:g.jsx(Nt,{title:"Main options",className:"card",children:C})})}),g.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[g.jsx("div",{className:"w-full sm:w-1/2",children:g.jsxs(Nt,{title:"Customize the short URL",bodyClassName:"flex flex-col gap-4",className:"card h-full",children:[g.jsx(Ti,{placeholder:"Title",value:c.title??"",onChange:({target:_})=>f(A=>({...A,title:y(_.value,r.title)}))}),h&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[g.jsx("div",{className:"lg:w-1/2",children:g.jsx(Ti,{placeholder:"Custom slug",value:c.customSlug??"",onChange:_=>f(A=>({...A,customSlug:_.target.value})),disabled:Su(c.shortCodeLength)})}),g.jsx("div",{className:"lg:w-1/2",children:g.jsx(Ti,{type:"number",placeholder:"Short code length",value:c.shortCodeLength??"",onChange:_=>f(A=>({...A,shortCodeLength:_.target.value})),min:4,disabled:Su(c.customSlug)})})]}),g.jsx(wbe,{value:c.domain,onChange:_=>f(A=>({...A,domain:_})),domains:o.domains})]})]})}),g.jsx("div",{className:"w-full sm:w-1/2",children:g.jsxs(Nt,{title:"Limit access to the short URL",className:"card h-full",bodyClassName:"flex flex-col gap-y-4",children:[g.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[g.jsx("div",{className:"lg:w-1/2",children:g.jsx(ny,{label:"Enabled since",withTime:!0,maxDate:c.validUntil?Eg(c.validUntil):void 0,value:c.validSince?Eg(c.validSince):null,onChange:_=>f(A=>({...A,validSince:Ol(_)}))})}),g.jsx("div",{className:"lg:w-1/2",children:g.jsx(ny,{label:"Enabled until",withTime:!0,minDate:c.validSince?Eg(c.validSince):void 0,value:c.validUntil?Eg(c.validUntil):null,onChange:_=>f(A=>({...A,validUntil:Ol(_)}))})})]}),g.jsx(di,{label:"Maximum visits allowed:",type:"number",min:1,placeholder:"25...",value:c.maxVisits??"",onChange:_=>f(A=>({...A,maxVisits:Su(_.target.value)?Number(_.target.value):null}))})]})})]}),g.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[h&&g.jsx("div",{className:"w-full sm:w-1/2",children:g.jsx(Nt,{title:"Extra checks",className:"h-full",children:g.jsxs("p",{className:"inline-flex items-center gap-x-2",children:[g.jsxs(Ma,{className:"inline-flex items-center gap-x-1.5",children:[g.jsx(W_,{checked:c.findIfExists,onChange:_=>f(A=>({...A,findIfExists:_}))}),"Use existing URL if found"]}),g.jsx(Ebe,{})]})})}),g.jsx("div",{className:Oe("w-full",{"sm:w-1/2":h}),children:g.jsxs(Nt,{title:"Configure behavior",children:[g.jsx(yL,{infoTooltip:"This short URL will be included in the robots.txt for your Shlink instance, allowing web crawlers (like Google) to index it.",checked:c.crawlable,onChange:_=>f(A=>({...A,crawlable:_})),children:"Make it crawlable"}),g.jsx(yL,{infoTooltip:"When this short URL is visited, any query params appended to it will be forwarded to the long URL.",checked:c.forwardQuery,onChange:_=>f(A=>({...A,forwardQuery:_})),children:"Forward query params on redirect"})]})})]})]}),g.jsx("div",{className:"text-center",children:g.jsx(Tt,{type:"submit",inline:!0,solid:!0,disabled:t||!c.longUrl,className:"max-md:w-full",children:t?"Saving...":"Save"})})]})},Tbe=Tn(U9,["TagsSelector"]),B9=({domains:e,value:t,onChange:n})=>{const r=!t,i=t===fl?e.find(({isDefault:l})=>l)?.domain:t,o=w.useCallback(l=>{l!==t&&n(l)},[n,t]);return g.jsxs(qe,{buttonContent:r?"All domains":g.jsxs("span",{children:["Domain: ",g.jsx("b",{children:i})]}),buttonClassName:"w-full",menuAlignment:"right",buttonDisabled:!e.length,children:[g.jsx(qe.Item,{onClick:()=>o(),selected:r,children:"All domains"}),g.jsx(qe.Separator,{}),e.map(({domain:l,isDefault:c})=>g.jsxs(qe.Item,{selected:c?t===fl:t===l,onClick:()=>o(c?fl:l),className:"flex justify-between items-center",children:[l,c&&g.jsx(Zo,{children:"default"})]},l))]})},Obe=({startDate:e,endDate:t,disabled:n=!1,onStartDateChange:r,onEndDateChange:i})=>g.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-y-3 gap-x-4",children:[g.jsx("div",{className:"flex flex-col",children:g.jsx(ny,{label:"Since",value:e,maxDate:t??void 0,disabled:n,onChange:r})}),g.jsx("div",{className:"flex flex-col",children:g.jsx(ny,{label:"Until",value:t,minDate:e??void 0,disabled:n,onChange:o=>i(o&&hf(o))})})]}),_0="all",F9={today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",last180Days:"Last 180 days",last365Days:"Last 365 days",[_0]:void 0},$9=Object.keys(F9),jbe=e=>!e||!e.startDate&&!e.endDate,ry=e=>typeof e=="string"&&$9.includes(e),Mbe=$9.filter(e=>e!==_0),bL=e=>e?ji(e):null,V9=(e,t)=>({startDate:bL(e),endDate:bL(t)}),Pbe=e=>{if(!(!e||jbe(e)))return e.startDate&&!e.endDate?`Since ${sl(e.startDate)}`:!e.startDate&&e.endDate?`Until ${sl(e.endDate)}`:`${sl(e.startDate)} - ${sl(e.endDate)}`},xL=e=>{if(!(!e||e===_0))return ry(e)?F9[e]:Pbe(e)},ta=e=>Fu(pv(Tl(),e)),Zc=e=>({startDate:e,endDate:hf(Tl())}),H9=e=>[[()=>e==="today",()=>Zc(Fu(Tl()))],[()=>e==="yesterday",()=>({startDate:ta(1),endDate:hf(pv(Tl(),1))})],[()=>e==="last7Days",()=>Zc(ta(7))],[()=>e==="last30Days",()=>Zc(ta(30))],[()=>e==="last90Days",()=>Zc(ta(90))],[()=>e==="last180Days",()=>Zc(ta(180))],[()=>e==="last365Days",()=>Zc(ta(365))]].find(([t])=>t())?.[1]()??{},Lbe=e=>{const t=ji(e);return[[()=>yu(Fu(Tl()),t),"today"],[()=>yu(ta(1),t),"yesterday"],[()=>yu(ta(7),t),"last7Days"],[()=>yu(ta(30),t),"last30Days"],[()=>yu(ta(90),t),"last90Days"],[()=>yu(ta(180),t),"last180Days"],[()=>yu(ta(365),t),"last365Days"]].find(([n])=>n())?.[1]??_0},q9=e=>ry(e)?H9(e):e,G9=e=>!!(e&&e.startDate),Nbe=({startDate:e,endDate:t})=>{const n=vD(hf(t??new Date),Fu(e))+1,r=pv(Fu(e),n),i=pv(hf(e),1);return{startDate:r,endDate:i}},Rbe=e=>{if(G9(e))return vD(e.endDate??new Date,e.startDate)},O3=({onDatesChange:e,dateRangeOrInterval:t,defaultText:n,disabled:r})=>{const i=w.useMemo(()=>xL(t)??n,[t,n]),[o,l]=w.useMemo(()=>ry(t)?[void 0,t]:[t,void 0],[t]),c=w.useCallback(f=>{ry(f)?e(H9(f),f):e(f)},[e]);return g.jsxs(qe,{buttonDisabled:r,buttonContent:i,containerClassName:"[&]:block",buttonClassName:"w-full",menuClassName:"md:min-w-90!",children:[g.jsx(qe.Item,{selected:l==="all",onClick:()=>c("all"),children:n}),g.jsx(qe.Separator,{}),Mbe.map(f=>g.jsx(qe.Item,{selected:l===f,onClick:()=>c(f),children:xL(f)},f)),g.jsx(qe.Separator,{}),g.jsx(qe.Misc,{children:g.jsx(Obe,{...o,onStartDateChange:f=>c({...o,startDate:f}),onEndDateChange:f=>c({...o,endDate:f})})})]})},Dbe={dateCreated:"Created at",shortCode:"Short URL",longUrl:"Long URL",title:"Title",visits:"Visits"},kbe=({onChange:e,selected:t={}})=>{const{excludeBots:n=!1,excludeMaxVisitsReached:r=!1,excludePastValidUntil:i=!1}=t,o=Number(n)+Number(r)+Number(i),l=w.useCallback(f=>e({...t,...f}),[e,t]),c=w.useCallback(f=>l({[f]:!t?.[f]}),[l,t]);return g.jsxs(qe,{buttonContent:g.jsxs("span",{children:["More",o>0?g.jsxs("b",{children:[" (",o,")"]}):""]}),buttonClassName:"w-full",menuAlignment:"right",children:[g.jsx(qe.Title,{children:"Visits:"}),g.jsx(qe.Item,{selected:n,onClick:()=>c("excludeBots"),children:"Ignore visits from bots"}),g.jsx(qe.Separator,{}),g.jsx(qe.Title,{children:"Short URLs:"}),g.jsx(qe.Item,{selected:r,onClick:()=>c("excludeMaxVisitsReached"),children:"Exclude with visits reached"}),g.jsx(qe.Item,{selected:i,onClick:()=>c("excludePastValidUntil"),children:"Exclude enabled in the past"}),g.jsx(qe.Separator,{}),g.jsx(qe.Item,{disabled:t.excludeBots===void 0&&t.excludeMaxVisitsReached===void 0&&t.excludePastValidUntil===void 0,onClick:()=>e({excludeBots:void 0,excludeMaxVisitsReached:void 0,excludePastValidUntil:void 0}),className:"italic",children:"Reset to defaults"})]})},Y9=({className:e,shortUrlsAmount:t,order:n,handleOrderBy:r,tagsList:i,domainsList:o})=>{const{ExportShortUrlsBtn:l,TagsSearchDropdown:c}=An(Y9),[{search:f,tags:h,tagsMode:m="any",excludeTags:y,excludeTagsMode:x="any",startDate:b,endDate:C,excludeBots:_,excludeMaxVisitsReached:A,excludePastValidUntil:O,domain:P},N]=b0(),F=Fn("visits"),U=cl("filterShortUrlsByDomain"),W=cl("filterShortUrlsByExcludedTags"),[X,ae]=w.useState(),ce=w.useCallback(({startDate:Y,endDate:k},z)=>{N({startDate:Ol(Y)??void 0,endDate:Ol(k)??void 0}),ae(z)},[N]),re=w.useCallback(Y=>N({search:Y||void 0}),[N]),J=w.useCallback(Y=>N({domain:Y}),[N]),oe=w.useCallback(Y=>N({tags:Y}),[N]),we=w.useCallback(Y=>N({tagsMode:Y}),[N]),se=w.useCallback(Y=>N({excludeTags:Y}),[N]),ue=w.useCallback(Y=>N({excludeTagsMode:Y}),[N]);return g.jsxs("div",{className:Oe("flex flex-col gap-y-4",e),children:[g.jsx(Mf,{defaultValue:f,onChange:re}),g.jsxs("div",{className:"flex flex-col xl:flex-row-reverse justify-between gap-y-4",children:[g.jsxs("div",{className:Oe("flex flex-col lg:flex-row gap-x-2 gap-y-4",{"min-w-3/4":W,"min-w-2/3":!W}),children:[g.jsxs("div",{className:"flex flex-col md:flex-row gap-x-2 gap-y-4 grow",children:[g.jsx("div",{className:"grow",children:g.jsx(O3,{defaultText:"All short URLs",dateRangeOrInterval:X??V9(b,C),onDatesChange:ce})}),g.jsxs("div",{className:Oe("grid lg:flex gap-x-2 gap-y-4",{"grid-cols-2":W}),children:[g.jsx(c,{title:"Filter by tag",prefix:"With",tags:i.tags,selectedTags:h,onTagsChange:oe,mode:m,onModeChange:we,buttonClassName:"w-full"}),W&&g.jsx(c,{title:"Filter by excluded tag",prefix:"Without",tags:i.tags,selectedTags:y,onTagsChange:se,mode:x,onModeChange:ue,buttonClassName:"w-full"})]})]}),g.jsxs("div",{className:Oe("grid lg:flex gap-x-2 gap-y-4",{"grid-cols-2":U}),children:[U&&g.jsx(B9,{domains:o.domains,onChange:J,value:P}),g.jsx(kbe,{selected:{excludeBots:_??F?.excludeBots,excludeMaxVisitsReached:A,excludePastValidUntil:O},onChange:N})]})]}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("div",{className:"max-xl:w-1/2 xl:hidden",children:g.jsx(rm,{containerClassName:"[&]:block",buttonClassName:"w-full",prefixed:!1,items:Dbe,order:n,onChange:({field:Y,dir:k})=>r(Y,k)})}),g.jsx("div",{className:"max-xl:w-1/2",children:g.jsx(l,{amount:t})})]})]})]})},Ibe=Tn(Y9,["ExportShortUrlsBtn","TagsSearchDropdown"]);function Eh({currentOrder:e,field:t,className:n="ml-1"}){return!e.dir||e.field!==t?null:g.jsx(Be,{icon:e.dir==="ASC"?yH:PN,className:n})}const zbe=({paginator:e,currentQueryString:t=""})=>{const{currentPage:n=0,pagesCount:r=0}=e??{},i=ps(),o=w.useCallback(l=>`${i}/list-short-urls/${l}${t}`,[t,i]);return r<=1?g.jsx("div",{"data-testid":"empty-gap",className:"pb-4"}):g.jsx("div",{"data-testid":"short-urls-paginator",className:Oe("sticky bottom-0 py-4 -mx-0.5","flex justify-around","bg-lm-primary dark:bg-dm-primary","border-t border-lm-border dark:border-dm-border"),children:g.jsx(Ey,{urlForPage:o,currentPage:n,pagesCount:r})})},Ube={field:"dateCreated",dir:"DESC"},W9=Na(({listShortUrls:e,shortUrlsList:t})=>{const{ShortUrlsTable:n,ShortUrlsFilteringBar:r}=An(W9),{page:i}=Ef(),o=Or(),[{tags:l,tagsMode:c,excludeTags:f,excludeTagsMode:h,search:m,startDate:y,endDate:x,orderBy:b,excludeBots:C,excludePastValidUntil:_,excludeMaxVisitsReached:A,domain:O},P]=b0(),N=rS(),[F,U]=w.useState(b??N.shortUrlsList?.defaultOrdering??Ube),{pagination:W}=t?.shortUrls??{},X=w.useMemo(()=>C??N.visits?.excludeBots,[C,N.visits?.excludeBots]),ae=w.useCallback((se,ue)=>{P({orderBy:{field:se,dir:ue}}),U({field:se,dir:ue})},[P]),ce=se=>()=>ae(se,h6({currentOrderDir:F.dir,currentField:F.field,newField:se})),re=se=>g.jsx(Eh,{currentOrder:F,field:se}),J=w.useCallback(se=>P({tags:[...new Set([...l,se])]}),[l,P]),oe=w.useCallback(({field:se,dir:ue})=>X&&se==="visits"?{field:"nonBotVisits",dir:ue}:{field:se,dir:ue},[X]),we=y3();return w.useEffect(()=>{e({page:i,searchTerm:m,tags:l,tagsMode:c,excludeTags:f,excludeTagsMode:h,startDate:y,endDate:x,orderBy:oe(F),excludePastValidUntil:_,excludeMaxVisitsReached:A,domain:O})},[e,oe,i,m,l,y,x,F,c,_,A,O,f,h]),g.jsxs(v3,{value:we,children:[g.jsx(r,{shortUrlsAmount:t.shortUrls?.pagination.totalItems,order:F,handleOrderBy:ae,className:"mb-4"}),g.jsx(b3,{type:"short-urls",className:"mb-4"}),g.jsxs(Nt,{bodyClassName:Oe({"pb-0":!t.loading}),children:[g.jsx(n,{shortUrlsList:t,orderByColumn:ce,renderOrderIcon:re,onTagClick:J}),!t.loading&&g.jsx(zbe,{paginator:W,currentQueryString:o.search})]})]})},()=>[ia.visits]),Bbe=Tn(W9,["ShortUrlsTable","ShortUrlsFilteringBar"]),T2=({children:e,danger:t})=>g.jsx($e.Row,{children:g.jsx($e.Cell,{colSpan:6,className:Oe("text-center",{"text-danger font-bold":t}),children:e})}),Fbe=({shortUrlsList:e,onTagClick:t,ShortUrlsRow:n})=>{const{error:r,loading:i,shortUrls:o}=e;return r?g.jsx(T2,{danger:!0,children:"Something went wrong while loading short URLs :("}):i?g.jsx(T2,{children:"Loading..."}):!o||o.data.length===0?g.jsx(T2,{children:"No results found"}):o?.data.map(l=>g.jsx(n,{shortUrl:l,onTagClick:t},l.shortUrl))},K9=({orderByColumn:e,renderOrderIcon:t,shortUrlsList:n,onTagClick:r})=>{const{ShortUrlsRow:i}=An(K9),o=Oe({"cursor-pointer":!!e});return g.jsx($e,{className:"mb-[-1px] w-full",header:g.jsxs($e.Row,{children:[g.jsxs($e.Cell,{className:o,onClick:e?.("dateCreated"),children:["Created at ",t?.("dateCreated")]}),g.jsxs($e.Cell,{className:o,onClick:e?.("shortCode"),children:["Short URL ",t?.("shortCode")]}),g.jsxs($e.Cell,{children:[g.jsxs(wf,{className:Oe("p-0",o),onClick:e?.("title"),children:["Title ",t?.("title")]}),"  /  ",g.jsxs(wf,{className:Oe("p-0",o),onClick:e?.("longUrl"),children:[g.jsx("span",{className:"whitespace-nowrap",children:"Long URL"})," ",t?.("longUrl")]})]}),g.jsx($e.Cell,{children:"Tags"}),g.jsx($e.Cell,{className:o,onClick:e?.("visits"),children:g.jsxs("span",{className:"whitespace-nowrap",children:["Visits ",t?.("visits")]})}),g.jsx($e.Cell,{colSpan:2,"aria-hidden":!0})]}),children:g.jsx(Fbe,{ShortUrlsRow:i,shortUrlsList:n,onTagClick:r})})},$be=Tn(K9,["ShortUrlsRow"]),Vbe=(e,t)=>{e.factory("ShortUrlsList",Bbe),e.decorator("ShortUrlsList",t(["mercureInfo","shortUrlsList"],["listShortUrls","createNewVisits","loadMercureInfo"])),e.factory("ShortUrlsTable",$be),e.factory("ShortUrlsRow",ube),e.factory("ShortUrlsRowMenu",mbe),e.decorator("ShortUrlsRowMenu",t(null,["shortUrlDeleted","deleteShortUrl"])),e.factory("ShortUrlForm",Tbe),e.decorator("ShortUrlForm",t(["tagsList","domainsList"])),e.factory("CreateShortUrl",J1e),e.decorator("CreateShortUrl",t(["shortUrlCreation"],["createShortUrl","resetCreateShortUrl"])),e.factory("EditShortUrl",ebe),e.decorator("EditShortUrl",t(["shortUrlsDetails","shortUrlEdition"],["getShortUrlsDetails","editShortUrl"])),e.serviceFactory("DeleteShortUrlModal",()=>tbe),e.decorator("DeleteShortUrlModal",t(["shortUrlDeletion"],["resetDeleteShortUrl"])),e.factory("ExportShortUrlsBtn",nbe),e.factory("ShortUrlsFilteringBar",Ibe),e.decorator("ShortUrlsFilteringBar",t(["tagsList","domainsList"])),e.serviceFactory("shortUrlsListReducerCreator",N0e,"listShortUrls","editShortUrl","createShortUrl"),e.serviceFactory("shortUrlsListReducer",n=>n.reducer,"shortUrlsListReducerCreator"),e.serviceFactory("shortUrlCreationReducerCreator",gbe,"createShortUrl"),e.serviceFactory("shortUrlCreationReducer",n=>n.reducer,"shortUrlCreationReducerCreator"),e.serviceFactory("shortUrlEditionReducerCreator",bbe,"editShortUrl"),e.serviceFactory("shortUrlEditionReducer",n=>n.reducer,"shortUrlEditionReducerCreator"),e.serviceFactory("shortUrlDeletionReducerCreator",M0e,"deleteShortUrl"),e.serviceFactory("shortUrlDeletionReducer",n=>n.reducer,"shortUrlDeletionReducerCreator"),e.serviceFactory("shortUrlsDetailsReducerCreator",xbe,"apiClientFactory"),e.serviceFactory("shortUrlsDetailsReducer",n=>n.reducer,"shortUrlsDetailsReducerCreator"),e.serviceFactory("listShortUrls",L0e,"apiClientFactory"),e.serviceFactory("createShortUrl",pbe,"apiClientFactory"),e.serviceFactory("resetCreateShortUrl",n=>n.resetCreateShortUrl,"shortUrlCreationReducerCreator"),e.serviceFactory("deleteShortUrl",j0e,"apiClientFactory"),e.serviceFactory("resetDeleteShortUrl",n=>n.resetDeleteShortUrl,"shortUrlDeletionReducerCreator"),e.serviceFactory("shortUrlDeleted",()=>s9),e.serviceFactory("getShortUrlsDetails",n=>n.getShortUrlsDetails,"shortUrlsDetailsReducerCreator"),e.serviceFactory("editShortUrl",ybe,"apiClientFactory")},Hbe=({tag:e,onClose:t,isOpen:n,deleteTag:r,tagDelete:i,tagDeleted:o})=>{const{deleting:l,error:c,deleted:f,errorData:h}=i;return g.jsxs(co,{title:"Delete tag",variant:"danger",open:n,onClose:t,onClosed:()=>f&&o(e),onConfirm:async()=>{await r(e),t()},confirmText:l?"Deleting tag...":"Delete tag",confirmDisabled:l,children:["Are you sure you want to delete tag ",g.jsx("b",{children:e}),"?",c&&g.jsx(Gr,{variant:"error",size:"sm",className:"mt-2",children:g.jsx(so,{errorData:h,fallbackMessage:"Something went wrong while deleting the tag :("})})]})},Z9=({tag:e,editTag:t,onClose:n,tagEdited:r,isOpen:i,tagEdit:o})=>{const{ColorGenerator:l}=An(Z9),[c,f]=w.useState(e),[h,m]=w.useState(l.getColorForKey(e)),{editing:y,error:x,edited:b,errorData:C}=o,_=w.useCallback(async()=>{await t({oldName:e,newName:c,color:h}),n()},[h,t,c,n,e]),A=w.useCallback(()=>b&&r({oldName:e,newName:c,color:h}),[h,b,c,e,r]);return g.jsxs(co,{title:"Edit tag",open:i,onClose:n,onClosed:A,onConfirm:_,confirmText:y?"Saving...":"Save",confirmDisabled:y,children:[g.jsxs("div",{className:"flex",children:[g.jsx(D9,{color:h,onChange:m,className:"rounded-r-none",name:"tag-color"}),g.jsx(Ti,{className:"grow [&]:rounded-l-none",value:c,placeholder:"Tag",required:!0,onChange:({target:O})=>f(O.value)})]}),x&&g.jsx(Gr,{variant:"error",size:"sm",className:"mt-2",children:g.jsx(so,{errorData:C,fallbackMessage:"Something went wrong while editing the tag :("})})]})},qbe=Tn(Z9,["ColorGenerator"]),S0=({color:e,testId:t})=>g.jsx("div",{"data-testid":t,style:{backgroundColor:e},className:Oe("inline-block w-[20px] h-[20px] rounded-full","align-[-4px] mr-1.5")}),X9=({tags:e,selectedTags:t,onTagsChange:n,mode:r="any",onModeChange:i,buttonClassName:o,title:l,prefix:c})=>{const{ColorGenerator:f}=An(X9),h=Fn("shortUrlCreation")?.tagFilteringMode??"startsWith",{searchResults:m,onSearch:y}=o6({tags:e,selectedTags:t,searchMode:h}),x=w.useCallback(_=>n?.([...new Set([...t,J_(_)])]),[n,t]),b=w.useCallback(_=>n?.(t.filter(A=>A!==_)),[n,t]),C=w.useCallback(_=>{n?.([]),_.target.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0}))},[n]);return g.jsxs(qe,{buttonContent:t.length?g.jsxs("span",{children:[c," ",g.jsx("b",{children:Sn(t.length)})," tag",t.length>1&&"s"]}):g.jsxs(g.Fragment,{children:[c," tags..."]}),menuAlignment:"right",menuClassName:"min-w-72 w-full",buttonClassName:o,children:[g.jsxs(qe.Title,{children:[l,":"]}),g.jsxs(qe.Misc,{className:"flex flex-col gap-3",children:[g.jsx(r6,{size:"sm",searchResults:m,onSearch:y,onSelectSearchResult:x,renderSearchResult:_=>g.jsxs("div",{className:"flex items-center",children:[g.jsx(S0,{color:f.getColorForKey(_)}),_]}),onKeyDownCapture:_=>{_.key==="Escape"&&m&&_.stopPropagation()}}),t.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("ul",{className:"flex gap-1 flex-wrap",children:t.map((_,A)=>g.jsx("li",{children:g.jsx(w0,{text:_,colorGenerator:f,onClose:()=>b(_)})},`${_}${A}`))}),g.jsxs(Tt,{variant:"secondary",size:"sm",onClick:C,className:"gap-1!",children:[g.jsx(Be,{icon:dy})," Clear tags"]})]})]}),g.jsx(qe.Separator,{}),g.jsx(qe.Title,{children:"Mode:"}),g.jsxs(qe.Misc,{className:"flex flex-col gap-1",children:[g.jsxs("div",{className:"flex",children:[g.jsxs(Tt,{className:"w-1/2 rounded-r-none gap-1! border-r-0",size:"sm",solid:r==="any",onClick:()=>i?.("any"),children:[g.jsx(Be,{icon:OH})," Any"]}),g.jsxs(Tt,{className:"w-1/2 rounded-l-none gap-1!",size:"sm",solid:r==="all",onClick:()=>i?.("all"),children:[g.jsx(Be,{icon:jN})," All"]})]}),g.jsxs(Zo,{children:[c," ",g.jsx("b",{children:r})," of the tags"]})]})]})},Gbe=Tn(X9,["ColorGenerator"]),Q9=({onChange:e,...t})=>{const{ColorGenerator:n}=An(Q9),r=Fn("shortUrlCreation")?.tagFilteringMode??"startsWith";return g.jsx(lZ,{...t,onTagsChange:e,getColorForTag:i=>n.getColorForKey(i),size:"lg",searchMode:r})},Ybe=Tn(Q9,["ColorGenerator"]),o_="shlink/tagDelete",Wbe={deleting:!1,deleted:!1,error:!1},J9=un(`${o_}/tagDeleted`),Kbe=e=>{const t=or(`${o_}/deleteTag`,async r=>{await e().deleteTags([r])}),{reducer:n}=jt({name:o_,initialState:Wbe,reducers:{},extraReducers:r=>{r.addCase(t.pending,()=>({deleting:!0,deleted:!1,error:!1})),r.addCase(t.rejected,(i,{error:o})=>({deleting:!1,deleted:!1,error:!0,errorData:zi(o)})),r.addCase(t.fulfilled,()=>({deleting:!1,deleted:!0,error:!1}))}});return{reducer:n,deleteTag:t}},j3="shlink/tagEdit",Zbe={editing:!1,edited:!1,error:!1},ez=un(`${j3}/tagEdited`),Xbe=(e,t)=>or(`${j3}/editTag`,async({oldName:n,newName:r,color:i})=>(await e().editTag({oldName:n,newName:r}),t.setColorForKey(r,i),{oldName:n,newName:r,color:i})),Qbe=e=>jt({name:j3,initialState:Zbe,reducers:{},extraReducers:t=>{t.addCase(e.pending,()=>({editing:!0,edited:!1,error:!1})),t.addCase(e.rejected,(n,{error:r})=>({editing:!1,edited:!1,error:!0,errorData:zi(r)})),t.addCase(e.fulfilled,(n,{payload:r})=>{const{oldName:i,newName:o}=r;return{oldName:i,newName:o,editing:!1,edited:!0,error:!1}})}}),M3="shlink/tagsList",O2={tags:[],filteredTags:[],stats:{},loading:!1,error:!1},wL=(e,t)=>n=>n===e?t:n,_L=(e,t)=>e.filter(n=>n!==t),Jbe=(e,t)=>e.reduce((n,[r,i])=>{if(!n[r])return n;const{bots:o,nonBots:l}=i,c=n[r];return{...n,[r]:{...c,visitsSummary:{total:c.visitsSummary.total+o+l,bots:c.visitsSummary.bots+o,nonBots:c.visitsSummary.nonBots+l}}}},{...t}),exe=e=>Object.entries(e.reduce((t,{shortUrl:n,visit:r})=>(n?.tags.forEach(i=>{t[i]||(t[i]={bots:0,nonBots:0}),r.potentialBot?t[i].bots+=1:t[i].nonBots+=1}),t),{})),txe=e=>or(`${M3}/listTags`,async()=>{const{data:t}=await e().tagsStats(),n=t.reduce((r,{tag:i,...o})=>(r[i]=o,r),{});return{tags:Object.keys(n),stats:n}}),tz=un(`${M3}/filterTags`),nxe=(e,t)=>jt({name:M3,initialState:O2,reducers:{},extraReducers:n=>{n.addCase(tz,(r,{payload:i})=>({...r,filteredTags:r.tags.filter(o=>o.toLowerCase().match(i.toLowerCase()))})),n.addCase(e.pending,r=>({...r,loading:!0,error:!1})),n.addCase(e.rejected,(r,{error:i})=>({...O2,error:!0,errorData:zi(i)})),n.addCase(e.fulfilled,(r,{payload:i})=>({...O2,stats:i.stats,tags:i.tags,filteredTags:i.tags})),n.addCase(J9,({tags:r,filteredTags:i,...o},{payload:l})=>({...o,tags:_L(r,l),filteredTags:_L(i,l)})),n.addCase(ez,({tags:r,filteredTags:i,stats:o,...l},{payload:c})=>({...l,stats:{...o,[c.newName]:o[c.oldName]},tags:r.map(wL(c.oldName,c.newName)).sort(),filteredTags:i.map(wL(c.oldName,c.newName)).sort()})),n.addCase(Vf,(r,{payload:i})=>({...r,stats:Jbe(exe(i.createdVisits),r.stats)})),n.addCase(t.fulfilled,({tags:r,...i},{payload:o})=>({...i,tags:r.concat(o.tags.filter(l=>!r.includes(l)))}))}}),rxe={tag:"Tag",shortUrls:"Short URLs",visits:"Visits"},nz=Na(({filterTags:e,tagsList:t})=>{const{TagsTable:n}=An(nz),r=rS(),[i,o]=w.useState(r.tags?.defaultOrdering??{}),l=w.useMemo(()=>{const f=t.filteredTags.map(h=>{const m=t.stats[h],y=r.visits?.excludeBots?m.visitsSummary.nonBots:m.visitsSummary.total;return{tag:h,visits:y,shortUrls:m?.shortUrlsCount??0}});return m6(f,i)},[i,r.visits?.excludeBots,t.filteredTags,t.stats]),c=y3();return t.loading?g.jsx(Ko,{loading:!0}):t.error?g.jsx(Gr,{variant:"error",children:g.jsx(so,{errorData:t.errorData,fallbackMessage:"Error loading tags :("})}):g.jsx(v3,{value:c,children:g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsx(Mf,{onChange:e}),g.jsx("div",{className:"flex flex-col lg:flex-row lg:justify-end",children:g.jsx("div",{className:"lg:w-1/2",children:g.jsx(rm,{containerClassName:"[&]:block",buttonClassName:"w-full",items:rxe,order:i,onChange:o})})}),g.jsx(b3,{type:"tags"}),g.jsx(n,{sortedTags:l,currentOrder:i,orderByColumn:f=>()=>o(eS({currentField:i.field,currentOrderDir:i.dir,newField:f}))})]})})},()=>[ia.visits]),ixe=Tn(nz,["TagsTable"]),axe=(e,t)=>{const n=r=>i=>{i.event.composedPath().some(({classList:o})=>o?.contains("visits-table"))||document.querySelector(".modal")||r()};return gte({delta:40,onSwipedLeft:n(t),onSwipedRight:n(e)})},oxe=(e,t)=>{const[n,r]=w.useState(t),i=w.useCallback(o=>{const{location:l,history:c}=window,f=a6(l.search);f[e]=o,c.pushState(null,"",`${l.pathname}?${Q_(f)}`),r(o)},[e]);return[n,i]},P3=e=>{const t=Zu();return w.useMemo(()=>t[e]?.split(",").filter(Boolean)??[],[e,t])},sxe=(e,t)=>{const n=w.useCallback(()=>t(`(max-width: ${e}px)`).matches,[t,e]),[r,i]=w.useState(n());return w.useEffect(()=>{const o=()=>i(n());return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[n]),r},lxe=(e,t,n)=>{w.useEffect(()=>{if(!n)return()=>{};const r=new AbortController;return document.addEventListener("keydown",i=>i.key===e&&t(),{signal:r.signal}),()=>r.abort()},[n,t,e])},uxe=20,rz=({sortedTags:e,orderByColumn:t,currentOrder:n})=>{const{TagsTableRow:r}=An(rz),i=w.useRef(!0),{page:o=1}=Zu(),[l,c]=oxe("page",Number(o)),f=w.useCallback(b=>{c(b),scrollTo(0,0)},[c]),h=af(e,uxe),m=h.length>1,y=h[l-1]??[];w.useEffect(()=>{i.current||f(1),i.current=!1},[f,e]);const x="cursor-pointer top-(--header-height) sticky-cell";return g.jsxs(Nt,{bodyClassName:m?"pb-1":"",children:[g.jsxs($e,{header:g.jsxs($e.Row,{children:[g.jsxs($e.Cell,{onClick:t("tag"),className:x,children:["Tag ",g.jsx(Eh,{currentOrder:n,field:"tag"})]}),g.jsxs($e.Cell,{onClick:t("shortUrls"),className:`lg:text-right ${x}`,children:["Short URLs ",g.jsx(Eh,{currentOrder:n,field:"shortUrls"})]}),g.jsxs($e.Cell,{onClick:t("visits"),className:`lg:text-right ${x}`,children:["Visits ",g.jsx(Eh,{currentOrder:n,field:"visits"})]}),g.jsx($e.Cell,{className:x,children:g.jsx("span",{className:"sr-only",children:"Options"})})]}),children:[y.length===0&&g.jsx($e.Row,{children:g.jsx($e.Cell,{colSpan:4,className:"text-center",children:"No tags found"})}),y.map(b=>g.jsx(r,{tag:b},b.tag))]}),m&&g.jsx("div",{className:Oe("sticky bottom-0 py-4 -mx-0.5","flex justify-around","bg-lm-primary dark:bg-dm-primary","border-t border-lm-border dark:border-dm-border"),"data-testid":"tags-paginator",children:g.jsx(Ey,{pagesCount:h.length,currentPage:l,onPageChange:f})})]},l)},cxe=Tn(rz,["TagsTableRow"]),fxe=({tag:e,colorGenerator:t})=>g.jsx(S0,{color:t.getColorForKey(e)}),iz=({tag:e})=>{const{DeleteTagConfirmModal:t,EditTagModal:n,ColorGenerator:r}=An(iz),{flag:i,setToFalse:o,setToTrue:l}=Cn(),{flag:c,setToFalse:f,setToTrue:h}=Cn(),m=ps(),y=m0();return g.jsxs($e.Row,{className:"max-lg:relative",children:[g.jsxs($e.Cell,{columnName:"Tag",children:[g.jsx(fxe,{tag:e.tag,colorGenerator:r})," ",e.tag]}),g.jsx($e.Cell,{className:"lg:text-right",columnName:"Short URLs",children:g.jsx(Ir,{to:`${m}/list-short-urls/1?tags=${encodeURIComponent(e.tag)}`,children:Sn(e.shortUrls)})}),g.jsx($e.Cell,{className:"lg:text-right",columnName:"Visits",children:g.jsx(Ir,{to:`${m}/tag/${e.tag}/visits`,children:Sn(e.visits)})}),g.jsx($e.Cell,{className:"lg:text-right max-lg:absolute max-lg:top-1.25 max-lg:right-0 max-lg:p-0",children:g.jsxs(tn,{menuAlignment:"right",children:[g.jsxs(tn.Item,{onClick:h,className:"gap-1.5",children:[g.jsx(Be,{icon:ON})," Edit"]}),g.jsxs(tn.Item,{className:"gap-1.5",disabled:!y||!y.canAddItemWithName(e.tag),onClick:()=>y?.addItemToCompare({name:e.tag,query:e.tag,style:r.stylesForKey(e.tag)}),children:[g.jsx(Be,{icon:cy})," Compare visits"]}),g.jsx(tn.Separator,{}),g.jsxs(tn.Item,{className:"[&]:text-danger gap-1.5",onClick:l,children:[g.jsx(Be,{icon:YV})," Delete tag"]})]})}),g.jsx(n,{tag:e.tag,onClose:f,isOpen:c}),g.jsx(t,{tag:e.tag,onClose:o,isOpen:i})]})},dxe=Tn(iz,["DeleteTagConfirmModal","EditTagModal","ColorGenerator"]),hxe=(e,t)=>{e.factory("TagsSelector",Ybe),e.factory("TagsSearchDropdown",Gbe),e.serviceFactory("DeleteTagConfirmModal",()=>Hbe),e.decorator("DeleteTagConfirmModal",t(["tagDelete"],["deleteTag","tagDeleted"])),e.factory("EditTagModal",qbe),e.decorator("EditTagModal",t(["tagEdit"],["editTag","tagEdited"])),e.factory("TagsTableRow",dxe),e.factory("TagsTable",cxe),e.factory("TagsList",ixe),e.decorator("TagsList",t(["tagsList","mercureInfo"],["filterTags","createNewVisits","loadMercureInfo"])),e.serviceFactory("tagEditReducerCreator",Qbe,"editTag"),e.serviceFactory("tagEditReducer",n=>n.reducer,"tagEditReducerCreator"),e.serviceFactory("tagDeleteReducerCreator",Kbe,"apiClientFactory"),e.serviceFactory("tagDeleteReducer",n=>n.reducer,"tagDeleteReducerCreator"),e.serviceFactory("tagsListReducerCreator",nxe,"listTags","createShortUrl"),e.serviceFactory("tagsListReducer",n=>n.reducer,"tagsListReducerCreator"),e.serviceFactory("listTags",txe,"apiClientFactory"),e.serviceFactory("filterTags",()=>tz),e.serviceFactory("deleteTag",n=>n.deleteTag,"tagDeleteReducerCreator"),e.serviceFactory("tagDeleted",()=>J9),e.serviceFactory("editTag",Xbe,"apiClientFactory","ColorGenerator"),e.serviceFactory("tagEdited",()=>ez)},mxe=new CD,pxe=e=>mxe.parse(e),gxe=6,SL="0123456789ABCDEF";function vxe(){return`#${nS(gxe,()=>SL[Math.floor(Math.random()*SL.length)]).join("")}`}const CL=e=>e.toLowerCase().trim();class yxe{constructor(t){this.storage=t,this.colors=this.storage?.getTagColors()??{},this.lights={}}colors;lights;getColorForKey(t){const n=CL(t);return this.colors[n]||this.setColorForKey(n,vxe())}setColorForKey(t,n){const r=CL(t);return this.colors[r]=n,this.storage?.storeTagColors(this.colors),n}stylesForKey(t){const n=this.getColorForKey(t);return{backgroundColor:n,color:this.isLightColor(n)?"#222":"#fff"}}isLightColor(t){const n=t.substring(1);return this.lights[n]===void 0&&(this.lights[n]=X_(n)),this.lights[n]}}const az=({document:e},t,n)=>{const r=e.createElement("a");r.setAttribute("href",t),r.setAttribute("download",n),r.style.visibility="hidden",e.body.appendChild(r),r.click(),e.body.removeChild(r)},bxe=(e,t,n)=>{const r=new Blob([t],{type:"text/csv;charset=utf-8;"}),i=URL.createObjectURL(r);az(e,i,n)};class xxe{constructor(t,n){this.fetch=t,this.window=n}async saveImage(t,n){const r=await this.fetch(t).then(o=>o.blob()),i=URL.createObjectURL(r);az(this.window,i,n)}}class wxe{constructor(t,n){this.window=t,this.jsonToCsv=n}exportVisits=(t,n)=>{n.length&&this.exportCsv(t,n)};exportShortUrls=t=>{t.length&&this.exportCsv("short_urls.csv",t)};exportCsv=(t,n)=>{const r=this.jsonToCsv(n);bxe(this.window,r,t)}}function _xe(e){e.constant("window",window),e.constant("fetch",window.fetch.bind(window)),e.service("ImageDownloader",xxe,"fetch","window"),e.service("ColorGenerator",yxe,"TagColorsStorage"),e.constant("jsonToCsv",pxe),e.service("ReportExporter",wxe,"window","jsonToCsv"),e.serviceFactory("useTimeoutToggle",()=>Sy)}const Am=({visits:e,shortUrl:t,children:n,title:r})=>g.jsx("header",{children:g.jsxs(Nt,{children:[g.jsxs("h2",{className:"flex justify-between items-center",children:[g.jsx(x0,{}),g.jsx("span",{className:"text-center hidden sm:block",children:g.jsx("small",{children:r})}),g.jsxs("span",{className:Oe("px-3 py-1.5 rounded-md ml-3","font-bold text-white text-2xl","bg-lm-main dark:bg-dm-main"),"data-testid":"badge",children:["Visits:"," ",g.jsx(N9,{visitsCount:e.length,shortUrl:t})]})]}),g.jsx("h3",{className:"text-center block sm:hidden mt-3",children:g.jsx("small",{children:r})}),n&&g.jsx("div",{className:"md:mt-3",children:n})]})}),L3=({children:e,className:t})=>g.jsx("div",{className:Oe("flex justify-between items-center",t),children:e}),oz=({title:e,footer:t,children:n})=>g.jsxs(ln,{role:"document",children:[g.jsx(ln.Header,{children:e}),g.jsx(ln.Body,{children:n}),t&&g.jsx(ln.Footer,{className:"sticky bottom-0",children:t})]}),sz=w.createContext(null),{Provider:N_e}=sz,N3=e=>{const t=w.useContext(sz)??void 0,n=w.useMemo(()=>t?{}:{width:"100%",height:e},[e,t]);return{ChartWrapper:t?w.Fragment:mie,dimensions:t,wrapperDimensions:n}},lz={color:"white",background:"rgb(0 0 0 / .9)",border:"none",borderRadius:"5px"},Sxe={marginBottom:"5px",fontWeight:"bold"},uz={contentStyle:lz,labelStyle:Sxe,itemStyle:{padding:0}},EL=["#97BBCD","#F7464A","#46BFBD","#FDB45C","#949FB1","#57A773","#414066","#08B2E3","#B6C454","#DCDCDC","#463730"],cz=e=>EL[e%EL.length],iy=()=>ls()?"#46e587":"#1DAA58",Cxe=()=>ls()?"rgba(70, 229, 135, 0.4)":"rgba(29, 170, 88, 0.4)",Exe=({chartData:e,showNumbers:t})=>g.jsx("ul",{className:"space-y-1",children:e.map(({name:n,color:r,value:i},o)=>g.jsxs("li",{className:"flex items-center",children:[g.jsx(S0,{color:r,testId:`color-bullet-${o}`}),g.jsxs("small",{className:"truncate grow","data-testid":`name-${o}`,children:[n,t&&g.jsxs("b",{children:[" (",Sn(i),")"]})]})]},n))}),AL=e=>w.useMemo(()=>Object.entries(e).map(([t,n],r)=>({name:t,value:n,color:cz(r)})),[e]),Axe=({stats:e,prevStats:t,showNumbersInLegend:n})=>{const r=AL(e),i=AL(t),o=i.length>0,l=ls()?qZ:HZ,{ChartWrapper:c,dimensions:f,wrapperDimensions:h}=N3(300);return g.jsxs("div",{className:"flex flex-col md:flex-row md:items-center gap-y-4",children:[g.jsx("div",{className:"md:flex-7",children:g.jsx("div",{style:h,children:g.jsx(c,{children:g.jsxs(Pye,{...f,children:[g.jsx(FC,{formatter:Sn,contentStyle:lz,itemStyle:{color:"white"}}),g.jsx(Kw,{data:r,dataKey:"value",nameKey:"name",startAngle:360,endAngle:0,outerRadius:"100%",innerRadius:o?"65%":"50%",animationBegin:0,children:r.map((m,y)=>g.jsx(ul,{fill:m.color,stroke:l},`${m.name}-${y}`))}),o&&g.jsx(Kw,{data:i,dataKey:"value",nameKey:"name",startAngle:360,endAngle:0,outerRadius:"55%",innerRadius:"20%",animationBegin:0,stroke:l,fill:iy()})]})})})}),g.jsx("div",{className:"md:flex-5",children:g.jsx(Exe,{chartData:r,showNumbers:n})})]})},TL=({title:e,...t})=>{const{flag:n,toggle:r}=Cn();return g.jsx(oz,{title:g.jsxs(L3,{children:[e,g.jsx(bl,{checked:n,onChange:r,children:"Show numbers"})]}),children:g.jsx(Axe,{...t,showNumbersInLegend:n})})},Txe=w.forwardRef(({visitsGroups:e},t)=>{const n=w.useMemo(()=>Object.entries(e),[e]);return n.length===0?null:g.jsx("ul",{className:"mt-2 flex flex-wrap justify-center gap-4",ref:t,children:n.map(([r,i],o)=>g.jsxs("li",{className:"inline",children:[g.jsx(S0,{color:fz(i)}),g.jsxs("strong",{children:[r," (",Sn(i.length),")"]})]},`${r}${o}`))})}),Oxe={monthly:"Month",weekly:"Week",daily:"Day",hourly:"Hour"},jxe={hourly:e=>({hours:e}),daily:e=>({days:e}),weekly:e=>({weeks:e}),monthly:e=>({months:e})},Mxe={hourly:MJ,daily:Ny,weekly:jJ,monthly:dv},R3={hourly:e=>hv(e,"yyyy-MM-dd HH:00"),daily:e=>sl(e),weekly(e){const t=sl(kh(e)),n=sl(zJ(e));return`${t} - ${n}`},monthly:e=>hv(e,"yyyy-MM")},Pxe=e=>{const t=Object.values(e).filter(o=>o.length>0);if(t.length===0)return"monthly";const n=new Date,r=t.map(o=>xl(o[o.length-1].date)),i=gD(r);return[[()=>Ny(n,i)<=2,"hourly"],[()=>dv(n,i)<=1,"daily"],[()=>dv(n,i)<=6,"weekly"]].find(([o])=>o())?.[1]??"monthly"},Lxe=(e,t)=>Object.keys(t).reduce((n,r)=>(n[r]=v6(t[r],i=>R3[e](xl(i.date))),n),{}),Nxe=(e,t)=>t.reduce((n,r)=>{const i=R3[e](xl(r.date));return n[i]=n[i]??[],n[i].push(r),n},{}),Rxe=(e,t)=>{const n=Object.values(t).filter(m=>m.length>0).map(m=>[...m].reverse());if(n.length===0)return[];const r=Mxe[e],i=R3[e],o=jxe[e],l=n.flat(),c=xl(l[0].date),f=xl(l[l.length-1].date),h=r(f,c)||1;return[{formattedDate:i(c),date:c},...nS(h,m=>{const y=SJ(c,o(m));return{formattedDate:i(y),date:y}})]},fz=e=>{if(e.color)return e.color;const t={main:Lh(),highlighted:tw,previous:iy()};return e.type?t[e.type]:Lh()},OL=(e,t)=>w.useMemo(()=>Object.values(e).find(n=>n.type===t)??[],[e,t]),Dxe=(e,t,n)=>{const r=OL(e,"main"),i=OL(e,"highlighted"),o=w.useMemo(()=>n?Nxe(t,r):{},[n,t,r]),l=w.useCallback((c,{payload:f})=>{const h=o[f.formattedDate]??[];n?.(h===i?[]:h)},[o,i,n]);return n&&{cursor:"pointer",onClick:l}},dz=({visitsGroups:e,setSelectedVisits:t,matchMedia:n,onDateRangeChange:r})=>{const[i,o]=w.useState(Pxe(e)),l=sxe(767,n??window.matchMedia),c=w.useMemo(()=>{const J=Lxe(i,e),oe=Object.keys(J);return Rxe(i,e).map(({formattedDate:we,date:se})=>({date:se,formattedDate:we,...oe.reduce((ue,Y)=>(ue[Y]=J[Y][we]??0,ue),{})}))},[i,e]),f=Dxe(e,i,t),{flag:h,toggle:m,setToFalse:y}=Cn(),x=w.useId(),b=w.useRef(null),[C,_]=w.useState(l?300:400);w.useLayoutEffect(()=>{if(!h)return _(l?300:400),()=>{};const J=new ResizeObserver(()=>{const oe=window.innerHeight,{height:we}=b.current.getBoundingClientRect();_(oe-we-98)});return J.observe(b.current),()=>J.disconnect()},[h,l,b]),lxe("Escape",y,h);const{ChartWrapper:A,dimensions:O,wrapperDimensions:P}=N3(C),[N,F]=w.useState(),[U,W]=w.useState(),X=w.useCallback(()=>{F(void 0),W(void 0)},[]),ae=w.useCallback((J,oe)=>{const we=J.activeIndex&&c[J.activeIndex];oe.button===0&&we&&F(we)},[c]),ce=w.useCallback(J=>{const oe=J.activeIndex&&c[J.activeIndex];N&&oe&&W(oe)},[c,N]),re=w.useCallback(()=>{if(!N||!U){X();return}const J=[N.date,U.date],oe=AJ(J),we=gD(J);X(),r({startDate:oe,endDate:we})},[r,X,U,N]);return g.jsxs(ln,{className:Oe({"fixed top-0 bottom-0 left-0 right-0 z-1030":h}),"data-testid":"line-chart-card",children:[g.jsxs(ln.Header,{role:"heading","aria-level":4,className:"flex justify-between items-center",children:["Visits over time",g.jsxs("div",{className:"flex content-center gap-1",children:[g.jsx(Cy,{"aria-label":h?"Collapse":"Expand","aria-expanded":h,"aria-controls":x,size:"sm",onClick:m,children:g.jsx(Be,{icon:h?wH:aH})}),g.jsx(qe,{buttonContent:"Group by",buttonSize:"sm",buttonVariant:"link",buttonClassName:"[&]:p-0",menuAlignment:"right",menuClassName:"w-40",children:Object.entries(Oxe).map(([J,oe])=>g.jsx(qe.Item,{selected:i===J,onClick:()=>o(J),children:oe},J))})]})]}),g.jsxs(ln.Body,{id:x,children:[g.jsx(A,{...P,children:g.jsxs(wye,{className:"select-none",data:c,...O,onMouseDown:ae,onMouseMove:ce,onMouseUp:re,children:[g.jsx(s3,{dataKey:"formattedDate"}),g.jsx(l3,{tickFormatter:Sn,yAxisId:"1"}),g.jsx(FC,{formatter:Sn,...uz}),g.jsx(a3,{strokeOpacity:ls()?.1:.9}),Object.entries(e).map(([J,oe])=>oe.length>0&&g.jsx(N7,{yAxisId:"1",dataKey:J,type:"monotone",stroke:fz(oe),strokeWidth:2,activeDot:oe.type==="previous"?void 0:f,strokeDasharray:oe.type==="previous"?"8 3":void 0},J)),N&&U&&g.jsx(C7,{yAxisId:"1",x1:N.formattedDate,x2:U.formattedDate})]})}),g.jsx(Txe,{visitsGroups:e,ref:b})]})]})},kxe=({ranges:e,value:t,setValue:n})=>g.jsxs(qe,{buttonContent:"Paginate",buttonVariant:"link",buttonClassName:"[&]:p-0",buttonSize:"sm",menuAlignment:"right",children:[e.map(r=>g.jsxs(qe.Item,{selected:r===t,onClick:()=>n(r),children:[g.jsx("b",{children:r})," items per page"]},r)),g.jsx(qe.Separator,{}),g.jsx(qe.Item,{disabled:t===1/0,onClick:()=>n(1/0),children:g.jsx("i",{children:"Clear pagination"})})]}),jL=e=>typeof e!="string"||e.startsWith("hidden_"),Ixe=({stats:e,prevStats:t,highlightedStats:n,highlightedLabel:r,max:i,onClick:o})=>{const l=w.useMemo(()=>Object.entries(e).map(([y,x])=>{const b=n?.[y]??0,C=t?.[y]??0,_=jL(y);return{name:y,amount:Math.max(x,C),nonHighlightedAmount:_?null:x-b,highlightedAmount:_?null:b,prevAmount:_?null:C}}),[e,t,n]),c=w.useMemo(()=>{const y=l.reduce((x,{name:b})=>x>b.length?x:b.length,0);return Math.min(150,y*7)},[l]),{ChartWrapper:f,dimensions:h,wrapperDimensions:m}=N3(Math.max(300,l.length*(t?44:22)));return g.jsx(f,{...m,children:g.jsxs(Nye,{layout:"vertical",data:l,barCategoryGap:3,...h,children:[g.jsx(s3,{type:"number",dataKey:"amount",tickFormatter:Sn,domain:i?[0,i]:void 0}),g.jsx(l3,{type:"category",dataKey:"name",width:c,interval:0,style:{fontSize:".8rem"},tickFormatter:y=>jL(y)?"":y}),g.jsx(a3,{strokeOpacity:ls()?.05:.9}),g.jsx(FC,{filterNull:!0,...uz,formatter:(y,x)=>[Sn(y),x==="highlightedAmount"?r:x==="prevAmount"?"Previous period":n?"Non-selected":"Visits"]}),g.jsx($g,{dataKey:"nonHighlightedAmount",stackId:"main",cursor:"pointer",fill:Lh(),onClick:({name:y})=>y&&o?.(y),children:l.map(y=>g.jsx(ul,{fill:$Z(),stroke:Lh(),strokeWidth:2},y.name))}),n&&g.jsx($g,{dataKey:"highlightedAmount",stackId:"main",cursor:"pointer",fill:tw,onClick:({name:y})=>y&&o?.(y),children:l.map(y=>g.jsx(ul,{fill:VZ,stroke:tw,strokeWidth:2},y.name))}),t&&g.jsx($g,{dataKey:"prevAmount",fill:iy(),children:l.map(y=>g.jsx(ul,{fill:Cxe(),stroke:iy(),strokeWidth:2},y.name))})]})})},zxe=e=>typeof e=="string"?e.toLowerCase():e,Uxe=([e])=>e,Bxe=([,e])=>e,Ag=({stats:e,prevStats:t,highlightedStats:n,title:r,sortingItems:i,extraHeaderContent:o,withPagination:l=!0,...c})=>{const[f,h]=w.useState({}),[m,y]=w.useState(1),[x,b]=w.useState(50),C=w.useCallback((ae,ce)=>{const re=Object.entries(ae),J=f.field?WZ(re,([oe,we])=>zxe(f.field===Object.keys(ce)[0]?oe:we)):re;return!f.dir||f.dir==="ASC"?J:[...J].reverse()},[f.dir,f.field]),_=w.useCallback(ae=>{const ce=ae[m-1];if(m[`hidden_${J}`,0])]},[m]),A=w.useCallback(ae=>g.jsx(Ey,{currentPage:m,pagesCount:ae,onPageChange:y}),[m]),O=w.useCallback((ae,ce,re,J)=>{const oe=C(ae,ce),we=oe.map(Uxe),se=re&&Object.entries({...uO(we,we.map(()=>0)),...re}),ue=J&&Object.entries({...uO(we,we.map(()=>0)),...J});if(oe.length<=x)return{currentPageStats:Object.fromEntries(oe),currentPageHighlightedStats:se&&Object.fromEntries(se),currentPagePrevStats:ue&&Object.fromEntries(ue)};const Y=af(oe,x),k=se&&af(se,x),z=ue&&af(ue,x);return{currentPageStats:Object.fromEntries(_(Y)),currentPageHighlightedStats:k&&Object.fromEntries(_(k)),currentPagePrevStats:z&&Object.fromEntries(_(z)),pagination:A(Y.length),max:pZ(Math.max(...oe.map(Bxe)))}},[_,C,x,A]),{currentPageStats:P,currentPagePrevStats:N,currentPageHighlightedStats:F,pagination:U,max:W}=w.useMemo(()=>O(e,i,n&&Object.keys(n).length>0?n:void 0,t&&Object.keys(t).length>0?t:void 0),[O,n,t,i,e]),X=w.useMemo(()=>Object.keys(P),[P]);return g.jsx(oz,{title:g.jsxs(L3,{children:[r,g.jsxs("div",{className:"flex items-center gap-3",children:[o?.(U?X:void 0),l&&Object.keys(e).length>50&&g.jsx(kxe,{ranges:[50,100,200,500],value:x,setValue:ae=>{b(ae),y(1)}}),g.jsx(rm,{buttonVariant:"link",menuAlignment:"right",buttonSize:"sm",buttonClassName:"[&]:p-0",items:i,order:f,onChange:ae=>{h(ae),y(1)}})]})]}),footer:U&&g.jsx("div",{className:"flex justify-around items-center","data-testid":"chart-paginator",children:U}),children:g.jsx(Ixe,{stats:P,prevStats:N,highlightedStats:F,max:W,...c})})},D3=e=>e.type!==void 0,Fxe=e=>e.type!==void 0,$xe=e=>{const t=y6(e,n=>D3(n.visit)?"orphanVisits":"nonOrphanVisits");return{orphanVisits:[],nonOrphanVisits:[],...t}},hz=(e,{shortCode:t,domain:n},{endDate:r,startDate:i}={})=>e.filter(({shortUrl:o,visit:l})=>o&&Ch(o,t,n)&&Em(l.date,i,r)),mz=(e,t,{endDate:n,startDate:r}={})=>e.filter(({shortUrl:i,visit:o})=>i&&T0e(i,t)&&Em(o.date,r,n)),pz=(e,t,{endDate:n,startDate:r}={})=>e.filter(({shortUrl:i,visit:o})=>i?.tags.includes(t)&&Em(o.date,r,n)),Tg=(e,t)=>v6(e,n=>n[t]),Vxe=e=>{const t=(e?.startDate&&Ol(e?.startDate))??void 0,n=(e?.endDate&&Ol(e?.endDate))??void 0;return{startDate:t,endDate:n}},s_=({filter:e,dateRange:t})=>{const{startDate:n,endDate:r}=Vxe(t),i=e?.excludeBots||void 0;return{startDate:n,endDate:r,excludeBots:i}},Hxe=e=>G9(e.dateRange),qxe=({dateRange:e,...t})=>({...t,dateRange:Nbe(e)}),ML=(e,t)=>{if(!(!t||!(e in t)))return t[e]&&Ol(t[e])||""},gz=()=>{const e=uo(),t=Zu(),{startDate:n,endDate:r,orphanVisitsType:i,excludeBots:o,loadPrevInterval:l,domain:c,...f}=t,h=w.useMemo(()=>({dateRange:n!=null||r!=null?V9(n,r):void 0,visitsFilter:{orphanVisitsType:i,excludeBots:o!==void 0?o==="true":void 0},loadPrevInterval:l!==void 0?l==="true":void 0,domain:c}),[r,o,l,i,n,c]),m=w.useCallback(y=>{const{dateRange:x,visitsFilter:b={},loadPrevInterval:C,domain:_}=Pf(h,y),{excludeBots:A,orphanVisitsType:O}=b,P={...f,startDate:ML("startDate",x),endDate:ML("endDate",x),excludeBots:A===void 0?void 0:nw(A),orphanVisitsType:O,loadPrevInterval:C===void 0?void 0:nw(C),domain:_},N=Q_(P),F=N?`?${N}`:"";e(F,{replace:!0,relative:"route"})},[h,e,f]);return[h,m]},Gxe=()=>g.jsx(Qye,{attribution:'© OpenStreetMap contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),Yxe=e=>{if(e.length===0)return{};if(e.length>1)return{bounds:e.map(({latLong:n})=>n)};const[{latLong:t}]=e;return{zoom:10,center:t}},vz=({toggle:e,isOpen:t,title:n,locations:r=[]})=>g.jsx(co,{open:t,onClose:e,title:n,variant:"cover",children:g.jsxs(Kye,{...Yxe(r),className:"h-full w-full",children:[g.jsx(Gxe,{}),r.map(({cityName:i,latLong:o,count:l},c)=>g.jsx(Zye,{position:o,children:g.jsxs(Xye,{children:[g.jsx("b",{children:l})," visit",l>1?"s":""," from ",g.jsx("b",{children:i})]})},c))]})}),Wxe=({modalTitle:e,activeCities:t,locations:n=[]})=>{const{flag:r,setToTrue:i,setToFalse:o}=Cn(),[l,c]=w.useState([]),f=w.useCallback(h=>{c(h?n.filter(h):n),i()},[n,i]);return g.jsxs(g.Fragment,{children:[!t&&g.jsx(Cy,{onClick:()=>f(),"aria-label":"Show in map",title:"Show in map",className:"[&]:p-0",children:g.jsx(Be,{icon:D2})}),t&&g.jsxs(qe,{buttonContent:g.jsx(Be,{icon:D2,title:"Show in map"}),buttonLabel:"Show in map",buttonVariant:"link",buttonClassName:"[&]:p-0",menuAlignment:"right",caretless:!0,children:[g.jsx(qe.Item,{onClick:()=>f(),children:"Show all locations"}),g.jsx(qe.Item,{onClick:()=>f(({cityName:h})=>t.includes(h)),children:"Show locations in current page"})]}),g.jsx(vz,{toggle:o,isOpen:r,title:e,locations:l})]})},yz=({onChange:e,selected:t={},isOrphanVisits:n=!1,withPrevInterval:r=!1,disabled:i})=>{const{orphanVisitsType:o,excludeBots:l=!1,loadPrevInterval:c=!1}=t,f=y=>({selected:o===y,onClick:()=>e({...t,orphanVisitsType:y===o?void 0:y})}),h=w.useCallback(()=>e({...t,excludeBots:!l}),[l,e,t]),m=w.useCallback(()=>e({...t,loadPrevInterval:!c}),[c,e,t]);return g.jsxs(qe,{buttonDisabled:i,buttonContent:"More",buttonClassName:"w-full",menuAlignment:"right",children:[r&&g.jsxs(g.Fragment,{children:[g.jsx(qe.Item,{selected:c,onClick:m,children:"Compare with previous period"}),g.jsx(qe.Separator,{})]}),g.jsx(qe.Title,{children:"Bots:"}),g.jsx(qe.Item,{selected:l,onClick:h,children:"Exclude potential bots"}),n&&g.jsxs(g.Fragment,{children:[g.jsx(qe.Separator,{}),g.jsx(qe.Title,{children:"Orphan visits type:"}),g.jsx(qe.Item,{...f("base_url"),children:"Base URL"}),g.jsx(qe.Item,{...f("invalid_short_url"),children:"Invalid short URL"}),g.jsx(qe.Item,{...f("regular_404"),children:"Regular 404"})]}),g.jsx(qe.Separator,{}),g.jsx(qe.Item,{disabled:t.excludeBots===void 0&&t.loadPrevInterval===void 0&&t.orphanVisitsType===void 0,onClick:()=>e({excludeBots:void 0,loadPrevInterval:void 0,orphanVisitsType:void 0}),children:g.jsx("i",{children:"Reset to defaults"})})]})},Kxe=({className:e,value:t,...n})=>{const r=Math.min(100,Math.max(0,t));return g.jsx("div",{className:Oe("flex h-4 bg-gray-100 overflow-hidden rounded-md",e),...n,children:g.jsx("div",{role:"progressbar","aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":r,className:"bg-lm-brand dark:bg-dm-brand transition-[width]",style:{width:`${r}%`}})})},bz=({info:e})=>{const{loading:t,errorData:n,progress:r}=e;return g.jsxs(g.Fragment,{children:[t&&r===null&&g.jsx(Ko,{loading:!0}),t&&r!==null&&g.jsxs(Ko,{loading:!0,children:["This is going to take a while... :S",g.jsx(Kxe,{value:r,className:"mt-4"})]}),n&&g.jsx(Gr,{variant:"error",children:g.jsx(so,{errorData:n,fallbackMessage:"An error occurred while loading visits :("})})]})},Vg=({children:e,showFallback:t})=>g.jsxs(g.Fragment,{children:[t&&g.jsx(Ko,{children:"There are no visits matching current filter"}),!t&&g.jsx(g.Fragment,{children:e})]}),Zxe=({visitsDeletion:e,deleteVisits:t})=>{const{deleting:n}=e,{flag:r,setToTrue:i}=Cn();return g.jsx(Nt,{title:g.jsx("span",{className:"text-danger font-bold text-base",children:"Danger zone"}),children:g.jsxs(L3,{children:[g.jsxs("dl",{className:"m-0 mr-3",children:[g.jsx("dt",{children:"Delete visits."}),g.jsxs("dd",{className:"m-0",children:["This will delete ",g.jsx("b",{children:"all"})," visits, not only the ones matching current filter."]})]}),!r&&g.jsx(Tt,{variant:"danger",solid:!0,className:"whitespace-nowrap",onClick:i,children:"Delete visits"}),r&&g.jsxs(Tt,{solid:!0,variant:"danger",disabled:n,className:"whitespace-nowrap",onClick:t,autoFocus:!0,children:[!n&&g.jsx(g.Fragment,{children:"Click again to confirm"}),n&&g.jsx(g.Fragment,{children:"Deleting..."})]})]})})},Og="Others",Xxe=["Android Browser","Chrome","Chromium","Firefox","Internet Explorer","Microsoft Edge","Opera","Safari","Samsung Internet for Android","Vivaldi","WeChat"],Qxe=e=>{if(!Su(e))return{browser:Og,os:Og};const{browser:{name:t},os:{name:n}}=i0e.parse(e);return{os:n??Og,browser:t&&Xxe.includes(t)?t:Og}},Jxe=e=>Su(e)?e.split("/")[e.includes("://")?2:0]?.split(":")[0]??"":"Direct",xz=(e,t)=>e[t]!==void 0,PL=e=>typeof e=="number"?e:e?parseFloat(e):0,e2e=(e,{os:t})=>{e[t]=(e[t]||0)+1},t2e=(e,{browser:t})=>{e[t]=(e[t]||0)+1},n2e=(e,{referer:t})=>{e[t]=(e[t]||0)+1},wz=e=>(t,n)=>{const r=xz(n,e)?n[e]:"Unknown";t[r]=(t[r]||0)+1},r2e=wz("country"),i2e=wz("city"),a2e=(e,t)=>{if(!xz(t,"city")||t.city==="Unknown")return;const{city:n,latitude:r,longitude:i}=t,o=e[n]||{cityName:n,count:0,latLong:[PL(r),PL(i)]};o.count+=1,e[n]=o},o2e=(e,t)=>{if(!Fxe(t))return;const{visitedUrl:n}=t;e[n]=(e[n]||0)+1},l_=e=>e.reduce((t,n)=>(e2e(t.os,n),t2e(t.browsers,n),n2e(t.referrers,n),r2e(t.countries,n),i2e(t.cities,n),a2e(t.citiesForMap,n),o2e(t.visitedUrls,n),t),{os:{},browsers:{},referrers:{},countries:{},cities:{},citiesForMap:{},visitedUrls:{}}),ay=e=>e.map(t=>{const{userAgent:n,date:r,referer:i,visitLocation:o,potentialBot:l}=t;return{date:r,potentialBot:l,userAgent:n,...Qxe(n),referer:Jxe(i),country:o?.countryName||"Unknown",region:o?.regionName||"Unknown",city:o?.cityName||"Unknown",latitude:o?.latitude,longitude:o?.longitude,visitedUrl:t.visitedUrl,type:D3(t)?t.type:void 0}}),s2e=Object.freeze(Object.defineProperty({__proto__:null,normalizeVisits:ay,processStatsFromVisits:l_},Symbol.toStringTag,{value:"Module"})),vh=20,l2e=({browser:e,os:t,referer:n,country:r,city:i,userAgent:o,...l},c,f)=>{const h=f?o:`${r} ${i}`;return`${e} ${t} ${n} ${h} ${l.visitedUrl}`.toLowerCase().includes(c.toLowerCase())},u2e=(e,t,n)=>t.filter(r=>l2e(r,e,n)),c2e=(e,t)=>m6(t,e),f2e=({visits:e,searchTerm:t,order:n,searchInRawUserAgent:r})=>{const i=t?u2e(t,e,r):[...e],o=c2e(n,i),l=o.length;return{visitsGroups:af(o,vh),total:l}},ba="cursor-pointer md:sticky-cell-separated md:top-[calc(var(--header-height)+41px)]",d2e=()=>{const{anchor:e,tooltip:t}=os({placement:"right"});return g.jsxs(g.Fragment,{children:[g.jsx(Be,{icon:MN,...e}),g.jsx(ss,{...t,children:"Potentially a visit from a bot or crawler"})]})},h2e=({visits:e,selectedVisits:t=[],setSelectedVisits:n})=>{const[r,i]=w.useState(),o=w.useCallback(F=>{i(F),x(1),n([])},[n]),[l,c]=w.useState({}),f=Fn("visitsList"),h=w.useMemo(()=>Pf(Ay,f?.columns??{}),[f?.columns]),m=w.useMemo(()=>f2e({visits:e,searchTerm:r,order:l,searchInRawUserAgent:h.userAgent}),[e,r,l,h.userAgent]),[y,x]=w.useState(1),b=y*vh,C=b-vh,_=w.useMemo(()=>h.visitedUrl?m.visitsGroups.length===0||!!m.visitsGroups[y-1]?.[0]?.visitedUrl:!1,[h.visitedUrl,y,m.visitsGroups]),A=6+Number(_)+(h.userAgent?1:2),O=m.total>0,P=F=>c(eS({currentField:l.field,currentOrderDir:l.dir,newField:F})),N=F=>g.jsx(Eh,{currentOrder:l,field:F,className:"float-right mt-[5px] ml-[5px]"});return g.jsx(Nt,{bodyClassName:"[&]:p-0 [&]:pb-1",title:"Visits list",children:g.jsxs($e,{responsive:!1,size:"sm",className:"w-full relative overflow-y-hidden bg-lm-primary dark:bg-dm-primary",header:g.jsxs(g.Fragment,{children:[g.jsxs($e.Row,{children:[g.jsxs($e.Cell,{className:Oe(ba,"[&]:text-center"),onClick:()=>n(t.length0})})]}),h.potentialBot&&g.jsxs($e.Cell,{className:Oe(ba,"[&]:text-center"),onClick:()=>P("potentialBot"),children:[g.jsx("span",{className:"sr-only",children:"Is bot"}),g.jsx(Be,{icon:MN}),N("potentialBot")]}),h.date&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("date"),children:["Date",N("date")]}),h.country&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("country"),children:["Country",N("country")]}),h.region&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("region"),children:["Region",N("region")]}),h.city&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("city"),children:["City",N("city")]}),h.userAgent&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("userAgent"),children:["User agent",N("userAgent")]}),h.browser&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("browser"),children:["Browser",N("browser")]}),h.browser&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("os"),children:["OS",N("os")]}),h.referer&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("referer"),children:["Referrer",N("referer")]}),_&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("visitedUrl"),children:["Visited URL",N("visitedUrl")]})]}),g.jsx($e.Row,{children:g.jsx($e.Cell,{colSpan:A,className:"[&]:p-0",children:g.jsx(Mf,{size:"md",borderless:!0,onChange:o})})})]}),footer:m.total>vh?g.jsx($e.Row,{children:g.jsx($e.Cell,{type:"td",colSpan:A,className:"md:sticky-cell-separated bottom-0",children:g.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4 p-1",children:[g.jsx(Ey,{pagesCount:Math.ceil(m.total/vh),currentPage:y,onPageChange:x}),g.jsxs("div",{children:["Visits ",g.jsx("b",{children:Sn(C+1)})," to"," ",g.jsx("b",{children:Sn(Math.min(b,m.total))})," of"," ",g.jsx("b",{children:Sn(m.total)})]})]})})}):void 0,children:[!O&&g.jsx($e.Row,{children:g.jsx($e.Cell,{colSpan:A,className:"text-center",children:"There are no visits matching current filter"})}),m.visitsGroups[y-1]?.map((F,U)=>{const W=t.includes(F);return g.jsxs($e.Row,{className:Oe("cursor-pointer",W&&["bg-lm-table-highlight hover:[&]:bg-lm-table-highlight","dark:bg-dm-table-highlight dark:hover:[&]:bg-dm-table-highlight"]),onClick:()=>n(W?t.filter(X=>X!==F):[...t,F]),children:[g.jsx($e.Cell,{className:"text-center",children:W&&g.jsx(Be,{icon:Ru,className:"text-lm-brand dark:text-dm-brand"})}),h.potentialBot&&g.jsx($e.Cell,{className:"text-center",children:F.potentialBot&&g.jsx(d2e,{})}),h.date&&g.jsx($e.Cell,{children:g.jsx(ty,{date:F.date})}),h.country&&g.jsx($e.Cell,{children:F.country}),h.region&&g.jsx($e.Cell,{children:F.region}),h.city&&g.jsx($e.Cell,{children:F.city}),h.userAgent&&g.jsx($e.Cell,{children:F.userAgent}),h.browser&&g.jsx($e.Cell,{children:F.browser}),h.os&&g.jsx($e.Cell,{children:F.os}),h.referer&&g.jsx($e.Cell,{children:F.referer}),_&&g.jsx($e.Cell,{children:F.visitedUrl??""})]},U)})]})})},tl={byTime:{title:"By time",subPath:"by-time",icon:zV},byContext:{title:"By context",subPath:"by-context",icon:P_},byLocation:{title:"By location",subPath:"by-location",icon:D2},list:{title:"List",subPath:"list",icon:M_},options:{title:"Options",subPath:"options",icon:EN,shouldRender:({deletion:e})=>!!e}};Object.freeze(tl);const j2=({display:e})=>e&&g.jsx("div",{className:"mx-auto w-3/4",children:g.jsx(Nt,{children:g.jsxs("div",{className:"flex gap-2",children:[g.jsx(Be,{icon:vH,className:"mt-1"}),g.jsx("i",{children:"Could not calculate previous period because selected one does not have a strictly defined start date."})]})})}),Tm=e=>{const{children:t,visitsInfo:n,getVisits:r,cancelGetVisits:i,deletion:o,exportCsv:l,isOrphanVisits:c=!1,domains:f}=e,{visits:h,prevVisits:m,loading:y,errorData:x,fallbackInterval:b}=n,[{dateRange:C,visitsFilter:_,loadPrevInterval:A,domain:O},P]=gz(),N=Fn("visits"),[F,U]=w.useState(),W=w.useCallback(({startDate:Z,endDate:ne},me)=>{P({dateRange:{startDate:Z??void 0,endDate:ne??void 0}}),U(me)},[P]),[X,ae]=w.useState(b??N?.defaultInterval??"last30Days"),[ce,re]=w.useState([]),[J,oe]=w.useState(),we=w.useRef(!0),{search:se}=Or(),ue=w.useCallback(Z=>Z?`../${Z}${se}`:se,[se]),Y=w.useMemo(()=>ay(h),[h]),k=w.useMemo(()=>m&&ay(m),[m]),{os:z,browsers:H,referrers:I,countries:j,cities:q,citiesForMap:ee,visitedUrls:le}=w.useMemo(()=>l_(Y),[Y]),pe=w.useMemo(()=>l_(k??[]),[k]),he=w.useMemo(()=>Object.fromEntries([["Visits",Object.assign(Y,{type:"main"})],k&&["Previous period",Object.assign(k,{type:"previous"})],ce.length>0&&[J??"Selected",Object.assign(ce,{type:"highlighted"})]].filter(Boolean)),[J,ce,k,Y]),ve=w.useMemo(()=>({..._,excludeBots:_.excludeBots??N?.excludeBots,loadPrevInterval:A??N?.loadPrevInterval,domain:O}),[A,_,N?.excludeBots,N?.loadPrevInterval,O]),D=w.useMemo(()=>Object.values(ee),[ee]),R=w.useRef(void 0),G=w.useCallback(Z=>{R.current=void 0,re(Z)},[]),te=w.useCallback((Z,ne)=>{const me=`${Z}_${ne}`;R.current===me?(re([]),oe(void 0),R.current=void 0):(re(Y.filter(ie=>ie[Z]===ne)),oe(ne),R.current=me)},[Y]),V=cl("filterVisitsByDomain");return w.useEffect(()=>i,[i]),w.useEffect(()=>{const Z=C??q9(X),{loadPrevInterval:ne,...me}=ve,ie={doIntervalFallback:we.current,loadPrevInterval:ne};r({dateRange:Z,filter:me},ie),G([]),we.current=!1},[X,C,r,ve,G]),w.useEffect(()=>{b&&X===(N?.defaultInterval??"last30Days")&&ae(b)},[X,b,N?.defaultInterval]),g.jsxs("div",{className:"flex flex-col gap-y-4",children:[t,g.jsxs("section",{className:"flex flex-col lg:flex-row-reverse gap-4",children:[g.jsxs("div",{className:"lg:w-1/2 flex flex-col md:flex-row gap-x-2 gap-y-4",children:[g.jsx("div",{className:"grow",children:g.jsx(O3,{disabled:y,dateRangeOrInterval:F??C??X,defaultText:"All visits",onDatesChange:W})}),V&&f&&g.jsx(B9,{domains:y?[]:f,value:O,onChange:Z=>P({domain:Z})}),g.jsx(yz,{disabled:y,isOrphanVisits:c,withPrevInterval:!0,selected:ve,onChange:({loadPrevInterval:Z,...ne})=>P({visitsFilter:ne,loadPrevInterval:Z})})]}),g.jsx("div",{className:"lg:w-1/2 xl:flex-3 flex gap-2",children:h.length>0&&g.jsxs(g.Fragment,{children:[g.jsx(O9,{className:"max-lg:w-full",amount:Y.length,onClick:()=>l(Y)}),g.jsxs(Tt,{variant:"secondary",solid:ce.length>0&&!ls(),disabled:ce.length===0,className:"max-lg:w-full",onClick:()=>G([]),children:["Clear selection ",ce.length>0&&g.jsxs(g.Fragment,{children:["(",Sn(ce.length),")"]})]})]})})]}),g.jsxs("section",{className:"flex flex-col gap-4",children:[g.jsx(bz,{info:n}),!y&&!x&&g.jsxs(g.Fragment,{children:[g.jsx(nl,{fill:!0,className:"sticky top-(--header-height) z-2",children:Object.values(tl).map(({title:Z,icon:ne,subPath:me,shouldRender:ie},xe)=>!ie||ie(e)?g.jsxs(nl.Pill,{to:ue(me),replace:!0,children:[g.jsx(Be,{icon:ne}),g.jsx("span",{className:"ml-2 max-lg:sr-only",children:Z})]},xe):void 0).filter(Boolean)}),g.jsxs(sy,{children:[g.jsx(ft,{path:tl.byTime.subPath,element:g.jsxs(Vg,{showFallback:h.length===0,children:[g.jsx("div",{"data-testid":"line-chart-container",children:g.jsx(dz,{visitsGroups:he,setSelectedVisits:G,onDateRangeChange:W})}),g.jsx(j2,{display:!!ve.loadPrevInterval&&!m})]})}),g.jsx(ft,{path:tl.byContext.subPath,element:g.jsxs(Vg,{showFallback:h.length===0,children:[g.jsxs("div",{className:Oe("grid grid-cols-1 gap-4",{"lg:grid-cols-2":c,"xl:grid-cols-3":!c}),children:[g.jsx(TL,{title:"Operating systems",stats:z,prevStats:pe.os}),g.jsx(TL,{title:"Browsers",stats:H,prevStats:pe.browsers}),g.jsx(Ag,{title:"Referrers",withPagination:!1,stats:I,prevStats:pe.referrers,highlightedStats:Tg(ce,"referer"),highlightedLabel:J,sortingItems:{name:"Referrer name",amount:"Visits amount"},onClick:Z=>te("referer",Z)}),c&&g.jsx(Ag,{title:"Visited URLs",stats:le,prevStats:pe.visitedUrls,highlightedStats:Tg(ce,"visitedUrl"),highlightedLabel:J,sortingItems:{visitedUrl:"Visited URL",amount:"Visits amount"},onClick:Z=>te("visitedUrl",Z)})]}),g.jsx(j2,{display:!!ve.loadPrevInterval&&!m})]})}),g.jsx(ft,{path:tl.byLocation.subPath,element:g.jsxs(Vg,{showFallback:h.length===0,children:[g.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[g.jsx(Ag,{title:"Countries",stats:j,prevStats:pe.countries,highlightedStats:Tg(ce,"country"),highlightedLabel:J,sortingItems:{name:"Country name",amount:"Visits amount"},onClick:Z=>te("country",Z)}),g.jsx(Ag,{title:"Cities",stats:q,prevStats:pe.cities,highlightedStats:Tg(ce,"city"),highlightedLabel:J,extraHeaderContent:Z=>D.length>0&&g.jsx(Wxe,{modalTitle:"Cities",locations:D,activeCities:Z}),sortingItems:{name:"City name",amount:"Visits amount"},onClick:Z=>te("city",Z)})]}),g.jsx(j2,{display:!!ve.loadPrevInterval&&!m})]})}),g.jsx(ft,{path:tl.list.subPath,element:g.jsx(h2e,{visits:Y,selectedVisits:ce,setSelectedVisits:G})}),o&&g.jsx(ft,{path:tl.options.subPath,element:g.jsx(Zxe,{...o})}),g.jsx(ft,{path:"*",element:g.jsx(b_,{replace:!0,to:ue(tl.byTime.subPath)})})]})]})]})]})},_z=Na(({getDomainVisits:e,domainVisits:t,cancelGetDomainVisits:n})=>{const{ReportExporter:r}=An(_z),{domain:i=""}=Ef(),[o,l=o]=i.split("_"),c=w.useCallback((h,m)=>e({domain:l,options:m,params:h}),[l,e]),f=w.useCallback(h=>r.exportVisits(`domain_${o}_visits.csv`,h),[o,r]);return g.jsx(Tm,{getVisits:c,cancelGetVisits:n,visitsInfo:t,exportCsv:f,children:g.jsx(Am,{visits:t.visits,title:`"${o}" visits`})})},()=>[ia.visits]),m2e=Tn(_z,["ReportExporter"]),Sz=Na(({getNonOrphanVisits:e,nonOrphanVisits:t,cancelGetNonOrphanVisits:n,domainsList:r})=>{const{ReportExporter:i}=An(Sz),o=w.useCallback(c=>i.exportVisits("non_orphan_visits.csv",c),[i]),l=w.useCallback((c,f)=>e({options:f,params:c,domain:c.filter?.domain}),[e]);return g.jsx(Tm,{getVisits:l,cancelGetVisits:n,visitsInfo:t,exportCsv:o,domains:r.domains,children:g.jsx(Am,{title:"Non-orphan visits",visits:t.visits})})},()=>[ia.visits]),p2e=Tn(Sz,["ReportExporter"]),Cz=Na(({getOrphanVisits:e,orphanVisits:t,cancelGetOrphanVisits:n,deleteOrphanVisits:r,orphanVisitsDeletion:i,domainsList:o})=>{const{ReportExporter:l}=An(Cz),c=w.useCallback(m=>l.exportVisits("orphan_visits.csv",m),[l]),f=w.useCallback((m,y)=>e({options:y,params:m,orphanVisitsType:m.filter?.orphanVisitsType,domain:m.filter?.domain}),[e]),h=w.useMemo(()=>({deleteVisits:r,visitsDeletion:i}),[r,i]);return g.jsx(Tm,{getVisits:f,cancelGetVisits:n,visitsInfo:t,exportCsv:c,deletion:h,isOrphanVisits:!0,domains:o.domains,children:g.jsx(Am,{title:"Orphan visits",visits:t.visits})})},()=>[ia.orphanVisits]),g2e=Tn(Cz,["ReportExporter"]),LL=5e3,v2e=2,y2e=4,b2e=({currentPage:e,pagesCount:t})=>e>=t,x2e=(e,t)=>t*100/e,Ez=({visitsLoader:e,shouldCancel:t,progressChanged:n,batchSize:r})=>{const i=async(l,c)=>Promise.all(c.map(async f=>e({...l,page:f,itemsPerPage:LL}).then(({data:h})=>h))).then(f=>f.flat()),o=async(l,c,f=0)=>{if(t())return[];const h=await i(l,c[f]);return n(x2e(c.length,f+1)),f{const{pagination:c,data:f}=await e({...l,page:1,itemsPerPage:LL});if(b2e(c))return f;const h=x6(v2e,c.pagesCount+1),m=af(h,r);return c.pagesCount-1>r&&n(0),f.concat(await o(l,m))}},Om=(e,t)=>async n=>e?t({page:1,itemsPerPage:1,excludeBots:n}).then(({data:r})=>r[0]):Promise.resolve(void 0),jm=({typePrefix:e,createLoaders:t,shouldCancel:n})=>{const r=un(`${e}/progressChanged`),i=un(`${e}/fallbackToInterval`),o=or(e,async(l,{getState:c,dispatch:f})=>{const{params:h,options:m}=l,{visitsLoader:y,lastVisitLoader:x}=t(l),b=Rbe(h.dateRange),C=s_(h),_=m.loadPrevInterval&&Hxe(h)?s_(qxe(h)):void 0,A=y2e/(_?2:1),O=_?{main:0,prev:0}:{main:0},P=(X,ae)=>{O[X]=ae;const ce=Object.values(O),re=ce.reduce((J,oe)=>J+oe,0);f(r(re/ce.length))},N=Ez({visitsLoader:y,shouldCancel:()=>n(c),progressChanged:X=>P("main",X),batchSize:A}),[F,U,W]=await Promise.all([N(C),x(h.filter?.excludeBots),_?N(_).then(X=>X.map(ae=>{if(b===void 0)return ae;const{date:ce,...re}=ae,J=gS(ji(ce),b);return{...re,date:Ol(J)}})):Promise.resolve(void 0)]);return!F.length&&U&&f(i(Lbe(U.date))),{...l,visits:F,prevVisits:W}});return Object.assign(o,{progressChanged:r,fallbackToInterval:i})},Mm=({name:e,asyncThunkCreator:t,initialState:n,filterCreatedVisits:r,extraReducers:i})=>{const{pending:o,rejected:l,fulfilled:c,progressChanged:f,fallbackToInterval:h}=t,{reducer:m,actions:y}=jt({name:e,initialState:n,reducers:{cancelGetVisits:b=>({...b,cancelLoad:!0})},extraReducers:b=>{b.addCase(o,()=>({...n,loading:!0})),b.addCase(l,(C,{error:_})=>({...n,errorData:zi(_)??null})),b.addCase(c,(C,{payload:_})=>({...C,..._,loading:!1,progress:null,errorData:null})),b.addCase(f,(C,{payload:_})=>({...C,progress:_})),b.addCase(h,(C,{payload:_})=>({...C,fallbackInterval:_})),b.addCase(Vf,(C,{payload:_})=>{const{visits:A}=C,O=r(C,_.createdVisits).map(({visit:P})=>P);return O.length?{...C,visits:[...O,...A]}:C}),i?.(b)}}),{cancelGetVisits:x}=y;return{reducer:m,cancelGetVisits:x}},Az="shlink/domainVisits",w2e={visits:[],domain:"",loading:!1,cancelLoad:!1,errorData:null,progress:null},_2e=e=>jm({typePrefix:`${Az}/getDomainVisits`,createLoaders:({domain:t,options:n})=>{const r=e(),{doIntervalFallback:i=!1}=n,o=c=>r.getDomainVisits(t,c),l=Om(i,c=>r.getDomainVisits(t,c));return{visitsLoader:o,lastVisitLoader:l}},shouldCancel:t=>t().domainVisits.cancelLoad}),S2e=e=>Mm({name:Az,initialState:w2e,asyncThunkCreator:e,filterCreatedVisits:({domain:t,params:n},r)=>mz(r,t,n?.dateRange)}),Tz="shlink/orphanVisits",C2e={visits:[],loading:!1,cancelLoad:!1,errorData:null,progress:null},E2e=e=>jm({typePrefix:`${Tz}/getNonOrphanVisits`,createLoaders:({options:t,domain:n})=>{const r=e(),{doIntervalFallback:i=!1}=t,o=async c=>r.getNonOrphanVisits({...c,domain:n}),l=Om(i,c=>r.getNonOrphanVisits(c));return{visitsLoader:o,lastVisitLoader:l}},shouldCancel:t=>t().orphanVisits.cancelLoad}),A2e=e=>Mm({name:Tz,initialState:C2e,asyncThunkCreator:e,filterCreatedVisits:({params:t},n)=>{const{startDate:r,endDate:i}=t?.dateRange??{};return n.filter(({visit:o})=>Em(o.date,r,i))}}),Oz="shlink/orphanVisits",T2e={visits:[],loading:!1,cancelLoad:!1,errorData:null,progress:null},O2e=(e,t)=>!t||t===e.type,j2e=({data:e,...t},n)=>{const r=e.filter(i=>D3(i)&&O2e(i,n));return{...t,data:r}},M2e=e=>jm({typePrefix:`${Oz}/getOrphanVisits`,createLoaders:({orphanVisitsType:t,domain:n,options:r})=>{const i=e(),{doIntervalFallback:o=!1}=r,l=async f=>i.getOrphanVisits({...f,type:t,domain:n}).then(h=>j2e(h,t)),c=Om(o,f=>i.getOrphanVisits(f));return{visitsLoader:l,lastVisitLoader:c}},shouldCancel:t=>t().orphanVisits.cancelLoad}),P2e=(e,t)=>Mm({name:Oz,initialState:T2e,asyncThunkCreator:e,extraReducers:n=>{n.addCase(t.fulfilled,r=>({...r,visits:[]}))},filterCreatedVisits:({params:n},r)=>{const{startDate:i,endDate:o}=n?.dateRange??{};return r.filter(({visit:l,shortUrl:c})=>!c&&Em(l.date,i,o))}}),jz="shlink/orphanVisitsDeletion",NL={deletedVisits:0,deleting:!1,error:!1},L2e=e=>or(`${jz}/deleteOrphanVisits`,()=>e().deleteOrphanVisits()),N2e=e=>jt({name:jz,initialState:NL,reducers:{},extraReducers:t=>{t.addCase(e.pending,n=>({...n,deleting:!0,error:!1})),t.addCase(e.rejected,(n,{error:r})=>({...n,deleting:!1,error:!0,errorData:zi(r)})),t.addCase(e.fulfilled,(n,{payload:r})=>{const{deletedVisits:i}=r;return{...NL,deletedVisits:i}})}}),Mz="shlink/shortUrlVisits",R2e={visits:[],shortCode:"",loading:!1,errorData:null,cancelLoad:!1,progress:null},D2e=e=>jm({typePrefix:`${Mz}/getShortUrlVisits`,createLoaders:({shortCode:t,domain:n,options:r})=>{const i=e(),{doIntervalFallback:o=!1}=r,l=f=>i.getShortUrlVisits({shortCode:t,domain:n},f),c=Om(o,f=>i.getShortUrlVisits({shortCode:t,domain:n},f));return{visitsLoader:l,lastVisitLoader:c}},shouldCancel:t=>t().shortUrlVisits.cancelLoad}),k2e=(e,t)=>Mm({name:Mz,initialState:R2e,asyncThunkCreator:e,extraReducers:n=>{n.addCase(t.fulfilled,(r,{payload:i})=>r.shortCode===i.shortCode&&r.domain===i.domain?{...r,visits:[]}:r)},filterCreatedVisits:({shortCode:n,domain:r,params:i},o)=>hz(o,{shortCode:n,domain:r},i?.dateRange)}),Pz="shlink/shortUrlVisitsDeletion",RL={shortCode:"",deletedVisits:0,deleting:!1,error:!1},I2e=e=>or(`${Pz}/deleteShortUrlVisits`,async({shortCode:t,domain:n})=>({...await e().deleteShortUrlVisits({shortCode:t,domain:n}),shortCode:t,domain:n})),z2e=e=>jt({name:Pz,initialState:RL,reducers:{},extraReducers:t=>{t.addCase(e.pending,n=>({...n,deleting:!0,error:!1})),t.addCase(e.rejected,(n,{error:r})=>({...n,deleting:!1,error:!0,errorData:zi(r)})),t.addCase(e.fulfilled,(n,{payload:r})=>{const{shortCode:i,domain:o,deletedVisits:l}=r;return{...RL,shortCode:i,domain:o,deletedVisits:l}})}}),Lz="shlink/tagVisits",U2e={visits:[],tag:"",loading:!1,cancelLoad:!1,errorData:null,progress:null},B2e=e=>jm({typePrefix:`${Lz}/getTagVisits`,createLoaders:({tag:t,options:n,domain:r})=>{const i=e(),{doIntervalFallback:o=!1}=n,l=f=>i.getTagVisits(t,{...f,domain:r}),c=Om(o,async f=>i.getTagVisits(t,f));return{visitsLoader:l,lastVisitLoader:c}},shouldCancel:t=>t().tagVisits.cancelLoad}),F2e=e=>Mm({name:Lz,initialState:U2e,asyncThunkCreator:e,filterCreatedVisits:({tag:t,params:n},r)=>pz(r,t,n?.dateRange)}),Nz="shlink/visitsOverview",jg={nonOrphanVisits:{total:0},orphanVisits:{total:0},loading:!1,error:!1},DL=e=>e.filter(({visit:t})=>t.potentialBot).length,$2e=e=>or(`${Nz}/loadVisitsOverview`,()=>e().getVisitsOverview()),V2e=e=>jt({name:Nz,initialState:jg,reducers:{},extraReducers:t=>{t.addCase(e.pending,()=>({...jg,loading:!0})),t.addCase(e.rejected,()=>({...jg,error:!0})),t.addCase(e.fulfilled,(n,{payload:r})=>({...jg,...r})),t.addCase(Vf,({nonOrphanVisits:n,orphanVisits:r,...i},{payload:o})=>{const{nonOrphanVisits:l,orphanVisits:c}=$xe(o.createdVisits),f=l.length,h=DL(l),m=f-h,y=c.length,x=DL(c),b=y-x;return{...i,nonOrphanVisits:{total:n.total+f,bots:n.bots&&n.bots+h,nonBots:n.nonBots&&n.nonBots+m},orphanVisits:{total:r.total+y,bots:r.bots&&r.bots+x,nonBots:r.nonBots&&r.nonBots+b}}})}}),H2e=({shortUrl:e})=>{const{anchor:t,tooltip:n}=os({placement:"bottom"});return e?g.jsxs("span",{children:[g.jsx("b",{className:"cursor-default",...t,children:g.jsx(ty,{date:e.dateCreated,relative:!0})}),g.jsx(ss,{...n,children:g.jsx(ty,{date:e.dateCreated})})]}):g.jsx("small",{children:"Loading..."})},q2e=({shortUrl:e,loading:t,shortUrlVisits:n})=>{const{visits:r}=n,i=e?.shortUrl??"",o=e?.longUrl??"",l=e?.title;return g.jsxs(Am,{title:g.jsxs(g.Fragment,{children:["Visits for ",g.jsx(Li,{href:i})]}),visits:r,shortUrl:e,children:[g.jsx("hr",{}),g.jsxs("div",{children:["Created: ",g.jsx(H2e,{shortUrl:e})]}),g.jsxs("div",{"data-testid":"long-url-container",children:[`${l?"Title":"Long URL"}: `,t&&g.jsx("small",{children:"Loading..."}),!t&&g.jsx(Li,{href:o,children:l??o})]})]})},Rz=Na(({shortUrlVisits:e,shortUrlVisitsDeletion:t,shortUrlsDetails:n,getShortUrlVisits:r,getShortUrlsDetails:i,deleteShortUrlVisits:o,cancelGetShortUrlVisits:l})=>{const{ReportExporter:c}=An(Rz),f=C3(),h=w.useMemo(()=>n.shortUrls?.get(f),[f,n.shortUrls]),m=w.useCallback((b,C)=>r({...f,options:C,params:b}),[r,f]),y=w.useCallback(b=>c.exportVisits(`short-url_${h?.shortUrl.replace(/https?:\/\//g,"")}_visits.csv`,b),[c,h?.shortUrl]),x=w.useMemo(()=>({deleteVisits:()=>o(f),visitsDeletion:t}),[o,f,t]);return w.useEffect(()=>{i([f])},[f,i]),g.jsx(Tm,{getVisits:m,cancelGetVisits:l,visitsInfo:e,exportCsv:y,deletion:x,children:g.jsx(q2e,{shortUrl:h,loading:n.loading,shortUrlVisits:e})})},e=>e.shortCode?[ia.shortUrlVisits(x3(e.shortCode))]:[]),G2e=Tn(Rz,["ReportExporter"]),Y2e=({tagVisits:e,colorGenerator:t})=>{const{visits:n,tag:r}=e;return g.jsx(Am,{title:g.jsxs("span",{className:"flex items-center justify-center",children:[g.jsx("span",{className:"mr-2",children:"Visits for"}),g.jsx(w0,{text:r,colorGenerator:t})]}),visits:n})},Dz=Na(({getTagVisits:e,tagVisits:t,cancelGetTagVisits:n,domainsList:r})=>{const{ColorGenerator:i,ReportExporter:o}=An(Dz),{tag:l=""}=Ef(),c=w.useCallback((h,m)=>e({tag:l,params:h,options:m,domain:h.filter?.domain}),[e,l]),f=w.useCallback(h=>o.exportVisits(`tag_${l}_visits.csv`,h),[o,l]);return g.jsx(Tm,{getVisits:c,cancelGetVisits:n,visitsInfo:t,exportCsv:f,domains:r.domains,children:g.jsx(Y2e,{tagVisits:t,colorGenerator:i})})},()=>[ia.visits]),W2e=Tn(Dz,["ColorGenerator","ReportExporter"]),k3=({title:e,colors:t,getVisitsForComparison:n,visitsComparisonInfo:r,cancelGetVisitsComparison:i})=>{const{loading:o,visitsGroups:l}=r,c=Fn("visits"),f=w.useMemo(()=>Object.keys(l).reduce((P,N,F)=>(P[N]=Object.assign(ay(l[N]),{color:t?.[N]??cz(F)}),P),{}),[t,l]),h=w.useMemo(()=>Object.values(l).every(P=>P.length===0),[l]),[{dateRange:m,visitsFilter:y},x]=gz(),[b,C]=w.useState(),_=w.useCallback(({startDate:P,endDate:N},F)=>{x({dateRange:{startDate:P??void 0,endDate:N??void 0}}),C(F)},[x]),[A]=w.useState(()=>m??c?.defaultInterval??"last30Days"),O=w.useMemo(()=>({...y,excludeBots:y.excludeBots??c?.excludeBots}),[y,c?.excludeBots]);return w.useEffect(()=>{const P=m??q9(A);return n({params:{dateRange:P,filter:O}}),i},[i,m,n,A,O]),g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsxs(Nt,{bodyClassName:"flex items-center",children:[g.jsx(x0,{}),g.jsx("h3",{className:"grow text-center",children:e})]}),g.jsxs("div",{className:"flex flex-col lg:flex-row-reverse gap-4",children:[g.jsxs("div",{className:"lg:flex-3 flex flex-col md:flex-row gap-x-2 gap-y-4",children:[g.jsx("div",{className:"grow",children:g.jsx(O3,{disabled:o,defaultText:"All visits",dateRangeOrInterval:b??m??A,onDatesChange:_})}),g.jsx(yz,{disabled:o,selected:O,onChange:({orphanVisitsType:P,excludeBots:N})=>x({visitsFilter:{orphanVisitsType:P,excludeBots:N}})})]}),g.jsx("div",{className:"hidden lg:block lg:flex-2 xl:flex-3"})]}),g.jsx(bz,{info:r}),!o&&g.jsx(Vg,{showFallback:h,children:g.jsx(dz,{visitsGroups:f,onDateRangeChange:_})})]})},K2e=Na(({getDomainVisitsForComparison:e,domainVisitsComparison:t,cancelGetDomainVisitsComparison:n})=>{const r=P3("domains"),i=w.useCallback(o=>e({...o,domains:r}),[r,e]);return g.jsx(k3,{title:`Comparing "${r.join('", "')}"`,getVisitsForComparison:i,visitsComparisonInfo:t,cancelGetVisitsComparison:n})},()=>[ia.visits]),Z2e=({visitsLoaders:e,shouldCancel:t,progressChanged:n})=>{const r=Object.keys(e),i=Math.max(1,Math.round(4/r.length)),o=Object.fromEntries(r.map(f=>[f,0])),l=(f,h)=>{o[f]=h;const m=Object.values(o),y=m.reduce((x,b)=>x+b,0);n(y/m.length)},c=Object.entries(e).map(([f,h])=>[f,Ez({visitsLoader:h,batchSize:i,shouldCancel:t,progressChanged:m=>l(f,m)})]);return async f=>{const h=await Promise.all(c.map(async([m,y])=>{const x=await y(f);return[m,x]}));return Object.fromEntries(h)}},I3=({typePrefix:e,createLoaders:t,shouldCancel:n})=>{const r=un(`${e}/progressChanged`),i=or(e,async(o,{getState:l,dispatch:c})=>{const f=t(o),h=await Z2e({visitsLoaders:f,shouldCancel:()=>n(l),progressChanged:m=>c(r(m))})(s_(o.params));return{...o,visitsGroups:h}});return Object.assign(i,{progressChanged:r})},z3=({name:e,asyncThunkCreator:t,initialState:n,filterCreatedVisitsForGroup:r})=>{const{pending:i,rejected:o,fulfilled:l,progressChanged:c}=t,{reducer:f,actions:h}=jt({name:e,initialState:n,reducers:{cancelGetVisits:y=>({...y,cancelLoad:!0})},extraReducers:y=>{y.addCase(i,()=>({...n,loading:!0})),y.addCase(o,(x,{error:b})=>({...n,errorData:zi(b)??null})),y.addCase(l,(x,{payload:b})=>({...x,...b,loading:!1,progress:null,errorData:null})),y.addCase(c,(x,{payload:b})=>({...x,progress:b})),y.addCase(Vf,(x,{payload:b})=>{const{visitsGroups:C,..._}=x,A=Object.keys(C).map(P=>{const N=r({..._,groupKey:P},b.createdVisits).map(({visit:F})=>F);return[P,[...N,...C[P]]]}),O=Object.fromEntries(A);return{..._,visitsGroups:O}})}}),{cancelGetVisits:m}=h;return{reducer:f,cancelGetVisits:m}},kz="shlink/domainVisitsComparison",X2e={visitsGroups:{},loading:!1,cancelLoad:!1,errorData:null,progress:null},Q2e=e=>I3({typePrefix:`${kz}/getDomainVisitsForComparison`,createLoaders:({domains:t})=>{const n=e(),r=t.map(i=>[i,o=>n.getDomainVisits(i,o)]);return Object.fromEntries(r)},shouldCancel:t=>t().domainVisitsComparison.cancelLoad}),J2e=e=>z3({name:kz,initialState:X2e,asyncThunkCreator:e,filterCreatedVisitsForGroup:({groupKey:t,params:n},r)=>mz(r,t,n?.dateRange)}),Iz="shlink/shortUrlVisitsComparison",ewe={visitsGroups:{},loading:!1,cancelLoad:!1,errorData:null,progress:null},twe=e=>I3({typePrefix:`${Iz}/getShortUrlVisitsForComparison`,createLoaders:({shortUrls:t})=>{const n=e(),r=t.map(i=>[w3(i),o=>n.getShortUrlVisits(i,o)]);return Object.fromEntries(r)},shouldCancel:t=>t().shortUrlVisitsComparison.cancelLoad}),nwe=e=>z3({name:Iz,initialState:ewe,asyncThunkCreator:e,filterCreatedVisitsForGroup:({groupKey:t,params:n},r)=>hz(r,o9(t),n?.dateRange)}),zz="shlink/tagVisitsComparison",rwe={visitsGroups:{},loading:!1,cancelLoad:!1,errorData:null,progress:null},iwe=e=>I3({typePrefix:`${zz}/getTagVisitsForComparison`,createLoaders:({tags:t})=>{const n=e(),r=t.map(i=>[i,o=>n.getTagVisits(i,o)]);return Object.fromEntries(r)},shouldCancel:t=>t().tagVisitsComparison.cancelLoad}),awe=e=>z3({name:zz,initialState:rwe,asyncThunkCreator:e,filterCreatedVisitsForGroup:({groupKey:t,params:n},r)=>pz(r,t,n?.dateRange)}),owe=Na(({getShortUrlVisitsForComparison:e,shortUrlVisitsComparison:t,cancelGetShortUrlVisitsComparison:n,shortUrlsDetails:r,getShortUrlsDetails:i})=>{const o=P3("short-urls"),l=w.useMemo(()=>o.map(o9),[o]),c=w.useCallback(m=>e({...m,shortUrls:l}),[e,l]),f=w.useMemo(()=>[...r.shortUrls?.values()??[]],[r.shortUrls]),h=w.useMemo(()=>{const{visitsGroups:m,loading:y,...x}=t,b=f.reduce((C,_)=>(C[_.shortUrl]=m[w3(_)]??[],C),{});return{...x,visitsGroups:b,loading:y||r.loading}},[t,r.loading,f]);return w.useEffect(()=>{l.length>0&&i(l)},[i,l]),g.jsx(k3,{title:g.jsx("span",{"data-testid":"title",children:r.loading?"Loading...":`Comparing ${f.length} short URLs`}),getVisitsForComparison:c,visitsComparisonInfo:h,cancelGetVisitsComparison:n})},()=>[ia.visits]),Uz=Na(({getTagVisitsForComparison:e,tagVisitsComparison:t,cancelGetTagVisitsComparison:n})=>{const{ColorGenerator:r}=An(Uz),i=P3("tags"),o=w.useCallback(f=>e({...f,tags:i}),[e,i]),{visitsGroups:l}=t,c=w.useMemo(()=>Object.keys(l).reduce((f,h)=>(f[h]=r.getColorForKey(h),f),{}),[r,l]);return g.jsx(k3,{title:g.jsxs(g.Fragment,{children:["Comparing ",i.map(f=>g.jsx(w0,{colorGenerator:r,text:f},f))]}),getVisitsForComparison:o,visitsComparisonInfo:t,cancelGetVisitsComparison:n,colors:c})},()=>[ia.visits]),swe=Tn(Uz,["ColorGenerator"]),lwe=(e,t)=>{const n=(r,i)=>t([...r,"mercureInfo"],[...i,"createNewVisits","loadMercureInfo"]);e.serviceFactory("MapModal",()=>vz),e.factory("ShortUrlVisits",G2e),e.decorator("ShortUrlVisits",t(["shortUrlVisits","shortUrlVisitsDeletion","shortUrlsDetails","mercureInfo"],["getShortUrlVisits","deleteShortUrlVisits","getShortUrlsDetails","cancelGetShortUrlVisits","createNewVisits","loadMercureInfo"])),e.factory("TagVisits",W2e),e.decorator("TagVisits",n(["tagVisits","domainsList"],["getTagVisits","cancelGetTagVisits"])),e.factory("TagVisitsComparison",swe),e.decorator("TagVisitsComparison",n(["tagVisitsComparison"],["getTagVisitsForComparison","cancelGetTagVisitsForComparison"])),e.serviceFactory("DomainVisitsComparison",()=>K2e),e.decorator("DomainVisitsComparison",n(["domainVisitsComparison"],["getDomainVisitsForComparison","cancelGetDomainVisitsForComparison"])),e.serviceFactory("ShortUrlVisitsComparison",()=>owe),e.decorator("ShortUrlVisitsComparison",n(["shortUrlVisitsComparison","shortUrlsDetails"],["getShortUrlVisitsForComparison","cancelGetShortUrlVisitsForComparison","getShortUrlsDetails"])),e.factory("DomainVisits",m2e),e.decorator("DomainVisits",n(["domainVisits"],["getDomainVisits","cancelGetDomainVisits"])),e.factory("OrphanVisits",g2e),e.decorator("OrphanVisits",n(["orphanVisits","orphanVisitsDeletion","domainsList"],["getOrphanVisits","cancelGetOrphanVisits","deleteOrphanVisits"])),e.factory("NonOrphanVisits",p2e),e.decorator("NonOrphanVisits",n(["nonOrphanVisits","domainsList"],["getNonOrphanVisits","cancelGetNonOrphanVisits"])),e.serviceFactory("VisitsParser",()=>s2e),e.serviceFactory("getShortUrlVisits",D2e,"apiClientFactory"),e.serviceFactory("cancelGetShortUrlVisits",r=>r.cancelGetVisits,"shortUrlVisitsReducerCreator"),e.serviceFactory("getShortUrlVisitsForComparison",twe,"apiClientFactory"),e.serviceFactory("cancelGetShortUrlVisitsForComparison",r=>r.cancelGetVisits,"shortUrlVisitsComparisonReducerCreator"),e.serviceFactory("deleteShortUrlVisits",I2e,"apiClientFactory"),e.serviceFactory("getTagVisits",B2e,"apiClientFactory"),e.serviceFactory("cancelGetTagVisits",r=>r.cancelGetVisits,"tagVisitsReducerCreator"),e.serviceFactory("getTagVisitsForComparison",iwe,"apiClientFactory"),e.serviceFactory("cancelGetTagVisitsForComparison",r=>r.cancelGetVisits,"tagVisitsComparisonReducerCreator"),e.serviceFactory("getDomainVisits",_2e,"apiClientFactory"),e.serviceFactory("cancelGetDomainVisits",r=>r.cancelGetVisits,"domainVisitsReducerCreator"),e.serviceFactory("getDomainVisitsForComparison",Q2e,"apiClientFactory"),e.serviceFactory("cancelGetDomainVisitsForComparison",r=>r.cancelGetVisits,"domainVisitsComparisonReducerCreator"),e.serviceFactory("getOrphanVisits",M2e,"apiClientFactory"),e.serviceFactory("cancelGetOrphanVisits",r=>r.cancelGetVisits,"orphanVisitsReducerCreator"),e.serviceFactory("deleteOrphanVisits",L2e,"apiClientFactory"),e.serviceFactory("getNonOrphanVisits",E2e,"apiClientFactory"),e.serviceFactory("cancelGetNonOrphanVisits",r=>r.cancelGetVisits,"nonOrphanVisitsReducerCreator"),e.serviceFactory("createNewVisits",()=>Vf),e.serviceFactory("loadVisitsOverview",$2e,"apiClientFactory"),e.serviceFactory("visitsOverviewReducerCreator",V2e,"loadVisitsOverview"),e.serviceFactory("visitsOverviewReducer",r=>r.reducer,"visitsOverviewReducerCreator"),e.serviceFactory("domainVisitsReducerCreator",S2e,"getDomainVisits"),e.serviceFactory("domainVisitsReducer",r=>r.reducer,"domainVisitsReducerCreator"),e.serviceFactory("nonOrphanVisitsReducerCreator",A2e,"getNonOrphanVisits"),e.serviceFactory("nonOrphanVisitsReducer",r=>r.reducer,"nonOrphanVisitsReducerCreator"),e.serviceFactory("orphanVisitsReducerCreator",P2e,"getOrphanVisits","deleteOrphanVisits"),e.serviceFactory("orphanVisitsReducer",r=>r.reducer,"orphanVisitsReducerCreator"),e.serviceFactory("orphanVisitsDeletionReducerCreator",N2e,"deleteOrphanVisits"),e.serviceFactory("orphanVisitsDeletionReducer",r=>r.reducer,"orphanVisitsDeletionReducerCreator"),e.serviceFactory("shortUrlVisitsReducerCreator",k2e,"getShortUrlVisits","deleteShortUrlVisits"),e.serviceFactory("shortUrlVisitsReducer",r=>r.reducer,"shortUrlVisitsReducerCreator"),e.serviceFactory("shortUrlVisitsDeletionReducerCreator",z2e,"deleteShortUrlVisits"),e.serviceFactory("shortUrlVisitsDeletionReducer",r=>r.reducer,"shortUrlVisitsDeletionReducerCreator"),e.serviceFactory("tagVisitsReducerCreator",F2e,"getTagVisits"),e.serviceFactory("tagVisitsReducer",r=>r.reducer,"tagVisitsReducerCreator"),e.serviceFactory("tagVisitsComparisonReducerCreator",awe,"getTagVisitsForComparison"),e.serviceFactory("tagVisitsComparisonReducer",r=>r.reducer,"tagVisitsComparisonReducerCreator"),e.serviceFactory("domainVisitsComparisonReducerCreator",J2e,"getDomainVisitsForComparison"),e.serviceFactory("domainVisitsComparisonReducer",r=>r.reducer,"domainVisitsComparisonReducerCreator"),e.serviceFactory("shortUrlVisitsComparisonReducerCreator",nwe,"getShortUrlVisitsForComparison"),e.serviceFactory("shortUrlVisitsComparisonReducer",r=>r.reducer,"shortUrlVisitsComparisonReducerCreator")},uh=({children:e,to:t,active:n,...r})=>g.jsx(__,{...r,className:({isActive:i})=>Oe("flex items-center gap-2","no-underline rounded-none px-5 py-2.5",{"text-white bg-lm-main dark:bg-dm-main":i||n,"highlight:bg-lm-secondary highlight:dark:bg-dm-secondary":!i&&!n}),to:t,children:e}),uwe=({routePrefix:e,showOnMobile:t=!1})=>{const{pathname:n}=Or(),r=i=>`${e}${i}`;return g.jsx("aside",{className:Oe("w-(--aside-menu-width) bg-lm-primary dark:bg-dm-primary","pt-[15px] md:pt-[30px] pb-[10px]","fixed! bottom-0 top-(--header-height) z-890 transition-[left] duration-300","shadow-aside-menu-mobile md:shadow-aside-menu",{"left-0":t,"max-md:left-[calc(-1*(var(--aside-menu-width)+35px))]":!t}),children:g.jsxs("nav",{className:"flex flex-col h-full",children:[g.jsxs(uh,{to:r("/overview"),children:[g.jsx(Be,{icon:uH}),"Overview"]}),g.jsxs(uh,{to:r("/list-short-urls/1"),active:n.match("/list-short-urls")!==null,children:[g.jsx(Be,{icon:M_}),"List short URLs"]}),g.jsxs(uh,{to:r("/create-short-url"),children:[g.jsx(Be,{icon:iH,flip:"horizontal"}),"Create short URL"]}),g.jsxs(uh,{to:r("/manage-tags"),children:[g.jsx(Be,{icon:jN}),"Manage tags"]}),g.jsxs(uh,{to:r("/manage-domains"),children:[g.jsx(Be,{icon:bH}),"Manage domains"]})]})})},Bz=w.createContext(void 0),U3=()=>w.useContext(Bz),Fz=({children:e})=>{const t=U3(),{flag:n,toggle:r,setToTrue:i,setToFalse:o}=Cn(),l=t??{sidebarVisible:n,toggleSidebar:r,showSidebar:i,hideSidebar:o};return g.jsx(Bz.Provider,{value:l,children:e})},$z=({className:e,...t})=>{const n=U3();if(!n)throw new Error("ShlinkSidebarToggleButton has to be used inside a ShlinkSidebarVisibilityProvider");const{sidebarVisible:r,toggleSidebar:i}=n;return g.jsx(wf,{"aria-label":"Toggle sidebar",className:Oe("md:hidden transition-colors",{"text-white/50":!r,"text-white":r},e),onClick:i,...t,children:g.jsx(Be,{icon:MH,size:"xl"})})},Vz=({createNotFound:e,autoToggleButton:t})=>{const{TagsList:n,ShortUrlsList:r,CreateShortUrl:i,ShortUrlVisits:o,TagVisits:l,DomainVisits:c,OrphanVisits:f,NonOrphanVisits:h,Overview:m,EditShortUrl:y,ManageDomains:x,TagVisitsComparison:b,DomainVisitsComparison:C,ShortUrlVisitsComparison:_,ShortUrlRedirectRules:A}=An(Vz),O=Or(),P=ps(),{sidebarVisible:N,showSidebar:F,hideSidebar:U}=U3();w.useEffect(()=>U(),[O,U]);const W=axe(F,U);return g.jsxs(g.Fragment,{children:[t&&g.jsx($z,{className:"fixed top-4 left-3 z-1035"}),g.jsx("div",{...W,className:"h-full",children:g.jsxs("div",{className:"h-full",children:[g.jsx(uwe,{routePrefix:P,showOnMobile:N}),g.jsx("div",{className:"min-h-full pt-[20px] md:pt-[30px] md:pl-(--aside-menu-width)",onPointerDown:U,children:g.jsx("div",{className:"container mx-auto px-3",children:g.jsxs(sy,{children:[g.jsx(ft,{index:!0,element:g.jsx(b_,{replace:!0,to:"overview"})}),g.jsx(ft,{path:"/overview",element:g.jsx(m,{})}),g.jsx(ft,{path:"/list-short-urls/:page",element:g.jsx(r,{})}),g.jsx(ft,{path:"/create-short-url",element:g.jsx(i,{})}),g.jsx(ft,{path:"/short-code/:shortCode/visits",children:["","*"].map(X=>g.jsx(ft,{path:X,element:g.jsx(o,{})},X))}),g.jsx(ft,{path:"/short-code/:shortCode/edit",element:g.jsx(y,{})}),g.jsx(ft,{path:"/short-code/:shortCode/redirect-rules",element:g.jsx(A,{})}),g.jsx(ft,{path:"/short-urls/compare-visits",element:g.jsx(_,{})}),g.jsx(ft,{path:"/tag/:tag/visits",children:["","*"].map(X=>g.jsx(ft,{path:X,element:g.jsx(l,{})},X))}),g.jsx(ft,{path:"/tags/compare-visits",element:g.jsx(b,{})}),g.jsx(ft,{path:"/domain/:domain/visits",children:["","*"].map(X=>g.jsx(ft,{path:X,element:g.jsx(c,{})},X))}),g.jsx(ft,{path:"/orphan-visits",children:["","*"].map(X=>g.jsx(ft,{path:X,element:g.jsx(f,{})},X))}),g.jsx(ft,{path:"/non-orphan-visits",children:["","*"].map(X=>g.jsx(ft,{path:X,element:g.jsx(h,{})},X))}),g.jsx(ft,{path:"/manage-tags",element:g.jsx(n,{})}),g.jsx(ft,{path:"/manage-domains",element:g.jsx(x,{})}),g.jsx(ft,{path:"/domains/compare-visits",element:g.jsx(C,{})}),e&&g.jsx(ft,{path:"*",element:e("/list-short-urls/1")})]})})})]})})]})},cwe=Tn(Vz,["TagsList","ShortUrlsList","CreateShortUrl","ShortUrlVisits","TagVisits","DomainVisits","OrphanVisits","NonOrphanVisits","Overview","EditShortUrl","ManageDomains","TagVisitsComparison","DomainVisitsComparison","ShortUrlVisitsComparison","ShortUrlRedirectRules"]),fwe=e=>sS({devTools:!1,reducer:Ty({mercureInfo:e.mercureInfoReducer,shortUrlsList:e.shortUrlsListReducer,shortUrlCreation:e.shortUrlCreationReducer,shortUrlDeletion:e.shortUrlDeletionReducer,shortUrlEdition:e.shortUrlEditionReducer,shortUrlsDetails:e.shortUrlsDetailsReducer,shortUrlVisits:e.shortUrlVisitsReducer,shortUrlVisitsDeletion:e.shortUrlVisitsDeletionReducer,shortUrlVisitsComparison:e.shortUrlVisitsComparisonReducer,tagVisits:e.tagVisitsReducer,tagVisitsComparison:e.tagVisitsComparisonReducer,domainVisits:e.domainVisitsReducer,domainVisitsComparison:e.domainVisitsComparisonReducer,orphanVisits:e.orphanVisitsReducer,orphanVisitsDeletion:e.orphanVisitsDeletionReducer,nonOrphanVisits:e.nonOrphanVisitsReducer,tagsList:e.tagsListReducer,tagDelete:e.tagDeleteReducer,tagEdit:e.tagEditReducer,domainsList:e.domainsListReducer,visitsOverview:e.visitsOverviewReducer,shortUrlRedirectRules:e.shortUrlRedirectRulesReducer,shortUrlRedirectRulesSaving:e.setShortUrlRedirectRulesReducer}),middleware:t=>t({immutableCheck:!1,serializableCheck:!1})}),dwe=e=>{e.factory("Main",cwe),e.factory("store",fwe)},Ra=new _N,{container:hwe}=Ra,mwe=e=>t=>Object.fromEntries(e.map(n=>[n,t[n]])),pwe=(e,t)=>(...n)=>e[t](...n),gwe=(e,t)=>({...e,[t]:pwe(hwe,t)}),qf=(e,t=[])=>GL(e?mwe(e):null,t.reduce(gwe,{}));dwe(Ra);Vbe(Ra,qf);hxe(Ra,qf);lwe(Ra,qf);E0e(Ra);_0e(Ra,qf);D0e(Ra,qf);_xe(Ra);X1e(Ra,qf);let kL;const vwe=e=>({serverVersion:t,apiClient:n,settings:r,routesPrefix:i="",createNotFound:o,tagColorsStorage:l,autoSidebarToggle:c=!0})=>{const f=d0e(t),h=w.useRef(void 0),[m,y]=w.useState(),x=Ku(),b=w.useMemo(()=>x?w.Fragment:uN,[x]);return w.useEffect(()=>{kL=n,e.value("apiClientFactory",()=>kL),l&&e.value("TagColorsStorage",l);const{Main:C,store:_,loadMercureInfo:A,listTags:O,listDomains:P}=e.container;h.current=g.jsx(C,{createNotFound:o,autoToggleButton:c}),y(_),_.dispatch(A(r)),_.dispatch(O()),_.dispatch(P())},[n,c,o,r,l]),m?g.jsx(d_,{store:m,children:g.jsx(A6,{value:r??{},children:g.jsx(f0e,{value:f,children:g.jsx(Fz,{children:g.jsx(l0e,{value:i,children:g.jsx(b,{children:h.current})})})})})}):g.jsx(g.Fragment,{})},ywe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",bwe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",xwe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",wwe=()=>{delete X5.Icon.Default.prototype._getIconUrl,X5.Icon.Default.mergeOptions({iconRetinaUrl:bwe,iconUrl:ywe,shadowUrl:xwe})};wwe();const _we=vwe(Ra);function Hz(e){const t=n=>{const{ServerError:r,buildShlinkApiClient:i}=oa(t),o=Ef(),{selectServer:l,selectedServer:c}=Xu();return w.useEffect(()=>{o.serverId&&l({serverId:o.serverId,buildShlinkApiClient:i})},[i,o.serverId,l]),c?CV(c)?g.jsx(r,{}):g.jsx(e,{...n}):g.jsx(Nf,{children:g.jsx(Ko,{loading:!0})})};return t}const qz=Hz(w.memo(({settings:e})=>{const{buildShlinkApiClient:t,TagColorsStorage:n,ServerError:r}=oa(qz),{selectedServer:i}=Xu();if(!T_(i))return g.jsx(r,{});const o=`/server/${i.id}`;return g.jsxs(Fz,{children:[g.jsx($z,{className:"fixed top-3.5 left-3 z-901"}),g.jsx(_we,{serverVersion:i.version,apiClient:t(i),settings:e,routesPrefix:o,tagColorsStorage:n,createNotFound:l=>g.jsx(g6,{to:`${o}${l}`,children:"List short URLs"}),autoSidebarToggle:!1})]})})),Swe=Pa(qz,["buildShlinkApiClient","TagColorsStorage","ServerError"]),Cwe=(e,t)=>{e.constant("window",window),e.constant("console",console),e.constant("fetch",window.fetch.bind(window)),e.service("HttpClient",LQ,"fetch"),e.serviceFactory("ScrollToTop",()=>hJ),e.factory("MainHeader",dJ),e.serviceFactory("Home",()=>fJ),e.decorator("Home",hw),e.decorator("Home",t(["servers"],[])),e.factory("ShlinkWebComponentContainer",Swe),e.decorator("ShlinkWebComponentContainer",t(["settings"],["selectServer"])),e.serviceFactory("ShlinkVersionsContainer",()=>vJ),e.serviceFactory("ErrorHandler",()=>uJ)},Gz=()=>{const e=uo();return w.useCallback(()=>e(-1),[e])},Yz=({open:e,duplicatedServers:t,onClose:n,onConfirm:r})=>{const i=t.length>1;return g.jsxs(co,{size:"lg",title:`Duplicated server${i?"s":""}`,open:e,onClose:n,onConfirm:r,confirmText:`Save duplicate${i?"s":""}`,cancelText:i?"Ignore duplicates":"Discard",children:[g.jsx("p",{children:i?"The next servers already exist:":"There is already a server with:"}),g.jsx("ul",{className:"list-disc mt-4",children:t.map(({url:o,apiKey:l},c)=>i?g.jsxs("li",{children:[g.jsx("b",{children:o})," - ",g.jsx("b",{children:l})]},c):g.jsxs(w.Fragment,{children:[g.jsxs("li",{children:["URL: ",g.jsx("b",{children:o})]}),g.jsxs("li",{children:["API key: ",g.jsx("b",{children:l})]})]},c))}),g.jsxs("span",{children:[i?"Do you want to save duplicated servers":"Do you want to save this server","?"]})]})},Ewe=e=>w.useCallback(t=>{t.preventDefault(),e(t)},[e]),Wz=({onSubmit:e,initialValues:t,children:n,title:r})=>{const[i,o]=w.useState(t?.name??""),[l,c]=w.useState(t?.url??""),[f,h]=w.useState(t?.apiKey??""),{flag:m,toggle:y}=Cn(t?.forwardCredentials??!1),x=Ewe(()=>e({name:i,url:l,apiKey:f,forwardCredentials:m}));return g.jsxs("form",{name:"serverForm",onSubmit:x,children:[g.jsxs(Nt,{className:"mb-4",bodyClassName:"flex flex-col gap-y-3",title:r,children:[g.jsx(di,{label:"Name",value:i,onChange:b=>o(b.target.value),required:!0}),g.jsx(di,{label:"URL",type:"url",value:l,onChange:b=>c(b.target.value),required:!0}),g.jsx(rZ,{label:"API key",value:f,onChange:b=>h(b.target.value),required:!0}),g.jsx(HK,{summary:"Advanced options",children:g.jsxs("div",{className:"flex flex-col gap-0.5",children:[g.jsxs(Ma,{className:"flex items-center gap-x-1.5 cursor-pointer",children:[g.jsx(W_,{onChange:y,checked:m}),"Forward credentials to this server on every request."]}),g.jsxs("small",{className:"pl-5.5 text-gray-600 dark:text-gray-400 mt-0.5",children:['"',"Credentials",'"'," here means cookies, TLS client certificates, or authentication headers containing a username and password."]}),g.jsxs("small",{className:"pl-5.5 text-gray-600 dark:text-gray-400",children:[g.jsx("b",{children:"Important!"})," If you are not sure what this means, leave it unchecked. Enabling this option will make all requests fail for Shlink older than v4.5.0, as it requires the server to set a more strict value for ",g.jsx("code",{className:"whitespace-nowrap",children:"Access-Control-Allow-Origin"})," than ",g.jsx("code",{children:"*"}),"."]})]})})]}),g.jsx("div",{className:"flex items-center justify-end gap-x-2",children:n})]})},IL=4e3,zL=({variant:e})=>g.jsx("div",{className:"mt-4",children:g.jsxs(Gr,{variant:e,children:[e==="success"&&"Servers properly imported. You can now select one from the list :)",e==="error"&&"The servers could not be imported. Make sure the format is correct."]})}),Kz=({servers:e,createServers:t})=>{const{ImportServersBtn:n,useTimeoutToggle:r}=oa(Kz),i=uo(),o=Gz(),l=!!Object.keys(e).length,[c,f]=r({delay:IL}),[h,m]=r({delay:IL}),{flag:y,toggle:x}=Cn(),[b,C]=w.useState(),_=w.useCallback(O=>{const[P]=fv(e,[O]);t([P]),i(`/server/${P.id}`)},[t,i,e]),A=w.useCallback(O=>{C(O),Object.values(e).some(({url:N,apiKey:F})=>O.url===N&&O.apiKey===F)?x():_(O)},[_,e,x]);return g.jsxs(Nf,{children:[g.jsxs(Wz,{title:"Add new server",onSubmit:A,children:[!l&&g.jsx(n,{tooltipPlacement:"top",onImport:f,onError:m}),l&&g.jsx(Tt,{variant:"secondary",onClick:o,children:"Cancel"}),g.jsx(Tt,{type:"submit",children:"Create server"})]}),c&&g.jsx(zL,{variant:"success"}),h&&g.jsx(zL,{variant:"error"}),g.jsx(Yz,{open:y,duplicatedServers:b?[b]:[],onClose:o,onConfirm:()=>b&&_(b)})]})},Awe=Pa(Kz,["ImportServersBtn","useTimeoutToggle"]),Zz=({server:e,children:t})=>{const{DeleteServerModal:n}=oa(Zz),{flag:r,setToTrue:i,setToFalse:o}=Cn(),l=uo(),c=w.useCallback(f=>{o(),f&&l("/")},[o,l]);return g.jsxs(g.Fragment,{children:[g.jsx("button",{type:"button",className:"text-danger hover:underline",onClick:i,children:t}),g.jsx(n,{server:e,open:r,onClose:c})]})},Twe=Pa(Zz,["DeleteServerModal"]),Owe=({server:e,onClose:t,open:n,deleteServer:r})=>{const i=w.useCallback(o=>{o==="confirm"&&r(e)},[r,e]);return g.jsx(co,{open:n,title:"Remove server",variant:"danger",onClose:()=>t(!1),onConfirm:()=>t(!0),onClosed:i,confirmText:"Delete",children:g.jsxs("div",{className:"flex flex-col gap-y-4",children:[g.jsxs("p",{children:["Are you sure you want to remove ",g.jsx("b",{children:e?e.name:""}),"?"]}),g.jsx("p",{children:g.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."})})]})})},Xz=Hz(({editServer:e})=>{const{buildShlinkApiClient:t}=oa(Xz),{selectServer:n,selectedServer:r}=Xu(),i=Gz(),{reconnect:o}=Zu();if(!yh(r))return null;const l=c=>{e(r.id,c),o==="true"&&n({serverId:r.id,buildShlinkApiClient:t}),i()};return g.jsx(Nf,{children:g.jsxs(Wz,{title:g.jsxs(g.Fragment,{children:['Edit "',r.name,'"']}),initialValues:r,onSubmit:l,children:[g.jsx(Tt,{variant:"secondary",onClick:i,children:"Cancel"}),g.jsx(Tt,{type:"submit",children:"Save"})]})})}),jwe=Pa(Xz,["ServerError"]),Qz=({createServers:e,servers:t,children:n,onImport:r,onError:i=()=>{},tooltipPlacement:o="bottom",className:l=""})=>{const{ServersImporter:c}=oa(Qz),f=w.useRef(null),{anchor:h,tooltip:m}=os({placement:o}),[y,x]=w.useState([]),{flag:b,setToTrue:C,setToFalse:_}=Cn(),A=w.useRef(!1),O=w.useCallback(async({target:F})=>c.importServersFromFile(F.files?.[0]).then(U=>{const{duplicatedServers:W,newServers:X}=zQ(t,U);A.current=X.length>0,e(fv(t,X)),W.length>0?(x(W),C()):r?.()}).then(()=>{F.value=null}).catch(i),[e,i,r,t,c,C]),P=w.useCallback(()=>{e(fv(t,y)),_(),r?.()},[e,y,_,r,t]),N=w.useCallback(()=>{_(),A.current&&r?.()},[_,r]);return g.jsxs(g.Fragment,{children:[g.jsxs(Tt,{variant:"secondary",className:l,onClick:()=>f.current?.click(),...h,children:[g.jsx(Be,{icon:QV,widthAuto:!0})," ",n??"Import from file"]}),g.jsxs(ss,{...m,children:["You can create servers by importing a CSV file with ",g.jsx("b",{children:"name"}),", ",g.jsx("b",{children:"apiKey"})," and ",g.jsx("b",{children:"url"})," columns."]}),g.jsx("input",{type:"file",accept:".csv",className:"hidden","aria-hidden":!0,tabIndex:-1,ref:f,onChange:O,"data-testid":"csv-file-input"}),g.jsx(Yz,{open:b,duplicatedServers:y,onClose:N,onConfirm:P})]})},Mwe=Pa(Qz,["ServersImporter"]),Jz=({servers:e})=>{const{DeleteServerButton:t}=oa(Jz),{selectedServer:n}=Xu();return g.jsx(Nf,{children:g.jsxs("div",{className:"flex flex-col items-center gap-y-4 md:gap-y-8",children:[g.jsxs(Ko,{className:"w-full lg:w-[80%]",variant:"error",children:[!yh(n)&&"Could not find this Shlink server.",yh(n)&&g.jsxs(g.Fragment,{children:[g.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."]})]}),g.jsxs("p",{className:"text-xl",children:["These are the Shlink servers currently configured. Choose one of them or ",g.jsx(Ir,{to:"/server/create",children:"add a new one"}),"."]}),g.jsx(ln,{className:"w-full max-w-100 overflow-hidden",children:g.jsx(fD,{borderless:!0,servers:Object.values(e)})}),yh(n)&&g.jsxs("p",{className:"text-xl",children:["Alternatively, if you think you may have misconfigured this server, you can ",g.jsx(t,{server:n,children:"remove it"})," or ",g.jsx(Ir,{to:`/server/${n.id}/edit?reconnect=true`,children:"edit it"}),"."]})]})})},Pwe=Pa(Jz,["DeleteServerButton"]),Lwe=4e3,eU=({servers:e})=>{const{ServersExporter:t,ImportServersBtn:n,useTimeoutToggle:r,ManageServersRow:i}=oa(eU),[o,l]=w.useState(""),c=w.useMemo(()=>Object.values(e),[e]),f=w.useMemo(()=>c.filter(({name:x,url:b})=>`${x} ${b}`.toLowerCase().match(o.toLowerCase())),[c,o]),h=c.some(({autoConnect:x})=>!!x),[m,y]=r({delay:Lwe});return g.jsxs(Nf,{className:"flex flex-col gap-y-4",children:[g.jsx(Mf,{onChange:l}),g.jsxs("div",{className:"flex flex-col md:flex-row gap-2",children:[g.jsxs("div",{className:"flex gap-2",children:[g.jsx(n,{className:"flex-grow",onError:y,children:"Import servers"}),f.length>0&&g.jsxs(Tt,{variant:"secondary",className:"flex-grow",onClick:async()=>t.exportServers(),children:[g.jsx(Be,{icon:AN,widthAuto:!0})," Export servers"]})]}),g.jsxs(Tt,{className:"md:ml-auto",to:"/server/create",children:[g.jsx(Be,{icon:Zh,widthAuto:!0})," Add a server"]})]}),g.jsx(Nt,{className:"card",children:g.jsxs($e,{header:g.jsxs($e.Row,{children:[h&&g.jsx($e.Cell,{className:"w-[35px]",children:g.jsx("span",{className:"sr-only",children:"Auto-connect"})}),g.jsx($e.Cell,{children:"Name"}),g.jsx($e.Cell,{children:"Base URL"}),g.jsx($e.Cell,{children:g.jsx("span",{className:"sr-only",children:"Options"})})]}),children:[!f.length&&g.jsx($e.Row,{className:"text-center",children:g.jsx($e.Cell,{colSpan:4,children:"No servers found."})}),f.map(x=>g.jsx(i,{server:x,hasAutoConnect:h},x.id))]})}),m&&g.jsx("div",{children:g.jsx(Gr,{variant:"error",children:"The servers could not be imported. Make sure the format is correct."})})]})},Nwe=Pa(eU,["ServersExporter","ImportServersBtn","useTimeoutToggle","ManageServersRow"]),tU=({server:e,hasAutoConnect:t})=>{const{ManageServersRowDropdown:n}=oa(tU),{anchor:r,tooltip:i}=os();return g.jsxs($e.Row,{className:"relative",children:[t&&g.jsx($e.Cell,{columnName:"Auto-connect",children:e.autoConnect&&g.jsxs(g.Fragment,{children:[g.jsx(Be,{icon:Ru,className:"text-lm-brand dark:text-dm-brand",...r}),g.jsx(ss,{...i,children:"Auto-connect to this server"})]})}),g.jsx($e.Cell,{className:"font-bold",columnName:"Name",children:g.jsx(Ir,{to:`/server/${e.id}`,children:e.name})}),g.jsx($e.Cell,{columnName:"Base URL",className:"max-lg:border-b-0",children:e.url}),g.jsx($e.Cell,{className:"text-right max-lg:absolute right-0 -top-1 mx-lg:pt-0",children:g.jsx(n,{server:e})})]})},Rwe=Pa(tU,["ManageServersRowDropdown"]),nU=({server:e,setAutoConnect:t})=>{const{DeleteServerModal:n}=oa(nU),{flag:r,setToTrue:i,setToFalse:o}=Cn(),l=`/server/${e.id}`,{autoConnect:c}=e,f=c?HV:FK;return g.jsxs(g.Fragment,{children:[g.jsxs(tn,{menuAlignment:"right",children:[g.jsxs(tn.Item,{to:l,className:"gap-1.5",children:[g.jsx(Be,{icon:hH})," Connect"]}),g.jsxs(tn.Item,{to:`${l}/edit`,className:"gap-1.5",children:[g.jsx(Be,{icon:j_})," Edit server"]}),g.jsxs(tn.Item,{onClick:()=>t(e,!c),className:"gap-1.5",children:[g.jsx(Be,{icon:f})," ",c?"Do not a":"A","uto-connect"]}),g.jsx(tn.Separator,{}),g.jsxs(tn.Item,{className:"[&]:text-danger gap-1.5",onClick:i,children:[g.jsx(Be,{icon:LN})," Remove server"]})]}),g.jsx(n,{server:e,open:r,onClose:o})]})},Dwe=Pa(nU,["DeleteServerModal"]),kwe=e=>fv({},Array.isArray(e)?e.filter(SN):[]),Iwe=e=>oD("shlink/remoteServers/fetchServers",async(t,{dispatch:n})=>{const r=await e.jsonRequest(`${Gg.homepage}/servers.json`),i=kwe(r);n(iD(i))}),zwe=({servers:e})=>{const t=Object.values(e),{selectedServer:n}=Xu();return g.jsx(J2.Dropdown,{buttonContent:g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx(Be,{icon:sT})," Servers"]}),children:t.length===0?g.jsxs(qe.Item,{to:"/server/create",children:[g.jsx(Be,{icon:Zh})," Add a server"]}):g.jsxs(g.Fragment,{children:[t.map(({name:r,id:i})=>g.jsx(qe.Item,{to:`/server/${i}`,selected:EV(n)===i,children:r},i)),g.jsx(qe.Separator,{}),g.jsxs(qe.Item,{to:"/manage-servers",children:[g.jsx(Be,{icon:sT})," Manage servers"]})]})})},Uwe=({document:e},t,n)=>{const r=e.createElement("a");r.setAttribute("href",t),r.setAttribute("download",n),r.style.visibility="hidden",e.body.appendChild(r),r.click(),e.body.removeChild(r)},Bwe=(e,t,n)=>{const r=new Blob([t],{type:"text/csv;charset=utf-8;"}),i=URL.createObjectURL(r);Uwe(e,i,n)},Fwe="shlink-servers.csv";class $we{#t;#r;#n;constructor(t,n,r){this.#t=t,this.#r=n,this.#n=r}exportServers=async()=>{const t=Object.values(this.#t.get("servers")??{}).map(AV);try{const n=this.#n(t);Bwe(this.#r,n,Fwe)}catch(n){console.error(n)}}}const Vwe=e=>{if(!Array.isArray(e))throw new Error("Provided file does not have the right format.");return e.map(OV)};class Hwe{#t;constructor(t){this.#t=t}async importServersFromFile(t){if(!t)throw new Error("No file provided");const n=await t.text(),r=await this.#t(n);return Vwe(r)}}const qwe=(e,t)=>{e.factory("ManageServers",Nwe),e.decorator("ManageServers",hw),e.decorator("ManageServers",t(["servers"],[])),e.factory("ManageServersRow",Rwe),e.factory("ManageServersRowDropdown",Dwe),e.decorator("ManageServersRowDropdown",t(null,["setAutoConnect"])),e.factory("CreateServer",Awe),e.decorator("CreateServer",hw),e.decorator("CreateServer",t(["servers"],["createServers"])),e.factory("EditServer",jwe),e.decorator("EditServer",t([],["editServer","selectServer"])),e.serviceFactory("ServersDropdown",()=>zwe),e.decorator("ServersDropdown",t(["servers"])),e.serviceFactory("DeleteServerModal",()=>Owe),e.decorator("DeleteServerModal",t(null,["deleteServer"])),e.factory("DeleteServerButton",Twe),e.factory("ImportServersBtn",Mwe),e.decorator("ImportServersBtn",t(["servers"],["createServers"])),e.factory("ServerError",Pwe),e.decorator("ServerError",t(["servers"])),e.service("ServersImporter",Hwe,"csvToJson"),e.service("ServersExporter",$we,"Storage","window","jsonToCsv"),e.serviceFactory("selectServer",()=>dS,"buildShlinkApiClient","loadMercureInfo"),e.serviceFactory("createServers",()=>iD),e.serviceFactory("deleteServer",()=>VQ),e.serviceFactory("editServer",()=>$Q),e.serviceFactory("setAutoConnect",()=>HQ),e.serviceFactory("fetchServers",Iwe,"HttpClient")};var M2,UL;function Gwe(){return UL||(UL=1,M2=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(r,i,o){n.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:o})},n.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,i){if(1&i&&(r=n(r)),8&i||4&i&&typeof r=="object"&&r&&r.__esModule)return r;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:r}),2&i&&typeof r!="string")for(var l in r)n.d(o,l,(function(c){return r[c]}).bind(null,l));return o},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=31)}([function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch{typeof window=="object"&&(n=window)}e.exports=n},function(e,t,n){var r=n(6),i=Object.keys||function(C){var _=[];for(var A in C)_.push(A);return _};e.exports=y;var o=Object.create(n(4));o.inherits=n(2);var l=n(22),c=n(13);o.inherits(y,l);for(var f=i(c.prototype),h=0;h=c())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+c().toString(16)+" bytes");return 0|D}function _(D,R){if(h.isBuffer(D))return D.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(D)||D instanceof ArrayBuffer))return D.byteLength;typeof D!="string"&&(D=""+D);var G=D.length;if(G===0)return 0;for(var te=!1;;)switch(R){case"ascii":case"latin1":case"binary":return G;case"utf8":case"utf-8":case void 0:return pe(D).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*G;case"hex":return G>>>1;case"base64":return he(D).length;default:if(te)return pe(D).length;R=(""+R).toLowerCase(),te=!0}}function A(D,R,G){var te=D[R];D[R]=D[G],D[G]=te}function O(D,R,G,te,V){if(D.length===0)return-1;if(typeof G=="string"?(te=G,G=0):G>2147483647?G=2147483647:G<-2147483648&&(G=-2147483648),G=+G,isNaN(G)&&(G=V?0:D.length-1),G<0&&(G=D.length+G),G>=D.length){if(V)return-1;G=D.length-1}else if(G<0){if(!V)return-1;G=0}if(typeof R=="string"&&(R=h.from(R,te)),h.isBuffer(R))return R.length===0?-1:P(D,R,G,te,V);if(typeof R=="number")return R&=255,h.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?V?Uint8Array.prototype.indexOf.call(D,R,G):Uint8Array.prototype.lastIndexOf.call(D,R,G):P(D,[R],G,te,V);throw new TypeError("val must be string, number or Buffer")}function P(D,R,G,te,V){var Z,ne=1,me=D.length,ie=R.length;if(te!==void 0&&((te=String(te).toLowerCase())==="ucs2"||te==="ucs-2"||te==="utf16le"||te==="utf-16le")){if(D.length<2||R.length<2)return-1;ne=2,me/=2,ie/=2,G/=2}function xe(ke,Ve){return ne===1?ke[Ve]:ke.readUInt16BE(Ve*ne)}if(V){var Ee=-1;for(Z=G;Zme&&(G=me-ie),Z=G;Z>=0;Z--){for(var Me=!0,Ue=0;UeV&&(te=V):te=V;var Z=R.length;if(Z%2!=0)throw new TypeError("Invalid hex string");te>Z/2&&(te=Z/2);for(var ne=0;ne>8,ie=ne%256,xe.push(ie),xe.push(me);return xe}(R,D.length-G),D,G,te)}function ce(D,R,G){return R===0&&G===D.length?i.fromByteArray(D):i.fromByteArray(D.slice(R,G))}function re(D,R,G){G=Math.min(D.length,G);for(var te=[],V=R;V239?4:xe>223?3:xe>191?2:1;if(V+Me<=G)switch(Me){case 1:xe<128&&(Ee=xe);break;case 2:(192&(Z=D[V+1]))==128&&(ie=(31&xe)<<6|63&Z)>127&&(Ee=ie);break;case 3:Z=D[V+1],ne=D[V+2],(192&Z)==128&&(192&ne)==128&&(ie=(15&xe)<<12|(63&Z)<<6|63&ne)>2047&&(ie<55296||ie>57343)&&(Ee=ie);break;case 4:Z=D[V+1],ne=D[V+2],me=D[V+3],(192&Z)==128&&(192&ne)==128&&(192&me)==128&&(ie=(15&xe)<<18|(63&Z)<<12|(63&ne)<<6|63&me)>65535&&ie<1114112&&(Ee=ie)}Ee===null?(Ee=65533,Me=1):Ee>65535&&(Ee-=65536,te.push(Ee>>>10&1023|55296),Ee=56320|1023&Ee),te.push(Ee),V+=Me}return function(Ue){var ke=Ue.length;if(ke<=J)return String.fromCharCode.apply(String,Ue);for(var Ve="",ot=0;otthis.length||((te===void 0||te>this.length)&&(te=this.length),te<=0)||(te>>>=0)<=(G>>>=0))return"";for(R||(R="utf8");;)switch(R){case"hex":return se(this,G,te);case"utf8":case"utf-8":return re(this,G,te);case"ascii":return oe(this,G,te);case"latin1":case"binary":return we(this,G,te);case"base64":return ce(this,G,te);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ue(this,G,te);default:if(V)throw new TypeError("Unknown encoding: "+R);R=(R+"").toLowerCase(),V=!0}}).apply(this,arguments)},h.prototype.equals=function(D){if(!h.isBuffer(D))throw new TypeError("Argument must be a Buffer");return this===D||h.compare(this,D)===0},h.prototype.inspect=function(){var D="",R=t.INSPECT_MAX_BYTES;return this.length>0&&(D=this.toString("hex",0,R).match(/.{2}/g).join(" "),this.length>R&&(D+=" ... ")),""},h.prototype.compare=function(D,R,G,te,V){if(!h.isBuffer(D))throw new TypeError("Argument must be a Buffer");if(R===void 0&&(R=0),G===void 0&&(G=D?D.length:0),te===void 0&&(te=0),V===void 0&&(V=this.length),R<0||G>D.length||te<0||V>this.length)throw new RangeError("out of range index");if(te>=V&&R>=G)return 0;if(te>=V)return-1;if(R>=G)return 1;if(this===D)return 0;for(var Z=(V>>>=0)-(te>>>=0),ne=(G>>>=0)-(R>>>=0),me=Math.min(Z,ne),ie=this.slice(te,V),xe=D.slice(R,G),Ee=0;EeV)&&(G=V),D.length>0&&(G<0||R<0)||R>this.length)throw new RangeError("Attempt to write outside buffer bounds");te||(te="utf8");for(var Z=!1;;)switch(te){case"hex":return N(this,D,R,G);case"utf8":case"utf-8":return F(this,D,R,G);case"ascii":return U(this,D,R,G);case"latin1":case"binary":return W(this,D,R,G);case"base64":return X(this,D,R,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ae(this,D,R,G);default:if(Z)throw new TypeError("Unknown encoding: "+te);te=(""+te).toLowerCase(),Z=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var J=4096;function oe(D,R,G){var te="";G=Math.min(D.length,G);for(var V=R;Vte)&&(G=te);for(var V="",Z=R;ZG)throw new RangeError("Trying to access beyond buffer length")}function k(D,R,G,te,V,Z){if(!h.isBuffer(D))throw new TypeError('"buffer" argument must be a Buffer instance');if(R>V||RD.length)throw new RangeError("Index out of range")}function z(D,R,G,te){R<0&&(R=65535+R+1);for(var V=0,Z=Math.min(D.length-G,2);V>>8*(te?V:1-V)}function H(D,R,G,te){R<0&&(R=4294967295+R+1);for(var V=0,Z=Math.min(D.length-G,4);V>>8*(te?V:3-V)&255}function I(D,R,G,te,V,Z){if(G+te>D.length)throw new RangeError("Index out of range");if(G<0)throw new RangeError("Index out of range")}function j(D,R,G,te,V){return V||I(D,0,G,4),o.write(D,R,G,te,23,4),G+4}function q(D,R,G,te,V){return V||I(D,0,G,8),o.write(D,R,G,te,52,8),G+8}h.prototype.slice=function(D,R){var G,te=this.length;if((D=~~D)<0?(D+=te)<0&&(D=0):D>te&&(D=te),(R=R===void 0?te:~~R)<0?(R+=te)<0&&(R=0):R>te&&(R=te),R0&&(V*=256);)te+=this[D+--R]*V;return te},h.prototype.readUInt8=function(D,R){return R||Y(D,1,this.length),this[D]},h.prototype.readUInt16LE=function(D,R){return R||Y(D,2,this.length),this[D]|this[D+1]<<8},h.prototype.readUInt16BE=function(D,R){return R||Y(D,2,this.length),this[D]<<8|this[D+1]},h.prototype.readUInt32LE=function(D,R){return R||Y(D,4,this.length),(this[D]|this[D+1]<<8|this[D+2]<<16)+16777216*this[D+3]},h.prototype.readUInt32BE=function(D,R){return R||Y(D,4,this.length),16777216*this[D]+(this[D+1]<<16|this[D+2]<<8|this[D+3])},h.prototype.readIntLE=function(D,R,G){D|=0,R|=0,G||Y(D,R,this.length);for(var te=this[D],V=1,Z=0;++Z=(V*=128)&&(te-=Math.pow(2,8*R)),te},h.prototype.readIntBE=function(D,R,G){D|=0,R|=0,G||Y(D,R,this.length);for(var te=R,V=1,Z=this[D+--te];te>0&&(V*=256);)Z+=this[D+--te]*V;return Z>=(V*=128)&&(Z-=Math.pow(2,8*R)),Z},h.prototype.readInt8=function(D,R){return R||Y(D,1,this.length),128&this[D]?-1*(255-this[D]+1):this[D]},h.prototype.readInt16LE=function(D,R){R||Y(D,2,this.length);var G=this[D]|this[D+1]<<8;return 32768&G?4294901760|G:G},h.prototype.readInt16BE=function(D,R){R||Y(D,2,this.length);var G=this[D+1]|this[D]<<8;return 32768&G?4294901760|G:G},h.prototype.readInt32LE=function(D,R){return R||Y(D,4,this.length),this[D]|this[D+1]<<8|this[D+2]<<16|this[D+3]<<24},h.prototype.readInt32BE=function(D,R){return R||Y(D,4,this.length),this[D]<<24|this[D+1]<<16|this[D+2]<<8|this[D+3]},h.prototype.readFloatLE=function(D,R){return R||Y(D,4,this.length),o.read(this,D,!0,23,4)},h.prototype.readFloatBE=function(D,R){return R||Y(D,4,this.length),o.read(this,D,!1,23,4)},h.prototype.readDoubleLE=function(D,R){return R||Y(D,8,this.length),o.read(this,D,!0,52,8)},h.prototype.readDoubleBE=function(D,R){return R||Y(D,8,this.length),o.read(this,D,!1,52,8)},h.prototype.writeUIntLE=function(D,R,G,te){D=+D,R|=0,G|=0,te||k(this,D,R,G,Math.pow(2,8*G)-1,0);var V=1,Z=0;for(this[R]=255&D;++Z=0&&(Z*=256);)this[R+V]=D/Z&255;return R+G},h.prototype.writeUInt8=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,1,255,0),h.TYPED_ARRAY_SUPPORT||(D=Math.floor(D)),this[R]=255&D,R+1},h.prototype.writeUInt16LE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[R]=255&D,this[R+1]=D>>>8):z(this,D,R,!0),R+2},h.prototype.writeUInt16BE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[R]=D>>>8,this[R+1]=255&D):z(this,D,R,!1),R+2},h.prototype.writeUInt32LE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[R+3]=D>>>24,this[R+2]=D>>>16,this[R+1]=D>>>8,this[R]=255&D):H(this,D,R,!0),R+4},h.prototype.writeUInt32BE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[R]=D>>>24,this[R+1]=D>>>16,this[R+2]=D>>>8,this[R+3]=255&D):H(this,D,R,!1),R+4},h.prototype.writeIntLE=function(D,R,G,te){if(D=+D,R|=0,!te){var V=Math.pow(2,8*G-1);k(this,D,R,G,V-1,-V)}var Z=0,ne=1,me=0;for(this[R]=255&D;++Z>0)-me&255;return R+G},h.prototype.writeIntBE=function(D,R,G,te){if(D=+D,R|=0,!te){var V=Math.pow(2,8*G-1);k(this,D,R,G,V-1,-V)}var Z=G-1,ne=1,me=0;for(this[R+Z]=255&D;--Z>=0&&(ne*=256);)D<0&&me===0&&this[R+Z+1]!==0&&(me=1),this[R+Z]=(D/ne>>0)-me&255;return R+G},h.prototype.writeInt8=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,1,127,-128),h.TYPED_ARRAY_SUPPORT||(D=Math.floor(D)),D<0&&(D=255+D+1),this[R]=255&D,R+1},h.prototype.writeInt16LE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[R]=255&D,this[R+1]=D>>>8):z(this,D,R,!0),R+2},h.prototype.writeInt16BE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[R]=D>>>8,this[R+1]=255&D):z(this,D,R,!1),R+2},h.prototype.writeInt32LE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[R]=255&D,this[R+1]=D>>>8,this[R+2]=D>>>16,this[R+3]=D>>>24):H(this,D,R,!0),R+4},h.prototype.writeInt32BE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,4,2147483647,-2147483648),D<0&&(D=4294967295+D+1),h.TYPED_ARRAY_SUPPORT?(this[R]=D>>>24,this[R+1]=D>>>16,this[R+2]=D>>>8,this[R+3]=255&D):H(this,D,R,!1),R+4},h.prototype.writeFloatLE=function(D,R,G){return j(this,D,R,!0,G)},h.prototype.writeFloatBE=function(D,R,G){return j(this,D,R,!1,G)},h.prototype.writeDoubleLE=function(D,R,G){return q(this,D,R,!0,G)},h.prototype.writeDoubleBE=function(D,R,G){return q(this,D,R,!1,G)},h.prototype.copy=function(D,R,G,te){if(G||(G=0),te||te===0||(te=this.length),R>=D.length&&(R=D.length),R||(R=0),te>0&&te=this.length)throw new RangeError("sourceStart out of bounds");if(te<0)throw new RangeError("sourceEnd out of bounds");te>this.length&&(te=this.length),D.length-R=0;--V)D[V+R]=this[V+G];else if(Z<1e3||!h.TYPED_ARRAY_SUPPORT)for(V=0;V>>=0,G=G===void 0?this.length:G>>>0,D||(D=0),typeof D=="number")for(Z=R;Z55295&&G<57344){if(!V){if(G>56319){(R-=3)>-1&&Z.push(239,191,189);continue}if(ne+1===te){(R-=3)>-1&&Z.push(239,191,189);continue}V=G;continue}if(G<56320){(R-=3)>-1&&Z.push(239,191,189),V=G;continue}G=65536+(V-55296<<10|G-56320)}else V&&(R-=3)>-1&&Z.push(239,191,189);if(V=null,G<128){if((R-=1)<0)break;Z.push(G)}else if(G<2048){if((R-=2)<0)break;Z.push(G>>6|192,63&G|128)}else if(G<65536){if((R-=3)<0)break;Z.push(G>>12|224,G>>6&63|128,63&G|128)}else{if(!(G<1114112))throw new Error("Invalid code point");if((R-=4)<0)break;Z.push(G>>18|240,G>>12&63|128,G>>6&63|128,63&G|128)}}return Z}function he(D){return i.toByteArray(function(R){if((R=function(G){return G.trim?G.trim():G.replace(/^\s+|\s+$/g,"")}(R).replace(ee,"")).length<2)return"";for(;R.length%4!=0;)R+="=";return R}(D))}function ve(D,R,G,te){for(var V=0;V=R.length||V>=D.length);++V)R[V+G]=D[V];return V}}).call(this,n(0))},function(e,t,n){function r(i){return Object.prototype.toString.call(i)}t.isArray=function(i){return Array.isArray?Array.isArray(i):r(i)==="[object Array]"},t.isBoolean=function(i){return typeof i=="boolean"},t.isNull=function(i){return i===null},t.isNullOrUndefined=function(i){return i==null},t.isNumber=function(i){return typeof i=="number"},t.isString=function(i){return typeof i=="string"},t.isSymbol=function(i){return typeof i=="symbol"},t.isUndefined=function(i){return i===void 0},t.isRegExp=function(i){return r(i)==="[object RegExp]"},t.isObject=function(i){return typeof i=="object"&&i!==null},t.isDate=function(i){return r(i)==="[object Date]"},t.isError=function(i){return r(i)==="[object Error]"||i instanceof Error},t.isFunction=function(i){return typeof i=="function"},t.isPrimitive=function(i){return i===null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||typeof i=="symbol"||i===void 0},t.isBuffer=n(3).Buffer.isBuffer},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function c(A){if(n===setTimeout)return setTimeout(A,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(A,0);try{return n(A,0)}catch{try{return n.call(null,A,0)}catch{return n.call(this,A,0)}}}(function(){try{n=typeof setTimeout=="function"?setTimeout:o}catch{n=o}try{r=typeof clearTimeout=="function"?clearTimeout:l}catch{r=l}})();var f,h=[],m=!1,y=-1;function x(){m&&f&&(m=!1,f.length?h=f.concat(h):y=-1,h.length&&b())}function b(){if(!m){var A=c(x);m=!0;for(var O=h.length;O;){for(f=h,h=[];++y1)for(var P=1;P0&&X.length>U&&!X.warned){X.warned=!0;var ae=new Error("Possible EventEmitter memory leak detected. "+X.length+" "+String(P)+" listeners added. Use emitter.setMaxListeners() to increase limit");ae.name="MaxListenersExceededWarning",ae.emitter=O,ae.type=P,ae.count=X.length,function(ce){console&&console.warn&&console.warn(ce)}(ae)}return O}function x(O,P,N){var F={fired:!1,wrapFn:void 0,target:O,type:P,listener:N},U=(function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}).bind(F);return U.listener=N,F.wrapFn=U,U}function b(O,P,N){var F=O._events;if(F===void 0)return[];var U=F[P];return U===void 0?[]:typeof U=="function"?N?[U.listener||U]:[U]:N?function(W){for(var X=new Array(W.length),ae=0;ae0&&(W=P[0]),W instanceof Error)throw W;var X=new Error("Unhandled error."+(W?" ("+W.message+")":""));throw X.context=W,X}var ae=U[O];if(ae===void 0)return!1;if(typeof ae=="function")o(ae,this,P);else{var ce=ae.length,re=_(ae,ce);for(N=0;N=0;W--)if(N[W]===P||N[W].listener===P){X=N[W].listener,U=W;break}if(U<0)return this;U===0?N.shift():function(ae,ce){for(;ce+1=0;F--)this.removeListener(O,P[F]);return this},c.prototype.listeners=function(O){return b(this,O,!0)},c.prototype.rawListeners=function(O){return b(this,O,!1)},c.listenerCount=function(O,P){return typeof O.listenerCount=="function"?O.listenerCount(P):C.call(O,P)},c.prototype.listenerCount=C,c.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){(t=e.exports=n(22)).Stream=t,t.Readable=t,t.Writable=n(13),t.Duplex=n(1),t.Transform=n(26),t.PassThrough=n(45)},function(e,t,n){var r=n(3),i=r.Buffer;function o(c,f){for(var h in c)f[h]=c[h]}function l(c,f,h){return i(c,f,h)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=l),o(i,l),l.from=function(c,f,h){if(typeof c=="number")throw new TypeError("Argument must not be a number");return i(c,f,h)},l.alloc=function(c,f,h){if(typeof c!="number")throw new TypeError("Argument must be a number");var m=i(c);return f!==void 0?typeof h=="string"?m.fill(f,h):m.fill(f):m.fill(0),m},l.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return i(c)},l.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(c)}},function(e,t,n){(function(r,i,o){var l=n(6);function c(re){var J=this;this.next=null,this.entry=null,this.finish=function(){(function(oe,we,se){var ue=oe.entry;for(oe.entry=null;ue;){var Y=ue.callback;we.pendingcb--,Y(void 0),ue=ue.next}we.corkedRequestsFree.next=oe})(J,re)}}e.exports=N;var f,h=!r.browser&&["v0.10","v0.9."].indexOf(r.version.slice(0,5))>-1?i:l.nextTick;N.WritableState=P;var m=Object.create(n(4));m.inherits=n(2);var y,x={deprecate:n(43)},b=n(23),C=n(12).Buffer,_=(o!==void 0?o:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},A=n(24);function O(){}function P(re,J){f=f||n(1),re=re||{};var oe=J instanceof f;this.objectMode=!!re.objectMode,oe&&(this.objectMode=this.objectMode||!!re.writableObjectMode);var we=re.highWaterMark,se=re.writableHighWaterMark,ue=this.objectMode?16:16384;this.highWaterMark=we||we===0?we:oe&&(se||se===0)?se:ue,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Y=re.decodeStrings===!1;this.decodeStrings=!Y,this.defaultEncoding=re.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(k){(function(z,H){var I=z._writableState,j=I.sync,q=I.writecb;if(function(le){le.writing=!1,le.writecb=null,le.length-=le.writelen,le.writelen=0}(I),H)(function(le,pe,he,ve,D){--pe.pendingcb,he?(l.nextTick(D,ve),l.nextTick(ce,le,pe),le._writableState.errorEmitted=!0,le.emit("error",ve)):(D(ve),le._writableState.errorEmitted=!0,le.emit("error",ve),ce(le,pe))})(z,I,j,H,q);else{var ee=X(I);ee||I.corked||I.bufferProcessing||!I.bufferedRequest||W(z,I),j?h(U,z,I,ee,q):U(z,I,ee,q)}})(J,k)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new c(this)}function N(re){if(f=f||n(1),!(y.call(N,this)||this instanceof f))return new N(re);this._writableState=new P(re,this),this.writable=!0,re&&(typeof re.write=="function"&&(this._write=re.write),typeof re.writev=="function"&&(this._writev=re.writev),typeof re.destroy=="function"&&(this._destroy=re.destroy),typeof re.final=="function"&&(this._final=re.final)),b.call(this)}function F(re,J,oe,we,se,ue,Y){J.writelen=we,J.writecb=Y,J.writing=!0,J.sync=!0,oe?re._writev(se,J.onwrite):re._write(se,ue,J.onwrite),J.sync=!1}function U(re,J,oe,we){oe||function(se,ue){ue.length===0&&ue.needDrain&&(ue.needDrain=!1,se.emit("drain"))}(re,J),J.pendingcb--,we(),ce(re,J)}function W(re,J){J.bufferProcessing=!0;var oe=J.bufferedRequest;if(re._writev&&oe&&oe.next){var we=J.bufferedRequestCount,se=new Array(we),ue=J.corkedRequestsFree;ue.entry=oe;for(var Y=0,k=!0;oe;)se[Y]=oe,oe.isBuf||(k=!1),oe=oe.next,Y+=1;se.allBuffers=k,F(re,J,!0,J.length,se,"",ue.finish),J.pendingcb++,J.lastBufferedRequest=null,ue.next?(J.corkedRequestsFree=ue.next,ue.next=null):J.corkedRequestsFree=new c(J),J.bufferedRequestCount=0}else{for(;oe;){var z=oe.chunk,H=oe.encoding,I=oe.callback;if(F(re,J,!1,J.objectMode?1:z.length,z,H,I),oe=oe.next,J.bufferedRequestCount--,J.writing)break}oe===null&&(J.lastBufferedRequest=null)}J.bufferedRequest=oe,J.bufferProcessing=!1}function X(re){return re.ending&&re.length===0&&re.bufferedRequest===null&&!re.finished&&!re.writing}function ae(re,J){re._final(function(oe){J.pendingcb--,oe&&re.emit("error",oe),J.prefinished=!0,re.emit("prefinish"),ce(re,J)})}function ce(re,J){var oe=X(J);return oe&&(function(we,se){se.prefinished||se.finalCalled||(typeof we._final=="function"?(se.pendingcb++,se.finalCalled=!0,l.nextTick(ae,we,se)):(se.prefinished=!0,we.emit("prefinish")))}(re,J),J.pendingcb===0&&(J.finished=!0,re.emit("finish"))),oe}m.inherits(N,b),P.prototype.getBuffer=function(){for(var re=this.bufferedRequest,J=[];re;)J.push(re),re=re.next;return J},function(){try{Object.defineProperty(P.prototype,"buffer",{get:x.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(y=Function.prototype[Symbol.hasInstance],Object.defineProperty(N,Symbol.hasInstance,{value:function(re){return!!y.call(this,re)||this===N&&re&&re._writableState instanceof P}})):y=function(re){return re instanceof this},N.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},N.prototype.write=function(re,J,oe){var we=this._writableState,se=!1,ue=!we.objectMode&&function(Y){return C.isBuffer(Y)||Y instanceof _}(re);return ue&&!C.isBuffer(re)&&(re=function(Y){return C.from(Y)}(re)),typeof J=="function"&&(oe=J,J=null),ue?J="buffer":J||(J=we.defaultEncoding),typeof oe!="function"&&(oe=O),we.ended?function(Y,k){var z=new Error("write after end");Y.emit("error",z),l.nextTick(k,z)}(this,oe):(ue||function(Y,k,z,H){var I=!0,j=!1;return z===null?j=new TypeError("May not write null values to stream"):typeof z=="string"||z===void 0||k.objectMode||(j=new TypeError("Invalid non-string/buffer chunk")),j&&(Y.emit("error",j),l.nextTick(H,j),I=!1),I}(this,we,re,oe))&&(we.pendingcb++,se=function(Y,k,z,H,I,j){if(!z){var q=function(he,ve,D){return he.objectMode||he.decodeStrings===!1||typeof ve!="string"||(ve=C.from(ve,D)),ve}(k,H,I);H!==q&&(z=!0,I="buffer",H=q)}var ee=k.objectMode?1:H.length;k.length+=ee;var le=k.length-1))throw new TypeError("Unknown encoding: "+re);return this._writableState.defaultEncoding=re,this},Object.defineProperty(N.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),N.prototype._write=function(re,J,oe){oe(new Error("_write() is not implemented"))},N.prototype._writev=null,N.prototype.end=function(re,J,oe){var we=this._writableState;typeof re=="function"?(oe=re,re=null,J=null):typeof J=="function"&&(oe=J,J=null),re!=null&&this.write(re,J),we.corked&&(we.corked=1,this.uncork()),we.ending||function(se,ue,Y){ue.ending=!0,ce(se,ue),Y&&(ue.finished?l.nextTick(Y):se.once("finish",Y)),ue.ended=!0,se.writable=!1}(this,we,oe)},Object.defineProperty(N.prototype,"destroyed",{get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(re){this._writableState&&(this._writableState.destroyed=re)}}),N.prototype.destroy=A.destroy,N.prototype._undestroy=A.undestroy,N.prototype._destroy=function(re,J){this.end(),J(re)}}).call(this,n(5),n(21).setImmediate,n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(r,i){if(!i.eol&&r){for(var o=0,l=r.length;o{var{cx:r,cy:i,innerRadius:o,outerRadius:l,startAngle:c,endAngle:f}=e,h=(c+f)/2;if(n==="outside"){var{x:m,y}=Kn(r,i,l+t,h);return{x:m,y,textAnchor:m>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var x=(o+l)/2,{x:b,y:C}=Kn(r,i,x,h);return{x:b,y:C,textAnchor:"middle",verticalAnchor:"middle"}},Yw=e=>"cx"in e&&Xe(e.cx),wde=(e,t)=>{var{parentViewBox:n,offset:r,position:i}=e,o;n!=null&&!Yw(n)&&(o=n);var{x:l,y:c,upperWidth:f,lowerWidth:h,height:m}=t,y=l,x=l+(f-h)/2,b=(y+x)/2,C=(f+h)/2,_=y+f/2,A=m>=0?1:-1,O=A*r,P=A>0?"end":"start",N=A>0?"start":"end",F=f>=0?1:-1,U=F*r,W=F>0?"end":"start",X=F>0?"start":"end";if(i==="top"){var ae={x:y+f/2,y:c-O,textAnchor:"middle",verticalAnchor:P};return zn(zn({},ae),o?{height:Math.max(c-o.y,0),width:f}:{})}if(i==="bottom"){var ce={x:x+h/2,y:c+m+O,textAnchor:"middle",verticalAnchor:N};return zn(zn({},ce),o?{height:Math.max(o.y+o.height-(c+m),0),width:h}:{})}if(i==="left"){var re={x:b-U,y:c+m/2,textAnchor:W,verticalAnchor:"middle"};return zn(zn({},re),o?{width:Math.max(re.x-o.x,0),height:m}:{})}if(i==="right"){var J={x:b+C+U,y:c+m/2,textAnchor:X,verticalAnchor:"middle"};return zn(zn({},J),o?{width:Math.max(o.x+o.width-J.x,0),height:m}:{})}var oe=o?{width:C,height:m}:{};return i==="insideLeft"?zn({x:b+U,y:c+m/2,textAnchor:X,verticalAnchor:"middle"},oe):i==="insideRight"?zn({x:b+C-U,y:c+m/2,textAnchor:W,verticalAnchor:"middle"},oe):i==="insideTop"?zn({x:y+f/2,y:c+O,textAnchor:"middle",verticalAnchor:N},oe):i==="insideBottom"?zn({x:x+h/2,y:c+m-O,textAnchor:"middle",verticalAnchor:P},oe):i==="insideTopLeft"?zn({x:y+U,y:c+O,textAnchor:X,verticalAnchor:N},oe):i==="insideTopRight"?zn({x:y+f-U,y:c+O,textAnchor:W,verticalAnchor:N},oe):i==="insideBottomLeft"?zn({x:x+U,y:c+m-O,textAnchor:X,verticalAnchor:P},oe):i==="insideBottomRight"?zn({x:x+h-U,y:c+m-O,textAnchor:W,verticalAnchor:P},oe):i&&typeof i=="object"&&(Xe(i.x)||Qo(i.x))&&(Xe(i.y)||Qo(i.y))?zn({x:l+kr(i.x,C),y:c+kr(i.y,m),textAnchor:"end",verticalAnchor:"end"},oe):zn({x:_,y:c+m/2,textAnchor:"middle",verticalAnchor:"middle"},oe)},_de={offset:5,zIndex:Un.label};function il(e){var t=sr(e,_de),{viewBox:n,position:r,value:i,children:o,content:l,className:c="",textBreakAll:f,labelRef:h}=t,m=gde(),y=XI(),x=r==="center"?y:m??y,b,C,_;if(n==null?b=x:Yw(n)?b=n:b=yk(n),!b||yn(i)&&yn(o)&&!w.isValidElement(l)&&typeof l!="function")return null;var A=zn(zn({},t),{},{viewBox:b});if(w.isValidElement(l)){var{labelRef:O}=A,P=cde(A,ude);return w.cloneElement(l,P)}if(typeof l=="function"){if(C=w.createElement(l,A),w.isValidElement(C))return C}else C=vde(t);var N=zr(t);if(Yw(b)){if(r==="insideStart"||r==="insideEnd"||r==="end")return bde(t,r,C,N,b);_=xde(b,t.offset,t.position)}else _=wde(t,b);return w.createElement(Kr,{zIndex:t.zIndex},w.createElement(c0,Uo({ref:h,className:Oe("recharts-label",c)},N,_,{textAnchor:ide(N.textAnchor)?N.textAnchor:_.textAnchor,breakAll:f}),C))}il.displayName="Label";var Sde=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?w.createElement(il,Uo({key:"label-implicit"},r)):ci(e)?w.createElement(il,Uo({key:"label-implicit",value:e},r)):w.isValidElement(e)?e.type===il?w.cloneElement(e,zn({key:"label-implicit"},r)):w.createElement(il,Uo({key:"label-implicit",content:e},r)):$C(e)?w.createElement(il,Uo({key:"label-implicit",content:e},r)):e&&typeof e=="object"?w.createElement(il,Uo({},e,{key:"label-implicit"},r)):null};function QI(e){var{label:t,labelRef:n}=e,r=XI();return Sde(t,r,n)||null}var f2={},d2={},l5;function Cde(){return l5||(l5=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n[n.length-1]}e.last=t}(d2)),d2}var h2={},u5;function Ede(){return u5||(u5=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Array.isArray(n)?n:Array.from(n)}e.toArray=t}(h2)),h2}var c5;function Ade(){return c5||(c5=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Cde(),n=Ede(),r=AS();function i(o){if(r.isArrayLike(o))return t.last(n.toArray(o))}e.last=i}(f2)),f2}var m2,f5;function Tde(){return f5||(f5=1,m2=Ade().last),m2}var Ode=Tde();const jde=aa(Ode);var Mde=["valueAccessor"],Pde=["dataKey","clockWise","id","textBreakAll","zIndex"];function Bv(){return Bv=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?jde(e.value):e.value,JI=w.createContext(void 0),e7=JI.Provider,t7=w.createContext(void 0),Rde=t7.Provider;function Dde(){return w.useContext(JI)}function kde(){return w.useContext(t7)}function Fg(e){var{valueAccessor:t=Nde}=e,n=d5(e,Mde),{dataKey:r,clockWise:i,id:o,textBreakAll:l,zIndex:c}=n,f=d5(n,Pde),h=Dde(),m=kde(),y=h||m;return!y||!y.length?null:w.createElement(Kr,{zIndex:c??Un.label},w.createElement(ar,{className:"recharts-label-list"},y.map((x,b)=>{var C,_=yn(r)?t(x,b):nn(x&&x.payload,r),A=yn(o)?{}:{id:"".concat(o,"-").concat(b)};return w.createElement(il,Bv({key:"label-".concat(b)},zr(x),f,A,{fill:(C=n.fill)!==null&&C!==void 0?C:x.fill,parentViewBox:x.parentViewBox,value:_,textBreakAll:l,viewBox:x.viewBox,index:b,zIndex:0}))})))}Fg.displayName="LabelList";function VC(e){var{label:t}=e;return t?t===!0?w.createElement(Fg,{key:"labelList-implicit"}):w.isValidElement(t)||$C(t)?w.createElement(Fg,{key:"labelList-implicit",content:t}):typeof t=="object"?w.createElement(Fg,Bv({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function Ww(){return Ww=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,o=Oe("recharts-dot",i);return Xe(t)&&Xe(n)&&Xe(r)?w.createElement("circle",Ww({},Di(e),ES(e),{className:o,cx:t,cy:n,r})):null},r7=e=>e.graphicalItems.polarItems,Ide=Ce([bn,vm],dC),f0=Ce([r7,En,Ide],hC),zde=Ce([f0],mC),d0=Ce([zde,tC],pC),Ude=Ce([d0,En,f0],vC);Ce([d0,En,f0],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(i=>{var o,l=nn(r,(o=t.dataKey)!==null&&o!==void 0?o:i.dataKey);return{value:l,errorDomain:[]}})).filter(Boolean):t?.dataKey!=null?e.map(r=>({value:nn(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var h5=()=>{},Bde=Ce([d0,En,f0,o0,bn],wC),Fde=Ce([En,bC,xC,h5,Bde,h5,Mt,bn],_C),i7=Ce([En,Mt,d0,Ude,gm,bn,Fde],SC),$de=Ce([i7,En,Bf],AC);Ce([En,i7,$de,bn],OC);var Vde={radiusAxis:{},angleAxis:{}},a7=jt({name:"polarAxis",initialState:Vde,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:b_e,removeRadiusAxis:x_e,addAngleAxis:w_e,removeAngleAxis:__e}=a7.actions,Hde=a7.reducer;function m5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function p5(e){for(var t=1;tt,HC=Ce([r7,Wde],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),Kde=[],qC=(e,t,n)=>n?.length===0?Kde:n,o7=Ce([tC,HC,qC],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i;if(t?.data!=null&&t.data.length>0?i=t.data:i=r,(!i||!i.length)&&n!=null&&(i=n.map(o=>p5(p5({},t.presentationProps),o.props))),i!=null)return i}}),Zde=Ce([o7,HC,qC],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,i)=>{var o,l=nn(r,t.nameKey,t.name),c;return n!=null&&(o=n[i])!==null&&o!==void 0&&(o=o.props)!==null&&o!==void 0&&o.fill?c=n[i].props.fill:typeof r=="object"&&r!=null&&"fill"in r?c=r.fill:c=t.fill,{value:Rf(l,t.dataKey),color:c,payload:r,type:t.legendType}})}),Xde=Ce([o7,HC,qC,lr],(e,t,n,r)=>{if(!(t==null||e==null))return Zhe({offset:r,pieSettings:t,displayedData:e,cells:n})}),p2={exports:{}},Ft={};var g5;function Qde(){if(g5)return Ft;g5=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,h=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,y=e?Symbol.for("react.suspense"):60113,x=e?Symbol.for("react.suspense_list"):60120,b=e?Symbol.for("react.memo"):60115,C=e?Symbol.for("react.lazy"):60116,_=e?Symbol.for("react.block"):60121,A=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,P=e?Symbol.for("react.scope"):60119;function N(U){if(typeof U=="object"&&U!==null){var W=U.$$typeof;switch(W){case t:switch(U=U.type,U){case f:case h:case r:case o:case i:case y:return U;default:switch(U=U&&U.$$typeof,U){case c:case m:case C:case b:case l:return U;default:return W}}case n:return W}}}function F(U){return N(U)===h}return Ft.AsyncMode=f,Ft.ConcurrentMode=h,Ft.ContextConsumer=c,Ft.ContextProvider=l,Ft.Element=t,Ft.ForwardRef=m,Ft.Fragment=r,Ft.Lazy=C,Ft.Memo=b,Ft.Portal=n,Ft.Profiler=o,Ft.StrictMode=i,Ft.Suspense=y,Ft.isAsyncMode=function(U){return F(U)||N(U)===f},Ft.isConcurrentMode=F,Ft.isContextConsumer=function(U){return N(U)===c},Ft.isContextProvider=function(U){return N(U)===l},Ft.isElement=function(U){return typeof U=="object"&&U!==null&&U.$$typeof===t},Ft.isForwardRef=function(U){return N(U)===m},Ft.isFragment=function(U){return N(U)===r},Ft.isLazy=function(U){return N(U)===C},Ft.isMemo=function(U){return N(U)===b},Ft.isPortal=function(U){return N(U)===n},Ft.isProfiler=function(U){return N(U)===o},Ft.isStrictMode=function(U){return N(U)===i},Ft.isSuspense=function(U){return N(U)===y},Ft.isValidElementType=function(U){return typeof U=="string"||typeof U=="function"||U===r||U===h||U===o||U===i||U===y||U===x||typeof U=="object"&&U!==null&&(U.$$typeof===C||U.$$typeof===b||U.$$typeof===l||U.$$typeof===c||U.$$typeof===m||U.$$typeof===A||U.$$typeof===O||U.$$typeof===P||U.$$typeof===_)},Ft.typeOf=N,Ft}var v5;function Jde(){return v5||(v5=1,p2.exports=Qde()),p2.exports}var ehe=Jde(),y5=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",b5=null,g2=null,s7=e=>{if(e===b5&&Array.isArray(g2))return g2;var t=[];return w.Children.forEach(e,n=>{yn(n)||(ehe.isFragment(n)?t=t.concat(s7(n.props.children)):t.push(n))}),g2=t,b5=e,t};function GC(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>y5(i)):r=[y5(t)],s7(e).forEach(i=>{var o=Vu(i,"type.displayName")||Vu(i,"type.name");o&&r.indexOf(o)!==-1&&n.push(i)}),n}var l7=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,v2={},x5;function the(){return x5||(x5=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const i=n[Symbol.toStringTag];return i==null||!Object.getOwnPropertyDescriptor(n,Symbol.toStringTag)?.writable?!1:n.toString()===`[object ${i}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t}(v2)),v2}var y2,w5;function nhe(){return w5||(w5=1,y2=the().isPlainObject),y2}var rhe=nhe();const ihe=aa(rhe);function _5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function S5(e){for(var t=1;t{var o=n-r,l;return l="M ".concat(e,",").concat(t),l+="L ".concat(e+n,",").concat(t),l+="L ".concat(e+n-o/2,",").concat(t+i),l+="L ".concat(e+n-o/2-r,",").concat(t+i),l+="L ".concat(e,",").concat(t," Z"),l},lhe={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},uhe=e=>{var t=sr(e,lhe),{x:n,y:r,upperWidth:i,lowerWidth:o,height:l,className:c}=t,{animationEasing:f,animationDuration:h,animationBegin:m,isUpdateAnimationActive:y}=t,x=w.useRef(null),[b,C]=w.useState(-1),_=w.useRef(i),A=w.useRef(o),O=w.useRef(l),P=w.useRef(n),N=w.useRef(r),F=fm(e,"trapezoid-");if(w.useEffect(()=>{if(x.current&&x.current.getTotalLength)try{var se=x.current.getTotalLength();se&&C(se)}catch{}},[]),n!==+n||r!==+r||i!==+i||o!==+o||l!==+l||i===0&&o===0||l===0)return null;var U=Oe("recharts-trapezoid",c);if(!y)return w.createElement("g",null,w.createElement("path",Fv({},zr(t),{className:U,d:C5(n,r,i,o,l)})));var W=_.current,X=A.current,ae=O.current,ce=P.current,re=N.current,J="0px ".concat(b===-1?1:b,"px"),oe="".concat(b,"px 0px"),we=Ak(["strokeDasharray"],h,f);return w.createElement(cm,{animationId:F,key:F,canBegin:b>0,duration:h,easing:f,isActive:y,begin:m},se=>{var ue=mn(W,i,se),Y=mn(X,o,se),k=mn(ae,l,se),z=mn(ce,n,se),H=mn(re,r,se);x.current&&(_.current=ue,A.current=Y,O.current=k,P.current=z,N.current=H);var I=se>0?{transition:we,strokeDasharray:oe}:{strokeDasharray:J};return w.createElement("path",Fv({},zr(t),{className:U,d:C5(z,H,ue,Y,k),ref:x,style:S5(S5({},I),t.style)}))})},che=["option","shapeType","propTransformer","activeClassName","isActive"];function fhe(e,t){if(e==null)return{};var n,r,i=dhe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r{var n=cn();return(r,i)=>o=>{e?.(r,i,o),n(pI({activeIndex:String(i),activeDataKey:t,activeCoordinate:r.tooltipPosition}))}},KC=e=>{var t=cn();return(n,r)=>i=>{e?.(n,r,i),t(kue())}},ZC=(e,t)=>{var n=cn();return(r,i)=>o=>{e?.(r,i,o),n(Iue({activeIndex:String(i),activeDataKey:t,activeCoordinate:r.tooltipPosition}))}};function XC(e){var{fn:t,args:n}=e,r=cn(),i=jr();return w.useLayoutEffect(()=>{if(!i){var o=t(n);return r(Nue(o)),()=>{r(Rue(o))}}},[t,n,r,i]),null}function u7(e){var{legendPayload:t}=e,n=cn(),r=jr();return w.useLayoutEffect(()=>r?Ju:(n(Sk(t)),()=>{n(Ck(t))}),[n,r,t]),null}function bhe(e){var{legendPayload:t}=e,n=cn(),r=Ze(Mt);return w.useLayoutEffect(()=>r!=="centric"&&r!=="radial"?Ju:(n(Sk(t)),()=>{n(Ck(t))}),[n,r,t]),null}var b2,xhe=()=>{var[e]=w.useState(()=>Ih("uid-"));return e},whe=(b2=u_.useId)!==null&&b2!==void 0?b2:xhe;function c7(e,t){var n=whe();return t||(e?"".concat(e,"-").concat(n):n)}var _he=w.createContext(void 0),QC=e=>{var{id:t,type:n,children:r}=e,i=c7("recharts-".concat(n),t);return w.createElement(_he.Provider,{value:i},r(i))},She={cartesianItems:[],polarItems:[]},f7=jt({name:"graphicalItems",initialState:She,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:ir()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Vo(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:ir()},removeCartesianGraphicalItem:{reducer(e,t){var n=Vo(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:ir()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:ir()},removePolarGraphicalItem:{reducer(e,t){var n=Vo(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:ir()}}}),{addCartesianGraphicalItem:Che,replaceCartesianGraphicalItem:Ehe,removeCartesianGraphicalItem:Ahe,addPolarGraphicalItem:The,removePolarGraphicalItem:Ohe}=f7.actions,jhe=f7.reducer;function d7(e){var t=cn(),n=w.useRef(null);return w.useLayoutEffect(()=>{n.current===null?t(Che(e)):n.current!==e&&t(Ehe({prev:n.current,next:e})),n.current=e},[t,e]),w.useLayoutEffect(()=>()=>{n.current&&(t(Ahe(n.current)),n.current=null)},[t]),null}function Mhe(e){var t=cn();return w.useLayoutEffect(()=>(t(The(e)),()=>{t(Ohe(e))}),[t,e]),null}var Phe=["onMouseEnter","onClick","onMouseLeave"],Lhe=["id"],Nhe=["id"];function JC(e,t){if(e==null)return{};var n,r,i=Rhe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;rGC(e.children,ul),[e.children]),n=Ze(r=>Zde(r,e.id,t));return n==null?null:w.createElement(bhe,{legendPayload:n})}function Uhe(e){var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:o,fill:l,name:c,hide:f,tooltipType:h}=e;return{dataDefinedOnItem:r.map(m=>m.tooltipPayload),positions:r.map(m=>m.tooltipPosition),settings:{stroke:i,strokeWidth:o,fill:l,dataKey:t,nameKey:n,name:Rf(c,t),hide:f,type:h,color:l,unit:""}}}var Bhe=(e,t)=>e>t?"start":ekr(typeof t=="function"?t(e):t,n,n*.8),$he=(e,t,n)=>{var{top:r,left:i,width:o,height:l}=t,c=Mk(o,l),f=i+kr(e.cx,o,o/2),h=r+kr(e.cy,l,l/2),m=kr(e.innerRadius,c,0),y=Fhe(n,e.outerRadius,c),x=e.maxRadius||Math.sqrt(o*o+l*l)/2;return{cx:f,cy:h,innerRadius:m,outerRadius:y,maxRadius:x}},Vhe=(e,t)=>{var n=yr(t-e),r=Math.min(Math.abs(t-e),360);return n*r};function Hhe(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var qhe=(e,t)=>{if(w.isValidElement(e))return w.cloneElement(e,t);if(typeof e=="function")return e(t);var n=Oe("recharts-pie-label-line",typeof e!="boolean"?e.className:"");return w.createElement(MS,El({},t,{type:"linear",className:n}))},Ghe=(e,t,n)=>{if(w.isValidElement(e))return w.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),w.isValidElement(r)))return r;var i=Oe("recharts-pie-label-text",Hhe(e));return w.createElement(c0,El({},t,{alignmentBaseline:"middle",className:i}),r)};function Yhe(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:o,dataKey:l}=n;if(!r||!i||!t)return null;var c=Di(n),f=$u(i),h=$u(o),m=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,y=t.map((x,b)=>{var C=(x.startAngle+x.endAngle)/2,_=Kn(x.cx,x.cy,x.outerRadius+m,C),A=pn(pn(pn(pn({},c),x),{},{stroke:"none"},f),{},{index:b,textAnchor:Bhe(_.x,x.cx)},_),O=pn(pn(pn(pn({},c),x),{},{fill:"none",stroke:x.fill},h),{},{index:b,points:[Kn(x.cx,x.cy,x.outerRadius,C),_],key:"line"});return w.createElement(Kr,{zIndex:Un.label,key:"label-".concat(x.startAngle,"-").concat(x.endAngle,"-").concat(x.midAngle,"-").concat(b)},w.createElement(ar,null,o&&qhe(o,O),Ghe(i,A,nn(x,l))))});return w.createElement(ar,{className:"recharts-pie-labels"},y)}function Whe(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i=="object"&&i!=null&&"position"in i?w.createElement(VC,{label:i}):w.createElement(Yhe,{sectors:t,props:n,showLabels:r})}function Khe(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i}=e,o=Ze(Cl),{onMouseEnter:l,onClick:c,onMouseLeave:f}=i,h=JC(i,Phe),m=WC(l,i.dataKey),y=KC(f),x=ZC(c,i.dataKey);return t==null||t.length===0?null:w.createElement(w.Fragment,null,t.map((b,C)=>{if(b?.startAngle===0&&b?.endAngle===0&&t.length!==1)return null;var _=n&&String(C)===o,A=o?r:null,O=_?n:A,P=pn(pn({},b),{},{stroke:b.stroke,tabIndex:-1,[hk]:C,[mk]:i.dataKey});return w.createElement(ar,El({key:"sector-".concat(b?.startAngle,"-").concat(b?.endAngle,"-").concat(b.midAngle,"-").concat(C),tabIndex:-1,className:"recharts-pie-sector"},Iy(h,b,C),{onMouseEnter:m(b,C),onMouseLeave:y(b,C),onClick:x(b,C)}),w.createElement(YC,El({option:O,isActive:_,shapeType:"sector"},P)))}))}function Zhe(e){var t,{pieSettings:n,displayedData:r,cells:i,offset:o}=e,{cornerRadius:l,startAngle:c,endAngle:f,dataKey:h,nameKey:m,tooltipType:y}=n,x=Math.abs(n.minAngle),b=Vhe(c,f),C=Math.abs(b),_=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,A=r.filter(W=>nn(W,h,0)!==0).length,O=(C>=360?A:A-1)*_,P=C-A*x-O,N=r.reduce((W,X)=>{var ae=nn(X,h,0);return W+(Xe(ae)?ae:0)},0),F;if(N>0){var U;F=r.map((W,X)=>{var ae=nn(W,h,0),ce=nn(W,m,X),re=$he(n,o,W),J=(Xe(ae)?ae:0)/N,oe,we=pn(pn({},W),i&&i[X]&&i[X].props);X?oe=U.endAngle+yr(b)*_*(ae!==0?1:0):oe=c;var se=oe+yr(b)*((ae!==0?x:0)+J*P),ue=(oe+se)/2,Y=(re.innerRadius+re.outerRadius)/2,k=[{name:ce,value:ae,payload:we,dataKey:h,type:y}],z=Kn(re.cx,re.cy,Y,ue);return U=pn(pn(pn(pn({},n.presentationProps),{},{percent:J,cornerRadius:typeof l=="string"?parseFloat(l):l,name:ce,tooltipPayload:k,midAngle:ue,middleRadius:Y,tooltipPosition:z},we),re),{},{value:ae,startAngle:oe,endAngle:se,payload:we,paddingAngle:yr(b)*_}),U})}return F}function Xhe(e){var{showLabels:t,sectors:n,children:r}=e,i=w.useMemo(()=>!t||!n?[]:n.map(o=>({value:o.value,payload:o.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:o.cx,cy:o.cy,innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,clockWise:!1},fill:o.fill})),[n,t]);return w.createElement(Rde,{value:t?i:void 0},r)}function Qhe(e){var{props:t,previousSectorsRef:n}=e,{sectors:r,isAnimationActive:i,animationBegin:o,animationDuration:l,animationEasing:c,activeShape:f,inactiveShape:h,onAnimationStart:m,onAnimationEnd:y}=t,x=fm(t,"recharts-pie-"),b=n.current,[C,_]=w.useState(!1),A=w.useCallback(()=>{typeof y=="function"&&y(),_(!1)},[y]),O=w.useCallback(()=>{typeof m=="function"&&m(),_(!0)},[m]);return w.createElement(Xhe,{showLabels:!C,sectors:r},w.createElement(cm,{animationId:x,begin:o,duration:l,isActive:i,easing:c,onAnimationStart:O,onAnimationEnd:A,key:x},P=>{var N=[],F=r&&r[0],U=F?.startAngle;return r?.forEach((W,X)=>{var ae=b&&b[X],ce=X>0?Vu(W,"paddingAngle",0):0;if(ae){var re=mn(ae.endAngle-ae.startAngle,W.endAngle-W.startAngle,P),J=pn(pn({},W),{},{startAngle:U+ce,endAngle:U+re+ce});N.push(J),U=J.endAngle}else{var{endAngle:oe,startAngle:we}=W,se=mn(0,oe-we,P),ue=pn(pn({},W),{},{startAngle:U+ce,endAngle:U+se+ce});N.push(ue),U=ue.endAngle}}),n.current=N,w.createElement(ar,null,w.createElement(Khe,{sectors:N,activeShape:f,inactiveShape:h,allOtherPieProps:t}))}),w.createElement(Whe,{showLabels:!C,sectors:r,props:t}),t.children)}var Jhe={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:!Ml.isSsr,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:Un.area};function eme(e){var{id:t}=e,n=JC(e,Lhe),{hide:r,className:i,rootTabIndex:o}=e,l=w.useMemo(()=>GC(e.children,ul),[e.children]),c=Ze(m=>Xde(m,t,l)),f=w.useRef(null),h=Oe("recharts-pie",i);return r||c==null?(f.current=null,w.createElement(ar,{tabIndex:o,className:h})):w.createElement(Kr,{zIndex:e.zIndex},w.createElement(XC,{fn:Uhe,args:pn(pn({},e),{},{sectors:c})}),w.createElement(ar,{tabIndex:o,className:h},w.createElement(Qhe,{props:pn(pn({},n),{},{sectors:c}),previousSectorsRef:f})))}function Kw(e){var t=sr(e,Jhe),{id:n}=t,r=JC(t,Nhe),i=Di(r);return w.createElement(QC,{id:n,type:"pie"},o=>w.createElement(w.Fragment,null,w.createElement(Mhe,{type:"pie",id:o,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),w.createElement(zhe,El({},r,{id:o})),w.createElement(eme,El({},r,{id:o}))))}Kw.displayName="Pie";var tme=["points"];function O5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function x2(e){for(var t=1;t{var A,O,P=x2(x2(x2({r:3},l),y),{},{index:_,cx:(A=C.x)!==null&&A!==void 0?A:void 0,cy:(O=C.y)!==null&&O!==void 0?O:void 0,dataKey:o,value:C.value,payload:C.payload,points:t});return w.createElement(sme,{key:"dot-".concat(_),option:n,dotProps:P,className:i})}),b={};return c&&f!=null&&(b.clipPath="url(#clipPath-".concat(m?"":"dots-").concat(f,")")),w.createElement(Kr,{zIndex:h},w.createElement(ar,Vv({className:r},b),x))}function j5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function M5(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),wme=Ce([xme,us,cs],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),e3=()=>Ze(wme),_me=()=>Ze(Sce);function P5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function w2(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:o}=e;if(i===!1||t.x==null||t.y==null)return null;var l={index:n,dataKey:o,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=w2(w2(w2({},l),$u(i)),ES(i)),f;return w.isValidElement(i)?f=w.cloneElement(i,c):typeof i=="function"?f=i(c):f=w.createElement(n7,c),w.createElement(ar,{className:"recharts-active-dot"},f)};function Tme(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,zIndex:o=Un.activeDot}=e,l=Ze(Cl),c=_me();if(t==null||c==null)return null;var f=t.find(h=>c.includes(h.payload));return yn(f)?null:w.createElement(Kr,{zIndex:o},w.createElement(Ame,{point:f,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r}))}var Ome="Invariant failed";function jme(e,t){throw new Error(Ome)}var Mme=["x","y"];function Zw(){return Zw=Object.assign?Object.assign.bind():function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:0;return(r,i)=>{if(Xe(t))return t;var o=Xe(r)||yn(r);return o?t(r,i):(o||jme(),n)}},zme={},m7=jt({name:"errorBars",initialState:zme,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(o=>o.dataKey===r.dataKey&&o.direction===r.direction?i:o))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:E_e,replaceErrorBar:A_e,removeErrorBar:T_e}=m7.actions,Ume=m7.reducer,Bme=["children"];function Fme(e,t){if(e==null)return{};var n,r,i=$me(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0},Hme=w.createContext(Vme);function p7(e){var{children:t}=e,n=Fme(e,Bme);return w.createElement(Hme.Provider,{value:n},t)}function t3(e,t){var n,r,i=Ze(h=>ds(h,e)),o=Ze(h=>hs(h,t)),l=(n=i?.allowDataOverflow)!==null&&n!==void 0?n:Ci.allowDataOverflow,c=(r=o?.allowDataOverflow)!==null&&r!==void 0?r:Ei.allowDataOverflow,f=l||c;return{needClip:f,needClipX:l,needClipY:c}}function g7(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=e3(),{needClipX:o,needClipY:l,needClip:c}=t3(t,n);if(!c||!i)return null;var{x:f,y:h,width:m,height:y}=i;return w.createElement("clipPath",{id:"clipPath-".concat(r)},w.createElement("rect",{x:o?f:f-m/2,y:l?h:h-y/2,width:o?m:m*2,height:l?y:y*2}))}function qme(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&Bn(e.zIndex)?e.zIndex:t}var Gme=["onMouseEnter","onMouseLeave","onClick"],Yme=["value","background","tooltipPosition"],Wme=["id"],Kme=["onMouseEnter","onClick","onMouseLeave"];function rs(){return rs=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,fill:r,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:r,value:Rf(n,t),payload:e}]};function tpe(e){var{dataKey:t,stroke:n,strokeWidth:r,fill:i,name:o,hide:l,unit:c}=e;return{dataDefinedOnItem:void 0,positions:void 0,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:Rf(o,t),hide:l,type:e.tooltipType,color:e.fill,unit:c}}}function npe(e){var t=Ze(Cl),{data:n,dataKey:r,background:i,allOtherBarProps:o}=e,{onMouseEnter:l,onMouseLeave:c,onClick:f}=o,h=qv(o,Gme),m=WC(l,r),y=KC(c),x=ZC(f,r);if(!i||n==null)return null;var b=$u(i);return w.createElement(Kr,{zIndex:qme(i,Un.barBackground)},n.map((C,_)=>{var{value:A,background:O,tooltipPosition:P}=C,N=qv(C,Yme);if(!O)return null;var F=m(C,_),U=y(C,_),W=x(C,_),X=Hr(Hr(Hr(Hr(Hr({option:i,isActive:String(_)===t},N),{},{fill:"#eee"},O),b),Iy(h,C,_)),{},{onMouseEnter:F,onMouseLeave:U,onClick:W,dataKey:r,index:_,className:"recharts-bar-background-rectangle"});return w.createElement(Hv,rs({key:"background-bar-".concat(_)},X))}))}function rpe(e){var{showLabels:t,children:n,rects:r}=e,i=r?.map(o=>{var l={x:o.x,y:o.y,width:o.width,lowerWidth:o.width,upperWidth:o.width,height:o.height};return Hr(Hr({},l),{},{value:o.value,payload:o.payload,parentViewBox:o.parentViewBox,viewBox:l,fill:o.fill})});return w.createElement(e7,{value:t?i:void 0},n)}function ipe(e){var{shape:t,activeBar:n,baseProps:r,entry:i,index:o,dataKey:l}=e,c=Ze(Cl),f=Ze(MI),h=n&&String(o)===c&&(f==null||l===f),m=h?n:t;return h?w.createElement(Kr,{zIndex:Un.activeBar},w.createElement(Hv,rs({},r,{name:String(r.name)},i,{isActive:h,option:m,index:o,dataKey:l}))):w.createElement(Hv,rs({},r,{name:String(r.name)},i,{isActive:h,option:m,index:o,dataKey:l}))}function ape(e){var{shape:t,baseProps:n,entry:r,index:i,dataKey:o}=e;return w.createElement(Hv,rs({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:o}))}function ope(e){var t,{data:n,props:r}=e,i=(t=Di(r))!==null&&t!==void 0?t:{},{id:o}=i,l=qv(i,Wme),{shape:c,dataKey:f,activeBar:h}=r,{onMouseEnter:m,onClick:y,onMouseLeave:x}=r,b=qv(r,Kme),C=WC(m,f),_=KC(x),A=ZC(y,f);return n?w.createElement(w.Fragment,null,n.map((O,P)=>w.createElement(ar,rs({key:"rectangle-".concat(O?.x,"-").concat(O?.y,"-").concat(O?.value,"-").concat(P),className:"recharts-bar-rectangle"},Iy(b,O,P),{onMouseEnter:C(O,P),onMouseLeave:_(O,P),onClick:A(O,P)}),h?w.createElement(ipe,{shape:c,activeBar:h,baseProps:l,entry:O,index:P,dataKey:f}):w.createElement(ape,{shape:c,baseProps:l,entry:O,index:P,dataKey:f})))):null}function spe(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:i,isAnimationActive:o,animationBegin:l,animationDuration:c,animationEasing:f,onAnimationEnd:h,onAnimationStart:m}=t,y=n.current,x=fm(t,"recharts-bar-"),[b,C]=w.useState(!1),_=!b,A=w.useCallback(()=>{typeof h=="function"&&h(),C(!1)},[h]),O=w.useCallback(()=>{typeof m=="function"&&m(),C(!0)},[m]);return w.createElement(rpe,{showLabels:_,rects:r},w.createElement(cm,{animationId:x,begin:l,duration:c,isActive:o,easing:f,onAnimationEnd:A,onAnimationStart:O,key:x},P=>{var N=P===1?r:r?.map((F,U)=>{var W=y&&y[U];if(W)return Hr(Hr({},F),{},{x:mn(W.x,F.x,P),y:mn(W.y,F.y,P),width:mn(W.width,F.width,P),height:mn(W.height,F.height,P)});if(i==="horizontal"){var X=mn(0,F.height,P),ae=mn(F.stackedBarStart,F.y,P);return Hr(Hr({},F),{},{y:ae,height:X})}var ce=mn(0,F.width,P),re=mn(F.stackedBarStart,F.x,P);return Hr(Hr({},F),{},{width:ce,x:re})});return P>0&&(n.current=N??null),N==null?null:w.createElement(ar,null,w.createElement(ope,{props:t,data:N}))}),w.createElement(VC,{label:t.label}),t.children)}function lpe(e){var t=w.useRef(null);return w.createElement(spe,{previousRectanglesRef:t,props:e})}var v7=0,upe=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:nn(e,t)}};class cpe extends w.PureComponent{render(){var{hide:t,data:n,dataKey:r,className:i,xAxisId:o,yAxisId:l,needClip:c,background:f,id:h}=this.props;if(t||n==null)return null;var m=Oe("recharts-bar",i),y=h;return w.createElement(ar,{className:m,id:h},c&&w.createElement("defs",null,w.createElement(g7,{clipPathId:y,xAxisId:o,yAxisId:l})),w.createElement(ar,{className:"recharts-bar-rectangles",clipPath:c?"url(#clipPath-".concat(y,")"):void 0},w.createElement(npe,{data:n,dataKey:r,background:f,allOtherBarProps:this.props}),w.createElement(lpe,this.props)))}}var fpe={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",hide:!1,isAnimationActive:!Ml.isSsr,legendType:"rect",minPointSize:v7,xAxisId:0,yAxisId:0,zIndex:Un.bar};function dpe(e){var{xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:o,activeBar:l,animationBegin:c,animationDuration:f,animationEasing:h,isAnimationActive:m}=e,{needClip:y}=t3(t,n),x=um(),b=jr(),C=GC(e.children,ul),_=Ze(P=>Bpe(P,t,n,b,e.id,C));if(x!=="vertical"&&x!=="horizontal")return null;var A,O=_?.[0];return O==null||O.height==null||O.width==null?A=0:A=x==="vertical"?O.height/2:O.width/2,w.createElement(p7,{xAxisId:t,yAxisId:n,data:_,dataPointFormatter:upe,errorBarOffset:A},w.createElement(cpe,rs({},e,{layout:x,needClip:y,data:_,xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:o,activeBar:l,animationBegin:c,animationDuration:f,animationEasing:h,isAnimationActive:m})))}function hpe(e){var{layout:t,barSettings:{dataKey:n,minPointSize:r},pos:i,bandSize:o,xAxis:l,yAxis:c,xAxisTicks:f,yAxisTicks:h,stackedData:m,displayedData:y,offset:x,cells:b,parentViewBox:C,dataStartIndex:_}=e,A=t==="horizontal"?c:l,O=m?A.scale.domain():null,P=Rre({numericAxis:A}),N=A.scale(P);return y.map((F,U)=>{var W,X,ae,ce,re,J;m?W=Ore(m[U+_],O):(W=nn(F,n),Array.isArray(W)||(W=[P,W]));var oe=Ime(r,v7)(W[1],U);if(t==="horizontal"){var we,[se,ue]=[c.scale(W[0]),c.scale(W[1])];X=lM({axis:l,ticks:f,bandSize:o,offset:i.offset,entry:F,index:U}),ae=(we=ue??se)!==null&&we!==void 0?we:void 0,ce=i.size;var Y=se-ue;if(re=Ta(Y)?0:Y,J={x:X,y:x.top,width:ce,height:x.height},Math.abs(oe)>0&&Math.abs(re)0&&Math.abs(ce)w.createElement(w.Fragment,null,w.createElement(u7,{legendPayload:epe(t)}),w.createElement(XC,{fn:tpe,args:t}),w.createElement(d7,{type:"bar",id:r,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:Nre(t.stackId),hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:n}),w.createElement(Kr,{zIndex:t.zIndex},w.createElement(dpe,rs({},t,{id:r})))))}var $g=w.memo(mpe);$g.displayName="Bar";function R5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function bg(e){for(var t=1;tt,bpe=(e,t,n)=>n,xpe=(e,t,n,r)=>r,wpe=(e,t,n,r,i)=>i,Sm=Ce([i0,wpe],(e,t)=>e.filter(n=>n.type==="bar").find(n=>n.id===t)),_pe=Ce([Sm],e=>e?.maxBarSize),Spe=(e,t,n,r,i,o)=>o,D5=(e,t,n)=>{var r=n??e;if(!yn(r))return kr(r,t,0)},Cpe=Ce([Mt,i0,ype,bpe,xpe],(e,t,n,r,i)=>t.filter(o=>e==="horizontal"?o.xAxisId===n:o.yAxisId===r).filter(o=>o.isPanorama===i).filter(o=>o.hide===!1).filter(o=>o.type==="bar")),Epe=(e,t,n,r)=>{var i=Mt(e);return i==="horizontal"?Fw(e,"yAxis",n,r):Fw(e,"xAxis",t,r)},Ape=(e,t,n)=>{var r=Mt(e);return r==="horizontal"?NP(e,"xAxis",t):NP(e,"yAxis",n)},Tpe=(e,t,n)=>{var r={},i=e.filter(t0),o=e.filter(h=>h.stackId==null),l=i.reduce((h,m)=>(h[m.stackId]||(h[m.stackId]=[]),h[m.stackId].push(m),h),r),c=Object.entries(l).map(h=>{var[m,y]=h,x=y.map(C=>C.dataKey),b=D5(t,n,y[0].barSize);return{stackId:m,dataKeys:x,barSize:b}}),f=o.map(h=>{var m=[h.dataKey].filter(x=>x!=null),y=D5(t,n,h.barSize);return{stackId:void 0,dataKeys:m,barSize:y}});return[...c,...f]},Ope=Ce([Cpe,Ale,Ape],Tpe),jpe=(e,t,n,r,i)=>{var o,l,c=Sm(e,t,n,r,i);if(c!=null){var f=Mt(e),h=M8(e),{maxBarSize:m}=c,y=yn(m)?h:m,x,b;return f==="horizontal"?(x=Sl(e,"xAxis",t,r),b=_l(e,"xAxis",t,r)):(x=Sl(e,"yAxis",n,r),b=_l(e,"yAxis",n,r)),(o=(l=pf(x,b,!0))!==null&&l!==void 0?l:y)!==null&&o!==void 0?o:0}},y7=(e,t,n,r)=>{var i=Mt(e),o,l;return i==="horizontal"?(o=Sl(e,"xAxis",t,r),l=_l(e,"xAxis",t,r)):(o=Sl(e,"yAxis",n,r),l=_l(e,"yAxis",n,r)),pf(o,l)};function Mpe(e,t,n,r,i){var o=r.length;if(!(o<1)){var l=kr(e,n,0,!0),c,f=[];if(Bn(r[0].barSize)){var h=!1,m=n/o,y=r.reduce((O,P)=>O+(P.barSize||0),0);y+=(o-1)*l,y>=n&&(y-=(o-1)*l,l=0),y>=n&&m>0&&(h=!0,m*=.9,y=o*m);var x=(n-y)/2>>0,b={offset:x-l,size:0};c=r.reduce((O,P)=>{var N,F={stackId:P.stackId,dataKeys:P.dataKeys,position:{offset:b.offset+b.size+l,size:h?m:(N=P.barSize)!==null&&N!==void 0?N:0}},U=[...O,F];return b=U[U.length-1].position,U},f)}else{var C=kr(t,n,0,!0);n-2*C-(o-1)*l<=0&&(l=0);var _=(n-2*C-(o-1)*l)/o;_>1&&(_>>=0);var A=Bn(i)?Math.min(_,i):_;c=r.reduce((O,P,N)=>[...O,{stackId:P.stackId,dataKeys:P.dataKeys,position:{offset:C+(_+l)*N+(_-A)/2,size:A}}],f)}return c}}var Ppe=(e,t,n,r,i,o,l)=>{var c=yn(l)?t:l,f=Mpe(n,r,i!==o?i:o,e,c);return i!==o&&f!=null&&(f=f.map(h=>bg(bg({},h),{},{position:bg(bg({},h.position),{},{offset:h.position.offset-i/2})}))),f},Lpe=Ce([Ope,M8,Ele,P8,jpe,y7,_pe],Ppe),Npe=(e,t,n,r)=>Sl(e,"xAxis",t,r),Rpe=(e,t,n,r)=>Sl(e,"yAxis",n,r),Dpe=(e,t,n,r)=>_l(e,"xAxis",t,r),kpe=(e,t,n,r)=>_l(e,"yAxis",n,r),Ipe=Ce([Lpe,Sm],(e,t)=>{if(!(e==null||t==null)){var n=e.find(r=>r.stackId===t.stackId&&t.dataKey!=null&&r.dataKeys.includes(t.dataKey));if(n!=null)return n.position}}),zpe=(e,t)=>{var n=cC(t);if(!(!e||n==null||t==null)){var{stackId:r}=t;if(r!=null){var i=e[r];if(i){var{stackedData:o}=i;if(o)return o.find(l=>l.key===n)}}}},Upe=Ce([Epe,Sm],zpe),Bpe=Ce([lr,OS,Npe,Rpe,Dpe,kpe,Ipe,Mt,Xy,y7,Upe,Sm,Spe],(e,t,n,r,i,o,l,c,f,h,m,y,x)=>{var{chartData:b,dataStartIndex:C,dataEndIndex:_}=f;if(!(y==null||l==null||t==null||c!=="horizontal"&&c!=="vertical"||n==null||r==null||i==null||o==null||h==null)){var{data:A}=y,O;if(A!=null&&A.length>0?O=A:O=b?.slice(C,_+1),O!=null)return hpe({layout:c,barSettings:y,pos:l,parentViewBox:t,bandSize:h,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:o,stackedData:m,displayedData:O,offset:e,cells:x,dataStartIndex:C})}}),b7=e=>{var{chartData:t}=e,n=cn(),r=jr();return w.useEffect(()=>r?()=>{}:(n(GP(t)),()=>{n(GP(void 0))}),[t,n,r]),null},k5={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},x7=jt({name:"brush",initialState:k5,reducers:{setBrushSettings(e,t){return t.payload==null?k5:t.payload}}}),{setBrushSettings:O_e}=x7.actions,Fpe=x7.reducer;function I5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function xg(e){for(var t=1;t{var{x:n,y:r}=e,{x:i,y:o}=t;return{x:Math.min(n,i),y:Math.min(r,o),width:Math.abs(i-n),height:Math.abs(o-r)}};class h0{static create(t){return new h0(t)}constructor(t){this.scale=t}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(t){var{bandAware:n,position:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t!==void 0){if(r)switch(r){case"start":return this.scale(t);case"middle":{var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+i}case"end":{var o=this.bandwidth?this.bandwidth():0;return this.scale(t)+o}default:return this.scale(t)}if(n){var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+l}return this.scale(t)}}isInRange(t){var n=this.range(),r=n[0],i=n[n.length-1];return r<=i?t>=r&&t<=i:t>=i&&t<=r}}w7(h0,"EPS",1e-4);var qpe=e=>{var t=Object.keys(e).reduce((n,r)=>xg(xg({},n),{},{[r]:h0.create(e[r])}),{});return xg(xg({},t),{},{apply(n){var{bandAware:r,position:i}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.fromEntries(Object.entries(n).map(o=>{var[l,c]=o;return[l,t[l].apply(c,{bandAware:r,position:i})]}))},isInRange(n){return Object.keys(n).every(r=>t[r].isInRange(n[r]))}})};function Gpe(e){return(e%180+180)%180}var Ype=function(t){var{width:n,height:r}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=Gpe(i),l=o*Math.PI/180,c=Math.atan(r/n),f=l>c&&l{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=Vo(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=Vo(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=Vo(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:j_e,removeDot:M_e,addArea:Kpe,removeArea:Zpe,addLine:P_e,removeLine:L_e}=_7.actions,Xpe=_7.reducer,S7=w.createContext(void 0),Qpe=e=>{var{children:t}=e,[n]=w.useState("".concat(Ih("recharts"),"-clip")),r=e3();if(r==null)return null;var{x:i,y:o,width:l,height:c}=r;return w.createElement(S7.Provider,{value:n},w.createElement("defs",null,w.createElement("clipPath",{id:n},w.createElement("rect",{x:i,y:o,height:c,width:l}))),t)},Jpe=()=>w.useContext(S7);function z5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function U5(e){for(var t=1;t{var{x1:c,x2:f,y1:h,y2:m}=l;if(i==null||o==null)return null;var y=qpe({x:i,y:o}),x={x:e?y.x.apply(c,{position:"start"}):y.x.rangeMin,y:n?y.y.apply(h,{position:"start"}):y.y.rangeMin},b={x:t?y.x.apply(f,{position:"end"}):y.x.rangeMax,y:r?y.y.apply(m,{position:"end"}):y.y.rangeMax};return l.ifOverflow==="discard"&&(!y.isInRange(x)||!y.isInRange(b))?null:Hpe(x,b)},ige=(e,t)=>{var n;return w.isValidElement(e)?n=w.cloneElement(e,t):typeof e=="function"?n=e(t):n=w.createElement(PS,Gv({},t,{className:"recharts-reference-area-rect"})),n};function age(e){var t=cn();return w.useEffect(()=>(t(Kpe(e)),()=>{t(Zpe(e))})),null}function oge(e){var{x1:t,x2:n,y1:r,y2:i,className:o,shape:l,xAxisId:c,yAxisId:f}=e,h=Jpe(),m=jr(),y=Ze(F=>wl(F,"xAxis",c,m)),x=Ze(F=>wl(F,"yAxis",f,m));if(y==null||!x==null)return null;var b=ci(t),C=ci(n),_=ci(r),A=ci(i);if(!b&&!C&&!_&&!A&&!l)return null;var O=rge(b,C,_,A,y,x,e);if(!O&&!l)return null;var P=e.ifOverflow==="hidden",N=P?"url(#".concat(h,")"):void 0;return w.createElement(Kr,{zIndex:e.zIndex},w.createElement(ar,{className:Oe("recharts-reference-area",o)},ige(l,U5(U5({clipPath:N},zr(e)),O)),O!=null&&w.createElement(ZI,Gv({},O,{lowerWidth:O.width,upperWidth:O.width}),w.createElement(QI,{label:e.label}),e.children)))}var sge={ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1,zIndex:Un.area};function C7(e){var t=sr(e,sge);return w.createElement(w.Fragment,null,w.createElement(age,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2}),w.createElement(oge,t))}C7.displayName="ReferenceArea";function bf(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function E7(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],r=0;re*i)return!1;var o=n();return e*(t-e*o/2-r)>=0&&e*(t+e*o/2-i)<=0}function cge(e,t){return E7(e,t+1)}function fge(e,t,n,r,i){for(var o=(r||[]).slice(),{start:l,end:c}=t,f=0,h=1,m=l,y=function(){var C=r?.[f];if(C===void 0)return{v:E7(r,h)};var _=f,A,O=()=>(A===void 0&&(A=n(C,_)),A),P=C.coordinate,N=f===0||Yv(e,P,O,m,c);N||(f=0,m=l,h+=1),N&&(m=P+e*(O()/2+i),f+=h)},x;h<=o.length;)if(x=y(),x)return x.v;return[]}function B5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Nr(e){for(var t=1;t(C===void 0&&(C=n(b,x)),C);if(x===l-1){var A=e*(b.coordinate+e*_()/2-f);o[x]=b=Nr(Nr({},b),{},{tickCoord:A>0?b.coordinate-A*e:b.coordinate})}else o[x]=b=Nr(Nr({},b),{},{tickCoord:b.coordinate});if(b.tickCoord!=null){var O=Yv(e,b.tickCoord,_,c,f);O&&(f=b.tickCoord-e*(_()/2+i),o[x]=Nr(Nr({},b),{},{isShow:!0}))}},m=l-1;m>=0;m--)h(m);return o}function gge(e,t,n,r,i,o){var l=(r||[]).slice(),c=l.length,{start:f,end:h}=t;if(o){var m=r[c-1],y=n(m,c-1),x=e*(m.coordinate+e*y/2-h);if(l[c-1]=m=Nr(Nr({},m),{},{tickCoord:x>0?m.coordinate-x*e:m.coordinate}),m.tickCoord!=null){var b=Yv(e,m.tickCoord,()=>y,f,h);b&&(h=m.tickCoord-e*(y/2+i),l[c-1]=Nr(Nr({},m),{},{isShow:!0}))}}for(var C=o?c-1:c,_=function(P){var N=l[P],F,U=()=>(F===void 0&&(F=n(N,P)),F);if(P===0){var W=e*(N.coordinate-e*U()/2-f);l[P]=N=Nr(Nr({},N),{},{tickCoord:W<0?N.coordinate-W*e:N.coordinate})}else l[P]=N=Nr(Nr({},N),{},{tickCoord:N.coordinate});if(N.tickCoord!=null){var X=Yv(e,N.tickCoord,U,f,h);X&&(f=N.tickCoord+e*(U()/2+i),l[P]=Nr(Nr({},N),{},{isShow:!0}))}},A=0;A{var U=typeof h=="function"?h(N.value,F):N.value;return C==="width"?lge(Sh(U,{fontSize:t,letterSpacing:n}),_,y):Sh(U,{fontSize:t,letterSpacing:n})[C]},O=i.length>=2?yr(i[1].coordinate-i[0].coordinate):1,P=uge(o,O,C);return f==="equidistantPreserveStart"?fge(O,P,A,i,l):(f==="preserveStart"||f==="preserveStartEnd"?b=gge(O,P,A,i,l,f==="preserveStartEnd"):b=pge(O,P,A,i,l),b.filter(N=>N.isShow))}var vge=e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:o=0}=e,l=0;if(t){Array.from(t).forEach(m=>{if(m){var y=m.getBoundingClientRect();y.width>l&&(l=y.width)}});var c=n?n.getBoundingClientRect().width:0,f=i+o,h=l+f+c+(n?r:0);return Math.round(h)}return 0},yge=["axisLine","width","height","className","hide","ticks","axisType"],bge=["viewBox"],xge=["viewBox"];function Xw(e,t){if(e==null)return{};var n,r,i=wge(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r{var{ticks:n=[],tick:r,tickLine:i,stroke:o,tickFormatter:l,unit:c,padding:f,tickTextProps:h,orientation:m,mirror:y,x,y:b,width:C,height:_,tickSize:A,tickMargin:O,fontSize:P,letterSpacing:N,getTicksConfig:F,events:U,axisType:W}=e,X=n3(Wn(Wn({},F),{},{ticks:n}),P,N),ae=Tge(m,y),ce=Oge(m,y),re=Di(F),J=$u(r),oe={};typeof i=="object"&&(oe=i);var we=Wn(Wn({},re),{},{fill:"none"},oe),se=X.map(k=>Wn({entry:k},Age(k,x,b,C,_,m,A,y,O))),ue=se.map(k=>{var{entry:z,line:H}=k;return w.createElement(ar,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(z.value,"-").concat(z.coordinate,"-").concat(z.tickCoord)},i&&w.createElement("line",Gu({},we,H,{className:Oe("recharts-cartesian-axis-tick-line",Vu(i,"className"))})))}),Y=se.map((k,z)=>{var{entry:H,tick:I}=k,j=Wn(Wn(Wn(Wn({textAnchor:ae,verticalAnchor:ce},re),{},{stroke:"none",fill:o},J),I),{},{index:z,payload:H,visibleTicksCount:X.length,tickFormatter:l,padding:f},h);return w.createElement(ar,Gu({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(H.value,"-").concat(H.coordinate,"-").concat(H.tickCoord)},Iy(U,H,z)),r&&w.createElement(jge,{option:r,tickProps:j,value:"".concat(typeof l=="function"?l(H.value,z):H.value).concat(c||"")}))});return w.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(W,"-ticks")},Y.length>0&&w.createElement(Kr,{zIndex:Un.label},w.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(W,"-tick-labels"),ref:t},Y)),ue.length>0&&w.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(W,"-tick-lines")},ue))}),Pge=w.forwardRef((e,t)=>{var{axisLine:n,width:r,height:i,className:o,hide:l,ticks:c,axisType:f}=e,h=Xw(e,yge),[m,y]=w.useState(""),[x,b]=w.useState(""),C=w.useRef(null);w.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var A;return vge({ticks:C.current,label:(A=e.labelRef)===null||A===void 0?void 0:A.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var _=w.useCallback(A=>{if(A){var O=A.getElementsByClassName("recharts-cartesian-axis-tick-value");C.current=O;var P=O[0];if(P){var N=window.getComputedStyle(P),F=N.fontSize,U=N.letterSpacing;(F!==m||U!==x)&&(y(F),b(U))}}},[m,x]);return l||r!=null&&r<=0||i!=null&&i<=0?null:w.createElement(Kr,{zIndex:e.zIndex},w.createElement(ar,{className:Oe("recharts-cartesian-axis",o)},w.createElement(Ege,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:Di(e)}),w.createElement(Mge,{ref:_,axisType:f,events:h,fontSize:m,getTicksConfig:e,height:e.height,letterSpacing:x,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:c,unit:e.unit,width:e.width,x:e.x,y:e.y}),w.createElement(ZI,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},w.createElement(QI,{label:e.label,labelRef:e.labelRef}),e.children)))}),Lge=w.memo(Pge,(e,t)=>{var{viewBox:n}=e,r=Xw(e,bge),{viewBox:i}=t,o=Xw(t,xge);return bf(n,i)&&bf(r,o)}),i3=w.forwardRef((e,t)=>{var n=sr(e,r3);return w.createElement(Lge,Gu({},n,{ref:t}))});i3.displayName="CartesianAxis";var Nge=["x1","y1","x2","y2","key"],Rge=["offset"],Dge=["xAxisId","yAxisId"],kge=["xAxisId","yAxisId"];function $5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Rr(e){for(var t=1;t{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:n,x:r,y:i,width:o,height:l,ry:c}=e;return w.createElement("rect",{x:r,y:i,ry:c,width:o,height:l,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function A7(e){var{option:t,lineItemProps:n}=e,r;if(w.isValidElement(t))r=w.cloneElement(t,n);else if(typeof t=="function")r=t(n);else{var i,{x1:o,y1:l,x2:c,y2:f,key:h}=n,m=Wv(n,Nge),y=(i=Di(m))!==null&&i!==void 0?i:{},{offset:x}=y,b=Wv(y,Rge);r=w.createElement("line",Ou({},b,{x1:o,y1:l,x2:c,y2:f,fill:"none",key:h}))}return r}function $ge(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:o,yAxisId:l}=e,c=Wv(e,Dge),f=i.map((h,m)=>{var y=Rr(Rr({},c),{},{x1:t,y1:h,x2:t+n,y2:h,key:"line-".concat(m),index:m});return w.createElement(A7,{key:"line-".concat(m),option:r,lineItemProps:y})});return w.createElement("g",{className:"recharts-cartesian-grid-horizontal"},f)}function Vge(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:o,yAxisId:l}=e,c=Wv(e,kge),f=i.map((h,m)=>{var y=Rr(Rr({},c),{},{x1:h,y1:t,x2:h,y2:t+n,key:"line-".concat(m),index:m});return w.createElement(A7,{option:r,lineItemProps:y,key:"line-".concat(m)})});return w.createElement("g",{className:"recharts-cartesian-grid-vertical"},f)}function Hge(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:o,height:l,horizontalPoints:c,horizontal:f=!0}=e;if(!f||!t||!t.length||c==null)return null;var h=c.map(y=>Math.round(y+i-i)).sort((y,x)=>y-x);i!==h[0]&&h.unshift(0);var m=h.map((y,x)=>{var b=!h[x+1],C=b?i+l-y:h[x+1]-y;if(C<=0)return null;var _=x%t.length;return w.createElement("rect",{key:"react-".concat(x),y,x:r,height:C,width:o,stroke:"none",fill:t[_],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return w.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},m)}function qge(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:o,width:l,height:c,verticalPoints:f}=e;if(!t||!n||!n.length)return null;var h=f.map(y=>Math.round(y+i-i)).sort((y,x)=>y-x);i!==h[0]&&h.unshift(0);var m=h.map((y,x)=>{var b=!h[x+1],C=b?i+l-y:h[x+1]-y;if(C<=0)return null;var _=x%n.length;return w.createElement("rect",{key:"react-".concat(x),x:y,y:o,width:C,height:c,stroke:"none",fill:n[_],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return w.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},m)}var Gge=(e,t)=>{var{xAxis:n,width:r,height:i,offset:o}=e;return ck(n3(Rr(Rr(Rr({},r3),n),{},{ticks:fk(n),viewBox:{x:0,y:0,width:r,height:i}})),o.left,o.left+o.width,t)},Yge=(e,t)=>{var{yAxis:n,width:r,height:i,offset:o}=e;return ck(n3(Rr(Rr(Rr({},r3),n),{},{ticks:fk(n),viewBox:{x:0,y:0,width:r,height:i}})),o.top,o.top+o.height,t)},Wge={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Un.grid};function a3(e){var t=xk(),n=wk(),r=bk(),i=Rr(Rr({},sr(e,Wge)),{},{x:Xe(e.x)?e.x:r.left,y:Xe(e.y)?e.y:r.top,width:Xe(e.width)?e.width:r.width,height:Xe(e.height)?e.height:r.height}),{xAxisId:o,yAxisId:l,x:c,y:f,width:h,height:m,syncWithTicks:y,horizontalValues:x,verticalValues:b}=i,C=jr(),_=Ze(ce=>RP(ce,"xAxis",o,C)),A=Ze(ce=>RP(ce,"yAxis",l,C));if(!ao(h)||!ao(m)||!Xe(c)||!Xe(f))return null;var O=i.verticalCoordinatesGenerator||Gge,P=i.horizontalCoordinatesGenerator||Yge,{horizontalPoints:N,verticalPoints:F}=i;if((!N||!N.length)&&typeof P=="function"){var U=x&&x.length,W=P({yAxis:A?Rr(Rr({},A),{},{ticks:U?x:A.ticks}):void 0,width:t??h,height:n??m,offset:r},U?!0:y);wv(Array.isArray(W),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof W,"]")),Array.isArray(W)&&(N=W)}if((!F||!F.length)&&typeof O=="function"){var X=b&&b.length,ae=O({xAxis:_?Rr(Rr({},_),{},{ticks:X?b:_.ticks}):void 0,width:t??h,height:n??m,offset:r},X?!0:y);wv(Array.isArray(ae),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof ae,"]")),Array.isArray(ae)&&(F=ae)}return w.createElement(Kr,{zIndex:i.zIndex},w.createElement("g",{className:"recharts-cartesian-grid"},w.createElement(Fge,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),w.createElement(Hge,Ou({},i,{horizontalPoints:N})),w.createElement(qge,Ou({},i,{verticalPoints:F})),w.createElement($ge,Ou({},i,{offset:r,horizontalPoints:N,xAxis:_,yAxis:A})),w.createElement(Vge,Ou({},i,{offset:r,verticalPoints:F,xAxis:_,yAxis:A}))))}a3.displayName="CartesianGrid";var T7=(e,t,n,r)=>Sl(e,"xAxis",t,r),O7=(e,t,n,r)=>_l(e,"xAxis",t,r),j7=(e,t,n,r)=>Sl(e,"yAxis",n,r),M7=(e,t,n,r)=>_l(e,"yAxis",n,r),Kge=Ce([Mt,T7,j7,O7,M7],(e,t,n,r,i)=>jl(e,"xAxis")?pf(t,r,!1):pf(n,i,!1)),Zge=(e,t,n,r,i)=>i;function Xge(e){return e.type==="line"}var Qge=Ce([i0,Zge],(e,t)=>e.filter(Xge).find(n=>n.id===t)),Jge=Ce([Mt,T7,j7,O7,M7,Qge,Kge,Xy],(e,t,n,r,i,o,l,c)=>{var{chartData:f,dataStartIndex:h,dataEndIndex:m}=c;if(!(o==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||l==null)){var{dataKey:y,data:x}=o,b;if(x!=null&&x.length>0?b=x:b=f?.slice(h,m+1),b!=null)return xve({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:y,bandSize:l,displayedData:b})}});function eve(e){var t=$u(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:o}=t,l=Number(i),c=Number(o);return(Number.isNaN(l)||l<0)&&(l=n),(Number.isNaN(c)||c<0)&&(c=r),{r:l,strokeWidth:c}}return{r:n,strokeWidth:r}}var tve=["id"],nve=["type","layout","connectNulls","needClip","shape"],rve=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function qh(){return qh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:r,value:Rf(n,t),payload:e}]};function uve(e){var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:o,name:l,hide:c,unit:f}=e;return{dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:o,dataKey:t,nameKey:void 0,name:Rf(l,t),hide:c,type:e.tooltipType,color:e.stroke,unit:f}}}var P7=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function cve(e,t){for(var n=e.length%2!==0?[...e,0]:e,r=[],i=0;i{var r=n.reduce((y,x)=>y+x);if(!r)return P7(t,e);for(var i=Math.floor(e/r),o=e%r,l=t-e,c=[],f=0,h=0;fo){c=[...n.slice(0,f),o-h];break}var m=c.length%2===0?[0,l]:[l];return[...cve(n,i),...c,...m].map(y=>"".concat(y,"px")).join(", ")};function dve(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:o,needClip:l}=r,{id:c}=r,f=o3(r,tve),h=Di(f);return w.createElement(ume,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:o,baseProps:h,needClip:l,clipPathId:t})}function hve(e){var{showLabels:t,children:n,points:r}=e,i=w.useMemo(()=>r?.map(o=>{var l,c,f={x:(l=o.x)!==null&&l!==void 0?l:0,y:(c=o.y)!==null&&c!==void 0?c:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Qa(Qa({},f),{},{value:o.value,payload:o.payload,viewBox:f,parentViewBox:void 0,fill:void 0})}),[r]);return w.createElement(e7,{value:t?i:void 0},n)}function H5(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:o}=e,{type:l,layout:c,connectNulls:f,needClip:h,shape:m}=o,y=o3(o,nve),x=Qa(Qa({},zr(y)),{},{fill:"none",className:"recharts-line-curve",clipPath:h?"url(#clipPath-".concat(t,")"):void 0,points:r,type:l,layout:c,connectNulls:f,strokeDasharray:i??o.strokeDasharray});return w.createElement(w.Fragment,null,r?.length>1&&w.createElement(YC,qh({shapeType:"curve",option:m},x,{pathRef:n})),w.createElement(dve,{points:r,clipPathId:t,props:o}))}function mve(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function pve(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:o}=e,{points:l,strokeDasharray:c,isAnimationActive:f,animationBegin:h,animationDuration:m,animationEasing:y,animateNewValues:x,width:b,height:C,onAnimationEnd:_,onAnimationStart:A}=n,O=i.current,P=fm(n,"recharts-line-"),[N,F]=w.useState(!1),U=!N,W=w.useCallback(()=>{typeof _=="function"&&_(),F(!1)},[_]),X=w.useCallback(()=>{typeof A=="function"&&A(),F(!0)},[A]),ae=mve(r.current),ce=o.current;return w.createElement(hve,{points:l,showLabels:U},n.children,w.createElement(cm,{animationId:P,begin:h,duration:m,isActive:f,easing:y,onAnimationEnd:W,onAnimationStart:X,key:P},re=>{var J=mn(ce,ae+ce,re),oe=Math.min(J,ae),we;if(f)if(c){var se="".concat(c).split(/[,\s]+/gim).map(k=>parseFloat(k));we=fve(oe,ae,se)}else we=P7(ae,oe);else we=c==null?void 0:String(c);if(O){var ue=O.length/l.length,Y=re===1?l:l.map((k,z)=>{var H=Math.floor(z*ue);if(O[H]){var I=O[H];return Qa(Qa({},k),{},{x:mn(I.x,k.x,re),y:mn(I.y,k.y,re)})}return x?Qa(Qa({},k),{},{x:mn(b*2,k.x,re),y:mn(C/2,k.y,re)}):Qa(Qa({},k),{},{x:k.x,y:k.y})});return i.current=Y,w.createElement(H5,{props:n,points:Y,clipPathId:t,pathRef:r,strokeDasharray:we})}return re>0&&ae>0&&(i.current=l,o.current=oe),w.createElement(H5,{props:n,points:l,clipPathId:t,pathRef:r,strokeDasharray:we})}),w.createElement(VC,{label:n.label}))}function gve(e){var{clipPathId:t,props:n}=e,r=w.useRef(null),i=w.useRef(0),o=w.useRef(null);return w.createElement(pve,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:o})}var vve=(e,t)=>{var n,r;return{x:(n=e.x)!==null&&n!==void 0?n:void 0,y:(r=e.y)!==null&&r!==void 0?r:void 0,value:e.value,errorVal:nn(e.payload,t)}};class yve extends w.Component{render(){var{hide:t,dot:n,points:r,className:i,xAxisId:o,yAxisId:l,top:c,left:f,width:h,height:m,id:y,needClip:x,zIndex:b}=this.props;if(t)return null;var C=Oe("recharts-line",i),_=y,{r:A,strokeWidth:O}=eve(n),P=l7(n),N=A*2+O;return w.createElement(Kr,{zIndex:b},w.createElement(ar,{className:C},x&&w.createElement("defs",null,w.createElement(g7,{clipPathId:_,xAxisId:o,yAxisId:l}),!P&&w.createElement("clipPath",{id:"clipPath-dots-".concat(_)},w.createElement("rect",{x:f-N/2,y:c-N/2,width:h+N,height:m+N}))),w.createElement(p7,{xAxisId:o,yAxisId:l,data:r,dataPointFormatter:vve,errorBarOffset:0},w.createElement(gve,{props:this.props,clipPathId:_}))),w.createElement(Tme,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey}))}}var L7={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:!Ml.isSsr,label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Un.line};function bve(e){var t=sr(e,L7),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:o,animationEasing:l,connectNulls:c,dot:f,hide:h,isAnimationActive:m,label:y,legendType:x,xAxisId:b,yAxisId:C,id:_}=t,A=o3(t,rve),{needClip:O}=t3(b,C),P=e3(),N=um(),F=jr(),U=Ze(re=>Jge(re,b,C,F,_));if(N!=="horizontal"&&N!=="vertical"||U==null||P==null)return null;var{height:W,width:X,x:ae,y:ce}=P;return w.createElement(yve,qh({},A,{id:_,connectNulls:c,dot:f,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:o,animationEasing:l,isAnimationActive:m,hide:h,label:y,legendType:x,xAxisId:b,yAxisId:C,points:U,layout:N,height:W,width:X,left:ae,top:ce,needClip:O}))}function xve(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:o,dataKey:l,bandSize:c,displayedData:f}=e;return f.map((h,m)=>{var y=nn(h,l);if(t==="horizontal"){var x=sM({axis:n,ticks:i,bandSize:c,entry:h,index:m}),b=yn(y)?null:r.scale(y);return{x,y:b,value:y,payload:h}}var C=yn(y)?null:n.scale(y),_=sM({axis:r,ticks:o,bandSize:c,entry:h,index:m});return C==null||_==null?null:{x:C,y:_,value:y,payload:h}}).filter(Boolean)}function wve(e){var t=sr(e,L7),n=jr();return w.createElement(QC,{id:t.id,type:"line"},r=>w.createElement(w.Fragment,null,w.createElement(u7,{legendPayload:lve(t)}),w.createElement(XC,{fn:uve,args:t}),w.createElement(d7,{type:"line",id:r,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),w.createElement(bve,qh({},t,{id:r}))))}var N7=w.memo(wve);N7.displayName="Line";var _ve=["dangerouslySetInnerHTML","ticks"],Sve=["id"],Cve=["domain"],Eve=["domain"];function Qw(){return Qw=Object.assign?Object.assign.bind():function(e){for(var t=1;t(t(mme(e)),()=>{t(pme(e))}),[e,t]),null}var Ove=e=>{var{xAxisId:t,className:n}=e,r=Ze(OS),i=jr(),o="xAxis",l=Ze(A=>wl(A,o,t,i)),c=Ze(A=>uI(A,o,t,i)),f=Ze(A=>aI(A,t)),h=Ze(A=>Sue(A,t)),m=Ze(A=>U8(A,t));if(f==null||h==null||m==null)return null;var{dangerouslySetInnerHTML:y,ticks:x}=e,b=Kv(e,_ve),{id:C}=m,_=Kv(m,Sve);return w.createElement(i3,Qw({},b,_,{scale:l,x:h.x,y:h.y,width:f.width,height:f.height,className:Oe("recharts-".concat(o," ").concat(o),n),viewBox:r,ticks:c,axisType:o}))},jve={allowDataOverflow:Ci.allowDataOverflow,allowDecimals:Ci.allowDecimals,allowDuplicatedCategory:Ci.allowDuplicatedCategory,height:Ci.height,hide:!1,mirror:Ci.mirror,orientation:Ci.orientation,padding:Ci.padding,reversed:Ci.reversed,scale:Ci.scale,tickCount:Ci.tickCount,type:Ci.type,xAxisId:0},Mve=e=>{var t,n,r,i,o,l=sr(e,jve);return w.createElement(w.Fragment,null,w.createElement(Tve,{interval:(t=l.interval)!==null&&t!==void 0?t:"preserveEnd",id:l.xAxisId,scale:l.scale,type:l.type,padding:l.padding,allowDataOverflow:l.allowDataOverflow,domain:l.domain,dataKey:l.dataKey,allowDuplicatedCategory:l.allowDuplicatedCategory,allowDecimals:l.allowDecimals,tickCount:l.tickCount,includeHidden:(n=l.includeHidden)!==null&&n!==void 0?n:!1,reversed:l.reversed,ticks:l.ticks,height:l.height,orientation:l.orientation,mirror:l.mirror,hide:l.hide,unit:l.unit,name:l.name,angle:(r=l.angle)!==null&&r!==void 0?r:0,minTickGap:(i=l.minTickGap)!==null&&i!==void 0?i:5,tick:(o=l.tick)!==null&&o!==void 0?o:!0,tickFormatter:l.tickFormatter}),w.createElement(Ove,l))},Pve=(e,t)=>{var{domain:n}=e,r=Kv(e,Cve),{domain:i}=t,o=Kv(t,Eve);return bf(r,o)?Array.isArray(n)&&n.length===2&&Array.isArray(i)&&i.length===2?n[0]===i[0]&&n[1]===i[1]:bf({domain:n},{domain:i}):!1},s3=w.memo(Mve,Pve);s3.displayName="XAxis";var Lve=["dangerouslySetInnerHTML","ticks"],Nve=["id"],Rve=["domain"],Dve=["domain"];function Jw(){return Jw=Object.assign?Object.assign.bind():function(e){for(var t=1;t(t(gme(e)),()=>{t(vme(e))}),[e,t]),null}var zve=e=>{var{yAxisId:t,className:n,width:r,label:i}=e,o=w.useRef(null),l=w.useRef(null),c=Ze(OS),f=jr(),h=cn(),m="yAxis",y=Ze(U=>wl(U,m,t,f)),x=Ze(U=>oI(U,t)),b=Ze(U=>Eue(U,t)),C=Ze(U=>uI(U,m,t,f)),_=Ze(U=>B8(U,t));if(w.useLayoutEffect(()=>{if(!(r!=="auto"||!x||$C(i)||w.isValidElement(i)||_==null)){var U=o.current;if(U){var W=U.getCalculatedWidth();Math.round(x.width)!==Math.round(W)&&h(yme({id:t,width:W}))}}},[C,x,h,i,t,r,_]),x==null||b==null||_==null)return null;var{dangerouslySetInnerHTML:A,ticks:O}=e,P=Zv(e,Lve),{id:N}=_,F=Zv(_,Nve);return w.createElement(i3,Jw({},P,F,{ref:o,labelRef:l,scale:y,x:b.x,y:b.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:x.width,height:x.height,className:Oe("recharts-".concat(m," ").concat(m),n),viewBox:c,ticks:C,axisType:m}))},Uve={allowDataOverflow:Ei.allowDataOverflow,allowDecimals:Ei.allowDecimals,allowDuplicatedCategory:Ei.allowDuplicatedCategory,hide:!1,mirror:Ei.mirror,orientation:Ei.orientation,padding:Ei.padding,reversed:Ei.reversed,scale:Ei.scale,tickCount:Ei.tickCount,type:Ei.type,width:Ei.width,yAxisId:0},Bve=e=>{var t,n,r,i,o,l=sr(e,Uve);return w.createElement(w.Fragment,null,w.createElement(Ive,{interval:(t=l.interval)!==null&&t!==void 0?t:"preserveEnd",id:l.yAxisId,scale:l.scale,type:l.type,domain:l.domain,allowDataOverflow:l.allowDataOverflow,dataKey:l.dataKey,allowDuplicatedCategory:l.allowDuplicatedCategory,allowDecimals:l.allowDecimals,tickCount:l.tickCount,padding:l.padding,includeHidden:(n=l.includeHidden)!==null&&n!==void 0?n:!1,reversed:l.reversed,ticks:l.ticks,width:l.width,orientation:l.orientation,mirror:l.mirror,hide:l.hide,unit:l.unit,name:l.name,angle:(r=l.angle)!==null&&r!==void 0?r:0,minTickGap:(i=l.minTickGap)!==null&&i!==void 0?i:5,tick:(o=l.tick)!==null&&o!==void 0?o:!0,tickFormatter:l.tickFormatter}),w.createElement(zve,l))},Fve=(e,t)=>{var{domain:n}=e,r=Zv(e,Rve),{domain:i}=t,o=Zv(t,Dve);return bf(r,o)?Array.isArray(n)&&n.length===2&&Array.isArray(i)&&i.length===2?n[0]===i[0]&&n[1]===i[1]:bf({domain:n},{domain:i}):!1},l3=w.memo(Bve,Fve);l3.displayName="YAxis";var $ve=(e,t)=>t,u3=Ce([$ve,Mt,I8,cr,AI,ms,kce,lr],Vce),c3=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},R7=un("mouseClick"),D7=am();D7.startListening({actionCreator:R7,effect:(e,t)=>{var n=e.payload,r=u3(t.getState(),c3(n));r?.activeIndex!=null&&t.dispatch(zue({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var e_=un("mouseMove"),k7=am();k7.startListening({actionCreator:e_,effect:(e,t)=>{var n=e.payload,r=t.getState(),i=PC(r,r.tooltip.settings.shared),o=u3(r,c3(n));i==="axis"&&(o?.activeIndex!=null?t.dispatch(vI({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(gI()))}});var q5={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0},I7=jt({name:"rootProps",initialState:q5,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:q5.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue}}}),Vve=I7.reducer,{updateOptions:Hve}=I7.actions,z7=jt({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:qve}=z7.actions,Gve=z7.reducer,U7=un("keyDown"),B7=un("focus"),f3=am();f3.startListening({actionCreator:U7,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,o=e.payload;if(!(o!=="ArrowRight"&&o!=="ArrowLeft"&&o!=="Enter")){var l=Number(LC(i,$f(n))),c=ms(n);if(o==="Enter"){var f=Uv(n,"axis","hover",String(i.index));t.dispatch(Vw({active:!i.active,activeIndex:i.index,activeDataKey:i.dataKey,activeCoordinate:f}));return}var h=jue(n),m=h==="left-to-right"?1:-1,y=o==="ArrowRight"?1:-1,x=l+y*m;if(!(c==null||x>=c.length||x<0)){var b=Uv(n,"axis","hover",String(x));t.dispatch(Vw({active:!0,activeIndex:x.toString(),activeDataKey:void 0,activeCoordinate:b}))}}}}});f3.startListening({actionCreator:B7,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var o="0",l=Uv(n,"axis","hover",String(o));t.dispatch(Vw({activeDataKey:void 0,active:!0,activeIndex:o,activeCoordinate:l}))}}}});var ea=un("externalEvent"),F7=am();F7.startListening({actionCreator:ea,effect:(e,t)=>{if(e.payload.handler!=null){var n=t.getState(),r={activeCoordinate:xce(n),activeDataKey:MI(n),activeIndex:Cl(n),activeLabel:jI(n),activeTooltipIndex:Cl(n),isTooltipActive:wce(n)};e.payload.handler(r,e.payload.reactEvent)}}});var Yve=Ce([Ff],e=>e.tooltipItemPayloads),Wve=Ce([Yve,wm,(e,t,n)=>t,(e,t,n)=>n],(e,t,n,r)=>{var i=e.find(c=>c.settings.dataKey===r);if(i!=null){var{positions:o}=i;if(o!=null){var l=t(o,n);return l}}}),$7=un("touchMove"),V7=am();V7.startListening({actionCreator:$7,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),i=PC(r,r.tooltip.settings.shared);if(i==="axis"){var o=u3(r,c3({clientX:n.touches[0].clientX,clientY:n.touches[0].clientY,currentTarget:n.currentTarget}));o?.activeIndex!=null&&t.dispatch(vI({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var l,c=n.touches[0];if(document.elementFromPoint==null)return;var f=document.elementFromPoint(c.clientX,c.clientY);if(!f||!f.getAttribute)return;var h=f.getAttribute(hk),m=(l=f.getAttribute(mk))!==null&&l!==void 0?l:void 0,y=Wve(t.getState(),h,m);t.dispatch(pI({activeDataKey:m,activeIndex:h,activeCoordinate:y}))}}}});var Kve=Ty({brush:Fpe,cartesianAxis:bme,chartData:xfe,errorBars:Ume,graphicalItems:jhe,layout:_re,legend:yie,options:pfe,polarAxis:Hde,polarOptions:Gve,referenceElements:Xpe,rootProps:Vve,tooltip:Uue,zIndex:rfe}),Zve=function(t){return sS({reducer:Kve,preloadedState:t,middleware:n=>n({serializableCheck:!1}).concat([D7.middleware,k7.middleware,f3.middleware,F7.middleware,V7.middleware]),enhancers:n=>{var r=n;return typeof n=="function"&&(r=n()),r.concat(B6({type:"raf"}))},devTools:Ml.devToolsEnabled})};function H7(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=jr(),o=w.useRef(null);if(i)return n;o.current==null&&(o.current=Zve(t));var l=TS;return w.createElement(d_,{context:l,store:o.current},n)}function q7(e){var{layout:t,margin:n}=e,r=cn(),i=jr();return w.useEffect(()=>{i||(r(bre(t)),r(yre(n)))},[r,i,t,n]),null}function G7(e){var t=cn();return w.useEffect(()=>{t(Hve(e))},[t,e]),null}function G5(e){var{zIndex:t,isPanorama:n}=e,r=n?"recharts-zindex-panorama-":"recharts-zindex-",i=c7("".concat(r).concat(t)),o=cn();return w.useLayoutEffect(()=>(o(tfe({zIndex:t,elementId:i,isPanorama:n})),()=>{o(nfe({zIndex:t,isPanorama:n}))}),[o,t,i,n]),w.createElement("g",{id:i})}function Y5(e){var{children:t,isPanorama:n}=e,r=Ze(qce);if(!r||r.length===0)return t;var i=r.filter(l=>l<0),o=r.filter(l=>l>0);return w.createElement(w.Fragment,null,i.map(l=>w.createElement(G5,{key:l,zIndex:l,isPanorama:n})),t,o.map(l=>w.createElement(G5,{key:l,zIndex:l,isPanorama:n})))}var Xve=["children"];function Qve(e,t){if(e==null)return{};var n,r,i=Jve(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r{var n=xk(),r=wk(),i=Ek();if(!ao(n)||!ao(r))return null;var{children:o,otherAttributes:l,title:c,desc:f}=e,h,m;return l!=null&&(typeof l.tabIndex=="number"?h=l.tabIndex:h=i?0:void 0,typeof l.role=="string"?m=l.role:m=i?"application":void 0),w.createElement(TD,Xv({},l,{title:c,desc:f,role:m,tabIndex:h,width:n,height:r,style:eye,ref:t}),o)}),nye=e=>{var{children:t}=e,n=Ze($y);if(!n)return null;var{width:r,height:i,y:o,x:l}=n;return w.createElement(TD,{width:r,height:i,x:l,y:o},t)},W5=w.forwardRef((e,t)=>{var{children:n}=e,r=Qve(e,Xve),i=jr();return i?w.createElement(nye,null,w.createElement(Y5,{isPanorama:!0},n)):w.createElement(tye,Xv({ref:t},r),w.createElement(Y5,{isPanorama:!1},n))});function rye(){var e=cn(),[t,n]=w.useState(null),r=Ze(Bre);return w.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),o=i.width/t.offsetWidth;Bn(o)&&o!==r&&e(wre(o))}},[t,e,r]),n}function K5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function iye(e){for(var t=1;t(jfe(),null);function Qv(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var uye=w.forwardRef((e,t)=>{var n,r,i=w.useRef(null),[o,l]=w.useState({containerWidth:Qv((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:Qv((r=e.style)===null||r===void 0?void 0:r.height)}),c=w.useCallback((h,m)=>{l(y=>{var x=Math.round(h),b=Math.round(m);return y.containerWidth===x&&y.containerHeight===b?y:{containerWidth:x,containerHeight:b}})},[]),f=w.useCallback(h=>{if(typeof t=="function"&&t(h),h!=null&&typeof ResizeObserver<"u"){var{width:m,height:y}=h.getBoundingClientRect();c(m,y);var x=C=>{var{width:_,height:A}=C[0].contentRect;c(_,A)},b=new ResizeObserver(x);b.observe(h),i.current=b}},[t,c]);return w.useEffect(()=>()=>{var h=i.current;h?.disconnect()},[c]),w.createElement(w.Fragment,null,w.createElement(Hy,{width:o.containerWidth,height:o.containerHeight}),w.createElement("div",Yu({ref:f},e)))}),cye=w.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,o]=w.useState({containerWidth:Qv(n),containerHeight:Qv(r)}),l=w.useCallback((f,h)=>{o(m=>{var y=Math.round(f),x=Math.round(h);return m.containerWidth===y&&m.containerHeight===x?m:{containerWidth:y,containerHeight:x}})},[]),c=w.useCallback(f=>{if(typeof t=="function"&&t(f),f!=null){var{width:h,height:m}=f.getBoundingClientRect();l(h,m)}},[t,l]);return w.createElement(w.Fragment,null,w.createElement(Hy,{width:i.containerWidth,height:i.containerHeight}),w.createElement("div",Yu({ref:c},e)))}),fye=w.forwardRef((e,t)=>{var{width:n,height:r}=e;return w.createElement(w.Fragment,null,w.createElement(Hy,{width:n,height:r}),w.createElement("div",Yu({ref:t},e)))}),dye=w.forwardRef((e,t)=>{var{width:n,height:r}=e;return Qo(n)||Qo(r)?w.createElement(cye,Yu({},e,{ref:t})):w.createElement(fye,Yu({},e,{ref:t}))});function hye(e){return e===!0?uye:dye}var mye=w.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:o,onContextMenu:l,onDoubleClick:c,onMouseDown:f,onMouseEnter:h,onMouseLeave:m,onMouseMove:y,onMouseUp:x,onTouchEnd:b,onTouchMove:C,onTouchStart:_,style:A,width:O,responsive:P,dispatchTouchEvents:N=!0}=e,F=w.useRef(null),U=cn(),[W,X]=w.useState(null),[ae,ce]=w.useState(null),re=rye(),J=jS(),oe=J?.width>0?J.width:O,we=J?.height>0?J.height:i,se=w.useCallback(R=>{re(R),typeof t=="function"&&t(R),X(R),ce(R),R!=null&&(F.current=R)},[re,t,X,ce]),ue=w.useCallback(R=>{U(R7(R)),U(ea({handler:o,reactEvent:R}))},[U,o]),Y=w.useCallback(R=>{U(e_(R)),U(ea({handler:h,reactEvent:R}))},[U,h]),k=w.useCallback(R=>{U(gI()),U(ea({handler:m,reactEvent:R}))},[U,m]),z=w.useCallback(R=>{U(e_(R)),U(ea({handler:y,reactEvent:R}))},[U,y]),H=w.useCallback(()=>{U(B7())},[U]),I=w.useCallback(R=>{U(U7(R.key))},[U]),j=w.useCallback(R=>{U(ea({handler:l,reactEvent:R}))},[U,l]),q=w.useCallback(R=>{U(ea({handler:c,reactEvent:R}))},[U,c]),ee=w.useCallback(R=>{U(ea({handler:f,reactEvent:R}))},[U,f]),le=w.useCallback(R=>{U(ea({handler:x,reactEvent:R}))},[U,x]),pe=w.useCallback(R=>{U(ea({handler:_,reactEvent:R}))},[U,_]),he=w.useCallback(R=>{N&&U($7(R)),U(ea({handler:C,reactEvent:R}))},[U,N,C]),ve=w.useCallback(R=>{U(ea({handler:b,reactEvent:R}))},[U,b]),D=hye(P);return w.createElement(zI.Provider,{value:W},w.createElement(Lte.Provider,{value:ae},w.createElement(D,{width:oe??A?.width,height:we??A?.height,className:Oe("recharts-wrapper",r),style:iye({position:"relative",cursor:"default",width:oe,height:we},A),onClick:ue,onContextMenu:j,onDoubleClick:q,onFocus:H,onKeyDown:I,onMouseDown:ee,onMouseEnter:Y,onMouseLeave:k,onMouseMove:z,onMouseUp:le,onTouchEnd:ve,onTouchMove:he,onTouchStart:pe,ref:se},w.createElement(lye,null),n)))}),pye=["width","height","responsive","children","className","style","compact","title","desc"];function gye(e,t){if(e==null)return{};var n,r,i=vye(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:o,className:l,style:c,compact:f,title:h,desc:m}=e,y=gye(e,pye),x=Di(y);return f?w.createElement(w.Fragment,null,w.createElement(Hy,{width:n,height:r}),w.createElement(W5,{otherAttributes:x,title:h,desc:m},o)):w.createElement(mye,{className:l,style:c,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},w.createElement(W5,{otherAttributes:x,title:h,desc:m,ref:t},w.createElement(Qpe,null,o)))});function t_(){return t_=Object.assign?Object.assign.bind():function(e){for(var t=1;tw.createElement(W7,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:xye,tooltipPayloadSearcher:BC,categoricalChartProps:e,ref:t}));function _ye(e){var t=cn();return w.useEffect(()=>{t(qve(e))},[t,e]),null}var Sye=["layout"];function n_(){return n_=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=sr(e,Mye);return w.createElement(Oye,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:jye,tooltipPayloadSearcher:BC,categoricalChartProps:n,ref:t})}),Lye=["axis"],Nye=w.forwardRef((e,t)=>w.createElement(W7,{chartName:"ComposedChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Lye,tooltipPayloadSearcher:BC,categoricalChartProps:e,ref:t}));function K7(e,t){const n=w.useRef(t);w.useEffect(function(){t!==n.current&&e.attributionControl!=null&&(n.current!=null&&e.attributionControl.removeAttribution(n.current),t!=null&&e.attributionControl.addAttribution(t)),n.current=t},[e,t])}const Rye=1;function Dye(e){return Object.freeze({__version:Rye,map:e})}function kye(e,t){return Object.freeze({...e,...t})}const d3=w.createContext(null);function Z7(){const e=w.use(d3);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return e}function Iye(e){function t(n,r){const{instance:i,context:o}=e(n).current;w.useImperativeHandle(r,()=>i);const{children:l}=n;return l==null?null:uf.createElement(d3,{value:o},l)}return w.forwardRef(t)}function zye(e){function t(n,r){const[i,o]=w.useState(!1),{instance:l}=e(n,o).current;w.useImperativeHandle(r,()=>l),w.useEffect(function(){i&&l.update()},[l,i,n.children]);const c=l._contentNode;return c?Of.createPortal(n.children,c):null}return w.forwardRef(t)}function Uye(e){function t(n,r){const{instance:i}=e(n).current;return w.useImperativeHandle(r,()=>i),null}return w.forwardRef(t)}function X7(e,t){const n=w.useRef(void 0);w.useEffect(function(){return t!=null&&e.instance.on(t),n.current=t,function(){n.current!=null&&e.instance.off(n.current),n.current=null}},[e,t])}function h3(e,t){const n=e.pane??t.pane;return n?{...e,pane:n}:e}function Bye(e,t){return function(r,i){const o=Z7(),l=e(h3(r,o),o);return K7(o.map,r.attribution),X7(l.current,r.eventHandlers),t(l.current,o,r,i),l}}var gh={exports:{}};var Fye=gh.exports,Z5;function $ye(){return Z5||(Z5=1,function(e,t){(function(n,r){r(t)})(Fye,function(n){var r="1.9.4";function i(u){var p,S,M,B;for(S=1,M=arguments.length;S"u"||!L||!L.Mixin)){u=N(u)?u:[u];for(var p=0;p0?Math.floor(u):Math.ceil(u)};z.prototype={clone:function(){return new z(this.x,this.y)},add:function(u){return this.clone()._add(I(u))},_add:function(u){return this.x+=u.x,this.y+=u.y,this},subtract:function(u){return this.clone()._subtract(I(u))},_subtract:function(u){return this.x-=u.x,this.y-=u.y,this},divideBy:function(u){return this.clone()._divideBy(u)},_divideBy:function(u){return this.x/=u,this.y/=u,this},multiplyBy:function(u){return this.clone()._multiplyBy(u)},_multiplyBy:function(u){return this.x*=u,this.y*=u,this},scaleBy:function(u){return new z(this.x*u.x,this.y*u.y)},unscaleBy:function(u){return new z(this.x/u.x,this.y/u.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=H(this.x),this.y=H(this.y),this},distanceTo:function(u){u=I(u);var p=u.x-this.x,S=u.y-this.y;return Math.sqrt(p*p+S*S)},equals:function(u){return u=I(u),u.x===this.x&&u.y===this.y},contains:function(u){return u=I(u),Math.abs(u.x)<=Math.abs(this.x)&&Math.abs(u.y)<=Math.abs(this.y)},toString:function(){return"Point("+x(this.x)+", "+x(this.y)+")"}};function I(u,p,S){return u instanceof z?u:N(u)?new z(u[0],u[1]):u==null?u:typeof u=="object"&&"x"in u&&"y"in u?new z(u.x,u.y):new z(u,p,S)}function j(u,p){if(u)for(var S=p?[u,p]:u,M=0,B=S.length;M=this.min.x&&S.x<=this.max.x&&p.y>=this.min.y&&S.y<=this.max.y},intersects:function(u){u=q(u);var p=this.min,S=this.max,M=u.min,B=u.max,K=B.x>=p.x&&M.x<=S.x,fe=B.y>=p.y&&M.y<=S.y;return K&&fe},overlaps:function(u){u=q(u);var p=this.min,S=this.max,M=u.min,B=u.max,K=B.x>p.x&&M.xp.y&&M.y=p.lat&&B.lat<=S.lat&&M.lng>=p.lng&&B.lng<=S.lng},intersects:function(u){u=le(u);var p=this._southWest,S=this._northEast,M=u.getSouthWest(),B=u.getNorthEast(),K=B.lat>=p.lat&&M.lat<=S.lat,fe=B.lng>=p.lng&&M.lng<=S.lng;return K&&fe},overlaps:function(u){u=le(u);var p=this._southWest,S=this._northEast,M=u.getSouthWest(),B=u.getNorthEast(),K=B.lat>p.lat&&M.latp.lng&&M.lng1,fn=function(){var u=!1;try{var p=Object.defineProperty({},"passive",{get:function(){u=!0}});window.addEventListener("testPassiveEventSupport",y,p),window.removeEventListener("testPassiveEventSupport",y,p)}catch{}return u}(),Qn=function(){return!!document.createElement("canvas").getContext}(),xn=!!(document.createElementNS&&me("svg").createSVGRect),Jn=!!xn&&function(){var u=document.createElement("div");return u.innerHTML="",(u.firstChild&&u.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),Mn=!xn&&function(){try{var u=document.createElement("div");u.innerHTML='';var p=u.firstChild;return p.style.behavior="url(#default#VML)",p&&typeof p.adj=="object"}catch{return!1}}(),Zr=navigator.platform.indexOf("Mac")===0,Xr=navigator.platform.indexOf("Linux")===0;function Dn(u){return navigator.userAgent.toLowerCase().indexOf(u)>=0}var et={ie:Ee,ielt9:Me,edge:Ue,webkit:ke,android:Ve,android23:ot,androidStock:Qe,opera:We,chrome:ze,gecko:nt,safari:Pt,phantom:at,opera12:Lt,win:Ot,ie3d:gt,webkit3d:$t,gecko3d:On,any3d:vt,mobile:Ui,mobileWebkit:Xn,mobileWebkit3d:Dl,msPointer:Ur,pointer:fo,touch:Bi,touchNative:ho,mobileOpera:Da,mobileGecko:hi,retina:jn,passiveEvents:fn,canvas:Qn,svg:xn,vml:Mn,inlineSvg:Jn,mac:Zr,linux:Xr},Yf=et.msPointer?"MSPointerDown":"pointerdown",Wf=et.msPointer?"MSPointerMove":"pointermove",la=et.msPointer?"MSPointerUp":"pointerup",$n=et.msPointer?"MSPointerCancel":"pointercancel",dr={touchstart:Yf,touchmove:Wf,touchend:la,touchcancel:$n},mo={touchstart:vs,touchmove:Ia,touchend:Ia,touchcancel:Ia},ka={},Pm=!1;function C0(u,p,S){return p==="touchstart"&&gs(),mo[p]?(S=mo[p].bind(this,S),u.addEventListener(dr[p],S,!1),S):(console.warn("wrong event specified:",p),y)}function Lm(u,p,S){if(!dr[p]){console.warn("wrong event specified:",p);return}u.removeEventListener(dr[p],S,!1)}function kl(u){ka[u.pointerId]=u}function Kf(u){ka[u.pointerId]&&(ka[u.pointerId]=u)}function po(u){delete ka[u.pointerId]}function gs(){Pm||(document.addEventListener(Yf,kl,!0),document.addEventListener(Wf,Kf,!0),document.addEventListener(la,po,!0),document.addEventListener($n,po,!0),Pm=!0)}function Ia(u,p){if(p.pointerType!==(p.MSPOINTER_TYPE_MOUSE||"mouse")){p.touches=[];for(var S in ka)p.touches.push(ka[S]);p.changedTouches=[p],u(p)}}function vs(u,p){p.MSPOINTER_TYPE_TOUCH&&p.pointerType===p.MSPOINTER_TYPE_TOUCH&&Pn(p),Ia(u,p)}function Vn(u){var p={},S,M;for(M in u)S=u[M],p[M]=S&&S.bind?S.bind(u):S;return u=p,p.type="dblclick",p.detail=2,p.isTrusted=!1,p._simulated=!0,p}var Nm=200;function Rm(u,p){u.addEventListener("dblclick",p);var S=0,M;function B(K){if(K.detail!==1){M=K.detail;return}if(!(K.pointerType==="mouse"||K.sourceCapabilities&&!K.sourceCapabilities.firesTouchEvents)){var fe=Vl(K);if(!(fe.some(function(Ae){return Ae instanceof HTMLLabelElement&&Ae.attributes.for})&&!fe.some(function(Ae){return Ae instanceof HTMLInputElement||Ae instanceof HTMLSelectElement}))){var be=Date.now();be-S<=Nm?(M++,M===2&&p(Vn(K))):M=1,S=be}}}return u.addEventListener("click",B),{dblclick:p,simDblclick:B}}function go(u,p){u.removeEventListener("dblclick",p.dblclick),u.removeEventListener("click",p.simDblclick)}var za=Ul(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Il=Ul(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Zf=Il==="webkitTransition"||Il==="OTransition"?Il+"End":"transitionend";function Xf(u){return typeof u=="string"?document.getElementById(u):u}function zl(u,p){var S=u.style[p]||u.currentStyle&&u.currentStyle[p];if((!S||S==="auto")&&document.defaultView){var M=document.defaultView.getComputedStyle(u,null);S=M?M[p]:null}return S==="auto"?null:S}function yt(u,p,S){var M=document.createElement(u);return M.className=p||"",S&&S.appendChild(M),M}function Gt(u){var p=u.parentNode;p&&p.removeChild(u)}function Qr(u){for(;u.firstChild;)u.removeChild(u.firstChild)}function er(u){var p=u.parentNode;p&&p.lastChild!==u&&p.appendChild(u)}function vo(u){var p=u.parentNode;p&&p.firstChild!==u&&p.insertBefore(u,p.firstChild)}function Qf(u,p){if(u.classList!==void 0)return u.classList.contains(p);var S=nc(u);return S.length>0&&new RegExp("(^|\\s)"+p+"(\\s|$)").test(S)}function ut(u,p){if(u.classList!==void 0)for(var S=C(p),M=0,B=S.length;M0?2*window.devicePixelRatio:1;function xr(u){return et.edge?u.wheelDeltaY/2:u.deltaY&&u.deltaMode===0?-u.deltaY/Dm:u.deltaY&&u.deltaMode===1?-u.deltaY*20:u.deltaY&&u.deltaMode===2?-u.deltaY*60:u.deltaX||u.deltaZ?0:u.wheelDelta?(u.wheelDeltaY||u.wheelDelta)/2:u.detail&&Math.abs(u.detail)<32765?-u.detail*20:u.detail?u.detail/-32765*60:0}function ca(u,p){var S=p.relatedTarget;if(!S)return!0;try{for(;S&&S!==u;)S=S.parentNode}catch{return!1}return S!==u}var oc={__proto__:null,on:lt,off:Bt,stopPropagation:gi,disableScrollPropagation:$i,disableClickPropagation:bo,preventDefault:Pn,stop:Ba,getPropagationPath:Vl,getMousePosition:Hl,getWheelDelta:xr,isExternalTarget:ca,addListener:lt,removeListener:Bt},Ss=k.extend({run:function(u,p,S,M){this.stop(),this._el=u,this._inProgress=!0,this._duration=S||.25,this._easeOutPower=1/Math.max(M||.5,.2),this._startPos=Ua(u),this._offset=p.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=J(this._animate,this),this._step()},_step:function(u){var p=+new Date-this._startTime,S=this._duration*1e3;pthis.options.maxZoom)?this.setZoom(u):this},panInsideBounds:function(u,p){this._enforcingBounds=!0;var S=this.getCenter(),M=this._limitCenter(S,this._zoom,le(u));return S.equals(M)||this.panTo(M,p),this._enforcingBounds=!1,this},panInside:function(u,p){p=p||{};var S=I(p.paddingTopLeft||p.padding||[0,0]),M=I(p.paddingBottomRight||p.padding||[0,0]),B=this.project(this.getCenter()),K=this.project(u),fe=this.getPixelBounds(),be=q([fe.min.add(S),fe.max.subtract(M)]),Ae=be.getSize();if(!be.contains(K)){this._enforcingBounds=!0;var Ne=K.subtract(be.getCenter()),He=be.extend(K).getSize().subtract(Ae);B.x+=Ne.x<0?-He.x:He.x,B.y+=Ne.y<0?-He.y:He.y,this.panTo(this.unproject(B),p),this._enforcingBounds=!1}return this},invalidateSize:function(u){if(!this._loaded)return this;u=i({animate:!1,pan:!0},u===!0?{animate:!0}:u);var p=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var S=this.getSize(),M=p.divideBy(2).round(),B=S.divideBy(2).round(),K=M.subtract(B);return!K.x&&!K.y?this:(u.animate&&u.pan?this.panBy(K):(u.pan&&this._rawPanBy(K),this.fire("move"),u.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(l(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:p,newSize:S}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(u){if(u=this._locateOptions=i({timeout:1e4,watch:!1},u),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var p=l(this._handleGeolocationResponse,this),S=l(this._handleGeolocationError,this);return u.watch?this._locationWatchId=navigator.geolocation.watchPosition(p,S,u):navigator.geolocation.getCurrentPosition(p,S,u),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(u){if(this._container._leaflet_id){var p=u.code,S=u.message||(p===1?"permission denied":p===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:p,message:"Geolocation error: "+S+"."})}},_handleGeolocationResponse:function(u){if(this._container._leaflet_id){var p=u.coords.latitude,S=u.coords.longitude,M=new pe(p,S),B=M.toBounds(u.coords.accuracy*2),K=this._locateOptions;if(K.setView){var fe=this.getBoundsZoom(B);this.setView(M,K.maxZoom?Math.min(fe,K.maxZoom):fe)}var be={latlng:M,bounds:B,timestamp:u.timestamp};for(var Ae in u.coords)typeof u.coords[Ae]=="number"&&(be[Ae]=u.coords[Ae]);this.fire("locationfound",be)}},addHandler:function(u,p){if(!p)return this;var S=this[u]=new p(this);return this._handlers.push(S),this.options[u]&&S.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),Gt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(oe(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var u;for(u in this._layers)this._layers[u].remove();for(u in this._panes)Gt(this._panes[u]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(u,p){var S="leaflet-pane"+(u?" leaflet-"+u.replace("Pane","")+"-pane":""),M=yt("div",S,p||this._mapPane);return u&&(this._panes[u]=M),M},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var u=this.getPixelBounds(),p=this.unproject(u.getBottomLeft()),S=this.unproject(u.getTopRight());return new ee(p,S)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(u,p,S){u=le(u),S=I(S||[0,0]);var M=this.getZoom()||0,B=this.getMinZoom(),K=this.getMaxZoom(),fe=u.getNorthWest(),be=u.getSouthEast(),Ae=this.getSize().subtract(S),Ne=q(this.project(be,M),this.project(fe,M)).getSize(),He=et.any3d?this.options.zoomSnap:1,tt=Ae.x/Ne.x,ht=Ae.y/Ne.y,tr=p?Math.max(tt,ht):Math.min(tt,ht);return M=this.getScaleZoom(tr,M),He&&(M=Math.round(M/(He/100))*(He/100),M=p?Math.ceil(M/He)*He:Math.floor(M/He)*He),Math.max(B,Math.min(K,M))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new z(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(u,p){var S=this._getTopLeftPoint(u,p);return new j(S,S.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(u){return this.options.crs.getProjectedBounds(u===void 0?this.getZoom():u)},getPane:function(u){return typeof u=="string"?this._panes[u]:u},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(u,p){var S=this.options.crs;return p=p===void 0?this._zoom:p,S.scale(u)/S.scale(p)},getScaleZoom:function(u,p){var S=this.options.crs;p=p===void 0?this._zoom:p;var M=S.zoom(u*S.scale(p));return isNaN(M)?1/0:M},project:function(u,p){return p=p===void 0?this._zoom:p,this.options.crs.latLngToPoint(he(u),p)},unproject:function(u,p){return p=p===void 0?this._zoom:p,this.options.crs.pointToLatLng(I(u),p)},layerPointToLatLng:function(u){var p=I(u).add(this.getPixelOrigin());return this.unproject(p)},latLngToLayerPoint:function(u){var p=this.project(he(u))._round();return p._subtract(this.getPixelOrigin())},wrapLatLng:function(u){return this.options.crs.wrapLatLng(he(u))},wrapLatLngBounds:function(u){return this.options.crs.wrapLatLngBounds(le(u))},distance:function(u,p){return this.options.crs.distance(he(u),he(p))},containerPointToLayerPoint:function(u){return I(u).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(u){return I(u).add(this._getMapPanePos())},containerPointToLatLng:function(u){var p=this.containerPointToLayerPoint(I(u));return this.layerPointToLatLng(p)},latLngToContainerPoint:function(u){return this.layerPointToContainerPoint(this.latLngToLayerPoint(he(u)))},mouseEventToContainerPoint:function(u){return Hl(u,this._container)},mouseEventToLayerPoint:function(u){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(u))},mouseEventToLatLng:function(u){return this.layerPointToLatLng(this.mouseEventToLayerPoint(u))},_initContainer:function(u){var p=this._container=Xf(u);if(p){if(p._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");lt(p,"scroll",this._onScroll,this),this._containerId=f(p)},_initLayout:function(){var u=this._container;this._fadeAnimated=this.options.fadeAnimation&&et.any3d,ut(u,"leaflet-container"+(et.touch?" leaflet-touch":"")+(et.retina?" leaflet-retina":"")+(et.ielt9?" leaflet-oldie":"")+(et.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var p=zl(u,"position");p!=="absolute"&&p!=="relative"&&p!=="fixed"&&p!=="sticky"&&(u.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var u=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Xt(this._mapPane,new z(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ut(u.markerPane,"leaflet-zoom-hide"),ut(u.shadowPane,"leaflet-zoom-hide"))},_resetView:function(u,p,S){Xt(this._mapPane,new z(0,0));var M=!this._loaded;this._loaded=!0,p=this._limitZoom(p),this.fire("viewprereset");var B=this._zoom!==p;this._moveStart(B,S)._move(u,p)._moveEnd(B),this.fire("viewreset"),M&&this.fire("load")},_moveStart:function(u,p){return u&&this.fire("zoomstart"),p||this.fire("movestart"),this},_move:function(u,p,S,M){p===void 0&&(p=this._zoom);var B=this._zoom!==p;return this._zoom=p,this._lastCenter=u,this._pixelOrigin=this._getNewPixelOrigin(u),M?S&&S.pinch&&this.fire("zoom",S):((B||S&&S.pinch)&&this.fire("zoom",S),this.fire("move",S)),this},_moveEnd:function(u){return u&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return oe(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(u){Xt(this._mapPane,this._getMapPanePos().subtract(u))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(u){this._targets={},this._targets[f(this._container)]=this;var p=u?Bt:lt;p(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&p(window,"resize",this._onResize,this),et.any3d&&this.options.transform3DLimit&&(u?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){oe(this._resizeRequest),this._resizeRequest=J(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var u=this._getMapPanePos();Math.max(Math.abs(u.x),Math.abs(u.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(u,p){for(var S=[],M,B=p==="mouseout"||p==="mouseover",K=u.target||u.srcElement,fe=!1;K;){if(M=this._targets[f(K)],M&&(p==="click"||p==="preclick")&&this._draggableMoved(M)){fe=!0;break}if(M&&M.listens(p,!0)&&(B&&!ca(K,u)||(S.push(M),B))||K===this._container)break;K=K.parentNode}return!S.length&&!fe&&!B&&this.listens(p,!0)&&(S=[this]),S},_isClickDisabled:function(u){for(;u&&u!==this._container;){if(u._leaflet_disable_click)return!0;u=u.parentNode}},_handleDOMEvent:function(u){var p=u.target||u.srcElement;if(!(!this._loaded||p._leaflet_disable_events||u.type==="click"&&this._isClickDisabled(p))){var S=u.type;S==="mousedown"&&ws(p),this._fireDOMEvent(u,S)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(u,p,S){if(u.type==="click"){var M=i({},u);M.type="preclick",this._fireDOMEvent(M,M.type,S)}var B=this._findEventTargets(u,p);if(S){for(var K=[],fe=0;fe0?Math.round(u-p)/2:Math.max(0,Math.ceil(u))-Math.max(0,Math.floor(p))},_limitZoom:function(u){var p=this.getMinZoom(),S=this.getMaxZoom(),M=et.any3d?this.options.zoomSnap:1;return M&&(u=Math.round(u/M)*M),Math.max(p,Math.min(S,u))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){dn(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(u,p){var S=this._getCenterOffset(u)._trunc();return(p&&p.animate)!==!0&&!this.getSize().contains(S)?!1:(this.panBy(S,p),!0)},_createAnimProxy:function(){var u=this._proxy=yt("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(u),this.on("zoomanim",function(p){var S=za,M=this._proxy.style[S];ua(this._proxy,this.project(p.center,p.zoom),this.getZoomScale(p.zoom,1)),M===this._proxy.style[S]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Gt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var u=this.getCenter(),p=this.getZoom();ua(this._proxy,this.project(u,p),this.getZoomScale(p,1))},_catchTransitionEnd:function(u){this._animatingZoom&&u.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(u,p,S){if(this._animatingZoom)return!0;if(S=S||{},!this._zoomAnimated||S.animate===!1||this._nothingToAnimate()||Math.abs(p-this._zoom)>this.options.zoomAnimationThreshold)return!1;var M=this.getZoomScale(p),B=this._getCenterOffset(u)._divideBy(1-1/M);return S.animate!==!0&&!this.getSize().contains(B)?!1:(J(function(){this._moveStart(!0,S.noMoveStart||!1)._animateZoom(u,p,!0)},this),!0)},_animateZoom:function(u,p,S,M){this._mapPane&&(S&&(this._animatingZoom=!0,this._animateToCenter=u,this._animateToZoom=p,ut(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:u,zoom:p,noUpdate:M}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(l(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&dn(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function rd(u,p){return new Ct(u,p)}var Br=se.extend({options:{position:"topright"},initialize:function(u){_(this,u)},getPosition:function(){return this.options.position},setPosition:function(u){var p=this._map;return p&&p.removeControl(this),this.options.position=u,p&&p.addControl(this),this},getContainer:function(){return this._container},addTo:function(u){this.remove(),this._map=u;var p=this._container=this.onAdd(u),S=this.getPosition(),M=u._controlCorners[S];return ut(p,"leaflet-control"),S.indexOf("bottom")!==-1?M.insertBefore(p,M.firstChild):M.appendChild(p),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Gt(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(u){this._map&&u&&u.screenX>0&&u.screenY>0&&this._map.getContainer().focus()}}),fa=function(u){return new Br(u)};Ct.include({addControl:function(u){return u.addTo(this),this},removeControl:function(u){return u.remove(),this},_initControlPos:function(){var u=this._controlCorners={},p="leaflet-",S=this._controlContainer=yt("div",p+"control-container",this._container);function M(B,K){var fe=p+B+" "+p+K;u[B+K]=yt("div",fe,S)}M("top","left"),M("top","right"),M("bottom","left"),M("bottom","right")},_clearControlPos:function(){for(var u in this._controlCorners)Gt(this._controlCorners[u]);Gt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ql=Br.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(u,p,S,M){return S1,this._baseLayersList.style.display=u?"":"none"),this._separator.style.display=p&&u?"":"none",this},_onLayerChange:function(u){this._handlingClick||this._update();var p=this._getLayer(f(u.target)),S=p.overlay?u.type==="add"?"overlayadd":"overlayremove":u.type==="add"?"baselayerchange":null;S&&this._map.fire(S,p)},_createRadioElement:function(u,p){var S='",M=document.createElement("div");return M.innerHTML=S,M.firstChild},_addItem:function(u){var p=document.createElement("label"),S=this._map.hasLayer(u.layer),M;u.overlay?(M=document.createElement("input"),M.type="checkbox",M.className="leaflet-control-layers-selector",M.defaultChecked=S):M=this._createRadioElement("leaflet-base-layers_"+f(this),S),this._layerControlInputs.push(M),M.layerId=f(u.layer),lt(M,"click",this._onInputClick,this);var B=document.createElement("span");B.innerHTML=" "+u.name;var K=document.createElement("span");p.appendChild(K),K.appendChild(M),K.appendChild(B);var fe=u.overlay?this._overlaysList:this._baseLayersList;return fe.appendChild(p),this._checkDisabledLayers(),p},_onInputClick:function(){if(!this._preventClick){var u=this._layerControlInputs,p,S,M=[],B=[];this._handlingClick=!0;for(var K=u.length-1;K>=0;K--)p=u[K],S=this._getLayer(p.layerId).layer,p.checked?M.push(S):p.checked||B.push(S);for(K=0;K=0;B--)p=u[B],S=this._getLayer(p.layerId).layer,p.disabled=S.options.minZoom!==void 0&&MS.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var u=this._section;this._preventClick=!0,lt(u,"click",Pn),this.expand();var p=this;setTimeout(function(){Bt(u,"click",Pn),p._preventClick=!1})}}),km=function(u,p,S){return new ql(u,p,S)},id=Br.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(u){var p="leaflet-control-zoom",S=yt("div",p+" leaflet-bar"),M=this.options;return this._zoomInButton=this._createButton(M.zoomInText,M.zoomInTitle,p+"-in",S,this._zoomIn),this._zoomOutButton=this._createButton(M.zoomOutText,M.zoomOutTitle,p+"-out",S,this._zoomOut),this._updateDisabled(),u.on("zoomend zoomlevelschange",this._updateDisabled,this),S},onRemove:function(u){u.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(u){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(u.shiftKey?3:1))},_createButton:function(u,p,S,M,B){var K=yt("a",S,M);return K.innerHTML=u,K.href="#",K.title=p,K.setAttribute("role","button"),K.setAttribute("aria-label",p),bo(K),lt(K,"click",Ba),lt(K,"click",B,this),lt(K,"click",this._refocusOnMap,this),K},_updateDisabled:function(){var u=this._map,p="leaflet-disabled";dn(this._zoomInButton,p),dn(this._zoomOutButton,p),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||u._zoom===u.getMinZoom())&&(ut(this._zoomOutButton,p),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||u._zoom===u.getMaxZoom())&&(ut(this._zoomInButton,p),this._zoomInButton.setAttribute("aria-disabled","true"))}});Ct.mergeOptions({zoomControl:!0}),Ct.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new id,this.addControl(this.zoomControl))});var E0=function(u){return new id(u)},Im=Br.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(u){var p="leaflet-control-scale",S=yt("div",p),M=this.options;return this._addScales(M,p+"-line",S),u.on(M.updateWhenIdle?"moveend":"move",this._update,this),u.whenReady(this._update,this),S},onRemove:function(u){u.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(u,p,S){u.metric&&(this._mScale=yt("div",p,S)),u.imperial&&(this._iScale=yt("div",p,S))},_update:function(){var u=this._map,p=u.getSize().y/2,S=u.distance(u.containerPointToLatLng([0,p]),u.containerPointToLatLng([this.options.maxWidth,p]));this._updateScales(S)},_updateScales:function(u){this.options.metric&&u&&this._updateMetric(u),this.options.imperial&&u&&this._updateImperial(u)},_updateMetric:function(u){var p=this._getRoundNum(u),S=p<1e3?p+" m":p/1e3+" km";this._updateScale(this._mScale,S,p/u)},_updateImperial:function(u){var p=u*3.2808399,S,M,B;p>5280?(S=p/5280,M=this._getRoundNum(S),this._updateScale(this._iScale,M+" mi",M/S)):(B=this._getRoundNum(p),this._updateScale(this._iScale,B+" ft",B/p))},_updateScale:function(u,p,S){u.style.width=Math.round(this.options.maxWidth*S)+"px",u.innerHTML=p},_getRoundNum:function(u){var p=Math.pow(10,(Math.floor(u)+"").length-1),S=u/p;return S=S>=10?10:S>=5?5:S>=3?3:S>=2?2:1,p*S}}),ad=function(u){return new Im(u)},A0='',od=Br.extend({options:{position:"bottomright",prefix:''+(et.inlineSvg?A0+" ":"")+"Leaflet"},initialize:function(u){_(this,u),this._attributions={}},onAdd:function(u){u.attributionControl=this,this._container=yt("div","leaflet-control-attribution"),bo(this._container);for(var p in u._layers)u._layers[p].getAttribution&&this.addAttribution(u._layers[p].getAttribution());return this._update(),u.on("layeradd",this._addAttribution,this),this._container},onRemove:function(u){u.off("layeradd",this._addAttribution,this)},_addAttribution:function(u){u.layer.getAttribution&&(this.addAttribution(u.layer.getAttribution()),u.layer.once("remove",function(){this.removeAttribution(u.layer.getAttribution())},this))},setPrefix:function(u){return this.options.prefix=u,this._update(),this},addAttribution:function(u){return u?(this._attributions[u]||(this._attributions[u]=0),this._attributions[u]++,this._update(),this):this},removeAttribution:function(u){return u?(this._attributions[u]&&(this._attributions[u]--,this._update()),this):this},_update:function(){if(this._map){var u=[];for(var p in this._attributions)this._attributions[p]&&u.push(p);var S=[];this.options.prefix&&S.push(this.options.prefix),u.length&&S.push(u.join(", ")),this._container.innerHTML=S.join(' ')}}});Ct.mergeOptions({attributionControl:!0}),Ct.addInitHook(function(){this.options.attributionControl&&new od().addTo(this)});var T0=function(u){return new od(u)};Br.Layers=ql,Br.Zoom=id,Br.Scale=Im,Br.Attribution=od,fa.layers=km,fa.zoom=E0,fa.scale=ad,fa.attribution=T0;var Vi=se.extend({initialize:function(u){this._map=u},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Vi.addTo=function(u,p){return u.addHandler(p,this),this};var O0={Events:Y},sd=et.touch?"touchstart mousedown":"mousedown",Fa=k.extend({options:{clickTolerance:3},initialize:function(u,p,S,M){_(this,M),this._element=u,this._dragStartTarget=p||u,this._preventOutline=S},enable:function(){this._enabled||(lt(this._dragStartTarget,sd,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Fa._dragging===this&&this.finishDrag(!0),Bt(this._dragStartTarget,sd,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(u){if(this._enabled&&(this._moved=!1,!Qf(this._element,"leaflet-zoom-anim"))){if(u.touches&&u.touches.length!==1){Fa._dragging===this&&this.finishDrag();return}if(!(Fa._dragging||u.shiftKey||u.which!==1&&u.button!==1&&!u.touches)&&(Fa._dragging=this,this._preventOutline&&ws(this._element),rc(),bs(),!this._moving)){this.fire("down");var p=u.touches?u.touches[0]:u,S=ac(this._element);this._startPoint=new z(p.clientX,p.clientY),this._startPos=Ua(this._element),this._parentScale=Fl(S);var M=u.type==="mousedown";lt(document,M?"mousemove":"touchmove",this._onMove,this),lt(document,M?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(u){if(this._enabled){if(u.touches&&u.touches.length>1){this._moved=!0;return}var p=u.touches&&u.touches.length===1?u.touches[0]:u,S=new z(p.clientX,p.clientY)._subtract(this._startPoint);!S.x&&!S.y||Math.abs(S.x)+Math.abs(S.y)K&&(fe=be,K=Ae);K>S&&(p[fe]=1,cd(u,p,S,M,fe),cd(u,p,S,fe,B))}function M0(u,p){for(var S=[u[0]],M=1,B=0,K=u.length;Mp&&(S.push(u[M]),B=M);return Bp.max.x&&(S|=2),u.yp.max.y&&(S|=8),S}function P0(u,p){var S=p.x-u.x,M=p.y-u.y;return S*S+M*M}function Gl(u,p,S,M){var B=p.x,K=p.y,fe=S.x-B,be=S.y-K,Ae=fe*fe+be*be,Ne;return Ae>0&&(Ne=((u.x-B)*fe+(u.y-K)*be)/Ae,Ne>1?(B=S.x,K=S.y):Ne>0&&(B+=fe*Ne,K+=be*Ne)),fe=u.x-B,be=u.y-K,M?fe*fe+be*be:new z(B,K)}function ei(u){return!N(u[0])||typeof u[0][0]!="object"&&typeof u[0][0]<"u"}function lc(u){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),ei(u)}function Cs(u,p){var S,M,B,K,fe,be,Ae,Ne;if(!u||u.length===0)throw new Error("latlngs not passed");ei(u)||(console.warn("latlngs are not flat! Only the first ring will be used"),u=u[0]);var He=he([0,0]),tt=le(u),ht=tt.getNorthWest().distanceTo(tt.getSouthWest())*tt.getNorthEast().distanceTo(tt.getNorthWest());ht<1700&&(He=ld(u));var tr=u.length,Ln=[];for(S=0;SM){Ae=(K-M)/B,Ne=[be.x-Ae*(be.x-fe.x),be.y-Ae*(be.y-fe.y)];break}var Rt=p.unproject(I(Ne));return he([Rt.lat+He.lat,Rt.lng+He.lng])}var L0={__proto__:null,simplify:Bm,pointToSegmentDistance:Fm,closestPointOnSegment:j0,clipSegment:Hm,_getEdgeIntersection:sc,_getBitCode:xo,_sqClosestPointOnSegment:Gl,isFlat:ei,_flat:lc,polylineCenter:Cs},uc={project:function(u){return new z(u.lng,u.lat)},unproject:function(u){return new pe(u.y,u.x)},bounds:new j([-180,-90],[180,90])},cc={R:6378137,R_MINOR:6356752314245179e-9,bounds:new j([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(u){var p=Math.PI/180,S=this.R,M=u.lat*p,B=this.R_MINOR/S,K=Math.sqrt(1-B*B),fe=K*Math.sin(M),be=Math.tan(Math.PI/4-M/2)/Math.pow((1-fe)/(1+fe),K/2);return M=-S*Math.log(Math.max(be,1e-10)),new z(u.lng*p*S,M)},unproject:function(u){for(var p=180/Math.PI,S=this.R,M=this.R_MINOR/S,B=Math.sqrt(1-M*M),K=Math.exp(-u.y/S),fe=Math.PI/2-2*Math.atan(K),be=0,Ae=.1,Ne;be<15&&Math.abs(Ae)>1e-7;be++)Ne=B*Math.sin(fe),Ne=Math.pow((1-Ne)/(1+Ne),B/2),Ae=Math.PI/2-2*Math.atan(K*Ne)-fe,fe+=Ae;return new pe(fe*p,u.x*p/S)}},qm={__proto__:null,LonLat:uc,Mercator:cc,SphericalMercator:G},Gm=i({},D,{code:"EPSG:3395",projection:cc,transformation:function(){var u=.5/(Math.PI*cc.R);return V(u,.5,-u,.5)}()}),fd=i({},D,{code:"EPSG:4326",projection:uc,transformation:V(1/180,1,-1/180,.5)}),Es=i({},ve,{projection:uc,transformation:V(1,0,-1,0),scale:function(u){return Math.pow(2,u)},zoom:function(u){return Math.log(u)/Math.LN2},distance:function(u,p){var S=p.lng-u.lng,M=p.lat-u.lat;return Math.sqrt(S*S+M*M)},infinite:!0});ve.Earth=D,ve.EPSG3395=Gm,ve.EPSG3857=Z,ve.EPSG900913=ne,ve.EPSG4326=fd,ve.Simple=Es;var vi=k.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(u){return u.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(u){return u&&u.removeLayer(this),this},getPane:function(u){return this._map.getPane(u?this.options[u]||u:this.options.pane)},addInteractiveTarget:function(u){return this._map._targets[f(u)]=this,this},removeInteractiveTarget:function(u){return delete this._map._targets[f(u)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(u){var p=u.target;if(p.hasLayer(this)){if(this._map=p,this._zoomAnimated=p._zoomAnimated,this.getEvents){var S=this.getEvents();p.on(S,this),this.once("remove",function(){p.off(S,this)},this)}this.onAdd(p),this.fire("add"),p.fire("layeradd",{layer:this})}}});Ct.include({addLayer:function(u){if(!u._layerAdd)throw new Error("The provided object is not a Layer.");var p=f(u);return this._layers[p]?this:(this._layers[p]=u,u._mapToAdd=this,u.beforeAdd&&u.beforeAdd(this),this.whenReady(u._layerAdd,u),this)},removeLayer:function(u){var p=f(u);return this._layers[p]?(this._loaded&&u.onRemove(this),delete this._layers[p],this._loaded&&(this.fire("layerremove",{layer:u}),u.fire("remove")),u._map=u._mapToAdd=null,this):this},hasLayer:function(u){return f(u)in this._layers},eachLayer:function(u,p){for(var S in this._layers)u.call(p,this._layers[S]);return this},_addLayers:function(u){u=u?N(u)?u:[u]:[];for(var p=0,S=u.length;pthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&p[0]instanceof pe&&p[0].equals(p[S-1])&&p.pop(),p},_setLatLngs:function(u){da.prototype._setLatLngs.call(this,u),ei(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return ei(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var u=this._renderer._bounds,p=this.options.weight,S=new z(p,p);if(u=new j(u.min.subtract(S),u.max.add(S)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(u))){if(this.options.noClip){this._parts=this._rings;return}for(var M=0,B=this._rings.length,K;Mu.y!=B.y>u.y&&u.x<(B.x-M.x)*(u.y-M.y)/(B.y-M.y)+M.x&&(p=!p);return p||da.prototype._containsPoint.call(this,u,!0)}});function D0(u,p){return new Os(u,p)}var ha=Hi.extend({initialize:function(u,p){_(this,p),this._layers={},u&&this.addData(u)},addData:function(u){var p=N(u)?u:u.features,S,M,B;if(p){for(S=0,M=p.length;S0&&B.push(B[0].slice()),B}function $a(u,p){return u.feature?i({},u.feature,{geometry:p}):mc(p)}function mc(u){return u.type==="Feature"||u.type==="FeatureCollection"?u:{type:"Feature",properties:{},geometry:u}}var Va={toGeoJSON:function(u){return $a(this,{type:"Point",coordinates:hc(this.getLatLng(),u)})}};Zl.include(Va),fc.include(Va),Ts.include(Va),da.include({toGeoJSON:function(u){var p=!ei(this._latlngs),S=Ql(this._latlngs,p?1:0,!1,u);return $a(this,{type:(p?"Multi":"")+"LineString",coordinates:S})}}),Os.include({toGeoJSON:function(u){var p=!ei(this._latlngs),S=p&&!ei(this._latlngs[0]),M=Ql(this._latlngs,S?2:p?1:0,!0,u);return p||(M=[M]),$a(this,{type:(S?"Multi":"")+"Polygon",coordinates:M})}}),As.include({toMultiPoint:function(u){var p=[];return this.eachLayer(function(S){p.push(S.toGeoJSON(u).geometry.coordinates)}),$a(this,{type:"MultiPoint",coordinates:p})},toGeoJSON:function(u){var p=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(p==="MultiPoint")return this.toMultiPoint(u);var S=p==="GeometryCollection",M=[];return this.eachLayer(function(B){if(B.toGeoJSON){var K=B.toGeoJSON(u);if(S)M.push(K.geometry);else{var fe=mc(K);fe.type==="FeatureCollection"?M.push.apply(M,fe.features):M.push(fe)}}}),S?$a(this,{geometries:M,type:"GeometryCollection"}):{type:"FeatureCollection",features:M}}});function pc(u,p){return new ha(u,p)}var Jl=pc,Ms=vi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(u,p,S){this._url=u,this._bounds=le(p),_(this,S)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ut(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Gt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(u){return this.options.opacity=u,this._image&&this._updateOpacity(),this},setStyle:function(u){return u.opacity&&this.setOpacity(u.opacity),this},bringToFront:function(){return this._map&&er(this._image),this},bringToBack:function(){return this._map&&vo(this._image),this},setUrl:function(u){return this._url=u,this._image&&(this._image.src=u),this},setBounds:function(u){return this._bounds=le(u),this._map&&this._reset(),this},getEvents:function(){var u={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(u.zoomanim=this._animateZoom),u},setZIndex:function(u){return this.options.zIndex=u,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var u=this._url.tagName==="IMG",p=this._image=u?this._url:yt("img");if(ut(p,"leaflet-image-layer"),this._zoomAnimated&&ut(p,"leaflet-zoom-animated"),this.options.className&&ut(p,this.options.className),p.onselectstart=y,p.onmousemove=y,p.onload=l(this.fire,this,"load"),p.onerror=l(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(p.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),u){this._url=p.src;return}p.src=this._url,p.alt=this.options.alt},_animateZoom:function(u){var p=this._map.getZoomScale(u.zoom),S=this._map._latLngBoundsToNewLayerBounds(this._bounds,u.zoom,u.center).min;ua(this._image,S,p)},_reset:function(){var u=this._image,p=new j(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),S=p.getSize();Xt(u,p.min),u.style.width=S.x+"px",u.style.height=S.y+"px"},_updateOpacity:function(){rn(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var u=this.options.errorOverlayUrl;u&&this._url!==u&&(this._url=u,this._image.src=u)},getCenter:function(){return this._bounds.getCenter()}}),Xm=function(u,p,S){return new Ms(u,p,S)},Ha=Ms.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var u=this._url.tagName==="VIDEO",p=this._image=u?this._url:yt("video");if(ut(p,"leaflet-image-layer"),this._zoomAnimated&&ut(p,"leaflet-zoom-animated"),this.options.className&&ut(p,this.options.className),p.onselectstart=y,p.onmousemove=y,p.onloadeddata=l(this.fire,this,"load"),u){for(var S=p.getElementsByTagName("source"),M=[],B=0;B0?M:[p.src];return}N(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(p.style,"objectFit")&&(p.style.objectFit="fill"),p.autoplay=!!this.options.autoplay,p.loop=!!this.options.loop,p.muted=!!this.options.muted,p.playsInline=!!this.options.playsInline;for(var K=0;KB?(p.height=B+"px",ut(u,K)):dn(u,K),this._containerWidth=this._container.offsetWidth},_animateZoom:function(u){var p=this._map._latLngToNewLayerPoint(this._latlng,u.zoom,u.center),S=this._getAnchor();Xt(this._container,p.add(S))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var u=this._map,p=parseInt(zl(this._container,"marginBottom"),10)||0,S=this._container.offsetHeight+p,M=this._containerWidth,B=new z(this._containerLeft,-S-this._containerBottom);B._add(Ua(this._container));var K=u.layerPointToContainerPoint(B),fe=I(this.options.autoPanPadding),be=I(this.options.autoPanPaddingTopLeft||fe),Ae=I(this.options.autoPanPaddingBottomRight||fe),Ne=u.getSize(),He=0,tt=0;K.x+M+Ae.x>Ne.x&&(He=K.x+M-Ne.x+Ae.x),K.x-He-be.x<0&&(He=K.x-be.x),K.y+S+Ae.y>Ne.y&&(tt=K.y+S-Ne.y+Ae.y),K.y-tt-be.y<0&&(tt=K.y-be.y),(He||tt)&&(this.options.keepInView&&(this._autopanning=!0),u.fire("autopanstart").panBy([He,tt]))}},_getAnchor:function(){return I(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Jm=function(u,p){return new eu(u,p)};Ct.mergeOptions({closePopupOnClick:!0}),Ct.include({openPopup:function(u,p,S){return this._initOverlay(eu,u,p,S).openOn(this),this},closePopup:function(u){return u=arguments.length?u:this._popup,u&&u.close(),this}}),vi.include({bindPopup:function(u,p){return this._popup=this._initOverlay(eu,this._popup,u,p),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(u){return this._popup&&(this instanceof Hi||(this._popup._source=this),this._popup._prepareOpen(u||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(u){return this._popup&&this._popup.setContent(u),this},getPopup:function(){return this._popup},_openPopup:function(u){if(!(!this._popup||!this._map)){Ba(u);var p=u.layer||u.target;if(this._popup._source===p&&!(p instanceof Gi)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(u.latlng);return}this._popup._source=p,this.openPopup(u.latlng)}},_movePopup:function(u){this._popup.setLatLng(u.latlng)},_onKeyPress:function(u){u.originalEvent.keyCode===13&&this._openPopup(u)}});var tu=mr.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(u){mr.prototype.onAdd.call(this,u),this.setOpacity(this.options.opacity),u.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(u){mr.prototype.onRemove.call(this,u),u.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var u=mr.prototype.getEvents.call(this);return this.options.permanent||(u.preclick=this.close),u},_initLayout:function(){var u="leaflet-tooltip",p=u+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=yt("div",p),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+f(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(u){var p,S,M=this._map,B=this._container,K=M.latLngToContainerPoint(M.getCenter()),fe=M.layerPointToContainerPoint(u),be=this.options.direction,Ae=B.offsetWidth,Ne=B.offsetHeight,He=I(this.options.offset),tt=this._getAnchor();be==="top"?(p=Ae/2,S=Ne):be==="bottom"?(p=Ae/2,S=0):be==="center"?(p=Ae/2,S=Ne/2):be==="right"?(p=0,S=Ne/2):be==="left"?(p=Ae,S=Ne/2):fe.xthis.options.maxZoom||SM?this._retainParent(B,K,fe,M):!1)},_retainChildren:function(u,p,S,M){for(var B=2*u;B<2*u+2;B++)for(var K=2*p;K<2*p+2;K++){var fe=new z(B,K);fe.z=S+1;var be=this._tileCoordsToKey(fe),Ae=this._tiles[be];if(Ae&&Ae.active){Ae.retain=!0;continue}else Ae&&Ae.loaded&&(Ae.retain=!0);S+1this.options.maxZoom||this.options.minZoom!==void 0&&B1){this._setView(u,S);return}for(var tt=B.min.y;tt<=B.max.y;tt++)for(var ht=B.min.x;ht<=B.max.x;ht++){var tr=new z(ht,tt);if(tr.z=this._tileZoom,!!this._isValidTile(tr)){var Ln=this._tiles[this._tileCoordsToKey(tr)];Ln?Ln.current=!0:fe.push(tr)}}if(fe.sort(function(Rt,Dt){return Rt.distanceTo(K)-Dt.distanceTo(K)}),fe.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Fr=document.createDocumentFragment();for(ht=0;htS.max.x)||!p.wrapLat&&(u.yS.max.y))return!1}if(!this.options.bounds)return!0;var M=this._tileCoordsToBounds(u);return le(this.options.bounds).overlaps(M)},_keyToBounds:function(u){return this._tileCoordsToBounds(this._keyToTileCoords(u))},_tileCoordsToNwSe:function(u){var p=this._map,S=this.getTileSize(),M=u.scaleBy(S),B=M.add(S),K=p.unproject(M,u.z),fe=p.unproject(B,u.z);return[K,fe]},_tileCoordsToBounds:function(u){var p=this._tileCoordsToNwSe(u),S=new ee(p[0],p[1]);return this.options.noWrap||(S=this._map.wrapLatLngBounds(S)),S},_tileCoordsToKey:function(u){return u.x+":"+u.y+":"+u.z},_keyToTileCoords:function(u){var p=u.split(":"),S=new z(+p[0],+p[1]);return S.z=+p[2],S},_removeTile:function(u){var p=this._tiles[u];p&&(Gt(p.el),delete this._tiles[u],this.fire("tileunload",{tile:p.el,coords:this._keyToTileCoords(u)}))},_initTile:function(u){ut(u,"leaflet-tile");var p=this.getTileSize();u.style.width=p.x+"px",u.style.height=p.y+"px",u.onselectstart=y,u.onmousemove=y,et.ielt9&&this.options.opacity<1&&rn(u,this.options.opacity)},_addTile:function(u,p){var S=this._getTilePos(u),M=this._tileCoordsToKey(u),B=this.createTile(this._wrapCoords(u),l(this._tileReady,this,u));this._initTile(B),this.createTile.length<2&&J(l(this._tileReady,this,u,null,B)),Xt(B,S),this._tiles[M]={el:B,coords:u,current:!0},p.appendChild(B),this.fire("tileloadstart",{tile:B,coords:u})},_tileReady:function(u,p,S){p&&this.fire("tileerror",{error:p,tile:S,coords:u});var M=this._tileCoordsToKey(u);S=this._tiles[M],S&&(S.loaded=+new Date,this._map._fadeAnimated?(rn(S.el,0),oe(this._fadeFrame),this._fadeFrame=J(this._updateOpacity,this)):(S.active=!0,this._pruneTiles()),p||(ut(S.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:S.el,coords:u})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),et.ielt9||!this._map._fadeAnimated?J(this._pruneTiles,this):setTimeout(l(this._pruneTiles,this),250)))},_getTilePos:function(u){return u.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(u){var p=new z(this._wrapX?m(u.x,this._wrapX):u.x,this._wrapY?m(u.y,this._wrapY):u.y);return p.z=u.z,p},_pxBoundsToTileRange:function(u){var p=this.getTileSize();return new j(u.min.unscaleBy(p).floor(),u.max.unscaleBy(p).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var u in this._tiles)if(!this._tiles[u].loaded)return!1;return!0}});function tp(u){return new Ls(u)}var qa=Ls.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(u,p){this._url=u,p=_(this,p),p.detectRetina&&et.retina&&p.maxZoom>0?(p.tileSize=Math.floor(p.tileSize/2),p.zoomReverse?(p.zoomOffset--,p.minZoom=Math.min(p.maxZoom,p.minZoom+1)):(p.zoomOffset++,p.maxZoom=Math.max(p.minZoom,p.maxZoom-1)),p.minZoom=Math.max(0,p.minZoom)):p.zoomReverse?p.minZoom=Math.min(p.maxZoom,p.minZoom):p.maxZoom=Math.max(p.minZoom,p.maxZoom),typeof p.subdomains=="string"&&(p.subdomains=p.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(u,p){return this._url===u&&p===void 0&&(p=!0),this._url=u,p||this.redraw(),this},createTile:function(u,p){var S=document.createElement("img");return lt(S,"load",l(this._tileOnLoad,this,p,S)),lt(S,"error",l(this._tileOnError,this,p,S)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(S.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(S.referrerPolicy=this.options.referrerPolicy),S.alt="",S.src=this.getTileUrl(u),S},getTileUrl:function(u){var p={r:et.retina?"@2x":"",s:this._getSubdomain(u),x:u.x,y:u.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var S=this._globalTileRange.max.y-u.y;this.options.tms&&(p.y=S),p["-y"]=S}return P(this._url,i(p,this.options))},_tileOnLoad:function(u,p){et.ielt9?setTimeout(l(u,this,null,p),0):u(null,p)},_tileOnError:function(u,p,S){var M=this.options.errorTileUrl;M&&p.getAttribute("src")!==M&&(p.src=M),u(S,p)},_onTileRemove:function(u){u.tile.onload=null},_getZoomForUrl:function(){var u=this._tileZoom,p=this.options.maxZoom,S=this.options.zoomReverse,M=this.options.zoomOffset;return S&&(u=p-u),u+M},_getSubdomain:function(u){var p=Math.abs(u.x+u.y)%this.options.subdomains.length;return this.options.subdomains[p]},_abortLoading:function(){var u,p;for(u in this._tiles)if(this._tiles[u].coords.z!==this._tileZoom&&(p=this._tiles[u].el,p.onload=y,p.onerror=y,!p.complete)){p.src=U;var S=this._tiles[u].coords;Gt(p),delete this._tiles[u],this.fire("tileabort",{tile:p,coords:S})}},_removeTile:function(u){var p=this._tiles[u];if(p)return p.el.setAttribute("src",U),Ls.prototype._removeTile.call(this,u)},_tileReady:function(u,p,S){if(!(!this._map||S&&S.getAttribute("src")===U))return Ls.prototype._tileReady.call(this,u,p,S)}});function ti(u,p){return new qa(u,p)}var nu=qa.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(u,p){this._url=u;var S=i({},this.defaultWmsParams);for(var M in p)M in this.options||(S[M]=p[M]);p=_(this,p);var B=p.detectRetina&&et.retina?2:1,K=this.getTileSize();S.width=K.x*B,S.height=K.y*B,this.wmsParams=S},onAdd:function(u){this._crs=this.options.crs||u.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var p=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[p]=this._crs.code,qa.prototype.onAdd.call(this,u)},getTileUrl:function(u){var p=this._tileCoordsToNwSe(u),S=this._crs,M=q(S.project(p[0]),S.project(p[1])),B=M.min,K=M.max,fe=(this._wmsVersion>=1.3&&this._crs===fd?[B.y,B.x,K.y,K.x]:[B.x,B.y,K.x,K.y]).join(","),be=qa.prototype.getTileUrl.call(this,u);return be+A(this.wmsParams,be,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+fe},setParams:function(u,p){return i(this.wmsParams,u),p||this.redraw(),this}});function ni(u,p){return new nu(u,p)}qa.WMS=nu,ti.wms=ni;var Mr=vi.extend({options:{padding:.1},initialize:function(u){_(this,u),f(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),ut(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var u={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(u.zoomanim=this._onAnimZoom),u},_onAnimZoom:function(u){this._updateTransform(u.center,u.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(u,p){var S=this._map.getZoomScale(p,this._zoom),M=this._map.getSize().multiplyBy(.5+this.options.padding),B=this._map.project(this._center,p),K=M.multiplyBy(-S).add(B).subtract(this._map._getNewPixelOrigin(u,p));et.any3d?ua(this._container,K,S):Xt(this._container,K)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var u in this._layers)this._layers[u]._reset()},_onZoomEnd:function(){for(var u in this._layers)this._layers[u]._project()},_updatePaths:function(){for(var u in this._layers)this._layers[u]._update()},_update:function(){var u=this.options.padding,p=this._map.getSize(),S=this._map.containerPointToLayerPoint(p.multiplyBy(-u)).round();this._bounds=new j(S,S.add(p.multiplyBy(1+u*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),vc=Mr.extend({options:{tolerance:0},getEvents:function(){var u=Mr.prototype.getEvents.call(this);return u.viewprereset=this._onViewPreReset,u},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Mr.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var u=this._container=document.createElement("canvas");lt(u,"mousemove",this._onMouseMove,this),lt(u,"click dblclick mousedown mouseup contextmenu",this._onClick,this),lt(u,"mouseout",this._handleMouseOut,this),u._leaflet_disable_events=!0,this._ctx=u.getContext("2d")},_destroyContainer:function(){oe(this._redrawRequest),delete this._ctx,Gt(this._container),Bt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var u;this._redrawBounds=null;for(var p in this._layers)u=this._layers[p],u._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Mr.prototype._update.call(this);var u=this._bounds,p=this._container,S=u.getSize(),M=et.retina?2:1;Xt(p,u.min),p.width=M*S.x,p.height=M*S.y,p.style.width=S.x+"px",p.style.height=S.y+"px",et.retina&&this._ctx.scale(2,2),this._ctx.translate(-u.min.x,-u.min.y),this.fire("update")}},_reset:function(){Mr.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(u){this._updateDashArray(u),this._layers[f(u)]=u;var p=u._order={layer:u,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=p),this._drawLast=p,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(u){this._requestRedraw(u)},_removePath:function(u){var p=u._order,S=p.next,M=p.prev;S?S.prev=M:this._drawLast=M,M?M.next=S:this._drawFirst=S,delete u._order,delete this._layers[f(u)],this._requestRedraw(u)},_updatePath:function(u){this._extendRedrawBounds(u),u._project(),u._update(),this._requestRedraw(u)},_updateStyle:function(u){this._updateDashArray(u),this._requestRedraw(u)},_updateDashArray:function(u){if(typeof u.options.dashArray=="string"){var p=u.options.dashArray.split(/[, ]+/),S=[],M,B;for(B=0;B')}}catch{}return function(u){return document.createElement("<"+u+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),dd={_initContainer:function(){this._container=yt("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Mr.prototype._update.call(this),this.fire("update"))},_initPath:function(u){var p=u._container=Ga("shape");ut(p,"leaflet-vml-shape "+(this.options.className||"")),p.coordsize="1 1",u._path=Ga("path"),p.appendChild(u._path),this._updateStyle(u),this._layers[f(u)]=u},_addPath:function(u){var p=u._container;this._container.appendChild(p),u.options.interactive&&u.addInteractiveTarget(p)},_removePath:function(u){var p=u._container;Gt(p),u.removeInteractiveTarget(p),delete this._layers[f(u)]},_updateStyle:function(u){var p=u._stroke,S=u._fill,M=u.options,B=u._container;B.stroked=!!M.stroke,B.filled=!!M.fill,M.stroke?(p||(p=u._stroke=Ga("stroke")),B.appendChild(p),p.weight=M.weight+"px",p.color=M.color,p.opacity=M.opacity,M.dashArray?p.dashStyle=N(M.dashArray)?M.dashArray.join(" "):M.dashArray.replace(/( *, *)/g," "):p.dashStyle="",p.endcap=M.lineCap.replace("butt","flat"),p.joinstyle=M.lineJoin):p&&(B.removeChild(p),u._stroke=null),M.fill?(S||(S=u._fill=Ga("fill")),B.appendChild(S),S.color=M.fillColor||M.color,S.opacity=M.fillOpacity):S&&(B.removeChild(S),u._fill=null)},_updateCircle:function(u){var p=u._point.round(),S=Math.round(u._radius),M=Math.round(u._radiusY||S);this._setPath(u,u._empty()?"M0 0":"AL "+p.x+","+p.y+" "+S+","+M+" 0,"+65535*360)},_setPath:function(u,p){u._path.v=p},_bringToFront:function(u){er(u._container)},_bringToBack:function(u){vo(u._container)}},Yi=et.vml?Ga:me,Ns=Mr.extend({_initContainer:function(){this._container=Yi("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Yi("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Gt(this._container),Bt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Mr.prototype._update.call(this);var u=this._bounds,p=u.getSize(),S=this._container;(!this._svgSize||!this._svgSize.equals(p))&&(this._svgSize=p,S.setAttribute("width",p.x),S.setAttribute("height",p.y)),Xt(S,u.min),S.setAttribute("viewBox",[u.min.x,u.min.y,p.x,p.y].join(" ")),this.fire("update")}},_initPath:function(u){var p=u._path=Yi("path");u.options.className&&ut(p,u.options.className),u.options.interactive&&ut(p,"leaflet-interactive"),this._updateStyle(u),this._layers[f(u)]=u},_addPath:function(u){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(u._path),u.addInteractiveTarget(u._path)},_removePath:function(u){Gt(u._path),u.removeInteractiveTarget(u._path),delete this._layers[f(u)]},_updatePath:function(u){u._project(),u._update()},_updateStyle:function(u){var p=u._path,S=u.options;p&&(S.stroke?(p.setAttribute("stroke",S.color),p.setAttribute("stroke-opacity",S.opacity),p.setAttribute("stroke-width",S.weight),p.setAttribute("stroke-linecap",S.lineCap),p.setAttribute("stroke-linejoin",S.lineJoin),S.dashArray?p.setAttribute("stroke-dasharray",S.dashArray):p.removeAttribute("stroke-dasharray"),S.dashOffset?p.setAttribute("stroke-dashoffset",S.dashOffset):p.removeAttribute("stroke-dashoffset")):p.setAttribute("stroke","none"),S.fill?(p.setAttribute("fill",S.fillColor||S.color),p.setAttribute("fill-opacity",S.fillOpacity),p.setAttribute("fill-rule",S.fillRule||"evenodd")):p.setAttribute("fill","none"))},_updatePoly:function(u,p){this._setPath(u,ie(u._parts,p))},_updateCircle:function(u){var p=u._point,S=Math.max(Math.round(u._radius),1),M=Math.max(Math.round(u._radiusY),1)||S,B="a"+S+","+M+" 0 1,0 ",K=u._empty()?"M0 0":"M"+(p.x-S)+","+p.y+B+S*2+",0 "+B+-S*2+",0 ";this._setPath(u,K)},_setPath:function(u,p){u._path.setAttribute("d",p)},_bringToFront:function(u){er(u._path)},_bringToBack:function(u){vo(u._path)}});et.vml&&Ns.include(dd);function iu(u){return et.svg||et.vml?new Ns(u):null}Ct.include({getRenderer:function(u){var p=u.options.renderer||this._getPaneRenderer(u.options.pane)||this.options.renderer||this._renderer;return p||(p=this._renderer=this._createRenderer()),this.hasLayer(p)||this.addLayer(p),p},_getPaneRenderer:function(u){if(u==="overlayPane"||u===void 0)return!1;var p=this._paneRenderers[u];return p===void 0&&(p=this._createRenderer({pane:u}),this._paneRenderers[u]=p),p},_createRenderer:function(u){return this.options.preferCanvas&&ru(u)||iu(u)}});var wo=Os.extend({initialize:function(u,p){Os.prototype.initialize.call(this,this._boundsToLatLngs(u),p)},setBounds:function(u){return this.setLatLngs(this._boundsToLatLngs(u))},_boundsToLatLngs:function(u){return u=le(u),[u.getSouthWest(),u.getNorthWest(),u.getNorthEast(),u.getSouthEast()]}});function z0(u,p){return new wo(u,p)}Ns.create=Yi,Ns.pointsToPath=ie,ha.geometryToLayer=hr,ha.coordsToLatLng=dc,ha.coordsToLatLngs=Xl,ha.latLngToCoords=hc,ha.latLngsToCoords=Ql,ha.getFeature=$a,ha.asFeature=mc,Ct.mergeOptions({boxZoom:!0});var Pr=Vi.extend({initialize:function(u){this._map=u,this._container=u._container,this._pane=u._panes.overlayPane,this._resetStateTimeout=0,u.on("unload",this._destroy,this)},addHooks:function(){lt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Bt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Gt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(u){if(!u.shiftKey||u.which!==1&&u.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),bs(),rc(),this._startPoint=this._map.mouseEventToContainerPoint(u),lt(document,{contextmenu:Ba,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(u){this._moved||(this._moved=!0,this._box=yt("div","leaflet-zoom-box",this._container),ut(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(u);var p=new j(this._point,this._startPoint),S=p.getSize();Xt(this._box,p.min),this._box.style.width=S.x+"px",this._box.style.height=S.y+"px"},_finish:function(){this._moved&&(Gt(this._box),dn(this._container,"leaflet-crosshair")),Fi(),Bl(),Bt(document,{contextmenu:Ba,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(u){if(!(u.which!==1&&u.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(l(this._resetState,this),0);var p=new ee(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(p).fire("boxzoomend",{boxZoomBounds:p})}},_onKeyDown:function(u){u.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Ct.addInitHook("addHandler","boxZoom",Pr),Ct.mergeOptions({doubleClickZoom:!0});var yc=Vi.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(u){var p=this._map,S=p.getZoom(),M=p.options.zoomDelta,B=u.originalEvent.shiftKey?S-M:S+M;p.options.doubleClickZoom==="center"?p.setZoom(B):p.setZoomAround(u.containerPoint,B)}});Ct.addInitHook("addHandler","doubleClickZoom",yc),Ct.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Wi=Vi.extend({addHooks:function(){if(!this._draggable){var u=this._map;this._draggable=new Fa(u._mapPane,u._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),u.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),u.on("zoomend",this._onZoomEnd,this),u.whenReady(this._onZoomEnd,this))}ut(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){dn(this._map._container,"leaflet-grab"),dn(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var u=this._map;if(u._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var p=le(this._map.options.maxBounds);this._offsetLimit=q(this._map.latLngToContainerPoint(p.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(p.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;u.fire("movestart").fire("dragstart"),u.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(u){if(this._map.options.inertia){var p=this._lastTime=+new Date,S=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(S),this._times.push(p),this._prunePositions(p)}this._map.fire("move",u).fire("drag",u)},_prunePositions:function(u){for(;this._positions.length>1&&u-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var u=this._map.getSize().divideBy(2),p=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=p.subtract(u).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(u,p){return u-(u-p)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var u=this._draggable._newPos.subtract(this._draggable._startPos),p=this._offsetLimit;u.xp.max.x&&(u.x=this._viscousLimit(u.x,p.max.x)),u.y>p.max.y&&(u.y=this._viscousLimit(u.y,p.max.y)),this._draggable._newPos=this._draggable._startPos.add(u)}},_onPreDragWrap:function(){var u=this._worldWidth,p=Math.round(u/2),S=this._initialWorldOffset,M=this._draggable._newPos.x,B=(M-p+S)%u+p-S,K=(M+p+S)%u-p-S,fe=Math.abs(B+S)0?K:-K))-p;this._delta=0,this._startTime=null,fe&&(u.options.scrollWheelZoom==="center"?u.setZoom(p+fe):u.setZoomAround(this._lastMousePos,p+fe))}});Ct.addInitHook("addHandler","scrollWheelZoom",au);var _o=600;Ct.mergeOptions({tapHold:et.touchNative&&et.safari&&et.mobile,tapTolerance:15});var bc=Vi.extend({addHooks:function(){lt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Bt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(u){if(clearTimeout(this._holdTimeout),u.touches.length===1){var p=u.touches[0];this._startPos=this._newPos=new z(p.clientX,p.clientY),this._holdTimeout=setTimeout(l(function(){this._cancel(),this._isTapValid()&&(lt(document,"touchend",Pn),lt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",p))},this),_o),lt(document,"touchend touchcancel contextmenu",this._cancel,this),lt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function u(){Bt(document,"touchend",Pn),Bt(document,"touchend touchcancel",u)},_cancel:function(){clearTimeout(this._holdTimeout),Bt(document,"touchend touchcancel contextmenu",this._cancel,this),Bt(document,"touchmove",this._onMove,this)},_onMove:function(u){var p=u.touches[0];this._newPos=new z(p.clientX,p.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(u,p){var S=new MouseEvent(u,{bubbles:!0,cancelable:!0,view:window,screenX:p.screenX,screenY:p.screenY,clientX:p.clientX,clientY:p.clientY});S._simulated=!0,p.target.dispatchEvent(S)}});Ct.addInitHook("addHandler","tapHold",bc),Ct.mergeOptions({touchZoom:et.touch,bounceAtZoomLimits:!0});var md=Vi.extend({addHooks:function(){ut(this._map._container,"leaflet-touch-zoom"),lt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){dn(this._map._container,"leaflet-touch-zoom"),Bt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(u){var p=this._map;if(!(!u.touches||u.touches.length!==2||p._animatingZoom||this._zooming)){var S=p.mouseEventToContainerPoint(u.touches[0]),M=p.mouseEventToContainerPoint(u.touches[1]);this._centerPoint=p.getSize()._divideBy(2),this._startLatLng=p.containerPointToLatLng(this._centerPoint),p.options.touchZoom!=="center"&&(this._pinchStartLatLng=p.containerPointToLatLng(S.add(M)._divideBy(2))),this._startDist=S.distanceTo(M),this._startZoom=p.getZoom(),this._moved=!1,this._zooming=!0,p._stop(),lt(document,"touchmove",this._onTouchMove,this),lt(document,"touchend touchcancel",this._onTouchEnd,this),Pn(u)}},_onTouchMove:function(u){if(!(!u.touches||u.touches.length!==2||!this._zooming)){var p=this._map,S=p.mouseEventToContainerPoint(u.touches[0]),M=p.mouseEventToContainerPoint(u.touches[1]),B=S.distanceTo(M)/this._startDist;if(this._zoom=p.getScaleZoom(B,this._startZoom),!p.options.bounceAtZoomLimits&&(this._zoomp.getMaxZoom()&&B>1)&&(this._zoom=p._limitZoom(this._zoom)),p.options.touchZoom==="center"){if(this._center=this._startLatLng,B===1)return}else{var K=S._add(M)._divideBy(2)._subtract(this._centerPoint);if(B===1&&K.x===0&&K.y===0)return;this._center=p.unproject(p.project(this._pinchStartLatLng,this._zoom).subtract(K),this._zoom)}this._moved||(p._moveStart(!0,!1),this._moved=!0),oe(this._animRequest);var fe=l(p._move,p,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=J(fe,this,!0),Pn(u)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,oe(this._animRequest),Bt(document,"touchmove",this._onTouchMove,this),Bt(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});Ct.addInitHook("addHandler","touchZoom",md),Ct.BoxZoom=Pr,Ct.DoubleClickZoom=yc,Ct.Drag=Wi,Ct.Keyboard=hd,Ct.ScrollWheelZoom=au,Ct.TapHold=bc,Ct.TouchZoom=md,n.Bounds=j,n.Browser=et,n.CRS=ve,n.Canvas=vc,n.Circle=fc,n.CircleMarker=Ts,n.Class=se,n.Control=Br,n.DivIcon=ep,n.DivOverlay=mr,n.DomEvent=oc,n.DomUtil=_s,n.Draggable=Fa,n.Evented=k,n.FeatureGroup=Hi,n.GeoJSON=ha,n.GridLayer=Ls,n.Handler=Vi,n.Icon=qi,n.ImageOverlay=Ms,n.LatLng=pe,n.LatLngBounds=ee,n.Layer=vi,n.LayerGroup=As,n.LineUtil=L0,n.Map=Ct,n.Marker=Zl,n.Mixin=O0,n.Path=Gi,n.Point=z,n.PolyUtil=ud,n.Polygon=Os,n.Polyline=da,n.Popup=eu,n.PosAnimation=Ss,n.Projection=qm,n.Rectangle=wo,n.Renderer=Mr,n.SVG=Ns,n.SVGOverlay=gc,n.TileLayer=qa,n.Tooltip=tu,n.Transformation=te,n.Util=we,n.VideoOverlay=Ha,n.bind=l,n.bounds=q,n.canvas=ru,n.circle=Zm,n.circleMarker=Km,n.control=fa,n.divIcon=I0,n.extend=i,n.featureGroup=Ym,n.geoJSON=pc,n.geoJson=Jl,n.gridLayer=tp,n.icon=Yl,n.imageOverlay=Xm,n.latLng=he,n.latLngBounds=le,n.layerGroup=N0,n.map=rd,n.marker=Wm,n.point=I,n.polygon=D0,n.polyline=R0,n.popup=Jm,n.rectangle=z0,n.setOptions=_,n.stamp=f,n.svg=iu,n.svgOverlay=Qm,n.tileLayer=ti,n.tooltip=k0,n.transformation=V,n.version=r,n.videoOverlay=Ps;var pd=window.L;n.noConflict=function(){return window.L=pd,this},window.L=n})}(gh,gh.exports)),gh.exports}var Cm=$ye();const X5=aa(Cm);function m3(e,t,n){return Object.freeze({instance:e,context:t,container:n})}function p3(e,t){return t==null?function(r,i){const o=w.useRef(void 0);return o.current||(o.current=e(r,i)),o}:function(r,i){const o=w.useRef(void 0);o.current||(o.current=e(r,i));const l=w.useRef(r),{instance:c}=o.current;return w.useEffect(function(){l.current!==r&&(t(c,r,l.current),l.current=r)},[c,r,t]),o}}function Vye(e,t){w.useEffect(function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){t.layerContainer?.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function Q7(e){return function(n){const r=Z7(),i=e(h3(n,r),r);return K7(r.map,n.attribution),X7(i.current,n.eventHandlers),Vye(i.current,r),i}}function Hye(e,t){const n=p3(e,t),r=Q7(n);return Iye(r)}function qye(e,t){const n=p3(e),r=Bye(n,t);return zye(r)}function Gye(e,t){const n=p3(e,t),r=Q7(n);return Uye(r)}function Yye(e,t,n){const{opacity:r,zIndex:i}=t;r!=null&&r!==n.opacity&&e.setOpacity(r),i!=null&&i!==n.zIndex&&e.setZIndex(i)}function Wye({bounds:e,boundsOptions:t,center:n,children:r,className:i,id:o,placeholder:l,style:c,whenReady:f,zoom:h,...m},y){const[x]=w.useState({className:i,id:o,style:c}),[b,C]=w.useState(null),_=w.useRef(void 0);w.useImperativeHandle(y,()=>b?.map??null,[b]);const A=w.useCallback(P=>{if(P!==null&&!_.current){const N=new Cm.Map(P,m);_.current=N,n!=null&&h!=null?N.setView(n,h):e!=null&&N.fitBounds(e,t),f!=null&&N.whenReady(f),C(Dye(N))}},[]);w.useEffect(()=>()=>{b?.map.remove()},[b]);const O=b?uf.createElement(d3,{value:b},r):l??null;return uf.createElement("div",{...x,ref:A},O)}const Kye=w.forwardRef(Wye),Zye=Hye(function({position:t,...n},r){const i=new Cm.Marker(t,n);return m3(i,kye(r,{overlayContainer:i}))},function(t,n,r){n.position!==r.position&&t.setLatLng(n.position),n.icon!=null&&n.icon!==r.icon&&t.setIcon(n.icon),n.zIndexOffset!=null&&n.zIndexOffset!==r.zIndexOffset&&t.setZIndexOffset(n.zIndexOffset),n.opacity!=null&&n.opacity!==r.opacity&&t.setOpacity(n.opacity),t.dragging!=null&&n.draggable!==r.draggable&&(n.draggable===!0?t.dragging.enable():t.dragging.disable())}),Xye=qye(function(t,n){const r=new Cm.Popup(t,n.overlayContainer);return m3(r,n)},function(t,n,{position:r},i){w.useEffect(function(){const{instance:l}=t;function c(h){h.popup===l&&(l.update(),i(!0))}function f(h){h.popup===l&&i(!1)}return n.map.on({popupopen:c,popupclose:f}),n.overlayContainer==null?(r!=null&&l.setLatLng(r),l.openOn(n.map)):n.overlayContainer.bindPopup(l),function(){n.map.off({popupopen:c,popupclose:f}),n.overlayContainer?.unbindPopup(),n.map.removeLayer(l)}},[t,n,i,r])}),Qye=Gye(function({url:t,...n},r){const i=new Cm.TileLayer(t,h3(n,r));return m3(i,r)},function(t,n,r){Yye(t,n,r);const{url:i}=n;i!=null&&i!==r.url&&t.setUrl(i)}),Jye={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},J7={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},_n={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv",bot:"bot"},Vr={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},el={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class De{static getFirstMatch(t,n){const r=n.match(t);return r&&r.length>0&&r[1]||""}static getSecondMatch(t,n){const r=n.match(t);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(t,n,r){if(t.test(n))return r}static getWindowsVersionName(t){switch(t){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(t){const n=t.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),n[0]===10)switch(n[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(t){const n=t.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),!(n[0]===1&&n[1]<5)){if(n[0]===1&&n[1]<6)return"Cupcake";if(n[0]===1&&n[1]>=6)return"Donut";if(n[0]===2&&n[1]<2)return"Eclair";if(n[0]===2&&n[1]===2)return"Froyo";if(n[0]===2&&n[1]>2)return"Gingerbread";if(n[0]===3)return"Honeycomb";if(n[0]===4&&n[1]<1)return"Ice Cream Sandwich";if(n[0]===4&&n[1]<4)return"Jelly Bean";if(n[0]===4&&n[1]>=4)return"KitKat";if(n[0]===5)return"Lollipop";if(n[0]===6)return"Marshmallow";if(n[0]===7)return"Nougat";if(n[0]===8)return"Oreo";if(n[0]===9)return"Pie"}}static getVersionPrecision(t){return t.split(".").length}static compareVersions(t,n,r=!1){const i=De.getVersionPrecision(t),o=De.getVersionPrecision(n);let l=Math.max(i,o),c=0;const f=De.map([t,n],h=>{const m=l-De.getVersionPrecision(h),y=h+new Array(m+1).join(".0");return De.map(y.split("."),x=>new Array(20-x.length).join("0")+x).reverse()});for(r&&(c=l-Math.min(i,o)),l-=1;l>=c;){if(f[0][l]>f[1][l])return 1;if(f[0][l]===f[1][l]){if(l===c)return 0;l-=1}else if(f[0][l]{r[f]=l[f]})}return t}static getBrowserAlias(t){return Jye[t]}static getBrowserTypeByAlias(t){return J7[t]||""}}const Zt=/version\/(\d+(\.?_?\d+)+)/i,e0e=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},n=De.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},n=De.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/PaleMoon/i],describe(e){const t={name:"Pale Moon"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},n=De.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},n=De.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},n=De.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},n=De.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},n=De.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},n=De.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=De.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},n=De.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},n=De.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},n=De.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},n=De.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},n=De.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},n=De.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},n=De.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},n=De.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},n=De.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},n=De.getFirstMatch(Zt,e)||De.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},n=De.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},n=De.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},n=De.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},n=De.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},n=De.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},n=De.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},n=De.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},n=De.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},n=De.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t={name:"Android Browser"},n=De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},n=De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},n=De.getFirstMatch(Zt,e);return n&&(t.version=n),t}},{test:[/.*/i],describe(e){const t=/^(.*)\/(.*) /,n=/^(.*)\/(.*)[ \t]\((.*)/,i=e.search("\\(")!==-1?n:t;return{name:De.getFirstMatch(i,e),version:De.getSecondMatch(i,e)}}}],t0e=[{test:[/Roku\/DVP/],describe(e){const t=De.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:Vr.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=De.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:Vr.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=De.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=De.getWindowsVersionName(t);return{name:Vr.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:Vr.iOS},n=De.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe(e){const t=De.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=De.getMacOSVersionName(t),r={name:Vr.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=De.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:Vr.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t=De.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=De.getAndroidVersionName(t),r={name:Vr.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=De.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:Vr.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=De.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||De.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||De.getFirstMatch(/\bbb(\d+)/i,e);return{name:Vr.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=De.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:Vr.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=De.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:Vr.Tizen,version:t}}},{test:[/linux/i],describe(){return{name:Vr.Linux}}},{test:[/CrOS/],describe(){return{name:Vr.ChromeOS}}},{test:[/PlayStation 4/],describe(e){const t=De.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:Vr.PlayStation4,version:t}}}],n0e=[{test:[/googlebot/i],describe(){return{type:_n.bot,vendor:"Google"}}},{test:[/huawei/i],describe(e){const t=De.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:_n.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:_n.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:_n.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:_n.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:_n.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:_n.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:_n.tablet}}},{test(e){const t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe(e){const t=De.getFirstMatch(/(ipod|iphone)/i,e);return{type:_n.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:_n.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe(e){const t=De.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,e),n={type:_n.mobile,vendor:"Nokia"};return t&&(n.model=t),n}},{test:[/[^-]mobi/i],describe(){return{type:_n.mobile}}},{test(e){return e.getBrowserName(!0)==="blackberry"},describe(){return{type:_n.mobile,vendor:"BlackBerry"}}},{test(e){return e.getBrowserName(!0)==="bada"},describe(){return{type:_n.mobile}}},{test(e){return e.getBrowserName()==="windows phone"},describe(){return{type:_n.mobile,vendor:"Microsoft"}}},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return e.getOSName(!0)==="android"&&t>=3},describe(){return{type:_n.tablet}}},{test(e){return e.getOSName(!0)==="android"},describe(){return{type:_n.mobile}}},{test(e){return e.getOSName(!0)==="macos"},describe(){return{type:_n.desktop,vendor:"Apple"}}},{test(e){return e.getOSName(!0)==="windows"},describe(){return{type:_n.desktop}}},{test(e){return e.getOSName(!0)==="linux"},describe(){return{type:_n.desktop}}},{test(e){return e.getOSName(!0)==="playstation 4"},describe(){return{type:_n.tv}}},{test(e){return e.getOSName(!0)==="roku"},describe(){return{type:_n.tv}}}],r0e=[{test(e){return e.getBrowserName(!0)==="microsoft edge"},describe(e){if(/\sedg\//i.test(e))return{name:el.Blink};const n=De.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:el.EdgeHTML,version:n}}},{test:[/trident/i],describe(e){const t={name:el.Trident},n=De.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){return e.test(/presto/i)},describe(e){const t={name:el.Presto},n=De.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe(e){const t={name:el.Gecko},n=De.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:el.Blink}}},{test:[/(apple)?webkit/i],describe(e){const t={name:el.WebKit},n=De.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];class Q5{constructor(t,n=!1){if(t==null||t==="")throw new Error("UserAgent parameter can't be empty");this._ua=t,this.parsedResult={},n!==!0&&this.parse()}getUA(){return this._ua}test(t){return t.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const t=De.find(e0e,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(t){return t?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const t=De.find(t0e,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os}getOSName(t){const{name:n}=this.getOS();return t?String(n).toLowerCase()||"":n||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(t=!1){const{type:n}=this.getPlatform();return t?String(n).toLowerCase()||"":n||""}parsePlatform(){this.parsedResult.platform={};const t=De.find(n0e,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(t){return t?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const t=De.find(r0e,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return De.assign({},this.parsedResult)}satisfies(t){const n={};let r=0;const i={};let o=0;if(Object.keys(t).forEach(c=>{const f=t[c];typeof f=="string"?(i[c]=f,o+=1):typeof f=="object"&&(n[c]=f,r+=1)}),r>0){const c=Object.keys(n),f=De.find(c,m=>this.isOS(m));if(f){const m=this.satisfies(n[f]);if(m!==void 0)return m}const h=De.find(c,m=>this.isPlatform(m));if(h){const m=this.satisfies(n[h]);if(m!==void 0)return m}}if(o>0){const c=Object.keys(i),f=De.find(c,h=>this.isBrowser(h,!0));if(f!==void 0)return this.compareVersion(i[f])}}isBrowser(t,n=!1){const r=this.getBrowserName().toLowerCase();let i=t.toLowerCase();const o=De.getBrowserTypeByAlias(i);return n&&o&&(i=o.toLowerCase()),i===r}compareVersion(t){let n=[0],r=t,i=!1;const o=this.getBrowserVersion();if(typeof o=="string")return t[0]===">"||t[0]==="<"?(r=t.substr(1),t[1]==="="?(i=!0,r=t.substr(2)):n=[],t[0]===">"?n.push(1):n.push(-1)):t[0]==="="?r=t.substr(1):t[0]==="~"&&(i=!0,r=t.substr(1)),n.indexOf(De.compareVersions(o,r,i))>-1}isOS(t){return this.getOSName(!0)===String(t).toLowerCase()}isPlatform(t){return this.getPlatformType(!0)===String(t).toLowerCase()}isEngine(t){return this.getEngineName(!0)===String(t).toLowerCase()}is(t,n=!1){return this.isBrowser(t,n)||this.isOS(t)||this.isPlatform(t)}some(t=[]){return t.some(n=>this.is(n))}}class i0e{static getParser(t,n=!1){if(typeof t!="string")throw new Error("UserAgent should be a string");return new Q5(t,n)}static parse(t){return new Q5(t).getResult()}static get BROWSER_MAP(){return J7}static get ENGINE_MAP(){return el}static get OS_MAP(){return Vr}static get PLATFORMS_MAP(){return _n}}const a0e=e=>e?.type===hS.INVALID_ARGUMENT,o0e=e=>e?.type===hS.INVALID_SHORT_URL_DELETION,s0e=e=>!!e&&typeof e=="object"&&["type","detail","title","status"].every(t=>t in e),zi=e=>s0e(e)?e:void 0,g3=e=>"error"in e,so=({errorData:e,fallbackMessage:t})=>g.jsxs(g.Fragment,{children:[e?.detail??t,a0e(e)&&g.jsxs("p",{children:["Invalid elements: [",e.invalidElements.join(", "),"]"]})]}),e9=w.createContext(""),l0e=e9.Provider,ps=()=>w.useContext(e9),t9=w.createContext(void 0),{Provider:v3}=t9,m0=()=>w.useContext(t9),u0e=5,y3=()=>{const[e,t]=w.useState([]),n=w.useMemo(()=>e.length>=u0e,[e.length]),r=w.useCallback(c=>!n&&t(f=>[...f,c]),[n]),i=w.useCallback(c=>!n&&e.every(f=>f.name!==c),[e,n]),o=w.useCallback(c=>t(f=>f.filter(h=>h!==c)),[]),l=w.useCallback(()=>t([]),[]);return{itemsToCompare:e,addItemToCompare:r,removeItemToCompare:o,clearItemsToCompare:l,canAddItemWithName:i}},b3=({className:e,type:t})=>{const n=ps(),r=m0(),i=w.useMemo(()=>r?encodeURIComponent(r.itemsToCompare.map(f=>f.query).join(",")):"",[r]);if(!r||r.itemsToCompare.length===0)return null;const{itemsToCompare:o,clearItemsToCompare:l,removeItemToCompare:c}=r;return g.jsx("div",{className:Oe("sticky top-(--header-height) z-10",e),children:g.jsxs(Nt,{bodyClassName:"flex flex-col lg:flex-row gap-4 items-center",children:[g.jsx("ul",{className:"flex flex-wrap gap-1 grow items-center",children:o.map((f,h)=>g.jsxs("li",{className:Oe("flex items-center gap-1 text-sm font-bold text-white py-0.5 px-1.5 rounded",{"bg-gray-500":!f.style?.backgroundColor}),style:f.style,children:[f.name,g.jsx(Iu,{label:`Remove ${f.name}`,className:"text-xs",onClick:()=>c(f)})]},`${f.name}_${h}`))}),g.jsxs("div",{className:"flex gap-2 max-lg:w-full",children:[g.jsxs(Tt,{className:"grow whitespace-nowrap",disabled:o.length<2,to:o.length>1?`${n}/${t}/compare-visits?${t}=${i}`:void 0,children:[g.jsx(Be,{icon:cy}),"Compare (",o.length,"/5)",g.jsx(Be,{icon:Wg})]}),g.jsx(Tt,{"aria-label":"Close compare",variant:"secondary",onClick:l,children:g.jsx(Be,{icon:dy})})]})]})})},c0e=(e,{maxVersion:t,minVersion:n})=>{const r=!n||dw(e,n,">=");return(!t||dw(e,t,"<="))&&r},n9={ipRedirectCondition:{minVersion:"4.2.0"},geolocationRedirectCondition:{minVersion:"4.3.0"},filterShortUrlsByDomain:{minVersion:"4.3.0"},advancedQueryRedirectConditions:{minVersion:"4.5.0"},desktopDeviceTypes:{minVersion:"4.5.0"},filterShortUrlsByExcludedTags:{minVersion:"4.6.0"},filterVisitsByDomain:{minVersion:"4.6.0"}};Object.freeze(n9);const vu=(e,t)=>c0e(t==="latest"?"999.99.99":t,n9[e]),r9=e=>({ipRedirectCondition:vu("ipRedirectCondition",e),geolocationRedirectCondition:vu("geolocationRedirectCondition",e),filterShortUrlsByDomain:vu("filterShortUrlsByDomain",e),advancedQueryRedirectConditions:vu("advancedQueryRedirectConditions",e),desktopDeviceTypes:vu("advancedQueryRedirectConditions",e),filterShortUrlsByExcludedTags:vu("filterShortUrlsByExcludedTags",e),filterVisitsByDomain:vu("filterVisitsByDomain",e)}),i9=w.createContext(r9("0.0.0")),f0e=i9.Provider,d0e=e=>w.useMemo(()=>r9(e),[e]),cl=e=>w.useContext(i9)[e],fl="DEFAULT",_2=({children:e,onChange:t,infoTitle:n,...r})=>g.jsx(di,{...r,onChange:i=>t(i.target.value),label:g.jsxs(g.Fragment,{children:[g.jsx(Be,{className:"mr-1.5",icon:hy,title:n}),e]}),type:"url",placeholder:"No redirect"}),h0e=({isOpen:e,onClose:t,domain:n,editDomainRedirects:r})=>{const[i,o]=w.useState(n.redirects?.baseUrlRedirect??""),[l,c]=w.useState(n.redirects?.regular404Redirect??""),[f,h]=w.useState(n.redirects?.invalidShortUrlRedirect??""),[m,y]=w.useState(!1),x=w.useCallback(async()=>{y(!0);try{await r({domain:n.domain,redirects:{baseUrlRedirect:Ub(i),regular404Redirect:Ub(l),invalidShortUrlRedirect:Ub(f)}}),t()}finally{y(!1)}},[r,n.domain,i,l,f,t]);return g.jsx(co,{title:`Edit redirects for ${n.domain}`,open:e,onClose:t,onConfirm:x,confirmText:m?"Saving...":"Save",confirmDisabled:m,children:g.jsxs("div",{className:"flex flex-col gap-y-3",children:[g.jsx(_2,{value:i,onChange:o,infoTitle:`Visitors accessing the base url, as in https://${n.domain}/, will be redirected to this URL.`,children:"Base URL"}),g.jsx(_2,{value:l,onChange:c,infoTitle:`Visitors accessing a url not matching a short URL pattern, as in https://${n.domain}/???/[...], will be redirected to this URL.`,children:"Regular 404"}),g.jsx(_2,{value:f,onChange:h,infoTitle:"Visitors accessing a url matching a short URL pattern, but not matching an existing short code, will be redirected to this URL.",children:"Invalid short URL"})]})})},m0e=({domain:e,editDomainRedirects:t})=>{const{flag:n,setToTrue:r,setToFalse:i}=Cn(),o=ps(),l=m0(),c=cl("filterShortUrlsByDomain");return g.jsxs(g.Fragment,{children:[g.jsxs(tn,{menuAlignment:"right",children:[g.jsxs(tn.Item,{className:"gap-1.5",to:`${o}/domain/${e.domain}${e.isDefault?`_${fl}`:""}/visits`,children:[g.jsx(Be,{icon:P_})," Visit stats"]}),g.jsxs(tn.Item,{className:"gap-1.5",disabled:!l||!l.canAddItemWithName(e.domain),onClick:()=>l?.addItemToCompare({name:e.domain,query:e.domain}),children:[g.jsx(Be,{icon:cy})," Compare visits"]}),c&&g.jsxs(tn.Item,{className:"gap-1.5",to:`${o}/list-short-urls/1?domain=${e.isDefault?fl:e.domain}`,children:[g.jsx(Be,{icon:M_})," Short URLs"]}),g.jsx(tn.Separator,{}),g.jsxs(tn.Item,{onClick:r,className:"gap-1.5",children:[g.jsx(Be,{icon:j_})," Edit redirects"]})]}),g.jsx(h0e,{domain:e,isOpen:n,onClose:i,editDomainRedirects:t})]})},p0e=({status:e})=>{const{anchor:t,tooltip:n}=os();return e==="validating"?g.jsx(Be,{icon:O_,spin:!0}):g.jsxs("span",{...t,children:[g.jsx(Be,{icon:e==="valid"?Ru:cH,className:Oe({"text-danger":e!=="valid"})}),g.jsx(ss,{...n,children:e==="valid"?g.jsxs(g.Fragment,{children:["Congratulations!",g.jsx("br",{}),"This domain is properly configured."]}):g.jsxs("span",{children:["Oops! There is some missing configuration, and short URLs shared with this domain will not work.",g.jsx("br",{}),"Check the ",g.jsx(Li,{href:"https://slnk.to/multi-domain-docs",children:"documentation"})," in order to find out what is missing."]})})]})},S2=({fallback:e})=>g.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:[!e&&g.jsx("small",{children:"No redirect"}),e&&g.jsxs(g.Fragment,{children:[e," ",g.jsx("small",{children:"(as fallback)"})]})]}),g0e=()=>{const{anchor:e,tooltip:t}=os();return g.jsxs(g.Fragment,{children:[g.jsx(Be,{...e,icon:LH,className:"text-lm-brand dark:text-dm-brand","data-testid":"default-domain-icon"}),g.jsx(ss,{...t,children:"Default domain foo"})]})},v0e=({domain:e,editDomainRedirects:t,checkDomainHealth:n,defaultRedirects:r})=>{const{domain:i,isDefault:o,redirects:l,status:c}=e;return w.useEffect(()=>{n(e.domain)},[n,e.domain]),g.jsxs($e.Row,{className:"relative",children:[g.jsx($e.Cell,{columnName:"Is default domain:",children:o&&g.jsx(g0e,{})}),g.jsx($e.Cell,{columnName:"Domain:",children:g.jsx("b",{children:i})}),g.jsx($e.Cell,{columnName:"Base path redirect:",children:l?.baseUrlRedirect??g.jsx(S2,{fallback:r?.baseUrlRedirect})}),g.jsx($e.Cell,{columnName:"Regular 404 redirect:",children:l?.regular404Redirect??g.jsx(S2,{fallback:r?.regular404Redirect})}),g.jsx($e.Cell,{columnName:"Invalid short URL redirect:",children:l?.invalidShortUrlRedirect??g.jsx(S2,{fallback:r?.invalidShortUrlRedirect})}),g.jsx($e.Cell,{className:"lg:text-center max-lg:border-none",columnName:"Status:",children:g.jsx(p0e,{status:c})}),g.jsx($e.Cell,{className:"text-right max-lg:absolute max-lg:top-1 max-lg:right-1 max-lg:p-0",children:g.jsx(m0e,{domain:e,editDomainRedirects:t})})]})},J5=[{value:"Is default domain",isHidden:!0},{value:"Domain",isHidden:!1},{value:"Base path redirect",isHidden:!1},{value:"Regular 404 redirect",isHidden:!1},{value:"Invalid short URL redirect",isHidden:!1},{value:"Domain status",isHidden:!0},{value:"Options",isHidden:!0}],y0e=({domainsList:e,filterDomains:t,editDomainRedirects:n,checkDomainHealth:r})=>{const{filteredDomains:i,defaultRedirects:o,loading:l,error:c,errorData:f}=e,h=o??i.find(({isDefault:y})=>y)?.redirects,m=y3();return l?g.jsx(Ko,{loading:!0}):g.jsx(v3,{value:m,children:g.jsxs("div",{className:"flex flex-col gap-y-4",children:[g.jsx(Mf,{onChange:t}),g.jsx(b3,{type:"domains"}),c&&g.jsx(Gr,{variant:"error",children:g.jsx(so,{errorData:f,fallbackMessage:"Error loading domains :("})}),!c&&g.jsx(Nt,{className:"card",children:g.jsxs($e,{header:g.jsx($e.Row,{children:J5.map((y,x)=>g.jsx($e.Cell,{children:g.jsx("span",{className:y.isHidden?"sr-only":void 0,children:y.value})},x))}),children:[i.length<1&&g.jsx($e.Row,{children:g.jsx($e.Cell,{colSpan:J5.length,className:"text-center",children:"No results found"})}),i.map(y=>g.jsx(v0e,{domain:y,editDomainRedirects:n,checkDomainHealth:r,defaultRedirects:h},y.domain))]})})]})})},or=(e,t)=>V6(e,t,{serializeError:n=>n}),b0e="shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS",x0e=e=>or(b0e,async({domain:t,redirects:n})=>{const r=await e().editDomainRedirects({domain:t,...n});return{domain:t,redirects:r}}),wg="shlink/domainsList",_g={domains:[],filteredDomains:[],loading:!1,error:!1},eL=({domain:e,redirects:t})=>n=>n.domain!==e?n:{...n,redirects:t},tL=(e,t)=>n=>n.domain!==e?n:{...n,status:t},w0e=(e,t,n)=>{const r=or(`${wg}/listDomains`,async()=>{const{data:c,defaultRedirects:f}=await e().listDomains();return{domains:c.map(h=>({...h,status:"validating"})),defaultRedirects:f}}),i=or(`${wg}/checkDomainHealth`,async c=>{try{const{status:f}=await e().health({domain:c});return{domain:c,status:f==="pass"?"valid":"invalid"}}catch{return{domain:c,status:"invalid"}}}),o=un(`${wg}/filterDomains`),{reducer:l}=jt({name:wg,initialState:_g,reducers:{},extraReducers:c=>{c.addCase(r.pending,()=>({..._g,loading:!0})),c.addCase(r.rejected,(f,{error:h})=>({..._g,error:!0,errorData:zi(h)})),c.addCase(r.fulfilled,(f,{payload:h})=>({..._g,...h,filteredDomains:h.domains})),c.addCase(i.fulfilled,({domains:f,filteredDomains:h,...m},{payload:y})=>({...m,domains:f.map(tL(y.domain,y.status)),filteredDomains:h.map(tL(y.domain,y.status))})),c.addCase(o,(f,{payload:h})=>({...f,filteredDomains:f.domains.filter(({domain:m})=>m.toLowerCase().match(h.toLowerCase()))})),c.addCase(t.fulfilled,(f,{payload:h})=>({...f,domains:f.domains.map(eL(h)),filteredDomains:f.filteredDomains.map(eL(h))})),c.addCase(n.fulfilled,(f,{payload:h})=>{h.domain===null||f.domains.some(m=>m.domain===h.domain)||f.domains.push({domain:h.domain,status:"validating",isDefault:!1,redirects:{baseUrlRedirect:null,regular404Redirect:null,invalidShortUrlRedirect:null}})})}});return{reducer:l,listDomains:r,checkDomainHealth:i,filterDomains:o}},_0e=(e,t)=>{e.serviceFactory("ManageDomains",()=>y0e),e.decorator("ManageDomains",t(["domainsList"],["filterDomains","editDomainRedirects","checkDomainHealth"])),e.serviceFactory("domainsListReducerCreator",w0e,"apiClientFactory","editDomainRedirects","createShortUrl"),e.serviceFactory("domainsListReducer",n=>n.reducer,"domainsListReducerCreator"),e.serviceFactory("listDomains",n=>n.listDomains,"domainsListReducerCreator"),e.serviceFactory("filterDomains",n=>n.filterDomains,"domainsListReducerCreator"),e.serviceFactory("editDomainRedirects",x0e,"apiClientFactory"),e.serviceFactory("checkDomainHealth",n=>n.checkDomainHealth,"domainsListReducerCreator")},nL="shlink/mercure",S0e={loading:!0,error:!1},C0e=e=>{const t=or(`${nL}/loadMercureInfo`,r=>{if(r&&r.realTimeUpdates&&!r.realTimeUpdates.enabled)throw new Error("Real time updates not enabled");return e().mercureInfo()}),{reducer:n}=jt({name:nL,initialState:S0e,reducers:{},extraReducers:r=>{r.addCase(t.pending,i=>({...i,loading:!0,error:!1})),r.addCase(t.rejected,i=>({...i,loading:!1,error:!0})),r.addCase(t.fulfilled,(i,{payload:o})=>({...o,loading:!1,error:!1}))}});return{loadMercureInfo:t,reducer:n}},E0e=e=>{e.serviceFactory("mercureInfoReducerCreator",C0e,"apiClientFactory"),e.serviceFactory("mercureInfoReducer",t=>t.reducer,"mercureInfoReducerCreator"),e.serviceFactory("loadMercureInfo",t=>t.loadMercureInfo,"mercureInfoReducerCreator")};function An(e){return w.useMemo(()=>e,[e])}function Tn(e,t){return(n,r=globalThis.console)=>(t.forEach(i=>{const o=n[i];e[i]=o}),e)}const A0e=(e,t,n,r)=>{const{mercureHubUrl:i,token:o,loading:l,error:c}=e;if(l||c||!i)return;const f=({data:y})=>n(JSON.parse(y)),h=({status:y})=>y===401&&r(),m=t.map(y=>{const x=new URL(i);x.searchParams.append("topic",y);const b=new xJ.EventSourcePolyfill(x,{headers:{Authorization:`Bearer ${o}`}});return b.onmessage=f,b.onerror=h,b});return()=>m.forEach(y=>y.close())};function Na(e,t){const n=new Set;return r=>{const{createNewVisits:i,loadMercureInfo:o,mercureInfo:l}=r,c=Ef();return w.useEffect(()=>{const{interval:f}=l,h=b=>f?n.add(b):i([b]),m=t(c),y=A0e(l,m,h,o);if(!f)return y;const x=setInterval(()=>{i([...n]),n.clear()},f*1e3*60);return()=>{clearInterval(x),y?.()}},[i,o,l,c]),g.jsx(e,{...r})}}class ia{static visits="https://shlink.io/new-visit";static orphanVisits="https://shlink.io/new-orphan-visit";static shortUrlVisits=t=>`https://shlink.io/new-visit/${t}`}const Vf=un("shlink/visitCreation/createNewVisits",e=>({payload:{createdVisits:e}})),Ch=(e,t,n)=>n==null?e.shortCode===t&&!e.domain:e.shortCode===t&&e.domain===n,T0e=(e,t)=>!e.domain&&t===fl?!0:e.domain===t,O0e=e=>e?{longUrl:e.longUrl,tags:e.tags,title:e.title??void 0,domain:e.domain??void 0,validSince:e.meta.validSince??void 0,validUntil:e.meta.validUntil??void 0,maxVisits:e.meta.maxVisits??void 0,crawlable:e.crawlable,forwardQuery:e.forwardQuery}:{longUrl:""},a9=e=>e.replaceAll("/","__"),x3=e=>e.replaceAll("__","/"),w3=({domain:e,shortCode:t})=>`${e??fl}__${a9(t)}`,o9=e=>{const[t,n]=e.split(/__(.+)/);if(!n)throw new Error(`It was not possible to parse domain and short code from "${e}"`);return{domain:t===fl?null:t,shortCode:x3(n)}},_3="shlink/shortUrlDeletion",rL={shortCode:"",loading:!1,deleted:!1,error:!1},j0e=e=>or(`${_3}/deleteShortUrl`,async({shortCode:t,domain:n})=>(await e().deleteShortUrl({shortCode:t,domain:n}),{shortCode:t,domain:n})),s9=un(`${_3}/shortUrlDeleted`),M0e=e=>{const{actions:t,reducer:n}=jt({name:_3,initialState:rL,reducers:{resetDeleteShortUrl:()=>rL},extraReducers:i=>{i.addCase(e.pending,o=>({...o,loading:!0,error:!1,deleted:!1})),i.addCase(e.rejected,(o,{error:l})=>({...o,errorData:zi(l),loading:!1,error:!0,deleted:!1})),i.addCase(e.fulfilled,(o,{payload:l})=>({...o,shortCode:l.shortCode,loading:!1,error:!1,deleted:!0}))}}),{resetDeleteShortUrl:r}=t;return{reducer:n,resetDeleteShortUrl:r}},l9="shlink/shortUrlsList",u9=5,P0e={loading:!0,error:!1},L0e=e=>or(`${l9}/listShortUrls`,t=>e().listShortUrls(t??{})),N0e=(e,t,n)=>jt({name:l9,initialState:P0e,reducers:{},extraReducers:r=>{r.addCase(e.pending,i=>({...i,loading:!0,error:!1})),r.addCase(e.rejected,()=>({loading:!1,error:!0})),r.addCase(e.fulfilled,(i,{payload:o})=>({loading:!1,error:!1,shortUrls:o})),r.addCase(n.fulfilled,(i,{payload:o})=>{i.shortUrls&&(i.shortUrls.data=[o,...i.shortUrls.data.slice(0,u9-1)],i.shortUrls.pagination.totalItems+=1)}),r.addCase(t.fulfilled,(i,{payload:o})=>{i.shortUrls&&(i.shortUrls.data=i.shortUrls.data.map(l=>{const{shortCode:c,domain:f}=o;return Ch(l,c,f)?o:l}))}),r.addCase(s9,(i,{payload:o})=>{i.shortUrls&&(i.shortUrls.data=i.shortUrls.data.filter(l=>!Ch(l,o.shortCode,o.domain)),i.shortUrls.pagination.totalItems-=1)}),r.addCase(Vf,(i,{payload:o})=>{i.shortUrls&&(i.shortUrls.data=i.shortUrls.data.map(l=>o.createdVisits.findLast(({shortUrl:c})=>c&&Ch(l,c.shortCode,c.domain))?.shortUrl??l))})}}),r_=({children:e,title:t,link:n,tooltip:r})=>{const{anchor:i,tooltip:o}=os({placement:"bottom"});return g.jsxs(g.Fragment,{children:[g.jsx(Ir,{to:n,className:"no-underline text-inherit",...i,children:g.jsxs(Nt,{className:Oe("text-center border-t-3 border-t-lm-main dark:border-t-dm-main relative"),children:[g.jsx(Be,{icon:VK,size:"3x",className:"absolute right-[5px] bottom-[5px] opacity-10 -rotate-45"}),g.jsx("div",{role:"heading","aria-level":5,className:"text-xl uppercase text-placeholder font-bold mb-2",children:t}),g.jsx("div",{className:"text-4xl font-semibold",children:e})]})}),r&&g.jsx(ss,{...o,children:r})]})},iL=({loading:e,excludeBots:t,visitsSummary:n,...r})=>g.jsx(r_,{tooltip:n.bots!==void 0?g.jsxs(g.Fragment,{children:[t?"Plus":"Including"," ",g.jsx("b",{"data-testid":"tooltip-amount",children:Sn(n.bots)})," potential bot visits"]}):void 0,...r,children:e?"Loading...":Sn(t&&n.nonBots!==void 0?n.nonBots:n.total)}),aL=({children:e,titleLinkText:t,titleLink:n,title:r})=>g.jsxs(ln,{className:"card",children:[g.jsxs(ln.Header,{className:"flex justify-between items-center",children:[g.jsx("span",{className:"sm:hidden",children:r}),g.jsx("h5",{className:"hidden sm:inline",children:r}),g.jsxs(Ir,{to:n,children:[t," »"]})]}),g.jsx(ln.Body,{children:e})]}),c9=Na(({shortUrlsList:e,listShortUrls:t,tagsList:n,loadVisitsOverview:r,visitsOverview:i})=>{const{ShortUrlsTable:o,CreateShortUrl:l}=An(c9),{loading:c,shortUrls:f}=e,{loading:h}=n,{loading:m,nonOrphanVisits:y,orphanVisits:x}=i,b=ps(),C=uo(),_=Fn("visits");return w.useEffect(()=>{t({itemsPerPage:u9,orderBy:{field:"dateCreated",dir:"DESC"}}),r()},[t,r]),g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-4 gap-4",children:[g.jsx(iL,{title:"Visits",link:`${b}/non-orphan-visits`,excludeBots:_?.excludeBots??!1,loading:m,visitsSummary:y}),g.jsx(iL,{title:"Orphan visits",link:`${b}/orphan-visits`,excludeBots:_?.excludeBots??!1,loading:m,visitsSummary:x}),g.jsx(r_,{title:"Short URLs",link:`${b}/list-short-urls/1`,children:c?"Loading...":Sn(f?.pagination.totalItems??0)}),g.jsx(r_,{title:"Tags",link:`${b}/manage-tags`,children:h?"Loading...":Sn(n.tags.length)})]}),g.jsx(aL,{title:"Create a short URL",titleLinkText:"Advanced options",titleLink:`${b}/create-short-url`,children:g.jsx(l,{basicMode:!0})}),g.jsx(aL,{title:"Recently created URLs",titleLinkText:"See all",titleLink:`${b}/list-short-urls/1`,children:g.jsx(o,{shortUrlsList:e,onTagClick:A=>C(`${b}/list-short-urls/1?tags=${encodeURIComponent(A)}`)})})]})},()=>[ia.visits,ia.orphanVisits]),R0e=Tn(c9,["ShortUrlsTable","CreateShortUrl"]);function D0e(e,t){e.factory("Overview",R0e),e.decorator("Overview",t(["shortUrlsList","tagsList","mercureInfo","visitsOverview"],["listShortUrls","createNewVisits","loadMercureInfo","loadVisitsOverview"]))}const f9="shlink/setShortUrlRedirectRules",oL={saving:!1,saved:!1,error:!1},k0e=e=>or(`${f9}/setShortUrlRedirectRules`,({shortUrl:t,data:n})=>{const{shortCode:r,domain:i}=t;return e().setShortUrlRedirectRules({shortCode:r,domain:i},n)}),I0e=e=>{const{reducer:t,actions:n}=jt({name:f9,initialState:oL,reducers:{resetSetRules:()=>oL},extraReducers:i=>{i.addCase(e.pending,()=>({saving:!0,saved:!1,error:!1})),i.addCase(e.rejected,(o,{error:l})=>({saving:!1,saved:!1,error:!0,errorData:zi(l)})),i.addCase(e.fulfilled,()=>({saving:!1,error:!1,saved:!0}))}}),{resetSetRules:r}=n;return{reducer:t,resetSetRules:r}},d9="shlink/getShortUrlRedirectRules",z0e={loading:!0,error:!1},U0e=e=>or(`${d9}/getShortUrlRedirectRules`,({shortCode:t,domain:n})=>e().getShortUrlRedirectRules({shortCode:t,domain:n})),B0e=e=>jt({name:d9,initialState:z0e,reducers:{},extraReducers:t=>{t.addCase(e.pending,()=>({loading:!0,error:!1})),t.addCase(e.rejected,()=>({loading:!1,error:!0})),t.addCase(e.fulfilled,(n,{payload:r})=>({loading:!1,error:!1,...r}))}});function Yr(e){e.preventDefault()}function Rl(e){e.stopPropagation()}function h9(){const e=new Map;return[function(t,n){e.get(t)&&e.get(t).forEach(r=>{r(n)})},function(t,n){const r=e.get(t)??[];r.push(n),e.set(t,r)}]}var[m9,p9]=h9();function F0e(e,t){return e.source===t.source&&e.flags.split("").sort().join("")===t.flags.split("").sort().join("")}function Gh(e,t,n=!0,r=["__key"]){if(e===t)return!0;if(typeof t=="object"&&typeof e=="object"&&e!==null&&t!==null){if(e instanceof Map||e instanceof Set)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&t instanceof RegExp)return F0e(e,t);if(e===null||t===null)return!1;const i=e,o=t;if(Object.keys(i).length!==Object.keys(o).length)return!1;for(const l of r)if((l in i||l in o)&&i[l]!==o[l])return!1;for(const l in i)if(!(l in o)||i[l]!==o[l]&&!n||n&&!Gh(i[l],o[l],n,r))return!1;return!0}return!1}function g9(e){return e.split(" ").filter(t=>t)}function Hf(e){return{x:e.clientX,y:e.clientY}}Array();var S3=typeof window<"u",Dr=new WeakMap,lo=new WeakMap;function v9(){if(!S3)return!1;if("userAgentData"in navigator)return navigator.userAgentData.mobile===!0;const e=navigator.userAgent,t=/android|iphone|ipod/i.test(e),n=/iPad/.test(e)||e.includes("Macintosh")&&navigator.maxTouchPoints>1;return t||n}var $0e={affectedNodes:[],coordinates:{x:0,y:0},currentTargetValue:void 0,on:p9,emit:m9,originalZIndex:void 0,pointerSelection:!1,preventEnter:!1,rootUserSelect:void 0,nodePointerdown:void 0,longPress:!1,scrolling:!1,longPressTimeout:void 0,remapJustFinished:!1,selectedNodes:[],selectedParent:void 0,preventSynthDrag:!1,pointerDown:void 0,lastScrollContainerX:null,lastScrollContainerY:null,rootScrollWidth:void 0,rootScrollHeight:void 0,dragItemRect:void 0,windowScrollX:void 0,windowScrollY:void 0,lastScrollDirectionX:void 0,lastScrollDirectionY:void 0,scrollDebounceTimeout:void 0,frameIdX:void 0,frameIdY:void 0},Ie=$0e,Al=!1,sL,C2;function V0e(){Ie.scrollDebounceTimeout&&clearTimeout(Ie.scrollDebounceTimeout),Ie.longPressTimeout&&clearTimeout(Ie.longPressTimeout),Ie.frameIdX!==void 0&&cancelAnimationFrame(Ie.frameIdX),Ie.frameIdY!==void 0&&cancelAnimationFrame(Ie.frameIdY),Ie={affectedNodes:[],coordinates:{x:0,y:0},on:p9,emit:m9,currentTargetValue:void 0,originalZIndex:void 0,pointerId:void 0,preventEnter:!1,remapJustFinished:!1,selectedNodes:[],nodePointerdown:void 0,rootUserSelect:void 0,preventSynthDrag:!1,scrolling:!1,selectedParent:void 0,pointerSelection:!1,synthScrollDirection:void 0,draggedNodeDisplay:void 0,synthDragScrolling:!1,longPress:!1,pointerDown:void 0,longPressTimeout:void 0,lastScrollContainerX:null,lastScrollContainerY:null,rootScrollWidth:void 0,rootScrollHeight:void 0,dragItemRect:void 0,windowScrollX:void 0,windowScrollY:void 0,lastScrollDirectionX:void 0,lastScrollDirectionY:void 0,scrollDebounceTimeout:void 0,frameIdX:void 0,frameIdY:void 0}}function y9(e){return Object.assign(Ie,e),e.initialParent.data.emit("dragStarted",Ie),Al=!1,Ie.emit("dragStarted",Ie),Ie}function H0e(){Ie.activeState&&Wu(Ie.activeState.parent,void 0,Ie),Ie.selectedState&&Nu(Ie.selectedState.nodes,Ie.selectedState.parent,Ie),Ie.selectedState=Ie.activeState=void 0}function q0e(){if(Ie.pointerDown&&(Ie.pointerDown.node.el.draggable=!0),Ie.pointerDown=void 0,!ki(Ie))return;const e=Ie.currentParent.data.config;ki(Ie)&&e.handleEnd(Ie)}function G0e(e){e.key==="Escape"&&(Ie.selectedState&&Nu(Ie.selectedState.nodes,Ie.selectedState.parent,Ie),Ie.activeState&&Wu(Ie.activeState.parent,void 0,Ie),Ie.selectedState=Ie.activeState=void 0)}function Y0e(e){if(!Wr(Ie))return;Al=!0;const t=Ie.initialParent.data.config.handleEnd;t(Ie)}function W0e(e){if(!Wr(Ie))return;Yr(e);const{x:t,y:n}=Hf(e);Wr(Ie)&&v0({x:t,y:n},e,Ie)}function K0e(e){if(!Ie.pointerDown||!Ie.pointerDown.validated)return;const t=Ie.pointerDown.parent.data.config;if(!(e.pointerType==="mouse"&&!v9()))if(ki(Ie))ki(Ie)&&lL(e,Ie);else{if(Yr(e),t.longPress&&!Ie.longPress){clearTimeout(Ie.longPressTimeout),Ie.longPress=!1;return}const n=t.draggedNodes(Ie.pointerDown);t.dragstartClasses(Ie.pointerDown.node,n,t,!0);const r=Ie.pointerDown.node.el.getBoundingClientRect(),i=C1e(Ie.pointerDown.node,Ie.pointerDown.parent,e,Ie,n,r);lL(e,i,!0)}}function Z0e({parent:e,getValues:t,setValues:n,config:r={}}){if(!S3)return;sL||(sL=Jv(document,{dragover:W0e,pointerdown:H0e,pointerup:q0e,keydown:G0e,drop:Y0e,pointermove:K0e,pointercancel:Si(r.handlePointercancel),touchmove:c=>{Wr(Ie)&&c.cancelable&&Yr(c)},contextmenu:c=>{ki(Ie)&&Yr(c)}})),x9(e);const[i,o]=h9(),l={getValues:t,setValues:n,config:{dragDropEffect:r.dragDropEffect??"move",dragEffectAllowed:r.dragEffectAllowed??"move",draggedNodes:u1e,dragstartClasses:h1e,handleNodeKeydown:p1e,handleDragstart:f1e,handleNodeDragover:A1e,handleParentDragover:T1e,handleNodeDrop:v1e,handleNodeFocus:y1e,handleNodeBlur:b1e,handlePointercancel:w1e,handleEnd:_1e,handleDragend:x1e,handleParentFocus:Q0e,handleNodePointerup:S1e,handleNodePointerover:g1e,handleParentPointerover:O1e,handleParentScroll:c1e,handleNodePointerdown:d1e,handleNodeDragenter:M1e,handleNodeDragleave:P1e,handleParentDrop:e1e,multiDrag:r.multiDrag??!1,nativeDrag:r.nativeDrag??!0,performSort:X0e,performTransfer:J0e,root:r.root??document,setupNode:n1e,setupNodeRemap:w9,reapplyDragClasses:r1e,tearDownNode:a1e,tearDownNodeRemap:i1e,remapFinished:s1e,threshold:{horizontal:0,vertical:0},...r},enabledNodes:[],abortControllers:{},privateClasses:[],on:o,emit:i};new MutationObserver(o1e).observe(e,{childList:!0}),Dr.set(e,l),r.plugins?.forEach(c=>{c(e)?.tearDown?.()}),r.plugins?.forEach(c=>{c(e)?.tearDown?.()}),r.plugins?.forEach(c=>{c(e)?.setup?.()}),t1e(e,l),p0(e,!0)}function b9(e,t,n,r,i,o){const{x:l,y:c}=Hf(n),f=e.el.getBoundingClientRect();return{affectedNodes:[],ascendingDirection:!1,clonedDraggedEls:[],coordinates:{x:l,y:c},draggedNode:{el:e.el,data:e.data},draggedNodes:r,incomingDirection:void 0,initialIndex:e.data.index,initialParent:{el:t.el,data:t.data},currentParent:{el:t.el,data:t.data},longPress:t.data.config.longPress??!1,longPressTimeout:void 0,currentTargetValue:e.data.value,scrollEls:[],startLeft:i||l-(f?.left??0),startTop:o||c-(f?.top??0),targetIndex:e.data.index,transferred:!1}}function X0e({parent:e,draggedNodes:t,targetNodes:n}){p0(e.el);const r=t.map(f=>f.data.value),i=xf(e.el,e.data),o=t[0].data.index,l=[...e.data.enabledNodes],c=[...i.filter(f=>!r.some(h=>Gh(f,h)))];c.splice(n[0].data.index,0,...r),"draggedNode"in Ie&&(Ie.currentTargetValue=n[0].data.value),i_(e.el,e.data,[...c]),e.data.config.onSort&&e.data.config.onSort({parent:{el:e.el,data:e.data},previousValues:[...i],previousNodes:[...l],nodes:[...e.data.enabledNodes],values:[...c],draggedNodes:t,previousPosition:o,position:n[0].data.index,targetNodes:n,state:Ie})}function Wu(e,t,n){if(!t){n.activeState=void 0;return}n.activeState={node:t,parent:e}}function Nu(e,t,n){const r=t.data.config.selectedClass;if(!n.selectedState)return;const i=Array.from(e);dl(e.map(o=>o.el),r);for(const o of i){o.el.setAttribute("aria-selected","false");const l=n.selectedState.nodes.findIndex(c=>c.el===o.el);l!==-1&&n.selectedState.nodes.splice(l,1)}}function Sg(e,t,n,r,i=!1){r.pointerSelection=i;for(const o of t)o.el.setAttribute("aria-selected","true"),lf([o.el],e.data.config.selectedClass,!0);r.selectedState={nodes:t,parent:e},Wu(e,n,r)}function Q0e(e,t){const n=e.targetData.parent.data.enabledNodes[0];n&&(t.selectedState&&t.selectedState.parent.el!==e.targetData.parent.el?Wu(e.targetData.parent,n,t):t.selectedState||Wu(e.targetData.parent,n,t))}function J0e({currentParent:e,targetParent:t,initialParent:n,draggedNodes:r,initialIndex:i,targetNodes:o,state:l}){p0(n.el);const c=r.map(x=>x.data.value),f=[...xf(e.el,e.data).filter(x=>!c.some(b=>Gh(x,b)))],h=xf(t.el,t.data),m=n.el===t.el&&t.data.config.sortable===!1;let y;o.length?(m?y=i:t.data.config.sortable===!1?y=t.data.enabledNodes.length:y=o[0].data.index,h.splice(y,0,...c)):(y=m?i:t.data.enabledNodes.length,h.splice(y,0,...c)),i_(e.el,e.data,f),i_(t.el,t.data,h),t.data.config.onTransfer&&t.data.config.onTransfer({sourceParent:e,targetParent:t,initialParent:n,draggedNodes:r,targetIndex:y,state:l,targetNodes:o}),e.data.config.onTransfer&&e.data.config.onTransfer({sourceParent:e,targetParent:t,initialParent:n,draggedNodes:r,targetIndex:y,state:l,targetNodes:o||[]})}function xf(e,t){return[...t.getValues(e)]}function i_(e,t,n){t.setValues(n,e)}function e1e(e,t){Rl(e.e),Al=!0;const n=t.initialParent.data.config.handleEnd;n(t)}function x9(e){const t=Dr.get(e);t&&t.abortControllers.mainParent&&t.abortControllers.mainParent.abort()}function Wr(e){return"draggedNode"in e&&!!e.draggedNode}function ki(e){return"synthDragging"in e&&!!e.synthDragging}function t1e(e,t){t.abortControllers.mainParent=Jv(e,{dragover:Cg(t.config.handleParentDragover),handleParentPointerover:t.config.handleParentPointerover,scroll:Cg(t.config.handleParentScroll),drop:Cg(t.config.handleParentDrop),hasNestedParent:n=>{const r=Dr.get(n.target);r&&(r.nestedParent=n.detail.parent)},focus:Cg(t.config.handleParentFocus)}),t.config.externalDragHandle&&t.config.externalDragHandle.el&&t.config.externalDragHandle.callback&&(t.abortControllers.externalDragHandle=Jv(t.config.externalDragHandle.el,{pointerdown:n=>{if(!t.config.externalDragHandle||!t.config.externalDragHandle.callback)return;const r=t.config.externalDragHandle.callback();if(!y0(r)){console.warn("No draggable item found from external drag handle callback");return}const i=lo.get(r);if(!i)return;const o=r.parentNode;if(!(o instanceof HTMLElement))return;const l=Dr.get(o);l&&(Ie.pointerDown={parent:{el:o,data:l},node:{el:r,data:i},validated:!0},r.draggable=!0)}}))}function n1e(e){const t=e.parent.data.config;e.node.data.abortControllers.mainNode=Jv(e.node.el,{keydown:Si(t.handleNodeKeydown),dragstart:Si(t.handleDragstart),dragover:Si(t.handleNodeDragover),dragenter:Si(t.handleNodeDragenter),dragleave:Si(t.handleNodeDragleave),dragend:Si(t.handleDragend),drop:Si(t.handleNodeDrop),focus:Si(t.handleNodeFocus),blur:Si(t.handleNodeBlur),pointerup:Si(t.handleNodePointerup),pointercancel:Si(t.handlePointercancel),pointerdown:Si(t.handleNodePointerdown),handleNodePointerover:t.handleNodePointerover,touchmove:n=>{Wr(Ie)&&n.cancelable&&Yr(n)},contextmenu:n=>{ki(Ie)&&Yr(n)}}),e.node.el.draggable=!0,t.reapplyDragClasses(e.node.el,e.parent.data),e.parent.data.config.plugins?.forEach(n=>{n(e.parent.el)?.setupNode?.(e)})}function w9(e){lo.set(e.node.el,e.node.data),e.parent.data.config.plugins?.forEach(t=>{t(e.parent.el)?.setupNodeRemap?.(e)})}function r1e(e,t){if(!Wr(Ie))return;const n=ki(Ie)?t.config.synthDropZoneClass:t.config.dropZoneClass;Ie.draggedNode.el===e&&lf([e],n,!0)}function i1e(e){e.parent.data.config.plugins?.forEach(t=>{t(e.parent.el)?.tearDownNodeRemap?.(e)})}function a1e(e){e.parent.data.config.plugins?.forEach(t=>{t(e.parent.el)?.tearDownNode?.(e)}),e.node.el.draggable=!1,e.node.data?.abortControllers?.mainNode&&e.node.data?.abortControllers?.mainNode.abort()}function o1e(e){if(e.length===1&&e[0].addedNodes.length===1&&!(e[0].addedNodes[0]instanceof HTMLElement))return;const t=e[0].target;!(t instanceof HTMLElement)||!Dr.get(t)||p0(t)}function p0(e,t){const n=Dr.get(e);if(!n)return;n.privateClasses=Array.from(e.classList);const r=[],i=n.config;for(let c=0;cx.data.value===m.value);y&&(y.el=f)}l.push({el:f,data:m}),(t||!h)&&i.setupNode({parent:{el:e,data:n},node:{el:f,data:m}}),w9({parent:{el:e,data:n},node:{el:f,data:m}})}Dr.set(e,{...n,enabledNodes:l}),i.remapFinished(n),n.config.plugins?.forEach(c=>{c(e)?.remapFinished?.()})}function s1e(){Ie.remapJustFinished=!0,"draggedNode"in Ie&&(Ie.affectedNodes=[])}function l1e(e){return!!e.targetData.parent.data.config.nativeDrag}function u1e(e){if(e.parent.data.config.multiDrag){if(Ie.selectedState)return[e.node,...Ie.selectedState?.nodes.filter(t=>t.el!==e.node.el)]}else return[e.node];return[]}function c1e(e){Wr(Ie)&&(Ie.emit("scrollStarted",Ie),!ki(Ie)&&(Ie.preventEnter=!0,C2&&clearTimeout(C2),C2=setTimeout(()=>{Ie.preventEnter=!1,Ie.emit("scrollEnded",Ie)},100)))}function f1e(e,t){const n=e.targetData.parent.data.config;if(!n.nativeDrag||!l1e(e)||!_9({x:e.e.clientX,y:e.e.clientY,node:e.targetData.node,config:n})){Yr(e.e);return}let r=n.draggedNodes({parent:e.targetData.parent,node:e.targetData.node});r.length===0&&(r=[e.targetData.node]),n.dragstartClasses(e.targetData.node,r,n);const i=m1e(e,r);if(n.onDragstart){const o={parent:e.targetData.parent,values:xf(e.targetData.parent.el,e.targetData.parent.data),draggedNode:i.draggedNode,draggedNodes:i.draggedNodes,position:i.initialIndex,state:i};n.onDragstart(o)}}function d1e(e,t){if(Rl(e.e),t.pointerDown={parent:e.targetData.parent,node:e.targetData.node,validated:!1},!_9({x:e.e.clientX,y:e.e.clientY,node:e.targetData.node,config:e.targetData.parent.data.config}))return;t.pointerDown.validated=!0,E1e(e,t,e.targetData.node);const n=e.targetData.parent.data;let r=[e.targetData.node];const i=e.e.ctrlKey||e.e.metaKey,o=e.e.shiftKey,l=e.targetData.node;if(i&&n.config.multiDrag){t.selectedState?t.selectedState.nodes.findIndex(c=>c.el===l.el)===-1?r=[...t.selectedState.nodes,l]:r=t.selectedState.nodes.filter(c=>c.el!==l.el):r=[l],Sg(e.targetData.parent,r,e.targetData.node,t,!0);return}if(o&&n.config.multiDrag){const c=e.targetData.parent.data.enabledNodes;if(t.selectedState&&t.activeState)if(t.selectedState.parent.el!==e.targetData.parent.el){Nu(t.selectedState.nodes,t.selectedState.parent,t),t.selectedState=void 0;for(let f=0;f<=l.data.index;f++)r.push(c[f])}else{const[f,h]=t.activeState.node.data.indexc.el===e.targetData.node.el)===-1&&(t.selectedState.parent.el!==e.targetData.parent.el?Nu(t.selectedState.nodes,e.targetData.parent,t):n.config.multiDrag&&v9()?r.push(...t.selectedState.nodes):Nu(t.selectedState.nodes,e.targetData.parent,t),Sg(e.targetData.parent,r,e.targetData.node,t,!0)):Sg(e.targetData.parent,[e.targetData.node],e.targetData.node,t,!0)}function h1e(e,t,n,r=!1){lf(t.map(i=>i.el),r?n.synthDraggingClass:n.draggingClass),setTimeout(()=>{dl(t.map(i=>i.el),r?n.synthDraggingClass:n.draggingClass),lf(t.map(i=>i.el),r?n.synthDragPlaceholderClass:n.dragPlaceholderClass),lf(t.map(i=>i.el),r?n.synthDropZoneClass:n.dropZoneClass),dl(t.map(i=>i.el),n.selectedClass)})}function m1e(e,t){Rl(e.e);const n=y9(b9(e.targetData.node,e.targetData.parent,e.e,t));if(e.e.dataTransfer){const r=e.targetData.parent.data.config;e.e.dataTransfer.dropEffect=r.dragDropEffect,e.e.dataTransfer.effectAllowed=r.dragEffectAllowed;let i;if(e.e.dataTransfer.setData("text/plain",""),r.dragImage)i=r.dragImage(e,t);else{if(!r.multiDrag||t.length===1)return e.targetData.node.el.style.zIndex="9999",e.targetData.node.el.style.boxSizing="border-box",e.e.dataTransfer.setDragImage(e.targetData.node.el,e.e.offsetX,e.e.offsetY),n.originalZIndex=e.targetData.node.el.style.zIndex,n;{const o=document.createElement("div");o.setAttribute("id","dnd-dragged-node-clone"),o.setAttribute("popover","manual");for(const c of t){const f=c.el.cloneNode(!0);f.id=c.el.id+"-clone",f.style.pointerEvents="none",o.appendChild(f)}const{width:l}=t[0].el.getBoundingClientRect();Object.assign(o.style,{display:"flex",flexDirection:"column",width:`${l}px`,position:"absolute",pointerEvents:"none",zIndex:"9999",left:"-9999px",boxSizing:"border-box",background:"transparent",overflow:"hidden"}),e.targetData.parent.el.appendChild(o),o.showPopover(),o.getBoundingClientRect(),i=o,e.e.dataTransfer.setDragImage(i,e.e.offsetX,e.e.offsetY)}}setTimeout(()=>{i?.remove()})}return n}function _9({x:e,y:t,node:n,config:r}){if(r.externalDragHandle)return!1;if(!r.dragHandle)return!0;const i=n.el.querySelectorAll(r.dragHandle);if(!i)return!1;const o=r.root.elementFromPoint(e,t);if(!o)return!1;for(const l of Array.from(i))if(o===l||l.contains(o))return!0;return!1}function p1e(e){}function g1e(e){e.detail.targetData.parent.el===e.detail.state.currentParent.el?C9(e.detail,e.detail.state):g0(e.detail,e.detail.state)}function v1e(e,t){const n=e.targetData.parent.data.config;n.nativeDrag&&(Rl(e.e),Al=!0,n.handleEnd(t))}function y1e(e){e.e.target!==e.e.currentTarget&&Ie.pointerDown&&(Ie.pointerDown.node.el.draggable=!1)}function b1e(e){e.e.target!==e.e.currentTarget&&Ie.pointerDown&&(Ie.pointerDown.node.el.draggable=!0)}function x1e(e,t){const n=e.targetData.parent.data.config;if(n.nativeDrag){if(Yr(e.e),Rl(e.e),Al){Al=!1;return}n.handleEnd(t)}}function w1e(e,t){if(!ki(t))return;if(Yr(e.e),Al){Al=!1;return}const n=Dr.get(t.initialParent.el)?.config;n?.onDragend&&n.onDragend({parent:t.currentParent,values:xf(t.currentParent.el,t.currentParent.data),draggedNode:t.draggedNode,draggedNodes:t.draggedNodes,state:t}),n?.handleEnd(t)}function _1e(e){e.draggedNode&&(e.draggedNode.el.draggable=!0);const t=e.draggedNodes.map(m=>m.el),n=e.initialParent.data,r=ki(e),i=Dr.get(e.initialParent.el)?.config,o=r?i?.synthDropZoneClass:i?.dropZoneClass,l=n?.config?.longPressClass,c=r?n?.config?.synthDragPlaceholderClass:n?.config?.dragPlaceholderClass,f=e.originalZIndex;ki(e)&&(e.clonedDraggedNode&&e.clonedDraggedNode.remove(),e.longPressTimeout&&clearTimeout(e.longPressTimeout)),a_(e),e.lastScrollDirectionX=void 0,e.lastScrollDirectionY=void 0,e.preventEnter=!1,e.scrollDebounceTimeout&&(clearTimeout(e.scrollDebounceTimeout),e.scrollDebounceTimeout=void 0),f!==void 0&&e.draggedNode&&(e.draggedNode.el.style.zIndex=f),requestAnimationFrame(()=>{dl(t,o),dl(t,l),dl(t,c)}),Nu(e.draggedNodes,e.currentParent,e),Wu(e.currentParent,void 0,e);const h={...e};i?.onDragend?.({parent:h.currentParent,values:xf(h.currentParent.el,h.currentParent.data),draggedNode:h.draggedNode,draggedNodes:h.draggedNodes,state:h}),e.emit("dragEnded",h),V0e()}function S1e(e,t){Rl(e.e),!t.pointerSelection&&t.selectedState&&Nu(t.selectedState.nodes,e.targetData.parent,t);const n=e.targetData.parent.data.config;t.pointerSelection=!1,"longPressTimeout"in t&&t.longPressTimeout&&clearTimeout(t.longPressTimeout),t.longPress=!1,dl(e.targetData.parent.data.enabledNodes.map(r=>r.el),n.longPressClass),Wr(t)&&n.handleEnd(t)}function C1e(e,t,n,r,i,o){const l=t.data.config;let c,f;const h=["display","flexDirection","alignItems","justifyContent","padding","paddingTop","margin","marginTop","marginBottom","marginLeft","marginRight","paddingBottom","paddingLeft","paddingRight","border","borderRadius","background","backgroundColor","boxShadow","font","color","lineHeight","gap","width","height","boxSizing","overflow"],m=(b,C)=>{const _=window.getComputedStyle(b);h.forEach(A=>{C.style[A]=_[A]})},y=(b,C={})=>{Object.assign(b.style,{position:"absolute",zIndex:"9999",pointerEvents:"none",willChange:"transform",boxSizing:"border-box",opacity:"0",overflow:"hidden",width:`${o.width}px`,height:`${o.height}px`,...C})};if(l.synthDragImage)f=l.synthDragImage(e,t,n,i),c=f.dragImage,c.setAttribute("popover","manual"),y(c);else if(!l.multiDrag||i.length===1)c=e.el.cloneNode(!0),m(e.el,c),c.setAttribute("popover","manual"),y(c);else{const b=document.createElement("div");b.setAttribute("popover","manual"),i.forEach(C=>{const _=C.el.cloneNode(!0);m(C.el,_),_.style.pointerEvents="none",_.style.margin="0",b.append(_)}),b.style.display="flex",b.style.flexDirection="column",b.style.padding="0",b.style.margin="0",b.style.position="absolute",b.style.zIndex="9999",b.style.pointerEvents="none",c=b}c.id="dnd-dragged-node-clone",t.el.appendChild(c),c.showPopover();const x={clonedDraggedEls:[],clonedDraggedNode:c,synthDragScrolling:!1,synthDragging:!0,rootScrollWidth:document.scrollingElement?.scrollWidth,rootScrollHeight:document.scrollingElement?.scrollHeight};return y9({...b9(e,t,n,i,f?.offsetX,f?.offsetY),...x})}function E1e(e,t,n){const r=e.targetData.parent.data.config;t.longPressTimeout=setTimeout(()=>{t&&(t.longPress=!0,r.longPressClass&&e.e.cancelable&&lf([n.el],r.longPressClass),Yr(e.e))},r.longPressDuration||1e3)}function a_(e,t=!0,n=!0){t&&(e.frameIdX!==void 0&&(cancelAnimationFrame(e.frameIdX),e.frameIdX=void 0),e.lastScrollDirectionX=void 0),n&&(e.frameIdY!==void 0&&(cancelAnimationFrame(e.frameIdY),e.frameIdY=void 0),e.lastScrollDirectionY=void 0),!e.frameIdX&&!e.frameIdY&&(e.preventEnter=!1)}function S9(e,t=!1){const{x:n,y:r}=e.coordinates,i=e.startLeft??0,o=e.startTop??0,l=window.scrollX??0,c=window.scrollY??0,f=n-i+l,h=r-o+c;e.clonedDraggedNode.style.transform=`translate3d(${f}px, ${h}px, 0px)`,t&&(e.clonedDraggedNode.style.opacity="1",dl(e.draggedNodes.map(m=>m.el),e.initialParent.data.config?.longPressClass))}function lL(e,t,n=!1){const r=Hf(e);t.coordinates.x=r.x,t.coordinates.y=r.y,S9(t,n),t.scrollDebounceTimeout&&(clearTimeout(t.scrollDebounceTimeout),t.scrollDebounceTimeout=void 0),t.scrollDebounceTimeout=setTimeout(()=>{ki(t)&&v0(t.coordinates,e,t)},16);const i=D1e(r);if(!i){document.dispatchEvent(new CustomEvent("handleRootPointerover",{detail:{e,state:t}}));return}const o={e,targetData:i,state:t};"node"in i?i.node.el.dispatchEvent(new CustomEvent("handleNodePointerover",{detail:o})):i.parent.el.dispatchEvent(new CustomEvent("handleParentPointerover",{detail:o}))}function A1e(e,t){if(!e.targetData.parent.data.config.nativeDrag)return;const{x:n,y:r}=Hf(e.e);t.coordinates.y=r,t.coordinates.x=n,Yr(e.e),Rl(e.e),Wr(t)&&v0({x:n,y:r},e.e,t),e.targetData.parent.el===t.currentParent?.el?C9(e,t):g0(e,t)}function T1e(e,t){if(!e.targetData.parent.data.config.nativeDrag)return;Yr(e.e),Rl(e.e);const{x:n,y:r}=Hf(e.e);Wr(t)&&v0({x:n,y:r},e.e,t),g0(e,t)}function O1e(e){e.detail.targetData.parent.el!==e.detail.state.currentParent.el&&g0(e.detail,e.detail.state)}function j1e({currentParent:e,targetParent:t,initialParent:n,draggedNodes:r,state:i}){if(t.el===e.el)return!1;const o=t.data.config;if(r[0].el.contains(t.el)||o.dropZone===!1)return!1;const l=n.data.config;return o.accepts?o.accepts(t,n,e,i):!(!o.group||o.group!==l.group)}function M1e(e,t){Yr(e.e)}function P1e(e,t){Yr(e.e)}function L1e(e,t,n,r){if(t.affectedNodes.map(m=>m.data.value).includes(e.targetData.node.data.value))return!1;if(t.remapJustFinished)return t.remapJustFinished=!1,(e.targetData.node.data.value===t.currentTargetValue||t.draggedNodes.map(m=>m.el).includes(e.targetData.node.el))&&(t.currentTargetValue=e.targetData.node.data.value),!1;if(t.preventEnter)return!1;if(t.draggedNodes.map(m=>m.el).includes(e.targetData.node.el))return t.currentTargetValue=void 0,!1;if(e.targetData.node.data.value===t.currentTargetValue||e.targetData.parent.el!==t.currentParent?.el||e.targetData.parent.data.config.sortable===!1||e.targetData.node.el.contains(t.draggedNodes[0].el))return!1;const i=e.targetData.node.el.getBoundingClientRect(),o=t.draggedNode.el.getBoundingClientRect(),l=i.y-o.y,c=i.x-o.x;let f;Math.abs(l)>Math.abs(c)?f=l>0?"above":"below":f=c>0?"left":"right";const h=t.currentParent.data.config.threshold;switch(f){case"left":if(n>i.x+i.width*h.horizontal)return t.incomingDirection="left",!0;break;case"right":if(ni.y+i.height*h.vertical)return t.incomingDirection="above",!0;break;case"below":if(re.targetData.node.data.index?[e.targetData.node.data.index,t.draggedNode.data.index]:[t.draggedNode.data.index,e.targetData.node.data.index];t.targetIndex=e.targetData.node.data.index,t.affectedNodes=e.targetData.parent.data.enabledNodes.filter(o=>i[0]<=o.data.index&&o.data.index<=i[1]&&o.el!==t.draggedNode.el),e.targetData.parent.data.config.performSort({parent:e.targetData.parent,draggedNodes:t.draggedNodes,targetNodes:[e.targetData.node]})}function Si(e){function t(n){const r=lo.get(n);if(!r)return;const i=Dr.get(n.parentNode);if(i)return{node:{el:n,data:r},parent:{el:n.parentNode,data:i}}}return n=>{const r=t(n.currentTarget);if(r)return e({e:n,targetData:r},Ie)}}function g0(e,t){Yr(e.e),j1e({currentParent:t.currentParent,targetParent:e.targetData.parent,initialParent:t.initialParent,draggedNodes:t.draggedNodes,state:t})&&(e.targetData.parent.data.config.performTransfer({currentParent:t.currentParent,targetParent:e.targetData.parent,initialParent:t.initialParent,draggedNodes:t.draggedNodes,initialIndex:t.initialIndex,state:t,targetNodes:"node"in e.targetData?[e.targetData.node]:[]}),t.currentParent=e.targetData.parent,t.transferred=!0)}function Cg(e){function t(n){const r=Dr.get(n);if(r)return{parent:{el:n,data:r}}}return n=>{const r=t(n.currentTarget);if(r)return e({e:n,targetData:r},Ie)}}function lf(e,t,n=!1){function r(i,o){lo.set(i,o)}for(const i of e){const o=lo.get(i),l=N1e(i,t,o,n);l&&r(i,l)}}function N1e(e,t,n,r=!1){if(!t)return;const i=g9(t);if(!i.length)return;if(!n){e.classList.add(...i);return}const o=[];for(const l of i)e.classList.contains(l)?e.classList.contains(l)&&r===!1&&o.push(l):e.classList.add(l);return n.privateClasses=o,n}function dl(e,t){if(!t)return;const n=g9(t);if(n.length)for(const r of e){if(!y0(r)){r.classList.remove(...n);continue}const i=lo.get(r)||Dr.get(r);if(i)for(const o of n)i.privateClasses.includes(o)||r.classList.remove(o)}}function uL(e,t,n,r,i){const o=i.axis==="x",l=e===document.scrollingElement,c=o?"scrollLeft":"scrollTop",f=o?"clientWidth":"clientHeight",h=o?"offsetWidth":"offsetHeight",m=o?"scrollWidth":"scrollHeight",y=o?t.clientX:t.clientY,x=o?r.left:r.top,b=o?n.overflowX:n.overflowY;if(l){const C=e[c],_=e[f],A=C>0,O=C+_<(o?i.state.rootScrollWidth||0:e[m]);return o?{left:A&&y<_*.075,right:O&&y>_*(1-.075)}:{up:A&&y<_*.075,down:O&&y>_*(1-.075)}}if((b==="auto"||b==="scroll")&&e!==document.body&&e!==document.documentElement){const C=e[m],_=e[h],A=e[c],O=A>0,P=Ax+_*(1-.075)}:{up:O&&yx+_*(1-.075)}}return o?{left:!1,right:!1}:{up:!1,down:!1}}function R1e(e,t,n,r){if(!Wr(n)||!n.draggedNode)return;n.preventEnter=!0;const i=r.axis==="x",o=r.direction==="positive"?1:-1,l=20,c=i?"lastScrollDirectionX":"lastScrollDirectionY",f=i?"frameIdX":"frameIdY";n[f]!==void 0&&(cancelAnimationFrame(n[f]),n[f]=void 0),n[c]=r.direction;const h=()=>{if(!Wr(n)||!n.draggedNode){n[f]!==void 0&&(cancelAnimationFrame(n[f]),n[f]=void 0);return}const m=i?"scrollLeft":"scrollTop",y=i?"clientWidth":"clientHeight",x=i?"scrollWidth":"scrollHeight",b=e[m],C=e[y],_=e[x];if(!(o>0?b+C<_:b>0)){n[f]=void 0,n[c]=void 0;return}e[m]+=l*o,ki(n)&&S9(n),n[f]=requestAnimationFrame(h)};n[f]=requestAnimationFrame(h)}function cL(e,t,n){const r=e.getBoundingClientRect();return t>=r.left&&t<=r.right&&n>=r.top&&n<=r.bottom}function v0(e,t,n){if(!Wr(n)||!n.draggedNode)return;a_(n);const{x:r,y:i}=e;let o=!1;const l=(f,h,m)=>{R1e(m,t,n,{axis:f,direction:h}),o=!0},c=f=>{const h=window.getComputedStyle(f),m=f.getBoundingClientRect(),y=uL(f,t,h,m,{axis:"x",state:n}),x=uL(f,t,h,m,{axis:"y"});(y.left||y.right)&&(n.lastScrollContainerX=f,l("x",y.right?"positive":"negative",f)),(x.up||x.down)&&(n.lastScrollContainerY=f,l("y",x.down?"positive":"negative",f))};if(n.lastScrollContainerX&&cL(n.lastScrollContainerX,r,i)&&c(n.lastScrollContainerX),!o&&n.lastScrollContainerY&&cL(n.lastScrollContainerY,r,i)&&c(n.lastScrollContainerY),!o){let f=document.elementFromPoint(r,i);for(;f&&!(o&&n.lastScrollContainerX&&n.lastScrollContainerY);)f instanceof HTMLElement&&c(f),f=f.parentElement}if(!o){const f=document.scrollingElement;f instanceof HTMLElement&&c(f)}o||a_(n)}function D1e(e){let t=document.elementFromPoint(e.x,e.y);if(!y0(t))return;let n,r=!0;for(;t&&r;){if(lo.has(t)||Dr.has(t)){r=!1,n=Dr.has(t);break}t=t.parentNode}if(n){const i=Dr.get(t);return i?{parent:{el:t,data:i}}:void 0}else{const i=lo.get(t);if(!i)return;const o=Dr.get(t.parentNode);return o?{node:{el:t,data:i},parent:{el:t.parentNode,data:o}}:void 0}}function y0(e){return e instanceof HTMLElement&&e.parentNode instanceof HTMLElement}function Jv(e,t){const n=new AbortController;for(const r in t){const i=t[r];e.addEventListener(r,i,{signal:n.signal,passive:!1,capture:r==="focus"||r==="blur"})}return n}function k1e(e){if(e instanceof HTMLElement)return e;if("current"in e&&e.current instanceof HTMLElement)return e.current;console.warn("Invalid parent element",e)}function I1e(e,t){const n=k1e(e);n&&t(n)}var ey=new WeakMap;function z1e(e){const t=ey.get(e);return t?t[0]:(console.warn("No values found for parent element"),[])}function U1e(e,t){const n=ey.get(t);n&&n[1](e),ey.set(t,[e,n[1]])}function B1e(e,t){return n=>{ey.set(n,t),Z0e({parent:n,getValues:z1e,setValues:U1e,config:e})}}function fL(e){S3&&(Array.isArray(e)||(e=[e]),e.forEach(t=>{const{parent:n,state:r,...i}=t;I1e(n,B1e(i,r))}))}function F1e(e,t={}){const n=w.useRef(null),[r,i]=w.useState(e);function o(l={}){fL({parent:n,state:[r,i],...l})}return w.useEffect(()=>{fL({parent:n,state:[r,i],...t})},[r]),w.useEffect(()=>()=>{n.current&&x9(n.current)},[]),[n,r,i,o]}const b0=()=>{const e=uo(),t=ps(),n=Zu(),r=w.useMemo(()=>{const{orderBy:o,tags:l,excludeTags:c,excludeBots:f,excludeMaxVisitsReached:h,excludePastValidUntil:m,...y}=n,x=o?IZ(o):void 0,b=l?.split(",")??[];return{...y,orderBy:x,tags:b,excludeTags:c?.split(",")??[],excludeBots:f!==void 0?f==="true":void 0,excludeMaxVisitsReached:h!==void 0?h==="true":void 0,excludePastValidUntil:m!==void 0?m==="true":void 0}},[n]),i=w.useCallback(o=>{const l={...r,...o},{orderBy:c,tags:f,excludeTags:h,excludeBots:m,excludeMaxVisitsReached:y,excludePastValidUntil:x,...b}=l,C={...b,orderBy:c&&kZ(c),tags:f.length>0?f.join(","):void 0,excludeTags:h.length>0?h.join(","):void 0,excludeBots:Bb(m),excludeMaxVisitsReached:Bb(y),excludePastValidUntil:Bb(x)},_=Q_(C),A=_?`?${_}`:"";e(`${t}/list-short-urls/1${A}`)},[r,e,t]);return[r,i]},C3=()=>{const{domain:e}=Zu(),{shortCode:t=""}=Ef();return w.useMemo(()=>({shortCode:x3(t),domain:e}),[e,t])},x0=()=>{const e=fZ();return g.jsx(Cy,{size:"lg",className:"[&]:p-1 mr-4",onClick:e,"aria-label":"Go back",children:g.jsx(Be,{icon:xH})})},$1e={AF:"Afghanistan",AL:"Albania",DZ:"Algeria",AS:"American Samoa",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antarctica",AG:"Antigua and Barbuda",AR:"Argentina",AM:"Armenia",AW:"Aruba",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BS:"Bahamas",BH:"Bahrain",BD:"Bangladesh",BB:"Barbados",BY:"Belarus",BE:"Belgium",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivia",BA:"Bosnia and Herzegovina",BW:"Botswana",BR:"Brazil",IO:"British Indian Ocean Territory",VG:"British Virgin Islands",BN:"Brunei",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",KH:"Cambodia",CM:"Cameroon",CA:"Canada",CV:"Cape Verde",KY:"Cayman Islands",CF:"Central African Republic",TD:"Chad",CL:"Chile",CN:"China",CX:"Christmas Island",CC:"Cocos Islands",CO:"Colombia",KM:"Comoros",CK:"Cook Islands",CR:"Costa Rica",HR:"Croatia",CU:"Cuba",CW:"Curacao",CY:"Cyprus",CZ:"Czech Republic",CD:"Democratic Republic of the Congo",DK:"Denmark",DJ:"Djibouti",DM:"Dominica",DO:"Dominican Republic",TL:"East Timor",EC:"Ecuador",EG:"Egypt",SV:"El Salvador",GQ:"Equatorial Guinea",ER:"Eritrea",EE:"Estonia",ET:"Ethiopia",FK:"Falkland Islands",FO:"Faroe Islands",FJ:"Fiji",FI:"Finland",FR:"France",PF:"French Polynesia",GA:"Gabon",GM:"Gambia",GE:"Georgia",DE:"Germany",GH:"Ghana",GI:"Gibraltar",GR:"Greece",GL:"Greenland",GD:"Grenada",GU:"Guam",GT:"Guatemala",GG:"Guernsey",GN:"Guinea",GW:"Guinea-Bissau",GY:"Guyana",HT:"Haiti",HN:"Honduras",HK:"Hong Kong",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran",IQ:"Iraq",IE:"Ireland",IM:"Isle of Man",IL:"Israel",IT:"Italy",CI:"Ivory Coast",JM:"Jamaica",JP:"Japan",JE:"Jersey",JO:"Jordan",KZ:"Kazakhstan",KE:"Kenya",KI:"Kiribati",XK:"Kosovo",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Laos",LV:"Latvia",LB:"Lebanon",LS:"Lesotho",LR:"Liberia",LY:"Libya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MO:"Macao",MK:"Macedonia",MG:"Madagascar",MW:"Malawi",MY:"Malaysia",MV:"Maldives",ML:"Mali",MT:"Malta",MH:"Marshall Islands",MR:"Mauritania",MU:"Mauritius",YT:"Mayotte",MX:"Mexico",FM:"Micronesia",MD:"Moldova",MC:"Monaco",MN:"Mongolia",ME:"Montenegro",MS:"Montserrat",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar",NA:"Namibia",NR:"Nauru",NP:"Nepal",NL:"Netherlands",AN:"Netherlands Antilles",NC:"New Caledonia",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NU:"Niue",KP:"North Korea",MP:"Northern Mariana Islands",NO:"Norway",OM:"Oman",PK:"Pakistan",PW:"Palau",PS:"Palestine",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PN:"Pitcairn",PL:"Poland",PT:"Portugal",PR:"Puerto Rico",QA:"Qatar",CG:"Republic of the Congo",RE:"Reunion",RO:"Romania",RU:"Russia",RW:"Rwanda",BL:"Saint Barthelemy",SH:"Saint Helena",KN:"Saint Kitts and Nevis",LC:"Saint Lucia",MF:"Saint Martin",PM:"Saint Pierre and Miquelon",VC:"Saint Vincent and the Grenadines",WS:"Samoa",SM:"San Marino",ST:"Sao Tome and Principe",SA:"Saudi Arabia",SN:"Senegal",RS:"Serbia",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapore",SX:"Sint Maarten",SK:"Slovakia",SI:"Slovenia",SB:"Solomon Islands",SO:"Somalia",ZA:"South Africa",KR:"South Korea",SS:"South Sudan",ES:"Spain",LK:"Sri Lanka",SD:"Sudan",SR:"Suriname",SJ:"Svalbard and Jan Mayen",SZ:"Swaziland",SE:"Sweden",CH:"Switzerland",SY:"Syria",TW:"Taiwan",TJ:"Tajikistan",TZ:"Tanzania",TH:"Thailand",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad and Tobago",TN:"Tunisia",TR:"Turkey",TM:"Turkmenistan",TC:"Turks and Caicos Islands",TV:"Tuvalu",VI:"U.S. Virgin Islands",UG:"Uganda",UA:"Ukraine",AE:"United Arab Emirates",GB:"United Kingdom",US:"United States",UY:"Uruguay",UZ:"Uzbekistan",VU:"Vanuatu",VA:"Vatican",VE:"Venezuela",VN:"Vietnam",WF:"Wallis and Futuna",EH:"Western Sahara",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe"},V1e=({deviceType:e,onDeviceTypeChange:t})=>{const n=cl("desktopDeviceTypes"),r=w.useMemo(()=>{const i={android:"Android",ios:"iOS"};return n&&(i.mobile="Any mobile device",i.windows="Windows",i.macos="MacOS",i.linux="Linux",i.chromeos="ChromeOS"),i.desktop="Any desktop device",i},[n]);return g.jsxs(Z_,{label:"Device type:",value:e??void 0,onChange:i=>t(i.target.value),hiddenRequired:!0,children:[!e&&g.jsx("option",{value:"",children:"- Select type -"}),Object.entries(r).map(([i,o])=>g.jsx("option",{value:i,children:o},i))]})},E3=({value:e,onValueChange:t,label:n,placeholder:r})=>g.jsx(di,{label:`${n}:`,value:e??"",onChange:i=>t(i.target.value),placeholder:r,hiddenRequired:!0}),H1e=({language:e,onLanguageChange:t})=>g.jsx(E3,{value:e,onValueChange:t,label:"Language",placeholder:"en-US / en"}),E2=({name:e,value:t,onNameChange:n,onValueChange:r})=>g.jsxs(g.Fragment,{children:[g.jsx(di,{label:"Param name:",value:e??"",onChange:i=>n(i.target.value),placeholder:"hello",hiddenRequired:!0}),typeof t=="string"&&g.jsx(di,{label:"Param value:",value:t,onChange:i=>r(i.target.value),placeholder:"world",hiddenRequired:!0})]}),q1e=({ipAddress:e,onIpAddressChange:t})=>g.jsx(E3,{value:e,onValueChange:t,label:"IP address",placeholder:"192.168.1.10"}),G1e=({countryCode:e,onCountryCodeChange:t})=>g.jsxs(Z_,{label:"Country:",value:e??void 0,onChange:n=>t(n.target.value),hiddenRequired:!0,children:[!e&&g.jsx("option",{value:"",children:"- Select country -"}),Object.entries($1e).map(([n,r])=>g.jsx("option",{value:n,children:r},n))]}),Y1e=({cityName:e,onCityNameChange:t})=>g.jsx(E3,{value:e,onValueChange:t,label:"City name",placeholder:"New York"}),W1e=({condition:e,onConditionChange:t,onDelete:n})=>{const r=w.useCallback(m=>t({type:m,matchValue:null,matchKey:null}),[t]),i=w.useCallback(m=>t({...e,matchValue:m}),[e,t]),o=w.useCallback(m=>t({...e,matchKey:m}),[e,t]),l=cl("ipRedirectCondition"),c=cl("geolocationRedirectCondition"),f=cl("advancedQueryRedirectConditions"),h=w.useMemo(()=>{const m={device:"Device type",language:"Language","query-param":"Query param"};return f&&(m["any-value-query-param"]="Any value query param",m["valueless-query-param"]="Valueless query param"),l&&(m["ip-address"]="IP address"),c&&(m["geolocation-country-code"]="Country (geolocation)",m["geolocation-city-name"]="City name (geolocation)"),m},[f,c,l]);return g.jsxs("div",{className:Oe("flex flex-col gap-2","border border-lm-border dark:border-dm-border","rounded-md relative p-4 h-full"),children:[g.jsxs("div",{children:[g.jsx(Tt,{variant:"secondary","aria-label":"Remove condition",onClick:n,className:Oe("absolute -top-3.5 -right-3.5 [&]:px-2","[&]:rounded-full bg-lm-primary dark:bg-dm-primary"),children:g.jsx(Be,{icon:fy,widthAuto:!0})}),g.jsx(Z_,{label:"Type:",value:e.type,onChange:m=>r(m.target.value),hiddenRequired:!0,children:Object.entries(h).map(([m,y])=>g.jsx("option",{value:m,children:y},m))})]}),e.type==="device"&&g.jsx(V1e,{deviceType:e.matchValue,onDeviceTypeChange:i}),e.type==="language"&&g.jsx(H1e,{language:e.matchValue,onLanguageChange:i}),e.type==="query-param"&&g.jsx(E2,{name:e.matchKey,value:e.matchValue??"",onNameChange:o,onValueChange:i}),e.type==="any-value-query-param"&&g.jsx(E2,{name:e.matchKey,onNameChange:o,onValueChange:i}),e.type==="valueless-query-param"&&g.jsx(E2,{name:e.matchKey,onNameChange:o,onValueChange:i}),e.type==="ip-address"&&g.jsx(q1e,{ipAddress:e.matchValue,onIpAddressChange:i}),e.type==="geolocation-country-code"&&g.jsx(G1e,{countryCode:e.matchValue,onCountryCodeChange:i}),e.type==="geolocation-city-name"&&g.jsx(Y1e,{cityName:e.matchValue,onCityNameChange:i})]})},E9=({isOpen:e,onClose:t,onSave:n,initialData:r})=>{const[i,o]=w.useState(r??{longUrl:"",conditions:[]}),l=w.useCallback(()=>{i&&n(i),t()},[n,i,t]),c=w.useCallback(()=>o(({longUrl:x,conditions:b})=>({longUrl:x,conditions:[...b,{type:"device",matchValue:null,matchKey:null}]})),[]),f=w.useCallback((x,b)=>o(({longUrl:C,conditions:_})=>{const A=[..._];return A[x]=b,{longUrl:C,conditions:A}}),[]),h=w.useCallback(x=>o(({longUrl:b,conditions:C})=>{const _=[...C];return _.splice(x,1),{longUrl:b,conditions:_}}),[]),m=w.useRef(null),y=w.useCallback(()=>o(r??{longUrl:"",conditions:[]}),[r]);return w.useEffect(()=>{const x=new MutationObserver(()=>{m.current&&e&&(m.current.focus(),x.disconnect())});return x.observe(document.body,{childList:!0,subtree:!0}),()=>x.disconnect()},[e]),g.jsxs(co,{size:"xl",title:"Redirect rule",open:e,onClose:t,onClosed:y,onConfirm:l,confirmDisabled:i.conditions.length===0,confirmText:"Confirm",children:[g.jsx(di,{label:"Long URL:",type:"url",placeholder:"https://www.example.com",value:i.longUrl,onChange:x=>o(b=>({...b,longUrl:x.target.value})),hiddenRequired:!0,ref:m}),g.jsx("hr",{}),g.jsxs("div",{className:"flex justify-between",children:[g.jsx("b",{children:"Conditions:"}),g.jsx(Tt,{className:"[&]:px-1.5",variant:"secondary","aria-label":"Add condition",onClick:c,children:g.jsx(Be,{icon:Zh})})]}),i.conditions.length===0&&g.jsx("div",{className:"text-center",children:g.jsx("i",{children:"Add conditions..."})}),i.conditions.length>0&&g.jsx("div",{className:"pr-3 mt-6 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:i.conditions.map((x,b)=>g.jsx(W1e,{condition:x,onConditionChange:C=>f(b,C),onDelete:()=>h(b)},`${b}_${x.type}`))})]})},K1e=({priority:e,isLast:t,redirectRule:n,onDelete:r,onMoveUp:i,onMoveDown:o,onUpdate:l})=>{const{flag:c,setToTrue:f,setToFalse:h}=Cn();return g.jsxs(Nt,{children:[g.jsxs("div",{className:"flex align-center gap-4",children:[g.jsx("div",{className:"flex flex-col my-auto hidden md:block cursor-grab drag-n-drop-handler",children:g.jsx(Be,{icon:pH})}),g.jsxs("div",{className:"flex flex-col my-auto",children:[g.jsx(Tt,{variant:"secondary","aria-label":`Move rule with priority ${e} up`,disabled:e===1,onClick:i,className:"[&]:px-2 rounded-b-none mb-[-1px]",children:g.jsx(Be,{icon:oH})}),g.jsx(Tt,{variant:"secondary","aria-label":`Move rule with priority ${e} down`,disabled:t,onClick:o,className:"[&]:px-2 rounded-t-none",children:g.jsx(Be,{icon:jH})})]}),g.jsxs("div",{className:"grow",children:[g.jsxs("div",{className:"mb-2",children:[g.jsx("b",{children:"Long URL:"})," ",g.jsx(Li,{href:n.longUrl,"data-testid":"rule-long-url"})]}),g.jsxs("div",{className:"flex flex-col lg:flex-row gap-2",children:[g.jsx("b",{children:"Conditions:"}),n.conditions.map((m,y)=>g.jsxs("div",{className:"rounded-sm bg-gray-600 px-1 text-white",children:[m.type==="device"&&g.jsxs(g.Fragment,{children:["Device is ",m.matchValue]}),m.type==="language"&&g.jsxs(g.Fragment,{children:[m.matchValue," language is accepted"]}),m.type==="query-param"&&g.jsxs(g.Fragment,{children:["Query string contains ",m.matchKey,"=",m.matchValue]}),m.type==="ip-address"&&g.jsxs(g.Fragment,{children:["IP address matches ",m.matchValue]}),m.type==="geolocation-country-code"&&g.jsxs(g.Fragment,{children:["Country code is ",m.matchValue]}),m.type==="geolocation-city-name"&&g.jsxs(g.Fragment,{children:["City name is ",m.matchValue]})]},`${m.type}_${y}`))]})]}),g.jsxs("div",{className:"flex flex-col sm:flex-row gap-1 my-auto",children:[g.jsx(Tt,{className:"[&]:px-1.5",variant:"secondary","aria-label":`Edit rule with priority ${e}`,onClick:f,children:g.jsx(Be,{icon:ON})}),g.jsx(Tt,{className:"[&]:px-2",variant:"danger","aria-label":`Delete rule with priority ${e}`,onClick:r,children:g.jsx(Be,{icon:sH})})]})]}),g.jsx(E9,{onSave:l,isOpen:c,onClose:h,initialData:n})]})},Z1e=({shortUrlRedirectRules:e,getShortUrlRedirectRules:t,getShortUrlsDetails:n,shortUrlsDetails:r,setShortUrlRedirectRules:i,shortUrlRedirectRulesSaving:o,resetSetRules:l})=>{const c=C3(),{shortUrls:f}=r,h=c&&f?.get(c),[m,y,x]=F1e([],{dragHandle:".drag-n-drop-handler",dropZoneClass:"opacity-25"}),{saving:b,saved:C,errorData:_}=o,{flag:A,setToFalse:O,setToTrue:P}=Cn(),N=w.useCallback(re=>x((J=[])=>[...J,re]),[x]),F=w.useCallback(re=>x((J=[])=>{const oe=[...J];return oe.splice(re,1),oe}),[x]),U=w.useCallback((re,J)=>x((oe=[])=>{const we=[...oe];return we[re]=J,we}),[x]),W=w.useCallback((re,J)=>x((oe=[])=>{if(!oe[J])return oe;const we=[...oe],se=we[J];return we[J]=we[re],we[re]=se,we}),[x]),X=w.useCallback(re=>W(re,re-1),[W]),ae=w.useCallback(re=>W(re,re+1),[W]),ce=w.useCallback(re=>{re.preventDefault(),y&&i({shortUrl:c,data:{redirectRules:y}})},[c,y,i]);return w.useEffect(()=>(t(c),n([c]),l),[t,n,c,l]),w.useEffect(()=>{e.redirectRules&&x(e.redirectRules)},[x,e.redirectRules]),g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsx("header",{children:g.jsxs(Nt,{children:[g.jsxs("h2",{className:"sm:flex justify-between items-center",children:[g.jsx(x0,{}),g.jsxs("div",{className:"text-center grow",children:[r.loading&&g.jsx(g.Fragment,{children:"Loading..."}),!r.loading&&g.jsxs("small",{children:["Redirect rules for ",g.jsx(Li,{href:h?.shortUrl??""})]})]})]}),g.jsx("hr",{}),g.jsxs("div",{children:[g.jsx("p",{children:"Configure dynamic conditions that will be checked at runtime."}),g.jsxs("p",{children:["If no conditions match, visitors will be redirected to: ",g.jsx(Li,{href:e.defaultLongUrl??""})]})]})]})}),g.jsx("div",{children:g.jsxs(Tt,{onClick:P,children:[g.jsx(Be,{icon:Zh})," Add rule"]})}),g.jsxs("form",{onSubmit:ce,children:[e.loading&&g.jsx(Ko,{loading:!0}),y.length===0&&!e.loading&&g.jsx(Nt,{className:"text-center",children:g.jsx("i",{children:"This short URL has no dynamic redirect rules"})}),g.jsx("div",{className:"flex flex-col gap-2",ref:m,children:y.map((re,J)=>g.jsx(K1e,{redirectRule:re,priority:J+1,isLast:J===y.length-1,onDelete:()=>F(J),onMoveUp:()=>X(J),onMoveDown:()=>ae(J),onUpdate:oe=>U(J,oe)},`${re.longUrl}_${J}`))}),g.jsx("div",{className:"text-center mt-4",children:g.jsx(Tt,{type:"submit",inline:!0,className:"max-md:w-full",disabled:b,"data-testid":"save-button",children:b?"Saving...":"Save rules"})})]}),_&&g.jsx(Gr,{variant:"error",children:g.jsx(so,{errorData:_,fallbackMessage:"An error occurred while saving short URL redirect rules :("})}),C&&g.jsx(Gr,{variant:"success",children:"Redirect rules properly saved."}),g.jsx(E9,{isOpen:A,onClose:O,onSave:N})]})},X1e=(e,t)=>{e.serviceFactory("ShortUrlRedirectRules",()=>Z1e),e.decorator("ShortUrlRedirectRules",t(["shortUrlRedirectRules","shortUrlsDetails","shortUrlRedirectRulesSaving"],["getShortUrlRedirectRules","getShortUrlsDetails","setShortUrlRedirectRules","resetSetRules"])),e.serviceFactory("getShortUrlRedirectRules",U0e,"apiClientFactory"),e.serviceFactory("setShortUrlRedirectRules",k0e,"apiClientFactory"),e.serviceFactory("resetSetRules",n=>n.resetSetRules,"setShortUrlRedirectRulesReducerCreator"),e.serviceFactory("shortUrlRedirectRulesReducerCreator",B0e,"getShortUrlRedirectRules"),e.serviceFactory("shortUrlRedirectRulesReducer",n=>n.reducer,"shortUrlRedirectRulesReducerCreator"),e.serviceFactory("setShortUrlRedirectRulesReducerCreator",I0e,"setShortUrlRedirectRules"),e.serviceFactory("setShortUrlRedirectRulesReducer",n=>n.reducer,"setShortUrlRedirectRulesReducerCreator")},Q1e=({creation:e,resetCreateShortUrl:t,canBeClosed:n=!1})=>{const{error:r,saved:i}=e;if(w.useEffect(()=>{t()},[t]),r)return g.jsxs(Gr,{variant:"error",className:"mt-4 relative",children:[n&&g.jsx("div",{className:"absolute right-1.5 top-1.5","data-testid":"error-close-button",children:g.jsx(Iu,{onClick:t})}),g.jsx(so,{errorData:e.errorData,fallbackMessage:"An error occurred while creating the URL :("})]});if(!i)return null;const{shortUrl:o}=e.result;return g.jsxs(Gr,{variant:"success",className:"mt-4 relative",children:[n&&g.jsx("div",{className:"absolute right-1.5 top-1.5","data-testid":"success-close-button",children:g.jsx(Iu,{onClick:t})}),g.jsxs("div",{className:"flex items-center justify-center gap-1",children:[g.jsxs("span",{children:[g.jsx("b",{children:"Great!"})," The short URL is ",g.jsx("b",{children:o})]}),g.jsx(i6,{text:o})]})]})},A9=({createShortUrl:e,shortUrlCreation:t,resetCreateShortUrl:n,basicMode:r=!1})=>{const{ShortUrlForm:i}=An(A9),o=Fn("shortUrlCreation"),{"long-url":l=""}=Zu(),c=w.useMemo(()=>({longUrl:l,tags:[],customSlug:"",title:void 0,shortCodeLength:void 0,domain:"",validSince:void 0,validUntil:void 0,maxVisits:void 0,findIfExists:!1,forwardQuery:o?.forwardQuery??!0}),[l,o?.forwardQuery]);return g.jsxs(g.Fragment,{children:[g.jsx(i,{initialState:c,saving:t.saving,basicMode:r,onSave:async f=>(n(),e(f))}),g.jsx(Q1e,{creation:t,resetCreateShortUrl:n,canBeClosed:r})]})},J1e=Tn(A9,["ShortUrlForm"]),T9=({shortUrlsDetails:e,getShortUrlsDetails:t,shortUrlEdition:n,editShortUrl:r})=>{const{ShortUrlForm:i}=An(T9),o=C3(),{loading:l,error:c,errorData:f,shortUrls:h}=e,m=o&&h?.get(o),{saving:y,saved:x,error:b,errorData:C}=n,_=w.useMemo(()=>O0e(m),[m]);return w.useEffect(()=>{o&&t([o])},[t,o]),l?g.jsx(Ko,{loading:!0}):c?g.jsx(Gr,{variant:"error",children:g.jsx(so,{errorData:f,fallbackMessage:"An error occurred while loading short URL detail :("})}):g.jsxs("div",{className:"flex flex-col gap-y-4",children:[g.jsx("header",{children:g.jsx(Nt,{children:g.jsxs("h2",{className:"sm:flex items-center",children:[g.jsx(x0,{}),g.jsx("div",{className:"text-center grow",children:g.jsxs("small",{children:["Edit ",g.jsx(Li,{href:m?.shortUrl??""})]})})]})})}),g.jsx(i,{initialState:_,saving:y,onSave:async A=>{m&&r({...m,data:A})}}),x&&b&&g.jsx(Gr,{variant:"error",children:g.jsx(so,{errorData:C,fallbackMessage:"An error occurred while updating short URL :("})}),x&&!b&&g.jsx(Gr,{variant:"success",children:"Short URL properly edited."})]})},ebe=Tn(T9,["ShortUrlForm"]),A2="delete",tbe=({shortUrl:e,onClose:t,isOpen:n,shortUrlDeletion:r,resetDeleteShortUrl:i,deleteShortUrl:o,shortUrlDeleted:l})=>{const[c,f]=w.useState("");w.useEffect(()=>i,[i]);const{loading:h,error:m,deleted:y,errorData:x}=r,b=w.useCallback(()=>{i(),t()},[i,t]),C=w.useCallback(()=>o(e).then(_=>!g3(_)&&t()),[o,e,t]);return g.jsx(co,{open:n,title:"Delete short URL",variant:"danger",confirmText:h?"Deleting...":"Delete",confirmDisabled:c!==A2||h,onConfirm:C,onClose:b,onClosed:()=>y&&l(e),children:g.jsxs("div",{className:"flex flex-col gap-y-2",children:[g.jsxs("p",{children:[g.jsx("b",{className:"text-danger",children:"Caution!"})," You are about to delete a short URL."]}),g.jsx("p",{children:"This action cannot be undone. Once you have deleted it, all the visits stats will be lost."}),g.jsx(di,{label:g.jsxs(g.Fragment,{children:["Type ",g.jsx("b",{children:A2})," to confirm deletion."]}),type:"text",placeholder:A2,value:c,onChange:_=>f(_.target.value),onKeyDown:_=>_.key==="Enter"&&C()}),m&&g.jsx(Gr,{variant:o0e(x)?"warning":"error",size:"sm",className:"mt-2",children:g.jsx(so,{errorData:x,fallbackMessage:"Something went wrong while deleting the URL :("})})]})})},O9=({amount:e=0,loading:t=!1,...n})=>g.jsxs(Tt,{...n,disabled:t,solid:!ls(),children:[g.jsx(Be,{icon:mH})," ",t?"Exporting...":g.jsxs(g.Fragment,{children:["Export (",Sn(e),")"]})]}),dL=20,j9=({amount:e=0})=>{const{apiClientFactory:t,ReportExporter:n}=An(j9),[{tags:r,search:i,startDate:o,endDate:l,orderBy:c,tagsMode:f}]=b0(),{flag:h,setToTrue:m,setToFalse:y}=Cn(),x=w.useCallback(async()=>{const b=e/dL,C=async(A=1)=>{const{data:O}=await t().listShortUrls({page:`${A}`,tags:r,searchTerm:i,startDate:o,endDate:l,orderBy:c,tagsMode:f,itemsPerPage:dL});return A>=b?O:O.concat(await C(A+1))};m();const _=await C();n.exportShortUrls(_.map(A=>{const{hostname:O,pathname:P}=new URL(A.shortUrl),N=P.substring(1);return{createdAt:A.dateCreated,domain:O,shortCode:N,shortUrl:A.shortUrl,longUrl:A.longUrl,title:A.title??"",tags:A.tags.join("|"),visits:A.visitsSummary.total}})),y()},[e,t,l,c,n,i,o,m,y,r,f]);return g.jsx(O9,{loading:h,className:"max-xl:w-full",amount:e,onClick:x})},nbe=Tn(j9,["apiClientFactory","ReportExporter"]),rbe="yyyy-MM-dd",M9="yyyy-MM-dd HH:mm",Tl=()=>new Date,A3=e=>typeof e!="string",T3=(e,t)=>!e||!A3(e)?e:t?hv(e,t):Iee(e),Ol=e=>T3(e,void 0),sl=e=>T3(e,rbe),Yh=e=>T3(e,M9),ji=e=>A3(e)?e:xl(e),Em=(e,t,n)=>{const r=ji(e),i=t&&ji(t),o=n&&ji(n);if(i&&o)try{return Bee(r,{start:i,end:o})}catch{return!1}return i?mw(r,i)||Uee(r,i):o?mw(r,o)||mv(r,o):!0},yu=(e,t)=>mw(e,t)||mv(e,t),ty=({date:e,format:t=M9,relative:n=!1})=>{const r=A3(e)?e:xl(e);return g.jsx("time",{dateTime:`${zee(r)}000`,children:n?`${kee(Tl(),r)} ago`:hv(r,t)})},P9=(e,{shortCode:t,domain:n},r)=>{const i=n?`?domain=${n}`:"";return`${e}/short-code/${a9(t)}/${r}${i}`},L9=({shortUrl:e,suffix:t,asLink:n,children:r,...i})=>{const o=ps();return!n||!e?g.jsx("span",{...i,children:r}):g.jsx(Ir,{to:P9(o,e,t),...i,children:r})},ibe=e=>{const{meta:t,visitsSummary:n}=e,{maxVisits:r,validSince:i,validUntil:o}=t,l=n.total;return r&&l>=r?{icon:_H,className:"text-danger",description:`This short URL cannot be currently visited because it has reached the maximum amount of ${r} visit${r>1?"s":""}`}:o&&mv(ji(o),Tl())?{icon:lT,className:"text-danger",description:`This short URL cannot be visited since ${Yh(ji(o))}`}:i&&mv(Tl(),ji(i))?{icon:lT,className:"text-warning",description:`This short URL will start working on ${Yh(ji(i))}`}:{icon:Ru,className:"text-lm-brand dark:text-dm-brand",description:"This short URL can be visited normally"}},abe=({shortUrl:e})=>{const{icon:t,className:n,description:r}=w.useMemo(()=>ibe(e),[e]);return g.jsx("span",{className:"cursor-help",title:r,children:g.jsx(Be,{icon:t,className:n})})},N9=({visitsCount:e,shortUrl:t,active:n=!1,asLink:r=!1})=>{const{anchor:i,tooltip:o}=os(),{maxVisits:l,validSince:c,validUntil:f}=t?.meta??{},h=!!l||!!c||!!f,m=g.jsx(L9,{shortUrl:t,suffix:"visits",asLink:r,children:g.jsx("strong",{className:Oe("inline-block transition-all duration-300",{"scale-150":n}),children:Sn(e)})});return h?g.jsxs(g.Fragment,{children:[g.jsxs("span",{className:"whitespace-nowrap",children:[m,g.jsxs("small",{className:"cursor-help",...i,children:[l&&g.jsxs(g.Fragment,{children:[" / ",Sn(l)]}),g.jsx("sup",{className:"ml-1",children:g.jsx(Be,{icon:hy})})]})]}),g.jsx(ss,{...o,children:g.jsxs("ul",{className:"flex flex-col gap-y-2",children:[l&&g.jsxs("li",{children:["This short URL will not accept more than ",g.jsx("b",{children:Sn(l)})," visit",l===1?"":"s","."]}),c&&g.jsxs("li",{children:["This short URL will not accept visits before ",g.jsx("b",{className:"whitespace-nowrap",children:Yh(ji(c))}),"."]}),f&&g.jsxs("li",{children:["This short URL will not accept visits after ",g.jsx("b",{className:"whitespace-nowrap",children:Yh(ji(f))}),"."]})]})})]}):m},wf=({className:e,...t})=>g.jsx("button",{type:"button",className:Oe("rounded-sm focus-ring cursor-pointer",e),...t}),obe=e=>!!e.onClose,sbe=e=>!!e.onClick,w0=e=>{const{text:t,children:n,className:r,colorGenerator:i}=e,o=sbe(e),l=obe(e),c=o?wf:"span",f=w.useMemo(()=>i.stylesForKey(t),[t,i]);return g.jsxs(c,{className:Oe("inline-flex items-center gap-1","font-bold [&]:rounded-md",{"text-sm px-1.5 py-0.5":!l,"py-1 px-2":l,"cursor-pointer":o},r),style:f,onClick:o?e.onClick:void 0,"data-testid":"tag",children:[n??t,l&&g.jsx(wf,{"aria-label":`Remove ${t}`,className:"p-0 text-lg leading-5.5",onClick:e.onClose,children:g.jsx(Be,{icon:dy,size:"sm"})})]})},lbe=({tags:e,onTagClick:t,colorGenerator:n})=>e.length===0?g.jsx("i",{className:"whitespace-nowrap",children:g.jsx("small",{children:"No tags"})}):g.jsx("div",{className:"inline-flex flex-wrap gap-1 items-center",children:e.map(r=>g.jsx(w0,{text:r,colorGenerator:n,onClick:()=>t?.(r)},r))}),R9=({shortUrl:e,onTagClick:t})=>{const{ShortUrlsRowMenu:n,ColorGenerator:r,useTimeoutToggle:i}=An(R9),[o,l]=i({initialValue:!1,delay:500}),c=w.useRef(!0),[{excludeBots:f}]=b0(),h=Fn("visits"),m=f??h?.excludeBots;return w.useEffect(()=>{c.current||l(),c.current=!1},[e.visitsSummary.total,e.visitsSummary.nonBots,l]),g.jsxs($e.Row,{className:"relative",children:[g.jsx($e.Cell,{className:"whitespace-nowrap",columnName:"Created at:",children:g.jsx(ty,{date:e.dateCreated})}),g.jsx($e.Cell,{columnName:"Short URL:",children:g.jsxs("span",{className:"lg:whitespace-nowrap inline-flex items-center gap-x-2",children:[g.jsx(Li,{href:e.shortUrl,className:"max-md:break-all lg:truncate max-w-72"}),g.jsx(i6,{text:e.shortUrl})]})}),g.jsx($e.Cell,{className:"break-all",columnName:`${e.title?"Title":"Long URL"}:`,children:g.jsx(Li,{href:e.longUrl,children:e.title??e.longUrl})}),e.title&&g.jsx($e.Cell,{className:"break-all [&]:lg:hidden",columnName:"Long URL:",children:g.jsx(Li,{href:e.longUrl})}),g.jsx($e.Cell,{columnName:"Tags:",children:g.jsx(lbe,{tags:e.tags,colorGenerator:r,onTagClick:t})}),g.jsx($e.Cell,{className:"lg:text-right",columnName:"Visits:",children:g.jsx(N9,{visitsCount:m?e.visitsSummary.nonBots:e.visitsSummary.total,shortUrl:e,active:o,asLink:!0})}),g.jsx($e.Cell,{columnName:"Status:",className:"max-lg:border-none",children:g.jsxs("div",{className:"inline-flex gap-2",children:[g.jsx(abe,{shortUrl:e}),e.hasRedirectRules&&g.jsx(L9,{asLink:!0,shortUrl:e,suffix:"redirect-rules",title:"This short URL has dynamic redirect rules",children:g.jsx(Be,{icon:TN})})]})}),g.jsx($e.Cell,{className:"text-right max-lg:absolute max-lg:top-1 max-lg:right-1 max-lg:p-0",children:g.jsx(n,{shortUrl:e})})]})},ube=Tn(R9,["ShortUrlsRowMenu","ColorGenerator","useTimeoutToggle"]),D9=w.forwardRef(({name:e,color:t,onChange:n,className:r},i)=>g.jsxs("div",{className:Oe("relative rounded w-12",r),style:{backgroundColor:t,borderColor:t},children:[g.jsx(Ti,{className:"w-full h-full cursor-pointer relative z-1 opacity-0",type:"color",value:t,onChange:o=>n(o.target.value),ref:i,name:e,"aria-label":e.replace("-"," ")}),g.jsx(Be,{icon:qV,className:"absolute top-1/2 left-1/2 -translate-1/2",style:{color:X_(t.substring(1))?"#000":"#fff"}})]})),hL=({color:e,onChange:t,name:n})=>{const r=w.useRef(null);return g.jsxs("div",{className:"flex",children:[g.jsx(D9,{name:`${n}-picker`,color:e,onChange:t,className:"rounded-r-none",ref:r}),g.jsx(Ti,{readOnly:!0,value:e,onClick:()=>r.current?.click(),"aria-label":n,"data-testid":"text-input",className:"grow rounded-l-none"})]})};function cbe(e){switch(e){case"L":return 1;case"M":return .5;default:return .3}}const fbe=w.forwardRef(({data:e,color:t="#000000",bgColor:n="#ffffff",margin:r=0,errorCorrection:i="L",size:o=300,drawType:l="canvas",logo:c},f)=>{const h=w.useRef(null),m=w.useRef(new ate),y=w.useCallback((b,C)=>m.current.download({name:b,extension:C}),[]),x=w.useCallback(b=>new Promise((C,_)=>{const A=m.current.getRawData(b),O=new FileReader;O.onload=()=>{const{result:P}=O;P&&C(P.toString())},O.onerror=_,A.then(P=>{P instanceof Blob?O.readAsDataURL(P):_(new Error("QR code image blob not available"))})}),[]);return w.useImperativeHandle(f,()=>({download:y,getDataUri:x}),[y,x]),w.useEffect(()=>{const b=h.current;m.current.append(b)},[]),w.useEffect(()=>{m.current.update({type:l,data:e,width:o+r,height:o+r,margin:r,dotsOptions:{color:t},backgroundOptions:{color:n},qrOptions:{errorCorrectionLevel:i},imageOptions:{margin:5,imageSize:cbe(i)},image:c})},[n,t,e,l,i,c,r,o]),g.jsxs(g.Fragment,{children:[g.jsx("style",{dangerouslySetInnerHTML:{__html:"#qr-code-canvas-container canvas { max-width: 100% }"}}),g.jsx("div",{ref:h,id:"qr-code-canvas-container"})]})}),dbe=async({text:e,onCopy:t},n=navigator)=>{const r=typeof e=="string"?e:await e;return n.clipboard?.writeText(r).then(()=>t?.({text:r,copied:!0})).catch(()=>t?.({text:r,copied:!1}))},mL=({name:e,value:t,step:n,min:r,max:i,onChange:o})=>{const l=w.useId();return g.jsxs("div",{className:"flex flex-col gap-1",children:[g.jsxs("label",{htmlFor:l,className:"capitalize",children:[e,": ",t,"px"]}),g.jsx("input",{id:l,type:"range",value:t,step:n,min:r,max:i,onChange:c=>o(Number(c.target.value))})]})},hbe=({shortUrl:{shortUrl:e,shortCode:t},onClose:n,isOpen:r,qrDrawType:i})=>{const o=Fn("qrCodes",Lf),[{size:l,margin:c,color:f,bgColor:h,errorCorrection:m,format:y},x]=w.useState(o),b=w.useCallback(ae=>x(ce=>({...ce,...ae})),[]),C=w.useRef(null),[_,A]=w.useState(),O=w.useCallback(ae=>{const ce=ae.target.files?.[0];ce&&A({url:URL.createObjectURL(new Blob([ce],{type:ce.type})),name:ce.name})},[]),P=w.useRef(null),N=w.useCallback(()=>P.current?.download(`${t}-qr-code`,y),[y,t]),[F,U]=Sy({}),W=w.useCallback(()=>{const ae=P.current?.getDataUri(y)??"";return dbe({text:ae,onCopy:U})},[y,U]),X=w.useCallback(()=>{x(o),A(void 0)},[o]);return g.jsx(co,{size:"lg",open:r,onClose:n,title:g.jsxs(g.Fragment,{children:["QR code for ",g.jsx(Li,{href:e})]}),onClosed:X,children:g.jsxs("div",{className:"flex flex-col-reverse lg:flex-row gap-4",children:[g.jsx("div",{className:"grow flex items-center justify-around",children:g.jsxs("div",{className:"flex flex-col gap-1 items-center","data-testid":"qr-code-container",children:[g.jsx(fbe,{ref:P,data:e,size:l,margin:c,errorCorrection:m,color:f,bgColor:h,logo:_?.url,drawType:i}),g.jsxs("div",{className:"italic",children:["Preview (",l+c,"x",l+c,")"]})]})}),g.jsxs("div",{className:"flex flex-col gap-2 lg:w-64",children:[g.jsx(mL,{name:"size",value:l,onChange:ae=>b({size:ae}),step:10,min:50,max:1e3}),g.jsx(mL,{name:"margin",value:c,onChange:ae=>b({margin:ae}),step:1,min:0,max:100}),g.jsx(w6,{errorCorrection:m,onChange:ae=>b({errorCorrection:ae})}),g.jsx(hL,{name:"color",color:f,onChange:ae=>b({color:ae})}),g.jsx(hL,{name:"background",color:h,onChange:ae=>b({bgColor:ae})}),!_&&g.jsxs(g.Fragment,{children:[g.jsxs(Tt,{variant:"secondary",onClick:()=>C.current?.click(),children:[g.jsx(Be,{icon:BK}),"Select logo"]}),g.jsx("input",{ref:C,type:"file",accept:"image/*","aria-hidden":!0,tabIndex:-1,className:"hidden",onChange:O,"data-testid":"logo-input"})]}),_&&g.jsxs(Tt,{variant:"secondary",onClick:()=>A(void 0),children:[g.jsx(Be,{icon:fy}),g.jsxs("div",{className:"truncate",children:["Clear logo (",_.name,")"]})]}),g.jsx("div",{className:"my-auto",children:g.jsx("hr",{className:"my-2"})}),g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx(_6,{format:y,onChange:ae=>b({format:ae})}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Tt,{onClick:W,"aria-label":"Copy data URI",title:"Copy data URI",className:"h-full",children:g.jsx(Be,{icon:F?Ru:t6})}),g.jsxs(Tt,{solid:!0,onClick:N,className:"grow",children:["Download ",g.jsx(Be,{icon:AN})]})]})]})]})]})})},k9=({shortUrl:e,deleteShortUrl:t,shortUrlDeleted:n})=>{const{DeleteShortUrlModal:r}=An(k9),{flag:i,setToTrue:o,setToFalse:l}=Cn(),{flag:c,setToTrue:f,setToFalse:h}=Cn(),m=m0(),{confirmDeletions:y=!0}=Fn("shortUrlsList",{}),x=w.useCallback(async()=>{const _=await t(e);g3(_)||n(e)},[t,e,n]),b=ps(),C=w.useCallback(_=>P9(b,e,_),[b,e]);return g.jsxs(g.Fragment,{children:[g.jsxs(tn,{menuAlignment:"right",children:[g.jsxs(tn.Item,{to:C("visits"),className:"gap-1.5",children:[g.jsx(Be,{icon:P_})," Visit stats"]}),m&&g.jsxs(g.Fragment,{children:[g.jsxs(tn.Item,{className:"gap-1.5",disabled:!m.canAddItemWithName(e.shortUrl),onClick:()=>m.addItemToCompare({name:e.shortUrl,query:w3(e)}),children:[g.jsx(Be,{icon:cy})," Compare visits"]}),g.jsx(tn.Separator,{})]}),g.jsxs(tn.Item,{to:C("edit"),className:"gap-1.5",children:[g.jsx(Be,{icon:j_})," Edit short URL"]}),g.jsxs(tn.Item,{to:C("redirect-rules"),className:"gap-1.5",children:[g.jsx(Be,{icon:TN})," Manage redirect rules"]}),g.jsxs(tn.Item,{onClick:o,className:"gap-1.5",children:[g.jsx(Be,{icon:NH})," QR code"]}),g.jsx(tn.Separator,{}),g.jsxs(tn.Item,{className:"[&]:text-danger gap-1.5",onClick:y?f:x,children:[g.jsx(Be,{icon:LN})," Delete short URL"]})]}),g.jsx(hbe,{shortUrl:e,isOpen:i,onClose:l}),g.jsx(r,{shortUrl:e,deleteShortUrl:t,shortUrlDeleted:n,isOpen:c,onClose:h})]})},mbe=Tn(k9,["DeleteShortUrlModal"]),I9="shlink/shortUrlCreation",pL={saving:!1,saved:!1,error:!1},pbe=e=>or(`${I9}/createShortUrl`,t=>e().createShortUrl(t)),gbe=e=>{const{reducer:t,actions:n}=jt({name:I9,initialState:pL,reducers:{resetCreateShortUrl:()=>pL},extraReducers:i=>{i.addCase(e.pending,()=>({saving:!0,saved:!1,error:!1})),i.addCase(e.rejected,(o,{error:l})=>({saving:!1,saved:!1,error:!0,errorData:zi(l)})),i.addCase(e.fulfilled,(o,{payload:l})=>({result:l,saving:!1,saved:!0,error:!1}))}}),{resetCreateShortUrl:r}=n;return{reducer:t,resetCreateShortUrl:r}},z9="shlink/shortUrlEdition",vbe={saving:!1,saved:!1,error:!1},ybe=e=>or(`${z9}/editShortUrl`,({shortCode:t,domain:n,data:r})=>e().updateShortUrl({shortCode:t,domain:n},r)),bbe=e=>jt({name:z9,initialState:vbe,reducers:{},extraReducers:t=>{t.addCase(e.pending,n=>({...n,saving:!0,error:!1,saved:!1})),t.addCase(e.rejected,(n,{error:r})=>({...n,saving:!1,error:!0,saved:!1,errorData:zi(r)})),t.addCase(e.fulfilled,(n,{payload:r})=>({shortUrl:r,saving:!1,error:!1,saved:!0}))}}),gL="shlink/shortUrlsDetails",vL={loading:!1,error:!1},xbe=e=>{const t=or(`${gL}/getShortUrlsDetails`,async(r,{getState:i})=>{const{shortUrlsList:o}=i(),l=await Promise.all(r.map(async c=>{const{shortCode:f,domain:h}=c,m=o?.shortUrls?.data.find(y=>Ch(y,f,h));return[c,m??await e().getShortUrl({shortCode:f,domain:h})]}));return new Map(l)}),{reducer:n}=jt({name:gL,initialState:vL,reducers:{},extraReducers:r=>{r.addCase(t.pending,()=>({loading:!0,error:!1})),r.addCase(t.rejected,(i,{error:o})=>({loading:!1,error:!0,errorData:zi(o)})),r.addCase(t.fulfilled,(i,{payload:o})=>({...vL,shortUrls:o}))}});return{reducer:n,getShortUrlsDetails:t}},wbe=({domains:e,value:t,onChange:n})=>{const{flag:r,setToTrue:i,setToFalse:o}=Cn(),l=!t,c=w.useCallback(()=>{n(""),o()},[n,o]),f=w.useCallback(()=>{n(""),i()},[n,i]);return r?g.jsxs("div",{className:"flex",children:[g.jsx(Ti,{value:t??"",placeholder:"Domain",onChange:h=>n(h.target.value),className:"flex-grow rounded-r-none [&]:border-r-0"}),g.jsx(Tt,{variant:"secondary",type:"button",className:"rounded-l-none","aria-label":"Back to domains list",title:"Existing domains",onClick:c,children:g.jsx(Be,{icon:TH})})]}):g.jsxs(qe,{buttonContent:l?"Domain":`Domain: ${t}`,buttonClassName:Oe("w-full",{"text-placeholder":l}),children:[e.map(({domain:h,isDefault:m})=>g.jsxs(qe.Item,{selected:(t===h||m)&&l,onClick:()=>n(h),className:"flex justify-between items-center",children:[h,m&&g.jsx(Zo,{children:"default"})]},h)),g.jsx(qe.Separator,{}),g.jsx(qe.Item,{onClick:f,children:g.jsx("i",{children:"New domain"})})]})},_be=({minDate:e,maxDate:t,value:n,onChange:r,withTime:i=!1,...o})=>{const l=w.useCallback(({target:f})=>{if(!f.value){r?.(null);return}r?.(ji(f.value))},[r]),c=w.useMemo(()=>i?Yh:sl,[i]);return g.jsx(Ti,{...o,type:i?"datetime-local":"date",value:c(n)??"",max:c(t)??void 0,min:c(e)??void 0,onChange:l})},ny=({label:e,id:t,...n})=>{const r=w.useId();return g.jsxs(g.Fragment,{children:[g.jsxs("label",{htmlFor:t??r,className:"mb-1",children:[e,":"]}),g.jsx(_be,{id:t??r,...n})]})},Sbe=({className:e,placement:t,children:n})=>{const{anchor:r,tooltip:i}=os({placement:t});return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:e,...r,"data-placement":t,"data-testid":"tooltip-anchor",children:g.jsx(Be,{icon:hy})}),g.jsx(ss,{...i,children:n})]})},yL=({children:e,infoTooltip:t,checked:n,onChange:r})=>g.jsxs("div",{className:"flex items-center gap-x-2",children:[g.jsxs(Ma,{className:"inline-flex items-center gap-x-1.5",children:[g.jsx(W_,{checked:n,onChange:r}),e]}),g.jsx(Sbe,{placement:"right",children:t})]}),Cbe=e=>g.jsx(co,{...e,title:"Info",size:"lg",children:g.jsxs("div",{className:"flex flex-col gap-y-2",children:[g.jsxs("p",{children:["When the ",g.jsx("b",{children:g.jsx("i",{children:'"Use existing URL if found"'})})," checkbox is checked, the server will return an existing short URL if it matches provided params."]}),g.jsx("p",{children:"These are the checks performed by Shlink in order to determine if an existing short URL should be returned:"}),g.jsxs("ul",{className:"list-disc pl-5",children:[g.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."}),g.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.",g.jsx("br",{}),"If the slug is being used by another long URL, an error will be returned."]}),g.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"})]})]})}),Ebe=()=>{const{flag:e,setToFalse:t,setToTrue:n}=Cn();return g.jsxs(g.Fragment,{children:[g.jsx(wf,{title:"What does this mean?",onClick:n,children:g.jsx(Be,{icon:hy})}),g.jsx(Cbe,{open:e,onClose:t})]})},Eg=e=>typeof e=="string"?xl(e):e,Abe=e=>"shortCodeLength"in e&&"customSlug"in e&&"domain"in e,U9=({basicMode:e=!1,saving:t,onSave:n,initialState:r,tagsList:i,domainsList:o})=>{const{TagsSelector:l}=An(U9),[c,f]=w.useState(r),h=Abe(c),m=w.useCallback(()=>f(r),[r]),y=w.useCallback((_,A)=>Su(_)?_:Su(A)?null:void 0,[]),x=w.useCallback(_=>f(A=>({...A,tags:_})),[]),b=w.useCallback(async _=>(_.preventDefault(),n(c).then(A=>h&&!g3(A)&&m()).catch(()=>{})),[h,n,m,c]),C=w.useMemo(()=>g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsx(Ti,{size:"lg",type:"url",placeholder:"URL to be shortened",required:!0,value:c.longUrl,onChange:_=>f(A=>({...A,longUrl:_.target.value}))}),g.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e&&h&&g.jsx("div",{className:"w-full lg:w-1/2",children:g.jsx(Ti,{size:"lg",placeholder:"Custom slug",value:c.customSlug??"",onChange:_=>f(A=>({...A,customSlug:_.target.value}))})}),g.jsx("div",{className:Oe("w-full",{"lg:w-1/2":e}),children:g.jsx(l,{tags:i.tags,selectedTags:c.tags??[],onChange:x,placeholder:"Add tags to the URL"})})]})]}),[l,e,x,h,c,i.tags]);return g.jsxs("form",{name:"shortUrlForm",onSubmit:b,className:"flex flex-col gap-4",children:[e&&C,!e&&g.jsxs(g.Fragment,{children:[g.jsx("div",{children:g.jsx("div",{className:"w-full",children:g.jsx(Nt,{title:"Main options",className:"card",children:C})})}),g.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[g.jsx("div",{className:"w-full sm:w-1/2",children:g.jsxs(Nt,{title:"Customize the short URL",bodyClassName:"flex flex-col gap-4",className:"card h-full",children:[g.jsx(Ti,{placeholder:"Title",value:c.title??"",onChange:({target:_})=>f(A=>({...A,title:y(_.value,r.title)}))}),h&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[g.jsx("div",{className:"lg:w-1/2",children:g.jsx(Ti,{placeholder:"Custom slug",value:c.customSlug??"",onChange:_=>f(A=>({...A,customSlug:_.target.value})),disabled:Su(c.shortCodeLength)})}),g.jsx("div",{className:"lg:w-1/2",children:g.jsx(Ti,{type:"number",placeholder:"Short code length",value:c.shortCodeLength??"",onChange:_=>f(A=>({...A,shortCodeLength:_.target.value})),min:4,disabled:Su(c.customSlug)})})]}),g.jsx(wbe,{value:c.domain,onChange:_=>f(A=>({...A,domain:_})),domains:o.domains})]})]})}),g.jsx("div",{className:"w-full sm:w-1/2",children:g.jsxs(Nt,{title:"Limit access to the short URL",className:"card h-full",bodyClassName:"flex flex-col gap-y-4",children:[g.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[g.jsx("div",{className:"lg:w-1/2",children:g.jsx(ny,{label:"Enabled since",withTime:!0,maxDate:c.validUntil?Eg(c.validUntil):void 0,value:c.validSince?Eg(c.validSince):null,onChange:_=>f(A=>({...A,validSince:Ol(_)}))})}),g.jsx("div",{className:"lg:w-1/2",children:g.jsx(ny,{label:"Enabled until",withTime:!0,minDate:c.validSince?Eg(c.validSince):void 0,value:c.validUntil?Eg(c.validUntil):null,onChange:_=>f(A=>({...A,validUntil:Ol(_)}))})})]}),g.jsx(di,{label:"Maximum visits allowed:",type:"number",min:1,placeholder:"25...",value:c.maxVisits??"",onChange:_=>f(A=>({...A,maxVisits:Su(_.target.value)?Number(_.target.value):null}))})]})})]}),g.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[h&&g.jsx("div",{className:"w-full sm:w-1/2",children:g.jsx(Nt,{title:"Extra checks",className:"h-full",children:g.jsxs("p",{className:"inline-flex items-center gap-x-2",children:[g.jsxs(Ma,{className:"inline-flex items-center gap-x-1.5",children:[g.jsx(W_,{checked:c.findIfExists,onChange:_=>f(A=>({...A,findIfExists:_}))}),"Use existing URL if found"]}),g.jsx(Ebe,{})]})})}),g.jsx("div",{className:Oe("w-full",{"sm:w-1/2":h}),children:g.jsxs(Nt,{title:"Configure behavior",children:[g.jsx(yL,{infoTooltip:"This short URL will be included in the robots.txt for your Shlink instance, allowing web crawlers (like Google) to index it.",checked:c.crawlable,onChange:_=>f(A=>({...A,crawlable:_})),children:"Make it crawlable"}),g.jsx(yL,{infoTooltip:"When this short URL is visited, any query params appended to it will be forwarded to the long URL.",checked:c.forwardQuery,onChange:_=>f(A=>({...A,forwardQuery:_})),children:"Forward query params on redirect"})]})})]})]}),g.jsx("div",{className:"text-center",children:g.jsx(Tt,{type:"submit",inline:!0,solid:!0,disabled:t||!c.longUrl,className:"max-md:w-full",children:t?"Saving...":"Save"})})]})},Tbe=Tn(U9,["TagsSelector"]),B9=({domains:e,value:t,onChange:n})=>{const r=!t,i=t===fl?e.find(({isDefault:l})=>l)?.domain:t,o=w.useCallback(l=>{l!==t&&n(l)},[n,t]);return g.jsxs(qe,{buttonContent:r?"All domains":g.jsxs("span",{children:["Domain: ",g.jsx("b",{children:i})]}),buttonClassName:"w-full",menuAlignment:"right",buttonDisabled:!e.length,children:[g.jsx(qe.Item,{onClick:()=>o(),selected:r,children:"All domains"}),g.jsx(qe.Separator,{}),e.map(({domain:l,isDefault:c})=>g.jsxs(qe.Item,{selected:c?t===fl:t===l,onClick:()=>o(c?fl:l),className:"flex justify-between items-center",children:[l,c&&g.jsx(Zo,{children:"default"})]},l))]})},Obe=({startDate:e,endDate:t,disabled:n=!1,onStartDateChange:r,onEndDateChange:i})=>g.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-y-3 gap-x-4",children:[g.jsx("div",{className:"flex flex-col",children:g.jsx(ny,{label:"Since",value:e,maxDate:t??void 0,disabled:n,onChange:r})}),g.jsx("div",{className:"flex flex-col",children:g.jsx(ny,{label:"Until",value:t,minDate:e??void 0,disabled:n,onChange:o=>i(o&&hf(o))})})]}),_0="all",F9={today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",last180Days:"Last 180 days",last365Days:"Last 365 days",[_0]:void 0},$9=Object.keys(F9),jbe=e=>!e||!e.startDate&&!e.endDate,ry=e=>typeof e=="string"&&$9.includes(e),Mbe=$9.filter(e=>e!==_0),bL=e=>e?ji(e):null,V9=(e,t)=>({startDate:bL(e),endDate:bL(t)}),Pbe=e=>{if(!(!e||jbe(e)))return e.startDate&&!e.endDate?`Since ${sl(e.startDate)}`:!e.startDate&&e.endDate?`Until ${sl(e.endDate)}`:`${sl(e.startDate)} - ${sl(e.endDate)}`},xL=e=>{if(!(!e||e===_0))return ry(e)?F9[e]:Pbe(e)},ta=e=>Fu(pv(Tl(),e)),Zc=e=>({startDate:e,endDate:hf(Tl())}),H9=e=>[[()=>e==="today",()=>Zc(Fu(Tl()))],[()=>e==="yesterday",()=>({startDate:ta(1),endDate:hf(pv(Tl(),1))})],[()=>e==="last7Days",()=>Zc(ta(7))],[()=>e==="last30Days",()=>Zc(ta(30))],[()=>e==="last90Days",()=>Zc(ta(90))],[()=>e==="last180Days",()=>Zc(ta(180))],[()=>e==="last365Days",()=>Zc(ta(365))]].find(([t])=>t())?.[1]()??{},Lbe=e=>{const t=ji(e);return[[()=>yu(Fu(Tl()),t),"today"],[()=>yu(ta(1),t),"yesterday"],[()=>yu(ta(7),t),"last7Days"],[()=>yu(ta(30),t),"last30Days"],[()=>yu(ta(90),t),"last90Days"],[()=>yu(ta(180),t),"last180Days"],[()=>yu(ta(365),t),"last365Days"]].find(([n])=>n())?.[1]??_0},q9=e=>ry(e)?H9(e):e,G9=e=>!!(e&&e.startDate),Nbe=({startDate:e,endDate:t})=>{const n=vD(hf(t??new Date),Fu(e))+1,r=pv(Fu(e),n),i=pv(hf(e),1);return{startDate:r,endDate:i}},Rbe=e=>{if(G9(e))return vD(e.endDate??new Date,e.startDate)},O3=({onDatesChange:e,dateRangeOrInterval:t,defaultText:n,disabled:r})=>{const i=w.useMemo(()=>xL(t)??n,[t,n]),[o,l]=w.useMemo(()=>ry(t)?[void 0,t]:[t,void 0],[t]),c=w.useCallback(f=>{ry(f)?e(H9(f),f):e(f)},[e]);return g.jsxs(qe,{buttonDisabled:r,buttonContent:i,containerClassName:"[&]:block",buttonClassName:"w-full",menuClassName:"md:min-w-90!",children:[g.jsx(qe.Item,{selected:l==="all",onClick:()=>c("all"),children:n}),g.jsx(qe.Separator,{}),Mbe.map(f=>g.jsx(qe.Item,{selected:l===f,onClick:()=>c(f),children:xL(f)},f)),g.jsx(qe.Separator,{}),g.jsx(qe.Misc,{children:g.jsx(Obe,{...o,onStartDateChange:f=>c({...o,startDate:f}),onEndDateChange:f=>c({...o,endDate:f})})})]})},Dbe={dateCreated:"Created at",shortCode:"Short URL",longUrl:"Long URL",title:"Title",visits:"Visits"},kbe=({onChange:e,selected:t={}})=>{const{excludeBots:n=!1,excludeMaxVisitsReached:r=!1,excludePastValidUntil:i=!1}=t,o=Number(n)+Number(r)+Number(i),l=w.useCallback(f=>e({...t,...f}),[e,t]),c=w.useCallback(f=>l({[f]:!t?.[f]}),[l,t]);return g.jsxs(qe,{buttonContent:g.jsxs("span",{children:["More",o>0?g.jsxs("b",{children:[" (",o,")"]}):""]}),buttonClassName:"w-full",menuAlignment:"right",children:[g.jsx(qe.Title,{children:"Visits:"}),g.jsx(qe.Item,{selected:n,onClick:()=>c("excludeBots"),children:"Ignore visits from bots"}),g.jsx(qe.Separator,{}),g.jsx(qe.Title,{children:"Short URLs:"}),g.jsx(qe.Item,{selected:r,onClick:()=>c("excludeMaxVisitsReached"),children:"Exclude with visits reached"}),g.jsx(qe.Item,{selected:i,onClick:()=>c("excludePastValidUntil"),children:"Exclude enabled in the past"}),g.jsx(qe.Separator,{}),g.jsx(qe.Item,{disabled:t.excludeBots===void 0&&t.excludeMaxVisitsReached===void 0&&t.excludePastValidUntil===void 0,onClick:()=>e({excludeBots:void 0,excludeMaxVisitsReached:void 0,excludePastValidUntil:void 0}),className:"italic",children:"Reset to defaults"})]})},Y9=({className:e,shortUrlsAmount:t,order:n,handleOrderBy:r,tagsList:i,domainsList:o})=>{const{ExportShortUrlsBtn:l,TagsSearchDropdown:c}=An(Y9),[{search:f,tags:h,tagsMode:m="any",excludeTags:y,excludeTagsMode:x="any",startDate:b,endDate:C,excludeBots:_,excludeMaxVisitsReached:A,excludePastValidUntil:O,domain:P},N]=b0(),F=Fn("visits"),U=cl("filterShortUrlsByDomain"),W=cl("filterShortUrlsByExcludedTags"),[X,ae]=w.useState(),ce=w.useCallback(({startDate:Y,endDate:k},z)=>{N({startDate:Ol(Y)??void 0,endDate:Ol(k)??void 0}),ae(z)},[N]),re=w.useCallback(Y=>N({search:Y||void 0}),[N]),J=w.useCallback(Y=>N({domain:Y}),[N]),oe=w.useCallback(Y=>N({tags:Y}),[N]),we=w.useCallback(Y=>N({tagsMode:Y}),[N]),se=w.useCallback(Y=>N({excludeTags:Y}),[N]),ue=w.useCallback(Y=>N({excludeTagsMode:Y}),[N]);return g.jsxs("div",{className:Oe("flex flex-col gap-y-4",e),children:[g.jsx(Mf,{defaultValue:f,onChange:re}),g.jsxs("div",{className:"flex flex-col xl:flex-row-reverse justify-between gap-y-4",children:[g.jsxs("div",{className:Oe("flex flex-col lg:flex-row gap-x-2 gap-y-4",{"min-w-3/4":W,"min-w-2/3":!W}),children:[g.jsxs("div",{className:"flex flex-col md:flex-row gap-x-2 gap-y-4 grow",children:[g.jsx("div",{className:"grow",children:g.jsx(O3,{defaultText:"All short URLs",dateRangeOrInterval:X??V9(b,C),onDatesChange:ce})}),g.jsxs("div",{className:Oe("grid lg:flex gap-x-2 gap-y-4",{"grid-cols-2":W}),children:[g.jsx(c,{title:"Filter by tag",prefix:"With",tags:i.tags,selectedTags:h,onTagsChange:oe,mode:m,onModeChange:we,buttonClassName:"w-full"}),W&&g.jsx(c,{title:"Filter by excluded tag",prefix:"Without",tags:i.tags,selectedTags:y,onTagsChange:se,mode:x,onModeChange:ue,buttonClassName:"w-full"})]})]}),g.jsxs("div",{className:Oe("grid lg:flex gap-x-2 gap-y-4",{"grid-cols-2":U}),children:[U&&g.jsx(B9,{domains:o.domains,onChange:J,value:P}),g.jsx(kbe,{selected:{excludeBots:_??F?.excludeBots,excludeMaxVisitsReached:A,excludePastValidUntil:O},onChange:N})]})]}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("div",{className:"max-xl:w-1/2 xl:hidden",children:g.jsx(rm,{containerClassName:"[&]:block",buttonClassName:"w-full",prefixed:!1,items:Dbe,order:n,onChange:({field:Y,dir:k})=>r(Y,k)})}),g.jsx("div",{className:"max-xl:w-1/2",children:g.jsx(l,{amount:t})})]})]})]})},Ibe=Tn(Y9,["ExportShortUrlsBtn","TagsSearchDropdown"]);function Eh({currentOrder:e,field:t,className:n="ml-1"}){return!e.dir||e.field!==t?null:g.jsx(Be,{icon:e.dir==="ASC"?yH:PN,className:n})}const zbe=({paginator:e,currentQueryString:t=""})=>{const{currentPage:n=0,pagesCount:r=0}=e??{},i=ps(),o=w.useCallback(l=>`${i}/list-short-urls/${l}${t}`,[t,i]);return r<=1?g.jsx("div",{"data-testid":"empty-gap",className:"pb-4"}):g.jsx("div",{"data-testid":"short-urls-paginator",className:Oe("sticky bottom-0 py-4 -mx-0.5","flex justify-around","bg-lm-primary dark:bg-dm-primary","border-t border-lm-border dark:border-dm-border"),children:g.jsx(Ey,{urlForPage:o,currentPage:n,pagesCount:r})})},Ube={field:"dateCreated",dir:"DESC"},W9=Na(({listShortUrls:e,shortUrlsList:t})=>{const{ShortUrlsTable:n,ShortUrlsFilteringBar:r}=An(W9),{page:i}=Ef(),o=Or(),[{tags:l,tagsMode:c,excludeTags:f,excludeTagsMode:h,search:m,startDate:y,endDate:x,orderBy:b,excludeBots:C,excludePastValidUntil:_,excludeMaxVisitsReached:A,domain:O},P]=b0(),N=rS(),[F,U]=w.useState(b??N.shortUrlsList?.defaultOrdering??Ube),{pagination:W}=t?.shortUrls??{},X=w.useMemo(()=>C??N.visits?.excludeBots,[C,N.visits?.excludeBots]),ae=w.useCallback((se,ue)=>{P({orderBy:{field:se,dir:ue}}),U({field:se,dir:ue})},[P]),ce=se=>()=>ae(se,h6({currentOrderDir:F.dir,currentField:F.field,newField:se})),re=se=>g.jsx(Eh,{currentOrder:F,field:se}),J=w.useCallback(se=>P({tags:[...new Set([...l,se])]}),[l,P]),oe=w.useCallback(({field:se,dir:ue})=>X&&se==="visits"?{field:"nonBotVisits",dir:ue}:{field:se,dir:ue},[X]),we=y3();return w.useEffect(()=>{e({page:i,searchTerm:m,tags:l,tagsMode:c,excludeTags:f,excludeTagsMode:h,startDate:y,endDate:x,orderBy:oe(F),excludePastValidUntil:_,excludeMaxVisitsReached:A,domain:O})},[e,oe,i,m,l,y,x,F,c,_,A,O,f,h]),g.jsxs(v3,{value:we,children:[g.jsx(r,{shortUrlsAmount:t.shortUrls?.pagination.totalItems,order:F,handleOrderBy:ae,className:"mb-4"}),g.jsx(b3,{type:"short-urls",className:"mb-4"}),g.jsxs(Nt,{bodyClassName:Oe({"pb-0":!t.loading}),children:[g.jsx(n,{shortUrlsList:t,orderByColumn:ce,renderOrderIcon:re,onTagClick:J}),!t.loading&&g.jsx(zbe,{paginator:W,currentQueryString:o.search})]})]})},()=>[ia.visits]),Bbe=Tn(W9,["ShortUrlsTable","ShortUrlsFilteringBar"]),T2=({children:e,danger:t})=>g.jsx($e.Row,{children:g.jsx($e.Cell,{colSpan:6,className:Oe("text-center",{"text-danger font-bold":t}),children:e})}),Fbe=({shortUrlsList:e,onTagClick:t,ShortUrlsRow:n})=>{const{error:r,loading:i,shortUrls:o}=e;return r?g.jsx(T2,{danger:!0,children:"Something went wrong while loading short URLs :("}):i?g.jsx(T2,{children:"Loading..."}):!o||o.data.length===0?g.jsx(T2,{children:"No results found"}):o?.data.map(l=>g.jsx(n,{shortUrl:l,onTagClick:t},l.shortUrl))},K9=({orderByColumn:e,renderOrderIcon:t,shortUrlsList:n,onTagClick:r})=>{const{ShortUrlsRow:i}=An(K9),o=Oe({"cursor-pointer":!!e});return g.jsx($e,{className:"mb-[-1px] w-full",header:g.jsxs($e.Row,{children:[g.jsxs($e.Cell,{className:o,onClick:e?.("dateCreated"),children:["Created at ",t?.("dateCreated")]}),g.jsxs($e.Cell,{className:o,onClick:e?.("shortCode"),children:["Short URL ",t?.("shortCode")]}),g.jsxs($e.Cell,{children:[g.jsxs(wf,{className:Oe("p-0",o),onClick:e?.("title"),children:["Title ",t?.("title")]}),"  /  ",g.jsxs(wf,{className:Oe("p-0",o),onClick:e?.("longUrl"),children:[g.jsx("span",{className:"whitespace-nowrap",children:"Long URL"})," ",t?.("longUrl")]})]}),g.jsx($e.Cell,{children:"Tags"}),g.jsx($e.Cell,{className:o,onClick:e?.("visits"),children:g.jsxs("span",{className:"whitespace-nowrap",children:["Visits ",t?.("visits")]})}),g.jsx($e.Cell,{colSpan:2,"aria-hidden":!0})]}),children:g.jsx(Fbe,{ShortUrlsRow:i,shortUrlsList:n,onTagClick:r})})},$be=Tn(K9,["ShortUrlsRow"]),Vbe=(e,t)=>{e.factory("ShortUrlsList",Bbe),e.decorator("ShortUrlsList",t(["mercureInfo","shortUrlsList"],["listShortUrls","createNewVisits","loadMercureInfo"])),e.factory("ShortUrlsTable",$be),e.factory("ShortUrlsRow",ube),e.factory("ShortUrlsRowMenu",mbe),e.decorator("ShortUrlsRowMenu",t(null,["shortUrlDeleted","deleteShortUrl"])),e.factory("ShortUrlForm",Tbe),e.decorator("ShortUrlForm",t(["tagsList","domainsList"])),e.factory("CreateShortUrl",J1e),e.decorator("CreateShortUrl",t(["shortUrlCreation"],["createShortUrl","resetCreateShortUrl"])),e.factory("EditShortUrl",ebe),e.decorator("EditShortUrl",t(["shortUrlsDetails","shortUrlEdition"],["getShortUrlsDetails","editShortUrl"])),e.serviceFactory("DeleteShortUrlModal",()=>tbe),e.decorator("DeleteShortUrlModal",t(["shortUrlDeletion"],["resetDeleteShortUrl"])),e.factory("ExportShortUrlsBtn",nbe),e.factory("ShortUrlsFilteringBar",Ibe),e.decorator("ShortUrlsFilteringBar",t(["tagsList","domainsList"])),e.serviceFactory("shortUrlsListReducerCreator",N0e,"listShortUrls","editShortUrl","createShortUrl"),e.serviceFactory("shortUrlsListReducer",n=>n.reducer,"shortUrlsListReducerCreator"),e.serviceFactory("shortUrlCreationReducerCreator",gbe,"createShortUrl"),e.serviceFactory("shortUrlCreationReducer",n=>n.reducer,"shortUrlCreationReducerCreator"),e.serviceFactory("shortUrlEditionReducerCreator",bbe,"editShortUrl"),e.serviceFactory("shortUrlEditionReducer",n=>n.reducer,"shortUrlEditionReducerCreator"),e.serviceFactory("shortUrlDeletionReducerCreator",M0e,"deleteShortUrl"),e.serviceFactory("shortUrlDeletionReducer",n=>n.reducer,"shortUrlDeletionReducerCreator"),e.serviceFactory("shortUrlsDetailsReducerCreator",xbe,"apiClientFactory"),e.serviceFactory("shortUrlsDetailsReducer",n=>n.reducer,"shortUrlsDetailsReducerCreator"),e.serviceFactory("listShortUrls",L0e,"apiClientFactory"),e.serviceFactory("createShortUrl",pbe,"apiClientFactory"),e.serviceFactory("resetCreateShortUrl",n=>n.resetCreateShortUrl,"shortUrlCreationReducerCreator"),e.serviceFactory("deleteShortUrl",j0e,"apiClientFactory"),e.serviceFactory("resetDeleteShortUrl",n=>n.resetDeleteShortUrl,"shortUrlDeletionReducerCreator"),e.serviceFactory("shortUrlDeleted",()=>s9),e.serviceFactory("getShortUrlsDetails",n=>n.getShortUrlsDetails,"shortUrlsDetailsReducerCreator"),e.serviceFactory("editShortUrl",ybe,"apiClientFactory")},Hbe=({tag:e,onClose:t,isOpen:n,deleteTag:r,tagDelete:i,tagDeleted:o})=>{const{deleting:l,error:c,deleted:f,errorData:h}=i;return g.jsxs(co,{title:"Delete tag",variant:"danger",open:n,onClose:t,onClosed:()=>f&&o(e),onConfirm:async()=>{await r(e),t()},confirmText:l?"Deleting tag...":"Delete tag",confirmDisabled:l,children:["Are you sure you want to delete tag ",g.jsx("b",{children:e}),"?",c&&g.jsx(Gr,{variant:"error",size:"sm",className:"mt-2",children:g.jsx(so,{errorData:h,fallbackMessage:"Something went wrong while deleting the tag :("})})]})},Z9=({tag:e,editTag:t,onClose:n,tagEdited:r,isOpen:i,tagEdit:o})=>{const{ColorGenerator:l}=An(Z9),[c,f]=w.useState(e),[h,m]=w.useState(l.getColorForKey(e)),{editing:y,error:x,edited:b,errorData:C}=o,_=w.useCallback(async()=>{await t({oldName:e,newName:c,color:h}),n()},[h,t,c,n,e]),A=w.useCallback(()=>b&&r({oldName:e,newName:c,color:h}),[h,b,c,e,r]);return g.jsxs(co,{title:"Edit tag",open:i,onClose:n,onClosed:A,onConfirm:_,confirmText:y?"Saving...":"Save",confirmDisabled:y,children:[g.jsxs("div",{className:"flex",children:[g.jsx(D9,{color:h,onChange:m,className:"rounded-r-none",name:"tag-color"}),g.jsx(Ti,{className:"grow [&]:rounded-l-none",value:c,placeholder:"Tag",required:!0,onChange:({target:O})=>f(O.value)})]}),x&&g.jsx(Gr,{variant:"error",size:"sm",className:"mt-2",children:g.jsx(so,{errorData:C,fallbackMessage:"Something went wrong while editing the tag :("})})]})},qbe=Tn(Z9,["ColorGenerator"]),S0=({color:e,testId:t})=>g.jsx("div",{"data-testid":t,style:{backgroundColor:e},className:Oe("inline-block w-[20px] h-[20px] rounded-full","align-[-4px] mr-1.5")}),X9=({tags:e,selectedTags:t,onTagsChange:n,mode:r="any",onModeChange:i,buttonClassName:o,title:l,prefix:c})=>{const{ColorGenerator:f}=An(X9),h=Fn("shortUrlCreation")?.tagFilteringMode??"startsWith",{searchResults:m,onSearch:y}=o6({tags:e,selectedTags:t,searchMode:h}),x=w.useCallback(_=>n?.([...new Set([...t,J_(_)])]),[n,t]),b=w.useCallback(_=>n?.(t.filter(A=>A!==_)),[n,t]),C=w.useCallback(_=>{n?.([]),_.target.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0}))},[n]);return g.jsxs(qe,{buttonContent:t.length?g.jsxs("span",{children:[c," ",g.jsx("b",{children:Sn(t.length)})," tag",t.length>1&&"s"]}):g.jsxs(g.Fragment,{children:[c," tags..."]}),menuAlignment:"right",menuClassName:"min-w-72 w-full",buttonClassName:o,children:[g.jsxs(qe.Title,{children:[l,":"]}),g.jsxs(qe.Misc,{className:"flex flex-col gap-3",children:[g.jsx(r6,{size:"sm",searchResults:m,onSearch:y,onSelectSearchResult:x,renderSearchResult:_=>g.jsxs("div",{className:"flex items-center",children:[g.jsx(S0,{color:f.getColorForKey(_)}),_]}),onKeyDownCapture:_=>{_.key==="Escape"&&m&&_.stopPropagation()}}),t.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("ul",{className:"flex gap-1 flex-wrap",children:t.map((_,A)=>g.jsx("li",{children:g.jsx(w0,{text:_,colorGenerator:f,onClose:()=>b(_)})},`${_}${A}`))}),g.jsxs(Tt,{variant:"secondary",size:"sm",onClick:C,className:"gap-1!",children:[g.jsx(Be,{icon:dy})," Clear tags"]})]})]}),g.jsx(qe.Separator,{}),g.jsx(qe.Title,{children:"Mode:"}),g.jsxs(qe.Misc,{className:"flex flex-col gap-1",children:[g.jsxs("div",{className:"flex",children:[g.jsxs(Tt,{className:"w-1/2 rounded-r-none gap-1! border-r-0",size:"sm",solid:r==="any",onClick:()=>i?.("any"),children:[g.jsx(Be,{icon:OH})," Any"]}),g.jsxs(Tt,{className:"w-1/2 rounded-l-none gap-1!",size:"sm",solid:r==="all",onClick:()=>i?.("all"),children:[g.jsx(Be,{icon:jN})," All"]})]}),g.jsxs(Zo,{children:[c," ",g.jsx("b",{children:r})," of the tags"]})]})]})},Gbe=Tn(X9,["ColorGenerator"]),Q9=({onChange:e,...t})=>{const{ColorGenerator:n}=An(Q9),r=Fn("shortUrlCreation")?.tagFilteringMode??"startsWith";return g.jsx(lZ,{...t,onTagsChange:e,getColorForTag:i=>n.getColorForKey(i),size:"lg",searchMode:r})},Ybe=Tn(Q9,["ColorGenerator"]),o_="shlink/tagDelete",Wbe={deleting:!1,deleted:!1,error:!1},J9=un(`${o_}/tagDeleted`),Kbe=e=>{const t=or(`${o_}/deleteTag`,async r=>{await e().deleteTags([r])}),{reducer:n}=jt({name:o_,initialState:Wbe,reducers:{},extraReducers:r=>{r.addCase(t.pending,()=>({deleting:!0,deleted:!1,error:!1})),r.addCase(t.rejected,(i,{error:o})=>({deleting:!1,deleted:!1,error:!0,errorData:zi(o)})),r.addCase(t.fulfilled,()=>({deleting:!1,deleted:!0,error:!1}))}});return{reducer:n,deleteTag:t}},j3="shlink/tagEdit",Zbe={editing:!1,edited:!1,error:!1},ez=un(`${j3}/tagEdited`),Xbe=(e,t)=>or(`${j3}/editTag`,async({oldName:n,newName:r,color:i})=>(await e().editTag({oldName:n,newName:r}),t.setColorForKey(r,i),{oldName:n,newName:r,color:i})),Qbe=e=>jt({name:j3,initialState:Zbe,reducers:{},extraReducers:t=>{t.addCase(e.pending,()=>({editing:!0,edited:!1,error:!1})),t.addCase(e.rejected,(n,{error:r})=>({editing:!1,edited:!1,error:!0,errorData:zi(r)})),t.addCase(e.fulfilled,(n,{payload:r})=>{const{oldName:i,newName:o}=r;return{oldName:i,newName:o,editing:!1,edited:!0,error:!1}})}}),M3="shlink/tagsList",O2={tags:[],filteredTags:[],stats:{},loading:!1,error:!1},wL=(e,t)=>n=>n===e?t:n,_L=(e,t)=>e.filter(n=>n!==t),Jbe=(e,t)=>e.reduce((n,[r,i])=>{if(!n[r])return n;const{bots:o,nonBots:l}=i,c=n[r];return{...n,[r]:{...c,visitsSummary:{total:c.visitsSummary.total+o+l,bots:c.visitsSummary.bots+o,nonBots:c.visitsSummary.nonBots+l}}}},{...t}),exe=e=>Object.entries(e.reduce((t,{shortUrl:n,visit:r})=>(n?.tags.forEach(i=>{t[i]||(t[i]={bots:0,nonBots:0}),r.potentialBot?t[i].bots+=1:t[i].nonBots+=1}),t),{})),txe=e=>or(`${M3}/listTags`,async()=>{const{data:t}=await e().tagsStats(),n=t.reduce((r,{tag:i,...o})=>(r[i]=o,r),{});return{tags:Object.keys(n),stats:n}}),tz=un(`${M3}/filterTags`),nxe=(e,t)=>jt({name:M3,initialState:O2,reducers:{},extraReducers:n=>{n.addCase(tz,(r,{payload:i})=>({...r,filteredTags:r.tags.filter(o=>o.toLowerCase().match(i.toLowerCase()))})),n.addCase(e.pending,r=>({...r,loading:!0,error:!1})),n.addCase(e.rejected,(r,{error:i})=>({...O2,error:!0,errorData:zi(i)})),n.addCase(e.fulfilled,(r,{payload:i})=>({...O2,stats:i.stats,tags:i.tags,filteredTags:i.tags})),n.addCase(J9,({tags:r,filteredTags:i,...o},{payload:l})=>({...o,tags:_L(r,l),filteredTags:_L(i,l)})),n.addCase(ez,({tags:r,filteredTags:i,stats:o,...l},{payload:c})=>({...l,stats:{...o,[c.newName]:o[c.oldName]},tags:r.map(wL(c.oldName,c.newName)).sort(),filteredTags:i.map(wL(c.oldName,c.newName)).sort()})),n.addCase(Vf,(r,{payload:i})=>({...r,stats:Jbe(exe(i.createdVisits),r.stats)})),n.addCase(t.fulfilled,({tags:r,...i},{payload:o})=>({...i,tags:r.concat(o.tags.filter(l=>!r.includes(l)))}))}}),rxe={tag:"Tag",shortUrls:"Short URLs",visits:"Visits"},nz=Na(({filterTags:e,tagsList:t})=>{const{TagsTable:n}=An(nz),r=rS(),[i,o]=w.useState(r.tags?.defaultOrdering??{}),l=w.useMemo(()=>{const f=t.filteredTags.map(h=>{const m=t.stats[h],y=r.visits?.excludeBots?m.visitsSummary.nonBots:m.visitsSummary.total;return{tag:h,visits:y,shortUrls:m?.shortUrlsCount??0}});return m6(f,i)},[i,r.visits?.excludeBots,t.filteredTags,t.stats]),c=y3();return t.loading?g.jsx(Ko,{loading:!0}):t.error?g.jsx(Gr,{variant:"error",children:g.jsx(so,{errorData:t.errorData,fallbackMessage:"Error loading tags :("})}):g.jsx(v3,{value:c,children:g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsx(Mf,{onChange:e}),g.jsx("div",{className:"flex flex-col lg:flex-row lg:justify-end",children:g.jsx("div",{className:"lg:w-1/2",children:g.jsx(rm,{containerClassName:"[&]:block",buttonClassName:"w-full",items:rxe,order:i,onChange:o})})}),g.jsx(b3,{type:"tags"}),g.jsx(n,{sortedTags:l,currentOrder:i,orderByColumn:f=>()=>o(eS({currentField:i.field,currentOrderDir:i.dir,newField:f}))})]})})},()=>[ia.visits]),ixe=Tn(nz,["TagsTable"]),axe=(e,t)=>{const n=r=>i=>{i.event.composedPath().some(({classList:o})=>o?.contains("visits-table"))||document.querySelector(".modal")||r()};return gte({delta:40,onSwipedLeft:n(t),onSwipedRight:n(e)})},oxe=(e,t)=>{const[n,r]=w.useState(t),i=w.useCallback(o=>{const{location:l,history:c}=window,f=a6(l.search);f[e]=o,c.pushState(null,"",`${l.pathname}?${Q_(f)}`),r(o)},[e]);return[n,i]},P3=e=>{const t=Zu();return w.useMemo(()=>t[e]?.split(",").filter(Boolean)??[],[e,t])},sxe=(e,t)=>{const n=w.useCallback(()=>t(`(max-width: ${e}px)`).matches,[t,e]),[r,i]=w.useState(n());return w.useEffect(()=>{const o=()=>i(n());return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[n]),r},lxe=(e,t,n)=>{w.useEffect(()=>{if(!n)return()=>{};const r=new AbortController;return document.addEventListener("keydown",i=>i.key===e&&t(),{signal:r.signal}),()=>r.abort()},[n,t,e])},uxe=20,rz=({sortedTags:e,orderByColumn:t,currentOrder:n})=>{const{TagsTableRow:r}=An(rz),i=w.useRef(!0),{page:o=1}=Zu(),[l,c]=oxe("page",Number(o)),f=w.useCallback(b=>{c(b),scrollTo(0,0)},[c]),h=af(e,uxe),m=h.length>1,y=h[l-1]??[];w.useEffect(()=>{i.current||f(1),i.current=!1},[f,e]);const x="cursor-pointer top-(--header-height) sticky-cell";return g.jsxs(Nt,{bodyClassName:m?"pb-1":"",children:[g.jsxs($e,{header:g.jsxs($e.Row,{children:[g.jsxs($e.Cell,{onClick:t("tag"),className:x,children:["Tag ",g.jsx(Eh,{currentOrder:n,field:"tag"})]}),g.jsxs($e.Cell,{onClick:t("shortUrls"),className:`lg:text-right ${x}`,children:["Short URLs ",g.jsx(Eh,{currentOrder:n,field:"shortUrls"})]}),g.jsxs($e.Cell,{onClick:t("visits"),className:`lg:text-right ${x}`,children:["Visits ",g.jsx(Eh,{currentOrder:n,field:"visits"})]}),g.jsx($e.Cell,{className:x,children:g.jsx("span",{className:"sr-only",children:"Options"})})]}),children:[y.length===0&&g.jsx($e.Row,{children:g.jsx($e.Cell,{colSpan:4,className:"text-center",children:"No tags found"})}),y.map(b=>g.jsx(r,{tag:b},b.tag))]}),m&&g.jsx("div",{className:Oe("sticky bottom-0 py-4 -mx-0.5","flex justify-around","bg-lm-primary dark:bg-dm-primary","border-t border-lm-border dark:border-dm-border"),"data-testid":"tags-paginator",children:g.jsx(Ey,{pagesCount:h.length,currentPage:l,onPageChange:f})})]},l)},cxe=Tn(rz,["TagsTableRow"]),fxe=({tag:e,colorGenerator:t})=>g.jsx(S0,{color:t.getColorForKey(e)}),iz=({tag:e})=>{const{DeleteTagConfirmModal:t,EditTagModal:n,ColorGenerator:r}=An(iz),{flag:i,setToFalse:o,setToTrue:l}=Cn(),{flag:c,setToFalse:f,setToTrue:h}=Cn(),m=ps(),y=m0();return g.jsxs($e.Row,{className:"max-lg:relative",children:[g.jsxs($e.Cell,{columnName:"Tag",children:[g.jsx(fxe,{tag:e.tag,colorGenerator:r})," ",e.tag]}),g.jsx($e.Cell,{className:"lg:text-right",columnName:"Short URLs",children:g.jsx(Ir,{to:`${m}/list-short-urls/1?tags=${encodeURIComponent(e.tag)}`,children:Sn(e.shortUrls)})}),g.jsx($e.Cell,{className:"lg:text-right",columnName:"Visits",children:g.jsx(Ir,{to:`${m}/tag/${e.tag}/visits`,children:Sn(e.visits)})}),g.jsx($e.Cell,{className:"lg:text-right max-lg:absolute max-lg:top-1.25 max-lg:right-0 max-lg:p-0",children:g.jsxs(tn,{menuAlignment:"right",children:[g.jsxs(tn.Item,{onClick:h,className:"gap-1.5",children:[g.jsx(Be,{icon:ON})," Edit"]}),g.jsxs(tn.Item,{className:"gap-1.5",disabled:!y||!y.canAddItemWithName(e.tag),onClick:()=>y?.addItemToCompare({name:e.tag,query:e.tag,style:r.stylesForKey(e.tag)}),children:[g.jsx(Be,{icon:cy})," Compare visits"]}),g.jsx(tn.Separator,{}),g.jsxs(tn.Item,{className:"[&]:text-danger gap-1.5",onClick:l,children:[g.jsx(Be,{icon:YV})," Delete tag"]})]})}),g.jsx(n,{tag:e.tag,onClose:f,isOpen:c}),g.jsx(t,{tag:e.tag,onClose:o,isOpen:i})]})},dxe=Tn(iz,["DeleteTagConfirmModal","EditTagModal","ColorGenerator"]),hxe=(e,t)=>{e.factory("TagsSelector",Ybe),e.factory("TagsSearchDropdown",Gbe),e.serviceFactory("DeleteTagConfirmModal",()=>Hbe),e.decorator("DeleteTagConfirmModal",t(["tagDelete"],["deleteTag","tagDeleted"])),e.factory("EditTagModal",qbe),e.decorator("EditTagModal",t(["tagEdit"],["editTag","tagEdited"])),e.factory("TagsTableRow",dxe),e.factory("TagsTable",cxe),e.factory("TagsList",ixe),e.decorator("TagsList",t(["tagsList","mercureInfo"],["filterTags","createNewVisits","loadMercureInfo"])),e.serviceFactory("tagEditReducerCreator",Qbe,"editTag"),e.serviceFactory("tagEditReducer",n=>n.reducer,"tagEditReducerCreator"),e.serviceFactory("tagDeleteReducerCreator",Kbe,"apiClientFactory"),e.serviceFactory("tagDeleteReducer",n=>n.reducer,"tagDeleteReducerCreator"),e.serviceFactory("tagsListReducerCreator",nxe,"listTags","createShortUrl"),e.serviceFactory("tagsListReducer",n=>n.reducer,"tagsListReducerCreator"),e.serviceFactory("listTags",txe,"apiClientFactory"),e.serviceFactory("filterTags",()=>tz),e.serviceFactory("deleteTag",n=>n.deleteTag,"tagDeleteReducerCreator"),e.serviceFactory("tagDeleted",()=>J9),e.serviceFactory("editTag",Xbe,"apiClientFactory","ColorGenerator"),e.serviceFactory("tagEdited",()=>ez)},mxe=new CD,pxe=e=>mxe.parse(e),gxe=6,SL="0123456789ABCDEF";function vxe(){return`#${nS(gxe,()=>SL[Math.floor(Math.random()*SL.length)]).join("")}`}const CL=e=>e.toLowerCase().trim();class yxe{constructor(t){this.storage=t,this.colors=this.storage?.getTagColors()??{},this.lights={}}colors;lights;getColorForKey(t){const n=CL(t);return this.colors[n]||this.setColorForKey(n,vxe())}setColorForKey(t,n){const r=CL(t);return this.colors[r]=n,this.storage?.storeTagColors(this.colors),n}stylesForKey(t){const n=this.getColorForKey(t);return{backgroundColor:n,color:this.isLightColor(n)?"#222":"#fff"}}isLightColor(t){const n=t.substring(1);return this.lights[n]===void 0&&(this.lights[n]=X_(n)),this.lights[n]}}const az=({document:e},t,n)=>{const r=e.createElement("a");r.setAttribute("href",t),r.setAttribute("download",n),r.style.visibility="hidden",e.body.appendChild(r),r.click(),e.body.removeChild(r)},bxe=(e,t,n)=>{const r=new Blob([t],{type:"text/csv;charset=utf-8;"}),i=URL.createObjectURL(r);az(e,i,n)};class xxe{constructor(t,n){this.fetch=t,this.window=n}async saveImage(t,n){const r=await this.fetch(t).then(o=>o.blob()),i=URL.createObjectURL(r);az(this.window,i,n)}}class wxe{constructor(t,n){this.window=t,this.jsonToCsv=n}exportVisits=(t,n)=>{n.length&&this.exportCsv(t,n)};exportShortUrls=t=>{t.length&&this.exportCsv("short_urls.csv",t)};exportCsv=(t,n)=>{const r=this.jsonToCsv(n);bxe(this.window,r,t)}}function _xe(e){e.constant("window",window),e.constant("fetch",window.fetch.bind(window)),e.service("ImageDownloader",xxe,"fetch","window"),e.service("ColorGenerator",yxe,"TagColorsStorage"),e.constant("jsonToCsv",pxe),e.service("ReportExporter",wxe,"window","jsonToCsv"),e.serviceFactory("useTimeoutToggle",()=>Sy)}const Am=({visits:e,shortUrl:t,children:n,title:r})=>g.jsx("header",{children:g.jsxs(Nt,{children:[g.jsxs("h2",{className:"flex justify-between items-center",children:[g.jsx(x0,{}),g.jsx("span",{className:"text-center hidden sm:block",children:g.jsx("small",{children:r})}),g.jsxs("span",{className:Oe("px-3 py-1.5 rounded-md ml-3","font-bold text-white text-2xl","bg-lm-main dark:bg-dm-main"),"data-testid":"badge",children:["Visits:"," ",g.jsx(N9,{visitsCount:e.length,shortUrl:t})]})]}),g.jsx("h3",{className:"text-center block sm:hidden mt-3",children:g.jsx("small",{children:r})}),n&&g.jsx("div",{className:"md:mt-3",children:n})]})}),L3=({children:e,className:t})=>g.jsx("div",{className:Oe("flex justify-between items-center",t),children:e}),oz=({title:e,footer:t,children:n})=>g.jsxs(ln,{role:"document",children:[g.jsx(ln.Header,{children:e}),g.jsx(ln.Body,{children:n}),t&&g.jsx(ln.Footer,{className:"sticky bottom-0",children:t})]}),sz=w.createContext(null),{Provider:N_e}=sz,N3=e=>{const t=w.useContext(sz)??void 0,n=w.useMemo(()=>t?{}:{width:"100%",height:e},[e,t]);return{ChartWrapper:t?w.Fragment:mie,dimensions:t,wrapperDimensions:n}},lz={color:"white",background:"rgb(0 0 0 / .9)",border:"none",borderRadius:"5px"},Sxe={marginBottom:"5px",fontWeight:"bold"},uz={contentStyle:lz,labelStyle:Sxe,itemStyle:{padding:0}},EL=["#97BBCD","#F7464A","#46BFBD","#FDB45C","#949FB1","#57A773","#414066","#08B2E3","#B6C454","#DCDCDC","#463730"],cz=e=>EL[e%EL.length],iy=()=>ls()?"#46e587":"#1DAA58",Cxe=()=>ls()?"rgba(70, 229, 135, 0.4)":"rgba(29, 170, 88, 0.4)",Exe=({chartData:e,showNumbers:t})=>g.jsx("ul",{className:"space-y-1",children:e.map(({name:n,color:r,value:i},o)=>g.jsxs("li",{className:"flex items-center",children:[g.jsx(S0,{color:r,testId:`color-bullet-${o}`}),g.jsxs("small",{className:"truncate grow","data-testid":`name-${o}`,children:[n,t&&g.jsxs("b",{children:[" (",Sn(i),")"]})]})]},n))}),AL=e=>w.useMemo(()=>Object.entries(e).map(([t,n],r)=>({name:t,value:n,color:cz(r)})),[e]),Axe=({stats:e,prevStats:t,showNumbersInLegend:n})=>{const r=AL(e),i=AL(t),o=i.length>0,l=ls()?qZ:HZ,{ChartWrapper:c,dimensions:f,wrapperDimensions:h}=N3(300);return g.jsxs("div",{className:"flex flex-col md:flex-row md:items-center gap-y-4",children:[g.jsx("div",{className:"md:flex-7",children:g.jsx("div",{style:h,children:g.jsx(c,{children:g.jsxs(Pye,{...f,children:[g.jsx(FC,{formatter:Sn,contentStyle:lz,itemStyle:{color:"white"}}),g.jsx(Kw,{data:r,dataKey:"value",nameKey:"name",startAngle:360,endAngle:0,outerRadius:"100%",innerRadius:o?"65%":"50%",animationBegin:0,children:r.map((m,y)=>g.jsx(ul,{fill:m.color,stroke:l},`${m.name}-${y}`))}),o&&g.jsx(Kw,{data:i,dataKey:"value",nameKey:"name",startAngle:360,endAngle:0,outerRadius:"55%",innerRadius:"20%",animationBegin:0,stroke:l,fill:iy()})]})})})}),g.jsx("div",{className:"md:flex-5",children:g.jsx(Exe,{chartData:r,showNumbers:n})})]})},TL=({title:e,...t})=>{const{flag:n,toggle:r}=Cn();return g.jsx(oz,{title:g.jsxs(L3,{children:[e,g.jsx(bl,{checked:n,onChange:r,children:"Show numbers"})]}),children:g.jsx(Axe,{...t,showNumbersInLegend:n})})},Txe=w.forwardRef(({visitsGroups:e},t)=>{const n=w.useMemo(()=>Object.entries(e),[e]);return n.length===0?null:g.jsx("ul",{className:"mt-2 flex flex-wrap justify-center gap-4",ref:t,children:n.map(([r,i],o)=>g.jsxs("li",{className:"inline",children:[g.jsx(S0,{color:fz(i)}),g.jsxs("strong",{children:[r," (",Sn(i.length),")"]})]},`${r}${o}`))})}),Oxe={monthly:"Month",weekly:"Week",daily:"Day",hourly:"Hour"},jxe={hourly:e=>({hours:e}),daily:e=>({days:e}),weekly:e=>({weeks:e}),monthly:e=>({months:e})},Mxe={hourly:MJ,daily:Ny,weekly:jJ,monthly:dv},R3={hourly:e=>hv(e,"yyyy-MM-dd HH:00"),daily:e=>sl(e),weekly(e){const t=sl(kh(e)),n=sl(zJ(e));return`${t} - ${n}`},monthly:e=>hv(e,"yyyy-MM")},Pxe=e=>{const t=Object.values(e).filter(o=>o.length>0);if(t.length===0)return"monthly";const n=new Date,r=t.map(o=>xl(o[o.length-1].date)),i=gD(r);return[[()=>Ny(n,i)<=2,"hourly"],[()=>dv(n,i)<=1,"daily"],[()=>dv(n,i)<=6,"weekly"]].find(([o])=>o())?.[1]??"monthly"},Lxe=(e,t)=>Object.keys(t).reduce((n,r)=>(n[r]=v6(t[r],i=>R3[e](xl(i.date))),n),{}),Nxe=(e,t)=>t.reduce((n,r)=>{const i=R3[e](xl(r.date));return n[i]=n[i]??[],n[i].push(r),n},{}),Rxe=(e,t)=>{const n=Object.values(t).filter(m=>m.length>0).map(m=>[...m].reverse());if(n.length===0)return[];const r=Mxe[e],i=R3[e],o=jxe[e],l=n.flat(),c=xl(l[0].date),f=xl(l[l.length-1].date),h=r(f,c)||1;return[{formattedDate:i(c),date:c},...nS(h,m=>{const y=SJ(c,o(m));return{formattedDate:i(y),date:y}})]},fz=e=>{if(e.color)return e.color;const t={main:Lh(),highlighted:tw,previous:iy()};return e.type?t[e.type]:Lh()},OL=(e,t)=>w.useMemo(()=>Object.values(e).find(n=>n.type===t)??[],[e,t]),Dxe=(e,t,n)=>{const r=OL(e,"main"),i=OL(e,"highlighted"),o=w.useMemo(()=>n?Nxe(t,r):{},[n,t,r]),l=w.useCallback((c,{payload:f})=>{const h=o[f.formattedDate]??[];n?.(h===i?[]:h)},[o,i,n]);return n&&{cursor:"pointer",onClick:l}},dz=({visitsGroups:e,setSelectedVisits:t,matchMedia:n,onDateRangeChange:r})=>{const[i,o]=w.useState(Pxe(e)),l=sxe(767,n??window.matchMedia),c=w.useMemo(()=>{const J=Lxe(i,e),oe=Object.keys(J);return Rxe(i,e).map(({formattedDate:we,date:se})=>({date:se,formattedDate:we,...oe.reduce((ue,Y)=>(ue[Y]=J[Y][we]??0,ue),{})}))},[i,e]),f=Dxe(e,i,t),{flag:h,toggle:m,setToFalse:y}=Cn(),x=w.useId(),b=w.useRef(null),[C,_]=w.useState(l?300:400);w.useLayoutEffect(()=>{if(!h)return _(l?300:400),()=>{};const J=new ResizeObserver(()=>{const oe=window.innerHeight,{height:we}=b.current.getBoundingClientRect();_(oe-we-98)});return J.observe(b.current),()=>J.disconnect()},[h,l,b]),lxe("Escape",y,h);const{ChartWrapper:A,dimensions:O,wrapperDimensions:P}=N3(C),[N,F]=w.useState(),[U,W]=w.useState(),X=w.useCallback(()=>{F(void 0),W(void 0)},[]),ae=w.useCallback((J,oe)=>{const we=J.activeIndex&&c[J.activeIndex];oe.button===0&&we&&F(we)},[c]),ce=w.useCallback(J=>{const oe=J.activeIndex&&c[J.activeIndex];N&&oe&&W(oe)},[c,N]),re=w.useCallback(()=>{if(!N||!U){X();return}const J=[N.date,U.date],oe=AJ(J),we=gD(J);X(),r({startDate:oe,endDate:we})},[r,X,U,N]);return g.jsxs(ln,{className:Oe({"fixed top-0 bottom-0 left-0 right-0 z-1030":h}),"data-testid":"line-chart-card",children:[g.jsxs(ln.Header,{role:"heading","aria-level":4,className:"flex justify-between items-center",children:["Visits over time",g.jsxs("div",{className:"flex content-center gap-1",children:[g.jsx(Cy,{"aria-label":h?"Collapse":"Expand","aria-expanded":h,"aria-controls":x,size:"sm",onClick:m,children:g.jsx(Be,{icon:h?wH:aH})}),g.jsx(qe,{buttonContent:"Group by",buttonSize:"sm",buttonVariant:"link",buttonClassName:"[&]:p-0",menuAlignment:"right",menuClassName:"w-40",children:Object.entries(Oxe).map(([J,oe])=>g.jsx(qe.Item,{selected:i===J,onClick:()=>o(J),children:oe},J))})]})]}),g.jsxs(ln.Body,{id:x,children:[g.jsx(A,{...P,children:g.jsxs(wye,{className:"select-none",data:c,...O,onMouseDown:ae,onMouseMove:ce,onMouseUp:re,children:[g.jsx(s3,{dataKey:"formattedDate"}),g.jsx(l3,{tickFormatter:Sn,yAxisId:"1"}),g.jsx(FC,{formatter:Sn,...uz}),g.jsx(a3,{strokeOpacity:ls()?.1:.9}),Object.entries(e).map(([J,oe])=>oe.length>0&&g.jsx(N7,{yAxisId:"1",dataKey:J,type:"monotone",stroke:fz(oe),strokeWidth:2,activeDot:oe.type==="previous"?void 0:f,strokeDasharray:oe.type==="previous"?"8 3":void 0},J)),N&&U&&g.jsx(C7,{yAxisId:"1",x1:N.formattedDate,x2:U.formattedDate})]})}),g.jsx(Txe,{visitsGroups:e,ref:b})]})]})},kxe=({ranges:e,value:t,setValue:n})=>g.jsxs(qe,{buttonContent:"Paginate",buttonVariant:"link",buttonClassName:"[&]:p-0",buttonSize:"sm",menuAlignment:"right",children:[e.map(r=>g.jsxs(qe.Item,{selected:r===t,onClick:()=>n(r),children:[g.jsx("b",{children:r})," items per page"]},r)),g.jsx(qe.Separator,{}),g.jsx(qe.Item,{disabled:t===1/0,onClick:()=>n(1/0),children:g.jsx("i",{children:"Clear pagination"})})]}),jL=e=>typeof e!="string"||e.startsWith("hidden_"),Ixe=({stats:e,prevStats:t,highlightedStats:n,highlightedLabel:r,max:i,onClick:o})=>{const l=w.useMemo(()=>Object.entries(e).map(([y,x])=>{const b=n?.[y]??0,C=t?.[y]??0,_=jL(y);return{name:y,amount:Math.max(x,C),nonHighlightedAmount:_?null:x-b,highlightedAmount:_?null:b,prevAmount:_?null:C}}),[e,t,n]),c=w.useMemo(()=>{const y=l.reduce((x,{name:b})=>x>b.length?x:b.length,0);return Math.min(150,y*7)},[l]),{ChartWrapper:f,dimensions:h,wrapperDimensions:m}=N3(Math.max(300,l.length*(t?44:22)));return g.jsx(f,{...m,children:g.jsxs(Nye,{layout:"vertical",data:l,barCategoryGap:3,...h,children:[g.jsx(s3,{type:"number",dataKey:"amount",tickFormatter:Sn,domain:i?[0,i]:void 0}),g.jsx(l3,{type:"category",dataKey:"name",width:c,interval:0,style:{fontSize:".8rem"},tickFormatter:y=>jL(y)?"":y}),g.jsx(a3,{strokeOpacity:ls()?.05:.9}),g.jsx(FC,{filterNull:!0,...uz,formatter:(y,x)=>[Sn(y),x==="highlightedAmount"?r:x==="prevAmount"?"Previous period":n?"Non-selected":"Visits"]}),g.jsx($g,{dataKey:"nonHighlightedAmount",stackId:"main",cursor:"pointer",fill:Lh(),onClick:({name:y})=>y&&o?.(y),children:l.map(y=>g.jsx(ul,{fill:$Z(),stroke:Lh(),strokeWidth:2},y.name))}),n&&g.jsx($g,{dataKey:"highlightedAmount",stackId:"main",cursor:"pointer",fill:tw,onClick:({name:y})=>y&&o?.(y),children:l.map(y=>g.jsx(ul,{fill:VZ,stroke:tw,strokeWidth:2},y.name))}),t&&g.jsx($g,{dataKey:"prevAmount",fill:iy(),children:l.map(y=>g.jsx(ul,{fill:Cxe(),stroke:iy(),strokeWidth:2},y.name))})]})})},zxe=e=>typeof e=="string"?e.toLowerCase():e,Uxe=([e])=>e,Bxe=([,e])=>e,Ag=({stats:e,prevStats:t,highlightedStats:n,title:r,sortingItems:i,extraHeaderContent:o,withPagination:l=!0,...c})=>{const[f,h]=w.useState({}),[m,y]=w.useState(1),[x,b]=w.useState(50),C=w.useCallback((ae,ce)=>{const re=Object.entries(ae),J=f.field?WZ(re,([oe,we])=>zxe(f.field===Object.keys(ce)[0]?oe:we)):re;return!f.dir||f.dir==="ASC"?J:[...J].reverse()},[f.dir,f.field]),_=w.useCallback(ae=>{const ce=ae[m-1];if(m[`hidden_${J}`,0])]},[m]),A=w.useCallback(ae=>g.jsx(Ey,{currentPage:m,pagesCount:ae,onPageChange:y}),[m]),O=w.useCallback((ae,ce,re,J)=>{const oe=C(ae,ce),we=oe.map(Uxe),se=re&&Object.entries({...uO(we,we.map(()=>0)),...re}),ue=J&&Object.entries({...uO(we,we.map(()=>0)),...J});if(oe.length<=x)return{currentPageStats:Object.fromEntries(oe),currentPageHighlightedStats:se&&Object.fromEntries(se),currentPagePrevStats:ue&&Object.fromEntries(ue)};const Y=af(oe,x),k=se&&af(se,x),z=ue&&af(ue,x);return{currentPageStats:Object.fromEntries(_(Y)),currentPageHighlightedStats:k&&Object.fromEntries(_(k)),currentPagePrevStats:z&&Object.fromEntries(_(z)),pagination:A(Y.length),max:pZ(Math.max(...oe.map(Bxe)))}},[_,C,x,A]),{currentPageStats:P,currentPagePrevStats:N,currentPageHighlightedStats:F,pagination:U,max:W}=w.useMemo(()=>O(e,i,n&&Object.keys(n).length>0?n:void 0,t&&Object.keys(t).length>0?t:void 0),[O,n,t,i,e]),X=w.useMemo(()=>Object.keys(P),[P]);return g.jsx(oz,{title:g.jsxs(L3,{children:[r,g.jsxs("div",{className:"flex items-center gap-3",children:[o?.(U?X:void 0),l&&Object.keys(e).length>50&&g.jsx(kxe,{ranges:[50,100,200,500],value:x,setValue:ae=>{b(ae),y(1)}}),g.jsx(rm,{buttonVariant:"link",menuAlignment:"right",buttonSize:"sm",buttonClassName:"[&]:p-0",items:i,order:f,onChange:ae=>{h(ae),y(1)}})]})]}),footer:U&&g.jsx("div",{className:"flex justify-around items-center","data-testid":"chart-paginator",children:U}),children:g.jsx(Ixe,{stats:P,prevStats:N,highlightedStats:F,max:W,...c})})},D3=e=>e.type!==void 0,Fxe=e=>e.type!==void 0,$xe=e=>{const t=y6(e,n=>D3(n.visit)?"orphanVisits":"nonOrphanVisits");return{orphanVisits:[],nonOrphanVisits:[],...t}},hz=(e,{shortCode:t,domain:n},{endDate:r,startDate:i}={})=>e.filter(({shortUrl:o,visit:l})=>o&&Ch(o,t,n)&&Em(l.date,i,r)),mz=(e,t,{endDate:n,startDate:r}={})=>e.filter(({shortUrl:i,visit:o})=>i&&T0e(i,t)&&Em(o.date,r,n)),pz=(e,t,{endDate:n,startDate:r}={})=>e.filter(({shortUrl:i,visit:o})=>i?.tags.includes(t)&&Em(o.date,r,n)),Tg=(e,t)=>v6(e,n=>n[t]),Vxe=e=>{const t=(e?.startDate&&Ol(e?.startDate))??void 0,n=(e?.endDate&&Ol(e?.endDate))??void 0;return{startDate:t,endDate:n}},s_=({filter:e,dateRange:t})=>{const{startDate:n,endDate:r}=Vxe(t),i=e?.excludeBots||void 0;return{startDate:n,endDate:r,excludeBots:i}},Hxe=e=>G9(e.dateRange),qxe=({dateRange:e,...t})=>({...t,dateRange:Nbe(e)}),ML=(e,t)=>{if(!(!t||!(e in t)))return t[e]&&Ol(t[e])||""},gz=()=>{const e=uo(),t=Zu(),{startDate:n,endDate:r,orphanVisitsType:i,excludeBots:o,loadPrevInterval:l,domain:c,...f}=t,h=w.useMemo(()=>({dateRange:n!=null||r!=null?V9(n,r):void 0,visitsFilter:{orphanVisitsType:i,excludeBots:o!==void 0?o==="true":void 0},loadPrevInterval:l!==void 0?l==="true":void 0,domain:c}),[r,o,l,i,n,c]),m=w.useCallback(y=>{const{dateRange:x,visitsFilter:b={},loadPrevInterval:C,domain:_}=Pf(h,y),{excludeBots:A,orphanVisitsType:O}=b,P={...f,startDate:ML("startDate",x),endDate:ML("endDate",x),excludeBots:A===void 0?void 0:nw(A),orphanVisitsType:O,loadPrevInterval:C===void 0?void 0:nw(C),domain:_},N=Q_(P),F=N?`?${N}`:"";e(F,{replace:!0,relative:"route"})},[h,e,f]);return[h,m]},Gxe=()=>g.jsx(Qye,{attribution:'© OpenStreetMap contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),Yxe=e=>{if(e.length===0)return{};if(e.length>1)return{bounds:e.map(({latLong:n})=>n)};const[{latLong:t}]=e;return{zoom:10,center:t}},vz=({toggle:e,isOpen:t,title:n,locations:r=[]})=>g.jsx(co,{open:t,onClose:e,title:n,variant:"cover",children:g.jsxs(Kye,{...Yxe(r),className:"h-full w-full",children:[g.jsx(Gxe,{}),r.map(({cityName:i,latLong:o,count:l},c)=>g.jsx(Zye,{position:o,children:g.jsxs(Xye,{children:[g.jsx("b",{children:l})," visit",l>1?"s":""," from ",g.jsx("b",{children:i})]})},c))]})}),Wxe=({modalTitle:e,activeCities:t,locations:n=[]})=>{const{flag:r,setToTrue:i,setToFalse:o}=Cn(),[l,c]=w.useState([]),f=w.useCallback(h=>{c(h?n.filter(h):n),i()},[n,i]);return g.jsxs(g.Fragment,{children:[!t&&g.jsx(Cy,{onClick:()=>f(),"aria-label":"Show in map",title:"Show in map",className:"[&]:p-0",children:g.jsx(Be,{icon:D2})}),t&&g.jsxs(qe,{buttonContent:g.jsx(Be,{icon:D2,title:"Show in map"}),buttonLabel:"Show in map",buttonVariant:"link",buttonClassName:"[&]:p-0",menuAlignment:"right",caretless:!0,children:[g.jsx(qe.Item,{onClick:()=>f(),children:"Show all locations"}),g.jsx(qe.Item,{onClick:()=>f(({cityName:h})=>t.includes(h)),children:"Show locations in current page"})]}),g.jsx(vz,{toggle:o,isOpen:r,title:e,locations:l})]})},yz=({onChange:e,selected:t={},isOrphanVisits:n=!1,withPrevInterval:r=!1,disabled:i})=>{const{orphanVisitsType:o,excludeBots:l=!1,loadPrevInterval:c=!1}=t,f=y=>({selected:o===y,onClick:()=>e({...t,orphanVisitsType:y===o?void 0:y})}),h=w.useCallback(()=>e({...t,excludeBots:!l}),[l,e,t]),m=w.useCallback(()=>e({...t,loadPrevInterval:!c}),[c,e,t]);return g.jsxs(qe,{buttonDisabled:i,buttonContent:"More",buttonClassName:"w-full",menuAlignment:"right",children:[r&&g.jsxs(g.Fragment,{children:[g.jsx(qe.Item,{selected:c,onClick:m,children:"Compare with previous period"}),g.jsx(qe.Separator,{})]}),g.jsx(qe.Title,{children:"Bots:"}),g.jsx(qe.Item,{selected:l,onClick:h,children:"Exclude potential bots"}),n&&g.jsxs(g.Fragment,{children:[g.jsx(qe.Separator,{}),g.jsx(qe.Title,{children:"Orphan visits type:"}),g.jsx(qe.Item,{...f("base_url"),children:"Base URL"}),g.jsx(qe.Item,{...f("invalid_short_url"),children:"Invalid short URL"}),g.jsx(qe.Item,{...f("regular_404"),children:"Regular 404"})]}),g.jsx(qe.Separator,{}),g.jsx(qe.Item,{disabled:t.excludeBots===void 0&&t.loadPrevInterval===void 0&&t.orphanVisitsType===void 0,onClick:()=>e({excludeBots:void 0,loadPrevInterval:void 0,orphanVisitsType:void 0}),children:g.jsx("i",{children:"Reset to defaults"})})]})},Kxe=({className:e,value:t,...n})=>{const r=Math.min(100,Math.max(0,t));return g.jsx("div",{className:Oe("flex h-4 bg-gray-100 overflow-hidden rounded-md",e),...n,children:g.jsx("div",{role:"progressbar","aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":r,className:"bg-lm-brand dark:bg-dm-brand transition-[width]",style:{width:`${r}%`}})})},bz=({info:e})=>{const{loading:t,errorData:n,progress:r}=e;return g.jsxs(g.Fragment,{children:[t&&r===null&&g.jsx(Ko,{loading:!0}),t&&r!==null&&g.jsxs(Ko,{loading:!0,children:["This is going to take a while... :S",g.jsx(Kxe,{value:r,className:"mt-4"})]}),n&&g.jsx(Gr,{variant:"error",children:g.jsx(so,{errorData:n,fallbackMessage:"An error occurred while loading visits :("})})]})},Vg=({children:e,showFallback:t})=>g.jsxs(g.Fragment,{children:[t&&g.jsx(Ko,{children:"There are no visits matching current filter"}),!t&&g.jsx(g.Fragment,{children:e})]}),Zxe=({visitsDeletion:e,deleteVisits:t})=>{const{deleting:n}=e,{flag:r,setToTrue:i}=Cn();return g.jsx(Nt,{title:g.jsx("span",{className:"text-danger font-bold text-base",children:"Danger zone"}),children:g.jsxs(L3,{children:[g.jsxs("dl",{className:"m-0 mr-3",children:[g.jsx("dt",{children:"Delete visits."}),g.jsxs("dd",{className:"m-0",children:["This will delete ",g.jsx("b",{children:"all"})," visits, not only the ones matching current filter."]})]}),!r&&g.jsx(Tt,{variant:"danger",solid:!0,className:"whitespace-nowrap",onClick:i,children:"Delete visits"}),r&&g.jsxs(Tt,{solid:!0,variant:"danger",disabled:n,className:"whitespace-nowrap",onClick:t,autoFocus:!0,children:[!n&&g.jsx(g.Fragment,{children:"Click again to confirm"}),n&&g.jsx(g.Fragment,{children:"Deleting..."})]})]})})},Og="Others",Xxe=["Android Browser","Chrome","Chromium","Firefox","Internet Explorer","Microsoft Edge","Opera","Safari","Samsung Internet for Android","Vivaldi","WeChat"],Qxe=e=>{if(!Su(e))return{browser:Og,os:Og};const{browser:{name:t},os:{name:n}}=i0e.parse(e);return{os:n??Og,browser:t&&Xxe.includes(t)?t:Og}},Jxe=e=>Su(e)?e.split("/")[e.includes("://")?2:0]?.split(":")[0]??"":"Direct",xz=(e,t)=>e[t]!==void 0,PL=e=>typeof e=="number"?e:e?parseFloat(e):0,e2e=(e,{os:t})=>{e[t]=(e[t]||0)+1},t2e=(e,{browser:t})=>{e[t]=(e[t]||0)+1},n2e=(e,{referer:t})=>{e[t]=(e[t]||0)+1},wz=e=>(t,n)=>{const r=xz(n,e)?n[e]:"Unknown";t[r]=(t[r]||0)+1},r2e=wz("country"),i2e=wz("city"),a2e=(e,t)=>{if(!xz(t,"city")||t.city==="Unknown")return;const{city:n,latitude:r,longitude:i}=t,o=e[n]||{cityName:n,count:0,latLong:[PL(r),PL(i)]};o.count+=1,e[n]=o},o2e=(e,t)=>{if(!Fxe(t))return;const{visitedUrl:n}=t;e[n]=(e[n]||0)+1},l_=e=>e.reduce((t,n)=>(e2e(t.os,n),t2e(t.browsers,n),n2e(t.referrers,n),r2e(t.countries,n),i2e(t.cities,n),a2e(t.citiesForMap,n),o2e(t.visitedUrls,n),t),{os:{},browsers:{},referrers:{},countries:{},cities:{},citiesForMap:{},visitedUrls:{}}),ay=e=>e.map(t=>{const{userAgent:n,date:r,referer:i,visitLocation:o,potentialBot:l}=t;return{date:r,potentialBot:l,userAgent:n,...Qxe(n),referer:Jxe(i),country:o?.countryName||"Unknown",region:o?.regionName||"Unknown",city:o?.cityName||"Unknown",latitude:o?.latitude,longitude:o?.longitude,visitedUrl:t.visitedUrl,type:D3(t)?t.type:void 0}}),s2e=Object.freeze(Object.defineProperty({__proto__:null,normalizeVisits:ay,processStatsFromVisits:l_},Symbol.toStringTag,{value:"Module"})),vh=20,l2e=({browser:e,os:t,referer:n,country:r,city:i,userAgent:o,...l},c,f)=>{const h=f?o:`${r} ${i}`;return`${e} ${t} ${n} ${h} ${l.visitedUrl}`.toLowerCase().includes(c.toLowerCase())},u2e=(e,t,n)=>t.filter(r=>l2e(r,e,n)),c2e=(e,t)=>m6(t,e),f2e=({visits:e,searchTerm:t,order:n,searchInRawUserAgent:r})=>{const i=t?u2e(t,e,r):[...e],o=c2e(n,i),l=o.length;return{visitsGroups:af(o,vh),total:l}},ba="cursor-pointer md:sticky-cell-separated md:top-[calc(var(--header-height)+41px)]",d2e=()=>{const{anchor:e,tooltip:t}=os({placement:"right"});return g.jsxs(g.Fragment,{children:[g.jsx(Be,{icon:MN,...e}),g.jsx(ss,{...t,children:"Potentially a visit from a bot or crawler"})]})},h2e=({visits:e,selectedVisits:t=[],setSelectedVisits:n})=>{const[r,i]=w.useState(),o=w.useCallback(F=>{i(F),x(1),n([])},[n]),[l,c]=w.useState({}),f=Fn("visitsList"),h=w.useMemo(()=>Pf(Ay,f?.columns??{}),[f?.columns]),m=w.useMemo(()=>f2e({visits:e,searchTerm:r,order:l,searchInRawUserAgent:h.userAgent}),[e,r,l,h.userAgent]),[y,x]=w.useState(1),b=y*vh,C=b-vh,_=w.useMemo(()=>h.visitedUrl?m.visitsGroups.length===0||!!m.visitsGroups[y-1]?.[0]?.visitedUrl:!1,[h.visitedUrl,y,m.visitsGroups]),A=6+Number(_)+(h.userAgent?1:2),O=m.total>0,P=F=>c(eS({currentField:l.field,currentOrderDir:l.dir,newField:F})),N=F=>g.jsx(Eh,{currentOrder:l,field:F,className:"float-right mt-[5px] ml-[5px]"});return g.jsx(Nt,{bodyClassName:"[&]:p-0 [&]:pb-1",title:"Visits list",children:g.jsxs($e,{responsive:!1,size:"sm",className:"w-full relative overflow-y-hidden bg-lm-primary dark:bg-dm-primary",header:g.jsxs(g.Fragment,{children:[g.jsxs($e.Row,{children:[g.jsxs($e.Cell,{className:Oe(ba,"[&]:text-center"),onClick:()=>n(t.length0})})]}),h.potentialBot&&g.jsxs($e.Cell,{className:Oe(ba,"[&]:text-center"),onClick:()=>P("potentialBot"),children:[g.jsx("span",{className:"sr-only",children:"Is bot"}),g.jsx(Be,{icon:MN}),N("potentialBot")]}),h.date&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("date"),children:["Date",N("date")]}),h.country&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("country"),children:["Country",N("country")]}),h.region&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("region"),children:["Region",N("region")]}),h.city&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("city"),children:["City",N("city")]}),h.userAgent&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("userAgent"),children:["User agent",N("userAgent")]}),h.browser&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("browser"),children:["Browser",N("browser")]}),h.browser&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("os"),children:["OS",N("os")]}),h.referer&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("referer"),children:["Referrer",N("referer")]}),_&&g.jsxs($e.Cell,{className:ba,onClick:()=>P("visitedUrl"),children:["Visited URL",N("visitedUrl")]})]}),g.jsx($e.Row,{children:g.jsx($e.Cell,{colSpan:A,className:"[&]:p-0",children:g.jsx(Mf,{size:"md",borderless:!0,onChange:o})})})]}),footer:m.total>vh?g.jsx($e.Row,{children:g.jsx($e.Cell,{type:"td",colSpan:A,className:"md:sticky-cell-separated bottom-0",children:g.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4 p-1",children:[g.jsx(Ey,{pagesCount:Math.ceil(m.total/vh),currentPage:y,onPageChange:x}),g.jsxs("div",{children:["Visits ",g.jsx("b",{children:Sn(C+1)})," to"," ",g.jsx("b",{children:Sn(Math.min(b,m.total))})," of"," ",g.jsx("b",{children:Sn(m.total)})]})]})})}):void 0,children:[!O&&g.jsx($e.Row,{children:g.jsx($e.Cell,{colSpan:A,className:"text-center",children:"There are no visits matching current filter"})}),m.visitsGroups[y-1]?.map((F,U)=>{const W=t.includes(F);return g.jsxs($e.Row,{className:Oe("cursor-pointer",W&&["bg-lm-table-highlight hover:[&]:bg-lm-table-highlight","dark:bg-dm-table-highlight dark:hover:[&]:bg-dm-table-highlight"]),onClick:()=>n(W?t.filter(X=>X!==F):[...t,F]),children:[g.jsx($e.Cell,{className:"text-center",children:W&&g.jsx(Be,{icon:Ru,className:"text-lm-brand dark:text-dm-brand"})}),h.potentialBot&&g.jsx($e.Cell,{className:"text-center",children:F.potentialBot&&g.jsx(d2e,{})}),h.date&&g.jsx($e.Cell,{children:g.jsx(ty,{date:F.date})}),h.country&&g.jsx($e.Cell,{children:F.country}),h.region&&g.jsx($e.Cell,{children:F.region}),h.city&&g.jsx($e.Cell,{children:F.city}),h.userAgent&&g.jsx($e.Cell,{children:F.userAgent}),h.browser&&g.jsx($e.Cell,{children:F.browser}),h.os&&g.jsx($e.Cell,{children:F.os}),h.referer&&g.jsx($e.Cell,{children:F.referer}),_&&g.jsx($e.Cell,{children:F.visitedUrl??""})]},U)})]})})},tl={byTime:{title:"By time",subPath:"by-time",icon:zV},byContext:{title:"By context",subPath:"by-context",icon:P_},byLocation:{title:"By location",subPath:"by-location",icon:D2},list:{title:"List",subPath:"list",icon:M_},options:{title:"Options",subPath:"options",icon:EN,shouldRender:({deletion:e})=>!!e}};Object.freeze(tl);const j2=({display:e})=>e&&g.jsx("div",{className:"mx-auto w-3/4",children:g.jsx(Nt,{children:g.jsxs("div",{className:"flex gap-2",children:[g.jsx(Be,{icon:vH,className:"mt-1"}),g.jsx("i",{children:"Could not calculate previous period because selected one does not have a strictly defined start date."})]})})}),Tm=e=>{const{children:t,visitsInfo:n,getVisits:r,cancelGetVisits:i,deletion:o,exportCsv:l,isOrphanVisits:c=!1,domains:f}=e,{visits:h,prevVisits:m,loading:y,errorData:x,fallbackInterval:b}=n,[{dateRange:C,visitsFilter:_,loadPrevInterval:A,domain:O},P]=gz(),N=Fn("visits"),[F,U]=w.useState(),W=w.useCallback(({startDate:Z,endDate:ne},me)=>{P({dateRange:{startDate:Z??void 0,endDate:ne??void 0}}),U(me)},[P]),[X,ae]=w.useState(b??N?.defaultInterval??"last30Days"),[ce,re]=w.useState([]),[J,oe]=w.useState(),we=w.useRef(!0),{search:se}=Or(),ue=w.useCallback(Z=>Z?`../${Z}${se}`:se,[se]),Y=w.useMemo(()=>ay(h),[h]),k=w.useMemo(()=>m&&ay(m),[m]),{os:z,browsers:H,referrers:I,countries:j,cities:q,citiesForMap:ee,visitedUrls:le}=w.useMemo(()=>l_(Y),[Y]),pe=w.useMemo(()=>l_(k??[]),[k]),he=w.useMemo(()=>Object.fromEntries([["Visits",Object.assign(Y,{type:"main"})],k&&["Previous period",Object.assign(k,{type:"previous"})],ce.length>0&&[J??"Selected",Object.assign(ce,{type:"highlighted"})]].filter(Boolean)),[J,ce,k,Y]),ve=w.useMemo(()=>({..._,excludeBots:_.excludeBots??N?.excludeBots,loadPrevInterval:A??N?.loadPrevInterval,domain:O}),[A,_,N?.excludeBots,N?.loadPrevInterval,O]),D=w.useMemo(()=>Object.values(ee),[ee]),R=w.useRef(void 0),G=w.useCallback(Z=>{R.current=void 0,re(Z)},[]),te=w.useCallback((Z,ne)=>{const me=`${Z}_${ne}`;R.current===me?(re([]),oe(void 0),R.current=void 0):(re(Y.filter(ie=>ie[Z]===ne)),oe(ne),R.current=me)},[Y]),V=cl("filterVisitsByDomain");return w.useEffect(()=>i,[i]),w.useEffect(()=>{const Z=C??q9(X),{loadPrevInterval:ne,...me}=ve,ie={doIntervalFallback:we.current,loadPrevInterval:ne};r({dateRange:Z,filter:me},ie),G([]),we.current=!1},[X,C,r,ve,G]),w.useEffect(()=>{b&&X===(N?.defaultInterval??"last30Days")&&ae(b)},[X,b,N?.defaultInterval]),g.jsxs("div",{className:"flex flex-col gap-y-4",children:[t,g.jsxs("section",{className:"flex flex-col lg:flex-row-reverse gap-4",children:[g.jsxs("div",{className:"lg:w-1/2 flex flex-col md:flex-row gap-x-2 gap-y-4",children:[g.jsx("div",{className:"grow",children:g.jsx(O3,{disabled:y,dateRangeOrInterval:F??C??X,defaultText:"All visits",onDatesChange:W})}),V&&f&&g.jsx(B9,{domains:y?[]:f,value:O,onChange:Z=>P({domain:Z})}),g.jsx(yz,{disabled:y,isOrphanVisits:c,withPrevInterval:!0,selected:ve,onChange:({loadPrevInterval:Z,...ne})=>P({visitsFilter:ne,loadPrevInterval:Z})})]}),g.jsx("div",{className:"lg:w-1/2 xl:flex-3 flex gap-2",children:h.length>0&&g.jsxs(g.Fragment,{children:[g.jsx(O9,{className:"max-lg:w-full",amount:Y.length,onClick:()=>l(Y)}),g.jsxs(Tt,{variant:"secondary",solid:ce.length>0&&!ls(),disabled:ce.length===0,className:"max-lg:w-full",onClick:()=>G([]),children:["Clear selection ",ce.length>0&&g.jsxs(g.Fragment,{children:["(",Sn(ce.length),")"]})]})]})})]}),g.jsxs("section",{className:"flex flex-col gap-4",children:[g.jsx(bz,{info:n}),!y&&!x&&g.jsxs(g.Fragment,{children:[g.jsx(nl,{fill:!0,className:"sticky top-(--header-height) z-2",children:Object.values(tl).map(({title:Z,icon:ne,subPath:me,shouldRender:ie},xe)=>!ie||ie(e)?g.jsxs(nl.Pill,{to:ue(me),replace:!0,children:[g.jsx(Be,{icon:ne}),g.jsx("span",{className:"ml-2 max-lg:sr-only",children:Z})]},xe):void 0).filter(Boolean)}),g.jsxs(sy,{children:[g.jsx(ft,{path:tl.byTime.subPath,element:g.jsxs(Vg,{showFallback:h.length===0,children:[g.jsx("div",{"data-testid":"line-chart-container",children:g.jsx(dz,{visitsGroups:he,setSelectedVisits:G,onDateRangeChange:W})}),g.jsx(j2,{display:!!ve.loadPrevInterval&&!m})]})}),g.jsx(ft,{path:tl.byContext.subPath,element:g.jsxs(Vg,{showFallback:h.length===0,children:[g.jsxs("div",{className:Oe("grid grid-cols-1 gap-4",{"lg:grid-cols-2":c,"xl:grid-cols-3":!c}),children:[g.jsx(TL,{title:"Operating systems",stats:z,prevStats:pe.os}),g.jsx(TL,{title:"Browsers",stats:H,prevStats:pe.browsers}),g.jsx(Ag,{title:"Referrers",withPagination:!1,stats:I,prevStats:pe.referrers,highlightedStats:Tg(ce,"referer"),highlightedLabel:J,sortingItems:{name:"Referrer name",amount:"Visits amount"},onClick:Z=>te("referer",Z)}),c&&g.jsx(Ag,{title:"Visited URLs",stats:le,prevStats:pe.visitedUrls,highlightedStats:Tg(ce,"visitedUrl"),highlightedLabel:J,sortingItems:{visitedUrl:"Visited URL",amount:"Visits amount"},onClick:Z=>te("visitedUrl",Z)})]}),g.jsx(j2,{display:!!ve.loadPrevInterval&&!m})]})}),g.jsx(ft,{path:tl.byLocation.subPath,element:g.jsxs(Vg,{showFallback:h.length===0,children:[g.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[g.jsx(Ag,{title:"Countries",stats:j,prevStats:pe.countries,highlightedStats:Tg(ce,"country"),highlightedLabel:J,sortingItems:{name:"Country name",amount:"Visits amount"},onClick:Z=>te("country",Z)}),g.jsx(Ag,{title:"Cities",stats:q,prevStats:pe.cities,highlightedStats:Tg(ce,"city"),highlightedLabel:J,extraHeaderContent:Z=>D.length>0&&g.jsx(Wxe,{modalTitle:"Cities",locations:D,activeCities:Z}),sortingItems:{name:"City name",amount:"Visits amount"},onClick:Z=>te("city",Z)})]}),g.jsx(j2,{display:!!ve.loadPrevInterval&&!m})]})}),g.jsx(ft,{path:tl.list.subPath,element:g.jsx(h2e,{visits:Y,selectedVisits:ce,setSelectedVisits:G})}),o&&g.jsx(ft,{path:tl.options.subPath,element:g.jsx(Zxe,{...o})}),g.jsx(ft,{path:"*",element:g.jsx(b_,{replace:!0,to:ue(tl.byTime.subPath)})})]})]})]})]})},_z=Na(({getDomainVisits:e,domainVisits:t,cancelGetDomainVisits:n})=>{const{ReportExporter:r}=An(_z),{domain:i=""}=Ef(),[o,l=o]=i.split("_"),c=w.useCallback((h,m)=>e({domain:l,options:m,params:h}),[l,e]),f=w.useCallback(h=>r.exportVisits(`domain_${o}_visits.csv`,h),[o,r]);return g.jsx(Tm,{getVisits:c,cancelGetVisits:n,visitsInfo:t,exportCsv:f,children:g.jsx(Am,{visits:t.visits,title:`"${o}" visits`})})},()=>[ia.visits]),m2e=Tn(_z,["ReportExporter"]),Sz=Na(({getNonOrphanVisits:e,nonOrphanVisits:t,cancelGetNonOrphanVisits:n,domainsList:r})=>{const{ReportExporter:i}=An(Sz),o=w.useCallback(c=>i.exportVisits("non_orphan_visits.csv",c),[i]),l=w.useCallback((c,f)=>e({options:f,params:c,domain:c.filter?.domain}),[e]);return g.jsx(Tm,{getVisits:l,cancelGetVisits:n,visitsInfo:t,exportCsv:o,domains:r.domains,children:g.jsx(Am,{title:"Non-orphan visits",visits:t.visits})})},()=>[ia.visits]),p2e=Tn(Sz,["ReportExporter"]),Cz=Na(({getOrphanVisits:e,orphanVisits:t,cancelGetOrphanVisits:n,deleteOrphanVisits:r,orphanVisitsDeletion:i,domainsList:o})=>{const{ReportExporter:l}=An(Cz),c=w.useCallback(m=>l.exportVisits("orphan_visits.csv",m),[l]),f=w.useCallback((m,y)=>e({options:y,params:m,orphanVisitsType:m.filter?.orphanVisitsType,domain:m.filter?.domain}),[e]),h=w.useMemo(()=>({deleteVisits:r,visitsDeletion:i}),[r,i]);return g.jsx(Tm,{getVisits:f,cancelGetVisits:n,visitsInfo:t,exportCsv:c,deletion:h,isOrphanVisits:!0,domains:o.domains,children:g.jsx(Am,{title:"Orphan visits",visits:t.visits})})},()=>[ia.orphanVisits]),g2e=Tn(Cz,["ReportExporter"]),LL=5e3,v2e=2,y2e=4,b2e=({currentPage:e,pagesCount:t})=>e>=t,x2e=(e,t)=>t*100/e,Ez=({visitsLoader:e,shouldCancel:t,progressChanged:n,batchSize:r})=>{const i=async(l,c)=>Promise.all(c.map(async f=>e({...l,page:f,itemsPerPage:LL}).then(({data:h})=>h))).then(f=>f.flat()),o=async(l,c,f=0)=>{if(t())return[];const h=await i(l,c[f]);return n(x2e(c.length,f+1)),f{const{pagination:c,data:f}=await e({...l,page:1,itemsPerPage:LL});if(b2e(c))return f;const h=x6(v2e,c.pagesCount+1),m=af(h,r);return c.pagesCount-1>r&&n(0),f.concat(await o(l,m))}},Om=(e,t)=>async n=>e?t({page:1,itemsPerPage:1,excludeBots:n}).then(({data:r})=>r[0]):Promise.resolve(void 0),jm=({typePrefix:e,createLoaders:t,shouldCancel:n})=>{const r=un(`${e}/progressChanged`),i=un(`${e}/fallbackToInterval`),o=or(e,async(l,{getState:c,dispatch:f})=>{const{params:h,options:m}=l,{visitsLoader:y,lastVisitLoader:x}=t(l),b=Rbe(h.dateRange),C=s_(h),_=m.loadPrevInterval&&Hxe(h)?s_(qxe(h)):void 0,A=y2e/(_?2:1),O=_?{main:0,prev:0}:{main:0},P=(X,ae)=>{O[X]=ae;const ce=Object.values(O),re=ce.reduce((J,oe)=>J+oe,0);f(r(re/ce.length))},N=Ez({visitsLoader:y,shouldCancel:()=>n(c),progressChanged:X=>P("main",X),batchSize:A}),[F,U,W]=await Promise.all([N(C),x(h.filter?.excludeBots),_?N(_).then(X=>X.map(ae=>{if(b===void 0)return ae;const{date:ce,...re}=ae,J=gS(ji(ce),b);return{...re,date:Ol(J)}})):Promise.resolve(void 0)]);return!F.length&&U&&f(i(Lbe(U.date))),{...l,visits:F,prevVisits:W}});return Object.assign(o,{progressChanged:r,fallbackToInterval:i})},Mm=({name:e,asyncThunkCreator:t,initialState:n,filterCreatedVisits:r,extraReducers:i})=>{const{pending:o,rejected:l,fulfilled:c,progressChanged:f,fallbackToInterval:h}=t,{reducer:m,actions:y}=jt({name:e,initialState:n,reducers:{cancelGetVisits:b=>({...b,cancelLoad:!0})},extraReducers:b=>{b.addCase(o,()=>({...n,loading:!0})),b.addCase(l,(C,{error:_})=>({...n,errorData:zi(_)??null})),b.addCase(c,(C,{payload:_})=>({...C,..._,loading:!1,progress:null,errorData:null})),b.addCase(f,(C,{payload:_})=>({...C,progress:_})),b.addCase(h,(C,{payload:_})=>({...C,fallbackInterval:_})),b.addCase(Vf,(C,{payload:_})=>{const{visits:A}=C,O=r(C,_.createdVisits).map(({visit:P})=>P);return O.length?{...C,visits:[...O,...A]}:C}),i?.(b)}}),{cancelGetVisits:x}=y;return{reducer:m,cancelGetVisits:x}},Az="shlink/domainVisits",w2e={visits:[],domain:"",loading:!1,cancelLoad:!1,errorData:null,progress:null},_2e=e=>jm({typePrefix:`${Az}/getDomainVisits`,createLoaders:({domain:t,options:n})=>{const r=e(),{doIntervalFallback:i=!1}=n,o=c=>r.getDomainVisits(t,c),l=Om(i,c=>r.getDomainVisits(t,c));return{visitsLoader:o,lastVisitLoader:l}},shouldCancel:t=>t().domainVisits.cancelLoad}),S2e=e=>Mm({name:Az,initialState:w2e,asyncThunkCreator:e,filterCreatedVisits:({domain:t,params:n},r)=>mz(r,t,n?.dateRange)}),Tz="shlink/orphanVisits",C2e={visits:[],loading:!1,cancelLoad:!1,errorData:null,progress:null},E2e=e=>jm({typePrefix:`${Tz}/getNonOrphanVisits`,createLoaders:({options:t,domain:n})=>{const r=e(),{doIntervalFallback:i=!1}=t,o=async c=>r.getNonOrphanVisits({...c,domain:n}),l=Om(i,c=>r.getNonOrphanVisits(c));return{visitsLoader:o,lastVisitLoader:l}},shouldCancel:t=>t().orphanVisits.cancelLoad}),A2e=e=>Mm({name:Tz,initialState:C2e,asyncThunkCreator:e,filterCreatedVisits:({params:t},n)=>{const{startDate:r,endDate:i}=t?.dateRange??{};return n.filter(({visit:o})=>Em(o.date,r,i))}}),Oz="shlink/orphanVisits",T2e={visits:[],loading:!1,cancelLoad:!1,errorData:null,progress:null},O2e=(e,t)=>!t||t===e.type,j2e=({data:e,...t},n)=>{const r=e.filter(i=>D3(i)&&O2e(i,n));return{...t,data:r}},M2e=e=>jm({typePrefix:`${Oz}/getOrphanVisits`,createLoaders:({orphanVisitsType:t,domain:n,options:r})=>{const i=e(),{doIntervalFallback:o=!1}=r,l=async f=>i.getOrphanVisits({...f,type:t,domain:n}).then(h=>j2e(h,t)),c=Om(o,f=>i.getOrphanVisits(f));return{visitsLoader:l,lastVisitLoader:c}},shouldCancel:t=>t().orphanVisits.cancelLoad}),P2e=(e,t)=>Mm({name:Oz,initialState:T2e,asyncThunkCreator:e,extraReducers:n=>{n.addCase(t.fulfilled,r=>({...r,visits:[]}))},filterCreatedVisits:({params:n},r)=>{const{startDate:i,endDate:o}=n?.dateRange??{};return r.filter(({visit:l,shortUrl:c})=>!c&&Em(l.date,i,o))}}),jz="shlink/orphanVisitsDeletion",NL={deletedVisits:0,deleting:!1,error:!1},L2e=e=>or(`${jz}/deleteOrphanVisits`,()=>e().deleteOrphanVisits()),N2e=e=>jt({name:jz,initialState:NL,reducers:{},extraReducers:t=>{t.addCase(e.pending,n=>({...n,deleting:!0,error:!1})),t.addCase(e.rejected,(n,{error:r})=>({...n,deleting:!1,error:!0,errorData:zi(r)})),t.addCase(e.fulfilled,(n,{payload:r})=>{const{deletedVisits:i}=r;return{...NL,deletedVisits:i}})}}),Mz="shlink/shortUrlVisits",R2e={visits:[],shortCode:"",loading:!1,errorData:null,cancelLoad:!1,progress:null},D2e=e=>jm({typePrefix:`${Mz}/getShortUrlVisits`,createLoaders:({shortCode:t,domain:n,options:r})=>{const i=e(),{doIntervalFallback:o=!1}=r,l=f=>i.getShortUrlVisits({shortCode:t,domain:n},f),c=Om(o,f=>i.getShortUrlVisits({shortCode:t,domain:n},f));return{visitsLoader:l,lastVisitLoader:c}},shouldCancel:t=>t().shortUrlVisits.cancelLoad}),k2e=(e,t)=>Mm({name:Mz,initialState:R2e,asyncThunkCreator:e,extraReducers:n=>{n.addCase(t.fulfilled,(r,{payload:i})=>r.shortCode===i.shortCode&&r.domain===i.domain?{...r,visits:[]}:r)},filterCreatedVisits:({shortCode:n,domain:r,params:i},o)=>hz(o,{shortCode:n,domain:r},i?.dateRange)}),Pz="shlink/shortUrlVisitsDeletion",RL={shortCode:"",deletedVisits:0,deleting:!1,error:!1},I2e=e=>or(`${Pz}/deleteShortUrlVisits`,async({shortCode:t,domain:n})=>({...await e().deleteShortUrlVisits({shortCode:t,domain:n}),shortCode:t,domain:n})),z2e=e=>jt({name:Pz,initialState:RL,reducers:{},extraReducers:t=>{t.addCase(e.pending,n=>({...n,deleting:!0,error:!1})),t.addCase(e.rejected,(n,{error:r})=>({...n,deleting:!1,error:!0,errorData:zi(r)})),t.addCase(e.fulfilled,(n,{payload:r})=>{const{shortCode:i,domain:o,deletedVisits:l}=r;return{...RL,shortCode:i,domain:o,deletedVisits:l}})}}),Lz="shlink/tagVisits",U2e={visits:[],tag:"",loading:!1,cancelLoad:!1,errorData:null,progress:null},B2e=e=>jm({typePrefix:`${Lz}/getTagVisits`,createLoaders:({tag:t,options:n,domain:r})=>{const i=e(),{doIntervalFallback:o=!1}=n,l=f=>i.getTagVisits(t,{...f,domain:r}),c=Om(o,async f=>i.getTagVisits(t,f));return{visitsLoader:l,lastVisitLoader:c}},shouldCancel:t=>t().tagVisits.cancelLoad}),F2e=e=>Mm({name:Lz,initialState:U2e,asyncThunkCreator:e,filterCreatedVisits:({tag:t,params:n},r)=>pz(r,t,n?.dateRange)}),Nz="shlink/visitsOverview",jg={nonOrphanVisits:{total:0},orphanVisits:{total:0},loading:!1,error:!1},DL=e=>e.filter(({visit:t})=>t.potentialBot).length,$2e=e=>or(`${Nz}/loadVisitsOverview`,()=>e().getVisitsOverview()),V2e=e=>jt({name:Nz,initialState:jg,reducers:{},extraReducers:t=>{t.addCase(e.pending,()=>({...jg,loading:!0})),t.addCase(e.rejected,()=>({...jg,error:!0})),t.addCase(e.fulfilled,(n,{payload:r})=>({...jg,...r})),t.addCase(Vf,({nonOrphanVisits:n,orphanVisits:r,...i},{payload:o})=>{const{nonOrphanVisits:l,orphanVisits:c}=$xe(o.createdVisits),f=l.length,h=DL(l),m=f-h,y=c.length,x=DL(c),b=y-x;return{...i,nonOrphanVisits:{total:n.total+f,bots:n.bots&&n.bots+h,nonBots:n.nonBots&&n.nonBots+m},orphanVisits:{total:r.total+y,bots:r.bots&&r.bots+x,nonBots:r.nonBots&&r.nonBots+b}}})}}),H2e=({shortUrl:e})=>{const{anchor:t,tooltip:n}=os({placement:"bottom"});return e?g.jsxs("span",{children:[g.jsx("b",{className:"cursor-default",...t,children:g.jsx(ty,{date:e.dateCreated,relative:!0})}),g.jsx(ss,{...n,children:g.jsx(ty,{date:e.dateCreated})})]}):g.jsx("small",{children:"Loading..."})},q2e=({shortUrl:e,loading:t,shortUrlVisits:n})=>{const{visits:r}=n,i=e?.shortUrl??"",o=e?.longUrl??"",l=e?.title;return g.jsxs(Am,{title:g.jsxs(g.Fragment,{children:["Visits for ",g.jsx(Li,{href:i})]}),visits:r,shortUrl:e,children:[g.jsx("hr",{}),g.jsxs("div",{children:["Created: ",g.jsx(H2e,{shortUrl:e})]}),g.jsxs("div",{"data-testid":"long-url-container",children:[`${l?"Title":"Long URL"}: `,t&&g.jsx("small",{children:"Loading..."}),!t&&g.jsx(Li,{href:o,children:l??o})]})]})},Rz=Na(({shortUrlVisits:e,shortUrlVisitsDeletion:t,shortUrlsDetails:n,getShortUrlVisits:r,getShortUrlsDetails:i,deleteShortUrlVisits:o,cancelGetShortUrlVisits:l})=>{const{ReportExporter:c}=An(Rz),f=C3(),h=w.useMemo(()=>n.shortUrls?.get(f),[f,n.shortUrls]),m=w.useCallback((b,C)=>r({...f,options:C,params:b}),[r,f]),y=w.useCallback(b=>c.exportVisits(`short-url_${h?.shortUrl.replace(/https?:\/\//g,"")}_visits.csv`,b),[c,h?.shortUrl]),x=w.useMemo(()=>({deleteVisits:()=>o(f),visitsDeletion:t}),[o,f,t]);return w.useEffect(()=>{i([f])},[f,i]),g.jsx(Tm,{getVisits:m,cancelGetVisits:l,visitsInfo:e,exportCsv:y,deletion:x,children:g.jsx(q2e,{shortUrl:h,loading:n.loading,shortUrlVisits:e})})},e=>e.shortCode?[ia.shortUrlVisits(x3(e.shortCode))]:[]),G2e=Tn(Rz,["ReportExporter"]),Y2e=({tagVisits:e,colorGenerator:t})=>{const{visits:n,tag:r}=e;return g.jsx(Am,{title:g.jsxs("span",{className:"flex items-center justify-center",children:[g.jsx("span",{className:"mr-2",children:"Visits for"}),g.jsx(w0,{text:r,colorGenerator:t})]}),visits:n})},Dz=Na(({getTagVisits:e,tagVisits:t,cancelGetTagVisits:n,domainsList:r})=>{const{ColorGenerator:i,ReportExporter:o}=An(Dz),{tag:l=""}=Ef(),c=w.useCallback((h,m)=>e({tag:l,params:h,options:m,domain:h.filter?.domain}),[e,l]),f=w.useCallback(h=>o.exportVisits(`tag_${l}_visits.csv`,h),[o,l]);return g.jsx(Tm,{getVisits:c,cancelGetVisits:n,visitsInfo:t,exportCsv:f,domains:r.domains,children:g.jsx(Y2e,{tagVisits:t,colorGenerator:i})})},()=>[ia.visits]),W2e=Tn(Dz,["ColorGenerator","ReportExporter"]),k3=({title:e,colors:t,getVisitsForComparison:n,visitsComparisonInfo:r,cancelGetVisitsComparison:i})=>{const{loading:o,visitsGroups:l}=r,c=Fn("visits"),f=w.useMemo(()=>Object.keys(l).reduce((P,N,F)=>(P[N]=Object.assign(ay(l[N]),{color:t?.[N]??cz(F)}),P),{}),[t,l]),h=w.useMemo(()=>Object.values(l).every(P=>P.length===0),[l]),[{dateRange:m,visitsFilter:y},x]=gz(),[b,C]=w.useState(),_=w.useCallback(({startDate:P,endDate:N},F)=>{x({dateRange:{startDate:P??void 0,endDate:N??void 0}}),C(F)},[x]),[A]=w.useState(()=>m??c?.defaultInterval??"last30Days"),O=w.useMemo(()=>({...y,excludeBots:y.excludeBots??c?.excludeBots}),[y,c?.excludeBots]);return w.useEffect(()=>{const P=m??q9(A);return n({params:{dateRange:P,filter:O}}),i},[i,m,n,A,O]),g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsxs(Nt,{bodyClassName:"flex items-center",children:[g.jsx(x0,{}),g.jsx("h3",{className:"grow text-center",children:e})]}),g.jsxs("div",{className:"flex flex-col lg:flex-row-reverse gap-4",children:[g.jsxs("div",{className:"lg:flex-3 flex flex-col md:flex-row gap-x-2 gap-y-4",children:[g.jsx("div",{className:"grow",children:g.jsx(O3,{disabled:o,defaultText:"All visits",dateRangeOrInterval:b??m??A,onDatesChange:_})}),g.jsx(yz,{disabled:o,selected:O,onChange:({orphanVisitsType:P,excludeBots:N})=>x({visitsFilter:{orphanVisitsType:P,excludeBots:N}})})]}),g.jsx("div",{className:"hidden lg:block lg:flex-2 xl:flex-3"})]}),g.jsx(bz,{info:r}),!o&&g.jsx(Vg,{showFallback:h,children:g.jsx(dz,{visitsGroups:f,onDateRangeChange:_})})]})},K2e=Na(({getDomainVisitsForComparison:e,domainVisitsComparison:t,cancelGetDomainVisitsComparison:n})=>{const r=P3("domains"),i=w.useCallback(o=>e({...o,domains:r}),[r,e]);return g.jsx(k3,{title:`Comparing "${r.join('", "')}"`,getVisitsForComparison:i,visitsComparisonInfo:t,cancelGetVisitsComparison:n})},()=>[ia.visits]),Z2e=({visitsLoaders:e,shouldCancel:t,progressChanged:n})=>{const r=Object.keys(e),i=Math.max(1,Math.round(4/r.length)),o=Object.fromEntries(r.map(f=>[f,0])),l=(f,h)=>{o[f]=h;const m=Object.values(o),y=m.reduce((x,b)=>x+b,0);n(y/m.length)},c=Object.entries(e).map(([f,h])=>[f,Ez({visitsLoader:h,batchSize:i,shouldCancel:t,progressChanged:m=>l(f,m)})]);return async f=>{const h=await Promise.all(c.map(async([m,y])=>{const x=await y(f);return[m,x]}));return Object.fromEntries(h)}},I3=({typePrefix:e,createLoaders:t,shouldCancel:n})=>{const r=un(`${e}/progressChanged`),i=or(e,async(o,{getState:l,dispatch:c})=>{const f=t(o),h=await Z2e({visitsLoaders:f,shouldCancel:()=>n(l),progressChanged:m=>c(r(m))})(s_(o.params));return{...o,visitsGroups:h}});return Object.assign(i,{progressChanged:r})},z3=({name:e,asyncThunkCreator:t,initialState:n,filterCreatedVisitsForGroup:r})=>{const{pending:i,rejected:o,fulfilled:l,progressChanged:c}=t,{reducer:f,actions:h}=jt({name:e,initialState:n,reducers:{cancelGetVisits:y=>({...y,cancelLoad:!0})},extraReducers:y=>{y.addCase(i,()=>({...n,loading:!0})),y.addCase(o,(x,{error:b})=>({...n,errorData:zi(b)??null})),y.addCase(l,(x,{payload:b})=>({...x,...b,loading:!1,progress:null,errorData:null})),y.addCase(c,(x,{payload:b})=>({...x,progress:b})),y.addCase(Vf,(x,{payload:b})=>{const{visitsGroups:C,..._}=x,A=Object.keys(C).map(P=>{const N=r({..._,groupKey:P},b.createdVisits).map(({visit:F})=>F);return[P,[...N,...C[P]]]}),O=Object.fromEntries(A);return{..._,visitsGroups:O}})}}),{cancelGetVisits:m}=h;return{reducer:f,cancelGetVisits:m}},kz="shlink/domainVisitsComparison",X2e={visitsGroups:{},loading:!1,cancelLoad:!1,errorData:null,progress:null},Q2e=e=>I3({typePrefix:`${kz}/getDomainVisitsForComparison`,createLoaders:({domains:t})=>{const n=e(),r=t.map(i=>[i,o=>n.getDomainVisits(i,o)]);return Object.fromEntries(r)},shouldCancel:t=>t().domainVisitsComparison.cancelLoad}),J2e=e=>z3({name:kz,initialState:X2e,asyncThunkCreator:e,filterCreatedVisitsForGroup:({groupKey:t,params:n},r)=>mz(r,t,n?.dateRange)}),Iz="shlink/shortUrlVisitsComparison",ewe={visitsGroups:{},loading:!1,cancelLoad:!1,errorData:null,progress:null},twe=e=>I3({typePrefix:`${Iz}/getShortUrlVisitsForComparison`,createLoaders:({shortUrls:t})=>{const n=e(),r=t.map(i=>[w3(i),o=>n.getShortUrlVisits(i,o)]);return Object.fromEntries(r)},shouldCancel:t=>t().shortUrlVisitsComparison.cancelLoad}),nwe=e=>z3({name:Iz,initialState:ewe,asyncThunkCreator:e,filterCreatedVisitsForGroup:({groupKey:t,params:n},r)=>hz(r,o9(t),n?.dateRange)}),zz="shlink/tagVisitsComparison",rwe={visitsGroups:{},loading:!1,cancelLoad:!1,errorData:null,progress:null},iwe=e=>I3({typePrefix:`${zz}/getTagVisitsForComparison`,createLoaders:({tags:t})=>{const n=e(),r=t.map(i=>[i,o=>n.getTagVisits(i,o)]);return Object.fromEntries(r)},shouldCancel:t=>t().tagVisitsComparison.cancelLoad}),awe=e=>z3({name:zz,initialState:rwe,asyncThunkCreator:e,filterCreatedVisitsForGroup:({groupKey:t,params:n},r)=>pz(r,t,n?.dateRange)}),owe=Na(({getShortUrlVisitsForComparison:e,shortUrlVisitsComparison:t,cancelGetShortUrlVisitsComparison:n,shortUrlsDetails:r,getShortUrlsDetails:i})=>{const o=P3("short-urls"),l=w.useMemo(()=>o.map(o9),[o]),c=w.useCallback(m=>e({...m,shortUrls:l}),[e,l]),f=w.useMemo(()=>[...r.shortUrls?.values()??[]],[r.shortUrls]),h=w.useMemo(()=>{const{visitsGroups:m,loading:y,...x}=t,b=f.reduce((C,_)=>(C[_.shortUrl]=m[w3(_)]??[],C),{});return{...x,visitsGroups:b,loading:y||r.loading}},[t,r.loading,f]);return w.useEffect(()=>{l.length>0&&i(l)},[i,l]),g.jsx(k3,{title:g.jsx("span",{"data-testid":"title",children:r.loading?"Loading...":`Comparing ${f.length} short URLs`}),getVisitsForComparison:c,visitsComparisonInfo:h,cancelGetVisitsComparison:n})},()=>[ia.visits]),Uz=Na(({getTagVisitsForComparison:e,tagVisitsComparison:t,cancelGetTagVisitsComparison:n})=>{const{ColorGenerator:r}=An(Uz),i=P3("tags"),o=w.useCallback(f=>e({...f,tags:i}),[e,i]),{visitsGroups:l}=t,c=w.useMemo(()=>Object.keys(l).reduce((f,h)=>(f[h]=r.getColorForKey(h),f),{}),[r,l]);return g.jsx(k3,{title:g.jsxs(g.Fragment,{children:["Comparing ",i.map(f=>g.jsx(w0,{colorGenerator:r,text:f},f))]}),getVisitsForComparison:o,visitsComparisonInfo:t,cancelGetVisitsComparison:n,colors:c})},()=>[ia.visits]),swe=Tn(Uz,["ColorGenerator"]),lwe=(e,t)=>{const n=(r,i)=>t([...r,"mercureInfo"],[...i,"createNewVisits","loadMercureInfo"]);e.serviceFactory("MapModal",()=>vz),e.factory("ShortUrlVisits",G2e),e.decorator("ShortUrlVisits",t(["shortUrlVisits","shortUrlVisitsDeletion","shortUrlsDetails","mercureInfo"],["getShortUrlVisits","deleteShortUrlVisits","getShortUrlsDetails","cancelGetShortUrlVisits","createNewVisits","loadMercureInfo"])),e.factory("TagVisits",W2e),e.decorator("TagVisits",n(["tagVisits","domainsList"],["getTagVisits","cancelGetTagVisits"])),e.factory("TagVisitsComparison",swe),e.decorator("TagVisitsComparison",n(["tagVisitsComparison"],["getTagVisitsForComparison","cancelGetTagVisitsForComparison"])),e.serviceFactory("DomainVisitsComparison",()=>K2e),e.decorator("DomainVisitsComparison",n(["domainVisitsComparison"],["getDomainVisitsForComparison","cancelGetDomainVisitsForComparison"])),e.serviceFactory("ShortUrlVisitsComparison",()=>owe),e.decorator("ShortUrlVisitsComparison",n(["shortUrlVisitsComparison","shortUrlsDetails"],["getShortUrlVisitsForComparison","cancelGetShortUrlVisitsForComparison","getShortUrlsDetails"])),e.factory("DomainVisits",m2e),e.decorator("DomainVisits",n(["domainVisits"],["getDomainVisits","cancelGetDomainVisits"])),e.factory("OrphanVisits",g2e),e.decorator("OrphanVisits",n(["orphanVisits","orphanVisitsDeletion","domainsList"],["getOrphanVisits","cancelGetOrphanVisits","deleteOrphanVisits"])),e.factory("NonOrphanVisits",p2e),e.decorator("NonOrphanVisits",n(["nonOrphanVisits","domainsList"],["getNonOrphanVisits","cancelGetNonOrphanVisits"])),e.serviceFactory("VisitsParser",()=>s2e),e.serviceFactory("getShortUrlVisits",D2e,"apiClientFactory"),e.serviceFactory("cancelGetShortUrlVisits",r=>r.cancelGetVisits,"shortUrlVisitsReducerCreator"),e.serviceFactory("getShortUrlVisitsForComparison",twe,"apiClientFactory"),e.serviceFactory("cancelGetShortUrlVisitsForComparison",r=>r.cancelGetVisits,"shortUrlVisitsComparisonReducerCreator"),e.serviceFactory("deleteShortUrlVisits",I2e,"apiClientFactory"),e.serviceFactory("getTagVisits",B2e,"apiClientFactory"),e.serviceFactory("cancelGetTagVisits",r=>r.cancelGetVisits,"tagVisitsReducerCreator"),e.serviceFactory("getTagVisitsForComparison",iwe,"apiClientFactory"),e.serviceFactory("cancelGetTagVisitsForComparison",r=>r.cancelGetVisits,"tagVisitsComparisonReducerCreator"),e.serviceFactory("getDomainVisits",_2e,"apiClientFactory"),e.serviceFactory("cancelGetDomainVisits",r=>r.cancelGetVisits,"domainVisitsReducerCreator"),e.serviceFactory("getDomainVisitsForComparison",Q2e,"apiClientFactory"),e.serviceFactory("cancelGetDomainVisitsForComparison",r=>r.cancelGetVisits,"domainVisitsComparisonReducerCreator"),e.serviceFactory("getOrphanVisits",M2e,"apiClientFactory"),e.serviceFactory("cancelGetOrphanVisits",r=>r.cancelGetVisits,"orphanVisitsReducerCreator"),e.serviceFactory("deleteOrphanVisits",L2e,"apiClientFactory"),e.serviceFactory("getNonOrphanVisits",E2e,"apiClientFactory"),e.serviceFactory("cancelGetNonOrphanVisits",r=>r.cancelGetVisits,"nonOrphanVisitsReducerCreator"),e.serviceFactory("createNewVisits",()=>Vf),e.serviceFactory("loadVisitsOverview",$2e,"apiClientFactory"),e.serviceFactory("visitsOverviewReducerCreator",V2e,"loadVisitsOverview"),e.serviceFactory("visitsOverviewReducer",r=>r.reducer,"visitsOverviewReducerCreator"),e.serviceFactory("domainVisitsReducerCreator",S2e,"getDomainVisits"),e.serviceFactory("domainVisitsReducer",r=>r.reducer,"domainVisitsReducerCreator"),e.serviceFactory("nonOrphanVisitsReducerCreator",A2e,"getNonOrphanVisits"),e.serviceFactory("nonOrphanVisitsReducer",r=>r.reducer,"nonOrphanVisitsReducerCreator"),e.serviceFactory("orphanVisitsReducerCreator",P2e,"getOrphanVisits","deleteOrphanVisits"),e.serviceFactory("orphanVisitsReducer",r=>r.reducer,"orphanVisitsReducerCreator"),e.serviceFactory("orphanVisitsDeletionReducerCreator",N2e,"deleteOrphanVisits"),e.serviceFactory("orphanVisitsDeletionReducer",r=>r.reducer,"orphanVisitsDeletionReducerCreator"),e.serviceFactory("shortUrlVisitsReducerCreator",k2e,"getShortUrlVisits","deleteShortUrlVisits"),e.serviceFactory("shortUrlVisitsReducer",r=>r.reducer,"shortUrlVisitsReducerCreator"),e.serviceFactory("shortUrlVisitsDeletionReducerCreator",z2e,"deleteShortUrlVisits"),e.serviceFactory("shortUrlVisitsDeletionReducer",r=>r.reducer,"shortUrlVisitsDeletionReducerCreator"),e.serviceFactory("tagVisitsReducerCreator",F2e,"getTagVisits"),e.serviceFactory("tagVisitsReducer",r=>r.reducer,"tagVisitsReducerCreator"),e.serviceFactory("tagVisitsComparisonReducerCreator",awe,"getTagVisitsForComparison"),e.serviceFactory("tagVisitsComparisonReducer",r=>r.reducer,"tagVisitsComparisonReducerCreator"),e.serviceFactory("domainVisitsComparisonReducerCreator",J2e,"getDomainVisitsForComparison"),e.serviceFactory("domainVisitsComparisonReducer",r=>r.reducer,"domainVisitsComparisonReducerCreator"),e.serviceFactory("shortUrlVisitsComparisonReducerCreator",nwe,"getShortUrlVisitsForComparison"),e.serviceFactory("shortUrlVisitsComparisonReducer",r=>r.reducer,"shortUrlVisitsComparisonReducerCreator")},uh=({children:e,to:t,active:n,...r})=>g.jsx(__,{...r,className:({isActive:i})=>Oe("flex items-center gap-2","no-underline rounded-none px-5 py-2.5",{"text-white bg-lm-main dark:bg-dm-main":i||n,"highlight:bg-lm-secondary highlight:dark:bg-dm-secondary":!i&&!n}),to:t,children:e}),uwe=({routePrefix:e,showOnMobile:t=!1})=>{const{pathname:n}=Or(),r=i=>`${e}${i}`;return g.jsx("aside",{className:Oe("w-(--aside-menu-width) bg-lm-primary dark:bg-dm-primary","pt-[15px] md:pt-[30px] pb-[10px]","fixed! bottom-0 top-(--header-height) z-890 transition-[left] duration-300","shadow-aside-menu-mobile md:shadow-aside-menu",{"left-0":t,"max-md:left-[calc(-1*(var(--aside-menu-width)+35px))]":!t}),children:g.jsxs("nav",{className:"flex flex-col h-full",children:[g.jsxs(uh,{to:r("/overview"),children:[g.jsx(Be,{icon:uH}),"Overview"]}),g.jsxs(uh,{to:r("/list-short-urls/1"),active:n.match("/list-short-urls")!==null,children:[g.jsx(Be,{icon:M_}),"List short URLs"]}),g.jsxs(uh,{to:r("/create-short-url"),children:[g.jsx(Be,{icon:iH,flip:"horizontal"}),"Create short URL"]}),g.jsxs(uh,{to:r("/manage-tags"),children:[g.jsx(Be,{icon:jN}),"Manage tags"]}),g.jsxs(uh,{to:r("/manage-domains"),children:[g.jsx(Be,{icon:bH}),"Manage domains"]})]})})},Bz=w.createContext(void 0),U3=()=>w.useContext(Bz),Fz=({children:e})=>{const t=U3(),{flag:n,toggle:r,setToTrue:i,setToFalse:o}=Cn(),l=t??{sidebarVisible:n,toggleSidebar:r,showSidebar:i,hideSidebar:o};return g.jsx(Bz.Provider,{value:l,children:e})},$z=({className:e,...t})=>{const n=U3();if(!n)throw new Error("ShlinkSidebarToggleButton has to be used inside a ShlinkSidebarVisibilityProvider");const{sidebarVisible:r,toggleSidebar:i}=n;return g.jsx(wf,{"aria-label":"Toggle sidebar",className:Oe("md:hidden transition-colors",{"text-white/50":!r,"text-white":r},e),onClick:i,...t,children:g.jsx(Be,{icon:MH,size:"xl"})})},Vz=({createNotFound:e,autoToggleButton:t})=>{const{TagsList:n,ShortUrlsList:r,CreateShortUrl:i,ShortUrlVisits:o,TagVisits:l,DomainVisits:c,OrphanVisits:f,NonOrphanVisits:h,Overview:m,EditShortUrl:y,ManageDomains:x,TagVisitsComparison:b,DomainVisitsComparison:C,ShortUrlVisitsComparison:_,ShortUrlRedirectRules:A}=An(Vz),O=Or(),P=ps(),{sidebarVisible:N,showSidebar:F,hideSidebar:U}=U3();w.useEffect(()=>U(),[O,U]);const W=axe(F,U);return g.jsxs(g.Fragment,{children:[t&&g.jsx($z,{className:"fixed top-4 left-3 z-1035"}),g.jsx("div",{...W,className:"h-full",children:g.jsxs("div",{className:"h-full",children:[g.jsx(uwe,{routePrefix:P,showOnMobile:N}),g.jsx("div",{className:"min-h-full pt-[20px] md:pt-[30px] md:pl-(--aside-menu-width)",onPointerDown:U,children:g.jsx("div",{className:"container mx-auto px-3",children:g.jsxs(sy,{children:[g.jsx(ft,{index:!0,element:g.jsx(b_,{replace:!0,to:"overview"})}),g.jsx(ft,{path:"/overview",element:g.jsx(m,{})}),g.jsx(ft,{path:"/list-short-urls/:page",element:g.jsx(r,{})}),g.jsx(ft,{path:"/create-short-url",element:g.jsx(i,{})}),g.jsx(ft,{path:"/short-code/:shortCode/visits",children:["","*"].map(X=>g.jsx(ft,{path:X,element:g.jsx(o,{})},X))}),g.jsx(ft,{path:"/short-code/:shortCode/edit",element:g.jsx(y,{})}),g.jsx(ft,{path:"/short-code/:shortCode/redirect-rules",element:g.jsx(A,{})}),g.jsx(ft,{path:"/short-urls/compare-visits",element:g.jsx(_,{})}),g.jsx(ft,{path:"/tag/:tag/visits",children:["","*"].map(X=>g.jsx(ft,{path:X,element:g.jsx(l,{})},X))}),g.jsx(ft,{path:"/tags/compare-visits",element:g.jsx(b,{})}),g.jsx(ft,{path:"/domain/:domain/visits",children:["","*"].map(X=>g.jsx(ft,{path:X,element:g.jsx(c,{})},X))}),g.jsx(ft,{path:"/orphan-visits",children:["","*"].map(X=>g.jsx(ft,{path:X,element:g.jsx(f,{})},X))}),g.jsx(ft,{path:"/non-orphan-visits",children:["","*"].map(X=>g.jsx(ft,{path:X,element:g.jsx(h,{})},X))}),g.jsx(ft,{path:"/manage-tags",element:g.jsx(n,{})}),g.jsx(ft,{path:"/manage-domains",element:g.jsx(x,{})}),g.jsx(ft,{path:"/domains/compare-visits",element:g.jsx(C,{})}),e&&g.jsx(ft,{path:"*",element:e("/list-short-urls/1")})]})})})]})})]})},cwe=Tn(Vz,["TagsList","ShortUrlsList","CreateShortUrl","ShortUrlVisits","TagVisits","DomainVisits","OrphanVisits","NonOrphanVisits","Overview","EditShortUrl","ManageDomains","TagVisitsComparison","DomainVisitsComparison","ShortUrlVisitsComparison","ShortUrlRedirectRules"]),fwe=e=>sS({devTools:!1,reducer:Ty({mercureInfo:e.mercureInfoReducer,shortUrlsList:e.shortUrlsListReducer,shortUrlCreation:e.shortUrlCreationReducer,shortUrlDeletion:e.shortUrlDeletionReducer,shortUrlEdition:e.shortUrlEditionReducer,shortUrlsDetails:e.shortUrlsDetailsReducer,shortUrlVisits:e.shortUrlVisitsReducer,shortUrlVisitsDeletion:e.shortUrlVisitsDeletionReducer,shortUrlVisitsComparison:e.shortUrlVisitsComparisonReducer,tagVisits:e.tagVisitsReducer,tagVisitsComparison:e.tagVisitsComparisonReducer,domainVisits:e.domainVisitsReducer,domainVisitsComparison:e.domainVisitsComparisonReducer,orphanVisits:e.orphanVisitsReducer,orphanVisitsDeletion:e.orphanVisitsDeletionReducer,nonOrphanVisits:e.nonOrphanVisitsReducer,tagsList:e.tagsListReducer,tagDelete:e.tagDeleteReducer,tagEdit:e.tagEditReducer,domainsList:e.domainsListReducer,visitsOverview:e.visitsOverviewReducer,shortUrlRedirectRules:e.shortUrlRedirectRulesReducer,shortUrlRedirectRulesSaving:e.setShortUrlRedirectRulesReducer}),middleware:t=>t({immutableCheck:!1,serializableCheck:!1})}),dwe=e=>{e.factory("Main",cwe),e.factory("store",fwe)},Ra=new _N,{container:hwe}=Ra,mwe=e=>t=>Object.fromEntries(e.map(n=>[n,t[n]])),pwe=(e,t)=>(...n)=>e[t](...n),gwe=(e,t)=>({...e,[t]:pwe(hwe,t)}),qf=(e,t=[])=>GL(e?mwe(e):null,t.reduce(gwe,{}));dwe(Ra);Vbe(Ra,qf);hxe(Ra,qf);lwe(Ra,qf);E0e(Ra);_0e(Ra,qf);D0e(Ra,qf);_xe(Ra);X1e(Ra,qf);let kL;const vwe=e=>({serverVersion:t,apiClient:n,settings:r,routesPrefix:i="",createNotFound:o,tagColorsStorage:l,autoSidebarToggle:c=!0})=>{const f=d0e(t),h=w.useRef(void 0),[m,y]=w.useState(),x=Ku(),b=w.useMemo(()=>x?w.Fragment:uN,[x]);return w.useEffect(()=>{kL=n,e.value("apiClientFactory",()=>kL),l&&e.value("TagColorsStorage",l);const{Main:C,store:_,loadMercureInfo:A,listTags:O,listDomains:P}=e.container;h.current=g.jsx(C,{createNotFound:o,autoToggleButton:c}),y(_),_.dispatch(A(r)),_.dispatch(O()),_.dispatch(P())},[n,c,o,r,l]),m?g.jsx(d_,{store:m,children:g.jsx(A6,{value:r??{},children:g.jsx(f0e,{value:f,children:g.jsx(Fz,{children:g.jsx(l0e,{value:i,children:g.jsx(b,{children:h.current})})})})})}):g.jsx(g.Fragment,{})},ywe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",bwe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",xwe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",wwe=()=>{delete X5.Icon.Default.prototype._getIconUrl,X5.Icon.Default.mergeOptions({iconRetinaUrl:bwe,iconUrl:ywe,shadowUrl:xwe})};wwe();const _we=vwe(Ra);function Hz(e){const t=n=>{const{ServerError:r,buildShlinkApiClient:i}=oa(t),o=Ef(),{selectServer:l,selectedServer:c}=Xu();return w.useEffect(()=>{o.serverId&&l({serverId:o.serverId,buildShlinkApiClient:i})},[i,o.serverId,l]),c?CV(c)?g.jsx(r,{}):g.jsx(e,{...n}):g.jsx(Nf,{children:g.jsx(Ko,{loading:!0})})};return t}const qz=Hz(w.memo(({settings:e})=>{const{buildShlinkApiClient:t,TagColorsStorage:n,ServerError:r}=oa(qz),{selectedServer:i}=Xu();if(!T_(i))return g.jsx(r,{});const o=`/server/${i.id}`;return g.jsxs(Fz,{children:[g.jsx($z,{className:"fixed top-3.5 left-3 z-901"}),g.jsx(_we,{serverVersion:i.version,apiClient:t(i),settings:e,routesPrefix:o,tagColorsStorage:n,createNotFound:l=>g.jsx(g6,{to:`${o}${l}`,children:"List short URLs"}),autoSidebarToggle:!1})]})})),Swe=Pa(qz,["buildShlinkApiClient","TagColorsStorage","ServerError"]),Cwe=(e,t)=>{e.constant("window",window),e.constant("console",console),e.constant("fetch",window.fetch.bind(window)),e.service("HttpClient",LQ,"fetch"),e.serviceFactory("ScrollToTop",()=>hJ),e.factory("MainHeader",dJ),e.serviceFactory("Home",()=>fJ),e.decorator("Home",hw),e.decorator("Home",t(["servers"],[])),e.factory("ShlinkWebComponentContainer",Swe),e.decorator("ShlinkWebComponentContainer",t(["settings"],["selectServer"])),e.serviceFactory("ShlinkVersionsContainer",()=>vJ),e.serviceFactory("ErrorHandler",()=>uJ)},Gz=()=>{const e=uo();return w.useCallback(()=>e(-1),[e])},Yz=({open:e,duplicatedServers:t,onClose:n,onConfirm:r})=>{const i=t.length>1;return g.jsxs(co,{size:"lg",title:`Duplicated server${i?"s":""}`,open:e,onClose:n,onConfirm:r,confirmText:`Save duplicate${i?"s":""}`,cancelText:i?"Ignore duplicates":"Discard",children:[g.jsx("p",{children:i?"The next servers already exist:":"There is already a server with:"}),g.jsx("ul",{className:"list-disc mt-4",children:t.map(({url:o,apiKey:l},c)=>i?g.jsxs("li",{children:[g.jsx("b",{children:o})," - ",g.jsx("b",{children:l})]},c):g.jsxs(w.Fragment,{children:[g.jsxs("li",{children:["URL: ",g.jsx("b",{children:o})]}),g.jsxs("li",{children:["API key: ",g.jsx("b",{children:l})]})]},c))}),g.jsxs("span",{children:[i?"Do you want to save duplicated servers":"Do you want to save this server","?"]})]})},Ewe=e=>w.useCallback(t=>{t.preventDefault(),e(t)},[e]),Wz=({onSubmit:e,initialValues:t,children:n,title:r})=>{const[i,o]=w.useState(t?.name??""),[l,c]=w.useState(t?.url??""),[f,h]=w.useState(t?.apiKey??""),{flag:m,toggle:y}=Cn(t?.forwardCredentials??!1),x=Ewe(()=>e({name:i,url:l,apiKey:f,forwardCredentials:m}));return g.jsxs("form",{name:"serverForm",onSubmit:x,children:[g.jsxs(Nt,{className:"mb-4",bodyClassName:"flex flex-col gap-y-3",title:r,children:[g.jsx(di,{label:"Name",value:i,onChange:b=>o(b.target.value),required:!0}),g.jsx(di,{label:"URL",type:"url",value:l,onChange:b=>c(b.target.value),required:!0}),g.jsx(rZ,{label:"API key",value:f,onChange:b=>h(b.target.value),required:!0}),g.jsx(HK,{summary:"Advanced options",children:g.jsxs("div",{className:"flex flex-col gap-0.5",children:[g.jsxs(Ma,{className:"flex items-center gap-x-1.5 cursor-pointer",children:[g.jsx(W_,{onChange:y,checked:m}),"Forward credentials to this server on every request."]}),g.jsxs("small",{className:"pl-5.5 text-gray-600 dark:text-gray-400 mt-0.5",children:['"',"Credentials",'"'," here means cookies, TLS client certificates, or authentication headers containing a username and password."]}),g.jsxs("small",{className:"pl-5.5 text-gray-600 dark:text-gray-400",children:[g.jsx("b",{children:"Important!"})," If you are not sure what this means, leave it unchecked. Enabling this option will make all requests fail for Shlink older than v4.5.0, as it requires the server to set a more strict value for ",g.jsx("code",{className:"whitespace-nowrap",children:"Access-Control-Allow-Origin"})," than ",g.jsx("code",{children:"*"}),"."]})]})})]}),g.jsx("div",{className:"flex items-center justify-end gap-x-2",children:n})]})},IL=4e3,zL=({variant:e})=>g.jsx("div",{className:"mt-4",children:g.jsxs(Gr,{variant:e,children:[e==="success"&&"Servers properly imported. You can now select one from the list :)",e==="error"&&"The servers could not be imported. Make sure the format is correct."]})}),Kz=({servers:e,createServers:t})=>{const{ImportServersBtn:n,useTimeoutToggle:r}=oa(Kz),i=uo(),o=Gz(),l=!!Object.keys(e).length,[c,f]=r({delay:IL}),[h,m]=r({delay:IL}),{flag:y,toggle:x}=Cn(),[b,C]=w.useState(),_=w.useCallback(O=>{const[P]=fv(e,[O]);t([P]),i(`/server/${P.id}`)},[t,i,e]),A=w.useCallback(O=>{C(O),Object.values(e).some(({url:N,apiKey:F})=>O.url===N&&O.apiKey===F)?x():_(O)},[_,e,x]);return g.jsxs(Nf,{children:[g.jsxs(Wz,{title:"Add new server",onSubmit:A,children:[!l&&g.jsx(n,{tooltipPlacement:"top",onImport:f,onError:m}),l&&g.jsx(Tt,{variant:"secondary",onClick:o,children:"Cancel"}),g.jsx(Tt,{type:"submit",children:"Create server"})]}),c&&g.jsx(zL,{variant:"success"}),h&&g.jsx(zL,{variant:"error"}),g.jsx(Yz,{open:y,duplicatedServers:b?[b]:[],onClose:o,onConfirm:()=>b&&_(b)})]})},Awe=Pa(Kz,["ImportServersBtn","useTimeoutToggle"]),Zz=({server:e,children:t})=>{const{DeleteServerModal:n}=oa(Zz),{flag:r,setToTrue:i,setToFalse:o}=Cn(),l=uo(),c=w.useCallback(f=>{o(),f&&l("/")},[o,l]);return g.jsxs(g.Fragment,{children:[g.jsx("button",{type:"button",className:"text-danger hover:underline",onClick:i,children:t}),g.jsx(n,{server:e,open:r,onClose:c})]})},Twe=Pa(Zz,["DeleteServerModal"]),Owe=({server:e,onClose:t,open:n,deleteServer:r})=>{const i=w.useCallback(o=>{o==="confirm"&&r(e)},[r,e]);return g.jsx(co,{open:n,title:"Remove server",variant:"danger",onClose:()=>t(!1),onConfirm:()=>t(!0),onClosed:i,confirmText:"Delete",children:g.jsxs("div",{className:"flex flex-col gap-y-4",children:[g.jsxs("p",{children:["Are you sure you want to remove ",g.jsx("b",{children:e?e.name:""}),"?"]}),g.jsx("p",{children:g.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."})})]})})},Xz=Hz(({editServer:e})=>{const{buildShlinkApiClient:t}=oa(Xz),{selectServer:n,selectedServer:r}=Xu(),i=Gz(),{reconnect:o}=Zu();if(!yh(r))return null;const l=c=>{e(r.id,c),o==="true"&&n({serverId:r.id,buildShlinkApiClient:t}),i()};return g.jsx(Nf,{children:g.jsxs(Wz,{title:g.jsxs(g.Fragment,{children:['Edit "',r.name,'"']}),initialValues:r,onSubmit:l,children:[g.jsx(Tt,{variant:"secondary",onClick:i,children:"Cancel"}),g.jsx(Tt,{type:"submit",children:"Save"})]})})}),jwe=Pa(Xz,["ServerError"]),Qz=({createServers:e,servers:t,children:n,onImport:r,onError:i=()=>{},tooltipPlacement:o="bottom",className:l=""})=>{const{ServersImporter:c}=oa(Qz),f=w.useRef(null),{anchor:h,tooltip:m}=os({placement:o}),[y,x]=w.useState([]),{flag:b,setToTrue:C,setToFalse:_}=Cn(),A=w.useRef(!1),O=w.useCallback(async({target:F})=>c.importServersFromFile(F.files?.[0]).then(U=>{const{duplicatedServers:W,newServers:X}=UQ(t,U);A.current=X.length>0,e(fv(t,X)),W.length>0?(x(W),C()):r?.()}).then(()=>{F.value=null}).catch(i),[e,i,r,t,c,C]),P=w.useCallback(()=>{e(fv(t,y)),_(),r?.()},[e,y,_,r,t]),N=w.useCallback(()=>{_(),A.current&&r?.()},[_,r]);return g.jsxs(g.Fragment,{children:[g.jsxs(Tt,{variant:"secondary",className:l,onClick:()=>f.current?.click(),...h,children:[g.jsx(Be,{icon:QV,widthAuto:!0})," ",n??"Import from file"]}),g.jsxs(ss,{...m,children:["You can create servers by importing a CSV file with ",g.jsx("b",{children:"name"}),", ",g.jsx("b",{children:"apiKey"})," and ",g.jsx("b",{children:"url"})," columns."]}),g.jsx("input",{type:"file",accept:".csv",className:"hidden","aria-hidden":!0,tabIndex:-1,ref:f,onChange:O,"data-testid":"csv-file-input"}),g.jsx(Yz,{open:b,duplicatedServers:y,onClose:N,onConfirm:P})]})},Mwe=Pa(Qz,["ServersImporter"]),Jz=({servers:e})=>{const{DeleteServerButton:t}=oa(Jz),{selectedServer:n}=Xu();return g.jsx(Nf,{children:g.jsxs("div",{className:"flex flex-col items-center gap-y-4 md:gap-y-8",children:[g.jsxs(Ko,{className:"w-full lg:w-[80%]",variant:"error",children:[!yh(n)&&"Could not find this Shlink server.",yh(n)&&g.jsxs(g.Fragment,{children:[g.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."]})]}),g.jsxs("p",{className:"text-xl",children:["These are the Shlink servers currently configured. Choose one of them or ",g.jsx(Ir,{to:"/server/create",children:"add a new one"}),"."]}),g.jsx(ln,{className:"w-full max-w-100 overflow-hidden",children:g.jsx(fD,{borderless:!0,servers:Object.values(e)})}),yh(n)&&g.jsxs("p",{className:"text-xl",children:["Alternatively, if you think you may have misconfigured this server, you can ",g.jsx(t,{server:n,children:"remove it"})," or ",g.jsx(Ir,{to:`/server/${n.id}/edit?reconnect=true`,children:"edit it"}),"."]})]})})},Pwe=Pa(Jz,["DeleteServerButton"]),Lwe=4e3,eU=({servers:e})=>{const{ServersExporter:t,ImportServersBtn:n,useTimeoutToggle:r,ManageServersRow:i}=oa(eU),[o,l]=w.useState(""),c=w.useMemo(()=>Object.values(e),[e]),f=w.useMemo(()=>c.filter(({name:x,url:b})=>`${x} ${b}`.toLowerCase().match(o.toLowerCase())),[c,o]),h=c.some(({autoConnect:x})=>!!x),[m,y]=r({delay:Lwe});return g.jsxs(Nf,{className:"flex flex-col gap-y-4",children:[g.jsx(Mf,{onChange:l}),g.jsxs("div",{className:"flex flex-col md:flex-row gap-2",children:[g.jsxs("div",{className:"flex gap-2",children:[g.jsx(n,{className:"flex-grow",onError:y,children:"Import servers"}),f.length>0&&g.jsxs(Tt,{variant:"secondary",className:"flex-grow",onClick:async()=>t.exportServers(),children:[g.jsx(Be,{icon:AN,widthAuto:!0})," Export servers"]})]}),g.jsxs(Tt,{className:"md:ml-auto",to:"/server/create",children:[g.jsx(Be,{icon:Zh,widthAuto:!0})," Add a server"]})]}),g.jsx(Nt,{className:"card",children:g.jsxs($e,{header:g.jsxs($e.Row,{children:[h&&g.jsx($e.Cell,{className:"w-[35px]",children:g.jsx("span",{className:"sr-only",children:"Auto-connect"})}),g.jsx($e.Cell,{children:"Name"}),g.jsx($e.Cell,{children:"Base URL"}),g.jsx($e.Cell,{children:g.jsx("span",{className:"sr-only",children:"Options"})})]}),children:[!f.length&&g.jsx($e.Row,{className:"text-center",children:g.jsx($e.Cell,{colSpan:4,children:"No servers found."})}),f.map(x=>g.jsx(i,{server:x,hasAutoConnect:h},x.id))]})}),m&&g.jsx("div",{children:g.jsx(Gr,{variant:"error",children:"The servers could not be imported. Make sure the format is correct."})})]})},Nwe=Pa(eU,["ServersExporter","ImportServersBtn","useTimeoutToggle","ManageServersRow"]),tU=({server:e,hasAutoConnect:t})=>{const{ManageServersRowDropdown:n}=oa(tU),{anchor:r,tooltip:i}=os();return g.jsxs($e.Row,{className:"relative",children:[t&&g.jsx($e.Cell,{columnName:"Auto-connect",children:e.autoConnect&&g.jsxs(g.Fragment,{children:[g.jsx(Be,{icon:Ru,className:"text-lm-brand dark:text-dm-brand",...r}),g.jsx(ss,{...i,children:"Auto-connect to this server"})]})}),g.jsx($e.Cell,{className:"font-bold",columnName:"Name",children:g.jsx(Ir,{to:`/server/${e.id}`,children:e.name})}),g.jsx($e.Cell,{columnName:"Base URL",className:"max-lg:border-b-0",children:e.url}),g.jsx($e.Cell,{className:"text-right max-lg:absolute right-0 -top-1 mx-lg:pt-0",children:g.jsx(n,{server:e})})]})},Rwe=Pa(tU,["ManageServersRowDropdown"]),nU=({server:e,setAutoConnect:t})=>{const{DeleteServerModal:n}=oa(nU),{flag:r,setToTrue:i,setToFalse:o}=Cn(),l=`/server/${e.id}`,{autoConnect:c}=e,f=c?HV:FK;return g.jsxs(g.Fragment,{children:[g.jsxs(tn,{menuAlignment:"right",children:[g.jsxs(tn.Item,{to:l,className:"gap-1.5",children:[g.jsx(Be,{icon:hH})," Connect"]}),g.jsxs(tn.Item,{to:`${l}/edit`,className:"gap-1.5",children:[g.jsx(Be,{icon:j_})," Edit server"]}),g.jsxs(tn.Item,{onClick:()=>t(e,!c),className:"gap-1.5",children:[g.jsx(Be,{icon:f})," ",c?"Do not a":"A","uto-connect"]}),g.jsx(tn.Separator,{}),g.jsxs(tn.Item,{className:"[&]:text-danger gap-1.5",onClick:i,children:[g.jsx(Be,{icon:LN})," Remove server"]})]}),g.jsx(n,{server:e,open:r,onClose:o})]})},Dwe=Pa(nU,["DeleteServerModal"]),kwe=e=>fv({},Array.isArray(e)?e.filter(SN):[]),Iwe=e=>oD("shlink/remoteServers/fetchServers",async(t,{dispatch:n})=>{const r=await e.jsonRequest(`${Gg.homepage}/servers.json`),i=kwe(r);n(iD(i))}),zwe=({servers:e})=>{const t=Object.values(e),{selectedServer:n}=Xu();return g.jsx(J2.Dropdown,{buttonContent:g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx(Be,{icon:sT})," Servers"]}),children:t.length===0?g.jsxs(qe.Item,{to:"/server/create",children:[g.jsx(Be,{icon:Zh})," Add a server"]}):g.jsxs(g.Fragment,{children:[t.map(({name:r,id:i})=>g.jsx(qe.Item,{to:`/server/${i}`,selected:EV(n)===i,children:r},i)),g.jsx(qe.Separator,{}),g.jsxs(qe.Item,{to:"/manage-servers",children:[g.jsx(Be,{icon:sT})," Manage servers"]})]})})},Uwe=({document:e},t,n)=>{const r=e.createElement("a");r.setAttribute("href",t),r.setAttribute("download",n),r.style.visibility="hidden",e.body.appendChild(r),r.click(),e.body.removeChild(r)},Bwe=(e,t,n)=>{const r=new Blob([t],{type:"text/csv;charset=utf-8;"}),i=URL.createObjectURL(r);Uwe(e,i,n)},Fwe="shlink-servers.csv";class $we{#t;#r;#n;constructor(t,n,r){this.#t=t,this.#r=n,this.#n=r}exportServers=async()=>{const t=Object.values(this.#t.get("servers")??{}).map(AV);try{const n=this.#n(t);Bwe(this.#r,n,Fwe)}catch(n){console.error(n)}}}const Vwe=e=>{if(!Array.isArray(e))throw new Error("Provided file does not have the right format.");return e.map(OV)};class Hwe{#t;constructor(t){this.#t=t}async importServersFromFile(t){if(!t)throw new Error("No file provided");const n=await t.text(),r=await this.#t(n);return Vwe(r)}}const qwe=(e,t)=>{e.factory("ManageServers",Nwe),e.decorator("ManageServers",hw),e.decorator("ManageServers",t(["servers"],[])),e.factory("ManageServersRow",Rwe),e.factory("ManageServersRowDropdown",Dwe),e.decorator("ManageServersRowDropdown",t(null,["setAutoConnect"])),e.factory("CreateServer",Awe),e.decorator("CreateServer",hw),e.decorator("CreateServer",t(["servers"],["createServers"])),e.factory("EditServer",jwe),e.decorator("EditServer",t([],["editServer","selectServer"])),e.serviceFactory("ServersDropdown",()=>zwe),e.decorator("ServersDropdown",t(["servers"])),e.serviceFactory("DeleteServerModal",()=>Owe),e.decorator("DeleteServerModal",t(null,["deleteServer"])),e.factory("DeleteServerButton",Twe),e.factory("ImportServersBtn",Mwe),e.decorator("ImportServersBtn",t(["servers"],["createServers"])),e.factory("ServerError",Pwe),e.decorator("ServerError",t(["servers"])),e.service("ServersImporter",Hwe,"csvToJson"),e.service("ServersExporter",$we,"Storage","window","jsonToCsv"),e.serviceFactory("selectServer",()=>dS,"buildShlinkApiClient","loadMercureInfo"),e.serviceFactory("createServers",()=>iD),e.serviceFactory("deleteServer",()=>HQ),e.serviceFactory("editServer",()=>VQ),e.serviceFactory("setAutoConnect",()=>qQ),e.serviceFactory("fetchServers",Iwe,"HttpClient")};var M2,UL;function Gwe(){return UL||(UL=1,M2=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(r,i,o){n.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:o})},n.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,i){if(1&i&&(r=n(r)),8&i||4&i&&typeof r=="object"&&r&&r.__esModule)return r;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:r}),2&i&&typeof r!="string")for(var l in r)n.d(o,l,(function(c){return r[c]}).bind(null,l));return o},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=31)}([function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch{typeof window=="object"&&(n=window)}e.exports=n},function(e,t,n){var r=n(6),i=Object.keys||function(C){var _=[];for(var A in C)_.push(A);return _};e.exports=y;var o=Object.create(n(4));o.inherits=n(2);var l=n(22),c=n(13);o.inherits(y,l);for(var f=i(c.prototype),h=0;h=c())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+c().toString(16)+" bytes");return 0|D}function _(D,R){if(h.isBuffer(D))return D.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(D)||D instanceof ArrayBuffer))return D.byteLength;typeof D!="string"&&(D=""+D);var G=D.length;if(G===0)return 0;for(var te=!1;;)switch(R){case"ascii":case"latin1":case"binary":return G;case"utf8":case"utf-8":case void 0:return pe(D).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*G;case"hex":return G>>>1;case"base64":return he(D).length;default:if(te)return pe(D).length;R=(""+R).toLowerCase(),te=!0}}function A(D,R,G){var te=D[R];D[R]=D[G],D[G]=te}function O(D,R,G,te,V){if(D.length===0)return-1;if(typeof G=="string"?(te=G,G=0):G>2147483647?G=2147483647:G<-2147483648&&(G=-2147483648),G=+G,isNaN(G)&&(G=V?0:D.length-1),G<0&&(G=D.length+G),G>=D.length){if(V)return-1;G=D.length-1}else if(G<0){if(!V)return-1;G=0}if(typeof R=="string"&&(R=h.from(R,te)),h.isBuffer(R))return R.length===0?-1:P(D,R,G,te,V);if(typeof R=="number")return R&=255,h.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?V?Uint8Array.prototype.indexOf.call(D,R,G):Uint8Array.prototype.lastIndexOf.call(D,R,G):P(D,[R],G,te,V);throw new TypeError("val must be string, number or Buffer")}function P(D,R,G,te,V){var Z,ne=1,me=D.length,ie=R.length;if(te!==void 0&&((te=String(te).toLowerCase())==="ucs2"||te==="ucs-2"||te==="utf16le"||te==="utf-16le")){if(D.length<2||R.length<2)return-1;ne=2,me/=2,ie/=2,G/=2}function xe(ke,Ve){return ne===1?ke[Ve]:ke.readUInt16BE(Ve*ne)}if(V){var Ee=-1;for(Z=G;Zme&&(G=me-ie),Z=G;Z>=0;Z--){for(var Me=!0,Ue=0;UeV&&(te=V):te=V;var Z=R.length;if(Z%2!=0)throw new TypeError("Invalid hex string");te>Z/2&&(te=Z/2);for(var ne=0;ne>8,ie=ne%256,xe.push(ie),xe.push(me);return xe}(R,D.length-G),D,G,te)}function ce(D,R,G){return R===0&&G===D.length?i.fromByteArray(D):i.fromByteArray(D.slice(R,G))}function re(D,R,G){G=Math.min(D.length,G);for(var te=[],V=R;V239?4:xe>223?3:xe>191?2:1;if(V+Me<=G)switch(Me){case 1:xe<128&&(Ee=xe);break;case 2:(192&(Z=D[V+1]))==128&&(ie=(31&xe)<<6|63&Z)>127&&(Ee=ie);break;case 3:Z=D[V+1],ne=D[V+2],(192&Z)==128&&(192&ne)==128&&(ie=(15&xe)<<12|(63&Z)<<6|63&ne)>2047&&(ie<55296||ie>57343)&&(Ee=ie);break;case 4:Z=D[V+1],ne=D[V+2],me=D[V+3],(192&Z)==128&&(192&ne)==128&&(192&me)==128&&(ie=(15&xe)<<18|(63&Z)<<12|(63&ne)<<6|63&me)>65535&&ie<1114112&&(Ee=ie)}Ee===null?(Ee=65533,Me=1):Ee>65535&&(Ee-=65536,te.push(Ee>>>10&1023|55296),Ee=56320|1023&Ee),te.push(Ee),V+=Me}return function(Ue){var ke=Ue.length;if(ke<=J)return String.fromCharCode.apply(String,Ue);for(var Ve="",ot=0;otthis.length||((te===void 0||te>this.length)&&(te=this.length),te<=0)||(te>>>=0)<=(G>>>=0))return"";for(R||(R="utf8");;)switch(R){case"hex":return se(this,G,te);case"utf8":case"utf-8":return re(this,G,te);case"ascii":return oe(this,G,te);case"latin1":case"binary":return we(this,G,te);case"base64":return ce(this,G,te);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ue(this,G,te);default:if(V)throw new TypeError("Unknown encoding: "+R);R=(R+"").toLowerCase(),V=!0}}).apply(this,arguments)},h.prototype.equals=function(D){if(!h.isBuffer(D))throw new TypeError("Argument must be a Buffer");return this===D||h.compare(this,D)===0},h.prototype.inspect=function(){var D="",R=t.INSPECT_MAX_BYTES;return this.length>0&&(D=this.toString("hex",0,R).match(/.{2}/g).join(" "),this.length>R&&(D+=" ... ")),""},h.prototype.compare=function(D,R,G,te,V){if(!h.isBuffer(D))throw new TypeError("Argument must be a Buffer");if(R===void 0&&(R=0),G===void 0&&(G=D?D.length:0),te===void 0&&(te=0),V===void 0&&(V=this.length),R<0||G>D.length||te<0||V>this.length)throw new RangeError("out of range index");if(te>=V&&R>=G)return 0;if(te>=V)return-1;if(R>=G)return 1;if(this===D)return 0;for(var Z=(V>>>=0)-(te>>>=0),ne=(G>>>=0)-(R>>>=0),me=Math.min(Z,ne),ie=this.slice(te,V),xe=D.slice(R,G),Ee=0;EeV)&&(G=V),D.length>0&&(G<0||R<0)||R>this.length)throw new RangeError("Attempt to write outside buffer bounds");te||(te="utf8");for(var Z=!1;;)switch(te){case"hex":return N(this,D,R,G);case"utf8":case"utf-8":return F(this,D,R,G);case"ascii":return U(this,D,R,G);case"latin1":case"binary":return W(this,D,R,G);case"base64":return X(this,D,R,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ae(this,D,R,G);default:if(Z)throw new TypeError("Unknown encoding: "+te);te=(""+te).toLowerCase(),Z=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var J=4096;function oe(D,R,G){var te="";G=Math.min(D.length,G);for(var V=R;Vte)&&(G=te);for(var V="",Z=R;ZG)throw new RangeError("Trying to access beyond buffer length")}function k(D,R,G,te,V,Z){if(!h.isBuffer(D))throw new TypeError('"buffer" argument must be a Buffer instance');if(R>V||RD.length)throw new RangeError("Index out of range")}function z(D,R,G,te){R<0&&(R=65535+R+1);for(var V=0,Z=Math.min(D.length-G,2);V>>8*(te?V:1-V)}function H(D,R,G,te){R<0&&(R=4294967295+R+1);for(var V=0,Z=Math.min(D.length-G,4);V>>8*(te?V:3-V)&255}function I(D,R,G,te,V,Z){if(G+te>D.length)throw new RangeError("Index out of range");if(G<0)throw new RangeError("Index out of range")}function j(D,R,G,te,V){return V||I(D,0,G,4),o.write(D,R,G,te,23,4),G+4}function q(D,R,G,te,V){return V||I(D,0,G,8),o.write(D,R,G,te,52,8),G+8}h.prototype.slice=function(D,R){var G,te=this.length;if((D=~~D)<0?(D+=te)<0&&(D=0):D>te&&(D=te),(R=R===void 0?te:~~R)<0?(R+=te)<0&&(R=0):R>te&&(R=te),R0&&(V*=256);)te+=this[D+--R]*V;return te},h.prototype.readUInt8=function(D,R){return R||Y(D,1,this.length),this[D]},h.prototype.readUInt16LE=function(D,R){return R||Y(D,2,this.length),this[D]|this[D+1]<<8},h.prototype.readUInt16BE=function(D,R){return R||Y(D,2,this.length),this[D]<<8|this[D+1]},h.prototype.readUInt32LE=function(D,R){return R||Y(D,4,this.length),(this[D]|this[D+1]<<8|this[D+2]<<16)+16777216*this[D+3]},h.prototype.readUInt32BE=function(D,R){return R||Y(D,4,this.length),16777216*this[D]+(this[D+1]<<16|this[D+2]<<8|this[D+3])},h.prototype.readIntLE=function(D,R,G){D|=0,R|=0,G||Y(D,R,this.length);for(var te=this[D],V=1,Z=0;++Z=(V*=128)&&(te-=Math.pow(2,8*R)),te},h.prototype.readIntBE=function(D,R,G){D|=0,R|=0,G||Y(D,R,this.length);for(var te=R,V=1,Z=this[D+--te];te>0&&(V*=256);)Z+=this[D+--te]*V;return Z>=(V*=128)&&(Z-=Math.pow(2,8*R)),Z},h.prototype.readInt8=function(D,R){return R||Y(D,1,this.length),128&this[D]?-1*(255-this[D]+1):this[D]},h.prototype.readInt16LE=function(D,R){R||Y(D,2,this.length);var G=this[D]|this[D+1]<<8;return 32768&G?4294901760|G:G},h.prototype.readInt16BE=function(D,R){R||Y(D,2,this.length);var G=this[D+1]|this[D]<<8;return 32768&G?4294901760|G:G},h.prototype.readInt32LE=function(D,R){return R||Y(D,4,this.length),this[D]|this[D+1]<<8|this[D+2]<<16|this[D+3]<<24},h.prototype.readInt32BE=function(D,R){return R||Y(D,4,this.length),this[D]<<24|this[D+1]<<16|this[D+2]<<8|this[D+3]},h.prototype.readFloatLE=function(D,R){return R||Y(D,4,this.length),o.read(this,D,!0,23,4)},h.prototype.readFloatBE=function(D,R){return R||Y(D,4,this.length),o.read(this,D,!1,23,4)},h.prototype.readDoubleLE=function(D,R){return R||Y(D,8,this.length),o.read(this,D,!0,52,8)},h.prototype.readDoubleBE=function(D,R){return R||Y(D,8,this.length),o.read(this,D,!1,52,8)},h.prototype.writeUIntLE=function(D,R,G,te){D=+D,R|=0,G|=0,te||k(this,D,R,G,Math.pow(2,8*G)-1,0);var V=1,Z=0;for(this[R]=255&D;++Z=0&&(Z*=256);)this[R+V]=D/Z&255;return R+G},h.prototype.writeUInt8=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,1,255,0),h.TYPED_ARRAY_SUPPORT||(D=Math.floor(D)),this[R]=255&D,R+1},h.prototype.writeUInt16LE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[R]=255&D,this[R+1]=D>>>8):z(this,D,R,!0),R+2},h.prototype.writeUInt16BE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[R]=D>>>8,this[R+1]=255&D):z(this,D,R,!1),R+2},h.prototype.writeUInt32LE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[R+3]=D>>>24,this[R+2]=D>>>16,this[R+1]=D>>>8,this[R]=255&D):H(this,D,R,!0),R+4},h.prototype.writeUInt32BE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[R]=D>>>24,this[R+1]=D>>>16,this[R+2]=D>>>8,this[R+3]=255&D):H(this,D,R,!1),R+4},h.prototype.writeIntLE=function(D,R,G,te){if(D=+D,R|=0,!te){var V=Math.pow(2,8*G-1);k(this,D,R,G,V-1,-V)}var Z=0,ne=1,me=0;for(this[R]=255&D;++Z>0)-me&255;return R+G},h.prototype.writeIntBE=function(D,R,G,te){if(D=+D,R|=0,!te){var V=Math.pow(2,8*G-1);k(this,D,R,G,V-1,-V)}var Z=G-1,ne=1,me=0;for(this[R+Z]=255&D;--Z>=0&&(ne*=256);)D<0&&me===0&&this[R+Z+1]!==0&&(me=1),this[R+Z]=(D/ne>>0)-me&255;return R+G},h.prototype.writeInt8=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,1,127,-128),h.TYPED_ARRAY_SUPPORT||(D=Math.floor(D)),D<0&&(D=255+D+1),this[R]=255&D,R+1},h.prototype.writeInt16LE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[R]=255&D,this[R+1]=D>>>8):z(this,D,R,!0),R+2},h.prototype.writeInt16BE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[R]=D>>>8,this[R+1]=255&D):z(this,D,R,!1),R+2},h.prototype.writeInt32LE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[R]=255&D,this[R+1]=D>>>8,this[R+2]=D>>>16,this[R+3]=D>>>24):H(this,D,R,!0),R+4},h.prototype.writeInt32BE=function(D,R,G){return D=+D,R|=0,G||k(this,D,R,4,2147483647,-2147483648),D<0&&(D=4294967295+D+1),h.TYPED_ARRAY_SUPPORT?(this[R]=D>>>24,this[R+1]=D>>>16,this[R+2]=D>>>8,this[R+3]=255&D):H(this,D,R,!1),R+4},h.prototype.writeFloatLE=function(D,R,G){return j(this,D,R,!0,G)},h.prototype.writeFloatBE=function(D,R,G){return j(this,D,R,!1,G)},h.prototype.writeDoubleLE=function(D,R,G){return q(this,D,R,!0,G)},h.prototype.writeDoubleBE=function(D,R,G){return q(this,D,R,!1,G)},h.prototype.copy=function(D,R,G,te){if(G||(G=0),te||te===0||(te=this.length),R>=D.length&&(R=D.length),R||(R=0),te>0&&te=this.length)throw new RangeError("sourceStart out of bounds");if(te<0)throw new RangeError("sourceEnd out of bounds");te>this.length&&(te=this.length),D.length-R=0;--V)D[V+R]=this[V+G];else if(Z<1e3||!h.TYPED_ARRAY_SUPPORT)for(V=0;V>>=0,G=G===void 0?this.length:G>>>0,D||(D=0),typeof D=="number")for(Z=R;Z55295&&G<57344){if(!V){if(G>56319){(R-=3)>-1&&Z.push(239,191,189);continue}if(ne+1===te){(R-=3)>-1&&Z.push(239,191,189);continue}V=G;continue}if(G<56320){(R-=3)>-1&&Z.push(239,191,189),V=G;continue}G=65536+(V-55296<<10|G-56320)}else V&&(R-=3)>-1&&Z.push(239,191,189);if(V=null,G<128){if((R-=1)<0)break;Z.push(G)}else if(G<2048){if((R-=2)<0)break;Z.push(G>>6|192,63&G|128)}else if(G<65536){if((R-=3)<0)break;Z.push(G>>12|224,G>>6&63|128,63&G|128)}else{if(!(G<1114112))throw new Error("Invalid code point");if((R-=4)<0)break;Z.push(G>>18|240,G>>12&63|128,G>>6&63|128,63&G|128)}}return Z}function he(D){return i.toByteArray(function(R){if((R=function(G){return G.trim?G.trim():G.replace(/^\s+|\s+$/g,"")}(R).replace(ee,"")).length<2)return"";for(;R.length%4!=0;)R+="=";return R}(D))}function ve(D,R,G,te){for(var V=0;V=R.length||V>=D.length);++V)R[V+G]=D[V];return V}}).call(this,n(0))},function(e,t,n){function r(i){return Object.prototype.toString.call(i)}t.isArray=function(i){return Array.isArray?Array.isArray(i):r(i)==="[object Array]"},t.isBoolean=function(i){return typeof i=="boolean"},t.isNull=function(i){return i===null},t.isNullOrUndefined=function(i){return i==null},t.isNumber=function(i){return typeof i=="number"},t.isString=function(i){return typeof i=="string"},t.isSymbol=function(i){return typeof i=="symbol"},t.isUndefined=function(i){return i===void 0},t.isRegExp=function(i){return r(i)==="[object RegExp]"},t.isObject=function(i){return typeof i=="object"&&i!==null},t.isDate=function(i){return r(i)==="[object Date]"},t.isError=function(i){return r(i)==="[object Error]"||i instanceof Error},t.isFunction=function(i){return typeof i=="function"},t.isPrimitive=function(i){return i===null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||typeof i=="symbol"||i===void 0},t.isBuffer=n(3).Buffer.isBuffer},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function c(A){if(n===setTimeout)return setTimeout(A,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(A,0);try{return n(A,0)}catch{try{return n.call(null,A,0)}catch{return n.call(this,A,0)}}}(function(){try{n=typeof setTimeout=="function"?setTimeout:o}catch{n=o}try{r=typeof clearTimeout=="function"?clearTimeout:l}catch{r=l}})();var f,h=[],m=!1,y=-1;function x(){m&&f&&(m=!1,f.length?h=f.concat(h):y=-1,h.length&&b())}function b(){if(!m){var A=c(x);m=!0;for(var O=h.length;O;){for(f=h,h=[];++y1)for(var P=1;P0&&X.length>U&&!X.warned){X.warned=!0;var ae=new Error("Possible EventEmitter memory leak detected. "+X.length+" "+String(P)+" listeners added. Use emitter.setMaxListeners() to increase limit");ae.name="MaxListenersExceededWarning",ae.emitter=O,ae.type=P,ae.count=X.length,function(ce){console&&console.warn&&console.warn(ce)}(ae)}return O}function x(O,P,N){var F={fired:!1,wrapFn:void 0,target:O,type:P,listener:N},U=(function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}).bind(F);return U.listener=N,F.wrapFn=U,U}function b(O,P,N){var F=O._events;if(F===void 0)return[];var U=F[P];return U===void 0?[]:typeof U=="function"?N?[U.listener||U]:[U]:N?function(W){for(var X=new Array(W.length),ae=0;ae0&&(W=P[0]),W instanceof Error)throw W;var X=new Error("Unhandled error."+(W?" ("+W.message+")":""));throw X.context=W,X}var ae=U[O];if(ae===void 0)return!1;if(typeof ae=="function")o(ae,this,P);else{var ce=ae.length,re=_(ae,ce);for(N=0;N=0;W--)if(N[W]===P||N[W].listener===P){X=N[W].listener,U=W;break}if(U<0)return this;U===0?N.shift():function(ae,ce){for(;ce+1=0;F--)this.removeListener(O,P[F]);return this},c.prototype.listeners=function(O){return b(this,O,!0)},c.prototype.rawListeners=function(O){return b(this,O,!1)},c.listenerCount=function(O,P){return typeof O.listenerCount=="function"?O.listenerCount(P):C.call(O,P)},c.prototype.listenerCount=C,c.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){(t=e.exports=n(22)).Stream=t,t.Readable=t,t.Writable=n(13),t.Duplex=n(1),t.Transform=n(26),t.PassThrough=n(45)},function(e,t,n){var r=n(3),i=r.Buffer;function o(c,f){for(var h in c)f[h]=c[h]}function l(c,f,h){return i(c,f,h)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=l),o(i,l),l.from=function(c,f,h){if(typeof c=="number")throw new TypeError("Argument must not be a number");return i(c,f,h)},l.alloc=function(c,f,h){if(typeof c!="number")throw new TypeError("Argument must be a number");var m=i(c);return f!==void 0?typeof h=="string"?m.fill(f,h):m.fill(f):m.fill(0),m},l.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return i(c)},l.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(c)}},function(e,t,n){(function(r,i,o){var l=n(6);function c(re){var J=this;this.next=null,this.entry=null,this.finish=function(){(function(oe,we,se){var ue=oe.entry;for(oe.entry=null;ue;){var Y=ue.callback;we.pendingcb--,Y(void 0),ue=ue.next}we.corkedRequestsFree.next=oe})(J,re)}}e.exports=N;var f,h=!r.browser&&["v0.10","v0.9."].indexOf(r.version.slice(0,5))>-1?i:l.nextTick;N.WritableState=P;var m=Object.create(n(4));m.inherits=n(2);var y,x={deprecate:n(43)},b=n(23),C=n(12).Buffer,_=(o!==void 0?o:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},A=n(24);function O(){}function P(re,J){f=f||n(1),re=re||{};var oe=J instanceof f;this.objectMode=!!re.objectMode,oe&&(this.objectMode=this.objectMode||!!re.writableObjectMode);var we=re.highWaterMark,se=re.writableHighWaterMark,ue=this.objectMode?16:16384;this.highWaterMark=we||we===0?we:oe&&(se||se===0)?se:ue,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Y=re.decodeStrings===!1;this.decodeStrings=!Y,this.defaultEncoding=re.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(k){(function(z,H){var I=z._writableState,j=I.sync,q=I.writecb;if(function(le){le.writing=!1,le.writecb=null,le.length-=le.writelen,le.writelen=0}(I),H)(function(le,pe,he,ve,D){--pe.pendingcb,he?(l.nextTick(D,ve),l.nextTick(ce,le,pe),le._writableState.errorEmitted=!0,le.emit("error",ve)):(D(ve),le._writableState.errorEmitted=!0,le.emit("error",ve),ce(le,pe))})(z,I,j,H,q);else{var ee=X(I);ee||I.corked||I.bufferProcessing||!I.bufferedRequest||W(z,I),j?h(U,z,I,ee,q):U(z,I,ee,q)}})(J,k)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new c(this)}function N(re){if(f=f||n(1),!(y.call(N,this)||this instanceof f))return new N(re);this._writableState=new P(re,this),this.writable=!0,re&&(typeof re.write=="function"&&(this._write=re.write),typeof re.writev=="function"&&(this._writev=re.writev),typeof re.destroy=="function"&&(this._destroy=re.destroy),typeof re.final=="function"&&(this._final=re.final)),b.call(this)}function F(re,J,oe,we,se,ue,Y){J.writelen=we,J.writecb=Y,J.writing=!0,J.sync=!0,oe?re._writev(se,J.onwrite):re._write(se,ue,J.onwrite),J.sync=!1}function U(re,J,oe,we){oe||function(se,ue){ue.length===0&&ue.needDrain&&(ue.needDrain=!1,se.emit("drain"))}(re,J),J.pendingcb--,we(),ce(re,J)}function W(re,J){J.bufferProcessing=!0;var oe=J.bufferedRequest;if(re._writev&&oe&&oe.next){var we=J.bufferedRequestCount,se=new Array(we),ue=J.corkedRequestsFree;ue.entry=oe;for(var Y=0,k=!0;oe;)se[Y]=oe,oe.isBuf||(k=!1),oe=oe.next,Y+=1;se.allBuffers=k,F(re,J,!0,J.length,se,"",ue.finish),J.pendingcb++,J.lastBufferedRequest=null,ue.next?(J.corkedRequestsFree=ue.next,ue.next=null):J.corkedRequestsFree=new c(J),J.bufferedRequestCount=0}else{for(;oe;){var z=oe.chunk,H=oe.encoding,I=oe.callback;if(F(re,J,!1,J.objectMode?1:z.length,z,H,I),oe=oe.next,J.bufferedRequestCount--,J.writing)break}oe===null&&(J.lastBufferedRequest=null)}J.bufferedRequest=oe,J.bufferProcessing=!1}function X(re){return re.ending&&re.length===0&&re.bufferedRequest===null&&!re.finished&&!re.writing}function ae(re,J){re._final(function(oe){J.pendingcb--,oe&&re.emit("error",oe),J.prefinished=!0,re.emit("prefinish"),ce(re,J)})}function ce(re,J){var oe=X(J);return oe&&(function(we,se){se.prefinished||se.finalCalled||(typeof we._final=="function"?(se.pendingcb++,se.finalCalled=!0,l.nextTick(ae,we,se)):(se.prefinished=!0,we.emit("prefinish")))}(re,J),J.pendingcb===0&&(J.finished=!0,re.emit("finish"))),oe}m.inherits(N,b),P.prototype.getBuffer=function(){for(var re=this.bufferedRequest,J=[];re;)J.push(re),re=re.next;return J},function(){try{Object.defineProperty(P.prototype,"buffer",{get:x.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(y=Function.prototype[Symbol.hasInstance],Object.defineProperty(N,Symbol.hasInstance,{value:function(re){return!!y.call(this,re)||this===N&&re&&re._writableState instanceof P}})):y=function(re){return re instanceof this},N.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},N.prototype.write=function(re,J,oe){var we=this._writableState,se=!1,ue=!we.objectMode&&function(Y){return C.isBuffer(Y)||Y instanceof _}(re);return ue&&!C.isBuffer(re)&&(re=function(Y){return C.from(Y)}(re)),typeof J=="function"&&(oe=J,J=null),ue?J="buffer":J||(J=we.defaultEncoding),typeof oe!="function"&&(oe=O),we.ended?function(Y,k){var z=new Error("write after end");Y.emit("error",z),l.nextTick(k,z)}(this,oe):(ue||function(Y,k,z,H){var I=!0,j=!1;return z===null?j=new TypeError("May not write null values to stream"):typeof z=="string"||z===void 0||k.objectMode||(j=new TypeError("Invalid non-string/buffer chunk")),j&&(Y.emit("error",j),l.nextTick(H,j),I=!1),I}(this,we,re,oe))&&(we.pendingcb++,se=function(Y,k,z,H,I,j){if(!z){var q=function(he,ve,D){return he.objectMode||he.decodeStrings===!1||typeof ve!="string"||(ve=C.from(ve,D)),ve}(k,H,I);H!==q&&(z=!0,I="buffer",H=q)}var ee=k.objectMode?1:H.length;k.length+=ee;var le=k.length-1))throw new TypeError("Unknown encoding: "+re);return this._writableState.defaultEncoding=re,this},Object.defineProperty(N.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),N.prototype._write=function(re,J,oe){oe(new Error("_write() is not implemented"))},N.prototype._writev=null,N.prototype.end=function(re,J,oe){var we=this._writableState;typeof re=="function"?(oe=re,re=null,J=null):typeof J=="function"&&(oe=J,J=null),re!=null&&this.write(re,J),we.corked&&(we.corked=1,this.uncork()),we.ending||function(se,ue,Y){ue.ending=!0,ce(se,ue),Y&&(ue.finished?l.nextTick(Y):se.once("finish",Y)),ue.ended=!0,se.writable=!1}(this,we,oe)},Object.defineProperty(N.prototype,"destroyed",{get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(re){this._writableState&&(this._writableState.destroyed=re)}}),N.prototype.destroy=A.destroy,N.prototype._undestroy=A.undestroy,N.prototype._destroy=function(re,J){this.end(),J(re)}}).call(this,n(5),n(21).setImmediate,n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(r,i){if(!i.eol&&r){for(var o=0,l=r.length;o Shlink — The URL shortener - + diff --git a/redux-hooks/service-worker.js b/redux-hooks/service-worker.js index 37f61dd2..d7ba0b55 100644 --- a/redux-hooks/service-worker.js +++ b/redux-hooks/service-worker.js @@ -1,2 +1,2 @@ try{self["workbox:core:7.2.0"]&&_()}catch{}const G=(s,...e)=>{let t=s;return e.length>0&&(t+=` :: ${JSON.stringify(e)}`),t},Q=G;class l extends Error{constructor(e,t){const n=Q(e,t);super(n),this.name=e,this.details=t}}const j=new Set;function z(s){j.add(s)}const d={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:typeof registration<"u"?registration.scope:""},E=s=>[d.prefix,s,d.suffix].filter(e=>e&&e.length>0).join("-"),J=s=>{for(const e of Object.keys(d))s(e)},x={updateDetails:s=>{J(e=>{typeof s[e]=="string"&&(d[e]=s[e])})},getGoogleAnalyticsName:s=>s||E(d.googleAnalytics),getPrecacheName:s=>s||E(d.precache),getPrefix:()=>d.prefix,getRuntimeName:s=>s||E(d.runtime),getSuffix:()=>d.suffix};function K(s,e){const t=new URL(s);for(const n of e)t.searchParams.delete(n);return t.href}async function X(s,e,t,n){const a=K(e.url,t);if(e.url===a)return s.match(e,n);const r=Object.assign(Object.assign({},n),{ignoreSearch:!0}),i=await s.keys(e,r);for(const c of i){const o=K(c.url,t);if(a===o)return s.match(c,n)}}let m;function Y(){if(m===void 0){const s=new Response("");if("body"in s)try{new Response(s.body),m=!0}catch{m=!1}m=!1}return m}function q(s){s.then(()=>{})}class Z{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}async function ee(){for(const s of j)await s()}const te=s=>new URL(String(s),location.href).href.replace(new RegExp(`^${location.origin}`),"");function se(s){return new Promise(e=>setTimeout(e,s))}function A(s,e){const t=e();return s.waitUntil(t),t}async function ne(s,e){let t=null;if(s.url&&(t=new URL(s.url).origin),t!==self.location.origin)throw new l("cross-origin-copy-response",{origin:t});const n=s.clone(),r={headers:new Headers(n.headers),status:n.status,statusText:n.statusText},i=Y()?n.body:await n.blob();return new Response(i,r)}function ae(){self.addEventListener("activate",()=>self.clients.claim())}const re=(s,e)=>e.some(t=>s instanceof t);let O,S;function ie(){return O||(O=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ce(){return S||(S=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const F=new WeakMap,k=new WeakMap,H=new WeakMap,D=new WeakMap,I=new WeakMap;function oe(s){const e=new Promise((t,n)=>{const a=()=>{s.removeEventListener("success",r),s.removeEventListener("error",i)},r=()=>{t(f(s.result)),a()},i=()=>{n(s.error),a()};s.addEventListener("success",r),s.addEventListener("error",i)});return e.then(t=>{t instanceof IDBCursor&&F.set(t,s)}).catch(()=>{}),I.set(e,s),e}function he(s){if(k.has(s))return;const e=new Promise((t,n)=>{const a=()=>{s.removeEventListener("complete",r),s.removeEventListener("error",i),s.removeEventListener("abort",i)},r=()=>{t(),a()},i=()=>{n(s.error||new DOMException("AbortError","AbortError")),a()};s.addEventListener("complete",r),s.addEventListener("error",i),s.addEventListener("abort",i)});k.set(s,e)}let P={get(s,e,t){if(s instanceof IDBTransaction){if(e==="done")return k.get(s);if(e==="objectStoreNames")return s.objectStoreNames||H.get(s);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return f(s[e])},set(s,e,t){return s[e]=t,!0},has(s,e){return s instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in s}};function le(s){P=s(P)}function ue(s){return s===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const n=s.call(L(this),e,...t);return H.set(n,e.sort?e.sort():[e]),f(n)}:ce().includes(s)?function(...e){return s.apply(L(this),e),f(F.get(this))}:function(...e){return f(s.apply(L(this),e))}}function de(s){return typeof s=="function"?ue(s):(s instanceof IDBTransaction&&he(s),re(s,ie())?new Proxy(s,P):s)}function f(s){if(s instanceof IDBRequest)return oe(s);if(D.has(s))return D.get(s);const e=de(s);return e!==s&&(D.set(s,e),I.set(e,s)),e}const L=s=>I.get(s);function fe(s,e,{blocked:t,upgrade:n,blocking:a,terminated:r}={}){const i=indexedDB.open(s,e),c=f(i);return n&&i.addEventListener("upgradeneeded",o=>{n(f(i.result),o.oldVersion,o.newVersion,f(i.transaction),o)}),t&&i.addEventListener("blocked",o=>t(o.oldVersion,o.newVersion,o)),c.then(o=>{r&&o.addEventListener("close",()=>r()),a&&o.addEventListener("versionchange",h=>a(h.oldVersion,h.newVersion,h))}).catch(()=>{}),c}function pe(s,{blocked:e}={}){const t=indexedDB.deleteDatabase(s);return e&&t.addEventListener("blocked",n=>e(n.oldVersion,n)),f(t).then(()=>{})}const ge=["get","getKey","getAll","getAllKeys","count"],me=["put","add","delete","clear"],U=new Map;function W(s,e){if(!(s instanceof IDBDatabase&&!(e in s)&&typeof e=="string"))return;if(U.get(e))return U.get(e);const t=e.replace(/FromIndex$/,""),n=e!==t,a=me.includes(t);if(!(t in(n?IDBIndex:IDBObjectStore).prototype)||!(a||ge.includes(t)))return;const r=async function(i,...c){const o=this.transaction(i,a?"readwrite":"readonly");let h=o.store;return n&&(h=h.index(c.shift())),(await Promise.all([h[t](...c),a&&o.done]))[0]};return U.set(e,r),r}le(s=>({...s,get:(e,t,n)=>W(e,t)||s.get(e,t,n),has:(e,t)=>!!W(e,t)||s.has(e,t)}));try{self["workbox:expiration:7.2.0"]&&_()}catch{}const we="workbox-expiration",w="cache-entries",B=s=>{const e=new URL(s,location.href);return e.hash="",e.href};class ye{constructor(e){this._db=null,this._cacheName=e}_upgradeDb(e){const t=e.createObjectStore(w,{keyPath:"id"});t.createIndex("cacheName","cacheName",{unique:!1}),t.createIndex("timestamp","timestamp",{unique:!1})}_upgradeDbAndDeleteOldDbs(e){this._upgradeDb(e),this._cacheName&&pe(this._cacheName)}async setTimestamp(e,t){e=B(e);const n={url:e,timestamp:t,cacheName:this._cacheName,id:this._getId(e)},r=(await this.getDb()).transaction(w,"readwrite",{durability:"relaxed"});await r.store.put(n),await r.done}async getTimestamp(e){const n=await(await this.getDb()).get(w,this._getId(e));return n?.timestamp}async expireEntries(e,t){const n=await this.getDb();let a=await n.transaction(w).store.index("timestamp").openCursor(null,"prev");const r=[];let i=0;for(;a;){const o=a.value;o.cacheName===this._cacheName&&(e&&o.timestamp=t?r.push(a.value):i++),a=await a.continue()}const c=[];for(const o of r)await n.delete(w,o.id),c.push(o.url);return c}_getId(e){return this._cacheName+"|"+B(e)}async getDb(){return this._db||(this._db=await fe(we,1,{upgrade:this._upgradeDbAndDeleteOldDbs.bind(this)})),this._db}}class _e{constructor(e,t={}){this._isRunning=!1,this._rerunRequested=!1,this._maxEntries=t.maxEntries,this._maxAgeSeconds=t.maxAgeSeconds,this._matchOptions=t.matchOptions,this._cacheName=e,this._timestampModel=new ye(e)}async expireEntries(){if(this._isRunning){this._rerunRequested=!0;return}this._isRunning=!0;const e=this._maxAgeSeconds?Date.now()-this._maxAgeSeconds*1e3:0,t=await this._timestampModel.expireEntries(e,this._maxEntries),n=await self.caches.open(this._cacheName);for(const a of t)await n.delete(a,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,q(this.expireEntries()))}async updateTimestamp(e){await this._timestampModel.setTimestamp(e,Date.now())}async isURLExpired(e){if(this._maxAgeSeconds){const t=await this._timestampModel.getTimestamp(e),n=Date.now()-this._maxAgeSeconds*1e3;return t!==void 0?t{if(!r)return null;const i=this._isResponseDateFresh(r),c=this._getCacheExpiration(a);q(c.expireEntries());const o=c.updateTimestamp(n.url);if(t)try{t.waitUntil(o)}catch{}return i?r:null},this.cacheDidUpdate=async({cacheName:t,request:n})=>{const a=this._getCacheExpiration(t);await a.updateTimestamp(n.url),await a.expireEntries()},this._config=e,this._maxAgeSeconds=e.maxAgeSeconds,this._cacheExpirations=new Map,e.purgeOnQuotaError&&z(()=>this.deleteCacheAndMetadata())}_getCacheExpiration(e){if(e===x.getRuntimeName())throw new l("expire-custom-caches-only");let t=this._cacheExpirations.get(e);return t||(t=new _e(e,this._config),this._cacheExpirations.set(e,t)),t}_isResponseDateFresh(e){if(!this._maxAgeSeconds)return!0;const t=this._getDateHeaderTimestamp(e);if(t===null)return!0;const n=Date.now();return t>=n-this._maxAgeSeconds*1e3}_getDateHeaderTimestamp(e){if(!e.headers.has("date"))return null;const t=e.headers.get("date"),a=new Date(t).getTime();return isNaN(a)?null:a}async deleteCacheAndMetadata(){for(const[e,t]of this._cacheExpirations)await self.caches.delete(e),await t.delete();this._cacheExpirations=new Map}}try{self["workbox:precaching:7.2.0"]&&_()}catch{}const be="__WB_REVISION__";function Ce(s){if(!s)throw new l("add-to-cache-list-unexpected-type",{entry:s});if(typeof s=="string"){const r=new URL(s,location.href);return{cacheKey:r.href,url:r.href}}const{revision:e,url:t}=s;if(!t)throw new l("add-to-cache-list-unexpected-type",{entry:s});if(!e){const r=new URL(t,location.href);return{cacheKey:r.href,url:r.href}}const n=new URL(t,location.href),a=new URL(t,location.href);return n.searchParams.set(be,e),{cacheKey:n.href,url:a.href}}class xe{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:e,state:t})=>{t&&(t.originalRequest=e)},this.cachedResponseWillBeUsed=async({event:e,state:t,cachedResponse:n})=>{if(e.type==="install"&&t&&t.originalRequest&&t.originalRequest instanceof Request){const a=t.originalRequest.url;n?this.notUpdatedURLs.push(a):this.updatedURLs.push(a)}return n}}}class Ee{constructor({precacheController:e}){this.cacheKeyWillBeUsed=async({request:t,params:n})=>{const a=n?.cacheKey||this._precacheController.getCacheKeyForURL(t.url);return a?new Request(a,{headers:t.headers}):t},this._precacheController=e}}try{self["workbox:strategies:7.2.0"]&&_()}catch{}function b(s){return typeof s=="string"?new Request(s):s}class De{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new Z,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(const n of this._plugins)this._pluginStateMap.set(n,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){const{event:t}=this;let n=b(e);if(n.mode==="navigate"&&t instanceof FetchEvent&&t.preloadResponse){const i=await t.preloadResponse;if(i)return i}const a=this.hasCallback("fetchDidFail")?n.clone():null;try{for(const i of this.iterateCallbacks("requestWillFetch"))n=await i({request:n.clone(),event:t})}catch(i){if(i instanceof Error)throw new l("plugin-error-request-will-fetch",{thrownErrorMessage:i.message})}const r=n.clone();try{let i;i=await fetch(n,n.mode==="navigate"?void 0:this._strategy.fetchOptions);for(const c of this.iterateCallbacks("fetchDidSucceed"))i=await c({event:t,request:r,response:i});return i}catch(i){throw a&&await this.runCallbacks("fetchDidFail",{error:i,event:t,originalRequest:a.clone(),request:r.clone()}),i}}async fetchAndCachePut(e){const t=await this.fetch(e),n=t.clone();return this.waitUntil(this.cachePut(e,n)),t}async cacheMatch(e){const t=b(e);let n;const{cacheName:a,matchOptions:r}=this._strategy,i=await this.getCacheKey(t,"read"),c=Object.assign(Object.assign({},r),{cacheName:a});n=await caches.match(i,c);for(const o of this.iterateCallbacks("cachedResponseWillBeUsed"))n=await o({cacheName:a,matchOptions:r,cachedResponse:n,request:i,event:this.event})||void 0;return n}async cachePut(e,t){const n=b(e);await se(0);const a=await this.getCacheKey(n,"write");if(!t)throw new l("cache-put-with-no-response",{url:te(a.url)});const r=await this._ensureResponseSafeToCache(t);if(!r)return!1;const{cacheName:i,matchOptions:c}=this._strategy,o=await self.caches.open(i),h=this.hasCallback("cacheDidUpdate"),g=h?await X(o,a.clone(),["__WB_REVISION__"],c):null;try{await o.put(a,h?r.clone():r)}catch(u){if(u instanceof Error)throw u.name==="QuotaExceededError"&&await ee(),u}for(const u of this.iterateCallbacks("cacheDidUpdate"))await u({cacheName:i,oldResponse:g,newResponse:r.clone(),request:a,event:this.event});return!0}async getCacheKey(e,t){const n=`${e.url} | ${t}`;if(!this._cacheKeys[n]){let a=e;for(const r of this.iterateCallbacks("cacheKeyWillBeUsed"))a=b(await r({mode:t,request:a,event:this.event,params:this.params}));this._cacheKeys[n]=a}return this._cacheKeys[n]}hasCallback(e){for(const t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(const n of this.iterateCallbacks(e))await n(t)}*iterateCallbacks(e){for(const t of this._strategy.plugins)if(typeof t[e]=="function"){const n=this._pluginStateMap.get(t);yield r=>{const i=Object.assign(Object.assign({},r),{state:n});return t[e](i)}}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){let e;for(;e=this._extendLifetimePromises.shift();)await e}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,n=!1;for(const a of this.iterateCallbacks("cacheWillUpdate"))if(t=await a({request:this.request,response:t,event:this.event})||void 0,n=!0,!t)break;return n||t&&t.status!==200&&(t=void 0),t}}class V{constructor(e={}){this.cacheName=x.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){const[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});const t=e.event,n=typeof e.request=="string"?new Request(e.request):e.request,a="params"in e?e.params:void 0,r=new De(this,{event:t,request:n,params:a}),i=this._getResponse(r,n,t),c=this._awaitComplete(i,r,n,t);return[i,c]}async _getResponse(e,t,n){await e.runCallbacks("handlerWillStart",{event:n,request:t});let a;try{if(a=await this._handle(t,e),!a||a.type==="error")throw new l("no-response",{url:t.url})}catch(r){if(r instanceof Error){for(const i of e.iterateCallbacks("handlerDidError"))if(a=await i({error:r,event:n,request:t}),a)break}if(!a)throw r}for(const r of e.iterateCallbacks("handlerWillRespond"))a=await r({event:n,request:t,response:a});return a}async _awaitComplete(e,t,n,a){let r,i;try{r=await e}catch{}try{await t.runCallbacks("handlerDidRespond",{event:a,request:n,response:r}),await t.doneWaiting()}catch(c){c instanceof Error&&(i=c)}if(await t.runCallbacks("handlerDidComplete",{event:a,request:n,response:r,error:i}),t.destroy(),i)throw i}}class p extends V{constructor(e={}){e.cacheName=x.getPrecacheName(e.cacheName),super(e),this._fallbackToNetwork=e.fallbackToNetwork!==!1,this.plugins.push(p.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){const n=await t.cacheMatch(e);return n||(t.event&&t.event.type==="install"?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,t){let n;const a=t.params||{};if(this._fallbackToNetwork){const r=a.integrity,i=e.integrity,c=!i||i===r;n=await t.fetch(new Request(e,{integrity:e.mode!=="no-cors"?i||r:void 0})),r&&c&&e.mode!=="no-cors"&&(this._useDefaultCacheabilityPluginIfNeeded(),await t.cachePut(e,n.clone()))}else throw new l("missing-precache-entry",{cacheName:this.cacheName,url:e.url});return n}async _handleInstall(e,t){this._useDefaultCacheabilityPluginIfNeeded();const n=await t.fetch(e);if(!await t.cachePut(e,n.clone()))throw new l("bad-precaching-response",{url:e.url,status:n.status});return n}_useDefaultCacheabilityPluginIfNeeded(){let e=null,t=0;for(const[n,a]of this.plugins.entries())a!==p.copyRedirectedCacheableResponsesPlugin&&(a===p.defaultPrecacheCacheabilityPlugin&&(e=n),a.cacheWillUpdate&&t++);t===0?this.plugins.push(p.defaultPrecacheCacheabilityPlugin):t>1&&e!==null&&this.plugins.splice(e,1)}}p.defaultPrecacheCacheabilityPlugin={async cacheWillUpdate({response:s}){return!s||s.status>=400?null:s}};p.copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate({response:s}){return s.redirected?await ne(s):s}};class Le{constructor({cacheName:e,plugins:t=[],fallbackToNetwork:n=!0}={}){this._urlsToCacheKeys=new Map,this._urlsToCacheModes=new Map,this._cacheKeysToIntegrities=new Map,this._strategy=new p({cacheName:x.getPrecacheName(e),plugins:[...t,new Ee({precacheController:this})],fallbackToNetwork:n}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this._strategy}precache(e){this.addToCacheList(e),this._installAndActiveListenersAdded||(self.addEventListener("install",this.install),self.addEventListener("activate",this.activate),this._installAndActiveListenersAdded=!0)}addToCacheList(e){const t=[];for(const n of e){typeof n=="string"?t.push(n):n&&n.revision===void 0&&t.push(n.url);const{cacheKey:a,url:r}=Ce(n),i=typeof n!="string"&&n.revision?"reload":"default";if(this._urlsToCacheKeys.has(r)&&this._urlsToCacheKeys.get(r)!==a)throw new l("add-to-cache-list-conflicting-entries",{firstEntry:this._urlsToCacheKeys.get(r),secondEntry:a});if(typeof n!="string"&&n.integrity){if(this._cacheKeysToIntegrities.has(a)&&this._cacheKeysToIntegrities.get(a)!==n.integrity)throw new l("add-to-cache-list-conflicting-integrities",{url:r});this._cacheKeysToIntegrities.set(a,n.integrity)}if(this._urlsToCacheKeys.set(r,a),this._urlsToCacheModes.set(r,i),t.length>0){const c=`Workbox is precaching URLs without revision info: ${t.join(", ")} -This is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(c)}}}install(e){return A(e,async()=>{const t=new xe;this.strategy.plugins.push(t);for(const[r,i]of this._urlsToCacheKeys){const c=this._cacheKeysToIntegrities.get(i),o=this._urlsToCacheModes.get(r),h=new Request(r,{integrity:c,cache:o,credentials:"same-origin"});await Promise.all(this.strategy.handleAll({params:{cacheKey:i},request:h,event:e}))}const{updatedURLs:n,notUpdatedURLs:a}=t;return{updatedURLs:n,notUpdatedURLs:a}})}activate(e){return A(e,async()=>{const t=await self.caches.open(this.strategy.cacheName),n=await t.keys(),a=new Set(this._urlsToCacheKeys.values()),r=[];for(const i of n)a.has(i.url)||(await t.delete(i),r.push(i.url));return{deletedURLs:r}})}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){const t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForCacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){const t=e instanceof Request?e.url:e,n=this.getCacheKeyForURL(t);if(n)return(await self.caches.open(this.strategy.cacheName)).match(n)}createHandlerBoundToURL(e){const t=this.getCacheKeyForURL(e);if(!t)throw new l("non-precached-url",{url:e});return n=>(n.request=new Request(e),n.params=Object.assign({cacheKey:t},n.params),this.strategy.handle(n))}}let T;const M=()=>(T||(T=new Le),T);try{self["workbox:routing:7.2.0"]&&_()}catch{}const $="GET",C=s=>s&&typeof s=="object"?s:{handle:s};class R{constructor(e,t,n=$){this.handler=C(t),this.match=e,this.method=n}setCatchHandler(e){this.catchHandler=C(e)}}class Ue extends R{constructor(e,t,n){const a=({url:r})=>{const i=e.exec(r.href);if(i&&!(r.origin!==location.origin&&i.index!==0))return i.slice(1)};super(a,t,n)}}class Te{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener("fetch",e=>{const{request:t}=e,n=this.handleRequest({request:t,event:e});n&&e.respondWith(n)})}addCacheListener(){self.addEventListener("message",e=>{if(e.data&&e.data.type==="CACHE_URLS"){const{payload:t}=e.data,n=Promise.all(t.urlsToCache.map(a=>{typeof a=="string"&&(a=[a]);const r=new Request(...a);return this.handleRequest({request:r,event:e})}));e.waitUntil(n),e.ports&&e.ports[0]&&n.then(()=>e.ports[0].postMessage(!0))}})}handleRequest({request:e,event:t}){const n=new URL(e.url,location.href);if(!n.protocol.startsWith("http"))return;const a=n.origin===location.origin,{params:r,route:i}=this.findMatchingRoute({event:t,request:e,sameOrigin:a,url:n});let c=i&&i.handler;const o=e.method;if(!c&&this._defaultHandlerMap.has(o)&&(c=this._defaultHandlerMap.get(o)),!c)return;let h;try{h=c.handle({url:n,request:e,event:t,params:r})}catch(u){h=Promise.reject(u)}const g=i&&i.catchHandler;return h instanceof Promise&&(this._catchHandler||g)&&(h=h.catch(async u=>{if(g)try{return await g.handle({url:n,request:e,event:t,params:r})}catch(N){N instanceof Error&&(u=N)}if(this._catchHandler)return this._catchHandler.handle({url:n,request:e,event:t});throw u})),h}findMatchingRoute({url:e,sameOrigin:t,request:n,event:a}){const r=this._routes.get(n.method)||[];for(const i of r){let c;const o=i.match({url:e,sameOrigin:t,request:n,event:a});if(o)return c=o,(Array.isArray(c)&&c.length===0||o.constructor===Object&&Object.keys(o).length===0||typeof o=="boolean")&&(c=void 0),{route:i,params:c}}return{}}setDefaultHandler(e,t=$){this._defaultHandlerMap.set(t,C(e))}setCatchHandler(e){this._catchHandler=C(e)}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new l("unregister-route-but-not-found-with-method",{method:e.method});const t=this._routes.get(e.method).indexOf(e);if(t>-1)this._routes.get(e.method).splice(t,1);else throw new l("unregister-route-route-not-registered")}}let y;const ke=()=>(y||(y=new Te,y.addFetchListener(),y.addCacheListener()),y);function v(s,e,t){let n;if(typeof s=="string"){const r=new URL(s,location.href),i=({url:c})=>c.href===r.href;n=new R(i,e,t)}else if(s instanceof RegExp)n=new Ue(s,e,t);else if(typeof s=="function")n=new R(s,e,t);else if(s instanceof R)n=s;else throw new l("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});return ke().registerRoute(n),n}function Pe(s,e=[]){for(const t of[...s.searchParams.keys()])e.some(n=>n.test(t))&&s.searchParams.delete(t);return s}function*Ie(s,{ignoreURLParametersMatching:e=[/^utm_/,/^fbclid$/],directoryIndex:t="index.html",cleanURLs:n=!0,urlManipulation:a}={}){const r=new URL(s,location.href);r.hash="",yield r.href;const i=Pe(r,e);if(yield i.href,t&&i.pathname.endsWith("/")){const c=new URL(i.href);c.pathname+=t,yield c.href}if(n){const c=new URL(i.href);c.pathname+=".html",yield c.href}if(a){const c=a({url:r});for(const o of c)yield o.href}}class Me extends R{constructor(e,t){const n=({request:a})=>{const r=e.getURLsToCacheKeys();for(const i of Ie(a.url,t)){const c=r.get(i);if(c){const o=e.getIntegrityForCacheKey(c);return{cacheKey:c,integrity:o}}}};super(n,e.strategy)}}function ve(s){const e=M(),t=new Me(e,s);v(t)}function Ne(s){return M().createHandlerBoundToURL(s)}function Ke(s){M().precache(s)}function Ae(s,e){Ke(s),ve(e)}const Oe={cacheWillUpdate:async({response:s})=>s.status===200||s.status===0?s:null};class Se extends V{constructor(e={}){super(e),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(Oe)}async _handle(e,t){const n=t.fetchAndCachePut(e).catch(()=>{});t.waitUntil(n);let a=await t.cacheMatch(e),r;if(!a)try{a=await n}catch(i){i instanceof Error&&(r=i)}if(!a)throw new l("no-response",{url:e.url,error:r});return a}}const We="/shlink-web-client/redux-hooks",Be={homepage:We};ae();Ae([{"revision":null,"url":"assets/index-BolCBtSy.js"},{"revision":null,"url":"assets/index-DQHUni9_.css"},{"revision":"918dfab963911ea13ccf3cf528022d4e","url":"index.html"},{"revision":"f3e729bb644bebe1dcffadcbba68f1ff","url":"icons/icon-1024x1024.png"},{"revision":"cd508d134aa805268381ead58279489b","url":"icons/icon-114x114.png"},{"revision":"0812cd0c539ec3bc3880201497ef5439","url":"icons/icon-120x120.png"},{"revision":"db11b5c2a48fbba615b39792e40f4c87","url":"icons/icon-128x128.png"},{"revision":"eb6d6cdd19cac779b6d7ac97463b888e","url":"icons/icon-144x144.png"},{"revision":"6088b31c860949672f7df75fccf9a9ba","url":"icons/icon-150x150.png"},{"revision":"e6f72b1eaa19a7c204b01f5d432b8d12","url":"icons/icon-152x152.png"},{"revision":"0e45616d9a2ada37a8cc9f27a670ca31","url":"icons/icon-160x160.png"},{"revision":"d1006b686a7ab98a5620b415792a33a6","url":"icons/icon-167x167.png"},{"revision":"d42b11e07581fa319271ae71f7093811","url":"icons/icon-16x16.png"},{"revision":"78f75b82e4ce73706359d19cb87c3b00","url":"icons/icon-180x180.png"},{"revision":"a536b5cee1e4a64fd54fc4be7b77efcf","url":"icons/icon-192x192.png"},{"revision":"9e994d55a0485b6bbaad7e63b13a0ef5","url":"icons/icon-196x196.png"},{"revision":"786e390718d25939056e8ef85e264d8a","url":"icons/icon-228x228.png"},{"revision":"556d9b9e027c4411745496790753cd73","url":"icons/icon-24x24.png"},{"revision":"7642a0a1530b73e8818bceceb3d3e7e2","url":"icons/icon-256x256.png"},{"revision":"06d7a4a92102470e88880d42920c7549","url":"icons/icon-310x310.png"},{"revision":"7fcbe3894492fb7f62a317ddd99a28d5","url":"icons/icon-32x32.png"},{"revision":"5a8a86ced62f17062326ae85d5ff352f","url":"icons/icon-384x384.png"},{"revision":"45146cbf5554683533638cb5d8b017ae","url":"icons/icon-40x40.png"},{"revision":"903d05ccefb480c98cd4cf2e484bd663","url":"icons/icon-48x48.png"},{"revision":"f25bdd85d754463f79f8ef441a035933","url":"icons/icon-512x512.png"},{"revision":"60f05c206db3360a51bef6105de2b995","url":"icons/icon-60x60.png"},{"revision":"492762bfada55a219fc687f2549ed05a","url":"icons/icon-64x64.png"},{"revision":"faa08e0d1df851afc410e939cc7bcbc4","url":"icons/icon-72x72.png"},{"revision":"6ae3db0007861108aa3db4e35450fe16","url":"icons/icon-76x76.png"},{"revision":"a5602a4acdef243f27b9acc94f49e9c2","url":"icons/icon-96x96.png"},{"revision":"01f09dc86c547f7d122d22dd2adb4f57","url":"manifest.json"}]);const je=new RegExp("/[^/?]+\\.[^/]+$");v(({request:s,url:e})=>!(s.mode!=="navigate"||e.pathname.startsWith("/_")||e.pathname.match(je)),Ne(`${Be.homepage}/index.html`));v(({url:s})=>s.origin===self.location.origin&&s.pathname.endsWith(".png"),new Se({cacheName:"images",plugins:[new Re({maxEntries:50})]}));self.addEventListener("message",s=>{s.data&&s.data.type==="SKIP_WAITING"&&self.skipWaiting()}); +This is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(c)}}}install(e){return A(e,async()=>{const t=new xe;this.strategy.plugins.push(t);for(const[r,i]of this._urlsToCacheKeys){const c=this._cacheKeysToIntegrities.get(i),o=this._urlsToCacheModes.get(r),h=new Request(r,{integrity:c,cache:o,credentials:"same-origin"});await Promise.all(this.strategy.handleAll({params:{cacheKey:i},request:h,event:e}))}const{updatedURLs:n,notUpdatedURLs:a}=t;return{updatedURLs:n,notUpdatedURLs:a}})}activate(e){return A(e,async()=>{const t=await self.caches.open(this.strategy.cacheName),n=await t.keys(),a=new Set(this._urlsToCacheKeys.values()),r=[];for(const i of n)a.has(i.url)||(await t.delete(i),r.push(i.url));return{deletedURLs:r}})}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){const t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForCacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){const t=e instanceof Request?e.url:e,n=this.getCacheKeyForURL(t);if(n)return(await self.caches.open(this.strategy.cacheName)).match(n)}createHandlerBoundToURL(e){const t=this.getCacheKeyForURL(e);if(!t)throw new l("non-precached-url",{url:e});return n=>(n.request=new Request(e),n.params=Object.assign({cacheKey:t},n.params),this.strategy.handle(n))}}let T;const M=()=>(T||(T=new Le),T);try{self["workbox:routing:7.2.0"]&&_()}catch{}const $="GET",C=s=>s&&typeof s=="object"?s:{handle:s};class R{constructor(e,t,n=$){this.handler=C(t),this.match=e,this.method=n}setCatchHandler(e){this.catchHandler=C(e)}}class Ue extends R{constructor(e,t,n){const a=({url:r})=>{const i=e.exec(r.href);if(i&&!(r.origin!==location.origin&&i.index!==0))return i.slice(1)};super(a,t,n)}}class Te{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener("fetch",e=>{const{request:t}=e,n=this.handleRequest({request:t,event:e});n&&e.respondWith(n)})}addCacheListener(){self.addEventListener("message",e=>{if(e.data&&e.data.type==="CACHE_URLS"){const{payload:t}=e.data,n=Promise.all(t.urlsToCache.map(a=>{typeof a=="string"&&(a=[a]);const r=new Request(...a);return this.handleRequest({request:r,event:e})}));e.waitUntil(n),e.ports&&e.ports[0]&&n.then(()=>e.ports[0].postMessage(!0))}})}handleRequest({request:e,event:t}){const n=new URL(e.url,location.href);if(!n.protocol.startsWith("http"))return;const a=n.origin===location.origin,{params:r,route:i}=this.findMatchingRoute({event:t,request:e,sameOrigin:a,url:n});let c=i&&i.handler;const o=e.method;if(!c&&this._defaultHandlerMap.has(o)&&(c=this._defaultHandlerMap.get(o)),!c)return;let h;try{h=c.handle({url:n,request:e,event:t,params:r})}catch(u){h=Promise.reject(u)}const g=i&&i.catchHandler;return h instanceof Promise&&(this._catchHandler||g)&&(h=h.catch(async u=>{if(g)try{return await g.handle({url:n,request:e,event:t,params:r})}catch(N){N instanceof Error&&(u=N)}if(this._catchHandler)return this._catchHandler.handle({url:n,request:e,event:t});throw u})),h}findMatchingRoute({url:e,sameOrigin:t,request:n,event:a}){const r=this._routes.get(n.method)||[];for(const i of r){let c;const o=i.match({url:e,sameOrigin:t,request:n,event:a});if(o)return c=o,(Array.isArray(c)&&c.length===0||o.constructor===Object&&Object.keys(o).length===0||typeof o=="boolean")&&(c=void 0),{route:i,params:c}}return{}}setDefaultHandler(e,t=$){this._defaultHandlerMap.set(t,C(e))}setCatchHandler(e){this._catchHandler=C(e)}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new l("unregister-route-but-not-found-with-method",{method:e.method});const t=this._routes.get(e.method).indexOf(e);if(t>-1)this._routes.get(e.method).splice(t,1);else throw new l("unregister-route-route-not-registered")}}let y;const ke=()=>(y||(y=new Te,y.addFetchListener(),y.addCacheListener()),y);function v(s,e,t){let n;if(typeof s=="string"){const r=new URL(s,location.href),i=({url:c})=>c.href===r.href;n=new R(i,e,t)}else if(s instanceof RegExp)n=new Ue(s,e,t);else if(typeof s=="function")n=new R(s,e,t);else if(s instanceof R)n=s;else throw new l("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});return ke().registerRoute(n),n}function Pe(s,e=[]){for(const t of[...s.searchParams.keys()])e.some(n=>n.test(t))&&s.searchParams.delete(t);return s}function*Ie(s,{ignoreURLParametersMatching:e=[/^utm_/,/^fbclid$/],directoryIndex:t="index.html",cleanURLs:n=!0,urlManipulation:a}={}){const r=new URL(s,location.href);r.hash="",yield r.href;const i=Pe(r,e);if(yield i.href,t&&i.pathname.endsWith("/")){const c=new URL(i.href);c.pathname+=t,yield c.href}if(n){const c=new URL(i.href);c.pathname+=".html",yield c.href}if(a){const c=a({url:r});for(const o of c)yield o.href}}class Me extends R{constructor(e,t){const n=({request:a})=>{const r=e.getURLsToCacheKeys();for(const i of Ie(a.url,t)){const c=r.get(i);if(c){const o=e.getIntegrityForCacheKey(c);return{cacheKey:c,integrity:o}}}};super(n,e.strategy)}}function ve(s){const e=M(),t=new Me(e,s);v(t)}function Ne(s){return M().createHandlerBoundToURL(s)}function Ke(s){M().precache(s)}function Ae(s,e){Ke(s),ve(e)}const Oe={cacheWillUpdate:async({response:s})=>s.status===200||s.status===0?s:null};class Se extends V{constructor(e={}){super(e),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(Oe)}async _handle(e,t){const n=t.fetchAndCachePut(e).catch(()=>{});t.waitUntil(n);let a=await t.cacheMatch(e),r;if(!a)try{a=await n}catch(i){i instanceof Error&&(r=i)}if(!a)throw new l("no-response",{url:e.url,error:r});return a}}const We="/shlink-web-client/redux-hooks",Be={homepage:We};ae();Ae([{"revision":null,"url":"assets/index-DQHUni9_.css"},{"revision":null,"url":"assets/index-DXlA2lIk.js"},{"revision":"c6000384e41c15ba2b45e0282e8a6475","url":"index.html"},{"revision":"f3e729bb644bebe1dcffadcbba68f1ff","url":"icons/icon-1024x1024.png"},{"revision":"cd508d134aa805268381ead58279489b","url":"icons/icon-114x114.png"},{"revision":"0812cd0c539ec3bc3880201497ef5439","url":"icons/icon-120x120.png"},{"revision":"db11b5c2a48fbba615b39792e40f4c87","url":"icons/icon-128x128.png"},{"revision":"eb6d6cdd19cac779b6d7ac97463b888e","url":"icons/icon-144x144.png"},{"revision":"6088b31c860949672f7df75fccf9a9ba","url":"icons/icon-150x150.png"},{"revision":"e6f72b1eaa19a7c204b01f5d432b8d12","url":"icons/icon-152x152.png"},{"revision":"0e45616d9a2ada37a8cc9f27a670ca31","url":"icons/icon-160x160.png"},{"revision":"d1006b686a7ab98a5620b415792a33a6","url":"icons/icon-167x167.png"},{"revision":"d42b11e07581fa319271ae71f7093811","url":"icons/icon-16x16.png"},{"revision":"78f75b82e4ce73706359d19cb87c3b00","url":"icons/icon-180x180.png"},{"revision":"a536b5cee1e4a64fd54fc4be7b77efcf","url":"icons/icon-192x192.png"},{"revision":"9e994d55a0485b6bbaad7e63b13a0ef5","url":"icons/icon-196x196.png"},{"revision":"786e390718d25939056e8ef85e264d8a","url":"icons/icon-228x228.png"},{"revision":"556d9b9e027c4411745496790753cd73","url":"icons/icon-24x24.png"},{"revision":"7642a0a1530b73e8818bceceb3d3e7e2","url":"icons/icon-256x256.png"},{"revision":"06d7a4a92102470e88880d42920c7549","url":"icons/icon-310x310.png"},{"revision":"7fcbe3894492fb7f62a317ddd99a28d5","url":"icons/icon-32x32.png"},{"revision":"5a8a86ced62f17062326ae85d5ff352f","url":"icons/icon-384x384.png"},{"revision":"45146cbf5554683533638cb5d8b017ae","url":"icons/icon-40x40.png"},{"revision":"903d05ccefb480c98cd4cf2e484bd663","url":"icons/icon-48x48.png"},{"revision":"f25bdd85d754463f79f8ef441a035933","url":"icons/icon-512x512.png"},{"revision":"60f05c206db3360a51bef6105de2b995","url":"icons/icon-60x60.png"},{"revision":"492762bfada55a219fc687f2549ed05a","url":"icons/icon-64x64.png"},{"revision":"faa08e0d1df851afc410e939cc7bcbc4","url":"icons/icon-72x72.png"},{"revision":"6ae3db0007861108aa3db4e35450fe16","url":"icons/icon-76x76.png"},{"revision":"a5602a4acdef243f27b9acc94f49e9c2","url":"icons/icon-96x96.png"},{"revision":"01f09dc86c547f7d122d22dd2adb4f57","url":"manifest.json"}]);const je=new RegExp("/[^/?]+\\.[^/]+$");v(({request:s,url:e})=>!(s.mode!=="navigate"||e.pathname.startsWith("/_")||e.pathname.match(je)),Ne(`${Be.homepage}/index.html`));v(({url:s})=>s.origin===self.location.origin&&s.pathname.endsWith(".png"),new Se({cacheName:"images",plugins:[new Re({maxEntries:50})]}));self.addEventListener("message",s=>{s.data&&s.data.type==="SKIP_WAITING"&&self.skipWaiting()});