ambient-display 1.1.0 → 1.1.2

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.
Files changed (162) hide show
  1. package/build/client/_app/immutable/assets/0.Dl9__I4E.css +1 -0
  2. package/build/client/_app/immutable/assets/0.Dl9__I4E.css.br +0 -0
  3. package/build/client/_app/immutable/assets/0.Dl9__I4E.css.gz +0 -0
  4. package/build/client/_app/immutable/assets/2.BtzFOBtk.css +1 -0
  5. package/build/client/_app/immutable/assets/2.BtzFOBtk.css.br +0 -0
  6. package/build/client/_app/immutable/assets/2.BtzFOBtk.css.gz +0 -0
  7. package/build/client/_app/immutable/assets/3.BvcZlbFP.css +1 -0
  8. package/build/client/_app/immutable/assets/3.BvcZlbFP.css.br +0 -0
  9. package/build/client/_app/immutable/assets/3.BvcZlbFP.css.gz +0 -0
  10. package/build/client/_app/immutable/assets/LoadingIndicator.D0m6rSKQ.css +1 -0
  11. package/build/client/_app/immutable/assets/LoadingIndicator.D0m6rSKQ.css.br +0 -0
  12. package/build/client/_app/immutable/assets/LoadingIndicator.D0m6rSKQ.css.gz +0 -0
  13. package/build/client/_app/immutable/assets/PlayingTracker.9uM5nyWg.css +1 -0
  14. package/build/client/_app/immutable/assets/PlayingTracker.9uM5nyWg.css.br +0 -0
  15. package/build/client/_app/immutable/assets/PlayingTracker.9uM5nyWg.css.gz +0 -0
  16. package/build/client/_app/immutable/assets/_layout.Dl9__I4E.css +1 -0
  17. package/build/client/_app/immutable/assets/_layout.Dl9__I4E.css.br +0 -0
  18. package/build/client/_app/immutable/assets/_layout.Dl9__I4E.css.gz +0 -0
  19. package/build/client/_app/immutable/assets/_page.BtzFOBtk.css +1 -0
  20. package/build/client/_app/immutable/assets/_page.BtzFOBtk.css.br +0 -0
  21. package/build/client/_app/immutable/assets/_page.BtzFOBtk.css.gz +0 -0
  22. package/build/client/_app/immutable/assets/_page.BvcZlbFP.css +1 -0
  23. package/build/client/_app/immutable/assets/_page.BvcZlbFP.css.br +0 -0
  24. package/build/client/_app/immutable/assets/_page.BvcZlbFP.css.gz +0 -0
  25. package/build/client/_app/immutable/chunks/LoadingIndicator.COVTk436.js +1 -0
  26. package/build/client/_app/immutable/chunks/LoadingIndicator.COVTk436.js.br +0 -0
  27. package/build/client/_app/immutable/chunks/LoadingIndicator.COVTk436.js.gz +0 -0
  28. package/build/client/_app/immutable/chunks/PlayingTracker.Cymhk9j5.js +5 -0
  29. package/build/client/_app/immutable/chunks/PlayingTracker.Cymhk9j5.js.br +0 -0
  30. package/build/client/_app/immutable/chunks/PlayingTracker.Cymhk9j5.js.gz +0 -0
  31. package/build/client/_app/immutable/chunks/disclose-version.N57b1q78.js +1 -0
  32. package/build/client/_app/immutable/chunks/disclose-version.N57b1q78.js.br +0 -0
  33. package/build/client/_app/immutable/chunks/disclose-version.N57b1q78.js.gz +0 -0
  34. package/build/client/_app/immutable/chunks/entry.CTcSu7Oh.js +3 -0
  35. package/build/client/_app/immutable/chunks/entry.CTcSu7Oh.js.br +0 -0
  36. package/build/client/_app/immutable/chunks/entry.CTcSu7Oh.js.gz +0 -0
  37. package/build/client/_app/immutable/chunks/index-client.DV07uIiZ.js +1 -0
  38. package/build/client/_app/immutable/chunks/index-client.DV07uIiZ.js.br +0 -0
  39. package/build/client/_app/immutable/chunks/index-client.DV07uIiZ.js.gz +0 -0
  40. package/build/client/_app/immutable/chunks/index.DFULH2AN.js +1 -0
  41. package/build/client/_app/immutable/chunks/index.DFULH2AN.js.br +0 -0
  42. package/build/client/_app/immutable/chunks/index.DFULH2AN.js.gz +0 -0
  43. package/build/client/_app/immutable/chunks/index.DLR8Bvs6.js +4 -0
  44. package/build/client/_app/immutable/chunks/index.DLR8Bvs6.js.br +0 -0
  45. package/build/client/_app/immutable/chunks/index.DLR8Bvs6.js.gz +0 -0
  46. package/build/client/_app/immutable/chunks/legacy.DZgMwYuQ.js +1 -0
  47. package/build/client/_app/immutable/chunks/legacy.DZgMwYuQ.js.br +0 -0
  48. package/build/client/_app/immutable/chunks/legacy.DZgMwYuQ.js.gz +0 -0
  49. package/build/client/_app/immutable/chunks/props.DYfFZGja.js +1 -0
  50. package/build/client/_app/immutable/chunks/props.DYfFZGja.js.br +0 -0
  51. package/build/client/_app/immutable/chunks/props.DYfFZGja.js.gz +0 -0
  52. package/build/client/_app/immutable/chunks/snippet.BVSCguOu.js +1 -0
  53. package/build/client/_app/immutable/chunks/snippet.BVSCguOu.js.br +0 -0
  54. package/build/client/_app/immutable/chunks/snippet.BVSCguOu.js.gz +0 -0
  55. package/build/client/_app/immutable/chunks/this.EZLWgc5v.js +1 -0
  56. package/build/client/_app/immutable/chunks/this.EZLWgc5v.js.br +0 -0
  57. package/build/client/_app/immutable/chunks/this.EZLWgc5v.js.gz +0 -0
  58. package/build/client/_app/immutable/chunks/utils.BXcQV2KO.js +1 -0
  59. package/build/client/_app/immutable/chunks/utils.BXcQV2KO.js.br +0 -0
  60. package/build/client/_app/immutable/chunks/utils.BXcQV2KO.js.gz +0 -0
  61. package/build/client/_app/immutable/entry/app.DHMJZPqS.js +2 -0
  62. package/build/client/_app/immutable/entry/app.DHMJZPqS.js.br +0 -0
  63. package/build/client/_app/immutable/entry/app.DHMJZPqS.js.gz +0 -0
  64. package/build/client/_app/immutable/entry/start.BGJKS9mR.js +1 -0
  65. package/build/client/_app/immutable/entry/start.BGJKS9mR.js.br +2 -0
  66. package/build/client/_app/immutable/entry/start.BGJKS9mR.js.gz +0 -0
  67. package/build/client/_app/immutable/nodes/0.DaJoi3FK.js +2 -0
  68. package/build/client/_app/immutable/nodes/0.DaJoi3FK.js.br +0 -0
  69. package/build/client/_app/immutable/nodes/0.DaJoi3FK.js.gz +0 -0
  70. package/build/client/_app/immutable/nodes/1.0EwG4xPT.js +1 -0
  71. package/build/client/_app/immutable/nodes/1.0EwG4xPT.js.br +0 -0
  72. package/build/client/_app/immutable/nodes/1.0EwG4xPT.js.gz +0 -0
  73. package/build/client/_app/immutable/nodes/2.CIcrK0Mf.js +1 -0
  74. package/build/client/_app/immutable/nodes/2.CIcrK0Mf.js.br +0 -0
  75. package/build/client/_app/immutable/nodes/2.CIcrK0Mf.js.gz +0 -0
  76. package/build/client/_app/immutable/nodes/3.vzk8SJSG.js +1 -0
  77. package/build/client/_app/immutable/nodes/3.vzk8SJSG.js.br +0 -0
  78. package/build/client/_app/immutable/nodes/3.vzk8SJSG.js.gz +0 -0
  79. package/build/client/_app/version.json +1 -0
  80. package/build/client/_app/version.json.br +0 -0
  81. package/build/client/_app/version.json.gz +0 -0
  82. package/build/client/manifest.json.br +0 -0
  83. package/build/client/manifest.json.gz +0 -0
  84. package/build/env.js +45 -0
  85. package/build/handler.js +1375 -0
  86. package/build/index.js +334 -0
  87. package/build/server/chunks/0-D_yciAvo.js +91 -0
  88. package/build/server/chunks/0-D_yciAvo.js.map +1 -0
  89. package/build/server/chunks/1-BA-qTHOy.js +9 -0
  90. package/build/server/chunks/1-BA-qTHOy.js.map +1 -0
  91. package/build/server/chunks/2-DPsIhdeI.js +9 -0
  92. package/build/server/chunks/2-DPsIhdeI.js.map +1 -0
  93. package/build/server/chunks/3-CZREXwZu.js +9 -0
  94. package/build/server/chunks/3-CZREXwZu.js.map +1 -0
  95. package/build/server/chunks/LoadingIndicator-CTUFEPkL.js +10 -0
  96. package/build/server/chunks/LoadingIndicator-CTUFEPkL.js.map +1 -0
  97. package/build/server/chunks/LoadingIndicator.svelte_svelte_type_style_lang-CVdBHA1v.js +172 -0
  98. package/build/server/chunks/LoadingIndicator.svelte_svelte_type_style_lang-CVdBHA1v.js.map +1 -0
  99. package/build/server/chunks/PlayingTracker-BIq1bdv_.js +18 -0
  100. package/build/server/chunks/PlayingTracker-BIq1bdv_.js.map +1 -0
  101. package/build/server/chunks/_layout.svelte-BoFI04Ng.js +24 -0
  102. package/build/server/chunks/_layout.svelte-BoFI04Ng.js.map +1 -0
  103. package/build/server/chunks/_page.svelte-C3Mw7ZhL.js +115 -0
  104. package/build/server/chunks/_page.svelte-C3Mw7ZhL.js.map +1 -0
  105. package/build/server/chunks/_page.svelte-CzGyTA7b.js +368 -0
  106. package/build/server/chunks/_page.svelte-CzGyTA7b.js.map +1 -0
  107. package/build/server/chunks/error.svelte-BZE1ioPX.js +116 -0
  108. package/build/server/chunks/error.svelte-BZE1ioPX.js.map +1 -0
  109. package/build/server/chunks/exports-DAjI6ZSp.js +125 -0
  110. package/build/server/chunks/exports-DAjI6ZSp.js.map +1 -0
  111. package/build/server/chunks/index2-BA59f76P.js +1214 -0
  112. package/build/server/chunks/index2-BA59f76P.js.map +1 -0
  113. package/build/server/index.js +4868 -0
  114. package/build/server/index.js.map +1 -0
  115. package/build/server/manifest.js +50 -0
  116. package/build/server/manifest.js.map +1 -0
  117. package/build/shims.js +32 -0
  118. package/package.json +9 -2
  119. package/server/index.js +4 -0
  120. package/server/spotify_auth.json +1 -0
  121. package/.prettierignore +0 -4
  122. package/.prettierrc +0 -17
  123. package/CHANGELOG.md +0 -34
  124. package/env.template +0 -2
  125. package/eslint.config.js +0 -24
  126. package/jsconfig.json +0 -19
  127. package/screenshot.png +0 -0
  128. package/src/app.d.ts +0 -13
  129. package/src/app.html +0 -12
  130. package/src/lib/actions/qr.svelte.js +0 -23
  131. package/src/lib/comms.js +0 -25
  132. package/src/lib/components/AuthenticateTrigger.svelte +0 -74
  133. package/src/lib/components/Controls.svelte +0 -91
  134. package/src/lib/components/ImageLoad.svelte +0 -79
  135. package/src/lib/components/LoadingIndicator.svelte +0 -75
  136. package/src/lib/components/MediaItem.svelte +0 -75
  137. package/src/lib/components/PlayingTracker.svelte +0 -94
  138. package/src/lib/components/ResultsList.svelte +0 -80
  139. package/src/lib/components/Toast/Item.svelte +0 -71
  140. package/src/lib/components/Toast/Manager.svelte +0 -34
  141. package/src/lib/icons/disc.svg +0 -1
  142. package/src/lib/index.js +0 -1
  143. package/src/lib/store.js +0 -146
  144. package/src/lib/styles.scss +0 -166
  145. package/src/lib/toast.js +0 -57
  146. package/src/lib/utils.js +0 -723
  147. package/src/routes/+layout.server.js +0 -25
  148. package/src/routes/+layout.svelte +0 -72
  149. package/src/routes/+page.svelte +0 -381
  150. package/src/routes/player/+page.svelte +0 -294
  151. package/svelte.config.js +0 -19
  152. package/tools/BuildManifest.js +0 -87
  153. package/vite.config.js +0 -46
  154. /package/{static → build/client}/favicon.ico +0 -0
  155. /package/{static → build/client}/favicon.png +0 -0
  156. /package/{static → build/client}/icons/144.favicon.png +0 -0
  157. /package/{static → build/client}/icons/168.favicon.png +0 -0
  158. /package/{static → build/client}/icons/192.favicon.png +0 -0
  159. /package/{static → build/client}/icons/48.favicon.png +0 -0
  160. /package/{static → build/client}/icons/72.favicon.png +0 -0
  161. /package/{static → build/client}/icons/96.favicon.png +0 -0
  162. /package/{static → build/client}/manifest.json +0 -0
