import{t as d,i as b,E as c,x as _}from"../chunks/BR4fxmeU.min.js";import{n as r}from"../chunks/BKQw7CDm.min.js";var p=Object.defineProperty,g=Object.getOwnPropertyDescriptor,a=(s,o,e,t)=>{for(var i=t>1?void 0:t?g(o,e):o,n=s.length-1,h;n>=0;n--)(h=s[n])&&(i=(t?h(o,e,i):h(i))||i);return t&&i&&p(o,e,i),i};let l=class extends b{constructor(){super(...arguments),this.loading=!0,this.numPosts=6,this.mobileShowMore=!1,this.showMoreLabel="Show more",this.showLessLabel="Show less"}connectedCallback(){super.connectedCallback(),this.feed&&this.fetchFeed()}async fetchFeed(){const s=new URLSearchParams,o=Math.floor(new Date().getTime());s.set("c",String(o));const e=await window.fetch(`${this.feed}?${s.toString()}`);e.status===200&&(this.data=(await e.json()).data||{},this.loading=!1)}createRenderRoot(){return this}render(){if(this.loading)return c;const s=(e,t)=>this.mobileShowMore?!0:t<3,o=(this.data.items||[]).slice(0,this.numPosts);return _`
`}toggleMMobileShowMore(){this.mobileShowMore=!this.mobileShowMore}formatDate(s){const o=new Date(s);return new Intl.DateTimeFormat("en-US",{dateStyle:"long"}).format(o)}parseImageSrc(s){const o=s.content||"",e=/]*src="([^"]*)"/,t=o.match(e);if(t)return t[1]}};a([r()],l.prototype,"feed",2);a([r({type:Boolean})],l.prototype,"loading",2);a([r()],l.prototype,"data",2);a([r({type:Number,attribute:"num-posts"})],l.prototype,"numPosts",2);a([r({type:Boolean})],l.prototype,"mobileShowMore",2);a([r({type:String,attribute:"show-more-label"})],l.prototype,"showMoreLabel",2);a([r({type:String,attribute:"show-less-label"})],l.prototype,"showLessLabel",2);l=a([d("photos-blog-feed")],l);