@qratilabs/qrati-connect 2.7.0-beta.21 → 2.7.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/element/ApyjFWKp.js +1 -0
- package/element/B4hg-Jzn.js +1 -0
- package/element/{DGuOrd-J.js → Bu-UssyO.js} +3 -3
- package/element/C73GNwh3.js +8 -0
- package/element/CoFGfneL.js +1 -0
- package/element/D8g89do5.js +46 -0
- package/element/DJSvG_Nj.js +4 -0
- package/element/DKsx0Y8e.js +1 -0
- package/element/Dp3VaoZ-.js +3 -0
- package/element/Dp5jqmjn.js +4 -0
- package/element/M8Us9cU9.js +2 -0
- package/element/Nlxbxype.js +19 -0
- package/element/V5NTL9Q8.js +8 -0
- package/element/ts3zQh2I.js +3 -0
- package/element/web.es.js +426 -421
- package/element/zVkCODn-.js +1 -0
- package/package.json +1 -1
- package/react/{BiCzDvPj.js → AapCUC-0.js} +1 -1
- package/react/{BMKU_9Dv.js → BA-rmyyP.js} +1 -1
- package/react/{1Ikk7UFc.js → BFeys-t9.js} +1 -1
- package/react/{DE1Dpj--.js → BJuTpMwr.js} +1 -1
- package/react/{B6PQAfDy.js → BNq5z2O6.js} +1 -1
- package/react/{rdtnGUzO.js → BSqusAcm.js} +1 -1
- package/react/{De1I5osG.js → BWSvzAIN.js} +1 -1
- package/react/{lO7A5UtA.js → CH6vqA5t.js} +1 -1
- package/react/{DBByV_MA.js → CIMTZgx2.js} +1 -1
- package/react/{B4OqjpeZ.js → CMNwX5MM.js} +3 -3
- package/react/{DEml42Wf.js → CRqKn_Cg.js} +1 -1
- package/react/CS1Kg8-a.js +1 -0
- package/react/CWGMt62d.js +1 -0
- package/react/{DZCz7kl3.js → CdVkPkqy.js} +1 -1
- package/react/Cn5QS0_5.js +1 -0
- package/react/Cqdhu1W9.js +1 -0
- package/react/{Bv-1NjQE.js → CwlQ8z66.js} +1 -1
- package/react/{Dnp2RfXx.js → DEsmg9S6.js} +1 -1
- package/react/{DDcelZeN.js → DMmZTL_c.js} +1 -1
- package/react/DSiikjS9.js +1 -0
- package/react/{BjBT1ihN.js → DZ_wJszu.js} +1 -1
- package/react/{DJtDMWy2.js → DsQDSY49.js} +1 -1
- package/react/{Bg0TKkPl.js → DyShHlxS.js} +1 -1
- package/react/K73cs4am.js +1 -0
- package/react/RkYXaQ5u.js +1 -0
- package/react/{BNYjlts5.js → Y9MAVRwK.js} +1 -1
- package/react/{CM-f5bOF.js → bAxGEsnX.js} +1 -1
- package/react/{BSXFijrL.js → bia7_YIN.js} +1 -1
- package/react/index.cjs +1 -1
- package/react/index.mjs +114 -109
- package/umd/web.umd.js +1 -1
- package/element/Bl3RFWpg.js +0 -3
- package/element/Bmvot7Mx.js +0 -3
- package/element/C0wQndW7.js +0 -19
- package/element/CCEtowI9.js +0 -46
- package/element/CUGl86v2.js +0 -8
- package/element/CUfhicE8.js +0 -1
- package/element/DCFrvyiS.js +0 -2
- package/element/DCbRXtK8.js +0 -4
- package/element/DI_rRNLa.js +0 -4
- package/element/dcV4od5T.js +0 -8
- package/react/BarCxWTX.js +0 -1
- /package/element/{CMbOX_GS.js → BAMB7Uoo.js} +0 -0
- /package/element/{C6TX_i0I.js → BzIJspY1.js} +0 -0
- /package/element/{DgGPkDRT.js → CjmNvKgB.js} +0 -0
- /package/element/{BxbCvlCo.js → D1zX23l-.js} +0 -0
- /package/element/{CzSmu5XM.js → DUJAMyRv.js} +0 -0
- /package/element/{CIcND0Dg.js → PPVqva_9.js} +0 -0
- /package/element/{Cdux6g1i.js → tPk8Ov5I.js} +0 -0
- /package/react/{Cdux6g1i.js → BJ85RnFv.js} +0 -0
- /package/react/{BvVjd_UK.js → Bp3BRlhW.js} +0 -0
- /package/react/{BCc5Yj_f.js → BszowxAR.js} +0 -0
- /package/react/{BH8UJKb5.js → BtTYXVAR.js} +0 -0
- /package/react/{DJTeOMQR.js → BvT0jQ3V.js} +0 -0
- /package/react/{BAKN93OB.js → Byq3TC8k.js} +0 -0
- /package/react/{qy2OAEht.js → C5dmblnS.js} +0 -0
- /package/react/{fwmxAw7l.js → D2h6qyms.js} +0 -0
- /package/react/{DlCuoz_e.js → D7BzZEsL.js} +0 -0
- /package/react/{C8D6WaBQ.js → DSaIeQ30.js} +0 -0
- /package/react/{DiysJlOc.js → DYeIUbVU.js} +0 -0
- /package/react/{I7IwY3sd.js → Y-mDLYqW.js} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{D as t,_ as e,g as r,t as n,w as s,y as o}from"./CoFGfneL.js";import{B as i,X as a,g as c,p as l,r as u}from"./D8g89do5.js";import{t as h}from"./zVkCODn-.js";import{a as p,i as d,n as f,o as m,r as g,t as y}from"./V5NTL9Q8.js";var{getOwnPropertyNames:b,getOwnPropertySymbols:w}=Object,{hasOwnProperty:x}=Object.prototype;function k(t,e){return function(r,n,s){return t(r,n,s)&&e(r,n,s)}}function E(t){return function(e,r,n){if(!e||!r||"object"!=typeof e||"object"!=typeof r)return t(e,r,n);const{cache:s}=n,o=s.get(e),i=s.get(r);if(o&&i)return o===r&&i===e;s.set(e,r),s.set(r,e);const a=t(e,r,n);return s.delete(e),s.delete(r),a}}function v(t){return b(t).concat(w(t))}var M=Object.hasOwn||((t,e)=>x.call(t,e));function A(t,e){return t===e||!t&&!e&&t!=t&&e!=e}var{getOwnPropertyDescriptor:C,keys:_}=Object;function j(t,e){return t.byteLength===e.byteLength&&N(new Uint8Array(t),new Uint8Array(e))}function L(t,e,r){let n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function I(t,e){return t.byteLength===e.byteLength&&N(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function O(t,e){return A(t.getTime(),e.getTime())}function q(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function T(t,e){return t===e}function P(t,e,r){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const s=new Array(n),o=t.entries();let i,a,c=0;for(;(i=o.next())&&!i.done;){const n=e.entries();let o=!1,l=0;for(;(a=n.next())&&!a.done;){if(s[l]){l++;continue}const n=i.value,u=a.value;if(r.equals(n[0],u[0],c,l,t,e,r)&&r.equals(n[1],u[1],n[0],u[0],t,e,r)){o=s[l]=!0;break}l++}if(!o)return!1;c++}return!0}var S=A;function z(t,e,r){const n=_(t);let s=n.length;if(_(e).length!==s)return!1;for(;s-- >0;)if(!$(t,e,r,n[s]))return!1;return!0}function U(t,e,r){const n=v(t);let s,o,i,a=n.length;if(v(e).length!==a)return!1;for(;a-- >0;){if(s=n[a],!$(t,e,r,s))return!1;if(o=C(t,s),i=C(e,s),(o||i)&&(!o||!i||o.configurable!==i.configurable||o.enumerable!==i.enumerable||o.writable!==i.writable))return!1}return!0}function Z(t,e){return A(t.valueOf(),e.valueOf())}function B(t,e){return t.source===e.source&&t.flags===e.flags}function F(t,e,r){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const s=new Array(n),o=t.values();let i,a;for(;(i=o.next())&&!i.done;){const n=e.values();let o=!1,c=0;for(;(a=n.next())&&!a.done;){if(!s[c]&&r.equals(i.value,a.value,i.value,a.value,t,e,r)){o=s[c]=!0;break}c++}if(!o)return!1}return!0}function N(t,e){let r=t.byteLength;if(e.byteLength!==r||t.byteOffset!==e.byteOffset)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function D(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function $(t,e,r,n){return!("_owner"!==n&&"__o"!==n&&"__v"!==n||!t.$$typeof&&!e.$$typeof)||M(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var R={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},G=Object.prototype.toString;var V=K();function K(t={}){const{circular:e=!1,createInternalComparator:r,createState:n,strict:s=!1}=t,o=function({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:s,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:a,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:h,areTypedArraysEqual:p,areUrlsEqual:d,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;const b=typeof m;if(b!==typeof g)return!1;if("object"!==b)return"number"===b?a(m,g,y):"function"===b&&o(m,g,y);const w=m.constructor;if(w!==g.constructor)return!1;if(w===Object)return c(m,g,y);if(Array.isArray(m))return e(m,g,y);if(w===Date)return n(m,g,y);if(w===RegExp)return u(m,g,y);if(w===Map)return i(m,g,y);if(w===Set)return h(m,g,y);const x=G.call(m);if("[object Date]"===x)return n(m,g,y);if("[object RegExp]"===x)return u(m,g,y);if("[object Map]"===x)return i(m,g,y);if("[object Set]"===x)return h(m,g,y);if("[object Object]"===x)return"function"!=typeof m.then&&"function"!=typeof g.then&&c(m,g,y);if("[object URL]"===x)return d(m,g,y);if("[object Error]"===x)return s(m,g,y);if("[object Arguments]"===x)return c(m,g,y);if(R[x])return p(m,g,y);if("[object ArrayBuffer]"===x)return t(m,g,y);if("[object DataView]"===x)return r(m,g,y);if("[object Boolean]"===x||"[object Number]"===x||"[object String]"===x)return l(m,g,y);if(f){let t=f[x];if(!t){const e=null!=(k=m)?k[Symbol.toStringTag]:void 0;e&&(t=f[e])}if(t)return t(m,g,y)}var k;return!1}}(function({circular:t,createCustomConfig:e,strict:r}){let n={areArrayBuffersEqual:j,areArraysEqual:r?U:L,areDataViewsEqual:I,areDatesEqual:O,areErrorsEqual:q,areFunctionsEqual:T,areMapsEqual:r?k(P,U):P,areNumbersEqual:S,areObjectsEqual:r?U:z,arePrimitiveWrappersEqual:Z,areRegExpsEqual:B,areSetsEqual:r?k(F,U):F,areTypedArraysEqual:r?k(N,U):N,areUrlsEqual:D,unknownTagComparators:void 0};if(e&&(n=Object.assign({},n,e(n))),t){const t=E(n.areArraysEqual),e=E(n.areMapsEqual),r=E(n.areObjectsEqual),s=E(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:t,areMapsEqual:e,areObjectsEqual:r,areSetsEqual:s})}return n}(t));return function({circular:t,comparator:e,createState:r,equals:n,strict:s}){if(r)return function(o,i){const{cache:a=(t?/* @__PURE__ */new WeakMap:void 0),meta:c}=r();return e(o,i,{cache:a,equals:n,meta:c,strict:s})};if(t)return function(t,r){return e(t,r,{cache:/* @__PURE__ */new WeakMap,equals:n,meta:void 0,strict:s})};const o={cache:void 0,equals:n,meta:void 0,strict:s};return function(t,r){return e(t,r,o)}}({circular:e,comparator:o,createState:n,equals:r?r(o):(i=o,function(t,e,r,n,s,o,a){return i(t,e,a)}),strict:s});var i}K({strict:!0}),K({circular:!0}),K({circular:!0,strict:!0}),K({createInternalComparator:()=>A}),K({strict:!0,createInternalComparator:()=>A}),K({circular:!0,createInternalComparator:()=>A}),K({circular:!0,createInternalComparator:()=>A,strict:!0});var W=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],X=class t{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,n]=new Uint8Array(e,0,2);if(219!==r)throw new Error("Data does not appear to be in a KDBush format.");const s=n>>4;if(1!==s)throw new Error(`Got v${s} data when expected v1.`);const o=W[15&n];if(!o)throw new Error("Unrecognized array type.");const[i]=new Uint16Array(e,2,1),[a]=new Uint32Array(e,4,1);return new t(a,i,o,e)}constructor(t,e=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const s=W.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,i=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-i%8)%8;if(s<0)throw new Error(`Unexpected typed array class: ${r}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+i+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+i+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+i+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+s]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return J(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:o,nodeSize:i}=this,a=[0,s.length-1,0],c=[];for(;a.length;){const l=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=i){for(let i=h;i<=u;i++){const a=o[2*i],l=o[2*i+1];a>=t&&a<=r&&l>=e&&l<=n&&c.push(s[i])}continue}const p=h+u>>1,d=o[2*p],f=o[2*p+1];d>=t&&d<=r&&f>=e&&f<=n&&c.push(s[p]),(0===l?t<=d:e<=f)&&(a.push(h),a.push(p-1),a.push(1-l)),(0===l?r>=d:n>=f)&&(a.push(p+1),a.push(u),a.push(1-l))}return c}within(t,e,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:s,nodeSize:o}=this,i=[0,n.length-1,0],a=[],c=r*r;for(;i.length;){const l=i.pop()||0,u=i.pop()||0,h=i.pop()||0;if(u-h<=o){for(let r=h;r<=u;r++)tt(s[2*r],s[2*r+1],t,e)<=c&&a.push(n[r]);continue}const p=h+u>>1,d=s[2*p],f=s[2*p+1];tt(d,f,t,e)<=c&&a.push(n[p]),(0===l?t-r<=d:e-r<=f)&&(i.push(h),i.push(p-1),i.push(1-l)),(0===l?t+r>=d:e+r>=f)&&(i.push(p+1),i.push(u),i.push(1-l))}return a}};function J(t,e,r,n,s,o){if(s-n<=r)return;const i=n+s>>1;Y(t,e,i,n,s,o),J(t,e,r,n,i-1,1-o),J(t,e,r,i+1,s,1-o)}function Y(t,e,r,n,s,o){for(;s>n;){if(s-n>600){const i=s-n+1,a=r-n+1,c=Math.log(i),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(i-l)/i)*(a-i/2<0?-1:1);Y(t,e,r,Math.max(n,Math.floor(r-a*l/i+u)),Math.min(s,Math.floor(r+(i-a)*l/i+u)),o)}const i=e[2*r+o];let a=n,c=s;for(H(t,e,n,r),e[2*s+o]>i&&H(t,e,n,s);a<c;){for(H(t,e,a,c),a++,c--;e[2*a+o]<i;)a++;for(;e[2*c+o]>i;)c--}e[2*n+o]===i?H(t,e,n,c):(c++,H(t,e,c,s)),c<=r&&(n=c+1),r<=c&&(s=c-1)}}function H(t,e,r,n){Q(t,r,n),Q(e,2*r,2*n),Q(e,2*r+1,2*n+1)}function Q(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function tt(t,e,r,n){const s=t-r,o=e-n;return s*s+o*o}var et,rt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},nt=Math.fround||(et=new Float32Array(1),t=>(et[0]=+t,et[0])),st=class{constructor(t){this.options=Object.assign(Object.create(rt),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:r,maxZoom:n}=this.options;e&&console.time("total time");const s=`prepare ${t.length} points`;e&&console.time(s),this.points=t;const o=[];for(let a=0;a<t.length;a++){const e=t[a];if(!e.geometry)continue;const[r,n]=e.geometry.coordinates,s=nt(at(r)),i=nt(ct(n));o.push(s,i,1/0,a,-1,1),this.options.reduce&&o.push(0)}let i=this.trees[n+1]=this._createTree(o);e&&console.timeEnd(s);for(let a=n;a>=r;a--){const t=+Date.now();i=this.trees[a]=this._createTree(this._cluster(i,a)),e&&console.log("z%d: %d clusters in %dms",a,i.numItems,+Date.now()-t)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let s=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,s=180;else if(r>s){const t=this.getClusters([r,n,180,o],e),i=this.getClusters([-180,n,s,o],e);return t.concat(i)}const i=this.trees[this._limitZoom(e)],a=i.range(at(r),ct(o),at(s),ct(n)),c=i.data,l=[];for(const u of a){const t=this.stride*u;l.push(c[t+5]>1?ot(c,t,this.clusterProps):this.points[c[t+3]])}return l}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),n="No cluster with the specified id.",s=this.trees[r];if(!s)throw new Error(n);const o=s.data;if(e*this.stride>=o.length)throw new Error(n);const i=this.options.radius/(this.options.extent*Math.pow(2,r-1)),a=o[e*this.stride],c=o[e*this.stride+1],l=s.within(a,c,i),u=[];for(const h of l){const e=h*this.stride;o[e+4]===t&&u.push(o[e+5]>1?ot(o,e,this.clusterProps):this.points[o[e+3]])}if(0===u.length)throw new Error(n);return u}getLeaves(t,e,r){e=e||10,r=r||0;const n=[];return this._appendLeaves(n,t,e,r,0),n}getTile(t,e,r){const n=this.trees[this._limitZoom(t)],s=Math.pow(2,t),{extent:o,radius:i}=this.options,a=i/o,c=(r-a)/s,l=(r+1+a)/s,u={features:[]};return this._addTileFeatures(n.range((e-a)/s,c,(e+1+a)/s,l),n.data,e,r,s,u),0===e&&this._addTileFeatures(n.range(1-a/s,c,1,l),n.data,s,r,s,u),e===s-1&&this._addTileFeatures(n.range(0,c,a/s,l),n.data,-1,r,s,u),u.features.length?u:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,n,s){const o=this.getChildren(e);for(const i of o){const e=i.properties;if(e&&e.cluster?s+e.point_count<=n?s+=e.point_count:s=this._appendLeaves(t,e.cluster_id,r,n,s):s<n?s++:t.push(i),t.length===r)break}return s}_createTree(t){const e=new X(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<t.length;r+=this.stride)e.add(t[r],t[r+1]);return e.finish(),e.data=t,e}_addTileFeatures(t,e,r,n,s,o){for(const i of t){const t=i*this.stride,a=e[t+5]>1;let c,l,u;if(a)c=it(e,t,this.clusterProps),l=e[t],u=e[t+1];else{const r=this.points[e[t+3]];c=r.properties;const[n,s]=r.geometry.coordinates;l=at(n),u=ct(s)}const h={type:1,geometry:[[Math.round(this.options.extent*(l*s-r)),Math.round(this.options.extent*(u*s-n))]],tags:c};let p;p=a||this.options.generateId?e[t+3]:this.points[e[t+3]].id,void 0!==p&&(h.id=p),o.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:r,extent:n,reduce:s,minPoints:o}=this.options,i=r/(n*Math.pow(2,e)),a=t.data,c=[],l=this.stride;for(let u=0;u<a.length;u+=l){if(a[u+2]<=e)continue;a[u+2]=e;const r=a[u],n=a[u+1],h=t.within(a[u],a[u+1],i),p=a[u+5];let d=p;for(const t of h){const r=t*l;a[r+2]>e&&(d+=a[r+5])}if(d>p&&d>=o){let t,o=r*p,i=n*p,f=-1;const m=(u/l<<5)+(e+1)+this.points.length;for(const r of h){const n=r*l;if(a[n+2]<=e)continue;a[n+2]=e;const c=a[n+5];o+=a[n]*c,i+=a[n+1]*c,a[n+4]=m,s&&(t||(t=this._map(a,u,!0),f=this.clusterProps.length,this.clusterProps.push(t)),s(t,this._map(a,n)))}a[u+4]=m,c.push(o/d,i/d,1/0,m,-1,d),s&&c.push(f)}else{for(let t=0;t<l;t++)c.push(a[u+t]);if(d>1)for(const t of h){const r=t*l;if(!(a[r+2]<=e)){a[r+2]=e;for(let t=0;t<l;t++)c.push(a[r+t])}}}}return c}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,r){if(t[e+5]>1){const n=this.clusterProps[t[e+6]];return r?Object.assign({},n):n}const n=this.points[t[e+3]].properties,s=this.options.map(n);return r&&s===n?Object.assign({},s):s}};function ot(t,e,r){return{type:"Feature",id:t[e+3],properties:it(t,e,r),geometry:{type:"Point",coordinates:[(n=t[e],360*(n-.5)),lt(t[e+1])]}};var n}function it(t,e,r){const n=t[e+5],s=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,o=t[e+6],i=-1===o?{}:Object.assign({},r[o]);return Object.assign(i,{cluster:!0,cluster_id:t[e+3],point_count:n,point_count_abbreviated:s})}function at(t){return t/360+.5}function ct(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function lt(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}var ut=class{static isAdvancedMarkerAvailable(t){return google.maps.marker&&!0===t.getMapCapabilities().isAdvancedMarkersAvailable}static isAdvancedMarker(t){return google.maps.marker&&t instanceof google.maps.marker.AdvancedMarkerElement}static setMap(t,e){this.isAdvancedMarker(t)?t.map=e:t.setMap(e)}static getPosition(t){if(this.isAdvancedMarker(t)){if(t.position){if(t.position instanceof google.maps.LatLng)return t.position;if(Number.isFinite(t.position.lat)&&Number.isFinite(t.position.lng))return new google.maps.LatLng(t.position.lat,t.position.lng)}return new google.maps.LatLng(null)}return t.getPosition()}static getVisible(t){return!!this.isAdvancedMarker(t)||t.getVisible()}},ht=class{constructor({markers:t,position:e}){this.markers=[],t&&(this.markers=t),e&&(e instanceof google.maps.LatLng?this._position=e:this._position=new google.maps.LatLng(e))}get bounds(){if(0===this.markers.length&&!this._position)return;const t=new google.maps.LatLngBounds(this._position,this._position);for(const e of this.markers)t.extend(ut.getPosition(e));return t}get position(){return this._position||this.bounds.getCenter()}get count(){return this.markers.filter(t=>ut.getVisible(t)).length}push(t){this.markers.push(t)}delete(){this.marker&&(ut.setMap(this.marker,null),this.marker=void 0),this.markers.length=0}};function pt(t,e="assertion failed"){if(null==t)throw Error(e)}var dt,ft=class{constructor({maxZoom:t=16}){this.maxZoom=t}noop({markers:t}){return mt(t)}},mt=t=>t.map(t=>new ht({position:ut.getPosition(t),markers:[t]})),gt=class extends ft{constructor(t){var{maxZoom:e,radius:r=60}=t,n=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]])}return r}(t,["maxZoom","radius"]);super({maxZoom:e}),this.markers=[],this.clusters=[],this.state={zoom:-1},this.superCluster=new st(Object.assign({maxZoom:this.maxZoom,radius:r},n))}calculate(t){let e=!1,r=t.map.getZoom();pt(r),r=Math.round(r);const n={zoom:r};if(!V(t.markers,this.markers)){e=!0,this.markers=[...t.markers];const r=this.markers.map(t=>{const e=ut.getPosition(t);return{type:"Feature",geometry:{type:"Point",coordinates:[e.lng(),e.lat()]},properties:{marker:t}}});this.superCluster.load(r)}return e||(this.state.zoom<=this.maxZoom||n.zoom<=this.maxZoom)&&(e=!V(this.state,n)),this.state=n,0===t.markers.length?(this.clusters=[],{clusters:this.clusters,changed:e}):(e&&(this.clusters=this.cluster(t)),{clusters:this.clusters,changed:e})}cluster({map:t}){const e=t.getZoom();return pt(e),this.superCluster.getClusters([-180,-90,180,90],Math.round(e)).map(t=>this.transformCluster(t))}transformCluster({geometry:{coordinates:[t,e]},properties:r}){if(r.cluster)return new ht({markers:this.superCluster.getLeaves(r.cluster_id,1/0).map(t=>t.properties.marker),position:{lat:e,lng:t}});const n=r.marker;return new ht({markers:[n],position:ut.getPosition(n)})}},yt=class{constructor(t,e){this.markers={sum:t.length};const r=e.map(t=>t.count),n=r.reduce((t,e)=>t+e,0);this.clusters={count:e.length,markers:{mean:n/e.length,sum:n,min:Math.min(...r),max:Math.max(...r)}}}},bt=class{render({count:t,position:e},r,n){const s=`<svg fill="${t>Math.max(10,r.clusters.markers.mean)?"#ff0000":"#0000ff"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50" height="50">\n<circle cx="120" cy="120" opacity=".6" r="70" />\n<circle cx="120" cy="120" opacity=".3" r="90" />\n<circle cx="120" cy="120" opacity=".2" r="110" />\n<text x="50%" y="50%" style="fill:#fff" text-anchor="middle" font-size="50" dominant-baseline="middle" font-family="roboto,arial,sans-serif">${t}</text>\n</svg>`,o=`Cluster of ${t} markers`,i=Number(google.maps.Marker.MAX_ZINDEX)+t;if(ut.isAdvancedMarkerAvailable(n)){const t=(new DOMParser).parseFromString(s,"image/svg+xml").documentElement;t.setAttribute("transform","translate(0 25)");const r={map:n,position:e,zIndex:i,title:o,content:t};return new google.maps.marker.AdvancedMarkerElement(r)}const a={position:e,zIndex:i,title:o,icon:{url:`data:image/svg+xml;base64,${btoa(s)}`,anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(a)}},wt=class t{constructor(){!function(t,e){for(let r in e.prototype)t.prototype[r]=e.prototype[r]}(t,google.maps.OverlayView)}};!function(t){t.CLUSTERING_BEGIN="clusteringbegin",t.CLUSTERING_END="clusteringend",t.CLUSTER_CLICK="click",t.GMP_CLICK="gmp-click"}(dt||(dt={}));var xt=(t,e,r)=>{e.bounds&&r.fitBounds(e.bounds)},kt=class extends wt{constructor({map:t,markers:e=[],algorithmOptions:r={},algorithm:n=new gt(r),renderer:s=new bt,onClusterClick:o=xt}){super(),this.map=null,this.idleListener=null,this.markers=[...e],this.clusters=[],this.algorithm=n,this.renderer=s,this.onClusterClick=o,t&&this.setMap(t)}addMarker(t,e){this.markers.includes(t)||(this.markers.push(t),e||this.render())}addMarkers(t,e){t.forEach(t=>{this.addMarker(t,!0)}),e||this.render()}removeMarker(t,e){const r=this.markers.indexOf(t);return-1!==r&&(ut.setMap(t,null),this.markers.splice(r,1),e||this.render(),!0)}removeMarkers(t,e){let r=!1;return t.forEach(t=>{r=this.removeMarker(t,!0)||r}),r&&!e&&this.render(),r}clearMarkers(t){this.markers.length=0,t||this.render()}render(){const t=this.getMap();if(t instanceof google.maps.Map&&t.getProjection()){google.maps.event.trigger(this,dt.CLUSTERING_BEGIN,this);const{clusters:e,changed:r}=this.algorithm.calculate({markers:this.markers,map:t,mapCanvasProjection:this.getProjection()});if(r||null==r){const t=/* @__PURE__ */new Set;for(const n of e)1==n.markers.length&&t.add(n.markers[0]);const r=[];for(const e of this.clusters)null!=e.marker&&(1==e.markers.length?t.has(e.marker)||ut.setMap(e.marker,null):r.push(e.marker));this.clusters=e,this.renderClusters(),requestAnimationFrame(()=>r.forEach(t=>ut.setMap(t,null)))}google.maps.event.trigger(this,dt.CLUSTERING_END,this)}}onAdd(){const t=this.getMap();pt(t),this.idleListener=t.addListener("idle",this.render.bind(this)),this.render()}onRemove(){this.idleListener&&google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach(t=>ut.setMap(t,null)),this.clusters.forEach(t=>t.delete()),this.clusters=[]}renderClusters(){const t=new yt(this.markers,this.clusters),e=this.getMap();this.clusters.forEach(r=>{if(1===r.markers.length)r.marker=r.markers[0];else if(r.marker=this.renderer.render(r,t,e),r.markers.forEach(t=>ut.setMap(t,null)),this.onClusterClick){const t=ut.isAdvancedMarker(r.marker)?dt.GMP_CLICK:dt.CLUSTER_CLICK;r.marker.addListener(t,t=>{google.maps.event.trigger(this,dt.CLUSTER_CLICK,r),this.onClusterClick(t,r,e)})}ut.setMap(r.marker,e)})}},Et={top:60,bottom:60,left:276,right:60},vt="#fb8500",Mt=new h,At=(e,r,s)=>{t(/* @__PURE__ */n(a,{client:Mt,children:/* @__PURE__ */n(u,{children:/* @__PURE__ */n(p,{event:e,onExplore:s})})}),r)},Ct=t=>{const e=document.createElement("div");e.style.cssText=`\n background:${g(t.color,"#fb8500")};color:#fff;border-radius:20px;padding:5px 10px;\n font-size:12px;font-weight:600;white-space:nowrap;cursor:pointer;\n box-shadow:0 2px 8px rgba(0,0,0,0.25);border:2px solid rgba(255,255,255,0.4);\n display:inline-flex;align-items:center;gap:6px;\n `;const r=document.createElement("span");r.textContent=t.folder.name;const n=document.createElement("span");return n.style.cssText="background:rgba(0,0,0,0.18);border-radius:10px;padding:1px 5px;font-size:10px;",n.textContent=String(t.eventCount),e.appendChild(r),e.appendChild(n),e},_t=(t,e)=>{const r=document.createElement("div");if(r.style.cssText=`\n width:36px;height:36px;cursor:pointer;\n background:${t};border-radius:50% 50% 50% 0;transform:rotate(-45deg);\n border:2px solid white;box-shadow:0 2px 8px rgba(0,0,0,0.3);\n display:flex;align-items:center;justify-content:center;overflow:hidden;\n `,e){const t=document.createElement("img");t.src=d(e)??"",t.style.cssText="width:24px;height:24px;border-radius:50%;object-fit:cover;transform:rotate(45deg);",r.appendChild(t)}return r},jt=({apiKey:t,onExplore:a,logoUrl:u})=>{const h=r(null),p=r(null),d=r(null),g=r(null),b=r([]),w=r([]),x=r(null),k=r(null),E=r(!1),v=r(!1),M=e(()=>(()=>{try{const t=sessionStorage.getItem(i);if(!t)return null;const e=JSON.parse(t);if(Array.isArray(e?.center)&&"number"==typeof e.zoom)return e}catch{}return null})(),[]),[A,C]=o(!1),[_,j]=o(!0),{folderTree:L,activeFolderId:I,activeFolder:O,visibleEvents:q,setActiveFolderId:T,isLoadingEvents:P}=m(),{organization:S}=l(),z=()=>{b.current.forEach(t=>{t.map=null}),b.current=[]},U=()=>{x.current&&(x.current.clearMarkers(),x.current=null),w.current.forEach(t=>{t.map=null}),w.current=[]};return s(()=>{if(!h.current||p.current)return;let e=!1;return(async()=>{try{const{setOptions:r,importLibrary:n}=await import("./CjmNvKgB.js");if(e)return;if(r({key:t,v:"weekly"}),await Promise.all([n("maps"),n("marker"),n("visualization")]),e||!h.current)return;const s=window.google.maps;d.current=s;const o=M?.center?{lng:M.center[0],lat:M.center[1]}:{lat:20,lng:0},a=M?.zoom??3,c=new s.Map(h.current,{mapId:"DEMO_MAP_ID",renderingType:"VECTOR",mapTypeId:"roadmap",center:o,zoom:a,mapTypeControl:!1,streetViewControl:!1});p.current=c,g.current=new s.InfoWindow({maxWidth:280}),k.current=new s.visualization.HeatmapLayer({data:[],map:null,radius:30,opacity:.8});const l=()=>{try{const t=c.getCenter();if(!t)return;sessionStorage.setItem(i,JSON.stringify({center:[t.lng(),t.lat()],zoom:c.getZoom()}))}catch{}};c.addListener("idle",l),j(!1),C(!0)}finally{e||j(!1)}})(),()=>{e=!0,z(),U(),k.current&&(k.current.setMap(null),k.current=null),g.current?.close(),p.current=null,d.current=null}},[t]),s(()=>{if(!A)return;const t=p.current,e=d.current;if(t&&e)if(z(),U(),g.current?.close(),null===I&&L.length>0){k.current?.setMap(null);const r=n=>{for(const s of n)if(s.centroid){const r=Ct(s),n=new e.marker.AdvancedMarkerElement({map:t,position:{lng:s.centroid[0],lat:s.centroid[1]},content:r,gmpClickable:!0});n.addListener("click",()=>T(s.folder._id)),b.current.push(n)}else s.children.length>0&&r(s.children)};r(L)}else{const r=0===L.length&&null===I;if(0===q.length)return;if(r){const r=[],n=q.map(n=>{const s=n.location.y,o=n.location.x;r.push({location:new e.LatLng(s,o),weight:(n.views||0)+1});const i=_t(vt,u),c=new e.marker.AdvancedMarkerElement({map:t,position:{lat:s,lng:o},content:i,gmpClickable:!0});return c.addListener("click",()=>{const e=document.createElement("div");At(n,e,a),g.current.close(),g.current.setContent(e),g.current.open({anchor:c,map:t})}),c});if(w.current=n,x.current=new kt({markers:n,map:t,renderer:{render:({count:t,position:r})=>{const n=document.createElement("div"),s=t<10?28:t<30?34:40;return n.style.cssText=`\n width:${s}px;height:${s}px;border-radius:50%;cursor:pointer;\n background:${vt};color:#fff;\n display:flex;align-items:center;justify-content:center;\n font-size:13px;font-weight:700;\n box-shadow:0 2px 8px rgba(0,0,0,0.3);\n border:2px solid rgba(255,255,255,0.6);\n `,n.textContent=String(t),new e.marker.AdvancedMarkerElement({position:r,content:n,gmpClickable:!0,zIndex:Number(e.Marker?.MAX_ZINDEX??0)+t})}}}),k.current&&(k.current.setData(r),k.current.setMap(t)),!v.current&&(v.current=!0,!M)){const r=new e.LatLngBounds;q.forEach(t=>r.extend({lat:t.location.y,lng:t.location.x})),r.isEmpty()||t.fitBounds(r,Et)}}else{k.current?.setMap(null);const r=O?.color||vt,n=new e.LatLngBounds;q.forEach(s=>{const o=s.location.y,i=s.location.x;n.extend({lat:o,lng:i});const c=_t(r,u),l=new e.marker.AdvancedMarkerElement({map:t,position:{lat:o,lng:i},content:c,gmpClickable:!0});l.addListener("click",()=>{const e=document.createElement("div");At(s,e,a),g.current.close(),g.current.setContent(e),g.current.open({anchor:l,map:t})}),w.current.push(l)})}}},[I,L,q,A,a,u,T,O,M]),s(()=>{if(!A)return;const t=p.current,e=d.current;if(t&&e)if(E.current||!M){if(E.current=!0,I){const r=f(L,I);if(!r?.folder.boundary?.length)return;const n=new e.LatLngBounds;for(const t of r.folder.boundary)n.extend({lat:t.y,lng:t.x});n.isEmpty()||t.fitBounds(n,{...Et,maxZoom:14})}else if(L.length>0){const r=new e.LatLngBounds,n=t=>{for(const e of t)e.centroid?r.extend({lng:e.centroid[0],lat:e.centroid[1]}):n(e.children)};n(L),r.isEmpty()||t.fitBounds(r,{...Et,maxZoom:8})}}else E.current=!0},[I,L,A,M]),/* @__PURE__ */n("div",{class:"relative h-screen w-full sm:h-[calc(100vh-4rem)]",style:c(S),children:[
|
|
2
|
+
/* @__PURE__ */n(y,{positionClass:"absolute top-3 left-16 z-[1000]",folderTree:L,activeFolderId:I,setActiveFolderId:T}),P&&/* @__PURE__ */n("div",{class:"absolute inset-0 z-10 flex items-center justify-center bg-white/60",children:/* @__PURE__ */n("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"})}),_&&/* @__PURE__ */n("div",{class:"absolute inset-0 z-20 flex items-center justify-center bg-white/85",children:/* @__PURE__ */n("div",{class:"flex flex-col items-center gap-3",children:[/* @__PURE__ */n("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"}),/* @__PURE__ */n("p",{class:"text-sm font-medium text-slate-700",children:"Loading map…"})]})}),
|
|
3
|
+
/* @__PURE__ */n("div",{ref:h,class:"size-full"})]})};export{jt as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{r as e}from"./hOIsfHC7.js";import{D as t,_ as r,g as n,t as o,w as s,y as i}from"./CoFGfneL.js";import{B as l,X as a,g as c,p as u,r as d}from"./D8g89do5.js";import{t as p}from"./zVkCODn-.js";import{a as m,i as f,n as g,o as h,r as y,t as b}from"./V5NTL9Q8.js";var v={top:60,bottom:60,left:276,right:60},x="#fb8500",w=new p,L=(e,r,n)=>{t(/* @__PURE__ */o(a,{client:w,children:/* @__PURE__ */o(d,{children:/* @__PURE__ */o(m,{event:e,onExplore:n})})}),r)},C=e=>{const t=document.createElement("div");t.style.cssText=`\n background:${y(e.color,"#fb8500")};color:#fff;border-radius:20px;padding:5px 10px;\n font-size:12px;font-weight:600;white-space:nowrap;cursor:pointer;\n box-shadow:0 2px 8px rgba(0,0,0,0.25);border:2px solid rgba(255,255,255,0.4);\n display:inline-flex;align-items:center;gap:6px;\n `;const r=document.createElement("span");r.textContent=e.folder.name;const n=document.createElement("span");return n.style.cssText="background:rgba(0,0,0,0.18);border-radius:10px;padding:1px 5px;font-size:10px;",n.textContent=String(e.eventCount),t.appendChild(r),t.appendChild(n),t},z=({apiKey:t,is3D:a,onExplore:d,logoUrl:p})=>{const m=n(null),y=n(null),w=n(null),z=n(a),E=n([]),k=n([]),_=n(null),j=n(!1),T=n(!1),F=n(null),[S,B]=i(a),D=r(()=>(()=>{try{const e=sessionStorage.getItem(l);if(!e)return null;const t=JSON.parse(e);if(Array.isArray(t?.center)&&"number"==typeof t.zoom)return t}catch{}return null})(),[]),[Z,I]=i(!1),[M,O]=i(!0),{folderTree:U,activeFolderId:A,activeFolder:P,visibleEvents:R,setActiveFolderId:W,isLoadingEvents:$}=h(),{organization:q}=u(),J=()=>{E.current.forEach(e=>e.remove()),E.current=[]},N=()=>{k.current.forEach(e=>e.remove()),k.current=[]},K=(e,t)=>{const r=t?"visible":"none";for(const n of["heatmap","event-clusters","cluster-count","unclustered-point"])e.getLayer(n)&&e.setLayoutProperty(n,"visibility",r)};return s(()=>{if(!m.current||y.current)return;let r,n=!1;return(async()=>{try{const o=(await import("./PPVqva_9.js").then(t=>/* @__PURE__ */e(t.default,1))).default;if(n)return;if(!m.current)return;const s=D?.center??[0,20],i=D?.zoom??3,a=new o.Map({container:m.current,style:`https://api.maptiler.com/maps/streets-v2/style.json?key=${t}`,center:s,zoom:i,minZoom:0,pitch:0,bearing:0,renderWorldCopies:!1,projection:z.current?{type:"globe"}:{type:"mercator"},canvasContextAttributes:{antialias:!0}});y.current=a,w.current=o,a.on("load",()=>{if(n)return;const e=a.getStyle()?.layers??[];let t,r;for(const n of e){const e=n;"symbol"===e.type&&e.layout?.["text-field"]&&!t&&(t=n.id),"building"!==e["source-layer"]||r||(r=e.source)}r&&!a.getLayer("3d-buildings")&&a.addLayer({id:"3d-buildings",source:r,"source-layer":"building",filter:["has","render_height"],type:"fill-extrusion",minzoom:2,paint:{"fill-extrusion-color":["interpolate",["linear"],["get","render_height"],0,"lightgray",200,"royalblue",400,"lightblue"],"fill-extrusion-height":["interpolate",["linear"],["zoom"],14,0,15,["get","render_height"]],"fill-extrusion-base":["case",["has","render_min_height"],["get","render_min_height"],0],"fill-extrusion-opacity":.6}},t),a.addSource("all-events",{type:"geojson",data:{type:"FeatureCollection",features:[]},cluster:!0,clusterRadius:50,clusterMaxZoom:14}),a.addSource("heat-events",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),a.addLayer({id:"heatmap",type:"heatmap",source:"heat-events",layout:{visibility:"none"},paint:{"heatmap-weight":["interpolate",["linear"],["get","views"],0,0,200,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(33,102,172,0)",.2,"rgb(103,169,207)",.4,"rgb(209,229,240)",.6,"rgb(253,219,199)",.8,"rgb(239,138,98)",1,"rgb(178,24,43)"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,4,9,30],"heatmap-opacity":["interpolate",["linear"],["zoom"],6,.85,11,0]}}),a.addLayer({id:"event-clusters",type:"circle",source:"all-events",layout:{visibility:"none"},filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],x,10,"#e63946",30,"#9b2226"],"circle-radius":["step",["get","point_count"],16,10,20,30,26],"circle-stroke-width":2,"circle-stroke-color":"#fff"}}),a.addLayer({id:"cluster-count",type:"symbol",source:"all-events",layout:{visibility:"none","text-field":"{point_count_abbreviated}","text-size":12},paint:{"text-color":"#fff"}}),a.addLayer({id:"unclustered-point",type:"circle",source:"all-events",layout:{visibility:"none"},filter:["!",["has","point_count"]],paint:{"circle-radius":7,"circle-color":x,"circle-stroke-color":"#fff","circle-stroke-width":2}}),a.on("click","event-clusters",e=>{const t=a.queryRenderedFeatures(e.point,{layers:["event-clusters"]});if(!t.length)return;const r=t[0].properties?.cluster_id,n=a.getSource("all-events");r&&n?.getClusterExpansionZoom&&n.getClusterExpansionZoom(r,(e,r)=>{e||"number"!=typeof r||a.easeTo({center:t[0].geometry.coordinates,zoom:r,duration:600})})}),a.on("click","unclustered-point",e=>{const t=e.features?.[0];if(!t)return;const r=t.geometry.coordinates.slice(0,2),n=t.properties??{},s={_id:n._id,slug:n.slug,name:n.name,views:n.views,location:{x:r[0],y:r[1],label:n.label},contents:n.thumbnailUrl?[{thumbnailUrl:n.thumbnailUrl}]:[]};F.current&&(F.current.remove(),F.current=null);const i=document.createElement("div");L(s,i,d);const l=new o.Popup({closeButton:!0,closeOnClick:!1,maxWidth:"none",offset:[0,-10]}).setLngLat(r).setDOMContent(i).addTo(a);F.current=l,l.on("close",()=>{F.current===l&&(F.current=null)})}),a.on("click",e=>{!a.queryRenderedFeatures(e.point,{layers:["event-clusters","unclustered-point"]}).length&&F.current&&(F.current.remove(),F.current=null)}),a.on("mouseenter","event-clusters",()=>{a.getCanvas().style.cursor="pointer"}),a.on("mouseleave","event-clusters",()=>{a.getCanvas().style.cursor=""}),a.on("mouseenter","unclustered-point",()=>{a.getCanvas().style.cursor="pointer"}),a.on("mouseleave","unclustered-point",()=>{a.getCanvas().style.cursor=""}),I(!0),O(!1)});const c=()=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{try{const e=a.getCenter();sessionStorage.setItem(l,JSON.stringify({center:[e.lng,e.lat],zoom:a.getZoom()}))}catch{}},250)};a.on("zoomend",c),a.on("moveend",c),r=()=>{J(),N(),_.current&&clearTimeout(_.current),a.off("zoomend",c),a.off("moveend",c),a.remove(),y.current=null,w.current=null}}finally{n||O(!1)}})(),()=>{n=!0,r?.()}},[t]),s(()=>{if(!Z)return;const e=y.current,t=w.current;if(e&&t)if(J(),N(),null===A&&U.length>0){K(e,!1);const r=n=>{for(const o of n)if(o.centroid){const r=C(o);r.addEventListener("click",()=>W(o.folder._id));const n=new t.Marker({element:r,anchor:"center"}).setLngLat([o.centroid[0],o.centroid[1]]).addTo(e);E.current.push(n)}else o.children.length>0&&r(o.children)};r(U)}else if(0===U.length&&null===A){if(0===R.length)return;const r=R.map(e=>({type:"Feature",geometry:{type:"Point",coordinates:[e.location.x,e.location.y]},properties:{_id:e._id,slug:e.slug,name:e.name,views:e.views??0,label:e.location?.label??"",thumbnailUrl:e.contents?.[0]?.thumbnailUrl??""}})),n={type:"FeatureCollection",features:r};if(e.getSource("all-events")?.setData(n),e.getSource("heat-events")?.setData({...n,features:r.map(e=>({...e,properties:{views:e.properties.views}}))}),K(e,!0),!T.current&&(T.current=!0,!D)){const r=new t.LngLatBounds;R.forEach(e=>r.extend([e.location.x,e.location.y])),r.isEmpty()||e.fitBounds(r,{padding:v,maxZoom:8,duration:800})}}else{if(0===R.length)return;K(e,!1);const r=P?.color||x,n=new t.LngLatBounds;R.forEach(o=>{const s=o.location.x,i=o.location.y;n.extend([s,i]);const l=((e,t)=>{const r=document.createElement("div");if(r.style.cssText=`\n width:36px;height:36px;cursor:pointer;\n background:${e};border-radius:50% 50% 50% 0;transform:rotate(-45deg);\n border:2px solid white;box-shadow:0 2px 8px rgba(0,0,0,0.3);\n display:flex;align-items:center;justify-content:center;overflow:hidden;\n `,t){const e=document.createElement("img");e.src=f(t)??"",e.style.cssText="width:24px;height:24px;border-radius:50%;object-fit:cover;transform:rotate(45deg);",r.appendChild(e)}return r})(r,p);l.addEventListener("click",()=>{F.current&&(F.current.remove(),F.current=null);const r=document.createElement("div");L(o,r,d);const n=new t.Popup({closeButton:!0,closeOnClick:!1,maxWidth:"none",offset:[0,-40]}).setLngLat([s,i]).setDOMContent(r).addTo(e);F.current=n,n.on("close",()=>{F.current===n&&(F.current=null)})});const a=new t.Marker({element:l}).setLngLat([s,i]).addTo(e);k.current.push(a)})}},[A,U,R,Z,d,p,W,P,D]),s(()=>{if(!Z)return;const e=y.current;if(!e)return;if(!j.current&&D)return void(j.current=!0);j.current=!0;const t={padding:v,duration:3e3,essential:!0};if(A){const r=g(U,A);if(!r?.folder.boundary?.length)return;const n=w.current;if(!n)return;const o=new n.LngLatBounds;for(const e of r.folder.boundary)o.extend([e.x,e.y]);o.isEmpty()||e.fitBounds(o,{...t,maxZoom:14})}else if(U.length>0){const r=w.current;if(!r)return;const n=new r.LngLatBounds,o=e=>{for(const t of e)t.centroid?n.extend([t.centroid[0],t.centroid[1]]):o(t.children)};o(U),n.isEmpty()||e.fitBounds(n,{...t,maxZoom:8})}},[A,U,Z,D]),s(()=>{y.current&&(z.current=S,y.current.setProjection(S?{type:"globe"}:{type:"mercator"}),y.current.easeTo({pitch:0,bearing:0,duration:600}))},[S]),/* @__PURE__ */o("div",{class:"relative h-screen w-full sm:h-[calc(100vh-4rem)]",style:c(q),children:[
|
|
2
|
+
/* @__PURE__ */o(b,{positionClass:"absolute top-3 left-16 z-[1000]",folderTree:U,activeFolderId:A,setActiveFolderId:W}),
|
|
3
|
+
/* @__PURE__ */o("button",{type:"button",onClick:()=>B(e=>!e),class:"bg-background hover:bg-foreground/10 absolute top-4 right-4 z-[1000] rounded-xl px-3 py-2 text-xs font-semibold shadow-lg backdrop-blur-sm",children:S?"2D":"3D"}),$&&/* @__PURE__ */o("div",{class:"absolute inset-0 z-10 flex items-center justify-center bg-white/60",children:/* @__PURE__ */o("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"})}),M&&/* @__PURE__ */o("div",{class:"absolute inset-0 z-20 flex items-center justify-center bg-white/85",children:/* @__PURE__ */o("div",{class:"flex flex-col items-center gap-3",children:[/* @__PURE__ */o("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"}),/* @__PURE__ */o("p",{class:"text-sm font-medium text-slate-700",children:"Loading map…"})]})}),
|
|
4
|
+
/* @__PURE__ */o("div",{ref:m,class:"size-full"})]})};export{z as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g as t,j as e,o as r,t as o,w as n,y as s}from"./CoFGfneL.js";import{h as a}from"./D8g89do5.js";var i=({as:e="div",className:r,threshold:s=.5,rootMargin:a="0px",triggerOnce:i,onChange:l,onClick:h,children:c})=>{const u=t(null),d=t(!1);return n(()=>{const t=u.current;if(!t)return;const e=new IntersectionObserver(t=>{t.forEach(t=>{i&&d.current||(t.isIntersecting&&(d.current=!0),l?.(t.isIntersecting))})},{threshold:s,rootMargin:a});return e.observe(t),()=>e.disconnect()},[s,a,l,i]),/* @__PURE__ */o(e,{ref:u,className:r,onClick:h,children:c})},l=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],h=t=>{let e=0;for(let r=0;r<t.length;r++){let o=t[r];e=83*e+l.indexOf(o)}return e},c=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},u=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},d=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),p=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},f=t=>{let e=t>>8&255,r=255&t;return[c(t>>16),c(e),c(r)]},g=(t,e)=>{let r=Math.floor(t/361),o=Math.floor(t/19)%19,n=t%19;return[d((r-9)/9,2)*e,d((o-9)/9,2)*e,d((n-9)/9,2)*e]},m=(t,e,r,o)=>{(t=>{if(!t||t.length<6)throw new p("The blurhash string must be at least 6 characters");let e=h(t[0]),r=Math.floor(e/9)+1,o=e%9+1;if(t.length!==4+2*o*r)throw new p(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*o*r}`)})(t),o|=1;let n=h(t[0]),s=Math.floor(n/9)+1,a=n%9+1,i=(h(t[1])+1)/166,l=new Array(a*s);for(let u=0;u<l.length;u++)l[u]=0===u?f(h(t.substring(2,6))):g(h(t.substring(4+2*u,6+2*u)),i*o);let c=4*e,d=new Uint8ClampedArray(c*r);for(let h=0;h<r;h++)for(let t=0;t<e;t++){let o=0,n=0,i=0;for(let c=0;c<s;c++)for(let s=0;s<a;s++){let u=Math.cos(Math.PI*t*s/e)*Math.cos(Math.PI*h*c/r),d=l[s+c*a];o+=d[0]*u,n+=d[1]*u,i+=d[2]*u}let p=u(o),f=u(n),g=u(i);d[4*t+0+h*c]=p,d[4*t+1+h*c]=f,d[4*t+2+h*c]=g,d[4*t+3+h*c]=255}return d},b=Object.defineProperty,w=Object.defineProperties,v=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,O=(t,e,r)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x=(t,e)=>{for(var r in e||(e={}))M.call(e,r)&&O(t,r,e[r]);if(y)for(var r of y(e))j.call(e,r)&&O(t,r,e[r]);return t},C=(t,e)=>w(t,v(e)),P=(t,e)=>{var r={};for(var o in t)M.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&y)for(var o of y(t))e.indexOf(o)<0&&j.call(t,o)&&(r[o]=t[o]);return r},I=class extends r{constructor(){super(...arguments),this.canvas=null,this.handleRef=t=>{this.canvas=t,this.draw()},this.draw=()=>{let{hash:t,height:e,punch:r,width:o}=this.props;if(this.canvas){let n=m(t,o,e,r),s=this.canvas.getContext("2d"),a=s.createImageData(o,e);a.data.set(n),s.putImageData(a,0,0)}}}componentDidUpdate(){this.draw()}render(){let t=this.props,{hash:r,height:o,width:n}=t,s=P(t,["hash","height","width"]);return e("canvas",C(x({},s),{height:o,width:n,ref:this.handleRef}))}};I.defaultProps={height:128,width:128};var N={position:"absolute",top:0,bottom:0,left:0,right:0,width:"100%",height:"100%"};(class extends r{componentDidUpdate(){if(this.props.resolutionX<=0)throw new Error("resolutionX must be larger than zero");if(this.props.resolutionY<=0)throw new Error("resolutionY must be larger than zero")}render(){let t=this.props,{hash:r,height:o,width:n,punch:s,resolutionX:a,resolutionY:i,style:l}=t,h=P(t,["hash","height","width","punch","resolutionX","resolutionY","style"]);return e("div",C(x({},h),{style:C(x({display:"inline-block",height:o,width:n},l),{position:"relative"})}),e(I,{hash:r,height:i,width:a,punch:s,style:N}))}}).defaultProps={height:128,width:128,resolutionX:32,resolutionY:32};var k=I,E=({src:e,alt:r,threshold:l=.1,rootMargin:h="200px 0px",blurhash:c,containerClassName:u="size-full",wrapperClassName:d,imgClassName:p="",sizeMode:f="cover",position:g="center",delayMs:m=100,delayTime:b,onClick:w})=>{const v=c&&c.length>=6?c:"LEHV6nWB2yk8pyo0adR*.7kCMdnj",[y,M]=s(!1),[j,O]=s(!1),[x,C]=s(!1),P=t(null),I="number"==typeof b?b:m,N=d??u;n(()=>{if(!y)return x?P.current=window.setTimeout(()=>{O(!0)},I):P.current&&(clearTimeout(P.current),P.current=null),()=>{P.current&&clearTimeout(P.current)}},[x,y,I]);const E=j&&x||y;/* @__PURE__ */
|
|
2
|
+
return o(i,{as:"div",className:a(N,"relative overflow-hidden"),threshold:l,rootMargin:h,onChange:t=>C(t),children:[!y&&/* @__PURE__ */o(k,{className:"size-full blur-2xl",hash:v}),E&&e&&/* @__PURE__ */o("img",{alt:r,src:e,onLoad:()=>M(!0),className:a("absolute top-0 left-0 size-full object-center transition-all duration-300",y?"scale-100 opacity-100":"scale-95 opacity-0","contain"===f?"object-contain":"object-cover","top"===g?"object-top":"bottom"===g?"object-bottom":"object-center",p),onClick:t=>w?.(t)})]})};export{m as n,i as r,E as t};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{A as t,C as e,D as n,O as i,S as s,_ as o,b as r,g as a,i as l,j as c,k as d,n as p,t as h,v as u,w as m,x as g,y as w}from"./CoFGfneL.js";import{C as f,H as y,N as v,O as b,R as T,S as x,V as _,Z as q,g as k,h as S,n as I,p as E,q as C,x as L,z as N}from"./D8g89do5.js";import{a as A,d as M,f as B,g as V,h as z,i as R,l as O,m as P,n as $,o as D,p as H,r as F,s as U,t as j,u as W,v as G,y as K}from"./Bu-UssyO.js";import{n as Y,r as Q,t as Z}from"./M8Us9cU9.js";function J(t){return["react-photo-album",t].filter(Boolean).join("--")}function X({width:t,height:e}){const n=t/e;return Number.isFinite(n)?n:1}var tt=Object.freeze([1200,600,300,0]);function et(t,e){return"function"==typeof t?t(e):t}function nt(t,e){return void 0!==e?et(t,e):void 0}function it(t,e,n,i=0){if(void 0===e)return;const s=nt(t,e);return Math.round(Math.max(void 0===s?function(t,e){const n=tt.findIndex(t=>t<=e);return et(t[Math.max(n,0)],e)}(n,e):s,i))}function st(t,{spacing:e,padding:n,componentsProps:i,render:s}){return{spacing:it(e,t,[20,15,10,5]),padding:it(n,t,[0,0,0,0]),componentsProps:et(i,t)||{},render:et(s,t)}}function ot(t,e=0){const n=10**e;return Math.round((t+Number.EPSILON)*n)/n}function rt(t,e,n,i,s,o,r){let a,l;const c=t=>{const e=o*(s-1)+2*r*s;return`calc((${t.match(/^\s*calc\((.*)\)\s*$/)?.[1]??t} - ${e}px) / ${ot((i-e)/n,5)})`},d=t.srcSet;return d&&d.length>0&&(a=d.concat(d.some(({width:e})=>e===t.width)?[]:[{src:t.src,width:t.width,height:t.height}]).sort((t,e)=>t.width-e.width).map(t=>`${t.src} ${t.width}w`).join(", ")),l=e?.size?(e.sizes||[]).map(({viewport:t,size:e})=>`${t} ${c(e)}`).concat(c(e.size)).join(", "):`${Math.ceil(n/i*100)}vw`,{srcSet:a,sizes:l}}var at=l(function({as:t,render:e,context:n,classes:i=[],variables:s={},style:o,className:r,children:a,...l},c){const d=function(...t){return t.filter(Boolean).join(" ")}(...(Array.isArray(i)?i:[i]).filter(t=>"string"==typeof t).map(J),r),p={style:{...Object.fromEntries(Object.entries(s).map(([t,e])=>{return[(n=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),`--${J(n)}`),"number"==typeof e?ot(e,5):e];var n})),...o},className:d,children:a,...l};if(e){const t=e({ref:c,...p},n);if(t)return t}return h(t||"div",{ref:c,...p})}),lt=l(function({photo:t,index:e,width:n,height:i,onClick:s,render:{wrapper:o,link:r,button:a,image:l,extras:c}={},componentsProps:{link:d,button:p,wrapper:u,image:m}={}},g){const{href:w}=t,f={photo:t,index:e,width:ot(n,3),height:ot(i,3)};let y;return y=w?{...d,as:"a",render:r,classes:["photo","link"],href:w,onClick:s}:s?{...p,as:"button",type:"button",render:a,classes:["photo","button"],onClick:s}:{...u,render:o,classes:"photo"},h(at,{ref:g,variables:{photoWidth:f.width,photoHeight:f.height},context:f,...y,children:[h(at,{as:"img",classes:"image",render:l,context:f,...m}),c?.({},f)]})}),ct=l(function({layout:t,sizes:e,model:n,skeleton:i,onClick:s,render:{container:o,track:r,photo:a,...l}={},componentsProps:{container:d,track:p,link:u,button:m,wrapper:g,image:w}={}},f){const{spacing:y,padding:v,containerWidth:b,tracks:T,variables:x,horizontal:_}=n||{};return h(at,{role:"group","aria-label":"Photo album",...d,variables:{spacing:y,padding:v,containerWidth:b,...x},classes:["",t],render:o,ref:f,children:[void 0!==y&&void 0!==v&&void 0!==b&&T?.map(({photos:t,variables:n},i)=>{const o=t.length,d=_?o:T.length;return c(at,{...p,key:i,render:r,classes:"track",variables:{trackSize:o,...n}},t.map(t=>{const{photo:n,index:i,width:o}=t,{key:r,src:c,alt:p="",title:f,label:T}=n,x=s?t=>{s({event:t,photo:n,index:i})}:void 0;if(a){const e=a({onClick:x},t);if(e)return e}const _=t=>T?{"aria-label":T,...t}:t;return h(lt,{onClick:x,render:l,componentsProps:{image:{loading:"lazy",decoding:"async",src:c,alt:p,title:f,...rt(n,e,o,b,d,y,v),...et(w,t)},link:_(et(u,t)),button:_(et(m,t)),wrapper:et(g,t)},...t},r??i)}))}),void 0===b&&i]})});function dt(t,e,n,i){return(e-(t.length-1)*n-2*i*t.length)/t.reduce((t,e)=>t+X(e),0)}function pt(t,e,n,i,s,o,r){const a=t.slice(e,n),l=dt(a,i,s,o);return l>0?(l-r)**2*a.length:void 0}function ht(t,e){const[n,i]=t;if(n===e)return t;if(void 0!==i&&void 0!==e&&void 0!==n&&e===i&&Math.abs(e-n)<=20){const s=Math.min(n,e),o=Math.max(n,e);return s===n&&o===i?t:[s,o]}return[e,n]}function ut(t,e,n){const[[i],o]=g(ht,[n]),r=function(t){const[e,n]=w(t);return t===e||t&&e&&t.length===e.length&&!t.some((t,n)=>t!==e[n])?e:(n(t),t)}(e),l=a(void 0);return{containerRef:s(e=>{l.current?.disconnect(),l.current=void 0;const n=()=>o(function(t,e){let n=t?.clientWidth;if(void 0!==n&&e&&e.length>0){const t=[...e.filter(t=>t>0)].sort((t,e)=>e-t);t.push(Math.floor(t[t.length-1]/2)),n=t.find((e,i)=>e<=n||i===t.length-1)}return n}(e,r));n(),e&&"undefined"!=typeof ResizeObserver&&(l.current=new ResizeObserver(n),l.current.observe(e)),"function"==typeof t?t(e):t&&(t.current=e)},[t,r]),containerWidth:i}}var mt=l(function({photos:t,breakpoints:e,defaultContainerWidth:n,...i},s){const{containerRef:r,containerWidth:a}=ut(s,e,n),{spacing:l,padding:c,targetRowHeight:d,minPhotos:p,maxPhotos:u,...m}=function(t,{photos:e,targetRowHeight:n,rowConstraints:i,...s}){const{spacing:o,padding:r,componentsProps:a,render:l}=st(t,s),{singleRowMaxHeight:c,minPhotos:d,maxPhotos:p}=nt(i,t)||{};if(void 0!==c&&void 0!==o&&void 0!==r){const t=Math.floor(e.reduce((t,{width:e,height:n})=>t+e/n*c+2*r,o*(e.length-1)));t>0&&(a.container={...a.container},a.container.style={maxWidth:t,...a.container.style})}return{...s,targetRowHeight:it(n,t,[t=>t/5,t=>t/4,t=>t/3,t=>t/2]),render:l,spacing:o,padding:r,minPhotos:d,maxPhotos:p,componentsProps:a}}(a,{photos:t,...i});return h(ct,{layout:"rows",ref:r,model:o(()=>void 0!==a&&void 0!==l&&void 0!==c&&void 0!==d?function(t,e,n,i,s,o,r){const a=Math.min(function(t,e,n,i){return ot(e/n/Math.min(...t.map(t=>X(t))))+(i||0)+2}(t,i,s,o),r||1/0),l=o||1,c=t.length,d=new Array(c+1).fill(1/0),p=new Array(c+1).fill(-1);d[0]=0;for(let m=1;m<=c;m+=1)for(let o=m-l;o>=Math.max(0,m-a);o-=1){if(d[o]===1/0)continue;const r=pt(t,o,m,i,e,n,s);if(void 0===r)break;const a=d[o]+r;(d[m]===1/0||d[m]>a&&(d[m]/a>1.005||-1!==p[m]&&p[m]<o))&&(d[m]=a,p[m]=o)}if(d[c]===1/0)return;const h=[];for(let m=c;0!==m;m=p[m])h.push(m);h.push(0),h.reverse();const u=[];for(let m=1;m<h.length;m+=1){const s=t.slice(h[m-1],h[m]).map((t,e)=>({photo:t,index:h[m-1]+e})),o=dt(s.map(({photo:t})=>t),i,e,n);u.push({photos:s.map(({photo:t,index:e})=>({photo:t,index:e,width:o*X(t),height:o}))})}return{spacing:e,padding:n,containerWidth:i,tracks:u,horizontal:!0}}(t,l,c,a,d,p,u):void 0,[t,l,c,a,d,p,u]),...m})});function gt(t,e,n,i,s,o,r){const a=[],l=r.reduce((t,e)=>t+e,0);for(let c=0;c<t.length-1;c+=1){const d=e.slice(t[c],t[c+1]).map((e,n)=>({photo:e,index:t[c]+n})),p=r.reduce((t,e,n)=>t+(o[c]-o[n])*e,0),h=(s-(t.length-2)*n-2*(t.length-1)*i-p)*r[c]/l;a.push({photos:d.map(({photo:t,index:e})=>({photo:t,index:e,width:h,height:h/X(t)})),variables:{adjustedGaps:p,columnRatio:r[c]}})}return{tracks:a,variables:{totalRatio:l}}}function wt(t,e,n,i,s,o){const r=[],a=[];if(t.length<=o){const s=t.length>0?t.reduce((t,e)=>t+X(e),0)/t.length:1;for(let e=0;e<o;e+=1)r[e]=2*n,a[e]=e<t.length?X(t[e]):s;return gt(Array.from({length:o+1},(e,n)=>Math.min(n,t.length)),t,e,n,i,r,a)}const l=(c=function(t,e,n,i,s){return o=>{const r=[],a=1.5*s;let l=i/X(t[o])+2*n;for(let c=o+1;c<t.length+1&&(r.push([c,(s-l)**2]),!(l>a||c===t.length));c+=1)l+=i/X(t[c])+e+2*n;return r}}(t,e,n,s,(t.reduce((t,e)=>t+s/X(e),0)+e*(t.length-o)+2*n*t.length)/o),d=o,p=0,h=t.length,function(t,e,n){const i=[n];for(let s=n,o=e;o>0;o-=1)[s]=t.get(s)[o],i.push(s);return i.reverse()}(function(t,e,n,i){const s=/* @__PURE__ */new Map,o=/* @__PURE__ */new Set;o.add(n);for(let r=0;r<e;r+=1){const n=[...o.keys()];o.clear(),n.forEach(n=>{const a=r>0?s.get(n)[r][1]:0;t(n).forEach(([t,l])=>{let c=s.get(t);c||(c=[],s.set(t,c));const d=a+l,p=c[r+1];(!p||p[1]>d&&(p[1]/d>1.0001||n<p[0]))&&(c[r+1]=[n,d]),r<e-1&&t!==i&&o.add(t)})})}return s}(c,d,p,h),d,h));var c,d,p,h;for(let u=0;u<l.length-1;u+=1){const i=t.slice(l[u],l[u+1]);r[u]=e*(i.length-1)+2*n*i.length,a[u]=1/i.reduce((t,e)=>t+1/X(e),0)}return gt(l,t,e,n,i,r,a)}function ft(t,e,n,i,s){const{tracks:o,variables:r}=wt(t,e,n,i,(i-e*(s-1)-2*n*s)/s,s);return o.some(t=>t.photos.some(({width:t,height:e})=>t<=0||e<=0))?s>1?ft(t,e,n,i,s-1):void 0:{tracks:o,spacing:e,padding:n,containerWidth:i,variables:{columns:s,...r}}}var yt=l(function({photos:t,breakpoints:e,defaultContainerWidth:n,...i},s){const{containerRef:r,containerWidth:a}=ut(s,e,n),{spacing:l,padding:c,columns:d,...p}=function(t,{columns:e,...n}){return{...n,...st(t,n),columns:it(e,t,[5,4,3,2],1)}}(a,{photos:t,...i});return h(ct,{layout:"columns",ref:r,model:o(()=>void 0!==a&&void 0!==l&&void 0!==c&&void 0!==d?ft(t,l,c,a,d):void 0,[t,l,c,a,d]),...p})});function vt(t,e,n,i,s){const o=(i-e*(s-1)-2*n*s)/s;if(o<=0)return s>1?vt(t,e,n,i,s-1):void 0;const r=[];for(let l=0;l<s;l+=1)r[l]=0;const a=t.reduce((t,i,s)=>{const a=r.reduce((t,e,n)=>e<r[t]-1?n:t,0);return r[a]=r[a]+o/X(i)+e+2*n,t[a].push({photo:i,index:s}),t},Array.from({length:s},()=>[]));return{spacing:e,padding:n,containerWidth:i,variables:{columns:s},tracks:a.map(t=>({photos:t.map(({photo:t,index:e})=>({photo:t,index:e,width:o,height:o/X(t)}))}))}}var bt=l(function({photos:t,breakpoints:e,defaultContainerWidth:n,...i},s){const{containerRef:r,containerWidth:a}=ut(s,e,n),{spacing:l,padding:c,columns:d,...p}=function(t,{columns:e,...n}){return{...n,...st(t,n),columns:it(e,t,[5,4,3,2],1)}}(a,{photos:t,...i});return h(ct,{layout:"masonry",ref:r,model:o(()=>void 0!==a&&void 0!==l&&void 0!==c&&void 0!==d?vt(t,l,c,a,d):void 0,[t,l,c,a,d]),...p})});function Tt(t){return t?String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""}var xt=class{constructor(t,e={}){this.lightbox=t,this.aiSummaryVisible=!1,this.currentSummary=null,this.options={aiSummaryButtonOrder:7,width:"400px",height:"300px",transition:"0.3s ease",...e},document.head.insertAdjacentHTML("beforeend",`<style>\n .pswp__ai-summary-panel {\n background: rgba(30, 30, 30, 0.9);\n color: white;\n position: absolute;\n overflow-y: auto;\n z-index: 1;\n transition: transform ${this.options.transition};\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);\n padding: 20px;\n }\n\n /* Desktop styles */\n @media (min-width: 768px) {\n .pswp__ai-summary-panel {\n top: 0;\n right: 0;\n height: 100%;\n width: ${this.options.width};\n transform: translateX(100%);\n }\n\n .pswp__ai-summary-panel.visible {\n transform: translateX(0);\n }\n\n .pswp__container.shifted-for-ai-summary {\n transform: translateX(-${this.options.width});\n transition: transform ${this.options.transition};\n }\n }\n\n /* Mobile styles */\n @media (max-width: 767px) {\n .pswp__ai-summary-panel {\n bottom: 0;\n left: 0;\n width: 100%;\n height: ${this.options.height};\n transform: translateY(100%);\n }\n\n .pswp__ai-summary-panel.visible {\n transform: translateY(0);\n }\n\n .pswp__container.shifted-for-ai-summary {\n transform: translateY(-${this.options.height});\n transition: transform ${this.options.transition};\n }\n }\n\n .pswp__ai-summary-close {\n position: absolute;\n top: 10px;\n right: 10px;\n width: 32px;\n height: 32px;\n opacity: 0.6;\n cursor: pointer;\n z-index: 2;\n background: rgba(0, 0, 0, 0.3);\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: opacity 0.3s;\n }\n\n .pswp__ai-summary-close:hover {\n opacity: 1;\n }\n\n .pswp__ai-summary-close:before,\n .pswp__ai-summary-close:after {\n position: absolute;\n content: '';\n width: 16px;\n height: 2px;\n background-color: white;\n }\n\n .pswp__ai-summary-close:before {\n transform: rotate(45deg);\n }\n\n .pswp__ai-summary-close:after {\n transform: rotate(-45deg);\n }\n\n .pswp__ai-summary-content {\n margin-top: 20px;\n }\n\n .pswp__ai-summary-title {\n margin-bottom: 16px;\n font-size: 18px;\n font-weight: bold;\n padding-right: 30px; /* Add space for the close button */\n }\n\n .pswp__ai-summary-section {\n margin-bottom: 16px;\n }\n\n .pswp__ai-summary-section-title {\n font-weight: bold;\n margin-bottom: 8px;\n }\n\n .pswp__ai-summary-label {\n display: inline-flex;\n align-items: center;\n background: rgba(255, 255, 255, 0.1);\n border-radius: 12px;\n padding: 4px 12px;\n margin-right: 8px;\n margin-bottom: 8px;\n font-size: 14px;\n }\n\n .pswp__ai-summary-description {\n font-size: 14px;\n line-height: 1.5;\n }\n\n .pswp__ai-summary-empty {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: rgba(255, 255, 255, 0.6);\n font-style: italic;\n }\n\n .pswp__ai-summary-bing-search {\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 8px;\n z-index: 2;\n }\n\n .pswp__ai-summary-bing-button {\n height: 32px;\n background: rgba(255, 255, 255, 0.2);\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: background-color 0.3s;\n }\n\n .pswp__ai-summary-bing-button:hover {\n background: rgba(255, 255, 255, 0.4);\n }\n\n .pswp__ai-summary-bing-icon {\n width: 20px;\n height: 20px;\n }\n\n .pswp__ai-summary-disclaimer {\n font-size: 12px;\n color: rgba(255, 255, 255, 0.7);\n text-align: center;\n margin-top: 32px;\n padding: 0 10px;\n line-height: 1.4;\n font-style: italic;\n }\n </style>`),t.on("init",()=>{this.initPswpEvents(t.pswp)})}initPswpEvents(t){t.on("uiRegister",()=>{t.ui.registerElement({name:"ai-summary-toggle-button",title:"Toggle AI summary view",order:this.options.aiSummaryButtonOrder,isButton:!0,html:'<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 24 24">\n <use class="pswp__icn-shadow" xlink:href="#pswp__icn-ai-summary"/>\n <path d="M12 17q.425 0 .713-.288T13 16v-4q0-.425-.288-.712T12 11t-.712.288T11 12v4q0 .425.288.713T12 17m0-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20m0-8"/>\n </svg>',onClick:()=>{this.toggleAISummary(t)}}),t.ui.registerElement({name:"ai-summary-panel",isButton:!1,appendTo:"root",html:'<div class="pswp__ai-summary-panel"><div class="pswp__ai-summary-close"></div></div>'})}),t.on("change",()=>{this.aiSummaryVisible&&this.updateAISummary(t)}),t.on("close",()=>{this.hideAISummary(t)}),t.on("firstUpdate",()=>{const e=t.element.querySelector(".pswp__ai-summary-close");e&&e.addEventListener("click",()=>{this.hideAISummary(t)})})}toggleAISummary(t){this.aiSummaryVisible?this.hideAISummary(t):this.showAISummary(t)}showAISummary(t){const e=t.container,n=t.element.querySelector(".pswp__ai-summary-panel");n&&(this.aiSummaryVisible=!0,n.classList.add("visible"),e.classList.add("shifted-for-ai-summary"),this.updateAISummary(t))}hideAISummary(t){const e=t.container,n=t.element.querySelector(".pswp__ai-summary-panel");n&&(this.aiSummaryVisible=!1,n.classList.remove("visible"),e.classList.remove("shifted-for-ai-summary"))}updateAISummary(t){if(!t.currSlide)return;const e=t.element.querySelector(".pswp__ai-summary-panel");if(!e)return;const n=t.currSlide.data,i=n.src||n.url||"";let s=null;try{n.contentSummary&&(s=JSON.parse(n.contentSummary),this.currentSummary=s)}catch(r){console.error("Error parsing AI summary data:",r)}const o=i?`<a class="pswp__ai-summary-bing-search" href="https://www.bing.com/images/search?view=detailv2&iss=SBI&form=SBIIRP&sbisrc=UrlPaste&q=imgurl:${encodeURIComponent(i)}&idpbck=1&selectedindex=0&id=${encodeURIComponent(i)}&mediaurl=${encodeURIComponent(i)}" target="_blank" rel="noopener noreferrer" class="pswp__ai-summary-bing-button">\n <svg xmlns="http://www.w3.org/2000/svg" style="height:24px;width:24px" width="256" height="388" viewBox="0 0 256 388"><defs><radialGradient id="logosBing0" cx="93.717%" cy="77.818%" r="143.121%" fx="93.717%" fy="77.818%" gradientTransform="scale(-1 -.71954)rotate(49.091 2.036 -2.204)"><stop offset="0%" stop-color="#00cacc"/><stop offset="100%" stop-color="#048fce"/></radialGradient><radialGradient id="logosBing1" cx="13.893%" cy="71.448%" r="150.086%" fx="13.893%" fy="71.448%" gradientTransform="matrix(.55155 -.39387 .23634 .91917 -.107 .112)"><stop offset="0%" stop-color="#00bbec"/><stop offset="100%" stop-color="#2756a9"/></radialGradient><linearGradient id="logosBing2" x1="50%" x2="50%" y1="0%" y2="100%"><stop offset="0%" stop-color="#00bbec"/><stop offset="100%" stop-color="#2756a9"/></linearGradient></defs><path fill="url(#logosBing0)" d="M129.424 122.047c-7.133.829-12.573 6.622-13.079 13.928c-.218 3.147-.15 3.36 6.986 21.722c16.233 41.774 20.166 51.828 20.827 53.243c1.603 3.427 3.856 6.65 6.672 9.544c2.16 2.22 3.585 3.414 5.994 5.024c4.236 2.829 6.337 3.61 22.818 8.49c16.053 4.754 24.824 7.913 32.381 11.664c9.791 4.86 16.623 10.387 20.944 16.946c3.1 4.706 5.846 13.145 7.04 21.64c.468 3.321.47 10.661.006 13.663c-1.008 6.516-3.021 11.976-6.101 16.545c-1.638 2.43-1.068 2.023 1.313-.939c6.74-8.379 13.605-22.7 17.108-35.687c4.24-15.718 4.817-32.596 1.66-48.57c-6.147-31.108-25.786-57.955-53.444-73.06c-1.738-.95-8.357-4.42-17.331-9.085a1633 1633 0 0 1-4.127-2.154c-.907-.477-2.764-1.447-4.126-2.154c-1.362-.708-5.282-2.75-8.711-4.539l-8.528-4.446a6021 6021 0 0 1-8.344-4.357c-8.893-4.655-12.657-6.537-13.73-6.863c-1.125-.343-3.984-.782-4.701-.723c-.152.012-.838.088-1.527.168"/><path fill="url(#logosBing1)" d="M148.81 277.994c-.493.292-1.184.714-1.537.938c-.354.225-1.137.712-1.743 1.083a8315 8315 0 0 0-13.204 8.137a2848 2848 0 0 0-8.07 4.997a388 388 0 0 1-3.576 2.198c-.454.271-2.393 1.465-4.31 2.654a2652 2652 0 0 1-7.427 4.586a3958 3958 0 0 0-8.62 5.316a3011 3011 0 0 1-7.518 4.637c-1.564.959-3.008 1.885-3.21 2.058c-.3.257-14.205 8.87-21.182 13.121c-5.3 3.228-11.43 5.387-17.705 6.235c-2.921.395-8.45.396-11.363.003c-7.9-1.067-15.176-4.013-21.409-8.666c-2.444-1.826-7.047-6.425-8.806-8.8c-4.147-5.598-6.829-11.602-8.218-18.396c-.32-1.564-.622-2.884-.672-2.935c-.13-.13.105 2.231.528 5.319c.44 3.211 1.377 7.856 2.387 11.829c7.814 30.743 30.05 55.749 60.15 67.646c8.668 3.424 17.415 5.582 26.932 6.64c3.576.4 13.699.56 17.43.276c17.117-1.296 32.02-6.334 47.308-15.996c1.362-.86 3.92-2.474 5.685-3.585a877 877 0 0 0 4.952-3.14c.958-.615 2.114-1.341 2.567-1.614a91 91 0 0 0 2.018-1.268c.656-.424 3.461-2.2 6.235-3.944l11.092-7.006l3.809-2.406l.137-.086l.42-.265l.199-.126l2.804-1.771l9.69-6.121c12.348-7.759 16.03-10.483 21.766-16.102c2.392-2.342 5.997-6.34 6.176-6.848c.037-.104.678-1.092 1.424-2.197c3.036-4.492 5.06-9.995 6.064-16.484c.465-3.002.462-10.342-.005-13.663c-.903-6.42-2.955-13.702-5.167-18.339c-3.627-7.603-11.353-14.512-22.453-20.076c-3.065-1.537-6.23-2.943-6.583-2.924c-.168.009-10.497 6.322-22.954 14.03c-12.457 7.71-23.268 14.4-24.025 14.87s-2.056 1.263-2.888 1.764z"/><path fill="url(#logosBing2)" d="m.053 241.013l.054 53.689l.695 3.118c2.172 9.747 5.937 16.775 12.482 23.302c3.078 3.07 5.432 4.922 8.768 6.896c7.06 4.177 14.657 6.238 22.978 6.235c8.716-.005 16.256-2.179 24.025-6.928c1.311-.801 6.449-3.964 11.416-7.029l9.032-5.572v-127.4l-.002-58.273c-.002-37.177-.07-59.256-.188-60.988c-.74-10.885-5.293-20.892-12.948-28.461c-2.349-2.323-4.356-3.875-10.336-7.99a25160 25160 0 0 1-12.104-8.336L28.617 5.835C22.838 1.85 22.386 1.574 20.639.949C18.367.136 15.959-.163 13.67.084C6.998.804 1.657 5.622.269 12.171C.053 13.191.013 26.751.01 100.35l-.003 86.975H0z"/></svg>\n <span>Search on Bing</span>\n </a>\n <div class="pswp__ai-summary-disclaimer">\n These are AI generated summaries based on the content. Please verify the information before using it.\n </div>`:"";if(s){e.innerHTML=`<div class="pswp__ai-summary-close"></div>${this.renderAISummary(s)}${o}`;const n=e.querySelector(".pswp__ai-summary-close");n&&n.addEventListener("click",()=>{this.hideAISummary(t)})}else{e.innerHTML=`<div class="pswp__ai-summary-close"></div><div class="pswp__ai-summary-empty">No AI summary available for this content</div>${o}`;const n=e.querySelector(".pswp__ai-summary-close");n&&n.addEventListener("click",()=>{this.hideAISummary(t)})}}renderAISummary(t){let e='<div class="pswp__ai-summary-content">';return t.subject&&(e+=`<div class="pswp__ai-summary-title">${Tt(t.subject)}</div>`),t.labels&&Object.entries(t.labels).filter(([t,e])=>Array.isArray(e)&&e.length>0).forEach(([t,n])=>{e+=`\n <div class="pswp__ai-summary-section">\n <div class="pswp__ai-summary-section-title">${Tt(t.replace("_"," ").replace(/\b\w/g,t=>t.toUpperCase()))}</div>\n <div class="pswp__ai-summary-labels space-y-2">\n ${n.map(t=>`<span class="pswp__ai-summary-label">${Tt(t)}</span>`).join("")}\n </div>\n </div>\n `}),t.description&&(e+=`\n <div class="pswp__ai-summary-section">\n <div class="pswp__ai-summary-description">${Tt(t.description)}</div>\n </div>\n `),e+="</div>",e}},_t='url("https://res.cloudinary.com/dectzk2b2/image/upload/v1736933014/black_rpie3v.png")',qt=class{constructor(t){this.backdropOn=!1,this.lightbox=t,this.backgroundElement=null,this.backgroundVideoElement=null,this.referenceVideoElement=null,this.options={toggleBackdropButtonOrder:7},t.on("init",()=>{this.initPswpEvents(t.pswp)})}initPswpEvents(t){t.on("afterInit",()=>{setTimeout(()=>{this.backgroundElement.style.display="block",this.backgroundVideoElement.style.display="block"},[500])}),t.on("uiRegister",()=>{t.ui.registerElement({name:"toggle-backdrop-button",title:"Toggle blur backdrop",order:this.options.toggleBackdropButtonOrder,isButton:!0,html:'<svg aria-hidden="true" class="pswp__icn p-0.5" viewBox="0 0 24 24"><use class="pswp__icn-shadow" xlink:href="#pswp__icn-show-backdrop"/><use class="pswp__icn-shadow" xlink:href="#pswp__icn-hide-backdrop"/><path id="pswp__icn-show-backdrop" style="display:none" d="M3 14.5q-.2 0-.35-.15T2.5 14t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15m0-4q-.2 0-.35-.15T2.5 10t.15-.35T3 9.5t.35.15t.15.35t-.15.35t-.35.15M6 19q-.425 0-.712-.288T5 18t.288-.712T6 17t.713.288T7 18t-.288.713T6 19m0-4q-.425 0-.712-.288T5 14t.288-.712T6 13t.713.288T7 14t-.288.713T6 15m0-4q-.425 0-.712-.288T5 10t.288-.712T6 9t.713.288T7 10t-.288.713T6 11m0-4q-.425 0-.712-.288T5 6t.288-.712T6 5t.713.288T7 6t-.288.713T6 7m4 8.5q-.625 0-1.062-.437T8.5 14t.438-1.062T10 12.5t1.063.438T11.5 14t-.437 1.063T10 15.5m0-4q-.625 0-1.062-.437T8.5 10t.438-1.062T10 8.5t1.063.438T11.5 10t-.437 1.063T10 11.5m0 7.5q-.425 0-.712-.288T9 18t.288-.712T10 17t.713.288T11 18t-.288.713T10 19m0-12q-.425 0-.712-.288T9 6t.288-.712T10 5t.713.288T11 6t-.288.713T10 7m0 14.5q-.2 0-.35-.15T9.5 21t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15m0-18q-.2 0-.35-.15T9.5 3t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15m4 12q-.625 0-1.062-.437T12.5 14t.438-1.062T14 12.5t1.063.438T15.5 14t-.437 1.063T14 15.5m0-4q-.625 0-1.062-.437T12.5 10t.438-1.062T14 8.5t1.063.438T15.5 10t-.437 1.063T14 11.5m0 7.5q-.425 0-.712-.288T13 18t.288-.712T14 17t.713.288T15 18t-.288.713T14 19m0-12q-.425 0-.712-.288T13 6t.288-.712T14 5t.713.288T15 6t-.288.713T14 7m0 14.5q-.2 0-.35-.15T13.5 21t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15m0-18q-.2 0-.35-.15T13.5 3t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15M18 19q-.425 0-.712-.288T17 18t.288-.712T18 17t.713.288T19 18t-.288.713T18 19m0-4q-.425 0-.712-.288T17 14t.288-.712T18 13t.713.288T19 14t-.288.713T18 15m0-4q-.425 0-.712-.288T17 10t.288-.712T18 9t.713.288T19 10t-.288.713T18 11m0-4q-.425 0-.712-.288T17 6t.288-.712T18 5t.713.288T19 6t-.288.713T18 7m3 7.5q-.2 0-.35-.15T20.5 14t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15m0-4q-.2 0-.35-.15T20.5 10t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15"/><path id="pswp__icn-hide-backdrop" d="m19.1 21.9l-17-17q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275l17 17q.275.275.275.7t-.275.7t-.7.275t-.7-.275m-9.1-.4q-.2 0-.35-.15T9.5 21t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15m4 0q-.2 0-.35-.15T13.5 21t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15M6 19q-.425 0-.712-.288T5 18t.288-.712T6 17t.713.288T7 18t-.288.713T6 19m4 0q-.425 0-.712-.288T9 18t.288-.712T10 17t.713.288T11 18t-.288.713T10 19m4 0q-.425 0-.712-.288T13 18t.288-.712T14 17t.713.288T15 18t-.288.713T14 19m-4-3.5q-.65 0-1.075-.425T8.5 14t.425-1.075T10 12.5t1.075.425T11.5 14t-.425 1.075T10 15.5M6 15q-.425 0-.712-.288T5 14t.288-.712T6 13t.713.288T7 14t-.288.713T6 15m11.8-.025l-.775-.775q-.1-.5.213-.85T18 13q.425 0 .713.288T19 14q0 .45-.35.763t-.85.212M3 14.5q-.2 0-.35-.15T2.5 14t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15m18 0q-.2 0-.35-.15T20.5 14t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15m-6.7-3.05L12.55 9.7q.125-.525.5-.862T14 8.5q.65 0 1.075.425T15.5 10q0 .575-.35.963t-.85.487M6 11q-.425 0-.712-.287T5 10t.288-.712T6 9t.713.288T7 10t-.288.713T6 11m12 0q-.425 0-.712-.288T17 10t.288-.712T18 9t.713.288T19 10t-.288.713T18 11m-15-.5q-.2 0-.35-.15T2.5 10t.15-.35T3 9.5t.35.15t.15.35t-.15.35t-.35.15m18 0q-.2 0-.35-.15T20.5 10t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15M14 7q-.425 0-.712-.288T13 6t.288-.712T14 5t.713.288T15 6t-.288.713T14 7m-4.175-.025l-.8-.8q-.075-.5.225-.837T10 5q.425 0 .712.287T11 6q0 .45-.337.75t-.838.225M18 7q-.425 0-.712-.288T17 6t.288-.712T18 5t.713.288T19 6t-.288.713T18 7m-8-3.5q-.2 0-.35-.15T9.5 3t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15m4 0q-.2 0-.35-.15T13.5 3t.15-.35t.35-.15t.35.15t.15.35t-.15.35t-.35.15" /></svg>',onClick:()=>{this.toggleBackdrop(t)}}),this.createBlurBackground(t)}),t.on("change",()=>{this.backdropOn&&this.updateBlurBackground(t)}),t.on("close",()=>{this.removeBlurBackground(),this.backdropOn=!1})}createBlurBackground(t){const e=t.element;if(!this.backgroundElement){const t=document.createElement("div");t.style.position="fixed",t.style.top=0,t.style.left=0,t.style.width="100vw",t.style.height="100vh",t.style.backgroundSize="cover",t.style.backgroundPosition="center",t.style.filter="blur(44px)",t.style.zIndex=-1,t.style.transition="background-image 0.5s ease, opacity 0.5s ease",t.style.display="none",t.style.backgroundImage=_t,e.append(t),this.backgroundElement=t}if(!this.backgroundVideoElement){const t=document.createElement("video");t.style.position="fixed",t.style.top=0,t.style.left=0,t.style.width="100vw",t.style.height="100vh",t.style.objectFit="cover",t.style.filter="blur(44px)",t.style.zIndex=-1,t.style.display="none",t.style.transition="opacity 0.5s ease",t.muted=!0,t.loop=!0,t.autoplay=!1,t.muted=!0,t.volume=0,e.append(t),this.backgroundVideoElement=t}}toggleBackdrop(t){this.backdropOn?(this.backgroundElement.style.backgroundImage=_t,this.backgroundVideoElement.style.opacity=0,this.backgroundVideoElement.pause(),this.backdropOn=!1):(this.updateBlurBackground(t),this.backdropOn=!0),document.querySelector("#pswp__icn-hide-backdrop").style.display=this.backdropOn?"none":"inline",document.querySelector("#pswp__icn-show-backdrop").style.display=this.backdropOn?"inline":"none"}updateBlurBackground(t){const e=t.currSlide;if(e?.data)if("video"===e.data.type){const t=this.backgroundVideoElement,n=e.content.element;"video"===n?.tagName?.toLowerCase()&&(this.referenceVideoElement=n,this.registerVideoEvents(n,t)),t.style.opacity=0,setTimeout(()=>{t.src=e.data.src,t.load(),this.initBackgroundVideo(),t.style.opacity=1},500),this.backgroundElement&&(this.backgroundElement.style.opacity=0)}else{if(this.backgroundElement){const t=((t,e=32,n=32)=>{if(!t||t.length<6||"undefined"==typeof document)return null;try{const i=Y(t,e,n),s=document.createElement("canvas");s.width=e,s.height=n;const o=s.getContext("2d");if(!o)return null;const r=o.createImageData(e,n);return r.data.set(i),o.putImageData(r,0,0),s.toDataURL()}catch(i){return console.warn("[PhotoSwipeBackdrop] Failed to decode blurhash:",i),null}})(e.data.blurhash)||e.data.thumbnailUrl||e.data.src;this.backgroundElement.style.backgroundImage=t?`url("${t}")`:_t,this.backgroundElement.style.backgroundColor="transparent",this.backgroundElement.style.opacity=1}this.backgroundVideoElement&&(this.backgroundVideoElement.style.opacity=0,this.backgroundVideoElement.src="")}}initBackgroundVideo(){this.referenceVideoElement&&(this.backgroundVideoElement.currentTime=this.referenceVideoElement.currentTime,this.referenceVideoElement.currentTime>0&&!this.referenceVideoElement.paused&&!this.referenceVideoElement.ended&&this.referenceVideoElement.readyState>2&&this.backgroundVideoElement.play())}removeBlurBackground(){this.backgroundElement&&(this.backgroundElement.remove(),this.backgroundVideoElement.remove(),this.backgroundElement=null,this.backgroundVideoElement=null)}registerVideoEvents(t,e){this.foregroundVideoElement=t,t.addEventListener("play",()=>{e.currentTime=t.currentTime,e.play()}),t.addEventListener("pause",()=>{e.pause()}),t.addEventListener("ended",()=>{e.pause(),e.currentTime=0})}};function kt(t){return t?String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""}var St={[L.LINK]:'<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path fill="currentColor" d="M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h6q.425 0 .713.288T12 4t-.288.713T11 5H5v14h14v-6q0-.425.288-.712T20 12t.713.288T21 13v6q0 .825-.587 1.413T19 21zM19 6.4L10.4 15q-.275.275-.7.275T9 15t-.275-.7t.275-.7L17.6 5H15q-.425 0-.712-.288T14 4t.288-.712T15 3h5q.425 0 .713.288T21 4v5q0 .425-.288.713T20 10t-.712-.288T19 9z"/></svg>',[L.EMAIL]:'<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path fill="currentColor" d="M12 22q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12v1.45q0 1.475-1.012 2.513T18.5 17q-.875 0-1.65-.375t-1.3-1.075q-.725.725-1.638 1.088T12 17q-2.075 0-3.537-1.463T7 12t1.463-3.537T12 7t3.538 1.463T17 12v1.45q0 .65.425 1.1T18.5 15t1.075-.45t.425-1.1V12q0-3.35-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20h4q.425 0 .713.288T17 21t-.288.713T16 22zm0-7q1.25 0 2.125-.875T15 12t-.875-2.125T12 9t-2.125.875T9 12t.875 2.125T12 15"/></svg>',[L.PHONE]:'<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path fill="currentColor" d="M19.95 21q-3.125 0-6.175-1.362t-5.55-3.863t-3.862-5.55T3 4.05q0-.45.3-.75t.75-.3H8.1q.35 0 .625.238t.325.562l.65 3.5q.05.4-.025.675T9.4 8.45L6.975 10.9q.5.925 1.187 1.787t1.513 1.663q.775.775 1.625 1.438T13.1 17l2.35-2.35q.225-.225.588-.337t.712-.063l3.45.7q.35.1.575.363T21 15.9v4.05q0 .45-.3.75t-.75.3M6.025 9l1.65-1.65L7.25 5H5.025q.125 1.025.35 2.025T6.025 9m8.95 8.95q.975.425 1.988.675T19 18.95v-2.2l-2.35-.475zm0 0"/></svg>',[L.SMS]:'<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path fill="currentColor" d="m6 18l-2.3 2.3q-.475.475-1.088.213T2 19.575V4q0-.825.588-1.412T4 2h16q.825 0 1.413.588T22 4v12q0 .825-.587 1.413T20 18zm-.85-2H20V4H4v13.125zM4 16V4zm4-5q.425 0 .713-.288T9 10t-.288-.712T8 9t-.712.288T7 10t.288.713T8 11m4 0q.425 0 .713-.288T13 10t-.288-.712T12 9t-.712.288T11 10t.288.713T12 11m4 0q.425 0 .713-.288T17 10t-.288-.712T16 9t-.712.288T15 10t.288.713T16 11"/></svg>',[L.WHATSAPP]:'<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 258"><defs><linearGradient id="logosWhatsappIcon0" x1="50%" x2="50%" y1="100%" y2="0%"><stop offset="0%" stop-color="#1faf38"/><stop offset="100%" stop-color="#60d669"/></linearGradient><linearGradient id="logosWhatsappIcon1" x1="50%" x2="50%" y1="100%" y2="0%"><stop offset="0%" stop-color="#f9f9f9"/><stop offset="100%" stop-color="#fff"/></linearGradient></defs><path fill="url(#logosWhatsappIcon0)" d="M5.463 127.456c-.006 21.677 5.658 42.843 16.428 61.499L4.433 252.697l65.232-17.104a123 123 0 0 0 58.8 14.97h.054c67.815 0 123.018-55.183 123.047-123.01c.013-32.867-12.775-63.773-36.009-87.025c-23.23-23.25-54.125-36.061-87.043-36.076c-67.823 0-123.022 55.18-123.05 123.004"/><path fill="url(#logosWhatsappIcon1)" d="M1.07 127.416c-.007 22.457 5.86 44.38 17.014 63.704L0 257.147l67.571-17.717c18.618 10.151 39.58 15.503 60.91 15.511h.055c70.248 0 127.434-57.168 127.464-127.423c.012-34.048-13.236-66.065-37.3-90.15C194.633 13.286 162.633.014 128.536 0C58.276 0 1.099 57.16 1.071 127.416m40.24 60.376l-2.523-4.005c-10.606-16.864-16.204-36.352-16.196-56.363C22.614 69.029 70.138 21.52 128.576 21.52c28.3.012 54.896 11.044 74.9 31.06c20.003 20.018 31.01 46.628 31.003 74.93c-.026 58.395-47.551 105.91-105.943 105.91h-.042c-19.013-.01-37.66-5.116-53.922-14.765l-3.87-2.295l-40.098 10.513z"/><path fill="#fff" d="M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64"/></svg>',[L.MESSENGER]:'<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256"><defs><radialGradient id="logosMessenger0" cx="19.247%" cy="99.465%" r="108.96%" fx="19.247%" fy="99.465%"><stop offset="0%" stop-color="#09f"/><stop offset="60.975%" stop-color="#a033ff"/><stop offset="93.482%" stop-color="#ff5280"/><stop offset="100%" stop-color="#ff7061"/></radialGradient></defs><path fill="url(#logosMessenger0)" d="M128 0C55.894 0 0 52.818 0 124.16c0 37.317 15.293 69.562 40.2 91.835c2.09 1.871 3.352 4.493 3.438 7.298l.697 22.77c.223 7.262 7.724 11.988 14.37 9.054L84.111 243.9a10.22 10.22 0 0 1 6.837-.501c11.675 3.21 24.1 4.92 37.052 4.92c72.106 0 128-52.818 128-124.16S200.106 0 128 0"/><path fill="#fff" d="m51.137 160.47l37.6-59.653c5.98-9.49 18.788-11.853 27.762-5.123l29.905 22.43a7.68 7.68 0 0 0 9.252-.027l40.388-30.652c5.39-4.091 12.428 2.36 8.82 8.085l-37.6 59.654c-5.981 9.489-18.79 11.852-27.763 5.122l-29.906-22.43a7.68 7.68 0 0 0-9.25.027l-40.39 30.652c-5.39 4.09-12.427-2.36-8.818-8.085"/></svg>'},It=class{constructor(t,e,n){this.lightbox=t,this.captureAdImpression=e,this.captureAdClick=n,this.captionOn=!0,this.options={captionButtonOrder:8},t.on("init",()=>{this.initPswpEvents(t.pswp)})}getRootNode(){return this.lightbox?.pswp?.element?.getRootNode?.()||document}getElementById(t){const e=this.getRootNode();return"function"==typeof e.getElementById?e.getElementById(t):e.querySelector?.(`#${t}`)||document.getElementById(t)}querySelector(t){return this.getRootNode().querySelector?.(t)||document.querySelector(t)}initPswpEvents(t){t.on("uiRegister",()=>{t.ui.registerElement({name:"caption-toggle-button",title:"Toggle caption view",order:this.options.captionButtonOrder,isButton:!0,html:'<svg aria-hidden="true" class="pswp__icn p-0.5" viewBox="0 0 24 24"><use class="pswp__icn-shadow" xlink:href="#pswp__icn-show-caption"/><use class="pswp__icn-shadow" xlink:href="#pswp__icn-hide-caption"/><path id="pswp__icn-show-caption" d="M5 20q-.825 0-1.412-.587T3 18V6q0-.825.588-1.412T5 4h14q.825 0 1.413.588T21 6v12q0 .825-.587 1.413T19 20zm0-2h14V6H5zm2-3h3q.425 0 .713-.288T11 14v-.5q0-.225-.15-.375t-.375-.15h-.45q-.225 0-.375.15t-.15.375h-2v-3h2q0 .225.15.375t.375.15h.45q.225 0 .375-.15T11 10.5V10q0-.425-.288-.712T10 9H7q-.425 0-.712.288T6 10v4q0 .425.288.713T7 15m10-6h-3q-.425 0-.712.288T13 10v4q0 .425.288.713T14 15h3q.425 0 .713-.288T18 14v-.5q0-.225-.15-.375t-.375-.15h-.45q-.225 0-.375.15t-.15.375h-2v-3h2q0 .225.15.375t.375.15h.45q.225 0 .375-.15T18 10.5V10q0-.425-.288-.712T17 9M5 18V6z"/><path id="pswp__icn-hide-caption" style="display:none" d="m9.025 9l1.5 1.5H7.5v3h2q0-.225.15-.375t.375-.15h.45q.225 0 .375.15t.15.375v.5q0 .425-.288.713T10 15H7q-.425 0-.712-.288T6 14v-4q0-.425.288-.712T7 9zM21 6v10q0 .5-.325.763t-.7.262t-.675-.262T19 16V6H8.975q-.5 0-.75-.312T7.975 5t.25-.687t.75-.313H19q.825 0 1.413.588T21 6m-3 8q0 .225-.088.438t-.262.337L16.375 13.5h.125q0-.225.15-.375t.375-.15h.45q.225 0 .375.15t.15.375zm-1-5q.425 0 .713.288T18 10v.5q0 .225-.15.375t-.375.15h-.45q-.225 0-.375-.15t-.15-.375h-2v1.125l-1.5-1.5V10q0-.425.288-.712T14 9zM5 20q-.825 0-1.412-.587T3 18V6q0-.625.338-1.112t.862-.713L6.025 6H5v12h10.175L1.375 4.225q-.3-.3-.3-.712t.3-.713t.713-.3t.712.3l18.375 18.375q.3.3.3.713t-.3.712t-.712.3t-.713-.3L17.175 20z"/></svg>',onClick:()=>{this.toggleCaption(t)}}),t.ui.registerElement({name:"custom-caption",isButton:!1,appendTo:"root",html:'<div id="pswp-caption-container" class=" absolute bottom-0 w-full"></div>'})}),t.on("change",()=>{this.captionOn&&this.updateCaption(t)}),t.on("close",()=>{this.clearCaption()})}toggleCaption(t){this.captionOn?this.clearCaption():this.updateCaption(t),this.captionOn=!this.captionOn;const e=this.querySelector("#pswp__icn-show-caption"),n=this.querySelector("#pswp__icn-hide-caption");e&&(e.style.display=this.captionOn?"inline":"none"),n&&(n.style.display=this.captionOn?"none":"inline")}createCaptionHTML(t){const{id:e,type:n,caption:i,title:s,description:o,targetType:r,targetText:a,targetUrl:l}=t||{},c=Boolean(r)&&String(r)!==String(L.NONE),d=c?r:L.LINK;switch("ad"===n&&this.captureAdImpression&&this.captureAdImpression(e),n){case"image":case"video":return i?.length>0?`\n <div class=" w-full bg-black bg-opacity-50 p-4 text-gray-300">\n <h3 class=" text-center sm:text-lg">${kt(i)}</h3>\n </div>\n `:"";case"ad":return`\n <div class=" w-full bg-black/85 p-4 text-white">\n <div class=" mx-auto w-full max-w-2xl space-y-2 text-center">\n <h3 class=" text-center sm:text-lg">${kt(s)}</h3>\n <h4 class=" pb-2 text-center text-sm sm:text-base">${kt(o)}</h4>\n ${c?`<button\n class=" flex w-full items-center justify-center gap-3 rounded-md bg-white py-1 text-lg text-black caption-action-button"\n data-id="${kt(e)}"\n data-target-type="${kt(d)}"\n data-target-url="${kt(l)}">\n ${St[d]}\n ${kt(a)}\n </button>`:""}\n </div>\n </div>\n `;default:return""}}updateCaption(t){try{const e=this.getElementById("pswp-caption-container");if(!e)return;const n=t.currSlide?.data;e.innerHTML=this.createCaptionHTML(n);const i=e.querySelector(".caption-action-button");i&&i.addEventListener("click",t=>{const e=t.currentTarget.dataset.id,n=t.currentTarget.dataset.targetType,i=t.currentTarget.dataset.targetUrl;this.captureAdClick&&e&&this.captureAdClick(e,n,i)})}catch(e){console.error("Error rendering caption:",e)}}clearCaption(){const t=this.getElementById("pswp-caption-container");t&&(t.innerHTML="")}},Et=({contents:t=[],selectedIndex:e,onClick:n})=>{const i=a(null);m(()=>{i.current&&s(e)},[e,i.current]);const s=t=>{if(!i.current)return;const e=i.current,n=e.children;if(t<0||t>=n.length)return;const s=n[t],o=e.offsetWidth/2,r=s.offsetLeft+s.offsetWidth/2-o;e.scrollTo({left:r,behavior:"smooth"})};/* @__PURE__ */
|
|
2
|
+
return h("div",{ref:i,className:"scrollbar-hide flex h-28 w-auto items-center justify-center overflow-x-auto bg-black/50",style:{scrollBehavior:"smooth",userSelect:"none",whiteSpace:"nowrap"},children:t.map((t,i)=>/* @__PURE__ */h("button",{className:"relative mx-0.5 inline-block lg:mx-1.5",onClick:()=>((t,e)=>{n(e)})(0,i),children:[
|
|
3
|
+
/* @__PURE__ */h(Z,{wrapperClassName:S("h-16 w-24 rounded-md lg:h-20 lg:w-20",i===e&&"border-2 border-[#ff4800]"),src:t.thumbnailUrl,placeholderSrc:t.blurImageUrl,alt:t.caption}),t.type===b.VIDEO&&/* @__PURE__ */h("div",{className:"absolute top-0 left-0 flex size-full items-center justify-center opacity-75",children:/* @__PURE__ */h("svg",{xmlns:"http://www.w3.org/2000/svg",className:"size-6 text-white lg:size-9",viewBox:"0 0 24 24",children:/* @__PURE__ */h("path",{fill:"currentColor",d:"M8 17.175V6.825q0-.425.3-.713t.7-.287q.125 0 .263.037t.262.113l8.15 5.175q.225.15.338.375t.112.475t-.112.475t-.338.375l-8.15 5.175q-.125.075-.262.113T9 18.175q-.4 0-.7-.288t-.3-.712"})})}),t.type===b.AD&&/* @__PURE__ */h("div",{className:"absolute top-1 left-1 text-xs",children:"Ad"})]},`filmstrip-thumbnail-${i}`))})},Ct=class{constructor(t){this.lightbox=t,this.filmstripVisible=!0,this.options={filmstripButtonOrder:7},t.on("init",()=>{this.initPswpEvents(t.pswp)})}getRootNode(){return this.lightbox?.pswp?.element?.getRootNode?.()||document}getElementById(t){const e=this.getRootNode();return"function"==typeof e.getElementById?e.getElementById(t):e.querySelector?.(`#${t}`)||document.getElementById(t)}querySelector(t){return this.getRootNode().querySelector?.(t)||document.querySelector(t)}initPswpEvents(t){t.on("uiRegister",()=>{t.ui.registerElement({name:"filmstrip-toggle-button",title:"Toggle filmstrip view",order:this.options.filmstripButtonOrder,isButton:!0,html:'<svg aria-hidden="true" class="pswp__icn p-0.5" viewBox="0 0 24 24" id="pswp__icn-show-filmstrip"><use class="pswp__icn-shadow" xlink:href="#pswp__icn-show-filmstrip"/>\n <path\n d="M4 20q-.825 0-1.412-.587T2 18V6q0-.825.588-1.412T4 4h16q.825 0 1.413.588T22 6v12q0 .825-.587 1.413T20 20zm0-2h16V8H4z" />\n <path\n d="m 5.100795,16.58464 q -0.165328,0 -0.282961,-0.116899 Q 4.700201,16.350842 4.7,16.186347 V 13.398294 Q 4.7,13.233997 4.817834,13.117098 4.935667,13.000199 5.100795,13 h 2.805561 q 0.165328,0 0.283161,0.117098 0.117834,0.117099 0.117633,0.281196 v 2.788053 q 0,0.164296 -0.117633,0.281394 -0.117633,0.117099 -0.283161,0.116899 z"\n\n style="stroke-width:0.199771" />\n <path\n\n d="m 10.572144,16.65489 q -0.165329,0 -0.282961,-0.116899 -0.117633,-0.116899 -0.117834,-0.281394 v -2.788053 q 0,-0.164297 0.117834,-0.281196 0.117832,-0.116899 0.282961,-0.117098 h 2.805561 q 0.165328,0 0.283161,0.117098 0.117834,0.117099 0.117633,0.281196 v 2.788053 q 0,0.164296 -0.117633,0.281394 -0.117633,0.117099 -0.283161,0.116899 z"\n\n style="stroke-width:0.199771" />\n <path\n\n d="m 16.049385,16.724729 q -0.165328,0 -0.282961,-0.116899 -0.117633,-0.116899 -0.117834,-0.281394 v -2.788053 q 0,-0.164297 0.117834,-0.281196 0.117833,-0.116899 0.282961,-0.117098 h 2.805561 q 0.165328,0 0.283161,0.117098 0.117834,0.117099 0.117634,0.281196 v 2.788053 q 0,0.164296 -0.117634,0.281394 -0.117633,0.117099 -0.283161,0.116899 z"\n\n style="stroke-width:0.199771" />\n </svg>\n <svg aria-hidden="true" class="pswp__icn p-0.5" viewBox="0 0 24 24" id="pswp__icn-hide-filmstrip" style="display:none"><use class="pswp__icn-shadow" xlink:href="#pswp__icn-hide-filmstrip"/>\n <path\n d="M4 20q-.825 0-1.412-.587T2 18V6q0-.825.588-1.412T4 4v2.85L1.35 4.2q-.3-.3-.3-.712t.3-.713t.713-.3t.712.3l18.4 18.4q.3.3.3.7t-.3.7t-.712.3t-.713-.3L17.15 20zm0-2h11.15l-10-10H4zM22 6v11q0 .5-.312.75T21 18t-.687-.262t-.313-.763V8h-8.325q-.4 0-.763-.15t-.637-.425L8.55 5.7q-.225-.25-.275-.525t.075-.55t.35-.45T9.275 4H20q.825 0 1.413.588T22 6"\n />\n <path\n\n d="m 5.100795,16.58464 q -0.165328,0 -0.282961,-0.116899 Q 4.700201,16.350842 4.7,16.186347 V 13.398294 Q 4.7,13.233997 4.817834,13.117098 4.935667,13.000199 5.100795,13 h 2.805561 q 0.165328,0 0.283161,0.117098 0.117834,0.117099 0.117633,0.281196 v 2.788053 q 0,0.164296 -0.117633,0.281394 -0.117633,0.117099 -0.283161,0.116899 z"\n\n style="stroke-width:0.199771" />\n <path\n\n d="m 10.572143,16.65489 q -0.165327,0 -0.282961,-0.116899 -0.117632,-0.116899 -0.117833,-0.281394 v -2.788053 q 0,-0.164297 0.117833,-0.281196 0.117834,-0.116899 0.282961,-0.117098 h 2.805562 q 0.165328,0 0.283161,0.117098 0.117834,0.117099 0.117633,0.281196 v 2.788053 q 0,0.164296 -0.117633,0.281394 -0.117633,0.117099 -0.283161,0.116899 z"\n\n style="stroke-width:0.199771" />\n <path\n\n d="m 16.049385,16.724729 q -0.165327,0 -0.282961,-0.116899 -0.117632,-0.116899 -0.117833,-0.281394 v -2.788053 q 0,-0.164297 0.117833,-0.281196 0.117834,-0.116899 0.282961,-0.117098 h 2.805561 q 0.165328,0 0.283161,0.117098 0.117834,0.117099 0.117634,0.281196 v 2.788053 q 0,0.164296 -0.117634,0.281394 -0.117633,0.117099 -0.283161,0.116899 z"\n\n style="stroke-width:0.199771" />\n </svg>\n\n ',onClick:()=>{this.toggleFilmstrip()}}),t.ui.registerElement({name:"filmstrip",isButton:!1,appendTo:"root",html:'\n <div id="filmstrip-container" class="w-full absolute bottom-0">\n </div>\n '})}),t.on("change",()=>{this.filmstripVisible&&this.updateFilmstrip(t)}),t.on("close",()=>{this.cleanupFilmstrip()})}onThumbnailClcik(t){this.lightbox.pswp.goTo(t)}updateFilmstrip(t){const e=this.getElementById("filmstrip-container");if(!e)return;n(/* @__PURE__ */h(Et,{contents:t?.options?.dataSource?.items?.map(t=>({id:t.getAttribute("data-pswp-id"),type:t.getAttribute("data-pswp-type"),thumbnailUrl:t.getAttribute("data-pswp-thumbnail-url"),blurImageUrl:t.getAttribute("data-pswp-blur-image-url")||t.getAttribute("data-pswp-blurhash")})),selectedIndex:t.currSlide.index,onClick:t=>this.onThumbnailClcik(t)}),e);const i=this.getElementById("pswp-caption-container");i&&"7rem"!==i.style.bottom&&(i.style.bottom="7rem")}toggleFilmstrip(){this.filmstripVisible?this.cleanupFilmstrip():this.updateFilmstrip(this.lightbox.pswp),this.filmstripVisible=!this.filmstripVisible;const t=this.querySelector("#pswp__icn-show-filmstrip"),e=this.querySelector("#pswp__icn-hide-filmstrip");t&&(t.style.display=this.filmstripVisible?"inline":"none"),e&&(e.style.display=this.filmstripVisible?"none":"inline")}cleanupFilmstrip(){const t=this.getElementById("filmstrip-container"),e=this.getElementById("pswp-caption-container");e&&(e.style.bottom="0"),t&&n(null,t)}},Lt=class{constructor(t){this.lightbox=t,this.fullscreen=!1,this.options={fullScreenButtonOrder:7},t.on("init",()=>{this.initPswpEvents(t.pswp)})}initPswpEvents(t){t.on("uiRegister",()=>{(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)&&t.ui.registerElement({name:"fullscreen-button",title:"Toggle fullscreen view",order:this.options.fullScreenButtonOrder,isButton:!0,html:'<svg aria-hidden="true" class="pswp__icn p-1" viewBox="0 0 24 24"><use class="pswp__icn-shadow" xlink:href="#pswp__icn-fullscreen"/><use class="pswp__icn-shadow" xlink:href="#pswp__icn-exit-fullscreen"/><path id="pswp__icn-fullscreen" d="M5 19h2q.425 0 .713.288T8 20t-.288.713T7 21H4q-.425 0-.712-.288T3 20v-3q0-.425.288-.712T4 16t.713.288T5 17zm14 0v-2q0-.425.288-.712T20 16t.713.288T21 17v3q0 .425-.288.713T20 21h-3q-.425 0-.712-.288T16 20t.288-.712T17 19zM5 5v2q0 .425-.288.713T4 8t-.712-.288T3 7V4q0-.425.288-.712T4 3h3q.425 0 .713.288T8 4t-.288.713T7 5zm14 0h-2q-.425 0-.712-.288T16 4t.288-.712T17 3h3q.425 0 .713.288T21 4v3q0 .425-.288.713T20 8t-.712-.288T19 7z"/><path id="pswp__icn-exit-fullscreen" style="display:none" d="M6 18H4q-.425 0-.712-.288T3 17t.288-.712T4 16h3q.425 0 .713.288T8 17v3q0 .425-.288.713T7 21t-.712-.288T6 20zm12 0v2q0 .425-.288.713T17 21t-.712-.288T16 20v-3q0-.425.288-.712T17 16h3q.425 0 .713.288T21 17t-.288.713T20 18zM6 6V4q0-.425.288-.712T7 3t.713.288T8 4v3q0 .425-.288.713T7 8H4q-.425 0-.712-.288T3 7t.288-.712T4 6zm12 0h2q.425 0 .713.288T21 7t-.288.713T20 8h-3q-.425 0-.712-.288T16 7V4q0-.425.288-.712T17 3t.713.288T18 4z"/></svg>',onClick:()=>{this.toggleFullscreen(t)}})})}toggleFullscreen(t){const e=t.element;this.fullscreen?(document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen(),t.options.showHideAnimationType="zoom",this.fullscreen=!1):(e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen&&e.msRequestFullscreen(),t.options.showHideAnimationType="fade",this.fullscreen=!0),document.querySelector("#pswp__icn-exit-fullscreen").style.display=this.fullscreen?"inline":"none",document.querySelector("#pswp__icn-fullscreen").style.display=this.fullscreen?"none":"inline"}},Nt=class{constructor(t,e={}){this.lightbox=t,this.autoHideTimer=null,this.uiVisible=!0,this.options=Object.assign({defaultDelayMs:4e3,playPauseButtonOrder:9,progressBarPosition:"top",progressBarTransition:"ease",restartOnSlideChange:!0,autoHideProgressBar:!0},e),this.setSlideshowLength(Number(localStorage.getItem("pswp_delay"))||this.options.defaultDelayMs),document.head.insertAdjacentHTML("beforeend",`<style>.pswp__progress-bar{position:fixed;${this.options.progressBarPosition}:0;width:0;height:0}.pswp__progress-bar.running{width:100%;height:2px;transition-property:width;background:#ff4800}</style>`),this.slideshowIsRunning=!1,this.slideshowTimerID=null,this.wakeLockIsRunning=!1,this.wakeLockSentinel=null,this.lightbox.on("init",()=>{this.init(this.lightbox.pswp)})}init(t){t.on("uiRegister",()=>{t.ui.registerElement({name:"playpause-button",title:"Toggle slideshow (Space)\nChange delay with +/- while running",order:this.options.playPauseButtonOrder,isButton:!0,html:'<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 24 24"><use class="pswp__icn-shadow" xlink:href="#pswp__icn-play"/><use class="pswp__icn-shadow" xlink:href="#pswp__icn-stop"/><path id="pswp__icn-play" d="M8 17.175V6.825q0-.425.3-.713t.7-.287q.125 0 .263.037t.262.113l8.15 5.175q.225.15.338.375t.112.475t-.112.475t-.338.375l-8.15 5.175q-.125.075-.262.113T9 18.175q-.4 0-.7-.288t-.3-.712"/><path id="pswp__icn-stop" style="display:none" d="M16 19q-.825 0-1.412-.587T14 17V7q0-.825.588-1.412T16 5t1.413.588T18 7v10q0 .825-.587 1.413T16 19m-8 0q-.825 0-1.412-.587T6 17V7q0-.825.588-1.412T8 5t1.413.588T10 7v10q0 .825-.587 1.413T8 19"/></svg>',onClick:()=>{this.setSlideshowState()}}),t.ui.registerElement({name:"playtime",appendTo:"wrapper",tagName:"div",className:"pswp__progress-bar"}),t.events.add(document,"keydown",t=>{switch(t.code){case"Space":this.setSlideshowState(),t.preventDefault();break;case"ArrowUp":case"NumpadAdd":case"Equal":this.changeSlideshowLength(1e3),t.preventDefault();break;case"ArrowDown":case"NumpadSubtract":case"Minus":this.changeSlideshowLength(-1e3),t.preventDefault()}})}),this.lightbox.on("change",()=>{this.slideshowIsRunning&&this.options.restartOnSlideChange&&this.goToNextSlideAfterTimeout()}),this.lightbox.on("close",()=>{this.slideshowIsRunning&&this.setSlideshowState()})}showUI(){this.lightbox&&this.lightbox.pswp&&this.lightbox.pswp.element&&this.lightbox.pswp.element.classList.add("pswp--ui-visible"),this.uiVisible=!0}stopAutoHideTimer(){this.autoHideTimer&&(clearTimeout(this.autoHideTimer),this.autoHideTimer=null)}hideUI(){this.lightbox&&this.lightbox.pswp&&this.lightbox.pswp.element&&this.lightbox.pswp.element.classList.remove("pswp--ui-visible"),this.uiVisible=!1}resetAutoHideTimer(){this.autoHideTimer&&clearTimeout(this.autoHideTimer),this.autoHideTimer=setTimeout(()=>{this.slideshowIsRunning&&this.hideUI(),this.autoHideTimer=null},[3e3])}setSlideshowState(){this.slideshowIsRunning=!this.slideshowIsRunning,this.slideshowIsRunning?(this.goToNextSlideAfterTimeout(),this.showUI(),this.resetAutoHideTimer(),document.addEventListener("touchstart",()=>{this.stopAutoHideTimer(),this.showUI()}),document.addEventListener("touchend",()=>{this.resetAutoHideTimer()}),document.addEventListener("mousemove",()=>{this.uiVisible||this.showUI(),this.resetAutoHideTimer()})):(this.showUI(),this.resetSlideshow(),this.stopAutoHideTimer()),document.querySelector("#pswp__icn-stop").style.display=this.slideshowIsRunning?"inline":"none",document.querySelector("#pswp__icn-play").style.display=this.slideshowIsRunning?"none":"inline",document.querySelector(".pswp__progress-bar").style.opacity=this.options.autoHideProgressBar?null:1,this.toggleWakeLock()}setSlideshowLength(t){this.options.defaultDelayMs=Math.min(Math.max(t,1e3),2147483647),this.options.defaultDelayMs!=t&&localStorage.setItem("pswp_delay",this.options.defaultDelayMs)}changeSlideshowLength(t){if(!this.slideshowIsRunning)return;this.setSlideshowLength(this.options.defaultDelayMs+t),localStorage.setItem("pswp_delay",this.options.defaultDelayMs);const e=document.querySelector(".pswp__counter");e&&(e.innerHTML=this.options.defaultDelayMs/1e3+"s"),this.goToNextSlideAfterTimeout()}isVideoContent(t){return"video"===t?.data?.type}getSlideTimeout(){const t=this.lightbox.pswp.currSlide.content;if(this.isVideoContent(t)){const e=t.element;if(e.paused)return this.options.defaultDelayMs;const n=e.duration,i=e.currentTime;return isNaN(n)||isNaN(i)?this.options.defaultDelayMs:1e3*(n-i)}return this.options.defaultDelayMs}slideContentHasLoaded(){const t=this.lightbox.pswp.currSlide.content;if(this.isVideoContent(t)){const e=t.element;return e.ended||e.readyState===HTMLMediaElement.HAVE_ENOUGH_DATA&&[HTMLMediaElement.NETWORK_IDLE,HTMLMediaElement.NETWORK_LOADING].includes(e.networkState)}return!t.isLoading()}goToNextSlideAfterTimeout(){if(this.resetSlideshow(),this.slideContentHasLoaded()){const t=this.getSlideTimeout();this.slideshowTimerID=setTimeout(()=>{this.lightbox.pswp.next(),this.options.restartOnSlideChange||this.goToNextSlideAfterTimeout()},t),setTimeout(()=>{this.slideshowIsRunning&&this.toggleProgressBar(t)},100)}else this.slideshowTimerID=setTimeout(()=>{this.goToNextSlideAfterTimeout()},200)}getSlideTransition(){return this.isVideoContent(this.lightbox.pswp.currSlide.content)?"linear":this.options.progressBarTransition}toggleProgressBar(t){const e=document.querySelector(".pswp__progress-bar");t?(e.style.transitionTimingFunction=this.getSlideTransition(),e.style.transitionDuration=`${t}ms`,e.classList.add("running")):e.classList.remove("running")}toggleWakeLock(){this.wakeLockIsRunning!=this.slideshowIsRunning&&("keepAwake"in screen?screen.keepAwake=this.slideshowIsRunning:"wakeLock"in navigator&&(this.wakeLockSentinel?this.wakeLockSentinel.release().then(()=>(this.wakeLockSentinel=null,!0)).catch(t=>console.error(t)):navigator.wakeLock.request("screen").then(t=>(this.wakeLockSentinel=t,this.wakeLockSentinel.addEventListener("release",()=>{this.wakeLockSentinel=null,this.wakeLockIsRunning=!1}),!0)).catch(t=>{})),this.wakeLockIsRunning=this.slideshowIsRunning)}resetSlideshow(){this.toggleProgressBar(),this.slideshowTimerID&&(clearTimeout(this.slideshowTimerID),this.slideshowTimerID=null)}},At={videoAttributes:{controls:"",playsinline:"",muted:"",preload:"auto"},autoplay:!0,preventDragOffset:40};function Mt(t){return t&&t.data&&"video"===t.data.type}var Bt=class{constructor(t,e){this.options=e,this.initLightboxEvents(t),t.on("init",()=>{this.initPswpEvents(t.pswp)})}initLightboxEvents(t){t.on("contentLoad",this.onContentLoad.bind(this)),t.on("contentDestroy",this.onContentDestroy.bind(this)),t.on("contentActivate",this.onContentActivate.bind(this)),t.on("contentDeactivate",this.onContentDeactivate.bind(this)),t.on("contentAppend",this.onContentAppend.bind(this)),t.on("contentResize",this.onContentResize.bind(this)),t.addFilter("isKeepingPlaceholder",this.isKeepingPlaceholder.bind(this)),t.addFilter("isContentZoomable",this.isContentZoomable.bind(this)),t.addFilter("useContentPlaceholder",this.useContentPlaceholder.bind(this)),t.addFilter("domItemData",(t,e,n)=>("video"===t.type&&n&&(n.dataset.pswpVideoSources?t.videoSources=JSON.parse(n.dataset.pswpVideoSources):n.dataset.pswpVideoSrc?t.videoSrc=n.dataset.pswpVideoSrc:t.videoSrc=n.href),t))}initPswpEvents(t){t.on("pointerDown",e=>{const n=t.currSlide;if(Mt(n)&&this.options.preventDragOffset){const i=e.originalEvent;if("pointerdown"===i.type){const s=Math.ceil(n.height*n.currZoomLevel)+n.bounds.center.y,o=i.pageY-t.offset.y;o>s-this.options.preventDragOffset&&o<s&&e.preventDefault()}}}),t.on("appendHeavy",t=>{Mt(t.slide)&&!t.slide.isActive&&t.preventDefault()}),t.on("close",()=>{Mt(t.currSlide.content)&&this.pauseVideo(t.currSlide.content)})}onContentDestroy({content:t}){Mt(t)&&t._videoPosterImg&&(t._videoPosterImg.onload=t._videoPosterImg.onerror=null,t._videoPosterImg=null)}onContentResize(t){if(Mt(t.content)){t.preventDefault();const e=t.width,n=t.height,i=t.content;if(i.element&&(i.element.style.width=`${e}px`,i.element.style.height=`${n}px`),i.slide&&i.slide.placeholder){const t=i.slide.placeholder.element.style;t.transform="none",t.width=`${e}px`,t.height=`${n}px`}}}isKeepingPlaceholder(t,e){return!Mt(e)&&t}isContentZoomable(t,e){return!Mt(e)&&t}onContentActivate({content:t}){Mt(t)&&this.options.autoplay&&this.playVideo(t)}onContentDeactivate({content:t}){Mt(t)&&this.pauseVideo(t)}onContentAppend(t){Mt(t.content)&&(t.preventDefault(),t.content.isAttached=!0,t.content.appendImage())}onContentLoad(t){const e=t.content;if(Mt(t.content)&&(t.preventDefault(),!e.element)){if(e.state="loading",e.type="video",e.element=document.createElement("video"),this.options.videoAttributes)for(let t in this.options.videoAttributes)e.element.setAttribute(t,this.options.videoAttributes[t]||"");e.element.setAttribute("poster",e.data.msrc),this.preloadVideoPoster(e,e.data.msrc),e.element.style.position="relative",e.element.style.left=0,e.element.style.top=0,e.data.videoSources?e.data.videoSources.forEach(t=>{let n=document.createElement("source");n.src=t.src,n.type=t.type,e.element.appendChild(n)}):e.data.videoSrc&&(e.element.src=e.data.videoSrc)}}preloadVideoPoster(t,e){!t._videoPosterImg&&e&&(t._videoPosterImg=new Image,t._videoPosterImg.src=e,t._videoPosterImg.complete?t.onLoaded():t._videoPosterImg.onload=t._videoPosterImg.onerror=()=>{t.onLoaded()})}playVideo(t){t.element&&t.element.play()}pauseVideo(t){t.element&&t.element.pause()}useContentPlaceholder(t,e){return!!Mt(e)||t}},Vt=class{constructor(t,e={}){new Bt(t,{...At,...e})}},zt=({open:t,ad:e,onClose:n,captureAdClick:i})=>{const s=Boolean(e?.targetType&&e.targetType!==L.NONE);/* @__PURE__ */
|
|
4
|
+
return h(A,{open:Boolean(t&&e),onOpenChange:t=>!t&&n?.(),children:/* @__PURE__ */h(D,{className:"border-none p-0",children:[/* @__PURE__ */h(O,{className:"hidden",children:[/* @__PURE__ */h(W,{children:e?.title}),/* @__PURE__ */h(U,{children:e?.description})]}),/* @__PURE__ */h("div",{className:"flex max-w-2xl flex-col overflow-hidden",children:[
|
|
5
|
+
/* @__PURE__ */h("img",{className:"h-auto w-full object-contain sm:max-h-96",src:e?.imageUrl,alt:"Image not found"}),
|
|
6
|
+
/* @__PURE__ */h("div",{className:"flex flex-col gap-2 p-3",children:[/* @__PURE__ */h(V,{variant:"h4",align:"center",lines:2,children:e?.title}),/* @__PURE__ */h(V,{variant:"body3",color:"secondary",align:"center",lines:4,children:e?.description})]}),s&&/* @__PURE__ */h(G,{fullWidth:!0,className:"rounded-none",onClick:()=>{i?.(e?._id,e?.targetType??L.LINK,e?.targetUrl),n?.()},iconName:x[e?.targetType]??x[L.LINK],children:e?.targetText})]})]})})},Rt=({style:t,content:e,curateLink:n,onAdClick:i})=>{const{captureAdImpression:s,captureAdEngagement:o,captureAdClick:r}=B(),a=Boolean(n&&i);/* @__PURE__ */
|
|
7
|
+
return h("div",{style:t,className:"group relative mb-1 overflow-hidden rounded",children:[/* @__PURE__ */h(Q,{className:"size-full",threshold:.8,triggerOnce:!0,onChange:t=>{t&&s(e._id)},onClick:()=>o(e._id),children:/* @__PURE__ */h(F,{url:e.src||e.imageUrl,thumbnailUrl:e.src||e.imageUrl,blurhash:e.blurhash,alt:e.caption,onClick:a?i:void 0,pswpData:{id:e._id,type:b.AD,hash:e._id,width:e.width,height:e.height,title:e.title,description:e.description,targetType:e.targetType,targetText:e.targetText,targetUrl:e.targetUrl,thumbnailUrl:e.imageUrl,blurhash:e.blurhash}})}),/* @__PURE__ */h("div",{className:"transition-opacity duration-500 group-hover:opacity-100 sm:opacity-0",children:/* @__PURE__ */h("div",{className:"text-foreground bg-background bg-opacity-75 absolute bottom-0 w-full flex-col items-center justify-between sm:flex sm:flex-row",children:[/* @__PURE__ */h("div",{className:"py-2",children:/* @__PURE__ */h("h3",{className:"text-foreground line-clamp-2 px-2 text-sm font-medium sm:ml-3 sm:line-clamp-1 sm:p-0",children:e.title})}),e?.targetType!==L.NONE&&/* @__PURE__ */h(G,{immutable:!0,className:"w-full rounded-t-none py-1 text-nowrap sm:w-auto sm:rounded-t-none sm:rounded-bl-none sm:py-2",onClick:()=>{a?i?.():r(e._id,e.targetType,e.targetUrl)},iconName:x[e?.targetType??L.LINK],children:e?.targetText})]})})]})},Ot=({style:t,gamConfig:e,slotIndex:n,eventId:i,organizationId:s})=>{const o=a(null),r=a(null),{trackGamAnalytics:l}=B(),c=`gam-slot-${i??"ev"}-${n}`,d=Math.max(1,Math.round(t?.width||e.sizes[0]?.[0]||300)),p=Math.max(1,Math.round(t?.height||e.sizes[0]?.[1]||250)),u=a({w:d,h:p});return m(()=>{let t=!1,n=null,a=null,d=null,p=null;return(async()=>{await z(),!t&&o.current&&window.googletag.cmd.push(()=>{if(t)return;H(c);const{w:h,h:m}=u.current,g=[[h,m],...e.sizes],w=window.googletag.defineSlot(e.adUnitPath,g,c)?.addService(window.googletag.pubads());if(!w)return;r.current=w,a=window.googletag.pubads(),i?w.setConfig({targeting:{qrati_event:i,...e.categories.length>0?{qrati_category:e.categories}:{}}}):e.categories.length>0&&w.setConfig({targeting:{qrati_category:e.categories}}),d=t=>{t.slot===w&&l({eventId:i,organizationId:s,type:N.GAM_IMPRESSION,creativeId:String(t.creativeId??""),lineItemId:String(t.lineItemId??""),advertiserId:String(t.advertiserId??""),isEmpty:t.isEmpty??!1})},a.addEventListener("slotRenderEnded",d),p=t=>{t.slot===w&&l({eventId:i,organizationId:s,type:N.GAM_VIEWABLE})},a.addEventListener("impressionViewable",p);const f=o.current;f&&(n=M({container:f,onClick:()=>{l({eventId:i,organizationId:s,type:N.GAM_CLICK})}}),P(),window.googletag.display(c))})})(),()=>{t=!0,n?.(),a&&"function"==typeof a.removeEventListener&&(d&&a.removeEventListener("slotRenderEnded",d),p&&a.removeEventListener("impressionViewable",p));const e=r.current;r.current=null,e&&window.googletag?.cmd?.push(()=>{window.googletag.destroySlots([e])})}},[i,e.adUnitPath,e.categories,s,c]),/* @__PURE__ */h("div",{style:{width:d,height:p},className:"relative overflow-hidden rounded bg-neutral-100 dark:bg-neutral-800","data-gam-slot-index":n,children:/* @__PURE__ */h("div",{id:c,ref:o,style:{width:d,height:p},className:"gam-ad-slot"})})},Pt=t(null),$t=()=>{const t=e(Pt);if(!t)throw new Error("Popover components must be used within a Popover");return t},Dt=({children:t,className:e,open:n,onOpenChange:i})=>{const[s,o]=w(!1),l="boolean"==typeof n,c=l?n:s,d=r(),p=`popover-trigger-${d}`,u=`popover-content-${d}`,m=a(null);/* @__PURE__ */
|
|
8
|
+
return h(Pt.Provider,{value:{isOpen:c,setIsOpen:t=>{l||o(t),i?.(t)},triggerId:p,contentId:u,triggerRef:m},children:/* @__PURE__ */h("div",{"data-slot":"popover",className:S("relative inline-block",e),children:t})})},Ht=({children:t,asChild:e,className:n,onClick:i,...s})=>{const{isOpen:o,setIsOpen:r,triggerId:a,contentId:l,triggerRef:c}=$t();if(m(()=>{if(!e)return;const t=document.getElementById(a);return c.current=t,()=>{c.current===t&&(c.current=null)}},[e,a,c]),e){const e=Array.isArray(t)?t[0]:t;if(e&&e.type){const t=e.props?.className;return d(e,{id:a,className:n?t?`${t} ${n}`:n:t,"aria-haspopup":"dialog","aria-expanded":o,"aria-controls":o?l:void 0,onClick:t=>{r(!o),e.props?.onClick?.(t)},"data-state":o?"open":"closed"})}}/* @__PURE__ */
|
|
9
|
+
return h("button",{ref:c,id:a,type:"button","aria-haspopup":"dialog","aria-expanded":o,"aria-controls":o?l:void 0,"data-slot":"popover-trigger","data-state":o?"open":"closed",className:n,onClick:t=>{r(!o),i?.(t)},...s,children:t})},Ft=({children:t,className:e,align:n="center",side:i="top",sideOffset:s=4,...o})=>{const{isOpen:r,setIsOpen:l,contentId:c,triggerRef:d}=$t(),{organization:g,portalContainer:f}=E(),y=a(null),[v,b]=w(null);if(u(()=>{if(!r)return;const t=()=>{if(!d.current||!y.current)return;const t=d.current.getBoundingClientRect(),e=y.current.getBoundingClientRect();let o=t.left,r=t.bottom+s;"center"===n&&(o=t.left+t.width/2-e.width/2),"end"===n&&(o=t.right-e.width),"top"===i&&(r=t.top-e.height-s),"left"===i&&(o=t.left-e.width-s,r=t.top+t.height/2-e.height/2),"right"===i&&(o=t.right+s,r=t.top+t.height/2-e.height/2),"bottom"===i&&(r=t.bottom+s),b({top:r,left:o})},e=requestAnimationFrame(t);return window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{cancelAnimationFrame(e),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[n,r,i,s,d]),m(()=>{if(!r)return;const t=t=>{const e=t.target;y.current&&!y.current.contains(e)&&d.current&&!d.current.contains(e)&&l(!1)},e=t=>{"Escape"===t.key&&(l(!1),d.current?.focus())},n=window.setTimeout(()=>{document.addEventListener("mousedown",t)},0);return document.addEventListener("keydown",e),()=>{window.clearTimeout(n),document.removeEventListener("mousedown",t),document.removeEventListener("keydown",e)}},[r,l,d]),!r)return null;const T=/* @__PURE__ */h("div",{ref:y,id:c,role:"dialog","aria-modal":"false","data-state":r?"open":"closed",className:S("bg-background text-foreground border-border shadow-outer rounded outline-none",e),style:{position:"fixed",top:v?.top??0,left:v?.left??0,zIndex:2010,...k(g)},...o,children:t});return"undefined"!=typeof document?p(T,f??document.body):T},Ut=({eventId:t,contentId:e,emojis:n=[],counts:i={},userReaction:s})=>{const{user:o,props:r,organization:a}=E(),l=r?.loginUrl,{handleReactionClick:c}=(()=>{const t=q(),{props:e,user:n}=E(),i=e?.organizationId;return{handleReactionClick:async(e,s,o)=>{if(!e||!s||!o)return!1;if(!n)return R.error("Please login to react"),!1;const r=[y.CONTENTS_BY_EVENT(e)],a=t.getQueriesData({queryKey:r});t.setQueriesData({queryKey:r},t=>t?.pages&&Array.isArray(t.pages)?{...t,pages:t.pages.map(t=>t.data?{...t,data:t.data.map(t=>{if(t._id===s){const e={...t.reactionCounts};return t.userReaction&&t.userReaction!==o&&(e[t.userReaction]=Math.max(0,(e[t.userReaction]??1)-1)),t.userReaction===o?(e[o]=Math.max(0,(e[o]??1)-1),{...t,reactionCounts:e,userReaction:void 0}):(e[o]=(e[o]??0)+1,{...t,reactionCounts:e,userReaction:o})}return t})}:t)}:t);try{return await C.post(f.UPDATE_REACTION,{json:{eventId:e,contentId:s,reaction:o},headers:{"x-org-id":i,Authorization:`Bearer ${n.token}`}}),!0}catch(l){return a.forEach(([e,n])=>{t.setQueryData(e,n)}),R.error("Failed to add reaction"),console.error("Error handling reaction click:",l),!1}}}})(),[d,p]=w(!1),[u,m]=w(!1),g=Object.values(i).reduce((t,e)=>t+e,0);/* @__PURE__ */
|
|
10
|
+
return h(Dt,{open:d,onOpenChange:p,children:[/* @__PURE__ */h(Ht,{children:/* @__PURE__ */h("div",{className:S("bg-background/50 flex items-center gap-1 rounded px-2 py-1 backdrop-blur-sm transition-transform active:scale-90 sm:gap-2 sm:py-0",s&&"ring-primary ring-1"),children:[(n||[]).slice().sort((t,e)=>(i[e]||0)-(i[t]||0)).slice(0,1).map(t=>/* @__PURE__ */h("span",{className:"text-sm sm:text-lg",children:s||t},`${e}-${t}-1`)),g>0&&/* @__PURE__ */h("span",{className:"text-xs font-bold sm:text-sm",children:g||0})]})}),/* @__PURE__ */h(Ft,{side:"top",align:"end",children:[o?null:/* @__PURE__ */h("div",a?.customAuth?{className:"p-2 font-semibold",children:["Please"," ",
|
|
11
|
+
/* @__PURE__ */h("a",{className:"text-info underline",href:l,children:"Login"})," ","to react"]}:{className:"p-2 font-semibold",children:["Please"," ",
|
|
12
|
+
/* @__PURE__ */h(I,{className:"text-info underline",to:_.LOGIN,children:"Login"})," ","to react"]}),o&&/* @__PURE__ */h("div",{className:"flex gap-1 p-2",children:n.map(n=>{const o=s===n;/* @__PURE__ */
|
|
13
|
+
return h("div",{className:"flex flex-col items-center",children:[/* @__PURE__ */h("span",{className:"text-xs font-medium",children:i[n]||0}),/* @__PURE__ */h("button",{type:"button",disabled:u,className:S("text-3xl transition-transform disabled:opacity-50",o?"scale-125":"hover:scale-110",u&&"cursor-not-allowed"),onClick:()=>(async n=>{!u&&c&&(m(!0),await c(t,e,n)&&p(!1),m(!1))})(n),children:n})]},`${e}-${n}-2`)})})]})]})},jt=({event:t={},content:e,curateLink:n})=>t.engagementStyle===v.CONTEST?/* @__PURE__ */h("button",{className:"bg-background/75 flex items-center gap-1 rounded px-2 py-1",children:[/* @__PURE__ */h(K,{name:"material-symbols:star-half-rounded",className:"size-4"}),/* @__PURE__ */h("span",{className:"text-xs font-semibold",children:parseFloat(String(e.score||0)).toFixed(1)})]}):t.engagementStyle===v.REACTION&&t.reactionEmojis?.length?/* @__PURE__ */h(Ut,{eventId:t?._id,contentId:e._id,emojis:t?.reactionEmojis,engagementStyle:t?.engagementStyle,counts:e.reactionCounts||{},userReaction:e.userReaction}):null,Wt=({content:t})=>/* @__PURE__ */h("div",{className:"w-full space-y-3 px-3 pb-3",children:[t?.caption&&/* @__PURE__ */h("span",{"data-tooltip-target":"tooltip-default",className:"hidden w-full text-xs drop-shadow-[0_1.2px_1.2px_rgba(0,0,0,0.8)] sm:block",children:/* @__PURE__ */h("div",{role:"note",title:t?.caption,className:"lg:text-md line-clamp-1 text-xs text-white lg:font-medium",children:t?.caption})}),/* @__PURE__ */h("div",{className:"flex items-center justify-between",children:/* @__PURE__ */h("span",{className:"lg:text-md line-clamp-1 text-sm font-medium text-white drop-shadow-[0_1.2px_1.2px_rgba(0,0,0,0.8)]",children:t?.user?.name})})]}),Gt=({event:t,content:e,style:n,timestampField:s,curateLink:o,onChangeFaceUrl:r,hideControls:a})=>{const{organization:l}=E(),c=`content-${e._id}`,d=((t,e)=>{if(!t||!e)return null;const n=e?.[t];if(!n)return null;try{const t=new Date(String(n)),e=/* @__PURE__ */new Date,i=t.getFullYear()===e.getFullYear(),s={weekday:"long",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0};return i||(s.year="numeric"),t.toLocaleString("en-US",s).replace(","," •")}catch{return null}})(s,e);/* @__PURE__ */
|
|
14
|
+
return h("div",{id:c,style:n,className:"group relative mb-1 overflow-hidden rounded",children:[/* @__PURE__ */h(F,{url:e.src,alt:e.caption,blurhash:e.blurhash,thumbnailUrl:e.thumbnailUrl,curateLink:o,pswpData:{id:e._id,type:b.IMAGE,hash:e._id,width:e.width,height:e.height,thumbnailUrl:e.thumbnailUrl,blurhash:e.blurhash,caption:e.caption,contentSummary:JSON.stringify(e.contentSummary)}}),!a&&/* @__PURE__ */h(i,{children:[d&&/* @__PURE__ */h("div",{className:"absolute top-2 left-2 max-w-[calc(100%-80px)] truncate rounded bg-black/50 px-2 py-0.5 text-xs text-white backdrop-blur-sm",children:d}),l?.integrationSettings?.showQuickSearch&&(e.faces?.length??0)>0&&/* @__PURE__ */h("button",{className:"bg-primary absolute top-2 right-2 rounded-full p-1 text-gray-200 opacity-50 transition-all sm:p-1.5 sm:hover:scale-110 sm:hover:opacity-100",onClick:()=>{r?.(e?.url);const t=document.getElementById("media-gallery-container");t&&t.scrollIntoView({behavior:"smooth",block:"start"})},children:/* @__PURE__ */h(K,{color:"a11y",name:"material-symbols:familiar-face-and-zone-outline-rounded"})}),
|
|
15
|
+
/* @__PURE__ */h("div",{className:"",children:[/* @__PURE__ */h("div",{className:"absolute bottom-0 w-full rounded-b",children:/* @__PURE__ */h(Wt,{content:e})}),/* @__PURE__ */h("div",{className:"absolute right-2 bottom-2",children:/* @__PURE__ */h(jt,{event:t,content:e,curateLink:o})})]})]})]})},Kt=({content:t,style:e,event:n,timestampField:i,curateLink:s,hideControls:o})=>{const r=((t,e)=>{if(!t||!e)return null;const n=e?.[t];if(!n)return null;try{const t=new Date(String(n)),e=/* @__PURE__ */new Date,i=t.getFullYear()===e.getFullYear(),s={weekday:"long",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0};return i||(s.year="numeric"),t.toLocaleString("en-US",s).replace(","," •")}catch{return null}})(i,t);/* @__PURE__ */
|
|
16
|
+
return h("div",{id:`content-${t._id}`,className:"group relative mb-1 overflow-hidden rounded",style:e,children:[/* @__PURE__ */h(F,{url:t.src??t.url,thumbnailUrl:t.thumbnailUrl,blurhash:t.blurhash,alt:t.caption,curateLink:s,pswpData:{id:t._id,type:b.VIDEO,hash:t._id,width:t.width,height:t.height,thumbnailUrl:t.thumbnailUrl,blurhash:t.blurhash,caption:t.caption}}),!o&&/* @__PURE__ */h("div",{className:"transition-opacity duration-500",children:[r&&/* @__PURE__ */h("div",{className:"absolute top-2 left-2 max-w-[calc(100%-80px)] truncate rounded bg-black/50 px-2 py-0.5 text-xs text-white backdrop-blur-sm",children:r}),
|
|
17
|
+
/* @__PURE__ */h("div",{className:"absolute bottom-0 w-full rounded-b",children:/* @__PURE__ */h(Wt,{content:t})}),
|
|
18
|
+
/* @__PURE__ */h("div",{className:"absolute right-2 bottom-2",children:/* @__PURE__ */h(jt,{event:n,content:t,curateLink:s})})]})]})},Yt=({event:t,contents:e=[],gamConfig:n,singleColumnMode:s,kioskMode:r,timestampField:l,curateLink:c,onChangeFaceUrl:d})=>{const p=a(null),u=a(null),g=o(()=>`gallery-${t?._id??""}`,[t]),{captureAdImpression:f,captureAdClick:y}=B(),{organization:v,portalContainer:x}=E(),_=v?._id,[q,k]=w(null);m(()=>{const t=u.current;if(!c&&t){const e=new $({gallery:t,children:"a",counter:!1,bgOpacity:1,wheelToZoom:!0,pinchToClose:!0,zoom:!1,pswpModule:j,appendToEl:x??document.body});p.current=e,new Vt(e),new Ct(e),new qt(e),new It(e,f,y),new Lt(e),new Nt(e),v?.integrationSettings?.showAIDescription&&new xt(e,{width:"400px",height:"40%"}),e.init()}return()=>{p.current?.destroy?.(),p.current=null}},[t?.galleryLayout,c,y,f,g,v]);const I=o(()=>{switch(t?.galleryLayout){case T.ROW:return mt;case T.COLUMN:return yt;case T.MASONRY:return bt;default:return mt}},[s,t?.galleryLayout]);/* @__PURE__ */
|
|
19
|
+
return h(i,{children:[/* @__PURE__ */h("div",{id:g,ref:u,className:S(s?"w-full lg:w-1/3":"w-full"),children:/* @__PURE__ */h(I,{spacing:4,rowConstraints:t=>{const e={minPhotos:1,maxPhotos:4,singleRowMaxHeight:400};return s&&(e.minPhotos=1,e.maxPhotos=t<400?2:t<800?3:4),e},columns:t=>s?1:t<400?2:t<800?3:4,photos:e.map(t=>({src:t.type===b.IMAGE||t.type===b.VIDEO?t.url:t.type===b.GAM_AD?"":t.imageUrl,width:t.dimension?.width,height:t.dimension?.height,...t})),render:{container:({ref:t,className:e,children:n})=>/* @__PURE__ */h("div",{ref:t,className:e??"",children:n}),photo:(e,{photo:i,width:s,height:o,index:a})=>{const p=i;let u=null;switch(p.type){case b.IMAGE:u=Gt;break;case b.VIDEO:u=Kt;break;case b.AD:u=Rt;break;case b.GAM_AD:return n?/* @__PURE__ */h(Ot,{style:{width:s,height:o},gamConfig:n,slotIndex:p.slotIndex??a,eventId:t?._id,organizationId:_},`${p._id??a}-${a}`):null;default:u=null}return u&&/* @__PURE__ */h(u,{style:{width:s,height:o},event:t,content:p,timestampField:l,onAdClick:c?()=>k(p):void 0,hideControls:r,curateLink:c?`${c}/${p._id}`:null,onChangeFaceUrl:d},`${p._id??a}-${a}`)}}})}),/* @__PURE__ */h(zt,{open:Boolean(q),ad:q,onClose:()=>k(null),captureAdClick:y})]})};export{Yt as default};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{O as e,S as t,_ as l,t as n,w as r,y as a}from"./CoFGfneL.js";import{C as o,J as s,h as i,p as d,q as c}from"./D8g89do5.js";import{t as u}from"./M8Us9cU9.js";var h=(e,t)=>e.filter(e=>(e.parentFolderId??null)===t).map(t=>{return{folder:t,children:h(e,t._id),eventCount:t.boundary?.length??0,centroid:(l=t.boundary,l?.length?[l.reduce((e,t)=>e+t.x,0)/l.length,l.reduce((e,t)=>e+t.y,0)/l.length]:null),color:t.color||"#fb8500"};var l}).filter(e=>e.eventCount>0||e.children.length>0),f=e=>e.filter(e=>"number"==typeof e.location?.x&&"number"==typeof e.location?.y),m=()=>{const{folders:e,organization:n}=d(),[i,u]=a(null),m=Boolean(n?.integrationSettings?.enableFolderView),p=l(()=>m?h(e??[],null):[],[e,m]),b=s({queryKey:["map-all-events",n?._id],queryFn:async()=>f((await c.get(o.PUBLIC_EVENTS,{headers:{"x-org-id":n?._id??""},searchParams:{includeAllFolders:!0,limit:500,sort:"-views",contentLimit:3}}).json()).data??[]),enabled:Boolean(n?._id)&&!m,staleTime:3e5,retry:!1}),g=s({queryKey:["map-folder-events",n?._id,i],queryFn:async()=>f((await c.get(o.PUBLIC_EVENTS,{headers:{"x-org-id":n?._id??""},searchParams:{folderId:i,limit:500,sort:"-views",contentLimit:3}}).json()).data??[]),enabled:Boolean(n?._id)&&m&&Boolean(i),staleTime:3e5,retry:!1}),v=l(()=>(e??[]).find(e=>e._id===i)??null,[e,i]);r(()=>{m||u(null)},[m]);const x=t(e=>{u(e)},[]);return{folderTree:p,activeFolderId:i,activeFolder:v,visibleEvents:m?g.data??[]:b.data??[],setActiveFolderId:x,isLoadingEvents:m?Boolean(i)&&(g.isLoading||g.isFetching):b.isLoading||b.isFetching}},p=()=>/* @__PURE__ */n("svg",{className:"size-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:/* @__PURE__ */n("path",{d:"m15 18-6-6 6-6"})}),b=()=>/* @__PURE__ */n("svg",{className:"size-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:/* @__PURE__ */n("path",{d:"m9 18 6-6-6-6"})});function g({items:t,autoplayInterval:l=3e3,showControls:o=!1,className:s}){const[d,c]=a(0);return r(()=>{if(t.length<=1)return;const e=setInterval(()=>c(e=>(e+1)%t.length),l);return()=>clearInterval(e)},[t.length,l]),0===t.length?null:/* @__PURE__ */n("div",{className:i("relative size-full overflow-hidden",s),children:[t.map((e,t)=>/* @__PURE__ */n("div",{className:i("absolute inset-0 transition-opacity duration-500",t===d?"opacity-100":"opacity-0"),children:e},t)),t.length>1&&/* @__PURE__ */n("div",{className:"absolute bottom-2 left-1/2 z-10 flex -translate-x-1/2 gap-1",children:t.map((e,t)=>/* @__PURE__ */n("button",{onClick:()=>c(t),className:i("h-1.5 rounded-full transition-all",t===d?"w-4 bg-white":"w-1.5 bg-white/50 hover:bg-white/75"),"aria-label":`Go to slide ${t+1}`},t))}),o&&t.length>1&&/* @__PURE__ */n(e,{children:[/* @__PURE__ */n("button",{onClick:()=>c(e=>0===e?t.length-1:e-1),className:"absolute top-1/2 left-2 z-10 flex size-8 -translate-y-1/2 items-center justify-center rounded-full bg-black/40 text-white hover:bg-black/60","aria-label":"Previous",children:/* @__PURE__ */n(p,{})}),/* @__PURE__ */n("button",{onClick:()=>c(e=>(e+1)%t.length),className:"absolute top-1/2 right-2 z-10 flex size-8 -translate-y-1/2 items-center justify-center rounded-full bg-black/40 text-white hover:bg-black/60","aria-label":"Next",children:/* @__PURE__ */n(b,{})})]})]})}var v=({event:e,onExplore:t})=>/* @__PURE__ */n("div",{className:"w-40 rounded pt-2 pl-1",children:[
|
|
2
|
+
/* @__PURE__ */n("div",{className:"h-32 w-full overflow-hidden rounded",children:/* @__PURE__ */n(g,{items:(e.contents||[]).map(t=>/* @__PURE__ */n(u,{alt:e.name,src:t.thumbnailUrl||t.url,containerClassName:"size-full",imgClassName:"rounded"},t._id)),autoplayInterval:3e3})}),
|
|
3
|
+
/* @__PURE__ */n("div",{className:"line-clamp-2 pt-2 pb-0.5 text-sm font-medium text-black",children:e.name}),
|
|
4
|
+
/* @__PURE__ */n("div",{className:"pb-2 text-xs text-gray-600",children:e.location?.label}),
|
|
5
|
+
/* @__PURE__ */n("button",{type:"button",onClick:()=>t?.(e.slug||""),className:"bg-primary text-primary-foreground flex w-full items-center justify-center rounded py-1",children:"Explore"})]}),x=(e,t)=>e&&(/^#[0-9a-fA-F]{3,8}$/.test(e)||/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(e))?e:t,y=e=>{if(e)try{const{protocol:t}=new URL(e);return"https:"===t||"http:"===t?e:void 0}catch{return}},w=({node:e,depth:t,activeFolderId:l,onSelect:r})=>{const[o,s]=a(!1),i=e.folder._id===l,d=e.children.length>0,c=e.eventCount>0;/* @__PURE__ */
|
|
6
|
+
return n("li",{children:[/* @__PURE__ */n("div",{class:"flex items-center gap-1 py-1.5 pr-2 rounded-lg "+(i?"bg-foreground/20":"hover:bg-foreground/20"),style:{paddingLeft:8+14*t+"px"},children:[/* @__PURE__ */n("button",{type:"button",class:"flex w-4 shrink-0 items-center justify-center text-slate-400 text-xs",onClick:e=>{e.stopPropagation(),d&&s(e=>!e)},children:d?o?"▾":"▸":/* @__PURE__ */n("span",{class:"size-1.5 rounded-full bg-slate-300 inline-block"})}),/* @__PURE__ */n("button",{type:"button",class:"flex flex-1 min-w-0 items-center gap-2 cursor-pointer",onClick:()=>{c?r(i?null:e.folder._id):s(e=>!e)},children:[
|
|
7
|
+
/* @__PURE__ */n("span",{class:"size-2 shrink-0 rounded-full",style:{background:e.color}}),
|
|
8
|
+
/* @__PURE__ */n("span",{class:"flex-1 truncate text-left text-sm",children:e.folder.name}),c&&/* @__PURE__ */n("span",{class:"text-xs tabular-nums text-slate-400",children:e.eventCount})]})]}),d&&o&&/* @__PURE__ */n("ul",{children:e.children.map(e=>/* @__PURE__ */n(w,{node:e,depth:t+1,activeFolderId:l,onSelect:r},e.folder._id))})]})},k=(e,t)=>{for(const l of e){if(l.folder._id===t)return l;const e=k(l.children,t);if(e)return e}return null},C=({folderTree:e,activeFolderId:t,setActiveFolderId:l,positionClass:r})=>0===e.length?null:/* @__PURE__ */n("div",{class:`${r??""} w-[min(92%,260px)] overflow-hidden rounded-xl bg-background shadow-lg backdrop-blur-sm`,children:[/* @__PURE__ */n("div",{class:"flex items-center justify-between border-b border-slate-100 px-3 py-2.5",children:[/* @__PURE__ */n("p",{class:"text-xs font-semibold uppercase tracking-wide",children:"Destinations"}),t&&/* @__PURE__ */n("button",{type:"button",onClick:()=>l(null),class:"text-xs text-foreground",children:"Show all"})]}),/* @__PURE__ */n("ul",{class:"max-h-[60vh] overflow-y-auto py-1",children:e.map(e=>/* @__PURE__ */n(w,{node:e,depth:0,activeFolderId:t,onSelect:l},e.folder._id))})]});export{v as a,y as i,k as n,m as o,x as r,C as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as e}from"./hOIsfHC7.js";import{D as r,_ as t,g as n,t as o,w as a,y as i}from"./CoFGfneL.js";import{B as s,X as c,g as l,p as d,r as u}from"./D8g89do5.js";import{t as p}from"./zVkCODn-.js";import{a as m,i as f,n as g,o as h,r as y,t as x}from"./V5NTL9Q8.js";var b=[[90,-180],[-90,180]],v=[20,0],L="#fb8500",w={topLeft:[276,60],bottomRight:[60,60]},z=new p,T=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),B=({onExplore:p,logoUrl:B})=>{const j=n(null),k=n(null),O=n(null),C=n(null),S=n(null),Z=n(null),I=n(null),R=n(!1),E=n(!1),A=t(()=>(()=>{try{const e=sessionStorage.getItem(s);if(!e)return null;const r=JSON.parse(e);if("number"==typeof r?.center?.lat&&"number"==typeof r?.center?.lng&&"number"==typeof r?.zoom)return r}catch{}return null})(),[]),[F,$]=i(!0),[G,N]=i(!1),{folderTree:V,activeFolderId:q,activeFolder:J,visibleEvents:M,setActiveFolderId:P,isLoadingEvents:W}=h(),{organization:_}=d();return a(()=>{if(!j.current||k.current)return;let r,t=!1;return(async()=>{try{const n=await import("./BAMB7Uoo.js").then(r=>/* @__PURE__ */e(r.default,1));if(t)return;if("undefined"!=typeof window&&(window.L=n),await Promise.all([import("./D1zX23l-.js").then(r=>/* @__PURE__ */e(r.default,1)),import("./tPk8Ov5I.js")]),t)return;const o=window.L??n;if(!j.current)return;const a=n.map(j.current,{center:A?.center?[A.center.lat??v[0],A.center.lng??v[1]]:v,zoom:A?.zoom??3,minZoom:3,zoomControl:!0,worldCopyJump:!1,maxBounds:n.latLngBounds(b),maxBoundsViscosity:1});n.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:"© OpenStreetMap contributors",maxZoom:19,noWrap:!0}).addTo(a);const i=n.layerGroup().addTo(a),c="function"==typeof o.heatLayer?o.heatLayer([],{radius:30,blur:30,maxZoom:10,minOpacity:.35}):null;c?.addTo(a);const l="function"==typeof o.markerClusterGroup?o.markerClusterGroup({chunkedLoading:!0,showCoverageOnHover:!1,spiderfyOnMaxZoom:!0,zoomToBoundsOnClick:!0,maxClusterRadius:48}):n.layerGroup();l.addTo(a);const d=()=>{I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{try{sessionStorage.setItem(s,JSON.stringify({center:a.getCenter(),zoom:a.getZoom()}))}catch{}},250)};let u;a.on("zoomend",d),a.on("moveend",d),k.current=a,O.current=o,C.current=i,Z.current=c,S.current=l,"undefined"!=typeof ResizeObserver&&j.current&&(u=new ResizeObserver(()=>a.invalidateSize(!1)),u.observe(j.current)),requestAnimationFrame(()=>a.invalidateSize(!1)),N(!0),$(!1),r=()=>{u?.disconnect(),I.current&&clearTimeout(I.current),a.off("zoomend",d),a.off("moveend",d),a.remove(),O.current=null,k.current=null,C.current=null,Z.current=null,S.current=null}}finally{t||$(!1)}})(),()=>{t=!0,r?.()}},[A]),a(()=>{if(!G)return;const e=O.current;if(!e)return;const t=k.current;if(C.current?.clearLayers(),S.current?.clearLayers(),null===q&&V.length>0){t&&Z.current&&(Z.current.setLatLngs?.([]),t.hasLayer(Z.current)&&t.removeLayer(Z.current));const r=t=>{for(const n of t)if(n.centroid){const[r,t]=n.centroid,o=e.divIcon({className:"",html:`<div style="transform:translate(-50%,-50%);background:${y(n.color,L)};color:#fff;border-radius:20px;padding:5px 10px;font-size:12px;font-weight:600;white-space:nowrap;box-shadow:0 2px 8px rgba(0,0,0,0.25);border:2px solid rgba(255,255,255,0.4);cursor:pointer;display:inline-flex;align-items:center;gap:6px;"><span>${T(n.folder.name)}</span><span style="background:rgba(0,0,0,0.18);border-radius:10px;padding:1px 5px;font-size:10px;">${n.eventCount}</span></div>`,iconSize:[0,0],iconAnchor:[0,0]});e.marker([t,r],{icon:o}).on("click",()=>P(n.folder._id)).addTo(C.current)}else n.children.length>0&&r(n.children)};r(V)}else{if(0===M.length)return;const n=0===V.length&&null===q,a=y(J?.color,L);if(t&&Z.current&&(n&&!t.hasLayer(Z.current)?Z.current.addTo(t):n||(Z.current.setLatLngs?.([]),t.hasLayer(Z.current)&&t.removeLayer(Z.current))),M.forEach(t=>{const n=t.location.x,i=t.location.y,s=e.divIcon({className:"qrati-leaflet-marker-wrapper",html:`<div style="width:36px;height:36px;cursor:pointer;background:${a};border-radius:50% 50% 50% 0;transform:rotate(-45deg);border:2px solid white;box-shadow:0 2px 8px rgba(0,0,0,0.3);display:flex;align-items:center;justify-content:center;overflow:hidden;">${f(B)?`<img src="${f(B)}" style="width:24px;height:24px;border-radius:50%;object-fit:cover;transform:rotate(45deg);" />`:""}</div>`,iconSize:[36,36],iconAnchor:[18,36],popupAnchor:[0,-36]}),l=e.marker([i,n],{icon:s}),d=document.createElement("div");d.style.width="fit-content",((e,t,n)=>{r(/* @__PURE__ */o(c,{client:z,children:/* @__PURE__ */o(u,{children:/* @__PURE__ */o(m,{event:e,onExplore:n})})}),t)})(t,d,p),l.bindPopup(d,{closeButton:!0,maxWidth:256}),S.current?.addLayer(l)}),n&&Z.current){const e=M.reduce((e,r)=>Math.max(e,r.views??0),1),r=M.map(e=>[e.location.y,e.location.x,e.views??1]);Z.current.setOptions?.({radius:30,blur:30,maxZoom:10,minOpacity:.35,max:e}),Z.current.setLatLngs?.(r)}if(n&&!E.current&&t&&(E.current=!0,!A)){const r=e.latLngBounds([]);M.forEach(e=>r.extend([e.location.y,e.location.x])),r.isValid()&&t.fitBounds(r,{paddingTopLeft:w.topLeft,paddingBottomRight:w.bottomRight,maxZoom:8})}}},[q,V,M,G,p,B,P,J,A]),a(()=>{if(!G)return;const e=k.current,r=O.current;if(!e||!r)return;if(!R.current&&A)return void(R.current=!0);R.current=!0;const t={paddingTopLeft:w.topLeft,paddingBottomRight:w.bottomRight,duration:3,easeLinearity:1};if(q){const n=g(V,q);if(!n?.folder.boundary?.length)return;const o=r.latLngBounds([]);for(const e of n.folder.boundary)o.extend([e.y,e.x]);o.isValid()&&e.flyToBounds(o,{...t,maxZoom:14})}else{const n=r.latLngBounds([]),o=e=>{for(const r of e)r.centroid?n.extend([r.centroid[1],r.centroid[0]]):o(r.children)};o(V),n.isValid()&&e.flyToBounds(n,{...t,maxZoom:8})}},[q,V,G,A]),/* @__PURE__ */o("div",{class:"relative h-screen w-full sm:h-[calc(100vh-4rem)]",style:l(_),children:[
|
|
2
|
+
/* @__PURE__ */o(x,{positionClass:"absolute top-3 left-16 z-[1000]",folderTree:V,activeFolderId:q,setActiveFolderId:P}),W&&/* @__PURE__ */o("div",{class:"absolute inset-0 z-10 flex items-center justify-center bg-white/60",children:/* @__PURE__ */o("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"})}),F&&/* @__PURE__ */o("div",{class:"absolute inset-0 z-20 flex items-center justify-center bg-white/85",children:/* @__PURE__ */o("div",{class:"flex flex-col items-center gap-3",children:[/* @__PURE__ */o("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"}),/* @__PURE__ */o("p",{class:"text-sm font-medium text-slate-700",children:"Loading map…"})]})}),
|
|
3
|
+
/* @__PURE__ */o("div",{ref:j,class:"h-full w-full rounded-xl border border-slate-200"})]})};export{B as default};
|