Add progressive web app companion for cross-platform access

Vite + TypeScript PWA that mirrors the Android app's core features:
- Pre-processed shelter data (build-time UTM33N→WGS84 conversion)
- Leaflet map with shelter markers, user location, and offline tiles
- Canvas compass arrow (ported from DirectionArrowView.kt)
- IndexedDB shelter cache with 7-day staleness check
- Service worker with CacheFirst tiles and precached app shell
- i18n for en, nb, nn (ported from Android strings.xml)
- iOS/Android compass handling with low-pass filter
- Respects user map interaction (no auto-snap on pan/zoom)
- Build revision cache-breaker for reliable SW updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2026-03-08 17:41:38 +01:00
commit e8428de775
12051 changed files with 1799735 additions and 0 deletions

19
pwa/node_modules/check-error/LICENSE generated vendored Normal file
View file

@ -0,0 +1,19 @@
Copyright (c) 2013 Jake Luer <jake@alogicalparadox.com> (http://alogicalparadox.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

144
pwa/node_modules/check-error/README.md generated vendored Normal file
View file

@ -0,0 +1,144 @@
<h1 align=center>
<a href="http://chaijs.com" title="Chai Documentation">
<img alt="ChaiJS" src="http://chaijs.com/img/chai-logo.png">
</a>
<br>
check-error
</h1>
<p align=center>
Error comparison and information related utility for <a href="http://nodejs.org">node</a> and the browser.
</p>
## What is Check-Error?
Check-Error is a module which you can use to retrieve an Error's information such as its `message` or `constructor` name and also to check whether two Errors are compatible based on their messages, constructors or even instances.
## Installation
### Node.js
`check-error` is available on [npm](http://npmjs.org). To install it, type:
$ npm install check-error
### Browsers
You can also use it within the browser; install via npm and use the `check-error.js` file found within the download. For example:
```html
<script src="./node_modules/check-error/check-error.js"></script>
```
## Usage
The primary export of `check-error` is an object which has the following methods:
* `compatibleInstance(err, errorLike)` - Checks if an error is compatible with another `errorLike` object. If `errorLike` is an error instance we do a strict comparison, otherwise we return `false` by default, because instances of objects can only be compatible if they're both error instances.
* `compatibleConstructor(err, errorLike)` - Checks if an error's constructor is compatible with another `errorLike` object. If `err` has the same constructor as `errorLike` or if `err` is an instance of `errorLike`.
* `compatibleMessage(err, errMatcher)` - Checks if an error message is compatible with an `errMatcher` RegExp or String (we check if the message contains the String).
* `getConstructorName(errorLike)` - Retrieves the name of a constructor, an error's constructor or `errorLike` itself if it's not an error instance or constructor.
* `getMessage(err)` - Retrieves the message of an error or `err` itself if it's a String. If `err` or `err.message` is undefined we return an empty String.
```js
import * as checkError 'check-error';
```
#### .compatibleInstance(err, errorLike)
```js
import * as checkError 'check-error';
const funcThatThrows = function() { throw new TypeError('I am a TypeError') };
let caughtErr;
try {
funcThatThrows();
} catch(e) {
caughtErr = e;
}
const sameInstance = caughtErr;
checkError.compatibleInstance(caughtErr, sameInstance); // true
checkError.compatibleInstance(caughtErr, new TypeError('Another error')); // false
```
#### .compatibleConstructor(err, errorLike)
```js
import * as checkError 'check-error';
const funcThatThrows = function() { throw new TypeError('I am a TypeError') };
let caughtErr;
try {
funcThatThrows();
} catch(e) {
caughtErr = e;
}
checkError.compatibleConstructor(caughtErr, Error); // true
checkError.compatibleConstructor(caughtErr, TypeError); // true
checkError.compatibleConstructor(caughtErr, RangeError); // false
```
#### .compatibleMessage(err, errMatcher)
```js
import * as checkError 'check-error';
const funcThatThrows = function() { throw new TypeError('I am a TypeError') };
let caughtErr;
try {
funcThatThrows();
} catch(e) {
caughtErr = e;
}
const sameInstance = caughtErr;
checkError.compatibleMessage(caughtErr, /TypeError$/); // true
checkError.compatibleMessage(caughtErr, 'I am a'); // true
checkError.compatibleMessage(caughtErr, /unicorn/); // false
checkError.compatibleMessage(caughtErr, 'I do not exist'); // false
```
#### .getConstructorName(errorLike)
```js
import * as checkError 'check-error';
const funcThatThrows = function() { throw new TypeError('I am a TypeError') };
let caughtErr;
try {
funcThatThrows();
} catch(e) {
caughtErr = e;
}
const sameInstance = caughtErr;
checkError.getConstructorName(caughtErr) // 'TypeError'
```
#### .getMessage(err)
```js
import * as checkError 'check-error';
const funcThatThrows = function() { throw new TypeError('I am a TypeError') };
let caughtErr;
try {
funcThatThrows();
} catch(e) {
caughtErr = e;
}
const sameInstance = caughtErr;
checkError.getMessage(caughtErr) // 'I am a TypeError'
```

136
pwa/node_modules/check-error/index.js generated vendored Normal file
View file

@ -0,0 +1,136 @@
function isErrorInstance(obj) {
return obj instanceof Error || Object.prototype.toString.call(obj) === '[object Error]';
}
function isRegExp(obj) {
return Object.prototype.toString.call(obj) === '[object RegExp]';
}
/**
* ### .compatibleInstance(thrown, errorLike)
*
* Checks if two instances are compatible (strict equal).
* Returns false if errorLike is not an instance of Error, because instances
* can only be compatible if they're both error instances.
*
* @name compatibleInstance
* @param {Error} thrown error
* @param {Error|ErrorConstructor} errorLike object to compare against
* @namespace Utils
* @api public
*/
function compatibleInstance(thrown, errorLike) {
return isErrorInstance(errorLike) && thrown === errorLike;
}
/**
* ### .compatibleConstructor(thrown, errorLike)
*
* Checks if two constructors are compatible.
* This function can receive either an error constructor or
* an error instance as the `errorLike` argument.
* Constructors are compatible if they're the same or if one is
* an instance of another.
*
* @name compatibleConstructor
* @param {Error} thrown error
* @param {Error|ErrorConstructor} errorLike object to compare against
* @namespace Utils
* @api public
*/
function compatibleConstructor(thrown, errorLike) {
if (isErrorInstance(errorLike)) {
// If `errorLike` is an instance of any error we compare their constructors
return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor;
} else if ((typeof errorLike === 'object' || typeof errorLike === 'function') && errorLike.prototype) {
// If `errorLike` is a constructor that inherits from Error, we compare `thrown` to `errorLike` directly
return thrown.constructor === errorLike || thrown instanceof errorLike;
}
return false;
}
/**
* ### .compatibleMessage(thrown, errMatcher)
*
* Checks if an error's message is compatible with a matcher (String or RegExp).
* If the message contains the String or passes the RegExp test,
* it is considered compatible.
*
* @name compatibleMessage
* @param {Error} thrown error
* @param {String|RegExp} errMatcher to look for into the message
* @namespace Utils
* @api public
*/
function compatibleMessage(thrown, errMatcher) {
const comparisonString = typeof thrown === 'string' ? thrown : thrown.message;
if (comparisonString === undefined) {
return false;
}
if (isRegExp(errMatcher)) {
return errMatcher.test(comparisonString);
} else if (typeof errMatcher === 'string') {
return comparisonString.indexOf(errMatcher) !== -1;
}
return false;
}
/**
* ### .getConstructorName(errorLike)
*
* Gets the constructor name for an Error instance or constructor itself.
*
* @name getConstructorName
* @param {Error|ErrorConstructor} errorLike
* @namespace Utils
* @api public
*/
function getConstructorName(errorLike) {
let constructorName = errorLike;
if (isErrorInstance(errorLike)) {
constructorName = errorLike.constructor.name;
} else if (typeof errorLike === 'function') {
// If `err` is not an instance of Error it is an error constructor itself or another function.
// If we've got a common function we get its name, otherwise we may need to create a new instance
// of the error just in case it's a poorly-constructed error. Please see chaijs/chai/issues/45 to know more.
constructorName = errorLike.name;
if (constructorName === '') {
const newConstructorName = (new errorLike().name);
constructorName = newConstructorName || constructorName;
}
}
return constructorName;
}
/**
* ### .getMessage(errorLike)
*
* Gets the error message from an error.
* If `err` is a String itself, we return it.
* If the error has no message, we return an empty string.
*
* @name getMessage
* @param {Error|String} errorLike
* @namespace Utils
* @api public
*/
function getMessage(errorLike) {
let msg = '';
if (errorLike && errorLike.message) {
msg = errorLike.message;
} else if (typeof errorLike === 'string') {
msg = errorLike;
}
return msg;
}
export { compatibleInstance, compatibleConstructor, compatibleMessage, getMessage, getConstructorName };

46
pwa/node_modules/check-error/package.json generated vendored Normal file
View file

@ -0,0 +1,46 @@
{
"name": "check-error",
"description": "Error comparison and information related utility for node and the browser",
"keywords": [
"check-error",
"error",
"chai util"
],
"license": "MIT",
"author": "Jake Luer <jake@alogicalparadox.com> (http://alogicalparadox.com)",
"contributors": [
"David Losert (https://github.com/davelosert)",
"Keith Cirkel (https://github.com/keithamus)",
"Miroslav Bajtoš (https://github.com/bajtos)",
"Lucas Fernandes da Costa (https://github.com/lucasfcosta)"
],
"files": [
"index.js",
"check-error.js"
],
"type": "module",
"main": "./index.js",
"module": "./index.js",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/chaijs/check-error.git"
},
"scripts": {
"lint": "eslint index.js test/",
"pretest": "npm run lint",
"test": "npm run test:node && npm run test:browser",
"test:browser": "web-test-runner",
"test:node": "mocha"
},
"devDependencies": {
"@eslint/js": "^9.31.0",
"@web/test-runner": "^0.20.2",
"eslint": "^9.31.0",
"mocha": "^11.7.1",
"simple-assert": "^2.0.0"
},
"engines": {
"node": ">= 16"
},
"version": "2.1.3"
}