{"version":3,"file":"index.mjs","names":["Accessor","JSX","Setter","createContext","createEffect","createSignal","useContext","raise","LatLngLiteral","Size","width","height","Point","x","y","Vector","GlobeContextType","size","center","zoom","translation","rotation","setCenter","setZoom","setTranslation","setRotation","defaults","lat","lng","const","GlobeContext","GlobeContextProviderProps","children","Element","GlobeContextProvider","props","setSize","_$createComponent","Provider","value","useGlobeContext","Error","defaults","_$createComponent","timer","d3GeoCircle","d3Timer","selection","d3Selection","ControlPosition","JSX","ControlAction","ControlProps","class","onAction","action","controlPositions","Record","topleft","topright","bottomleft","bottomright","ZoomControls","props","Element","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","$$click","_$effect","_$className","ActionControls","_el$4","_tmpl$2","_el$5","_el$6","_$delegateEvents","_tmpl$","_tmpl$2","_$className","_$delegateEvents","createResizeObserver","GeoProjection","easeLinear","easeSinOut","geoMercator","geoOrthographic","geoPath","geoTransverseMercator","interpolateNumber","transition","ControlPosition","Accessor","JSX","Setter","Show","createEffect","createMemo","createSignal","Topology","mx","GlobeContextProvider","GlobeContextProviderProps","useGlobeContext","Features","StyleSet","createLayers","geoToPosition","positionToRotation","renderLayers","timer","ActionControls","ControlProps","ZoomControls","controlPositions","defaultStyles","Record","light","background","fillStyle","water","land","line","strokeStyle","point","strokeWidth","pointRadius","dark","GlobeController","canvas","HTMLCanvasElement","projection","zoom","translation","x","y","rotation","setZoom","prev","setTranslation","setRotation","ProjectionType","projectionMap","getProjection","type","GlobeCanvasProps","constructor","GlobeRootProps","children","Element","class","Partial","HTMLAttributes","HTMLDivElement","GlobeRoot","props","containerRef","size","setSize","width","height","_$createComponent","_$mergeProps","_el$","_tmpl$","_ref$","_$use","_$spread","_$insert","ref","controller","topology","features","styles","GlobeCanvas","themeMode","setCanvas","layers","center","setCenter","zoomValue","zooming","c","canvasEl","state","is","ease","duration","tween","t","newZoom","on","generator","proj","getContext","alpha","gen","z","r","s","scale","Math","min","translate","rotate","when","_$memo","_el$2","_tmpl$2","_$effect","_p$","_v$","_v$2","e","_$setAttribute","undefined","GlobeDebug","position","_el$3","_tmpl$3","_el$4","firstChild","JSON","stringify","_$className","GlobePanel","_el$5","CustomControl","_el$6","GlobeControlProps","Pick","GlobeZoom","onAction","GlobeAction","Globe","Root","Canvas","Zoom","Action","Debug","Panel","_tmpl$","_tmpl$2","_$createComponent","_$mergeProps","_$use","_$memo","_$setAttribute","_$className","CustomControl","L","ControlPosition","LatLngLiteral","latLngBounds","Accessor","JSX","Setter","Show","createContext","createEffect","createSignal","onCleanup","onMount","useContext","GeoMarker","ActionControls","ControlProps","ZoomControls","controlPositions","defaults","center","lat","lng","zoom","const","MapController","setCenter","setZoom","cb","MapContextValue","map","Map","attention","setAttention","onChange","ev","MapContext","useMapContext","displayName","context","Error","MapRootProps","ref","controller","children","Element","class","scrollWheelZoom","doubleClickZoom","touchZoom","MapRoot","props","mapContainer","HTMLDivElement","setMap","leafletMap","attributionControl","zoomControl","setView","getZoom","remove","enable","disable","_$createComponent","Provider","value","_el$","_tmpl$","_ref$","_$use","_$effect","_$className","when","MapTiles","name","tileLayer","TileLayer","att","detectRetina","keepBuffer","className","addTo","on","target","getCenter","container","getContainer","MapMarkersProps","markers","MapMarkers","leafletMarkers","Marker","lastMarkerIds","Set","forEach","marker","length","markerList","currentIds","m","id","size","every","has","bounds","location","fitBounds","title","icon","Icon","iconUrl","iconRetinaUrl","shadowUrl","iconSize","iconAnchor","popupAnchor","shadowSize","bindPopup","push","CustomControl","position","mapAccessor","controlContainer","Control","extend","onAdd","DomUtil","create","DomEvent","disableClickPropagation","disableScrollPropagation","appendChild","control","_el$2","_tmpl$2","_ref$2","_$insert","MapControlProps","Pick","MapZoom","onAction","MapAction","Root","Tiles","Markers","Zoom","Action","_$createComponent","_$use","_$className"],"sources":["../../src/hooks/context.tsx","../../src/util/debug.ts","../../src/util/inertia.ts","../../src/util/path.ts","../../src/util/render.ts","../../src/hooks/useDrag.ts","../../src/hooks/useGlobeZoomHandler.ts","../../src/hooks/useMapZoomHandler.ts","../../src/hooks/useSpinner.ts","../../src/hooks/useTour.ts","../../src/components/Toolbar/Controls.tsx","../../src/components/Globe/Globe.tsx","../../src/components/Map/Map.tsx"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Accessor, type JSX, type Setter, createContext, createEffect, createSignal, useContext } from 'solid-js';\n\nimport { raise } from '@dxos/debug';\n\nimport { type LatLngLiteral } from '../types.ts';\n\n// TODO(burdon): Factor out common geometry types.\nexport type Size = { width: number; height: number };\nexport type Point = { x: number; y: number };\nexport type Vector = [number, number, number];\n\nexport type GlobeContextType = {\n  size: Accessor<Size>;\n  center: Accessor<LatLngLiteral | undefined>;\n  zoom: Accessor<number>;\n  translation: Accessor<Point | undefined>;\n  rotation: Accessor<Vector | undefined>;\n  setCenter: Setter<LatLngLiteral | undefined>;\n  setZoom: Setter<number>;\n  setTranslation: Setter<Point | undefined>;\n  setRotation: Setter<Vector | undefined>;\n};\n\nconst defaults = {\n  center: { lat: 51, lng: 0 } as LatLngLiteral,\n  zoom: 4,\n} as const;\n\nconst GlobeContext = createContext<GlobeContextType>();\n\nexport type GlobeContextProviderProps = {\n  children: JSX.Element;\n  size?: Size;\n  center?: LatLngLiteral;\n  zoom?: number;\n  translation?: Point;\n  rotation?: Vector;\n};\n\nexport const GlobeContextProvider = (props: GlobeContextProviderProps) => {\n  const [size, setSize] = createSignal<Size>(props.size ?? { width: 0, height: 0 });\n  const [center, setCenter] = createSignal<LatLngLiteral | undefined>(props.center ?? defaults.center);\n  const [zoom, setZoom] = createSignal(props.zoom ?? defaults.zoom);\n  const [translation, setTranslation] = createSignal<Point | undefined>(props.translation);\n  const [rotation, setRotation] = createSignal<Vector | undefined>(props.rotation);\n\n  // Update size when prop changes\n  createEffect(() => {\n    if (props.size) {\n      setSize(props.size);\n    }\n  });\n\n  return (\n    <GlobeContext.Provider\n      value={{\n        size,\n        center,\n        zoom,\n        translation,\n        rotation,\n        setCenter,\n        setZoom,\n        setTranslation,\n        setRotation,\n      }}\n    >\n      {props.children}\n    </GlobeContext.Provider>\n  );\n};\n\nexport const useGlobeContext = () => {\n  return useContext(GlobeContext) ?? raise(new Error('Missing GlobeContext'));\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nconst debug = false;\n\nexport const timer = <T = void>(cb: () => T): T => {\n  const start = Date.now();\n  const data = cb();\n  const t = Date.now() - start / 1_000;\n  if (debug) {\n    // eslint-disable-next-line no-console\n    console.log({ t, data });\n  }\n\n  return data;\n};\n","//\n// Copyright 2017 Philippe Rivière\n// Copyright 2025 DXOS.org\n// https://github.com/Fil/d3-inertia\n//\n\nimport { drag, select, timer } from 'd3';\nimport versor from 'versor';\n\nexport const restrictAxis =\n  (axis: boolean[]) =>\n  (original: number[], current: number[]): number[] =>\n    current.map((d, i) => (axis[i] ? d : original[i]));\n\n/**\n * Applies a drag handler to the specified target element.\n */\n// TODO(burdon): Define type.\nexport const geoInertiaDrag = (target, render, projection, options) => {\n  if (!options) {\n    options = {};\n  }\n\n  // Target can be an element, a selector, a function, or a selection\n  // but in case of a selection we make sure to reselect it with d3-selection.\n  if (target.node) {\n    target = target.node();\n  }\n  target = select(target);\n\n  // Complete params: (projection, render, startDrag, dragging, endDrag).\n  const inertia = geoInertiaDragHelper({\n    projection,\n    render: (rotation) => {\n      projection.rotate(rotation);\n      render && render();\n    },\n    axis: restrictAxis(options.xAxis ? [true, false, false] : [true, true, true]),\n    start: options.start,\n    move: options.move,\n    end: options.end,\n    stop: options.stop,\n    finish: options.finish,\n    time: options.time,\n    hold: options.hold,\n  });\n\n  target.call(drag().on('start', inertia.start).on('drag', inertia.move).on('end', inertia.end));\n  return inertia;\n};\n\n/**\n * A versor is a compact way to describe a rotation in 3D space.\n * It consists of four components [𝑤,x,y,z], where:\n * 𝑤 is a scalar representing the angle of rotation.\n * x, y, z are the vector components, representing the axis of rotation.\n */\nconst geoInertiaDragHelper = (opt) => {\n  const projection = opt.projection;\n\n  let v0; // Mouse position in Cartesian coordinates at start of drag gesture.\n  let r0; // Projection rotation as Euler angles at start.\n  let q0; // Projection rotation as versor at start.\n  let v10; // Mouse position in Cartesian coordinates just before end of drag gesture.\n  let v11; // Mouse position in Cartesian coordinates at end.\n  let q10; // Projection rotation as versor at end.\n\n  const inertia = inertiaHelper({\n    axis: opt.axis,\n\n    start: () => {\n      v0 = versor.cartesian(projection.invert(inertia.position));\n      r0 = projection.rotate();\n      q0 = versor(r0);\n      opt.start && opt.start();\n    },\n\n    move: () => {\n      const inv = projection.rotate(r0).invert(inertia.position);\n      if (isNaN(inv[0])) {\n        return;\n      }\n      const v1 = versor.cartesian(inv);\n      const q1 = versor.multiply(q0, versor.delta(v0, v1));\n      const r1 = versor.rotation(q1);\n      const r2 = opt.axis(r0, r1);\n      opt.render(r2);\n      opt.move && opt.move();\n    },\n\n    end: () => {\n      // Velocity.\n      v10 = versor.cartesian(projection.invert(inertia.position.map((d, i) => d - inertia.velocity[i] / 1_000)));\n      q10 = versor(projection.rotate());\n      v11 = versor.cartesian(projection.invert(inertia.position));\n      opt.end && opt.end();\n    },\n\n    stop: opt.stop,\n\n    finish: opt.finish,\n\n    render: (t) => {\n      const r1 = versor.rotation(versor.multiply(q10, versor.delta(v10, v11, t * 1_000)));\n      const r2 = opt.axis(r0, r1);\n      opt.render && opt.render(r2);\n    },\n\n    time: opt.time,\n  });\n\n  return inertia;\n};\n\nfunction inertiaHelper(opt) {\n  const A = opt.time || 5_000; // Reference time in ms.\n  const limit = 1.0001;\n  const B = -Math.log(1 - 1 / limit);\n  const inertia = {\n    position: [0, 0],\n    velocity: [0, 0], // Velocity in pixels/s.\n    timer: timer(() => {}),\n    time: 0,\n    t: 0,\n\n    start: function (ev) {\n      const position = [ev.x, ev.y];\n      inertia.position = position;\n      inertia.velocity = [0, 0];\n      inertia.timer.stop();\n      this.classList.remove('inertia');\n      this.classList.add('dragging');\n      opt.start && opt.start.call(this, position);\n    },\n\n    move: function (ev) {\n      const position = [ev.x, ev.y];\n      const time = performance.now();\n      const deltaTime = time - inertia.time;\n      const decay = 1 - Math.exp(-deltaTime / 1_000);\n      inertia.velocity = inertia.velocity.map((d, i) => {\n        const deltaPos = position[i] - inertia.position[i];\n        const deltaTime = time - inertia.time;\n        return (1_000 * (1 - decay) * deltaPos) / deltaTime + d * decay;\n      });\n\n      // Clamp velocity axis.\n      inertia.velocity = opt.axis([0, 0], inertia.velocity);\n\n      inertia.time = time;\n      inertia.position = position;\n      opt.move && opt.move.call(this, position);\n    },\n\n    end: function (ev) {\n      this.classList.remove('dragging', 'inertia');\n\n      const v = inertia.velocity;\n      if (v[0] * v[0] + v[1] * v[1] < 100) {\n        inertia.timer.stop();\n        return opt.stop && opt.stop();\n      }\n\n      const time = performance.now();\n      const deltaTime = time - inertia.time;\n\n      if (opt.hold === undefined) {\n        opt.hold = 100;\n      } // Default flick->drag threshold time (0 disables inertia).\n\n      if (deltaTime >= opt.hold) {\n        inertia.timer.stop();\n        return opt.stop && opt.stop();\n      }\n\n      this.classList.add('inertia');\n      opt.end && opt.end();\n\n      const self = this;\n      inertia.timer.restart((e) => {\n        inertia.t = limit * (1 - Math.exp((-B * e) / A));\n        opt.render && opt.render(inertia.t);\n        if (inertia.t > 1) {\n          inertia.timer.stop();\n          self.classList.remove('inertia');\n          inertia.velocity = [0, 0];\n          inertia.t = 1;\n          opt.finish && opt.finish();\n        }\n      });\n    },\n  };\n\n  inertia.timer.stop();\n  return inertia;\n}\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { type GeoGeometryObjects, geoCircle as d3GeoCircle } from 'd3';\nimport { type Point, type Polygon, type Position } from 'geojson';\nimport { type LatLngLiteral } from 'leaflet';\n\nimport type { Vector } from '../hooks/index.ts';\n\nexport const positionToRotation = ([lng, lat]: [number, number], tilt = 0): Vector => [-lng, tilt - lat, 0];\n\nexport const geoToPosition = ({ lat, lng }: LatLngLiteral): [number, number] => [lng, lat];\n\nexport const geoPoint = (point: LatLngLiteral): Point => ({ type: 'Point', coordinates: geoToPosition(point) });\n\n// https://github.com/d3/d3-geo#geoCircle\nexport const geoCircle = ({ lat, lng }: LatLngLiteral, radius: number): Polygon =>\n  d3GeoCircle().radius(radius).center([lng, lat])();\n\nexport const geoLine = (p1: LatLngLiteral, p2: LatLngLiteral): GeoGeometryObjects => ({\n  type: 'LineString',\n  coordinates: [\n    [p1.lng, p1.lat],\n    [p2.lng, p2.lat],\n  ],\n});\n\nexport const closestPoint = (points: Position[], target: Position): Position | null => {\n  if (points.length === 0) {\n    return target;\n  }\n\n  let closestPoint = points[0];\n  let minDistance = getDistance(points[0], target);\n\n  for (const point of points) {\n    const distance = getDistance(point, target);\n    if (distance < minDistance) {\n      minDistance = distance;\n      closestPoint = point;\n    }\n  }\n\n  return closestPoint;\n};\n\nexport const getDistance = (point1: Position, point2: Position): number => {\n  const dx = point1[0] - point2[0];\n  const dy = point1[1] - point2[1];\n  return Math.sqrt(dx * dx + dy * dy);\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { type GeoPath, type GeoPermissibleObjects, geoGraticule } from 'd3';\nimport { feature, mesh } from 'topojson-client';\nimport { type Topology } from 'topojson-specification';\n\nimport { type LatLngLiteral } from '../types.ts';\nimport { geoLine, geoPoint } from './path.ts';\n\nexport type Styles = Record<string, any>;\n\nexport type Style =\n  | 'background'\n  | 'water'\n  | 'graticule'\n  | 'land'\n  | 'border'\n  | 'dots'\n  | 'point'\n  | 'line'\n  | 'cursor'\n  | 'arc';\n\nexport type StyleSet = Partial<Record<Style, Styles>>;\n\nexport type Features = {\n  points?: LatLngLiteral[];\n  lines?: { source: LatLngLiteral; target: LatLngLiteral }[];\n};\n\nexport type Layer = {\n  styles: Styles;\n  path: GeoPermissibleObjects;\n};\n\n/**\n * Create rendering layers.\n */\nexport const createLayers = (topology: Topology, features: Features, styles: StyleSet): Layer[] => {\n  const layers: Layer[] = [];\n\n  if (styles.water) {\n    layers.push({\n      styles: styles.water,\n      path: {\n        type: 'Sphere',\n      },\n    });\n  }\n\n  if (styles.graticule) {\n    layers.push({\n      styles: styles.graticule,\n      path: geoGraticule().step([6, 6])(),\n    });\n  }\n\n  //\n  // Topology.\n  //\n\n  if (topology) {\n    if (topology.objects.land && styles.land) {\n      layers.push({\n        styles: styles.land,\n        path: feature(topology, topology.objects.land),\n      });\n    }\n\n    if (topology.objects.countries && styles.border) {\n      layers.push({\n        styles: styles.border,\n        path: mesh(topology, topology.objects.countries, (a: any, b: any) => a !== b),\n      });\n    }\n\n    if (topology.objects.dots && styles.dots) {\n      layers.push({\n        styles: styles.dots,\n        path: topology.objects.dots as any, // TODO(burdon): Type.\n      });\n    }\n  }\n\n  //\n  // Features.\n  //\n\n  if (features) {\n    const { points, lines } = features;\n\n    if (points && styles.point) {\n      layers.push({\n        styles: styles.point,\n        path: {\n          type: 'GeometryCollection',\n          geometries: points.map((point) => geoPoint(point)),\n        },\n      });\n    }\n\n    if (lines && styles.line) {\n      layers.push({\n        styles: styles.line,\n        path: {\n          type: 'GeometryCollection',\n          geometries: lines.map(({ source, target }) => geoLine(source, target)),\n        },\n      });\n    }\n  }\n\n  return layers;\n};\n\n/**\n * Render layers created above.\n */\nexport const renderLayers = (generator: GeoPath, layers: Layer[] = [], scale: number, styles: StyleSet) => {\n  const context: CanvasRenderingContext2D = generator.context();\n  const {\n    canvas: { width, height },\n  } = context;\n  context.reset();\n\n  // Clear background.\n  if (styles.background) {\n    context.fillStyle = styles.background.fillStyle;\n    context.fillRect(0, 0, width, height);\n  } else {\n    context.clearRect(0, 0, width, height);\n  }\n\n  // Render features.\n  // https://github.com/d3/d3-geo#_path\n  layers.forEach(({ path, styles }) => {\n    context.save();\n    let fill = false;\n    let stroke = false;\n    if (styles) {\n      Object.entries(styles).forEach(([key, value]) => {\n        if (key === 'pointRadius') {\n          generator.pointRadius(value * scale);\n        } else {\n          context[key] = value;\n          fill ||= key === 'fillStyle';\n          stroke ||= key === 'strokeStyle';\n        }\n      });\n    }\n\n    context.beginPath();\n\n    generator(path);\n    fill && context.fill();\n    stroke && context.stroke();\n    context.restore();\n  });\n\n  return context;\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { select } from 'd3';\nimport { createEffect, onCleanup } from 'solid-js';\n\nimport { type GlobeController } from '../components/index.ts';\nimport { geoInertiaDrag } from '../util/index.ts';\n\nexport type GlobeDragEvent = {\n  type: 'start' | 'move' | 'end';\n  controller: GlobeController;\n};\n\nexport type DragOptions = {\n  disabled?: boolean;\n  duration?: number;\n  xAxis?: boolean; // TODO(burdon): Generalize.\n  onUpdate?: (event: GlobeDragEvent) => void;\n};\n\n/**\n * Allows user to drag globe.\n */\nexport const useDrag = (controller?: GlobeController | null, options: DragOptions = {}) => {\n  createEffect(() => {\n    const canvas = controller?.canvas;\n    if (!canvas || options.disabled) {\n      return;\n    }\n\n    geoInertiaDrag(\n      select(canvas),\n      () => {\n        controller.setRotation(controller.projection.rotate());\n        options.onUpdate?.({ type: 'move', controller });\n      },\n      controller.projection,\n      {\n        xAxis: options.xAxis,\n        time: 3_000,\n        start: () => options.onUpdate?.({ type: 'start', controller }),\n        finish: () => options.onUpdate?.({ type: 'end', controller }),\n      },\n    );\n\n    onCleanup(() => {\n      cancelDrag(select(canvas));\n    });\n  });\n};\n\nconst cancelDrag = (node) => node.on('.drag', null);\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ControlProps, type GlobeController } from '../components/index.ts';\n\nconst ZOOM_FACTOR = 0.1;\n\nexport const useGlobeZoomHandler = (controller: GlobeController | null | undefined): ControlProps['onAction'] => {\n  return (event) => {\n    if (!controller) {\n      return;\n    }\n\n    switch (event) {\n      case 'zoom-in': {\n        controller.setZoom((zoom) => {\n          return zoom * (1 + ZOOM_FACTOR);\n        });\n        break;\n      }\n      case 'zoom-out': {\n        controller.setZoom((zoom) => {\n          return zoom * (1 - ZOOM_FACTOR);\n        });\n        break;\n      }\n    }\n  };\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ControlProps, type MapController } from '../components/index.ts';\n\nexport const useMapZoomHandler = (controller: MapController | null | undefined): ControlProps['onAction'] => {\n  return (event) => {\n    if (!controller) {\n      return;\n    }\n\n    switch (event) {\n      case 'zoom-in': {\n        controller.setZoom((scale) => scale + 1);\n        break;\n      }\n      case 'zoom-out': {\n        controller.setZoom((scale) => scale - 1);\n        break;\n      }\n    }\n  };\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { timer as d3Timer } from 'd3';\nimport { type Timer } from 'd3';\nimport { createEffect, createSignal, onCleanup } from 'solid-js';\n\nimport { type GlobeController } from '../components/index.ts';\nimport { type Vector } from './context.tsx';\n\nexport type SpinnerOptions = {\n  disabled?: boolean;\n  delta?: Vector;\n};\n\n/**\n * Rotates globe.\n */\nexport const useSpinner = (controller?: GlobeController | null, options: SpinnerOptions = {}) => {\n  const [running, setRunning] = createSignal(false);\n\n  createEffect(() => {\n    let timer: Timer | undefined;\n\n    const start = () => {\n      const delta: Vector = options.delta ?? [0.001, 0, 0];\n\n      let t = 0;\n      let lastRotation = controller!.projection.rotate();\n      timer = d3Timer((elapsed) => {\n        const dt = elapsed - t;\n        t = elapsed;\n\n        const rotation: Vector = [\n          lastRotation[0] + delta[0] * dt,\n          lastRotation[1] + delta[1] * dt,\n          lastRotation[2] + delta[2] * dt,\n        ];\n\n        lastRotation = rotation;\n        controller!.setRotation(rotation);\n      });\n    };\n\n    const stop = () => {\n      if (timer) {\n        timer.stop();\n        timer = undefined;\n      }\n    };\n\n    if (controller && running()) {\n      start();\n    } else {\n      stop();\n    }\n\n    onCleanup(() => stop());\n  });\n\n  return {\n    start: () => {\n      if (!options.disabled) {\n        setRunning(true);\n      }\n    },\n    stop: () => setRunning(false),\n  };\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { selection as d3Selection, geoDistance, geoInterpolate, geoPath } from 'd3';\nimport { type Accessor, type Setter, createEffect, createSignal, onCleanup } from 'solid-js';\nimport versor from 'versor';\n\nimport type { GlobeController } from '../components/index.ts';\nimport { type LatLngLiteral } from '../types.ts';\nimport { type StyleSet, geoToPosition, positionToRotation } from '../util/index.ts';\n\nconst TRANSITION_NAME = 'globe-tour';\n\nconst defaultDuration = 1_500;\n\nexport type TourOptions = {\n  running?: boolean;\n  disabled?: boolean;\n  duration?: number;\n  loop?: boolean;\n  tilt?: number;\n  autoRotate?: boolean;\n  styles?: StyleSet;\n};\n\n/**\n * Iterates between points.\n * Inspired by: https://observablehq.com/@mbostock/top-100-cities\n */\nexport const useTour = (\n  controller?: GlobeController | null,\n  points?: LatLngLiteral[],\n  options: TourOptions = {},\n): { running: Accessor<boolean>; setRunning: Setter<boolean> } => {\n  const selection = d3Selection();\n  const [running, setRunning] = createSignal(options.running ?? false);\n\n  createEffect(() => {\n    if (!running()) {\n      selection.interrupt(TRANSITION_NAME);\n      return;\n    }\n\n    let t: ReturnType<typeof setTimeout>;\n    if (controller && running()) {\n      t = setTimeout(async () => {\n        const { canvas, projection, setRotation } = controller;\n        const context = canvas.getContext('2d', { alpha: false });\n        const path = geoPath(projection, context).pointRadius(2);\n\n        const tilt = options.tilt ?? 0;\n        let last: LatLngLiteral;\n        try {\n          const p = [...(points ?? [])];\n          if (options.loop) {\n            p.push(p[0]);\n          }\n\n          for (const next of p) {\n            if (!running()) {\n              break;\n            }\n\n            // Points.\n            const p1 = last ? geoToPosition(last) : undefined;\n            const p2 = geoToPosition(next);\n            const ip = geoInterpolate(p1 || p2, p2);\n            const distance = geoDistance(p1 || p2, p2);\n\n            // Rotation.\n            const r1 = p1 ? positionToRotation(p1, tilt) : controller.projection.rotate();\n            const r2 = positionToRotation(p2, tilt);\n            const iv = versor.interpolate(r1, r2);\n\n            const transition = selection\n              .transition(TRANSITION_NAME)\n              .duration(Math.max(options.duration ?? defaultDuration, distance * 2_000))\n              .tween('render', () => (t) => {\n                const t1 = Math.max(0, Math.min(1, t * 2 - 1));\n                const t2 = Math.min(1, t * 2);\n\n                context.save();\n                {\n                  context.beginPath();\n                  context.strokeStyle = options?.styles?.arc?.strokeStyle ?? 'yellow';\n                  context.lineWidth = (options?.styles?.arc?.lineWidth ?? 1.5) * (controller?.zoom ?? 1);\n                  context.setLineDash(options?.styles?.arc?.lineDash ?? []);\n                  path({ type: 'LineString', coordinates: [ip(t1), ip(t2)] });\n                  context.stroke();\n\n                  context.beginPath();\n                  context.fillStyle = options?.styles?.cursor?.fillStyle ?? 'orange';\n                  path.pointRadius((options?.styles?.cursor?.pointRadius ?? 2) * (controller?.zoom ?? 1));\n                  path({ type: 'Point', coordinates: ip(t2) });\n                  context.fill();\n                }\n                context.restore();\n\n                // TODO(burdon): This has to come after rendering above. Add to features to correct order?\n                projection.rotate(iv(t));\n                setRotation(projection.rotate());\n              });\n\n            // Throws if interrupted.\n            await transition.end();\n            last = next;\n          }\n        } catch {\n          // Ignore.\n        } finally {\n          setRunning(false);\n        }\n      });\n\n      onCleanup(() => {\n        clearTimeout(t);\n        selection.interrupt(TRANSITION_NAME);\n      });\n    }\n  });\n\n  return { running, setRunning };\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ControlPosition } from 'leaflet';\nimport { type JSX } from 'solid-js';\n\nexport type ControlAction = 'toggle' | 'start' | 'zoom-in' | 'zoom-out';\n\nexport type ControlProps = {\n  class?: string;\n  onAction?: (action: ControlAction) => void;\n};\n\nexport const controlPositions: Record<ControlPosition, string> = {\n  topleft: 'top-2 left-2',\n  topright: 'top-2 right-2',\n  bottomleft: 'bottom-2 left-2',\n  bottomright: 'bottom-2 right-2',\n};\n\nexport const ZoomControls = (props: ControlProps): JSX.Element => {\n  return (\n    <div class={`flex flex-row gap-2 ${props.class ?? ''}`}>\n      <button\n        type='button'\n        class='dx-control dx-button dx-button-square dx-focus-ring'\n        data-size='lg'\n        onClick={() => props.onAction?.('zoom-in')}\n        title='Zoom in'\n      >\n        <span class='text-xl'>+</span>\n      </button>\n      <button\n        type='button'\n        class='dx-control dx-button dx-button-square dx-focus-ring'\n        data-size='lg'\n        onClick={() => props.onAction?.('zoom-out')}\n        title='Zoom out'\n      >\n        <span class='text-xl'>−</span>\n      </button>\n    </div>\n  );\n};\n\nexport const ActionControls = (props: ControlProps): JSX.Element => {\n  return (\n    <div class={`flex flex-row gap-2 ${props.class ?? ''}`}>\n      <button\n        type='button'\n        class='dx-control dx-button dx-button-square dx-focus-ring'\n        data-size='lg'\n        onClick={() => props.onAction?.('start')}\n        title='Start'\n      >\n        <span class='text-xl'>▶</span>\n      </button>\n      <button\n        type='button'\n        class='dx-control dx-button dx-button-square dx-focus-ring'\n        data-size='lg'\n        onClick={() => props.onAction?.('toggle')}\n        title='Toggle'\n      >\n        <span class='text-xl'>🌍</span>\n      </button>\n    </div>\n  );\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { createResizeObserver } from '@solid-primitives/resize-observer';\nimport {\n  type GeoProjection,\n  easeLinear,\n  easeSinOut,\n  geoMercator,\n  geoOrthographic,\n  geoPath,\n  geoTransverseMercator,\n  interpolateNumber,\n  transition,\n} from 'd3';\nimport { type ControlPosition } from 'leaflet';\nimport { type Accessor, type JSX, type Setter, Show, createEffect, createMemo, createSignal } from 'solid-js';\nimport { type Topology } from 'topojson-specification';\n\nimport { mx } from '@dxos/ui-theme';\n\nimport { GlobeContextProvider, type GlobeContextProviderProps, useGlobeContext } from '../../hooks/index.ts';\nimport {\n  type Features,\n  type StyleSet,\n  createLayers,\n  geoToPosition,\n  positionToRotation,\n  renderLayers,\n  timer,\n} from '../../util/index.ts';\nimport { ActionControls, type ControlProps, ZoomControls, controlPositions } from '../Toolbar/index.ts';\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute\n */\nconst defaultStyles: Record<string, StyleSet> = {\n  light: {\n    background: {\n      fillStyle: '#EEE',\n    },\n\n    water: {\n      fillStyle: '#555',\n    },\n\n    land: {\n      fillStyle: '#999',\n    },\n\n    line: {\n      strokeStyle: 'darkred',\n    },\n\n    point: {\n      fillStyle: '#111111',\n      strokeStyle: '#111111',\n      strokeWidth: 1,\n      pointRadius: 0.5,\n    },\n  },\n  dark: {\n    background: {\n      fillStyle: '#111111',\n    },\n\n    water: {\n      fillStyle: '#123E6A',\n    },\n\n    land: {\n      fillStyle: '#032153',\n    },\n\n    line: {\n      strokeStyle: '#111111',\n    },\n\n    point: {\n      fillStyle: '#111111',\n      strokeStyle: '#111111',\n      strokeWidth: 1,\n      pointRadius: 0.5,\n    },\n  },\n};\n\nexport type GlobeController = {\n  canvas: HTMLCanvasElement;\n  projection: GeoProjection;\n  zoom: number;\n  translation: Accessor<{ x: number; y: number } | undefined>;\n  rotation: Accessor<[number, number, number] | undefined>;\n  setZoom: (zoom: number | ((prev: number) => number)) => void;\n  setTranslation: Setter<{ x: number; y: number } | undefined>;\n  setRotation: (rotation: [number, number, number]) => void;\n};\n\nexport type ProjectionType = 'orthographic' | 'mercator' | 'transverse-mercator';\n\nconst projectionMap: Record<ProjectionType, () => GeoProjection> = {\n  'orthographic': geoOrthographic,\n  'mercator': geoMercator,\n  'transverse-mercator': geoTransverseMercator,\n};\n\nconst getProjection = (type: GlobeCanvasProps['projection'] = 'orthographic'): GeoProjection => {\n  if (typeof type === 'string') {\n    const constructor = projectionMap[type] ?? geoOrthographic;\n    return constructor();\n  }\n\n  return type ?? geoOrthographic();\n};\n\n//\n// Root\n//\n\ntype GlobeRootProps = {\n  children: JSX.Element;\n  class?: string;\n} & Partial<GlobeContextProviderProps> &\n  JSX.HTMLAttributes<HTMLDivElement>;\n\nconst GlobeRoot = (props: GlobeRootProps) => {\n  let containerRef: HTMLDivElement | undefined;\n  const [size, setSize] = createSignal({ width: 0, height: 0 });\n\n  // Use @solid-primitives/resize-observer\n  createResizeObserver(\n    () => containerRef,\n    ({ width, height }) => {\n      setSize({ width, height });\n    },\n  );\n\n  return (\n    <GlobeContextProvider size={size()} {...props}>\n      <div ref={containerRef} class={mx('relative dx-expand overflow-hidden')} {...props}>\n        {props.children}\n      </div>\n    </GlobeContextProvider>\n  );\n};\n\n//\n// Canvas\n//\n\ntype GlobeCanvasProps = {\n  ref?: (controller: GlobeController) => void;\n  projection?: ProjectionType | GeoProjection;\n  topology?: Topology;\n  features?: Features;\n  styles?: StyleSet;\n};\n\n/**\n * Basic globe renderer.\n * https://github.com/topojson/world-atlas\n */\n\nconst GlobeCanvas = (props: GlobeCanvasProps) => {\n  const themeMode = 'dark'; // TODO: Get from theme context\n  const styles = createMemo(() => props.styles ?? defaultStyles[themeMode]);\n\n  // Canvas.\n  const [canvas, setCanvas] = createSignal<HTMLCanvasElement | null>(null);\n\n  // Projection.\n  const projection = createMemo(() => getProjection(props.projection));\n\n  // Layers.\n  const layers = createMemo(() => {\n    return timer(() => createLayers(props.topology as Topology, props.features, styles()));\n  });\n\n  // State.\n  const { size, center, zoom, translation, rotation, setCenter, setZoom, setTranslation, setRotation } =\n    useGlobeContext();\n\n  let zoomValue = zoom();\n  let zooming = false;\n\n  createEffect(() => {});\n\n  // Update rotation.\n  createEffect(() => {\n    const c = center();\n    if (c) {\n      setZoom(1);\n      setRotation(positionToRotation(geoToPosition(c)));\n    }\n  });\n\n  // External controller.\n  createEffect(() => {\n    const canvasEl = canvas();\n    if (canvasEl && props.ref) {\n      const controller: GlobeController = {\n        canvas: canvasEl,\n        projection: projection(),\n        get zoom() {\n          return zoomValue;\n        },\n        translation,\n        rotation,\n        setZoom: (state) => {\n          if (typeof state === 'function') {\n            const is = interpolateNumber(zoomValue, state(zoomValue));\n            // Stop easing if already zooming.\n            transition()\n              .ease(zooming ? easeLinear : easeSinOut)\n              .duration(200)\n              .tween('scale', () => (t) => {\n                const newZoom = is(t);\n                zoomValue = newZoom;\n                setZoom(newZoom);\n              })\n              .on('end', () => {\n                zooming = false;\n              });\n          } else {\n            zoomValue = state;\n            setZoom(state);\n          }\n        },\n        setTranslation,\n        setRotation,\n      };\n      props.ref(controller);\n    }\n  });\n\n  // https://d3js.org/d3-geo/path#geoPath\n  // https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n  const generator = createMemo(() => {\n    const canvasEl = canvas();\n    const proj = projection();\n    return canvasEl && proj && geoPath(proj, canvasEl.getContext('2d', { alpha: false }));\n  });\n\n  // Render on change.\n  createEffect(() => {\n    const canvasEl = canvas();\n    const proj = projection();\n    const gen = generator();\n    const z = zoom();\n    const t = translation();\n    const r = rotation();\n    const s = size();\n\n    if (canvasEl && proj && gen) {\n      timer(() => {\n        // https://d3js.org/d3-geo/projection\n        proj\n          .scale((Math.min(s.width, s.height) / 2) * z)\n          .translate([s.width / 2 + (t?.x ?? 0), s.height / 2 + (t?.y ?? 0)])\n          .rotate(r ?? [0, 0, 0]);\n\n        renderLayers(gen, layers(), z, styles());\n      });\n    }\n  });\n\n  return (\n    <Show when={size().width > 0 && size().height > 0}>\n      <canvas ref={setCanvas} width={size().width} height={size().height} />\n    </Show>\n  );\n};\n\n//\n// Debug\n//\n\nconst GlobeDebug = (props: { position?: ControlPosition }) => {\n  const { size, zoom, translation, rotation } = useGlobeContext();\n  return (\n    <div\n      class={`z-10 absolute w-96 p-2 overflow-hidden border border-green-700 rounded-sm ${\n        controlPositions[props.position ?? 'topleft']\n      }`}\n    >\n      <pre class='font-mono text-xs text-green-700'>\n        {JSON.stringify({ size, zoom: zoom(), translation: translation(), rotation: rotation() }, null, 2)}\n      </pre>\n    </div>\n  );\n};\n\n//\n// Panel\n//\n\nconst GlobePanel = (props: { children: JSX.Element; position?: ControlPosition; class?: string }) => {\n  return (\n    <div class={`z-10 absolute overflow-hidden ${controlPositions[props.position ?? 'topleft']} ${props.class ?? ''}`}>\n      {props.children}\n    </div>\n  );\n};\n\n//\n// Controls\n//\n\nconst CustomControl = (props: { children: JSX.Element; position: ControlPosition }) => {\n  return <div class={`z-10 absolute overflow-hidden ${controlPositions[props.position]}`}>{props.children}</div>;\n};\n\ntype GlobeControlProps = { position?: ControlPosition } & Pick<ControlProps, 'onAction'>;\n\nconst GlobeZoom = (props: GlobeControlProps) => (\n  <CustomControl position={props.position ?? 'bottomleft'}>\n    <ZoomControls onAction={props.onAction} />\n  </CustomControl>\n);\n\nconst GlobeAction = (props: GlobeControlProps) => (\n  <CustomControl position={props.position ?? 'bottomright'}>\n    <ActionControls onAction={props.onAction} />\n  </CustomControl>\n);\n\n//\n// Globe\n//\n\nexport const Globe = {\n  Root: GlobeRoot,\n  Canvas: GlobeCanvas,\n  Zoom: GlobeZoom,\n  Action: GlobeAction,\n  Debug: GlobeDebug,\n  Panel: GlobePanel,\n};\n\nexport type { GlobeCanvasProps, GlobeRootProps };\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport 'leaflet/dist/leaflet.css';\n\nimport L, { type ControlPosition, type LatLngLiteral, latLngBounds } from 'leaflet';\nimport {\n  type Accessor,\n  type JSX,\n  type Setter,\n  Show,\n  createContext,\n  createEffect,\n  createSignal,\n  onCleanup,\n  onMount,\n  useContext,\n} from 'solid-js';\n\nimport { type GeoMarker } from '../../types.ts';\nimport { ActionControls, type ControlProps, ZoomControls, controlPositions } from '../Toolbar/index.ts';\n\n// TODO(burdon): Guess initial location.\n\nconst defaults = {\n  center: { lat: 51, lng: 0 } as L.LatLngLiteral,\n  zoom: 4,\n} as const;\n\n//\n// Controller\n//\n\nexport type MapController = {\n  setCenter: (center: LatLngLiteral, zoom?: number) => void;\n  setZoom: (cb: (zoom: number) => number) => void;\n};\n\n//\n// Context\n//\n\ntype MapContextValue = {\n  map: Accessor<L.Map | null>;\n  attention: Accessor<boolean>;\n  setAttention: Setter<boolean>;\n  onChange?: (ev: { center: LatLngLiteral; zoom: number }) => void;\n};\n\nconst MapContext = createContext<MapContextValue>();\n\nconst useMapContext = (displayName: string) => {\n  const context = useContext(MapContext);\n  if (!context) {\n    throw new Error(`${displayName} must be used within Map.Root`);\n  }\n\n  return context;\n};\n\n//\n// Root\n//\n\ntype MapRootProps = {\n  ref?: (controller: MapController) => void;\n  children: JSX.Element;\n  class?: string;\n  scrollWheelZoom?: boolean;\n  doubleClickZoom?: boolean;\n  touchZoom?: boolean;\n  center?: LatLngLiteral;\n  zoom?: number;\n  onChange?: (ev: { center: LatLngLiteral; zoom: number }) => void;\n};\n\n/**\n * https://leafletjs.com/reference.html#map\n */\n\nconst MapRoot = (props: MapRootProps) => {\n  let mapContainer: HTMLDivElement | undefined;\n  const [map, setMap] = createSignal<L.Map | null>(null);\n  const [attention, setAttention] = createSignal(false);\n\n  onMount(() => {\n    if (!mapContainer) {\n      return;\n    }\n\n    const leafletMap = L.map(mapContainer, {\n      center: props.center ?? defaults.center,\n      zoom: props.zoom ?? defaults.zoom,\n      attributionControl: false,\n      zoomControl: false,\n      scrollWheelZoom: props.scrollWheelZoom ?? true,\n      doubleClickZoom: props.doubleClickZoom ?? true,\n      touchZoom: props.touchZoom ?? true,\n    });\n\n    setMap(leafletMap);\n\n    // Set up controller\n    if (props.ref) {\n      props.ref({\n        setCenter: (center: LatLngLiteral, zoom?: number) => {\n          leafletMap.setView(center, zoom);\n        },\n        setZoom: (cb: (zoom: number) => number) => {\n          leafletMap.setZoom(cb(leafletMap.getZoom()));\n        },\n      });\n    }\n\n    onCleanup(() => {\n      leafletMap.remove();\n    });\n  });\n\n  // Enable/disable scroll wheel zoom based on attention\n  createEffect(() => {\n    const leafletMap = map();\n    if (!leafletMap) {\n      return;\n    }\n\n    if (attention()) {\n      leafletMap.scrollWheelZoom.enable();\n    } else {\n      leafletMap.scrollWheelZoom.disable();\n    }\n  });\n\n  return (\n    <MapContext.Provider value={{ map, attention, setAttention, onChange: props.onChange }}>\n      <div\n        ref={mapContainer}\n        class={`group relative grid h-full w-full bg-gray-100 dark:bg-gray-900 ${props.class ?? ''}`}\n        style={{ 'z-index': '0' }}\n      />\n      <Show when={map()}>{props.children}</Show>\n    </MapContext.Provider>\n  );\n};\n\n//\n// Tiles\n//\n\nconst MapTiles = () => {\n  const { map, onChange, attention } = useMapContext(MapTiles.name);\n  let tileLayer: L.TileLayer | null = null;\n\n  createEffect(() => {\n    const leafletMap = map();\n    if (!leafletMap) {\n      return;\n    }\n\n    const att = attention();\n    tileLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n      detectRetina: true,\n      keepBuffer: 4,\n      className: `dark:grayscale dark:invert ${att ? '' : 'opacity-80'}`,\n    });\n\n    tileLayer.addTo(leafletMap);\n\n    // Set up event listeners\n    leafletMap.on('zoomstart', (ev) => {\n      onChange?.({\n        center: ev.target.getCenter(),\n        zoom: ev.target.getZoom(),\n      });\n    });\n\n    onCleanup(() => {\n      if (tileLayer) {\n        tileLayer.remove();\n        tileLayer = null;\n      }\n    });\n  });\n\n  // Update tile layer class when attention changes\n  createEffect(() => {\n    const att = attention();\n    if (tileLayer) {\n      const container = tileLayer.getContainer();\n      if (container) {\n        container.className = `dark:grayscale dark:invert ${att ? '' : 'opacity-80'}`;\n      }\n    }\n  });\n\n  return null;\n};\n\n//\n// Markers\n//\n\ntype MapMarkersProps = {\n  markers?: Accessor<GeoMarker[]>;\n};\n\nconst MapMarkers = (props: MapMarkersProps) => {\n  const { map } = useMapContext(MapMarkers.name);\n  const leafletMarkers: L.Marker[] = [];\n  let lastMarkerIds = new Set<string>();\n\n  // Clean up all markers when component unmounts\n  onCleanup(() => {\n    leafletMarkers.forEach((marker) => marker.remove());\n    leafletMarkers.length = 0;\n  });\n\n  createEffect(() => {\n    const leafletMap = map();\n    if (!leafletMap) {\n      return;\n    }\n\n    const markerList = props.markers?.() ?? [];\n    const currentIds = new Set(markerList.map((m) => m.id));\n\n    // Skip if the markers haven't actually changed\n    if (\n      currentIds.size === lastMarkerIds.size &&\n      [...currentIds].every((id) => lastMarkerIds.has(id)) &&\n      leafletMarkers.length > 0\n    ) {\n      return;\n    }\n\n    // Clear existing markers\n    leafletMarkers.forEach((marker) => marker.remove());\n    leafletMarkers.length = 0;\n    lastMarkerIds = currentIds;\n\n    if (markerList.length > 0) {\n      const bounds = latLngBounds(markerList.map((marker) => marker.location));\n      leafletMap.fitBounds(bounds);\n\n      // Add new markers\n      markerList.forEach(({ title, location }) => {\n        const marker = L.marker(location, {\n          icon: new L.Icon({\n            iconUrl: 'https://media.dxos.network/marker-icon.png',\n            iconRetinaUrl: 'https://media.dxos.network/marker-icon-2x.png',\n            shadowUrl: 'https://media.dxos.network/marker-shadow.png',\n            iconSize: [25, 41],\n            iconAnchor: [12, 41],\n            popupAnchor: [1, -34],\n            shadowSize: [41, 41],\n          }),\n        });\n\n        if (title) {\n          marker.bindPopup(title);\n        }\n\n        marker.addTo(leafletMap);\n        leafletMarkers.push(marker);\n      });\n    } else {\n      leafletMap.setView(defaults.center, defaults.zoom);\n    }\n  });\n\n  return null;\n};\n\n//\n// Controls\n//\n\nconst CustomControl = (props: { children: JSX.Element; position: ControlPosition }) => {\n  const { map: mapAccessor } = useMapContext(CustomControl.name);\n  let controlContainer: HTMLDivElement | undefined;\n\n  createEffect(() => {\n    const map = mapAccessor();\n    if (!map || !controlContainer) {\n      return;\n    }\n\n    const Control = L.Control.extend({\n      onAdd: () => {\n        const container = L.DomUtil.create('div', `${controlPositions[props.position]} m-0!`);\n        L.DomEvent.disableClickPropagation(container);\n        L.DomEvent.disableScrollPropagation(container);\n\n        if (controlContainer) {\n          container.appendChild(controlContainer);\n        }\n\n        return container;\n      },\n    });\n\n    const control = new Control({ position: props.position });\n    control.addTo(map);\n\n    onCleanup(() => {\n      control.remove();\n    });\n  });\n\n  return (\n    <div ref={controlContainer} style={{ display: 'contents' }}>\n      {props.children}\n    </div>\n  );\n};\n\ntype MapControlProps = { position?: ControlPosition } & Pick<ControlProps, 'onAction'>;\n\nconst MapZoom = (props: MapControlProps) => (\n  <CustomControl position={props.position ?? 'bottomleft'}>\n    <ZoomControls onAction={props.onAction} />\n  </CustomControl>\n);\n\nconst MapAction = (props: MapControlProps) => (\n  <CustomControl position={props.position ?? 'bottomright'}>\n    <ActionControls onAction={props.onAction} />\n  </CustomControl>\n);\n\n//\n// Map\n//\n\nexport const Map = {\n  Root: MapRoot,\n  Tiles: MapTiles,\n  Markers: MapMarkers,\n  Zoom: MapZoom,\n  Action: MapAction,\n};\n\nexport { type MapControlProps, type MapMarkersProps, type MapRootProps };\n"],"mappings":";;;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