diff --git a/build/app/feed-content.399329db.js b/build/app/feed-content.399329db.js deleted file mode 100644 index 91b9436cc2..0000000000 --- a/build/app/feed-content.399329db.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";(globalThis.webpackChunkwordpress_activitypub=globalThis.webpackChunkwordpress_activitypub||[]).push([[579],{713(e,t,a){a.r(t),a.d(t,{inspector:()=>Q,stage:()=>H});var i=a(6087),r=a(3965),n=a(7545),s=a(3832),o=a(7143),d=a(3582);const c=["id","date","modified","title","excerpt","content","actor_info","status","link","ap_object_type","ap_tag"],l=[],p=[];var u=a(7723),g=a(6007),m=a(790);(0,u.__)("Avatar","activitypub");var v=a(8537),h=a(8107),y=a(2769);function b(e){return(0,v.decodeEntities)((0,h.__unstableStripHTML)(e.excerpt?.rendered||e.content?.rendered||""))}const f={id:"content",label:(0,u.__)("Content","activitypub"),enableHiding:!1,enableSorting:!1,getValue:({item:e})=>b(e),render:function({item:e}){const{getObjectTypeName:t,isLoading:a}=(0,y.t)(),i=e.ap_object_type?.[0],r=t(i);if(a&&!r)return(0,m.jsx)("div",{className:"activitypub-feed-excerpt",children:" "});if("Note"===r){const t=(0,h.safeHTML)((0,v.decodeEntities)(e.content?.rendered||""));return(0,m.jsx)("div",{className:"activitypub-feed-post",children:(0,m.jsx)("div",{className:"activitypub-feed-content",dangerouslySetInnerHTML:{__html:t||"
"}})})}const n=b(e).trim();return(0,m.jsx)("div",{className:"activitypub-feed-excerpt",children:n||" "})}},_={id:"date",label:(0,u.__)("Date","activitypub"),enableHiding:!1,enableSorting:!0,getValue:({item:e})=>e.date||"",render:({item:e})=>e.date?new Date(e.date).toLocaleDateString():""};(0,u.__)("Following","activitypub");var x=a(8443);function j(e){const t=new Date(e.endsWith("Z")?e:e+"Z"),a=Date.now()-t.getTime(),i=Math.floor(a/6e4);if(i<60)return(0,u.sprintf)(/* translators: %d: number of minutes */ /* translators: %d: number of minutes */ -(0,u._x)("%dm","short time format: minutes","activitypub"),i);const r=Math.floor(a/36e5);if(r<24)return(0,u.sprintf)(/* translators: %d: number of hours */ /* translators: %d: number of hours */ -(0,u._x)("%dh","short time format: hours","activitypub"),r);const n=Math.floor(a/864e5);return n<7?(0,u.sprintf)(/* translators: %d: number of days */ /* translators: %d: number of days */ -(0,u._x)("%dd","short time format: days","activitypub"),n):(0,x.dateI18n)((0,x.getSettings)().formats.date,e)}const w={id:"metadata",label:(0,u.__)("Metadata","activitypub"),enableHiding:!0,enableSorting:!1,getValue:({item:e})=>`${e.actor_info?.name||""} · ${e.date?j(e.date):""}`,render:({item:e})=>{const t=(0,v.decodeEntities)(e.actor_info?.name||(0,u.__)("Unknown author","activitypub")),a=e.date?j(e.date):"";return(0,m.jsxs)("div",{className:"activitypub-feed-post-meta",children:[(0,m.jsx)(g.A,{item:e}),(0,m.jsx)("span",{className:"author",children:t}),a&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"separator",children:"·"}),(0,m.jsx)("span",{className:"date",children:a})]})]})}};(0,u.__)("Last Updated","activitypub"),(0,u.__)("Name","activitypub");var N=a(9993);const S={id:"ap_object_type",type:"integer",label:(0,u.__)("Type","activitypub"),enableHiding:!1,enableSorting:!1,getValue:({item:e})=>e.ap_object_type?.[0],getElements:async()=>{const e=await(0,o.resolveSelect)(d.store).getEntityRecords("taxonomy","ap_object_type",{per_page:-1,orderby:"count",order:"desc",hide_empty:!0});return e?e.map(e=>({value:e.id,label:N.M[e.name]?.label||e.name})):[]},render:()=>null,filterBy:{operators:["is"]}},E=((0,u.__)("Status","activitypub"),{id:"ap_tag",type:"integer",label:(0,u.__)("Tag","activitypub"),enableHiding:!1,enableSorting:!1,getValue:({item:e})=>{var t;return null!==(t=e.ap_tag)&&void 0!==t?t:[]},getElements:async()=>{const e=await(0,o.resolveSelect)(d.store).getEntityRecords("taxonomy","ap_tag",{per_page:10,orderby:"count",order:"desc",hide_empty:!0});return e?e.map(e=>({value:e.id,label:`#${e.name}`})):[]},render:()=>null,filterBy:{operators:["isAny"]}}),C={id:"title.rendered",label:(0,u.__)("Title","activitypub"),enableHiding:!0,enableSorting:!1,enableGlobalSearch:!0,getValue:({item:e})=>(0,v.decodeEntities)(e.title?.rendered||""),render:({item:e})=>{if(!e.title?.rendered)return null;const t=e.title.rendered.replace(/\\(.)/g,"$1");return(0,m.jsx)("div",{className:"activitypub-feed-post-title",children:(0,v.decodeEntities)(t)})}};(0,u.__)("Profile","activitypub");var k=a(3834);function I(){const e=(0,o.useSelect)(e=>e(k.E).getActiveActorId(),[]),{view:t}=(0,n.lQ)({kind:"postType",name:"ap_post",slug:"feed",defaultView:{type:"list",search:"",filters:[]}});if(t.search||t.filters&&t.filters.length>0)return(0,m.jsx)("p",{children:(0,u.__)("No posts found.","activitypub")});const a=0===e?(0,s.addQueryArgs)("options-general.php",{page:"activitypub",tab:"following"}):(0,s.addQueryArgs)("users.php",{page:"activitypub-following-list"});return(0,m.jsx)("p",{children:(0,i.createInterpolateElement)((0,u.__)("Your feed is waiting to come alive. Follow more people on the Fediverse to see their posts here.","activitypub"),{a:(0,m.jsx)("a",{href:a})})})}var T=a(9304);const A={type:"list",perPage:20,page:1,sort:{field:"date",direction:"desc"},search:"",filters:[],fields:["metadata","title.rendered","content"],infiniteScrollEnabled:!0},R={list:{primaryField:"metadata",fields:["metadata","title.rendered","content"],mediaField:void 0}};function H(){const e=(0,T.Zp)(),t=(0,i.useCallback)(t=>{e({search:e=>({...e,postId:t})})},[e]),a=(0,o.useSelect)(e=>e(k.E).getActiveActorId(),[]),[u,g]=(0,i.useState)(()=>{const e=(0,s.getQueryArgs)(window.location.href);return{page:e.paged?Number(e.paged):void 0,search:e.search||void 0}});(0,i.useEffect)(()=>{const e=()=>{const e=(0,s.getQueryArgs)(window.location.href);g({page:e.paged?Number(e.paged):void 0,search:e.search||void 0})};return window.addEventListener("popstate",e),window.addEventListener("hashchange",e),()=>{window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)}},[]);const v=(0,i.useCallback)(e=>{const t=window.location.href,a=(0,s.getQueryArgs)(t),i=(0,s.addQueryArgs)(t,{...a,paged:e.page||void 0,search:e.search||void 0});window.history.pushState(null,"",i),g({page:e.page,search:e.search})},[]),{view:h,updateView:y}=(0,n.lQ)({kind:"postType",name:"ap_post",slug:"feed",defaultView:A,queryParams:u,onChangeQueryParams:v}),b=(0,i.useCallback)(e=>{var t;const a=JSON.stringify(h.filters)!==JSON.stringify(e.filters)?1:null!==(t=e.page)&&void 0!==t?t:1;y({...e,page:a})},[h.filters,y]),x=(0,i.useRef)(a);(0,i.useEffect)(()=>{x.current!==a&&(y({...A,fields:h.fields}),x.current=a)},[a]);const{feed:j,isResolving:N,totalItems:H,totalPages:L}=function({perPage:e=20,page:t=1,orderBy:a="date",order:r="desc",search:n="",userId:s,fields:o=c,filters:u=l}={}){const g=null!=s,m=(0,i.useMemo)(()=>{const i={per_page:e,page:t,orderby:a,order:r,search:n,_fields:o};g&&(i.user_id=s);const d=u.find(e=>"ap_object_type"===e.field);void 0!==d?.value&&(i.ap_object_type=Array.isArray(d.value)?d.value:[d.value]);const c=u.find(e=>"ap_tag"===e.field);return void 0!==c?.value&&(i.ap_tag=c.value),i},[e,t,a,r,n,s,o,g,u]),{records:v,hasResolved:h,isResolving:y,totalItems:b,totalPages:f}=(0,d.useEntityRecords)("postType","ap_post",m,{enabled:g});return{feed:g&&v||p,hasResolved:h,isResolving:y,totalItems:g?b:null,totalPages:g?f:null}}({perPage:h.perPage||20,page:h.page||1,orderBy:h.sort?.field||"date",order:h.sort?.direction||"desc",search:h.search||"",userId:a,filters:h.filters||A.filters}),M=(0,i.useMemo)(()=>[w,C,f,_,S,E],[]),P=(0,i.useMemo)(()=>function(e,t){if(!e.fields)return e;const a=new Map(t.map((e,t)=>[e.id,t])),i=[...e.fields].sort((e,t)=>{var i,r;return(null!==(i=a.get(e))&&void 0!==i?i:1/0)-(null!==(r=a.get(t))&&void 0!==r?r:1/0)});return{...e,fields:i}}(h,M),[h,M]),[V,Q]=(0,i.useState)([]),[F,B]=(0,i.useState)([]),[$,D]=(0,i.useState)(!1),Z=(0,i.useRef)(0),O=(0,i.useCallback)(e=>{Q(e),0!==e.length&&t(Number(e[0]))},[t]),U=(0,i.useCallback)(()=>{const e=h.page||1;$||e>=(L||1)||(D(!0),b({...h,page:e+1}))},[$,h,L,b]);return(0,i.useEffect)(()=>{const e=P.page||1,t=P.infiniteScrollEnabled;if(0===j.length&&1===e)return B([]),Z.current=e,void D(!1);0!==j.length&&(e>1&&Z.current===e||(1!==e&&t?(B(e=>{const t=new Set(e.map(e=>e.id)),a=j.filter(e=>!t.has(e.id));return a.length>0?[...e,...a]:e}),Z.current=e,D(!1)):(B(j),Z.current=e,D(!1))))},[j,P.page,P.search,P.infiniteScrollEnabled,P.filters]),(0,m.jsx)(r.Vw,{data:F,fields:M,view:P,onChangeView:b,isLoading:N||$,onClickItem:e=>t(e.id),isItemClickable:()=>!0,getItemId:e=>e.id.toString(),selection:V,onChangeSelection:O,empty:(0,m.jsx)(I,{}),paginationInfo:{totalItems:H,totalPages:L,infiniteScrollHandler:U},defaultLayouts:R})}var L=a(6427),M=a(2023),P=a(1958);const V=({html:e})=>{const t=e.replace(/\\(.)/g,"$1"),a=(0,v.decodeEntities)(t),i=(0,h.safeHTML)(a);return(0,m.jsx)("div",{dangerouslySetInnerHTML:{__html:i}})};function Q(){const e=(0,T.SQ)({strict:!1}),t=(0,T.Zp)(),a=e.postId,i=()=>{t({search:e=>{const{postId:t,...a}=e;return a}})},{record:r,isResolving:n}=(0,d.useEntityRecord)("postType","ap_post",null!=a?a:0),{records:s,isResolving:o}=(0,d.useEntityRecords)("root","comment",{post:null!=a?a:0,order:"asc",orderby:"date"}),c=r?.ap_tag||[],{records:l}=(0,d.useEntityRecords)("taxonomy","ap_tag",{include:c}),{selectedTagId:p,updateTagFilter:h}=(0,P.K)();if(!a)return null;if(n)return(0,m.jsx)("div",{className:"activitypub-inspector-loading",children:(0,m.jsx)(L.Spinner,{})});if(!r)return(0,m.jsx)("div",{className:"activitypub-inspector-loading",children:(0,u.__)("Post not found","activitypub")});const y=r.actor_info,b=(0,v.decodeEntities)(y?.name||(0,u.__)("Unknown author","activitypub")),f=y?.webfinger||"",_=y?.url||"",x=r.link||"",w=r.date?j(r.date):"";return(0,m.jsxs)("div",{className:"activitypub-inspector",children:[(0,m.jsxs)(L.Card,{className:"activitypub-inspector-card",children:[(0,m.jsx)(L.CardHeader,{children:(0,m.jsxs)("div",{className:"activitypub-inspector-header",children:[(0,m.jsx)(g.A,{item:r}),(0,m.jsxs)("div",{className:"activitypub-inspector-author",children:[(0,m.jsx)("a",{href:_,target:"_blank",rel:"noopener noreferrer",className:"activitypub-inspector-author-name",children:b}),(0,m.jsxs)("div",{className:"activitypub-inspector-meta",children:[f&&(0,m.jsx)("span",{className:"activitypub-inspector-webfinger",children:f}),w&&x&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"activitypub-inspector-separator",children:"·"}),(0,m.jsx)("a",{href:x,target:"_blank",rel:"noopener noreferrer",className:"activitypub-inspector-timestamp",children:w})]})]})]}),(0,m.jsx)(L.Button,{icon:M.A,label:(0,u.__)("Close","activitypub"),onClick:i,className:"activitypub-inspector-close"})]})}),(0,m.jsxs)(L.CardBody,{children:[r.title?.rendered&&(0,m.jsx)("h2",{children:(0,m.jsx)(V,{html:r.title.rendered})}),(r.content?.rendered||r.excerpt?.rendered)&&(0,m.jsx)(V,{html:r.content?.rendered||r.excerpt?.rendered||""}),l&&l.length>0&&(0,m.jsx)("div",{className:"activitypub-inspector-tags",children:l.map(e=>(0,m.jsxs)(L.Button,{size:"small",variant:"secondary",onClick:()=>{return t=e.id,void h(t,{onComplete:i});var t},"aria-pressed":p===e.id,"aria-label":/* translators: %s: tag name */ /* translators: %s: tag name */ -(0,u.sprintf)((0,u.__)("Filter by tag: %s","activitypub"),e.name),children:["#",e.name]},e.id))})]})]}),(o||s&&s.length>0)&&(0,m.jsxs)(L.Card,{className:"activitypub-inspector-card activitypub-inspector-comments-card",children:[(0,m.jsxs)(L.CardHeader,{children:[(0,u.__)("Comments","activitypub"),s&&s.length>0&&` (${s.length})`]}),(0,m.jsxs)(L.CardBody,{children:[o&&(0,m.jsx)(L.Spinner,{}),!o&&s&&s.length>0&&(0,m.jsx)("div",{children:s.map(e=>{const t=e.date_gmt?j(e.date_gmt):"";return(0,m.jsxs)("div",{className:"activitypub-inspector-comment",children:[(0,m.jsxs)("div",{className:"activitypub-inspector-comment-meta",children:[(0,m.jsx)("strong",{children:(0,v.decodeEntities)(e.author_name)}),t&&(0,m.jsx)("span",{className:"activitypub-inspector-comment-date",children:t})]}),(0,m.jsx)(V,{html:e.content.rendered})]},e.id)})}),!o&&(!s||0===s.length)&&(0,m.jsx)("p",{children:(0,u.__)("No comments yet.","activitypub")})]})]})]})}}}]); \ No newline at end of file diff --git a/build/app/feed-content.637834c1.js b/build/app/feed-content.637834c1.js new file mode 100644 index 0000000000..b2e838ffda --- /dev/null +++ b/build/app/feed-content.637834c1.js @@ -0,0 +1,5 @@ +"use strict";(globalThis.webpackChunkwordpress_activitypub=globalThis.webpackChunkwordpress_activitypub||[]).push([[579],[(e,t,i)=>{i.r(t),i.d(t,{inspector:()=>O,stage:()=>R});var a=i(6087),r=i(3965),n=i(7754),s=i(3832),c=i(7143),o=i(3582);const d=["id","date","modified","title","excerpt","content","actor_info","status","link","ap_object_type","ap_tag"],l=[],p=[];var u=i(7723),g=i(6007),m=i(790);(0,u.__)("Avatar","activitypub");var h=i(8537),v=i(8107),b=i(2769);function y(e){return(0,h.decodeEntities)((0,v.__unstableStripHTML)(e.excerpt?.rendered||e.content?.rendered||""))}const f={id:"content",label:(0,u.__)("Content","activitypub"),enableHiding:!1,enableSorting:!1,getValue:({item:e})=>y(e),render:function({item:e}){const{getObjectTypeName:t,isLoading:i}=(0,b.t)(),a=e.ap_object_type?.[0],r=t(a);if(i&&!r)return(0,m.jsx)("div",{className:"activitypub-feed-excerpt",children:" "});if("Note"===r){const t=(0,v.safeHTML)((0,h.decodeEntities)(e.content?.rendered||""));return(0,m.jsx)("div",{className:"activitypub-feed-post",children:(0,m.jsx)("div",{className:"activitypub-feed-content",dangerouslySetInnerHTML:{__html:t||"
"}})})}const n=y(e).trim();return(0,m.jsx)("div",{className:"activitypub-feed-excerpt",children:n||" "})}},_={id:"date",label:(0,u.__)("Date","activitypub"),enableHiding:!1,enableSorting:!0,getValue:({item:e})=>e.date||"",render:({item:e})=>e.date?new Date(e.date).toLocaleDateString():""};(0,u.__)("Following","activitypub");var x=i(8443);function j(e){const t=new Date(e.endsWith("Z")?e:e+"Z"),i=Date.now()-t.getTime(),a=Math.floor(i/6e4);if(a<60)return(0,u.sprintf)(/* translators: %d: number of minutes */ /* translators: %d: number of minutes */ +(0,u._x)("%dm","short time format: minutes","activitypub"),a);const r=Math.floor(i/36e5);if(r<24)return(0,u.sprintf)(/* translators: %d: number of hours */ /* translators: %d: number of hours */ +(0,u._x)("%dh","short time format: hours","activitypub"),r);const n=Math.floor(i/864e5);return n<7?(0,u.sprintf)(/* translators: %d: number of days */ /* translators: %d: number of days */ +(0,u._x)("%dd","short time format: days","activitypub"),n):(0,x.dateI18n)((0,x.getSettings)().formats.date,e)}const w={id:"metadata",label:(0,u.__)("Metadata","activitypub"),enableHiding:!0,enableSorting:!1,getValue:({item:e})=>`${e.actor_info?.name||""} · ${e.date?j(e.date):""}`,render:({item:e})=>{const t=(0,h.decodeEntities)(e.actor_info?.name||(0,u.__)("Unknown author","activitypub")),i=e.date?j(e.date):"";return(0,m.jsxs)("div",{className:"activitypub-feed-post-meta",children:[(0,m.jsx)(g.A,{item:e}),(0,m.jsx)("span",{className:"author",children:t}),i&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"separator",children:"·"}),(0,m.jsx)("span",{className:"date",children:i})]})]})}};(0,u.__)("Last Updated","activitypub"),(0,u.__)("Name","activitypub");var N=i(9993);const S={id:"ap_object_type",type:"integer",label:(0,u.__)("Type","activitypub"),enableHiding:!1,enableSorting:!1,getValue:({item:e})=>e.ap_object_type?.[0],getElements:async()=>{const e=await(0,c.resolveSelect)(o.store).getEntityRecords("taxonomy","ap_object_type",{per_page:-1,orderby:"count",order:"desc",hide_empty:!0});return e?e.map(e=>({value:e.id,label:N.M[e.name]?.label||e.name})):[]},render:()=>null,filterBy:{operators:["is"]}},E=((0,u.__)("Status","activitypub"),{id:"ap_tag",type:"integer",label:(0,u.__)("Tag","activitypub"),enableHiding:!1,enableSorting:!1,getValue:({item:e})=>{var t;return null!==(t=e.ap_tag)&&void 0!==t?t:[]},getElements:async()=>{const e=await(0,c.resolveSelect)(o.store).getEntityRecords("taxonomy","ap_tag",{per_page:10,orderby:"count",order:"desc",hide_empty:!0});return e?e.map(e=>({value:e.id,label:`#${e.name}`})):[]},render:()=>null,filterBy:{operators:["isAny"]}}),A={id:"title.rendered",label:(0,u.__)("Title","activitypub"),enableHiding:!0,enableSorting:!1,enableGlobalSearch:!0,getValue:({item:e})=>(0,h.decodeEntities)(e.title?.rendered||""),render:({item:e})=>{if(!e.title?.rendered)return null;const t=e.title.rendered.replace(/\\(.)/g,"$1");return(0,m.jsx)("div",{className:"activitypub-feed-post-title",children:(0,h.decodeEntities)(t)})}};(0,u.__)("Profile","activitypub");var C=i(3834);function I(){const e=(0,c.useSelect)(e=>e(C.E).getActiveActorId(),[]),{view:t}=(0,n.l)({kind:"postType",name:"ap_post",slug:"feed",defaultView:{type:"list",search:"",filters:[]}});if(t.search||t.filters&&t.filters.length>0)return(0,m.jsx)("p",{children:(0,u.__)("No posts found.","activitypub")});const i=0===e?(0,s.addQueryArgs)("options-general.php",{page:"activitypub",tab:"following"}):(0,s.addQueryArgs)("users.php",{page:"activitypub-following-list"});return(0,m.jsx)("p",{children:(0,a.createInterpolateElement)((0,u.__)("Your feed is waiting to come alive. Follow more people on the Fediverse to see their posts here.","activitypub"),{a:(0,m.jsx)("a",{href:i})})})}var k=i(9304);const T={type:"list",perPage:20,page:1,sort:{field:"date",direction:"desc"},search:"",filters:[],fields:["metadata","title.rendered","content"],infiniteScrollEnabled:!0},M={list:{primaryField:"metadata",fields:["metadata","title.rendered","content"],mediaField:void 0}};function R(){const e=(0,k.Zp)(),t=(0,a.useCallback)(t=>{e({search:e=>({...e,postId:t})})},[e]),i=(0,c.useSelect)(e=>e(C.E).getActiveActorId(),[]),[u,g]=(0,a.useState)(()=>{const e=(0,s.getQueryArgs)(window.location.href);return{page:e.paged?Number(e.paged):void 0,search:e.search||void 0}});(0,a.useEffect)(()=>{const e=()=>{const e=(0,s.getQueryArgs)(window.location.href);g({page:e.paged?Number(e.paged):void 0,search:e.search||void 0})};return window.addEventListener("popstate",e),window.addEventListener("hashchange",e),()=>{window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)}},[]);const h=(0,a.useCallback)(e=>{const t=window.location.href,i=(0,s.getQueryArgs)(t),a=(0,s.addQueryArgs)(t,{...i,paged:e.page||void 0,search:e.search||void 0});window.history.pushState(null,"",a),g({page:e.page,search:e.search})},[]),{view:v,updateView:b}=(0,n.l)({kind:"postType",name:"ap_post",slug:"feed",defaultView:T,queryParams:u,onChangeQueryParams:h}),y=(0,a.useCallback)(e=>{const t=JSON.stringify(v.filters)!==JSON.stringify(e.filters)?1:e.page??1;b({...e,page:t})},[v.filters,b]),x=(0,a.useRef)(i);(0,a.useEffect)(()=>{x.current!==i&&(b({...T,fields:v.fields}),x.current=i)},[i]);const{feed:j,isResolving:N,totalItems:R,totalPages:H}=function({perPage:e=20,page:t=1,orderBy:i="date",order:r="desc",search:n="",userId:s,fields:c=d,filters:u=l}={}){const g=null!=s,m=(0,a.useMemo)(()=>{const a={per_page:e,page:t,orderby:i,order:r,search:n,_fields:c};g&&(a.user_id=s);const o=u.find(e=>"ap_object_type"===e.field);void 0!==o?.value&&(a.ap_object_type=Array.isArray(o.value)?o.value:[o.value]);const d=u.find(e=>"ap_tag"===e.field);return void 0!==d?.value&&(a.ap_tag=d.value),a},[e,t,i,r,n,s,c,g,u]),{records:h,hasResolved:v,isResolving:b,totalItems:y,totalPages:f}=(0,o.useEntityRecords)("postType","ap_post",m,{enabled:g});return{feed:g&&h||p,hasResolved:v,isResolving:b,totalItems:g?y:null,totalPages:g?f:null}}({perPage:v.perPage||20,page:v.page||1,orderBy:v.sort?.field||"date",order:v.sort?.direction||"desc",search:v.search||"",userId:i,filters:v.filters||T.filters}),L=(0,a.useMemo)(()=>[w,A,f,_,S,E],[]),P=(0,a.useMemo)(()=>function(e,t){if(!e.fields)return e;const i=new Map(t.map((e,t)=>[e.id,t])),a=[...e.fields].sort((e,t)=>(i.get(e)??1/0)-(i.get(t)??1/0));return{...e,fields:a}}(v,L),[v,L]),[Q,F]=(0,a.useState)([]),[V,B]=(0,a.useState)([]),[$,D]=(0,a.useState)(!1),Z=(0,a.useRef)(0),O=(0,a.useCallback)(e=>{F(e),0!==e.length&&t(Number(e[0]))},[t]),U=(0,a.useCallback)(()=>{const e=v.page||1;$||e>=(H||1)||(D(!0),y({...v,page:e+1}))},[$,v,H,y]);return(0,a.useEffect)(()=>{const e=P.page||1,t=P.infiniteScrollEnabled;if(0===j.length&&1===e)return B([]),Z.current=e,void D(!1);0!==j.length&&(e>1&&Z.current===e||(1!==e&&t?(B(e=>{const t=new Set(e.map(e=>e.id)),i=j.filter(e=>!t.has(e.id));return i.length>0?[...e,...i]:e}),Z.current=e,D(!1)):(B(j),Z.current=e,D(!1))))},[j,P.page,P.search,P.infiniteScrollEnabled,P.filters]),(0,m.jsx)(r.Vw,{data:V,fields:L,view:P,onChangeView:y,isLoading:N||$,onClickItem:e=>t(e.id),isItemClickable:()=>!0,getItemId:e=>e.id.toString(),selection:Q,onChangeSelection:O,empty:(0,m.jsx)(I,{}),paginationInfo:{totalItems:R,totalPages:H,infiniteScrollHandler:U},defaultLayouts:M})}var H=i(6427),L=i(2023),P=i(7809),Q=i(7204),F=i(974),V=i(2215);const B=[function(){const e=[{id:"new-post",label:(0,u.__)("New Post","activitypub"),icon:P.A,href:"post-new.php"},{id:"followers",label:(0,u.__)("Followers","activitypub"),icon:Q.A,href:(0,s.addQueryArgs)("users.php",{page:"activitypub-followers-list"})},{id:"following",label:(0,u.__)("Following","activitypub"),icon:Q.A,href:(0,s.addQueryArgs)("users.php",{page:"activitypub-following-list"})},{id:"settings",label:(0,u.__)("Settings","activitypub"),icon:F.A,href:(0,s.addQueryArgs)("admin.php",{page:"activitypub"})}];return(0,m.jsxs)("div",{className:"inspector-widget navigation-widget",children:[(0,m.jsx)("h2",{className:"inspector-widget__title",children:(0,u.__)("Quick Actions","activitypub")}),(0,m.jsx)("div",{className:"inspector-widget__content",children:(0,m.jsx)(H.MenuGroup,{children:e.map(e=>(0,m.jsxs)(H.MenuItem,{href:e.href,className:"menu-item",children:[(0,m.jsx)(H.Icon,{icon:e.icon,size:20}),(0,m.jsx)("span",{children:e.label})]},e.id))})})]})},function(){return(0,m.jsxs)("div",{className:"inspector-widget trending-widget",children:[(0,m.jsx)("h2",{className:"inspector-widget__title",children:(0,u.__)("Trending","activitypub")}),(0,m.jsx)("div",{className:"inspector-widget__content",children:(0,m.jsx)(V.n,{})})]})}];function $(){return(0,m.jsx)("div",{className:"inspector-sidebar",children:B.map((e,t)=>(0,m.jsx)(e,{},t))})}var D=i(1958);const Z=({html:e})=>{const t=e.replace(/\\(.)/g,"$1"),i=(0,h.decodeEntities)(t),a=(0,v.safeHTML)(i);return(0,m.jsx)("div",{dangerouslySetInnerHTML:{__html:a}})};function O(){const e=(0,k.SQ)({strict:!1}),t=(0,k.Zp)(),i=e.postId,a=()=>{t({search:e=>{const{postId:t,...i}=e;return i}})},{record:r,isResolving:n}=(0,o.useEntityRecord)("postType","ap_post",i??0),{records:s,isResolving:c}=(0,o.useEntityRecords)("root","comment",{post:i??0,order:"asc",orderby:"date"}),d=r?.ap_tag||[],{records:l}=(0,o.useEntityRecords)("taxonomy","ap_tag",{include:d}),{selectedTagId:p,updateTagFilter:v}=(0,D.K)();if(!i)return(0,m.jsx)($,{});if(n)return(0,m.jsx)("div",{className:"activitypub-inspector-loading",children:(0,m.jsx)(H.Spinner,{})});if(!r)return(0,m.jsx)("div",{className:"activitypub-inspector-loading",children:(0,u.__)("Post not found","activitypub")});const b=r.actor_info,y=(0,h.decodeEntities)(b?.name||(0,u.__)("Unknown author","activitypub")),f=b?.webfinger||"",_=b?.url||"",x=r.link||"",w=r.date?j(r.date):"";return(0,m.jsxs)("div",{className:"activitypub-inspector",children:[(0,m.jsxs)(H.Card,{className:"activitypub-inspector-card",children:[(0,m.jsx)(H.CardHeader,{children:(0,m.jsxs)("div",{className:"activitypub-inspector-header",children:[(0,m.jsx)(g.A,{item:r}),(0,m.jsxs)("div",{className:"activitypub-inspector-author",children:[(0,m.jsx)("a",{href:_,target:"_blank",rel:"noopener noreferrer",className:"activitypub-inspector-author-name",children:y}),(0,m.jsxs)("div",{className:"activitypub-inspector-meta",children:[f&&(0,m.jsx)("span",{className:"activitypub-inspector-webfinger",children:f}),w&&x&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"activitypub-inspector-separator",children:"·"}),(0,m.jsx)("a",{href:x,target:"_blank",rel:"noopener noreferrer",className:"activitypub-inspector-timestamp",children:w})]})]})]}),(0,m.jsx)(H.Button,{icon:L.A,label:(0,u.__)("Close","activitypub"),onClick:a,className:"activitypub-inspector-close"})]})}),(0,m.jsxs)(H.CardBody,{children:[r.title?.rendered&&(0,m.jsx)("h2",{children:(0,m.jsx)(Z,{html:r.title.rendered})}),(r.content?.rendered||r.excerpt?.rendered)&&(0,m.jsx)(Z,{html:r.content?.rendered||r.excerpt?.rendered||""}),l&&l.length>0&&(0,m.jsx)("div",{className:"activitypub-inspector-tags",children:l.map(e=>(0,m.jsxs)(H.Button,{size:"small",variant:"secondary",onClick:()=>{return t=e.id,void v(t,{onComplete:a});var t},"aria-pressed":p===e.id,"aria-label":/* translators: %s: tag name */ /* translators: %s: tag name */ +(0,u.sprintf)((0,u.__)("Filter by tag: %s","activitypub"),e.name),children:["#",e.name]},e.id))})]})]}),(c||s&&s.length>0)&&(0,m.jsxs)(H.Card,{className:"activitypub-inspector-card activitypub-inspector-comments-card",children:[(0,m.jsxs)(H.CardHeader,{children:[(0,u.__)("Comments","activitypub"),s&&s.length>0&&` (${s.length})`]}),(0,m.jsxs)(H.CardBody,{children:[c&&(0,m.jsx)(H.Spinner,{}),!c&&s&&s.length>0&&(0,m.jsx)("div",{children:s.map(e=>{const t=e.date_gmt?j(e.date_gmt):"";return(0,m.jsxs)("div",{className:"activitypub-inspector-comment",children:[(0,m.jsxs)("div",{className:"activitypub-inspector-comment-meta",children:[(0,m.jsx)("strong",{children:(0,h.decodeEntities)(e.author_name)}),t&&(0,m.jsx)("span",{className:"activitypub-inspector-comment-date",children:t})]}),(0,m.jsx)(Z,{html:e.content.rendered})]},e.id)})}),!c&&(!s||0===s.length)&&(0,m.jsx)("p",{children:(0,u.__)("No comments yet.","activitypub")})]})]})]})}}]]); \ No newline at end of file diff --git a/build/app/feed-route.20fab139.js b/build/app/feed-route.0befe523.js similarity index 60% rename from build/app/feed-route.20fab139.js rename to build/app/feed-route.0befe523.js index 5e961b6047..a515a8ed46 100644 --- a/build/app/feed-route.20fab139.js +++ b/build/app/feed-route.0befe523.js @@ -1 +1 @@ -"use strict";(globalThis.webpackChunkwordpress_activitypub=globalThis.webpackChunkwordpress_activitypub||[]).push([[843],{4831(s,t,p){p.r(t),p.d(t,{route:()=>r});const r={inspector:({search:s})=>!!s.postId}}}]); \ No newline at end of file +"use strict";(globalThis.webpackChunkwordpress_activitypub=globalThis.webpackChunkwordpress_activitypub||[]).push([[843],{4831(s,t,i){i.r(t),i.d(t,{route:()=>p});const p={inspector:()=>!0}}}]); \ No newline at end of file diff --git a/build/app/index.asset.php b/build/app/index.asset.php index 5a6a4f9292..2dddfce7f1 100644 --- a/build/app/index.asset.php +++ b/build/app/index.asset.php @@ -1 +1 @@ - array('react', 'react-dom', 'react-jsx-runtime', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-private-apis', 'wp-url'), 'version' => '2634332f8f7d3b5c3a04'); + array('react', 'react-dom', 'react-jsx-runtime', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-url'), 'version' => '8716f609f088000a4db9'); diff --git a/build/app/index.js b/build/app/index.js index f46f53f9b5..49c25f1613 100644 --- a/build/app/index.js +++ b/build/app/index.js @@ -1,4 +1,4 @@ -(()=>{"use strict";var e,t,i,r,n,a={6007(e,t,i){i.d(t,{A:()=>a,k:()=>n});var r=i(790);const n="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Crect width='200' height='200' fill='%23f0f0f0'/%3E%3Cpath fill='%23c6c6c6' d='M32,201 C22,201 12,201 1,201 C1,134 1,68 1,1 C68,1 134,1 201,1 C201,68 201,134 201,201 C194,201 186,201 178,201 C174,184 165,172 149,166 C145,164 139,163 134,162 C131,161 128,160 126,158 C123,156 122,154 126,151 C147,137 154,112 145,89 C139,70 122,58 104,59 C90,59 79,66 71,77 C54,101 60,135 84,151 C88,154 88,155 84,158 C81,160 78,161 75,162 C53,167 38,179 32,201z'/%3E%3C/svg%3E";function a({item:e}){const t=e.actor_info?.icon||n,i=e.actor_info?.name||e.actor_info?.username||"";return(0,r.jsx)("img",{alt:i,src:t,className:"activitypub-avatar",onError:e=>{e.target.src=n},...!i&&{role:"presentation"}})}},9993(e,t,i){i.d(t,{l:()=>w,M:()=>x});var r=i(3582),n=i(7143),a=i(6427),s=i(7723),o=i(7947),c=i(7028),l=i(3560),d=i(4539),p=i(5506),u=i(2285),m=i(8087),v=i(7884),f=i(618),h=i(3834),b=i(6087),_=i(7545),g=i(9304),y=i(790);const x={Article:{label:(0,s.__)("Articles","activitypub"),icon:o.A},Note:{label:(0,s.__)("Notes & Updates","activitypub"),icon:c.A},Image:{label:(0,s.__)("Photos & Images","activitypub"),icon:l.A},Event:{label:(0,s.__)("Events & Meetups","activitypub"),icon:d.A},Video:{label:(0,s.__)("Videos","activitypub"),icon:p.A},Audio:{label:(0,s.__)("Music & Podcasts","activitypub"),icon:u.A},Document:{label:(0,s.__)("Documents & Files","activitypub"),icon:m.A},Page:{label:(0,s.__)("Pages","activitypub"),icon:v.A},Place:{label:(0,s.__)("Places & Locations","activitypub"),icon:f.A}};function w(){const e=(0,n.useSelect)(e=>e(h.E).getActiveActorId(),[]),t=null!==e,{records:i,isResolving:o}=(0,r.useEntityRecords)("taxonomy","ap_object_type",t?{per_page:-1,user_id:e}:void 0),{selectedObjectTypeId:c,updateObjectTypeFilter:l}=function(){const e=(0,g.Zp)(),{view:t,updateView:i}=(0,_.lQ)({kind:"postType",name:"ap_post",slug:"feed",defaultView:{type:"list",filters:[]}});return{selectedObjectTypeId:(0,b.useMemo)(()=>{var e;const i=t.filters?.find(e=>"ap_object_type"===e.field);return null!==(e=i?.value)&&void 0!==e?e:null},[t.filters]),updateObjectTypeFilter:(0,b.useCallback)((r,n={})=>{const a=t.filters||[],s=a.findIndex(e=>"ap_object_type"===e.field);let o;o=null===r?a.filter(e=>"ap_object_type"!==e.field):-1!==s?a[s].value===r?a.filter(e=>"ap_object_type"!==e.field):[...a.slice(0,s),{field:"ap_object_type",operator:"is",value:r},...a.slice(s+1)]:[...a,{field:"ap_object_type",operator:"is",value:r}],i({...t,filters:o,page:1}),e({search:e=>{const{postId:t,...i}=e;return i}}),n.onComplete&&n.onComplete()},[t,i,e])}}();if(o||!i||0===i.length)return null;const d=i.filter(e=>!!x[e.name]);if(d.length<=1)return null;const p=Object.keys(x),u=[...d].sort((e,t)=>p.indexOf(e.name)-p.indexOf(t.name));return(0,y.jsx)(a.MenuGroup,{className:"object-types-menu",children:u.map(e=>{const t=x[e.name];return(0,y.jsxs)(a.MenuItem,{onClick:()=>{return t=e.id,l(c===t?null:t);var t},className:"menu-item","aria-pressed":c===e.id,"aria-label":/* translators: %s: object type name */ /* translators: %s: object type name */ -(0,s.sprintf)((0,s.__)("Filter by type: %s","activitypub"),t.label),children:[(0,y.jsx)(a.Icon,{icon:t.icon,size:24}),(0,y.jsx)("span",{children:t.label})]},e.id)})})}},2769(e,t,i){i.d(t,{N:()=>c,t:()=>l});var r=i(6087),n=i(7143),a=i(3582),s=i(790);const o=(0,r.createContext)({getObjectTypeName:()=>null,isLoading:!0});function c({children:e}){const{terms:t,isResolving:i}=(0,n.useSelect)(e=>{const t=e(a.store);return{terms:t.getEntityRecords("taxonomy","ap_object_type",{per_page:-1}),isResolving:t.isResolving("getEntityRecords",["taxonomy","ap_object_type",{per_page:-1}])}},[]),c=(0,r.useMemo)(()=>t?new Map(t.map(e=>[e.id,e.name])):new Map,[t]),l=(0,r.useCallback)(e=>e&&c.get(e)||null,[c]),d=(0,r.useMemo)(()=>({getObjectTypeName:l,isLoading:i}),[l,i]);return(0,s.jsx)(o.Provider,{value:d,children:e})}function l(){return(0,r.useContext)(o)}},1958(e,t,i){i.d(t,{K:()=>s});var r=i(6087),n=i(7545),a=i(9304);function s(){const e=(0,a.Zp)(),{view:t,updateView:i}=(0,n.lQ)({kind:"postType",name:"ap_post",slug:"feed",defaultView:{type:"list",filters:[]}});return{selectedTagId:(0,r.useMemo)(()=>{var e;const i=t.filters?.find(e=>"ap_tag"===e.field),r=null!==(e=i?.value)&&void 0!==e?e:[];return 1===r.length?r[0]:null},[t.filters]),updateTagFilter:(0,r.useCallback)((r,n={})=>{const a=t.filters||[],s=a.findIndex(e=>"ap_tag"===e.field);let o;if(null===r)o=a.filter(e=>"ap_tag"!==e.field);else if(-1!==s){const e=a[s].value;o=Array.isArray(e)&&e.includes(r)?a.filter(e=>"ap_tag"!==e.field):[...a.slice(0,s),{field:"ap_tag",operator:"isAny",value:[r]},...a.slice(s+1)]}else o=[...a,{field:"ap_tag",operator:"isAny",value:[r]}];i({...t,filters:o,page:1}),e({search:e=>{const{postId:t,...i}=e;return i}}),n.onComplete&&n.onComplete()},[t,i,e])}}},5158(e,t,i){var r=i(6087),n=i(6427);const a=window.wp.keyboardShortcuts;var s=i(9304),o=i(7143);const c=window.wp.notices,l=window.wp.compose;var d=i(7723),p=i(5016),u=i(5367),m=i(5492),v=i(974),f=i(3832),h=i(7545),b=i(3582),_=i(8537),g=i(5069),y=i(5992);const x=window.wp.commands,w=window.wp.keycodes;var j=i(4164),A=i(9474),C=i(790);const N=function({className:e}){const{isRequestingSite:t,siteIconUrl:i}=(0,o.useSelect)(e=>{const{getEntityRecord:t}=e(b.store),i=t("root","__unstableBase",void 0);return{isRequestingSite:!i,siteIconUrl:i?.site_icon_url}},[]);let r=(0,C.jsx)(n.Icon,{className:"site-icon__icon",icon:A.A,size:32});return t?r=(0,C.jsx)("div",{className:"site-icon__image"}):i&&(r=(0,C.jsx)("img",{className:"site-icon__image",alt:(0,d.__)("Site Icon","activitypub"),src:i})),(0,C.jsx)("div",{className:(0,j.A)(e,"site-icon"),children:r})},k=(0,r.forwardRef)(function({onMenuClick:e,title:t},i){return(0,C.jsxs)("div",{className:"site-hub-mobile",ref:i,children:[(0,C.jsxs)(n.__experimentalHStack,{spacing:2,justify:"flex-start",children:[(0,C.jsx)(n.Button,{icon:(0,d.isRTL)()?u.A:m.A,href:"/wp-admin/",label:(0,d.__)("Go to the Dashboard","activitypub"),className:"site-hub-mobile__button",size:"compact"}),(0,C.jsx)("span",{className:"site-hub-mobile__title",children:t||(0,d.__)("Social Web","activitypub")})]}),(0,C.jsx)(n.Button,{icon:y.A,onClick:e,label:(0,d.__)("Open menu","activitypub"),className:"site-hub-mobile__button",size:"compact"})]})}),S=function(){const{homeUrl:e,siteTitle:t}=(0,o.useSelect)(e=>{const{getEntityRecord:t}=e(b.store),i=t("root","__unstableBase");return{homeUrl:i?.home,siteTitle:!i?.name&&i?.url?(0,f.filterURLForDisplay)(i?.url):i?.name}},[]),{open:i}=(0,o.useDispatch)(x.store);return(0,C.jsx)("div",{className:"site-hub",children:(0,C.jsxs)(n.__experimentalHStack,{justify:"flex-start",spacing:"0",children:[(0,C.jsx)("div",{className:"site-hub__icon-container",children:(0,C.jsx)(n.Button,{__next40pxDefaultSize:!0,href:"/wp-admin/",label:(0,d.__)("Go to the Dashboard","activitypub"),className:"site-hub__icon-button",style:{transform:"scale(0.5333) translateX(-4px)",borderRadius:4},children:(0,C.jsx)(N,{className:"site-hub__icon"})})}),(0,C.jsxs)(n.__experimentalHStack,{children:[(0,C.jsx)("div",{className:"site-hub__title",children:(0,C.jsxs)(n.Button,{variant:"link",href:e,target:"_blank",children:[(0,_.decodeEntities)(t),(0,C.jsx)(n.VisuallyHidden,{as:"span",children:/* translators: accessibility text */ /* translators: accessibility text */ -(0,d.__)("(opens in a new tab)","activitypub")})]})}),(0,C.jsx)(n.__experimentalHStack,{spacing:0,expanded:!1,className:"site-hub__actions",children:(0,C.jsx)(n.Button,{size:"compact",className:"site-hub__command-button",icon:g.A,onClick:i,label:(0,d.__)("Open command palette","activitypub"),shortcut:w.displayShortcut.primary("k")})})]})]})})};var I=i(3834),E=i(6007);const P="actor_blog";function T(){const e=(0,s.Zp)(),{setActiveActor:t}=(0,o.useDispatch)(I.E),{currentUser:i,activeActorId:a,actorMode:c,hasUserCap:l,hasBlogCap:p}=(0,o.useSelect)(e=>{var t;return{currentUser:e(b.store).getCurrentUser(),activeActorId:e(I.E).getActiveActorId(),actorMode:null!==(t=e(b.store).getEntityRecord("root","site")?.activitypub_actor_mode)&&void 0!==t?t:P,hasUserCap:e(b.store).canUser("create",{kind:"postType",name:"ap_extrafield"}),hasBlogCap:e(b.store).canUser("create",{kind:"postType",name:"ap_extrafield_blog"})}},[]),u=("actor"===c||c===P)&&l,m=("blog"===c||c===P)&&p,v=i?.id,h=u&&m,_=0===a;(0,r.useEffect)(()=>{_&&!m&&u&&v?t(v):_||u||!m||t(0)},[_,u,m,v,t]);const g=i?.avatar_urls?.[48]||E.k,y=_?(0,d.__)("Site","activitypub"):i?.name||"",x=m&&!u?(0,f.addQueryArgs)("options-general.php",{page:"activitypub",tab:"blog-profile"}):"profile.php#activitypub";return(0,C.jsx)(n.Button,{...h?{onClick:()=>{h&&v&&(t(0===a?v:0),e({search:e=>{const{postId:t,...i}=e;return i}}))}}:{href:x},className:"actor-switcher",label:h?(0,d.__)("Switch Actor","activitypub"):(0,d.__)("Profile","activitypub"),children:(0,C.jsxs)(n.__experimentalHStack,{spacing:2,alignment:"center",children:[_?(0,C.jsx)(N,{className:"actor-switcher__avatar"}):(0,C.jsx)("img",{src:g,alt:y,className:"actor-switcher__avatar",onError:e=>{e.currentTarget.src=E.k}}),(0,C.jsx)("span",{className:"actor-switcher__name",children:y})]})})}var O=i(9993),R=i(1958);function M(){const{records:e,isResolving:t}=(0,b.useEntityRecords)("taxonomy","ap_tag",{per_page:5,orderby:"count",order:"desc",hide_empty:!0}),{selectedTagId:i,updateTagFilter:r}=(0,R.K)();return t||!e||0===e.length?null:(0,C.jsxs)("div",{className:"popular-tags",children:[(0,C.jsx)("h3",{className:"popular-tags__title",children:(0,d.__)("Popular Tags","activitypub")}),(0,C.jsx)(n.MenuGroup,{children:e.map(e=>(0,C.jsx)(n.MenuItem,{onClick:()=>{return t=e.id,r(i===t?null:t);var t},className:"menu-item","aria-pressed":i===e.id,"aria-label":/* translators: %s: tag name */ /* translators: %s: tag name */ -(0,d.sprintf)((0,d.__)("Filter by tag: %s","activitypub"),e.name),children:(0,C.jsxs)("span",{children:["#",e.name]})},e.id))})]})}function L({menuItem:{description:e}}){if(!e)return null;if("string"==typeof e)return(0,C.jsx)("p",{className:"sidebar-description",children:e});const t=e;return(0,C.jsx)("p",{className:"sidebar-description",children:(0,C.jsx)(t,{})})}const F=[{id:"feed",path:"/",label:(0,d.__)("Feed","activitypub"),icon:p.A,description:function(){const e=0===(0,o.useSelect)(e=>e(I.E).getActiveActorId(),[])?(0,d.__)("Posts from accounts this site follows.","activitypub"):(0,d.__)("Posts from accounts you follow.","activitypub");return(0,C.jsx)(C.Fragment,{children:e})}}];function z(){const e=(0,s.zy)(),t=(0,s.Zp)(),{hasActiveFilters:i,clearAllFilters:a}=function(){const{view:e,updateView:t}=(0,h.lQ)({kind:"postType",name:"ap_post",slug:"feed",defaultView:{type:"list",filters:[]}});return{hasActiveFilters:(0,r.useMemo)(()=>{var t;return(null!==(t=e.filters?.length)&&void 0!==t?t:0)>0},[e.filters]),clearAllFilters:(0,r.useCallback)(()=>{t({...e,filters:[],page:1})},[e,t])}}(),o=t=>e.pathname===t,c=o("/")&&!i,l=F.find(e=>o(e.path));return(0,C.jsxs)("div",{className:"sidebar",children:[(0,C.jsx)(S,{}),(0,C.jsxs)("nav",{className:"nav",children:[(0,C.jsxs)(n.__experimentalHStack,{spacing:3,alignment:"flex-start",className:"sidebar-navigation__icon-title",children:[(0,C.jsx)(n.Button,{className:"sidebar-navigation__button",size:"compact",icon:(0,d.isRTL)()?u.A:m.A,href:"/wp-admin/",label:(0,d.__)("Go to the Dashboard","activitypub")}),(0,C.jsx)(n.__experimentalHeading,{className:"sidebar-navigation__title",level:1,size:20,children:(0,d.__)("Social Web","activitypub")})]}),(0,C.jsxs)(n.NavigableMenu,{children:[(0,C.jsx)(L,{menuItem:l}),(0,C.jsx)(n.MenuGroup,{children:F.map(e=>(0,C.jsxs)(n.MenuItem,{isSelected:"/"===e.path?c:o(e.path),onClick:()=>{return"/"===(i=e.path)&&a(),void t({to:i});var i},className:"menu-item",children:[e.icon&&(0,C.jsx)(n.Icon,{icon:e.icon,size:24}),(0,C.jsx)("span",{children:e.label})]},e.id))})]}),o("/")&&(0,C.jsx)(O.l,{})]}),o("/")&&(0,C.jsx)(M,{}),(0,C.jsx)("div",{className:"footer",children:(0,C.jsxs)(n.__experimentalHStack,{justify:"space-between",alignment:"center",children:[(0,C.jsx)(T,{}),(0,C.jsx)(n.Button,{icon:v.A,iconSize:20,size:"compact",href:(0,f.addQueryArgs)("admin.php",{page:"activitypub"}),target:"_blank",label:(0,d.__)("Settings","activitypub"),className:"footer-settings-button"})]})})]})}function U(){const e=(0,l.useViewportMatch)("medium","<"),t=(0,s.zy)(),i=(0,l.useReducedMotion)(),[a,p]=(0,r.useState)(!1),u=(0,r.useMemo)(()=>{const e=F.find(e=>e.path===t.pathname);return e?.label||(0,d.__)("Social Web","activitypub")},[t.pathname]);(0,r.useEffect)(()=>{p(!1)},[t.pathname,e]);const m=(0,o.useSelect)(e=>{const{getNotices:t}=e(c.store);return t().filter(e=>"snackbar"===e.type)},[]),{removeNotice:v}=(0,o.useDispatch)(c.store);return(0,C.jsxs)("div",{className:"app-layout",children:[(0,C.jsx)(n.__unstableAnimatePresence,{children:e&&a&&(0,C.jsx)(n.__unstableMotion.div,{className:"sidebar-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{type:"tween",duration:i?0:.2,ease:"easeOut"},onClick:()=>p(!1),onKeyDown:e=>{"Escape"===e.key&&p(!1)},role:"button",tabIndex:-1,"aria-label":(0,d.__)("Close menu","activitypub")})}),(0,C.jsx)(n.__unstableAnimatePresence,{children:e&&a&&(0,C.jsx)(n.__unstableMotion.div,{className:"sidebar-region is-mobile",initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"tween",duration:i?0:.2,ease:"easeOut"},children:(0,C.jsx)(z,{})})}),!e&&(0,C.jsxs)("div",{className:"app-content",children:[(0,C.jsx)("div",{className:"sidebar-region",children:(0,C.jsx)(z,{})}),(0,C.jsx)(s.sv,{})]}),e&&(0,C.jsxs)("div",{className:"app-content is-mobile",children:[(0,C.jsx)(k,{title:u,onMenuClick:()=>p(!0)}),(0,C.jsx)(s.sv,{})]}),(0,C.jsx)(n.SnackbarList,{notices:m,onRemove:v})]})}const B=(0,r.createContext)(void 0);function D({children:e,settings:t}){return(0,C.jsx)(B.Provider,{value:t,children:e})}var H=i(2769);const V=[{path:"/",contentLoader:()=>Promise.all([i.e(668),i.e(247),i.e(579)]).then(i.bind(i,713)),routeLoader:()=>i.e(843).then(i.bind(i,4831))}];window.wp=window.wp||{},window.wp.activitypubApp={initialize:function(e,t){const i=document.getElementById(e);i&&(0,r.createRoot)(i).render((0,C.jsx)(D,{settings:t,children:(0,C.jsx)(H.N,{children:(0,C.jsx)(a.ShortcutProvider,{children:(0,C.jsx)(n.SlotFillProvider,{children:(0,C.jsx)(s.Ay,{routes:V,rootComponent:U})})})})}))}}},9304(e,t,i){i.d(t,{sv:()=>o.s,Ay:()=>w,zy:()=>s.z,Zp:()=>n.Z,SQ:()=>a.S});var r=i(1315),n=i(2166),a=i(8081),s=i(8590),o=i(6918),c=i(9681),l=i(7003),d=i(6037),p=i(5698),u=i(362),m=i(7410),v=i(6087),f=i(6427),h=i(7723),b=i(4164),_=i(790);function g({className:e,children:t}){return(0,_.jsx)("div",{className:(0,b.A)("themed-surface",e),children:t})}function y({className:e,children:t}){return(0,_.jsx)("div",{className:(0,b.A)("panel",e),children:(0,_.jsx)(g,{children:t})})}function x(){return(0,_.jsx)("div",{style:{padding:"20px",textAlign:"center"},children:(0,h.__)("Page not found","activitypub")})}function w({routes:e,rootComponent:t}){const[i,n]=(0,v.useState)(null);return(0,v.useEffect)(()=>{let i=!1;return async function(){const a=(0,r.zR)({parseLocation:()=>{const e=new URL(window.location.href),t=`${e.searchParams.get("p")||"/"}${e.hash}`;return(0,r.dy)(t,window.history.state)},createHref:e=>{const t=new URLSearchParams(window.location.search);return t.set("p",e),`${window.location.pathname}?${t}`}}),s=await async function(e,t){const i=(0,l.gI)({component:t,context:()=>({})}),r=await Promise.all(e.map(e=>async function(e,t){let i={};if(e.routeLoader){const t=await e.routeLoader();i=t.route||{}}return(0,l.un)({getParentRoute:()=>t,path:e.path,beforeLoad:i.beforeLoad?e=>i.beforeLoad({params:e.params||{},search:e.search||{}}):void 0,loader:async e=>{const t={params:e.params||{},search:e.deps||{}},[,r]=await Promise.all([i.loader?i.loader(t):Promise.resolve(void 0),i.inspector?i.inspector(t):Promise.resolve(!0)]);return{inspector:r}},loaderDeps:e=>e.search}).lazy(async()=>{const t=e.contentLoader?await e.contentLoader():{},i=t.stage,r=t.inspector;return(0,d.AF)(e.path)({component:function(){var t;const n=(0,p.L)({from:e.path}),a=null!==(t=n?.inspector)&&void 0!==t&&t;return(0,_.jsxs)(_.Fragment,{children:[i&&(0,_.jsx)("div",{className:"stage-region",children:(0,_.jsx)(y,{children:(0,_.jsx)(i,{})})}),r&&a&&(0,_.jsx)("div",{className:"inspector-region",children:(0,_.jsx)(y,{children:(0,_.jsx)(r,{})})})]})}})})}(e,i)));return i.addChildren(r)}(e,t);if(!i){const e=(0,u.a)({history:a,routeTree:s,defaultPreload:"intent",defaultNotFoundComponent:x});n(e)}}(),()=>{i=!0}},[e,t]),i?(0,_.jsx)(m.p,{router:i}):(0,_.jsx)("div",{style:{padding:"20px",textAlign:"center"},children:(0,_.jsx)(f.Spinner,{})})}(0,c.d)({defaultPreload:"intent"})},3834(e,t,i){i.d(t,{E:()=>p});var r=i(7143);const n=window.wp.dataControls;var a=i(1233);const s="SET_ACTIVE_ACTOR",o={activeActorId:null},c={setActiveActor:e=>((0,r.dispatch)(a.store).set("activitypub/app","activeActorId",e),{type:s,actorId:e})};var l=i(3582);const d={getActiveActorId:(0,r.createRegistrySelector)(e=>t=>{var i;if(null!==t.activeActorId)return t.activeActorId;const r=e(l.store).getCurrentUser();return null!==(i=r?.id)&&void 0!==i?i:null})},p="activitypub/app",u={reducer:function(e=o,t){return t.type===s?{...e,activeActorId:t.actorId}:e},actions:c,selectors:d,resolvers:{getActiveActorId:function*(){let e=(0,r.select)(a.store).get("activitypub/app","activeActorId");if(null==e){const t=yield(0,r.resolveSelect)(l.store).getCurrentUser();t?.id&&(e=t.id,(0,r.dispatch)(a.store).set("activitypub/app","activeActorId",e))}if(void 0!==e)return{type:s,actorId:e}}},controls:n.controls},m=(0,r.createReduxStore)(p,u);(0,r.register)(m)},1609(e){e.exports=window.React},5795(e){e.exports=window.ReactDOM},790(e){e.exports=window.ReactJSXRuntime},6427(e){e.exports=window.wp.components},3582(e){e.exports=window.wp.coreData},7143(e){e.exports=window.wp.data},8443(e){e.exports=window.wp.date},8107(e){e.exports=window.wp.dom},6087(e){e.exports=window.wp.element},2619(e){e.exports=window.wp.hooks},8537(e){e.exports=window.wp.htmlEntities},7723(e){e.exports=window.wp.i18n},1233(e){e.exports=window.wp.preferences},5573(e){e.exports=window.wp.primitives},3053(e){e.exports=window.wp.privateApis},3832(e){e.exports=window.wp.url}},s={};function o(e){var t=s[e];if(void 0!==t)return t.exports;var i=s[e]={exports:{}};return a[e](i,i.exports,o),i.exports}o.m=a,e=[],o.O=(t,i,r,n)=>{if(!i){var a=1/0;for(d=0;d