diff --git a/public/dx-maps/doxa-maps-spa/manifest.json b/public/dx-maps/doxa-maps-spa/manifest.json index 8452277b3..0d6569f07 100644 --- a/public/dx-maps/doxa-maps-spa/manifest.json +++ b/public/dx-maps/doxa-maps-spa/manifest.json @@ -1417,7 +1417,7 @@ "bundle": "wall-of-people-groups", "scriptUrl": "./wall-of-people-groups/wall-of-people-groups.js", "output": "dx-maps/wall-of-people-groups/wall-of-people-groups.js", - "integrity": "sha384-rjnA4qgtwgrQC7iLWc+whRkgmLG5a2HYEOqeoCm28JyJym6abkNbpOAs6ZF5BBDR", + "integrity": "sha384-NICGq3Rws15rGwIp1ZmIhJOYePGD+aa5ENU16sBsk5NrpcXh+HbUzOl7EZ8Stchx", "elements": [ "wall-of-people-groups" ], @@ -1436,7 +1436,7 @@ "scriptUrl": "./wall-of-people-groups/wall-of-people-groups.js", "embed": { "iframe": "", - "script": "\n\n\n" + "script": "\n\n\n" }, "bundle": "wall-of-people-groups" } diff --git a/public/dx-maps/manifest.json b/public/dx-maps/manifest.json index 8452277b3..0d6569f07 100644 --- a/public/dx-maps/manifest.json +++ b/public/dx-maps/manifest.json @@ -1417,7 +1417,7 @@ "bundle": "wall-of-people-groups", "scriptUrl": "./wall-of-people-groups/wall-of-people-groups.js", "output": "dx-maps/wall-of-people-groups/wall-of-people-groups.js", - "integrity": "sha384-rjnA4qgtwgrQC7iLWc+whRkgmLG5a2HYEOqeoCm28JyJym6abkNbpOAs6ZF5BBDR", + "integrity": "sha384-NICGq3Rws15rGwIp1ZmIhJOYePGD+aa5ENU16sBsk5NrpcXh+HbUzOl7EZ8Stchx", "elements": [ "wall-of-people-groups" ], @@ -1436,7 +1436,7 @@ "scriptUrl": "./wall-of-people-groups/wall-of-people-groups.js", "embed": { "iframe": "", - "script": "\n\n\n" + "script": "\n\n\n" }, "bundle": "wall-of-people-groups" } diff --git a/public/dx-maps/wall-of-people-groups/wall-of-people-groups.js b/public/dx-maps/wall-of-people-groups/wall-of-people-groups.js index 6a175ded6..680f39496 100644 --- a/public/dx-maps/wall-of-people-groups/wall-of-people-groups.js +++ b/public/dx-maps/wall-of-people-groups/wall-of-people-groups.js @@ -122,5 +122,5 @@ body,.poster{font-family:Georgia,'Times New Roman',serif;color:#1c1c1c;-webkit-p .card .rf{font-size:${O.toFixed(1)}pt;color:#777;margin-top:1pt} .glue{position:absolute;left:0;width:100%;border-bottom:.02in dashed #b00;display:flex;align-items:center;justify-content:center;font:700 ${_(Math.min(.5,a*.08))} sans-serif;color:#b00;background:rgba(176,0,0,.035);letter-spacing:.05em;text-transform:uppercase} .trim{position:absolute;left:0;bottom:0;width:100%;border-bottom:.02in solid #999} -.tag{position:absolute;right:${_(Math.max(.15,a*.1))};top:${_(Math.max(.1,a*.08))};font:600 ${_(Math.max(.12,a*.035))} sans-serif;color:#aaa}`;return{plan:r,css:S,pages:C,banner:i}}const Zg=/^[^A-Za-z\u00C0-\u024F\u0370-\u052F\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]*[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,bo=e=>Zg.test(String(e||""))?"rtl":"ltr",Qg={heart:"M12 20.5s-7.2-4.4-9.2-8.8C1.3 8.3 3.2 4.6 6.7 4.6c2 0 3.5 1.1 4.3 2.4.8-1.3 2.3-2.4 4.3-2.4 3.5 0 5.4 3.7 3.9 7.1-2 4.4-9.2 8.8-9.2 8.8z",comment:"M4 4.5h16v11.5H9.5L4 20.5z",plane:"M21 3.5 3 10.8l7 2.7 2.7 7 8.3-17z"};function Es(e){if(e&&e.slug)return`https://pray.doxa.life/${encodeURIComponent(e.slug)}?source=doxalife`;const t=e&&(e.peopleID3||e.PeopleID3);return t&&String(t).trim()?`https://joshuaproject.net/people_groups/${String(t).trim()}`:""}const Fo=40,Bc=48,Uc=12,Gc=400,em=12,Vc=320,tm=150,Ro=e=>e.naturalWidth||e.width,Do=e=>e.naturalHeight||e.height;class om{constructor(t,o){var r;this.host=t,this.o=o,this.groups=[],this.mode="bless",this.k0=1,this.ox=0,this.oy=0,this.t={k:1,x:0,y:0},this.images=new Map,this.stats={loaded:0,thumbs:0,thumbsFallback:0,measured:0},this.loading=0,this.queue=[],this.canvas=document.createElement("canvas"),this.canvas.className="wall-canvas-el",this.canvas.style.cssText="display:block;width:100%;height:100%;touch-action:none",this.canvas.tabIndex=0,o.label&&this.canvas.setAttribute("aria-label",o.label),this.canvas.setAttribute("role","img"),t.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d"),this.icons=Object.fromEntries(Object.entries(Qg).map(([s,a])=>[s,new Path2D(a)]));const n=As();this.zoom=n.zoom().scaleExtent([.1,20]).filter(s=>!s.ctrlKey&&!s.button).on("zoom",s=>{this.t=s.transform,this.request()}),this.sel=n.select(this.canvas).call(this.zoom).on("dblclick.zoom",null),this._click=s=>this.onClick(s),this._move=s=>this.onMove(s),this.canvas.addEventListener("click",this._click),this.canvas.addEventListener("mousemove",this._move),this.ro=typeof ResizeObserver<"u"?new ResizeObserver(()=>this.resize()):null,(r=this.ro)==null||r.observe(t),this.resize()}setWorld(t,o){this.o.worldW=t,this.o.worldH=o,this.layout(),this.resize()}setGroups(t){this.groups=t||[],this.layout(),this.request()}setMode(t){this.mode=t,this.showPoster(),this.resize(),this.startView(96)}setPoster(t){this.sp=t,this.textCache=new Map,this.estCache=new Map,this.ov||(this.ov=document.createElement("div"),this.ov.style.cssText="position:absolute;inset:0;overflow:hidden;pointer-events:none",getComputedStyle(this.host).position==="static"&&(this.host.style.position="relative"),this.host.appendChild(this.ov),this.ovRoot=this.ov.attachShadow?this.ov.attachShadow({mode:"open"}):this.ov),this.ovRoot.innerHTML=`
${t.chromeHtml}
`,this.ovw=this.ovRoot.querySelector(".ovw"),this.showPoster(),this.resize()}get posterOn(){return this.mode==="bless"&&!!this.sp}showPoster(){this.ov&&(this.ov.style.display=this.posterOn?"":"none")}get worldW(){return this.posterOn?this.sp.worldW:this.o.worldW}get worldH(){return this.posterOn?this.sp.worldH:this.o.worldH}fitAll(){this.sel.call(this.zoom.transform,As().zoomIdentity)}layout(){const t=this.groups.length;this.grid=t?Wg(t,this.o.worldW,this.o.worldH,this.o.spacing,this.o.vSpacing):null}resize(){const t=this.host.getBoundingClientRect(),o=Math.min(2,window.devicePixelRatio||1);this.cssW=Math.max(1,t.width),this.cssH=Math.max(1,t.height),this.canvas.width=Math.round(this.cssW*o),this.canvas.height=Math.round(this.cssH*o),this.dpr=o,this.k0=Math.min(this.cssW/this.worldW,this.cssH/this.worldH),this.ox=(this.cssW-this.worldW*this.k0)/2,this.oy=(this.cssH-this.worldH*this.k0)/2,this.request()}get scale(){return this.k0*this.t.k}toScreen(t,o){return[this.ox+(t*this.t.k+this.t.x)*this.k0,this.oy+(o*this.t.k+this.t.y)*this.k0]}toWorld(t,o){return[((t-this.ox)/this.k0-this.t.x)/this.t.k,((o-this.oy)/this.k0-this.t.y)/this.t.k]}startView(t=96){if(this.posterOn)return this.fitAll();if(!this.grid)return;const o=Math.max(1,Math.min(20,t/(this.grid.cw*this.k0)));this.sel.call(this.zoom.transform,As().zoomIdentity.scale(o))}resetZoom(){this.sel.transition().duration(750).call(this.zoom.transform,As().zoomIdentity)}request(){this.raf||(this.raf=requestAnimationFrame(()=>{this.raf=0,this.draw()}))}cardRect(t){const o=this.grid,n=t%o.cols,r=Math.floor(t/o.cols);return{x:n*(o.cw+o.spacing)+o.spacing,y:r*(o.ch+o.vSpacing)+o.vSpacing,w:o.cw,h:o.ch}}visibleRange(){const t=this.grid,[o,n]=this.toWorld(0,0),[r,s]=this.toWorld(this.cssW,this.cssH),a=t.cw+t.spacing,i=t.ch+t.vSpacing,l=Math.ceil(t.n/t.cols);return{c0:Math.max(0,Math.floor(o/a)-1),c1:Math.min(t.cols-1,Math.floor(r/a)+1),r0:Math.max(0,Math.floor(n/i)-1),r1:Math.min(l-1,Math.floor(s/i)+1)}}draw(){const t=this.ctx;if(t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,this.canvas.width,this.canvas.height),!this.grid)return;const o=this.scale,n=this.ox+this.t.x*this.k0,r=this.oy+this.t.y*this.k0;if(t.setTransform(this.dpr*o,0,0,this.dpr*o,this.dpr*n,this.dpr*r),this.posterOn)return this.drawPoster(t,o,n,r);const s=this.grid.cw*o,{c0:a,c1:i,r0:l,r1:c}=this.visibleRange(),u=[];for(let f=l;f<=c;f++)for(let h=a;h<=i;h++){const $=f*this.grid.cols+h;if($>=this.groups.length)break;const _=this.cardRect($);if(sl||$.y+$.hc)&&!($.i>=this.groups.length)){if(u=Fo&&(this.measureMore=!0),u=this.estCache.get(o.i),!u){const N=(K,I)=>Math.max(1,Math.ceil(String(K).length*.5*I/Math.max(1,$)));u={ct:f,estimate:!0,nameLines:Array(f.name.wrap?f.name.lines:1).fill(""),verse:f.readable?{lines:Array(N(_n(o.i).text,R)).fill(""),ref:""}:null},this.estCache.set(o.i,u)}}else if(!u){this.measureBudget--,this.stats.measured++,t.font=`700 ${F}px -apple-system, "Segoe UI", Arial, sans-serif`;const N=f.name.wrap?this.breakLines(t,c,$,f.name.lines):[c];let K=null;if(f.readable){const I=_n(o.i);t.font=`italic ${R}px Georgia, "Times New Roman", serif`,K={lines:this.breakLines(t,I.text,$,99),ref:I.ref}}u={ct:f,nameLines:N,verse:K},this.textCache.set(o.i,u)}const v=u.nameLines.length*F*f.nameLine,m=u.verse?u.verse.lines.length*R*f.verseLine+f.refGapPt*l+O*1.2:0,P=f.imgMarginIn*i,L=o.y+h+v+P,M=Math.max(0,o.h-2*h-v-m-2*P),C=s.imageUrl,S=C&&this.images.get(C);if(S&&S.ok){S.used=performance.now();const N=S.img,K=Ro(N)/Do(N)||1,I=$/(M||1);let Y=0,le=0,pe=Ro(N),se=Do(N);K>I?(pe=se*I,Y=(Ro(N)-pe)/2):(se=pe/I,le=(Do(N)-se)/2),t.drawImage(N,Y,le,pe,se,_,L,$,M)}else t.fillStyle="#eee",t.fillRect(_,L,$,M),C&&n>=Bc&&r.push(C);if(!(nt.fillText(N,y,o.y+h+K*F*f.nameLine,$)),u.verse){let N=L+M+P;t.font=`italic ${R}px Georgia, "Times New Roman", serif`,t.fillStyle="#1c1c1c",t.direction=bo(u.verse.lines[0]);for(const K of u.verse.lines)t.fillText(K,y,N,$),N+=R*f.verseLine;t.font=`${O}px Georgia, "Times New Roman", serif`,t.fillStyle="#777",t.direction=bo(u.verse.ref),t.fillText(u.verse.ref,y,N+f.refGapPt*l,$)}t.textBaseline="alphabetic",t.direction="inherit"}}breakLines(t,o,n,r){const s=[];let a="";for(const i of String(o).split(/\s+/)){const l=a?a+" "+i:i;if(t.measureText(l).width<=n){a=l;continue}for(a&&s.push(a),a=i;t.measureText(a).width>n&&a.length>1;){let c=a.length-1;for(;c>1&&t.measureText(a.slice(0,c)).width>n;)c--;s.push(a.slice(0,c)),a=a.slice(c)}}return a&&s.push(a),s.slice(0,r)}drawCard(t,o,n,r,s){const a=this.groups[o],i=n.w,l=n.h,c=n.x,u=n.y;t.fillStyle="#fff",t.fillRect(c,u,i,l),t.lineWidth=.5,t.strokeStyle="#dbdbdb",t.strokeRect(c,u,i,l);const f=u+l*.18,h=l*.5,$=a.imageUrl,_=$&&this.images.get($);if(_&&_.ok){_.used=performance.now();const m=_.img,P=Ro(m)/Do(m)||1,L=i/h;let M=0,C=0,S=Ro(m),N=Do(m);P>L?(S=N*L,M=(Ro(m)-S)/2):(N=S/L,C=(Do(m)-N)/2),t.drawImage(m,M,C,S,N,c,f,i,h)}else t.fillStyle="#f2f2f2",t.fillRect(c,f,i,h),$&&r>=Bc&&s.push($);if(ri*.95?Nc(F,Math.max(6,Math.floor(F.length/2)+2),2):[F];if(t.direction=bo(F),R.forEach((m,P)=>t.fillText(m,c+i/2,u+l*.06+P*y*1.1,i*.96)),this.mode==="bless"){const m=Math.max(3,i*.052),P=Math.max(10,Math.floor(i/(m*.5))),L=_n(o),M=Nc(L.text,P,4),C=f+h+m*1.5;t.font=`italic ${m}px Georgia, "Times New Roman", serif`,t.fillStyle="#262626",t.direction=bo(L.text),M.forEach((S,N)=>t.fillText(S,c+i/2,C+N*m*1.25,i*.96)),t.font=`${m*.82}px -apple-system, "Segoe UI", Arial, sans-serif`,t.fillStyle="#8e8e8e",t.direction=bo(L.ref),t.fillText(L.ref,c+i/2,C+M.length*m*1.25+m*.4,i*.96);return}t.font=`${Math.max(3,i*.055)}px -apple-system, "Segoe UI", Arial, sans-serif`,t.fillStyle="#8e8e8e",a.status&&(t.direction=bo(a.status),t.fillText(a.status,c+i/2,u+l*.14,i*.96)),t.direction="inherit";const O=this.socialLayout(n),v=this.o.prayCount(a);t.lineWidth=1.8,t.lineJoin="round",t.lineCap="round";for(const[m,P]of[["heart",O.hx],["comment",O.cx],["plane",O.px]]){t.save(),t.translate(P,O.by),t.scale(O.bs/24,O.bs/24);const L=m==="heart"&&v>0;t.strokeStyle=L?"#ed4956":"#262626",L&&(t.fillStyle="#ed4956",t.fill(this.icons[m])),t.stroke(this.icons[m]),t.restore()}t.textAlign="left",t.font=`600 ${O.pf}px -apple-system, "Segoe UI", Arial, sans-serif`,t.fillStyle="#262626",t.fillText(this.o.labels("wall.prayedCount",{n:v},v),O.hx,O.by+O.bs+O.pf+2,i*.9),t.font=`${O.pf}px -apple-system, "Segoe UI", Arial, sans-serif`,t.fillStyle="#8e8e8e",t.fillText(this.o.labels("wall.viewPrayers"),O.hx,O.by+O.bs+O.pf*2+4,i*.9)}socialLayout(t){const o=t.w,n=Math.max(8,o*.12),r=n*.7,s=r*1.6,a=t.x+(o-(r*3+s*2))/2,i=t.y+t.h*.72;return{bs:r,hx:a,cx:a+s,px:a+s*2,by:i,pf:Math.max(3.5,o*.065)}}hit(t,o){if(this.posterOn){const[u,f]=this.toWorld(t,o),h=this.sp.cards.find(y=>u>=y.x&&u<=y.x+y.w&&f>=y.y&&f<=y.y+y.h);if(!h||h.w*this.scale=this.groups.length)return null;const $=this.textCache.get(h.i),_=h.y+($?$.ct.padIn*this.sp.pxPerIn+$.nameLines.length*$.ct.name.pt*(this.sp.pxPerIn/72)*$.ct.nameLine:h.h*.12);return{i:h.i,region:f<=_?"name":"card"}}if(!this.grid||this.grid.cw*this.scale=s.cols||i<0)return null;const l=i*s.cols+a;if(l>=this.groups.length)return null;const c=this.cardRect(l);if(nc.x+c.w||rc.y+c.h)return null;if(r=u.by&&r<=u.by+u.bs){if(n>=u.hx&&n<=u.hx+u.bs)return{i:l,region:"heart"};if(n>=u.cx&&n<=u.cx+u.bs)return{i:l,region:"comment"};if(n>=u.px&&n<=u.px+u.bs)return{i:l,region:"share"}}if(r>u.by+u.bs+u.pf&&r{this.stats.loaded++,this.thumbnail(s).then(i=>{i&&(a.img=i),a.ok=!0,this.loading--,this.request(),this.load([])})},s.onerror=()=>{this.loading--,this.load([])},s.src=r}if(this.images.size>Gc){const r=[...this.images.entries()].filter(([,s])=>s.ok).sort((s,a)=>s[1].used-a[1].used);for(const[s,a]of r.slice(0,this.images.size-Gc))(n=(o=a.img)==null?void 0:o.close)==null||n.call(o),this.images.delete(s)}}async thumbnail(t){var i;const o=t.naturalWidth,n=t.naturalHeight;if(!o||!n||Math.max(o,n)<=Vc)return null;const r=Vc/Math.max(o,n),s=Math.max(1,Math.round(o*r)),a=Math.max(1,Math.round(n*r));if(typeof createImageBitmap=="function")try{const l=await createImageBitmap(t,{resizeWidth:s,resizeHeight:a,resizeQuality:"medium"});if(l.width===s&&l.height===a)return this.stats.thumbs++,l;(i=l.close)==null||i.call(l)}catch{}try{const l=document.createElement("canvas");return l.width=s,l.height=a,l.getContext("2d").drawImage(t,0,0,s,a),this.stats.thumbs++,this.stats.thumbsFallback++,l}catch{return null}}destroy(){var t,o,n,r,s,a;this.raf&&cancelAnimationFrame(this.raf),(t=this.ro)==null||t.disconnect(),this.sel.on(".zoom",null),this.canvas.removeEventListener("click",this._click),this.canvas.removeEventListener("mousemove",this._move);for(const i of this.images.values())i.img&&(i.img.onload=i.img.onerror=null,"src"in i.img&&(i.img.src=""),(n=(o=i.img).close)==null||n.call(o));this.images.clear(),this.queue=[],this.canvas.remove(),(r=this.ov)==null||r.remove(),this.ov=this.ovRoot=this.ovw=this.sp=null,(s=this.textCache)==null||s.clear(),(a=this.estCache)==null||a.clear()}}function nm(e,{autoprint:t=!1}={}){const o=document.createElement("iframe");o.setAttribute("aria-hidden","true"),o.style.cssText="position:fixed;right:0;bottom:0;width:1px;height:1px;opacity:0;border:0",document.body.appendChild(o);const n=o.contentDocument;if(!n)return o.remove(),null;n.open(),n.write(e),t&&n.write(' - +