package/build/index.js ADDED
@@ -0,0 +1,334 @@
1
+ import process from 'node:process';
2
+ import { handler } from './handler.js';
3
+ import { env } from './env.js';
4
+ import http from 'node:http';
5
+ import { setImmediate } from 'node:timers';
6
+ import * as qs from 'node:querystring';
7
+
8
+ /**
9
+ * @param {string|RegExp} input The route pattern
10
+ * @param {boolean} [loose] Allow open-ended matching. Ignored with `RegExp` input.
11
+ */
12
+ function parse$1(input, loose) {
13
+ if (input instanceof RegExp) return { keys:false, pattern:input };
14
+ var c, o, tmp, ext, keys=[], pattern='', arr = input.split('/');
15
+ arr[0] || arr.shift();
16
+
17
+ while (tmp = arr.shift()) {
18
+ c = tmp[0];
19
+ if (c === '*') {
20
+ keys.push(c);
21
+ pattern += tmp[1] === '?' ? '(?:/(.*))?' : '/(.*)';
22
+ } else if (c === ':') {
23
+ o = tmp.indexOf('?', 1);
24
+ ext = tmp.indexOf('.', 1);
25
+ keys.push( tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length) );
26
+ pattern += !!~o && !~ext ? '(?:/([^/]+?))?' : '/([^/]+?)';
27
+ if (!!~ext) pattern += (!!~o ? '?' : '') + '\\' + tmp.substring(ext);
28
+ } else {
29
+ pattern += '/' + tmp;
30
+ }
31
+ }
32
+
33
+ return {
34
+ keys: keys,
35
+ pattern: new RegExp('^' + pattern + (loose ? '(?=$|\/)' : '\/?$'), 'i')
36
+ };
37
+ }
38
+
39
+ const MAP = {
40
+ "": 0,
41
+ GET: 1,
42
+ HEAD: 2,
43
+ PATCH: 3,
44
+ OPTIONS: 4,
45
+ CONNECT: 5,
46
+ DELETE: 6,
47
+ TRACE: 7,
48
+ POST: 8,
49
+ PUT: 9,
50
+ };
51
+
52
+ class Trouter {
53
+ constructor() {
54
+ this.routes = [];
55
+
56
+ this.all = this.add.bind(this, '');
57
+ this.get = this.add.bind(this, 'GET');
58
+ this.head = this.add.bind(this, 'HEAD');
59
+ this.patch = this.add.bind(this, 'PATCH');
60
+ this.options = this.add.bind(this, 'OPTIONS');
61
+ this.connect = this.add.bind(this, 'CONNECT');
62
+ this.delete = this.add.bind(this, 'DELETE');
63
+ this.trace = this.add.bind(this, 'TRACE');
64
+ this.post = this.add.bind(this, 'POST');
65
+ this.put = this.add.bind(this, 'PUT');
66
+ }
67
+
68
+ use(route, ...fns) {
69
+ let handlers = [].concat.apply([], fns);
70
+ let { keys, pattern } = parse$1(route, true);
71
+ this.routes.push({ keys, pattern, method: '', handlers, midx: MAP[''] });
72
+ return this;
73
+ }
74
+
75
+ add(method, route, ...fns) {
76
+ let { keys, pattern } = parse$1(route);
77
+ let handlers = [].concat.apply([], fns);
78
+ this.routes.push({ keys, pattern, method, handlers, midx: MAP[method] });
79
+ return this;
80
+ }
81
+
82
+ find(method, url) {
83
+ let midx = MAP[method];
84
+ let isHEAD = (midx === 2);
85
+ let i=0, j=0, k, tmp, arr=this.routes;
86
+ let matches=[], params={}, handlers=[];
87
+ for (; i < arr.length; i++) {
88
+ tmp = arr[i];
89
+ if (tmp.midx === midx || tmp.midx === 0 || (isHEAD && tmp.midx===1) ) {
90
+ if (tmp.keys === false) {
91
+ matches = tmp.pattern.exec(url);
92
+ if (matches === null) continue;
93
+ if (matches.groups !== void 0) for (k in matches.groups) params[k]=matches.groups[k];
94
+ tmp.handlers.length > 1 ? (handlers=handlers.concat(tmp.handlers)) : handlers.push(tmp.handlers[0]);
95
+ } else if (tmp.keys.length > 0) {
96
+ matches = tmp.pattern.exec(url);
97
+ if (matches === null) continue;
98
+ for (j=0; j < tmp.keys.length;) params[tmp.keys[j]]=matches[++j];
99
+ tmp.handlers.length > 1 ? (handlers=handlers.concat(tmp.handlers)) : handlers.push(tmp.handlers[0]);
100
+ } else if (tmp.pattern.test(url)) {
101
+ tmp.handlers.length > 1 ? (handlers=handlers.concat(tmp.handlers)) : handlers.push(tmp.handlers[0]);
102
+ }
103
+ } // else not a match
104
+ }
105
+
106
+ return { params, handlers };
107
+ }
108
+ }
109
+
110
+ /**
111
+ * @typedef ParsedURL
112
+ * @type {import('.').ParsedURL}
113
+ */
114
+
115
+ /**
116
+ * @typedef Request
117
+ * @property {string} url
118
+ * @property {ParsedURL} _parsedUrl
119
+ */
120
+
121
+ /**
122
+ * @param {Request} req
123
+ * @returns {ParsedURL|void}
124
+ */
125
+ function parse(req) {
126
+ let raw = req.url;
127
+ if (raw == null) return;
128
+
129
+ let prev = req._parsedUrl;
130
+ if (prev && prev.raw === raw) return prev;
131
+
132
+ let pathname=raw, search='', query;
133
+
134
+ if (raw.length > 1) {
135
+ let idx = raw.indexOf('?', 1);
136
+
137
+ if (idx !== -1) {
138
+ search = raw.substring(idx);
139
+ pathname = raw.substring(0, idx);
140
+ if (search.length > 1) {
141
+ query = qs.parse(search.substring(1));
142
+ }
143
+ }
144
+ }
145
+
146
+ return req._parsedUrl = { pathname, search, query, raw };
147
+ }
148
+
149
+ function onError(err, req, res) {
150
+ let code = typeof err.status === 'number' && err.status;
151
+ code = res.statusCode = (code && code >= 100 ? code : 500);
152
+ if (typeof err === 'string' || Buffer.isBuffer(err)) res.end(err);
153
+ else res.end(err.message || http.STATUS_CODES[code]);
154
+ }
155
+
156
+ const mount = fn => fn instanceof Polka ? fn.attach : fn;
157
+
158
+ class Polka extends Trouter {
159
+ constructor(opts={}) {
160
+ super();
161
+ this.parse = parse;
162
+ this.server = opts.server;
163
+ this.handler = this.handler.bind(this);
164
+ this.onError = opts.onError || onError; // catch-all handler
165
+ this.onNoMatch = opts.onNoMatch || this.onError.bind(null, { status: 404 });
166
+ this.attach = (req, res) => setImmediate(this.handler, req, res);
167
+ }
168
+
169
+ use(base, ...fns) {
170
+ if (base === '/') {
171
+ super.use(base, fns.map(mount));
172
+ } else if (typeof base === 'function' || base instanceof Polka) {
173
+ super.use('/', [base, ...fns].map(mount));
174
+ } else {
175
+ super.use(base,
176
+ (req, _, next) => {
177
+ if (typeof base === 'string') {
178
+ let len = base.length;
179
+ base.startsWith('/') || len++;
180
+ req.url = req.url.substring(len) || '/';
181
+ req.path = req.path.substring(len) || '/';
182
+ } else {
183
+ req.url = req.url.replace(base, '') || '/';
184
+ req.path = req.path.replace(base, '') || '/';
185
+ }
186
+ if (req.url.charAt(0) !== '/') {
187
+ req.url = '/' + req.url;
188
+ }
189
+ next();
190
+ },
191
+ fns.map(mount),
192
+ (req, _, next) => {
193
+ req.path = req._parsedUrl.pathname;
194
+ req.url = req.path + req._parsedUrl.search;
195
+ next();
196
+ }
197
+ );
198
+ }
199
+ return this; // chainable
200
+ }
201
+
202
+ listen() {
203
+ (this.server = this.server || http.createServer()).on('request', this.attach);
204
+ this.server.listen.apply(this.server, arguments);
205
+ return this;
206
+ }
207
+
208
+ handler(req, res, next) {
209
+ let info = this.parse(req), path = info.pathname;
210
+ let obj = this.find(req.method, req.path=path);
211
+
212
+ req.url = path + info.search;
213
+ req.originalUrl = req.originalUrl || req.url;
214
+ req.query = info.query || {};
215
+ req.search = info.search;
216
+ req.params = obj.params;
217
+
218
+ if (path.length > 1 && path.indexOf('%', 1) !== -1) {
219
+ for (let k in req.params) {
220
+ try { req.params[k] = decodeURIComponent(req.params[k]); }
221
+ catch (e) { /* malform uri segment */ }
222
+ }
223
+ }
224
+
225
+ let i=0, arr=obj.handlers.concat(this.onNoMatch), len=arr.length;
226
+ let loop = async () => res.finished || (i < len) && arr[i++](req, res, next);
227
+ (next = next || (err => err ? this.onError(err, req, res, next) : loop().catch(next)))(); // init
228
+ }
229
+ }
230
+
231
+ function polka (opts) {
232
+ return new Polka(opts);
233
+ }
234
+
235
+ const path = env('SOCKET_PATH', false);
236
+ const host = env('HOST', '0.0.0.0');
237
+ const port = env('PORT', !path && '3000');
238
+
239
+ const shutdown_timeout = parseInt(env('SHUTDOWN_TIMEOUT', '30'));
240
+ const idle_timeout = parseInt(env('IDLE_TIMEOUT', '0'));
241
+ const listen_pid = parseInt(env('LISTEN_PID', '0'));
242
+ const listen_fds = parseInt(env('LISTEN_FDS', '0'));
243
+ // https://www.freedesktop.org/software/systemd/man/latest/sd_listen_fds.html
244
+ const SD_LISTEN_FDS_START = 3;
245
+
246
+ if (listen_pid !== 0 && listen_pid !== process.pid) {
247
+ throw new Error(`received LISTEN_PID ${listen_pid} but current process id is ${process.pid}`);
248
+ }
249
+ if (listen_fds > 1) {
250
+ throw new Error(
251
+ `only one socket is allowed for socket activation, but LISTEN_FDS was set to ${listen_fds}`
252
+ );
253
+ }
254
+
255
+ const socket_activation = listen_pid === process.pid && listen_fds === 1;
256
+
257
+ let requests = 0;
258
+ /** @type {NodeJS.Timeout | void} */
259
+ let shutdown_timeout_id;
260
+ /** @type {NodeJS.Timeout | void} */
261
+ let idle_timeout_id;
262
+
263
+ const server = polka().use(handler);
264
+
265
+ if (socket_activation) {
266
+ server.listen({ fd: SD_LISTEN_FDS_START }, () => {
267
+ console.log(`Listening on file descriptor ${SD_LISTEN_FDS_START}`);
268
+ });
269
+ } else {
270
+ server.listen({ path, host, port }, () => {
271
+ console.log(`Listening on ${path || `http://${host}:${port}`}`);
272
+ });
273
+ }
274
+
275
+ /** @param {'SIGINT' | 'SIGTERM' | 'IDLE'} reason */
276
+ function graceful_shutdown(reason) {
277
+ if (shutdown_timeout_id) return;
278
+
279
+ // If a connection was opened with a keep-alive header close() will wait for the connection to
280
+ // time out rather than close it even if it is not handling any requests, so call this first
281
+ // @ts-expect-error this was added in 18.2.0 but is not reflected in the types
282
+ server.server.closeIdleConnections();
283
+
284
+ server.server.close((error) => {
285
+ // occurs if the server is already closed
286
+ if (error) return;
287
+
288
+ if (shutdown_timeout_id) {
289
+ clearTimeout(shutdown_timeout_id);
290
+ }
291
+ if (idle_timeout_id) {
292
+ clearTimeout(idle_timeout_id);
293
+ }
294
+
295
+ // @ts-expect-error custom events cannot be typed
296
+ process.emit('sveltekit:shutdown', reason);
297
+ });
298
+
299
+ shutdown_timeout_id = setTimeout(
300
+ // @ts-expect-error this was added in 18.2.0 but is not reflected in the types
301
+ () => server.server.closeAllConnections(),
302
+ shutdown_timeout * 1000
303
+ );
304
+ }
305
+
306
+ server.server.on(
307
+ 'request',
308
+ /** @param {import('node:http').IncomingMessage} req */
309
+ (req) => {
310
+ requests++;
311
+
312
+ if (socket_activation && idle_timeout_id) {
313
+ idle_timeout_id = clearTimeout(idle_timeout_id);
314
+ }
315
+
316
+ req.on('close', () => {
317
+ requests--;
318
+
319
+ if (shutdown_timeout_id) {
320
+ // close connections as soon as they become idle, so they don't accept new requests
321
+ // @ts-expect-error this was added in 18.2.0 but is not reflected in the types
322
+ server.server.closeIdleConnections();
323
+ }
324
+ if (requests === 0 && socket_activation && idle_timeout) {
325
+ idle_timeout_id = setTimeout(() => graceful_shutdown('IDLE'), idle_timeout * 1000);
326
+ }
327
+ });
328
+ }
329
+ );
330
+
331
+ process.on('SIGTERM', graceful_shutdown);
332
+ process.on('SIGINT', graceful_shutdown);
333
+
334
+ export { host, path, port, server };
@@ -0,0 +1,91 @@
1
+ import deepmerge from 'deepmerge';
2
+ import dotenv from 'dotenv';
3
+ import os from 'node:os';
4
+
5
+ const DEFAULT_OPTIONS = {
6
+ port: 3e3,
7
+ origin: "",
8
+ protocol: "http://",
9
+ verbose: false,
10
+ playerRoute: "/player",
11
+ api: {
12
+ market: "GB",
13
+ searchQueryLimit: 10,
14
+ centralisedPolling: true,
15
+ centralisedPollingTimer: 5e3,
16
+ canAdd: true,
17
+ canControl: true
18
+ },
19
+ spotify: {
20
+ client_id: "",
21
+ client_secret: "",
22
+ routePrefix: "/spotify",
23
+ routeToken: "/token",
24
+ authenticatedRedirect: "/",
25
+ accessTokenJsonLocation: "$HOME/.ambient/spotify_auth.json",
26
+ scope: []
27
+ },
28
+ plugins: [],
29
+ pluginOptions: {},
30
+ suppressErrors: []
31
+ };
32
+ const getIp = () => {
33
+ const [item] = Object.values(os.networkInterfaces()).flat().filter((item2) => item2 && item2.family === "IPv4" && !item2.internal);
34
+ return item?.address;
35
+ };
36
+ const expandAliases = (filePath) => {
37
+ if (filePath.startsWith("~")) {
38
+ return os.homedir() + filePath.slice(0);
39
+ }
40
+ if (filePath.startsWith("$HOME")) {
41
+ return os.homedir() + filePath.slice("$HOME".length);
42
+ }
43
+ return filePath;
44
+ };
45
+ dotenv.config();
46
+ const INJECTED_OPTIONS = {
47
+ verbose: "VERBOSE" in process.env && process.env.VERBOSE?.toLowerCase() !== "false",
48
+ origin: process.env.ORIGIN ?? getIp(),
49
+ protocol: process.env.PROTOCOL ?? "http://",
50
+ port: process.env.PORT ?? 3e3,
51
+ spotify: {
52
+ client_id: process.env.SPOTIFY_CLIENT_ID,
53
+ client_secret: process.env.SPOTIFY_CLIENT_SECRET
54
+ }
55
+ };
56
+ const USER_OPTIONS = await import(expandAliases(process.env.CONFIG ?? "../ambient.config.js")).then((module) => module.default).catch(() => ({}));
57
+ const OPTIONS = deepmerge(DEFAULT_OPTIONS, deepmerge(INJECTED_OPTIONS, USER_OPTIONS));
58
+ const testServer = async (fetch) => {
59
+ try {
60
+ const { success } = await fetch({ path: "/api/health", protocol: "http" }).then(
61
+ (resp) => resp.json()
62
+ );
63
+ return success;
64
+ } catch {
65
+ return false;
66
+ }
67
+ };
68
+ async function load({ fetch }) {
69
+ const server = await testServer(fetch);
70
+ const { plugins, ...config } = OPTIONS;
71
+ return {
72
+ live: !!server,
73
+ config
74
+ };
75
+ }
76
+
77
+ var _layout_server = /*#__PURE__*/Object.freeze({
78
+ __proto__: null,
79
+ load: load
80
+ });
81
+
82
+ const index = 0;
83
+ let component_cache;
84
+ const component = async () => component_cache ??= (await import('./_layout.svelte-BoFI04Ng.js')).default;
85
+ const server_id = "src/routes/+layout.server.js";
86
+ const imports = ["_app/immutable/nodes/0.DaJoi3FK.js","_app/immutable/chunks/disclose-version.N57b1q78.js","_app/immutable/chunks/utils.BXcQV2KO.js","_app/immutable/chunks/props.DYfFZGja.js","_app/immutable/chunks/snippet.BVSCguOu.js","_app/immutable/chunks/LoadingIndicator.COVTk436.js","_app/immutable/chunks/index.DFULH2AN.js","_app/immutable/chunks/legacy.DZgMwYuQ.js","_app/immutable/chunks/index.DLR8Bvs6.js"];
87
+ const stylesheets = ["_app/immutable/assets/0.Dl9__I4E.css","_app/immutable/assets/LoadingIndicator.D0m6rSKQ.css"];
88
+ const fonts = [];
89
+
90
+ export { component, fonts, imports, index, _layout_server as server, server_id, stylesheets };
91
+ //# sourceMappingURL=0-D_yciAvo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"0-D_yciAvo.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/_layout.server.js","../../../.svelte-kit/adapter-node/nodes/0.js"],"sourcesContent":["import deepmerge from \"deepmerge\";\nimport dotenv from \"dotenv\";\nimport os from \"node:os\";\nconst DEFAULT_OPTIONS = {\n port: 3e3,\n origin: \"\",\n protocol: \"http://\",\n verbose: false,\n playerRoute: \"/player\",\n api: {\n market: \"GB\",\n searchQueryLimit: 10,\n centralisedPolling: true,\n centralisedPollingTimer: 5e3,\n canAdd: true,\n canControl: true\n },\n spotify: {\n client_id: \"\",\n client_secret: \"\",\n routePrefix: \"/spotify\",\n routeToken: \"/token\",\n authenticatedRedirect: \"/\",\n accessTokenJsonLocation: \"$HOME/.ambient/spotify_auth.json\",\n scope: []\n },\n plugins: [],\n pluginOptions: {},\n suppressErrors: []\n};\nconst getIp = () => {\n const [item] = Object.values(os.networkInterfaces()).flat().filter((item2) => item2 && item2.family === \"IPv4\" && !item2.internal);\n return item?.address;\n};\nconst expandAliases = (filePath) => {\n if (filePath.startsWith(\"~\")) {\n return os.homedir() + filePath.slice(0);\n }\n if (filePath.startsWith(\"$HOME\")) {\n return os.homedir() + filePath.slice(\"$HOME\".length);\n }\n return filePath;\n};\ndotenv.config();\nconst INJECTED_OPTIONS = {\n verbose: \"VERBOSE\" in process.env && process.env.VERBOSE?.toLowerCase() !== \"false\",\n origin: process.env.ORIGIN ?? getIp(),\n protocol: process.env.PROTOCOL ?? \"http://\",\n port: process.env.PORT ?? 3e3,\n spotify: {\n client_id: process.env.SPOTIFY_CLIENT_ID,\n client_secret: process.env.SPOTIFY_CLIENT_SECRET\n }\n};\nconst USER_OPTIONS = await import(expandAliases(process.env.CONFIG ?? \"../ambient.config.js\")).then((module) => module.default).catch(() => ({}));\nconst OPTIONS = deepmerge(DEFAULT_OPTIONS, deepmerge(INJECTED_OPTIONS, USER_OPTIONS));\nconst testServer = async (fetch) => {\n try {\n const { success } = await fetch({ path: \"/api/health\", protocol: \"http\" }).then(\n (resp) => resp.json()\n );\n return success;\n } catch {\n return false;\n }\n};\nasync function load({ fetch }) {\n const server = await testServer(fetch);\n const { plugins, ...config } = OPTIONS;\n return {\n live: !!server,\n config\n };\n}\nexport {\n load\n};\n","import * as server from '../entries/pages/_layout.server.js';\n\nexport const index = 0;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/_layout.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/+layout.server.js\";\nexport const imports = [\"_app/immutable/nodes/0.DaJoi3FK.js\",\"_app/immutable/chunks/disclose-version.N57b1q78.js\",\"_app/immutable/chunks/utils.BXcQV2KO.js\",\"_app/immutable/chunks/props.DYfFZGja.js\",\"_app/immutable/chunks/snippet.BVSCguOu.js\",\"_app/immutable/chunks/LoadingIndicator.COVTk436.js\",\"_app/immutable/chunks/index.DFULH2AN.js\",\"_app/immutable/chunks/legacy.DZgMwYuQ.js\",\"_app/immutable/chunks/index.DLR8Bvs6.js\"];\nexport const stylesheets = [\"_app/immutable/assets/0.Dl9__I4E.css\",\"_app/immutable/assets/LoadingIndicator.D0m6rSKQ.css\"];\nexport const fonts = [];\n"],"names":[],"mappings":";;;;AAGA,MAAM,eAAe,GAAG;AACxB,EAAE,IAAI,EAAE,GAAG;AACX,EAAE,MAAM,EAAE,EAAE;AACZ,EAAE,QAAQ,EAAE,SAAS;AACrB,EAAE,OAAO,EAAE,KAAK;AAChB,EAAE,WAAW,EAAE,SAAS;AACxB,EAAE,GAAG,EAAE;AACP,IAAI,MAAM,EAAE,IAAI;AAChB,IAAI,gBAAgB,EAAE,EAAE;AACxB,IAAI,kBAAkB,EAAE,IAAI;AAC5B,IAAI,uBAAuB,EAAE,GAAG;AAChC,IAAI,MAAM,EAAE,IAAI;AAChB,IAAI,UAAU,EAAE;AAChB,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,SAAS,EAAE,EAAE;AACjB,IAAI,aAAa,EAAE,EAAE;AACrB,IAAI,WAAW,EAAE,UAAU;AAC3B,IAAI,UAAU,EAAE,QAAQ;AACxB,IAAI,qBAAqB,EAAE,GAAG;AAC9B,IAAI,uBAAuB,EAAE,kCAAkC;AAC/D,IAAI,KAAK,EAAE;AACX,GAAG;AACH,EAAE,OAAO,EAAE,EAAE;AACb,EAAE,aAAa,EAAE,EAAE;AACnB,EAAE,cAAc,EAAE;AAClB,CAAC;AACD,MAAM,KAAK,GAAG,MAAM;AACpB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;AACpI,EAAE,OAAO,IAAI,EAAE,OAAO;AACtB,CAAC;AACD,MAAM,aAAa,GAAG,CAAC,QAAQ,KAAK;AACpC,EAAE,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;AAChC,IAAI,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3C;AACA,EAAE,IAAI,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;AACpC,IAAI,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;AACxD;AACA,EAAE,OAAO,QAAQ;AACjB,CAAC;AACD,MAAM,CAAC,MAAM,EAAE;AACf,MAAM,gBAAgB,GAAG;AACzB,EAAE,OAAO,EAAE,SAAS,IAAI,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,OAAO;AACrF,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,KAAK,EAAE;AACvC,EAAE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,SAAS;AAC7C,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG;AAC/B,EAAE,OAAO,EAAE;AACX,IAAI,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;AAC5C,IAAI,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC;AAC/B;AACA,CAAC;AACD,MAAM,YAAY,GAAG,MAAM,OAAO,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AACjJ,MAAM,OAAO,GAAG,SAAS,CAAC,eAAe,EAAE,SAAS,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;AACrF,MAAM,UAAU,GAAG,OAAO,KAAK,KAAK;AACpC,EAAE,IAAI;AACN,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,KAAK,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI;AACnF,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;AACzB,KAAK;AACL,IAAI,OAAO,OAAO;AAClB,GAAG,CAAC,MAAM;AACV,IAAI,OAAO,KAAK;AAChB;AACA,CAAC;AACD,eAAe,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;AAC/B,EAAE,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC;AACxC,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO;AACxC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM;AAClB,IAAI;AACJ,GAAG;AACH;;;;;;;ACvEY,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,8BAAoC,CAAC,EAAE;AAElG,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,oDAAoD,CAAC,yCAAyC,CAAC,yCAAyC,CAAC,2CAA2C,CAAC,oDAAoD,CAAC,yCAAyC,CAAC,0CAA0C,CAAC,yCAAyC;AACzZ,MAAC,WAAW,GAAG,CAAC,sCAAsC,CAAC,qDAAqD;AAC5G,MAAC,KAAK,GAAG;;;;"}
@@ -0,0 +1,9 @@
1
+ const index = 1;
2
+ let component_cache;
3
+ const component = async () => component_cache ??= (await import('./error.svelte-BZE1ioPX.js')).default;
4
+ const imports = ["_app/immutable/nodes/1.0EwG4xPT.js","_app/immutable/chunks/disclose-version.N57b1q78.js","_app/immutable/chunks/utils.BXcQV2KO.js","_app/immutable/chunks/legacy.DZgMwYuQ.js","_app/immutable/chunks/entry.CTcSu7Oh.js","_app/immutable/chunks/index.DFULH2AN.js","_app/immutable/chunks/index-client.DV07uIiZ.js"];
5
+ const stylesheets = [];
6
+ const fonts = [];
7
+
8
+ export { component, fonts, imports, index, stylesheets };
9
+ //# sourceMappingURL=1-BA-qTHOy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1-BA-qTHOy.js","sources":["../../../.svelte-kit/adapter-node/nodes/1.js"],"sourcesContent":["\n\nexport const index = 1;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/fallbacks/error.svelte.js')).default;\nexport const imports = [\"_app/immutable/nodes/1.0EwG4xPT.js\",\"_app/immutable/chunks/disclose-version.N57b1q78.js\",\"_app/immutable/chunks/utils.BXcQV2KO.js\",\"_app/immutable/chunks/legacy.DZgMwYuQ.js\",\"_app/immutable/chunks/entry.CTcSu7Oh.js\",\"_app/immutable/chunks/index.DFULH2AN.js\",\"_app/immutable/chunks/index-client.DV07uIiZ.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":"AAEY,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAsC,CAAC,EAAE;AACpG,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,oDAAoD,CAAC,yCAAyC,CAAC,0CAA0C,CAAC,yCAAyC,CAAC,yCAAyC,CAAC,gDAAgD;AAC/T,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}
@@ -0,0 +1,9 @@
1
+ const index = 2;
2
+ let component_cache;
3
+ const component = async () => component_cache ??= (await import('./_page.svelte-CzGyTA7b.js')).default;
4
+ const imports = ["_app/immutable/nodes/2.CIcrK0Mf.js","_app/immutable/chunks/disclose-version.N57b1q78.js","_app/immutable/chunks/utils.BXcQV2KO.js","_app/immutable/chunks/props.DYfFZGja.js","_app/immutable/chunks/LoadingIndicator.COVTk436.js","_app/immutable/chunks/index.DFULH2AN.js","_app/immutable/chunks/this.EZLWgc5v.js","_app/immutable/chunks/snippet.BVSCguOu.js","_app/immutable/chunks/PlayingTracker.Cymhk9j5.js"];
5
+ const stylesheets = ["_app/immutable/assets/2.BtzFOBtk.css","_app/immutable/assets/LoadingIndicator.D0m6rSKQ.css","_app/immutable/assets/PlayingTracker.9uM5nyWg.css"];
6
+ const fonts = [];
7
+
8
+ export { component, fonts, imports, index, stylesheets };
9
+ //# sourceMappingURL=2-DPsIhdeI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"2-DPsIhdeI.js","sources":["../../../.svelte-kit/adapter-node/nodes/2.js"],"sourcesContent":["\n\nexport const index = 2;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/_page.svelte.js')).default;\nexport const imports = [\"_app/immutable/nodes/2.CIcrK0Mf.js\",\"_app/immutable/chunks/disclose-version.N57b1q78.js\",\"_app/immutable/chunks/utils.BXcQV2KO.js\",\"_app/immutable/chunks/props.DYfFZGja.js\",\"_app/immutable/chunks/LoadingIndicator.COVTk436.js\",\"_app/immutable/chunks/index.DFULH2AN.js\",\"_app/immutable/chunks/this.EZLWgc5v.js\",\"_app/immutable/chunks/snippet.BVSCguOu.js\",\"_app/immutable/chunks/PlayingTracker.Cymhk9j5.js\"];\nexport const stylesheets = [\"_app/immutable/assets/2.BtzFOBtk.css\",\"_app/immutable/assets/LoadingIndicator.D0m6rSKQ.css\",\"_app/immutable/assets/PlayingTracker.9uM5nyWg.css\"];\nexport const fonts = [];\n"],"names":[],"mappings":"AAEY,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAkC,CAAC,EAAE;AAChG,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,oDAAoD,CAAC,yCAAyC,CAAC,yCAAyC,CAAC,oDAAoD,CAAC,yCAAyC,CAAC,wCAAwC,CAAC,2CAA2C,CAAC,kDAAkD;AACha,MAAC,WAAW,GAAG,CAAC,sCAAsC,CAAC,qDAAqD,CAAC,mDAAmD;AAChK,MAAC,KAAK,GAAG;;;;"}
@@ -0,0 +1,9 @@
1
+ const index = 3;
2
+ let component_cache;
3
+ const component = async () => component_cache ??= (await import('./_page.svelte-C3Mw7ZhL.js')).default;
4
+ const imports = ["_app/immutable/nodes/3.vzk8SJSG.js","_app/immutable/chunks/disclose-version.N57b1q78.js","_app/immutable/chunks/utils.BXcQV2KO.js","_app/immutable/chunks/props.DYfFZGja.js","_app/immutable/chunks/index.DLR8Bvs6.js","_app/immutable/chunks/LoadingIndicator.COVTk436.js","_app/immutable/chunks/index.DFULH2AN.js","_app/immutable/chunks/PlayingTracker.Cymhk9j5.js"];
5
+ const stylesheets = ["_app/immutable/assets/3.BvcZlbFP.css","_app/immutable/assets/LoadingIndicator.D0m6rSKQ.css","_app/immutable/assets/PlayingTracker.9uM5nyWg.css"];
6
+ const fonts = [];
7
+
8
+ export { component, fonts, imports, index, stylesheets };
9
+ //# sourceMappingURL=3-CZREXwZu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"3-CZREXwZu.js","sources":["../../../.svelte-kit/adapter-node/nodes/3.js"],"sourcesContent":["\n\nexport const index = 3;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/player/_page.svelte.js')).default;\nexport const imports = [\"_app/immutable/nodes/3.vzk8SJSG.js\",\"_app/immutable/chunks/disclose-version.N57b1q78.js\",\"_app/immutable/chunks/utils.BXcQV2KO.js\",\"_app/immutable/chunks/props.DYfFZGja.js\",\"_app/immutable/chunks/index.DLR8Bvs6.js\",\"_app/immutable/chunks/LoadingIndicator.COVTk436.js\",\"_app/immutable/chunks/index.DFULH2AN.js\",\"_app/immutable/chunks/PlayingTracker.Cymhk9j5.js\"];\nexport const stylesheets = [\"_app/immutable/assets/3.BvcZlbFP.css\",\"_app/immutable/assets/LoadingIndicator.D0m6rSKQ.css\",\"_app/immutable/assets/PlayingTracker.9uM5nyWg.css\"];\nexport const fonts = [];\n"],"names":[],"mappings":"AAEY,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAyC,CAAC,EAAE;AACvG,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,oDAAoD,CAAC,yCAAyC,CAAC,yCAAyC,CAAC,yCAAyC,CAAC,oDAAoD,CAAC,yCAAyC,CAAC,kDAAkD;AACrX,MAAC,WAAW,GAAG,CAAC,sCAAsC,CAAC,qDAAqD,CAAC,mDAAmD;AAChK,MAAC,KAAK,GAAG;;;;"}
@@ -0,0 +1,10 @@
1
+ import { Z as attr, a6 as stringify } from './index2-BA59f76P.js';
2
+ import './LoadingIndicator.svelte_svelte_type_style_lang-CVdBHA1v.js';
3
+
4
+ function LoadingIndicator($$payload, $$props) {
5
+ const { floating = false } = $$props;
6
+ $$payload.out += `<div${attr("class", `loading svelte-1aqhn4j ${stringify([floating ? "floating" : ""].filter(Boolean).join(" "))}`)}><div class="loading-icon svelte-1aqhn4j"></div> <div class="loading-icon svelte-1aqhn4j"></div> <div class="loading-icon svelte-1aqhn4j"></div></div>`;
7
+ }
8
+
9
+ export { LoadingIndicator as L };
10
+ //# sourceMappingURL=LoadingIndicator-CTUFEPkL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoadingIndicator-CTUFEPkL.js","sources":["../../../.svelte-kit/adapter-node/chunks/LoadingIndicator.js"],"sourcesContent":["import { X as attr, a4 as stringify } from \"./index.js\";\nimport \"./LoadingIndicator.svelte_svelte_type_style_lang.js\";\nfunction LoadingIndicator($$payload, $$props) {\n const { floating = false } = $$props;\n $$payload.out += `<div${attr(\"class\", `loading svelte-1aqhn4j ${stringify([floating ? \"floating\" : \"\"].filter(Boolean).join(\" \"))}`)}><div class=\"loading-icon svelte-1aqhn4j\"></div> <div class=\"loading-icon svelte-1aqhn4j\"></div> <div class=\"loading-icon svelte-1aqhn4j\"></div></div>`;\n}\nexport {\n LoadingIndicator as L\n};\n"],"names":[],"mappings":";;;AAEA,SAAS,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE;AAC9C,EAAE,MAAM,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,OAAO;AACtC,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC,QAAQ,GAAG,UAAU,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,sJAAsJ,CAAC;AAC9R;;;;"}
@@ -0,0 +1,172 @@
1
+ import { io } from 'socket.io-client';
2
+ import { a8 as derived, X as writable } from './index2-BA59f76P.js';
3
+
4
+ const toastItemsStore = writable([]);
5
+ let itemsLength = 0;
6
+ const toastItems = {
7
+ ...toastItemsStore,
8
+ /**
9
+ *
10
+ * @param {ToastItem} item
11
+ */
12
+ addItem(item) {
13
+ const id = itemsLength + 1;
14
+ toastItemsStore.update((items) => [
15
+ ...items,
16
+ {
17
+ id,
18
+ ...item
19
+ }
20
+ ]);
21
+ itemsLength = id;
22
+ return () => toastItems.removeItem(id);
23
+ },
24
+ /**
25
+ *
26
+ * @param {number} itemId
27
+ */
28
+ removeItem(itemId) {
29
+ toastItemsStore.update((items) => {
30
+ const cacheItems = items.slice();
31
+ cacheItems.splice(
32
+ cacheItems.findIndex((item) => item.id === itemId),
33
+ 1
34
+ );
35
+ return cacheItems;
36
+ });
37
+ }
38
+ };
39
+ const liveData = writable(false);
40
+ const settled = writable(false);
41
+ const config = writable({});
42
+ const siteUrl = derived(
43
+ [config],
44
+ ([$config]) => [$config?.protocol, $config?.origin].join("")
45
+ );
46
+ const sitePort = derived([config], ([$config]) => $config.protocol);
47
+ const objectHasValues = (obj) => Object.values(obj).length > 0;
48
+ const address = derived(
49
+ [liveData, siteUrl, sitePort],
50
+ ([$liveData, $siteUrl, $sitePort]) => {
51
+ const full = `${typeof window !== "undefined" ? window.location.protocol : "http:"}//${$siteUrl}:${$sitePort}`;
52
+ return {
53
+ full,
54
+ naked: [$siteUrl, $sitePort].join(":"),
55
+ /**
56
+ *
57
+ * @param {string} route
58
+ * @returns {string}
59
+ */
60
+ get(route) {
61
+ return `${full}${route}`;
62
+ },
63
+ endpoint: $liveData || !$siteUrl ? "" : `${$siteUrl}:3000`,
64
+ /**
65
+ *
66
+ * @param {string} route
67
+ * @returns {string}
68
+ */
69
+ server(route) {
70
+ return `${this.endpoint}${route}`;
71
+ }
72
+ };
73
+ }
74
+ );
75
+ derived([address], ([$address]) => {
76
+ const f = async (route, data = {}, opts = {}) => {
77
+ try {
78
+ const url = new URL(
79
+ [
80
+ $address.endpoint.startsWith("http") ? "" : window.location.origin,
81
+ $address.endpoint,
82
+ "/api",
83
+ route
84
+ ].join("")
85
+ );
86
+ if (opts.method === "POST" && objectHasValues(data)) {
87
+ opts.body = JSON.stringify(data);
88
+ } else if (objectHasValues(data)) {
89
+ url.search = new URLSearchParams(data).toString();
90
+ }
91
+ const resp = await fetch(url, opts);
92
+ const result = await resp.json();
93
+ if (resp.status !== 200) {
94
+ throw new Error(result);
95
+ }
96
+ return result;
97
+ } catch (e) {
98
+ toastItems.addItem({
99
+ message: "Api Error",
100
+ type: "error"
101
+ });
102
+ throw e;
103
+ }
104
+ };
105
+ return {
106
+ health() {
107
+ return f("/health");
108
+ },
109
+ info() {
110
+ return f("/info");
111
+ },
112
+ /**
113
+ *
114
+ * @param {string} q
115
+ */
116
+ search(q) {
117
+ return f("/search", { q });
118
+ },
119
+ /**
120
+ *
121
+ * @param {string} id
122
+ */
123
+ artist(id) {
124
+ return f(`/artist/${id}`);
125
+ },
126
+ /**
127
+ *
128
+ * @param {string} id
129
+ */
130
+ album(id) {
131
+ return f(`/album/${id}`);
132
+ },
133
+ /**
134
+ *
135
+ * @param {string} uri
136
+ * @param {string} [name]
137
+ */
138
+ addTrack(uri, name) {
139
+ return f(`/add`, { uri, name });
140
+ },
141
+ play() {
142
+ return f("/play");
143
+ },
144
+ pause() {
145
+ return f("/pause");
146
+ },
147
+ skipForward() {
148
+ return f("/skipForward");
149
+ },
150
+ skipBackward() {
151
+ return f("/skipBackward");
152
+ }
153
+ };
154
+ });
155
+ const previous = {
156
+ /** @type {Socket | null} */
157
+ current: null
158
+ };
159
+ derived([address, settled], ([$address, $settled]) => {
160
+ if (!$settled) {
161
+ return null;
162
+ }
163
+ const i = io($address.endpoint);
164
+ if (previous.current) {
165
+ previous.current.disconnect();
166
+ }
167
+ previous.current = i;
168
+ return i;
169
+ });
170
+
171
+ export { address as a, config as c };
172
+ //# sourceMappingURL=LoadingIndicator.svelte_svelte_type_style_lang-CVdBHA1v.js.map