1import{n as H}from"./DJGpiQO7.js";import{ar as R,i as h,bg as E,M as P,c2 as Q,C as l,y as z}from"./app-BAclpbpz.js";import{b as D,a as i,c as U,z as J,g as T,h as m,j as y,s as G,l as K,A as X,C as V,H as M,B as N,q as A}from"./BI8qgwQJ.js";import"./BTqQ_sdn.js";function Y(w,e){window.parent.postMessage({type:w,payload:e},"*")}const Z={class:"_spacer",style:{"--MI_SPACER-w":"800px"}},q={key:1,class:"_buttonsCenter"},ae=D({__name:"share",setup(w){const e=new URLSearchParams(window.location.search),g=e.get("localOnly"),b=e.get("visibility"),u=i("fetching"),r=i(e.get("title")),c=e.get("text"),d=e.get("url"),_=i(),f=i(),v=i(),k=i(H.includes(b)?b:void 0),B=i(g==="0"?!1:g==="1"?!0:void 0),x=i([]),C=i([]);async function O(){let o="";if(r.value&&(o+=`[ ${r.value} ] 2`),c?.startsWith(`${r.value}. 3`)?o+=c.replace(`${r.value}. 4`,""):c&&r.value!==c&&(o+=`${c} 5`),d)try{o+=new URL(d).href}catch{o+=d}if(_.value=o.trim(),k.value==="specified"){const s=e.get("visibleUserIds"),n=e.get("visibleAccts");await Promise.all([...s?s.split(",").map(t=>({userId:t})):[],...n?n.split(",").map(Q):[]].map(t=>"username"in t?{username:t.username,host:t.host===null?void 0:t.host}:t).map(t=>l("users/show",t).then(p=>{C.value.push(p)},()=>{console.error(`Invalid user query: ${JSON.stringify(t)}`)})))}try{const s=e.get("replyId"),n=e.get("replyUri");if(s)f.value=await l("notes/show",{noteId:s});else if(n){const a=await l("ap/show",{uri:n});a.type==="Note"&&(f.value=a.object)}const t=e.get("renoteId"),p=e.get("renoteUri");if(t)v.value=await l("notes/show",{noteId:t});else if(p){const a=await l("ap/show",{uri:p});a.type==="Note"&&(v.value=a.object)}const I=e.get("fileIds");I&&await Promise.all(I.split(",").map(a=>l("drive/files/show",{fileId:a}).then(W=>{x.value.push(W)},()=>{console.error(`Failed to fetch a file ${a}`)})))}catch(s){z({type:"error",title:s.message,text:s.name})}u.value="writing"}O();function $(){window.close(),window.setTimeout(()=>{window.location.href="/"},100)}function j(){window.location.href="/"}function F(){u.value="posted",Y("misskey:shareForm:shareCompleted")}const L=U(()=>[]),S=U(()=>[]);return R(()=>({title:h.ts.share,icon:"ph-share-network ph-bold ph-lg"})),(o,s)=>{const n=J("PageWithHeader");return m(),T(n,{actions:L.value,tabs:S.value},{default:y(()=>[G("div",Z,[u.value==="writing"?(m(),T(E,{key:0,fixed:"",instant:!0,initialText:_.value,initialVisibility:k.value,initialFiles:x.value,initialLocalOnly:B.value,reply:f.value,renote:v.value,initialVisibleUsers:C.value,class:"_panel",onPosted:F},null,8,["initialText","initialVisibility","initialFiles","initialLocalOnly","reply","renote","initialVisibleUsers"])):u.value==="posted"?(m(),K("div",q,[V(P,{primary:"",onClick:$},{default:y(()=>[M(N(A(h).ts.close),1)]),_:1}),V(P,{onClick:j},{default:y(()=>[M(N(A(h).ts.goToMisskey),1)]),_:1})])):X("",!0)])]),_:1},8,["actions","tabs"])}}});export{ae 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.