"use strict";(()=>{var e={};e.id=119,e.ids=[119],e.modules={20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},24778:(e,o,r)=>{r.r(o),r.d(o,{originalPathname:()=>b,patchFetch:()=>y,requestAsyncStorage:()=>h,routeModule:()=>d,serverHooks:()=>m,staticGenerationAsyncStorage:()=>f});var t={};r.r(t),r.d(t,{OPTIONS:()=>g,POST:()=>u,dynamic:()=>l});var n=r(49303),s=r(88716),a=r(60670),i=r(87070),c=r(74016);let l="force-dynamic",p="im.flushing.right.now";async function u(e){try{let{accessToken:o,dpopToken:r,did:t,text:n,emoji:s,pdsEndpoint:a}=await e.json();if(!o||!r||!t||!n||!s)return i.NextResponse.json({error:"Missing required parameters"},{status:400});if(!a)return i.NextResponse.json({error:"MissingPDSEndpoint",message:"PDS endpoint is required for OAuth tokens"},{status:400});if(console.log(`Using PDS endpoint: ${a} for creating flush record`),(0,c.Lt)(n))return i.NextResponse.json({error:"ContentViolation",message:"Your post contains inappropriate content that violates our community guidelines."},{status:400});let l=(0,c.oO)(n),u=`${a}/xrpc`,g={$type:p,text:l,emoji:s,createdAt:new Date().toISOString()},d=`${u}/com.atproto.repo.createRecord`;console.log(`Creating record at ${d}`),console.log(`Making record creation request with:
      - URL: ${d}
      - PDS Endpoint: ${a} 
      - DID: ${t.substring(0,10)}...
      - Record type: ${p}
    `);let h=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`DPoP ${o}`,DPoP:r},body:JSON.stringify({repo:t,collection:p,record:g})});console.log(`Record creation response status: ${h.status}`);let f="",m={};try{if(f=await h.text())try{m=JSON.parse(f)}catch(e){console.error("Failed to parse response as JSON:",e)}}catch(e){console.error("Error reading response:",e)}if(401===h.status||400===h.status){let e=h.headers.get("DPoP-Nonce");if(e)return console.log(`Found DPoP-Nonce in headers: ${e}`),i.NextResponse.json({error:"use_dpop_nonce",nonce:e,originalError:m},{status:401});if(console.log("All response headers:"),h.headers.forEach((e,o)=>{console.log(`  ${o}: ${e}`)}),"object"==typeof m&&null!==m){if(console.log("Checking response body for nonce information"),m.nonce)return console.log(`Found nonce directly in response body: ${m.nonce}`),i.NextResponse.json({error:"use_dpop_nonce",nonce:m.nonce,originalError:m},{status:401});if("InvalidDpop"===m.error||"InvalidToken"===m.error||"use_dpop_nonce"===m.error||m.message&&(m.message.includes("nonce")||m.message.includes("DPoP"))){for(let e of[/nonce: ([A-Za-z0-9_-]+)/,/nonce="([A-Za-z0-9_-]+)"/,/nonce=([A-Za-z0-9_-]+)/,/DPoP-Nonce: ([A-Za-z0-9_-]+)/,/DPoP nonce: ([A-Za-z0-9_-]+)/,/dpop-nonce: ([A-Za-z0-9_-]+)/i,/dpop nonce: ([A-Za-z0-9_-]+)/i,/nonce '([A-Za-z0-9_-]+)'/,/Nonce: ([A-Za-z0-9_-]+)/,/"nonce":"([A-Za-z0-9_-]+)"/]){let o=m.message?.match(e);if(o&&o[1]){let r=o[1];return console.log(`Extracted nonce from error message using pattern ${e}: ${r}`),i.NextResponse.json({error:"use_dpop_nonce",nonce:r,originalError:m},{status:401})}}console.log("Potential nonce error detected but couldn't extract nonce value. Full error:",m)}}}if(!h.ok){let e="object"==typeof m&&null!==m?m:{};return i.NextResponse.json({error:e.error||"Status creation failed",message:e.message||f,status:h.status,details:e},{status:h.status})}return i.NextResponse.json(m,{status:h.status})}catch(e){return console.error("Create flushing status error:",e),i.NextResponse.json({error:"Status creation error",message:e.message},{status:500})}}async function g(){return new i.NextResponse(null,{status:200,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, Authorization, DPoP"}})}let d=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/bluesky/flushing/route",pathname:"/api/bluesky/flushing",filename:"route",bundlePath:"app/api/bluesky/flushing/route"},resolvedPagePath:"/Users/dame/Library/Mobile Documents/com~apple~CloudDocs/Software/flushes/app/src/app/api/bluesky/flushing/route.ts",nextConfigOutput:"standalone",userland:t}),{requestAsyncStorage:h,staticGenerationAsyncStorage:f,serverHooks:m}=d,b="/api/bluesky/flushing/route";function y(){return(0,a.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:f})}},74016:(e,o,r)=>{r.d(o,{Lt:()=>s,oO:()=>a});let t=["slur","racist","bigot","bigotry","homophobic","transphobic","fuck","damn","ass","asshole","bitch","kill","murder","attack","violence","harm","hurt","retard","retarded","idiot","stupid","dumb","penis","vagina","dick","cock","pussy","sex","masturbate","orgasm","horny","erection","blowjob","handjob","viagra","cialis","enlarge","cryptocurrency","bitcoin","ethereum","make money","get rich","earn fast","pyramid","scheme","discord.gg","telegram.me"],n=[/\bc[hH][iIl1][nN][kKsS]?\b/,/\bc[oO]{2}[nN][sS]?\b/,/\bf[aA][gG]{1,2}([oOeE][tT]?|[iIyY][nNeE]?)?s?\b/,/\bk[iIyY][kK][eE][sS]?\b/,/\bn[iIl1oO][gG]{2}([aAeE][rR]?|[lL][eE][tT]|[nNoO][gG])?s?\b/,/\bn[iIl1oO][gG]{2}[aAeE][sS]\b/,/\bt[rR][aA][nN][nN][iIyY][eE]?[sS]?\b/];function s(e){if(!e)return!1;let o=e.toLowerCase().replace(/0/g,"o").replace(/1/g,"i").replace(/3/g,"e").replace(/4/g,"a").replace(/5/g,"s").replace(/\$/g,"s").replace(/@/g,"a").replace(/!/g,"i").replace(/\*/g,"").replace(/\./g,"").replace(/-/g,"").replace(/_/g,"").replace(/\s+/g," ");for(let o of n)if(o.test(e))return!0;return t.some(e=>{if(RegExp(`\\b${e}\\b`,"i").test(o))return!0;let r=e.split("").join("\\s*");return!!RegExp(`\\b${r}\\b`,"i").test(o)||e.length<=4&&RegExp(e,"i").test(o)})}function a(e){if(!e)return e;let o=e;return t.forEach(e=>{let r=RegExp(`\\b${e}\\b`,"gi");o=o.replace(r,"*".repeat(e.length))}),t.forEach(e=>{if(e.length>2){let r=e.split("").join("\\s*"),t=RegExp(`\\b${r}\\b`,"gi");o=o.replace(t,e=>"*".repeat(e.replace(/\s+/g,"").length))}}),t.filter(e=>e.length<=4).forEach(e=>{let r=RegExp(`(?<!\\w)${e}(?!\\w)`,"gi");o=o.replace(r,"*".repeat(e.length))}),o}}};var o=require("../../../../webpack-runtime.js");o.C(e);var r=e=>o(o.s=e),t=o.X(0,[276,972],()=>r(24778));module.exports=t})();