PageSourceSearch

https://fyra.life/assets/copyStashLink-Dp6eGjAY.js

js fyra.life collected 2026-09-24 15:06:55 UTC 2,947 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BB8c_naI.js","assets/index-QPhecp7O.js","assets/index-Bc0UvdKs.css"])))=>i.map(i=>d[i]);
2import{aw as h,_ as p,s as l}from"./index-QPhecp7O.js";async function _(r){var t;if(h.isNativePlatform())try{const{Clipboard:e}=await p(async()=>{const{Clipboard:n}=await import("./index-BB8c_naI.js");return{Clipboard:n}},__vite__mapDeps([0,1,2]));return await e.write({string:r}),!0}catch(e){console.warn("[clipboard] Capacitor write failed, falling back",e)}try{if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))return await navigator.clipboard.writeText(r),!0}catch(e){console.warn("[clipboard] navigator.clipboard failed, falling back",e)}try{if(typeof document>"u")return!1;const e=document.createElement("textarea");e.value=r,e.setAttribute("readonly",""),e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.opacity="0",document.body.appendChild(e),e.focus(),e.select(),e.setSelectionRange(0,r.length);const n=document.execCommand("copy");return document.body.removeChild(e),n}catch(e){return console.warn("[clipboard] execCommand fallback failed",e),!1}}function d(){return"https://fyra.life"}function g(r,t){const e=new URL(`/og-stash-invite/${encodeURIComponent(r)}`,d());return e.searchParams.set("ai",t),e.toString()}async function m(r,t){var o,s;const{data:e}=await l.from("user_guide_shares").select("share_slug").eq("guide_id",r).eq("owner_user_id",t).eq("is_public",!0).not("share_slug","is",null).limit(1);let n=((o=e==null?void 0:e[0])==null?void 0:o.share_slug)??null;if(!n){const u="abcdefghijklmnopqrstuvwxyz0123456789";let c="";for(let i=0;i<12;i++)c+=u.charAt(Math.floor(Math.random()*u.length));const{error:f}=await l.from("user_guide_shares").insert({guide_id:r,owner_user_id:t,share_slug:c,is_public:!0});if(f){const{data:i}=await l.from("user_guide_shares").select("share_slug").eq("guide_id",r).eq("owner_user_id",t).eq("is_public",!0).not("share_slug","is",null).limit(1);if(n=((s=i==null?void 0:i[0])==null?void 0:s.share_slug)??null,!n)return null}else n=c}const a=`${Date.now()}-${Math.random().toString(36).slice(2,10)}`;return new URL(`/og-stash-card/${n}/${a}`,d()).toString()}async function y(r){const{data:t,error:e}=await l.functions.invoke("mint-stash-account-invite",{body:{guideId:r}});if(e)return console.error("[copyStashLink] mint-stash-account-invite failed",e),null;const n=t==null?void 0:t.stashToken,a=t==null?void 0:t.accountInviteToken;return!n||!a?(console.error("[copyStashLink] mint returned no tokens",t),null):g(n,a)}async function w(r){const{guideId:t,ownerUserId:e,visibility:n}=r;try{let a=await m(t,e),o="reusable";if(a||(a=await y(t),o="single_use"),!a)return{ok:!1,errorMessage:"Couldn't prepare share link"};const s=await _(a);return{ok:!0,url:a,mode:o}}catch(a){return console.error("[copyStashLink] failed",a),{ok:!1,errorMessage:"Couldn't prepare share link"}}}export{w as copyStashLink};

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.