UNPKG

@omneedia/client-js

Version:

Isomorphic Javascript client for Omneedia

2 lines 91.6 kB
/*! For license information please see omneedia.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.omneedia=t():e.omneedia=t()}(self,(()=>(()=>{var e,t,r={911:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Browser:()=>s});const s=(0,r(546).registerPlugin)("Browser",{web:()=>r.e(941).then(r.bind(r,941)).then((e=>new e.BrowserWeb))})},546:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Capacitor:()=>c,CapacitorCookies:()=>g,CapacitorException:()=>a,CapacitorHttp:()=>w,CapacitorPlatforms:()=>s,ExceptionCode:()=>i,Plugins:()=>u,WebPlugin:()=>d,WebView:()=>p,addPlatform:()=>n,buildRequestInit:()=>b,registerPlugin:()=>h,registerWebPlugin:()=>l,setPlatform:()=>o});const s=(e=>e.CapacitorPlatforms=(e=>{const t=new Map;t.set("web",{name:"web"});const r=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:t};return r.addPlatform=(e,t)=>{r.platforms.set(e,t)},r.setPlatform=e=>{r.platforms.has(e)&&(r.currentPlatform=r.platforms.get(e))},r})(e))("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r.g?r.g:{}),n=s.addPlatform,o=s.setPlatform;var i;!function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"}(i||(i={}));class a extends Error{constructor(e,t,r){super(e),this.message=e,this.code=t,this.data=r}}const c=(e=>e.Capacitor=(e=>{var t,r,s,n,o;const c=e.CapacitorCustomPlatform||null,h=e.Capacitor||{},u=h.Plugins=h.Plugins||{},l=e.CapacitorPlatforms,d=(null===(t=null==l?void 0:l.currentPlatform)||void 0===t?void 0:t.getPlatform)||(()=>null!==c?c.name:(e=>{var t,r;return(null==e?void 0:e.androidBridge)?"android":(null===(r=null===(t=null==e?void 0:e.webkit)||void 0===t?void 0:t.messageHandlers)||void 0===r?void 0:r.bridge)?"ios":"web"})(e)),p=(null===(r=null==l?void 0:l.currentPlatform)||void 0===r?void 0:r.isNativePlatform)||(()=>"web"!==d()),f=(null===(s=null==l?void 0:l.currentPlatform)||void 0===s?void 0:s.isPluginAvailable)||(e=>{const t=m.get(e);return!!(null==t?void 0:t.platforms.has(d()))||!!y(e)}),y=(null===(n=null==l?void 0:l.currentPlatform)||void 0===n?void 0:n.getPluginHeader)||(e=>{var t;return null===(t=h.PluginHeaders)||void 0===t?void 0:t.find((t=>t.name===e))}),m=new Map,g=(null===(o=null==l?void 0:l.currentPlatform)||void 0===o?void 0:o.registerPlugin)||((e,t={})=>{const r=m.get(e);if(r)return console.warn(`Capacitor plugin "${e}" already registered. Cannot register plugins twice.`),r.proxy;const s=d(),n=y(e);let o;const l=r=>{let u;const l=(...l)=>{const d=(async()=>(!o&&s in t?o=o="function"==typeof t[s]?await t[s]():t[s]:null!==c&&!o&&"web"in t&&(o=o="function"==typeof t.web?await t.web():t.web),o))().then((t=>{const o=((t,r)=>{var o,c;if(!n){if(t)return null===(c=t[r])||void 0===c?void 0:c.bind(t);throw new a(`"${e}" plugin is not implemented on ${s}`,i.Unimplemented)}{const s=null==n?void 0:n.methods.find((e=>r===e.name));if(s)return"promise"===s.rtype?t=>h.nativePromise(e,r.toString(),t):(t,s)=>h.nativeCallback(e,r.toString(),t,s);if(t)return null===(o=t[r])||void 0===o?void 0:o.bind(t)}})(t,r);if(o){const e=o(...l);return u=null==e?void 0:e.remove,e}throw new a(`"${e}.${r}()" is not implemented on ${s}`,i.Unimplemented)}));return"addListener"===r&&(d.remove=async()=>u()),d};return l.toString=()=>`${r.toString()}() { [capacitor code] }`,Object.defineProperty(l,"name",{value:r,writable:!1,configurable:!1}),l},p=l("addListener"),f=l("removeListener"),g=(e,t)=>{const r=p({eventName:e},t),s=async()=>{const s=await r;f({eventName:e,callbackId:s},t)},n=new Promise((e=>r.then((()=>e({remove:s})))));return n.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await s()},n},b=new Proxy({},{get(e,t){switch(t){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return n?g:p;case"removeListener":return f;default:return l(t)}}});return u[e]=b,m.set(e,{name:e,proxy:b,platforms:new Set([...Object.keys(t),...n?[s]:[]])}),b});return h.convertFileSrc||(h.convertFileSrc=e=>e),h.getPlatform=d,h.handleError=t=>e.console.error(t),h.isNativePlatform=p,h.isPluginAvailable=f,h.pluginMethodNoop=(e,t,r)=>Promise.reject(`${r} does not have an implementation of "${t}".`),h.registerPlugin=g,h.Exception=a,h.DEBUG=!!h.DEBUG,h.isLoggingEnabled=!!h.isLoggingEnabled,h.platform=h.getPlatform(),h.isNative=h.isNativePlatform(),h})(e))("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r.g?r.g:{}),h=c.registerPlugin,u=c.Plugins,l=e=>((e,t)=>{var r;const s=t.config,n=e.Plugins;if(!(null==s?void 0:s.name))throw new Error('Capacitor WebPlugin is using the deprecated "registerWebPlugin()" function, but without the config. Please use "registerPlugin()" instead to register this web plugin."');console.warn(`Capacitor plugin "${s.name}" is using the deprecated "registerWebPlugin()" function`),n[s.name]&&!(null===(r=null==s?void 0:s.platforms)||void 0===r?void 0:r.includes(e.getPlatform()))||(n[s.name]=t)})(c,e);class d{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t);const r=this.windowListeners[e];r&&!r.registered&&this.addWindowListener(r);const s=async()=>this.removeListener(e,t),n=Promise.resolve({remove:s});return Object.defineProperty(n,"remove",{value:async()=>{console.warn("Using addListener() without 'await' is deprecated."),await s()}}),n}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,t){const r=this.listeners[e];r&&r.forEach((e=>e(t)))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:e=>{this.notifyListeners(t,e)}}}unimplemented(e="not implemented"){return new c.Exception(e,i.Unimplemented)}unavailable(e="not available"){return new c.Exception(e,i.Unavailable)}async removeListener(e,t){const r=this.listeners[e];if(!r)return;const s=r.indexOf(t);this.listeners[e].splice(s,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const p=h("WebView"),f=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),y=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class m extends d{async getCookies(){const e=document.cookie,t={};return e.split(";").forEach((e=>{if(e.length<=0)return;let[r,s]=e.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");r=y(r).trim(),s=y(s).trim(),t[r]=s})),t}async setCookie(e){try{const t=f(e.key),r=f(e.value),s=`; expires=${(e.expires||"").replace("expires=","")}`,n=(e.path||"/").replace("path=",""),o=null!=e.url&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${t}=${r||""}${s}; path=${n}; ${o};`}catch(e){return Promise.reject(e)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(e){return Promise.reject(e)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const t of e)document.cookie=t.replace(/^ +/,"").replace(/=.*/,`=;expires=${(new Date).toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}const g=h("CapacitorCookies",{web:()=>new m}),b=(e,t={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},t),s=((e={})=>{const t=Object.keys(e);return Object.keys(e).map((e=>e.toLocaleLowerCase())).reduce(((r,s,n)=>(r[s]=e[t[n]],r)),{})})(e.headers)["content-type"]||"";if("string"==typeof e.data)r.body=e.data;else if(s.includes("application/x-www-form-urlencoded")){const t=new URLSearchParams;for(const[r,s]of Object.entries(e.data||{}))t.set(r,s);r.body=t.toString()}else if(s.includes("multipart/form-data")){const t=new FormData;if(e.data instanceof FormData)e.data.forEach(((e,r)=>{t.append(r,e)}));else for(const r of Object.keys(e.data))t.append(r,e.data[r]);r.body=t;const s=new Headers(r.headers);s.delete("content-type"),r.headers=s}else(s.includes("application/json")||"object"==typeof e.data)&&(r.body=JSON.stringify(e.data));return r};class v extends d{async request(e){const t=b(e,e.webFetchExtra),r=((e,t=!0)=>e?Object.entries(e).reduce(((e,r)=>{const[s,n]=r;let o,i;return Array.isArray(n)?(i="",n.forEach((e=>{o=t?encodeURIComponent(e):e,i+=`${s}=${o}&`})),i.slice(0,-1)):(o=t?encodeURIComponent(n):n,i=`${s}=${o}`),`${e}&${i}`}),"").substr(1):null)(e.params,e.shouldEncodeUrlParams),s=r?`${e.url}?${r}`:e.url,n=await fetch(s,t),o=n.headers.get("content-type")||"";let i,a,{responseType:c="text"}=n.ok?e:{};switch(o.includes("application/json")&&(c="json"),c){case"arraybuffer":case"blob":a=await n.blob(),i=await(async e=>new Promise(((t,r)=>{const s=new FileReader;s.onload=()=>{const e=s.result;t(e.indexOf(",")>=0?e.split(",")[1]:e)},s.onerror=e=>r(e),s.readAsDataURL(e)})))(a);break;case"json":i=await n.json();break;default:i=await n.text()}const h={};return n.headers.forEach(((e,t)=>{h[t]=e})),{data:i,headers:h,status:n.status,url:n.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}const w=h("CapacitorHttp",{web:()=>new v})},326:(e,t,r)=>{var s="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r.g&&r.g,n=function(){function e(){this.fetch=!1,this.DOMException=s.DOMException}return e.prototype=s,new e}();!function(e){!function(t){var r=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==r&&r,s="URLSearchParams"in r,n="Symbol"in r&&"iterator"in Symbol,o="FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch(e){return!1}}(),i="FormData"in r,a="ArrayBuffer"in r;if(a)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(e){return e&&c.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function p(e){this.map={},e instanceof p?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function y(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function m(e){var t=new FileReader,r=y(t);return t.readAsArrayBuffer(e),r}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:i&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:s&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&o&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||h(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):s&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(m)}),this.text=function(){var e,t,r,s=f(this);if(s)return s;if(this._bodyBlob)return e=this._bodyBlob,r=y(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),s=0;s<t.length;s++)r[s]=String.fromCharCode(t[s]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(E)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(e,t){e=u(e),t=l(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},p.prototype.delete=function(e){delete this.map[u(e)]},p.prototype.get=function(e){return e=u(e),this.has(e)?this.map[e]:null},p.prototype.has=function(e){return this.map.hasOwnProperty(u(e))},p.prototype.set=function(e,t){this.map[u(e)]=l(t)},p.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},p.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),d(e)},p.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),d(e)},p.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),d(e)},n&&(p.prototype[Symbol.iterator]=p.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(e,t){if(!(this instanceof w))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,s,n=(t=t||{}).body;if(e instanceof w){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new p(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new p(t.headers)),this.method=(s=(r=t.method||this.method||"GET").toUpperCase(),v.indexOf(s)>-1?s:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var o=/([?&])_=[^&]*/;o.test(this.url)?this.url=this.url.replace(o,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function E(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),s=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(s),decodeURIComponent(n))}})),t}function k(e,t){if(!(this instanceof k))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new p(t.headers),this.url=t.url||"",this._initBody(e)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},b.call(w.prototype),b.call(k.prototype),k.prototype.clone=function(){return new k(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},k.error=function(){var e=new k(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];k.redirect=function(e,t){if(-1===_.indexOf(t))throw new RangeError("Invalid status code");return new k(null,{status:t,headers:{location:e}})},t.DOMException=r.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function C(e,s){return new Promise((function(n,i){var c=new w(e,s);if(c.signal&&c.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var h=new XMLHttpRequest;function u(){h.abort()}h.onload=function(){var e,t,r={status:h.status,statusText:h.statusText,headers:(e=h.getAllResponseHeaders()||"",t=new p,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var r=e.split(":"),s=r.shift().trim();if(s){var n=r.join(":").trim();t.append(s,n)}})),t)};r.url="responseURL"in h?h.responseURL:r.headers.get("X-Request-URL");var s="response"in h?h.response:h.responseText;setTimeout((function(){n(new k(s,r))}),0)},h.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},h.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},h.onabort=function(){setTimeout((function(){i(new t.DOMException("Aborted","AbortError"))}),0)},h.open(c.method,function(e){try{return""===e&&r.location.href?r.location.href:e}catch(t){return e}}(c.url),!0),"include"===c.credentials?h.withCredentials=!0:"omit"===c.credentials&&(h.withCredentials=!1),"responseType"in h&&(o?h.responseType="blob":a&&c.headers.get("Content-Type")&&-1!==c.headers.get("Content-Type").indexOf("application/octet-stream")&&(h.responseType="arraybuffer")),!s||"object"!=typeof s.headers||s.headers instanceof p?c.headers.forEach((function(e,t){h.setRequestHeader(t,e)})):Object.getOwnPropertyNames(s.headers).forEach((function(e){h.setRequestHeader(e,l(s.headers[e]))})),c.signal&&(c.signal.addEventListener("abort",u),h.onreadystatechange=function(){4===h.readyState&&c.signal.removeEventListener("abort",u)}),h.send(void 0===c._bodyInit?null:c._bodyInit)}))}C.polyfill=!0,r.fetch||(r.fetch=C,r.Headers=p,r.Request=w,r.Response=k),t.Headers=p,t.Request=w,t.Response=k,t.fetch=C}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=s.fetch?s:n;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t},833:(e,t,r)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let s=0,n=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(s++,"%c"===e&&(n=s))})),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&typeof process/browser!=="undefined"&&"env"in process/browser&&(e=process/browser.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(736)(t);const{formatters:s}=e.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},736:(e,t,r)=>{e.exports=function(e){function t(e){let r,n,o,i=null;function a(...e){if(!a.enabled)return;const s=a,n=Number(new Date),o=n-(r||n);s.diff=o,s.prev=r,s.curr=n,r=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,n)=>{if("%%"===r)return"%";i++;const o=t.formatters[n];if("function"==typeof o){const t=e[i];r=o.call(s,t),e.splice(i,1),i--}return r})),t.formatArgs.call(s,e),(s.log||t.log).apply(s,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=s,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(n!==t.namespaces&&(n=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function s(e,r){const s=t(this.namespace+(void 0===r?":":r)+e);return s.log=this.log,s}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const s=("string"==typeof e?e:"").split(/[\s,]+/),n=s.length;for(r=0;r<n;r++)s[r]&&("-"===(e=s[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,s;for(r=0,s=t.skips.length;r<s;r++)if(t.skips[r].test(e))return!1;for(r=0,s=t.names.length;r<s;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(585),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},585:e=>{var t=1e3,r=60*t,s=60*r,n=24*s,o=7*n;function i(e,t,r,s){var n=t>=1.5*r;return Math.round(e/r)+" "+s+(n?"s":"")}e.exports=function(e,a){a=a||{};var c,h,u=typeof e;if("string"===u&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var i=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(i){var a=parseFloat(i[1]);switch((i[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*o;case"days":case"day":case"d":return a*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*s;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===u&&isFinite(e))return a.long?(c=e,(h=Math.abs(c))>=n?i(c,h,n,"day"):h>=s?i(c,h,s,"hour"):h>=r?i(c,h,r,"minute"):h>=t?i(c,h,t,"second"):c+" ms"):function(e){var o=Math.abs(e);return o>=n?Math.round(e/n)+"d":o>=s?Math.round(e/s)+"h":o>=r?Math.round(e/r)+"m":o>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},323:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(7),o=s(r(56)),i=s(r(587)),a=s(r(368)),c=s(r(945)),h=s(r(558));t.default=class{headers(){return{"Content-Type":"application/json",Authorization:"Basic "+this.KEY,apikey:this.KEY}}constructor(e,t,r){if(this.omneediaUrl=e,this.omneediaKey=t,this.PREFIX=h.default,this.KEY="",this.URI="",this.socket=null,!e)throw new Error("omneediaUrl is required.");if(!t)throw new Error("omneediaKey is required.");this.URI=e,this.KEY=t,this.request=new c.default(this),this.auth=new a.default(this,r),this.options=r}from(e){return new o.default(e,this)}channel(e){return this.socket=(0,n.io)(String(this.URI),{path:this.PREFIX.REALTIME,withCredentials:!0,extraHeaders:{apikey:`${this.KEY}`,Authorization:`Bearer ${this.KEY}`}}),this.socket.on("connect_error",(function(e){if(401==e.description)throw"Invalid authentication credentials (401)";throw"unhandled exception"})),new i.default(e,this)}}},558:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={REST:"/rest/v1",AUTH:"/auth/v1",REALTIME:"/realtime/v1"}},440:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createClient=t.OmneediaClient=t.omneediaClient=void 0;const n=s(r(323));t.omneediaClient=n.default,t.OmneediaClient=n.default,t.createClient=(e,t,r)=>new n.default(e,t,r)},368:function(e,t,r){"use strict";var s=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=r(170),o=r(546);r(911),t.default=class{constructor(e,t){this.tokenListener=null,this.session=this.getSession,this.options=t,this.ref=e,this.tokenListener=setInterval((()=>s(this,void 0,void 0,(function*(){if((0,n.isBrowser)()){let e=yield this.session().getUser();if(!e)return;let t=localStorage.getItem("omneedia.auth.refresh_token");if(!t)return localStorage.removeItem("omneedia.auth.token"),localStorage.removeItem("omneedia.auth.refresh_token"),location.href=`#new_token=${t}`;if(new Date(1e3*e.exp)<new Date){let e=yield this.getNewToken(t);return!1===e?(localStorage.removeItem("omneedia.auth.token"),localStorage.removeItem("omneedia.auth.refresh_token"),location.href=`#new_token=${t}`):(localStorage.setItem("omneedia.auth.token",e),location.href=`#new_token=${t}`)}}else if(!(yield this.session().getUser()))return}))),1e3)}getNewToken(e){return s(this,void 0,void 0,(function*(){let{data:t}=yield this.ref.request.post(this.ref.PREFIX.AUTH+"/token?grant_type=refresh_token",{refresh_token:e});return!t.err&&t.access_token}))}_setUserData(e){this.options.cookies.setAll([{name:"omneedia.auth.token",value:e.access_token,lifetime:1728e3,domain:"",path:"/",sameSite:"lax"}])}signInWithPassword(e){return s(this,void 0,void 0,(function*(){let{data:t}=yield this.ref.request.post(this.ref.PREFIX.AUTH+"/token?grant_type=password",{props:e});if(!(0,n.isBrowser)())return t.err?{data:{user:null,session:null},error:{message:t.err}}:(this._setUserData(t),this.getUser(t.access_token));if(t.err)r=[`#error=${t.err}`];else{var r=[];for(var s in t)r.push(`${s}=${t[s]}`)}location.href="#"+r.join("&")}))}signUp(e){return s(this,void 0,void 0,(function*(){let{data:t}=yield this.ref.request.post(this.ref.PREFIX.AUTH+"/signup",{props:e});if(t.err)r=[`#error=${t.err}`];else{var r=[];for(var s in t)r.push(`${s}=${t[s]}`)}t.waiting&&(r=["#waiting"]),location.href="#"+r.join("&")}))}signInWithProvider(e){var t;return s(this,void 0,void 0,(function*(){return(null===(t=e.config)||void 0===t?void 0:t.callback)?location.href=`${this.ref.URI}${this.ref.PREFIX.AUTH}/authorize?provider=${e.provider}&callback=${e.config.callback}`:(yield o.Capacitor.getPlatform(),!1)}))}updateUser(e){return s(this,void 0,void 0,(function*(){const t=new URLSearchParams(window.location.search).get("token");t&&(e.token=t);let{data:r}=yield this.ref.request.put(this.ref.PREFIX.AUTH+"/user",e);return r}))}onAuthStateChange(e){if((0,n.isBrowser)()){var t=()=>{if(location.href.indexOf("access_token")>-1){var t=(0,n.getHashParams)();return window.location.hash="",localStorage.setItem("omneedia.auth.token",t.access_token),localStorage.setItem("omneedia.auth.refresh_token",t.refresh_token),e("SIGNED_IN",t)}if(location.href.indexOf("#waiting")>-1)return window.location.hash="",e("WAITING_FOR_CONFIRMATION",{});if(location.href.indexOf("#logout")>-1)return localStorage.removeItem("omneedia.auth.token"),localStorage.removeItem("omneedia.auth.refresh_token"),window.location.hash="",e("SIGNED_OUT",{});if(location.href.indexOf("#error")>-1){var r=decodeURIComponent(location.href).split("#error=")[1];return e("ERROR",r),window.location.hash="",!1}if(location.href.indexOf("#new_token")>-1)return r=decodeURIComponent(location.href).split("#new_token=")[1],e("REFRESH_TOKEN",localStorage.getItem("omneedia.auth.token")),window.location.hash="",!1;localStorage.getItem("omneedia.auth.token")&&e("AUTHENTICATED",localStorage.getItem("omneedia.auth.token"))};window.addEventListener("hashchange",t),window.addEventListener("load",t),t()}}resetPasswordForEmail(e){return s(this,void 0,void 0,(function*(){let{data:t}=yield this.ref.request.post(this.ref.PREFIX.AUTH+"/recover",e);if(t.err)r=[`error=${t.err}`];else{var r=[];for(var s in t)r.push(`${s}=${t[s]}`)}t.waiting&&(r=["waiting"]),location.href="#"+r.join("&")}))}signInWithEmail(e){return s(this,void 0,void 0,(function*(){let{data:t}=yield this.ref.request.post(this.ref.PREFIX.AUTH+"/magiclink",e);if(t.err)r=[`error=${t.err}`];else{var r=[];for(var s in t)r.push(`${s}=${t[s]}`)}t.waiting&&(r=["waiting"]),location.href="#"+r.join("&")}))}getSession(){var e=!1;if((0,n.isBrowser)()&&localStorage.getItem("omneedia.auth.token")){let t=localStorage.getItem("omneedia.auth.token");e=(0,n.parseJwt)(t)}return{getUser:()=>e}}getUser(e){return s(this,void 0,void 0,(function*(){if(e){if(!(0,n.isBrowser)())return{data:{user:(0,n.urlBase64Decode)(e),session:e},error:null};try{return e=(0,n.urlBase64Decode)(e)}catch(e){return null}}let{data:t}=yield this.ref.request.get(this.ref.PREFIX.AUTH+"/user");return!1===t&&((0,n.isBrowser)()?(localStorage.removeItem("omneedia.auth.token"),localStorage.removeItem("omneedia.auth.refresh_token")):this.options.cookies.deleteAll()),(0,n.isBrowser)()?t:{data:{user:t},error:null}}))}isAuthenticated(){if((0,n.isBrowser)())return!!window.localStorage.getItem("omneedia.auth.token")}signOut(){return s(this,void 0,void 0,(function*(){if((0,n.isBrowser)())return yield this.ref.request.get(this.ref.PREFIX.AUTH+"/signout"),void(location.hash="#logout");yield this.ref.request.get(this.ref.PREFIX.AUTH+"/signout"),this.options.cookies.setAll([{name:"omneedia.auth.token",value:"",lifetime:0,domain:"",path:"/",sameSite:"lax"}])}))}}},56:function(e,t,r){"use strict";var s=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=n(r(945));t.default=class{constructor(e,t){this.SELECT=[],this.INSERT={},this.UPDATE={},this.DELETE=!1,this.WHERE=[],this.ref={},this.FilterOperator=["eq","neq","gt","gte","lt","lte","like","ilike","is","in","cs","cd","sl","sr","nxl","nxr","adj","ov","fts","plfts","phfts","wfts"],this.TABLE=e,this.ref=t,this.request=new o.default(this)}rangeLt(e,t){return this.WHERE.push(`${e}=sl.${t}`),this}rangeGt(e,t){return this.WHERE.push(`${e}=sr.${t}`),this}rangeLte(e,t){return this.WHERE.push(`${e}=nxr.${t}`),this}rangeGte(e,t){return this.WHERE.push(`${e}=nxl.${t}`),this}rangeAdjacent(e,t){return this.WHERE.push(`${e}=adj.${t}`),this}overlaps(e,t){return Array.isArray(t)||(t=[t]),t=`[${t.join(",")}]`,this.WHERE.push(`${e}=ov.${t}`),this}not(e,t,r){return-1==this.FilterOperator.indexOf(t)||this.WHERE.push(`${e}=not.${t}.${r}`),this}is(e,t){return this.WHERE.push(`${e}=is.${t}`),this}contains(e,t){return Array.isArray(t)||(t=[t]),t=`{${t.join(",")}}`,this.WHERE.push(`${e}=cs.${t}`),this}containedBy(e,t){return Array.isArray(t)||(t=[t]),t=`{${t.join(",")}}`,this.WHERE.push(`${e}=cd.${t}`),this}or(e){return Array.isArray(e)||(e=[e]),1==e.length&&(e=e[0].split(",")),this.WHERE.push(`or=(${e.join(",")})`),this}and(e){return Array.isArray(e)||(e=[e]),1==e.length&&(e=e[0].split(",")),this.WHERE.push(`and=(${e.join(",")})`),this}textSearch(e,t,r){let s="";r&&("plain"===r.type?s="pl":"phrase"===r.type?s="ph":"websearch"===r.type&&(s="w"));let n=`${s}fts`;return this.WHERE.push(`${e}=${n}.${t}`),this}in(e,t){return Array.isArray(t)||(t=[t]),t=`(${t.join(",")})`,this.WHERE.push(`${e}=in.${t}`),this}nxr(e,t){return Array.isArray(t)||(t=[t]),t=`(${t.join(",")})`,this.WHERE.push(`${e}=nxr.${t}`),this}sl(e,t){return Array.isArray(t)||(t=[t]),t=`(${t.join(",")})`,this.WHERE.push(`${e}=sl.${t}`),this}adj(e,t){return Array.isArray(t)||(t=[t]),t=`(${t.join(",")})`,this.WHERE.push(`${e}=adj.${t}`),this}imatch(e){for(var t in e)this.WHERE.push(`${t}=eq.${e[t]}`);return this}match(e){for(var t in e)this.WHERE.push(`${t}=eq.${e[t]}`);return this}gt(e,t){return this.WHERE.push(`${e}=gt.${t}`),this}gte(e,t){return this.WHERE.push(`${e}=gte.${t}`),this}lt(e,t){return this.WHERE.push(`${e}=lt.${t}`),this}lte(e,t){return this.WHERE.push(`${e}=lte.${t}`),this}neq(e,t){return this.WHERE.push(`${e}=neq.${t}`),this}like(e,t){return this.WHERE.push(`${e}=like.${t}`),this}ilike(e,t){return this.WHERE.push(`${e}=ilike.${t}`),this}eq(e,t){return this.WHERE.push(`${e}=eq.${t}`),this}select(...e){return e||(e=[""]),1==e.length&&(e=e[0].split(",")),this.SELECT=e,this}insert(e){return this.INSERT=e,this}update(e){return this.UPDATE=e,this}delete(){return this.DELETE=!0,this}then(e,t){return s(this,void 0,void 0,(function*(){var t=`/${this.TABLE}?`;if(Object.keys(this.INSERT).length>0){var r=this.ref.PREFIX.REST+t;return e(this.request.post(r,this.INSERT))}this.SELECT.length>0&&(t+=`select=${this.SELECT.join(",")}&`),this.WHERE.length>0&&(t+=this.WHERE.join("&")),r=this.ref.PREFIX.REST+t;var s="get";!0===this.DELETE&&(s="delete"),Object.keys(this.UPDATE).length>0?e(this.request.patch(r,this.UPDATE)):e(this.request[s](r))}))}}},587:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t){this.Channel="",this.ref=null,this.Channel=e,this.ref=t}send(e){return r(this,void 0,void 0,(function*(){return this.ref.socket.emit(this.Channel+"::"+e.type+"::"+e.event,e.payload),this}))}on(e,t,r){return this.ref.socket.on(`${this.Channel}::${e}::${t.event}`,r),this}subscribe(e){return this.ref.socket.on(`${this.Channel}:SUBSCRIBED`,e),this.ref.socket.emit("subscribe",this.Channel),this}}},945:function(e,t,r){"use strict";var s=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,o){function i(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((s=s.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(170),i=n(r(326));t.default=class{constructor(e){this.url="",this.ref=e,(0,o.isBrowser)()?this.fetch=globalThis.fetch.bind(globalThis):this.fetch=i.default}get(e,t){return s(this,void 0,void 0,(function*(){if(e.indexOf("://")>-1)var t=`${e}`;else t=`${this.ref.omneediaUrl}${e}`;let r=this.ref.headers();if((0,o.isBrowser)())localStorage.getItem("omneedia.auth.token")&&(r.Authorization="Bearer "+localStorage.getItem("omneedia.auth.token")),r.redirect_to=window.location.origin+window.location.pathname;else{const e=this.ref.options.cookies.getAll();if(e){const t=e.find((e=>"omneedia.auth.token"===e.name));t&&(r.Authorization="Bearer "+t.value)}}var s=yield this.fetch(t,{headers:r}),n=yield s.json(),i={data:null,error:null,statusText:s.statusText,status:s.status};return s.ok?i.data=n:i.error=n,i}))}delete(e,t){return s(this,void 0,void 0,(function*(){let t=[];if(e.indexOf("://")>-1)var r=`${e}`;else r=`${this.ref.omneediaUrl}${e}`;let s=this.ref.headers();if((0,o.isBrowser)())localStorage.getItem("omneedia.auth.token")&&(s.Authorization="Bearer "+localStorage.getItem("omneedia.auth.token")),s.redirect_to=window.location.origin+window.location.pathname;else{const e=this.ref.options.cookies.getAll();if(e){const t=e.find((e=>"omneedia.auth.token"===e.name));t&&(s.Authorization="Bearer "+t.value)}}var n=yield this.fetch(r,{method:"DELETE",headers:s});try{t=yield n.json()}catch(e){t=[]}return{data:t,statusText:n.statusText,status:n.status}}))}patch(e,t){return s(this,void 0,void 0,(function*(){let r=[];if(e.indexOf("://")>-1)var s=`${e}`;else s=`${this.ref.omneediaUrl}${e}`;let n=this.ref.headers();if((0,o.isBrowser)())n.redirect_to=window.location.origin+window.location.pathname,localStorage.getItem("omneedia.auth.token")&&(n.Authorization="Bearer "+localStorage.getItem("omneedia.auth.token"));else{const e=this.ref.options.cookies.getAll();if(e){const t=e.find((e=>"omneedia.auth.token"===e.name));t&&(n.Authorization="Bearer "+t.value)}}var i=yield this.fetch(s,{method:"PATCH",headers:n,body:JSON.stringify(t)});try{r=yield i.json()}catch(e){r=[]}return{data:yield r,statusText:i.statusText,status:i.status}}))}put(e,t){return s(this,void 0,void 0,(function*(){let r=[];if(e.indexOf("://")>-1)var s=`${e}`;else s=`${this.ref.omneediaUrl}${e}`;let n=this.ref.headers();if((0,o.isBrowser)())n.redirect_to=window.location.origin+window.location.pathname,localStorage.getItem("omneedia.auth.token")&&(n.Authorization="Bearer "+localStorage.getItem("omneedia.auth.token"));else{const e=this.ref.options.cookies.getAll();if(e){const t=e.find((e=>"omneedia.auth.token"===e.name));t&&(n.Authorization="Bearer "+t.value)}}var i=yield this.fetch(s,{method:"PUT",headers:n,body:JSON.stringify(t)});try{r=yield i.json()}catch(e){r=[]}return{data:yield r,statusText:i.statusText,status:i.status}}))}post(e,t){return s(this,void 0,void 0,(function*(){let r=[];if(e.indexOf("://")>-1)var s=`${e}`;else s=`${this.ref.omneediaUrl}${e}`;let n=this.ref.headers();if((0,o.isBrowser)())n.redirect_to=window.location.origin+window.location.pathname,localStorage.getItem("omneedia.auth.token")&&(n.Authorization="Bearer "+localStorage.getItem("omneedia.auth.token"));else{const e=this.ref.options.cookies.getAll();if(e){const t=e.find((e=>"omneedia.auth.token"===e.name));t&&(n.Authorization="Bearer "+t.value)}}var i=yield this.fetch(s,{method:"POST",headers:n,body:JSON.stringify(t)});try{r=yield i.json()}catch(e){r=[]}return{data:r,statusText:i.statusText,status:i.status}}))}}},170:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getHash=t.urlBase64Decode=t.parseJwt=t.getHashParams=t.isBrowser=t.uuid=void 0,t.uuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},t.isBrowser=()=>"undefined"!=typeof document,t.getHashParams=function(){let e=location.href.substring(location.href.indexOf("#")+1,location.href.length).split("&"),t={};for(let r in e)t[e[r].split("=")[0]]=e[r].split("=")[1];return t},t.parseJwt=function(e){if((0,t.isBrowser)()){var r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(window.atob(r).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""));const t=Math.floor(Date.now()/1e3);return JSON.parse(s).exp<t?(localStorage.removeItem("omneedia.auth.token"),localStorage.removeItem("omneedia.auth.refresh_token"),!1):JSON.parse(s)}return JSON.parse(Buffer.from(e.split(".")[1],"base64").toString())},t.urlBase64Decode=function(e){let r=e.replace(/-/g,"+").replace(/_/g,"/");switch(r.length%4){case 0:break;case 2:r+="==";break;case 3:r+="="}if(!(0,t.isBrowser)())return JSON.parse(Buffer.from(r.split(".")[1],"base64").toString());{const e=window.atob(r);try{return JSON.parse(decodeURIComponent(escape(e)))}catch(t){return e}}},t.getHash=function(){if(""==location.hash)return{};let e,t=location.hash.split("&");for(let n=0;n<t.length;n++){var r=t[n].split("=")[0],s=t[n].split("=")[1];e[r]=s}return e}},110:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasCORS=void 0;let r=!1;try{r="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}t.hasCORS=r},661:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=void 0,t.encode=function(e){let t="";for(let r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t},t.decode=function(e){let t={},r=e.split("&");for(let e=0,s=r.length;e<s;e++){let s=r[e].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}},15:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parse=void 0;const r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,s=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.parse=function(e){const t=e,n=e.indexOf("["),o=e.indexOf("]");-1!=n&&-1!=o&&(e=e.substring(0,n)+e.substring(n,o).replace(/:/g,";")+e.substring(o,e.length));let i=r.exec(e||""),a={},c=14;for(;c--;)a[s[c]]=i[c]||"";return-1!=n&&-1!=o&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=function(e,t){const r=t.replace(/\/{2,9}/g,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1),"/"==t.slice(-1)&&r.splice(r.length-1,1),r}(0,a.path),a.queryKey=function(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,s){t&&(r[t]=s)})),r}(0,a.query),a}},732:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.yeast=t.decode=t.encode=void 0;const r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),s={};let n,o=0,i=0;function a(e){let t="";do{t=r[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}for(t.encode=a,t.decode=function(e){let t=0;for(i=0;i<e.length;i++)t=64*t+s[e.charAt(i)];return t},t.yeast=function(){const e=a(+new Date);return e!==n?(o=0,n=e):e+"."+a(o++)};i<64;i++)s[r[i]]=i},235:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.globalThisShim=void 0,t.globalThisShim="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")()},956:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nextTick=t.parse=t.installTimerFunctions=t.transports=t.Transport=t.protocol=t.Socket=void 0;const s=r(223);Object.defineProperty(t,"Socket",{enumerable:!0,get:function(){return s.Socket}}),t.protocol=s.Socket.protocol;var n=r(689);Object.defineProperty(t,"Transport",{enumerable:!0,get:function(){return n.Transport}});var o=r(419);Object.defineProperty(t,"transports",{enumerable:!0,get:function(){return o.transports}});var i=r(374);Object.defineProperty(t,"installTimerFunctions",{enumerable:!0,get:function(){return i.installTimerFunctions}});var a=r(15);Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return a.parse}});var c=r(87);Object.defineProperty(t,"nextTick",{enumerable:!0,get:function(){return c.nextTick}})},223:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Socket=void 0;const n=r(419),o=r(374),i=r(661),a=r(15),c=s(r(833)),h=r(285),u=r(376),l=(0,c.default)("engine.io-client:socket");class d extends h.Emitter{constructor(e,t={}){super(),e&&"object"==typeof e&&(t=e,e=null),e?(e=(0,a.parse)(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=(0,a.parse)(t.host).host),(0,o.installTimerFunctions)(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+"/","string"==typeof this.opts.query&&(this.opts.query=(0,i.decode)(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){l('creating transport "%s"',e);const t=Object.assign({},this.opts.query);t.EIO=u.protocol,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return l("options: %j",r),new n.transports[e](r)}open(){let e;if(this.opts.rememberUpgrade&&d.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return l("error while creating transport: %s",e),this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(e){l("setting transport %s",e.name),this.transport&&(l("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(e){l('probing transport "%s"',e);let t=this.createTransport(e),r=!1;d.priorWebsocketSuccess=!1;const s=()=>{r||(l('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",(s=>{if(!r)if("pong"===s.type&&"probe"===s.data){if(l('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;d.priorWebsocketSuccess="websocket"===t.name,l('pausing current transport "%s"',this.transport.name),this.transport.pause((()=>{r||"closed"!==this.readyState&&(l("changing transport and sending upgrade packet"),h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{l('probe transport "%s" failed',e);const r=new Error("probe error");r.transport=t.name,this.emitReserved("upgradeError",r)}})))};function n(){r||(r=!0,h(),t.close(),t=null)}const o=r=>{const s=new Error("probe error: "+r);s.transport=t.name,n(),l('probe transport "%s" failed because of error: %s',e,r),this.emitReserved("upgradeError",s)};function i(