@xiboplayer/pwa 0.7.20 → 0.7.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/assets/html2canvas-DvZXzqCS.js +6 -0
  2. package/dist/assets/{html2canvas-BAfZNSwU.js.map → html2canvas-DvZXzqCS.js.map} +1 -1
  3. package/dist/assets/main-DZuP3atR.js +735 -0
  4. package/dist/assets/main-DZuP3atR.js.map +1 -0
  5. package/dist/assets/{pdf-Bxz9Nzto.js → pdf-sKGmgJ84.js} +3 -3
  6. package/dist/assets/pdf-sKGmgJ84.js.map +1 -0
  7. package/dist/assets/{setup-Dpox3R4b.js → setup-PPLkJXma.js} +2 -2
  8. package/dist/assets/{setup-Dpox3R4b.js.map → setup-PPLkJXma.js.map} +1 -1
  9. package/dist/assets/src-BXf12TBh.js +16 -0
  10. package/dist/assets/src-BXf12TBh.js.map +1 -0
  11. package/dist/assets/src-BfPGb2rS.js +1 -0
  12. package/dist/assets/{src-DTJp4-F0.js → src-Br0nlcJt.js} +2 -2
  13. package/dist/assets/{src-DTJp4-F0.js.map → src-Br0nlcJt.js.map} +1 -1
  14. package/dist/assets/{src-Bzheh5E2.js → src-CMBYiOs4.js} +3 -3
  15. package/dist/assets/{src-Bzheh5E2.js.map → src-CMBYiOs4.js.map} +1 -1
  16. package/dist/assets/{src-BLwxK97o.js → src-D7r8nqnZ.js} +2 -2
  17. package/dist/assets/{src-BLwxK97o.js.map → src-D7r8nqnZ.js.map} +1 -1
  18. package/dist/assets/{src-D_pit2UZ.js → src-DCHcQ-Z7.js} +3 -3
  19. package/dist/assets/{src-D_pit2UZ.js.map → src-DCHcQ-Z7.js.map} +1 -1
  20. package/dist/assets/src-DPOUYQMT.js +2 -0
  21. package/dist/assets/{src-DzgDstdA.js.map → src-DPOUYQMT.js.map} +1 -1
  22. package/dist/assets/src-Dfm-7Za-.js +2 -0
  23. package/dist/assets/{src-CIERor10.js.map → src-Dfm-7Za-.js.map} +1 -1
  24. package/dist/assets/src-Dfnol-_C.js +1 -0
  25. package/dist/assets/{src-e2yErlKg.js → src-WWbeHES3.js} +2 -2
  26. package/dist/assets/{src-e2yErlKg.js.map → src-WWbeHES3.js.map} +1 -1
  27. package/dist/assets/src-jHYXY4sl.js +1 -0
  28. package/dist/assets/{sync-manager-B6kqa4bv.js → sync-manager-C_rxYFpb.js} +2 -2
  29. package/dist/assets/{sync-manager-B6kqa4bv.js.map → sync-manager-C_rxYFpb.js.map} +1 -1
  30. package/dist/index.html +7 -7
  31. package/dist/setup.html +9 -7
  32. package/dist/sw-pwa.js +2 -2
  33. package/dist/sw-pwa.js.map +1 -1
  34. package/package.json +15 -13
  35. package/dist/assets/chunk-7ZXdHUL4.js +0 -1
  36. package/dist/assets/html2canvas-BAfZNSwU.js +0 -6
  37. package/dist/assets/main-BqJjhM5z.js +0 -3
  38. package/dist/assets/main-BqJjhM5z.js.map +0 -1
  39. package/dist/assets/main-C8f1ieZL.js +0 -108
  40. package/dist/assets/main-C8f1ieZL.js.map +0 -1
  41. package/dist/assets/pdf-Bxz9Nzto.js.map +0 -1
  42. package/dist/assets/preload-helper-Chd9yIcd.js +0 -1
  43. package/dist/assets/src-B0l-hkrA.js +0 -3
  44. package/dist/assets/src-B0l-hkrA.js.map +0 -1
  45. package/dist/assets/src-CIERor10.js +0 -2
  46. package/dist/assets/src-Cvcg0wpA.js +0 -629
  47. package/dist/assets/src-Cvcg0wpA.js.map +0 -1
  48. package/dist/assets/src-DzgDstdA.js +0 -2
  49. package/dist/assets/src-GjeUdI7b.js +0 -16
  50. package/dist/assets/src-GjeUdI7b.js.map +0 -1
  51. /package/dist/assets/{modulepreload-polyfill-Cf3xff8G.js → modulepreload-polyfill-wMinxHhO.js} +0 -0
