@forgebuild/sidon-booking-widget 4.1.3 → 4.1.5

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.
@@ -2402,59 +2402,66 @@ var Ii = /* @__PURE__ */ kr("<div class=\"sbm-map svelte-yb07tk\"></div>"), Li =
2402
2402
  };
2403
2403
  function Ri(e, t) {
2404
2404
  Ke(t, !0), Gr(e, Li);
2405
- let n = Y(t, "mapsApiKey", 7), r = Y(t, "mapStyle", 7), i = Y(t, "center", 7), a = Y(t, "navy", 7), o = Y(t, "gold", 7), s = Y(t, "logoMark", 7, null), c = Y(t, "marinaName", 7, ""), l = Y(t, "otherMarinas", 7), u = Y(t, "berths", 7), d = Y(t, "overlays", 7), f = Y(t, "layout", 7), p = Y(t, "loa", 7), m = Y(t, "selectedBerth", 7), h = Y(t, "onBerthClick", 7), g = Y(t, "staff", 7, !1), _, v = /* @__PURE__ */ H(null), y = /* @__PURE__ */ new Map(), b = [], ee = [], x = !1, te = /* @__PURE__ */ z(() => ({
2405
+ let n = Y(t, "mapsApiKey", 7), r = Y(t, "mapStyle", 7), i = Y(t, "center", 7), a = Y(t, "navy", 7), o = Y(t, "gold", 7), s = Y(t, "logoMark", 7, null), c = Y(t, "marinaName", 7, ""), l = Y(t, "otherMarinas", 7), u = Y(t, "berths", 7), d = Y(t, "overlays", 7), f = Y(t, "layout", 7), p = Y(t, "loa", 7), m = Y(t, "selectedBerth", 7), h = Y(t, "onBerthClick", 7), g = Y(t, "staff", 7, !1), _ = Y(t, "fitInset", 7), v, y = /* @__PURE__ */ H(null), b = /* @__PURE__ */ new Map(), ee = [], x = [], te = !1;
2406
+ function ne() {
2407
+ let e = _()?.() ?? 0;
2408
+ return e > 0 ? {
2409
+ top: 60,
2410
+ right: 60,
2411
+ bottom: 60,
2412
+ left: e + 60
2413
+ } : 60;
2414
+ }
2415
+ let re = /* @__PURE__ */ z(() => ({
2406
2416
  fillColor: o(),
2407
2417
  fillOpacity: .38,
2408
2418
  strokeColor: o(),
2409
2419
  strokeOpacity: 1,
2410
2420
  strokeWeight: 1.6
2411
- })), ne = /* @__PURE__ */ z(() => ({
2421
+ })), ie = /* @__PURE__ */ z(() => ({
2412
2422
  fillColor: o(),
2413
2423
  fillOpacity: .62,
2414
2424
  strokeColor: o(),
2415
2425
  strokeOpacity: 1,
2416
2426
  strokeWeight: 1.6
2417
- })), re = /* @__PURE__ */ z(() => ({
2418
- fillColor: o(),
2419
- fillOpacity: .72,
2420
- strokeColor: "#252525",
2421
- strokeOpacity: 1,
2422
- strokeWeight: 2
2423
- })), ie = {
2427
+ })), ae = /* @__PURE__ */ z(() => ({
2428
+ ...J(re),
2429
+ strokeWeight: 3
2430
+ })), oe = {
2424
2431
  fillColor: "#b8b8b8",
2425
2432
  fillOpacity: .08,
2426
2433
  strokeColor: "#b8b8b8",
2427
2434
  strokeOpacity: .5,
2428
2435
  strokeWeight: 1
2429
- }, ae = {
2436
+ }, se = {
2430
2437
  fillColor: "#888888",
2431
2438
  fillOpacity: .15,
2432
2439
  strokeColor: "#888888",
2433
2440
  strokeOpacity: .4,
2434
2441
  strokeWeight: 1
2435
- }, oe = /* @__PURE__ */ z(() => ({
2442
+ }, ce = /* @__PURE__ */ z(() => ({
2436
2443
  fillColor: a(),
2437
2444
  fillOpacity: .85,
2438
2445
  strokeColor: a(),
2439
2446
  strokeOpacity: 1,
2440
2447
  strokeWeight: 1.6
2441
- })), se = (e) => Math.max(5, e.lengthM || 15), ce = (e, t) => e.angle == null ? e.circle.setRadius(se(e.berth) * t) : e.circle.setPaths(Fi(e.berth, e.angle, Mi, t)), S = /* @__PURE__ */ new WeakMap();
2442
- function C(e) {
2448
+ })), S = (e) => Math.max(5, e.lengthM || 15), C = (e, t) => e.angle == null ? e.circle.setRadius(S(e.berth) * t) : e.circle.setPaths(Fi(e.berth, e.angle, Mi, t)), w = /* @__PURE__ */ new WeakMap();
2449
+ function T(e) {
2443
2450
  let t = e.circle, n = Symbol();
2444
- S.set(t, n);
2451
+ w.set(t, n);
2445
2452
  let r = performance.now(), i = (a) => {
2446
- if (S.get(t) !== n) return;
2453
+ if (w.get(t) !== n) return;
2447
2454
  let o = a - r;
2448
2455
  if (o >= 260) {
2449
- ce(e, 1);
2456
+ C(e, 1);
2450
2457
  return;
2451
2458
  }
2452
2459
  let s = o < 90 ? o / 90 : 1 - (o - 90) / 170, c = s * (2 - s);
2453
- ce(e, 1 + .18 * c), requestAnimationFrame(i);
2460
+ C(e, 1 + .18 * c), requestAnimationFrame(i);
2454
2461
  };
2455
2462
  requestAnimationFrame(i);
2456
2463
  }
2457
- let w = [
2464
+ let E = [
2458
2465
  {
2459
2466
  elementType: "geometry",
2460
2467
  stylers: [{ color: "#ffffff" }]
@@ -2512,7 +2519,7 @@ function Ri(e, t) {
2512
2519
  elementType: "labels.text.fill",
2513
2520
  stylers: [{ color: "#aab0b4" }]
2514
2521
  }
2515
- ], T = /* @__PURE__ */ z(() => [
2522
+ ], D = /* @__PURE__ */ z(() => [
2516
2523
  {
2517
2524
  elementType: "geometry",
2518
2525
  stylers: [{ color: "#f5efe4" }]
@@ -2594,7 +2601,7 @@ function Ri(e, t) {
2594
2601
  stylers: [{ color: a() }]
2595
2602
  }
2596
2603
  ]);
2597
- class E {
2604
+ class le {
2598
2605
  position;
2599
2606
  href;
2600
2607
  img;
@@ -2629,7 +2636,7 @@ function Ri(e, t) {
2629
2636
  this.overlayView.setMap(e);
2630
2637
  }
2631
2638
  }
2632
- let D = {
2639
+ let O = {
2633
2640
  available: {
2634
2641
  fill: "rgba(16,185,129,0.3)",
2635
2642
  stroke: "#10b981"
@@ -2647,7 +2654,7 @@ function Ri(e, t) {
2647
2654
  stroke: "rgba(136,136,136,0.4)"
2648
2655
  }
2649
2656
  };
2650
- function le(e) {
2657
+ function ue(e) {
2651
2658
  let t = {};
2652
2659
  for (let e of u()) e.berthId && (t[e.berthId] = {
2653
2660
  price: e.pricePerNight,
@@ -2660,7 +2667,7 @@ function Ri(e, t) {
2660
2667
  r?.price != null && e.setAttribute("data-price", String(r.price));
2661
2668
  let i = r?.status ?? "occupied";
2662
2669
  e.setAttribute("data-status", i), g() && r && e.setAttribute("data-pick", "1");
2663
- let a = D[i] ?? D.occupied, o = e.querySelector("rect:not([data-role]), circle");
2670
+ let a = O[i] ?? O.occupied, o = e.querySelector("rect:not([data-role]), circle");
2664
2671
  o && (o.setAttribute("fill", a.fill), o.setAttribute("stroke", a.stroke));
2665
2672
  let s = e.querySelector("[data-role=\"entrance\"]");
2666
2673
  s && s.setAttribute("fill", a.stroke);
@@ -2688,7 +2695,7 @@ function Ri(e, t) {
2688
2695
  [data-berth-id][data-fit="small"] circle { fill: rgba(136,136,136,0.15) !important; stroke: rgba(136,136,136,0.5) !important; }
2689
2696
  [data-berth-id][data-fit="small"] [data-role="entrance"] { fill: rgba(136,136,136,0.5) !important; }
2690
2697
  [data-berth-id][data-selected="1"] rect:not([data-role]),
2691
- [data-berth-id][data-selected="1"] circle { fill: ${o()} !important; stroke: ${o()} !important; }
2698
+ [data-berth-id][data-selected="1"] circle { stroke: ${o()} !important; }
2692
2699
  [data-berth-id][data-selected="1"] [data-role="entrance"] { fill: ${o()}; }
2693
2700
  [data-berth-id][data-pick="1"] { pointer-events: auto; cursor: pointer; }
2694
2701
  `, n.querySelector("svg")?.appendChild(r), new XMLSerializer().serializeToString(n);
@@ -2696,7 +2703,7 @@ function Ri(e, t) {
2696
2703
  return e;
2697
2704
  }
2698
2705
  }
2699
- class O {
2706
+ class de {
2700
2707
  bounds;
2701
2708
  svgData;
2702
2709
  rotation;
@@ -2713,7 +2720,7 @@ function Ri(e, t) {
2713
2720
  lat: e.neLat,
2714
2721
  lng: e.neLng
2715
2722
  }
2716
- }, this.svgData = le(e.svgData), this.rotation = e.rotation ?? 0, this.overlayView.onAdd = () => {
2723
+ }, this.svgData = ue(e.svgData), this.rotation = e.rotation ?? 0, this.overlayView.onAdd = () => {
2717
2724
  this.div = document.createElement("div"), this.div.style.cssText = "position:absolute;pointer-events:none;transform-origin:center center;", this.div.innerHTML = this.svgData;
2718
2725
  let e = this.div.querySelector("svg");
2719
2726
  e && (e.style.width = "100%", e.style.height = "100%"), this.div.addEventListener("click", (e) => {
@@ -2721,7 +2728,7 @@ function Ri(e, t) {
2721
2728
  if (!t || !(g() ? t.getAttribute("data-pick") === "1" : t.getAttribute("data-status") === "available" && !t.hasAttribute("data-fit"))) return;
2722
2729
  let n = t.getAttribute("data-berth-id");
2723
2730
  h()(m() === n ? null : n);
2724
- }), this.overlayView.getPanes().overlayMouseTarget.appendChild(this.div), ue();
2731
+ }), this.overlayView.getPanes().overlayMouseTarget.appendChild(this.div), k();
2725
2732
  }, this.overlayView.draw = () => {
2726
2733
  if (!this.div) return;
2727
2734
  let e = this.overlayView.getProjection();
@@ -2736,8 +2743,8 @@ function Ri(e, t) {
2736
2743
  this.overlayView.setMap(e);
2737
2744
  }
2738
2745
  }
2739
- function ue() {
2740
- let e = _?.getRootNode();
2746
+ function k() {
2747
+ let e = v?.getRootNode();
2741
2748
  if (!e) return;
2742
2749
  let t = new Map(u().map((e) => [e.berthId, e]));
2743
2750
  e.querySelectorAll("[data-berth-id]").forEach((e) => {
@@ -2745,61 +2752,61 @@ function Ri(e, t) {
2745
2752
  !g() && r && !Di(r, p()) ? e.setAttribute("data-fit", "small") : e.removeAttribute("data-fit"), n === m() ? e.setAttribute("data-selected", "1") : e.removeAttribute("data-selected");
2746
2753
  });
2747
2754
  }
2748
- function de(e, t) {
2755
+ function fe(e, t) {
2749
2756
  let n = e.berth.status !== "available";
2750
2757
  e.pickable = Oi(e.berth, p(), g());
2751
- let r = t === m() ? J(re) : n ? g() ? J(oe) : ae : e.pickable ? J(te) : ie;
2758
+ let r = t === m() ? J(ae) : n ? g() ? J(ce) : se : e.pickable ? J(re) : oe;
2752
2759
  e.circle.setOptions({
2753
2760
  ...r,
2754
2761
  clickable: e.pickable
2755
- }), e.hull?.setOptions({ fillOpacity: r === ie || r === ae ? .2 : .85 });
2762
+ }), e.hull?.setOptions({ fillOpacity: r === oe || r === se ? .2 : .85 });
2756
2763
  }
2757
2764
  Hr(() => {
2758
2765
  let e = !1;
2759
2766
  return bi(n()).then(() => {
2760
- if (e || !_) return;
2761
- let t = window.google.maps, n = new t.Map(_, {
2767
+ if (e || !v) return;
2768
+ let t = window.google.maps, n = new t.Map(v, {
2762
2769
  center: i(),
2763
2770
  zoom: 15,
2764
2771
  disableDefaultUI: !0,
2765
2772
  zoomControl: !0,
2766
- styles: r() === "coastal" ? J(T) : w,
2773
+ styles: r() === "coastal" ? J(D) : E,
2767
2774
  backgroundColor: r() === "coastal" ? "#f5efe4" : "#ffffff"
2768
2775
  });
2769
2776
  t.event.addListenerOnce(n, "idle", () => {
2770
- e || U(v, n);
2777
+ e || U(y, n);
2771
2778
  });
2772
2779
  }), () => {
2773
2780
  e = !0;
2774
2781
  };
2775
2782
  });
2776
- let k = null, fe = null;
2783
+ let pe = null, A = null;
2777
2784
  xn(() => {
2778
- !J(v) || i().lat === k && i().lng === fe || (k = i().lat, fe = i().lng, J(v).setCenter(i()));
2785
+ !J(y) || i().lat === pe && i().lng === A || (pe = i().lat, A = i().lng, J(y).setCenter(i()));
2779
2786
  }), xn(() => {
2780
- m(), p(), u(), g(), ue();
2787
+ m(), p(), u(), g(), k();
2781
2788
  });
2782
- function pe() {
2783
- if (!J(v) || r() !== "chart") return;
2789
+ function j() {
2790
+ if (!J(y) || r() !== "chart") return;
2784
2791
  let e = new window.google.maps.LatLngBounds();
2785
2792
  for (let t of u()) {
2786
2793
  if (t.lat == null || t.lng == null || !t.berthId) continue;
2787
2794
  let n = window.google.maps, r = Pi(t, d()), i = r == null ? new n.Circle({
2788
- map: J(v),
2795
+ map: J(y),
2789
2796
  center: {
2790
2797
  lat: t.lat,
2791
2798
  lng: t.lng
2792
2799
  },
2793
- radius: se(t),
2794
- ...J(te)
2800
+ radius: S(t),
2801
+ ...J(re)
2795
2802
  }) : new n.Polygon({
2796
- map: J(v),
2803
+ map: J(y),
2797
2804
  paths: Fi(t, r, Mi),
2798
- ...J(te)
2805
+ ...J(re)
2799
2806
  }), o = {
2800
2807
  circle: i,
2801
2808
  hull: r == null ? null : new n.Polygon({
2802
- map: J(v),
2809
+ map: J(y),
2803
2810
  paths: Fi(t, r, Ni, .8),
2804
2811
  clickable: !1,
2805
2812
  zIndex: 1,
@@ -2811,42 +2818,42 @@ function Ri(e, t) {
2811
2818
  berth: t,
2812
2819
  pickable: !1
2813
2820
  };
2814
- y.set(t.berthId, o), hr(() => de(o, t.berthId)), i.addListener("click", () => h()(t.berthId === m() ? null : t.berthId)), i.addListener("mouseover", () => {
2815
- o.pickable && t.berthId !== m() && i.setOptions(J(ne));
2821
+ b.set(t.berthId, o), hr(() => fe(o, t.berthId)), i.addListener("click", () => h()(t.berthId === m() ? null : t.berthId)), i.addListener("mouseover", () => {
2822
+ o.pickable && t.berthId !== m() && i.setOptions(J(ie));
2816
2823
  }), i.addListener("mouseout", () => {
2817
- t.berthId !== m() && de(o, t.berthId);
2824
+ t.berthId !== m() && fe(o, t.berthId);
2818
2825
  }), e.extend({
2819
2826
  lat: t.lat,
2820
2827
  lng: t.lng
2821
2828
  });
2822
2829
  }
2823
- y.size && !x && (x = !0, e.extend(i()), J(v).fitBounds(e, 60));
2830
+ b.size && !te && (te = !0, e.extend(i()), J(y).fitBounds(e, ne()));
2824
2831
  }
2825
2832
  xn(() => {
2826
- if (!(!J(v) || r() !== "chart")) {
2827
- for (let e of y.values()) e.circle.setMap(null), e.hull?.setMap(null);
2828
- y.clear(), pe();
2833
+ if (!(!J(y) || r() !== "chart")) {
2834
+ for (let e of b.values()) e.circle.setMap(null), e.hull?.setMap(null);
2835
+ b.clear(), j();
2829
2836
  }
2830
2837
  }), xn(() => {
2831
- if (!J(v)) return;
2832
- for (let e of b) e.setMap(null);
2838
+ if (!J(y)) return;
2839
+ for (let e of ee) e.setMap(null);
2833
2840
  let e = [];
2834
- s() && e.push(new E(i(), s(), c(), null));
2835
- for (let t of l()) t.logoMark && e.push(new E({
2841
+ s() && e.push(new le(i(), s(), c(), null));
2842
+ for (let t of l()) t.logoMark && e.push(new le({
2836
2843
  lat: t.lat,
2837
2844
  lng: t.lng
2838
2845
  }, t.logoMark, t.name, t.href));
2839
- for (let t of e) t.setMap(J(v));
2840
- b = e;
2846
+ for (let t of e) t.setMap(J(y));
2847
+ ee = e;
2841
2848
  }), xn(() => {
2842
- if (!J(v) || r() !== "coastal") return;
2843
- for (let e of ee) e.setMap(null);
2849
+ if (!J(y) || r() !== "coastal") return;
2850
+ for (let e of x) e.setMap(null);
2844
2851
  let e = d().length ? d() : f() ? [f()] : [];
2845
- if (ee = e.map((e) => {
2846
- let t = new O(e);
2847
- return t.setMap(J(v)), t;
2848
- }), e.length && !x) {
2849
- x = !0;
2852
+ if (x = e.map((e) => {
2853
+ let t = new de(e);
2854
+ return t.setMap(J(y)), t;
2855
+ }), e.length && !te) {
2856
+ te = !0;
2850
2857
  let t = new window.google.maps.LatLngBounds();
2851
2858
  for (let n of e) t.extend({
2852
2859
  lat: n.swLat,
@@ -2855,17 +2862,17 @@ function Ri(e, t) {
2855
2862
  lat: n.neLat,
2856
2863
  lng: n.neLng
2857
2864
  });
2858
- J(v).fitBounds(t, 60);
2865
+ J(y).fitBounds(t, ne());
2859
2866
  }
2860
2867
  });
2861
- let A = null;
2868
+ let me = null;
2862
2869
  xn(() => {
2863
2870
  p();
2864
- let e = m() != null && m() !== A;
2865
- for (let [t, n] of y) de(n, t), e && t === m() && C(n);
2866
- A = m();
2871
+ let e = m() != null && m() !== me;
2872
+ for (let [t, n] of b) fe(n, t), e && t === m() && T(n);
2873
+ me = m();
2867
2874
  });
2868
- var j = {
2875
+ var he = {
2869
2876
  get mapsApiKey() {
2870
2877
  return n();
2871
2878
  },
@@ -2955,9 +2962,15 @@ function Ri(e, t) {
2955
2962
  },
2956
2963
  set staff(e = !1) {
2957
2964
  g(e), V();
2965
+ },
2966
+ get fitInset() {
2967
+ return _();
2968
+ },
2969
+ set fitInset(e) {
2970
+ _(e), V();
2958
2971
  }
2959
- }, me = Ii();
2960
- return fi(me, (e) => _ = e, () => _), jr(e, me), qe(j);
2972
+ }, ge = Ii();
2973
+ return fi(ge, (e) => v = e, () => v), jr(e, ge), qe(he);
2961
2974
  }
2962
2975
  vi(Ri, {
2963
2976
  mapsApiKey: {},
@@ -2974,7 +2987,8 @@ vi(Ri, {
2974
2987
  loa: {},
2975
2988
  selectedBerth: {},
2976
2989
  onBerthClick: {},
2977
- staff: {}
2990
+ staff: {},
2991
+ fitInset: {}
2978
2992
  }, [], [], { mode: "open" });
2979
2993
  //#endregion
2980
2994
  //#region node_modules/flatpickr/dist/esm/types/options.js