diff --git a/dist/bigger-picture.cjs b/dist/bigger-picture.cjs index cfccf65..2b01555 100644 --- a/dist/bigger-picture.cjs +++ b/dist/bigger-picture.cjs @@ -699,7 +699,25 @@ const defaultTweenOptions = (duration) => ({ const getThumbBackground = (activeItem) => !activeItem.thumb || `url(${activeItem.thumb})`; -/* src/components/loading.svelte generated by Svelte v3.47.0 */ +/** + * Adds attributes to the given node based on the provided object. + * + * @param {HTMLElement} node - The node to which attributes will be added + * @param {Record | string} obj - The object containing key-value pairs of attributes to be added + */ +const addAttributes = (node, obj) => { + if (!obj) { + return + } + if (typeof obj === 'string') { + obj = JSON.parse(obj); + } + for (const key in obj) { + node.setAttribute(key, obj[key]); + } +}; + +/* src/components/loading.svelte generated by Svelte v3.55.1 */ function create_if_block_1$2(ctx) { let div; @@ -873,13 +891,11 @@ class Loading extends SvelteComponent { } } -/* src/components/image.svelte generated by Svelte v3.47.0 */ +/* src/components/image.svelte generated by Svelte v3.55.1 */ function create_if_block_1$1(ctx) { let img; - let img_srcset_value; let img_sizes_value; - let img_alt_value; let img_outro; let current; let mounted; @@ -888,16 +904,19 @@ function create_if_block_1$1(ctx) { return { c() { img = element("img"); - attr(img, "srcset", img_srcset_value = /*activeItem*/ ctx[7].img); attr(img, "sizes", img_sizes_value = /*opts*/ ctx[8].sizes || `${/*sizes*/ ctx[1]}px`); - attr(img, "alt", img_alt_value = /*activeItem*/ ctx[7].alt); + attr(img, "alt", /*activeItem*/ ctx[7].alt); }, m(target, anchor) { insert(target, img, anchor); current = true; if (!mounted) { - dispose = listen(img, "error", /*error_handler*/ ctx[26]); + dispose = [ + action_destroyer(/*addSrc*/ ctx[21].call(null, img)), + listen(img, "error", /*error_handler*/ ctx[27]) + ]; + mounted = true; } }, @@ -919,12 +938,12 @@ function create_if_block_1$1(ctx) { if (detaching) detach(img); if (detaching && img_outro) img_outro.end(); mounted = false; - dispose(); + run_all(dispose); } }; } -// (374:10) {#if showLoader} +// (384:10) {#if showLoader} function create_if_block$1(ctx) { let loading; let current; @@ -1068,11 +1087,11 @@ function create_fragment$3(ctx) { set_style(div0, "height", /*$imageDimensions*/ ctx[0][1] + "px"); } - if (dirty[0] & /*pointerDown*/ 16) { + if (!current || dirty[0] & /*pointerDown*/ 16) { toggle_class(div0, "bp-drag", /*pointerDown*/ ctx[4]); } - if (dirty[0] & /*maxZoom, $imageDimensions, naturalWidth*/ 6145) { + if (!current || dirty[0] & /*maxZoom, $imageDimensions, naturalWidth*/ 6145) { toggle_class(div0, "bp-canzoom", /*maxZoom*/ ctx[11] > 1 && /*$imageDimensions*/ ctx[0][0] < /*naturalWidth*/ ctx[12]); } @@ -1080,7 +1099,7 @@ function create_fragment$3(ctx) { set_style(div0, "transform", style_transform); } - if (dirty[0] & /*closingWhileZoomed*/ 32) { + if (!current || dirty[0] & /*closingWhileZoomed*/ 32) { toggle_class(div1, "bp-close", /*closingWhileZoomed*/ ctx[5]); } }, @@ -1110,11 +1129,11 @@ function instance$3($$self, $$props, $$invalidate) { let $zoomDragTranslate; let $closing; let $imageDimensions; - component_subscribe($$self, closing, $$value => $$invalidate(25, $closing = $$value)); + component_subscribe($$self, closing, $$value => $$invalidate(26, $closing = $$value)); let { props } = $$props; let { smallScreen } = $$props; let { activeItem, opts, prev, next, zoomed, container } = props; - component_subscribe($$self, zoomed, value => $$invalidate(24, $zoomed = value)); + component_subscribe($$self, zoomed, value => $$invalidate(25, $zoomed = value)); let maxZoom = activeItem.maxZoom || opts.maxZoom || 10; let calculatedDimensions = props.calculateDimensions(activeItem); @@ -1429,7 +1448,7 @@ function instance$3($$self, $$props, $$invalidate) { // handle globalThis resize props.setResizeFunc(() => { - $$invalidate(23, calculatedDimensions = props.calculateDimensions(activeItem)); + $$invalidate(24, calculatedDimensions = props.calculateDimensions(activeItem)); // adjust image size / zoom on resize, but not on mobile because // some browsers (ios safari 15) constantly resize screen on drag @@ -1454,19 +1473,24 @@ function instance$3($$self, $$props, $$invalidate) { ); }; + const addSrc = node => { + addAttributes(node, activeItem.attr); + node.srcset = activeItem.img; + }; + const error_handler = error => opts.onError?.(container, activeItem, error); $$self.$$set = $$props => { - if ('smallScreen' in $$props) $$invalidate(22, smallScreen = $$props.smallScreen); + if ('smallScreen' in $$props) $$invalidate(23, smallScreen = $$props.smallScreen); }; $$self.$$.update = () => { - if ($$self.$$.dirty[0] & /*$imageDimensions, calculatedDimensions*/ 8388609) { + if ($$self.$$.dirty[0] & /*$imageDimensions, calculatedDimensions*/ 16777217) { zoomed.set($imageDimensions[0] - 10 > calculatedDimensions[0]); } - if ($$self.$$.dirty[0] & /*$closing, $zoomed, calculatedDimensions*/ 58720256) { + if ($$self.$$.dirty[0] & /*$closing, $zoomed, calculatedDimensions*/ 117440512) { // if zoomed while closing, zoom out image and add class // to change contain value on .bp-wrap to avoid cropping if ($closing && $zoomed && !opts.intro) { @@ -1500,6 +1524,7 @@ function instance$3($$self, $$props, $$invalidate) { removeEventFromCache, onPointerUp, onMount, + addSrc, props, smallScreen, calculatedDimensions, @@ -1512,11 +1537,11 @@ function instance$3($$self, $$props, $$invalidate) { class Image extends SvelteComponent { constructor(options) { super(); - init(this, options, instance$3, create_fragment$3, not_equal, { props: 21, smallScreen: 22 }, null, [-1, -1]); + init(this, options, instance$3, create_fragment$3, not_equal, { props: 22, smallScreen: 23 }, null, [-1, -1]); } } -/* src/components/iframe.svelte generated by Svelte v3.47.0 */ +/* src/components/iframe.svelte generated by Svelte v3.55.1 */ function create_fragment$2(ctx) { let div; @@ -1598,8 +1623,10 @@ function instance$2($$self, $$props, $$invalidate) { setDimensions(); props.setResizeFunc(setDimensions); - // add src ourselves to avoid src_url_equal call (svelte stuff) - const addSrc = node => node.src = activeItem.iframe; + const addSrc = node => { + addAttributes(node, activeItem.attr); + node.src = activeItem.iframe; + }; const load_handler = () => $$invalidate(0, loaded = true); @@ -1615,7 +1642,7 @@ class Iframe extends SvelteComponent { } } -/* src/components/video.svelte generated by Svelte v3.47.0 */ +/* src/components/video.svelte generated by Svelte v3.55.1 */ function create_fragment$1(ctx) { let div; @@ -1689,13 +1716,6 @@ function instance$1($$self, $$props, $$invalidate) { setDimensions(); props.setResizeFunc(setDimensions); - /** adds attributes to a node */ - const addAttributes = (node, obj) => { - for (const key in obj) { - attr(node, key, obj[key]); - } - }; - /** create audo / video element */ const onMount = node => { let mediaElement; @@ -1717,6 +1737,8 @@ function instance$1($$self, $$props, $$invalidate) { playsinline: true, tabindex: '0' }); + + addAttributes(mediaElement, activeItem.attr); } // add sources / tracks to media element @@ -1750,7 +1772,7 @@ class Video extends SvelteComponent { } } -/* src/bigger-picture.svelte generated by Svelte v3.47.0 */ +/* src/bigger-picture.svelte generated by Svelte v3.55.1 */ function create_if_block(ctx) { let div2; @@ -1760,7 +1782,6 @@ function create_if_block(ctx) { let div1; let button; let div1_outro; - let containerActions_action; let current; let mounted; let dispose; @@ -1797,7 +1818,7 @@ function create_if_block(ctx) { if (!mounted) { dispose = [ listen(button, "click", /*close*/ ctx[1]), - action_destroyer(containerActions_action = /*containerActions*/ ctx[14].call(null, div2)) + action_destroyer(/*containerActions*/ ctx[14].call(null, div2)) ]; mounted = true; @@ -1810,7 +1831,7 @@ function create_if_block(ctx) { check_outros(); key_block = create_key_block(ctx); key_block.c(); - transition_in(key_block); + transition_in(key_block, 1); key_block.m(div2, div1); } else { key_block.p(ctx, dirty); @@ -1829,19 +1850,19 @@ function create_if_block(ctx) { if_block = null; } - if (dirty[0] & /*$zoomed*/ 1024) { + if (!current || dirty[0] & /*$zoomed*/ 1024) { toggle_class(div2, "bp-zoomed", /*$zoomed*/ ctx[10]); } - if (dirty[0] & /*inline*/ 256) { + if (!current || dirty[0] & /*inline*/ 256) { toggle_class(div2, "bp-inline", /*inline*/ ctx[8]); } - if (dirty[0] & /*smallScreen*/ 128) { + if (!current || dirty[0] & /*smallScreen*/ 128) { toggle_class(div2, "bp-small", /*smallScreen*/ ctx[7]); } - if (dirty[0] & /*opts*/ 32) { + if (!current || dirty[0] & /*opts*/ 32) { toggle_class(div2, "bp-noclose", /*opts*/ ctx[5].noClose); } }, diff --git a/dist/bigger-picture.min.js b/dist/bigger-picture.min.js index b49d415..9866eba 100644 --- a/dist/bigger-picture.min.js +++ b/dist/bigger-picture.min.js @@ -1 +1 @@ -var BiggerPicture=function(){function t(){}const n=t=>t;function e(t,n){for(const e in n)t[e]=n[e];return t}function o(t){return t()}function r(t){t.forEach(o)}function i(t){return"function"==typeof t}function c(t,n){return t!=t?n==n:t!==n}function s(n,e,o){n.$$.on_destroy.push(((n,...e)=>{if(null==n)return t;const o=n.subscribe(...e);return o.unsubscribe?()=>o.unsubscribe():o})(e,o))}function u(n){return n&&i(n.destroy)?n.destroy:t}let l=()=>globalThis.performance.now(),a=t=>requestAnimationFrame(t);const p=new Set;function f(t){p.forEach((n=>{n.c(t)||(p.delete(n),n.f())})),0!==p.size&&a(f)}function d(t){let n;return 0===p.size&&a(f),{promise:new Promise((e=>{p.add(n={c:t,f:e})})),abort(){p.delete(n)}}}function m(t,n){t.appendChild(n)}function b(t,n,e){t.insertBefore(n,e||null)}function h(t){t.parentNode.removeChild(t)}function g(t){return document.createElement(t)}function x(){return document.createTextNode("")}function v(t,n,e,o){return t.addEventListener(n,e,o),()=>t.removeEventListener(n,e,o)}function w(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}function y(t,n,e,o){null===e?t.style.removeProperty(n):t.style.setProperty(n,e)}function $(t,n,e){t.classList[e?"add":"remove"](n)}let k,_,M=0,z={};function I(t,n,e,o,r,i,c,s=0){const u=16.666/o;let l="{\n";for(let t=0;1>=t;t+=u){const o=n+(e-n)*i(t);l+=100*t+`%{${c(o,1-o)}}\n`}const a=l+`100% {${c(e,1-e)}}\n}`,p=`_bp_${Math.round(1e9*Math.random())}_${s}`;if(!z[p]){if(!k){const t=g("style");document.head.appendChild(t),k=t.sheet}z[p]=1,k.insertRule(`@keyframes ${p} ${a}`,k.cssRules.length)}const f=t.style.animation||"";return t.style.animation=`${f?f+", ":""}${p} ${o}ms linear ${r}ms 1 both`,M+=1,p}function S(t,n){t.style.animation=(t.style.animation||"").split(", ").filter(n?t=>0>t.indexOf(n):t=>-1===t.indexOf("_bp")).join(", "),n&&!--M&&a((()=>{if(M)return;let t=k.cssRules.length;for(;t--;)k.deleteRule(t);z={}}))}function P(t){_=t}const A=[],T=[],C=[],N=[],O=Promise.resolve();let E=0;function R(t){C.push(t)}const j=new Set;let q,F=0;function B(){const t=_;do{for(;A.length>F;){const t=A[F];F++,P(t),D(t.$$)}for(P(null),A.length=0,F=0;T.length;)T.pop()();for(let t=0;C.length>t;t+=1){const n=C[t];j.has(n)||(j.add(n),n())}C.length=0}while(A.length);for(;N.length;)N.pop()();E=0,j.clear(),P(t)}function D(t){if(null!==t.t){t.update(),r(t.before_update);const n=t.u;t.u=[-1],t.t&&t.t.p(t.ctx,n),t.after_update.forEach(R)}}function J(){return q||(q=Promise.resolve(),q.then((()=>{q=null}))),q}function K(t,n,e){t.dispatchEvent(((t,n,e=0)=>{const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,e,0,n),o})(`${n?"intro":"outro"}${e}`))}const L=new Set;let W;function X(){W={r:0,c:[],p:W}}function Y(){W.r||r(W.c),W=W.p}function G(t,n){t&&t.i&&(L.delete(t),t.i(n))}function H(t,n,e,o){if(t&&t.o){if(L.has(t))return;L.add(t),W.c.push((()=>{L.delete(t),o&&(e&&t.d(1),o())})),t.o(n)}}const Q={duration:0};function U(e,o,r){let c,s,u=o(e,r),a=0,p=0;function f(){c&&S(e,c)}function m(){const{delay:o=0,duration:r=300,l:i=n,g:m=t,css:b}=u||Q;b&&(c=I(e,0,1,r,o,i,b,p++)),m(0,1);const h=l()+o,g=h+r;s&&s.abort(),a=1,R((()=>K(e,1,"start"))),s=d((t=>{if(a){if(t>=g)return m(1,0),K(e,1,"end"),f(),a=0;if(t>=h){const n=i((t-h)/r);m(n,1-n)}}return a}))}let b=0;return{start(){b||(b=1,S(e),i(u)?(u=u(),J().then(m)):m())},invalidate(){b=0},end(){a&&(f(),a=0)}}}function V(e,o,c){let s,u=o(e,c),a=1;const p=W;function f(){const{delay:o=0,duration:i=300,l:c=n,g:f=t,css:m}=u||Q;m&&(s=I(e,1,0,i,o,c,m));const b=l()+o,h=b+i;R((()=>K(e,0,"start"))),d((t=>{if(a){if(t>=h)return f(0,1),K(e,0,"end"),--p.r||r(p.c),0;if(t>=b){const n=c((t-b)/i);f(1-n,n)}}return a}))}return p.r+=1,i(u)?J().then((()=>{u=u(),f()})):f(),{end(t){t&&u.g&&u.g(1,0),a&&(s&&S(e,s),a=0)}}}function Z(t){t&&t.c()}function tt(t,n,e,c){const{t:s,on_mount:u,on_destroy:l,after_update:a}=t.$$;s&&s.m(n,e),c||R((()=>{const n=u.map(o).filter(i);l?l.push(...n):r(n),t.$$.on_mount=[]})),a.forEach(R)}function nt(t,n){const e=t.$$;null!==e.t&&(r(e.on_destroy),e.t&&e.t.d(n),e.on_destroy=e.t=null,e.ctx=[])}function et(n,e,o,i,c,s,u,l=[-1]){const a=_;P(n);const p=n.$$={t:null,ctx:null,v:s,update:t,not_equal:c,bound:{},on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:{},u:l,skip_bound:0,root:e.target||a.$$.root};u&&u(p.root);let f=0;p.ctx=o?o(n,e.v||{},((t,e,...o)=>{const r=o.length?o[0]:e;return p.ctx&&c(p.ctx[t],p.ctx[t]=r)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](r),f&&((t,n)=>{-1===t.$$.u[0]&&(A.push(t),E||(E=1,O.then(B)),t.$$.u.fill(0)),t.$$.u[n/31|0]|=1<{const t=e.indexOf(n);-1!==t&&e.splice(t,1)}}$set(t){this.$$set&&0!==Object.keys(t).length&&(this.$$.skip_bound=1,this.$$set(t),this.$$.skip_bound=0)}}function rt(t){const n=t-1;return n*n*n+1}function it(t,{delay:n=0,duration:e=400,l:o=rt,x:r=0,y:i=0,opacity:c=0}={}){const s=getComputedStyle(t),u=+s.opacity,l="none"===s.transform?"":s.transform,a=u*(1-c);return{delay:n,duration:e,l:o,css(t,n){return`\n\t\t\ttransform: ${l} translate(${(1-t)*r}px, ${(1-t)*i}px);\n\t\t\topacity: ${u-a*n}`}}}const ct=[];function st(n,e=t){let o;const r=new Set;function i(t){if(c(n,t)&&(n=t,o)){const t=!ct.length;for(const t of r)t[1](),ct.push(t,n);if(t){for(let t=0;ct.length>t;t+=2)ct[t][0](ct[t+1]);ct.length=0}}}return{set:i,update(t){i(t(n))},subscribe(c,s=t){const u=[c,s];return r.add(u),1===r.size&&(o=e(i)||t),c(n),()=>{r.delete(u),0===r.size&&(o(),o=null)}}}}function ut(t,n){if(t===n||t!=t)return()=>t;const e=typeof t;if(Array.isArray(t)){const e=n.map(((n,e)=>ut(t[e],n)));return t=>e.map((n=>n(t)))}if("number"===e){const e=n-t;return n=>t+n*e}}function lt(t,o={}){const r=st(t);let i,c=t;function s(s,u){if(null==t)return r.set(t=s),Promise.resolve();c=s;let a=i,p=0,{delay:f=0,duration:m=400,l:b=n,interpolate:h=ut}=e(e({},o),u);if(0===m)return a&&(a.abort(),a=null),r.set(t=c),Promise.resolve();const g=l()+f;let x;return i=d((n=>{if(g>n)return 1;p||(x=h(t,s),"function"==typeof m&&(m=m(t,s)),p=1),a&&(a.abort(),a=null);const e=n-g;return e>m?(r.set(t=s),0):(r.set(t=x(b(e/m))),1)})),i.promise}return{set:s,update(n,e){return s(n(c,t),e)},subscribe:r.subscribe}}const at=st(0),pt=globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches,ft=t=>({l:rt,duration:pt?0:t}),dt=t=>!t.thumb||`url(${t.thumb})`;function mt(t){let n,e,o;return{c(){n=g("div"),n.innerHTML='',w(n,"class","bp-load"),y(n,"background-image",dt(t[0]))},m(t,e){b(t,n,e),o=1},p(t,e){1&e&&y(n,"background-image",dt(t[0]))},i(t){o||(e&&e.end(1),o=1)},o(t){t&&(e=V(n,it,{duration:480})),o=0},d(t){t&&h(n),t&&e&&e.end()}}}function bt(n){let e,o;return{c(){e=g("div"),w(e,"class","bp-load"),y(e,"background-image",dt(n[0]))},m(t,n){b(t,e,n)},p(t,n){1&n&&y(e,"background-image",dt(t[0]))},i(t){o||R((()=>{o=U(e,it,{duration:480}),o.start()}))},o:t,d(t){t&&h(e)}}}function ht(t){let n,e,o=!t[1]&&mt(t),r=t[2]&&bt(t);return{c(){o&&o.c(),n=x(),r&&r.c(),e=x()},m(t,i){o&&o.m(t,i),b(t,n,i),r&&r.m(t,i),b(t,e,i)},p(t,[i]){t[1]?o&&(X(),H(o,1,1,(()=>{o=null})),Y()):o?(o.p(t,i),2&i&&G(o,1)):(o=mt(t),o.c(),G(o,1),o.m(n.parentNode,n)),t[2]?r?(r.p(t,i),4&i&&G(r,1)):(r=bt(t),r.c(),G(r,1),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},i(t){G(o),G(r)},o(t){H(o)},d(t){o&&o.d(t),t&&h(n),r&&r.d(t),t&&h(e)}}}function gt(t,n,e){let o;s(t,at,(t=>e(2,o=t)));let{$:r}=n,{loaded:i}=n;return t.$$set=t=>{"$"in t&&e(0,r=t.$),"loaded"in t&&e(1,i=t.loaded)},[r,i,o]}class xt extends ot{constructor(t){super(),et(this,t,gt,ht,c,{$:0,loaded:1})}}function vt(t){let n,e,o,r,i,c,s,u;return{c(){n=g("img"),w(n,"srcset",e=t[7].img),w(n,"sizes",o=t[8].sizes||t[1]+"px"),w(n,"alt",r=t[7].alt)},m(e,o){b(e,n,o),c=1,s||(u=v(n,"error",t[26]),s=1)},p(t,e){(!c||2&e[0]&&o!==(o=t[8].sizes||t[1]+"px"))&&w(n,"sizes",o)},i(t){c||(i&&i.end(1),c=1)},o(t){i=V(n,it,{}),c=0},d(t){t&&h(n),t&&i&&i.end(),s=0,u()}}}function wt(t){let n,e;return n=new xt({v:{$:t[7],loaded:t[2]}}),{c(){Z(n.$$.t)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};4&e[0]&&(o.loaded=t[2]),n.$set(o)},i(t){e||(G(n.$$.t,t),e=1)},o(t){H(n.$$.t,t),e=0},d(t){nt(n,t)}}}function yt(t){let n,e,o,i,c,s,l=`translate3d(${t[0][0]/-2+t[6][0]}px, ${t[0][1]/-2+t[6][1]}px, 0)`,a=t[2]&&vt(t),p=t[3]&&wt(t);return{c(){n=g("div"),e=g("div"),a&&a.c(),o=x(),p&&p.c(),w(e,"class","bp-img"),y(e,"width",t[0][0]+"px"),y(e,"height",t[0][1]+"px"),$(e,"bp-drag",t[4]),$(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),y(e,"background-image",dt(t[7])),y(e,"transform",l),w(n,"class","bp-img-wrap"),$(n,"bp-close",t[5])},m(r,l){b(r,n,l),m(n,e),a&&a.m(e,null),m(e,o),p&&p.m(e,null),i=1,c||(s=[u(t[20].call(null,e)),v(n,"wheel",t[15]),v(n,"pointerdown",t[16]),v(n,"pointermove",t[17]),v(n,"pointerup",t[19]),v(n,"pointercancel",t[18])],c=1)},p(t,r){t[2]?a?(a.p(t,r),4&r[0]&&G(a,1)):(a=vt(t),a.c(),G(a,1),a.m(e,o)):a&&(X(),H(a,1,1,(()=>{a=null})),Y()),t[3]?p?(p.p(t,r),8&r[0]&&G(p,1)):(p=wt(t),p.c(),G(p,1),p.m(e,null)):p&&(X(),H(p,1,1,(()=>{p=null})),Y()),(!i||1&r[0])&&y(e,"width",t[0][0]+"px"),(!i||1&r[0])&&y(e,"height",t[0][1]+"px"),16&r[0]&&$(e,"bp-drag",t[4]),6145&r[0]&&$(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),65&r[0]&&l!==(l=`translate3d(${t[0][0]/-2+t[6][0]}px, ${t[0][1]/-2+t[6][1]}px, 0)`)&&y(e,"transform",l),32&r[0]&&$(n,"bp-close",t[5])},i(t){i||(G(a),G(p),i=1)},o(t){H(a),H(p),i=0},d(t){t&&h(n),a&&a.d(),p&&p.d(),c=0,r(s)}}}function $t(t,n,e){let o,r,i,c;s(t,at,(t=>e(25,i=t)));let{v:u}=n,{k:l}=n,{$:a,_:p,M:f,next:d,zoomed:m,container:b}=u;s(t,m,(t=>e(24,o=t)));let h,g,x,v,w,y,$,k,_,M,z,I=a.maxZoom||p.maxZoom||10,S=u.I(a),P=S[0],A=0;const T=+a.width,C=[],N=new Map,O=lt(S,ft(400));s(t,O,(t=>e(0,c=t)));const E=lt([0,0],ft(400));s(t,E,(t=>e(6,r=t)));const R=([t,n],o=c)=>{const r=(o[0]-b.w)/2,i=(o[1]-b.h)/2;return 0>r?t=0:t>r?l?(t=w?r+(t-r)/10:r)>r+20&&e(4,w=f()):t=r:-r>t&&(l?-r-20>(t=w?-r-(-r-t)/10:-r)&&e(4,w=d()):t=-r),0>i?n=0:n>i?n=i:-i>n&&(n=-i),[t,n]};function j(t=I,n){if(i)return;const o=S[0]*I;let s=c[0]+c[0]*t,u=c[1]+c[1]*t;if(t>0)s>o&&(s=o,u=S[1]*I),s>T&&(s=T,u=+a.height);else if(S[0]>s)return O.set(S),E.set([0,0]);let{x:l,y:p,width:f,height:d}=v.getBoundingClientRect();const m=n?n.clientX-l-f/2:0,b=n?n.clientY-p-d/2:0;l=s/f*-m+m,p=u/d*-b+b;const h=[s,u];O.set(h).then((()=>{e(1,P=Math.round(Math.max(P,s)))})),E.set(R([r[0]+l,r[1]+p],h))}Object.defineProperty(a,"zoom",{configurable:1,get(){return o},set(t){return j(t?I:-I)}});const q=t=>N.delete(t.pointerId);return t.$$set=t=>{"k"in t&&e(22,l=t.k)},t.$$.update=()=>{if(8388609&t.$$.u[0]&&m.set(c[0]-10>S[0]),58720256&t.$$.u[0]&&i&&o&&!p.intro){const t=ft(480);E.set([0,0],t),O.set(S,t),e(5,z=1)}},[c,P,h,g,w,z,r,a,p,m,b,I,T,O,E,t=>{p.inline&&!o||(t.preventDefault(),j(t.deltaY/-300,t))},t=>{2!==t.button&&(t.preventDefault(),e(4,w=1),N.set(t.pointerId,t),$=t.clientX,k=t.clientY,_=r[0],M=r[1])},t=>{if(N.size>1)return e(4,w=0),p.noPinch?.(b.el)||(t=>{const[n,e]=N.set(t.pointerId,t).values(),o=Math.hypot(n.clientX-e.clientX,n.clientY-e.clientY);x=x||{clientX:(n.clientX+e.clientX)/2,clientY:(n.clientY+e.clientY)/2},j(((A||o)-o)/-35,x),A=o})(t);if(!w)return;let n=t.clientX,r=t.clientY;y=C.push({x:n,y:r})>2,n-=$,r-=k,o||(-90>r&&e(4,w=!p.noClose&&u.close()),30>Math.abs(r)&&(n>40&&e(4,w=f()),-40>n&&e(4,w=d()))),o&&y&&!i&&E.set(R([_+n,M+r]),{duration:0})},q,function(t){if(q(t),x&&(e(4,w=A=0),x=N.size?x:null),w){if(e(4,w=0),t.target===this&&!p.noClose)return u.close();if(y){const[t,n,e]=C.slice(-3);Math.hypot(n.x-e.x,n.y-e.y)>5&&E.set(R([r[0]-5*(t.x-e.x),r[1]-5*(t.y-e.y)]))}else p.onImageClick?.(b.el,a)||j(o?-I:I,t);y=0,C.length=0}},t=>{v=t,u.S((()=>{e(23,S=u.I(a)),!p.inline&&l||(O.set(S),E.set([0,0]))})),u.P(a).then((()=>{e(2,h=1),u.A()})),setTimeout((()=>{e(3,g=!h)}),250)},u,l,S,o,i,t=>p.onError?.(b,a,t)]}class kt extends ot{constructor(t){super(),et(this,t,$t,yt,c,{v:21,k:22},null,[-1,-1])}}function _t(t){let n,e,o,i,c,s;return o=new xt({v:{$:t[2],loaded:t[0]}}),{c(){n=g("div"),e=g("iframe"),Z(o.$$.t),w(e,"allow","autoplay; fullscreen"),w(e,"title",t[2].title),w(n,"class","bp-if"),y(n,"width",t[1][0]+"px"),y(n,"height",t[1][1]+"px")},m(r,l){b(r,n,l),m(n,e),tt(o,n,null),i=1,c||(s=[u(t[3].call(null,e)),v(e,"load",t[5])],c=1)},p(t,[e]){const r={};1&e&&(r.loaded=t[0]),o.$set(r),(!i||2&e)&&y(n,"width",t[1][0]+"px"),(!i||2&e)&&y(n,"height",t[1][1]+"px")},i(t){i||(G(o.$$.t,t),i=1)},o(t){H(o.$$.t,t),i=0},d(t){t&&h(n),nt(o),c=0,r(s)}}}function Mt(t,n,e){let o,r,{v:i}=n;const{$:c}=i,s=()=>e(1,r=i.I(c));return s(),i.S(s),[o,r,c,t=>t.src=c.iframe,i,()=>e(0,o=1)]}class zt extends ot{constructor(t){super(),et(this,t,Mt,_t,c,{v:4})}}function It(t){let n,e,o,r,i;return e=new xt({v:{$:t[2],loaded:t[0]}}),{c(){n=g("div"),Z(e.$$.t),w(n,"class","bp-vid"),y(n,"width",t[1][0]+"px"),y(n,"height",t[1][1]+"px"),y(n,"background-image",dt(t[2]))},m(c,s){b(c,n,s),tt(e,n,null),o=1,r||(i=u(t[3].call(null,n)),r=1)},p(t,[r]){const i={};1&r&&(i.loaded=t[0]),e.$set(i),(!o||2&r)&&y(n,"width",t[1][0]+"px"),(!o||2&r)&&y(n,"height",t[1][1]+"px")},i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){t&&h(n),nt(e),r=0,i()}}}function St(t,n,e){let o,r,{v:i}=n;const{$:c,_:s,container:u}=i,l=()=>e(1,r=i.I(c));l(),i.S(l);const a=(t,n)=>{for(const e in n)w(t,e,n[e])};return[o,r,c,t=>{let n;const r=(t,e)=>{Array.isArray(e)||(e=JSON.parse(e));for(const o of e){n||(n=g(o.type?.includes("audio")?"audio":"video"),a(n,{controls:1,autoplay:1,playsinline:1,tabindex:"0"}));const e=g(t);a(e,o),"source"==t&&v(e,"error",(t=>s.onError?.(u,c,t))),m(n,e)}};r("source",c.sources),r("track",c.tracks||[]),v(n,"canplay",(()=>e(0,o=1))),m(t,n)},i]}class Pt extends ot{constructor(t){super(),et(this,t,St,It,c,{v:4})}}function At(n){let e,o,i,s,l,a,p,f,d,x,y=n[6].i,k=Rt(n),_=n[0].length>1&&jt(n);return{c(){e=g("div"),o=g("div"),k.c(),s=g("div"),l=g("button"),_&&_.c(),w(l,"class","bp-x"),w(l,"title","Close"),w(l,"aria-label","Close"),w(s,"class","bp-controls"),w(e,"class","bp-wrap"),$(e,"bp-zoomed",n[10]),$(e,"bp-inline",n[8]),$(e,"bp-small",n[7]),$(e,"bp-noclose",n[5].noClose)},m(t,r){b(t,e,r),m(e,o),k.m(e,null),m(e,s),m(s,l),_&&_.m(s,null),f=1,d||(x=[v(l,"click",n[1]),u(p=n[14].call(null,e))],d=1)},p(n,o){64&o[0]&&c(y,y=n[6].i)?(X(),H(k,1,1,t),Y(),k=Rt(n),k.c(),G(k),k.m(e,s)):k.p(n,o),n[0].length>1?_?_.p(n,o):(_=jt(n),_.c(),_.m(s,null)):_&&(_.d(1),_=null),1024&o[0]&&$(e,"bp-zoomed",n[10]),256&o[0]&&$(e,"bp-inline",n[8]),128&o[0]&&$(e,"bp-small",n[7]),32&o[0]&&$(e,"bp-noclose",n[5].noClose)},i(t){f||(i&&i.end(1),G(k),a&&a.end(1),f=1)},o(t){t&&(i=V(o,it,{duration:480})),H(k),t&&(a=V(s,it,{})),f=0},d(t){t&&h(e),t&&i&&i.end(),k.d(t),_&&_.d(),t&&a&&a.end(),d=0,r(x)}}}function Tt(n){let e,o=(n[6].html??n[6].element.outerHTML)+"";return{c(){e=g("div"),w(e,"class","bp-html")},m(t,n){b(t,e,n),e.innerHTML=o},p(t,n){64&n[0]&&o!==(o=(t[6].html??t[6].element.outerHTML)+"")&&(e.innerHTML=o)},i:t,o:t,d(t){t&&h(e)}}}function Ct(n){let e,o;return e=new zt({v:{v:n[13]()}}),{c(){Z(e.$$.t)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){nt(e,t)}}}function Nt(n){let e,o;return e=new Pt({v:{v:n[13]()}}),{c(){Z(e.$$.t)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){nt(e,t)}}}function Ot(t){let n,e;return n=new kt({v:{v:t[13](),k:t[7]}}),{c(){Z(n.$$.t)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};128&e[0]&&(o.k=t[7]),n.$set(o)},i(t){e||(G(n.$$.t,t),e=1)},o(t){H(n.$$.t,t),e=0},d(t){nt(n,t)}}}function Et(t){let n,e,o,r=t[6].caption+"";return{c(){n=g("div"),w(n,"class","bp-cap")},m(t,e){b(t,n,e),n.innerHTML=r,o=1},p(t,e){(!o||64&e[0])&&r!==(r=t[6].caption+"")&&(n.innerHTML=r)},i(t){o||(e&&e.end(1),o=1)},o(t){e=V(n,it,{duration:200}),o=0},d(t){t&&h(n),t&&e&&e.end()}}}function Rt(t){let n,e,o,i,c,s,u,l,a;const p=[Ot,Nt,Ct,Tt],f=[];function d(t,n){return t[6].img?0:t[6].sources?1:t[6].iframe?2:3}e=d(t),o=f[e]=p[e](t);let m=t[6].caption&&Et(t);return{c(){n=g("div"),o.c(),m&&m.c(),s=x(),w(n,"class","bp-inner")},m(o,r){b(o,n,r),f[e].m(n,null),m&&m.m(o,r),b(o,s,r),u=1,l||(a=[v(n,"pointerdown",t[20]),v(n,"pointerup",t[21])],l=1)},p(t,r){let i=e;e=d(t),e===i?f[e].p(t,r):(X(),H(f[i],1,1,(()=>{f[i]=null})),Y(),o=f[e],o?o.p(t,r):(o=f[e]=p[e](t),o.c()),G(o,1),o.m(n,null)),t[6].caption?m?(m.p(t,r),64&r[0]&&G(m,1)):(m=Et(t),m.c(),G(m,1),m.m(s.parentNode,s)):m&&(X(),H(m,1,1,(()=>{m=null})),Y())},i(e){u||(G(o),R((()=>{c&&c.end(1),i=U(n,t[12],1),i.start()})),G(m),u=1)},o(e){H(o),i&&i.invalidate(),c=V(n,t[12],0),H(m),u=0},d(t){t&&h(n),f[e].d(),t&&c&&c.end(),m&&m.d(t),t&&h(s),l=0,r(a)}}}function jt(t){let n,e,o,i,c,s=`${t[4]+1} / ${t[0].length}`;return{c(){n=g("div"),e=g("button"),o=g("button"),w(n,"class","bp-count"),w(e,"class","bp-prev"),w(e,"title","Previous"),w(e,"aria-label","Previous"),w(o,"class","bp-next"),w(o,"title","Next"),w(o,"aria-label","Next")},m(r,u){b(r,n,u),n.innerHTML=s,b(r,e,u),b(r,o,u),i||(c=[v(e,"click",t[2]),v(o,"click",t[3])],i=1)},p(t,e){17&e[0]&&s!==(s=`${t[4]+1} / ${t[0].length}`)&&(n.innerHTML=s)},d(t){t&&h(n),t&&h(e),t&&h(o),i=0,r(c)}}}function qt(t){let n,e,o=t[0]&&At(t);return{c(){o&&o.c(),n=x()},m(t,r){o&&o.m(t,r),b(t,n,r),e=1},p(t,e){t[0]?o?(o.p(t,e),1&e[0]&&G(o,1)):(o=At(t),o.c(),G(o,1),o.m(n.parentNode,n)):o&&(X(),H(o,1,1,(()=>{o=null})),Y())},i(t){e||(G(o),e=1)},o(t){H(o),e=0},d(t){o&&o.d(t),t&&h(n)}}}function Ft(t,n,e){let o,{items:r}=n,{target:i}=n;const c=document.documentElement;let u,l,a,p,f,d,m,b,h;const x=()=>!h.img&&!h.sources&&!h.iframe;let w;const y=t=>w=t,$={},k=st(0);s(t,k,(t=>e(10,o=t)));const _=()=>{l.onClose?.($.el,h),at.set(1),e(0,r=null),p?.focus({preventScroll:1})},M=()=>I(u-1),z=()=>I(u+1),I=t=>{m=t-u,e(4,u=S(t))},S=t=>(t+r.length)%r.length,P=t=>{const{key:n,shiftKey:e}=t;if("Escape"===n)!l.noClose&&_();else if("ArrowRight"===n)z();else if("ArrowLeft"===n)M();else if("Tab"===n){const{activeElement:n}=document;if(e||!n.controls){t.preventDefault();const{focusWrap:o=$.el}=l,r=[...o.querySelectorAll("*")].filter((t=>t.tabIndex>=0));let i=r.indexOf(n);i+=r.length+(e?-1:1),r[i%r.length].focus()}}},A=({width:t=1920,height:n=1080})=>{const{scale:e=.99}=l,o=Math.min(1,$.w/t*e,$.h/n*e);return[Math.round(t*o),Math.round(n*o)]},T=()=>{if(r){const t=r[S(u+1)],n=r[S(u-1)];!t.preload&&C(t),!n.preload&&C(n)}},C=t=>{if(t.img){const n=g("img");return n.sizes=l.sizes||A(t)[0]+"px",n.srcset=t.img,t.preload=1,n.decode().catch((t=>{}))}};return t.$$set=t=>{"items"in t&&e(0,r=t.items),"target"in t&&e(15,i=t.target)},t.$$.update=()=>{786545&t.$$.u[0]&&r&&(e(6,h=r[u]),a&&l.onUpdate?.($.el,h))},[r,_,M,z,u,l,h,f,d,b,o,k,(t,n)=>a&&r?it(t,{x:(m>0?20:-20)*(n?1:-1),duration:250}):(e(18,a=n),l.intro?it(t,{y:n?10:-10}):(t=>{let n;if(x()){const e=t.firstChild.firstChild;n=[e.clientWidth,e.clientHeight]}else n=A(h);const e=(h.element||p).getBoundingClientRect(),o=e.left-($.w-e.width)/2,r=e.top-($.h-e.height)/2,i=e.width/n[0],c=e.height/n[1];return{duration:480,l:rt,css:(t,n)=>`transform:translate3d(${o*n}px, ${r*n}px, 0) scale3d(${i+t*(1-i)}, ${c+t*(1-c)}, 1)`}})(t)),()=>({$:h,I:A,P:C,A:T,_:l,M,next:z,close:_,S:y,zoomed:k,container:$}),t=>{let n,o;e(19,$.el=t,$),l.onOpen?.($.el,h),d||(n=v(globalThis,"keydown",P));const r=new ResizeObserver((t=>{o&&(e(19,$.w=t[0].contentRect.width,$),e(19,$.h=t[0].contentRect.height,$),e(7,f=769>$.w),x()||w?.(),l.onResize?.($.el,h)),o=1}));return r.observe(t),{destroy(){r.disconnect(),n?.(),at.set(0),c.classList.remove("bp-lock"),l.onClosed?.()}}},i,t=>{e(5,l=t),e(8,d=l.inline);const n=l.items;!d&&c.scrollHeight>c.clientHeight&&c.classList.add("bp-lock"),p=document.activeElement,e(19,$.w=i.offsetWidth,$),e(19,$.h=i===document.body?globalThis.innerHeight:i.clientHeight,$),e(7,f=769>$.w),e(4,u=l.position||0),e(0,r=Array.isArray(n)?n.map(((t,n)=>(l.el&&l.el===t.element&&e(4,u=n),{i:n,...t}))):(n.length?[...n]:[n]).map(((t,n)=>(l.el===t&&e(4,u=n),{element:t,i:n,...t.dataset}))))},I,a,$,t=>e(9,b=t.target),function(t){2!==t.button&&t.target===this&&b===this&&!l.noClose&&_()}]}class Bt extends ot{constructor(t){super(),et(this,t,Ft,qt,c,{items:0,target:15,open:16,close:1,M:2,next:3,setPosition:17},null,[-1,-1])}get items(){return this.$$.ctx[0]}get target(){return this.$$.ctx[15]}get open(){return this.$$.ctx[16]}get close(){return this.$$.ctx[1]}get M(){return this.$$.ctx[2]}get next(){return this.$$.ctx[3]}get setPosition(){return this.$$.ctx[17]}}return t=>new Bt({...t,v:t})}(); +var BiggerPicture=function(){function t(){}const n=t=>t;function e(t,n){for(const e in n)t[e]=n[e];return t}function o(t){return t()}function r(t){t.forEach(o)}function i(t){return"function"==typeof t}function c(t,n){return t!=t?n==n:t!==n}function s(n,e,o){n.u.t.push(((n,...e)=>{if(null==n)return t;const o=n.subscribe(...e);return o.unsubscribe?()=>o.unsubscribe():o})(e,o))}function u(n){return n&&i(n.destroy)?n.destroy:t}let l=()=>globalThis.performance.now(),a=t=>requestAnimationFrame(t);const p=new Set;function f(t){p.forEach((n=>{n.c(t)||(p.delete(n),n.f())})),0!==p.size&&a(f)}function d(t){let n;return 0===p.size&&a(f),{promise:new Promise((e=>{p.add(n={c:t,f:e})})),abort(){p.delete(n)}}}function m(t,n){t.appendChild(n)}function b(t,n,e){t.insertBefore(n,e||null)}function h(t){t.parentNode.removeChild(t)}function g(t){return document.createElement(t)}function x(){return document.createTextNode("")}function v(t,n,e,o){return t.addEventListener(n,e,o),()=>t.removeEventListener(n,e,o)}function w(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}function y(t,n,e,o){null===e?t.style.removeProperty(n):t.style.setProperty(n,e)}function $(t,n,e){t.classList[e?"add":"remove"](n)}let k,_,M=0,S={};function z(t,n,e,o,r,i,c,s=0){const u=16.666/o;let l="{\n";for(let t=0;1>=t;t+=u){const o=n+(e-n)*i(t);l+=100*t+`%{${c(o,1-o)}}\n`}const a=l+`100% {${c(e,1-e)}}\n}`,p=`_bp_${Math.round(1e9*Math.random())}_${s}`;if(!S[p]){if(!k){const t=g("style");document.head.appendChild(t),k=t.sheet}S[p]=1,k.insertRule(`@keyframes ${p} ${a}`,k.cssRules.length)}const f=t.style.animation||"";return t.style.animation=`${f?f+", ":""}${p} ${o}ms linear ${r}ms 1 both`,M+=1,p}function I(t,n){t.style.animation=(t.style.animation||"").split(", ").filter(n?t=>0>t.indexOf(n):t=>-1===t.indexOf("_bp")).join(", "),n&&!--M&&a((()=>{if(M)return;let t=k.cssRules.length;for(;t--;)k.deleteRule(t);S={}}))}function P(t){_=t}const A=[],T=[],N=[],O=[],C=Promise.resolve();let E=0;function R(t){N.push(t)}const j=new Set;let q,F=0;function J(){const t=_;do{for(;A.length>F;){const t=A[F];F++,P(t),B(t.u)}for(P(null),A.length=0,F=0;T.length;)T.pop()();for(let t=0;N.length>t;t+=1){const n=N[t];j.has(n)||(j.add(n),n())}N.length=0}while(A.length);for(;O.length;)O.pop()();E=0,j.clear(),P(t)}function B(t){if(null!==t.l){t.update(),r(t.g);const n=t.v;t.v=[-1],t.l&&t.l.p(t.$,n),t.k.forEach(R)}}function D(){return q||(q=Promise.resolve(),q.then((()=>{q=null}))),q}function K(t,n,e){t.dispatchEvent(((t,n,e=0)=>{const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,e,0,n),o})(`${n?"intro":"outro"}${e}`))}const L=new Set;let W;function X(){W={r:0,c:[],p:W}}function Y(){W.r||r(W.c),W=W.p}function G(t,n){t&&t.i&&(L.delete(t),t.i(n))}function H(t,n,e,o){if(t&&t.o){if(L.has(t))return;L.add(t),W.c.push((()=>{L.delete(t),o&&(e&&t.d(1),o())})),t.o(n)}}const Q={duration:0};function U(e,o,r){let c,s,u=o(e,r),a=0,p=0;function f(){c&&I(e,c)}function m(){const{delay:o=0,duration:r=300,_:i=n,M:m=t,css:b}=u||Q;b&&(c=z(e,0,1,r,o,i,b,p++)),m(0,1);const h=l()+o,g=h+r;s&&s.abort(),a=1,R((()=>K(e,1,"start"))),s=d((t=>{if(a){if(t>=g)return m(1,0),K(e,1,"end"),f(),a=0;if(t>=h){const n=i((t-h)/r);m(n,1-n)}}return a}))}let b=0;return{start(){b||(b=1,I(e),i(u)?(u=u(),D().then(m)):m())},S(){b=0},end(){a&&(f(),a=0)}}}function V(e,o,c){let s,u=o(e,c),a=1;const p=W;function f(){const{delay:o=0,duration:i=300,_:c=n,M:f=t,css:m}=u||Q;m&&(s=z(e,1,0,i,o,c,m));const b=l()+o,h=b+i;R((()=>K(e,0,"start"))),d((t=>{if(a){if(t>=h)return f(0,1),K(e,0,"end"),--p.r||r(p.c),0;if(t>=b){const n=c((t-b)/i);f(1-n,n)}}return a}))}return p.r+=1,i(u)?D().then((()=>{u=u(),f()})):f(),{end(t){t&&u.M&&u.M(1,0),a&&(s&&I(e,s),a=0)}}}function Z(t){t&&t.c()}function tt(t,n,e,c){const{l:s,I:u,t:l,k:a}=t.u;s&&s.m(n,e),c||R((()=>{const n=u.map(o).filter(i);l?l.push(...n):r(n),t.u.I=[]})),a.forEach(R)}function nt(t,n){const e=t.u;null!==e.l&&(r(e.t),e.l&&e.l.d(n),e.t=e.l=null,e.$=[])}function et(n,e,o,i,c,s,u,l=[-1]){const a=_;P(n);const p=n.u={l:null,$:null,P:s,update:t,A:c,bound:{},I:[],t:[],T:[],g:[],k:[],context:new Map(e.context||(a?a.u.context:[])),N:{},v:l,O:0,root:e.target||a.u.root};u&&u(p.root);let f=0;p.$=o?o(n,e.P||{},((t,e,...o)=>{const r=o.length?o[0]:e;return p.$&&c(p.$[t],p.$[t]=r)&&(!p.O&&p.bound[t]&&p.bound[t](r),f&&((t,n)=>{-1===t.u.v[0]&&(A.push(t),E||(E=1,C.then(J)),t.u.v.fill(0)),t.u.v[n/31|0]|=1<{const t=e.indexOf(n);-1!==t&&e.splice(t,1)}}C(t){this.R&&0!==Object.keys(t).length&&(this.u.O=1,this.R(t),this.u.O=0)}}function rt(t){const n=t-1;return n*n*n+1}function it(t,{delay:n=0,duration:e=400,_:o=rt,x:r=0,y:i=0,opacity:c=0}={}){const s=getComputedStyle(t),u=+s.opacity,l="none"===s.transform?"":s.transform,a=u*(1-c);return{delay:n,duration:e,_:o,css(t,n){return`\n\t\t\ttransform: ${l} translate(${(1-t)*r}px, ${(1-t)*i}px);\n\t\t\topacity: ${u-a*n}`}}}const ct=[];function st(n,e=t){let o;const r=new Set;function i(t){if(c(n,t)&&(n=t,o)){const t=!ct.length;for(const t of r)t[1](),ct.push(t,n);if(t){for(let t=0;ct.length>t;t+=2)ct[t][0](ct[t+1]);ct.length=0}}}return{set:i,update(t){i(t(n))},subscribe(c,s=t){const u=[c,s];return r.add(u),1===r.size&&(o=e(i)||t),c(n),()=>{r.delete(u),0===r.size&&(o(),o=null)}}}}function ut(t,n){if(t===n||t!=t)return()=>t;const e=typeof t;if(Array.isArray(t)){const e=n.map(((n,e)=>ut(t[e],n)));return t=>e.map((n=>n(t)))}if("number"===e){const e=n-t;return n=>t+n*e}}function lt(t,o={}){const r=st(t);let i,c=t;function s(s,u){if(null==t)return r.set(t=s),Promise.resolve();c=s;let a=i,p=0,{delay:f=0,duration:m=400,_:b=n,interpolate:h=ut}=e(e({},o),u);if(0===m)return a&&(a.abort(),a=null),r.set(t=c),Promise.resolve();const g=l()+f;let x;return i=d((n=>{if(g>n)return 1;p||(x=h(t,s),"function"==typeof m&&(m=m(t,s)),p=1),a&&(a.abort(),a=null);const e=n-g;return e>m?(r.set(t=s),0):(r.set(t=x(b(e/m))),1)})),i.promise}return{set:s,update(n,e){return s(n(c,t),e)},subscribe:r.subscribe}}const at=st(0),pt=globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches,ft=t=>({_:rt,duration:pt?0:t}),dt=t=>!t.thumb||`url(${t.thumb})`,mt=(t,n)=>{if(n){"string"==typeof n&&(n=JSON.parse(n));for(const e in n)t.setAttribute(e,n[e])}};function bt(t){let n,e,o;return{c(){n=g("div"),n.innerHTML='',w(n,"class","bp-load"),y(n,"background-image",dt(t[0]))},m(t,e){b(t,n,e),o=1},p(t,e){1&e&&y(n,"background-image",dt(t[0]))},i(t){o||(e&&e.end(1),o=1)},o(t){t&&(e=V(n,it,{duration:480})),o=0},d(t){t&&h(n),t&&e&&e.end()}}}function ht(n){let e,o;return{c(){e=g("div"),w(e,"class","bp-load"),y(e,"background-image",dt(n[0]))},m(t,n){b(t,e,n)},p(t,n){1&n&&y(e,"background-image",dt(t[0]))},i(t){o||R((()=>{o=U(e,it,{duration:480}),o.start()}))},o:t,d(t){t&&h(e)}}}function gt(t){let n,e,o=!t[1]&&bt(t),r=t[2]&&ht(t);return{c(){o&&o.c(),n=x(),r&&r.c(),e=x()},m(t,i){o&&o.m(t,i),b(t,n,i),r&&r.m(t,i),b(t,e,i)},p(t,[i]){t[1]?o&&(X(),H(o,1,1,(()=>{o=null})),Y()):o?(o.p(t,i),2&i&&G(o,1)):(o=bt(t),o.c(),G(o,1),o.m(n.parentNode,n)),t[2]?r?(r.p(t,i),4&i&&G(r,1)):(r=ht(t),r.c(),G(r,1),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},i(t){G(o),G(r)},o(t){H(o)},d(t){o&&o.d(t),t&&h(n),r&&r.d(t),t&&h(e)}}}function xt(t,n,e){let o;s(t,at,(t=>e(2,o=t)));let{j:r}=n,{loaded:i}=n;return t.R=t=>{"j"in t&&e(0,r=t.j),"loaded"in t&&e(1,i=t.loaded)},[r,i,o]}class vt extends ot{constructor(t){super(),et(this,t,xt,gt,c,{j:0,loaded:1})}}function wt(t){let n,e,o,i,c,s;return{c(){n=g("img"),w(n,"sizes",e=t[8].sizes||t[1]+"px"),w(n,"alt",t[7].alt)},m(e,o){b(e,n,o),i=1,c||(s=[u(t[21].call(null,n)),v(n,"error",t[27])],c=1)},p(t,o){(!i||2&o[0]&&e!==(e=t[8].sizes||t[1]+"px"))&&w(n,"sizes",e)},i(t){i||(o&&o.end(1),i=1)},o(t){o=V(n,it,{}),i=0},d(t){t&&h(n),t&&o&&o.end(),c=0,r(s)}}}function yt(t){let n,e;return n=new vt({P:{j:t[7],loaded:t[2]}}),{c(){Z(n.u.l)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};4&e[0]&&(o.loaded=t[2]),n.C(o)},i(t){e||(G(n.u.l,t),e=1)},o(t){H(n.u.l,t),e=0},d(t){nt(n,t)}}}function $t(t){let n,e,o,i,c,s,l=`translate3d(${t[0][0]/-2+t[6][0]}px, ${t[0][1]/-2+t[6][1]}px, 0)`,a=t[2]&&wt(t),p=t[3]&&yt(t);return{c(){n=g("div"),e=g("div"),a&&a.c(),o=x(),p&&p.c(),w(e,"class","bp-img"),y(e,"width",t[0][0]+"px"),y(e,"height",t[0][1]+"px"),$(e,"bp-drag",t[4]),$(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),y(e,"background-image",dt(t[7])),y(e,"transform",l),w(n,"class","bp-img-wrap"),$(n,"bp-close",t[5])},m(r,l){b(r,n,l),m(n,e),a&&a.m(e,null),m(e,o),p&&p.m(e,null),i=1,c||(s=[u(t[20].call(null,e)),v(n,"wheel",t[15]),v(n,"pointerdown",t[16]),v(n,"pointermove",t[17]),v(n,"pointerup",t[19]),v(n,"pointercancel",t[18])],c=1)},p(t,r){t[2]?a?(a.p(t,r),4&r[0]&&G(a,1)):(a=wt(t),a.c(),G(a,1),a.m(e,o)):a&&(X(),H(a,1,1,(()=>{a=null})),Y()),t[3]?p?(p.p(t,r),8&r[0]&&G(p,1)):(p=yt(t),p.c(),G(p,1),p.m(e,null)):p&&(X(),H(p,1,1,(()=>{p=null})),Y()),(!i||1&r[0])&&y(e,"width",t[0][0]+"px"),(!i||1&r[0])&&y(e,"height",t[0][1]+"px"),(!i||16&r[0])&&$(e,"bp-drag",t[4]),(!i||6145&r[0])&&$(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),65&r[0]&&l!==(l=`translate3d(${t[0][0]/-2+t[6][0]}px, ${t[0][1]/-2+t[6][1]}px, 0)`)&&y(e,"transform",l),(!i||32&r[0])&&$(n,"bp-close",t[5])},i(t){i||(G(a),G(p),i=1)},o(t){H(a),H(p),i=0},d(t){t&&h(n),a&&a.d(),p&&p.d(),c=0,r(s)}}}function kt(t,n,e){let o,r,i,c;s(t,at,(t=>e(26,i=t)));let{P:u}=n,{q:l}=n,{j:a,F:p,J:f,next:d,zoomed:m,container:b}=u;s(t,m,(t=>e(25,o=t)));let h,g,x,v,w,y,$,k,_,M,S,z=a.maxZoom||p.maxZoom||10,I=u.B(a),P=I[0],A=0;const T=+a.width,N=[],O=new Map,C=lt(I,ft(400));s(t,C,(t=>e(0,c=t)));const E=lt([0,0],ft(400));s(t,E,(t=>e(6,r=t)));const R=([t,n],o=c)=>{const r=(o[0]-b.w)/2,i=(o[1]-b.h)/2;return 0>r?t=0:t>r?l?(t=w?r+(t-r)/10:r)>r+20&&e(4,w=f()):t=r:-r>t&&(l?-r-20>(t=w?-r-(-r-t)/10:-r)&&e(4,w=d()):t=-r),0>i?n=0:n>i?n=i:-i>n&&(n=-i),[t,n]};function j(t=z,n){if(i)return;const o=I[0]*z;let s=c[0]+c[0]*t,u=c[1]+c[1]*t;if(t>0)s>o&&(s=o,u=I[1]*z),s>T&&(s=T,u=+a.height);else if(I[0]>s)return C.set(I),E.set([0,0]);let{x:l,y:p,width:f,height:d}=v.getBoundingClientRect();const m=n?n.clientX-l-f/2:0,b=n?n.clientY-p-d/2:0;l=s/f*-m+m,p=u/d*-b+b;const h=[s,u];C.set(h).then((()=>{e(1,P=Math.round(Math.max(P,s)))})),E.set(R([r[0]+l,r[1]+p],h))}Object.defineProperty(a,"zoom",{configurable:1,get(){return o},set(t){return j(t?z:-z)}});const q=t=>O.delete(t.pointerId);return t.R=t=>{"q"in t&&e(23,l=t.q)},t.u.update=()=>{if(16777217&t.u.v[0]&&m.set(c[0]-10>I[0]),117440512&t.u.v[0]&&i&&o&&!p.intro){const t=ft(480);E.set([0,0],t),C.set(I,t),e(5,S=1)}},[c,P,h,g,w,S,r,a,p,m,b,z,T,C,E,t=>{p.inline&&!o||(t.preventDefault(),j(t.deltaY/-300,t))},t=>{2!==t.button&&(t.preventDefault(),e(4,w=1),O.set(t.pointerId,t),$=t.clientX,k=t.clientY,_=r[0],M=r[1])},t=>{if(O.size>1)return e(4,w=0),p.noPinch?.(b.el)||(t=>{const[n,e]=O.set(t.pointerId,t).values(),o=Math.hypot(n.clientX-e.clientX,n.clientY-e.clientY);x=x||{clientX:(n.clientX+e.clientX)/2,clientY:(n.clientY+e.clientY)/2},j(((A||o)-o)/-35,x),A=o})(t);if(!w)return;let n=t.clientX,r=t.clientY;y=N.push({x:n,y:r})>2,n-=$,r-=k,o||(-90>r&&e(4,w=!p.noClose&&u.close()),30>Math.abs(r)&&(n>40&&e(4,w=f()),-40>n&&e(4,w=d()))),o&&y&&!i&&E.set(R([_+n,M+r]),{duration:0})},q,function(t){if(q(t),x&&(e(4,w=A=0),x=O.size?x:null),w){if(e(4,w=0),t.target===this&&!p.noClose)return u.close();if(y){const[t,n,e]=N.slice(-3);Math.hypot(n.x-e.x,n.y-e.y)>5&&E.set(R([r[0]-5*(t.x-e.x),r[1]-5*(t.y-e.y)]))}else p.onImageClick?.(b.el,a)||j(o?-z:z,t);y=0,N.length=0}},t=>{v=t,u.D((()=>{e(24,I=u.B(a)),!p.inline&&l||(C.set(I),E.set([0,0]))})),u.K(a).then((()=>{e(2,h=1),u.L()})),setTimeout((()=>{e(3,g=!h)}),250)},t=>{mt(t,a.attr),t.srcset=a.img},u,l,I,o,i,t=>p.onError?.(b,a,t)]}class _t extends ot{constructor(t){super(),et(this,t,kt,$t,c,{P:22,q:23},null,[-1,-1])}}function Mt(t){let n,e,o,i,c,s;return o=new vt({P:{j:t[2],loaded:t[0]}}),{c(){n=g("div"),e=g("iframe"),Z(o.u.l),w(e,"allow","autoplay; fullscreen"),w(e,"title",t[2].title),w(n,"class","bp-if"),y(n,"width",t[1][0]+"px"),y(n,"height",t[1][1]+"px")},m(r,l){b(r,n,l),m(n,e),tt(o,n,null),i=1,c||(s=[u(t[3].call(null,e)),v(e,"load",t[5])],c=1)},p(t,[e]){const r={};1&e&&(r.loaded=t[0]),o.C(r),(!i||2&e)&&y(n,"width",t[1][0]+"px"),(!i||2&e)&&y(n,"height",t[1][1]+"px")},i(t){i||(G(o.u.l,t),i=1)},o(t){H(o.u.l,t),i=0},d(t){t&&h(n),nt(o),c=0,r(s)}}}function St(t,n,e){let o,r,{P:i}=n;const{j:c}=i,s=()=>e(1,r=i.B(c));return s(),i.D(s),[o,r,c,t=>{mt(t,c.attr),t.src=c.iframe},i,()=>e(0,o=1)]}class zt extends ot{constructor(t){super(),et(this,t,St,Mt,c,{P:4})}}function It(t){let n,e,o,r,i;return e=new vt({P:{j:t[2],loaded:t[0]}}),{c(){n=g("div"),Z(e.u.l),w(n,"class","bp-vid"),y(n,"width",t[1][0]+"px"),y(n,"height",t[1][1]+"px"),y(n,"background-image",dt(t[2]))},m(c,s){b(c,n,s),tt(e,n,null),o=1,r||(i=u(t[3].call(null,n)),r=1)},p(t,[r]){const i={};1&r&&(i.loaded=t[0]),e.C(i),(!o||2&r)&&y(n,"width",t[1][0]+"px"),(!o||2&r)&&y(n,"height",t[1][1]+"px")},i(t){o||(G(e.u.l,t),o=1)},o(t){H(e.u.l,t),o=0},d(t){t&&h(n),nt(e),r=0,i()}}}function Pt(t,n,e){let o,r,{P:i}=n;const{j:c,F:s,container:u}=i,l=()=>e(1,r=i.B(c));return l(),i.D(l),[o,r,c,t=>{let n;const r=(t,e)=>{Array.isArray(e)||(e=JSON.parse(e));for(const o of e){n||(n=g(o.type?.includes("audio")?"audio":"video"),mt(n,{controls:1,autoplay:1,playsinline:1,tabindex:"0"}),mt(n,c.attr));const e=g(t);mt(e,o),"source"==t&&v(e,"error",(t=>s.onError?.(u,c,t))),m(n,e)}};r("source",c.sources),r("track",c.tracks||[]),v(n,"canplay",(()=>e(0,o=1))),m(t,n)},i]}class At extends ot{constructor(t){super(),et(this,t,Pt,It,c,{P:4})}}function Tt(n){let e,o,i,s,l,a,p,f,d,x=n[6].i,y=jt(n),k=n[0].length>1&&qt(n);return{c(){e=g("div"),o=g("div"),y.c(),s=g("div"),l=g("button"),k&&k.c(),w(l,"class","bp-x"),w(l,"title","Close"),w(l,"aria-label","Close"),w(s,"class","bp-controls"),w(e,"class","bp-wrap"),$(e,"bp-zoomed",n[10]),$(e,"bp-inline",n[8]),$(e,"bp-small",n[7]),$(e,"bp-noclose",n[5].noClose)},m(t,r){b(t,e,r),m(e,o),y.m(e,null),m(e,s),m(s,l),k&&k.m(s,null),p=1,f||(d=[v(l,"click",n[1]),u(n[14].call(null,e))],f=1)},p(n,o){64&o[0]&&c(x,x=n[6].i)?(X(),H(y,1,1,t),Y(),y=jt(n),y.c(),G(y,1),y.m(e,s)):y.p(n,o),n[0].length>1?k?k.p(n,o):(k=qt(n),k.c(),k.m(s,null)):k&&(k.d(1),k=null),(!p||1024&o[0])&&$(e,"bp-zoomed",n[10]),(!p||256&o[0])&&$(e,"bp-inline",n[8]),(!p||128&o[0])&&$(e,"bp-small",n[7]),(!p||32&o[0])&&$(e,"bp-noclose",n[5].noClose)},i(t){p||(i&&i.end(1),G(y),a&&a.end(1),p=1)},o(t){t&&(i=V(o,it,{duration:480})),H(y),t&&(a=V(s,it,{})),p=0},d(t){t&&h(e),t&&i&&i.end(),y.d(t),k&&k.d(),t&&a&&a.end(),f=0,r(d)}}}function Nt(n){let e,o=(n[6].html??n[6].element.outerHTML)+"";return{c(){e=g("div"),w(e,"class","bp-html")},m(t,n){b(t,e,n),e.innerHTML=o},p(t,n){64&n[0]&&o!==(o=(t[6].html??t[6].element.outerHTML)+"")&&(e.innerHTML=o)},i:t,o:t,d(t){t&&h(e)}}}function Ot(n){let e,o;return e=new zt({P:{P:n[13]()}}),{c(){Z(e.u.l)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.u.l,t),o=1)},o(t){H(e.u.l,t),o=0},d(t){nt(e,t)}}}function Ct(n){let e,o;return e=new At({P:{P:n[13]()}}),{c(){Z(e.u.l)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.u.l,t),o=1)},o(t){H(e.u.l,t),o=0},d(t){nt(e,t)}}}function Et(t){let n,e;return n=new _t({P:{P:t[13](),q:t[7]}}),{c(){Z(n.u.l)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};128&e[0]&&(o.q=t[7]),n.C(o)},i(t){e||(G(n.u.l,t),e=1)},o(t){H(n.u.l,t),e=0},d(t){nt(n,t)}}}function Rt(t){let n,e,o,r=t[6].caption+"";return{c(){n=g("div"),w(n,"class","bp-cap")},m(t,e){b(t,n,e),n.innerHTML=r,o=1},p(t,e){(!o||64&e[0])&&r!==(r=t[6].caption+"")&&(n.innerHTML=r)},i(t){o||(e&&e.end(1),o=1)},o(t){e=V(n,it,{duration:200}),o=0},d(t){t&&h(n),t&&e&&e.end()}}}function jt(t){let n,e,o,i,c,s,u,l,a;const p=[Et,Ct,Ot,Nt],f=[];function d(t,n){return t[6].img?0:t[6].sources?1:t[6].iframe?2:3}e=d(t),o=f[e]=p[e](t);let m=t[6].caption&&Rt(t);return{c(){n=g("div"),o.c(),m&&m.c(),s=x(),w(n,"class","bp-inner")},m(o,r){b(o,n,r),f[e].m(n,null),m&&m.m(o,r),b(o,s,r),u=1,l||(a=[v(n,"pointerdown",t[20]),v(n,"pointerup",t[21])],l=1)},p(t,r){let i=e;e=d(t),e===i?f[e].p(t,r):(X(),H(f[i],1,1,(()=>{f[i]=null})),Y(),o=f[e],o?o.p(t,r):(o=f[e]=p[e](t),o.c()),G(o,1),o.m(n,null)),t[6].caption?m?(m.p(t,r),64&r[0]&&G(m,1)):(m=Rt(t),m.c(),G(m,1),m.m(s.parentNode,s)):m&&(X(),H(m,1,1,(()=>{m=null})),Y())},i(e){u||(G(o),R((()=>{c&&c.end(1),i=U(n,t[12],1),i.start()})),G(m),u=1)},o(e){H(o),i&&i.S(),c=V(n,t[12],0),H(m),u=0},d(t){t&&h(n),f[e].d(),t&&c&&c.end(),m&&m.d(t),t&&h(s),l=0,r(a)}}}function qt(t){let n,e,o,i,c,s=`${t[4]+1} / ${t[0].length}`;return{c(){n=g("div"),e=g("button"),o=g("button"),w(n,"class","bp-count"),w(e,"class","bp-prev"),w(e,"title","Previous"),w(e,"aria-label","Previous"),w(o,"class","bp-next"),w(o,"title","Next"),w(o,"aria-label","Next")},m(r,u){b(r,n,u),n.innerHTML=s,b(r,e,u),b(r,o,u),i||(c=[v(e,"click",t[2]),v(o,"click",t[3])],i=1)},p(t,e){17&e[0]&&s!==(s=`${t[4]+1} / ${t[0].length}`)&&(n.innerHTML=s)},d(t){t&&h(n),t&&h(e),t&&h(o),i=0,r(c)}}}function Ft(t){let n,e,o=t[0]&&Tt(t);return{c(){o&&o.c(),n=x()},m(t,r){o&&o.m(t,r),b(t,n,r),e=1},p(t,e){t[0]?o?(o.p(t,e),1&e[0]&&G(o,1)):(o=Tt(t),o.c(),G(o,1),o.m(n.parentNode,n)):o&&(X(),H(o,1,1,(()=>{o=null})),Y())},i(t){e||(G(o),e=1)},o(t){H(o),e=0},d(t){o&&o.d(t),t&&h(n)}}}function Jt(t,n,e){let o,{items:r}=n,{target:i}=n;const c=document.documentElement;let u,l,a,p,f,d,m,b,h;const x=()=>!h.img&&!h.sources&&!h.iframe;let w;const y=t=>w=t,$={},k=st(0);s(t,k,(t=>e(10,o=t)));const _=()=>{l.onClose?.($.el,h),at.set(1),e(0,r=null),p?.focus({preventScroll:1})},M=()=>z(u-1),S=()=>z(u+1),z=t=>{m=t-u,e(4,u=I(t))},I=t=>(t+r.length)%r.length,P=t=>{const{key:n,shiftKey:e}=t;if("Escape"===n)!l.noClose&&_();else if("ArrowRight"===n)S();else if("ArrowLeft"===n)M();else if("Tab"===n){const{activeElement:n}=document;if(e||!n.controls){t.preventDefault();const{focusWrap:o=$.el}=l,r=[...o.querySelectorAll("*")].filter((t=>t.tabIndex>=0));let i=r.indexOf(n);i+=r.length+(e?-1:1),r[i%r.length].focus()}}},A=({width:t=1920,height:n=1080})=>{const{scale:e=.99}=l,o=Math.min(1,$.w/t*e,$.h/n*e);return[Math.round(t*o),Math.round(n*o)]},T=()=>{if(r){const t=r[I(u+1)],n=r[I(u-1)];!t.preload&&N(t),!n.preload&&N(n)}},N=t=>{if(t.img){const n=g("img");return n.sizes=l.sizes||A(t)[0]+"px",n.srcset=t.img,t.preload=1,n.decode().catch((t=>{}))}};return t.R=t=>{"items"in t&&e(0,r=t.items),"target"in t&&e(15,i=t.target)},t.u.update=()=>{786545&t.u.v[0]&&r&&(e(6,h=r[u]),a&&l.onUpdate?.($.el,h))},[r,_,M,S,u,l,h,f,d,b,o,k,(t,n)=>a&&r?it(t,{x:(m>0?20:-20)*(n?1:-1),duration:250}):(e(18,a=n),l.intro?it(t,{y:n?10:-10}):(t=>{let n;if(x()){const e=t.firstChild.firstChild;n=[e.clientWidth,e.clientHeight]}else n=A(h);const e=(h.element||p).getBoundingClientRect(),o=e.left-($.w-e.width)/2,r=e.top-($.h-e.height)/2,i=e.width/n[0],c=e.height/n[1];return{duration:480,_:rt,css:(t,n)=>`transform:translate3d(${o*n}px, ${r*n}px, 0) scale3d(${i+t*(1-i)}, ${c+t*(1-c)}, 1)`}})(t)),()=>({j:h,B:A,K:N,L:T,F:l,J:M,next:S,close:_,D:y,zoomed:k,container:$}),t=>{let n,o;e(19,$.el=t,$),l.onOpen?.($.el,h),d||(n=v(globalThis,"keydown",P));const r=new ResizeObserver((t=>{o&&(e(19,$.w=t[0].contentRect.width,$),e(19,$.h=t[0].contentRect.height,$),e(7,f=769>$.w),x()||w?.(),l.onResize?.($.el,h)),o=1}));return r.observe(t),{destroy(){r.disconnect(),n?.(),at.set(0),c.classList.remove("bp-lock"),l.onClosed?.()}}},i,t=>{e(5,l=t),e(8,d=l.inline);const n=l.items;!d&&c.scrollHeight>c.clientHeight&&c.classList.add("bp-lock"),p=document.activeElement,e(19,$.w=i.offsetWidth,$),e(19,$.h=i===document.body?globalThis.innerHeight:i.clientHeight,$),e(7,f=769>$.w),e(4,u=l.position||0),e(0,r=Array.isArray(n)?n.map(((t,n)=>(l.el&&l.el===t.element&&e(4,u=n),{i:n,...t}))):(n.length?[...n]:[n]).map(((t,n)=>(l.el===t&&e(4,u=n),{element:t,i:n,...t.dataset}))))},z,a,$,t=>e(9,b=t.target),function(t){2!==t.button&&t.target===this&&b===this&&!l.noClose&&_()}]}class Bt extends ot{constructor(t){super(),et(this,t,Jt,Ft,c,{items:0,target:15,open:16,close:1,J:2,next:3,setPosition:17},null,[-1,-1])}get items(){return this.u.$[0]}get target(){return this.u.$[15]}get open(){return this.u.$[16]}get close(){return this.u.$[1]}get J(){return this.u.$[2]}get next(){return this.u.$[3]}get setPosition(){return this.u.$[17]}}return t=>new Bt({...t,P:t})}(); diff --git a/dist/bigger-picture.min.mjs b/dist/bigger-picture.min.mjs index 017865b..48a1448 100644 --- a/dist/bigger-picture.min.mjs +++ b/dist/bigger-picture.min.mjs @@ -1 +1 @@ -function t(){}const n=t=>t;function e(t,n){for(const e in n)t[e]=n[e];return t}function o(t){return t()}function r(t){t.forEach(o)}function i(t){return"function"==typeof t}function s(t,n){return t!=t?n==n:t!==n}function c(n,e,o){n.$$.on_destroy.push(((n,...e)=>{if(null==n)return t;const o=n.subscribe(...e);return o.unsubscribe?()=>o.unsubscribe():o})(e,o))}function u(n){return n&&i(n.destroy)?n.destroy:t}let l=()=>globalThis.performance.now(),a=t=>requestAnimationFrame(t);const p=new Set;function f(t){p.forEach((n=>{n.c(t)||(p.delete(n),n.f())})),0!==p.size&&a(f)}function d(t){let n;return 0===p.size&&a(f),{promise:new Promise((e=>{p.add(n={c:t,f:e})})),abort(){p.delete(n)}}}function m(t,n){t.appendChild(n)}function b(t,n,e){t.insertBefore(n,e||null)}function h(t){t.parentNode.removeChild(t)}function g(t){return document.createElement(t)}function x(){return document.createTextNode("")}function v(t,n,e,o){return t.addEventListener(n,e,o),()=>t.removeEventListener(n,e,o)}function w(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}function y(t,n,e,o){null===e?t.style.removeProperty(n):t.style.setProperty(n,e)}function $(t,n,e){t.classList[e?"add":"remove"](n)}let k,_,M=0,z={};function I(t,n,e,o,r,i,s,c=0){const u=16.666/o;let l="{\n";for(let t=0;1>=t;t+=u){const o=n+(e-n)*i(t);l+=100*t+`%{${s(o,1-o)}}\n`}const a=l+`100% {${s(e,1-e)}}\n}`,p=`_bp_${Math.round(1e9*Math.random())}_${c}`;if(!z[p]){if(!k){const t=g("style");document.head.appendChild(t),k=t.sheet}z[p]=1,k.insertRule(`@keyframes ${p} ${a}`,k.cssRules.length)}const f=t.style.animation||"";return t.style.animation=`${f?f+", ":""}${p} ${o}ms linear ${r}ms 1 both`,M+=1,p}function S(t,n){t.style.animation=(t.style.animation||"").split(", ").filter(n?t=>0>t.indexOf(n):t=>-1===t.indexOf("_bp")).join(", "),n&&!--M&&a((()=>{if(M)return;let t=k.cssRules.length;for(;t--;)k.deleteRule(t);z={}}))}function P(t){_=t}const A=[],T=[],C=[],N=[],O=Promise.resolve();let E=0;function R(t){C.push(t)}const j=new Set;let q,F=0;function D(){const t=_;do{for(;A.length>F;){const t=A[F];F++,P(t),J(t.$$)}for(P(null),A.length=0,F=0;T.length;)T.pop()();for(let t=0;C.length>t;t+=1){const n=C[t];j.has(n)||(j.add(n),n())}C.length=0}while(A.length);for(;N.length;)N.pop()();E=0,j.clear(),P(t)}function J(t){if(null!==t.t){t.update(),r(t.before_update);const n=t.u;t.u=[-1],t.t&&t.t.p(t.ctx,n),t.after_update.forEach(R)}}function K(){return q||(q=Promise.resolve(),q.then((()=>{q=null}))),q}function L(t,n,e){t.dispatchEvent(((t,n,e=0)=>{const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,e,0,n),o})(`${n?"intro":"outro"}${e}`))}const W=new Set;let X;function Y(){X={r:0,c:[],p:X}}function B(){X.r||r(X.c),X=X.p}function G(t,n){t&&t.i&&(W.delete(t),t.i(n))}function H(t,n,e,o){if(t&&t.o){if(W.has(t))return;W.add(t),X.c.push((()=>{W.delete(t),o&&(e&&t.d(1),o())})),t.o(n)}}const Q={duration:0};function U(e,o,r){let s,c,u=o(e,r),a=0,p=0;function f(){s&&S(e,s)}function m(){const{delay:o=0,duration:r=300,l:i=n,g:m=t,css:b}=u||Q;b&&(s=I(e,0,1,r,o,i,b,p++)),m(0,1);const h=l()+o,g=h+r;c&&c.abort(),a=1,R((()=>L(e,1,"start"))),c=d((t=>{if(a){if(t>=g)return m(1,0),L(e,1,"end"),f(),a=0;if(t>=h){const n=i((t-h)/r);m(n,1-n)}}return a}))}let b=0;return{start(){b||(b=1,S(e),i(u)?(u=u(),K().then(m)):m())},invalidate(){b=0},end(){a&&(f(),a=0)}}}function V(e,o,s){let c,u=o(e,s),a=1;const p=X;function f(){const{delay:o=0,duration:i=300,l:s=n,g:f=t,css:m}=u||Q;m&&(c=I(e,1,0,i,o,s,m));const b=l()+o,h=b+i;R((()=>L(e,0,"start"))),d((t=>{if(a){if(t>=h)return f(0,1),L(e,0,"end"),--p.r||r(p.c),0;if(t>=b){const n=s((t-b)/i);f(1-n,n)}}return a}))}return p.r+=1,i(u)?K().then((()=>{u=u(),f()})):f(),{end(t){t&&u.g&&u.g(1,0),a&&(c&&S(e,c),a=0)}}}function Z(t){t&&t.c()}function tt(t,n,e,s){const{t:c,on_mount:u,on_destroy:l,after_update:a}=t.$$;c&&c.m(n,e),s||R((()=>{const n=u.map(o).filter(i);l?l.push(...n):r(n),t.$$.on_mount=[]})),a.forEach(R)}function nt(t,n){const e=t.$$;null!==e.t&&(r(e.on_destroy),e.t&&e.t.d(n),e.on_destroy=e.t=null,e.ctx=[])}function et(n,e,o,i,s,c,u,l=[-1]){const a=_;P(n);const p=n.$$={t:null,ctx:null,v:c,update:t,not_equal:s,bound:{},on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:{},u:l,skip_bound:0,root:e.target||a.$$.root};u&&u(p.root);let f=0;p.ctx=o?o(n,e.v||{},((t,e,...o)=>{const r=o.length?o[0]:e;return p.ctx&&s(p.ctx[t],p.ctx[t]=r)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](r),f&&((t,n)=>{-1===t.$$.u[0]&&(A.push(t),E||(E=1,O.then(D)),t.$$.u.fill(0)),t.$$.u[n/31|0]|=1<{const t=e.indexOf(n);-1!==t&&e.splice(t,1)}}$set(t){this.$$set&&0!==Object.keys(t).length&&(this.$$.skip_bound=1,this.$$set(t),this.$$.skip_bound=0)}}function rt(t){const n=t-1;return n*n*n+1}function it(t,{delay:n=0,duration:e=400,l:o=rt,x:r=0,y:i=0,opacity:s=0}={}){const c=getComputedStyle(t),u=+c.opacity,l="none"===c.transform?"":c.transform,a=u*(1-s);return{delay:n,duration:e,l:o,css(t,n){return`\n\t\t\ttransform: ${l} translate(${(1-t)*r}px, ${(1-t)*i}px);\n\t\t\topacity: ${u-a*n}`}}}const st=[];function ct(n,e=t){let o;const r=new Set;function i(t){if(s(n,t)&&(n=t,o)){const t=!st.length;for(const t of r)t[1](),st.push(t,n);if(t){for(let t=0;st.length>t;t+=2)st[t][0](st[t+1]);st.length=0}}}return{set:i,update(t){i(t(n))},subscribe(s,c=t){const u=[s,c];return r.add(u),1===r.size&&(o=e(i)||t),s(n),()=>{r.delete(u),0===r.size&&(o(),o=null)}}}}function ut(t,n){if(t===n||t!=t)return()=>t;const e=typeof t;if(Array.isArray(t)){const e=n.map(((n,e)=>ut(t[e],n)));return t=>e.map((n=>n(t)))}if("number"===e){const e=n-t;return n=>t+n*e}}function lt(t,o={}){const r=ct(t);let i,s=t;function c(c,u){if(null==t)return r.set(t=c),Promise.resolve();s=c;let a=i,p=0,{delay:f=0,duration:m=400,l:b=n,interpolate:h=ut}=e(e({},o),u);if(0===m)return a&&(a.abort(),a=null),r.set(t=s),Promise.resolve();const g=l()+f;let x;return i=d((n=>{if(g>n)return 1;p||(x=h(t,c),"function"==typeof m&&(m=m(t,c)),p=1),a&&(a.abort(),a=null);const e=n-g;return e>m?(r.set(t=c),0):(r.set(t=x(b(e/m))),1)})),i.promise}return{set:c,update(n,e){return c(n(s,t),e)},subscribe:r.subscribe}}const at=ct(0),pt=globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches,ft=t=>({l:rt,duration:pt?0:t}),dt=t=>!t.thumb||`url(${t.thumb})`;function mt(t){let n,e,o;return{c(){n=g("div"),n.innerHTML='',w(n,"class","bp-load"),y(n,"background-image",dt(t[0]))},m(t,e){b(t,n,e),o=1},p(t,e){1&e&&y(n,"background-image",dt(t[0]))},i(t){o||(e&&e.end(1),o=1)},o(t){t&&(e=V(n,it,{duration:480})),o=0},d(t){t&&h(n),t&&e&&e.end()}}}function bt(n){let e,o;return{c(){e=g("div"),w(e,"class","bp-load"),y(e,"background-image",dt(n[0]))},m(t,n){b(t,e,n)},p(t,n){1&n&&y(e,"background-image",dt(t[0]))},i(t){o||R((()=>{o=U(e,it,{duration:480}),o.start()}))},o:t,d(t){t&&h(e)}}}function ht(t){let n,e,o=!t[1]&&mt(t),r=t[2]&&bt(t);return{c(){o&&o.c(),n=x(),r&&r.c(),e=x()},m(t,i){o&&o.m(t,i),b(t,n,i),r&&r.m(t,i),b(t,e,i)},p(t,[i]){t[1]?o&&(Y(),H(o,1,1,(()=>{o=null})),B()):o?(o.p(t,i),2&i&&G(o,1)):(o=mt(t),o.c(),G(o,1),o.m(n.parentNode,n)),t[2]?r?(r.p(t,i),4&i&&G(r,1)):(r=bt(t),r.c(),G(r,1),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},i(t){G(o),G(r)},o(t){H(o)},d(t){o&&o.d(t),t&&h(n),r&&r.d(t),t&&h(e)}}}function gt(t,n,e){let o;c(t,at,(t=>e(2,o=t)));let{$:r}=n,{loaded:i}=n;return t.$$set=t=>{"$"in t&&e(0,r=t.$),"loaded"in t&&e(1,i=t.loaded)},[r,i,o]}class xt extends ot{constructor(t){super(),et(this,t,gt,ht,s,{$:0,loaded:1})}}function vt(t){let n,e,o,r,i,s,c,u;return{c(){n=g("img"),w(n,"srcset",e=t[7].img),w(n,"sizes",o=t[8].sizes||t[1]+"px"),w(n,"alt",r=t[7].alt)},m(e,o){b(e,n,o),s=1,c||(u=v(n,"error",t[26]),c=1)},p(t,e){(!s||2&e[0]&&o!==(o=t[8].sizes||t[1]+"px"))&&w(n,"sizes",o)},i(t){s||(i&&i.end(1),s=1)},o(t){i=V(n,it,{}),s=0},d(t){t&&h(n),t&&i&&i.end(),c=0,u()}}}function wt(t){let n,e;return n=new xt({v:{$:t[7],loaded:t[2]}}),{c(){Z(n.$$.t)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};4&e[0]&&(o.loaded=t[2]),n.$set(o)},i(t){e||(G(n.$$.t,t),e=1)},o(t){H(n.$$.t,t),e=0},d(t){nt(n,t)}}}function yt(t){let n,e,o,i,s,c,l=`translate3d(${t[0][0]/-2+t[6][0]}px, ${t[0][1]/-2+t[6][1]}px, 0)`,a=t[2]&&vt(t),p=t[3]&&wt(t);return{c(){n=g("div"),e=g("div"),a&&a.c(),o=x(),p&&p.c(),w(e,"class","bp-img"),y(e,"width",t[0][0]+"px"),y(e,"height",t[0][1]+"px"),$(e,"bp-drag",t[4]),$(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),y(e,"background-image",dt(t[7])),y(e,"transform",l),w(n,"class","bp-img-wrap"),$(n,"bp-close",t[5])},m(r,l){b(r,n,l),m(n,e),a&&a.m(e,null),m(e,o),p&&p.m(e,null),i=1,s||(c=[u(t[20].call(null,e)),v(n,"wheel",t[15]),v(n,"pointerdown",t[16]),v(n,"pointermove",t[17]),v(n,"pointerup",t[19]),v(n,"pointercancel",t[18])],s=1)},p(t,r){t[2]?a?(a.p(t,r),4&r[0]&&G(a,1)):(a=vt(t),a.c(),G(a,1),a.m(e,o)):a&&(Y(),H(a,1,1,(()=>{a=null})),B()),t[3]?p?(p.p(t,r),8&r[0]&&G(p,1)):(p=wt(t),p.c(),G(p,1),p.m(e,null)):p&&(Y(),H(p,1,1,(()=>{p=null})),B()),(!i||1&r[0])&&y(e,"width",t[0][0]+"px"),(!i||1&r[0])&&y(e,"height",t[0][1]+"px"),16&r[0]&&$(e,"bp-drag",t[4]),6145&r[0]&&$(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),65&r[0]&&l!==(l=`translate3d(${t[0][0]/-2+t[6][0]}px, ${t[0][1]/-2+t[6][1]}px, 0)`)&&y(e,"transform",l),32&r[0]&&$(n,"bp-close",t[5])},i(t){i||(G(a),G(p),i=1)},o(t){H(a),H(p),i=0},d(t){t&&h(n),a&&a.d(),p&&p.d(),s=0,r(c)}}}function $t(t,n,e){let o,r,i,s;c(t,at,(t=>e(25,i=t)));let{v:u}=n,{k:l}=n,{$:a,_:p,M:f,next:d,zoomed:m,container:b}=u;c(t,m,(t=>e(24,o=t)));let h,g,x,v,w,y,$,k,_,M,z,I=a.maxZoom||p.maxZoom||10,S=u.I(a),P=S[0],A=0;const T=+a.width,C=[],N=new Map,O=lt(S,ft(400));c(t,O,(t=>e(0,s=t)));const E=lt([0,0],ft(400));c(t,E,(t=>e(6,r=t)));const R=([t,n],o=s)=>{const r=(o[0]-b.w)/2,i=(o[1]-b.h)/2;return 0>r?t=0:t>r?l?(t=w?r+(t-r)/10:r)>r+20&&e(4,w=f()):t=r:-r>t&&(l?-r-20>(t=w?-r-(-r-t)/10:-r)&&e(4,w=d()):t=-r),0>i?n=0:n>i?n=i:-i>n&&(n=-i),[t,n]};function j(t=I,n){if(i)return;const o=S[0]*I;let c=s[0]+s[0]*t,u=s[1]+s[1]*t;if(t>0)c>o&&(c=o,u=S[1]*I),c>T&&(c=T,u=+a.height);else if(S[0]>c)return O.set(S),E.set([0,0]);let{x:l,y:p,width:f,height:d}=v.getBoundingClientRect();const m=n?n.clientX-l-f/2:0,b=n?n.clientY-p-d/2:0;l=c/f*-m+m,p=u/d*-b+b;const h=[c,u];O.set(h).then((()=>{e(1,P=Math.round(Math.max(P,c)))})),E.set(R([r[0]+l,r[1]+p],h))}Object.defineProperty(a,"zoom",{configurable:1,get(){return o},set(t){return j(t?I:-I)}});const q=t=>N.delete(t.pointerId);return t.$$set=t=>{"k"in t&&e(22,l=t.k)},t.$$.update=()=>{if(8388609&t.$$.u[0]&&m.set(s[0]-10>S[0]),58720256&t.$$.u[0]&&i&&o&&!p.intro){const t=ft(480);E.set([0,0],t),O.set(S,t),e(5,z=1)}},[s,P,h,g,w,z,r,a,p,m,b,I,T,O,E,t=>{p.inline&&!o||(t.preventDefault(),j(t.deltaY/-300,t))},t=>{2!==t.button&&(t.preventDefault(),e(4,w=1),N.set(t.pointerId,t),$=t.clientX,k=t.clientY,_=r[0],M=r[1])},t=>{if(N.size>1)return e(4,w=0),p.noPinch?.(b.el)||(t=>{const[n,e]=N.set(t.pointerId,t).values(),o=Math.hypot(n.clientX-e.clientX,n.clientY-e.clientY);x=x||{clientX:(n.clientX+e.clientX)/2,clientY:(n.clientY+e.clientY)/2},j(((A||o)-o)/-35,x),A=o})(t);if(!w)return;let n=t.clientX,r=t.clientY;y=C.push({x:n,y:r})>2,n-=$,r-=k,o||(-90>r&&e(4,w=!p.noClose&&u.close()),30>Math.abs(r)&&(n>40&&e(4,w=f()),-40>n&&e(4,w=d()))),o&&y&&!i&&E.set(R([_+n,M+r]),{duration:0})},q,function(t){if(q(t),x&&(e(4,w=A=0),x=N.size?x:null),w){if(e(4,w=0),t.target===this&&!p.noClose)return u.close();if(y){const[t,n,e]=C.slice(-3);Math.hypot(n.x-e.x,n.y-e.y)>5&&E.set(R([r[0]-5*(t.x-e.x),r[1]-5*(t.y-e.y)]))}else p.onImageClick?.(b.el,a)||j(o?-I:I,t);y=0,C.length=0}},t=>{v=t,u.S((()=>{e(23,S=u.I(a)),!p.inline&&l||(O.set(S),E.set([0,0]))})),u.P(a).then((()=>{e(2,h=1),u.A()})),setTimeout((()=>{e(3,g=!h)}),250)},u,l,S,o,i,t=>p.onError?.(b,a,t)]}class kt extends ot{constructor(t){super(),et(this,t,$t,yt,s,{v:21,k:22},null,[-1,-1])}}function _t(t){let n,e,o,i,s,c;return o=new xt({v:{$:t[2],loaded:t[0]}}),{c(){n=g("div"),e=g("iframe"),Z(o.$$.t),w(e,"allow","autoplay; fullscreen"),w(e,"title",t[2].title),w(n,"class","bp-if"),y(n,"width",t[1][0]+"px"),y(n,"height",t[1][1]+"px")},m(r,l){b(r,n,l),m(n,e),tt(o,n,null),i=1,s||(c=[u(t[3].call(null,e)),v(e,"load",t[5])],s=1)},p(t,[e]){const r={};1&e&&(r.loaded=t[0]),o.$set(r),(!i||2&e)&&y(n,"width",t[1][0]+"px"),(!i||2&e)&&y(n,"height",t[1][1]+"px")},i(t){i||(G(o.$$.t,t),i=1)},o(t){H(o.$$.t,t),i=0},d(t){t&&h(n),nt(o),s=0,r(c)}}}function Mt(t,n,e){let o,r,{v:i}=n;const{$:s}=i,c=()=>e(1,r=i.I(s));return c(),i.S(c),[o,r,s,t=>t.src=s.iframe,i,()=>e(0,o=1)]}class zt extends ot{constructor(t){super(),et(this,t,Mt,_t,s,{v:4})}}function It(t){let n,e,o,r,i;return e=new xt({v:{$:t[2],loaded:t[0]}}),{c(){n=g("div"),Z(e.$$.t),w(n,"class","bp-vid"),y(n,"width",t[1][0]+"px"),y(n,"height",t[1][1]+"px"),y(n,"background-image",dt(t[2]))},m(s,c){b(s,n,c),tt(e,n,null),o=1,r||(i=u(t[3].call(null,n)),r=1)},p(t,[r]){const i={};1&r&&(i.loaded=t[0]),e.$set(i),(!o||2&r)&&y(n,"width",t[1][0]+"px"),(!o||2&r)&&y(n,"height",t[1][1]+"px")},i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){t&&h(n),nt(e),r=0,i()}}}function St(t,n,e){let o,r,{v:i}=n;const{$:s,_:c,container:u}=i,l=()=>e(1,r=i.I(s));l(),i.S(l);const a=(t,n)=>{for(const e in n)w(t,e,n[e])};return[o,r,s,t=>{let n;const r=(t,e)=>{Array.isArray(e)||(e=JSON.parse(e));for(const o of e){n||(n=g(o.type?.includes("audio")?"audio":"video"),a(n,{controls:1,autoplay:1,playsinline:1,tabindex:"0"}));const e=g(t);a(e,o),"source"==t&&v(e,"error",(t=>c.onError?.(u,s,t))),m(n,e)}};r("source",s.sources),r("track",s.tracks||[]),v(n,"canplay",(()=>e(0,o=1))),m(t,n)},i]}class Pt extends ot{constructor(t){super(),et(this,t,St,It,s,{v:4})}}function At(n){let e,o,i,c,l,a,p,f,d,x,y=n[6].i,k=Rt(n),_=n[0].length>1&&jt(n);return{c(){e=g("div"),o=g("div"),k.c(),c=g("div"),l=g("button"),_&&_.c(),w(l,"class","bp-x"),w(l,"title","Close"),w(l,"aria-label","Close"),w(c,"class","bp-controls"),w(e,"class","bp-wrap"),$(e,"bp-zoomed",n[10]),$(e,"bp-inline",n[8]),$(e,"bp-small",n[7]),$(e,"bp-noclose",n[5].noClose)},m(t,r){b(t,e,r),m(e,o),k.m(e,null),m(e,c),m(c,l),_&&_.m(c,null),f=1,d||(x=[v(l,"click",n[1]),u(p=n[14].call(null,e))],d=1)},p(n,o){64&o[0]&&s(y,y=n[6].i)?(Y(),H(k,1,1,t),B(),k=Rt(n),k.c(),G(k),k.m(e,c)):k.p(n,o),n[0].length>1?_?_.p(n,o):(_=jt(n),_.c(),_.m(c,null)):_&&(_.d(1),_=null),1024&o[0]&&$(e,"bp-zoomed",n[10]),256&o[0]&&$(e,"bp-inline",n[8]),128&o[0]&&$(e,"bp-small",n[7]),32&o[0]&&$(e,"bp-noclose",n[5].noClose)},i(t){f||(i&&i.end(1),G(k),a&&a.end(1),f=1)},o(t){t&&(i=V(o,it,{duration:480})),H(k),t&&(a=V(c,it,{})),f=0},d(t){t&&h(e),t&&i&&i.end(),k.d(t),_&&_.d(),t&&a&&a.end(),d=0,r(x)}}}function Tt(n){let e,o=(n[6].html??n[6].element.outerHTML)+"";return{c(){e=g("div"),w(e,"class","bp-html")},m(t,n){b(t,e,n),e.innerHTML=o},p(t,n){64&n[0]&&o!==(o=(t[6].html??t[6].element.outerHTML)+"")&&(e.innerHTML=o)},i:t,o:t,d(t){t&&h(e)}}}function Ct(n){let e,o;return e=new zt({v:{v:n[13]()}}),{c(){Z(e.$$.t)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){nt(e,t)}}}function Nt(n){let e,o;return e=new Pt({v:{v:n[13]()}}),{c(){Z(e.$$.t)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){nt(e,t)}}}function Ot(t){let n,e;return n=new kt({v:{v:t[13](),k:t[7]}}),{c(){Z(n.$$.t)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};128&e[0]&&(o.k=t[7]),n.$set(o)},i(t){e||(G(n.$$.t,t),e=1)},o(t){H(n.$$.t,t),e=0},d(t){nt(n,t)}}}function Et(t){let n,e,o,r=t[6].caption+"";return{c(){n=g("div"),w(n,"class","bp-cap")},m(t,e){b(t,n,e),n.innerHTML=r,o=1},p(t,e){(!o||64&e[0])&&r!==(r=t[6].caption+"")&&(n.innerHTML=r)},i(t){o||(e&&e.end(1),o=1)},o(t){e=V(n,it,{duration:200}),o=0},d(t){t&&h(n),t&&e&&e.end()}}}function Rt(t){let n,e,o,i,s,c,u,l,a;const p=[Ot,Nt,Ct,Tt],f=[];function d(t,n){return t[6].img?0:t[6].sources?1:t[6].iframe?2:3}e=d(t),o=f[e]=p[e](t);let m=t[6].caption&&Et(t);return{c(){n=g("div"),o.c(),m&&m.c(),c=x(),w(n,"class","bp-inner")},m(o,r){b(o,n,r),f[e].m(n,null),m&&m.m(o,r),b(o,c,r),u=1,l||(a=[v(n,"pointerdown",t[20]),v(n,"pointerup",t[21])],l=1)},p(t,r){let i=e;e=d(t),e===i?f[e].p(t,r):(Y(),H(f[i],1,1,(()=>{f[i]=null})),B(),o=f[e],o?o.p(t,r):(o=f[e]=p[e](t),o.c()),G(o,1),o.m(n,null)),t[6].caption?m?(m.p(t,r),64&r[0]&&G(m,1)):(m=Et(t),m.c(),G(m,1),m.m(c.parentNode,c)):m&&(Y(),H(m,1,1,(()=>{m=null})),B())},i(e){u||(G(o),R((()=>{s&&s.end(1),i=U(n,t[12],1),i.start()})),G(m),u=1)},o(e){H(o),i&&i.invalidate(),s=V(n,t[12],0),H(m),u=0},d(t){t&&h(n),f[e].d(),t&&s&&s.end(),m&&m.d(t),t&&h(c),l=0,r(a)}}}function jt(t){let n,e,o,i,s,c=`${t[4]+1} / ${t[0].length}`;return{c(){n=g("div"),e=g("button"),o=g("button"),w(n,"class","bp-count"),w(e,"class","bp-prev"),w(e,"title","Previous"),w(e,"aria-label","Previous"),w(o,"class","bp-next"),w(o,"title","Next"),w(o,"aria-label","Next")},m(r,u){b(r,n,u),n.innerHTML=c,b(r,e,u),b(r,o,u),i||(s=[v(e,"click",t[2]),v(o,"click",t[3])],i=1)},p(t,e){17&e[0]&&c!==(c=`${t[4]+1} / ${t[0].length}`)&&(n.innerHTML=c)},d(t){t&&h(n),t&&h(e),t&&h(o),i=0,r(s)}}}function qt(t){let n,e,o=t[0]&&At(t);return{c(){o&&o.c(),n=x()},m(t,r){o&&o.m(t,r),b(t,n,r),e=1},p(t,e){t[0]?o?(o.p(t,e),1&e[0]&&G(o,1)):(o=At(t),o.c(),G(o,1),o.m(n.parentNode,n)):o&&(Y(),H(o,1,1,(()=>{o=null})),B())},i(t){e||(G(o),e=1)},o(t){H(o),e=0},d(t){o&&o.d(t),t&&h(n)}}}function Ft(t,n,e){let o,{items:r}=n,{target:i}=n;const s=document.documentElement;let u,l,a,p,f,d,m,b,h;const x=()=>!h.img&&!h.sources&&!h.iframe;let w;const y=t=>w=t,$={},k=ct(0);c(t,k,(t=>e(10,o=t)));const _=()=>{l.onClose?.($.el,h),at.set(1),e(0,r=null),p?.focus({preventScroll:1})},M=()=>I(u-1),z=()=>I(u+1),I=t=>{m=t-u,e(4,u=S(t))},S=t=>(t+r.length)%r.length,P=t=>{const{key:n,shiftKey:e}=t;if("Escape"===n)!l.noClose&&_();else if("ArrowRight"===n)z();else if("ArrowLeft"===n)M();else if("Tab"===n){const{activeElement:n}=document;if(e||!n.controls){t.preventDefault();const{focusWrap:o=$.el}=l,r=[...o.querySelectorAll("*")].filter((t=>t.tabIndex>=0));let i=r.indexOf(n);i+=r.length+(e?-1:1),r[i%r.length].focus()}}},A=({width:t=1920,height:n=1080})=>{const{scale:e=.99}=l,o=Math.min(1,$.w/t*e,$.h/n*e);return[Math.round(t*o),Math.round(n*o)]},T=()=>{if(r){const t=r[S(u+1)],n=r[S(u-1)];!t.preload&&C(t),!n.preload&&C(n)}},C=t=>{if(t.img){const n=g("img");return n.sizes=l.sizes||A(t)[0]+"px",n.srcset=t.img,t.preload=1,n.decode().catch((t=>{}))}};return t.$$set=t=>{"items"in t&&e(0,r=t.items),"target"in t&&e(15,i=t.target)},t.$$.update=()=>{786545&t.$$.u[0]&&r&&(e(6,h=r[u]),a&&l.onUpdate?.($.el,h))},[r,_,M,z,u,l,h,f,d,b,o,k,(t,n)=>a&&r?it(t,{x:(m>0?20:-20)*(n?1:-1),duration:250}):(e(18,a=n),l.intro?it(t,{y:n?10:-10}):(t=>{let n;if(x()){const e=t.firstChild.firstChild;n=[e.clientWidth,e.clientHeight]}else n=A(h);const e=(h.element||p).getBoundingClientRect(),o=e.left-($.w-e.width)/2,r=e.top-($.h-e.height)/2,i=e.width/n[0],s=e.height/n[1];return{duration:480,l:rt,css:(t,n)=>`transform:translate3d(${o*n}px, ${r*n}px, 0) scale3d(${i+t*(1-i)}, ${s+t*(1-s)}, 1)`}})(t)),()=>({$:h,I:A,P:C,A:T,_:l,M,next:z,close:_,S:y,zoomed:k,container:$}),t=>{let n,o;e(19,$.el=t,$),l.onOpen?.($.el,h),d||(n=v(globalThis,"keydown",P));const r=new ResizeObserver((t=>{o&&(e(19,$.w=t[0].contentRect.width,$),e(19,$.h=t[0].contentRect.height,$),e(7,f=769>$.w),x()||w?.(),l.onResize?.($.el,h)),o=1}));return r.observe(t),{destroy(){r.disconnect(),n?.(),at.set(0),s.classList.remove("bp-lock"),l.onClosed?.()}}},i,t=>{e(5,l=t),e(8,d=l.inline);const n=l.items;!d&&s.scrollHeight>s.clientHeight&&s.classList.add("bp-lock"),p=document.activeElement,e(19,$.w=i.offsetWidth,$),e(19,$.h=i===document.body?globalThis.innerHeight:i.clientHeight,$),e(7,f=769>$.w),e(4,u=l.position||0),e(0,r=Array.isArray(n)?n.map(((t,n)=>(l.el&&l.el===t.element&&e(4,u=n),{i:n,...t}))):(n.length?[...n]:[n]).map(((t,n)=>(l.el===t&&e(4,u=n),{element:t,i:n,...t.dataset}))))},I,a,$,t=>e(9,b=t.target),function(t){2!==t.button&&t.target===this&&b===this&&!l.noClose&&_()}]}class Dt extends ot{constructor(t){super(),et(this,t,Ft,qt,s,{items:0,target:15,open:16,close:1,M:2,next:3,setPosition:17},null,[-1,-1])}get items(){return this.$$.ctx[0]}get target(){return this.$$.ctx[15]}get open(){return this.$$.ctx[16]}get close(){return this.$$.ctx[1]}get M(){return this.$$.ctx[2]}get next(){return this.$$.ctx[3]}get setPosition(){return this.$$.ctx[17]}}function Jt(t){return new Dt({...t,v:t})}export{Jt as default}; +function t(){}const n=t=>t;function e(t,n){for(const e in n)t[e]=n[e];return t}function o(t){return t()}function r(t){t.forEach(o)}function i(t){return"function"==typeof t}function s(t,n){return t!=t?n==n:t!==n}function c(n,e,o){n.u.t.push(((n,...e)=>{if(null==n)return t;const o=n.subscribe(...e);return o.unsubscribe?()=>o.unsubscribe():o})(e,o))}function u(n){return n&&i(n.destroy)?n.destroy:t}let l=()=>globalThis.performance.now(),a=t=>requestAnimationFrame(t);const p=new Set;function f(t){p.forEach((n=>{n.c(t)||(p.delete(n),n.f())})),0!==p.size&&a(f)}function d(t){let n;return 0===p.size&&a(f),{promise:new Promise((e=>{p.add(n={c:t,f:e})})),abort(){p.delete(n)}}}function m(t,n){t.appendChild(n)}function b(t,n,e){t.insertBefore(n,e||null)}function h(t){t.parentNode.removeChild(t)}function g(t){return document.createElement(t)}function x(){return document.createTextNode("")}function v(t,n,e,o){return t.addEventListener(n,e,o),()=>t.removeEventListener(n,e,o)}function w(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}function y(t,n,e,o){null===e?t.style.removeProperty(n):t.style.setProperty(n,e)}function $(t,n,e){t.classList[e?"add":"remove"](n)}let k,_,M=0,S={};function z(t,n,e,o,r,i,s,c=0){const u=16.666/o;let l="{\n";for(let t=0;1>=t;t+=u){const o=n+(e-n)*i(t);l+=100*t+`%{${s(o,1-o)}}\n`}const a=l+`100% {${s(e,1-e)}}\n}`,p=`_bp_${Math.round(1e9*Math.random())}_${c}`;if(!S[p]){if(!k){const t=g("style");document.head.appendChild(t),k=t.sheet}S[p]=1,k.insertRule(`@keyframes ${p} ${a}`,k.cssRules.length)}const f=t.style.animation||"";return t.style.animation=`${f?f+", ":""}${p} ${o}ms linear ${r}ms 1 both`,M+=1,p}function I(t,n){t.style.animation=(t.style.animation||"").split(", ").filter(n?t=>0>t.indexOf(n):t=>-1===t.indexOf("_bp")).join(", "),n&&!--M&&a((()=>{if(M)return;let t=k.cssRules.length;for(;t--;)k.deleteRule(t);S={}}))}function P(t){_=t}const A=[],T=[],N=[],O=[],C=Promise.resolve();let E=0;function R(t){N.push(t)}const j=new Set;let q,F=0;function J(){const t=_;do{for(;A.length>F;){const t=A[F];F++,P(t),D(t.u)}for(P(null),A.length=0,F=0;T.length;)T.pop()();for(let t=0;N.length>t;t+=1){const n=N[t];j.has(n)||(j.add(n),n())}N.length=0}while(A.length);for(;O.length;)O.pop()();E=0,j.clear(),P(t)}function D(t){if(null!==t.l){t.update(),r(t.g);const n=t.v;t.v=[-1],t.l&&t.l.p(t.$,n),t.k.forEach(R)}}function K(){return q||(q=Promise.resolve(),q.then((()=>{q=null}))),q}function L(t,n,e){t.dispatchEvent(((t,n,e=0)=>{const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,e,0,n),o})(`${n?"intro":"outro"}${e}`))}const W=new Set;let X;function Y(){X={r:0,c:[],p:X}}function B(){X.r||r(X.c),X=X.p}function G(t,n){t&&t.i&&(W.delete(t),t.i(n))}function H(t,n,e,o){if(t&&t.o){if(W.has(t))return;W.add(t),X.c.push((()=>{W.delete(t),o&&(e&&t.d(1),o())})),t.o(n)}}const Q={duration:0};function U(e,o,r){let s,c,u=o(e,r),a=0,p=0;function f(){s&&I(e,s)}function m(){const{delay:o=0,duration:r=300,_:i=n,M:m=t,css:b}=u||Q;b&&(s=z(e,0,1,r,o,i,b,p++)),m(0,1);const h=l()+o,g=h+r;c&&c.abort(),a=1,R((()=>L(e,1,"start"))),c=d((t=>{if(a){if(t>=g)return m(1,0),L(e,1,"end"),f(),a=0;if(t>=h){const n=i((t-h)/r);m(n,1-n)}}return a}))}let b=0;return{start(){b||(b=1,I(e),i(u)?(u=u(),K().then(m)):m())},S(){b=0},end(){a&&(f(),a=0)}}}function V(e,o,s){let c,u=o(e,s),a=1;const p=X;function f(){const{delay:o=0,duration:i=300,_:s=n,M:f=t,css:m}=u||Q;m&&(c=z(e,1,0,i,o,s,m));const b=l()+o,h=b+i;R((()=>L(e,0,"start"))),d((t=>{if(a){if(t>=h)return f(0,1),L(e,0,"end"),--p.r||r(p.c),0;if(t>=b){const n=s((t-b)/i);f(1-n,n)}}return a}))}return p.r+=1,i(u)?K().then((()=>{u=u(),f()})):f(),{end(t){t&&u.M&&u.M(1,0),a&&(c&&I(e,c),a=0)}}}function Z(t){t&&t.c()}function tt(t,n,e,s){const{l:c,I:u,t:l,k:a}=t.u;c&&c.m(n,e),s||R((()=>{const n=u.map(o).filter(i);l?l.push(...n):r(n),t.u.I=[]})),a.forEach(R)}function nt(t,n){const e=t.u;null!==e.l&&(r(e.t),e.l&&e.l.d(n),e.t=e.l=null,e.$=[])}function et(n,e,o,i,s,c,u,l=[-1]){const a=_;P(n);const p=n.u={l:null,$:null,P:c,update:t,A:s,bound:{},I:[],t:[],T:[],g:[],k:[],context:new Map(e.context||(a?a.u.context:[])),N:{},v:l,O:0,root:e.target||a.u.root};u&&u(p.root);let f=0;p.$=o?o(n,e.P||{},((t,e,...o)=>{const r=o.length?o[0]:e;return p.$&&s(p.$[t],p.$[t]=r)&&(!p.O&&p.bound[t]&&p.bound[t](r),f&&((t,n)=>{-1===t.u.v[0]&&(A.push(t),E||(E=1,C.then(J)),t.u.v.fill(0)),t.u.v[n/31|0]|=1<{const t=e.indexOf(n);-1!==t&&e.splice(t,1)}}C(t){this.R&&0!==Object.keys(t).length&&(this.u.O=1,this.R(t),this.u.O=0)}}function rt(t){const n=t-1;return n*n*n+1}function it(t,{delay:n=0,duration:e=400,_:o=rt,x:r=0,y:i=0,opacity:s=0}={}){const c=getComputedStyle(t),u=+c.opacity,l="none"===c.transform?"":c.transform,a=u*(1-s);return{delay:n,duration:e,_:o,css(t,n){return`\n\t\t\ttransform: ${l} translate(${(1-t)*r}px, ${(1-t)*i}px);\n\t\t\topacity: ${u-a*n}`}}}const st=[];function ct(n,e=t){let o;const r=new Set;function i(t){if(s(n,t)&&(n=t,o)){const t=!st.length;for(const t of r)t[1](),st.push(t,n);if(t){for(let t=0;st.length>t;t+=2)st[t][0](st[t+1]);st.length=0}}}return{set:i,update(t){i(t(n))},subscribe(s,c=t){const u=[s,c];return r.add(u),1===r.size&&(o=e(i)||t),s(n),()=>{r.delete(u),0===r.size&&(o(),o=null)}}}}function ut(t,n){if(t===n||t!=t)return()=>t;const e=typeof t;if(Array.isArray(t)){const e=n.map(((n,e)=>ut(t[e],n)));return t=>e.map((n=>n(t)))}if("number"===e){const e=n-t;return n=>t+n*e}}function lt(t,o={}){const r=ct(t);let i,s=t;function c(c,u){if(null==t)return r.set(t=c),Promise.resolve();s=c;let a=i,p=0,{delay:f=0,duration:m=400,_:b=n,interpolate:h=ut}=e(e({},o),u);if(0===m)return a&&(a.abort(),a=null),r.set(t=s),Promise.resolve();const g=l()+f;let x;return i=d((n=>{if(g>n)return 1;p||(x=h(t,c),"function"==typeof m&&(m=m(t,c)),p=1),a&&(a.abort(),a=null);const e=n-g;return e>m?(r.set(t=c),0):(r.set(t=x(b(e/m))),1)})),i.promise}return{set:c,update(n,e){return c(n(s,t),e)},subscribe:r.subscribe}}const at=ct(0),pt=globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches,ft=t=>({_:rt,duration:pt?0:t}),dt=t=>!t.thumb||`url(${t.thumb})`,mt=(t,n)=>{if(n){"string"==typeof n&&(n=JSON.parse(n));for(const e in n)t.setAttribute(e,n[e])}};function bt(t){let n,e,o;return{c(){n=g("div"),n.innerHTML='',w(n,"class","bp-load"),y(n,"background-image",dt(t[0]))},m(t,e){b(t,n,e),o=1},p(t,e){1&e&&y(n,"background-image",dt(t[0]))},i(t){o||(e&&e.end(1),o=1)},o(t){t&&(e=V(n,it,{duration:480})),o=0},d(t){t&&h(n),t&&e&&e.end()}}}function ht(n){let e,o;return{c(){e=g("div"),w(e,"class","bp-load"),y(e,"background-image",dt(n[0]))},m(t,n){b(t,e,n)},p(t,n){1&n&&y(e,"background-image",dt(t[0]))},i(t){o||R((()=>{o=U(e,it,{duration:480}),o.start()}))},o:t,d(t){t&&h(e)}}}function gt(t){let n,e,o=!t[1]&&bt(t),r=t[2]&&ht(t);return{c(){o&&o.c(),n=x(),r&&r.c(),e=x()},m(t,i){o&&o.m(t,i),b(t,n,i),r&&r.m(t,i),b(t,e,i)},p(t,[i]){t[1]?o&&(Y(),H(o,1,1,(()=>{o=null})),B()):o?(o.p(t,i),2&i&&G(o,1)):(o=bt(t),o.c(),G(o,1),o.m(n.parentNode,n)),t[2]?r?(r.p(t,i),4&i&&G(r,1)):(r=ht(t),r.c(),G(r,1),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},i(t){G(o),G(r)},o(t){H(o)},d(t){o&&o.d(t),t&&h(n),r&&r.d(t),t&&h(e)}}}function xt(t,n,e){let o;c(t,at,(t=>e(2,o=t)));let{j:r}=n,{loaded:i}=n;return t.R=t=>{"j"in t&&e(0,r=t.j),"loaded"in t&&e(1,i=t.loaded)},[r,i,o]}class vt extends ot{constructor(t){super(),et(this,t,xt,gt,s,{j:0,loaded:1})}}function wt(t){let n,e,o,i,s,c;return{c(){n=g("img"),w(n,"sizes",e=t[8].sizes||t[1]+"px"),w(n,"alt",t[7].alt)},m(e,o){b(e,n,o),i=1,s||(c=[u(t[21].call(null,n)),v(n,"error",t[27])],s=1)},p(t,o){(!i||2&o[0]&&e!==(e=t[8].sizes||t[1]+"px"))&&w(n,"sizes",e)},i(t){i||(o&&o.end(1),i=1)},o(t){o=V(n,it,{}),i=0},d(t){t&&h(n),t&&o&&o.end(),s=0,r(c)}}}function yt(t){let n,e;return n=new vt({P:{j:t[7],loaded:t[2]}}),{c(){Z(n.u.l)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};4&e[0]&&(o.loaded=t[2]),n.C(o)},i(t){e||(G(n.u.l,t),e=1)},o(t){H(n.u.l,t),e=0},d(t){nt(n,t)}}}function $t(t){let n,e,o,i,s,c,l=`translate3d(${t[0][0]/-2+t[6][0]}px, ${t[0][1]/-2+t[6][1]}px, 0)`,a=t[2]&&wt(t),p=t[3]&&yt(t);return{c(){n=g("div"),e=g("div"),a&&a.c(),o=x(),p&&p.c(),w(e,"class","bp-img"),y(e,"width",t[0][0]+"px"),y(e,"height",t[0][1]+"px"),$(e,"bp-drag",t[4]),$(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),y(e,"background-image",dt(t[7])),y(e,"transform",l),w(n,"class","bp-img-wrap"),$(n,"bp-close",t[5])},m(r,l){b(r,n,l),m(n,e),a&&a.m(e,null),m(e,o),p&&p.m(e,null),i=1,s||(c=[u(t[20].call(null,e)),v(n,"wheel",t[15]),v(n,"pointerdown",t[16]),v(n,"pointermove",t[17]),v(n,"pointerup",t[19]),v(n,"pointercancel",t[18])],s=1)},p(t,r){t[2]?a?(a.p(t,r),4&r[0]&&G(a,1)):(a=wt(t),a.c(),G(a,1),a.m(e,o)):a&&(Y(),H(a,1,1,(()=>{a=null})),B()),t[3]?p?(p.p(t,r),8&r[0]&&G(p,1)):(p=yt(t),p.c(),G(p,1),p.m(e,null)):p&&(Y(),H(p,1,1,(()=>{p=null})),B()),(!i||1&r[0])&&y(e,"width",t[0][0]+"px"),(!i||1&r[0])&&y(e,"height",t[0][1]+"px"),(!i||16&r[0])&&$(e,"bp-drag",t[4]),(!i||6145&r[0])&&$(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),65&r[0]&&l!==(l=`translate3d(${t[0][0]/-2+t[6][0]}px, ${t[0][1]/-2+t[6][1]}px, 0)`)&&y(e,"transform",l),(!i||32&r[0])&&$(n,"bp-close",t[5])},i(t){i||(G(a),G(p),i=1)},o(t){H(a),H(p),i=0},d(t){t&&h(n),a&&a.d(),p&&p.d(),s=0,r(c)}}}function kt(t,n,e){let o,r,i,s;c(t,at,(t=>e(26,i=t)));let{P:u}=n,{q:l}=n,{j:a,F:p,J:f,next:d,zoomed:m,container:b}=u;c(t,m,(t=>e(25,o=t)));let h,g,x,v,w,y,$,k,_,M,S,z=a.maxZoom||p.maxZoom||10,I=u.D(a),P=I[0],A=0;const T=+a.width,N=[],O=new Map,C=lt(I,ft(400));c(t,C,(t=>e(0,s=t)));const E=lt([0,0],ft(400));c(t,E,(t=>e(6,r=t)));const R=([t,n],o=s)=>{const r=(o[0]-b.w)/2,i=(o[1]-b.h)/2;return 0>r?t=0:t>r?l?(t=w?r+(t-r)/10:r)>r+20&&e(4,w=f()):t=r:-r>t&&(l?-r-20>(t=w?-r-(-r-t)/10:-r)&&e(4,w=d()):t=-r),0>i?n=0:n>i?n=i:-i>n&&(n=-i),[t,n]};function j(t=z,n){if(i)return;const o=I[0]*z;let c=s[0]+s[0]*t,u=s[1]+s[1]*t;if(t>0)c>o&&(c=o,u=I[1]*z),c>T&&(c=T,u=+a.height);else if(I[0]>c)return C.set(I),E.set([0,0]);let{x:l,y:p,width:f,height:d}=v.getBoundingClientRect();const m=n?n.clientX-l-f/2:0,b=n?n.clientY-p-d/2:0;l=c/f*-m+m,p=u/d*-b+b;const h=[c,u];C.set(h).then((()=>{e(1,P=Math.round(Math.max(P,c)))})),E.set(R([r[0]+l,r[1]+p],h))}Object.defineProperty(a,"zoom",{configurable:1,get(){return o},set(t){return j(t?z:-z)}});const q=t=>O.delete(t.pointerId);return t.R=t=>{"q"in t&&e(23,l=t.q)},t.u.update=()=>{if(16777217&t.u.v[0]&&m.set(s[0]-10>I[0]),117440512&t.u.v[0]&&i&&o&&!p.intro){const t=ft(480);E.set([0,0],t),C.set(I,t),e(5,S=1)}},[s,P,h,g,w,S,r,a,p,m,b,z,T,C,E,t=>{p.inline&&!o||(t.preventDefault(),j(t.deltaY/-300,t))},t=>{2!==t.button&&(t.preventDefault(),e(4,w=1),O.set(t.pointerId,t),$=t.clientX,k=t.clientY,_=r[0],M=r[1])},t=>{if(O.size>1)return e(4,w=0),p.noPinch?.(b.el)||(t=>{const[n,e]=O.set(t.pointerId,t).values(),o=Math.hypot(n.clientX-e.clientX,n.clientY-e.clientY);x=x||{clientX:(n.clientX+e.clientX)/2,clientY:(n.clientY+e.clientY)/2},j(((A||o)-o)/-35,x),A=o})(t);if(!w)return;let n=t.clientX,r=t.clientY;y=N.push({x:n,y:r})>2,n-=$,r-=k,o||(-90>r&&e(4,w=!p.noClose&&u.close()),30>Math.abs(r)&&(n>40&&e(4,w=f()),-40>n&&e(4,w=d()))),o&&y&&!i&&E.set(R([_+n,M+r]),{duration:0})},q,function(t){if(q(t),x&&(e(4,w=A=0),x=O.size?x:null),w){if(e(4,w=0),t.target===this&&!p.noClose)return u.close();if(y){const[t,n,e]=N.slice(-3);Math.hypot(n.x-e.x,n.y-e.y)>5&&E.set(R([r[0]-5*(t.x-e.x),r[1]-5*(t.y-e.y)]))}else p.onImageClick?.(b.el,a)||j(o?-z:z,t);y=0,N.length=0}},t=>{v=t,u.K((()=>{e(24,I=u.D(a)),!p.inline&&l||(C.set(I),E.set([0,0]))})),u.L(a).then((()=>{e(2,h=1),u.W()})),setTimeout((()=>{e(3,g=!h)}),250)},t=>{mt(t,a.attr),t.srcset=a.img},u,l,I,o,i,t=>p.onError?.(b,a,t)]}class _t extends ot{constructor(t){super(),et(this,t,kt,$t,s,{P:22,q:23},null,[-1,-1])}}function Mt(t){let n,e,o,i,s,c;return o=new vt({P:{j:t[2],loaded:t[0]}}),{c(){n=g("div"),e=g("iframe"),Z(o.u.l),w(e,"allow","autoplay; fullscreen"),w(e,"title",t[2].title),w(n,"class","bp-if"),y(n,"width",t[1][0]+"px"),y(n,"height",t[1][1]+"px")},m(r,l){b(r,n,l),m(n,e),tt(o,n,null),i=1,s||(c=[u(t[3].call(null,e)),v(e,"load",t[5])],s=1)},p(t,[e]){const r={};1&e&&(r.loaded=t[0]),o.C(r),(!i||2&e)&&y(n,"width",t[1][0]+"px"),(!i||2&e)&&y(n,"height",t[1][1]+"px")},i(t){i||(G(o.u.l,t),i=1)},o(t){H(o.u.l,t),i=0},d(t){t&&h(n),nt(o),s=0,r(c)}}}function St(t,n,e){let o,r,{P:i}=n;const{j:s}=i,c=()=>e(1,r=i.D(s));return c(),i.K(c),[o,r,s,t=>{mt(t,s.attr),t.src=s.iframe},i,()=>e(0,o=1)]}class zt extends ot{constructor(t){super(),et(this,t,St,Mt,s,{P:4})}}function It(t){let n,e,o,r,i;return e=new vt({P:{j:t[2],loaded:t[0]}}),{c(){n=g("div"),Z(e.u.l),w(n,"class","bp-vid"),y(n,"width",t[1][0]+"px"),y(n,"height",t[1][1]+"px"),y(n,"background-image",dt(t[2]))},m(s,c){b(s,n,c),tt(e,n,null),o=1,r||(i=u(t[3].call(null,n)),r=1)},p(t,[r]){const i={};1&r&&(i.loaded=t[0]),e.C(i),(!o||2&r)&&y(n,"width",t[1][0]+"px"),(!o||2&r)&&y(n,"height",t[1][1]+"px")},i(t){o||(G(e.u.l,t),o=1)},o(t){H(e.u.l,t),o=0},d(t){t&&h(n),nt(e),r=0,i()}}}function Pt(t,n,e){let o,r,{P:i}=n;const{j:s,F:c,container:u}=i,l=()=>e(1,r=i.D(s));return l(),i.K(l),[o,r,s,t=>{let n;const r=(t,e)=>{Array.isArray(e)||(e=JSON.parse(e));for(const o of e){n||(n=g(o.type?.includes("audio")?"audio":"video"),mt(n,{controls:1,autoplay:1,playsinline:1,tabindex:"0"}),mt(n,s.attr));const e=g(t);mt(e,o),"source"==t&&v(e,"error",(t=>c.onError?.(u,s,t))),m(n,e)}};r("source",s.sources),r("track",s.tracks||[]),v(n,"canplay",(()=>e(0,o=1))),m(t,n)},i]}class At extends ot{constructor(t){super(),et(this,t,Pt,It,s,{P:4})}}function Tt(n){let e,o,i,c,l,a,p,f,d,x=n[6].i,y=jt(n),k=n[0].length>1&&qt(n);return{c(){e=g("div"),o=g("div"),y.c(),c=g("div"),l=g("button"),k&&k.c(),w(l,"class","bp-x"),w(l,"title","Close"),w(l,"aria-label","Close"),w(c,"class","bp-controls"),w(e,"class","bp-wrap"),$(e,"bp-zoomed",n[10]),$(e,"bp-inline",n[8]),$(e,"bp-small",n[7]),$(e,"bp-noclose",n[5].noClose)},m(t,r){b(t,e,r),m(e,o),y.m(e,null),m(e,c),m(c,l),k&&k.m(c,null),p=1,f||(d=[v(l,"click",n[1]),u(n[14].call(null,e))],f=1)},p(n,o){64&o[0]&&s(x,x=n[6].i)?(Y(),H(y,1,1,t),B(),y=jt(n),y.c(),G(y,1),y.m(e,c)):y.p(n,o),n[0].length>1?k?k.p(n,o):(k=qt(n),k.c(),k.m(c,null)):k&&(k.d(1),k=null),(!p||1024&o[0])&&$(e,"bp-zoomed",n[10]),(!p||256&o[0])&&$(e,"bp-inline",n[8]),(!p||128&o[0])&&$(e,"bp-small",n[7]),(!p||32&o[0])&&$(e,"bp-noclose",n[5].noClose)},i(t){p||(i&&i.end(1),G(y),a&&a.end(1),p=1)},o(t){t&&(i=V(o,it,{duration:480})),H(y),t&&(a=V(c,it,{})),p=0},d(t){t&&h(e),t&&i&&i.end(),y.d(t),k&&k.d(),t&&a&&a.end(),f=0,r(d)}}}function Nt(n){let e,o=(n[6].html??n[6].element.outerHTML)+"";return{c(){e=g("div"),w(e,"class","bp-html")},m(t,n){b(t,e,n),e.innerHTML=o},p(t,n){64&n[0]&&o!==(o=(t[6].html??t[6].element.outerHTML)+"")&&(e.innerHTML=o)},i:t,o:t,d(t){t&&h(e)}}}function Ot(n){let e,o;return e=new zt({P:{P:n[13]()}}),{c(){Z(e.u.l)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.u.l,t),o=1)},o(t){H(e.u.l,t),o=0},d(t){nt(e,t)}}}function Ct(n){let e,o;return e=new At({P:{P:n[13]()}}),{c(){Z(e.u.l)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.u.l,t),o=1)},o(t){H(e.u.l,t),o=0},d(t){nt(e,t)}}}function Et(t){let n,e;return n=new _t({P:{P:t[13](),q:t[7]}}),{c(){Z(n.u.l)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};128&e[0]&&(o.q=t[7]),n.C(o)},i(t){e||(G(n.u.l,t),e=1)},o(t){H(n.u.l,t),e=0},d(t){nt(n,t)}}}function Rt(t){let n,e,o,r=t[6].caption+"";return{c(){n=g("div"),w(n,"class","bp-cap")},m(t,e){b(t,n,e),n.innerHTML=r,o=1},p(t,e){(!o||64&e[0])&&r!==(r=t[6].caption+"")&&(n.innerHTML=r)},i(t){o||(e&&e.end(1),o=1)},o(t){e=V(n,it,{duration:200}),o=0},d(t){t&&h(n),t&&e&&e.end()}}}function jt(t){let n,e,o,i,s,c,u,l,a;const p=[Et,Ct,Ot,Nt],f=[];function d(t,n){return t[6].img?0:t[6].sources?1:t[6].iframe?2:3}e=d(t),o=f[e]=p[e](t);let m=t[6].caption&&Rt(t);return{c(){n=g("div"),o.c(),m&&m.c(),c=x(),w(n,"class","bp-inner")},m(o,r){b(o,n,r),f[e].m(n,null),m&&m.m(o,r),b(o,c,r),u=1,l||(a=[v(n,"pointerdown",t[20]),v(n,"pointerup",t[21])],l=1)},p(t,r){let i=e;e=d(t),e===i?f[e].p(t,r):(Y(),H(f[i],1,1,(()=>{f[i]=null})),B(),o=f[e],o?o.p(t,r):(o=f[e]=p[e](t),o.c()),G(o,1),o.m(n,null)),t[6].caption?m?(m.p(t,r),64&r[0]&&G(m,1)):(m=Rt(t),m.c(),G(m,1),m.m(c.parentNode,c)):m&&(Y(),H(m,1,1,(()=>{m=null})),B())},i(e){u||(G(o),R((()=>{s&&s.end(1),i=U(n,t[12],1),i.start()})),G(m),u=1)},o(e){H(o),i&&i.S(),s=V(n,t[12],0),H(m),u=0},d(t){t&&h(n),f[e].d(),t&&s&&s.end(),m&&m.d(t),t&&h(c),l=0,r(a)}}}function qt(t){let n,e,o,i,s,c=`${t[4]+1} / ${t[0].length}`;return{c(){n=g("div"),e=g("button"),o=g("button"),w(n,"class","bp-count"),w(e,"class","bp-prev"),w(e,"title","Previous"),w(e,"aria-label","Previous"),w(o,"class","bp-next"),w(o,"title","Next"),w(o,"aria-label","Next")},m(r,u){b(r,n,u),n.innerHTML=c,b(r,e,u),b(r,o,u),i||(s=[v(e,"click",t[2]),v(o,"click",t[3])],i=1)},p(t,e){17&e[0]&&c!==(c=`${t[4]+1} / ${t[0].length}`)&&(n.innerHTML=c)},d(t){t&&h(n),t&&h(e),t&&h(o),i=0,r(s)}}}function Ft(t){let n,e,o=t[0]&&Tt(t);return{c(){o&&o.c(),n=x()},m(t,r){o&&o.m(t,r),b(t,n,r),e=1},p(t,e){t[0]?o?(o.p(t,e),1&e[0]&&G(o,1)):(o=Tt(t),o.c(),G(o,1),o.m(n.parentNode,n)):o&&(Y(),H(o,1,1,(()=>{o=null})),B())},i(t){e||(G(o),e=1)},o(t){H(o),e=0},d(t){o&&o.d(t),t&&h(n)}}}function Jt(t,n,e){let o,{items:r}=n,{target:i}=n;const s=document.documentElement;let u,l,a,p,f,d,m,b,h;const x=()=>!h.img&&!h.sources&&!h.iframe;let w;const y=t=>w=t,$={},k=ct(0);c(t,k,(t=>e(10,o=t)));const _=()=>{l.onClose?.($.el,h),at.set(1),e(0,r=null),p?.focus({preventScroll:1})},M=()=>z(u-1),S=()=>z(u+1),z=t=>{m=t-u,e(4,u=I(t))},I=t=>(t+r.length)%r.length,P=t=>{const{key:n,shiftKey:e}=t;if("Escape"===n)!l.noClose&&_();else if("ArrowRight"===n)S();else if("ArrowLeft"===n)M();else if("Tab"===n){const{activeElement:n}=document;if(e||!n.controls){t.preventDefault();const{focusWrap:o=$.el}=l,r=[...o.querySelectorAll("*")].filter((t=>t.tabIndex>=0));let i=r.indexOf(n);i+=r.length+(e?-1:1),r[i%r.length].focus()}}},A=({width:t=1920,height:n=1080})=>{const{scale:e=.99}=l,o=Math.min(1,$.w/t*e,$.h/n*e);return[Math.round(t*o),Math.round(n*o)]},T=()=>{if(r){const t=r[I(u+1)],n=r[I(u-1)];!t.preload&&N(t),!n.preload&&N(n)}},N=t=>{if(t.img){const n=g("img");return n.sizes=l.sizes||A(t)[0]+"px",n.srcset=t.img,t.preload=1,n.decode().catch((t=>{}))}};return t.R=t=>{"items"in t&&e(0,r=t.items),"target"in t&&e(15,i=t.target)},t.u.update=()=>{786545&t.u.v[0]&&r&&(e(6,h=r[u]),a&&l.onUpdate?.($.el,h))},[r,_,M,S,u,l,h,f,d,b,o,k,(t,n)=>a&&r?it(t,{x:(m>0?20:-20)*(n?1:-1),duration:250}):(e(18,a=n),l.intro?it(t,{y:n?10:-10}):(t=>{let n;if(x()){const e=t.firstChild.firstChild;n=[e.clientWidth,e.clientHeight]}else n=A(h);const e=(h.element||p).getBoundingClientRect(),o=e.left-($.w-e.width)/2,r=e.top-($.h-e.height)/2,i=e.width/n[0],s=e.height/n[1];return{duration:480,_:rt,css:(t,n)=>`transform:translate3d(${o*n}px, ${r*n}px, 0) scale3d(${i+t*(1-i)}, ${s+t*(1-s)}, 1)`}})(t)),()=>({j:h,D:A,L:N,W:T,F:l,J:M,next:S,close:_,K:y,zoomed:k,container:$}),t=>{let n,o;e(19,$.el=t,$),l.onOpen?.($.el,h),d||(n=v(globalThis,"keydown",P));const r=new ResizeObserver((t=>{o&&(e(19,$.w=t[0].contentRect.width,$),e(19,$.h=t[0].contentRect.height,$),e(7,f=769>$.w),x()||w?.(),l.onResize?.($.el,h)),o=1}));return r.observe(t),{destroy(){r.disconnect(),n?.(),at.set(0),s.classList.remove("bp-lock"),l.onClosed?.()}}},i,t=>{e(5,l=t),e(8,d=l.inline);const n=l.items;!d&&s.scrollHeight>s.clientHeight&&s.classList.add("bp-lock"),p=document.activeElement,e(19,$.w=i.offsetWidth,$),e(19,$.h=i===document.body?globalThis.innerHeight:i.clientHeight,$),e(7,f=769>$.w),e(4,u=l.position||0),e(0,r=Array.isArray(n)?n.map(((t,n)=>(l.el&&l.el===t.element&&e(4,u=n),{i:n,...t}))):(n.length?[...n]:[n]).map(((t,n)=>(l.el===t&&e(4,u=n),{element:t,i:n,...t.dataset}))))},z,a,$,t=>e(9,b=t.target),function(t){2!==t.button&&t.target===this&&b===this&&!l.noClose&&_()}]}class Dt extends ot{constructor(t){super(),et(this,t,Jt,Ft,s,{items:0,target:15,open:16,close:1,J:2,next:3,setPosition:17},null,[-1,-1])}get items(){return this.u.$[0]}get target(){return this.u.$[15]}get open(){return this.u.$[16]}get close(){return this.u.$[1]}get J(){return this.u.$[2]}get next(){return this.u.$[3]}get setPosition(){return this.u.$[17]}}function Kt(t){return new Dt({...t,P:t})}export{Kt as default}; diff --git a/dist/bigger-picture.mjs b/dist/bigger-picture.mjs index 5521e5e..28a2eee 100644 --- a/dist/bigger-picture.mjs +++ b/dist/bigger-picture.mjs @@ -699,7 +699,25 @@ const defaultTweenOptions = (duration) => ({ const getThumbBackground = (activeItem) => !activeItem.thumb || `url(${activeItem.thumb})`; -/* src/components/loading.svelte generated by Svelte v3.47.0 */ +/** + * Adds attributes to the given node based on the provided object. + * + * @param {HTMLElement} node - The node to which attributes will be added + * @param {Record | string} obj - The object containing key-value pairs of attributes to be added + */ +const addAttributes = (node, obj) => { + if (!obj) { + return + } + if (typeof obj === 'string') { + obj = JSON.parse(obj); + } + for (const key in obj) { + node.setAttribute(key, obj[key]); + } +}; + +/* src/components/loading.svelte generated by Svelte v3.55.1 */ function create_if_block_1$2(ctx) { let div; @@ -873,13 +891,11 @@ class Loading extends SvelteComponent { } } -/* src/components/image.svelte generated by Svelte v3.47.0 */ +/* src/components/image.svelte generated by Svelte v3.55.1 */ function create_if_block_1$1(ctx) { let img; - let img_srcset_value; let img_sizes_value; - let img_alt_value; let img_outro; let current; let mounted; @@ -888,16 +904,19 @@ function create_if_block_1$1(ctx) { return { c() { img = element("img"); - attr(img, "srcset", img_srcset_value = /*activeItem*/ ctx[7].img); attr(img, "sizes", img_sizes_value = /*opts*/ ctx[8].sizes || `${/*sizes*/ ctx[1]}px`); - attr(img, "alt", img_alt_value = /*activeItem*/ ctx[7].alt); + attr(img, "alt", /*activeItem*/ ctx[7].alt); }, m(target, anchor) { insert(target, img, anchor); current = true; if (!mounted) { - dispose = listen(img, "error", /*error_handler*/ ctx[26]); + dispose = [ + action_destroyer(/*addSrc*/ ctx[21].call(null, img)), + listen(img, "error", /*error_handler*/ ctx[27]) + ]; + mounted = true; } }, @@ -919,12 +938,12 @@ function create_if_block_1$1(ctx) { if (detaching) detach(img); if (detaching && img_outro) img_outro.end(); mounted = false; - dispose(); + run_all(dispose); } }; } -// (374:10) {#if showLoader} +// (384:10) {#if showLoader} function create_if_block$1(ctx) { let loading; let current; @@ -1068,11 +1087,11 @@ function create_fragment$3(ctx) { set_style(div0, "height", /*$imageDimensions*/ ctx[0][1] + "px"); } - if (dirty[0] & /*pointerDown*/ 16) { + if (!current || dirty[0] & /*pointerDown*/ 16) { toggle_class(div0, "bp-drag", /*pointerDown*/ ctx[4]); } - if (dirty[0] & /*maxZoom, $imageDimensions, naturalWidth*/ 6145) { + if (!current || dirty[0] & /*maxZoom, $imageDimensions, naturalWidth*/ 6145) { toggle_class(div0, "bp-canzoom", /*maxZoom*/ ctx[11] > 1 && /*$imageDimensions*/ ctx[0][0] < /*naturalWidth*/ ctx[12]); } @@ -1080,7 +1099,7 @@ function create_fragment$3(ctx) { set_style(div0, "transform", style_transform); } - if (dirty[0] & /*closingWhileZoomed*/ 32) { + if (!current || dirty[0] & /*closingWhileZoomed*/ 32) { toggle_class(div1, "bp-close", /*closingWhileZoomed*/ ctx[5]); } }, @@ -1110,11 +1129,11 @@ function instance$3($$self, $$props, $$invalidate) { let $zoomDragTranslate; let $closing; let $imageDimensions; - component_subscribe($$self, closing, $$value => $$invalidate(25, $closing = $$value)); + component_subscribe($$self, closing, $$value => $$invalidate(26, $closing = $$value)); let { props } = $$props; let { smallScreen } = $$props; let { activeItem, opts, prev, next, zoomed, container } = props; - component_subscribe($$self, zoomed, value => $$invalidate(24, $zoomed = value)); + component_subscribe($$self, zoomed, value => $$invalidate(25, $zoomed = value)); let maxZoom = activeItem.maxZoom || opts.maxZoom || 10; let calculatedDimensions = props.calculateDimensions(activeItem); @@ -1429,7 +1448,7 @@ function instance$3($$self, $$props, $$invalidate) { // handle globalThis resize props.setResizeFunc(() => { - $$invalidate(23, calculatedDimensions = props.calculateDimensions(activeItem)); + $$invalidate(24, calculatedDimensions = props.calculateDimensions(activeItem)); // adjust image size / zoom on resize, but not on mobile because // some browsers (ios safari 15) constantly resize screen on drag @@ -1454,19 +1473,24 @@ function instance$3($$self, $$props, $$invalidate) { ); }; + const addSrc = node => { + addAttributes(node, activeItem.attr); + node.srcset = activeItem.img; + }; + const error_handler = error => opts.onError?.(container, activeItem, error); $$self.$$set = $$props => { - if ('smallScreen' in $$props) $$invalidate(22, smallScreen = $$props.smallScreen); + if ('smallScreen' in $$props) $$invalidate(23, smallScreen = $$props.smallScreen); }; $$self.$$.update = () => { - if ($$self.$$.dirty[0] & /*$imageDimensions, calculatedDimensions*/ 8388609) { + if ($$self.$$.dirty[0] & /*$imageDimensions, calculatedDimensions*/ 16777217) { zoomed.set($imageDimensions[0] - 10 > calculatedDimensions[0]); } - if ($$self.$$.dirty[0] & /*$closing, $zoomed, calculatedDimensions*/ 58720256) { + if ($$self.$$.dirty[0] & /*$closing, $zoomed, calculatedDimensions*/ 117440512) { // if zoomed while closing, zoom out image and add class // to change contain value on .bp-wrap to avoid cropping if ($closing && $zoomed && !opts.intro) { @@ -1500,6 +1524,7 @@ function instance$3($$self, $$props, $$invalidate) { removeEventFromCache, onPointerUp, onMount, + addSrc, props, smallScreen, calculatedDimensions, @@ -1512,11 +1537,11 @@ function instance$3($$self, $$props, $$invalidate) { class Image extends SvelteComponent { constructor(options) { super(); - init(this, options, instance$3, create_fragment$3, not_equal, { props: 21, smallScreen: 22 }, null, [-1, -1]); + init(this, options, instance$3, create_fragment$3, not_equal, { props: 22, smallScreen: 23 }, null, [-1, -1]); } } -/* src/components/iframe.svelte generated by Svelte v3.47.0 */ +/* src/components/iframe.svelte generated by Svelte v3.55.1 */ function create_fragment$2(ctx) { let div; @@ -1598,8 +1623,10 @@ function instance$2($$self, $$props, $$invalidate) { setDimensions(); props.setResizeFunc(setDimensions); - // add src ourselves to avoid src_url_equal call (svelte stuff) - const addSrc = node => node.src = activeItem.iframe; + const addSrc = node => { + addAttributes(node, activeItem.attr); + node.src = activeItem.iframe; + }; const load_handler = () => $$invalidate(0, loaded = true); @@ -1615,7 +1642,7 @@ class Iframe extends SvelteComponent { } } -/* src/components/video.svelte generated by Svelte v3.47.0 */ +/* src/components/video.svelte generated by Svelte v3.55.1 */ function create_fragment$1(ctx) { let div; @@ -1689,13 +1716,6 @@ function instance$1($$self, $$props, $$invalidate) { setDimensions(); props.setResizeFunc(setDimensions); - /** adds attributes to a node */ - const addAttributes = (node, obj) => { - for (const key in obj) { - attr(node, key, obj[key]); - } - }; - /** create audo / video element */ const onMount = node => { let mediaElement; @@ -1717,6 +1737,8 @@ function instance$1($$self, $$props, $$invalidate) { playsinline: true, tabindex: '0' }); + + addAttributes(mediaElement, activeItem.attr); } // add sources / tracks to media element @@ -1750,7 +1772,7 @@ class Video extends SvelteComponent { } } -/* src/bigger-picture.svelte generated by Svelte v3.47.0 */ +/* src/bigger-picture.svelte generated by Svelte v3.55.1 */ function create_if_block(ctx) { let div2; @@ -1760,7 +1782,6 @@ function create_if_block(ctx) { let div1; let button; let div1_outro; - let containerActions_action; let current; let mounted; let dispose; @@ -1797,7 +1818,7 @@ function create_if_block(ctx) { if (!mounted) { dispose = [ listen(button, "click", /*close*/ ctx[1]), - action_destroyer(containerActions_action = /*containerActions*/ ctx[14].call(null, div2)) + action_destroyer(/*containerActions*/ ctx[14].call(null, div2)) ]; mounted = true; @@ -1810,7 +1831,7 @@ function create_if_block(ctx) { check_outros(); key_block = create_key_block(ctx); key_block.c(); - transition_in(key_block); + transition_in(key_block, 1); key_block.m(div2, div1); } else { key_block.p(ctx, dirty); @@ -1829,19 +1850,19 @@ function create_if_block(ctx) { if_block = null; } - if (dirty[0] & /*$zoomed*/ 1024) { + if (!current || dirty[0] & /*$zoomed*/ 1024) { toggle_class(div2, "bp-zoomed", /*$zoomed*/ ctx[10]); } - if (dirty[0] & /*inline*/ 256) { + if (!current || dirty[0] & /*inline*/ 256) { toggle_class(div2, "bp-inline", /*inline*/ ctx[8]); } - if (dirty[0] & /*smallScreen*/ 128) { + if (!current || dirty[0] & /*smallScreen*/ 128) { toggle_class(div2, "bp-small", /*smallScreen*/ ctx[7]); } - if (dirty[0] & /*opts*/ 32) { + if (!current || dirty[0] & /*opts*/ 32) { toggle_class(div2, "bp-noclose", /*opts*/ ctx[5].noClose); } }, diff --git a/dist/bigger-picture.umd.js b/dist/bigger-picture.umd.js index 716a1b3..3b6d4f9 100644 --- a/dist/bigger-picture.umd.js +++ b/dist/bigger-picture.umd.js @@ -704,7 +704,25 @@ const getThumbBackground = (activeItem) => !activeItem.thumb || `url(${activeItem.thumb})`; - /* src/components/loading.svelte generated by Svelte v3.47.0 */ + /** + * Adds attributes to the given node based on the provided object. + * + * @param {HTMLElement} node - The node to which attributes will be added + * @param {Record | string} obj - The object containing key-value pairs of attributes to be added + */ + const addAttributes = (node, obj) => { + if (!obj) { + return + } + if (typeof obj === 'string') { + obj = JSON.parse(obj); + } + for (const key in obj) { + node.setAttribute(key, obj[key]); + } + }; + + /* src/components/loading.svelte generated by Svelte v3.55.1 */ function create_if_block_1$2(ctx) { let div; @@ -878,13 +896,11 @@ } } - /* src/components/image.svelte generated by Svelte v3.47.0 */ + /* src/components/image.svelte generated by Svelte v3.55.1 */ function create_if_block_1$1(ctx) { let img; - let img_srcset_value; let img_sizes_value; - let img_alt_value; let img_outro; let current; let mounted; @@ -893,16 +909,19 @@ return { c() { img = element("img"); - attr(img, "srcset", img_srcset_value = /*activeItem*/ ctx[7].img); attr(img, "sizes", img_sizes_value = /*opts*/ ctx[8].sizes || `${/*sizes*/ ctx[1]}px`); - attr(img, "alt", img_alt_value = /*activeItem*/ ctx[7].alt); + attr(img, "alt", /*activeItem*/ ctx[7].alt); }, m(target, anchor) { insert(target, img, anchor); current = true; if (!mounted) { - dispose = listen(img, "error", /*error_handler*/ ctx[26]); + dispose = [ + action_destroyer(/*addSrc*/ ctx[21].call(null, img)), + listen(img, "error", /*error_handler*/ ctx[27]) + ]; + mounted = true; } }, @@ -924,12 +943,12 @@ if (detaching) detach(img); if (detaching && img_outro) img_outro.end(); mounted = false; - dispose(); + run_all(dispose); } }; } - // (374:10) {#if showLoader} + // (384:10) {#if showLoader} function create_if_block$1(ctx) { let loading; let current; @@ -1073,11 +1092,11 @@ set_style(div0, "height", /*$imageDimensions*/ ctx[0][1] + "px"); } - if (dirty[0] & /*pointerDown*/ 16) { + if (!current || dirty[0] & /*pointerDown*/ 16) { toggle_class(div0, "bp-drag", /*pointerDown*/ ctx[4]); } - if (dirty[0] & /*maxZoom, $imageDimensions, naturalWidth*/ 6145) { + if (!current || dirty[0] & /*maxZoom, $imageDimensions, naturalWidth*/ 6145) { toggle_class(div0, "bp-canzoom", /*maxZoom*/ ctx[11] > 1 && /*$imageDimensions*/ ctx[0][0] < /*naturalWidth*/ ctx[12]); } @@ -1085,7 +1104,7 @@ set_style(div0, "transform", style_transform); } - if (dirty[0] & /*closingWhileZoomed*/ 32) { + if (!current || dirty[0] & /*closingWhileZoomed*/ 32) { toggle_class(div1, "bp-close", /*closingWhileZoomed*/ ctx[5]); } }, @@ -1115,11 +1134,11 @@ let $zoomDragTranslate; let $closing; let $imageDimensions; - component_subscribe($$self, closing, $$value => $$invalidate(25, $closing = $$value)); + component_subscribe($$self, closing, $$value => $$invalidate(26, $closing = $$value)); let { props } = $$props; let { smallScreen } = $$props; let { activeItem, opts, prev, next, zoomed, container } = props; - component_subscribe($$self, zoomed, value => $$invalidate(24, $zoomed = value)); + component_subscribe($$self, zoomed, value => $$invalidate(25, $zoomed = value)); let maxZoom = activeItem.maxZoom || opts.maxZoom || 10; let calculatedDimensions = props.calculateDimensions(activeItem); @@ -1434,7 +1453,7 @@ // handle globalThis resize props.setResizeFunc(() => { - $$invalidate(23, calculatedDimensions = props.calculateDimensions(activeItem)); + $$invalidate(24, calculatedDimensions = props.calculateDimensions(activeItem)); // adjust image size / zoom on resize, but not on mobile because // some browsers (ios safari 15) constantly resize screen on drag @@ -1459,19 +1478,24 @@ ); }; + const addSrc = node => { + addAttributes(node, activeItem.attr); + node.srcset = activeItem.img; + }; + const error_handler = error => opts.onError?.(container, activeItem, error); $$self.$$set = $$props => { - if ('smallScreen' in $$props) $$invalidate(22, smallScreen = $$props.smallScreen); + if ('smallScreen' in $$props) $$invalidate(23, smallScreen = $$props.smallScreen); }; $$self.$$.update = () => { - if ($$self.$$.dirty[0] & /*$imageDimensions, calculatedDimensions*/ 8388609) { + if ($$self.$$.dirty[0] & /*$imageDimensions, calculatedDimensions*/ 16777217) { zoomed.set($imageDimensions[0] - 10 > calculatedDimensions[0]); } - if ($$self.$$.dirty[0] & /*$closing, $zoomed, calculatedDimensions*/ 58720256) { + if ($$self.$$.dirty[0] & /*$closing, $zoomed, calculatedDimensions*/ 117440512) { // if zoomed while closing, zoom out image and add class // to change contain value on .bp-wrap to avoid cropping if ($closing && $zoomed && !opts.intro) { @@ -1505,6 +1529,7 @@ removeEventFromCache, onPointerUp, onMount, + addSrc, props, smallScreen, calculatedDimensions, @@ -1517,11 +1542,11 @@ class Image extends SvelteComponent { constructor(options) { super(); - init(this, options, instance$3, create_fragment$3, not_equal, { props: 21, smallScreen: 22 }, null, [-1, -1]); + init(this, options, instance$3, create_fragment$3, not_equal, { props: 22, smallScreen: 23 }, null, [-1, -1]); } } - /* src/components/iframe.svelte generated by Svelte v3.47.0 */ + /* src/components/iframe.svelte generated by Svelte v3.55.1 */ function create_fragment$2(ctx) { let div; @@ -1603,8 +1628,10 @@ setDimensions(); props.setResizeFunc(setDimensions); - // add src ourselves to avoid src_url_equal call (svelte stuff) - const addSrc = node => node.src = activeItem.iframe; + const addSrc = node => { + addAttributes(node, activeItem.attr); + node.src = activeItem.iframe; + }; const load_handler = () => $$invalidate(0, loaded = true); @@ -1620,7 +1647,7 @@ } } - /* src/components/video.svelte generated by Svelte v3.47.0 */ + /* src/components/video.svelte generated by Svelte v3.55.1 */ function create_fragment$1(ctx) { let div; @@ -1694,13 +1721,6 @@ setDimensions(); props.setResizeFunc(setDimensions); - /** adds attributes to a node */ - const addAttributes = (node, obj) => { - for (const key in obj) { - attr(node, key, obj[key]); - } - }; - /** create audo / video element */ const onMount = node => { let mediaElement; @@ -1722,6 +1742,8 @@ playsinline: true, tabindex: '0' }); + + addAttributes(mediaElement, activeItem.attr); } // add sources / tracks to media element @@ -1755,7 +1777,7 @@ } } - /* src/bigger-picture.svelte generated by Svelte v3.47.0 */ + /* src/bigger-picture.svelte generated by Svelte v3.55.1 */ function create_if_block(ctx) { let div2; @@ -1765,7 +1787,6 @@ let div1; let button; let div1_outro; - let containerActions_action; let current; let mounted; let dispose; @@ -1802,7 +1823,7 @@ if (!mounted) { dispose = [ listen(button, "click", /*close*/ ctx[1]), - action_destroyer(containerActions_action = /*containerActions*/ ctx[14].call(null, div2)) + action_destroyer(/*containerActions*/ ctx[14].call(null, div2)) ]; mounted = true; @@ -1815,7 +1836,7 @@ check_outros(); key_block = create_key_block(ctx); key_block.c(); - transition_in(key_block); + transition_in(key_block, 1); key_block.m(div2, div1); } else { key_block.p(ctx, dirty); @@ -1834,19 +1855,19 @@ if_block = null; } - if (dirty[0] & /*$zoomed*/ 1024) { + if (!current || dirty[0] & /*$zoomed*/ 1024) { toggle_class(div2, "bp-zoomed", /*$zoomed*/ ctx[10]); } - if (dirty[0] & /*inline*/ 256) { + if (!current || dirty[0] & /*inline*/ 256) { toggle_class(div2, "bp-inline", /*inline*/ ctx[8]); } - if (dirty[0] & /*smallScreen*/ 128) { + if (!current || dirty[0] & /*smallScreen*/ 128) { toggle_class(div2, "bp-small", /*smallScreen*/ ctx[7]); } - if (dirty[0] & /*opts*/ 32) { + if (!current || dirty[0] & /*opts*/ 32) { toggle_class(div2, "bp-noclose", /*opts*/ ctx[5].noClose); } }, diff --git a/package.json b/package.json index c9596ca..37cdf41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bigger-picture", - "version": "1.1.15", + "version": "1.1.16", "type": "module", "exports": { ".": {