diff --git a/content/posts/thoughts-on-postcards/shutup-singapore.postcard b/content/posts/thoughts-on-postcards/shutup-singapore.postcard index f1e26127..b4aec8ff 100644 Binary files a/content/posts/thoughts-on-postcards/shutup-singapore.postcard and b/content/posts/thoughts-on-postcards/shutup-singapore.postcard differ diff --git a/static/js/postcards-html.js b/static/js/postcards-html.js index 7793295f..ddce3895 100644 --- a/static/js/postcards-html.js +++ b/static/js/postcards-html.js @@ -1,5 +1,1291 @@ -function v(){}function V(t,n){for(let r in n)t[r]=n[r];return t}function Jt(t){return t&&"object"==typeof t&&"function"==typeof t.then}function ut(t){return t()}function yt(){return Object.create(null)}function W(t){t.forEach(ut)}function Dt(t){return"function"==typeof t}function dt(t,n){return t!=t?n==n:t!==n||t&&"object"==typeof t||"function"==typeof t}let G;function Zt(t,n){return G||(G=document.createElement("a")),G.href=n,t===G.href}function Ht(t){return 0===Object.keys(t).length}function et(t){let n={};for(let r in t)"$"!==r[0]&&(n[r]=t[r]);return n}let rt=!1;function Qt(){rt=!0}function te(){rt=!1}function ee(t,n,r,o){for(;t>1);r(i)<=o?t=i+1:n=i}return t}function ne(t){if(t.hydrate_init)return;t.hydrate_init=!0;let n=t.childNodes;if("HEAD"===t.nodeName){let r=[];for(let o=0;o0&&n[l[s]].claim_order<=d?s+1:ee(1,s,t=>n[l[t]].claim_order,d))-1;a[c]=l[f]+1;let u=f+1;l[u]=c,s=Math.max(u,s)}let p=[],$=[],b=n.length-1;for(let y=l[s]+1;0!=y;y=a[y-1]){for(p.push(n[y-1]);b>=y;b--)$.push(n[b]);b--}for(;b>=0;b--)$.push(n[b]);p.reverse(),$.sort((t,n)=>t.claim_order-n.claim_order);for(let w=0,R=0;w<$.length;w++){for(;R=p[R].claim_order;)R++;let L=Rt.removeEventListener(n,r,o)}function h(t,n,r){null==r?t.removeAttribute(n):t.getAttribute(n)!==r&&t.setAttribute(n,r)}function kt(t,n){for(let r in n)h(t,r,n[r])}function A(t){return Array.from(t.childNodes)}function oe(t){void 0===t.claim_info&&(t.claim_info={last_index:0,total_claimed:0})}function se(t,n,r,o,i=!1){oe(t);let l=(()=>{for(let l=t.claim_info.last_index;l=0;c--){let d=t[c];if(n(d)){let f=r(d);return void 0===f?t.splice(c,1):t[c]=f,i?void 0===f&&t.claim_info.last_index--:t.claim_info.last_index=c,d}}return o()})();return l.claim_order=t.claim_info.total_claimed,t.claim_info.total_claimed+=1,l}function le(t,n,r,o){return se(t,t=>t.nodeName===n,t=>{let n=[];for(let o=0;ot.removeAttribute(n))},()=>o(n))}function N(t,n,r){return le(t,n,r,x)}function j(t,n){n=""+n,t.wholeText!==n&&(t.data=n)}function m(t,n,r,o){null===r?t.style.removeProperty(n):t.style.setProperty(n,r,o?"important":"")}function wt(t,n,r){t.classList[r?"add":"remove"](n)}function ce(t,n,{bubbles:r=!1,cancelable:o=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(t,r,o,n),i}function Ft(t){let n={};for(let r of t)n[r.name]=r.value;return n}let X;function C(t){X=t}function ht(){if(!X)throw Error("Function called outside component initialization");return X}function ae(){let t=ht();return(n,r,{cancelable:o=!1}={})=>{let i=t.$$.callbacks[n];if(i){let l=ce(n,r,{cancelable:o});return i.slice().forEach(n=>{n.call(t,l)}),!l.defaultPrevented}return!0}}const I=[],vt=[],Q=[],$t=[],fe=Promise.resolve();let lt=!1;function ue(){lt||(lt=!0,fe.then(S))}function ct(t){Q.push(t)}const st=new Set;let J=0;function S(){let t=X;do{for(;J{tt.delete(t),o&&(r&&t.d(1),o())}),t.o(n)):o&&o()}function zt(t,n){let r=n.token={};function o(t,o,i,l){if(n.token!==r)return;n.resolved=l;let a=n.ctx;void 0!==i&&((a=a.slice())[i]=l);let s=t&&(n.current=t)(a),c=!1;n.block&&(n.blocks?n.blocks.forEach((t,r)=>{r!==o&&t&&(Ut(),D(t,1,1,()=>{n.blocks[r]===t&&(n.blocks[r]=null)}),Wt())}):n.block.d(1),s.c(),T(s,1),s.m(n.mount(),n.anchor),c=!0),n.block=s,n.blocks&&(n.blocks[o]=s),c&&S()}if(Jt(t)){let i=ht();if(t.then(t=>{C(i),o(n.then,1,n.value,t),C(null)},t=>{if(C(i),o(n.catch,2,n.error,t),C(null),!n.hasCatch)throw t}),n.current!==n.pending)return o(n.pending,0),!0}else{if(n.current!==n.then)return o(n.then,1,n.value,t),!0;n.resolved=t}}function qt(t,n,r){let o=n.slice(),{resolved:i}=t;t.current===t.then&&(o[t.value]=i),t.current===t.catch&&(o[t.error]=i),t.block.p(o,r)}function he(t,n){let r={},o={},i={$$scope:1},l=t.length;for(;l--;){let a=t[l],s=n[l];if(s){for(let c in a)c in s||(o[c]=1);for(let d in s)i[d]||(r[d]=s[d],i[d]=1);t[l]=s}else for(let f in a)i[f]=1}for(let u in o)u in r||(r[u]=void 0);return r}function It(t){t&&t.c()}function pt(t,n,r,o){let{fragment:i,on_mount:l,on_destroy:a,after_update:s}=t.$$;i&&i.m(n,r),o||ct(()=>{let n=l.map(ut).filter(Dt);a?a.push(...n):W(n),t.$$.on_mount=[]}),s.forEach(ct)}function ot(t,n){let r=t.$$;null!==r.fragment&&(W(r.on_destroy),r.fragment&&r.fragment.d(n),r.on_destroy=r.fragment=null,r.ctx=[])}function pe(t,n){-1===t.$$.dirty[0]&&(I.push(t),ue(),t.$$.dirty.fill(0)),t.$$.dirty[n/31|0]|=1<{let l=o.length?o[0]:r;return d.ctx&&i(d.ctx[n],d.ctx[n]=l)&&(!d.skip_bound&&d.bound[n]&&d.bound[n](l),f&&pe(t,n)),r}):[],d.update(),f=!0,W(d.before_update),d.fragment=!!o&&o(d.ctx),n.target){if(n.hydrate){Qt();let u=A(n.target);d.fragment&&d.fragment.l(u),u.forEach(_)}else d.fragment&&d.fragment.c();n.intro&&T(t.$$.fragment),pt(t,n.target,n.anchor,n.customElement),te(),S()}C(c)}let _t;"function"==typeof HTMLElement&&(_t=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){let{on_mount:t}=this.$$;for(let n in this.$$.on_disconnect=t.map(ut).filter(Dt),this.$$.slotted)this.appendChild(this.$$.slotted[n])}attributeChangedCallback(t,n,r){this[t]=r}disconnectedCallback(){W(this.$$.on_disconnect)}$destroy(){ot(this,1),this.$destroy=v}$on(t,n){let r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{let t=r.indexOf(n);-1!==t&&r.splice(t,1)}}$set(t){this.$$set&&!Ht(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});class me{$destroy(){ot(this,1),this.$destroy=v}$on(t,n){let r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{let t=r.indexOf(n);-1!==t&&r.splice(t,1)}}$set(t){this.$$set&&!Ht(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}!function(t){t.Book="book",t.LeftHand="left-hand",t.Calendar="calendar",t.RightHand="right-hand"}(nt||(nt={}));const _e=t=>t==nt.LeftHand||t==nt.RightHand;class q{constructor(t){this.originalLocale=t.original,this.originalText=this.originalLocale&&t[this.originalLocale],this._innerMap=new Map(Object.entries(t))}pickBest(t=[],n=!0){if((0===t.length||n)&&this.originalLocale&&this.originalText)return[this.originalText,this.originalLocale];if(0===t.length){let r=this._innerMap.entries(),{value:[o,i]}=r.next();return[i,o]}let l=[];for(let a of t){if(this._innerMap.has(a))return[this._innerMap.get(a),a];l.push(a.split("-")[0])}for(let[s,c]of this._innerMap.entries())if(l.includes(s.split("-")[0]))return[c,s];return null}}class ge{constructor(t){this.reader=t.getReader(),this.buffer=new Uint8Array(0)}async read(t){for(;this.buffer.byteLengthr){let o=r/n;return{width:"100%",height:`${100*o}%`,margin:`${50*(1-o)}% 0`}}{let i=n/r;return{width:`${100*i}%`,height:"100%",margin:`0 ${50*(1-i)}%`}}}}const Kt=(t,n)=>n?Kt(n,t%n):t,ye=/^(\d+)\/(\d+)$/,Et=t=>{let n=t.match(ye);if(!n)throw`invalid rational length: ${t}`;return[parseInt(n[1]),parseInt(n[2])]},xt=t=>(t[0]/t[1]).toFixed(1),ke=t=>{if(200!==t.status)throw"Unable to load file";return t},we=async t=>{let n=await fetch(t).then(t=>ke(t).body);if(null===n)throw"Unable to retrieve postcard";let r=new ge(n),o={},i=await r.read(8);if("postcard"!==new TextDecoder().decode(i))throw"Not a postcard file";let l=await r.read(3),a=new DataView(l.buffer),s=a.getUint8(0),c=a.getUint8(1),d=a.getUint8(2);o.version=`${s}.${c}.${d}`;let f=await r.readSized(),u=new TextDecoder("utf-8");return o.metadata=ve(JSON.parse(u.decode(f))),o.frontData=r.readSized(),o.backData=o.frontData.then(()=>r.readSized()),o},ve=t=>{let{flip:n,frontSize:r,sentOn:o,front:i,back:l,context:a,...s}=t;return{...s,flip:n,sentOn:o&&new Date(o),size:new be(r,n),front:i&&{description:i.description&&new q(i.description),transcription:i.transcription&&new q(i.transcription),secrets:i.secrets},back:l&&{description:l.description&&new q(l.description),transcription:l.transcription&&new q(l.transcription),secrets:l.secrets},context:a&&{author:a.author,description:a.description&&new q(a.description)}}};function $e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,nt,at={exports:{}},Vt={},H={},gt={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function t(n,r){let o=RegExp(n,"g");return t=>{if("string"!=typeof t)throw TypeError("expected an argument of type string, but got ".concat(typeof styleObj));return t.match(o)?t.replace(o,r):t}};t.default=n}(gt),Object.defineProperty(H,"__esModule",{value:!0}),H.snakeToKebab=H.camelToKebab=void 0;var Xt=Ee(gt);function Ee(t){return t&&t.__esModule?t:{default:t}}const xe=(0,Xt.default)(/[A-Z]/,t=>"-".concat(t.toLowerCase()));H.camelToKebab=xe;const Oe=(0,Xt.default)(/_/,()=>"-");H.snakeToKebab=Oe,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=H,r=function t(r,o=n.camelToKebab){if(!r||"object"!=typeof r||Array.isArray(r))throw TypeError("expected an argument of type object, but got ".concat(typeof r));return Object.keys(r).map(t=>"".concat(o(t),": ").concat(r[t],";")).join(` -`)};t.default=r}(Vt),function(t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"createParser",{enumerable:!0,get:function(){return o.default}}),n.parsers=n.default=void 0;var r=l(Vt),o=l(gt),i=function t(n){if(n&&n.__esModule)return n;var r={};if(null!=n){for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(n,o):{};i.get||i.set?Object.defineProperty(r,o,i):r[o]=n[o]}}return r.default=n,r}(H);function l(t){return t&&t.__esModule?t:{default:t}}function a(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}n.parsers=i;var s=r.default;n.default=s,t.exports=r.default,t.exports.createParser=o.default,t.exports.parsers=function t(n){for(var r=1;rt.pickBest(Navigator.languages,n),Re=t=>{let n="",r;if(t.description){let[o,i]=K(t.description,!1);n+=o,r=i}if(t.transcription){let[l,a]=K(t.transcription,!0);n.length>0&&(n+=` -`),n+=l,r||(r=a)}return[n,r]},Z=t=>t.toISOString().replace(/T.*$/,""),Ae=t=>{let n=[];for(let r of t)n.push(`${r[0]},${r[1]}`);return n.join(" ")};function Ce(t){let n,r,o,i,l,a,s,c,d=[{width:"128"},{viewBox:"0 0 150.3 107.3"},{xmlns:"http://www.w3.org/2000/svg"},t[0]],f={};for(let u=0;u{r(0,n=V(V({},n),et(t)))},[n=et(n)]}class Yt extends me{constructor(t){super(),mt(this,t,Se,Ce,dt,{})}}function Ot(t,n,r){let o=t.slice();return o[21]=n[r],o[23]=r,o}function Pt(t,n,r){let o=t.slice();return o[25]=n[r],o}function Te(t){let n,r,o,i;return o=new Yt({}),{c(){n=E("div"),r=E("div"),It(o.$$.fragment),h(r,"class","error"),h(n,"class","postcard error")},m(t,l){g(t,n,l),k(n,r),pt(o,r,null),i=!0},p:v,i(t){i||(T(o.$$.fragment,t),i=!0)},o(t){D(o.$$.fragment,t),i=!1},d(t){t&&_(n),ot(o)}}}function Le(t){let n,r,o=t[2],i=[];for(let l=0;lD(i[t],1,1,()=>{i[t]=null});return{c(){n=E("div");for(let r=0;r0&&Me(t);return{c(){n=E("img"),o=O(),l&&l.c(),i=it(),Zt(n.src,r=t[24].src)||h(n,"src",r),h(n,"alt",t[24].description[0]),h(n,"lang",t[24].description[1])},m(t,r){g(t,n,r),g(t,o,r),l&&l.m(t,r),g(t,i,r)},p(t,n){t[24].secrets.length>0&&l.p(t,n)},i:v,o:v,d(t){t&&_(n),t&&_(o),l&&l.d(t),t&&_(i)}}}function Me(t){let n,r,o,i,l,a,s,c=t[24].secrets,d=[];for(let f=0;fn,a.anchor=r,k(n,r),o=!0,i||(l=ie(n,"click",t[5]),i=!0)},p(n,r){qt(a,t=n,r)},i(t){o||(T(a.block),o=!0)},o(t){for(let n=0;n<3;n+=1){let r=a.blocks[n];D(r)}o=!1},d(t){t&&_(n),a.block.d(),a.token=null,a=null,i=!1,l()}}}function He(t){let n;return{c(){h(n=E("div"),"class","postcard loading")},m(t,r){g(t,n,r)},p:v,i:v,o:v,d(t){t&&_(n)}}}function je(t){let n,r,o={ctx:t,current:null,token:null,hasCatch:!0,pending:He,then:Le,catch:Te,value:20,error:28,blocks:[,,,]};return zt(t[1],o),{c(){n=it(),o.block.c(),this.c=v},m(t,i){g(t,n,i),o.block.m(t,o.anchor=i),o.mount=()=>n.parentNode,o.anchor=n,r=!0},p(n,[r]){qt(o,t=n,r)},i(t){r||(T(o.block),r=!0)},o(t){for(let n=0;n<3;n+=1){let i=o.blocks[n];D(i)}r=!1},d(t){t&&_(n),o.block.d(t),o.token=null,o=null}}}function Fe(t,n,r){let{src:o}=n,{name:i}=n,{show:l=ft.BothFrontFirst}=n,a=i&&document.querySelectorAll(`postcard-display[name="${i}"`).length;a&&a>1&&console.warn(`There are ${a} postcards with name="${i}". Any elements will be attached to the first one only.`);let s=l.split(" "),c=!1,d=ht(),f=ae(),u=(t,n)=>{f(t,n),d.dispatchEvent&&d.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:n}))},p=t=>URL.createObjectURL(new Blob([t])),$=t=>{throw console.error(t),t},b=t=>{let[n,r]=t.size.aspectRatio(!0);d.style.setProperty("--frontAR",`${n}/${r}`),d.style.setProperty("--backAR",t.size.isHeteroriented?"1/1":`${n}/${r}`),y()},y=()=>d.style.aspectRatio=U()?"var(--frontAR)":"var(--backAR)",w=we(o),R=w.then(({metadata:t})=>t).catch($);R.then(t=>{b(t),u("postcard-loaded",{name:i,metadata:t,showingSide:z()})});let L=s.map(t=>w.then(n=>n[`${t}Data`].then(t=>({metadata:n.metadata,bytes:t}))).then(({metadata:n,bytes:r})=>({src:p(r),secrets:n[t].secrets||[],description:Re(n[t])})).catch($)),z=(t=c?1:0)=>s[t],U=(t=c?1:0)=>z(t)===ft.FrontOnly,F=2===s.length,Y=F&&(()=>{r(0,c=!c),y(),u("postcard-flipped",{name:i,showingSide:z()})});return t.$$set=t=>{"src"in t&&r(6,o=t.src),"name"in t&&r(7,i=t.name),"show"in t&&r(8,l=t.show)},[c,R,L,U,F,Y,o,i,l]}class Ue extends _t{constructor(t){super(),this.shadowRoot.innerHTML="",mt(this,{target:this.shadowRoot,props:Ft(this.attributes),customElement:!0},Fe,je,dt,{src:6,name:7,show:8},null),t&&(t.target&&g(t.target,this,t.anchor),t.props&&(this.$set(t.props),S()))}static get observedAttributes(){return["src","name","show"]}get src(){return this.$$.ctx[6]}set src(t){this.$$set({src:t}),S()}get name(){return this.$$.ctx[7]}set name(t){this.$$set({name:t}),S()}get show(){return this.$$.ctx[8]}set show(t){this.$$set({show:t}),S()}}function Ct(t){let n,r,o,i=t[5][0]+"",l,a;return{c(){n=E("p"),(r=E("strong")).textContent="Context:",o=O(),l=P(i),h(n,"lang",a=t[5][1])},m(t,i){g(t,n,i),k(n,r),k(n,o),k(n,l)},p(t,r){32&r&&i!==(i=t[5][0]+"")&&j(l,i),32&r&&a!==(a=t[5][1])&&h(n,"lang",a)},d(t){t&&_(n)}}}function St(t){let n,r,o,i;return{c(){n=E("p"),(r=E("strong")).textContent="Physical size (front):",o=O(),i=P(t[4])},m(t,l){g(t,n,l),k(n,r),k(n,o),k(n,i)},p(t,n){16&n&&j(i,t[4])},d(t){t&&_(n)}}}function Tt(t){var n;let r,o,i,l,a=Z(null==(n=t[0])?void 0:n.sentOn)+"",s,c;return{c(){var n;r=E("p"),(o=E("strong")).textContent="Date:",i=O(),l=E("time"),s=P(a),h(l,"datetime",c=Z(null==(n=t[0])?void 0:n.sentOn))},m(t,n){g(t,r,n),k(r,o),k(r,i),k(r,l),k(l,s)},p(t,n){var r,o;1&n&&a!==(a=Z(null==(r=t[0])?void 0:r.sentOn)+"")&&j(s,a),1&n&&c!==(c=Z(null==(o=t[0])?void 0:o.sentOn))&&h(l,"datetime",c)},d(t){t&&_(r)}}}function Lt(t){let n,r,o,i=t[0].location.name+"",l;return{c(){n=E("p"),(r=E("strong")).textContent="Location:",o=O(),l=P(i)},m(t,i){g(t,n,i),k(n,r),k(n,o),k(n,l)},p(t,n){1&n&&i!==(i=t[0].location.name+"")&&j(l,i)},d(t){t&&_(n)}}}function Nt(t){let n,r,o,i,l,a=t[3]&&Bt(t),s=t[2]&&Mt(t);return{c(){n=P("On the "),r=P(t[1]),o=P(`: +function v() { +} +function K(e, t) { + for (const n in t) + e[n] = t[n]; + return e; +} +function Qt(e) { + return e && typeof e == "object" && typeof e.then == "function"; +} +function ft(e) { + return e(); +} +function bt() { + return (/* @__PURE__ */Object.create(null)); +} +function U(e) { + e.forEach(ft); +} +function Lt(e) { + return typeof e == "function"; +} +function ut(e, t) { + return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function"; +} +let Y; +function te(e, t) { + return Y || (Y = document.createElement("a")), Y.href = t, e === Y.href; +} +function Dt(e) { + return Object.keys(e).length === 0; +} +function tt(e) { + const t = {}; + for (const n in e) + n[0] !== "$" && (t[n] = e[n]); + return t; +} +let nt = !1; +function ee() { + nt = !0; +} +function ne() { + nt = !1; +} +function re(e, t, n, r) { + for (; e < t;) { + const i = e + (t - e >> 1); + n(i) <= r ? e = i + 1 : t = i; + } + return e; +} +function ie(e) { + if (e.hydrate_init) + return; + e.hydrate_init = !0; + let t = e.childNodes; + if (e.nodeName === "HEAD") { + const l = []; + for (let a = 0; a < t.length; a++) { + const f = t[a]; + f.claim_order !== void 0 && l.push(f); + } + t = l; + } + const n = new Int32Array(t.length + 1),r = new Int32Array(t.length); + n[0] = -1; + let i = 0; + for (let l = 0; l < t.length; l++) { + const a = t[l].claim_order,f = (i > 0 && t[n[i]].claim_order <= a ? i + 1 : re(1, i, d => t[n[d]].claim_order, a)) - 1; + r[l] = n[f] + 1; + const u = f + 1; + n[u] = l, i = Math.max(u, i); + } + const s = [],o = []; + let c = t.length - 1; + for (let l = n[i] + 1; l != 0; l = r[l - 1]) { + for (s.push(t[l - 1]); c >= l; c--) + o.push(t[c]); + c--; + } + for (; c >= 0; c--) + o.push(t[c]); + s.reverse(), o.sort((l, a) => l.claim_order - a.claim_order); + for (let l = 0, a = 0; l < o.length; l++) { + for (; a < s.length && o[l].claim_order >= s[a].claim_order;) + a++; + const f = a < s.length ? s[a] : null; + e.insertBefore(o[l], f); + } +} +function k(e, t) { + e.appendChild(t); +} +function B(e, t) { + if (nt) { + for (ie(e), (e.actual_end_child === void 0 || e.actual_end_child !== null && e.actual_end_child.parentNode !== e) && (e.actual_end_child = e.firstChild); e.actual_end_child !== null && e.actual_end_child.claim_order === void 0;) + e.actual_end_child = e.actual_end_child.nextSibling; + t !== e.actual_end_child ? (t.claim_order !== void 0 || t.parentNode !== e) && e.insertBefore(t, e.actual_end_child) : e.actual_end_child = t.nextSibling; + } else + (t.parentNode !== e || t.nextSibling !== null) && e.appendChild(t); +} +function b(e, t, n) { + e.insertBefore(t, n || null); +} +function oe(e, t, n) { + nt && !n ? B(e, t) : (t.parentNode !== e || t.nextSibling != n) && e.insertBefore(t, n || null); +} +function _(e) { + e.parentNode.removeChild(e); +} +function jt(e, t) { + for (let n = 0; n < e.length; n += 1) + e[n] && e[n].d(t); +} +function E(e) { + return document.createElement(e); +} +function O(e) { + return document.createElementNS("http://www.w3.org/2000/svg", e); +} +function x(e) { + return document.createTextNode(e); +} +function P() { + return x(" "); +} +function rt() { + return x(""); +} +function se(e, t, n, r) { + return e.addEventListener(t, n, r), () => e.removeEventListener(t, n, r); +} +function h(e, t, n) { + n == null ? e.removeAttribute(t) : e.getAttribute(t) !== n && e.setAttribute(t, n); +} +function yt(e, t) { + for (const n in t) + h(e, n, t[n]); +} +function A(e) { + return Array.from(e.childNodes); +} +function le(e) { + e.claim_info === void 0 && (e.claim_info = { last_index: 0, total_claimed: 0 }); +} +function ce(e, t, n, r, i = !1) { + le(e); + const s = (() => { + for (let o = e.claim_info.last_index; o < e.length; o++) { + const c = e[o]; + if (t(c)) { + const l = n(c); + return l === void 0 ? e.splice(o, 1) : e[o] = l, i || (e.claim_info.last_index = o), c; + } + } + for (let o = e.claim_info.last_index - 1; o >= 0; o--) { + const c = e[o]; + if (t(c)) { + const l = n(c); + return l === void 0 ? e.splice(o, 1) : e[o] = l, i ? l === void 0 && e.claim_info.last_index-- : e.claim_info.last_index = o, c; + } + } + return r(); + })(); + return s.claim_order = e.claim_info.total_claimed, e.claim_info.total_claimed += 1, s; +} +function ae(e, t, n, r) { + return ce(e, i => i.nodeName === t, i => { + const s = []; + for (let o = 0; o < i.attributes.length; o++) { + const c = i.attributes[o]; + n[c.name] || s.push(c.name); + } + s.forEach(o => i.removeAttribute(o)); + }, () => r(t)); +} +function M(e, t, n) { + return ae(e, t, n, O); +} +function j(e, t) { + t = "" + t, e.wholeText !== t && (e.data = t); +} +function m(e, t, n, r) { + n === null ? e.style.removeProperty(t) : e.style.setProperty(t, n, r ? "important" : ""); +} +function kt(e, t, n) { + e.classList[n ? "add" : "remove"](t); +} +function fe(e, t, { bubbles: n = !1, cancelable: r = !1 } = {}) { + const i = document.createEvent("CustomEvent"); + return i.initCustomEvent(e, n, r, t), i; +} +function Ft(e) { + const t = {}; + for (const n of e) + t[n.name] = n.value; + return t; +} +let V; +function C(e) { + V = e; +} +function dt() { + if (!V) + throw new Error("Function called outside component initialization"); + return V; +} +function ue() { + const e = dt(); + return (t, n, { cancelable: r = !1 } = {}) => { + const i = e.$$.callbacks[t]; + if (i) { + const s = fe(t, n, { cancelable: r }); + return i.slice().forEach(o => { + o.call(e, s); + }), !s.defaultPrevented; + } + return !0; + }; +} +const I = [],wt = [],Z = [],vt = [],de = Promise.resolve(); +let st = !1; +function he() { + st || (st = !0, de.then(S)); +} +function lt(e) { + Z.push(e); +} +const ot = /* @__PURE__ */new Set(); +let G = 0; +function S() { + const e = V; + do { + for (; G < I.length;) { + const t = I[G]; + G++, C(t), pe(t.$$); + } + for (C(null), I.length = 0, G = 0; wt.length;) + wt.pop()(); + for (let t = 0; t < Z.length; t += 1) { + const n = Z[t]; + ot.has(n) || (ot.add(n), n()); + } + Z.length = 0; + } while (I.length); + for (; vt.length;) + vt.pop()(); + st = !1, ot.clear(), C(e); +} +function pe(e) { + if (e.fragment !== null) { + e.update(), U(e.before_update); + const t = e.dirty; + e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(lt); + } +} +const Q = /* @__PURE__ */new Set(); +let H; +function zt() { + H = { + r: 0, + c: [], + p: H }; - `),a&&a.c(),i=O(),s&&s.c(),l=it()},m(t,c){g(t,n,c),g(t,r,c),g(t,o,c),a&&a.m(t,c),g(t,i,c),s&&s.m(t,c),g(t,l,c)},p(t,n){2&n&&j(r,t[1]),t[3]?a?a.p(t,n):((a=Bt(t)).c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null),t[2]?s?s.p(t,n):((s=Mt(t)).c(),s.m(l.parentNode,l)):s&&(s.d(1),s=null)},d(t){t&&_(n),t&&_(r),t&&_(o),a&&a.d(t),t&&_(i),s&&s.d(t),t&&_(l)}}}function Bt(t){let n,r,o,i=t[3][0]+"",l,a;return{c(){n=E("p"),(r=E("strong")).textContent="Description:",o=O(),l=P(i),h(n,"lang",a=t[3][1])},m(t,i){g(t,n,i),k(n,r),k(n,o),k(n,l)},p(t,r){8&r&&i!==(i=t[3][0]+"")&&j(l,i),8&r&&a!==(a=t[3][1])&&h(n,"lang",a)},d(t){t&&_(n)}}}function Mt(t){let n,r,o,i=t[2][0]+"",l,a;return{c(){n=E("p"),(r=E("strong")).textContent="Transcription:",o=O(),l=P(i),h(n,"lang",a=t[2][1])},m(t,i){g(t,n,i),k(n,r),k(n,o),k(n,l)},p(t,r){4&r&&i!==(i=t[2][0]+"")&&j(l,i),4&r&&a!==(a=t[2][1])&&h(n,"lang",a)},d(t){t&&_(n)}}}function We(t){let n,r;return{c(){n=E("a"),r=P("Download postcard"),h(n,"href",t[7].src)},m(t,o){g(t,n,o),k(n,r)},p:v,d(t){t&&_(n)}}}function ze(t){var n,r,o;let i,l,a,s,c,d,f=t[5]&&Ct(t),u=t[4]&&St(t),p=(null==(n=t[0])?void 0:n.sentOn)&&Tt(t),$=(null==(o=null==(r=t[0])?void 0:r.location)?void 0:o.name)&&Lt(t),b=(t[3]||t[2])&&Nt(t),y=t[6]&&We(t);return{c(){f&&f.c(),i=O(),u&&u.c(),l=O(),p&&p.c(),a=O(),$&&$.c(),s=O(),b&&b.c(),c=O(),y&&y.c(),d=it(),this.c=v},m(t,n){f&&f.m(t,n),g(t,i,n),u&&u.m(t,n),g(t,l,n),p&&p.m(t,n),g(t,a,n),$&&$.m(t,n),g(t,s,n),b&&b.m(t,n),g(t,c,n),y&&y.m(t,n),g(t,d,n)},p(t,[n]){var r,o,d;t[5]?f?f.p(t,n):((f=Ct(t)).c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),t[4]?u?u.p(t,n):((u=St(t)).c(),u.m(l.parentNode,l)):u&&(u.d(1),u=null),null!=(r=t[0])&&r.sentOn?p?p.p(t,n):((p=Tt(t)).c(),p.m(a.parentNode,a)):p&&(p.d(1),p=null),null!=(d=null==(o=t[0])?void 0:o.location)&&d.name?$?$.p(t,n):(($=Lt(t)).c(),$.m(s.parentNode,s)):$&&($.d(1),$=null),t[3]||t[2]?b?b.p(t,n):((b=Nt(t)).c(),b.m(c.parentNode,c)):b&&(b.d(1),b=null),t[6]&&y.p(t,n)},i:v,o:v,d(t){f&&f.d(t),t&&_(i),u&&u.d(t),t&&_(l),p&&p.d(t),t&&_(a),$&&$.d(t),t&&_(s),b&&b.d(t),t&&_(c),y&&y.d(t),t&&_(d)}}}function qe(t,n,r){let o,i,l,a,s,{downloadable:c=!1}=n,{for:d}=n,f="boolean"!=typeof c||c,u=document.querySelector(`postcard-display[name="${d}"`);u||console.error(`No element found to attach to from .`);let p,$;return null==u||u.addEventListener("postcard-loaded",t=>{r(0,p=t.detail.metadata),r(1,$=t.detail.showingSide)}),null==u||u.addEventListener("postcard-flipped",t=>r(1,$=t.detail.showingSide)),t.$$set=t=>{r(11,n=V(V({},n),et(t))),"downloadable"in t&&r(8,c=t.downloadable)},t.$$.update=()=>{var n,c;1&t.$$.dirty&&r(5,o=(null==(n=null==p?void 0:p.context)?void 0:n.description)&&K(p.context.description)),1&t.$$.dirty&&r(4,i=null==(c=null==p?void 0:p.size)?void 0:c.physical),3&t.$$.dirty&&r(9,l=p&&p[$]),512&t.$$.dirty&&r(3,a=(null==l?void 0:l.description)&&K(l.description,!1)),512&t.$$.dirty&&r(2,s=(null==l?void 0:l.transcription)&&K(l.transcription,!0))},n=et(n),[p,$,s,a,i,o,f,u,c,l]}customElements.define("postcard-display",Ue);class Ie extends _t{constructor(t){super(),mt(this,{target:this.shadowRoot,props:Ft(this.attributes),customElement:!0},qe,ze,dt,{downloadable:8},null),t&&(t.target&&g(t.target,this,t.anchor),t.props&&(this.$set(t.props),S()))}static get observedAttributes(){return["downloadable"]}get downloadable(){return this.$$.ctx[8]}set downloadable(t){this.$$set({downloadable:t}),S()}}customElements.define("postcard-info",Ie); \ No newline at end of file +} +function Ut() { + H.r || U(H.c), H = H.p; +} +function T(e, t) { + e && e.i && (Q.delete(e), e.i(t)); +} +function L(e, t, n, r) { + if (e && e.o) { + if (Q.has(e)) + return; + Q.add(e), H.c.push(() => { + Q.delete(e), r && (n && e.d(1), r()); + }), e.o(t); + } else + r && r(); +} +function Wt(e, t) { + const n = t.token = {}; + function r(i, s, o, c) { + if (t.token !== n) + return; + t.resolved = c; + let l = t.ctx; + o !== void 0 && (l = l.slice(), l[o] = c); + const a = i && (t.current = i)(l); + let f = !1; + t.block && (t.blocks ? t.blocks.forEach((u, d) => { + d !== s && u && (zt(), L(u, 1, 1, () => { + t.blocks[d] === u && (t.blocks[d] = null); + }), Ut()); + }) : t.block.d(1), a.c(), T(a, 1), a.m(t.mount(), t.anchor), f = !0), t.block = a, t.blocks && (t.blocks[s] = a), f && S(); + } + if (Qt(e)) { + const i = dt(); + if (e.then(s => { + C(i), r(t.then, 1, t.value, s), C(null); + }, s => { + if (C(i), r(t.catch, 2, t.error, s), C(null), !t.hasCatch) + throw s; + }), t.current !== t.pending) + return r(t.pending, 0), !0; + } else { + if (t.current !== t.then) + return r(t.then, 1, t.value, e), !0; + t.resolved = e; + } +} +function qt(e, t, n) { + const r = t.slice(),{ resolved: i } = e; + e.current === e.then && (r[e.value] = i), e.current === e.catch && (r[e.error] = i), e.block.p(r, n); +} +function me(e, t) { + const n = {},r = {},i = { $$scope: 1 }; + let s = e.length; + for (; s--;) { + const o = e[s],c = t[s]; + if (c) { + for (const l in o) + l in c || (r[l] = 1); + for (const l in c) + i[l] || (n[l] = c[l], i[l] = 1); + e[s] = c; + } else + for (const l in o) + i[l] = 1; + } + for (const o in r) + o in n || (n[o] = void 0); + return n; +} +function It(e) { + e && e.c(); +} +function ht(e, t, n, r) { + const { fragment: i, on_mount: s, on_destroy: o, after_update: c } = e.$$; + i && i.m(t, n), r || lt(() => { + const l = s.map(ft).filter(Lt); + o ? o.push(...l) : U(l), e.$$.on_mount = []; + }), c.forEach(lt); +} +function it(e, t) { + const n = e.$$; + n.fragment !== null && (U(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []); +} +function _e(e, t) { + e.$$.dirty[0] === -1 && (I.push(e), he(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31; +} +function pt(e, t, n, r, i, s, o, c = [-1]) { + const l = V; + C(e); + const a = e.$$ = { + fragment: null, + ctx: null, + props: s, + update: v, + not_equal: i, + bound: bt(), + on_mount: [], + on_destroy: [], + on_disconnect: [], + before_update: [], + after_update: [], + context: new Map(t.context || (l ? l.$$.context : [])), + callbacks: bt(), + dirty: c, + skip_bound: !1, + root: t.target || l.$$.root }; + + o && o(a.root); + let f = !1; + if (a.ctx = n ? n(e, t.props || {}, (u, d, ...y) => { + const w = y.length ? y[0] : d; + return a.ctx && i(a.ctx[u], a.ctx[u] = w) && (!a.skip_bound && a.bound[u] && a.bound[u](w), f && _e(e, u)), d; + }) : [], a.update(), f = !0, U(a.before_update), a.fragment = r ? r(a.ctx) : !1, t.target) { + if (t.hydrate) { + ee(); + const u = A(t.target); + a.fragment && a.fragment.l(u), u.forEach(_); + } else + a.fragment && a.fragment.c(); + t.intro && T(e.$$.fragment), ht(e, t.target, t.anchor, t.customElement), ne(), S(); + } + C(l); +} +let mt; +typeof HTMLElement == "function" && (mt = class extends HTMLElement { + constructor() { + super(), this.attachShadow({ mode: "open" }); + } + connectedCallback() { + const { on_mount: e } = this.$$; + this.$$.on_disconnect = e.map(ft).filter(Lt); + for (const t in this.$$.slotted) + this.appendChild(this.$$.slotted[t]); + } + attributeChangedCallback(e, t, n) { + this[e] = n; + } + disconnectedCallback() { + U(this.$$.on_disconnect); + } + $destroy() { + it(this, 1), this.$destroy = v; + } + $on(e, t) { + const n = this.$$.callbacks[e] || (this.$$.callbacks[e] = []); + return n.push(t), () => { + const r = n.indexOf(t); + r !== -1 && n.splice(r, 1); + }; + } + $set(e) { + this.$$set && !Dt(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1); + }}); + +class ge { + $destroy() { + it(this, 1), this.$destroy = v; + } + $on(t, n) { + const r = this.$$.callbacks[t] || (this.$$.callbacks[t] = []); + return r.push(n), () => { + const i = r.indexOf(n); + i !== -1 && r.splice(i, 1); + }; + } + $set(t) { + this.$$set && !Dt(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1); + }} + +var et; +(function (e) { + e.Book = "book", e.LeftHand = "left-hand", e.Calendar = "calendar", e.RightHand = "right-hand"; +})(et || (et = {})); +const be = e => e == et.LeftHand || e == et.RightHand; +class q { + constructor(t) { + this.originalLocale = t.original, this.originalText = this.originalLocale && t[this.originalLocale], this._innerMap = new Map(Object.entries(t)); + } + pickBest(t = [], n = !0) { + if ((t.length === 0 || n) && this.originalLocale && this.originalText) + return [this.originalText, this.originalLocale]; + if (t.length === 0) { + const s = this._innerMap.entries(),{ value: [o, c] } = s.next(); + return [c, o]; + } + let i = []; + for (let s of t) { + if (this._innerMap.has(s)) + return [this._innerMap.get(s), s]; + i.push(s.split("-")[0]); + } + for (let [s, o] of this._innerMap.entries()) + if (i.includes(s.split("-")[0])) + return [o, s]; + return null; + }} + +class ye { + constructor(t) { + this.reader = t.getReader(), this.buffer = new Uint8Array(0); + } + async read(t) { + for (; this.buffer.byteLength < t;) + await this.addToBuffer(); + const n = this.buffer.slice(0, t); + return this.buffer = this.buffer.slice(t), n; + } + async readSized() { + const t = await this.read(4),n = new DataView(t.buffer).getUint32(0, !1); + return this.read(n); + } + async addToBuffer() { + const n = (await this.reader.read()).value; + if (!n) + throw "Unexpected end of data"; + const r = new Uint8Array(this.buffer.byteLength + n.byteLength); + r.set(this.buffer, 0), r.set(n, this.buffer.byteLength), this.buffer = r; + }} + +class ke { + constructor(t, n) { + if (typeof t != "object" || typeof t.pxW != "number" || typeof t.pxH != "number") + throw "Missing size attribute"; + this.isHeteroriented = be(n), this.pxW = t.pxW, this.pxH = t.pxH, this.frontAspectRatio = [this.pxW, this.pxH], t.cmW && t.cmH && (this.cmW = $t(t.cmW), this.cmH = $t(t.cmH), this.physical = `${Et(this.cmW)}cm x ${Et(this.cmH)}cm`, this.frontAspectRatio = [this.cmW[0] * this.cmH[1], this.cmW[1] * this.cmH[0]]); + const r = Kt(this.frontAspectRatio[0], this.frontAspectRatio[1]); + this.frontAspectRatio = [this.frontAspectRatio[0] / r, this.frontAspectRatio[1] / r]; + } + aspectRatio(t) { + return !this.isHeteroriented || t ? this.frontAspectRatio : [this.frontAspectRatio[1], this.frontAspectRatio[0]]; + } + css(t) { + if (!this.isHeteroriented) + return { + width: "100%", + height: "100%", + margin: "0 0" }; + + const [n, r] = this.aspectRatio(t); + if (n > r) { + const i = r / n; + return { + width: "100%", + height: `${100 * i}%`, + margin: `${50 * (1 - i)}% 0` }; + + } else { + const i = n / r; + return { + width: `${100 * i}%`, + height: "100%", + margin: `0 ${50 * (1 - i)}%` }; + + } + }} + +const Kt = (e, t) => t ? Kt(t, e % t) : e,we = /^(\d+)\/(\d+)$/,$t = e => { + const t = e.match(we); + if (!t) + throw `invalid rational length: ${e}`; + return [parseInt(t[1]), parseInt(t[2])]; +},Et = e => (e[0] / e[1]).toFixed(1),ve = e => { + if (e.status !== 200) + throw "Unable to load file"; + return e; +},$e = async e => { + const t = await fetch(e).then(d => ve(d).body); + if (t === null) + throw "Unable to retrieve postcard"; + const n = new ye(t); + let r = {}; + const i = await n.read(8); + if (new TextDecoder().decode(i) !== "postcard") + throw "Not a postcard file"; + const s = await n.read(3),o = new DataView(s.buffer),c = o.getUint8(0),l = o.getUint8(1),a = o.getUint8(2); + r.version = `${c}.${l}.${a}`; + const f = await n.readSized(),u = new TextDecoder("utf-8"); + return r.metadata = Ee(JSON.parse(u.decode(f))), r.frontData = n.readSized(), r.backData = r.frontData.then(() => n.readSized()), r; +},Ee = e => { + const { flip: t, frontSize: n, sentOn: r, front: i, back: s, context: o, ...c } = e; + return { + ...c, + flip: t, + sentOn: r && new Date(r), + size: new ke(n, t), + front: i && { + description: i.description && new q(i.description), + transcription: i.transcription && new q(i.transcription), + secrets: i.secrets }, + + back: s && { + description: s.description && new q(s.description), + transcription: s.transcription && new q(s.transcription), + secrets: s.secrets }, + + context: o && { + author: o.author, + description: o.description && new q(o.description) } }; + + +}; +function Oe(e) { + return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; +} +var ct = { exports: {} },Vt = {},D = {},_t = {}; +(function (e) { + Object.defineProperty(e, "__esModule", { + value: !0 }), + e.default = void 0; + function t(r, i) { + const s = RegExp(r, "g"); + return o => { + if (typeof o != "string") + throw new TypeError("expected an argument of type string, but got ".concat(typeof styleObj)); + return o.match(s) ? o.replace(s, i) : o; + }; + } + var n = t; + e.default = n; +})(_t); +Object.defineProperty(D, "__esModule", { + value: !0 }); + +D.snakeToKebab = D.camelToKebab = void 0; +var Xt = Pe(_t); +function Pe(e) { + return e && e.__esModule ? e : { default: e }; +} +const xe = (0, Xt.default)(/[A-Z]/, e => "-".concat(e.toLowerCase())); +D.camelToKebab = xe; +const Re = (0, Xt.default)(/_/, () => "-"); +D.snakeToKebab = Re; +(function (e) { + Object.defineProperty(e, "__esModule", { + value: !0 }), + e.default = void 0; + var t = D; + function n(i, s = t.camelToKebab) { + if (!i || typeof i != "object" || Array.isArray(i)) + throw new TypeError("expected an argument of type object, but got ".concat(typeof i)); + return Object.keys(i).map(c => "".concat(s(c), ": ").concat(i[c], ";")).join(` +`); + } + var r = n; + e.default = r; +})(Vt); +(function (e, t) { + Object.defineProperty(t, "__esModule", { + value: !0 }), + Object.defineProperty(t, "createParser", { + enumerable: !0, + get: function () { + return r.default; + } }), + t.parsers = t.default = void 0; + var n = o(Vt),r = o(_t),i = s(D); + t.parsers = i; + function s(f) { + if (f && f.__esModule) + return f; + var u = {}; + if (f != null) { + for (var d in f) + if (Object.prototype.hasOwnProperty.call(f, d)) { + var y = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(f, d) : {}; + y.get || y.set ? Object.defineProperty(u, d, y) : u[d] = f[d]; + } + } + return u.default = f, u; + } + function o(f) { + return f && f.__esModule ? f : { default: f }; + } + function c(f) { + for (var u = 1; u < arguments.length; u++) { + var d = arguments[u] != null ? arguments[u] : {},y = Object.keys(d); + typeof Object.getOwnPropertySymbols == "function" && (y = y.concat(Object.getOwnPropertySymbols(d).filter(function (w) { + return Object.getOwnPropertyDescriptor(d, w).enumerable; + }))), y.forEach(function (w) { + l(f, w, d[w]); + }); + } + return f; + } + function l(f, u, d) { + return u in f ? Object.defineProperty(f, u, { value: d, enumerable: !0, configurable: !0, writable: !0 }) : f[u] = d, f; + } + var a = n.default; + t.default = a, e.exports = n.default, e.exports.createParser = r.default, e.exports.parsers = c({}, i); +})(ct, ct.exports); +const Ae = /* @__PURE__ */Oe(ct.exports); +var at = /* @__PURE__ */(e => (e.FrontOnly = "front", e.BackOnly = "back", e.BothFrontFirst = "front back", e.BothBackFirst = "back front", e))(at || {}); +const Ot = (e, t) => { + const [n, r] = e.aspectRatio(t); + return r > n; +},J = e => e.toISOString().replace(/T.*$/, ""),Ce = e => { + let t = []; + for (let n of e) + t.push(`${n[0]},${n[1]}`); + return t.join(" "); +}; +function Se(e) { + let t,n,r,i,s,o,c,l,a = [ + { width: "128" }, + { viewBox: "0 0 150.3 107.3" }, + { xmlns: "http://www.w3.org/2000/svg" }, + e[0]], + f = {}; + for (let u = 0; u < a.length; u += 1) + f = K(f, a[u]); + return { + c() { + t = O("svg"), n = O("g"), r = O("rect"), i = O("rect"), s = O("path"), o = O("path"), c = O("path"), l = O("path"), this.h(); + }, + l(u) { + t = M(u, "svg", { width: !0, viewBox: !0, xmlns: !0 }); + var d = A(t); + n = M(d, "g", { transform: !0, style: !0 }); + var y = A(n); + r = M(y, "rect", { + style: !0, + width: !0, + height: !0, + x: !0, + y: !0, + rx: !0, + ry: !0 }), + A(r).forEach(_), i = M(y, "rect", { + style: !0, + width: !0, + height: !0, + x: !0, + y: !0, + rx: !0, + ry: !0 }), + A(i).forEach(_), y.forEach(_), s = M(d, "path", { style: !0, d: !0, transform: !0 }), A(s).forEach(_), o = M(d, "path", { style: !0, d: !0, transform: !0 }), A(o).forEach(_), c = M(d, "path", { style: !0, d: !0, transform: !0 }), A(c).forEach(_), l = M(d, "path", { style: !0, d: !0, transform: !0 }), A(l).forEach(_), d.forEach(_), this.h(); + }, + h() { + m(r, "fill", "#fff"), m(r, "stroke-width", "2.3"), m(r, "stroke-linecap", "round"), m(r, "stroke-linejoin", "round"), m(r, "stroke-dasharray", "none"), m(r, "stroke-opacity", "1"), h(r, "width", "148"), h(r, "height", "105"), h(r, "x", "51.15"), h(r, "y", "51.15"), h(r, "rx", "1"), h(r, "ry", "1"), m(i, "fill", "#fff"), m(i, "stroke-width", "2.5"), m(i, "stroke-linecap", "round"), m(i, "stroke-linejoin", "round"), m(i, "stroke-dasharray", "none"), m(i, "stroke-opacity", "1"), h(i, "width", "21"), h(i, "height", "24"), h(i, "x", "168.15"), h(i, "y", "61.15"), h(i, "rx", "1"), h(i, "ry", "1"), h(n, "transform", "translate(-50 -50)"), m(n, "fill", "#fff"), m(s, "fill", "none"), m(s, "stroke-width", "2.5"), m(s, "stroke-linecap", "round"), m(s, "stroke-linejoin", "round"), m(s, "stroke-dasharray", "none"), m(s, "stroke-opacity", "1"), h(s, "d", "m86.883 93.636 7.5 7.5m0-7.5-7.5 7.5"), h(s, "transform", "translate(3.267 -32.486)"), m(o, "fill", "none"), m(o, "stroke-width", "2.5"), m(o, "stroke-linecap", "round"), m(o, "stroke-linejoin", "round"), m(o, "stroke-dasharray", "none"), m(o, "stroke-opacity", "1"), h(o, "d", "m86.883 93.636 7.5 7.5m0-7.5-7.5 7.5"), h(o, "transform", "translate(-34.233 -32.486)"), m(c, "fill", "none"), m(c, "stroke-width", "2.5"), m(c, "stroke-linecap", "round"), m(c, "stroke-linejoin", "round"), m(c, "stroke-dasharray", "none"), m(c, "stroke-opacity", "1"), h(c, "d", "M90.633 109.317h30v3.75s0 3.75-3.75 3.75-3.75-3.75-3.75-3.75v-3.75"), h(c, "transform", "translate(-30.483 -33.167)"), m(l, "fill", "none"), m(l, "stroke-width", "2.5"), m(l, "stroke-linecap", "round"), m(l, "stroke-linejoin", "round"), m(l, "stroke-dasharray", "none"), m(l, "stroke-opacity", "1"), h(l, "d", "M125.5 67.679s3.75-3.75 7.5-3.75 7.5 3.75 7.5 3.75 3.75 3.75 7.5 3.75 7.5-3.75 7.5-3.75m-30 7.5s3.75-3.75 7.5-3.75 7.5 3.75 7.5 3.75 3.75 3.75 7.5 3.75 7.5-3.75 7.5-3.75"), h(l, "transform", "translate(-29.85 -48.279)"), yt(t, f); + }, + m(u, d) { + oe(u, t, d), B(t, n), B(n, r), B(n, i), B(t, s), B(t, o), B(t, c), B(t, l); + }, + p(u, [d]) { + yt(t, f = me(a, [ + { width: "128" }, + { viewBox: "0 0 150.3 107.3" }, + { xmlns: "http://www.w3.org/2000/svg" }, + d & 1 && u[0]])); + + }, + i: v, + o: v, + d(u) { + u && _(t); + } }; + +} +function Te(e, t, n) { + return e.$$set = r => { + n(0, t = K(K({}, t), tt(r))); + }, t = tt(t), [t]; +} +class Yt extends ge { + constructor(t) { + super(), pt(this, t, Te, Se, ut, {}); + }} + +function Pt(e, t, n) { + const r = e.slice(); + return r[21] = t[n], r[23] = n, r; +} +function xt(e, t, n) { + const r = e.slice(); + return r[25] = t[n], r; +} +function Ne(e) { + let t, n, r, i; + return r = new Yt({}), { + c() { + t = E("div"), n = E("div"), It(r.$$.fragment), h(n, "class", "error"), h(t, "class", "postcard error"); + }, + m(s, o) { + b(s, t, o), k(t, n), ht(r, n, null), i = !0; + }, + p: v, + i(s) { + i || (T(r.$$.fragment, s), i = !0); + }, + o(s) { + L(r.$$.fragment, s), i = !1; + }, + d(s) { + s && _(t), it(r); + } }; + +} +function Me(e) { + let t,n,r = e[2],i = []; + for (let o = 0; o < r.length; o += 1) + i[o] = At(Pt(e, r, o)); + const s = o => L(i[o], 1, 1, () => { + i[o] = null; + }); + return { + c() { + t = E("div"); + for (let o = 0; o < i.length; o += 1) + i[o].c(); + h(t, "class", "postcard flip-" + e[20].flip), kt(t, "flipped", e[0]); + }, + m(o, c) { + b(o, t, c); + for (let l = 0; l < i.length; l += 1) + i[l].m(t, null); + n = !0; + }, + p(o, c) { + if (c & 62) { + r = o[2]; + let l; + for (l = 0; l < r.length; l += 1) { + const a = Pt(o, r, l); + i[l] ? (i[l].p(a, c), T(i[l], 1)) : (i[l] = At(a), i[l].c(), T(i[l], 1), i[l].m(t, null)); + } + for (zt(), l = r.length; l < i.length; l += 1) + s(l); + Ut(); + } + (!n || c & 1) && kt(t, "flipped", o[0]); + }, + i(o) { + if (!n) { + for (let c = 0; c < r.length; c += 1) + T(i[c]); + n = !0; + } + }, + o(o) { + i = i.filter(Boolean); + for (let c = 0; c < i.length; c += 1) + L(i[c]); + n = !1; + }, + d(o) { + o && _(t), jt(i, o); + } }; + +} +function Be(e) { + let t, n, r; + return n = new Yt({}), { + c() { + t = E("div"), It(n.$$.fragment), h(t, "class", "error"); + }, + m(i, s) { + b(i, t, s), ht(n, t, null), r = !0; + }, + p: v, + i(i) { + r || (T(n.$$.fragment, i), r = !0); + }, + o(i) { + L(n.$$.fragment, i), r = !1; + }, + d(i) { + i && _(t), it(n); + } }; + +} +function He(e) { + let t,n,r,i,s = e[24].secrets.length > 0 && Le(e); + return { + c() { + t = E("img"), r = P(), s && s.c(), i = rt(), te(t.src, n = e[24].src) || h(t, "src", n), h(t, "alt", e[24].description), h(t, "lang", e[20].locale); + }, + m(o, c) { + b(o, t, c), b(o, r, c), s && s.m(o, c), b(o, i, c); + }, + p(o, c) { + o[24].secrets.length > 0 && s.p(o, c); + }, + i: v, + o: v, + d(o) { + o && _(t), o && _(r), s && s.d(o), o && _(i); + } }; + +} +function Le(e) { + let t,n,r,i,s,o,c,l = e[24].secrets,a = []; + for (let f = 0; f < l.length; f += 1) + a[f] = Rt(xt(e, l, f)); + return { + c() { + t = O("svg"), n = O("defs"), r = O("linearGradient"), i = O("stop"), s = O("stop"), o = O("animate"), c = O("animate"); + for (let f = 0; f < a.length; f += 1) + a[f].c(); + h(i, "offset", "0%"), h(i, "stop-color", "rgba(255,255,255,0.2)"), h(s, "offset", "100%"), h(s, "stop-color", "rgba(200,200,200,0.4)"), h(o, "attributeName", "x1"), h(o, "dur", "700ms"), h(o, "from", "0"), h(o, "to", "0.04"), h(o, "repeatCount", "indefinite"), h(c, "attributeName", "x2"), h(c, "dur", "700ms"), h(c, "from", "0.01"), h(c, "to", "0.05"), h(c, "repeatCount", "indefinite"), h(r, "id", "secret"), h(r, "x1", "0"), h(r, "x2", "0.01"), h(r, "y1", "0.01"), h(r, "y2", "0"), h(r, "gradientUnits", "userSpaceOnUse"), h(r, "spreadMethod", "reflect"), h(r, "vector-effect", "non-scaling-size"), h(t, "class", "secrets"), h(t, "viewBox", "0 0 1 1"); + }, + m(f, u) { + b(f, t, u), k(t, n), k(n, r), k(r, i), k(r, s), k(r, o), k(r, c); + for (let d = 0; d < a.length; d += 1) + a[d].m(t, null); + }, + p(f, u) { + if (u & 4) { + l = f[24].secrets; + let d; + for (d = 0; d < l.length; d += 1) { + const y = xt(f, l, d); + a[d] ? a[d].p(y, u) : (a[d] = Rt(y), a[d].c(), a[d].m(t, null)); + } + for (; d < a.length; d += 1) + a[d].d(1); + a.length = l.length; + } + }, + d(f) { + f && _(t), jt(a, f); + } }; + +} +function Rt(e) { + let t; + return { + c() { + t = O("polygon"), h(t, "points", Ce(e[25])), m(t, "fill", "url(#secret)"), m(t, "vector-effect", "non-scaling-size"); + }, + m(n, r) { + b(n, t, r); + }, + p: v, + d(n) { + n && _(t); + } }; + +} +function De(e) { + return { + c: v, + m: v, + p: v, + i: v, + o: v, + d: v }; + +} +function At(e) { + let t,n,r,i,s,o = { + ctx: e, + current: null, + token: null, + hasCatch: !0, + pending: De, + then: He, + catch: Be, + value: 24, + error: 28, + blocks: [,,,] }; + + return Wt(e[21], o), { + c() { + t = E("div"), o.block.c(), n = P(), h(t, "class", "side" + (e[4] ? " flippable" : "")), h(t, "style", Ae(e[20].size.css(e[3](e[23])))); + }, + m(c, l) { + b(c, t, l), o.block.m(t, o.anchor = null), o.mount = () => t, o.anchor = n, k(t, n), r = !0, i || (s = se(t, "click", e[5]), i = !0); + }, + p(c, l) { + e = c, qt(o, e, l); + }, + i(c) { + r || (T(o.block), r = !0); + }, + o(c) { + for (let l = 0; l < 3; l += 1) { + const a = o.blocks[l]; + L(a); + } + r = !1; + }, + d(c) { + c && _(t), o.block.d(), o.token = null, o = null, i = !1, s(); + } }; + +} +function je(e) { + let t; + return { + c() { + t = E("div"), h(t, "class", "postcard loading"); + }, + m(n, r) { + b(n, t, r); + }, + p: v, + i: v, + o: v, + d(n) { + n && _(t); + } }; + +} +function Fe(e) { + let t,n,r = { + ctx: e, + current: null, + token: null, + hasCatch: !0, + pending: je, + then: Me, + catch: Ne, + value: 20, + error: 28, + blocks: [,,,] }; + + return Wt(e[1], r), { + c() { + t = rt(), r.block.c(), this.c = v; + }, + m(i, s) { + b(i, t, s), r.block.m(i, r.anchor = s), r.mount = () => t.parentNode, r.anchor = t, n = !0; + }, + p(i, [s]) { + e = i, qt(r, e, s); + }, + i(i) { + n || (T(r.block), n = !0); + }, + o(i) { + for (let s = 0; s < 3; s += 1) { + const o = r.blocks[s]; + L(o); + } + n = !1; + }, + d(i) { + i && _(t), r.block.d(i), r.token = null, r = null; + } }; + +} +function ze(e, t, n) { + let { src: r } = t,{ name: i = void 0 } = t,{ show: s = at.BothFrontFirst } = t; + const o = i && document.querySelectorAll(`postcard-display[name="${i}"`).length; + o && o > 1 && console.warn(`There are ${o} postcards with name="${i}". Any elements will be attached to the first one only.`); + const c = s.split(" "); + let l = !1; + const a = dt(),f = ue(),u = (g, R) => { + f(g, R), a.dispatchEvent && a.dispatchEvent(new CustomEvent(g, { bubbles: !0, composed: !0, detail: R })); + },d = g => URL.createObjectURL(new Blob([g])),y = g => { + throw console.error(g), g; + },w = g => { + const [R, z] = g.size.aspectRatio(!0),Jt = Ot(g.size, !0) && g.size.isHeteroriented,Zt = Ot(g.size, !1) && g.size.isHeteroriented; + a.style.setProperty("--frontAR", Jt ? "1/1" : `${R}/${z}`), a.style.setProperty("--backAR", Zt ? "1/1" : `${R}/${z}`), N(); + },N = () => a.style.aspectRatio = W() ? "var(--frontAR)" : "var(--backAR)",p = $e(r),$ = p.then(({ metadata: g }) => g).catch(y); + $.then(g => { + w(g), u("postcard-loaded", { + name: i, + metadata: g, + showingSide: F() }); + + }); + const X = c.map(g => p.then(R => R[`${g}Data`].then(z => ({ metadata: R.metadata, bytes: z }))).then(({ metadata: R, bytes: z }) => ({ + src: d(z), + secrets: R[g].secrets || [], + description: R[g].description })). + catch(y)),F = (g = l ? 1 : 0) => c[g],W = (g = l ? 1 : 0) => F(g) === at.FrontOnly,gt = c.length === 2,Gt = gt && (() => { + n(0, l = !l), N(), u("postcard-flipped", { name: i, showingSide: F() }); + }); + return e.$$set = g => { + "src" in g && n(6, r = g.src), "name" in g && n(7, i = g.name), "show" in g && n(8, s = g.show); + }, [l, $, X, W, gt, Gt, r, i, s]; +} +class Ue extends mt { + constructor(t) { + super(), this.shadowRoot.innerHTML = "", pt( + this, + { + target: this.shadowRoot, + props: Ft(this.attributes), + customElement: !0 }, + + ze, + Fe, + ut, + { src: 6, name: 7, show: 8 }, + null), + t && (t.target && b(t.target, this, t.anchor), t.props && (this.$set(t.props), S())); + } + static get observedAttributes() { + return ["src", "name", "show"]; + } + get src() { + return this.$$.ctx[6]; + } + set src(t) { + this.$$set({ src: t }), S(); + } + get name() { + return this.$$.ctx[7]; + } + set name(t) { + this.$$set({ name: t }), S(); + } + get show() { + return this.$$.ctx[8]; + } + set show(t) { + this.$$set({ show: t }), S(); + }} + +customElements.define("postcard-display", Ue); +function Ct(e) { + let t, n, r, i, s; + return { + c() { + t = E("p"), n = E("strong"), n.textContent = "Context:", r = P(), i = x(e[5]), h(t, "lang", s = e[0].locale); + }, + m(o, c) { + b(o, t, c), k(t, n), k(t, r), k(t, i); + }, + p(o, c) { + c & 32 && j(i, o[5]), c & 1 && s !== (s = o[0].locale) && h(t, "lang", s); + }, + d(o) { + o && _(t); + } }; + +} +function St(e) { + let t, n, r, i; + return { + c() { + t = E("p"), n = E("strong"), n.textContent = "Physical size (front):", r = P(), i = x(e[4]); + }, + m(s, o) { + b(s, t, o), k(t, n), k(t, r), k(t, i); + }, + p(s, o) { + o & 16 && j(i, s[4]); + }, + d(s) { + s && _(t); + } }; + +} +function Tt(e) { + var l; + let t,n,r,i,s = J((l = e[0]) == null ? void 0 : l.sentOn) + "",o,c; + return { + c() { + var a; + t = E("p"), n = E("strong"), n.textContent = "Date:", r = P(), i = E("time"), o = x(s), h(i, "datetime", c = J((a = e[0]) == null ? void 0 : a.sentOn)); + }, + m(a, f) { + b(a, t, f), k(t, n), k(t, r), k(t, i), k(i, o); + }, + p(a, f) { + var u, d; + f & 1 && s !== (s = J((u = a[0]) == null ? void 0 : u.sentOn) + "") && j(o, s), f & 1 && c !== (c = J((d = a[0]) == null ? void 0 : d.sentOn)) && h(i, "datetime", c); + }, + d(a) { + a && _(t); + } }; + +} +function Nt(e) { + let t,n,r,i = e[0].location.name + "",s; + return { + c() { + t = E("p"), n = E("strong"), n.textContent = "Location:", r = P(), s = x(i); + }, + m(o, c) { + b(o, t, c), k(t, n), k(t, r), k(t, s); + }, + p(o, c) { + c & 1 && i !== (i = o[0].location.name + "") && j(s, i); + }, + d(o) { + o && _(t); + } }; + +} +function Mt(e) { + let t,n,r,i,s,o = e[3] && Bt(e),c = e[2] && Ht(e); + return { + c() { + t = x("On the "), n = x(e[1]), r = x(`: + + `), o && o.c(), i = P(), c && c.c(), s = rt(); + }, + m(l, a) { + b(l, t, a), b(l, n, a), b(l, r, a), o && o.m(l, a), b(l, i, a), c && c.m(l, a), b(l, s, a); + }, + p(l, a) { + a & 2 && j(n, l[1]), l[3] ? o ? o.p(l, a) : (o = Bt(l), o.c(), o.m(i.parentNode, i)) : o && (o.d(1), o = null), l[2] ? c ? c.p(l, a) : (c = Ht(l), c.c(), c.m(s.parentNode, s)) : c && (c.d(1), c = null); + }, + d(l) { + l && _(t), l && _(n), l && _(r), o && o.d(l), l && _(i), c && c.d(l), l && _(s); + } }; + +} +function Bt(e) { + let t, n, r, i, s; + return { + c() { + t = E("p"), n = E("strong"), n.textContent = "Description:", r = P(), i = x(e[3]), h(t, "lang", s = e[0].locale); + }, + m(o, c) { + b(o, t, c), k(t, n), k(t, r), k(t, i); + }, + p(o, c) { + c & 8 && j(i, o[3]), c & 1 && s !== (s = o[0].locale) && h(t, "lang", s); + }, + d(o) { + o && _(t); + } }; + +} +function Ht(e) { + let t, n, r, i, s; + return { + c() { + t = E("p"), n = E("strong"), n.textContent = "Transcription:", r = P(), i = x(e[2]), h(t, "lang", s = e[0].locale); + }, + m(o, c) { + b(o, t, c), k(t, n), k(t, r), k(t, i); + }, + p(o, c) { + c & 4 && j(i, o[2]), c & 1 && s !== (s = o[0].locale) && h(t, "lang", s); + }, + d(o) { + o && _(t); + } }; + +} +function We(e) { + let t, n; + return { + c() { + var r; + t = E("a"), n = x("Download postcard"), h(t, "href", (r = e[7]) == null ? void 0 : r.getAttribute("src")); + }, + m(r, i) { + b(r, t, i), k(t, n); + }, + p: v, + d(r) { + r && _(t); + } }; + +} +function qe(e) { + var y, w, N; + let t,n,r,i,s,o,c = e[5] && Ct(e),l = e[4] && St(e),a = ((y = e[0]) == null ? void 0 : y.sentOn) && Tt(e),f = ((N = (w = e[0]) == null ? void 0 : w.location) == null ? void 0 : N.name) && Nt(e),u = (e[3] || e[2]) && Mt(e),d = e[6] && We(e); + return { + c() { + c && c.c(), t = P(), l && l.c(), n = P(), a && a.c(), r = P(), f && f.c(), i = P(), u && u.c(), s = P(), d && d.c(), o = rt(), this.c = v; + }, + m(p, $) { + c && c.m(p, $), b(p, t, $), l && l.m(p, $), b(p, n, $), a && a.m(p, $), b(p, r, $), f && f.m(p, $), b(p, i, $), u && u.m(p, $), b(p, s, $), d && d.m(p, $), b(p, o, $); + }, + p(p, [$]) { + var X, F, W; + p[5] ? c ? c.p(p, $) : (c = Ct(p), c.c(), c.m(t.parentNode, t)) : c && (c.d(1), c = null), p[4] ? l ? l.p(p, $) : (l = St(p), l.c(), l.m(n.parentNode, n)) : l && (l.d(1), l = null), (X = p[0]) != null && X.sentOn ? a ? a.p(p, $) : (a = Tt(p), a.c(), a.m(r.parentNode, r)) : a && (a.d(1), a = null), (W = (F = p[0]) == null ? void 0 : F.location) != null && W.name ? f ? f.p(p, $) : (f = Nt(p), f.c(), f.m(i.parentNode, i)) : f && (f.d(1), f = null), p[3] || p[2] ? u ? u.p(p, $) : (u = Mt(p), u.c(), u.m(s.parentNode, s)) : u && (u.d(1), u = null), p[6] && d.p(p, $); + }, + i: v, + o: v, + d(p) { + c && c.d(p), p && _(t), l && l.d(p), p && _(n), a && a.d(p), p && _(r), f && f.d(p), p && _(i), u && u.d(p), p && _(s), d && d.d(p), p && _(o); + } }; + +} +function Ie(e, t, n) { + let r,i,s,o,c,{ downloadable: l = !1 } = t,{ for: a } = t; + const f = typeof l == "boolean" ? l : !0,u = document.querySelector(`postcard-display[name="${a}"`); + u || console.error(`No element found to attach to from .`); + let d, y; + return u == null || u.addEventListener("postcard-loaded", w => { + n(0, d = w.detail.metadata), n(1, y = w.detail.showingSide); + }), u == null || u.addEventListener("postcard-flipped", w => n(1, y = w.detail.showingSide)), e.$$set = w => { + n(11, t = K(K({}, t), tt(w))), "downloadable" in w && n(8, l = w.downloadable); + }, e.$$.update = () => { + var w, N; + e.$$.dirty & 1 && n(5, r = ((w = d == null ? void 0 : d.context) == null ? void 0 : w.description) && d.context.description), e.$$.dirty & 1 && n(4, i = (N = d == null ? void 0 : d.size) == null ? void 0 : N.physical), e.$$.dirty & 3 && n(9, s = d && d[y]), e.$$.dirty & 512 && n(3, o = (s == null ? void 0 : s.description) && s.description), e.$$.dirty & 512 && n(2, c = (s == null ? void 0 : s.transcription) && s.transcription); + }, t = tt(t), [ + d, + y, + c, + o, + i, + r, + f, + u, + l, + s]; + +} +class Ke extends mt { + constructor(t) { + super(), pt( + this, + { + target: this.shadowRoot, + props: Ft(this.attributes), + customElement: !0 }, + + Ie, + qe, + ut, + { downloadable: 8 }, + null), + t && (t.target && b(t.target, this, t.anchor), t.props && (this.$set(t.props), S())); + } + static get observedAttributes() { + return ["downloadable"]; + } + get downloadable() { + return this.$$.ctx[8]; + } + set downloadable(t) { + this.$$set({ downloadable: t }), S(); + }} + +customElements.define("postcard-info", Ke); \ No newline at end of file