1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[865],{18016:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>d});var l=a(95155),r=a(20063),s=a(12115),n=a(38966),o=a(42409);async function i(e,t){let a=new URLSearchParams({url:e}),l={next:{revalidate:0,cache:"no-store"},method:"GET",headers:{"Content-Type":"application/json",...t?{Authorization:"Bearer ".concat(t)}:{}}},r=await fetch("".concat("https://api.sociallibra.com/wp-json/social_libra/v2","/article_frames?").concat(a.toString()),l);if(!r.ok)return{frames:[],articles:[]};let s=await r.json();return"object"==typeof s&&s?{frames:Array.isArray(s.frames)?s.frames:Object.values(s.frames||{}),articles:Array.isArray(s.articles)?s.articles:Object.values(s.articles||{})}:{frames:[],articles:[]}}var c=a(32382),u=a(1399),m=a(70925),x=a(64133);function d(){let e=(0,r.useSearchParams)(),{user:t}=(0,s.useContext)(o.Rs),[a,d]=(0,s.useState)({title:"",text:"",url:""}),[f,h]=(0,s.useState)("loading"),[p,j]=(0,s.useState)([]),[g,b]=(0,s.useState)(!1);return((0,s.useEffect)(()=>{let t=e.get("title")||"";d({title:t,text:e.get("text")||"",url:e.get("url")||""})},[e]),(0,s.useEffect)(()=>{a.url&&(h("loading"),i(a.url,t.token).then(e=>{j(e.frames),h(e.frames.length>0?"found":"not-found")}))},[a.url,t.token]),a.url)?(0,l.jsxs)("main",{className:"p-4 max-w-xl mx-auto flex flex-col gap-4",children:[(0,l.jsx)("h1",{className:"text-2xl font-bold",children:"Shared link"}),(0,l.jsx)("p",{className:"break-all text-sm text-muted-foreground",children:a.title||a.url}),"loading"===f?(0,l.jsx)(x.A,{}):null,"found"===f?(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("p",{children:["Found ",p.length," existing Story Frame",p.length>1?"s":""," about this link:"]}),p.map(e=>(0,l.jsx)(n.N_,{href:"/story-frame/".concat(e.slug||e.id),className:"btn-primary block text-center",children:e.title},e.id))]}):null,"not-found"===f?(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsx)("p",{children:"No Story Frame found for this link yet."}),t.token?(0,l.jsx)(m.A,{initialTitle:a.title||a.text,initialArticleUrl:a.url,forceOpen:!0}):(0,l.jsx)("button",{className:"btn-primary",onClick:()=>b(!0),children:"Log in to create a Story Frame"})]}):null,!t.token&&g?(0,l.jsxs)(c.A,{className:"sm:w-1/3",onClose:()=>b(!1),children:[(0,l.jsx)("p",{className:"text-center",children:"You need to be logged in to create a Story Frame"}),(0,l.jsx)(u.default,{})]}):null]}):(0,l.jsxs)("main",{className:"p-4 max-w-xl mx-auto",children:[(0,l.jsx)("h1",{className:"text-2xl font-bold mb-2",children:"Nothing was shared"}),(0,l.jsx)("p",{className:"text-muted-foreground",children:"Share a link to Social Libra to vote on it or start a new Story Frame about it."})]})}},49830:(e,t,a)=>{Promise.resolve().then(a.bind(a,18016))}},e=>{e.O(0,[3098,5446,9344,8720,2619,4707,1474,4579,3096,1359,5779,1356,9510,7164,251,1399,7510,5875,8441,783,7358],()=>e(e.s=49830)),_N_E=e.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.