@aegis-framework/artemis 0.4.0 → 0.5.0
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.
- package/README.md +547 -96
- package/dist/artemis.browser.js +2 -2
- package/dist/artemis.browser.js.map +18 -17
- package/dist/artemis.js +2 -2
- package/dist/artemis.js.map +18 -17
- package/dist/types/DOM.d.ts +189 -207
- package/dist/types/DOM.d.ts.map +1 -1
- package/dist/types/Debug.d.ts +73 -2
- package/dist/types/Debug.d.ts.map +1 -1
- package/dist/types/FileSystem.d.ts +55 -38
- package/dist/types/FileSystem.d.ts.map +1 -1
- package/dist/types/Form.d.ts +41 -16
- package/dist/types/Form.d.ts.map +1 -1
- package/dist/types/Platform.d.ts +62 -63
- package/dist/types/Platform.d.ts.map +1 -1
- package/dist/types/Preload.d.ts +70 -11
- package/dist/types/Preload.d.ts.map +1 -1
- package/dist/types/Request.d.ts +111 -47
- package/dist/types/Request.d.ts.map +1 -1
- package/dist/types/Space.d.ts +19 -6
- package/dist/types/Space.d.ts.map +1 -1
- package/dist/types/SpaceAdapter/IndexedDB.d.ts +10 -7
- package/dist/types/SpaceAdapter/IndexedDB.d.ts.map +1 -1
- package/dist/types/SpaceAdapter/LocalStorage.d.ts +18 -8
- package/dist/types/SpaceAdapter/LocalStorage.d.ts.map +1 -1
- package/dist/types/SpaceAdapter/RemoteStorage.d.ts +15 -2
- package/dist/types/SpaceAdapter/RemoteStorage.d.ts.map +1 -1
- package/dist/types/SpaceAdapter/SessionStorage.d.ts +21 -2
- package/dist/types/SpaceAdapter/SessionStorage.d.ts.map +1 -1
- package/dist/types/SpaceAdapter/types.d.ts +32 -1
- package/dist/types/SpaceAdapter/types.d.ts.map +1 -1
- package/dist/types/Text.d.ts +34 -23
- package/dist/types/Text.d.ts.map +1 -1
- package/dist/types/Util.d.ts +18 -14
- package/dist/types/Util.d.ts.map +1 -1
- package/package.json +3 -4
package/dist/artemis.browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var h=Object.defineProperty;var D=(z,H)=>{for(var Q in H)h(z,Q,{get:H[Q],enumerable:!0,configurable:!0,set:(X)=>H[Q]=()=>X})};var T={};D(T,{Util:()=>S,Text:()=>V,SpaceAdapter:()=>R,Space:()=>x,SessionStorage:()=>P,Request:()=>G,RemoteStorage:()=>E,Preload:()=>O,Platform:()=>C,LocalStorage:()=>F,IndexedDB:()=>U,Form:()=>q,FileSystem:()=>A,DebugLevel:()=>M,Debug:()=>j,DOM:()=>$,$_ready:()=>b,$_:()=>w});var M;((Z)=>{Z[Z.NONE=0]="NONE";Z[Z.ERROR=1]="ERROR";Z[Z.WARNING=2]="WARNING";Z[Z.INFO=3]="INFO";Z[Z.DEBUG=4]="DEBUG";Z[Z.ALL=5]="ALL"})(M||={});class j{static _level=0;static level(z){if(typeof z==="number")this._level=z;return this._level}static log(...z){if(this.level()>=4)console.log(...z)}static debug(...z){if(this.level()>=4)console.debug(...z)}static info(...z){if(this.level()>=3)console.info(...z)}static error(...z){if(this.level()>=1)console.error(...z)}static warning(...z){if(this.level()>=2)console.warn(...z)}static table(...z){if(this.level()>=4)console.table(...z)}static group(...z){if(this.level()>=4)console.group(...z)}static groupCollapsed(...z){if(this.level()>=4)console.groupCollapsed(...z)}static groupEnd(){if(this.level()>=4)console.groupEnd()}static time(z){if(this.level()>=4)console.time(z)}static timeLog(z,...H){if(this.level()>=4)console.timeLog(z,...H)}static timeEnd(z){if(this.level()>=4)console.timeEnd(z)}static trace(...z){if(this.level()>=4)console.trace(...z)}}class ${collection;length;_selector;constructor(z){if(z===null){this.collection=[],this.length=0,this._selector=null;return}if(typeof z==="string")this.collection=document.querySelectorAll(z),this.length=this.collection.length,this._selector=z;else if(z instanceof NodeList)this.collection=z,this.length=z.length,this._selector=z;else if(z instanceof $)this.collection=z.collection,this.length=this.collection.length,this._selector=z._selector;else if(z instanceof HTMLElement)this.collection=[z],this.length=this.collection.length,this._selector=z;else if(Array.isArray(z))this.collection=z,this.length=z.length,this._selector=z;else this.collection=[],this.length=0,this._selector=null}hide(){for(let z of this.collection)z.style.display="none";return this}show(z="block"){for(let H of this.collection)H.style.display=z;return this}addClass(z){for(let H of this.collection)H.classList.add(z);return this}removeClass(z=null){if(z!==null)for(let H of this.collection)H.classList.remove(z);else for(let H of this.collection)while(H.classList.length>0){let Q=H.classList.item(0);if(Q)H.classList.remove(Q)}return this}toggleClass(z){let H=z.split(" ");for(let Q of this.collection)for(let X of H)Q.classList.toggle(X);return this}hasClass(z){for(let H of this.collection)if(!H.classList.contains(z))return!1;return!0}value(z){if(typeof z<"u"){for(let H of this.collection)H.value=z;return this}else{if(this.length===0)return;if(this.length===1)return this.collection[0].value;let H=[];for(let Q of this.collection)H.push(Q.value);return H}}focus(){if(this.length>0)this.collection[0].focus();return this}click(z){for(let H of this.collection)H.addEventListener("click",z,!1);return this}keyup(z){for(let H of this.collection)H.addEventListener("keyup",z,!1);return this}keydown(z){for(let H of this.collection)H.addEventListener("keydown",z,!1);return this}submit(z){for(let H of this.collection)H.addEventListener("submit",z,!1);return this}change(z){for(let H of this.collection)H.addEventListener("change",z,!1);return this}scroll(z){for(let H of this.collection)H.addEventListener("scroll",z,!1);return this}on(z,H,Q){let X=z.split(" ");for(let Y of this.collection)for(let W of X)if(typeof H==="function")Y.addEventListener(W,H,!1);else if(typeof H==="string"&&typeof Q==="function")Y.addEventListener(W,(Z)=>{if(!Z.target)return;let _=new $(Z.target).closestParent(H,this._selector);if(_.exists())Q.call(_.get(0),Z)},!1);return this}filter(z){let H=[];for(let Q of this.collection)if(Q.matches(z))H.push(Q);return new $(H.length>0?H:null)}exists(){return this.length>0}data(z,H){if(typeof H<"u"){for(let Q of this.collection)Q.dataset[z]=H;return this}else{if(this.length===0)return;if(this.length===1)return this.collection[0].dataset[z];let Q=[];for(let X of this.collection)Q.push(X.dataset[z]);return Q}}removeData(z){for(let H of this.collection)delete H.dataset[z];return this}text(z){if(typeof z<"u"){for(let H of this.collection)H.textContent=z;return this}else{if(this.length===0)return;if(this.length===1)return this.collection[0].textContent;let H=[];for(let Q of this.collection)H.push(Q.textContent);return H}}html(z){if(typeof z<"u"){for(let H of this.collection)H.innerHTML=z;return this}else{if(this.length===0)return;if(this.length===1)return this.collection[0].innerHTML;let H=[];for(let Q of this.collection)H.push(Q.innerHTML);return H}}append(z){for(let H of this.collection)if(typeof z==="string"){let Q=document.createElement("div");if(Q.innerHTML=z.trim(),Q.firstChild)H.appendChild(Q.firstChild.cloneNode(!0))}else H.appendChild(z.cloneNode(!0));return this}prepend(z){for(let H of this.collection)if(typeof z==="string"){let Q=document.createElement("div");if(Q.innerHTML=z.trim(),Q.firstChild)if(H.childNodes.length>0)H.insertBefore(Q.firstChild.cloneNode(!0),H.childNodes[0]);else H.appendChild(Q.firstChild.cloneNode(!0))}else if(H.childNodes.length>0)H.insertBefore(z.cloneNode(!0),H.childNodes[0]);else H.appendChild(z.cloneNode(!0));return this}each(z){for(let H of this.collection)z(H);return this}get(z){return this.collection[z]}first(){if(this.length>0)return new $(this.collection[0]);return new $(null)}last(){if(this.length>0)return new $(this.collection[this.collection.length-1]);return new $(null)}isVisible(){for(let z of this.collection){let H=z;if(H.style.display!=="none"&&H.offsetWidth>0&&H.offsetHeight>0)return!0}return!1}parent(){let z=[];for(let H of this.collection)if(H.parentElement&&!z.includes(H.parentElement))z.push(H.parentElement);return new $(z.length>0?z:null)}find(z){let H=[];for(let Q of this.collection){let X=Q.querySelectorAll(z);for(let Y of X)if(!H.includes(Y))H.push(Y)}return new $(H.length>0?H:null)}offset(){if(this.length===0)return;if(this.length===1){let H=this.collection[0].getBoundingClientRect();return{top:H.top+document.body.scrollTop,left:H.left+document.body.scrollLeft}}let z=[];for(let H of this.collection){let Q=H.getBoundingClientRect();z.push({top:Q.top+document.body.scrollTop,left:Q.left+document.body.scrollLeft})}return z}closest(z){let H=[];for(let Q of this.collection){let X=Q.closest(z);if(X&&!H.includes(X))H.push(X)}return new $(H.length>0?H:null)}closestParent(z,H){if(this.length===0)return new $(null);let Q=this.collection[0];while(Q){if(Q.matches(z))return new $(Q);if(typeof H==="string"&&Q.matches(H))break;Q=Q.parentElement}return new $(null)}attribute(z,H){if(typeof H<"u"){for(let Q of this.collection)Q.setAttribute(z,String(H));return this}else{if(this.length===0)return;if(this.length===1)return this.collection[0].getAttribute(z);let Q=[];for(let X of this.collection)Q.push(X.getAttribute(z));return Q}}hasAttribute(z){for(let H of this.collection)if(!H.hasAttribute(z))return!1;return!0}after(z){for(let H of this.collection)H.insertAdjacentHTML("afterend",z);return this}before(z){for(let H of this.collection)H.insertAdjacentHTML("beforebegin",z);return this}style(z,H){if(typeof z==="string"&&typeof H>"u"){if(this.length===0)return;if(this.length===1)return this.collection[0].style.getPropertyValue(z);let Q=[];for(let X of this.collection)Q.push(X.style.getPropertyValue(z));return Q}for(let Q of this.collection){let X=Q;if(typeof z==="string"&&typeof H<"u")X.style.setProperty(z,H);else if(typeof z==="object")for(let Y in z)X.style.setProperty(Y,String(z[Y]))}return this}animate(z,H){for(let Q=0;Q<this.collection.length;Q++){let X=this.collection[Q];for(let Y in z){let W=Date.now(),Z;if(typeof X.style.getPropertyValue(Y)<"u"&&X.style.getPropertyValue(Y)!==""){Z=parseFloat(X.style.getPropertyValue(Y));let J=setInterval(()=>{let _=Math.min(1,(Date.now()-W)/H);if(X.style.setProperty(Y,String(Z+_*(z[Y]-Z))),_===1)clearInterval(J)},25);X.style.setProperty(Y,String(Z))}else if(typeof X[Y]<"u"){Z=X[Y];let J=setInterval(()=>{let _=Math.min(1,(Date.now()-W)/H);if(X[Y]=Z+_*(z[Y]-Z),_===1)clearInterval(J)},25);X[Y]=Z}}}return this}fadeIn(z=400,H){let Q=0,X=this.collection.length;for(let Y of this.collection){let W=Y;W.style.opacity="0";let Z=Date.now(),J=()=>{if(W.style.opacity=String(parseFloat(W.style.opacity)+(Date.now()-Z)/z),Z=Date.now(),parseFloat(W.style.opacity)<1)requestAnimationFrame(J);else if(Q++,Q===X&&typeof H==="function")H()};J()}return this}fadeOut(z=400,H){let Q=0,X=this.collection.length;for(let Y of this.collection){let W=Y,Z=Date.now(),J=()=>{if(W.style.opacity=String(parseFloat(W.style.opacity)-(Date.now()-Z)/z),Z=Date.now(),parseFloat(W.style.opacity)>0)requestAnimationFrame(J);else if(Q++,Q===X&&typeof H==="function")H()};J()}return this}matches(z){if(this.length===0)return!1;for(let H of this.collection)if(!H.matches(z))return!1;return!0}remove(){for(let z of this.collection)z.parentNode?.removeChild(z);return this}replaceWith(z){for(let H of this.collection){let Q;if(typeof z==="string"){let X=document.createElement("div");X.innerHTML=z,Q=X.firstChild}else Q=z.cloneNode(!0);H.parentElement?.replaceChild(Q,H)}return this}reset(){for(let z of this.collection)if(z.reset)z.reset();return this}property(z,H){if(typeof H<"u"){for(let Q of this.collection)Q[z]=H;return this}else{if(this.length===0)return;if(this.length===1)return this.collection[0][z];let Q=[];for(let X of this.collection)Q.push(X[z]);return Q}}}function w(z){return new $(z)}function b(z){window.addEventListener("load",z)}class G{static serialize(z){return Object.keys(z).map((H)=>{return encodeURIComponent(H)+"="+encodeURIComponent(String(z[H]))}).join("&")}static get(z,H={},Q={}){let X=G.serialize(H);if(X!=="")z=`${z}?${X}`;return fetch(z,Q)}static post(z,H,Q={}){let X,Y=Q.headers?.["Content-Type"];if(Y!==void 0)if(Y==="multipart/form-data"){X=new FormData;for(let J in H)X.append(J,String(H[J]))}else if(Y==="application/json")X=JSON.stringify(H);else X=G.serialize(H);else X=G.serialize(H);let W={"Content-Type":"application/x-www-form-urlencoded",...Q.headers};if(W["Content-Type"]==="multipart/form-data")delete W["Content-Type"];let Z={...Q,method:"POST",headers:W,body:X};return fetch(z,Z)}static put(z,H,Q={}){return G.post(z,H,Object.assign({},{method:"PUT"},Q))}static delete(z,H,Q={}){return G.get(z,H,Object.assign({},{method:"DELETE"},Q))}static json(z,H={},Q={}){return G.get(z,H,Q).then((X)=>{return X.json()})}static blob(z,H={},Q={}){return G.get(z,H,Q).then((X)=>{return X.blob()})}}class A{static readRemote(z,H="base64",Q={}){return G.blob(z,{},Q).then((X)=>{return A.read(X,H)})}static read(z,H="text"){return new Promise((Q,X)=>{let Y=new FileReader;if(Y.onload=(W)=>{Q({event:W,content:W.target?.result??null})},Y.onerror=(W)=>{X(W)},H==="base64")Y.readAsDataURL(z);else if(H==="buffer")Y.readAsArrayBuffer(z);else Y.readAsText(z,"UTF-8")})}static create(z,H,Q="text/plain"){return Promise.resolve(new File([H],z,{type:Q}))}static extension(z){return z.split(".").pop()??""}static isImage(z){return["jpg","jpeg","png","gif","svg","webp","bmp"].indexOf(A.extension(z).toLowerCase())>-1}}class q{static fill(z,H){for(let Q in H){let X=w(`form[data-form='${z}'] [name='${Q}']`).get(0);if(typeof X<"u")switch(X.type){case"file":case"file[]":break;default:X.value=H[Q];break}}}static values(z){let H={};return w(`form[data-form='${z}'] [name]`).each((Q)=>{let X=Q,Y;switch(X.type){case"file[]":Y=X.files??void 0;break;case"file":Y=X.files?.[0];break;default:Y=X.value;break}if(typeof Y<"u"&&Y!==null)H[X.name]=Y}),H}}class C{static retina(){return window.devicePixelRatio>=2}static portrait(){return window.screen.orientation.type==="portrait-primary"||window.screen.orientation.type==="portrait-secondary"}static landscape(){return window.screen.orientation.type==="landscape-primary"||window.screen.orientation.type==="landscape-secondary"}static orientation(){return C.portrait()?"portrait":"landscape"}static electron(){let z=window;if(typeof z<"u"&&typeof z.process==="object"&&z.process?.type==="renderer")return!0;let H=typeof globalThis<"u"?globalThis.process:void 0;if(H&&typeof H.versions==="object"&&!!H.versions?.electron)return!0;if(typeof navigator==="object"&&typeof navigator.userAgent==="string"&&navigator.userAgent.indexOf("Electron")>=0)return!0;return!1}static cordova(){return!!window.cordova}static getPlatformString(){if(navigator.userAgentData?.platform)return navigator.userAgentData.platform;let z=navigator.userAgent;if(z.includes("Win"))return"Windows";if(z.includes("Mac"))return"macOS";if(z.includes("Linux"))return"Linux";if(z.includes("FreeBSD"))return"FreeBSD";if(z.includes("WebTV"))return"webOS";return""}static desktop(z="Any"){let H=C.getPlatformString();switch(z){case"Windows":return H==="Windows"||H.includes("Win");case"macOS":return H==="macOS"||H.includes("Mac");case"Linux":return H==="Linux"||H.includes("Linux");case"FreeBSD":return H==="FreeBSD"||H.includes("FreeBSD");case"webOS":return H==="webOS"||H.includes("WebTV");case"Any":default:return["Windows","macOS","Linux","FreeBSD","webOS"].some((Q)=>H===Q||H.includes(Q.replace("macOS","Mac").replace("webOS","WebTV")))}}static mobile(z="Any"){if(navigator.userAgentData?.mobile!==void 0&&z==="Any")return navigator.userAgentData.mobile;let H=navigator.userAgent;switch(z){case"Android":return/Android/i.test(H);case"iOS":return/iPhone|iPad|iPod/i.test(H);case"Opera":return/Opera Mini/i.test(H);case"Windows":return/Windows Phone|IEMobile|WPDesktop/i.test(H);case"BlackBerry":return/BlackBerry|BB10/i.test(H);case"Any":default:return/Android|iPhone|iPad|iPod|Windows Phone|IEMobile|WPDesktop|BlackBerry|BB10/i.test(H)}}static serviceWorkers(){if(typeof navigator<"u"){if("serviceWorker"in navigator&&location.protocol.indexOf("http")>-1)return!0}return!1}}class O{static image(z){return new Promise((H,Q)=>{let X=new Image;X.onload=()=>{H(X)},X.onerror=(Y)=>{Q(Y)},X.src=z})}static file(z){return G.blob(z)}}class F{name;version;store;id;numericVersion;upgrades;storage;constructor({name:z="",version:H="",store:Q=""}){if(this.name=z,this.version=H,this.store=Q,this.upgrades={},this.version==="")this.numericVersion=0;else this.numericVersion=parseInt(H.replace(/\./g,""));if(z!==""&&H!==""&&Q!=="")this.id=`${this.name}::${this.store}::${this.version}_`;else if(z!==""&&H!=="")this.id=`${this.name}::${this.version}_`;else if(z!=="")this.id=`${this.name}::_`;else this.id=""}configuration(z){if(z.name)this.name=z.name;if(z.version)this.version=z.version;if(z.store)this.store=z.store}open(){if(this.storage instanceof Storage)return Promise.resolve(this);else if(this.storage instanceof Promise)return this.storage;else{let z=new Promise((H)=>{let Q=[];if(this.version!==""){let X="";if(this.name!==""&&this.version!==""&&this.store!=="")X=`${this.name}::${this.store}::`;else if(this.name!==""&&this.version!=="")X=`${this.name}::`;let Y=Object.keys(window.localStorage).filter((W)=>{return W.indexOf(X)===0}).map((W)=>{return W.replace(X,"").split("_")[0]}).filter((W)=>{return W.indexOf("::")===-1}).sort();if(Y.length>0){let W=Y[0],Z=parseInt(W.replace(/\./g,""));if(Z<this.numericVersion){let J=Object.keys(this.upgrades).sort(),_=J.findIndex((K)=>{let[N]=K.split("::");return parseInt(N)===Z});if(_>-1)Q=J.slice(_).filter((K)=>{let[N,L]=K.split("::");return parseInt(N)<this.numericVersion&&parseInt(L)<=this.numericVersion});let B=`${this.name}::${W}_`;if(this.name!==""&&this.version!==""&&this.store!=="")B=`${this.name}::${this.store}::${W}_`;else if(this.name!==""&&this.version!=="")B=`${this.name}::${W}_`;let I=Object.keys(window.localStorage).filter((K)=>{return K.indexOf(B)===0}).map((K)=>{return K.replace(B,"")});for(let K of I){let N=window.localStorage.getItem(`${B}${K}`);if(N!==null)window.localStorage.setItem(this.id+K,N);window.localStorage.removeItem(`${B}${K}`)}}}}H({upgrades:Q})}).then(({upgrades:H})=>{return this.storage=window.localStorage,new Promise((Q)=>{let X=()=>Q(this);this._upgrade(H,X)})});return this.storage=z,z}}set(z,H){return this.open().then(()=>{if(typeof H==="object")this.storage.setItem(this.id+z,JSON.stringify(H));else this.storage.setItem(this.id+z,String(H));return Promise.resolve({key:z,value:H})})}update(z,H){return this.get(z).then((Q)=>{if(typeof Q==="object"&&Q!==null){if(typeof H==="object"&&H!==null)H=Object.assign({},Q,H);this.storage.setItem(this.id+z,JSON.stringify(H))}else this.storage.setItem(this.id+z,String(H));return Promise.resolve({key:z,value:H})}).catch(()=>{return this.set(z,H)})}get(z){return this.open().then(()=>{return new Promise((H,Q)=>{let X=this.storage.getItem(this.id+z);try{let Y=JSON.parse(X);if(Y&&typeof Y==="object")X=Y}catch{}if(typeof X<"u"&&X!==null)H(X);else Q()})})}getAll(){return this.keys().then((z)=>{let H={},Q=[];for(let X of z)Q.push(this.get(X).then((Y)=>{H[X]=Y}));return Promise.all(Q).then(()=>H)})}contains(z){return this.keys().then((H)=>{if(H.includes(z))return Promise.resolve();else return Promise.reject()})}upgrade(z,H,Q){let X=`${parseInt(z.replace(/\./g,""))}::${parseInt(H.replace(/\./g,""))}`;return this.upgrades[X]=Q,Promise.resolve()}_upgrade(z,H){if(z.length>0)this.upgrades[z[0]].call(this,this).then(()=>{this._upgrade(z.slice(1),H)}).catch((Q)=>console.error(Q));else H()}rename(z){if(this.name!==z)return this.keys().then((H)=>{let Q=this.id;if(this.name=z,this.name!==""&&this.version!==""&&this.store!=="")this.id=`${this.name}::${this.store}::${this.version}_`;else if(this.name!==""&&this.version!=="")this.id=`${this.name}::${this.version}_`;else if(this.name!=="")this.id=`${this.name}::_`;else this.id="";let X=[];for(let Y of H){let W=this.storage.getItem(`${Q}${Y}`);if(W!==null)X.push(this.set(Y,W).then(()=>{this.storage.removeItem(`${Q}${Y}`)}))}return Promise.all(X).then(()=>{})});else return Promise.reject()}key(z,H=!1){return this.open().then(()=>{let Q=this.storage.key(z);if(H===!0)return Promise.resolve(Q??"");else return Promise.resolve((Q??"").replace(this.id,""))})}keys(z=!1){return this.open().then(()=>{return Promise.resolve(Object.keys(this.storage).filter((H)=>{return H.indexOf(this.id)===0}).map((H)=>{if(z===!0)return H;else return H.replace(this.id,"")}))})}remove(z){return this.get(z).then((H)=>{return this.storage.removeItem(this.id+z),Promise.resolve(H)})}clear(){return this.keys().then((z)=>{for(let H of z)this.remove(H);return Promise.resolve()})}}class P extends F{constructor({name:z="",version:H="",store:Q=""}){super({name:z,version:H,store:Q})}open(){if(typeof this.storage>"u")this.storage=window.sessionStorage;return Promise.resolve(this)}}class U{name;version;store;props;index;keyPath;numericVersion;upgrades;storage;constructor({name:z="",version:H="",store:Q="",props:X={},index:Y={}}){if(this.name=z,this.version=H,this.store=Q,this.props=X||{},this.index=Y,this.keyPath=X?.keyPath||"id",this.upgrades={},this.version==="")this.numericVersion=0;else this.numericVersion=parseInt(H.replace(/\./g,""))}configuration(z){if(z.name)this.name=z.name;if(z.version)this.version=z.version;if(z.store)this.store=z.store}open(){if(this.name==="")return console.error("No name has been defined for IndexedDB space."),Promise.reject();if(this.store==="")return console.error("No store has been defined for IndexedDB space."),Promise.reject();if(this.storage instanceof IDBDatabase)return Promise.resolve(this);else if(this.storage instanceof Promise)return this.storage;else{let z,H=new Promise((Q,X)=>{let Y=[],W=window.indexedDB.open(this.name,this.numericVersion);W.onerror=(Z)=>{X(Z)},W.onsuccess=(Z)=>{Q({storage:Z.target.result,upgrades:Y})},W.onupgradeneeded=(Z)=>{z=Z;let J=Z.target.result;if(Z.oldVersion<1){let B=J.createObjectStore(this.store,this.props);for(let I of Object.keys(this.index)){let K=this.index[I];B.createIndex(K.name,K.field,K.props)}}else{let B=Object.keys(this.upgrades).sort(),I=B.findIndex((K)=>{let[N]=K.split("::");return parseInt(N)===Z.oldVersion});if(I>-1)Y=B.slice(I).filter((K)=>{let[N,L]=K.split("::");return parseInt(N)<this.numericVersion&&parseInt(L)<=this.numericVersion})}let _=Z.target.transaction;if(_)_.addEventListener("complete",()=>{Q({storage:J,upgrades:Y})})}}).then(({storage:Q,upgrades:X})=>{return this.storage=Q,new Promise((Y)=>{let W=()=>Y(this);this._upgrade(X,W,z)})});return this.storage=H,H}}set(z=null,H){return this.open().then(()=>{return new Promise((Q,X)=>{let Y=this.storage.transaction(this.store,"readwrite").objectStore(this.store),W;if(z!==null){let Z={};Z[this.keyPath]=z,W=Y.put(Object.assign({},Z,H))}else W=Y.add(H);W.addEventListener("success",(Z)=>{Q({key:String(Z.target.result),value:H})}),W.addEventListener("error",(Z)=>{X(Z)})})})}update(z,H){return this.get(z).then((Q)=>{if(typeof Q>"u")return this.set(z,H);return new Promise((X,Y)=>{let Z=this.storage.transaction(this.store,"readwrite").objectStore(this.store).put(Object.assign({},Q,H));Z.addEventListener("success",(J)=>{X({key:String(J.target.result),value:H})}),Z.addEventListener("error",(J)=>{Y(J)})})})}get(z){return this.open().then(()=>{return new Promise((H,Q)=>{let Y=this.storage.transaction(this.store).objectStore(this.store).get(z);Y.addEventListener("success",(W)=>{let Z=W.target.result;if(typeof Z<"u"&&Z!==null)H(Z);else Q()}),Y.addEventListener("error",(W)=>{Q(W)})})})}getAll(){return this.open().then(()=>{return new Promise((z,H)=>{let X=this.storage.transaction(this.store).objectStore(this.store).getAll();X.addEventListener("success",(Y)=>{let W={};Y.target.result.forEach((J)=>{let _=J[this.keyPath];delete J[this.keyPath],W[_]=J}),z(W)}),X.addEventListener("error",(Y)=>{H(Y)})})})}contains(z){return this.get(z).then(()=>{return Promise.resolve()})}upgrade(z,H,Q){let X=`${parseInt(z.replace(/\./g,""))}::${parseInt(H.replace(/\./g,""))}`;return this.upgrades[X]=Q,Promise.resolve()}_upgrade(z,H,Q){if(z.length>0)this.upgrades[z[0]].call(this,this,Q).then(()=>{this._upgrade(z.slice(1),H,Q)}).catch((X)=>console.error(X));else H()}rename(){return Promise.reject()}key(){return Promise.reject()}keys(){return this.open().then(()=>{return new Promise((z,H)=>{let X=this.storage.transaction(this.store,"readwrite").objectStore(this.store).getAllKeys();X.addEventListener("success",(Y)=>{z(Y.target.result.map(String))},!1),X.addEventListener("error",(Y)=>{H(Y)},!1)})})}remove(z){return this.get(z).then((H)=>{return new Promise((Q,X)=>{let W=this.storage.transaction(this.store,"readwrite").objectStore(this.store).delete(z);W.addEventListener("success",()=>{Q(H)},!1),W.addEventListener("error",(Z)=>{X(Z)},!1)})})}clear(){return this.open().then(()=>{return new Promise((z,H)=>{let X=this.storage.transaction(this.store,"readwrite").objectStore(this.store).clear();X.addEventListener("success",()=>{z()},!1),X.addEventListener("error",(Y)=>{H(Y)},!1)})})}}class E{name;version;store;endpoint;props;storage;constructor({name:z="",version:H="",store:Q="",endpoint:X="",props:Y={}}){this.name=z,this.version=H,this.store=Q,this.endpoint=`${X}${Q}/`,this.props=Y}configuration(z){if(z.name)this.name=z.name;if(z.version)this.version=z.version;if(z.store)this.store=z.store}open(){if(typeof this.storage>"u")this.storage=G;return Promise.resolve(this)}set(z,H){return this.open().then(()=>{return this.storage.post(this.endpoint+z,H,this.props).then((Q)=>{return Promise.resolve({key:z,value:Q.json()})})})}update(z,H){return this.get(z).then((Q)=>{let X=Object.assign({},Q,H);return this.storage.put(this.endpoint+z,X,this.props).then((Y)=>{return Promise.resolve({key:z,value:Y.json()})})})}get(z){return this.open().then(()=>{return this.storage.json(this.endpoint+z,{},this.props)})}getAll(){return this.open().then(()=>{return this.storage.json(this.endpoint,{},this.props)})}contains(z){return this.keys().then((H)=>{if(H.includes(z))return Promise.resolve();else return Promise.reject()})}upgrade(){return Promise.reject()}rename(){return Promise.reject()}key(){return Promise.reject()}keys(){return this.open().then(()=>{return this.storage.json(this.endpoint,{keys:!0},this.props)})}remove(z){return this.open().then(()=>{return this.storage.delete(this.endpoint+z,{},this.props).then((H)=>{return H.json()})})}clear(){return this.open().then(()=>{return this.storage.delete(this.endpoint,{},this.props).then(()=>{})})}}var R={LocalStorage:F,SessionStorage:P,IndexedDB:U,RemoteStorage:E};class x{_configuration;adapter;callbacks;transformations;constructor(z=R.LocalStorage,H={}){this._configuration=Object.assign({},{name:"",version:"",store:""},H),this.adapter=new z(this._configuration),this.callbacks={create:[],update:[],delete:[]},this.transformations={}}configuration(z=null){if(z!==null){if(this._configuration=Object.assign({},this._configuration,z),this.adapter.configuration)this.adapter.configuration(z)}else return this._configuration}open(){return this.adapter.open().then(()=>{return Promise.resolve(this)})}set(z,H){for(let Q of Object.keys(this.transformations))if(typeof this.transformations[Q].set==="function")H=this.transformations[Q].set(z,H);return this.adapter.set(z,H).then(({key:Q,value:X})=>{for(let Y of this.callbacks.create)Y.call(null,Q,X);return Promise.resolve({key:Q,value:X})})}update(z,H){for(let Q of Object.keys(this.transformations))if(typeof this.transformations[Q].set==="function")H=this.transformations[Q].set(z,H);return this.adapter.update(z,H).then(({key:Q,value:X})=>{for(let Y of this.callbacks.update)Y.call(null,Q,X);return Promise.resolve({key:Q,value:X})})}get(z){return this.adapter.get(z).then((H)=>{for(let Q of Object.keys(this.transformations))if(typeof this.transformations[Q].get==="function")H=this.transformations[Q].get(z,H);return H})}getAll(){return this.adapter.getAll().then((z)=>{for(let H of Object.keys(z))for(let Q of Object.keys(this.transformations))if(typeof this.transformations[Q].get==="function")z[H]=this.transformations[Q].get(H,z[H]);return z})}each(z){return this.getAll().then((H)=>{let Q=[];for(let X of Object.keys(H))Q.push(z.call(this,X,H[X]));return Promise.all(Q)})}contains(z){return this.adapter.contains(z)}upgrade(z,H,Q){return this.adapter.upgrade(z,H,Q).then(()=>{return Promise.resolve(this)})}rename(z){return this.adapter.rename(z)}onCreate(z){this.callbacks.create.push(z)}onUpdate(z){this.callbacks.update.push(z)}onDelete(z){this.callbacks.delete.push(z)}addTransformation({id:z,get:H,set:Q}){this.transformations[z]={id:z,get:H,set:Q}}removeTransformation(z){delete this.transformations[z]}key(z,H=!1){return this.adapter.key(z,H)}keys(z=!1){return this.adapter.keys(z)}remove(z){return this.adapter.remove(z).then((H)=>{for(let Q of this.callbacks.delete)Q.call(null,z,H)})}clear(){return this.adapter.clear()}}class V{static capitalize(z){return z.replace(/\w\S*/g,(H)=>{return H.charAt(0).toUpperCase()+H.substring(1).toLowerCase()})}static suffix(z,H){let Q="",X=H.indexOf(z);if(X!==-1)X+=z.length,Q=H.substring(X);return Q}static selection(){let z=window.getSelection();if(z)return z.toString();return""}static prefix(z,H){let Q="",X=H.indexOf(z);if(X!==-1)Q=H.substring(0,X);return Q}static friendly(z){let H=[/[áàâãªä]/g,/[ÁÀÂÃÄ]/g,/[ÍÌÎÏ]/g,/[íìîï]/g,/[éèêë]/g,/[ÉÈÊË]/g,/[óòôõºö]/g,/[ÓÒÔÕÖ]/g,/[úùûü]/g,/[ÚÙÛÜ]/g,/ç/g,/Ç/g,/ñ/g,/Ñ/g,/_/g,/[''‹›<>']/g,/[""«»„"]/g,/[(){}[\]]/g,/[?¿!¡#$%&^*´`~/°|]/g,/[,.:;]/g,/ /g],Q=["a","A","I","i","e","E","o","O","u","U","c","C","n","N","-","","","","","","-"],X=z;for(let Y=0;Y<H.length;Y++)X=X.replace(H[Y],Q[Y]);return X}}class S{static callAsync(z,H,...Q){try{let X=z.apply(H,Q);if(X instanceof Promise)return X;else return Promise.resolve(X)}catch(X){return Promise.reject(X)}}static uuid(){if(typeof crypto<"u"&&crypto.getRandomValues)return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(z)=>{let H=parseInt(z,10);return(H^crypto.getRandomValues(new Uint8Array(1))[0]&15>>H/4).toString(16)});else{let z=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return z()+z()+"-"+z()+"-"+z()+"-"+z()+"-"+z()+z()+z()}}}if(typeof window==="object")window.Artemis=T;
|
|
1
|
+
var v=Object.defineProperty;var c=(G,J)=>{for(var Q in J)v(G,Q,{get:J[Q],enumerable:!0,configurable:!0,set:(W)=>J[Q]=()=>W})};var R={};c(R,{Util:()=>p,Text:()=>k,SpaceAdapter:()=>g,Space:()=>y,SessionStorage:()=>T,RequestTimeoutError:()=>D,RequestError:()=>w,Request:()=>U,RemoteStorage:()=>S,Preload:()=>O,Platform:()=>P,LocalStorage:()=>L,IndexedDB:()=>C,Form:()=>j,FileSystem:()=>F,DebugLevel:()=>N,Debug:()=>x,DOM:()=>K,$_ready:()=>u,$_create:()=>i,$_:()=>m});var N;((Z)=>{Z[Z.NONE=0]="NONE";Z[Z.ERROR=1]="ERROR";Z[Z.WARNING=2]="WARNING";Z[Z.INFO=3]="INFO";Z[Z.DEBUG=4]="DEBUG";Z[Z.ALL=5]="ALL"})(N||={});class x{static _level=0;static get currentLevel(){return this._level}static level(G){if(typeof G==="number")this._level=G;return this._level}static setLevel(G){this._level=G}static isEnabled(G){return this._level>=G}static log(...G){if(this._level>=4)console.log(...G)}static debug(...G){if(this._level>=4)console.debug(...G)}static info(...G){if(this._level>=3)console.info(...G)}static error(...G){if(this._level>=1)console.error(...G)}static warning(...G){if(this._level>=2)console.warn(...G)}static warn(...G){this.warning(...G)}static table(G,J){if(this._level>=4)console.table(G,J)}static group(...G){if(this._level>=4)console.group(...G)}static groupCollapsed(...G){if(this._level>=4)console.groupCollapsed(...G)}static groupEnd(){if(this._level>=4)console.groupEnd()}static time(G){if(this._level>=4)console.time(G)}static timeLog(G,...J){if(this._level>=4)console.timeLog(G,...J)}static timeEnd(G){if(this._level>=4)console.timeEnd(G)}static trace(...G){if(this._level>=4)console.trace(...G)}static assert(G,...J){if(this._level>=1)console.assert(G,...J)}static clear(){if(this._level>=4)console.clear()}static count(G){if(this._level>=4)console.count(G)}static countReset(G){if(this._level>=4)console.countReset(G)}static dir(G){if(this._level>=4)console.dir(G)}static dirxml(G){if(this._level>=4)console.dirxml(G)}static format(G,...J){let Q=G,W=0;return Q=Q.replace(/%[sdioOcj%]/g,(X)=>{if(X==="%%")return"%";if(W>=J.length)return X;let Y=J[W++];switch(X){case"%s":return String(Y);case"%d":case"%i":return String(parseInt(String(Y),10));case"%o":case"%O":return JSON.stringify(Y);case"%c":return"";case"%j":return JSON.stringify(Y);default:return X}}),Q}}class K{collection;length;constructor(G){if(!G)this.collection=[];else if(typeof G==="string")this.collection=Array.from(document.querySelectorAll(G));else if(G instanceof NodeList)this.collection=Array.from(G);else if(G instanceof K)this.collection=G.collection;else if(G instanceof Element)this.collection=[G];else if(Array.isArray(G))this.collection=G;else this.collection=[];this.length=this.collection.length}hide(){return this.style("display","none")}show(G="block"){return this.style("display",G)}addClass(G){return this.collection.forEach((J)=>J.classList.add(G)),this}removeClass(G){return this.collection.forEach((J)=>{if(!G)J.className="";else J.classList.remove(G)}),this}toggleClass(G){let J=G.split(" ");return this.collection.forEach((Q)=>{J.forEach((W)=>Q.classList.toggle(W))}),this}hasClass(G){return this.collection.every((J)=>J.classList.contains(G))}value(G){if(G!==void 0){let Q=String(G);for(let W of this.collection)if(W instanceof HTMLInputElement||W instanceof HTMLTextAreaElement||W instanceof HTMLSelectElement||W instanceof HTMLButtonElement||W instanceof HTMLOptionElement)W.value=Q;return this}if(this.length===0)return;let J=this.collection[0];if(J instanceof HTMLInputElement||J instanceof HTMLTextAreaElement||J instanceof HTMLSelectElement||J instanceof HTMLButtonElement||J instanceof HTMLOptionElement)return J.value;return}focus(){if(this.length>0)this.collection[0].focus();return this}blur(){if(this.length>0)this.collection[0].blur();return this}click(G){return this.on("click",G)}keyup(G){return this.on("keyup",G)}keydown(G){return this.on("keydown",G)}submit(G){return this.on("submit",G)}change(G){return this.on("change",G)}scroll(G){return this.on("scroll",G)}input(G){return this.on("input",G)}on(G,J,Q){let W=G.split(" "),X=typeof J==="string",Y=X?Q:J,Z=X?J:null;if(!Y)return this;return this.collection.forEach((H)=>{W.forEach((_)=>{H.addEventListener(_,($)=>{if(X&&Z){let z=$.target;if(z instanceof Element){let A=z.closest(Z);if(A&&H.contains(A))Y.call(A,$)}}else Y.call(H,$)},!1)})}),this}off(G,J){let Q=G.split(" ");return this.collection.forEach((W)=>{Q.forEach((X)=>{W.removeEventListener(X,J)})}),this}trigger(G,J){let Q=G.split(" ");return this.collection.forEach((W)=>{Q.forEach((X)=>{let Y=J!==void 0?new CustomEvent(X,{detail:J,bubbles:!0,cancelable:!0}):new Event(X,{bubbles:!0,cancelable:!0});W.dispatchEvent(Y)})}),this}filter(G){return new K(this.collection.filter((J)=>J.matches(G)))}exists(){return this.length>0}data(G,J){if(J!==void 0)return this.collection.forEach((Q)=>Q.dataset[G]=J),this;return this.length>0?this.collection[0].dataset[G]:void 0}removeData(G){return this.collection.forEach((J)=>delete J.dataset[G]),this}text(G){if(G!==void 0){let J=String(G);for(let Q of this.collection)Q.textContent=J;return this}if(this.length===0)return;return this.collection[0].textContent||""}html(G){if(G!==void 0){let J=String(G);for(let Q of this.collection)Q.innerHTML=J;return this}if(this.length===0)return;return this.collection[0].innerHTML}append(G){return this.collection.forEach((J,Q)=>{if(typeof G==="string")J.insertAdjacentHTML("beforeend",G);else{let W=Q===0?G:G.cloneNode(!0);J.appendChild(W)}}),this}prepend(G){return this.collection.forEach((J,Q)=>{if(typeof G==="string")J.insertAdjacentHTML("afterbegin",G);else{let W=Q===0?G:G.cloneNode(!0);J.prepend(W)}}),this}each(G){return this.collection.forEach((J,Q)=>G(J,Q)),this}get(G){return this.collection[G]}first(){return new K(this.collection[0]??null)}last(){return new K(this.collection[this.collection.length-1]??null)}eq(G){let J=G<0?this.collection.length+G:G;return new K(this.collection[J]??null)}isVisible(){return this.collection.some((G)=>G.style.display!=="none"&&G.offsetWidth>0&&G.offsetHeight>0)}parent(){let G=new Set;return this.collection.forEach((J)=>{if(J.parentElement)G.add(J.parentElement)}),new K(Array.from(G))}parents(){let G=new Set;return this.collection.forEach((J)=>{let Q=J.parentElement;while(Q)G.add(Q),Q=Q.parentElement}),new K(Array.from(G))}find(G){let J=new Set;for(let Q of this.collection){let W=Q.querySelectorAll(G);for(let X of W)J.add(X)}return new K(Array.from(J))}offset(){if(this.length===0)return;let G=this.collection[0].getBoundingClientRect();return{top:G.top+window.scrollY,left:G.left+window.scrollX}}width(){if(this.length===0)return 0;return this.collection[0].getBoundingClientRect().width}height(){if(this.length===0)return 0;return this.collection[0].getBoundingClientRect().height}closest(G){let J=new Set;return this.collection.forEach((Q)=>{let W=Q.closest(G);if(W)J.add(W)}),new K(Array.from(J))}attribute(G,J){if(J!==void 0)return this.collection.forEach((Q)=>Q.setAttribute(G,String(J))),this;return this.length>0?this.collection[0].getAttribute(G):void 0}removeAttribute(G){return this.collection.forEach((J)=>J.removeAttribute(G)),this}hasAttribute(G){return this.collection.every((J)=>J.hasAttribute(G))}after(G){return this.collection.forEach((J)=>J.insertAdjacentHTML("afterend",G)),this}before(G){return this.collection.forEach((J)=>J.insertAdjacentHTML("beforebegin",G)),this}style(G,J){if(typeof G==="string"&&J===void 0)return this.length>0?this.collection[0].style.getPropertyValue(G):"";return this.collection.forEach((Q)=>{if(typeof G==="string"&&J!==void 0)Q.style.setProperty(G,J);else if(typeof G==="object")Object.entries(G).forEach(([W,X])=>{Q.style.setProperty(W,String(X))})}),this}animate(G,J){return this.collection.forEach((Q)=>Q.animate(G,J)),this}fadeIn(G=400,J){return this.collection.forEach((Q,W)=>{if(getComputedStyle(Q).display==="none")Q.style.display="block";let X=Q.animate([{opacity:0},{opacity:1}],{duration:G,fill:"forwards"});if(J&&W===this.collection.length-1)X.onfinish=()=>J()}),this}fadeOut(G=400,J){return this.collection.forEach((Q,W)=>{let X=Q.animate([{opacity:1},{opacity:0}],{duration:G,fill:"forwards"});X.onfinish=()=>{if(Q.style.display="none",J&&W===this.collection.length-1)J()}}),this}matches(G){if(this.length===0)return!1;return this.collection.every((J)=>J.matches(G))}remove(){return this.collection.forEach((G)=>G.remove()),this}empty(){return this.collection.forEach((G)=>{G.innerHTML=""}),this}clone(G=!0){let J=this.collection.map((Q)=>Q.cloneNode(G));return new K(J)}replaceWith(G){for(let J=this.collection.length-1;J>=0;J--){let Q=this.collection[J];if(typeof G==="string")Q.outerHTML=G;else{let W=J===0?G:G.cloneNode(!0);Q.replaceWith(W)}}return this}reset(){return this.collection.forEach((G)=>{if(G instanceof HTMLFormElement)G.reset()}),this}property(G,J){if(J!==void 0)return this.collection.forEach((Q)=>{Q[G]=J}),this;if(this.length===0)return;return this.collection[0][G]}siblings(){let G=new Set;return this.collection.forEach((J)=>{if(J.parentElement)Array.from(J.parentElement.children).forEach((Q)=>{if(Q!==J&&Q instanceof HTMLElement)G.add(Q)})}),new K(Array.from(G))}next(){let G=new Set;return this.collection.forEach((J)=>{let Q=J.nextElementSibling;if(Q instanceof HTMLElement)G.add(Q)}),new K(Array.from(G))}prev(){let G=new Set;return this.collection.forEach((J)=>{let Q=J.previousElementSibling;if(Q instanceof HTMLElement)G.add(Q)}),new K(Array.from(G))}children(){let G=new Set;return this.collection.forEach((J)=>{Array.from(J.children).forEach((Q)=>{if(Q instanceof HTMLElement)G.add(Q)})}),new K(Array.from(G))}scrollIntoView(G){if(this.length>0)this.collection[0].scrollIntoView(G);return this}}function m(G){return new K(G)}function u(G){if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",G);else G()}function i(G,J){let Q=document.createElement(G);if(J)Object.entries(J).forEach(([W,X])=>{Q.setAttribute(W,X)});return new K(Q)}class w extends Error{status;statusText;response;constructor(G,J){super(J||`Request failed: ${G.status} ${G.statusText}`);this.name="RequestError",this.status=G.status,this.statusText=G.statusText,this.response=G}}class D extends Error{constructor(G,J){super(`Request to "${G}" timed out after ${J}ms`);this.name="RequestTimeoutError"}}class U{static serialize(G,J){if(G instanceof FormData){let W=new URLSearchParams;return G.forEach((X,Y)=>{if(typeof X==="string")W.append(Y,X)}),W.toString()}let Q=[];for(let[W,X]of Object.entries(G)){if(X===void 0||X===null)continue;let Y=J?`${J}[${W}]`:W;if(Array.isArray(X))X.forEach((Z,H)=>{if(typeof Z==="object"&&Z!==null)Q.push(U.serialize(Z,`${Y}[${H}]`));else Q.push(`${encodeURIComponent(Y)}[]=${encodeURIComponent(String(Z))}`)});else if(typeof X==="object")Q.push(U.serialize(X,Y));else Q.push(`${encodeURIComponent(Y)}=${encodeURIComponent(String(X))}`)}return Q.filter(Boolean).join("&")}static parseUrl(G){try{return new URL(G)}catch{try{return new URL(G,window.location.origin)}catch(J){throw Error(`Invalid URL: "${G}"`)}}}static createTimeoutController(G,J){let Q=new AbortController;if(!G)return{controller:Q};let W=setTimeout(()=>{Q.abort(new D(J,G))},G);return{controller:Q,timeoutId:W}}static async send(G,J,Q={},W={}){let{timeout:X,...Y}=W,Z=U.parseUrl(J),H=void 0,_={...Y.headers};if(["GET","DELETE","HEAD"].includes(G.toUpperCase())){if(Q&&typeof Q==="object"&&!(Q instanceof FormData))Object.entries(Q).forEach(([A,B])=>{if(B!==void 0&&B!==null)Z.searchParams.append(A,String(B))})}else{let A=_["Content-Type"]||_["content-type"];if(Q instanceof FormData)delete _["Content-Type"],delete _["content-type"],H=Q;else if(A==="application/json")H=JSON.stringify(Q);else{if(!A)_["Content-Type"]="application/x-www-form-urlencoded";let B=new URLSearchParams;Object.entries(Q).forEach(([I,M])=>B.append(I,String(M))),H=B}}let{controller:$,timeoutId:z}=U.createTimeoutController(X,J);try{return await fetch(Z.toString(),{...Y,method:G,headers:_,body:H,signal:$.signal})}finally{if(z)clearTimeout(z)}}static get(G,J={},Q={}){return U.send("GET",G,J,Q)}static post(G,J,Q={}){return U.send("POST",G,J,Q)}static put(G,J,Q={}){return U.send("PUT",G,J,Q)}static patch(G,J,Q={}){return U.send("PATCH",G,J,Q)}static delete(G,J={},Q={}){return U.send("DELETE",G,J,Q)}static head(G,J={},Q={}){return U.send("HEAD",G,J,Q)}static async json(G,J={},Q={}){let W=await U.get(G,J,Q);if(!W.ok)throw new w(W);return W.json()}static async postJson(G,J,Q={}){let W={...Q.headers,"Content-Type":"application/json"},X=await U.post(G,J,{...Q,headers:W});if(!X.ok)throw new w(X);return X.json()}static async blob(G,J={},Q={}){let W=await U.get(G,J,Q);if(!W.ok)throw new w(W);return W.blob()}static async text(G,J={},Q={}){let W=await U.get(G,J,Q);if(!W.ok)throw new w(W);return W.text()}static async arrayBuffer(G,J={},Q={}){let W=await U.get(G,J,Q);if(!W.ok)throw new w(W);return W.arrayBuffer()}static async exists(G,J={}){try{return(await U.head(G,{},J)).ok}catch{return!1}}}class F{static async readRemote(G,J="base64",Q={}){let W=await U.blob(G,{},Q);return F.read(W,J)}static async read(G,J="text"){switch(J){case"text":return G.text();case"buffer":return G.arrayBuffer();case"base64":return new Promise((Q,W)=>{let X=new FileReader;X.onload=()=>Q(X.result),X.onerror=()=>W(X.error),X.readAsDataURL(G)});case"binary":return new Promise((Q,W)=>{let X=new FileReader;X.onload=()=>{let Y=X.result,Z="",H=new Uint8Array(Y),_=H.byteLength;for(let $=0;$<_;$++)Z+=String.fromCharCode(H[$]);Q(Z)},X.onerror=()=>W(X.error),X.readAsArrayBuffer(G)});default:throw Error(`FileSystem.read: Unknown type ${J}`)}}static create(G,J,Q="text/plain"){return new File([J],G,{type:Q})}static download(G,J){let Q=URL.createObjectURL(G),W=document.createElement("a");W.href=Q;let X;if(J!==void 0&&J!=="")X=J;else if(G instanceof File&&G.name!=="")X=G.name;else X="download";W.download=X,document.body.appendChild(W),W.click(),document.body.removeChild(W),URL.revokeObjectURL(Q)}static extension(G,J=!1){let Q=G.split(".");if(Q.length===1||Q[0]===""&&Q.length===2&&!J)return"";return Q.pop()?.toLowerCase()??""}static isImage(G){let J=F.extension(G);return new Set(["jpg","jpeg","png","gif","svg","webp","avif","bmp","ico","tiff","heic"]).has(J)}static isVideo(G){let J=F.extension(G);return new Set(["mp4","webm","ogg","mov","avi","mkv","m4v"]).has(J)}static isAudio(G){let J=F.extension(G);return new Set(["mp3","wav","ogg","flac","aac","m4a","wma"]).has(J)}static humanSize(G,J=2){if(G===0)return"0 Bytes";let Q=1024,W=["Bytes","KB","MB","GB","TB","PB"],X=Math.floor(Math.log(G)/Math.log(Q));return parseFloat((G/Math.pow(Q,X)).toFixed(J))+" "+W[X]}}class j{static fill(G,J){let Q=document.querySelector(`form[data-form='${G}']`);if(!Q){console.warn(`Form [data-form='${G}'] not found.`);return}Object.entries(J).forEach(([W,X])=>{let Y=Q.querySelectorAll(`[name='${W}']`);if(Y.length===0)return;let H=Y[0].type,_=String(X);switch(H){case"radio":Y.forEach(($)=>{let z=$;if(z.value===_)z.checked=!0});break;case"checkbox":if(Y.length===1)Y[0].checked=!!X;else if(Array.isArray(X)){let $=X.map(String);Y.forEach((z)=>{let A=z;A.checked=$.includes(A.value)})}break;case"file":break;default:Y[0].value=_;break}})}static values(G,J={}){let{parseNumbers:Q=!0,parseBooleans:W=!0}=J,X=document.querySelector(`form[data-form='${G}']`);if(!X)return console.warn(`Form [data-form='${G}'] not found.`),{};let Y=new FormData(X),Z={},H=Array.from(new Set(Y.keys()));for(let _ of H){let $=Y.getAll(_),z=X.querySelector(`[name='${_}']`),A=z?.type;if(A==="file"){let B=$.filter((I)=>I instanceof File);if(z?.multiple||B.length>1)Z[_]=B;else Z[_]=B[0]||null;continue}if(A==="checkbox"){let B=X.querySelectorAll(`[name='${_}']`);if(B.length===1&&W){Z[_]=B[0].checked;continue}Z[_]=$.map((I)=>j.parseValue(String(I),Q));continue}if(A==="number"&&Q){if($.length>1)Z[_]=$.map((B)=>parseFloat(String(B)));else Z[_]=parseFloat(String($[0]));continue}if($.length>1)Z[_]=$.map((B)=>j.parseValue(String(B),Q));else Z[_]=j.parseValue(String($[0]),Q)}return Z}static parseValue(G,J){if(J&&G!==""&&!isNaN(Number(G)))return Number(G);return G}static reset(G){let J=document.querySelector(`form[data-form='${G}']`);if(!J){console.warn(`Form [data-form='${G}'] not found.`);return}J.reset()}static isValid(G){let J=document.querySelector(`form[data-form='${G}']`);if(!J)return console.warn(`Form [data-form='${G}'] not found.`),!1;return J.checkValidity()}static reportValidity(G){let J=document.querySelector(`form[data-form='${G}']`);if(!J)return console.warn(`Form [data-form='${G}'] not found.`),!1;return J.reportValidity()}}class P{static get retina(){return window.devicePixelRatio>=2}static get portrait(){return window.matchMedia("(orientation: portrait)").matches}static get landscape(){return window.matchMedia("(orientation: landscape)").matches}static get orientation(){return P.portrait?"portrait":"landscape"}static get darkMode(){return window.matchMedia("(prefers-color-scheme: dark)").matches}static get reducedMotion(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}static get touch(){return"ontouchstart"in window||navigator.maxTouchPoints>0}static get standalone(){let G=navigator;return window.matchMedia("(display-mode: standalone)").matches||G.standalone===!0}static get electron(){let G=window;if(navigator.userAgent.toLowerCase().includes(" electron/"))return!0;if(G.process?.type==="renderer")return!0;if(G.process?.versions?.electron)return!0;return!1}static get cordova(){return!!window.cordova}static get userAgent(){return navigator.userAgent.toLowerCase()}static desktop(G="Any"){let J=navigator;if(J.userAgentData?.mobile===!0)return!1;if(P.isIpadOS())return!1;let Q=P.userAgent,W=J.userAgentData?.platform?.toLowerCase()||"",X={ChromeOS:W.includes("cros")||Q.includes("cros"),Windows:W.includes("windows")||Q.includes("windows"),macOS:W.includes("macos")||Q.includes("macintosh"),Linux:!Q.includes("android")&&(W.includes("linux")||Q.includes("linux")),FreeBSD:W.includes("freebsd")||Q.includes("freebsd")};if(G==="Any")return Object.values(X).some((Y)=>Y);return X[G]||!1}static mobile(G="Any"){if(navigator.userAgentData?.mobile===!0&&G==="Any")return!0;let Q=P.userAgent,W={Android:Q.includes("android"),iOS:/iphone|ipod/.test(Q),iPadOS:P.isIpadOS(),WindowsMobile:/windows phone|iemobile|wpdesktop/.test(Q),BlackBerry:/blackberry|bb10/.test(Q)};if(G==="Any")return Object.values(W).some((X)=>X);return W[G]||!1}static isIpadOS(){let G=P.userAgent;if(G.includes("ipad"))return!0;if(G.includes("macintosh")&&navigator.maxTouchPoints>0)return!0;return!1}static get serviceWorkers(){return"serviceWorker"in navigator&&window.isSecureContext}static get coarsePointer(){return window.matchMedia("(pointer: coarse)").matches}static get finePointer(){return window.matchMedia("(pointer: fine)").matches}static get canHover(){return window.matchMedia("(hover: hover)").matches}}class O{static async image(G){let J=new Image;return J.src=G,await J.decode(),J}static async images(G){return Promise.all(G.map((J)=>O.image(J)))}static async file(G,J="low"){let W=await fetch(G,{priority:J});if(!W.ok)throw Error(`Preload failed for "${G}": ${W.status} ${W.statusText}`);return W}static async files(G,J="low"){return Promise.all(G.map((Q)=>O.file(Q,J)))}static async isCached(G,J){if(!("caches"in window))return!1;try{return!!await(await caches.open(G)).match(J)}catch{return!1}}static async addToCache(G,J){if(!("caches"in window))throw Error("Cache API is not supported in this browser");try{await(await caches.open(G)).add(J)}catch(Q){throw Error(`Failed to cache "${J}": ${Q instanceof Error?Q.message:String(Q)}`)}}static async addAllToCache(G,J){if(!("caches"in window))throw Error("Cache API is not supported in this browser");try{await(await caches.open(G)).addAll(J)}catch(Q){throw Error(`Failed to cache URLs: ${Q instanceof Error?Q.message:String(Q)}`)}}static async stylesheet(G){return new Promise((J,Q)=>{let W=document.createElement("link");W.rel="preload",W.as="style",W.href=G,W.onload=()=>J(),W.onerror=()=>Q(Error(`Failed to preload stylesheet: ${G}`)),document.head.appendChild(W)})}static async script(G){return new Promise((J,Q)=>{let W=document.createElement("link");W.rel="preload",W.as="script",W.href=G,W.onload=()=>J(),W.onerror=()=>Q(Error(`Failed to preload script: ${G}`)),document.head.appendChild(W)})}static async font(G,J=!0){return new Promise((Q,W)=>{let X=document.createElement("link");if(X.rel="preload",X.as="font",X.href=G,J)X.crossOrigin="anonymous";X.onload=()=>Q(),X.onerror=()=>W(Error(`Failed to preload font: ${G}`)),document.head.appendChild(X)})}}function E(G){if(G==="")return 0;let J=G.split("."),Q=0,W=[1000000000000,1e8,1e4];for(let X=0;X<Math.min(J.length,W.length);X++){let Y=parseInt(J[X],10)||0;Q+=Y*W[X]}return Q}function q(G){if(G===null||typeof G!=="object")return G;if(Array.isArray(G))return G.map((Q)=>q(Q));let J={};for(let Q of Object.keys(G))J[Q]=q(G[Q]);return J}function h(G,J){let Q=G.endsWith("/")?G.slice(0,-1):G,W=J.startsWith("/")?J:`/${J}`;return`${Q}${W}`}class V extends Error{constructor(G){super(`Key "${G}" not found in storage`);this.name="KeyNotFoundError"}}class L{name;version;store;id;numericVersion;upgrades;storage;_openPromise;constructor({name:G="",version:J="",store:Q=""}){this.name=G,this.version=J,this.store=Q,this.upgrades={},this.numericVersion=E(J),this.id=this.computeId()}computeId(){if(this.name!==""&&this.version!==""&&this.store!=="")return`${this.name}::${this.store}::${this.version}_`;else if(this.name!==""&&this.version!=="")return`${this.name}::${this.version}_`;else if(this.name!=="")return`${this.name}::_`;else return""}configuration(G){if(G.name!==void 0)this.name=G.name;if(G.version!==void 0)this.version=G.version,this.numericVersion=E(G.version);if(G.store!==void 0)this.store=G.store;this.id=this.computeId()}async open(){if(this.storage instanceof Storage)return this;if(this._openPromise)return this._openPromise;this._openPromise=(async()=>{let G=[];if(this.version!==""){let J="";if(this.name!==""&&this.version!==""&&this.store!=="")J=`${this.name}::${this.store}::`;else if(this.name!==""&&this.version!=="")J=`${this.name}::`;let Q=Object.keys(window.localStorage).filter((W)=>{return W.indexOf(J)===0}).map((W)=>{return W.replace(J,"").split("_")[0]}).filter((W)=>{return W.indexOf("::")===-1}).sort();if(Q.length>0){let W=Q[0],X=E(W);if(X<this.numericVersion){let Y=Object.keys(this.upgrades).sort(($,z)=>{let[A]=$.split("::").map(Number),[B]=z.split("::").map(Number);return A-B}),Z=Y.findIndex(($)=>{let[z]=$.split("::");return parseInt(z)===X});if(Z>-1)G=Y.slice(Z).filter(($)=>{let[z,A]=$.split("::");return parseInt(z)<this.numericVersion&&parseInt(A)<=this.numericVersion});let H=`${this.name}::${W}_`;if(this.name!==""&&this.version!==""&&this.store!=="")H=`${this.name}::${this.store}::${W}_`;else if(this.name!==""&&this.version!=="")H=`${this.name}::${W}_`;let _=Object.keys(window.localStorage).filter(($)=>{return $.indexOf(H)===0}).map(($)=>{return $.replace(H,"")});for(let $ of _){let z=window.localStorage.getItem(`${H}${$}`);if(z!==null)window.localStorage.setItem(this.id+$,z);window.localStorage.removeItem(`${H}${$}`)}}}}this.storage=window.localStorage;for(let J of G)try{await this.upgrades[J].call(this,this)}catch(Q){console.error(Q)}return this})();try{return await this._openPromise}finally{this._openPromise=void 0}}async set(G,J){if(await this.open(),typeof J==="object")this.storage.setItem(this.id+G,JSON.stringify(J));else this.storage.setItem(this.id+G,String(J));return{key:G,value:J}}async update(G,J){try{let Q=await this.get(G);if(typeof Q==="object"&&Q!==null){if(typeof J==="object"&&J!==null)J={...Q,...J};this.storage.setItem(this.id+G,JSON.stringify(J))}else this.storage.setItem(this.id+G,String(J));return{key:G,value:J}}catch{return this.set(G,J)}}async get(G){await this.open();let J=this.storage.getItem(this.id+G);if(J===null)throw new V(G);try{let Q=JSON.parse(J);if(Q&&typeof Q==="object")return Q;return J}catch{return J}}async getAll(){let G=await this.keys(),J={};for(let Q of G)try{J[Q]=await this.get(Q)}catch{}return J}async contains(G){if((await this.keys()).includes(G))return;else throw new V(G)}async upgrade(G,J,Q){let W=`${E(G)}::${E(J)}`;return this.upgrades[W]=Q,Promise.resolve()}async rename(G){if(this.name===G)throw Error("Cannot rename: new name is identical to current name");let J=await this.keys(),Q=this.id;this.name=G,this.id=this.computeId();for(let W of J){let X=this.storage.getItem(`${Q}${W}`);if(X!==null)this.storage.setItem(this.id+W,X),this.storage.removeItem(`${Q}${W}`)}}async key(G,J=!1){let Q=await this.keys(J);if(G<0||G>=Q.length)throw Error(`Index ${G} out of bounds. Space has ${Q.length} keys.`);return Q[G]}async keys(G=!1){return await this.open(),Object.keys(this.storage).filter((J)=>{return J.indexOf(this.id)===0}).map((J)=>{if(G===!0)return J;else return J.replace(this.id,"")})}async remove(G){let J=await this.get(G);return this.storage.removeItem(this.id+G),J}async clear(){let G=await this.keys();for(let J of G)this.storage.removeItem(this.id+J)}}class T extends L{constructor({name:G="",version:J="",store:Q=""}){super({name:G,version:J,store:Q})}async open(){if(this.storage instanceof Storage)return this;return this.storage=window.sessionStorage,this}async upgrade(G,J,Q){return console.warn("SessionStorage.upgrade() is a no-op. Session data is temporary and does not support migrations."),Promise.resolve()}}class b extends Error{constructor(G){super(`Key "${G}" not found in IndexedDB`);this.name="KeyNotFoundError"}}class C{name;version;store;props;index;keyPath;numericVersion;upgrades;storage;constructor({name:G="",version:J="",store:Q="",props:W={},index:X={}}){this.name=G,this.version=J,this.store=Q,this.props=W||{},this.index=X,this.keyPath=W?.keyPath||"id",this.upgrades={},this.numericVersion=E(J)}configuration(G){if(G.name!==void 0)this.name=G.name;if(G.version!==void 0)this.version=G.version,this.numericVersion=E(G.version);if(G.store!==void 0)this.store=G.store}async open(){if(this.name==="")throw Error("IndexedDB requires a name. No name has been defined for this space.");if(this.store==="")throw Error("IndexedDB requires a store name. No store has been defined for this space.");if(this.storage instanceof IDBDatabase)return this;else if(this.storage instanceof Promise)return await this.storage;else{let G=(async()=>{let J,Q=[],W=await new Promise((X,Y)=>{let Z=window.indexedDB.open(this.name,this.numericVersion);Z.onerror=(H)=>{Y(Error(`Failed to open IndexedDB "${this.name}": ${H.target.error?.message}`))},Z.onsuccess=(H)=>{X(H.target.result)},Z.onupgradeneeded=(H)=>{J=H;let _=H.target.result;if(H.oldVersion<1){let z=_.createObjectStore(this.store,this.props);for(let A of Object.keys(this.index)){let B=this.index[A];z.createIndex(B.name,B.field,B.props)}}else{let z=Object.keys(this.upgrades).sort((B,I)=>{let[M]=B.split("::").map(Number),[d]=I.split("::").map(Number);return M-d}),A=z.findIndex((B)=>{let[I]=B.split("::");return parseInt(I)===H.oldVersion});if(A>-1)Q=z.slice(A).filter((B)=>{let[I,M]=B.split("::");return parseInt(I)<this.numericVersion&&parseInt(M)<=this.numericVersion})}let $=H.target.transaction;if($)$.addEventListener("complete",()=>{})}});this.storage=W;for(let X of Q)try{await this.upgrades[X].call(this,this,J)}catch(Y){console.error(Y)}return this})();return this.storage=G,await G}}async set(G=null,J){return await this.open(),new Promise((Q,W)=>{let X=this.storage.transaction(this.store,"readwrite").objectStore(this.store),Y;if(G!==null){let Z={};Z[this.keyPath]=G,Y=X.put({...Z,...J})}else Y=X.add(J);Y.addEventListener("success",(Z)=>{Q({key:String(Z.target.result),value:J})}),Y.addEventListener("error",(Z)=>{W(Error(`Failed to set key "${G}": ${Z.target.error?.message}`))})})}async update(G,J){try{let Q=await this.get(G);if(typeof Q>"u")return this.set(G,J);return new Promise((W,X)=>{let Z=this.storage.transaction(this.store,"readwrite").objectStore(this.store).put({...Q,...J});Z.addEventListener("success",(H)=>{W({key:String(H.target.result),value:J})}),Z.addEventListener("error",(H)=>{X(Error(`Failed to update key "${G}": ${H.target.error?.message}`))})})}catch{return this.set(G,J)}}async get(G){return await this.open(),new Promise((J,Q)=>{let X=this.storage.transaction(this.store,"readonly").objectStore(this.store).get(G);X.addEventListener("success",(Y)=>{let Z=Y.target.result;if(typeof Z<"u"&&Z!==null)J(Z);else Q(new b(G))}),X.addEventListener("error",(Y)=>{Q(Error(`Failed to get key "${G}": ${Y.target.error?.message}`))})})}async getAll(){return await this.open(),new Promise((G,J)=>{let W=this.storage.transaction(this.store,"readonly").objectStore(this.store).getAll();W.addEventListener("success",(X)=>{let Y={};X.target.result.forEach((H)=>{let _=H[this.keyPath],$={...H};delete $[this.keyPath],Y[_]=$}),G(Y)}),W.addEventListener("error",(X)=>{J(Error(`Failed to get all items: ${X.target.error?.message}`))})})}async contains(G){await this.get(G)}async upgrade(G,J,Q){let W=`${E(G)}::${E(J)}`;return this.upgrades[W]=Q,Promise.resolve()}rename(){return Promise.reject(Error("IndexedDB does not support renaming databases. Create a new database and migrate data manually."))}key(){return Promise.reject(Error("IndexedDB does not support getting keys by index. Use keys() to get all keys."))}async keys(){return await this.open(),new Promise((G,J)=>{let W=this.storage.transaction(this.store,"readonly").objectStore(this.store).getAllKeys();W.addEventListener("success",(X)=>{G(X.target.result.map(String))},!1),W.addEventListener("error",(X)=>{J(Error(`Failed to get keys: ${X.target.error?.message}`))},!1)})}async remove(G){let J=await this.get(G);return new Promise((Q,W)=>{let Y=this.storage.transaction(this.store,"readwrite").objectStore(this.store).delete(G);Y.addEventListener("success",()=>{Q(J)},!1),Y.addEventListener("error",(Z)=>{W(Error(`Failed to delete key "${G}": ${Z.target.error?.message}`))},!1)})}async clear(){return await this.open(),new Promise((G,J)=>{let W=this.storage.transaction(this.store,"readwrite").objectStore(this.store).clear();W.addEventListener("success",()=>{G()},!1),W.addEventListener("error",(X)=>{J(Error(`Failed to clear store: ${X.target.error?.message}`))},!1)})}}class f extends Error{constructor(G){super(`Key "${G}" not found in remote storage`);this.name="KeyNotFoundError"}}class S{name;version;store;baseEndpoint;endpoint;props;storage;constructor({name:G="",version:J="",store:Q="",endpoint:W="",props:X={}}){this.name=G,this.version=J,this.store=Q,this.baseEndpoint=W,this.endpoint=this.computeEndpoint(),this.props=X}computeEndpoint(){if(this.store)return h(this.baseEndpoint,`${this.store}/`);return this.baseEndpoint.endsWith("/")?this.baseEndpoint:`${this.baseEndpoint}/`}configuration(G){if(G.name!==void 0)this.name=G.name;if(G.version!==void 0)this.version=G.version;if(G.store!==void 0)this.store=G.store;if(G.endpoint!==void 0)this.baseEndpoint=G.endpoint;this.endpoint=this.computeEndpoint()}async open(){if(typeof this.storage>"u")this.storage=U;return this}async set(G,J){await this.open();let W=await(await this.storage.post(this.endpoint+G,J,this.props)).json();return{key:G,value:W}}async update(G,J){await this.open();let W={...await this.get(G),...J},Y=await(await this.storage.put(this.endpoint+G,W,this.props)).json();return{key:G,value:Y}}async get(G){return await this.open(),this.storage.json(this.endpoint+G,{},this.props)}async getAll(){return await this.open(),this.storage.json(this.endpoint,{},this.props)}async contains(G){if((await this.keys()).includes(G))return;else throw new f(G)}upgrade(){return Promise.reject(Error("RemoteStorage cannot be upgraded from the client. Upgrades must be performed server-side."))}rename(){return Promise.reject(Error("RemoteStorage cannot be renamed from the client. Renaming must be performed server-side."))}key(){return Promise.reject(Error("RemoteStorage does not support getting keys by index. Use keys() to get all keys."))}async keys(){return await this.open(),this.storage.json(this.endpoint,{keys:!0},this.props)}async remove(G){return await this.open(),(await this.storage.delete(this.endpoint+G,{},this.props)).json()}async clear(){await this.open(),await this.storage.delete(this.endpoint,{},this.props)}}var g={LocalStorage:L,SessionStorage:T,IndexedDB:C,RemoteStorage:S};class y{_configuration;adapter;callbacks;transformations;constructor(G=g.LocalStorage,J={}){this._configuration={name:"",version:"",store:"",...J},this.adapter=new G(this._configuration),this.callbacks={create:[],update:[],delete:[]},this.transformations={}}configuration(G=null){if(G!==null){if(this._configuration={...this._configuration,...G},this.adapter.configuration)this.adapter.configuration(G);return}else return this._configuration}async open(){return await this.adapter.open(),this}applySetTransformations(G,J){let Q=q(J);for(let W of Object.values(this.transformations))if(typeof W.set==="function")Q=W.set(G,Q);return Q}applyGetTransformations(G,J){let Q=J;for(let W of Object.values(this.transformations))if(typeof W.get==="function")Q=W.get(G,Q);return Q}async set(G,J){let Q=this.applySetTransformations(G,J),W=await this.adapter.set(G,Q);for(let X of this.callbacks.create)X.call(null,W.key,W.value);return W}async update(G,J){let Q=this.applySetTransformations(G,J),W=await this.adapter.update(G,Q);for(let X of this.callbacks.update)X.call(null,W.key,W.value);return W}async get(G){let J=await this.adapter.get(G);return this.applyGetTransformations(G,J)}async getAll(){let G=await this.adapter.getAll(),J={};for(let Q of Object.keys(G))J[Q]=this.applyGetTransformations(Q,G[Q]);return J}async each(G){let J=await this.getAll(),Q=[];for(let[W,X]of Object.entries(J))Q.push(G.call(this,W,X));return Promise.all(Q)}contains(G){return this.adapter.contains(G)}async upgrade(G,J,Q){return await this.adapter.upgrade(G,J,Q),this}rename(G){return this.adapter.rename(G)}onCreate(G){this.callbacks.create.push(G)}onUpdate(G){this.callbacks.update.push(G)}onDelete(G){this.callbacks.delete.push(G)}addTransformation({id:G,get:J,set:Q}){this.transformations[G]={id:G,get:J,set:Q}}removeTransformation(G){delete this.transformations[G]}key(G,J=!1){return this.adapter.key(G,J)}keys(G=!1){return this.adapter.keys(G)}async remove(G){let J=await this.adapter.remove(G);for(let Q of this.callbacks.delete)Q.call(null,G,J)}clear(){return this.adapter.clear()}}class k{static capitalize(G,J={}){let{preserveCase:Q=!1}=J;return G.replace(/\w\S*/g,(W)=>{let X=W.charAt(0).toUpperCase(),Y=Q?W.substring(1):W.substring(1).toLowerCase();return X+Y})}static selection(){return window.getSelection()?.toString()||""}static suffix(G,J){let Q=J.indexOf(G);if(Q===-1)return"";return J.slice(Q+G.length)}static prefix(G,J){let Q=J.indexOf(G);if(Q===-1)return"";return J.slice(0,Q)}static friendly(G){return G.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-")}static truncate(G,J,Q="..."){if(G.length<=J)return G;return G.slice(0,J-Q.length).trimEnd()+Q}static isBlank(G){return G===null||G===void 0||G.trim()===""}}class p{static async callAsync(G,J,...Q){try{return await G.apply(J,Q)}catch(W){return Promise.reject(W)}}static uuid(){if(typeof crypto<"u"&&"randomUUID"in crypto)return crypto.randomUUID();if(typeof crypto<"u"&&"getRandomValues"in crypto)return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(J)=>{let Q=parseInt(J,10),W=crypto.getRandomValues(new Uint8Array(1))[0],X=15>>Math.floor(Q/4);return(Q^W&X).toString(16)});let G=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return`${G()}${G()}-${G()}-${G()}-${G()}-${G()}${G()}${G()}`}static debounce(G,J){let Q=null;return(...W)=>{if(Q!==null)clearTimeout(Q);Q=setTimeout(()=>{G(...W),Q=null},J)}}static throttle(G,J){let Q=!1;return(...W)=>{if(!Q)G(...W),Q=!0,setTimeout(()=>{Q=!1},J)}}}if(typeof window==="object")window.Artemis=R;
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=5F3D30EB8865BDBD64756E2164756E21
|
|
4
4
|
//# sourceMappingURL=artemis.browser.js.map
|