@@ -1,3 +1,3 @@
1
- import{n as e}from"./chunk-7ZXdHUL4.js";var t={name:`@xiboplayer/utils`,version:`0.7.20`,description:`Shared utilities for xiboplayer packages`,type:`module`,main:`./src/index.js`,types:`./src/index.d.ts`,exports:{".":`./src/index.js`,"./logger":`./src/logger.js`,"./event-emitter":`./src/event-emitter.js`,"./config":`./src/config.js`},scripts:{test:`vitest run`,"test:watch":`vitest`,"test:coverage":`vitest run --coverage`},dependencies:{"@xiboplayer/crypto":`workspace:*`},devDependencies:{vitest:`^4.1.2`},keywords:[`xibo`,`digital-signage`,`utilities`,`logger`,`event-emitter`],author:`Pau Aliagas <linuxnow@gmail.com>`,license:`AGPL-3.0-or-later`,repository:{type:`git`,url:`git+https://github.com/xibo-players/xiboplayer.git`,directory:`packages/utils`},homepage:`https://xiboplayer.org`},n={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},r=[],i=class{constructor(e,t=null){this.name=e,this.useGlobal=t===null,this.useGlobal||this.setLevel(t)}_ts(){let e=new Date;return`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}.${String(e.getMilliseconds()).padStart(3,`0`)}`}setLevel(e){this.useGlobal=!1,typeof e==`string`?this.level=n[e.toUpperCase()]??n.INFO:this.level=e}getEffectiveLevel(){return this.useGlobal?a.level:this.level}debug(...e){this.getEffectiveLevel()<=n.DEBUG&&console.log(`${this._ts()} [${this.name}] DEBUG:`,...e),p(`debug`,this.name,e)}info(...e){this.getEffectiveLevel()<=n.INFO&&console.log(`${this._ts()} [${this.name}]`,...e),p(`info`,this.name,e)}warn(...e){this.getEffectiveLevel()<=n.WARNING&&console.warn(`${this._ts()} [${this.name}]`,...e),p(`warning`,this.name,e)}error(...e){this.getEffectiveLevel()<=n.ERROR&&console.error(`${this._ts()} [${this.name}]`,...e),p(`error`,this.name,e)}log(e,...t){switch(e.toUpperCase()){case`DEBUG`:return this.debug(...t);case`INFO`:return this.info(...t);case`WARNING`:case`WARN`:return this.warn(...t);case`ERROR`:return this.error(...t)}}},a={level:n.WARNING,setGlobalLevel(e){typeof e==`string`?this.level=n[e.toUpperCase()]??n.INFO:this.level=e,console.log(`[Logger] Global log level set to: ${this.getLevelName(this.level)}`)},getLevelName(e){return Object.keys(n).find(t=>n[t]===e)||`UNKNOWN`}},o=!1;if(typeof window<`u`){let e=new URLSearchParams(window.location.search).get(`logLevel`),t=localStorage.getItem(`xibo_log_level`),n=null;try{n=JSON.parse(localStorage.getItem(`xibo_config`)||`{}`).logLevel||null}catch{}e?(a.setGlobalLevel(e),o=!0):t?(a.setGlobalLevel(t),o=!0):n?(a.setGlobalLevel(n),o=!0):a.setGlobalLevel(`WARNING`)}else typeof self<`u`&&self.swLogLevel&&a.setGlobalLevel(self.swLogLevel);function s(e,t=null){return new i(e,t)}function c(e){a.setGlobalLevel(e),typeof window<`u`&&localStorage.setItem(`xibo_log_level`,e.toUpperCase())}function l(){return a.getLevelName(a.level)}function u(){return a.level<=n.DEBUG}function d(e){if(o||!e)return!1;let t=f(e);return a.setGlobalLevel(t),!0}function f(e){switch((e||``).toLowerCase()){case`debug`:return`DEBUG`;case`info`:case`notice`:case`audit`:return`INFO`;case`warning`:return`WARNING`;case`error`:case`critical`:case`alert`:case`emergency`:return`ERROR`;default:return`INFO`}}function p(e,t,n){if(r.length!==0)for(let i of r)try{i({level:e,name:t,args:n})}catch{}}function m(e){r.push(e)}function h(e){let t=r.indexOf(e);t>=0&&r.splice(t,1)}var g=class{constructor(){this.events=new Map}on(e,t){this.events.has(e)||this.events.set(e,[]),this.events.get(e).push(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){if(!this.events.has(e))return;let n=this.events.get(e),r=n.indexOf(t);r!==-1&&n.splice(r,1)}emit(e,...t){if(!this.events.has(e))return;let n=this.events.get(e).slice();for(let r of n)try{r(...t)}catch(t){console.error(`[EventEmitter] Listener error on '${e}':`,t)}}removeAllListeners(e){e?this.events.delete(e):this.events.clear()}};function _(e,t){let n=new Uint8Array(e),r=``;for(let e=0;e<n.length;e++)r+=String.fromCharCode(n[e]);let i=btoa(r),a=[];for(let e=0;e<i.length;e+=64)a.push(i.substring(e,e+64));return`-----BEGIN ${t}-----\n${a.join(`
2
- `)}\n-----END ${t}-----`}async function v(){let e=await crypto.subtle.generateKey({name:`RSA-OAEP`,modulusLength:1024,publicExponent:new Uint8Array([1,0,1]),hash:`SHA-256`},!0,[`encrypt`,`decrypt`]),t=await crypto.subtle.exportKey(`spki`,e.publicKey),n=await crypto.subtle.exportKey(`pkcs8`,e.privateKey);return{publicKeyPem:_(t,`PUBLIC KEY`),privateKeyPem:_(n,`PRIVATE KEY`)}}function y(e){return!e||typeof e!=`string`?!1:/^-----BEGIN (PUBLIC KEY|PRIVATE KEY)-----\n[A-Za-z0-9+/=\n]+\n-----END \1-----$/.test(e.trim())}function b(e,t,n,r={}){return typeof indexedDB>`u`?Promise.reject(Error(`IndexedDB not available`)):new Promise((i,a)=>{let o=indexedDB.open(e,t);o.onupgradeneeded=()=>{let e=o.result;if(!e.objectStoreNames.contains(n)){let t=r.keyPath?{keyPath:r.keyPath,autoIncrement:!0}:void 0,i=e.createObjectStore(n,t);r.indexName&&r.indexKey&&i.createIndex(r.indexName,r.indexKey,{unique:!1})}},o.onsuccess=()=>i(o.result),o.onerror=()=>a(o.error)})}function x(e,t,n,r,i){return new Promise((a,o)=>{let s=e.transaction([t],`readonly`).objectStore(t).index(n).openCursor(r),c=[];s.onsuccess=e=>{let t=e.target.result;t&&c.length<i?(c.push(t.value),t.continue()):a(c)},s.onerror=()=>o(Error(`Index query failed: ${s.error}`))})}function S(e,t,n){return new Promise((r,i)=>{let a=e.transaction([t],`readwrite`),o=a.objectStore(t),s=0;for(let e of n)if(e){let t=o.delete(e);t.onsuccess=()=>{s++},t.onerror=()=>{}}a.oncomplete=()=>r(s),a.onerror=()=>i(Error(`Delete failed: ${a.error}`))})}var C=s(`Config`),w=`xibo_global`,T=`xibo_cms:`,E=`xibo_active_cms`,D=`xibo-hw-backup`,O=1,k=new Set([`hardwareKey`,`xmrPubKey`,`xmrPrivKey`]);function A(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);t>>>=0;let n=t+1234567;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t)+1,n+=(n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24);return n>>>=0,(t.toString(16).padStart(8,`0`)+n.toString(16).padStart(8,`0`)).substring(0,12)}function j(e){if(!e)return null;try{let t=new URL(e),n=t.origin;return`${t.hostname}-${A(n)}`}catch{return`unknown-${A(e)}`}}function M(){let e={},t={cmsUrl:e.CMS_URL||``,cmsKey:e.CMS_KEY||``,displayName:e.DISPLAY_NAME||``,hardwareKey:e.HARDWARE_KEY||``,xmrChannel:e.XMR_CHANNEL||``,googleGeoApiKey:e.GOOGLE_GEO_API_KEY||``};return Object.values(t).some(e=>e!==``)?t:null}var N=new class{constructor(){this._activeCmsId=null,this.data=this.load(),this._fromEnv||this._restoreHardwareKeyFromBackup()}load(){let e=M();return e?(this._fromEnv=!0,e):typeof localStorage>`u`?{cmsUrl:``,cmsKey:``,displayName:``,hardwareKey:``,xmrChannel:``}:localStorage.getItem(w)?this._loadSplit():this._loadFresh()}_loadSplit(){let e={};try{e=JSON.parse(localStorage.getItem(w)||`{}`)}catch(e){C.error(`Failed to parse xibo_global:`,e)}let t=localStorage.getItem(E)||null;this._activeCmsId=t;let n={};if(t)try{let e=localStorage.getItem(T+t);e&&(n=JSON.parse(e))}catch(e){C.error(`Failed to parse CMS config:`,e)}let r={...e,...n};return this._validateConfig(r)}_loadFresh(){return this._validateConfig({})}_validateConfig(e){let t=!1;return!e.hardwareKey||e.hardwareKey.length<10?(C.warn(`Missing/invalid hardwareKey — generating`),e.hardwareKey=this.generateStableHardwareKey(),this._backupHardwareKey(e.hardwareKey),t=!0):C.info(`✓ Loaded existing hardwareKey:`,e.hardwareKey),e.xmrChannel||(C.warn(`Missing xmrChannel — generating`),e.xmrChannel=this.generateXmrChannel(),t=!0),e.cmsUrl=e.cmsUrl||``,e.cmsKey=e.cmsKey||``,e.displayName=e.displayName||``,t&&typeof localStorage<`u`&&this._saveSplit(e),e}save(){typeof localStorage>`u`||this._saveSplit(this.data)}_saveSplit(e){if(typeof localStorage>`u`)return;let t={},n={};for(let[r,i]of Object.entries(e))k.has(r)?t[r]=i:n[r]=i;localStorage.setItem(w,JSON.stringify(t));let r=j(e.cmsUrl);r&&(localStorage.setItem(T+r,JSON.stringify(n)),localStorage.setItem(E,r),this._activeCmsId=r),localStorage.setItem(`xibo_config`,JSON.stringify(e))}switchCms(e){if(typeof localStorage>`u`)throw Error(`switchCms requires localStorage (browser only)`);this.save();let t=j(e);if(!t)throw Error(`Invalid CMS URL`);let n=localStorage.getItem(T+t),r={},i=!0;if(n)try{r=JSON.parse(n),i=!1,C.info(`Switching to existing CMS profile: ${t}`)}catch(e){C.error(`Failed to parse target CMS config:`,e)}else C.info(`Creating new CMS profile: ${t}`),r={cmsUrl:e,cmsKey:``,displayName:``,xmrChannel:this.generateXmrChannel()},localStorage.setItem(T+t,JSON.stringify(r));localStorage.setItem(E,t),this._activeCmsId=t;let a={};try{a=JSON.parse(localStorage.getItem(w)||`{}`)}catch{}return this.data={...a,...r},this.data.cmsUrl||(this.data.cmsUrl=e),{cmsId:t,isNew:i}}listCmsProfiles(){if(typeof localStorage>`u`)return[];let e=[],t=localStorage.getItem(E)||null;for(let n=0;n<localStorage.length;n++){let r=localStorage.key(n);if(!r.startsWith(T))continue;let i=r.slice(9);try{let n=JSON.parse(localStorage.getItem(r));e.push({cmsId:i,cmsUrl:n.cmsUrl||``,displayName:n.displayName||``,isActive:i===t})}catch{}}return e}get activeCmsId(){if(this._activeCmsId)return this._activeCmsId;let e=j(this.data?.cmsUrl);return this._activeCmsId=e,e}isConfigured(){return!!(this.data.cmsUrl&&this.data.cmsKey&&this.data.displayName)}async _backupKeys(e){try{let t=await b(D,O,`keys`),n=t.transaction(`keys`,`readwrite`),r=n.objectStore(`keys`);for(let[t,n]of Object.entries(e))r.put(n,t);n.oncomplete=()=>{C.info(`Keys backed up to IndexedDB:`,Object.keys(e).join(`, `)),t.close()}}catch{}}_backupHardwareKey(e){this._backupKeys({hardwareKey:e})}async _restoreHardwareKeyFromBackup(){try{let e=await b(D,O,`keys`),t=e.transaction(`keys`,`readonly`).objectStore(`keys`),n=await new Promise(e=>{let n=t.get(`hardwareKey`);n.onsuccess=()=>e(n.result),n.onerror=()=>e(null)});e.close(),n&&n!==this.data.hardwareKey?(C.info(`Restoring hardware key from IndexedDB backup:`,n),C.info(`(was:`,this.data.hardwareKey,`)`),this.data.hardwareKey=n,this.save()):!n&&this.data.hardwareKey&&this._backupHardwareKey(this.data.hardwareKey)}catch{}}generateStableHardwareKey(){if(typeof crypto<`u`&&crypto.randomUUID){let e=`pwa-`+crypto.randomUUID().replace(/-/g,``).substring(0,28);return C.info(`Generated new UUID-based hardware key:`,e),e}let e=`pwa-`+Array.from({length:28},()=>Math.floor(Math.random()*16).toString(16)).join(``);return C.info(`Generated new random hardware key:`,e),e}generateXmrChannel(){return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}async ensureXmrKeyPair(){if(this.data.xmrPubKey&&y(this.data.xmrPubKey))return;C.info(`Generating RSA key pair for XMR registration...`);let{publicKeyPem:e,privateKeyPem:t}=await v();this.data.xmrPubKey=e,this.data.xmrPrivKey=t,this.save(),typeof indexedDB<`u`&&this._backupKeys({xmrPubKey:e,xmrPrivKey:t}),C.info(`RSA key pair generated and saved`)}get cmsUrl(){return this.data.cmsUrl}set cmsUrl(e){this.data.cmsUrl=e,this.save()}get cmsKey(){return this.data.cmsKey}set cmsKey(e){this.data.cmsKey=e,this.save()}get displayName(){return this.data.displayName}set displayName(e){this.data.displayName=e,this.save()}get hardwareKey(){return this.data.hardwareKey||(C.error(`CRITICAL: hardwareKey missing! Generating emergency key.`),this.data.hardwareKey=this.generateStableHardwareKey(),this.save()),this.data.hardwareKey}get xmrChannel(){return this.data.xmrChannel||(C.warn(`xmrChannel missing at access time — generating`),this.data.xmrChannel=this.generateXmrChannel(),this.save()),this.data.xmrChannel}get xmrPubKey(){return this.data.xmrPubKey||``}get xmrPrivKey(){return this.data.xmrPrivKey||``}get googleGeoApiKey(){return this.data.googleGeoApiKey||``}set googleGeoApiKey(e){this.data.googleGeoApiKey=e,this.save()}get controls(){return this.data.controls||{}}get transport(){return this.data.transport||`auto`}get debug(){return this.data.debug||{}}},P={kioskMode:[`electron`,`chromium`],autoLaunch:[`electron`],allowShellCommands:[`electron`,`chromium`],browser:[`chromium`],extraBrowserFlags:[`chromium`]};function F(e,t){if(!e||!t)return;let n=t.toLowerCase();for(let[t,r]of Object.entries(P))t in e&&!r.includes(n)&&C.warn(`Key "${t}" is only supported on ${r.join(`/`)}, but current platform is ${n} — this key will be ignored`)}var I=new Set([`serverPort`,`kioskMode`,`fullscreen`,`hideMouseCursor`,`preventSleep`,`allowShellCommands`,`width`,`height`,`relaxSslCerts`]);function L(e,t){let n=new Set([...I,...t||[]]),r={};for(let[t,i]of Object.entries(e))n.has(t)||(r[t]=i);return Object.keys(r).length>0?r:void 0}var R=s(`FetchRetry`),z=3e4,B=12e4;function V(e){if(!e)return z;let t=Number(e);if(!isNaN(t)&&t>=0)return Math.min(t*1e3,B);let n=new Date(e);if(!isNaN(n.getTime())){let e=n.getTime()-Date.now();return Math.min(Math.max(e,0),B)}return z}async function H(e,t={},n={}){let{maxRetries:r=3,baseDelayMs:i=1e3,maxDelayMs:a=3e4}=n,o,s;for(let n=0;n<=r;n++){try{let i=await fetch(e,t);if(i.status===429){let e=V(i.headers.get(`Retry-After`));if(R.debug(`429 Rate limited, waiting ${e}ms (Retry-After: ${i.headers.get(`Retry-After`)})`),s=i,o=Error(`HTTP 429: Too Many Requests`),o.status=429,n<r){await new Promise(t=>setTimeout(t,e));continue}break}if(i.status<500)return i;if(s=i,o=Error(`HTTP ${i.status}: ${i.statusText}`),o.status=i.status,i.status===503&&n<r){let e=i.headers.get(`Retry-After`);if(e){let t=V(e);R.debug(`503 Service Unavailable, Retry-After: ${e} (${t}ms)`),await new Promise(e=>setTimeout(e,t));continue}}}catch(t){R.warn(`Fetch error (attempt ${n+1}/${r+1}):`,t.message||t,String(e).slice(0,80)),o=t,s=null}if(n<r){let t=Math.min(i*2**n,a)*(.5+Math.random()*.5);R.debug(`Retry ${n+1}/${r} in ${Math.round(t)}ms:`,String(e).slice(0,80)),await new Promise(e=>setTimeout(e,t))}}if(s)return s;throw o}var U=s(`CmsApi`),W=class{constructor({baseUrl:e,clientId:t,clientSecret:n,apiToken:r}={}){this.baseUrl=(e||``).replace(/\/+$/,``),this.clientId=t||null,this.clientSecret=n||null,this.accessToken=r||null,this.tokenExpiry=r?1/0:0}async authenticate(){U.info(`Authenticating with CMS API...`);let e=await fetch(`${this.baseUrl}/api/authorize/access_token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`client_credentials`,client_id:this.clientId,client_secret:this.clientSecret})});if(!e.ok){let t=await e.text();throw Error(`OAuth2 authentication failed (${e.status}): ${t}`)}let t=await e.json();return this.accessToken=t.access_token,this.tokenExpiry=Date.now()+(t.expires_in||3600)*1e3,U.info(`Authenticated successfully, token expires in`,t.expires_in,`s`),this.accessToken}async ensureToken(){if(!(this.accessToken&&Date.now()<this.tokenExpiry-6e4)){if(!this.clientId||!this.clientSecret){if(this.accessToken)return;throw new G(`AUTH`,`/authorize`,0,`No valid token and no OAuth2 credentials`)}await this.authenticate()}}async request(e,t,n={}){await this.ensureToken();let r=new URL(`${this.baseUrl}/api${t}`),i={method:e,headers:{Authorization:`Bearer ${this.accessToken}`}};if(e===`GET`)for(let[e,t]of Object.entries(n))t!=null&&r.searchParams.set(e,String(t));else i.headers[`Content-Type`]=`application/x-www-form-urlencoded`,i.body=new URLSearchParams(n);let a=await fetch(r,i);return a.ok||await this._handleErrorResponse(a,e,t),(a.headers.get(`Content-Type`)||``).includes(`application/json`)?a.json():null}get(e,t){return this.request(`GET`,e,t)}post(e,t){return this.request(`POST`,e,t)}put(e,t){return this.request(`PUT`,e,t)}del(e){return this.request(`DELETE`,e)}async _listRequest(e,t={}){let n=await this.request(`GET`,e,t);return Array.isArray(n)?n:[]}async _handleErrorResponse(e,t,n){let r=await e.text(),i;try{let e=JSON.parse(r);i=e.error?.message||e.message||r}catch{i=r}throw new G(t,n,e.status,i)}async findDisplay(e){U.info(`Looking up display by hardwareKey:`,e);let t=await this._listRequest(`/display`,{hardwareKey:e});if(t.length===0)return U.info(`No display found for hardwareKey:`,e),null;let n=t[0];return U.info(`Found display: ${n.display} (ID: ${n.displayId}, licensed: ${n.licensed})`),n}async authorizeDisplay(e){U.info(`Authorizing display:`,e),await this.request(`PUT`,`/display/authorise/${e}`),U.info(`Display authorized successfully`)}async editDisplay(e,t){return U.info(`Editing display:`,e,t),this.request(`PUT`,`/display/${e}`,t)}async listDisplays(e={}){return this._listRequest(`/display`,e)}async requestScreenshot(e){await this.request(`PUT`,`/display/requestscreenshot/${e}`)}async getDisplayStatus(e){return this.request(`GET`,`/display/status/${e}`)}async requestMultipart(e,t,n){await this.ensureToken();let r=`${this.baseUrl}/api${t}`,i=await fetch(r,{method:e,headers:{Authorization:`Bearer ${this.accessToken}`},body:n});return i.ok||await this._handleErrorResponse(i,e,t),(i.headers.get(`Content-Type`)||``).includes(`application/json`)?i.json():null}async createLayout({name:e,resolutionId:t,description:n}){let r={name:e,resolutionId:t};return n&&(r.description=n),this.request(`POST`,`/layout`,r)}async listLayouts(e={}){return this._listRequest(`/layout`,e)}async getLayout(e){return this.request(`GET`,`/layout/${e}`)}async deleteLayout(e){await this.request(`DELETE`,`/layout/${e}`)}async publishLayout(e){await this.request(`PUT`,`/layout/publish/${e}`,{publishNow:1})}async checkoutLayout(e){return this.request(`PUT`,`/layout/checkout/${e}`)}async getDraftLayout(e){let t=await this.listLayouts({parentId:e});return t.length>0?t[0]:null}async editLayoutBackground(e,t){return this.request(`PUT`,`/layout/background/${e}`,t)}async addRegion(e,t){return this.request(`POST`,`/region/${e}`,t)}async editRegion(e,t){return this.request(`PUT`,`/region/${e}`,t)}async deleteRegion(e){await this.request(`DELETE`,`/region/${e}`)}async addWidget(e,t,n={}){let{templateId:r,displayOrder:i,...a}=n,o={};r!==void 0&&(o.templateId=r),i!==void 0&&(o.displayOrder=i);let s=await this.request(`POST`,`/playlist/widget/${e}/${t}`,o);return Object.keys(a).length>0?(a.duration!==void 0&&a.useDuration===void 0&&(a.useDuration=1),this.request(`PUT`,`/playlist/widget/${s.widgetId}`,a)):s}async editWidget(e,t){return this.request(`PUT`,`/playlist/widget/${e}`,t)}async deleteWidget(e){await this.request(`DELETE`,`/playlist/widget/${e}`)}async uploadMedia(e){return this.requestMultipart(`POST`,`/library`,e)}async listMedia(e={}){return this._listRequest(`/library`,e)}async getMedia(e){return this.request(`GET`,`/library/${e}`)}async deleteMedia(e){await this.request(`DELETE`,`/library/${e}`)}async createCampaign(e){return this.request(`POST`,`/campaign`,{name:e})}async listCampaigns(e={}){return this._listRequest(`/campaign`,e)}async deleteCampaign(e){await this.request(`DELETE`,`/campaign/${e}`)}async assignLayoutToCampaign(e,t,n){let r={layoutId:t};n!==void 0&&(r.displayOrder=n),await this.request(`POST`,`/campaign/layout/assign/${e}`,r)}async createSchedule(e){let t={...e};Array.isArray(t.displayGroupIds)&&delete t.displayGroupIds,await this.ensureToken();let n=`${this.baseUrl}/api/schedule`,r=new URLSearchParams;for(let[e,n]of Object.entries(t))n!=null&&r.set(e,String(n));if(Array.isArray(e.displayGroupIds))for(let t of e.displayGroupIds)r.append(`displayGroupIds[]`,String(t));let i=await fetch(n,{method:`POST`,headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":`application/x-www-form-urlencoded`},body:r});if(!i.ok){let e=await i.text();throw Error(`CMS API POST /schedule failed (${i.status}): ${e}`)}return(i.headers.get(`Content-Type`)||``).includes(`application/json`)?i.json():null}async deleteSchedule(e){await this.request(`DELETE`,`/schedule/${e}`)}async listSchedules(e={}){let t=await this.request(`GET`,`/schedule/data/events`,e);return Array.isArray(t)?t:t?.events||[]}async listDisplayGroups(e={}){return this._listRequest(`/displaygroup`,e)}async createDisplayGroup(e,t){let n={displayGroup:e};return t&&(n.description=t),this.request(`POST`,`/displaygroup`,n)}async deleteDisplayGroup(e){await this.request(`DELETE`,`/displaygroup/${e}`)}async assignDisplayToGroup(e,t){await this.ensureToken();let n=`${this.baseUrl}/api/displaygroup/${e}/display/assign`,r=new URLSearchParams;r.append(`displayId[]`,String(t));let i=await fetch(n,{method:`POST`,headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":`application/x-www-form-urlencoded`},body:r});if(!i.ok){let e=await i.text();throw Error(`CMS API assign display to group failed (${i.status}): ${e}`)}}async unassignDisplayFromGroup(e,t){await this.ensureToken();let n=`${this.baseUrl}/api/displaygroup/${e}/display/unassign`,r=new URLSearchParams;r.append(`displayId[]`,String(t));let i=await fetch(n,{method:`POST`,headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":`application/x-www-form-urlencoded`},body:r});if(!i.ok){let e=await i.text();throw Error(`CMS API unassign display from group failed (${i.status}): ${e}`)}}async listResolutions(){return this._listRequest(`/resolution`)}async listTemplates(e={}){return this._listRequest(`/template`,e)}async assignMediaToPlaylist(e,t){let n=Array.isArray(t)?t:[t];await this.ensureToken();let r=`${this.baseUrl}/api/playlist/library/assign/${e}`,i=new URLSearchParams;for(let e of n)i.append(`media[]`,String(e));let a=await fetch(r,{method:`POST`,headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":`application/x-www-form-urlencoded`},body:i});if(!a.ok){let t=await a.text();throw new G(`POST`,`/playlist/library/assign/${e}`,a.status,t)}return(a.headers.get(`Content-Type`)||``).includes(`application/json`)?a.json():null}async editLayout(e,t){return this.request(`PUT`,`/layout/${e}`,t)}async copyLayout(e,t={}){return this.post(`/layout/copy/${e}`,t)}async discardLayout(e){await this.put(`/layout/discard/${e}`)}async editCampaign(e,t){return this.put(`/campaign/${e}`,t)}async getCampaign(e){return this.get(`/campaign/${e}`)}async unassignLayoutFromCampaign(e,t){await this.post(`/campaign/layout/unassign/${e}`,{layoutId:t})}async editSchedule(e,t){return this.put(`/schedule/${e}`,t)}async retireLayout(e){await this.put(`/layout/retire/${e}`)}async unretireLayout(e){await this.put(`/layout/unretire/${e}`)}async getLayoutStatus(e){return this.get(`/layout/status/${e}`)}async tagLayout(e,t){await this.post(`/layout/${e}/tag`,{tag:t.join(`,`)})}async untagLayout(e,t){await this.post(`/layout/${e}/untag`,{tag:t.join(`,`)})}async listCommands(e={}){return this._listRequest(`/command`,e)}async createCommand(e){return this.post(`/command`,e)}async editCommand(e,t){return this.put(`/command/${e}`,t)}async deleteCommand(e){await this.del(`/command/${e}`)}async deleteDisplay(e){await this.del(`/display/${e}`)}async wolDisplay(e){await this.post(`/display/wol/${e}`)}async setDefaultLayout(e,t){return this.put(`/display/${e}`,{defaultLayoutId:t})}async purgeDisplay(e){await this.post(`/display/purge/${e}`)}async listDayParts(e={}){return this._listRequest(`/daypart`,e)}async createDayPart(e){return this.post(`/daypart`,e)}async editDayPart(e,t){return this.put(`/daypart/${e}`,t)}async deleteDayPart(e){await this.del(`/daypart/${e}`)}async uploadMediaUrl(e,t,n={}){return this.post(`/library/uploadUrl`,{url:e,type:t,...n})}async copyMedia(e){return this.post(`/library/copy/${e}`)}async downloadMedia(e){await this.ensureToken();let t=`${this.baseUrl}/api/library/download/${e}`,n=await fetch(t,{headers:{Authorization:`Bearer ${this.accessToken}`}});if(!n.ok){let t=await n.text();throw new G(`GET`,`/library/download/${e}`,n.status,t)}return n}async editMedia(e,t){return this.put(`/library/${e}`,t)}async getMediaUsage(e){return this.get(`/library/usage/${e}`)}async tidyLibrary(){await this.post(`/library/tidy`)}async listPlaylists(e={}){return this._listRequest(`/playlist`,e)}async createPlaylist(e){return this.post(`/playlist`,{name:e})}async getPlaylist(e){return this.get(`/playlist/${e}`)}async editPlaylist(e,t){return this.put(`/playlist/${e}`,t)}async deletePlaylist(e){await this.del(`/playlist/${e}`)}async reorderPlaylist(e,t){await this.ensureToken();let n=`${this.baseUrl}/api/playlist/order/${e}`,r=new URLSearchParams;for(let e of t)r.append(`widgets[]`,String(e));let i=await fetch(n,{method:`POST`,headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":`application/x-www-form-urlencoded`},body:r});if(!i.ok){let t=await i.text();throw new G(`POST`,`/playlist/order/${e}`,i.status,t)}}async copyPlaylist(e){return this.post(`/playlist/copy/${e}`)}async setWidgetTransition(e,t,n={}){return this.put(`/playlist/widget/transition/${e}`,{type:t,...n})}async setWidgetAudio(e,t){return this.put(`/playlist/widget/${e}/audio`,t)}async removeWidgetAudio(e){await this.del(`/playlist/widget/${e}/audio`)}async setWidgetExpiry(e,t){return this.put(`/playlist/widget/${e}/expiry`,t)}async saveAsTemplate(e,t){return this.post(`/template/${e}`,t)}async getTemplate(e){return this.get(`/template/${e}`)}async deleteTemplate(e){await this.del(`/template/${e}`)}async listDatasets(e={}){return this._listRequest(`/dataset`,e)}async createDataset(e){return this.post(`/dataset`,e)}async editDataset(e,t){return this.put(`/dataset/${e}`,t)}async deleteDataset(e){await this.del(`/dataset/${e}`)}async listDatasetColumns(e){return this._listRequest(`/dataset/${e}/column`)}async createDatasetColumn(e,t){return this.post(`/dataset/${e}/column`,t)}async editDatasetColumn(e,t,n){return this.put(`/dataset/${e}/column/${t}`,n)}async deleteDatasetColumn(e,t){await this.del(`/dataset/${e}/column/${t}`)}async listDatasetData(e,t={}){return this._listRequest(`/dataset/data/${e}`,t)}async addDatasetRow(e,t){return this.post(`/dataset/data/${e}`,t)}async editDatasetRow(e,t,n){return this.put(`/dataset/data/${e}/${t}`,n)}async deleteDatasetRow(e,t){await this.del(`/dataset/data/${e}/${t}`)}async importDatasetCsv(e,t){return this.requestMultipart(`POST`,`/dataset/import/${e}`,t)}async clearDataset(e){await this.del(`/dataset/data/${e}`)}async listNotifications(e={}){return this._listRequest(`/notification`,e)}async createNotification(e){return this.post(`/notification`,e)}async editNotification(e,t){return this.put(`/notification/${e}`,t)}async deleteNotification(e){await this.del(`/notification/${e}`)}async listFolders(e={}){return this._listRequest(`/folder`,e)}async createFolder(e){return this.post(`/folder`,e)}async editFolder(e,t){return this.put(`/folder/${e}`,t)}async deleteFolder(e){await this.del(`/folder/${e}`)}async listTags(e={}){return this._listRequest(`/tag`,e)}async createTag(e){return this.post(`/tag`,e)}async editTag(e,t){return this.put(`/tag/${e}`,t)}async deleteTag(e){await this.del(`/tag/${e}`)}async tagEntity(e,t,n){await this.post(`/${e}/${t}/tag`,{tag:n.join(`,`)})}async untagEntity(e,t,n){await this.post(`/${e}/${t}/untag`,{tag:n.join(`,`)})}async dgChangeLayout(e,t){await this.post(`/displaygroup/${e}/action/changeLayout`,{layoutId:t})}async dgOverlayLayout(e,t){await this.post(`/displaygroup/${e}/action/overlayLayout`,{layoutId:t})}async dgRevertToSchedule(e){await this.post(`/displaygroup/${e}/action/revertToSchedule`)}async dgCollectNow(e){await this.post(`/displaygroup/${e}/action/collectNow`)}async dgSendCommand(e,t){await this.post(`/displaygroup/${e}/action/command`,{commandId:t})}async editDisplayGroup(e,t){return this.put(`/displaygroup/${e}`,t)}},G=class extends Error{constructor(e,t,n,r){super(`CMS API ${e} ${t} → ${n}: ${r}`),this.name=`CmsApiError`,this.method=e,this.path=t,this.status=n,this.detail=r}},K=e({CmsApiClient:()=>W,CmsApiError:()=>G,EventEmitter:()=>g,LOG_LEVELS:()=>n,PLAYER_API:()=>Y,SHELL_ONLY_KEYS:()=>I,VERSION:()=>q,applyCmsLogLevel:()=>d,computeCmsId:()=>j,config:()=>N,createLogger:()=>s,deleteByIds:()=>S,extractPwaConfig:()=>L,fetchWithRetry:()=>H,getLogLevel:()=>l,isDebug:()=>u,mapCmsLogLevel:()=>f,openIDB:()=>b,queryByIndex:()=>x,registerLogSink:()=>m,setLogLevel:()=>c,setPlayerApi:()=>X,unregisterLogSink:()=>h,warnPlatformMismatch:()=>F}),q=t.version,J=N.data?.playerApiBase||`/player/api/v2`,Y=J;function X(e){J=e.replace(/\/+$/,``),Y=J}export{S as a,g as c,u as d,m as f,N as i,d as l,K as n,b as o,H as r,x as s,Y as t,s as u};
3
- //# sourceMappingURL=src-Bzheh5E2.js.map
1
+ var e={name:`@xiboplayer/utils`,version:`0.7.15`,description:`Shared utilities for xiboplayer packages`,type:`module`,main:`./src/index.js`,types:`./src/index.d.ts`,exports:{".":`./src/index.js`,"./logger":`./src/logger.js`,"./event-emitter":`./src/event-emitter.js`,"./config":`./src/config.js`},scripts:{test:`vitest run`,"test:watch":`vitest`,"test:coverage":`vitest run --coverage`},dependencies:{"@xiboplayer/crypto":`workspace:*`},devDependencies:{vitest:`^4.1.2`},keywords:[`xibo`,`digital-signage`,`utilities`,`logger`,`event-emitter`],author:`Pau Aliagas <linuxnow@gmail.com>`,license:`AGPL-3.0-or-later`,repository:{type:`git`,url:`git+https://github.com/xibo-players/xiboplayer.git`,directory:`packages/utils`},homepage:`https://xiboplayer.org`},t={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},n=[],r=class{constructor(e,t=null){this.name=e,this.useGlobal=t===null,this.useGlobal||this.setLevel(t)}_ts(){let e=new Date;return`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}.${String(e.getMilliseconds()).padStart(3,`0`)}`}setLevel(e){this.useGlobal=!1,typeof e==`string`?this.level=t[e.toUpperCase()]??t.INFO:this.level=e}getEffectiveLevel(){return this.useGlobal?i.level:this.level}debug(...e){this.getEffectiveLevel()<=t.DEBUG&&console.log(`${this._ts()} [${this.name}] DEBUG:`,...e),f(`debug`,this.name,e)}info(...e){this.getEffectiveLevel()<=t.INFO&&console.log(`${this._ts()} [${this.name}]`,...e),f(`info`,this.name,e)}warn(...e){this.getEffectiveLevel()<=t.WARNING&&console.warn(`${this._ts()} [${this.name}]`,...e),f(`warning`,this.name,e)}error(...e){this.getEffectiveLevel()<=t.ERROR&&console.error(`${this._ts()} [${this.name}]`,...e),f(`error`,this.name,e)}log(e,...t){switch(e.toUpperCase()){case`DEBUG`:return this.debug(...t);case`INFO`:return this.info(...t);case`WARNING`:case`WARN`:return this.warn(...t);case`ERROR`:return this.error(...t)}}},i={level:t.WARNING,setGlobalLevel(e){typeof e==`string`?this.level=t[e.toUpperCase()]??t.INFO:this.level=e,console.log(`[Logger] Global log level set to: ${this.getLevelName(this.level)}`)},getLevelName(e){return Object.keys(t).find(n=>t[n]===e)||`UNKNOWN`}},a=!1;if(typeof window<`u`){let e=new URLSearchParams(window.location.search).get(`logLevel`),t=localStorage.getItem(`xibo_log_level`),n=null;try{n=JSON.parse(localStorage.getItem(`xibo_config`)||`{}`).logLevel||null}catch{}e?(i.setGlobalLevel(e),a=!0):t?(i.setGlobalLevel(t),a=!0):n?(i.setGlobalLevel(n),a=!0):i.setGlobalLevel(`WARNING`)}else typeof self<`u`&&self.swLogLevel&&i.setGlobalLevel(self.swLogLevel);function o(e,t=null){return new r(e,t)}function s(e){i.setGlobalLevel(e),typeof window<`u`&&localStorage.setItem(`xibo_log_level`,e.toUpperCase())}function c(){return i.getLevelName(i.level)}function l(){return i.level<=t.DEBUG}function u(e){if(a||!e)return!1;let t=d(e);return i.setGlobalLevel(t),!0}function d(e){switch((e||``).toLowerCase()){case`debug`:return`DEBUG`;case`info`:case`notice`:case`audit`:return`INFO`;case`warning`:return`WARNING`;case`error`:case`critical`:case`alert`:case`emergency`:return`ERROR`;default:return`INFO`}}function f(e,t,r){if(n.length!==0)for(let i of n)try{i({level:e,name:t,args:r})}catch{}}function p(e){n.push(e)}function m(e){let t=n.indexOf(e);t>=0&&n.splice(t,1)}var h=class{constructor(){this.events=new Map}on(e,t){this.events.has(e)||this.events.set(e,[]),this.events.get(e).push(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){if(!this.events.has(e))return;let n=this.events.get(e),r=n.indexOf(t);r!==-1&&n.splice(r,1)}emit(e,...t){if(!this.events.has(e))return;let n=this.events.get(e).slice();for(let r of n)try{r(...t)}catch(t){console.error(`[EventEmitter] Listener error on '${e}':`,t)}}removeAllListeners(e){e?this.events.delete(e):this.events.clear()}};function g(e,t){let n=new Uint8Array(e),r=``;for(let e=0;e<n.length;e++)r+=String.fromCharCode(n[e]);let i=btoa(r),a=[];for(let e=0;e<i.length;e+=64)a.push(i.substring(e,e+64));return`-----BEGIN ${t}-----\n${a.join(`
2
+ `)}\n-----END ${t}-----`}async function _(){let e=await crypto.subtle.generateKey({name:`RSA-OAEP`,modulusLength:1024,publicExponent:new Uint8Array([1,0,1]),hash:`SHA-256`},!0,[`encrypt`,`decrypt`]),t=await crypto.subtle.exportKey(`spki`,e.publicKey),n=await crypto.subtle.exportKey(`pkcs8`,e.privateKey);return{publicKeyPem:g(t,`PUBLIC KEY`),privateKeyPem:g(n,`PRIVATE KEY`)}}function v(e){return!e||typeof e!=`string`?!1:/^-----BEGIN (PUBLIC KEY|PRIVATE KEY)-----\n[A-Za-z0-9+/=\n]+\n-----END \1-----$/.test(e.trim())}function y(e,t,n,r={}){return typeof indexedDB>`u`?Promise.reject(Error(`IndexedDB not available`)):new Promise((i,a)=>{let o=indexedDB.open(e,t);o.onupgradeneeded=()=>{let e=o.result;if(!e.objectStoreNames.contains(n)){let t=r.keyPath?{keyPath:r.keyPath,autoIncrement:!0}:void 0,i=e.createObjectStore(n,t);r.indexName&&r.indexKey&&i.createIndex(r.indexName,r.indexKey,{unique:!1})}},o.onsuccess=()=>i(o.result),o.onerror=()=>a(o.error)})}function b(e,t,n,r,i){return new Promise((a,o)=>{let s=e.transaction([t],`readonly`).objectStore(t).index(n).openCursor(r),c=[];s.onsuccess=e=>{let t=e.target.result;t&&c.length<i?(c.push(t.value),t.continue()):a(c)},s.onerror=()=>o(Error(`Index query failed: ${s.error}`))})}function x(e,t,n){return new Promise((r,i)=>{let a=e.transaction([t],`readwrite`),o=a.objectStore(t),s=0;for(let e of n)if(e){let t=o.delete(e);t.onsuccess=()=>{s++},t.onerror=()=>{}}a.oncomplete=()=>r(s),a.onerror=()=>i(Error(`Delete failed: ${a.error}`))})}var S=o(`Config`),C=`xibo_global`,w=`xibo_cms:`,T=`xibo_active_cms`,E=`xibo-hw-backup`,D=1,O=new Set([`hardwareKey`,`xmrPubKey`,`xmrPrivKey`]);function k(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);t>>>=0;let n=t+1234567;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t)+1,n+=(n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24);return n>>>=0,(t.toString(16).padStart(8,`0`)+n.toString(16).padStart(8,`0`)).substring(0,12)}function A(e){if(!e)return null;try{let t=new URL(e),n=t.origin;return`${t.hostname}-${k(n)}`}catch{return`unknown-${k(e)}`}}function j(){let e={},t={cmsUrl:e.CMS_URL||``,cmsKey:e.CMS_KEY||``,displayName:e.DISPLAY_NAME||``,hardwareKey:e.HARDWARE_KEY||``,xmrChannel:e.XMR_CHANNEL||``,googleGeoApiKey:e.GOOGLE_GEO_API_KEY||``};return Object.values(t).some(e=>e!==``)?t:null}var M=new class{constructor(){this._activeCmsId=null,this.data=this.load(),this._fromEnv||this._restoreHardwareKeyFromBackup()}load(){let e=j();return e?(this._fromEnv=!0,e):typeof localStorage>`u`?{cmsUrl:``,cmsKey:``,displayName:``,hardwareKey:``,xmrChannel:``}:localStorage.getItem(C)?this._loadSplit():this._loadFresh()}_loadSplit(){let e={};try{e=JSON.parse(localStorage.getItem(C)||`{}`)}catch(e){S.error(`Failed to parse xibo_global:`,e)}let t=localStorage.getItem(T)||null;this._activeCmsId=t;let n={};if(t)try{let e=localStorage.getItem(w+t);e&&(n=JSON.parse(e))}catch(e){S.error(`Failed to parse CMS config:`,e)}let r={...e,...n};return this._validateConfig(r)}_loadFresh(){return this._validateConfig({})}_validateConfig(e){let t=!1;return!e.hardwareKey||e.hardwareKey.length<10?(S.warn(`Missing/invalid hardwareKey — generating`),e.hardwareKey=this.generateStableHardwareKey(),this._backupHardwareKey(e.hardwareKey),t=!0):S.info(`✓ Loaded existing hardwareKey:`,e.hardwareKey),e.xmrChannel||(S.warn(`Missing xmrChannel — generating`),e.xmrChannel=this.generateXmrChannel(),t=!0),e.cmsUrl=e.cmsUrl||``,e.cmsKey=e.cmsKey||``,e.displayName=e.displayName||``,t&&typeof localStorage<`u`&&this._saveSplit(e),e}save(){typeof localStorage>`u`||this._saveSplit(this.data)}_saveSplit(e){if(typeof localStorage>`u`)return;let t={},n={};for(let[r,i]of Object.entries(e))O.has(r)?t[r]=i:n[r]=i;localStorage.setItem(C,JSON.stringify(t));let r=A(e.cmsUrl);r&&(localStorage.setItem(w+r,JSON.stringify(n)),localStorage.setItem(T,r),this._activeCmsId=r),localStorage.setItem(`xibo_config`,JSON.stringify(e))}switchCms(e){if(typeof localStorage>`u`)throw Error(`switchCms requires localStorage (browser only)`);this.save();let t=A(e);if(!t)throw Error(`Invalid CMS URL`);let n=localStorage.getItem(w+t),r={},i=!0;if(n)try{r=JSON.parse(n),i=!1,S.info(`Switching to existing CMS profile: ${t}`)}catch(e){S.error(`Failed to parse target CMS config:`,e)}else S.info(`Creating new CMS profile: ${t}`),r={cmsUrl:e,cmsKey:``,displayName:``,xmrChannel:this.generateXmrChannel()},localStorage.setItem(w+t,JSON.stringify(r));localStorage.setItem(T,t),this._activeCmsId=t;let a={};try{a=JSON.parse(localStorage.getItem(C)||`{}`)}catch{}return this.data={...a,...r},this.data.cmsUrl||(this.data.cmsUrl=e),{cmsId:t,isNew:i}}listCmsProfiles(){if(typeof localStorage>`u`)return[];let e=[],t=localStorage.getItem(T)||null;for(let n=0;n<localStorage.length;n++){let r=localStorage.key(n);if(!r.startsWith(w))continue;let i=r.slice(9);try{let n=JSON.parse(localStorage.getItem(r));e.push({cmsId:i,cmsUrl:n.cmsUrl||``,displayName:n.displayName||``,isActive:i===t})}catch{}}return e}get activeCmsId(){if(this._activeCmsId)return this._activeCmsId;let e=A(this.data?.cmsUrl);return this._activeCmsId=e,e}isConfigured(){return!!(this.data.cmsUrl&&this.data.cmsKey&&this.data.displayName)}async _backupKeys(e){try{let t=await y(E,D,`keys`),n=t.transaction(`keys`,`readwrite`),r=n.objectStore(`keys`);for(let[t,n]of Object.entries(e))r.put(n,t);n.oncomplete=()=>{S.info(`Keys backed up to IndexedDB:`,Object.keys(e).join(`, `)),t.close()}}catch{}}_backupHardwareKey(e){this._backupKeys({hardwareKey:e})}async _restoreHardwareKeyFromBackup(){try{let e=await y(E,D,`keys`),t=e.transaction(`keys`,`readonly`).objectStore(`keys`),n=await new Promise(e=>{let n=t.get(`hardwareKey`);n.onsuccess=()=>e(n.result),n.onerror=()=>e(null)});e.close(),n&&n!==this.data.hardwareKey?(S.info(`Restoring hardware key from IndexedDB backup:`,n),S.info(`(was:`,this.data.hardwareKey,`)`),this.data.hardwareKey=n,this.save()):!n&&this.data.hardwareKey&&this._backupHardwareKey(this.data.hardwareKey)}catch{}}generateStableHardwareKey(){if(typeof crypto<`u`&&crypto.randomUUID){let e=`pwa-`+crypto.randomUUID().replace(/-/g,``).substring(0,28);return S.info(`Generated new UUID-based hardware key:`,e),e}let e=`pwa-`+Array.from({length:28},()=>Math.floor(Math.random()*16).toString(16)).join(``);return S.info(`Generated new random hardware key:`,e),e}generateXmrChannel(){return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}async ensureXmrKeyPair(){if(this.data.xmrPubKey&&v(this.data.xmrPubKey))return;S.info(`Generating RSA key pair for XMR registration...`);let{publicKeyPem:e,privateKeyPem:t}=await _();this.data.xmrPubKey=e,this.data.xmrPrivKey=t,this.save(),typeof indexedDB<`u`&&this._backupKeys({xmrPubKey:e,xmrPrivKey:t}),S.info(`RSA key pair generated and saved`)}get cmsUrl(){return this.data.cmsUrl}set cmsUrl(e){this.data.cmsUrl=e,this.save()}get cmsKey(){return this.data.cmsKey}set cmsKey(e){this.data.cmsKey=e,this.save()}get displayName(){return this.data.displayName}set displayName(e){this.data.displayName=e,this.save()}get hardwareKey(){return this.data.hardwareKey||(S.error(`CRITICAL: hardwareKey missing! Generating emergency key.`),this.data.hardwareKey=this.generateStableHardwareKey(),this.save()),this.data.hardwareKey}get xmrChannel(){return this.data.xmrChannel||(S.warn(`xmrChannel missing at access time — generating`),this.data.xmrChannel=this.generateXmrChannel(),this.save()),this.data.xmrChannel}get xmrPubKey(){return this.data.xmrPubKey||``}get xmrPrivKey(){return this.data.xmrPrivKey||``}get googleGeoApiKey(){return this.data.googleGeoApiKey||``}set googleGeoApiKey(e){this.data.googleGeoApiKey=e,this.save()}get controls(){return this.data.controls||{}}get transport(){return this.data.transport||`auto`}get debug(){return this.data.debug||{}}},N={kioskMode:[`electron`,`chromium`],autoLaunch:[`electron`],allowShellCommands:[`electron`,`chromium`],browser:[`chromium`],extraBrowserFlags:[`chromium`]};function P(e,t){if(!e||!t)return;let n=t.toLowerCase();for(let[t,r]of Object.entries(N))t in e&&!r.includes(n)&&S.warn(`Key "${t}" is only supported on ${r.join(`/`)}, but current platform is ${n} — this key will be ignored`)}var F=new Set([`serverPort`,`kioskMode`,`fullscreen`,`hideMouseCursor`,`preventSleep`,`allowShellCommands`,`width`,`height`,`relaxSslCerts`]);function I(e,t){let n=new Set([...F,...t||[]]),r={};for(let[t,i]of Object.entries(e))n.has(t)||(r[t]=i);return Object.keys(r).length>0?r:void 0}var L=o(`FetchRetry`),R=3e4,z=12e4;function B(e){if(!e)return R;let t=Number(e);if(!isNaN(t)&&t>=0)return Math.min(t*1e3,z);let n=new Date(e);if(!isNaN(n.getTime())){let e=n.getTime()-Date.now();return Math.min(Math.max(e,0),z)}return R}async function V(e,t={},n={}){let{maxRetries:r=3,baseDelayMs:i=1e3,maxDelayMs:a=3e4}=n,o,s;for(let n=0;n<=r;n++){try{let i=await fetch(e,t);if(i.status===429){let e=B(i.headers.get(`Retry-After`));if(L.debug(`429 Rate limited, waiting ${e}ms (Retry-After: ${i.headers.get(`Retry-After`)})`),s=i,o=Error(`HTTP 429: Too Many Requests`),o.status=429,n<r){await new Promise(t=>setTimeout(t,e));continue}break}if(i.status<500)return i;if(s=i,o=Error(`HTTP ${i.status}: ${i.statusText}`),o.status=i.status,i.status===503&&n<r){let e=i.headers.get(`Retry-After`);if(e){let t=B(e);L.debug(`503 Service Unavailable, Retry-After: ${e} (${t}ms)`),await new Promise(e=>setTimeout(e,t));continue}}}catch(t){L.warn(`Fetch error (attempt ${n+1}/${r+1}):`,t.message||t,String(e).slice(0,80)),o=t,s=null}if(n<r){let t=Math.min(i*2**n,a)*(.5+Math.random()*.5);L.debug(`Retry ${n+1}/${r} in ${Math.round(t)}ms:`,String(e).slice(0,80)),await new Promise(e=>setTimeout(e,t))}}if(s)return s;throw o}var H=o(`CmsApi`),U=class{constructor({baseUrl:e,clientId:t,clientSecret:n,apiToken:r}={}){this.baseUrl=(e||``).replace(/\/+$/,``),this.clientId=t||null,this.clientSecret=n||null,this.accessToken=r||null,this.tokenExpiry=r?1/0:0}async authenticate(){H.info(`Authenticating with CMS API...`);let e=await fetch(`${this.baseUrl}/api/authorize/access_token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`client_credentials`,client_id:this.clientId,client_secret:this.clientSecret})});if(!e.ok){let t=await e.text();throw Error(`OAuth2 authentication failed (${e.status}): ${t}`)}let t=await e.json();return this.accessToken=t.access_token,this.tokenExpiry=Date.now()+(t.expires_in||3600)*1e3,H.info(`Authenticated successfully, token expires in`,t.expires_in,`s`),this.accessToken}async ensureToken(){if(!(this.accessToken&&Date.now()<this.tokenExpiry-6e4)){if(!this.clientId||!this.clientSecret){if(this.accessToken)return;throw new W(`AUTH`,`/authorize`,0,`No valid token and no OAuth2 credentials`)}await this.authenticate()}}async request(e,t,n={}){await this.ensureToken();let r=new URL(`${this.baseUrl}/api${t}`),i={method:e,headers:{Authorization:`Bearer ${this.accessToken}`}};if(e===`GET`)for(let[e,t]of Object.entries(n))t!=null&&r.searchParams.set(e,String(t));else i.headers[`Content-Type`]=`application/x-www-form-urlencoded`,i.body=new URLSearchParams(n);let a=await fetch(r,i);return a.ok||await this._handleErrorResponse(a,e,t),(a.headers.get(`Content-Type`)||``).includes(`application/json`)?a.json():null}get(e,t){return this.request(`GET`,e,t)}post(e,t){return this.request(`POST`,e,t)}put(e,t){return this.request(`PUT`,e,t)}del(e){return this.request(`DELETE`,e)}async _listRequest(e,t={}){let n=await this.request(`GET`,e,t);return Array.isArray(n)?n:[]}async _handleErrorResponse(e,t,n){let r=await e.text(),i;try{let e=JSON.parse(r);i=e.error?.message||e.message||r}catch{i=r}throw new W(t,n,e.status,i)}async findDisplay(e){H.info(`Looking up display by hardwareKey:`,e);let t=await this._listRequest(`/display`,{hardwareKey:e});if(t.length===0)return H.info(`No display found for hardwareKey:`,e),null;let n=t[0];return H.info(`Found display: ${n.display} (ID: ${n.displayId}, licensed: ${n.licensed})`),n}async authorizeDisplay(e){H.info(`Authorizing display:`,e),await this.request(`PUT`,`/display/authorise/${e}`),H.info(`Display authorized successfully`)}async editDisplay(e,t){return H.info(`Editing display:`,e,t),this.request(`PUT`,`/display/${e}`,t)}async listDisplays(e={}){return this._listRequest(`/display`,e)}async requestScreenshot(e){await this.request(`PUT`,`/display/requestscreenshot/${e}`)}async getDisplayStatus(e){return this.request(`GET`,`/display/status/${e}`)}async requestMultipart(e,t,n){await this.ensureToken();let r=`${this.baseUrl}/api${t}`,i=await fetch(r,{method:e,headers:{Authorization:`Bearer ${this.accessToken}`},body:n});return i.ok||await this._handleErrorResponse(i,e,t),(i.headers.get(`Content-Type`)||``).includes(`application/json`)?i.json():null}async createLayout({name:e,resolutionId:t,description:n}){let r={name:e,resolutionId:t};return n&&(r.description=n),this.request(`POST`,`/layout`,r)}async listLayouts(e={}){return this._listRequest(`/layout`,e)}async getLayout(e){return this.request(`GET`,`/layout/${e}`)}async deleteLayout(e){await this.request(`DELETE`,`/layout/${e}`)}async publishLayout(e){await this.request(`PUT`,`/layout/publish/${e}`,{publishNow:1})}async checkoutLayout(e){return this.request(`PUT`,`/layout/checkout/${e}`)}async getDraftLayout(e){let t=await this.listLayouts({parentId:e});return t.length>0?t[0]:null}async editLayoutBackground(e,t){return this.request(`PUT`,`/layout/background/${e}`,t)}async addRegion(e,t){return this.request(`POST`,`/region/${e}`,t)}async editRegion(e,t){return this.request(`PUT`,`/region/${e}`,t)}async deleteRegion(e){await this.request(`DELETE`,`/region/${e}`)}async addWidget(e,t,n={}){let{templateId:r,displayOrder:i,...a}=n,o={};r!==void 0&&(o.templateId=r),i!==void 0&&(o.displayOrder=i);let s=await this.request(`POST`,`/playlist/widget/${e}/${t}`,o);return Object.keys(a).length>0?(a.duration!==void 0&&a.useDuration===void 0&&(a.useDuration=1),this.request(`PUT`,`/playlist/widget/${s.widgetId}`,a)):s}async editWidget(e,t){return this.request(`PUT`,`/playlist/widget/${e}`,t)}async deleteWidget(e){await this.request(`DELETE`,`/playlist/widget/${e}`)}async uploadMedia(e){return this.requestMultipart(`POST`,`/library`,e)}async listMedia(e={}){return this._listRequest(`/library`,e)}async getMedia(e){return this.request(`GET`,`/library/${e}`)}async deleteMedia(e){await this.request(`DELETE`,`/library/${e}`)}async createCampaign(e){return this.request(`POST`,`/campaign`,{name:e})}async listCampaigns(e={}){return this._listRequest(`/campaign`,e)}async deleteCampaign(e){await this.request(`DELETE`,`/campaign/${e}`)}async assignLayoutToCampaign(e,t,n){let r={layoutId:t};n!==void 0&&(r.displayOrder=n),await this.request(`POST`,`/campaign/layout/assign/${e}`,r)}async createSchedule(e){let t={...e};Array.isArray(t.displayGroupIds)&&delete t.displayGroupIds,await this.ensureToken();let n=`${this.baseUrl}/api/schedule`,r=new URLSearchParams;for(let[e,n]of Object.entries(t))n!=null&&r.set(e,String(n));if(Array.isArray(e.displayGroupIds))for(let t of e.displayGroupIds)r.append(`displayGroupIds[]`,String(t));let i=await fetch(n,{method:`POST`,headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":`application/x-www-form-urlencoded`},body:r});if(!i.ok){let e=await i.text();throw Error(`CMS API POST /schedule failed (${i.status}): ${e}`)}return(i.headers.get(`Content-Type`)||``).includes(`application/json`)?i.json():null}async deleteSchedule(e){await this.request(`DELETE`,`/schedule/${e}`)}async listSchedules(e={}){let t=await this.request(`GET`,`/schedule/data/events`,e);return Array.isArray(t)?t:t?.events||[]}async listDisplayGroups(e={}){return this._listRequest(`/displaygroup`,e)}async createDisplayGroup(e,t){let n={displayGroup:e};return t&&(n.description=t),this.request(`POST`,`/displaygroup`,n)}async deleteDisplayGroup(e){await this.request(`DELETE`,`/displaygroup/${e}`)}async assignDisplayToGroup(e,t){await this.ensureToken();let n=`${this.baseUrl}/api/displaygroup/${e}/display/assign`,r=new URLSearchParams;r.append(`displayId[]`,String(t));let i=await fetch(n,{method:`POST`,headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":`application/x-www-form-urlencoded`},body:r});if(!i.ok){let e=await i.text();throw Error(`CMS API assign display to group failed (${i.status}): ${e}`)}}async unassignDisplayFromGroup(e,t){await this.ensureToken();let n=`${this.baseUrl}/api/displaygroup/${e}/display/unassign`,r=new URLSearchParams;r.append(`displayId[]`,String(t));let i=await fetch(n,{method:`POST`,headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":`application/x-www-form-urlencoded`},body:r});if(!i.ok){let e=await i.text();throw Error(`CMS API unassign display from group failed (${i.status}): ${e}`)}}async listResolutions(){return this._listRequest(`/resolution`)}async listTemplates(e={}){return this._listRequest(`/template`,e)}async assignMediaToPlaylist(e,t){let n=Array.isArray(t)?t:[t];await this.ensureToken();let r=`${this.baseUrl}/api/playlist/library/assign/${e}`,i=new URLSearchParams;for(let e of n)i.append(`media[]`,String(e));let a=await fetch(r,{method:`POST`,headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":`application/x-www-form-urlencoded`},body:i});if(!a.ok){let t=await a.text();throw new W(`POST`,`/playlist/library/assign/${e}`,a.status,t)}return(a.headers.get(`Content-Type`)||``).includes(`application/json`)?a.json():null}async editLayout(e,t){return this.request(`PUT`,`/layout/${e}`,t)}async copyLayout(e,t={}){return this.post(`/layout/copy/${e}`,t)}async discardLayout(e){await this.put(`/layout/discard/${e}`)}async editCampaign(e,t){return this.put(`/campaign/${e}`,t)}async getCampaign(e){return this.get(`/campaign/${e}`)}async unassignLayoutFromCampaign(e,t){await this.post(`/campaign/layout/unassign/${e}`,{layoutId:t})}async editSchedule(e,t){return this.put(`/schedule/${e}`,t)}async retireLayout(e){await this.put(`/layout/retire/${e}`)}async unretireLayout(e){await this.put(`/layout/unretire/${e}`)}async getLayoutStatus(e){return this.get(`/layout/status/${e}`)}async tagLayout(e,t){await this.post(`/layout/${e}/tag`,{tag:t.join(`,`)})}async untagLayout(e,t){await this.post(`/layout/${e}/untag`,{tag:t.join(`,`)})}async listCommands(e={}){return this._listRequest(`/command`,e)}async createCommand(e){return this.post(`/command`,e)}async editCommand(e,t){return this.put(`/command/${e}`,t)}async deleteCommand(e){await this.del(`/command/${e}`)}async deleteDisplay(e){await this.del(`/display/${e}`)}async wolDisplay(e){await this.post(`/display/wol/${e}`)}async setDefaultLayout(e,t){return this.put(`/display/${e}`,{defaultLayoutId:t})}async purgeDisplay(e){await this.post(`/display/purge/${e}`)}async listDayParts(e={}){return this._listRequest(`/daypart`,e)}async createDayPart(e){return this.post(`/daypart`,e)}async editDayPart(e,t){return this.put(`/daypart/${e}`,t)}async deleteDayPart(e){await this.del(`/daypart/${e}`)}async uploadMediaUrl(e,t){return this.post(`/library`,{url:e,name:t,type:`uri`})}async copyMedia(e){return this.post(`/library/copy/${e}`)}async downloadMedia(e){await this.ensureToken();let t=`${this.baseUrl}/api/library/download/${e}`,n=await fetch(t,{headers:{Authorization:`Bearer ${this.accessToken}`}});if(!n.ok){let t=await n.text();throw new W(`GET`,`/library/download/${e}`,n.status,t)}return n}async editMedia(e,t){return this.put(`/library/${e}`,t)}async getMediaUsage(e){return this.get(`/library/usage/${e}`)}async tidyLibrary(){await this.post(`/library/tidy`)}async listPlaylists(e={}){return this._listRequest(`/playlist`,e)}async createPlaylist(e){return this.post(`/playlist`,{name:e})}async getPlaylist(e){return this.get(`/playlist/${e}`)}async editPlaylist(e,t){return this.put(`/playlist/${e}`,t)}async deletePlaylist(e){await this.del(`/playlist/${e}`)}async reorderPlaylist(e,t){await this.ensureToken();let n=`${this.baseUrl}/api/playlist/order/${e}`,r=new URLSearchParams;for(let e of t)r.append(`widgets[]`,String(e));let i=await fetch(n,{method:`POST`,headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":`application/x-www-form-urlencoded`},body:r});if(!i.ok){let t=await i.text();throw new W(`POST`,`/playlist/order/${e}`,i.status,t)}}async copyPlaylist(e){return this.post(`/playlist/copy/${e}`)}async setWidgetTransition(e,t,n={}){return this.put(`/playlist/widget/transition/${e}`,{type:t,...n})}async setWidgetAudio(e,t){return this.put(`/playlist/widget/${e}/audio`,t)}async removeWidgetAudio(e){await this.del(`/playlist/widget/${e}/audio`)}async setWidgetExpiry(e,t){return this.put(`/playlist/widget/${e}/expiry`,t)}async saveAsTemplate(e,t){return this.post(`/template/${e}`,t)}async getTemplate(e){return this.get(`/template/${e}`)}async deleteTemplate(e){await this.del(`/template/${e}`)}async listDatasets(e={}){return this._listRequest(`/dataset`,e)}async createDataset(e){return this.post(`/dataset`,e)}async editDataset(e,t){return this.put(`/dataset/${e}`,t)}async deleteDataset(e){await this.del(`/dataset/${e}`)}async listDatasetColumns(e){return this._listRequest(`/dataset/${e}/column`)}async createDatasetColumn(e,t){return this.post(`/dataset/${e}/column`,t)}async editDatasetColumn(e,t,n){return this.put(`/dataset/${e}/column/${t}`,n)}async deleteDatasetColumn(e,t){await this.del(`/dataset/${e}/column/${t}`)}async listDatasetData(e,t={}){return this._listRequest(`/dataset/data/${e}`,t)}async addDatasetRow(e,t){return this.post(`/dataset/data/${e}`,t)}async editDatasetRow(e,t,n){return this.put(`/dataset/data/${e}/${t}`,n)}async deleteDatasetRow(e,t){await this.del(`/dataset/data/${e}/${t}`)}async importDatasetCsv(e,t){return this.requestMultipart(`POST`,`/dataset/import/${e}`,t)}async clearDataset(e){await this.del(`/dataset/data/${e}`)}async listNotifications(e={}){return this._listRequest(`/notification`,e)}async createNotification(e){return this.post(`/notification`,e)}async editNotification(e,t){return this.put(`/notification/${e}`,t)}async deleteNotification(e){await this.del(`/notification/${e}`)}async listFolders(e={}){return this._listRequest(`/folder`,e)}async createFolder(e){return this.post(`/folder`,e)}async editFolder(e,t){return this.put(`/folder/${e}`,t)}async deleteFolder(e){await this.del(`/folder/${e}`)}async listTags(e={}){return this._listRequest(`/tag`,e)}async createTag(e){return this.post(`/tag`,e)}async editTag(e,t){return this.put(`/tag/${e}`,t)}async deleteTag(e){await this.del(`/tag/${e}`)}async tagEntity(e,t,n){await this.post(`/${e}/${t}/tag`,{tag:n.join(`,`)})}async untagEntity(e,t,n){await this.post(`/${e}/${t}/untag`,{tag:n.join(`,`)})}async dgChangeLayout(e,t){await this.post(`/displaygroup/${e}/action/changeLayout`,{layoutId:t})}async dgOverlayLayout(e,t){await this.post(`/displaygroup/${e}/action/overlayLayout`,{layoutId:t})}async dgRevertToSchedule(e){await this.post(`/displaygroup/${e}/action/revertToSchedule`)}async dgCollectNow(e){await this.post(`/displaygroup/${e}/action/collectNow`)}async dgSendCommand(e,t){await this.post(`/displaygroup/${e}/action/command`,{commandId:t})}async editDisplayGroup(e,t){return this.put(`/displaygroup/${e}`,t)}},W=class extends Error{constructor(e,t,n,r){super(`CMS API ${e} ${t} → ${n}: ${r}`),this.name=`CmsApiError`,this.method=e,this.path=t,this.status=n,this.detail=r}},G=e.version,K=M.data?.playerApiBase||`/player/api/v2`,q=K;function J(e){K=e.replace(/\/+$/,``),q=K}export{s as C,p as S,u as _,W as a,l as b,A as c,P as d,x as f,t as g,h,U as i,M as l,b as m,G as n,V as o,y as p,J as r,F as s,q as t,I as u,o as v,m as w,d as x,c as y};
3
+ //# sourceMappingURL=src-CMBYiOs4.js.map