PageSourceSearch

https://app.usedot.xyz/_next/static/chunks/7371-17363a1061d030ad.js?dpl=dpl_HDt5qJjYGVnCx6nHFc8d622HPyC1

js usedot.xyz collected 2026-10-07 14:56:36 UTC 29,993 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7371],{18699:(e,t,n)=>{function r(e,t){return"/api/referral-security"+e}function o(){if("undefined"==typeof navigator)return{};let e="";try{e=Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){}return{"x-dot-referral-hints":JSON.stringify({platform:navigator.platform,language:navigator.language,timezone:e,screen:"undefined"==typeof screen?"":"".concat(screen.width,"x").concat(screen.height,"x").concat(screen.colorDepth)})}}n.d(t,{u:()=>o,v:()=>r})},19299:(e,t,n)=>{n.r(t),n.d(t,{accountStorageKey:()=>i,isProductionRedesign:()=>o,liveAccountBase:()=>l,redesignAccountHref:()=>c,switchRedesignAccount:()=>s,usesLiveRedesignAccount:()=>a});var r=n(95704);function o(){return!0}function a(){return!0}function i(e){return e}function l(e){{var t;let n=r.env.NEXT_PUBLIC_DOTPAY_API||"https://api.usedot.xyz",o=r.env.NEXT_PUBLIC_DOT_AGENT_API||r.env.NEXT_PUBLIC_DOT_PUBLIC_API||"https://api.usedot.xyz/agent/v1";return({core:n,pay:(null==(t=r.env.NEXT_PUBLIC_STRIPE_DOTPAY_API)?void 0:t.trim())||n,agent:o.replace(/\/+$/,"").replace(/\/agent\/v1(?:\/v1)?$/,"/agent/v1"),code:"https://preview.usedot.xyz",browser:"/api/browser",connectors:"/api/connectors"})[e].replace(/\/+$/,"")}}function s(e){}function c(e){if("1"!==r.env.NEXT_PUBLIC_DOT_REDESIGN_LOCAL||!e.startsWith("/")||e.startsWith("//"))return e;let t=new URLSearchParams(window.location.search).get("billing");if("live"!==t&&"preview"!==t)return e;let n=new URL(e,window.location.origin);return n.searchParams.set("billing",t),"".concat(n.pathname).concat(n.search).concat(n.hash)}},76101:(e,t,n)=>{n.d(t,{Nf:()=>l,wF:()=>i});var r=n(95704);let o="https://review-redesign.usedot.xyz";function a(){return"1"===r.env.NEXT_PUBLIC_DOT_REDESIGN_LOCAL&&window.location.origin===o}function i(e){if("1"===r.env.NEXT_PUBLIC_DOT_REDESIGN_LOCAL&&"1"===r.env.NEXT_PUBLIC_DOT_STAGING&&"1"===r.env.NEXT_PUBLIC_DOT_LOCAL_SERVICE_PROXY&&["localhost","127.0.0.1"].includes(window.location.hostname)&&"code"!==e)return"/api/redesign/local/".concat(e);let t={core:4312,agent:4314,code:4315}[e]+100*("1"===r.env.NEXT_PUBLIC_DOT_STAGING);return a()?"".concat(o,"/_review/").concat(e):"http://127.0.0.1:".concat(t)}function l(e,t){if(!a())return e;try{let n=new URL(e);if("http:"!==n.protocol||!["localhost","127.0.0.1"].includes(n.hostname)||Number(n.port)!==("code"===t?4315:4316)+100*("1"===r.env.NEXT_PUBLIC_DOT_STAGING))return e;return"".concat("code"===t?"https://code-redesign.usedot.xyz":"https://browser-redesign.usedot.xyz").concat(n.pathname).concat(n.search).concat(n.hash)}catch(t){return e}}},77371:(e,t,n)=>{n.d(t,{$2:()=>E,$p:()=>R,A7:()=>v,Ay:()=>eg,Bm:()=>M,FX:()=>eA,Fy:()=>B,Gt:()=>eD,J$:()=>T,Lc:()=>eI,Lj:()=>A,Lu:()=>eO,M7:()=>eq,N:()=>O,NL:()=>eX,Nc:()=>W,O_:()=>eL,Ox:()=>I,R3:()=>q,Sk:()=>V,UN:()=>_,VQ:()=>k,Vq:()=>ek,Vv:()=>L,Wg:()=>D,Xb:()=>eN,YE:()=>eB,ZV:()=>G,_r:()=>eu,_x:()=>eC,b5:()=>eR,bW:()=>X,bw:()=>e_,eQ:()=>P,ey:()=>s,jR:()=>ec,jw:()=>p,km:()=>eE,kv:()=>ep,lB:()=>eU,o$:()=>eT,qm:()=>d,rg:()=>j,sE:()=>es,sO:()=>el,t7:()=>x,xz:()=>ej,zX:()=>u,zj:()=>b});var r=n(18699),o=n(77372),a=n(76101),i=n(19299),l=n(95704);function s(){if("1"===l.env.NEXT_PUBLIC_DOT_REFERRAL_PREVIEW)return"/api/referral-preview";if((0,i.usesLiveRedesignAccount)())return(0,i.liveAccountBase)("core");if("1"===l.env.NEXT_PUBLIC_DOT_REDESIGN_LOCAL)return(0,a.wF)("core");if(l.env.NEXT_PUBLIC_DOTPAY_API)return l.env.NEXT_PUBLIC_DOTPAY_API;let e=function(){let{hostname:e,protocol:t}=window.location;return"localhost"===e||"127.0.0.1"===e||"::1"===e?"http://localhost:8787":/^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[0-1])\.)/.test(e)?"".concat("https:"===t?"https":"http","
1://").concat(e,":8787"):""}();return e||"https://api.usedot.xyz"}function c(){var e;return"1"===l.env.NEXT_PUBLIC_DOT_REFERRAL_PREVIEW?s():(0,i.usesLiveRedesignAccount)()?(0,i.liveAccountBase)("pay"):"1"===l.env.NEXT_PUBLIC_DOT_REDESIGN_LOCAL?(0,a.wF)("core"):((null==(e=l.env.NEXT_PUBLIC_STRIPE_DOTPAY_API)?void 0:e.trim())||s()).replace(/\/+$/,"")}function u(){var e;return(0,i.usesLiveRedesignAccount)()?(0,i.liveAccountBase)("core"):((null==(e=l.env.NEXT_PUBLIC_DOT_VIDEO_API)?void 0:e.trim())||s()).replace(/\/+$/,"")}s();class d extends Error{constructor(e,t="",n,r){super(e),this.code=t,this.details=n,this.status=r}}function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"DotPay request failed.",n=m(e);return 4001===y(e)||/user rejected|user denied|rejected request|request rejected|cancelled|canceled/i.test(n)?"Transaction was cancelled in your wallet. No credits were charged.":n&&"[object Object]"!==n?n:t}function m(e){var t,n,r,o,a,i;if(!e)return"";if("string"==typeof e)return e;if(e instanceof Error&&e.message)return e.message;if("object"!=typeof e)return String(e);for(let l of[e.shortMessage,e.message,e.reason,e.details,null==(t=e.data)?void 0:t.message,null==(n=e.error)?void 0:n.message,null==(o=e.error)||null==(r=o.data)?void 0:r.message,null==(a=e.cause)?void 0:a.shortMessage,null==(i=e.cause)?void 0:i.message])if("string"==typeof l&&l.trim()&&"[object Object]"!==l.trim())return l.trim();return""}function y(e){var t,n,r,o,a,i,l;return e&&"object"==typeof e&&null!=(l=null!=(i=null!=(a=null!=(o=e.code)?o:null==(t=e.error)?void 0:t.code)?a:null==(n=e.data)?void 0:n.code)?i:null==(r=e.cause)?void 0:r.code)?l:""}async function h(e){var t,n,o,a,i;let l,c,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},p=new AbortController,m=globalThis.setTimeout(()=>p.abort(),null!=(t=u.timeoutMs)?t:2e4);try{let t="/dotpay/topups"===e&&"POST"===u.method,n=e.startsWith("/api/")?e:"".concat(u.baseUrl||s()).concat(e);l=await fetch(t?(0,r.v)(e,u.baseUrl||s()):n,{method:u.method||"GET",headers:{...t?(0,r.u)():{},...u.body?{"Content-Type":"application/json"}:{},...u.headers||{}},body:u.body?JSON.stringify(u.body):void 0,signal:p.signal}),c=await l.text()}catch(e){if((null==e?void 0:e.name)==="AbortError")throw new d("DotPay is still checking Base. You can resume this top-up in a moment.","request_timeout");throw new d("Network issue contacting DotPay. You can resume this top-up in a moment.","network_error")}finally{globalThis.clearTimeout(m)}let y={};try{y=c?JSON.parse(c):{}}catch(e){y={}}if(!l.ok)throw new d((null==y||null==(n=y.error)?void 0:n.message)||"Request failed (".concat(l.status,")"),(null==y||null==(o=y.error)?void 0:o.code)||(null==y||null==(a=y.error)?void 0:a.type)||"",null==y||null==(i=y.error)?void 0:i.details,l.status);return y}let v=e=>e instanceof d&&["tx_not_found","tx_confirming","transfer_not_found","request_timeout","network_error"].includes(e.code);function f(e){return{receiver:e.dotpay.receiver,chainId:e.dotpay.chainId,network:e.dotpay.network,usdcAddress:e.dotpay.usdcAddress,dotAddress:e.dotpay.dotAddress,defaultTopupAsset:eS(e.dotpay.defaultTopupAsset),assets:Array.isArray(e.dotpay.assets)?e.dotpay.assets.map(t=>({id:String(t.id||"").trim(),symbol:eS(t.symbol),label:String(t.label||t.symbol||"").trim(),address:String(t.address||"").trim(),decimals:Number(t.decimals||18),minTopupUsd:String(t.minTopupUsd||e.dotpay.minTopupUsdc||"0.1"),maxTopupUsd:String(t.maxTopupUsd||e.dotpay.maxTopupUsdc||"500"),quote:String(t.quote||"stablecoin"),bonusBps:Math.max(0,Number(t.bonusBps||0)),default:!0===t.default})).filter(e=>e.symbol&&e.address):void 0,creditsPerUsd:e.dotpay.creditsPerUsd,minTopupUsdc:String(e.dotpay.minTopupUsdc),maxTopupUsdc:String(e.dotpay.maxTopupUsdc),denominations:e.veil.denominations,keys:e.veil.keys,stripe:e.dotpay.stripe?{enabled:!0===e.dotpay.stripe.enabled,configured:!0===e.dotpay.stripe.configured,testMode:!0===e.dotpay.stripe.testMode,liveMode:!0===e.dotpay.stripe.liveMode,currency:String(e.dotpay.stripe.currency||"usd").toLowerCase(),apiVersion:String(e.dotpay.stripe.apiVersion||""),publishableKey:String(e.dotpay.stripe.publishableKey||""),paymentMethods:Array.isArray(e.dotpay.stripe.paymentMethods)?e.dotpay.stripe.paymentMethods.map(String):[],expressWallets:Array.isArray(e.dotpay.stripe.expressWallets)?e.dotpay.stripe.expressWallets.map(String):[],privacy:e.dotpay.stripe.privacy}:void 0}}let w=null;async function b(){return w||(w=f(await h("/dotpay/config")))}let g=null;async function _(){return g||(g=f(await h("/dotpay/config",{baseUrl:c()})))}function T(e){return h("/dotpay/wallets/".concat(e,"/onchain")).then(e=>(function(e){var t,n,r,o,a,i,l,s;let c=(null==e?void 0:e.onchain)&&"object"==typeof e.onchain?e.onchain:e||{};return{usdc:String(null!=(i=null!=(a=c.usdc)?a:null==(t=c.officialUsdc)?void 0:t.amount)?i:"0"),usdbc:c.usdbc?String(c.usdbc):(null==(n=c.bridgedUsdbc)?void 0:n.amount)?String(c.bridgedUsdbc.amount):void 0,eth:(null==(r=c.eth)?void 0:r.amount)?String(c.eth.amount):c.eth?String(c.eth):void 0,dot:String(null!=(s=null!=(l=c.dot)?l:null==(o=c.dotToken)?void 0:o.amount)?s:"0")}})(e))}let S=e=>e?{"X-Dotpay-Claim-Secret":e}:{};async function A(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"DOT",r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=await h("/dotpay/topups",{method:"POST",body:{amountUsd:e,amountUsdc:e,walletAddress:t,asset:n,referralCode:eb(),referralVisit:eX(),requireReferralDiscount:r}});
1return{topup:o.topup,claimSecret:o.claimSecret}}async function P(e,t){var n,r;let o=await h("/dotpay/stripe/payment-intents",{method:"POST",body:e,headers:t?{"Idempotency-Key":t}:void 0,baseUrl:c()});if(!(null==o||null==(n=o.paymentIntent)?void 0:n.clientSecret)||!(null==o?void 0:o.claimSecret)||!(null==o||null==(r=o.topup)?void 0:r.id))throw new d("Stripe did not return a complete checkout session.","stripe_session_invalid");return o}async function O(e,t){return h("/dotpay/stripe/payment-intents/".concat(encodeURIComponent(e),"/sync"),{method:"POST",body:{claimSecret:t},headers:S(t),baseUrl:c()})}function U(e){var t;return(Array.isArray(null==e||null==(t=e.dotpay)?void 0:t.subscriptionPackages)?e.dotpay.subscriptionPackages:[]).map(e=>{var t;return{id:String(e.id||"").trim(),label:String(e.label||e.id||"").trim(),interval:e.interval?String(e.interval):void 0,amountUsd:String(null!=(t=e.amountUsd)?t:""),creditAmount:Number(e.creditAmount||0),paymentOptions:(Array.isArray(e.paymentOptions)?e.paymentOptions:[]).map(e=>{var t,n;return{asset:eS(e.asset),amountUsd:String(null!=(n=null!=(t=e.amountUsd)?t:e.amountUsdc)?n:""),amountUsdc:null!=e.amountUsdc?String(e.amountUsdc):void 0,creditAmount:Number(e.creditAmount||0),baseCreditAmount:null!=e.baseCreditAmount?Number(e.baseCreditAmount):void 0,bonusCredits:null!=e.bonusCredits?Number(e.bonusCredits):void 0,bonusBps:null!=e.bonusBps?Number(e.bonusBps):void 0}}).filter(e=>e.asset&&e.amountUsd)}}).filter(e=>e.id&&e.paymentOptions.length)}let C=null;async function E(){return C||(C=U(await h("/dotpay/config")))}let N=null;async function I(){return N||(N=U(await h("/dotpay/config",{baseUrl:c()})))}async function j(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=await h("/dotpay/topups",{method:"POST",body:{walletAddress:t,packageId:e,asset:n,referralCode:eb(),referralVisit:eX(),requireReferralDiscount:r}});return{topup:o.topup,claimSecret:o.claimSecret}}async function D(e,t){return(await h("/dotpay/subscriptions/entitlement",{method:"POST",body:{topupId:e,claimSecret:t},headers:S(t)})).entitlement}async function L(e,t){return(await h("/dotpay/subscriptions/entitlement",{method:"POST",body:{topupId:e,claimSecret:t},headers:S(t),baseUrl:c()})).entitlement}async function k(e){return(await h("/dotpay/subscriptions/restore/challenge",{method:"POST",body:{walletAddress:e}})).challenge}async function x(e,t){return(await h("/dotpay/subscriptions/restore",{method:"POST",body:{challengeToken:e,signature:t}})).entitlement}async function B(e){return h("/dotpay/subscriptions/usage",{headers:{"X-Dot-Subscription":e}})}async function R(e){return(await h("/dotpay/subscriptions/credit-upgrade",{method:"POST",headers:{"X-Dot-Subscription":e}})).upgrade}async function q(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"starter";return(await h("/dotpay/subscriptions/dev/entitlement",{method:"POST",body:{packageId:e}})).entitlement}async function X(e,t){return(await h("/dotpay/topups/".concat(e),{headers:S(t)})).topup}async function M(e,t,n){return(await h("/dotpay/topups/".concat(e,"/submit-tx"),{method:"POST",body:{txHash:t,claimSecret:n},headers:S(n)})).topup}async function W(e,t){return(await h("/dotpay/topups/".concat(e,"/sync-transfer"),{method:"POST",body:{claimSecret:t},headers:S(t)})).topup}function G(e,t,n){return h("/dotpay/topups/".concat(e,"/issue-blind"),{method:"POST",body:{claimSecret:n,tokens:t},headers:S(n)})}function V(e,t,n){return h("/dotpay/topups/".concat(e,"/issue-blind"),{method:"POST",body:{claimSecret:n,tokens:t},headers:S(n),baseUrl:c()})}let z=l.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID||"34aa5856f562a791522b284d5234e15f",Y="0x2105",J=null,$="",F=!1,K=null,Z=null,H=null,Q=null,ee=!1,et=null,en=null,er=!1,eo=0,ea=new Set;function ei(e,t,n){let r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:9e4;return Promise.race([e,new Promise((e,a)=>{r=setTimeout(()=>{try{null==n||n()}catch(e){}a(new d(t,"wallet_timeout"))},o)})]).finally(()=>clearTimeout(r))}function el(){var e;return null!=(e=window.ethereum)?e:null}function es(){return $}function ec(){$="",F=!1,J=null}function eu(){for(let e of(eo+=1,null==et||et(),et=null,Z=null,H=null,Q=null,ea))e();return(ec(),er=!0,!ee||K||en)?ed():Promise.resolve()}function ed(){if(!en){let e=(async()=>{var e,t,n,r;let o=await ey();null==(e=o.signer)||e.abortPairingAttempt(),await (null==(t=o.modal)?void 0:t.close()),await o.disconnect(),await (null==(r=o.modal)||null==(n=r.disconnect)?void 0:n.call(r,"eip155")),er=!1})().finally(()=>{en===e&&(en=null)});en=e}return ei(en,"The wallet connection couldn’t be reset. Try connecting again.",void 0,1e4)}function ep(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n="injected"===t.transport?t.provider:null,r=n?"injected":"walletconnect"===t.transport||F?"walletconnect":"auto";if(Z)return H!==r||Q!==n?Promise.reject(new d("Another wallet connection is in progress. Disconnect to try again.","wallet_busy")):Z;H=r,Q=n;let o={active:!0,provider:null},a=new Promise((t,n)=>{e=n}),i=()=>{o.active=!1,e(new d("Wallet disconnected.","wallet_disconnected"))};et=i;let l=ei(Promise.race([em(o,"walletconnect"===r,n),a]),"Wallet connection timed out. Open your wallet and try again.",()=>{var e,t,n,r;i(),null==(t=o.provider)||null==(e=t.signer)||e.abortPairingAttempt(),null==(r=o.provider)||null==(n=r.modal)||n.close()}).finally(()=>{o.active=!1,Z===l&&(Z=null,H=null,Q=null),et===i&&(et=null)});return Z=l,l}async function em(e,t,n){var r,o,a;let i=()=>
1{if(!e.active)throw new d("Wallet connection ended. Try again.","wallet_disconnected")},l=t?null:null!=(a=null!=n?n:J)?a:el();if((en||er&&(!l||K))&&await ed(),i(),ee=!!l,l){let e=await l.request({method:"eth_requestAccounts"});i(),await ef(l),i();let t=await l.request({method:"eth_accounts"});i();let n=(null==t?void 0:t[0])||(null==e?void 0:e[0]);if(!n)throw new d("Wallet did not return an account.","no_account");return J=l,F=!1,$=n,n}let s=await ey();i(),e.provider=s,(null==(r=s.session)?void 0:r.expiry)&&1e3*s.session.expiry<=Date.now()&&await ed(),i(),s.session||await s.connect(),!e.active&&s.session&&(er=!0),i(),await ef(s),i();let c=await s.request({method:"eth_accounts"});i();let u=(null==c?void 0:c[0])||(null==(o=s.accounts)?void 0:o[0]);if(!u)throw new d("Wallet did not connect.","no_account");return J=s,F=!0,$=u,u}function ey(){return K||(K=eh().catch(e=>{throw K=null,e})),K}async function eh(){let{createWalletPicker:e}=await Promise.all([n.e(1029),n.e(9984),n.e(6755),n.e(1605),n.e(5295),n.e(6830)]).then(n.bind(n,96830));return e({projectId:z,themeMode:"undefined"==typeof document||"light"!==document.documentElement.getAttribute("data-theme")?"dark":"light",metadata:{name:"Dot",description:"Chat, images, video and code",url:window.location.origin,icons:["https://app.usedot.xyz/dot-mark.png"]}})}function ev(e){let t=String(null!=e?e:"").trim().toLowerCase();if(t===Y||t===String(8453)||t==="eip155:".concat(8453))return!0;try{if(t.startsWith("0x"))return 8453===Number(BigInt(t))}catch(e){}return!1}async function ef(e){let t=async()=>e.request({method:"eth_chainId"});try{let n=await t();if(ev(n))return;await e.request({method:"wallet_switchEthereumChain",params:[{chainId:Y}]})}catch(t){if((null==t?void 0:t.code)===4902)await e.request({method:"wallet_addEthereumChain",params:[{chainId:Y,chainName:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://mainnet.base.org"],blockExplorerUrls:["https://basescan.org"]}]});else throw t}if(!ev(await t()))throw new d("Switch your wallet to Base and try again. No credits were charged.","wrong_chain")}function ew(e,t){let n=e.toLowerCase().replace(/^0x/,"").padStart(64,"0"),r=BigInt(t).toString(16).padStart(64,"0");return"0x".concat("a9059cbb").concat(n).concat(r)}function eb(){var e;if("undefined"==typeof document)return;
1let t=null==(e=document.cookie.split("; ").find(e=>e.startsWith("dot_referral=")))?void 0:e.split("=")[1];return t&&/^[a-z0-9][a-z0-9_-]{2,23}$/.test(t)?t:void 0}async function eg(e){let t=null!=J?J:el();if(!t)throw new d("Connect the treasury wallet first.","no_wallet");return await ef(t),t.request({method:"eth_sendTransaction",params:[{from:e.from,to:e.tokenAddress,value:"0x0",data:ew(e.recipient,e.amountBaseUnits)}]})}async function e_(e,t){let n=null!=J?J:el();if(!n)throw new d("Connect a wallet first.","no_wallet");let r=e.tokenAddress||e.usdcAddress;try{return await ef(n),await n.request({method:"eth_sendTransaction",params:[{from:t,to:r,value:"0x0",data:ew(e.receiver,e.amountBaseUnits)}]})}catch(e){throw new d(p(e,"Wallet could not submit the transfer. No credits were charged."),String(y(e)||"wallet_transfer_failed"),e)}}async function eT(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$,n=null!=J?J:el();if(!n)throw new d("Connect a wallet first.","no_wallet");let r=t||await ep(),o=eo,a="0x".concat(Array.from(new TextEncoder().encode(e),e=>e.toString(16).padStart(2,"0")).join("")),i=()=>{},l=new Promise((e,t)=>{i=()=>t(new d("Wallet disconnected.","wallet_disconnected")),ea.add(i)});try{let e=await ei(Promise.race([n.request({method:"personal_sign",params:[a,r]}),l]),"Sign-in timed out. Open your wallet and try again.");if(o!==eo)throw new d("Wallet disconnected.","wallet_disconnected");return e}catch(e){throw new d(4001===y(e)||/user rejected|user denied|cancelled|canceled/i.test(m(e))?"Sign-in cancelled. You can try again when you’re ready.":p(e,"Couldn’t confirm the wallet signature. Please try again."),String(y(e)||"wallet_signature_failed"),e)}finally{ea.delete(i)}}function eS(e){return"USDC"===String(e||"").trim().toUpperCase()?"USDC":"DOT"}async function eA(e){var t,n,r,o,a,i;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=await h("/dotpay/veil/quote",{method:"POST",body:e,baseUrl:l.baseUrl}),c=s.veil||s;return{amountCredits:Number(null!=(o=null!=(r=c.amountCredits)?r:c.amount_credits)?o:0),minCredits:Number(null!=(i=null!=(a=c.minCredits)?a:c.min_credits)?i:1)||1,formula:c.formula,priceUsd:null==(t=c.quote)?void 0:t.price_usd,model:null==(n=c.quote)?void 0:n.model}}function eP(e,t){return{...e,dotpay_veil:t,veil:t}}function eO(e,t){return h("/dotpay/veil/chat/completions",{method:"POST",body:eP(e,t),timeoutMs:24e4})}async function eU(e,t){let n,r=new AbortController,o=globalThis.setTimeout(()=>r.abort(),24e4);try{n=await fetch("".concat(s(),"/dotpay/veil/chat/completions"),{method:"POST",headers:{"Content-Type":"application/json"}
1,body:JSON.stringify(eP({...e,stream:!0},t)),signal:r.signal,cache:"no-store"})}catch(e){if((null==e?void 0:e.name)==="AbortError")throw new d("DotPay timed out while the model was streaming.","request_timeout");throw new d("Network issue contacting DotPay.","network_error")}finally{globalThis.clearTimeout(o)}if(!n.ok){var a,i,l,c;let e=await n.text().catch(()=>""),t={};try{t=e?JSON.parse(e):{}}catch(e){t={}}throw new d((null==t||null==(a=t.error)?void 0:a.message)||"Request failed (".concat(n.status,")"),(null==t||null==(i=t.error)?void 0:i.code)||(null==t||null==(l=t.error)?void 0:l.type)||"",null==t||null==(c=t.error)?void 0:c.details)}if(!n.body)throw new d("DotPay stream unavailable.","stream_unavailable");return n}async function eC(e,t){let n,r=new AbortController,o=globalThis.setTimeout(()=>r.abort(),24e4);try{n=await fetch("".concat(s(),"/dotpay/subscriptions/chat/completions"),{method:"POST",headers:{"Content-Type":"application/json","X-Dot-Subscription":t},body:JSON.stringify({...e,stream:!0}),signal:r.signal,cache:"no-store"})}catch(e){if((null==e?void 0:e.name)==="AbortError")throw new d("The included model timed out while streaming.","request_timeout");throw new d("Network issue contacting the included model.","network_error")}finally{globalThis.clearTimeout(o)}if(!n.ok){var a,i,l,c;let e=await n.text().catch(()=>""),t={};try{t=e?JSON.parse(e):{}}catch(e){t={}}throw new d((null==t||null==(a=t.error)?void 0:a.message)||"Request failed (".concat(n.status,")"),(null==t||null==(i=t.error)?void 0:i.code)||(null==t||null==(l=t.error)?void 0:l.type)||"",null==t||null==(c=t.error)?void 0:c.details)}if(!n.body)throw new d("Included model stream unavailable.","stream_unavailable");return n}function eE(e,t){return(0,o.yM)(e,"subscription",()=>h("/dotpay/subscriptions/images/generations",{method:"POST",body:e,headers:{"X-Dot-Subscription":t},timeoutMs:18e4}),e=>eN(e,t))}function eN(e,t){return h("/dotpay/subscriptions/images/retrieve",{method:"POST",body:e,headers:{"X-Dot-Subscription":t},timeoutMs:2e4})}function eI(e,t){return h("/api/subscription/videos/queue",{method:"POST",body:{...e,kind:"video"},headers:{"X-Dot-Subscription":t},timeoutMs:9e4})}function ej(e,t){return(0,o.yM)(e,"vault",()=>h("/dotpay/veil/images/generations",{method:"POST",body:eP(e,t),timeoutMs:18e4}),eD)}function eD(e){return h("/dotpay/veil/images/retrieve",{method:"POST",body:e,timeoutMs:2e4})}function eL(e,t){return h("/dotpay/veil/videos/queue",{method:"POST",body:eP({...e,kind:"video"},t),timeoutMs:9e4,baseUrl:u()})}function ek(e){var t,n;return null!=(n=null==e||null==(t=e.dot_parameters)?void 0:t.veil_payment)?n:{}}let ex=e=>Array.isArray(e)?e:Array.isArray(null==e?void 0:e.models)?e.models:Array.isArray(null==e?void 0:e.data)?e.data:[];async function eB(){let e={};try{let[t,n,r]=await Promise.all([h("/dotpay/models"),h("/dotpay/images/models"),h("/dotpay/videos/models",{baseUrl:u()})]);for(let o of[...ex(t),...ex(n),...ex(r)])(null==o?void 0:o.id)&&o.credit_pricing&&(e[o.id]=o.credit_pricing)}catch(e){}return e}async function eR(){return ex(await h("/dotpay/videos/models",{baseUrl:u()}))}async function eq(e){var t,n,r,o,a;let i,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/dotpay/veil/videos/retrieve",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=new AbortController,p=globalThis.setTimeout(()=>c.abort(),12e4),m=l.startsWith("/api/")?l:"".concat(u()).concat(l);try{i=await fetch(m,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, video/mp4",...s.entitlementToken?{"X-Dot-Subscription":s.entitlementToken}:{}},body:JSON.stringify({id:e,response_format:s.responseFormat}),signal:c.signal})}catch(e){if((null==e?void 0:e.name)==="AbortError")throw new d("Video is still rendering. Retry retrieve in a moment.","request_timeout");throw new d("Network issue retrieving the video.","network_error")}finally{globalThis.clearTimeout(p)}let y=i.headers.get("content-type")||"";if(!i.ok){let e=null;try{e=await i.json()}catch(e){}throw new d((null==e||null==(t=e.error)?void 0:t.message)||"Video retrieve failed (".concat(i.status,")"),(null==e||null==(n=e.error)?void 0:n.code)||(null==e||null==(r=e.error)?void 0:r.type)||"",null==e||null==(o=e.error)?void 0:o.details,i.status)}if(/^video\/|application\/octet-stream/i.test(y)){let e=(null==(a=y.split(";")[0])?void 0:a.startsWith("video/"))?y.split(";
1")[0]:"video/mp4",t=await i.blob();return{kind:"video",blob:t.type===e?t:new Blob([t],{type:e}),contentType:e}}let h=await i.json(),v=function(e){var t,n,r;let o=Array.isArray(null==e?void 0:e.data)?e.data[0]:null,a=(null==o?void 0:o.b64_json)||(null==o?void 0:o.base64)||(null==e?void 0:e.b64_json)||(null==e?void 0:e.base64)||(null==e||null==(t=e.video)?void 0:t.b64_json)||(null==e||null==(n=e.video)?void 0:n.base64)||"";if("string"!=typeof a||!a.trim())return null;let i=a.includes(",")?a.split(",").pop()||"":a,l=String((null==o?void 0:o.mime_type)||(null==o?void 0:o.content_type)||(null==e?void 0:e.mime_type)||(null==e?void 0:e.content_type)||"video/mp4"),s=(null==(r=l.split(";")[0])?void 0:r.startsWith("video/"))?l.split(";")[0]:"video/mp4";try{let e=atob(i),t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=1)t[n]=e.charCodeAt(n);return{blob:new Blob([t],{type:s}),contentType:s}}catch(e){return null}}(h);return v?{kind:"video",...v,response:h}:{kind:"job",job:h}}function eX(){var e;if("undefined"==typeof document)return;
1let t=null==(e=document.cookie.split("; ").find(e=>e.startsWith("dot_referral_visit=")))?void 0:e.split("=")[1];return t&&/^[A-Za-z0-9_-]{43}$/.test(t)?t:void 0}},77372:(e,t,n)=>{n.d(t,{Mn:()=>y,Uo:()=>w,Us:()=>i,_i:()=>s,aR:()=>c,eN:()=>m,ij:()=>u,lC:()=>d,m7:()=>v,yM:()=>b});var r=n(19299),o=n(95704);class a extends Error{constructor(){super("Your image is still being checked. You can return to it or check again without starting another generation."),this.code="image_recovery_pending"}}let i=()=>"1"===o.env.NEXT_PUBLIC_DOT_IMAGE_JOBS,l=()=>new Promise((e,t)=>{let n=indexedDB.open((0,r.accountStorageKey)("dot-image-recovery"),2);n.onupgradeneeded=()=>{let e=n.result.objectStoreNames.contains("jobs")?n.transaction.objectStore("jobs"):n.result.createObjectStore("jobs",{keyPath:"creationId"});e.indexNames.contains("recoveryId")||e.createIndex("recoveryId","recovery.id",{unique:!0})},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)});async function s(e){let t=await l();try{return await new Promise((n,r)=>{let o=t.transaction("jobs").objectStore("jobs").get(e);o.onsuccess=()=>n(o.result),o.onerror=()=>r(o.error)})}finally{t.close()}}async function c(e){let t=await l();try{await new Promise((n,r)=>{let o=t.transaction("jobs","readwrite");o.objectStore("jobs").put(e),o.oncomplete=()=>n(),o.onabort=o.onerror=()=>r(o.error||Error("Could not save image recovery."))})}finally{t.close()}}async function u(e){let t=await l();try{await new Promise((n,r)=>{let o=t.transaction("jobs","readwrite");o.objectStore("jobs").delete(e),o.oncomplete=()=>n(),o.onabort=o.onerror=()=>r(o.error)})}finally{t.close()}}async function d(){let e=await l();try{return await new Promise((t,n)=>{let r=[],o=e.transaction("jobs").objectStore("jobs").openCursor();o.onsuccess=()=>{var e;let n=o.result;if(!n)return void t(r);let a=n.value;r.push({creationId:a.creationId,recovery:a.recovery,lane:a.lane,context:{creation:null==(e=a.context)?void 0:e.creation}}),n.continue()},o.onerror=()=>n(o.error)})}finally{e.close()}}function p(){let e=crypto.getRandomValues(new Uint8Array(32));return{id:crypto.randomUUID().replaceAll("-",""),key:btoa(String.fromCharCode(...e)).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,""),createdAt:Date.now()}}async function m(e,t){if(!i())return;let n=p();return await c({creationId:e,recovery:n,context:t}),n}async function y(e){let t;if(!e.dot_image_job)return;let n=await l();try{t=await new Promise((t,r)=>{let o=n.transaction("jobs").objectStore("jobs").index("recoveryId").get(e.dot_image_job.id);o.onsuccess=()=>t(o.result),o.onerror=()=>r(o.error)})}finally{n.close()}if(!t)throw Error("Image recovery could not be saved. Please try again.");return t}async function h(e,t){let n=await y(e);n&&await c({...n,lane:t})}async function v(e){let t=await y(e);if(t){let n=p();await c({...t,recovery:n}),e.dot_image_job=n}}async function f(e,t){let n=e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0)),r=n(e.key.replaceAll("-","+").replaceAll("_","/")+"="),o=await crypto.subtle.importKey("raw",r,{name:"AES-GCM"},!1,["decrypt"]),a=await crypto.subtle.decrypt({name:"AES-GCM",iv:n(t.iv),additionalData:new TextEncoder().encode(e.id)},o,n(t.data));return JSON.parse(new TextDecoder().decode(a))}async function w(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:18e4,o=Date.now(),i=n;for(;Date.now()-o<r;){try{i||(i=await t(e))}catch(t){if([401,403,410].includes(t.status))throw t;if(404===t.status&&Date.now()-e.createdAt>6e4)throw Object.assign(Error("The image request was not accepted or its recovery record is unavailable. Your prompt is saved."),{code:"image_job_not_found",status:404});i=void 0}if((null==i?void 0:i.status)==="complete"&&i.encrypted_result)return{...await f(e,i.encrypted_result),...i.billing_unconfirmed?{image_billing_unconfirmed:!0}:{}};if((null==i?void 0:i.status)==="failed"){var l,s,c,u;let t=i.encrypted_error?await f(e,i.encrypted_error):i;throw Object.assign(Error((null==(l=t.error)?void 0:l.message)||"The image could not finish."),{code:(null==(s=t.error)?void 0:s.code)||(null==(c=t.error)?void 0:c.type)||"image_generation_failed",details:null==(u=t.error)?void 0:u.details,status:t.http_status||502})}if((null==i?void 0:i.status)==="interrupted")throw Object.assign(Error("The image service was interrupted before a recoverable result was saved. Your prompt is saved."),{code:"image_job_interrupted",status:503});await new Promise(e=>setTimeout(e,1500)),i=void 0}throw new a}async function b(e,t,n,r){let o;if(!e.dot_image_job)return n();await h(e,t);try{o=await n()}catch(e){if(!["network_error","request_timeout"].includes(e.code)&&!(e.status>=500))throw e}if(o&&"image.job"!==o.object){var a;if(null==(a=o.data)?void 0:a.some(e=>e.b64_json))return o;throw Error("The image service did not accept a recoverable request. Please check its saved status.")}return w(e.dot_image_job,r,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.