1import{u as ae,r as o,b as w,j as e,H as oe}from"./app-DP13319Q.js";import{aR as U,j as se,al as ne,ak as Q,F as r,f as V,k as j,aH as re,K as le}from"./index-CtyZ6W6U.js";import{D as ie}from"./DraggableMenu-Bk7Spryo.js";import{M as C}from"./react-tooltip.min-DW3XhwOj.js";/* empty css */import"./index-DQkUn08L.js";function fe(){const{auth:B,template:de,initialFunnels:c}=ae().props,[k,z]=o.useState((c==null?void 0:c.data)||[]),[g,Y]=o.useState(""),[p,E]=o.useState("fuzzy"),[$,_]=o.useState(1),[f,F]=o.useState((c==null?void 0:c.next_page_url)!==null),[m,H]=o.useState(!1),[v,l]=o.useState(""),[D,x]=o.useState(""),[N,L]=o.useState(""),[M,G]=o.useState(""),[d,I]=o.useState(!1),[u,P]=o.useState(""),[b,R]=o.useState(!1),[i,A]=o.useState(null),[Z,ce]=o.useState(!0),[T,q]=o.useState(null),J=o.useCallback(t=>new Date(t).toLocaleDateString("en-US",{weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}),[]),h=o.useCallback(async()=>{try{const t=await w.get("/search-ez-funnels",{params:{query:g,type:p,page:1}});z(t.data.data),_(1),F(t.data.next_page_url!==null)}catch(t){console.error("Search error:",t),l("Failed to search funnels. Please try again."),setTimeout(()=>l(""),5e3)}},[g,p]),S=o.useCallback(async()=>{var t,n;if(!(m||!f))try{H(!0);const s=await w.get("/search-ez-funnels",{params:{query:g,type:p,page:$+1}});z(a=>[...a,...s.data.data]),_(a=>a+1),F(s.data.next_page_url!==null)}catch(s){console.error("Load more error:",s),l(((n=(t=s.response)==null?void 0:t.data)==null?void 0:n.message)||"Failed to load more items. Please try again."),setTimeout(()=>l(""),5e3)}finally{H(!1)}},[$,f,m,g,p]),O=o.useCallback(async(t,n,s)=>{var a,K;A({name:s,type:t,id:n}),L(""),G(""),l(""),x(""),I(!0);try{const y=await w.post("/generate-transfer-token",{type:t,handle_id:n});L(y.data.token),G(y.data.expires_at),x("Transfer token generated successfully!")}catch(y){console.error("Token generation error:",y),l(((K=(a=y.response)==null?void 0:a.data)==null?void 0:K.message)||"Failed to generate transfer token")}finally{I(!1)}},[]),W=o.useCallback(async()=>{var t,n;if(u.trim())try{R(!0),l(""),x("");const s=await w.post("/redeem-transfer-token",{token:u.trim(),funnel_id:T||null});x(s.data.message),P(""),A(null),q(null),await h()}catch(s){console.error("Token redemption error:",s),l(((n=(t=s.response)==null?void 0:t.data)==null?void 0:n.message)||"Failed to redeem transfer token")}finally{R(!1)}},[u,h,T]),X=o.useCallback(t=>{navigator.clipboard.writeText(t).then(()=>{x("Copied to clipboard!"),setTimeout(()=>x(""),3e3)}).catch(n=>{console.error("Failed to copy:",n),l("Failed to copy to clipboard"),setTimeout(()=>l(""),3e3)})},[]),ee=o.useCallback(t=>{switch(t){case"funnel":return Q;case"domain":return ne;case"custom":return se;default:return U}},[]),te=o.useCallback(t=>{t.key==="Enter"&&h()},[h]);return o.useEffect(()=>{const t=()=>{window.innerHeight+document.documentElement.scrollTop!==document.documentElement.offsetHeight||m||!f||S()};return window.addEventListener("scroll",t),()=>window.removeEventListener("scroll",t)},[m,f,S]),e.jsxs(e.Fragment,{children:[e.jsxs(oe,{children:[e.jsx("title",{children:"EZ Transfer - Transfer Handles Between Accounts"}),e.jsx("style",{children:` 2 .react-tooltip { 3 z-index: 99999 !important; 4 opacity: 1 !important; 5 font-size: 12px; 6 padding: 4px 8px; 7 } 8 `})]}),e.jsx(C,{id:"panel-tooltip"}),e.jsx(C,{id:"form-tooltip"}),e.jsx(C,{id:"action-tooltip"}),e.jsx(ie,{auth:B}),e.jsx("main",{className:"relative flex justify-end p-4 min-h-screen overflow-hidden",children:Z&&e.jsx("div",{className:"relative mt-4 mx-auto bottom-4 z-50 backdrop-blur-sm p-4 rounded-xl border border-white-700 overflow-y-auto shadow-2xl max-w-6xl w-full",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-gray-800/80 border border-gray-700 rounded-lg p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("input",{type:"text",placeholder:"Search by token",className:"flex-grow bg-white text-gray-900 px-3 py-2 rounded-md focus:outline-none focus:ring-2 focus:ring-yellow-400 min-w-0",value:g,onChange:t=>Y(t.target.value),onKeyDown:te,"data-tooltip-id":"form-tooltip","data-tooltip-content":"Search by funnel token or associated domains"}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs("button",{className:`font-semibold px-3 py-2 flex items-center gap-1.5 whitespace-nowrap rounded-l-md border-r transition-colors ${p==="fuzzy"?"bg-green-600 text-white border-green-700 hover:bg-green-700":"bg-gray-600 text-gray-300 border-gray-700 hover:bg-gray-700"}`,onClick:()=>{E("fuzzy"),h()},"data-tooltip-id":"form-tooltip","data-tooltip-content":"Fuzzy search f
8inds partial and similar matches",children:[e.jsx(r,{icon:Q,className:"h-5 w-5"}),"Fuzzy"]}),e.jsxs("button",{className:`font-semibold px-3 py-2 flex items-center gap-1.5 whitespace-nowrap rounded-r-md transition-colors ${p==="exact"?"bg-green-600 text-white hover:bg-green-700":"bg-gray-600 text-gray-300 hover:bg-gray-700"}`,onClick:()=>{E("exact"),h()},"data-tooltip-id":"form-tooltip","data-tooltip-content":"Exact search requires a perfect match",children:[e.jsx(r,{icon:V,className:"h-5 w-5"}),"Exact"]})]})]}),e.jsx("div",{className:"max-h-[65vh] overflow-y-auto custom-scrollbar space-y-2",children:k.length>0?k.map(t=>{var n,s;return e.jsxs("div",{className:"flex items-start p-4 gap-3 bg-[#5d0f6e] rounded-lg","data-tooltip-id":"action-tooltip","data-tooltip-content":`Funnel Token: ${t.token}`,children:[e.jsx("span",{className:"text-4xl select-none pt-1",children:"ð"}),e.jsx("div",{className:"flex-grow min-w-0",children:e.jsxs("div",{className:"flex flex-col flex-wrap gap-2",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("a",{href:`https://ez.wiki/${encodeURIComponent(t.token)}`,target:"_blank",rel:"noopener noreferrer",className:"text-yellow-400 font-semibold truncate hover:underline","data-tooltip-id":"action-tooltip","data-tooltip-content":"Open this handle in a new tab",children:["https://ez.wiki/",t.token]})}),(n=t.handle_domains)==null?void 0:n.map(a=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("a",{href:`https://${a.domain}.${a.domainselected}`,target:"_blank",rel:"noopener noreferrer",className:"text-yellow-400 font-semibold truncate hover:underline","data-tooltip-id":"action-tooltip","data-tooltip-content":"Open this subdomain in a new tab",children:["https://",a.domain,".",a.domainselected]}),e.jsx("button",{onClick:()=>O("domain",a.id,`https://${a.domain}.${a.domainselected}`),disabled:d,className:`text-xs px-2 py-1 rounded transition-colors ${d?"bg-gray-500 cursor-not-allowed":"bg-yellow-500 text-black font-bold hover:bg-yellow-600"}`,"data-tooltip-id":"action-tooltip","data-tooltip-content":"Generate a transfer token for this domain",children:d&&(i==null?void 0:i.id)===a.id?e.jsx(r,{icon:j,className:"animate-spin"}):"Transfer"})]},a.id)),(s=t.custom_domains)==null?void 0:s.map(a=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("a",{href:`https://${a.domainselected}/${a.domain}`,target:"_blank",rel:"noopener noreferrer",className:"text-yellow-400 font-semibold truncate hover:underline","data-tooltip-id":"action-tooltip","data-tooltip-content":"Open this custom domain handle in a new tab",children:["https://",a.domainselected,"/",a.domain]}),e.jsx("button",{onClick:()=>O("custom",a.id,`https://${a.domainselected}/${a.domain}`),disabled:d,className:`text-xs px-2 py-1 rounded transition-colors ${d?"bg-gray-500 cursor-not-allowed":"bg-yellow-500 text-black font-bold hover:bg-yellow-600"}`,"data-tooltip-id":"action-tooltip","data-tooltip-content":"Generate a transfer token for this custom domain",children:d&&(i==null?void 0:i.id)===a.id?e.jsx(r,{icon:j,className:"animate-spin"}):"Transfer"})]},a.id)),e.jsxs("p",{className:"text-purple-300 text-sm whitespace-nowrap pt-1","data-tooltip-id":"action-tooltip","data-tooltip-content":`Created on: ${new Date(t.created_at).toLocaleString()}`,children:["Created: ",J(t.created_at)]})]})})]},t.id)}):e.jsx("div",{className:"text-center py-8 text-gray-400",children:"No funnels found. Try a different search term."})}),f&&e.jsx("div",{className:"flex justify-center mt-4",children:e.jsx("button",{className:"bg-black text-white border border-white px-8 py-2 rounded-md font-semibold hover:bg-white hover:text-black transition-colors disabled:opacity-50",onClick:S,disabled:m,"data-tooltip-id":"action-tooltip","data-tooltip-content":"Load more results",children:m?e.jsxs(e.Fragment,{children:[e.jsx(r,{icon:j,className:"animate-spin mr-2"}),"Loading..."]}):"Load More"})})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"bg-gray-800/80 border border-gray-700 rounded-lg p-6 space-y-4",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsxs("h2",{className:"text-xl font-bold text-white",children:[e.jsx(r,{icon:U,className:"mr-2"}),"Handle Transfer"]})}),D&&!v&&e.jsx("div",{className:"mb-4 p-3 bg-green-100 border border-green-400 text-green-700 rounded-lg text-sm",children:D}),v&&e.jsx("div",{className:"mb-4 p-3 bg-red-100 border border-red-400 text-red-700 rounded-lg text-sm",children:v}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-yellow-400 font-medium mb-3","data-tooltip-id":"form-tooltip","data-tooltip-content":"Generate a unique, single-use token to transfer a handle.",children:[e.jsx(r,{icon:re,className:"mr-2"}),"Generate Transfer Token"]}),i?e.jsxs("div",{className:"bg-gray-900/50 p-4 rounded-lg border border-gray-700 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3 bg-gray-800 p-3 rounded-md",children:[e.jsx(r,{icon:ee(i.type),className:"text-xl text-cyan-400 fa-fw","data-tooltip-id":"action-tooltip","data-tooltip-content":`Handle Type: ${i.type}`}),e.jsx("span",{className:"font-mono text-lg text-white break-all",children:i.name})]}),d?e.jsxs("div",{className:"flex items-center justify-center text-white pt-2",children:[e.jsx(r,{icon:j,className:"animate-spin mr-3"}),e.jsx("span",{children:"Generating Token..."})]}):N&&e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-white font-semibold",children:"Your Transfer Token:"}),e.jsxs("button",{onClick:()=>X(N),className:"text-yellow-400 hover:underline text-sm font-bold flex items-center gap-1","data-tooltip-id":"action-tooltip","data-tooltip-content":"Copy token to clipboard",children:[e.jsx(r,{icon:le}),"Copy"]})]}),e.jsx("div",{className:"bg-gray-800 p-2 text-white rounded break-all text-sm font-mono",children:N}),e.jsxs("div",{className:"text-gray-400 text-xs text-right","data-tooltip-id":"action-tooltip","data-tooltip-content":`Token is valid until ${new Date(M).toLocaleStr
8ing()}`,children:["Expires: ",new Date(M).toLocaleString()]})]})]}):e.jsx("p",{className:"text-gray-300 text-sm p-4 text-center bg-gray-900/50 rounded-lg border border-gray-700",children:'Select a handle from the list on the left and click its "Transfer" button to generate a token.'})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-yellow-400 font-medium mb-2","data-tooltip-id":"form-tooltip","data-tooltip-content":"Use a token received from another user to claim a handle.",children:[e.jsx(r,{icon:V,className:"mr-2"}),"Redeem Transfer Token"]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-300 text-sm mb-2",children:"Assign to existing funnel (leave blank to create new):"}),e.jsxs("select",{className:"w-full bg-gray-700 text-white px-4 py-2 rounded-md border border-gray-600 focus:outline-none focus:ring-2 focus:ring-yellow-400",value:T||"",onChange:t=>q(t.target.value?parseInt(t.target.value):null),disabled:b,"data-tooltip-id":"form-tooltip","data-tooltip-content":"Optional: Assign the handle to one of your existing funnels",children:[e.jsx("option",{value:"",children:"-- Create New Ai Page --"}),k.map(t=>e.jsx("option",{value:t.id,children:t.token},t.id))]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[e.jsx("input",{type:"text",placeholder:"Enter transfer token",className:"flex-grow bg-gray-700 text-white px-4 py-2 rounded-md border border-gray-600 focus:outline-none focus:ring-2 focus:ring-yellow-400",value:u,onChange:t=>P(t.target.value),disabled:b,"data-tooltip-id":"form-tooltip","data-tooltip-content":"Paste the transfer token you received"}),e.jsx("button",{onClick:W,disabled:b||!u.trim(),className:`bg-yellow-500 text-black font-bold py-2 px-4 rounded-md hover:bg-yellow-600 transition-colors ${b||!u.trim()?"opacity-70 cursor-not-allowed":""}`,"data-tooltip-id":"action-tooltip","data-tooltip-content":"Claim the handle using the provided token",children:b?e.jsxs(e.Fragment,{children:[e.jsx(r,{icon:j,className:"animate-spin mr-2"}),"Redeeming..."]}):"Redeem"})]})]})]})]})})]})})})]})}export{fe as default};
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.