@frames.js/debugger
Version:
Debug your Frames.js applications
23 lines (22 loc) • 213 kB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931,5477],{69314:function(){},75477:function(){},38087:function(){},30488:function(){},53260:function(){},87937:function(e,t,r){Promise.resolve().then(r.bind(r,80160)),Promise.resolve().then(r.bind(r,30969))},57769:function(e,t,r){"use strict";r.d(t,{Ol:function(){return o},Zb:function(){return i},aY:function(){return c},ll:function(){return l}});var n=r(57437),a=r(2265),s=r(38333);let i=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,s.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",r),...a})});i.displayName="Card";let o=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,s.cn)("flex flex-col space-y-1.5 p-4",r),...a})});o.displayName="CardHeader";let l=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("h3",{ref:t,className:(0,s.cn)("text-2xl font-semibold leading-none tracking-tight",r),...a})});l.displayName="CardTitle",a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("p",{ref:t,className:(0,s.cn)("text-sm text-muted-foreground",r),...a})}).displayName="CardDescription";let c=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,s.cn)("p-4 pt-0",r),...a})});c.displayName="CardContent",a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,s.cn)("flex items-center p-4 pt-0",r),...a})}).displayName="CardFooter"},905:function(e,t,r){"use strict";r.d(t,{FN:function(){return m},Mi:function(){return h},VW:function(){return c},_i:function(){return d},gD:function(){return f},lj:function(){return g},sA:function(){return p}});var n=r(57437),a=r(2265),s=r(21765),i=r(23655),o=r(52235),l=r(38333);let c=s.zt,d=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(s.l_,{ref:t,className:(0,l.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",r),...a})});d.displayName=s.l_.displayName;let u=(0,i.j)("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),m=a.forwardRef((e,t)=>{let{className:r,variant:a,...i}=e;return(0,n.jsx)(s.fC,{ref:t,className:(0,l.cn)(u({variant:a}),r),...i})});m.displayName=s.fC.displayName;let f=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(s.aU,{ref:t,className:(0,l.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",r),...a})});f.displayName=s.aU.displayName;let p=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(s.x8,{ref:t,className:(0,l.cn)("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",r),"toast-close":"",...a,children:(0,n.jsx)(o.Z,{className:"h-4 w-4"})})});p.displayName=s.x8.displayName;let h=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(s.Dx,{ref:t,className:(0,l.cn)("text-sm font-semibold",r),...a})});h.displayName=s.Dx.displayName;let g=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(s.dk,{ref:t,className:(0,l.cn)("text-sm opacity-90",r),...a})});g.displayName=s.dk.displayName},57111:function(e,t,r){"use strict";r.r(t),r.d(t,{Tooltip:function(){return l},TooltipContent:function(){return d},TooltipProvider:function(){return o},TooltipTrigger:function(){return c}});var n=r(57437),a=r(2265),s=r(43136),i=r(38333);let o=s.zt,l=s.fC,c=s.xz,d=a.forwardRef((e,t)=>{let{className:r,sideOffset:a=4,...o}=e;return(0,n.jsx)(s.VY,{ref:t,sideOffset:a,className:(0,i.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...o})});d.displayName=s.VY.displayName},20385:function(e,t,r){"use strict";r.d(t,{pm:function(){return m}});var n=r(2265);let a=0,s=new Map,i=e=>{if(s.has(e))return;let t=setTimeout(()=>{s.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);s.set(e,t)},o=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:r}=t;return r?i(r):e.toasts.forEach(e=>{i(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},l=[],c={toasts:[]};function d(e){c=o(c,e),l.forEach(e=>{e(c)})}function u(e){let{...t}=e,r=(a=(a+1)%Number.MAX_SAFE_INTEGER).toString(),n=()=>d({type:"DISMISS_TOAST",toastId:r});return d({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:e=>{e||n()}}}),{id:r,dismiss:n,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:r}})}}function m(){let[e,t]=n.useState(c);return n.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},38333:function(e,t,r){"use strict";r.d(t,{cn:function(){return s}});var n=r(25555),a=r(72758);function s(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,a.m6)((0,n.W)(t))}},80160:function(e,t,r){"use strict";r.r(t),r.d(t,{FrameDebuggerExamplesSection:function(){return o}});var n=r(57437),a=r(57769),s=r(43081),i=r(8792);function o(e){let{examples:t}=e;return 0===t.length?null:(0,n.jsx)("div",{className:"flex flex-grow flex-col items-center justify-center p-2",children:(0,n.jsxs)(a.Zb,{children:[(0,n.jsx)(a.Ol,{children:(0,n.jsx)(a.ll,{children:"Examples"})}),(0,n.jsx)(a.aY,{className:"grid grid-cols-2 gap-3",children:t.map(e=>(0,n.jsxs)(i.default,{className:"py-1 inline-flex items-center gap-2 font-semibold",href:{pathname:"/",query:{url:e.url}},children:[(0,n.jsx)("span",{className:"text-slate-400 relative text-center inline-block",children:(0,n.jsx)(s.Z,{size:16})}),e.title]},e.url))})]})})}},30969:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return sS}});var n,a,s,i,o,l,c,d,u,m=r(57437),f=r(2265),p=r(61738),h=r(23655),g=r(38333);let x=(0,h.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),v=f.forwardRef((e,t)=>{let{className:r,variant:n,size:a,asChild:s=!1,...i}=e,o=s?p.g7:"button";return(0,m.jsx)(o,{className:(0,g.cn)(x({variant:n,size:a,className:r})),ref:t,...i})});v.displayName="Button";let y=f.forwardRef((e,t)=>{let{className:r,type:n,...a}=e;return(0,m.jsx)("input",{type:n,className:(0,g.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:t,...a})});y.displayName="Input";var b=r(46079);function w(e){return(0,b._)(["bytes1","uint32"],["0xfc",e])}async function j(e){try{return e().catch(e=>e instanceof Error?e:TypeError("Unexpected error, check the console for details"))}catch(e){return TypeError("Unexpected error, check the console for details")}}function N(e){try{return e()}catch(e){if(e instanceof Error)return e;return TypeError("Unexpected error, check the console for details")}}function E(e){return"object"==typeof e&&null!==e&&"openframes"in e&&"farcaster"in e}function S(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];let a="temporary-for-parsing-purposes.tld",s=new URL(e,"http://".concat(a));return r.forEach(e=>{e.forEach((e,t)=>{s.searchParams.set(t,e)})}),s.hostname===a?"".concat(s.pathname).concat(s.search):s.toString()}var R=r(41171),C=r(21949),k=r(22268),I=r(73860).Buffer,T=async function(e,t){let r=await j(()=>P(e,t));if(r instanceof Error)throw r;let{message:n,trustedBytes:a}=r;return{untrustedData:{buttonIndex:n.data.frameActionBody.buttonIndex,fid:n.data.fid,messageHash:(0,C.ci)(n.hash),network:R.ddA.MAINNET,state:I.from(n.data.frameActionBody.state).toString(),timestamp:n.data.timestamp,url:I.from(n.data.frameActionBody.url).toString()},trustedData:{messageBytes:a}}},A=async function(e,t){let r=await j(()=>U(e,t));if(r instanceof Error)throw r;let{message:n,trustedBytes:a}=r;return{untrustedData:{buttonIndex:n.data.frameActionBody.buttonIndex,fid:n.data.fid,messageHash:(0,C.ci)(n.hash),network:R.ddA.MAINNET,timestamp:n.data.timestamp,url:I.from(n.data.frameActionBody.url).toString()},trustedData:{messageBytes:a}}},_=async e=>{let{frameButton:t,signer:r,buttonIndex:n,inputText:a,frameContext:s,state:i,url:o,target:l}=e;if(!r||"pending_approval"===r.status)throw Error("Missing signer fid to sign message");let{message:c,trustedBytes:d}=await F(r.privateKey,{fid:r.fid,buttonIndex:n,castId:{fid:s.castId.fid,hash:(0,k.nr)(s.castId.hash)},state:void 0!==i?I.from(i):void 0,url:I.from(o),inputText:void 0!==a?I.from(a):void 0,address:"tx-data"===e.type||"tx-post"===e.type?(0,k.nr)(e.address):void 0,transactionId:"tx-post"===e.type?(0,k.nr)(e.transactionId):void 0});if(!c)throw Error("hub error");return{searchParams:new URLSearchParams({postType:"tx-post"===e.type?"post":t.action,postUrl:null!=l?l:""}),body:{untrustedData:{fid:r.fid,url:o,messageHash:"0x".concat(I.from(c.hash).toString("hex")),timestamp:new Date().getTime(),network:1,buttonIndex:Number(c.data.frameActionBody.buttonIndex),castId:{fid:s.castId.fid,hash:s.castId.hash},inputText:a,state:i,address:"tx-data"===e.type||"tx-post"===e.type?e.address:void 0,transactionId:"tx-post"===e.type?e.transactionId:void 0},trustedData:{messageBytes:d}}}};async function P(e,t){let{fid:r,state:n,url:a}=t,s=new R.vJz(I.from(e.slice(2),"hex")),i={fid:r,network:R.ddA.MAINNET},o=await (0,R.uFe)(R.so9.create({url:I.from(a),buttonIndex:1,state:I.from(encodeURIComponent(JSON.stringify({cast:n})))}),i,s);if(o.isErr())throw o.error;return{message:o.value,trustedBytes:I.from(R.v0C.encode(o._unsafeUnwrap()).finish()).toString("hex")}}async function U(e,t){let{fid:r,castId:n,postUrl:a}=t,s=new R.vJz(I.from(e.slice(2),"hex")),i={fid:r,network:R.ddA.MAINNET},o=await (0,R.uFe)(R.so9.create({url:I.from(a),buttonIndex:1,castId:{fid:n.fid,hash:(0,k.nr)(n.hash)}}),i,s);if(o.isErr())throw o.error;return{message:o.value,trustedBytes:I.from(R.v0C.encode(o._unsafeUnwrap()).finish()).toString("hex")}}async function F(e,t){let{fid:r,url:n,buttonIndex:a,castId:s,inputText:i,state:o,address:l,transactionId:c}=t,d=new R.vJz(I.from(e.slice(2),"hex")),u={fid:r,network:R.ddA.MAINNET},m=await (0,R.uFe)(R.so9.create({url:n,buttonIndex:a,castId:s,state:o,inputText:void 0!==i?I.from(i):void 0,address:l,transactionId:c}),u,d);if(m.isErr())return{message:null,trustedBytes:null};let f=I.from(R.v0C.encode(m._unsafeUnwrap()).finish()).toString("hex");return{message:m.unwrapOr(null),trustedBytes:f}}async function D(e){let{frameButton:t,target:r,frameContext:n,url:a,buttonIndex:s,state:i,inputText:o}=e;return Promise.resolve({searchParams:new URLSearchParams({postType:"tx-post"===e.type?"post":t.action,postUrl:null!=r?r:""}),body:{untrustedData:{url:a,..."castId"in n?{castId:{fid:n.castId.fid,hash:n.castId.hash},network:1,timestamp:(0,R.ppm)()._unsafeUnwrap()}:{timestamp:Date.now()},buttonIndex:s,state:i,inputText:o,address:"tx-data"===e.type||"tx-post"===e.type?e.address:void 0,transactionId:"tx-post"===e.type?e.transactionId:void 0},trustedData:{messageBytes:I.from("").toString("hex")}}})}var L={fid:1,status:"approved",publicKey:"0x00000000000000000000000000000000000000000000000000000000000000000",privateKey:"0x00000000000000000000000000000000000000000000000000000000000000000"},O=Object.defineProperty,z={};function q(e){return("farcaster"===e.specification||"openframes"===e.specification)&&!!e.frame.image&&!!e.frame.buttons&&e.frame.buttons.length>0}function M(e){return"farcaster_v2"===e.specification&&!!e.frame.imageUrl&&!!e.frame.button&&!!e.frame.button.title&&!!e.frame.button.action&&!!e.frame.button.action.url}((e,t)=>{for(var r in t)O(e,r,{get:t[r],enumerable:!0})})(z,{attribution:()=>w,createCastActionMessageWithSignerKey:()=>U,createComposerActionMessageWithSignerKey:()=>P,createFrameActionMessageWithSignerKey:()=>F,mockFarcasterSigner:()=>L,signCastAction:()=>A,signComposerAction:()=>T,signFrameAction:()=>_,unsignedFrameAction:()=>D});var B={buttonBg:"#fff",buttonBorderColor:"#ccc",buttonHoverBg:"#efefef",buttonColor:"#444",buttonRadius:"4",bg:"#efefef"},Z=e=>({...B,...e});function V(e){var t;let r,{frameState:n,theme:a,FrameImage:s,allowPartialFrame:i}=e,[o,l]=(0,f.useState)(!0),c=n.currentFrameStackItem,d=(null==c?void 0:c.status)==="pending"||o,u=Z(null!=a?a:{});if(!n.homeframeUrl||!c||"done"===c.status&&"failure"===c.frameResult.status&&!(i&&(q(t=c.frameResult)||M(t))))return null;if("done"===c.status){if("farcaster_v2"===c.frameResult.specification)return null;r=c.frameResult.frame}else"message"===c.status||"doneRedirect"===c.status?r=c.request.sourceFrame:"requestError"===c.status&&(r="sourceFrame"in c.request?c.request.sourceFrame:void 0);return f.createElement("div",{style:{backgroundColor:u.bg},className:"flex w-full gap-2 rounded p-2 items-center"},f.createElement("div",{className:"relative max-h-[60px] shrink-0",style:{aspectRatio:"1/1"}}," ",!!r&&!!r.image&&f.createElement(s||"img",{src:r.image,key:r.image,alt:"Frame image",width:"100%",style:{filter:d?"blur(4px)":void 0,borderRadius:"".concat(u.buttonRadius,"px"),border:"1px solid ".concat(u.buttonBorderColor),objectFit:"cover",width:"100%",aspectRatio:"1/1"},onLoadStart:()=>{l(!0)},onLoad:()=>{l(!1)},onError:()=>{l(!1)}})),f.createElement("div",{className:"flex flex-col flex-1 justify-center min-w-[0]"},f.createElement("span",{className:"font-semibold block truncate"},null==r?void 0:r.title),f.createElement("span",{className:"text-gray-500 text-xs block truncate"},new URL(c.url).hostname)),r&&r.buttons?f.createElement("div",{className:"flex items-center shrink-0"},f.createElement("button",{type:"button",disabled:d,className:"p-2 ".concat(d?"bg-gray-100":""," border text-sm text-gray-800 rounded"),style:{flex:"1 1 0px",backgroundColor:u.buttonBg,borderColor:u.buttonBorderColor,color:u.buttonColor,cursor:d?void 0:"pointer"}},r.buttons[0]&&r.buttons[0].label.length<12?r.buttons[0].label:"View")):null)}var K="WebStorage: localStorage is not available, consider implementing your own Storage class",H=class{constructor(){this.watchers={},this.get=async e=>{if(this.values.has(e))return Promise.resolve(this.values.get(e));if("undefined"!=typeof localStorage){let t=localStorage.getItem(e);if(!t)return Promise.resolve(void 0);let r=JSON.parse(t);return this.values.set(e,r),Promise.resolve(r)}return console.warn(K),Promise.resolve(void 0)},this.set=async(e,t)=>{let r=t(await this.get(e));if(this.values.set(e,r),this.notifyChange(e,r),"undefined"!=typeof localStorage){localStorage.setItem(e,JSON.stringify(r));return}console.warn(K)},this.delete=e=>((this.values.delete(e),this.notifyChange(e,void 0),"undefined"!=typeof localStorage)?localStorage.removeItem(e):console.warn(K),Promise.resolve()),this.watch=(e,t)=>{var r,n,a;return null!==(a=(n=this.watchers)[e])&&void 0!==a||(n[e]=[]),null===(r=this.watchers[e])||void 0===r||r.push(t),this.get(e).then(e=>{t(e)}).catch(e=>{console.error("@frames.js/render: Failed to get value from storage: ".concat(e))}),()=>{let r=this.watchers[e];r&&(this.watchers[e]=r.filter(e=>e!==t))}},this.notifyChange=(e,t)=>{var r;null===(r=this.watchers[e])||void 0===r||r.forEach(e=>{e(t)})},this.values=new Map,this.watchers={}}},W=new H;function Y(e){return function(t){let{fallbackContext:r,storage:n=W,storageKey:a=e.storageKey}=t,s=(0,f.useRef)(n),[i,o]=(0,f.useState)(null);(0,f.useEffect)(()=>{s.current.get(a).then(e=>{e&&o(e)}).catch(e=>{console.error("@frames.js/render: Could not load frame context from storage",e)})},[a]);let l=(0,f.useCallback)(async e=>{await s.current.set(a,()=>e),o(e)},[a]),c=(0,f.useCallback)(async()=>{await s.current.delete(a),o(null)},[a]);return(0,f.useMemo)(()=>({frameContext:i||r,setFrameContext:l,resetFrameContext:c}),[r,i,l,c])}}var G=Y({storageKey:"farcasterFrameContext"}),J={castId:{fid:1,hash:"0x0000000000000000000000000000000000000000"}},X={buttonBg:"#fff",buttonBorderColor:"#ccc",buttonColor:"#444"},{attribution:Q,...$}=z,ee=r(96473),et=r(47907),er=r(66e3),en=r(88810),ea=JSON.parse('{"u2":"@frames.js/debugger","i8":"0.5.0"}'),es=r(56363),ei=null;try{ei=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function eo(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function el(e){return!0===(e&&e.__isLong__)}function ec(e){var t=Math.clz32(e&-e);return e?31-t:t}eo.prototype.__isLong__,Object.defineProperty(eo.prototype,"__isLong__",{value:!0}),eo.isLong=el;var ed={},eu={};function em(e,t){var r,n,a;return t?(e>>>=0,(a=0<=e&&e<256)&&(n=eu[e]))?n:(r=ep(e,0,!0),a&&(eu[e]=r),r):(e|=0,(a=-128<=e&&e<128)&&(n=ed[e]))?n:(r=ep(e,e<0?-1:0,!1),a&&(ed[e]=r),r)}function ef(e,t){if(isNaN(e))return t?eN:ej;if(t){if(e<0)return eN;if(e>=ey)return ek}else{if(e<=-eb)return eI;if(e+1>=eb)return eC}return e<0?ef(-e,t).neg():ep(e%ev|0,e/ev|0,t)}function ep(e,t,r){return new eo(e,t,r)}eo.fromInt=em,eo.fromNumber=ef,eo.fromBits=ep;var eh=Math.pow;function eg(e,t,r){if(0===e.length)throw Error("empty string");if("number"==typeof t?(r=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?eN:ej;if((r=r||10)<2||36<r)throw RangeError("radix");if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return eg(e.substring(1),t,r).neg();for(var n,a=ef(eh(r,8)),s=ej,i=0;i<e.length;i+=8){var o=Math.min(8,e.length-i),l=parseInt(e.substring(i,i+o),r);if(o<8){var c=ef(eh(r,o));s=s.mul(c).add(ef(l))}else s=(s=s.mul(a)).add(ef(l))}return s.unsigned=t,s}function ex(e,t){return"number"==typeof e?ef(e,t):"string"==typeof e?eg(e,t):ep(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}eo.fromString=eg,eo.fromValue=ex;var ev=4294967296,ey=18446744073709552e3,eb=0x7fffffffffffffff,ew=em(16777216),ej=em(0);eo.ZERO=ej;var eN=em(0,!0);eo.UZERO=eN;var eE=em(1);eo.ONE=eE;var eS=em(1,!0);eo.UONE=eS;var eR=em(-1);eo.NEG_ONE=eR;var eC=ep(-1,2147483647,!1);eo.MAX_VALUE=eC;var ek=ep(-1,-1,!0);eo.MAX_UNSIGNED_VALUE=ek;var eI=ep(0,-2147483648,!1);eo.MIN_VALUE=eI;var eT=eo.prototype;eT.toInt=function(){return this.unsigned?this.low>>>0:this.low},eT.toNumber=function(){return this.unsigned?(this.high>>>0)*ev+(this.low>>>0):this.high*ev+(this.low>>>0)},eT.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(!this.eq(eI))return"-"+this.neg().toString(e);var t=ef(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}for(var a=ef(eh(e,6),this.unsigned),s=this,i="";;){var o=s.div(a),l=(s.sub(o.mul(a)).toInt()>>>0).toString(e);if((s=o).isZero())return l+i;for(;l.length<6;)l="0"+l;i=""+l+i}},eT.getHighBits=function(){return this.high},eT.getHighBitsUnsigned=function(){return this.high>>>0},eT.getLowBits=function(){return this.low},eT.getLowBitsUnsigned=function(){return this.low>>>0},eT.getNumBitsAbs=function(){if(this.isNegative())return this.eq(eI)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&(e&1<<t)==0;t--);return 0!=this.high?t+33:t+1},eT.isZero=function(){return 0===this.high&&0===this.low},eT.eqz=eT.isZero,eT.isNegative=function(){return!this.unsigned&&this.high<0},eT.isPositive=function(){return this.unsigned||this.high>=0},eT.isOdd=function(){return(1&this.low)==1},eT.isEven=function(){return(1&this.low)==0},eT.equals=function(e){return el(e)||(e=ex(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},eT.eq=eT.equals,eT.notEquals=function(e){return!this.eq(e)},eT.neq=eT.notEquals,eT.ne=eT.notEquals,eT.lessThan=function(e){return 0>this.comp(e)},eT.lt=eT.lessThan,eT.lessThanOrEqual=function(e){return 0>=this.comp(e)},eT.lte=eT.lessThanOrEqual,eT.le=eT.lessThanOrEqual,eT.greaterThan=function(e){return this.comp(e)>0},eT.gt=eT.greaterThan,eT.greaterThanOrEqual=function(e){return this.comp(e)>=0},eT.gte=eT.greaterThanOrEqual,eT.ge=eT.greaterThanOrEqual,eT.compare=function(e){if(el(e)||(e=ex(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},eT.comp=eT.compare,eT.negate=function(){return!this.unsigned&&this.eq(eI)?eI:this.not().add(eE)},eT.neg=eT.negate,eT.add=function(e){el(e)||(e=ex(e));var t,r,n=this.high>>>16,a=65535&this.high,s=this.low>>>16,i=65535&this.low,o=e.high>>>16,l=65535&e.high,c=e.low>>>16,d=65535&e.low,u=0,m=0;return t=0+((r=0+(i+d))>>>16),r&=65535,t+=s+c,m+=t>>>16,t&=65535,m+=a+l,u+=m>>>16,m&=65535,u+=n+o,ep(t<<16|r,(u&=65535)<<16|m,this.unsigned)},eT.subtract=function(e){return el(e)||(e=ex(e)),this.add(e.neg())},eT.sub=eT.subtract,eT.multiply=function(e){if(this.isZero())return this;if(el(e)||(e=ex(e)),ei)return ep(ei.mul(this.low,this.high,e.low,e.high),ei.get_high(),this.unsigned);if(e.isZero())return this.unsigned?eN:ej;if(this.eq(eI))return e.isOdd()?eI:ej;if(e.eq(eI))return this.isOdd()?eI:ej;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(ew)&&e.lt(ew))return ef(this.toNumber()*e.toNumber(),this.unsigned);var t,r,n=this.high>>>16,a=65535&this.high,s=this.low>>>16,i=65535&this.low,o=e.high>>>16,l=65535&e.high,c=e.low>>>16,d=65535&e.low,u=0,m=0;return t=0+((r=0+i*d)>>>16),r&=65535,t+=s*d,m+=t>>>16,t&=65535,t+=i*c,m+=t>>>16,t&=65535,m+=a*d,u+=m>>>16,m&=65535,m+=s*c,u+=m>>>16,m&=65535,m+=i*l,u+=m>>>16,m&=65535,u+=n*d+a*c+s*l+i*o,ep(t<<16|r,(u&=65535)<<16|m,this.unsigned)},eT.mul=eT.multiply,eT.divide=function(e){if(el(e)||(e=ex(e)),e.isZero())throw Error("division by zero");if(ei){var t,r,n;return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?ep((this.unsigned?ei.div_u:ei.div_s)(this.low,this.high,e.low,e.high),ei.get_high(),this.unsigned):this}if(this.isZero())return this.unsigned?eN:ej;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return eN;if(e.gt(this.shru(1)))return eS;n=eN}else{if(this.eq(eI))return e.eq(eE)||e.eq(eR)?eI:e.eq(eI)?eE:(t=this.shr(1).div(e).shl(1)).eq(ej)?e.isNegative()?eE:eR:(r=this.sub(e.mul(t)),n=t.add(r.div(e)));if(e.eq(eI))return this.unsigned?eN:ej;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();n=ej}for(r=this;r.gte(e);){for(var a=Math.ceil(Math.log(t=Math.max(1,Math.floor(r.toNumber()/e.toNumber())))/Math.LN2),s=a<=48?1:eh(2,a-48),i=ef(t),o=i.mul(e);o.isNegative()||o.gt(r);)t-=s,o=(i=ef(t,this.unsigned)).mul(e);i.isZero()&&(i=eE),n=n.add(i),r=r.sub(o)}return n},eT.div=eT.divide,eT.modulo=function(e){return(el(e)||(e=ex(e)),ei)?ep((this.unsigned?ei.rem_u:ei.rem_s)(this.low,this.high,e.low,e.high),ei.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},eT.mod=eT.modulo,eT.rem=eT.modulo,eT.not=function(){return ep(~this.low,~this.high,this.unsigned)},eT.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},eT.clz=eT.countLeadingZeros,eT.countTrailingZeros=function(){return this.low?ec(this.low):ec(this.high)+32},eT.ctz=eT.countTrailingZeros,eT.and=function(e){return el(e)||(e=ex(e)),ep(this.low&e.low,this.high&e.high,this.unsigned)},eT.or=function(e){return el(e)||(e=ex(e)),ep(this.low|e.low,this.high|e.high,this.unsigned)},eT.xor=function(e){return el(e)||(e=ex(e)),ep(this.low^e.low,this.high^e.high,this.unsigned)},eT.shiftLeft=function(e){return(el(e)&&(e=e.toInt()),0==(e&=63))?this:e<32?ep(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):ep(0,this.low<<e-32,this.unsigned)},eT.shl=eT.shiftLeft,eT.shiftRight=function(e){return(el(e)&&(e=e.toInt()),0==(e&=63))?this:e<32?ep(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):ep(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},eT.shr=eT.shiftRight,eT.shiftRightUnsigned=function(e){return(el(e)&&(e=e.toInt()),0==(e&=63))?this:e<32?ep(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):32===e?ep(this.high,0,this.unsigned):ep(this.high>>>e-32,0,this.unsigned)},eT.shru=eT.shiftRightUnsigned,eT.shr_u=eT.shiftRightUnsigned,eT.rotateLeft=function(e){var t;return(el(e)&&(e=e.toInt()),0==(e&=63))?this:32===e?ep(this.high,this.low,this.unsigned):e<32?(t=32-e,ep(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(e-=32,t=32-e,ep(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},eT.rotl=eT.rotateLeft,eT.rotateRight=function(e){var t;return(el(e)&&(e=e.toInt()),0==(e&=63))?this:32===e?ep(this.high,this.low,this.unsigned):e<32?(t=32-e,ep(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(e-=32,t=32-e,ep(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},eT.rotr=eT.rotateRight,eT.toSigned=function(){return this.unsigned?ep(this.low,this.high,!1):this},eT.toUnsigned=function(){return this.unsigned?this:ep(this.low,this.high,!0)},eT.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},eT.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},eT.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},eo.fromBytes=function(e,t,r){return r?eo.fromBytesLE(e,t):eo.fromBytesBE(e,t)},eo.fromBytesLE=function(e,t){return new eo(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},eo.fromBytesBE=function(e,t){return new eo(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};var eA=((n=eA||{})[n.USERNAME_TYPE_NONE=0]="USERNAME_TYPE_NONE",n[n.USERNAME_TYPE_FNAME=1]="USERNAME_TYPE_FNAME",n[n.USERNAME_TYPE_ENS_L1=2]="USERNAME_TYPE_ENS_L1",n);function e_(){return{timestamp:0,name:new Uint8Array,owner:new Uint8Array,signature:new Uint8Array,fid:0,type:0}}var eP="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:window;function eU(e){if(eP.Buffer)return Uint8Array.from(eP.Buffer.from(e,"base64"));{let t=eP.atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;++e)r[e]=t.charCodeAt(e);return r}}function eF(e){if(eP.Buffer)return eP.Buffer.from(e).toString("base64");{let t=[];return e.forEach(e=>{t.push(String.fromCharCode(e))}),eP.btoa(t.join(""))}}function eD(e){if(e.gt(Number.MAX_SAFE_INTEGER))throw new eP.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}function eL(e){return null!=e}/*! Bundled license information:
long/index.js:
(**
* @license
* Copyright 2009 The Closure Library Authors
* Copyright 2020 Daniel Wirtz / The long.js Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*)
*/es.util.Long!==eo&&(es.util.Long=eo,es.configure());var eO=((a=eO||{})[a.NONE=0]="NONE",a[a.BLAKE3=1]="BLAKE3",a),ez=((s=ez||{})[s.NONE=0]="NONE",s[s.ED25519=1]="ED25519",s[s.EIP712=2]="EIP712",s),eq=((i=eq||{})[i.NONE=0]="NONE",i[i.CAST_ADD=1]="CAST_ADD",i[i.CAST_REMOVE=2]="CAST_REMOVE",i[i.REACTION_ADD=3]="REACTION_ADD",i[i.REACTION_REMOVE=4]="REACTION_REMOVE",i[i.LINK_ADD=5]="LINK_ADD",i[i.LINK_REMOVE=6]="LINK_REMOVE",i[i.VERIFICATION_ADD_ETH_ADDRESS=7]="VERIFICATION_ADD_ETH_ADDRESS",i[i.VERIFICATION_REMOVE=8]="VERIFICATION_REMOVE",i[i.USER_DATA_ADD=11]="USER_DATA_ADD",i[i.USERNAME_PROOF=12]="USERNAME_PROOF",i[i.FRAME_ACTION=13]="FRAME_ACTION",i[i.LINK_COMPACT_STATE=14]="LINK_COMPACT_STATE",i),eM=((o=eM||{})[o.NONE=0]="NONE",o[o.MAINNET=1]="MAINNET",o[o.TESTNET=2]="TESTNET",o[o.DEVNET=3]="DEVNET",o),eB=((l=eB||{})[l.NONE=0]="NONE",l[l.PFP=1]="PFP",l[l.DISPLAY=2]="DISPLAY",l[l.BIO=3]="BIO",l[l.URL=5]="URL",l[l.USERNAME=6]="USERNAME",l[l.LOCATION=7]="LOCATION",l[l.TWITTER=8]="TWITTER",l[l.GITHUB=9]="GITHUB",l),eZ=((c=eZ||{})[c.CAST=0]="CAST",c[c.LONG_CAST=1]="LONG_CAST",c),eV=((d=eV||{})[d.NONE=0]="NONE",d[d.LIKE=1]="LIKE",d[d.RECAST=2]="RECAST",d),eK=((u=eK||{})[u.ETHEREUM=0]="ETHEREUM",u[u.SOLANA=1]="SOLANA",u);function eH(e){switch(e){case 0:case"PROTOCOL_ETHEREUM":return 0;case 1:case"PROTOCOL_SOLANA":return 1;default:throw new e7.Error("Unrecognized enum value "+e+" for enum Protocol")}}function eW(e){switch(e){case 0:return"PROTOCOL_ETHEREUM";case 1:return"PROTOCOL_SOLANA";default:throw new e7.Error("Unrecognized enum value "+e+" for enum Protocol")}}function eY(){return{type:0,value:""}}function eG(){return{url:void 0,castId:void 0}}var eJ={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:es.Writer.create();return void 0!==e.url&&t.uint32(10).string(e.url),void 0!==e.castId&&e0.encode(e.castId,t.uint32(18).fork()).ldelim(),t},decode(e,t){let r=e instanceof es.Reader?e:es.Reader.create(e),n=void 0===t?r.len:r.pos+t,a=eG();for(;r.pos<n;){let e=r.uint32();switch(e>>>3){case 1:if(10!=e)break;a.url=r.string();continue;case 2:if(18!=e)break;a.castId=e0.decode(r,r.uint32());continue}if((7&e)==4||0==e)break;r.skipType(7&e)}return a},fromJSON:e=>({url:tt(e.url)?String(e.url):void 0,castId:tt(e.castId)?e0.fromJSON(e.castId):void 0}),toJSON(e){let t={};return void 0!==e.url&&(t.url=e.url),void 0!==e.castId&&(t.castId=e.castId?e0.toJSON(e.castId):void 0),t},create:e=>eJ.fromPartial(null!=e?e:{}),fromPartial(e){var t;let r=eG();return r.url=null!==(t=e.url)&&void 0!==t?t:void 0,r.castId=void 0!==e.castId&&null!==e.castId?e0.fromPartial(e.castId):void 0,r}};function eX(){return{embedsDeprecated:[],mentions:[],parentCastId:void 0,parentUrl:void 0,text:"",mentionsPositions:[],embeds:[],type:0}}function eQ(){return{targetHash:new Uint8Array}}function e$(){return{fid:0,hash:new Uint8Array}}var e0={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:es.Writer.create();return 0!==e.fid&&t.uint32(8).uint64(e.fid),0!==e.hash.length&&t.uint32(18).bytes(e.hash),t},decode(e,t){let r=e instanceof es.Reader?e:es.Reader.create(e),n=void 0===t?r.len:r.pos+t,a=e$();for(;r.pos<n;){let e=r.uint32();switch(e>>>3){case 1:if(8!=e)break;a.fid=te(r.uint64());continue;case 2:if(18!=e)break;a.hash=r.bytes();continue}if((7&e)==4||0==e)break;r.skipType(7&e)}return a},fromJSON:e=>({fid:tt(e.fid)?Number(e.fid):0,hash:tt(e.hash)?e8(e.hash):new Uint8Array}),toJSON(e){let t={};return void 0!==e.fid&&(t.fid=Math.round(e.fid)),void 0!==e.hash&&(t.hash=e9(void 0!==e.hash?e.hash:new Uint8Array)),t},create:e=>e0.fromPartial(null!=e?e:{}),fromPartial(e){var t,r;let n=e$();return n.fid=null!==(t=e.fid)&&void 0!==t?t:0,n.hash=null!==(r=e.hash)&&void 0!==r?r:new Uint8Array,n}};function e1(){return{type:0,targetCastId:void 0,targetUrl:void 0}}function e2(){return{address:new Uint8Array,claimSignature:new Uint8Array,blockHash:new Uint8Array,verificationType:0,chainId:0,protocol:0}}function e3(){return{address:new Uint8Array,protocol:0}}function e5(){return{type:"",displayTimestamp:void 0,targetFid:void 0}}function e4(){return{type:"",targetFids:[]}}function e6(){return{url:new Uint8Array,buttonIndex:0,castId:void 0,inputText:new Uint8Array,state:new Uint8Array,transactionId:new Uint8Array,address:new Uint8Array}}var e7="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:window;function e8(e){if(e7.Buffer)return Uint8Array.from(e7.Buffer.from(e,"base64"));{let t=e7.atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;++e)r[e]=t.charCodeAt(e);return r}}function e9(e){if(e7.Buffer)return e7.Buffer.from(e).toString("base64");{let t=[];return e.forEach(e=>{t.push(String.fromCharCode(e))}),e7.btoa(t.join(""))}}function te(e){if(e.gt(Number.MAX_SAFE_INTEGER))throw new e7.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}function tt(e){return null!=e}function tr(e){return e.replace(/["'<>]/g,e=>{switch(e){case'"':return""";case"'":return"'";case"<":return"<";case">":return">";default:return e}})}function tn(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}es.util.Long!==eo&&(es.util.Long=eo,es.configure()),r(73860).Buffer,r(73860).Buffer;var ta=r(23237);r(68571),r(73860).Buffer,ta.z.object({events:ta.z.array(ta.z.object({signerEventBody:ta.z.object({key:ta.z.string(),metadata:ta.z.string()})}))});var ts=r(59320),ti=r(550);ti.UG.sha512Sync||(ti.UG.sha512Sync=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,ts.o)(ti.UG.concatBytes(...t))});var to=r(23979),tl=r(73860).Buffer;async function tc(e){var t,r,n;let a;let s=(t=e.fid,r=e.signer,tn(tl.from(JSON.stringify({fid:t,type:r.type,key:"custody"===r.type?r.custodyAddress:r.appKey}),"utf-8"))),i=(n=e.payload,tn(tl.from(JSON.stringify(n),"utf-8"))),o=await e.signMessage("".concat(s,".").concat(i));return a="app_key"===e.signer.type?tn(tl.from((0,to.nr)(o))):tn(tl.from(o,"utf-8")),{compact:"".concat(s,".").concat(i,".").concat(a),json:{header:s,payload:i,signature:a}}}r(20778),r(39919);var td="0.21.3";function tu(e,t){var r,n;let a=e.accepts&&e.accepts.length?{"of:version":e.version,...e.accepts.reduce((e,t)=>{let{id:r,version:n}=t;return e["of:accepts:".concat(r)]=n,e},{}),"of:image":e.image,"og:image":e.ogImage||e.image,"og:title":e.title,"of:post_url":e.postUrl,"of:input:text":e.inputText,...e.state?{"of:state":e.state}:{},...e.imageAspectRatio?{"of:image:aspect_ratio":e.imageAspectRatio}:{},...null===(r=e.buttons)||void 0===r?void 0:r.reduce((e,t,r)=>({...e,["of:button:".concat(r+1)]:t.label,["of:button:".concat(r+1,":action")]:t.action,["of:button:".concat(r+1,":target")]:t.target,..."tx"===t.action||"post"===t.action||"post_redirect"===t.action?{["of:button:".concat(r+1,":post_url")]:t.post_url}:{}}),{})}:{};return{"fc:frame":e.version,"fc:frame:image":e.image,"og:image":e.ogImage||e.image,"og:title":e.title,"fc:frame:post_url":e.postUrl,"fc:frame:input:text":e.inputText,...e.title?{"og:title":e.title}:{},...e.state?{"fc:frame:state":e.state}:{},...e.imageAspectRatio?{"fc:frame:image:aspect_ratio":e.imageAspectRatio}:{},...null===(n=e.buttons)||void 0===n?void 0:n.reduce((e,t,r)=>({...e,["fc:frame:button:".concat(r+1)]:t.label,["fc:frame:button:".concat(r+1,":action")]:t.action,["fc:frame:button:".concat(r+1,":target")]:t.target,..."tx"===t.action||"post"===t.action||"post_redirect"===t.action?{["fc:frame:button:".concat(r+1,":post_url")]:t.post_url}:{}}),{}),...a,"frames.js:version":td,...t}}function tm(e,t){return{"fc:frame":JSON.stringify(e),"frames.js:version":td,...t}}function tf(e,t){let r=Object.entries(tu(e,t)).map(e=>{let[t,r]=e;return r?'<meta name="'.concat(t,'" content="').concat(tr(r),'"/>'):null}).filter(Boolean);return e.title&&r.push("<title>".concat(tr(e.title),"</title>")),r.join("")}function tp(e,t){return Object.entries(tm(e,t)).map(e=>{let[t,r]=e;return r?'<meta name="'.concat(t,'" content="').concat(tr(r),'"/>'):null}).filter(Boolean).join("")}r(73860).Buffer;var th=class extends Error{constructor(e){super("Malformed transaction target data from the server"),this.response=e}},tg=class extends Error{constructor(e){super("Non OK transaction data response from the server"),this.response=e}},tx=class extends Error{constructor(){super("onTransaction() handler did not return a transaction id")}},tv=class extends Error{constructor(){super("onSignature() handler did not return a transaction id")}},ty=class extends Error{constructor(){super("Unexpected cast action response from the server")}},tb=class extends Error{constructor(){super("Unexpected composer action response from the server")}},tw=class extends Error{constructor(){super("User rejected the request")}};function tj(e){console.error(e)}function tN(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];let a="temporary-for-parsing-purposes.tld",s=new URL(e,"http://".concat(a));return r.forEach(e=>{e.forEach((e,t)=>{s.searchParams.set(t,e)})}),s.hostname===a?"".concat(s.pathname).concat(s.search):s.toString()}async function tE(e){let t=new URLSearchParams({multispecification:"true"});if("frameAction"in e){let r=tN(e.proxyUrl,t,e.frameAction.searchParams);return j(()=>e.fetchFn(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e.extraRequestPayload,...e.frameAction.body})}))}e.parseFarcasterManifest&&t.set("parseFarcasterManifest","true"),t.set("url",e.url);let r=tN(e.proxyUrl,t);return j(()=>e.fetchFn(r,{method:"GET",signal:e.signal}))}async function tS(e){let{request:t,signerState:r}=e,{address:n,...a}=t.signerStateActionContext.frameContext;return j(()=>r.signFrameAction({...t.signerStateActionContext,frameContext:a}))}function tR(e){let t=(0,f.useRef)(e);return t.current=e,t}function tC(e,t){let r;let n=Array.isArray(t)?t:[t];if(0===n.length)throw Error("Signer does not have any specification defined");for(let t of n){if("success"===e[t].status){r=e[t];break}r||(r=e[t])}if(!r)throw Error("No frame for the given specification");return r}function tk(e){let{initialParseResult:t,initialFrameUrl:r,initialPendingExtra:n,resolveSpecification:a,resolveGETPendingExtra:s,resolvePOSTPendingExtra:i,resolveDoneExtra:o,resolveDoneRedirectExtra:l,resolveDoneWithErrorMessageExtra:c,resolveFailedExtra:d,resolveFailedWithRequestErrorExtra:u}=e,m=(0,f.useRef)(0),p=tR(a),h=tR(s),g=tR(i),x=tR(o),v=tR(l),y=tR(c),b=tR(d),w=tR(u),j=(0,f.useRef)(function(e,t){switch(t.action){case"LOAD":return{...e,stack:[t.item,...e.stack]};case"DONE_REDIRECT":{let r=e.stack.findIndex(e=>e.id===t.pendingItem.id);if(-1===r)return e;return e.stack[r]={...t.pendingItem,...t.item,status:"doneRedirect"},{...e,stack:e.stack.slice()}}case"DONE_WITH_ERROR_MESSAGE":{let r=e.stack.findIndex(e=>e.id===t.pendingItem.id);if(-1===r)return e;return e.stack[r]={...t.pendingItem,...t.item},{...e,stack:e.stack.slice()}}case"DONE":{let r,n,a,s;let i=e.stack.findIndex(e=>e.id===t.pendingItem.id);if(-1===i)return e;let o=t.parseResult;if("not-initialized"===e.type){let e=p.current({parseResult:t.parseResult});({signerState:r,frameContext:a={}}=e),s=t.pendingItem.url,n=r.specification}else({signerState:r,specification:n,frameContext:a,homeframeUrl:s,parseResult:o}=e);let l=tC(t.parseResult,n);return e.stack[i]={...t.pendingItem,status:"done",frameResult:l,extra:t.extra},{...e,parseResult:o,signerState:r,frameContext:a,homeframeUrl:s,specification:l.specification,type:"initialized",stack:e.stack.slice()}}case"REQUEST_ERROR":{let r=e.stack.findIndex(e=>e.id===t.pendingItem.id);if(-1===r)return e;return e.stack[r]=t.item,{...e,stack:e.stack.slice()}}case"RESET":{if("not-initialized"===e.type)return e;let{frameContext:t={},signerState:r}=p.current({parseResult:e.parseResult}),n=tC(e.parseResult,r.specification),a=e.stack[0];return(null==a?void 0:a.status)==="done"&&(a.frameResult=n),{...e,stack:a?[{...a}]:[],type:"initialized",frameContext:t,signerState:r,specification:n.specification}}case"RESET_INITIAL_FRAME":{let{frameContext:e={},signerState:r}=p.current({parseResult:t.parseResult}),n=tC(t.parseResult,r.specification);return{type:"initialized",signerState:r,frameContext:e,specification:n.specification,homeframeUrl:t.homeframeUrl,parseResult:t.parseResult,stack:[{request:{method:"GET",url:t.homeframeUrl},url:t.homeframeUrl,id:Date.now(),frameResult:n,status:"done",extra:t.extra}]}}case"CLEAR":return{type:"not-initialized",stack:[]};default:return e}}),N=tR(n),[E,S]=(0,f.useReducer)(j.current,[t,r,n],e=>{let[t,r,n]=e;if(t&&r){let{frameContext:e={},signerState:s}=a({parseResult:t}),i=tC(t,s.specification);return{type:"initialized",frameContext:e,signerState:s,specification:i.specification,homeframeUrl:r,parseResult:t,stack:[{id:m.current++,request:{method:"GET",url:r},frameResult:i,status:"done",url:r,extra:null!=n?n:{}}]}}return{type:"not-initialized",stack:r?[{id:m.current++,method:"GET",request:{method:"GET",url:r},url:r,status:"pending",extra:null!=n?n:{}}]:[]}});return[E,(0,f.useMemo)(()=>({dispatch:S,clear(){S({action:"CLEAR"})},createGetPendingItem(e){var t,r;let n={id:m.current++,method:"GET",request:e.request,url:e.request.url,status:"pending",extra:null!==(r=null===(t=h.current)||void 0===t?void 0:t.call(h,e))&&void 0!==r?r:{}};return S({action:"LOAD",item:n}),n},createPostPendingItem(e){var t,r,n;let a={id:m.current++,method:"POST",request:e.request,url:null!==(r=e.action.searchParams.get("postUrl"))&&void 0!==r?r:"missing postUrl",status:"pending",extra:null!==(n=null===(t=g.current)||void 0===t?void 0:t.call(g,e))&&void 0!==n?n:{}};return S({action:"LOAD",item:a}),a},markAsDone(e){var t,r;S({action:"DONE",pendingItem:e.pendingItem,parseResult:e.parseResult,extra:null!==(r=null===(t=x.current)||void 0===t?void 0:t.call(x,e))&&void 0!==r?r:{}})},markAsDoneWithErrorMessage(e){var t,r;S({action:"DONE_WITH_ERROR_MESSAGE",pendingItem:e.pendingItem,item:{...e.pendingItem,status:"message",type:"error",message:e.responseData.message,extra:null!==(r=null===(t=y.current)||void 0===t?void 0:t.call(y,e))&&void 0!==r?r:{}}})},markAsDoneWithRedirect(e){var t,r;S({action:"DONE_REDIRECT",pendingItem:e.pendingItem,item:{...e.pendingItem,location:e.location,status:"doneRedirect",extra:null!==(r=null===(t=v.current)||void 0===t?void 0:t.call(v,e))&&void 0!==r?r:{}}})},markAsFailed(e){var t,r;S({action:"REQUEST_ERROR",pendingItem:e.pendingItem,item:{request:e.pendingItem.request,id:e.pendingItem.id,url:e.pendingItem.url,requestError:e.requestError,status:"requestError",extra:null!==(r=null===(t=b.current)||void 0===t?void 0:t.call(b,e))&&void 0!==r?r:{}}})},markAsFailedWithRequestError(e){var t,r;S({action:"REQUEST_ERROR",pendingItem:e.pendingItem,item:{...e.pendingItem,status:"requestError",requestError:e.error,extra:null!==(r=null===(t=w.current)||void 0===t?void 0:t.call(w,e))&&void 0!==r?r:{}}})},reset(e){if(e){var t;S({action:"RESET_INITIAL_FRAME",homeframeUrl:e.homeframeUrl,parseResult:e.parseResult,extra:null!==(t=N.current)&&void 0!==t?t:{}})}else S({action:"RESET"})}}),[N,x,v,y,b,w,h,g])]}function tI(e){console.error("@frames.js/render",e)}function tT(e){let{target:t}=e;console.log("Please provide your own onMint function to useFrame() hook."),window.alert("Mint requested: ".concat(t))}function tA(){throw Error("Please implement this function in order to use transactions")}async function t_(e){let{transactionData:t}=e;console.log("Please provide your own onTransaction function to useFrame() hook.");let r="Requesting a transaction on chain with ID ".concat(t.chainId," with the following params: ").concat(JSON.stringify(t.params,null,2));return window.alert(r),null}async function tP(e){let{signatureData:t}=e;console.log("Please provide your own onSignature function to useFrame() hook.");let r="Requesting a signature on chain with ID ".concat(t.chainId," with the following params: ").concat(JSON.stringify(t.params,null,2));return window.alert(r),null}function tU(e){console.log("Please provide your own onRedirect function to useFetchFrame() hook.");let t="You are about to be redirected to ".concat(e.toString());if(window.confirm(t)){var r;null===(r=window.open(e,"_blank"))||void 0===r||r.focus()}}function tF(e){console.log("Please provide your own onLinkButtonClick function to useFrame() hook."),window.confirm("You are about to be redirected to ".concat(e.target))&&parent.window.open(e.target,"_blank")}function tD(e){let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw Error("Redirect location ".concat(t.toString()," is not a valid HTTP or HTTPS URL."));return!0}function tL(e,t){return fetch(e,t)}function tO(e){let{frameStateHook:t=tk,homeframeUrl:r,onMint:n=tT,onTransaction:a=t_,transactionDataSuffix:s,onSignature:i=tP,resolveAddress:o=tA,frame:l,frameActionProxy:c,frameGetProxy:d,parseFarcasterManifest:u=!1,extraButtonRequestPayload:m,resolveSigner:p,onError:h=tI,onLinkButtonClick:g=tF,onRedirect:x=tU,fetchFn:v=tL,onLaunchFrameButtonPressed:y,onTransactionDataError:b,onTransactionDataStart:w,onTransactionDataSuccess:S,onTransactionError:R,onTransactionStart:C,onTransactionSuccess:I,onSignatureError:T,onSignatureStart:A,onSignatureSuccess:_,onTransactionProcessingError:P,onTransactionProcessingStart:U,onTransactionProcessingSuccess:F,onMissingSigner:D}=e,[L,O]=(0,f.useState)(""),z=tR(L),[q,M]=t({resolveSpecification:p,initialFrameUrl:r,initialParseResult:l}),B=tR(q),{clear:Z,dispatch:V,reset:K}=M,H=function(e){let{frameStateAPI:t,frameState:r,frameActionProxy:n,frameGetProxy:a,extraButtonRequestPayload:s,parseFarcasterManifest:i=!1,onTransaction:o,transactionDataSuffix:l,onSignature:c,onError:d=tj,fetchFn:u,onRedirect:m,onTransactionDataError:f,onTransactionDataStart:p,onTransactionDataSuccess:h,onTransactionError:g,onTransactionStart:x,onTransactionSuccess:v,onSignatureError:y,onSignatureStart:b,onSignatureSuccess:w,onTransactionProcessingError:S,onTransactionProcessingStart:R,onTransactionProcessingSuccess:C}=e;async function I(e){var r,n;let{response:a,endTime:s,frameStackPendingItem:i,onError:o}=e;if(a.ok)throw TypeError("handleFailedResponse called with a successful response");let l=await ((null===(r=a.headers.get("content-type"))||void 0===r?void 0:r.includes("/json"))?a.clone().json():a.clone().text());if(a.status>=400&&a.status<500&&"POST"===i.method&&"object"==typeof(n=l)&&null!==n&&"message"in n&&"string"==typeof n.message){t.markAsDoneWithErrorMessage({pendingItem:i,endTime:s,response:a,responseData:l});let e=Error(l.message);N(()=>{d(e)}),N(()=>null==o?void 0:o(e));return}let c=Error("The server returned an error but it does not contain message property. Status code: ".concat(a.status));t.markAsFailed({endTime:s,pendingItem:i,requestError:c,responseStatus:a.status,response:a,responseBody:l}),N(()=>{d(c)}),N(()=>null==o?void 0:o(c))}async function T(e,r){r&&t.clear();let n=t.createGetPendingItem({request:e}),s=await tE({proxyUrl:a,fetchFn:u,url:e.url,parseFarcasterManifest:i}),o=new Date;if(s instanceof Response){if(!s.ok){await I({response:s,endTime:o,frameStackPendingItem:n});return}let e=await j(()=>s.clone().json());if(e instanceof Error){t.markAsFailed({pendingItem:n,endTime:o,requestError:e,response:s,responseBody:"none",responseStatus:500}),N(()=>{d(e)});return}if(!E(e)){let e=Error("The server returned an unexpected response.");t.markAsFailed({pendingItem:n,endTime:o,requestError:e,response:s,responseBod