1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[421],{339:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/links",function(){return n(4549)}])},597:function(e,t,n){var i=n(3454);n(1479);var l=n(7294),r=l&&"object"==typeof l&&"default"in l?l:{default:l};function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var o=void 0!==i&&i.env&&!0,a=function(e){return"[object String]"===Object.prototype.toString.call(e)},StyleSheet=function(){function StyleSheet(e){var t=void 0===e?{}:e,n=t.name,i=void 0===n?"stylesheet":n,l=t.optimizeForSpeed,r=void 0===l?o:l;d(a(i),"`name` must be a string"),this._name=i,this._deletedRulePlaceholder="#"+i+"-deleted-rule____{}",d("boolean"==typeof r,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=r,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var s=document.querySelector('meta[property="csp-nonce"]');this._nonce=s?s.getAttribute("content"):null}var e,t=StyleSheet.prototype;return t.setOptimizeForSpeed=function(e){d("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),d(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},t.isOptimizeForSpeed=function(){return this._optimizeForSpeed},t.inject=function(){var e=this;if(d(!this._injected,"sheet already injected"),this._injected=!0,this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(o||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,n){return"number"==typeof n?e._serverSheet.cssRules[n]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),n},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},t.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},t.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},t.insertRule=function(e,t){if(d(a(e),"`insertRule` accepts only strings"),this._optimizeForSpeed){var n=this.getSheet();"number"!=typeof t&&(t=n.cssRules.length);try{n.insertRule(e,t)}catch(t){return o||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var i=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,i))}return this._rulesCount++},t.replaceRule=function(e,t){if(this._optimizeForSpeed){var n=this.getSheet();if(t.trim()||(t=this._deletedRulePlaceholder),!n.cssRules[e])return e;n.deleteRule(e);try{n.insertRule(t,e)}catch(i){o||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),n.insertRule(this._deletedRulePlaceholder,e)}}else{var i=this._tags[e];d(i,"old rule at index `"+e+"` not found"),i.textContent=t}return e},t.deleteRule=function(e){if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];d(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},t.flush=function(){this._injected=!1,this._rulesCount=0,this._tags.forEac
1h(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]},t.cssRules=function(){var e=this;return this._tags.reduce(function(t,n){return n?t=t.concat(Array.prototype.map.call(e.getSheetForTag(n).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},t.makeStyleTag=function(e,t,n){t&&d(a(t),"makeStyleTag accepts only strings as second parameter");var i=document.createElement("style");this._nonce&&i.setAttribute("nonce",this._nonce),i.type="text/css",i.setAttribute("data-"+e,""),t&&i.appendChild(document.createTextNode(t));var l=document.head||document.getElementsByTagName("head")[0];return n?l.insertBefore(i,n):l.appendChild(i),i},s(StyleSheet.prototype,[{key:"length",get:function(){return this._rulesCount}}]),e&&s(StyleSheet,e),StyleSheet}();function d(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var c=function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return t>>>0},u={};function p(e,t){if(!t)return"jsx-"+e;var n=String(t),i=e+n;return u[i]||(u[i]="jsx-"+c(e+"-"+n)),u[i]}function h(e,t){var n=e+t;return u[n]||(u[n]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[n]}var x=function(){function e(e){var t=void 0===e?{}:e,n=t.styleSheet,i=void 0===n?null:n,l=t.optimizeForSpeed,r=void 0!==l&&l;this._sheet=i||new StyleSheet({name:"styled-jsx",optimizeForSpeed:r}),this._sheet.inject(),i&&"boolean"==typeof r&&(this._sheet.setOptimizeForSpeed(r),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer||(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var n=this.getIdAndRules(e),i=n.styleId,l=n.rules;if(i in this._instancesCounts){this._instancesCounts[i]+=1;return}var r=l.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[i]=r,this._instancesCounts[i]=1},t.remove=function(e){var t=this,n=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(n in this._instancesCounts,"styleId: `"+n+"` not found"),this._instancesCounts[n]-=1,this._instancesCounts[n]<1){var i=this._fromServer&&this._fromServer[n];i?(i.parentNode.removeChild(i),delete this._fromServer[n]):(this._indices[n].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[n]),delete this._instancesCounts[n]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],n=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return n[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,n;return t=this.cssRules(),void 0===(n=e)&&(n={}),t.map(function(e){var t=e[0],i=e[1];return r.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:n.nonce?n.nonce:void 0,dangerouslySetInnerHTML:{__html:i}})})},t.getIdAndRules=function(e){var t=e.children,n=e.dynamic,i=e.id;if(n){var l=p(i,n);return{styleId:l,rules:Array.isArray(t)?t.map(function(e){return h(l,e)}):[h(l,t)]}}return{styleId:p(i),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),f=l.createContext(null);f.displayName="StyleSheetContext";var y=r.default.useInsertionEffect||r.default.useLayoutEffect,g=new x;function m(e){var t=g||l.useContext(f);return t&&y(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)]),null}m.dynamic=function(e){return e.map(function(e){return p(e[0],e[1])}).join(" ")},t.style=m},5379:function(e,t,n){"use strict";e.exports=n(597).style},4549:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return m}});var i=n(5893),l=n(7294),r=n(1163),s=n(4879),o=n(1958),a=n(9367),d=n(7004),c=n(6124);async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,d.V1)(c.wk,"adminLinks"),i=await n({action:e,...t}),l=i.data;if(!l||"object"!=typeof l||!l.success)throw Error((null==l?void 0:l.message)||(null==l?void 0:l.error)||"Failed to ".concat(e," link"));return l}let p=async()=>{let e=await u("list");return e.links},h=async e=>{let t=await u("create",e);return t.link},x=async(e,t)=>{let n=await u("update",{id:e,...t});return n.link},f=async e=>{await u("delete",{id:e})},y=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,n=await u("analytics",{id:e,recentLimit:t});return{link:n.link,recentClicks:n.recentClicks||[],breakdowns:n.breakdowns||{platform:{},byDay:{},byCountry:{},byReferrer:{}}}},g=e=>"".concat("https://go.kopsoz.kz","/").concat(e);function m(){let e=(0,r.useRouter)(),{user:t,loading:n}=(0,a.aC)(),[d,c]=(0,l.useState)([]),[u,m]=(0,l.useState)(!0),[k,S]=(0,l.useState)(!1),[_,C]=(0,l.useState)(!1),[w,E]=(0,l.useState)(null),[L,N]=(0,l.useState)(null),[q,P]=(0,l.useState)(null),[H,M]=(0,l.useState)(!1),[Z,G]=(0,l.useState)(null),[Q,Y]=(0,l.useState)(null),[X,V]=(0,l.useState)({path:"",name:"",iosUrl:"",androidUrl:"",fallbackUrl:""});(0,l.useEffect)(()=>{n||t?t&&J():e.push("/admin/login")},[t,n,e]);let J=async()=>{try{m(!0),E(null);let e=await p();c(e)}catch(e){console.error("Failed to fetch links:",e),E(e.message||"Failed to load links")}finally{m(!1)}},K=()=>{V({path:"",name:"",iosUrl:"",androidUrl:"",fallbackUrl:""}),N(null),S(!1),E(null)},$=async e=>{e.preventDefault(),C(!0),E(null);try{L?await x(L.id,{name:X.name,iosUrl:X.iosUrl,androidUrl:X.androidUrl,fallbackUrl:X.fallbackUrl}):await h(X),await J(),K()}catch(e){console.error("Failed to save link:",e),E(e.message||"Failed to save link")}finally{C(!1)}},ee=e=>{N(e),V({path:e.path,name:e.name,iosUrl:e.iosUrl,androidUrl:e.androidUrl,fallbackUrl:e.fallbackUrl||""}),S(!0),E(null)},et=e=>{N(null),V({path:"".concat(e.slug,"-copy"),name:"".concat(e.name," (copy)"),iosUrl:e.iosUrl,androidUrl:e.androidUrl,fallbackUrl:e.fallbackUrl||""}),S(!0),E(null),window.scrollTo({top:0,behavior:"smooth"})},en=async e=>{if(confirm('Delete "'.concat(e.name,'" and all its click history? This cannot be undone.')))try{await f(e.id),await J()}catch(e){console.error("Failed to delete link:",e),alert(e.message||"Failed to delete link")}},ei=async e=>{try{await x(e.id,{isActive:!e.isActive}),await J()}catch(e){console.error("Failed to toggle link status:",e),alert(e.message||"Failed to update link")}},el=async e=>{try{await navigator.clipboard.writeText(g(e)),G(e),setTimeout(()=>G(t=>t===e?null:t),1500)}catch(e){}},er=async e=>{M(!0),P(null);try{let t=await y(e.id,100);P(t)}
1catch(e){console.error("Failed to load analytics:",e),alert(e.message||"Failed to load analytics")}finally{M(!1)}};return n||u?(0,i.jsx)(s.Z,{title:"Links",pageTitle:"Loading - Links",children:(0,i.jsx)(o.Z,{size:"large"})}):t?(0,i.jsxs)(s.Z,{title:"Links",pageTitle:"Links - Admin Panel",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{style:{marginBottom:"32px"},children:(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{style:{fontSize:"32px",fontWeight:700,color:"#1f2937",margin:0,marginBottom:"8px"},children:"Smart Links"}),(0,i.jsxs)("p",{style:{fontSize:"16px",color:"#6b7280",margin:0},children:["Create ",(0,i.jsx)("code",{style:z,children:"go.kopsoz.kz/<name>"})," links that send users to the App Store, Google Play, or your website â and track every click."]})]}),(0,i.jsx)("button",{onClick:()=>{K(),S(!0)},style:F,children:"Add New Link"})]})}),w&&!k&&(0,i.jsx)("div",{style:I,children:w}),k&&(0,i.jsxs)("div",{style:D,children:[(0,i.jsx)("h3",{style:U,children:L?"Edit Link":"Add New Link"}),(0,i.jsxs)("form",{onSubmit:$,children:[(0,i.jsxs)("div",{style:{display:"grid",gap:"16px"},children:[(0,i.jsxs)(j,{label:"Path / short name",children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[(0,i.jsx)("span",{style:{...z,color:"#6b7280",whiteSpace:"nowrap"},children:"go.kopsoz.kz/"}),(0,i.jsx)("input",{type:"text",value:X.path,onChange:e=>V({...X,path:e.target.value}),placeholder:"youtube",required:!0,disabled:!!L,style:{...R,opacity:L?.6:1}})]}),L&&(0,i.jsx)("small",{style:{color:"#9ca3af"},children:"The path canât be changed after creation."})]}),(0,i.jsx)(j,{label:"Name (for your reference)",children:(0,i.jsx)("input",{type:"text",value:X.name,onChange:e=>V({...X,name:e.target.value}),placeholder:"YouTube bio link",required:!0,style:R})}),(0,i.jsx)(j,{label:"iOS URL (App Store)",children:(0,i.jsx)("input",{type:"url",value:X.iosUrl,onChange:e=>V({...X,iosUrl:e.target.value}),placeholder:"https://apps.apple.com/...",style:R})}),(0,i.jsx)(j,{label:"Android URL (Google Play)",children:(0,i.jsx)("input",{type:"url",value:X.androidUrl,onChange:e=>V({...X,androidUrl:e.target.value}),placeholder:"https://play.google.com/...",style:R})}),(0,i.jsx)(j,{label:"Fallback URL (desktop / other â optional)",children:(0,i.jsx)("input",{type:"url",value:X.fallbackUrl,onChange:e=>V({...X,fallbackUrl:e.target.value}),placeholder:"https://kopsoz.kz",style:R})})]}),w&&(0,i.jsx)("div",{style:{...I,marginTop:"16px"},children:w}),(0,i.jsxs)("div",{style:{display:"flex",gap:"12px",marginTop:"24px"},children:[(0,i.jsx)("button",{type:"submit",disabled:_,style:{...F,opacity:_?.7:1},children:_?"Savingâ¦":L?"Update Link":"Create Link"}),(0,i.jsx)("button",{type:"button",onClick:K,style:T,children:"Cancel"})]})]})]}),(0,i.jsxs)("div",{children:[(0,i.jsxs)("h3",{style:U,children:["All Links (",d.length,")"]}),0===d.length?(0,i.jsxs)("div",{style:{textAlign:"center",padding:"64px 20px",color:"#6b7280"},children:[(0,i.jsx)("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"\uD83D\uDD17"}),(0,i.jsx)("div",{style:{fontSize:"20px",fontWeight:600,marginBottom:"8px",color:"#1f2937"},children:"No links yet"}),(0,i.jsx)("div",{style:{fontSize:"16px"},children:"Create your first redirect link to get started."})]}):(0,i.jsx)("div",{children:d.map(e=>{var t,n,l;return(0,i.jsx)("div",{style:{padding:"16px 0",borderBottom:"1px solid #f3f4f6"},children:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"16px",flexWrap:"wrap"},children:[(0,i.jsxs)("div",{style:{flex:1,minWidth:"260px"},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"6px",gap:"12px"},children:[(0,i.jsx)("h4",{style:{fontSize:"16px",fontWeight:600,color:"#1f2937",margin:0},children:e.name}),(0,i.jsx)("span",{style:e.isActive?O:W,children:e.isActive?"Active":"Inactive"})]}),(0,i.jsxs)("button",{onClick:()=>el(e.slug),style:B,title:"Copy short link",children:[(0,i.jsxs)("span",{style:z,children:["go.kopsoz.kz/",e.slug]}),(0,i.jsx)("span",{style:{color:"#3b82f6",fontWeight:600},children:Z===e.slug?"â Copied":"Copy"})]}),(0,i.jsxs)("div",{style:{fontSize:"14px",color:"#6b7280",marginTop:"8px",display:"flex",gap:"16px",flexWrap:"wrap"},children:[(0,i.jsxs)("span",{children:[(0,i.jsx)("strong",{children:e.totalClicks||0})," clicks"]}),(0,i.jsxs)("span",{children:["\uD83C\uDF4F iOS ",(null===(t=e.clicksByPlatform)||void 0===t?void 0:t.ios)||0]}),(0,i.jsxs)("span",{children:["\uD83E\uDD16 Android ",(null===(n=e.clicksByPlatform)||void 0===n?void 0:n.android)||0]}),(0,i.jsxs)("span",{children:["\uD83D\uDDA5 Desktop ",(null===(l=e.clicksByPlatform)||void 0===l?void 0:l.desktop)||0]})]})]}),(0,i.jsxs)("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[(0,i.jsx)("button",{onClick:()=>er(e),style:A("#7c3aed"),children:"Analytics"}),(0,i.jsx)("button",{onClick:()=>Y(e),style:A("#0f766e"),children:"QR Code"}),(0,i.jsx)("button",{onClick:()=>ei(e),style:A(e.isActive?"#dc2626":"#059669"),children:e.isActive?"Deactivate":"Activate"}),(0,i.jsx)("button",{onClick:()=>ee(e),style:A("#3b82f6"),children:"Edit"}),(0,i.jsx)("button",{onClick:()=>et(e),style:A("#0891b2"),children:"Duplicate"}),(0,i.jsx)("button",{onClick:()=>en(e),style:A("#dc2626"),children:"Delete"})]})]})},e.id)})})]})]}),(H||q)&&(0,i.jsx)(b,{analytics:q,loading:H,onClose:()=>{P(null),M(!1)}}),Q&&(0,i.jsx)(v,{link:Q,onClose:()=>Y(null)})]}):null}function v(e){let{link:t,onClose:r}=e,s=(0,l.useRef)(null),o=(0,l.useRef)(null),a=(0,l.useRef)(null),[d,c]=(0,l.useState)("#000000"),[u,p]=(0,l.useState)("#ffffff"),[h,x]=(0,l.useState)(!1),[f,y]=(0,l.useState)("square"),[m,v]=(0,l.useState)("square"),[b,j]=(0,l.useState)("square"),[k,S]=(0,l.useState)(null),[_,C]=(0,l.useState)(20),w=g(t.slug),z=(0,l.useCallback)(()=>({width:280,height:280,type:"canvas",data:w,dotsOptions:{color:d,type:f},backgroundOptions:{color:h?"#00000000":u},cornersSquareOptions:{type:m,color:d},cornersDotOptions:{type:b,color:d},...k?{image:k,imageOptions:{crossOrigin:"anonymous",margin:4,imageSize:_/100}}:{}}),[w,d,u,h,f,m,b,k,_]);return(0,l.useEffect)(()=>{let e=!0;return n.e(915).then(n.t.bind(n,1915,23)).then(t=>{let{default:n}=t;
1e&&s.current&&(s.current.innerHTML="",o.current=new n(z()),o.current.append(s.current))}),()=>{e=!1}},[]),(0,l.useEffect)(()=>{o.current&&o.current.update(z())},[z]),(0,i.jsx)("div",{style:E,onClick:r,children:(0,i.jsxs)("div",{style:{...L,maxWidth:"560px"},onClick:e=>e.stopPropagation(),children:[(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[(0,i.jsxs)("h3",{style:{...U,marginBottom:0},children:["QR Code â ",t.name]}),(0,i.jsx)("button",{onClick:r,style:{...T,padding:"6px 12px"},children:"Close"})]}),(0,i.jsxs)("div",{style:{display:"flex",gap:"24px",alignItems:"flex-start"},children:[(0,i.jsxs)("div",{style:{flexShrink:0},children:[(0,i.jsx)("div",{ref:s,style:{borderRadius:"8px",border:"1px solid #e5e7eb",overflow:"hidden",width:"".concat(280,"px"),height:"".concat(280,"px"),background:h?"repeating-conic-gradient(#e5e7eb 0% 25%, #fff 0% 50%) 0 0 / 16px 16px":u}}),(0,i.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",textAlign:"center",marginTop:"8px",fontFamily:"monospace"},children:w})]}),(0,i.jsxs)("div",{style:{flex:1,display:"grid",gap:"16px"},children:[(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{style:P,children:"QR color"}),(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,i.jsx)("input",{type:"color",value:d,onChange:e=>c(e.target.value),style:H}),(0,i.jsx)("span",{style:{fontSize:"12px",fontFamily:"monospace"},children:d})]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{style:P,children:"Backgroun
1d"}),(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,i.jsx)("input",{type:"color",value:u,onChange:e=>p(e.target.value),disabled:h,style:{...H,opacity:h?.4:1}}),(0,i.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"5px",fontSize:"12px",cursor:"pointer",userSelect:"none"},children:[(0,i.jsx)("input",{type:"checkbox",checked:h,onChange:e=>x(e.target.checked),style:{cursor:"pointer"}}),"Transparent"]})]})]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{style:P,children:"Dot shape"}),(0,i.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:[{value:"square",label:"Square"},{value:"rounded",label:"Rounded"},{value:"extra-rounded",label:"Extra Rounded"},{value:"dots",label:"Dots"},{value:"classy",label:"Classy"},{value:"classy-rounded",label:"Classy Rounded"}].map(e=>(0,i.jsx)("button",{onClick:()=>y(e.value),style:M(f===e.value),children:e.label},e.value))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{style:P,children:"Corner squares"}),(0,i.jsx)("div",{style:{display:"flex",gap:"6px"},children:[{value:"square",label:"Square"},{value:"extra-rounded",label:"Rounded"},{value:"dot",label:"Dot"}].map(e=>(0,i.jsx)("button",{onClick:()=>v(e.value),style:M(m===e.value),children:e.label},e.value))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{style:P,children:"Corner dots"}),(0,i.jsx)("div",{style:{display:"flex",gap:"6px"},children:[{value:"square",label:"Square"},{value:"dot",label:"Dot"}].map(e=>(0,i.jsx)("button",{onClick:()=>j(e.value),style:M(b===e.value),children:e.label},e.value))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{style:P,children:"Center logo"}),(0,i.jsxs)("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[(0,i.jsx)("button",{onClick:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.click()},style:{...T,padding:"8px 14px",fontSize:"13px"},children:k?"Change":"Upload logo"}),k&&(0,i.jsx)("button",{onClick:()=>S(null),style:{...T,padding:"8px 14px",fontSize:"13px",color:"#dc2626",borderColor:"#dc2626"},children:"Remove"}),(0,i.jsx)("input",{ref:a,type:"file",accept:"image/*",onChange:e=>{var t;let n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!n)return;let i=new FileReader;i.onload=e=>{var t;return S(null===(t=e.target)||void 0===t?void 0:t.result)},i.readAsDataURL(n)},style:{display:"none"}})]}),k&&(0,i.jsxs)("div",{style:{marginTop:"10px"},children:[(0,i.jsxs)("label",{style:{...P,display:"flex",justifyContent:"space-between"},children:[(0,i.jsx)("span",{children:"Size"}),(0,i.jsxs)("span",{children:[_,"%"]})]}),(0,i.jsx)("input",{type:"range",min:10,max:40,value:_,onChange:e=>C(Number(e.target.value)),style:{width:"100%"}})]})]})]})]}),(0,i.jsxs)("div",{style:{display:"flex",gap:"12px",marginTop:"20px"},children:[(0,i.jsx)("button",{onClick:()=>{var e;null===(e=o.current)||void 0===e||e.download({name:"qr-".concat(t.slug),extension:"png"})},style:F,children:"Download PNG"}),(0,i.jsx)("button",{onClick:r,style:T,children:"Close"})]})]})})}function b(e){let{analytics:t,loading:n,onClose:l}=e;return(0,i.jsx)("div",{style:E,onClick:l,children:(0,i.jsxs)("div",{style:L,onClick:e=>e.stopPropagation(),children:[(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[(0,i.jsx)("h3",{style:{...U,marginBottom:0},children:t?"Analytics â ".concat(t.link.name):"Loadingâ¦"}),(0,i.jsx)("button",{onClick:l,style:{...T,padding:"6px 12px"},children:"Close"})]}),n||!t?(0,i.jsx)(o.Z,{size:"medium"}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(120px, 1fr))",gap:"12px",marginBottom:"24px"},children:[(0,i.jsx)(k,{label:"Total clicks",value:t.link.totalClicks||0}),(0,i.jsx)(k,{label:"iOS",value:t.breakdowns.platform.ios||0}),(0,i.jsx)(k,{label:"Android",value:t.breakdowns.platform.android||0}),(0,i.jsx)(k,{label:"Desktop",value:t.breakdowns.platform.desktop||0})]}),!!t.link.botClicks&&(0,i.jsxs)("div",{style:{fontSize:"12px",color:"#9ca3af",marginBottom:"4px"},children:["Excludes ",t.link.botClicks," link-preview bot hit",1===t.link.botClicks?"":"s"," (Telegram / WhatsApp / etc.)."]}),(0,i.jsx)(S,{title:"Clicks by day (last 30)",children:(0,i.jsx)(_,{data:function(e,t){let n=[],i=new Date;for(let t=29;t>=0;t--){let l=new Date(i);l.setUTCDate(l.getUTCDate()-t);let r=l.toISOString().slice(0,10);n.push([r,e[r]||0])}return n}(t.breakdowns.byDay,0)})}),(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"24px",marginTop:"20px"},children:[(0,i.jsx)(S,{title:"Top countries (recent)",children:(0,i.jsx)(C,{data:t.breakdowns.byCountry})}),(0,i.jsx)(S,{title:"Top sources (recent)",children:(0,i.jsx)(C,{data:t.breakdowns.byReferrer})})]}),(0,i.jsx)(S,{title:"Recent clicks (".concat(t.recentClicks.length,")"),children:(0,i.jsx)("div",{style:{maxHeight:"260px",overflowY:"auto"},children:(0,i.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{style:{textAlign:"left",color:"#6b7280"},children:[(0,i.jsx)("th",{style:N,children:"When"}),(0,i.jsx)("th",{style:N,children:"Platform"}),(0,i.jsx)("th",{style:N,children:"OS"}),(0,i.jsx)("th",{style:N,children:"Source"}),(0,i.jsx)("th",{style:N,children:"Country"})]})}),(0,i.jsx)("tbody",{children:t.recentClicks.map(e=>(0,i.jsxs)("tr",{style:{borderTop:"1px solid #f3f4f6"},children:[(0,i.jsx)("td",{style:q,children:e.ts?new Date(e.ts).toLocaleStr
1ing():"â"}),(0,i.jsxs)("td",{style:q,children:[e.platform,e.isBot?" \uD83E\uDD16":""]}),(0,i.jsx)("td",{style:q,children:e.os||"â"}),(0,i.jsx)("td",{style:q,children:e.browser||"â"}),(0,i.jsx)("td",{style:q,children:e.country||"â"})]},e.id))})]})})})]})]})})}function j(e){let{label:t,children:n}=e;return(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{style:{display:"block",fontSize:"14px",fontWeight:500,color:"#374151",marginBottom:"4px"},children:t}),n]})}function k(e){let{label:t,value:n}=e;return(0,i.jsxs)("div",{style:{background:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"12px 16px"},children:[(0,i.jsx)("div",{style:{fontSize:"24px",fontWeight:700,color:"#1f2937"},children:n}),(0,i.jsx)("div",{style:{fontSize:"12px",color:"#6b7280"},children:t})]})}function S(e){let{title:t,children:n}=e;return(0,i.jsxs)("div",{style:{marginTop:"20px"},children:[(0,i.jsx)("div",{style:{fontSize:"13px",fontWeight:600,color:"#374151",marginBottom:"10px"},children:t}),n]})}function _(e){let{data:t}=e,n=Math.max(1,...t.map(e=>{let[,t]=e;return t}));return t.every(e=>{let[,t]=e;return 0===t})?(0,i.jsx)(w,{}):(0,i.jsx)("div",{style:{display:"flex",alignItems:"flex-end",gap:"3px",height:"80px"},children:t.map(e=>{let[t,l]=e;return(0,i.jsx)("div",{title:"".concat(t,": ").concat(l),style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"flex-end"},children:(0,i.jsx)("div",{style:{height:"".concat(l/n*100,"%"),minHeight:l>0?"2px":"0",background:"#7c3aed",borderRadius:"2px 2px 0 0"}})},t)})})}function C(e){let{data:t}=e,n=Object.entries(t).sort((e,t)=>t[1]-e[1]).slice(0,6);if(0===n.length)return(0,i.jsx)(w,{});let l=Math.max(1,...n.map(e=>{let[,t]=e;return t}));return(0,i.jsx)("div",{style:{display:"grid",gap:"6px"},children:n.map(e=>{let[t,n]=e;return(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,i.jsx)("div",{style:{width:"90px",fontSize:"12px",color:"#374151",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),(0,i.jsx)("div",{style:{flex:1,background:"#f3f4f6",borderRadius:"4px",overflow:"hidden"},children:(0,i.jsx)("div",{style:{width:"".concat(n/l*100,"%"),background:"#3b82f6",height:"14px"}})}),(0,i.jsx)("div",{style:{width:"28px",textAlign:"right",fontSize:"12px",color:"#6b7280"},children:n})]},t)})})}function w(){return(0,i.jsx)("div",{style:{fontSize:"13px",color:"#9ca3af"},children:"No data yet."})}let z={fontFamily:"monospace"},R={width:"100%",padding:"12px 16px",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"14px",fontFamily:"inherit",outline:"none"},F={padding:"12px 20px",backgroundColor:"#3b82f6",color:"white",border:"none",borderRadius:"6px",fontSize:"14px",fontWeight:500,cursor:"pointer",fontFamily:"inherit"},T={padding:"12px 20px",backgroundColor:"transparent",color:"#6b7280",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"14px",fontWeight:500,cursor:"pointer",fontFamily:"inherit"},A=e=>({fontSize:"12px",fontWeight:500,color:e,backgroundColor:"transparent",border:"1px solid ".concat(e),padding:"6px 12px",borderRadius:"4px",cursor:"pointer",fontFamily:"inherit"}),D={backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"24px",marginBottom:"32px"},U={fontSize:"18px",fontWeight:600,color:"#1f2937",marginBottom:"16px"},I={background:"#fee2e2",color:"#991b1b",border:"1px solid #fecaca",borderRadius:"6px",padding:"12px 16px",fontSize:"14px",marginBottom:"16px"},O={fontSize:"12px",fontWeight:500,color:"#059669",backgroundColor:"#d1fae5",padding:"4px 8px",borderRadius:"4px"},W={fontSize:"12px",fontWeight:500,color:"#dc2626",backgroundColor:"#fee2e2",padding:"4px 8px",borderRadius:"4px"},B={display:"inline-flex",alignItems:"center",gap:"10px",background:"#eff6ff",border:"1px solid #dbeafe",borderRadius:"6px",padding:"6px 10px",fontSize:"13px",cursor:"pointer",fontFamily:"inherit"},E={position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",zIndex:1e3},L={background:"white",borderRadius:"12px",padding:"24px",width:"100%",maxWidth:"720px",maxHeight:"85vh",overflowY:"auto"},N={padding:"6px 8px",fontWeight:600},q={padding:"6px 8px",color:"#374151"},P={display:"block",fontSize:"13px",fontWeight:500,color:"#374151",marginBottom:"6px"},H={width:"36px",height:"36px",padding:"2px",border:"1px solid #d1d5db",borderRadius:"6px",cursor:"pointer",background:"none"},M=e=>({fontSize:"12px",fontWeight:e?600:400,color:e?"#0f766e":"#374151",backgroundColor:e?"#f0fdf9":"transparent",border:"1px solid ".concat(e?"#0f766e":"#d1d5db"),padding:"4px 10px",borderRadius:"4px",cursor:"pointer",fontFamily:"inherit"})},1479:function(){},9008:function(e,t,n){e.exports=n(9201)},1163:function(e,t,n){e.exports=n(9974)}},function(e){e.O(0,[879,774,888,179],function(){return e(e.s=339)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.