jmini 0.0.47 → 0.0.49

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/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var P=Object.defineProperty,W=Object.defineProperties,z=Object.getOwnPropertyDescriptor,X=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertyNames,I=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var L=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var F=Math.pow,H=(e,t,r)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))_.call(t,r)&&H(e,r,t[r]);if(I)for(var r of I(t))Y.call(t,r)&&H(e,r,t[r]);return e},k=(e,t)=>W(e,X(t));var V=(e,t)=>{var r={};for(var s in e)_.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&I)for(var s of I(e))t.indexOf(s)<0&&Y.call(e,s)&&(r[s]=e[s]);return r};var Q=(e,t)=>{for(var r in t)P(e,r,{get:t[r],enumerable:!0})},Z=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of G(t))!_.call(e,n)&&n!==r&&P(e,n,{get:()=>t[n],enumerable:!(s=z(t,n))||s.enumerable});return e};var ee=e=>Z(P({},"__esModule",{value:!0}),e);var d=(e,t,r)=>new Promise((s,n)=>{var i=l=>{try{u(r.next(l))}catch(h){n(h)}},o=l=>{try{u(r.throw(l))}catch(h){n(h)}},u=l=>l.done?s(l.value):Promise.resolve(l.value).then(i,o);u((r=r.apply(e,t)).next())}),O=function(e,t){this[0]=e,this[1]=t},j=(e,t,r)=>{var s=(o,u,l,h)=>{try{var p=r[o](u),b=(u=p.value)instanceof O,M=p.done;Promise.resolve(b?u[0]:u).then(m=>b?s(o==="return"?o:"next",u[1]?{done:m.done,value:m.value}:m,l,h):l({value:m,done:M})).catch(m=>s("throw",m,l,h))}catch(m){h(m)}},n=o=>i[o]=u=>new Promise((l,h)=>s(o,u,l,h)),i={};return r=r.apply(e,t),i[L("asyncIterator")]=()=>i,n("next"),n("throw"),n("return"),i};var U=(e,t,r)=>(t=e[L("asyncIterator")])?t.call(e):(e=e[L("iterator")](),t={},r=(s,n)=>(n=e[s])&&(t[s]=i=>new Promise((o,u,l)=>(i=n.call(e,i),l=i.done,Promise.resolve(i.value).then(h=>o({value:h,done:l}),u)))),r("next"),r("return"),t);var pe={};Q(pe,{Fetcher:()=>f,Filer:()=>g,Server:()=>B,Time:()=>c,UUID:()=>x,default:()=>fe,useStore:()=>A});module.exports=ee(pe);typeof HTMLElement!="undefined"&&(HTMLElement.prototype.position=function(){return this.getBoundingClientRect()});typeof String!="undefined"&&(String.prototype.compress=function(){return this.trim().replace(/(\s|\n|\t)/ig,"")},String.prototype.encode=function(){return encodeURIComponent(this)},String.prototype.decode=function(){return decodeURIComponent(this)},String.prototype.toUpper=function(){return this.toLocaleUpperCase()},String.prototype.toLower=function(){return this.toLocaleLowerCase()},String.prototype.toCapital=function(){let e=this;return e&&(e=e.replace(/^./,this[0].toUpper()).replace(/(\s|_|-)[a-z]{1}/ig,t=>t[1].toUpper())),e},String.prototype.clip=function(e,t){return this.slice(e,t)},String.prototype.partReplace=function(e,t){return this.slice(0,e)+t+this.slice(e+t.length)},String.prototype.toBlob=function(e){let t=atob(this.replace(/^.*,/,"")),r=new Uint8Array(t.length);for(var s=0;s<t.length;s++)r[s]=t.charCodeAt(s);try{var n=new Blob([r.buffer],{type:e})}catch(i){return!1}return n},String.prototype.toNumber=function(){return Number(this.removeLetters())},String.prototype.removeLetters=function(){return this.replace(/[\D]/ig,"")},String.prototype.removeSpecifics=function(){return this.replace(/[^\w\s\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Han}]|_/uig,"")},String.prototype.removeJP=function(){return this.replace(/[\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Han}]+/uig,"")},String.prototype.zen2hanNumber=function(){return this.replace(/[0-9]/g,function(e){return String.fromCharCode(e.charCodeAt(0)-65248)}).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g,"-").replace(/¥/,"\xA5").replace(/、/,",").replace(/(/,"(").replace(/)/,")").replace(/+/,"+")},String.prototype.escapeRegExChar=function(){return this.replace(/\\/g,"\\\\").replace(/(\?|\^|\$|\.|\||\*|\+|\(|\)|\{|\}|\[|\])/g,"\\$1")});typeof Number!="undefined"&&(Number.prototype.zeroEmbed=function(e){return String(this).padStart(e||2,"0")},Number.prototype.ratio=function(e,t=2){let r=F(10,t);return Math.round(this/e*r*100)/r},Number.prototype.rate=function(e,t=2){let r=F(10,t);return Math.round(this/e*r)/r},Number.prototype.rank=function(e=1){let t=F(10,e),r=Number(this),s=r.toLocaleString().replace(/\d/ig,"").length;return Math.round(r/F(1e3,s)*t)/t+("KMGTPEZY"[s-1]||"")},Number.prototype.rankJp=function(){let e=Number(this),t="";return e>=1e12?t=`${e/1e12}\u5146`:e>=1e8?t=`${e/1e8}\u5104`:e>=1e4?t=`${e/1e4}\u4E07`:e>=1e3?t=`${e/1e3}\u5343`:t=`${e.toLocaleString()}`,t},Number.prototype.toDate=function(e="/"){let t=String(this),r=t.slice(0,4),s=t.slice(4,6),n=t.slice(6,8),i=[];return r.length!=4||i.push(r),s.length!=2||i.push(s),n.length!=2||i.push(n),i.join(e)});if(typeof Array!="undefined"){let e=(t,r)=>{var n;let s=t;for(let i of r){if(!i)break;s=(n=(s||{})[i||""])!=null?n:null}return s};Array.prototype.toASC=function(...t){return(!t||!(t!=null&&t.length))&&(t=[""]),this.sort((r,s)=>{for(let n of t){let i=String(n||""),o=this.every(h=>{let p=Number(e(h,i.split(".")));return typeof p=="number"&&!isNaN(p)}),u=e(r,i.split(".")),l=e(s,i.split("."));if(o){if(u=Number(u),l=Number(l),u>l)return 1;if(u<l)return-1}else{if(u=String(u).replace(/(\d+)/g,h=>h.padStart(18,"0")),l=String(l).replace(/(\d+)/g,h=>h.padStart(18,"0")),u>l)return 1;if(u<l)return-1}}return 0})},Array.prototype.toDESC=function(...t){return this.toASC(...t).reverse()}}typeof File!="undefined"&&(File.prototype.convert=function(e){return e=e||"dataURL",new Promise((t,r)=>{let s=new FileReader;s.onload=i=>t(i),s.onerror=i=>r(i);let n="readAs"+(e==null?void 0:e.toCapital());s[n](this)})});var te=(e=26)=>Array.from({length:e}).map((t,r)=>{let s=r==0?25:35,n=Math.round(Math.random());return"abcdefghijkrmnopqrstuvwxyz0123456789"[Math.round(Math.random()*s)][n?"toUpper":"toLower"]()}).join(""),x=te;x.gen128Binary=()=>Array.from({length:128}).map((e,t)=>"01"[Math.round(Math.random()*1)]).join("");x.gen32Hex=(e="Formatted",t="-")=>{let r=Array.from({length:32}).map((s,n)=>"0123456789abcdef"[Math.round(Math.random()*15)]).join("").toUpper();return e=="Formatted"&&(r=[r.slice(0,8),r.slice(8,12),r.slice(12,16),r.slice(16,20),r.slice(20,32)].join(t)),r};x.to32Format=e=>[e.slice(0,8),e.slice(8,12),e.slice(12,16),e.slice(16,20),e.slice(20,32)].join("-").toUpper();var re=e=>new a.prototype.jmini(e),a=re;a.prototype={};a.extend=function(e,t=a){for(var[r,s]of Object.entries(e))t.prototype[r]=s};a.expando="__jmini_"+x();var y=(e,t)=>(e.queue.push(t),J(e),e),J=e=>d(void 0,null,function*(){if(!e.queueProcess&&e.queue.length){e.queueProcess=!0;let t=e.queue.shift();t&&(yield t()),e.queueProcess=!1,J(e)}}),E=(e,t)=>{for(let r=0;r<e.length;r++)e[r]=null;for(let[r,s]of Object.entries(t))r.match(/queue/)||(e[r]=s);return e},ne=(e,t)=>{if(t.length){for(var r=0;r<t.length;r++){let s=t[r];s&&(s[a.expando]||(a.is.element(s)||a.is.shadowRoot(s))&&(s[a.expando]={events:{}})),e[r]=s}e.length=t.length}else e.warn="No Argument(s).",e.length=0;return e.queueProcess=!1,J(e),e};a.extend({constructor:a,jmini:function(e){return this.src=e,this.srcType=a.is.what(e),this.queueProcess=!0,this.queue=[],ne(this,a.is.jmini(e)?e.get():a.is.element(e)?[e]:a.is.elements(e)?e:a.is.shadowRoot(e)?[e]:a.is.string(e)?e.match(/^#[^\.\s]*$/)?[document.getElementById(e.replace(/#/,""))]:document.querySelectorAll(e):[])}});a.prototype[String(Symbol.iterator)]=[][Symbol.iterator];a.prototype.jmini.prototype=a.prototype;{let e=function(n,i,o){let u=[];for(let l=0;l<(n.length||0);l++)u.push(i(n[l],l));return o&&(u=u.filter(l=>l!=null)),u},t=n=>(n.for((i,o)=>{if(!(a.is.element(i)||a.is.shadowRoot(i)))return;let u=i.cloneNode(),l=i.parentNode;l&&l.replaceChild(u,i),n[o]=u}),n),r=(n,i)=>(a(i).for(o=>{if(n&&(a.is.element(o)||a.is.shadowRoot(o)))if(a.is.string(n)||a.is.number(n))n=String(n),o.insertAdjacentHTML("beforeend",String(n));else if(a.is.element(n))o.appendChild(n);else{a.is.jmini(n)?n=n.get():a.is.element(n)?n=[n]:a.is.keyValueDictionary(n)&&(n=[a(n)]);for(var u=0;u<n.length;u++)r(n[u],o)}}),i),s=(n,i,...o)=>{let{p:u,s:l}={before:{p:"beforebegin",s:""},after:{p:"afterend",s:"nextSibling"}}[i]||{p:"",s:""};return n.for(h=>{if(a.is.string(o[0]))h.insertAdjacentHTML(u,o[0]);else{if(!h.parentNode)return;a(o[0]).for(b=>{o[1]&&(b=b.cloneNode(!0)),h.parentNode.insertBefore(b,h[l]||h)})}}),n};a.extend({get:function(n){return n?this[0]:e(this,i=>i)},for:function(n,i=1){let o=e(this,(u,l)=>n(u,l),1);return i?o:[]},await:function(n){return y(this,()=>new Promise((i,o)=>{setTimeout(()=>{i(this)},n)}))},abort:function(){return y(this,()=>d(this,null,function*(){return this.queue=[],this}))},callback:function(n){return y(this,()=>d(this,null,function*(){return yield n(this),this}))},click:function(){return y(this,()=>{for(var n=0;n<this.length;n++){let i=this[n];a.is.element(i)&&i.click()}return this})},focus:function(){return y(this,()=>{for(var n=0;n<this.length;n++){let i=this[n];a.is.element(i)&&i.focus()}return this})},addEvent:function(n){return y(this,()=>{let{eventType:i,eventID:o=x(),target:u,callback:l,options:h}=n;return h=T({passive:!0,capture:!1},h),this.for(p=>{if(!(a.is.element(p)||a.is.shadowRoot(p)))return;let{events:b}=p[a.expando];if(u){let M=l;l=m=>{if(m.target){if(a.is.string(u)){let S=m.target.closest(u);S&&(!S||M.call(S,m))}else if(a.is.elements(u)){for(let v of u)if(m.target==v)return M.call(v,m)}}}}if(b[o]){let M=b[o];p.removeEventListener(M.eventType,M.callback,M.options)}b[o]={eventType:i,callback:l,options:h},p.addEventListener(i,l,h)}),this})},removeEvent:function(n){return y(this,()=>{let i=a.is.array(n)?n:[n];return this.for(o=>{let{events:u}=o[a.expando];for(let l of i){let h=u[l];h&&o.removeEventListener(h.eventType,h.callback,h.options)}}),this})},html:function(n){return y(this,()=>E(this,r(n,t(this))))},empty:function(){return y(this,()=>E(this,t(this)))},append:function(n){return y(this,()=>{r(n,this)})},remove:function(){return y(this,()=>(this.for((n,i)=>{n&&a.is.element(n)&&(n.remove(),delete this[i])}),this.length=0,this.warn="Object(s?) were all removed.",this))},before:function(...n){return y(this,()=>E(this,s(this,"before",...n)))},after:function(...n){return y(this,()=>E(this,s(this,"after",...n)))},find:function(n){return y(this,()=>{let i=[],o=this[0];o||E(this,a()),(a.is.element(o)||a.is.shadowRoot(o))&&(a.is.string(n)?i=o.querySelectorAll(n):a.is.element(o)&&a(n).for(u=>{let l=o.childNodes;for(let h of l)if(h===u){i.push(h);break}else h.childNodes.length&&(i=[...i,...a(h).find(u).for(p=>p)])})),E(this,a(i))})},parent:function(n){return y(this,()=>{var o,u;let i=a(n?(o=this[0])==null?void 0:o.closest(n):(u=this[0])==null?void 0:u.parentNode);E(this,i)})},children:function(n){return y(this,()=>{let i=this[0].children;a.is.exist(n)&&(n=String(n).replace(/^ : /,""),i=n=="first"?i[0]:n=="last"?i[i.length-1]:i[Number(n)]);let o=a(i);return E(this,o)})},addClass:function(n){return y(this,()=>(n&&this.for(i=>{let o=a.is.string(n)?n.split(" "):n;i&&a.is.element(i)&&i.classList.add(...o)}),this))},removeClass:function(n){return y(this,()=>(n&&this.for(i=>{let o=a.is.string(n)?n.split(" "):n;i&&a.is.element(i)&&i.classList.remove(...o)}),this))},toggleClass:function(n){return y(this,()=>(n&&this.for(i=>{i.classList.toggle(n)}),this))},hasClass:function(n=""){if(this[0])return this[0].classList.contains(n.replace(/^\./,""))},findClass:function(n){let i=[];return this[0]&&(i=[...this[0].classList].filter(o=>o.match(n))),i},css:function(n){return y(this,()=>(this.for(i=>{if(a.is.element(i))for(let[o,u]of Object.entries(n)){if(a.is.number(u)&&o.match(/width|height|top|right|bottom|left|padding|margin|gap|border-.*radius/)){i.style[o]=u+"px";continue}i.style[o]=String(u)}}),this))},getAttribute:function(n){return this[0].getAttribute(String(n))},setAttribute:function(n,i){return y(this,()=>(this.for(o=>o.setAttribute(n,i)),this))},getStyleProperty:function(n){let i=this[0];return i&&a.is.element(i)?getComputedStyle(i).getPropertyValue(n):""},setStyleProperty:function(n,i){let o=this[0];return o&&a.is.element(o)&&o.style.setProperty(n,i),this},val:function(){var i;let n=this[0];return(n==null?void 0:n.value)||((i=n==null?void 0:n.dataset)==null?void 0:i.value)},position:function(){return a.is.element(this[0])?this[0].getBoundingClientRect():{}}})}a.flatArray=(e,t)=>{if(!a.is.array(e))return[e];let r=[];for(let s of e)r.push(...t=="-R"?a.flatArray(s,"-R"):[s]);return r};a.uniqueArray=(e,t)=>{let r=e;return t?r=Array.from(new Map(e.map(s=>[a.getKeyValue(s,t||"0"),s])).values()):r=Array.from(new Set(e)),r};a.getKeyValue=(e,t)=>{let r={},s=e;return t.split(".").forEach(n=>{s=s==null?void 0:s[n],r=s}),r};a.Stringify=(...e)=>{let[t,r,s]=e;return JSON.stringify(t,r!=null?r:(()=>{let n=new WeakSet;return(i,o)=>{if(typeof o=="object"&&o!==null){if(n.has(o))return"[Circular Reference]";n.add(o)}return o}})(),s)};a.Objectify=(e,t)=>{try{return JSON.parse(e)}catch(r){return t!=null?t:null}};a.randomNumber=(e=0,t=100,r)=>{if(e>t)return NaN;let s=[],n=e;for(;n<=t;){if(r&&r.length&&r.includes(n)){n++;continue}s.push(n),n++}let i=Math.round(Math.random()*(s.length-1))+0;return s[i]};a.try=e=>{try{return[e(),!0]}catch(t){return[t,!1]}};a.trySync=e=>d(void 0,null,function*(){try{return[yield e(),!0]}catch(t){return[t,!1]}});a.scope=e=>e();a.scopeSync=e=>d(void 0,null,function*(){return yield e()});a.createElement=function(e){var b;let{tag:t,className:r="",id:s,html:n,attr:i,style:o,parent:u}=e,l=document.createElement(t||"div");if(r&&l.classList.add(...r.split(" ")),s&&(l.id=s),i)for(let M of Object.entries(i)){let m=M[0],v=(b=M[1])!=null?b:"";if(m=="data"&&a.is.keyValueDictionary(v))for(let[S,w]of Object.entries(v))l.dataset[S]=w;else m=="for"?m="htmlFor":m=="tabindex"?m="tabIndex":m=="aria-label"&&(m="ariaLabel"),l[m]=v}if(n&&a(l).append(n),o)for(var[h,p]of Object.entries(o))l.style[h]=p;return u&&a(u).append(l),l};a.setCookie=e=>{let{hostname:t}=new URL(location.toString()),{name:r,value:s="",age:n=60*60*24*365,path:i="/",domain:o=t,secure:u=!1}=e,l=`${r}=${s}max-age=${n}path=${i}domain=${o}`;u&&(l+=" Secure"),document.cookie=l};a.getCookie=e=>{let t=document.cookie.match(new RegExp(e+"=[^]*"));return t?t[0].replace(new RegExp(e+"="),""):""};a.localStrage={set:(e,t)=>{localStorage.setItem(e,a.Stringify(t))},get:e=>{let t=localStorage.getItem(e);return a.Objectify(t,t)}};a.deleteCookie=e=>{document.cookie=e+"=max-age=0"};a.getScreenSize=()=>{let{innerHeight:e,innerWidth:t,scrollY:r,scrollX:s,pageXOffset:n,pageYOffset:i}=window,o=Number(a(document.body).getStyleProperty("--sat").removeLetters()),u=Number(a(document.body).getStyleProperty("--sab").removeLetters());return{height:e,width:t,pageHeight:e-o-u,scrollY:r,scrollX:s,pageXOffset:n,pageYOffset:i,safeAreaTop:o,safeAreaBottom:u}};a.getCursor=e=>{var s,n,i,o,u,l,h,p;let t=(o=e.pageX)!=null?o:(i=(s=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:s.pageX)!=null?i:(((n=e==null?void 0:e.originalEvent)==null?void 0:n.touches)||[])[0].pageX,r=(p=e.pageY)!=null?p:(h=(u=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:u.pageY)!=null?h:(((l=e==null?void 0:e.originalEvent)==null?void 0:l.touches)||[])[0].pageY;return{x:t,y:r}};a.pending=(e,t)=>new Promise((r,s)=>{e(r),t&&setTimeout(()=>{r(!0)},t)});a.deepMerge=(e,...t)=>{if(!t.length)return e;let r=t.shift();if(a.is.keyValueDictionary(e)&&a.is.keyValueDictionary(r))for(let s in r)a.is.keyValueDictionary(r[s])?(e[s]||Object.assign(e,{[s]:{}}),a.deepMerge(e[s],r[s])):Object.assign(e,{[s]:r[s]});return a.deepMerge(e,...t)};a.deepCopy=e=>{if(a.is.array(e))return e.map(t=>a.deepCopy(t));if(a.is.keyValueDictionary(e)){let t={};return Object.entries(e).forEach(([r,s])=>{t[r]=a.deepCopy(s)}),t}return e};a.queryParams={get:e=>{let t=new URL(e||location.href),r={};return t.searchParams.forEach((s,n)=>r[n]=s),r},set:(e,t)=>{let r=new URL(t||location.href);return Object.entries(e).forEach(([s,n])=>{r.searchParams.set(s,String(n))}),t||history.replaceState({},"",r.pathname+r.search),r.toString()},delete:(e,t)=>{let r=new URL(t||location.href);return e.forEach(s=>{r.searchParams.delete(s)}),t||history.replaceState({},"",r.pathname+r.search),r.toString()}};a.ellipsisText=(e,t)=>{let r=String(e);return r.length>t&&(r=r.slice(0,t)+" ..."),r};a.is={equal:function(e,t,r){return r==null||r?a.Stringify(e)===a.Stringify(t):e===t},what:function(e){let t="other";return this.jmini(e)?t="jmini":this.element(e)?t="element":this.elements(e)?t="elements":this.shadowRoot(e)?t="shadowRoot":this.string(e)?t="string":this.number(e)?t="number":this.array(e)?t="array":this.function(e)?t="function":this.date(e)?t="date":typeof e=="undefined"?t="undefined":this.keyValueDictionary(e)?t="keyValueDictionary":e==null?t="null":isNaN(e)&&(t="NaN"),t},exist:function(e){return e===(e!=null?e:!e)},nullish:function(e){return!this.exist(e)},jmini:function(e){return(e||{}).constructor===a},string:function(e){return typeof e=="string"},boolean:function(e){return typeof e=="boolean"},number:function(e){return!isNaN(e)&&typeof e=="number"},array:function(e){let t={}.toString.call(e);return e instanceof Array||t=="[object NodeList]"||t=="[object HTMLCollection]"},function:function(e){return typeof e=="function"},keyValueDictionary:function(e){return{}.toString.call(e)==="[object Object]"&&!this.jmini(e)},element:function(e){return e&&(e.nodeType==1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"||[window,document].includes(e))},elements:function(e){let t={}.toString.call(e),r=Number(!!e&&typeof e!="string"&&this.array(e)&&t!=="[object Text]");if(r&&t!=="[object NodeList]")for(var s of e)r&=Number(this.element(s));return!!r},shadowRoot:function(e){return e instanceof ShadowRoot},date:function(e){return this.number(new Date(e).getTime())}};var se=e=>new c.prototype.Time(e),c=se;c.prototype={};var ie=function(e){c.isTimeObject(e)&&(e=e.value),e||(e===null?e=void 0:e===void 0&&(e=new Date));let t=new Date(e);return this.set(t)};a.extend({value:new Date,validate:!1,ms:-1,weekday:-1,weekInMonth:-1,weekInYear:-1,isLastWeekInMonth:!1,year:-1,month:-1,date:-1,hours:-1,minutes:-1,seconds:-1,constructor:c,Time:ie,clone:function(){return c(this)},set:function(e){this.value=e;let t=a.is.date(e);if(this.validate=t,!t)return this.ms=-1,this.year=-1,this.month=-1,this.weekday=-1,this.weekInYear=-1,this.date=-1,this.hours=-1,this.minutes=-1,this.seconds=-1,this;this.ms=e.getTime(),this.weekday=e.getDay(),this.year=e.getFullYear(),this.month=e.getMonth()+1,this.date=e.getDate();{let r=new Date(this.year,0,1),s=new Date(r.valueOf());s.setDate(s.getDate()-(r.getDay()+1));let n=e.getTime()-s.getTime(),i=Math.ceil(n/(1e3*60*60*24));this.weekInYear=Math.ceil(i/7)}{let r=new Date(this.year,this.month-1,1),s=new Date(r.valueOf());s.setDate(s.getDate()-(r.getDay()+1));let n=e.getTime()-s.getTime(),i=Math.ceil(n/(1e3*60*60*24)),o=Math.ceil(i/7);this.weekInMonth=o}{let r=new Date(this.year,this.month,0),s=r.getDay(),n=new Date(new Date(r).setDate(r.getDate()-s));this.isLastWeekInMonth=this.date>=n.getDate()}return this.hours=e.getHours(),this.minutes=e.getMinutes(),this.seconds=e.getSeconds(),this},isPast:function(){let e=c();return this.value.valueOf()<e.value.valueOf()},isSameYear:function(e){let t=c(e);return this.year==t.year},isSameMonth:function(e){let t=c(e);return this.year==t.year&&this.month==t.month},isSameWeek:function(e){let t=c(e);return this.year==t.year&&this.weekInYear==t.weekInYear},isSameDate:function(e){let t=c(e);return this.year==t.year&&this.month==t.month&&this.date==t.date},setYear:function(e){let t=new Date(this.value.valueOf());return t.setFullYear(e),this.set(t)},setMonth:function(e){let t=new Date(this.value.valueOf());return t.setMonth(e-1),this.set(t)},setDate:function(e){let t=new Date(this.value.valueOf());return t.setDate(e),this.set(t)},setHours:function(e){let t=new Date(this.value.valueOf());return t.setHours(e),this.set(t)},setMinutes:function(e){let t=new Date(this.value.valueOf());return t.setMinutes(e),this.set(t)},setSeconds:function(e){let t=new Date(this.value.valueOf());return t.setSeconds(e),this.set(t)},setMilliseconds:function(e){let t=new Date(this.value.valueOf());return t.setMilliseconds(e),this.set(t)},addYear:function(e){return this.setYear(this.year+e)},addMonth:function(e){return this.setMonth(this.month+e)},addWeek:function(e){return this.addDate(7*e)},addDate:function(e){return this.setDate(this.date+e)},addHours:function(e){return this.setHours(this.hours+e)},addMinutes:function(e){return this.setMinutes(this.minutes+e)},addSeconds:function(e){return this.setSeconds(this.seconds+e)},toFormat:function(e){return this.validate?e.replace(/\%y/ig,this.year.zeroEmbed(4)).replace(/\%m/ig,this.month.zeroEmbed(2)).replace(/\%d/ig,this.date.zeroEmbed(2)).replace(/\%w/ig,this.weekInYear.zeroEmbed(2)).replace(/\%h/ig,this.hours.zeroEmbed(2)).replace(/\%i/ig,this.minutes.zeroEmbed(2)).replace(/\%s/ig,this.seconds.zeroEmbed(2)):""},toFormatYMD:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5"):this.toFormat("%Y/%M/%D"):""},toFormatYM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708"):this.toFormat("%Y/%M"):""},toFormatMD:function(e){return this.validate?e=="JP"?this.toFormat("%M\u6708%D\u65E5"):this.toFormat("%M/%D"):""},toFormatHM:function(e){return this.validate?e=="JP"?this.toFormat("%h\u6642%i\u5206"):this.toFormat("%h:%i"):""},toFormatYMDHM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%i\u5206"):this.toFormat("%Y/%M/%D %h:%i"):""},toFormatYMDHMS:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\u5206%s\u79D2"):this.toFormat("%Y/%M/%D %h:%i:%s"):""},toLangYMD:function(e){if(!this.validate)return"";let t=c(),r=t.diff(this);return r.dates==0?"\u4ECA\u65E5":r.dates==1?"\u6628\u65E5":r.dates>=-7&&r.dates<0?-1*r.dates+"\u65E5\u5F8C":r.dates<=7&&r.dates>0?r.dates+"\u65E5\u524D":this.isSameYear(t)?e=="JP"?this.toFormat("%M\u6708%D\u65E5"):this.toFormat("%M/%D"):e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5"):this.toFormat("%Y/%M/%D")},setFirstOfTheDay:function(){let e=new Date(this.value.valueOf());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),this.set(e)},setLastOfTheDay:function(){let e=new Date(this.value.valueOf());return e.setHours(23),e.setMinutes(59),e.setSeconds(59),e.setMilliseconds(999),this.set(e)},setFromFormatHHMM:function(e){let t=String(e).removeLetters().removeSpecifics().toNumber().zeroEmbed(4).replace(/(\d{2})(\d{2})/,"$1:$2"),[r,s]=t.split(":"),n=new Date(this.value.valueOf());return n.setHours(Number(r)),n.setMinutes(Number(s)),this.set(n)},setFromFormatHHMMSS:function(e){let t=String(e).removeLetters().removeSpecifics().toNumber().zeroEmbed(4).replace(/(\d{2})(\d{2})(\d{2})/,"$1:$2:$3"),[r,s,n]=t.split(":"),i=new Date(this.value.valueOf());return i.setHours(Number(r)),i.setMinutes(Number(s)),i.setSeconds(Number(n)),this.set(i)},getFirstDayOfTheYear:function(){return c(new Date(this.value.getFullYear(),0,1))},getLastDayOfTheYear:function(){return c(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfTheMonth:function(){return c(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfTheMonth:function(){return c(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfTheWeek:function(){let e=c(this.value);return e.addDate(-e.weekday)},getLastDayOfTheWeek:function(){let e=c(this.value);return e.addDate(6-e.weekday)},diff:function(e){return{years:this.year-e.year,months:(this.year-e.year)*12+(this.month-e.month),dates:a.scope(()=>{let t=864e5,r=this.clone().setFirstOfTheDay(),s=e.clone().setFirstOfTheDay();return Math.floor((r.ms-s.ms)/t)}),hours:a.scope(()=>{let t=36e5,r=this.clone().setMinutes(0).setSeconds(0).setMilliseconds(0),s=e.clone().setMinutes(0).setSeconds(0).setMilliseconds(0);return Math.floor((r.ms-s.ms)/t)}),minutes:a.scope(()=>{let t=6e4,r=this.clone().setSeconds(0).setMilliseconds(0),s=e.clone().setSeconds(0).setMilliseconds(0);return Math.floor((r.ms-s.ms)/t)}),seconds:a.scope(()=>{let t=this.clone().setMilliseconds(0),r=e.clone().setMilliseconds(0);return Math.floor((t.ms-r.ms)/1e3)}),ms:this.ms-e.ms}},getAge:function(e){let t=e||c(),r=t.year-this.year;return(this.month>t.month||this.month==t.month&&t.date<this.date)&&r--,r}},c);c.isTimeObject=e=>{var t;return((t=e||{})==null?void 0:t.constructor)===c};c.getFromNumberYYYYMMDD=e=>{let t=Number(e).zeroEmbed(8).replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3");return c(t+" 00:00:00")};c.getShortYMDs=(e,t)=>{let r="",s="";return e.year==t.year&&e.year==c().year?r=e.toFormatMD():r=e.toFormatYMD(),e.year!=t.year?s=t.toFormatYMD():s=t.toFormatMD(),[r,s]};c.getPeriodArray=(e,t,r)=>{let s=[],n=t;if(!t.validate||!r.validate)return s;for(;n.toFormatYMDHMS().toNumber()<=r.toFormatYMDHMS().toNumber();)s.push(n),e=="year"?n=c(n).addYear(1):e=="month"?n=c(n).addMonth(1):e=="week"?n=c(n).addWeek(1):e=="day"?n=c(n).addDate(1):e=="hours"?n=c(n).addHours(1):e=="minutes"?n=c(n).addMinutes(1):e=="seconds"&&(n=c(n).addSeconds(1));return s};c.prototype.Time.prototype=c.prototype;var D={},A={set:(e,t)=>{let r=!0;return Object.entries(e).forEach(([s,n])=>{let i=D[s]||{};i&&i.privateKey&&i.privateKey!=t&&(r=!1),D[s]={privateKey:t,value:n}}),r},update:(e,t)=>{let r=!0;return Object.entries(e).forEach(([s,n])=>{var o;let i=D[s]||{};i&&i.privateKey&&i.privateKey!=t&&(r=!1),D[s]=k(T({},D[s]),{value:T(T({},(o=D[s])==null?void 0:o.value),n)})}),r},get:(e,t)=>{let r=D[e];if(!(r&&r.privateKey&&r.privateKey!=t))return r==null?void 0:r.value},delete:(e,t)=>{let r=D[e];return r&&r.privateKey&&r.privateKey!=t?!1:(delete D[e],!0)}};var ae=(...[e,t,r])=>new C.prototype.Interval(e,t,r),C=ae;C.prototype={};var oe=function(...[e,t,r]){return this.fn=e,this.ms=t,this.key=r,this.isFinished=!1,C.abort(this.key),this.store(),this};a.extend({key:"",ms:0,timeoutIndex:-1,fn:null,isFinished:!1,Interval:oe,store:function(){A.set({["Interval_"+this.key]:this})},once:function(){if(this.fn){let e=()=>{this.fn&&this.fn(),this.isFinished=!0,this.store()};this.timeoutIndex=setTimeout(e,this.ms)}return this.store(),this},start:function(){return this.fn&&(this.timeoutIndex=setInterval(this.fn,this.ms)),this.store(),this},abort:function(){return C.abort(this.timeoutIndex),this},set_ms:function(e){return this.ms=e,this.store(),this},set_fn:function(e){return this.fn=e,this.store(),this}},C);C.abort=e=>{if(a.is.number(e))return clearInterval(e);let t=A.get("Interval_"+e);t&&clearInterval(t.timeoutIndex)};C.get=e=>A.get("Interval_"+e);C.once=(e,t,r)=>C(e,t,r).once();C.rexclude=(e,t)=>d(void 0,null,function*(){return new Promise(r=>{let s=C.get(e);if(s&&!s.isFinished)return r(!1);C(()=>{r(!0)},t,e).once()})});C.start=(e,t,r)=>C(e,t,r).start();C.prototype.Interval.prototype=C.prototype;var ue=(e,t)=>new f.prototype.Fetcher(e,t),f=ue;f.prototype={};f.waitList=[];f.setDefaultTrafficControl=0;f.setDefaultTimeout=1e3*60*10;f.isReadableStream=e=>e instanceof ReadableStream;f.isReadableStreamReader=e=>e instanceof ReadableStreamDefaultReader;f.streamToContext=(e,t)=>d(void 0,null,function*(){try{let r=(t==null?void 0:t.reader)||e.getReader();if(!f.isReadableStreamReader(r))return{ok:!1,done:!0,data:null};if(!r)return{ok:!1,done:!0,data:null};let s=(t==null?void 0:t.decoder)||new TextDecoder("utf-8"),n=yield r.read();return{ok:!0,done:n.done,data:s.decode(n.value)}}catch(r){return{ok:!1,done:!0,data:r}}});var le=function(e,t){var n;t=t||{};let r=t.body;t.body&&!a.is.string(t.body)&&((n=t.bodyStringify)==null||n)&&(r=a.Stringify(t.body||{}));let s=e;return a.is.string(e)&&!e.match(/https?:/)&&(s=location.origin+"/"+e.replace(/^\//,"")),this.url=s,this.method=t.method||"get",this.streamStatus="open",this.params=k(T({key:x(),response_format:"json",timeout:f.setDefaultTimeout,trafficControl:f.setDefaultTrafficControl,preventMultiRequest:!0},t),{headers:T(T({"Content-Type":"application/json"},f.setDefaultHeaders&&f.setDefaultHeaders()),t.headers),body:r}),this};a.extend({Fetcher:le,params:{},url:"",method:"GET",streamStatus:"closed",onStartCB:()=>{},onCompleteCB:()=>{},onRetryCB:()=>d(void 0,null,function*(){return null}),isRetry:!1,extraBody:{},setExtraBody:function(e){return this.extraBody=T(T({},this.extraBody),e),this},onErrorCB:()=>{},onResultCB:()=>{},onStreamCB:()=>{},onStart:function(e){return this.onStartCB=e,this},onStream:function(e){return this.onStreamCB=e,this},onResult:function(e){return this.onResultCB=e,this},onComplete:function(e){return this.onCompleteCB=e,this},onRetry:function(e){return this.onRetryCB=e,this},onError:function(e){return this.onErrorCB=e,this},onStreamProcess:function(e){return d(this,null,function*(){let{response:t,errorCB:r,streamCB:s,reader:n,decoder:i}=e,o=t.body,u=this,l=function(){return j(this,null,function*(){if(!t.ok){a.scope(()=>d(this,null,function*(){let{ok:v,done:S,data:w}=yield f.streamToContext(o,{reader:n,decoder:i});v&&r(w)}));return}let m=!1;for(;!m;){let{ok:v,done:S,data:w}=yield new O(f.streamToContext(o,{reader:n,decoder:i}));u.streamStatus=="abort"?(u.streamStatus="closed",n.cancel(),S=!0):u.streamStatus=="closed"&&(S=!0),S&&(m=S,n.releaseLock()),s(w,S)}})};try{for(var h=U(l()),p,b,M;p=!(b=yield h.next()).done;p=!1){let m=b.value;;}}catch(b){M=[b]}finally{try{p&&(b=h.return)&&(yield b.call(h))}finally{if(M)throw M[0]}}})},get:function(){return this.method="GET",this.send()},head:function(){return this.method="HEAD",this.send()},post:function(){return this.method="POST",this.send()},put:function(){return this.method="PUT",this.send()},delete:function(){return this.method="DELETE",this.send()},patch:function(){return this.method="PATCH",this.send()},options:function(){return this.method="OPTIONS",this.send()},send:function(){return d(this,null,function*(){var M;let e=this.params,t=performance.now(),r=0,s=new AbortController,n=setTimeout(()=>{s.abort()},e.timeout);e.signal=s.signal;let i=!1,o=500,u="InternalServerError",l={},h=null;try{f.setDefaultOnStart&&f.setDefaultOnStart(e),this.onStartCB&&this.onStartCB(e);let b=e,{key:m,response_format:v,trafficControl:S,preventMultiRequest:w,timeout:de,queries:$}=b,N=V(b,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);N.method=this.method;let K=f.waitList.includes(m);if(w&&K)throw o=429,new Error("TooManyRequests");f.waitList=[...f.waitList,m];let q=a.queryParams.set(T({},$),String(this.url));l=yield fetch(q,N).then(R=>d(this,null,function*(){return i=R.ok,o=R.status,u=R.statusText,h=R,v=="none"||v=="stream"?R:R[v]()})).catch(R=>{throw new Error(R)})}catch(m){o==200&&(o=500,i=!1),o==429&&(u="TooManyRequests"),s.signal.aborted&&(o=408,u="Timeout"),o==500&&(u=String(m)||u),l={errorCode:String(m)}}finally{clearTimeout(n),r=performance.now()-t}e.trafficControl&&(yield a.pending(()=>{},e.trafficControl)),f.waitList.splice(f.waitList.findIndex(m=>m==e.key),1);let p={ok:i,status:o,statusText:u,body:l,additionalBody:this.extraBody,requestTime:r,rawData:h};if(!i){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let m=yield this.onRetryCB(p.body,this.params,this);if(m)return this.params=m,this.send()}this.onErrorCB&&this.onErrorCB(p.body)}if(i&&this.onStreamCB&&e.response_format=="stream"){let m=(M=h.body)==null?void 0:M.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:p,reader:m,decoder:new TextDecoder("utf-8")})}return i&&this.onCompleteCB&&this.onCompleteCB(p.body),this.onResultCB&&this.onResultCB(p,e),f.setDefaultOnEnd&&f.setDefaultOnEnd(p,e),p})},abortStream:function(){this.streamStatus="abort"}},f);f.prototype.Fetcher.prototype=f.prototype;var he=e=>new g.prototype.Filer(e),g=he;g.prototype={};var me=function(e){this.ok=!0;try{let[t,r]=e.name.replace(/\s/,"").replace(/(.*)\.(.*)$/,"$1 $2").split(" ");this.file=e,this.extension=r,this.fileName=t,this.type=e.type}catch(t){console.log(t),this.ok=!1}return this};a.extend({ok:!1,extension:"",type:"",file:{},fileName:"",Filer:me,isValid:function(){return this.ok},toBlob:function(){return d(this,null,function*(){return new Blob([this.file,{type:this.type}])})},toDataURL:function(){return d(this,null,function*(){var t;return(t=(yield this.file.convert("dataURL")).target)==null?void 0:t.result})},toAarrayBuffer:function(){return d(this,null,function*(){var t;return(t=(yield this.file.convert("arrayBuffer")).target)==null?void 0:t.result})},toObjectURL:function(){return d(this,null,function*(){return URL.createObjectURL(this.file)})},updateFileName:function(e){let t=new File([this.file],e+"."+this.extension);return this.file=t,this.fileName=e,this},updateMimeType:function(e){return this.file=new File([this.file],this.fileName+"."+this.extension,{type:e}),this.type=e,this},updateExtension:function(e){let t=new File([this.file],this.fileName+"."+e);return this.file=t,this.extension=e,this}},g);g.fromFile=e=>d(void 0,null,function*(){return g(e)});g.fromBlob=(e,t)=>d(void 0,null,function*(){let r=(t==null?void 0:t.fileName)||"file",s=(t==null?void 0:t.extension)||"",n=new File([e],r+"."+s,{type:t==null?void 0:t.mimeType});return g(n)});g.fromArrayBuffer=(e,t)=>d(void 0,null,function*(){return g.fromBlob(new Blob([e],{type:(t==null?void 0:t.mimeType)||""}),t)});g.fromObjectURL=(e,t)=>d(void 0,null,function*(){let r=yield f(e,{response_format:"blob"}).get();return r.ok?g.fromBlob(r.body,t):g({})});g.fromDataURL=(e,t)=>d(void 0,null,function*(){let r=yield e.toBlob((t==null?void 0:t.mimeType)||"");return r?g.fromBlob(r,t):g({})});g.prototype.Filer.prototype=g.prototype;var ce=function(e){let t=e,r=null;return t.use((s,n,i)=>{let o=n;o.return=u=>{let{ok:l,status:h,body:p={},bodyStringify:b=!0}=u||{};h=h!=null?h:(l!=null?l:!0)&&200||403;let M=p;return b&&!a.is.string(p)&&(M=a.Stringify(p)),n.status(h).end(M)},i()}),t.onPathRouter=function(s){return r=s,this},t.pathRouter=function(s){if(!r)return;let n=r(s);return n.route(s),t.use(s,n),n},t.exception=function(s){return t.use(s),this},t},B=ce;B.getLocalIP=e=>{let t="";return a.scope(()=>{if(!e)return;let r=e.networkInterfaces();for(let[s,n]of Object.entries(r))n.forEach(i=>{!i.internal&&i.family==="IPv4"&&!i.address.match(/^(169|127)/)&&(t=i.address)})}),t};B.getIP=function(e){var s;return(((e==null?void 0:e.headers["x-forwarded-for"])||((s=e==null?void 0:e.socket)==null?void 0:s.remoteAddress)||"").toString().match(new RegExp(/(::ffff:)?(\d+\.\d+.\d+\.\d+(:\d+)?)/))||[])[2]||"UNKNOWN IP"};a.copyToClipboard=e=>d(void 0,null,function*(){let t="";a.is.string(e)?t=e:a.is.function(e)&&(t=e());let r={ok:!1,body:"NotSupported"};return yield d(void 0,null,function*(){let s;if(navigator.clipboard){if(s=yield navigator.clipboard.writeText(t).then(()=>!0,()=>!1),!s)return}else{let n=document.createElement("input");if(a(document.body).append(n),n.value=t,n.select(),s=document.execCommand("copy"),document.body.removeChild(n),!s)return}r={ok:!0,body:""}}),r});a.ImageLoader=(e,t)=>new Promise((r,s)=>{let n=t||new Image;n.onload=()=>r(n),n.onerror=i=>s(i),n.src=e});a.formatCharacter={postal:{JP:e=>{let t="--";return e=String(e).replace(/\D/ig,""),e.length==7&&(t=e.replace(/^(\d{3})(.*)/,"$1-$2")),t}},tel:{_:e=>{let t=e;return e=String(e).removeLetters(),e.length==11&&(t=e.replace(/^(\d{3})(\d{4})(\d{4})/,"$1-$2-$3")),e.length==10&&(t=e.replace(/^(\d{2})(\d{4})(\d{4})/,"$1-$2-$3")),t},mobile:e=>{let t="--";return e=String(e).removeLetters(),e.length==11&&(t=e.replace(/^(\d{3})(\d{4})(\d{4})/,"$1-$2-$3")),t},fixed:e=>{let t="--";return e=String(e).removeLetters(),e.length==10&&(t=e.replace(/^(\d{2})(\d{4})(\d{4})/,"$1-$2-$3")),t}}};a.transformer={weekday:{ENG:e=>["Sun","Mon","Tues","Wednes","Thurs","Fri","Satur"][e]+"day",JP:e=>["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"][e]+"\u66DC\u65E5",shortJP:e=>["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"][e]},wareki:e=>{let t=[],r=[],s=!1;return[{From:1868,To:1912,name:"\u660E\u6CBB"},{From:1912,To:1926,name:"\u5927\u6B63"},{From:1926,To:1989,name:"\u662D\u548C"},{From:1989,To:2019,name:"\u5E73\u6210"},{From:2019,To:1e5,name:"\u4EE4\u548C"}].forEach(i=>{let{From:o,To:u,name:l}=i;if(o<=e&&e<=u){let h=e-o+1;h==1&&(s=!0,h="\u5143"),r.push(l+h+"\u5E74"),t.push(l)}}),{era:t,value:r,gap:s}}};a.interval=C;f.setDefaultHeaders=()=>({});var fe=a;0&&(module.exports={Fetcher,Filer,Server,Time,UUID,useStore});
1
+ "use strict";var O=Object.defineProperty,ee=Object.defineProperties,te=Object.getOwnPropertyDescriptor,re=Object.getOwnPropertyDescriptors,ne=Object.getOwnPropertyNames,L=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var Y=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var I=Math.pow,W=(e,t,r)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,D=(e,t)=>{for(var r in t||(t={}))V.call(t,r)&&W(e,r,t[r]);if(L)for(var r of L(t))z.call(t,r)&&W(e,r,t[r]);return e},J=(e,t)=>ee(e,re(t));var X=(e,t)=>{var r={};for(var i in e)V.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&L)for(var i of L(e))t.indexOf(i)<0&&z.call(e,i)&&(r[i]=e[i]);return r};var ie=(e,t)=>{for(var r in t)O(e,r,{get:t[r],enumerable:!0})},se=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ne(t))!V.call(e,n)&&n!==r&&O(e,n,{get:()=>t[n],enumerable:!(i=te(t,n))||i.enumerable});return e};var ae=e=>se(O({},"__esModule",{value:!0}),e);var p=(e,t,r)=>new Promise((i,n)=>{var s=l=>{try{u(r.next(l))}catch(h){n(h)}},o=l=>{try{u(r.throw(l))}catch(h){n(h)}},u=l=>l.done?i(l.value):Promise.resolve(l.value).then(s,o);u((r=r.apply(e,t)).next())}),j=function(e,t){this[0]=e,this[1]=t},G=(e,t,r)=>{var i=(o,u,l,h)=>{try{var d=r[o](u),y=(u=d.value)instanceof j,M=d.done;Promise.resolve(y?u[0]:u).then(c=>y?i(o==="return"?o:"next",u[1]?{done:c.done,value:c.value}:c,l,h):l({value:c,done:M})).catch(c=>i("throw",c,l,h))}catch(c){h(c)}},n=o=>s[o]=u=>new Promise((l,h)=>i(o,u,l,h)),s={};return r=r.apply(e,t),s[Y("asyncIterator")]=()=>s,n("next"),n("throw"),n("return"),s};var Q=(e,t,r)=>(t=e[Y("asyncIterator")])?t.call(e):(e=e[Y("iterator")](),t={},r=(i,n)=>(n=e[i])&&(t[i]=s=>new Promise((o,u,l)=>(s=n.call(e,s),l=s.done,Promise.resolve(s.value).then(h=>o({value:h,done:l}),u)))),r("next"),r("return"),t);var ve={};ie(ve,{Fetcher:()=>f,Filer:()=>v,Server:()=>_,Time:()=>m,UUID:()=>R,default:()=>Ce,useStore:()=>P});module.exports=ae(ve);typeof HTMLElement!="undefined"&&(HTMLElement.prototype.position=function(){return this.getBoundingClientRect()});typeof String!="undefined"&&(String.prototype.compress=function(){return this.trim().replace(/(\s|\n|\t)/ig,"")},String.prototype.encode=function(){return encodeURIComponent(this)},String.prototype.decode=function(){return decodeURIComponent(this)},String.prototype.toUpper=function(){return this.toLocaleUpperCase()},String.prototype.toLower=function(){return this.toLocaleLowerCase()},String.prototype.toCapital=function(){let e=this;return e&&(e=e.replace(/^./,this[0].toUpper()).replace(/(\s|_|-)[a-z]{1}/ig,t=>t[1].toUpper())),e},String.prototype.clip=function(e,t){return this.slice(e,t)},String.prototype.partReplace=function(e,t){return this.slice(0,e)+t+this.slice(e+t.length)},String.prototype.toBlob=function(e){let t=atob(this.replace(/^.*,/,"")),r=new Uint8Array(t.length);for(var i=0;i<t.length;i++)r[i]=t.charCodeAt(i);try{var n=new Blob([r.buffer],{type:e})}catch(s){return!1}return n},String.prototype.toNumber=function(){return Number(this.removeLetters())},String.prototype.removeLetters=function(){return this.replace(/[\D]/ig,"")},String.prototype.removeSpecifics=function(){return this.replace(/[^\w\s\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Han}]|_/uig,"")},String.prototype.removeJP=function(){return this.replace(/[\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Han}]+/uig,"")},String.prototype.zen2hanNumber=function(){return this.replace(/[0-9]/g,function(e){return String.fromCharCode(e.charCodeAt(0)-65248)}).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g,"-").replace(/¥/,"\xA5").replace(/、/,",").replace(/(/,"(").replace(/)/,")").replace(/+/,"+")},String.prototype.escapeRegExChar=function(){return this.replace(/\\/g,"\\\\").replace(/(\?|\^|\$|\.|\||\*|\+|\(|\)|\{|\}|\[|\])/g,"\\$1")});typeof Number!="undefined"&&(Number.prototype.zeroEmbed=function(e){return String(this).padStart(e||2,"0")},Number.prototype.ratio=function(e,t=2){let r=I(10,t);return Math.round(this/e*r*100)/r},Number.prototype.rate=function(e,t=2){let r=I(10,t);return Math.round(this/e*r)/r},Number.prototype.rank=function(e=1){let t=I(10,e),r=Number(this),i=r.toLocaleString().replace(/\d/ig,"").length;return Math.round(r/I(1e3,i)*t)/t+("KMGTPEZY"[i-1]||"")},Number.prototype.rankJp=function(){let e=Number(this),t="";return e>=1e12?t=`${e/1e12}\u5146`:e>=1e8?t=`${e/1e8}\u5104`:e>=1e4?t=`${e/1e4}\u4E07`:e>=1e3?t=`${e/1e3}\u5343`:t=`${e.toLocaleString()}`,t},Number.prototype.toDate=function(e="/"){let t=String(this),r=t.slice(0,4),i=t.slice(4,6),n=t.slice(6,8),s=[];return r.length!=4||s.push(r),i.length!=2||s.push(i),n.length!=2||s.push(n),s.join(e)});if(typeof Array!="undefined"){let e=(t,r)=>{var n;let i=t;for(let s of r){if(!s)break;i=(n=(i||{})[s||""])!=null?n:null}return i};Array.prototype.toASC=function(...t){return(!t||!(t!=null&&t.length))&&(t=[""]),this.sort((r,i)=>{for(let n of t){let s=String(n||""),o=this.every(h=>{let d=Number(e(h,s.split(".")));return typeof d=="number"&&!isNaN(d)}),u=e(r,s.split(".")),l=e(i,s.split("."));if(o){if(u=Number(u),l=Number(l),u>l)return 1;if(u<l)return-1}else{if(u=String(u).replace(/(\d+)/g,h=>h.padStart(18,"0")),l=String(l).replace(/(\d+)/g,h=>h.padStart(18,"0")),u>l)return 1;if(u<l)return-1}}return 0})},Array.prototype.toDESC=function(...t){return this.toASC(...t).reverse()}}typeof File!="undefined"&&(File.prototype.convert=function(e){return e=e||"dataURL",new Promise((t,r)=>{let i=new FileReader;i.onload=s=>t(s),i.onerror=s=>r(s);let n="readAs"+(e==null?void 0:e.toCapital());i[n](this)})});var oe=(e=26)=>Array.from({length:e}).map((t,r)=>{let i=r==0?25:35,n=Math.round(Math.random());return"abcdefghijkrmnopqrstuvwxyz0123456789"[Math.round(Math.random()*i)][n?"toUpper":"toLower"]()}).join(""),R=oe;R.gen128Binary=()=>Array.from({length:128}).map((e,t)=>"01"[Math.round(Math.random()*1)]).join("");R.gen32Hex=(e="Formatted",t="-")=>{let r=Array.from({length:32}).map((i,n)=>"0123456789abcdef"[Math.round(Math.random()*15)]).join("").toUpper();return e=="Formatted"&&(r=[r.slice(0,8),r.slice(8,12),r.slice(12,16),r.slice(16,20),r.slice(20,32)].join(t)),r};R.to32Format=e=>[e.slice(0,8),e.slice(8,12),e.slice(12,16),e.slice(16,20),e.slice(20,32)].join("-").toUpper();var ue=e=>new a.prototype.jmini(e),a=ue;a.prototype={};a.extend=function(e,t=a){for(var[r,i]of Object.entries(e))t.prototype[r]=i};a.expando="__jmini_"+R();var b=(e,t)=>(e.queue.push(t),K(e),e),K=e=>p(void 0,null,function*(){if(!e.queueProcess&&e.queue.length){e.queueProcess=!0;let t=e.queue.shift();t&&(yield t()),e.queueProcess=!1,K(e)}}),F=(e,t)=>{for(let r=0;r<e.length;r++)e[r]=null;for(let[r,i]of Object.entries(t))r.match(/queue/)||(e[r]=i);return e},le=(e,t)=>{if(t.length){for(var r=0;r<t.length;r++){let i=t[r];i&&(i[a.expando]||(a.is.element(i)||a.is.shadowRoot(i))&&(i[a.expando]={events:{}})),e[r]=i}e.length=t.length}else e.warn="No Argument(s).",e.length=0;return e.queueProcess=!1,K(e),e};a.extend({constructor:a,jmini:function(e){return this.src=e,this.srcType=a.is.what(e),this.queueProcess=!0,this.queue=[],le(this,a.is.jmini(e)?e.get():a.is.element(e)?[e]:a.is.elements(e)?e:a.is.shadowRoot(e)?[e]:a.is.string(e)?e.match(/^#[^\.\s]*$/)?[document.getElementById(e.replace(/#/,""))]:document.querySelectorAll(e):[])}});a.prototype[String(Symbol.iterator)]=[][Symbol.iterator];a.prototype.jmini.prototype=a.prototype;{let e=function(n,s,o){let u=[];for(let l=0;l<(n.length||0);l++)u.push(s(n[l],l));return o&&(u=u.filter(l=>l!=null)),u},t=n=>(n.for((s,o)=>{if(!(a.is.element(s)||a.is.shadowRoot(s)))return;let u=s.cloneNode(),l=s.parentNode;l&&l.replaceChild(u,s),n[o]=u}),n),r=(n,s)=>(a(s).for(o=>{if(n&&(a.is.element(o)||a.is.shadowRoot(o)))if(a.is.string(n)||a.is.number(n))n=String(n),o.insertAdjacentHTML("beforeend",String(n));else if(a.is.element(n))o.appendChild(n);else{a.is.jmini(n)?n=n.get():a.is.element(n)?n=[n]:a.is.keyValueDictionary(n)&&(n=[a(n)]);for(var u=0;u<n.length;u++)r(n[u],o)}}),s),i=(n,s,...o)=>{let{p:u,s:l}={before:{p:"beforebegin",s:""},after:{p:"afterend",s:"nextSibling"}}[s]||{p:"",s:""};return n.for(h=>{if(a.is.string(o[0]))h.insertAdjacentHTML(u,o[0]);else{if(!h.parentNode)return;a(o[0]).for(y=>{o[1]&&(y=y.cloneNode(!0)),h.parentNode.insertBefore(y,h[l]||h)})}}),n};a.extend({get:function(n){return n?this[0]:e(this,s=>s)},for:function(n,s=1){let o=e(this,(u,l)=>n(u,l),1);return s?o:[]},await:function(n){return b(this,()=>new Promise((s,o)=>{setTimeout(()=>{s(this)},n)}))},abort:function(){return b(this,()=>p(this,null,function*(){return this.queue=[],this}))},callback:function(n){return b(this,()=>p(this,null,function*(){return yield n(this),this}))},click:function(){return b(this,()=>{for(var n=0;n<this.length;n++){let s=this[n];a.is.element(s)&&s.click()}return this})},focus:function(){return b(this,()=>{for(var n=0;n<this.length;n++){let s=this[n];a.is.element(s)&&s.focus()}return this})},addEvent:function(n){return b(this,()=>{let{eventType:s,eventID:o=R(),target:u,callback:l,options:h}=n;return h=D({passive:!0,capture:!1},h),this.for(d=>{if(!(a.is.element(d)||a.is.shadowRoot(d)))return;let{events:y}=d[a.expando];if(u){let M=l;l=c=>{if(c.target){if(a.is.string(u)){let g=c.target.closest(u);g&&(!g||M.call(g,c))}else if(a.is.elements(u)){for(let S of u)if(c.target==S)return M.call(S,c)}}}}if(y[o]){let M=y[o];d.removeEventListener(M.eventType,M.callback,M.options)}y[o]={eventType:s,callback:l,options:h},d.addEventListener(s,l,h)}),this})},removeEvent:function(n){return b(this,()=>{let s=a.is.array(n)?n:[n];return this.for(o=>{let{events:u}=o[a.expando];for(let l of s){let h=u[l];h&&o.removeEventListener(h.eventType,h.callback,h.options)}}),this})},html:function(n){return b(this,()=>F(this,r(n,t(this))))},empty:function(){return b(this,()=>F(this,t(this)))},append:function(n){return b(this,()=>{r(n,this)})},remove:function(){return b(this,()=>(this.for((n,s)=>{n&&a.is.element(n)&&(n.remove(),delete this[s])}),this.length=0,this.warn="Object(s?) were all removed.",this))},before:function(...n){return b(this,()=>F(this,i(this,"before",...n)))},after:function(...n){return b(this,()=>F(this,i(this,"after",...n)))},find:function(n){return b(this,()=>{let s=[],o=this[0];o||F(this,a()),(a.is.element(o)||a.is.shadowRoot(o))&&(a.is.string(n)?s=o.querySelectorAll(n):a.is.element(o)&&a(n).for(u=>{let l=o.childNodes;for(let h of l)if(h===u){s.push(h);break}else h.childNodes.length&&(s=[...s,...a(h).find(u).for(d=>d)])})),F(this,a(s))})},parent:function(n){return b(this,()=>{var o,u;let s=a(n?(o=this[0])==null?void 0:o.closest(n):(u=this[0])==null?void 0:u.parentNode);F(this,s)})},children:function(n){return b(this,()=>{let s=this[0].children;a.is.exist(n)&&(n=String(n).replace(/^ : /,""),s=n=="first"?s[0]:n=="last"?s[s.length-1]:s[Number(n)]);let o=a(s);return F(this,o)})},addClass:function(n){return b(this,()=>(n&&this.for(s=>{let o=a.is.string(n)?n.split(" "):n;s&&a.is.element(s)&&s.classList.add(...o)}),this))},removeClass:function(n){return b(this,()=>(n&&this.for(s=>{let o=a.is.string(n)?n.split(" "):n;s&&a.is.element(s)&&s.classList.remove(...o)}),this))},toggleClass:function(n){return b(this,()=>(n&&this.for(s=>{s.classList.toggle(n)}),this))},hasClass:function(n=""){if(this[0])return this[0].classList.contains(n.replace(/^\./,""))},findClass:function(n){let s=[];return this[0]&&(s=[...this[0].classList].filter(o=>o.match(n))),s},css:function(n){return b(this,()=>(this.for(s=>{if(a.is.element(s))for(let[o,u]of Object.entries(n)){if(a.is.number(u)&&o.match(/width|height|top|right|bottom|left|padding|margin|gap|border-.*radius/)){s.style[o]=u+"px";continue}s.style[o]=String(u)}}),this))},getAttribute:function(n){return this[0].getAttribute(String(n))},setAttribute:function(n,s){return b(this,()=>(this.for(o=>o.setAttribute(n,s)),this))},getStyleProperty:function(n){let s=this[0];return s&&a.is.element(s)?getComputedStyle(s).getPropertyValue(n):""},setStyleProperty:function(n,s){let o=this[0];return o&&a.is.element(o)&&o.style.setProperty(n,s),this},val:function(){var s;let n=this[0];return(n==null?void 0:n.value)||((s=n==null?void 0:n.dataset)==null?void 0:s.value)},position:function(){return a.is.element(this[0])?this[0].getBoundingClientRect():{}}})}a.flatArray=(e,t)=>{if(!a.is.array(e))return[e];let r=[];for(let i of e)r.push(...t=="-R"?a.flatArray(i,"-R"):[i]);return r};a.uniqueArray=(e,t)=>{let r=e;return t?r=Array.from(new Map(e.map(i=>[a.getKeyValue(i,t||"0"),i])).values()):r=Array.from(new Set(e)),r};a.getKeyValue=(e,t)=>{let r={},i=e;return t.split(".").forEach(n=>{i=i==null?void 0:i[n],r=i}),r};a.Stringify=(...e)=>{let[t,r,i]=e;return JSON.stringify(t,r!=null?r:(()=>{let n=new WeakSet;return(s,o)=>{if(typeof o=="object"&&o!==null){if(n.has(o))return"[Circular Reference]";n.add(o)}return o}})(),i)};a.Objectify=(e,t)=>{try{return JSON.parse(e)}catch(r){return t!=null?t:null}};a.randomNumber=(e=0,t=100,r)=>{if(e>t)return NaN;let i=[],n=e;for(;n<=t;){if(r&&r.length&&r.includes(n)){n++;continue}i.push(n),n++}let s=Math.round(Math.random()*(i.length-1))+0;return i[s]};a.try=e=>{try{return[e(),!0]}catch(t){return[t,!1]}};a.trySync=e=>p(void 0,null,function*(){try{return[yield e(),!0]}catch(t){return[t,!1]}});a.scope=e=>e();a.scopeSync=e=>p(void 0,null,function*(){return yield e()});a.createElement=function(e){var y;let{tag:t,className:r="",id:i,html:n,attr:s,style:o,parent:u}=e,l=document.createElement(t||"div");if(r&&l.classList.add(...r.split(" ")),i&&(l.id=i),s)for(let M of Object.entries(s)){let c=M[0],S=(y=M[1])!=null?y:"";if(c=="data"&&a.is.keyValueDictionary(S))for(let[g,x]of Object.entries(S))l.dataset[g]=x;else c=="for"?c="htmlFor":c=="tabindex"?c="tabIndex":c=="aria-label"&&(c="ariaLabel"),l[c]=S}if(n&&a(l).append(n),o)for(var[h,d]of Object.entries(o))l.style[h]=d;return u&&a(u).append(l),l};a.setCookie=e=>{let{hostname:t}=new URL(location.toString()),{name:r,value:i="",age:n=60*60*24*365,path:s="/",domain:o=t,secure:u=!1}=e,l=`${r}=${i}max-age=${n}path=${s}domain=${o}`;u&&(l+=" Secure"),document.cookie=l};a.getCookie=e=>{let t=document.cookie.match(new RegExp(e+"=[^]*"));return t?t[0].replace(new RegExp(e+"="),""):""};a.localStrage={set:(e,t)=>{localStorage.setItem(e,a.Stringify(t))},get:e=>{let t=localStorage.getItem(e);return a.Objectify(t,t)}};a.deleteCookie=e=>{document.cookie=e+"=max-age=0"};a.getScreenSize=()=>{let{innerHeight:e,innerWidth:t,scrollY:r,scrollX:i,pageXOffset:n,pageYOffset:s}=window,o=Number(a(document.body).getStyleProperty("--sat").removeLetters()),u=Number(a(document.body).getStyleProperty("--sab").removeLetters());return{height:e,width:t,pageHeight:e-o-u,scrollY:r,scrollX:i,pageXOffset:n,pageYOffset:s,safeAreaTop:o,safeAreaBottom:u}};a.getCursor=e=>{var i,n,s,o,u,l,h,d;let t=(o=e.pageX)!=null?o:(s=(i=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:i.pageX)!=null?s:(((n=e==null?void 0:e.originalEvent)==null?void 0:n.touches)||[])[0].pageX,r=(d=e.pageY)!=null?d:(h=(u=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:u.pageY)!=null?h:(((l=e==null?void 0:e.originalEvent)==null?void 0:l.touches)||[])[0].pageY;return{x:t,y:r}};a.pending=(e,t)=>new Promise((r,i)=>{e(r),t&&setTimeout(()=>{r(!0)},t)});a.deepMerge=(e,...t)=>{if(!t.length)return e;let r=t.shift();if(a.is.keyValueDictionary(e)&&a.is.keyValueDictionary(r))for(let i in r)a.is.keyValueDictionary(r[i])?(e[i]||Object.assign(e,{[i]:{}}),a.deepMerge(e[i],r[i])):Object.assign(e,{[i]:r[i]});return a.deepMerge(e,...t)};a.deepCopy=e=>{if(a.is.array(e))return e.map(t=>a.deepCopy(t));if(a.is.keyValueDictionary(e)){let t={};return Object.entries(e).forEach(([r,i])=>{t[r]=a.deepCopy(i)}),t}return e};a.queryParams={get:e=>{let t=new URL(e||location.href),r={};return t.searchParams.forEach((i,n)=>r[n]=i),r},set:(e,t)=>{let r=new URL(t||location.href);return Object.entries(e).forEach(([i,n])=>{r.searchParams.set(i,String(n))}),t||history.replaceState({},"",r.pathname+r.search),r.toString()},delete:(e,t)=>{let r=new URL(t||location.href);return e.forEach(i=>{r.searchParams.delete(i)}),t||history.replaceState({},"",r.pathname+r.search),r.toString()}};a.ellipsisText=(e,t)=>{let r=String(e);return r.length>t&&(r=r.slice(0,t)+" ..."),r};a.is={equal:function(e,t,r){return r==null||r?a.Stringify(e)===a.Stringify(t):e===t},what:function(e){let t="other";return this.jmini(e)?t="jmini":this.element(e)?t="element":this.elements(e)?t="elements":this.shadowRoot(e)?t="shadowRoot":this.string(e)?t="string":this.number(e)?t="number":this.array(e)?t="array":this.function(e)?t="function":this.date(e)?t="date":typeof e=="undefined"?t="undefined":this.keyValueDictionary(e)?t="keyValueDictionary":e==null?t="null":isNaN(e)&&(t="NaN"),t},exist:function(e){return e===(e!=null?e:!e)},nullish:function(e){return!this.exist(e)},jmini:function(e){return(e||{}).constructor===a},string:function(e){return typeof e=="string"},boolean:function(e){return typeof e=="boolean"},number:function(e){return!isNaN(e)&&typeof e=="number"},array:function(e){let t={}.toString.call(e);return e instanceof Array||t=="[object NodeList]"||t=="[object HTMLCollection]"},function:function(e){return typeof e=="function"},keyValueDictionary:function(e){return{}.toString.call(e)==="[object Object]"&&!this.jmini(e)},element:function(e){return e&&(e.nodeType==1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"||[window,document].includes(e))},elements:function(e){let t={}.toString.call(e),r=Number(!!e&&typeof e!="string"&&this.array(e)&&t!=="[object Text]");if(r&&t!=="[object NodeList]")for(var i of e)r&=Number(this.element(i));return!!r},shadowRoot:function(e){return e instanceof ShadowRoot},date:function(e){return this.number(new Date(e).getTime())}};var he=e=>new m.prototype.Time(e),m=he;m.prototype={};var me=function(e){m.isTimeObject(e)&&(e=e.value),e||(e===null?e=void 0:e===void 0&&(e=new Date));let t=new Date(e);return this.set(t)};a.extend({value:new Date,validate:!1,ms:-1,weekday:-1,weekInMonth:-1,weekInYear:-1,isLastWeekInMonth:!1,year:-1,month:-1,date:-1,hours:-1,minutes:-1,seconds:-1,constructor:m,Time:me,clone:function(){return m(this)},set:function(e){this.value=e;let t=a.is.date(e);if(this.validate=t,!t)return this.ms=-1,this.year=-1,this.month=-1,this.weekday=-1,this.weekInYear=-1,this.date=-1,this.hours=-1,this.minutes=-1,this.seconds=-1,this;this.ms=e.getTime(),this.weekday=e.getDay(),this.year=e.getFullYear(),this.month=e.getMonth()+1,this.date=e.getDate();{let r=new Date(this.year,0,1),i=new Date(r.valueOf());i.setDate(i.getDate()-(r.getDay()+1));let n=e.getTime()-i.getTime(),s=Math.ceil(n/(1e3*60*60*24));this.weekInYear=Math.ceil(s/7)}{let r=new Date(this.year,this.month-1,1),i=new Date(r.valueOf());i.setDate(i.getDate()-(r.getDay()+1));let n=e.getTime()-i.getTime(),s=Math.ceil(n/(1e3*60*60*24)),o=Math.ceil(s/7);this.weekInMonth=o}{let r=new Date(this.year,this.month,0),i=r.getDay(),n=new Date(new Date(r).setDate(r.getDate()-i));this.isLastWeekInMonth=this.date>=n.getDate()}return this.hours=e.getHours(),this.minutes=e.getMinutes(),this.seconds=e.getSeconds(),this},isPast:function(){let e=m();return this.value.valueOf()<e.value.valueOf()},isSameYear:function(e){let t=m(e);return this.year==t.year},isSameMonth:function(e){let t=m(e);return this.year==t.year&&this.month==t.month},isSameWeek:function(e){let t=m(e);return this.year==t.year&&this.weekInYear==t.weekInYear},isSameDate:function(e){let t=m(e);return this.year==t.year&&this.month==t.month&&this.date==t.date},setYear:function(e){let t=new Date(this.value.valueOf());return t.setFullYear(e),this.set(t)},setMonth:function(e){let t=new Date(this.value.valueOf());return t.setMonth(e-1),this.set(t)},setDate:function(e){let t=new Date(this.value.valueOf());return t.setDate(e),this.set(t)},setHours:function(e){let t=new Date(this.value.valueOf());return t.setHours(e),this.set(t)},setMinutes:function(e){let t=new Date(this.value.valueOf());return t.setMinutes(e),this.set(t)},setSeconds:function(e){let t=new Date(this.value.valueOf());return t.setSeconds(e),this.set(t)},setMilliseconds:function(e){let t=new Date(this.value.valueOf());return t.setMilliseconds(e),this.set(t)},addYear:function(e){return this.setYear(this.year+e)},addMonth:function(e){return this.setMonth(this.month+e)},addWeek:function(e){return this.addDate(7*e)},addDate:function(e){return this.setDate(this.date+e)},addHours:function(e){return this.setHours(this.hours+e)},addMinutes:function(e){return this.setMinutes(this.minutes+e)},addSeconds:function(e){return this.setSeconds(this.seconds+e)},toFormat:function(e){return this.validate?e.replace(/\%y/ig,this.year.zeroEmbed(4)).replace(/\%m/ig,this.month.zeroEmbed(2)).replace(/\%d/ig,this.date.zeroEmbed(2)).replace(/\%w/ig,this.weekInYear.zeroEmbed(2)).replace(/\%h/ig,this.hours.zeroEmbed(2)).replace(/\%i/ig,this.minutes.zeroEmbed(2)).replace(/\%s/ig,this.seconds.zeroEmbed(2)):""},toFormatYMD:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5"):this.toFormat("%Y/%M/%D"):""},toFormatYM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708"):this.toFormat("%Y/%M"):""},toFormatMD:function(e){return this.validate?e=="JP"?this.toFormat("%M\u6708%D\u65E5"):this.toFormat("%M/%D"):""},toFormatHM:function(e){return this.validate?e=="JP"?this.toFormat("%h\u6642%i\u5206"):this.toFormat("%h:%i"):""},toFormatYMDHM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%i\u5206"):this.toFormat("%Y/%M/%D %h:%i"):""},toFormatYMDHMS:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\u5206%s\u79D2"):this.toFormat("%Y/%M/%D %h:%i:%s"):""},toLangYMD:function(e){if(!this.validate)return"";let t=m(),r=t.diff(this);return r.dates==0?"\u4ECA\u65E5":r.dates==1?"\u6628\u65E5":r.dates>=-7&&r.dates<0?-1*r.dates+"\u65E5\u5F8C":r.dates<=7&&r.dates>0?r.dates+"\u65E5\u524D":this.isSameYear(t)?e=="JP"?this.toFormat("%M\u6708%D\u65E5"):this.toFormat("%M/%D"):e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5"):this.toFormat("%Y/%M/%D")},setFirstOfTheDay:function(){let e=new Date(this.value.valueOf());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),this.set(e)},setLastOfTheDay:function(){let e=new Date(this.value.valueOf());return e.setHours(23),e.setMinutes(59),e.setSeconds(59),e.setMilliseconds(999),this.set(e)},setFromFormatHHMM:function(e){let t=String(e).removeLetters().removeSpecifics().toNumber().zeroEmbed(4).replace(/(\d{2})(\d{2})/,"$1:$2"),[r,i]=t.split(":"),n=new Date(this.value.valueOf());return n.setHours(Number(r)),n.setMinutes(Number(i)),this.set(n)},setFromFormatHHMMSS:function(e){let t=String(e).removeLetters().removeSpecifics().toNumber().zeroEmbed(4).replace(/(\d{2})(\d{2})(\d{2})/,"$1:$2:$3"),[r,i,n]=t.split(":"),s=new Date(this.value.valueOf());return s.setHours(Number(r)),s.setMinutes(Number(i)),s.setSeconds(Number(n)),this.set(s)},getFirstDayOfTheYear:function(){return m(new Date(this.value.getFullYear(),0,1))},getLastDayOfTheYear:function(){return m(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfTheMonth:function(){return m(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfTheMonth:function(){return m(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfTheWeek:function(){let e=m(this.value);return e.addDate(-e.weekday)},getLastDayOfTheWeek:function(){let e=m(this.value);return e.addDate(6-e.weekday)},diff:function(e){return{years:this.year-e.year,months:(this.year-e.year)*12+(this.month-e.month),dates:a.scope(()=>{let t=864e5,r=this.clone().setFirstOfTheDay(),i=e.clone().setFirstOfTheDay();return Math.floor((r.ms-i.ms)/t)}),hours:a.scope(()=>{let t=36e5,r=this.clone().setMinutes(0).setSeconds(0).setMilliseconds(0),i=e.clone().setMinutes(0).setSeconds(0).setMilliseconds(0);return Math.floor((r.ms-i.ms)/t)}),minutes:a.scope(()=>{let t=6e4,r=this.clone().setSeconds(0).setMilliseconds(0),i=e.clone().setSeconds(0).setMilliseconds(0);return Math.floor((r.ms-i.ms)/t)}),seconds:a.scope(()=>{let t=this.clone().setMilliseconds(0),r=e.clone().setMilliseconds(0);return Math.floor((t.ms-r.ms)/1e3)}),ms:this.ms-e.ms}},getAge:function(e){let t=e||m(),r=t.year-this.year;return(this.month>t.month||this.month==t.month&&t.date<this.date)&&r--,r}},m);m.isTimeObject=e=>{var t;return((t=e||{})==null?void 0:t.constructor)===m};m.getFromNumberYYYYMMDD=e=>{let t=Number(e).zeroEmbed(8).replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3");return m(t+" 00:00:00")};m.getShortYMDs=(e,t)=>{let r="",i="";return e.year==t.year&&e.year==m().year?r=e.toFormatMD():r=e.toFormatYMD(),e.year!=t.year?i=t.toFormatYMD():i=t.toFormatMD(),[r,i]};m.getPeriodArray=(e,t,r)=>{let i=[],n=t;if(!t.validate||!r.validate)return i;for(;n.toFormatYMDHMS().toNumber()<=r.toFormatYMDHMS().toNumber();)i.push(n),e=="year"?n=m(n).addYear(1):e=="month"?n=m(n).addMonth(1):e=="week"?n=m(n).addWeek(1):e=="day"?n=m(n).addDate(1):e=="hours"?n=m(n).addHours(1):e=="minutes"?n=m(n).addMinutes(1):e=="seconds"&&(n=m(n).addSeconds(1));return i};m.prototype.Time.prototype=m.prototype;var E={},P={set:(e,t)=>{let r=!0;return Object.entries(e).forEach(([i,n])=>{let s=E[i]||{};s&&s.privateKey&&s.privateKey!=t&&(r=!1),E[i]={privateKey:t,value:n}}),r},update:(e,t)=>{let r=!0;return Object.entries(e).forEach(([i,n])=>{var o;let s=E[i]||{};s&&s.privateKey&&s.privateKey!=t&&(r=!1),E[i]=J(D({},E[i]),{value:D(D({},(o=E[i])==null?void 0:o.value),n)})}),r},get:(e,t)=>{let r=E[e];if(!(r&&r.privateKey&&r.privateKey!=t))return r==null?void 0:r.value},delete:(e,t)=>{let r=E[e];return r&&r.privateKey&&r.privateKey!=t?!1:(delete E[e],!0)}};var ce=(...[e,t,r])=>new C.prototype.Interval(e,t,r),C=ce;C.prototype={};var fe=function(...[e,t,r]){return this.fn=e,this.ms=t,this.key=r,this.isFinished=!1,C.abort(this.key),this.store(),this};a.extend({key:"",ms:0,timeoutIndex:-1,fn:null,isFinished:!1,Interval:fe,store:function(){P.set({["Interval_"+this.key]:this})},once:function(){if(this.fn){let e=()=>{this.fn&&this.fn(),this.isFinished=!0,this.store()};this.timeoutIndex=setTimeout(e,this.ms)}return this.store(),this},start:function(){return this.fn&&(this.timeoutIndex=setInterval(this.fn,this.ms)),this.store(),this},abort:function(){return C.abort(this.timeoutIndex),this},setState:function(e){return Object.entries(e).forEach(([t,r])=>{this.hasOwnProperty(t)&&(this[t]=r)}),this.store(),this}},C);C.abort=e=>{if(a.is.number(e))return clearInterval(e);let t=P.get("Interval_"+e);t&&(t&&clearInterval(t.timeoutIndex),t.setState({isFinished:!0}))};C.get=e=>P.get("Interval_"+e);C.once=(e,t,r)=>C(e,t,r).once();C.series=(e,t)=>p(void 0,null,function*(){return new Promise(r=>{let i=C.get(e);if(i&&!i.isFinished)return r(null);let n=()=>{C.abort(e)};r(n),t&&C(n,t,e).once()})});C.start=(e,t,r)=>C(e,t,r).start();C.prototype.Interval.prototype=C.prototype;var pe=(e,t)=>new f.prototype.Fetcher(e,t),f=pe;f.prototype={};f.waitList=[];f.setDefaultTrafficControl=0;f.setDefaultTimeout=1e3*60*10;f.isReadableStream=e=>e instanceof ReadableStream;f.isReadableStreamReader=e=>e instanceof ReadableStreamDefaultReader;f.streamToContext=(e,t)=>p(void 0,null,function*(){try{let r=(t==null?void 0:t.reader)||e.getReader();if(!f.isReadableStreamReader(r))return{ok:!1,done:!0,data:null};if(!r)return{ok:!1,done:!0,data:null};let i=(t==null?void 0:t.decoder)||new TextDecoder("utf-8"),n=yield r.read();return{ok:!0,done:n.done,data:i.decode(n.value)}}catch(r){return{ok:!1,done:!0,data:r}}});var de=function(e,t){var n;t=t||{};let r=t.body;t.body&&!a.is.string(t.body)&&((n=t.bodyStringify)==null||n)&&(r=a.Stringify(t.body||{}));let i=e;return a.is.string(e)&&!e.match(/https?:/)&&(i=location.origin+"/"+e.replace(/^\//,"")),this.url=i,this.method=t.method||"get",this.streamStatus="open",this.params=J(D({key:R(),response_format:"json",timeout:f.setDefaultTimeout,trafficControl:f.setDefaultTrafficControl,preventMultiRequest:!0},t),{headers:D(D({"Content-Type":"application/json"},f.setDefaultHeaders&&f.setDefaultHeaders()),t.headers),body:r}),this};a.extend({Fetcher:de,params:{},url:"",method:"GET",streamStatus:"closed",onStartCB:()=>p(void 0,null,function*(){}),onKeyDuplicateCB:()=>p(void 0,null,function*(){}),onCompleteCB:()=>{},onRetryCB:()=>p(void 0,null,function*(){return null}),isRetry:!1,extraBody:{},setExtraBody:function(e){return this.extraBody=D(D({},this.extraBody),e),this},onErrorCB:()=>{},onResultCB:()=>{},onStreamCB:()=>{},onStart:function(e){return this.onStartCB=e,this},onKeyDuplicate:function(e){return this.onKeyDuplicateCB=e,this},onStream:function(e){return this.onStreamCB=e,this},onResult:function(e){return this.onResultCB=e,this},onComplete:function(e){return this.onCompleteCB=e,this},onRetry:function(e){return this.onRetryCB=e,this},onError:function(e){return this.onErrorCB=e,this},onStreamProcess:function(e){return p(this,null,function*(){let{response:t,errorCB:r,streamCB:i,reader:n,decoder:s}=e,o=t.body,u=this,l=function(){return G(this,null,function*(){if(!t.ok){a.scope(()=>p(this,null,function*(){let{ok:S,done:g,data:x}=yield f.streamToContext(o,{reader:n,decoder:s});S&&r(x)}));return}let c=!1;for(;!c;){let{ok:S,done:g,data:x}=yield new j(f.streamToContext(o,{reader:n,decoder:s}));u.streamStatus=="abort"?(u.streamStatus="closed",n.cancel(),g=!0):u.streamStatus=="closed"&&(g=!0),g&&(c=g,n.releaseLock()),i(x,g)}})};try{for(var h=Q(l()),d,y,M;d=!(y=yield h.next()).done;d=!1){let c=y.value;;}}catch(y){M=[y]}finally{try{d&&(y=h.return)&&(yield y.call(h))}finally{if(M)throw M[0]}}})},get:function(){return this.method="GET",this.send()},head:function(){return this.method="HEAD",this.send()},post:function(){return this.method="POST",this.send()},put:function(){return this.method="PUT",this.send()},delete:function(){return this.method="DELETE",this.send()},patch:function(){return this.method="PATCH",this.send()},options:function(){return this.method="OPTIONS",this.send()},send:function(){return p(this,null,function*(){var q;let e=this.params,t=performance.now(),$=e,{key:r,response_format:i,trafficControl:n,preventMultiRequest:s,timeout:o,queries:u}=$,l=X($,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);l.method=this.method;let h=[this.method,r].join("."),d=f.waitList.includes(h);f.waitList=[...f.waitList,h];let y=!1,M=!1,c=!1,S=0,g=500,x="InternalServerError",k={},N=null,B=new AbortController,Z=setTimeout(()=>{B.abort()},e.timeout);e.signal=B.signal;let H=()=>{y=!0,B.abort()},U={isCancelled:y,isAborted:M,ok:!1,status:0,statusText:"CANCELLED",body:k,requestTime:0,rawData:null};try{if(f.setDefaultOnStart&&(yield f.setDefaultOnStart(e,H)),this.onStartCB&&(yield this.onStartCB(e,H)),y)return U;if(d){if(this.onKeyDuplicateCB&&(yield this.onKeyDuplicateCB(H)),y)return U;if(s)throw g=429,new Error("TooManyRequests")}let T=a.queryParams.set(D({},u),String(this.url));k=yield fetch(T,l).then(A=>p(this,null,function*(){return c=A.ok,g=A.status,x=A.statusText,N=A,i=="none"||i=="stream"?A:A[i]()})).catch(A=>{throw new Error(A)})}catch(T){g==200&&(g=500,c=!1),g==429&&(x="TooManyRequests"),B.signal.aborted&&(g=408,x="Timeout",M=!0),g==500&&(x=String(T)||x),k={errorCode:String(T)}}finally{clearTimeout(Z),S=performance.now()-t}let w={isCancelled:y,isAborted:M,ok:c,status:g,statusText:x,body:k,additionalBody:this.extraBody,requestTime:S,rawData:N};if(!c){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let T=yield this.onRetryCB(w.body,this.params,this);if(T)return this.params=T,this.send()}this.onErrorCB&&this.onErrorCB(w.body)}if(c&&this.onStreamCB&&e.response_format=="stream"){let T=(q=N.body)==null?void 0:q.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:w,reader:T,decoder:new TextDecoder("utf-8")})}if(c&&this.onCompleteCB&&this.onCompleteCB(w.body),this.onResultCB&&this.onResultCB(w,e),f.setDefaultOnEnd&&f.setDefaultOnEnd(w,e),e.trafficControl){let T=e.trafficControl-Math.round(S);T>0&&(yield a.pending(()=>{},T),w.requestTime=e.trafficControl)}return f.waitList=f.waitList.filter(T=>T!=h),w})},abortStream:function(){this.streamStatus="abort"}},f);f.prototype.Fetcher.prototype=f.prototype;var ye=e=>new v.prototype.Filer(e),v=ye;v.prototype={};var ge=function(e){this.ok=!0;try{let[t,r]=e.name.replace(/\s/,"").replace(/(.*)\.(.*)$/,"$1 $2").split(" ");this.file=e,this.extension=r,this.fileName=t,this.type=e.type}catch(t){console.log(t),this.ok=!1}return this};a.extend({ok:!1,extension:"",type:"",file:{},fileName:"",Filer:ge,isValid:function(){return this.ok},toBlob:function(){return p(this,null,function*(){return new Blob([this.file,{type:this.type}])})},toDataURL:function(){return p(this,null,function*(){var t;return(t=(yield this.file.convert("dataURL")).target)==null?void 0:t.result})},toAarrayBuffer:function(){return p(this,null,function*(){var t;return(t=(yield this.file.convert("arrayBuffer")).target)==null?void 0:t.result})},toObjectURL:function(){return p(this,null,function*(){return URL.createObjectURL(this.file)})},updateFileName:function(e){let t=new File([this.file],e+"."+this.extension);return this.file=t,this.fileName=e,this},updateMimeType:function(e){return this.file=new File([this.file],this.fileName+"."+this.extension,{type:e}),this.type=e,this},updateExtension:function(e){let t=new File([this.file],this.fileName+"."+e);return this.file=t,this.extension=e,this}},v);v.fromFile=e=>p(void 0,null,function*(){return v(e)});v.fromBlob=(e,t)=>p(void 0,null,function*(){let r=(t==null?void 0:t.fileName)||"file",i=(t==null?void 0:t.extension)||"",n=new File([e],r+"."+i,{type:t==null?void 0:t.mimeType});return v(n)});v.fromArrayBuffer=(e,t)=>p(void 0,null,function*(){return v.fromBlob(new Blob([e],{type:(t==null?void 0:t.mimeType)||""}),t)});v.fromObjectURL=(e,t)=>p(void 0,null,function*(){let r=yield f(e,{response_format:"blob"}).get();return r.ok?v.fromBlob(r.body,t):v({})});v.fromDataURL=(e,t)=>p(void 0,null,function*(){let r=yield e.toBlob((t==null?void 0:t.mimeType)||"");return r?v.fromBlob(r,t):v({})});v.prototype.Filer.prototype=v.prototype;var be=function(e){let t=e,r=null;return t.use((i,n,s)=>{let o=n;o.return=u=>{let{ok:l,status:h,body:d={},bodyStringify:y=!0}=u||{};h=h!=null?h:(l!=null?l:!0)&&200||403;let M=d;return y&&!a.is.string(d)&&(M=a.Stringify(d)),n.status(h).end(M)},s()}),t.onPathRouter=function(i){return r=i,this},t.pathRouter=function(i){if(!r)return;let n=r(i);return n.route(i),t.use(i,n),n},t.exception=function(i){return t.use(i),this},t},_=be;_.getLocalIP=e=>{let t="";return a.scope(()=>{if(!e)return;let r=e.networkInterfaces();for(let[i,n]of Object.entries(r))n.forEach(s=>{!s.internal&&s.family==="IPv4"&&!s.address.match(/^(169|127)/)&&(t=s.address)})}),t};_.getIP=function(e){var i;return(((e==null?void 0:e.headers["x-forwarded-for"])||((i=e==null?void 0:e.socket)==null?void 0:i.remoteAddress)||"").toString().match(new RegExp(/(::ffff:)?(\d+\.\d+.\d+\.\d+(:\d+)?)/))||[])[2]||"UNKNOWN IP"};a.copyToClipboard=e=>p(void 0,null,function*(){let t="";a.is.string(e)?t=e:a.is.function(e)&&(t=e());let r={ok:!1,body:"NotSupported"};return yield p(void 0,null,function*(){let i;if(navigator.clipboard){if(i=yield navigator.clipboard.writeText(t).then(()=>!0,()=>!1),!i)return}else{let n=document.createElement("input");if(a(document.body).append(n),n.value=t,n.select(),i=document.execCommand("copy"),document.body.removeChild(n),!i)return}r={ok:!0,body:""}}),r});a.ImageLoader=(e,t)=>new Promise((r,i)=>{let n=t||new Image;n.onload=()=>r(n),n.onerror=s=>i(s),n.src=e});a.formatCharacter={postal:{JP:e=>{let t="--";return e=String(e).replace(/\D/ig,""),e.length==7&&(t=e.replace(/^(\d{3})(.*)/,"$1-$2")),t}},tel:{_:e=>{let t=e;return e=String(e).removeLetters(),e.length==11&&(t=e.replace(/^(\d{3})(\d{4})(\d{4})/,"$1-$2-$3")),e.length==10&&(t=e.replace(/^(\d{2})(\d{4})(\d{4})/,"$1-$2-$3")),t},mobile:e=>{let t="--";return e=String(e).removeLetters(),e.length==11&&(t=e.replace(/^(\d{3})(\d{4})(\d{4})/,"$1-$2-$3")),t},fixed:e=>{let t="--";return e=String(e).removeLetters(),e.length==10&&(t=e.replace(/^(\d{2})(\d{4})(\d{4})/,"$1-$2-$3")),t}}};a.transformer={weekday:{ENG:e=>["Sun","Mon","Tues","Wednes","Thurs","Fri","Satur"][e]+"day",JP:e=>["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"][e]+"\u66DC\u65E5",shortJP:e=>["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"][e]},wareki:e=>{let t=[],r=[],i=!1;return[{From:1868,To:1912,name:"\u660E\u6CBB"},{From:1912,To:1926,name:"\u5927\u6B63"},{From:1926,To:1989,name:"\u662D\u548C"},{From:1989,To:2019,name:"\u5E73\u6210"},{From:2019,To:1e5,name:"\u4EE4\u548C"}].forEach(s=>{let{From:o,To:u,name:l}=s;if(o<=e&&e<=u){let h=e-o+1;h==1&&(i=!0,h="\u5143"),r.push(l+h+"\u5E74"),t.push(l)}}),{era:t,value:r,gap:i}}};a.interval=C;f.setDefaultHeaders=()=>({});var Ce=a;0&&(module.exports={Fetcher,Filer,Server,Time,UUID,useStore});
package/declare/core.d.ts CHANGED
@@ -114,7 +114,7 @@ declare namespace Jmini {
114
114
  (resolve: {
115
115
  (result: boolean): void;
116
116
  }): void;
117
- }, seconds?: number): Promise<boolean>;
117
+ }, ms?: number): Promise<boolean>;
118
118
  getCursor(event: Event): {
119
119
  x: number;
120
120
  y: number;
@@ -12,6 +12,8 @@ declare namespace Fetcher {
12
12
  trafficControl?: number;
13
13
  };
14
14
  type Output<R = any, E = any, A = any> = {
15
+ isCancelled: boolean;
16
+ isAborted: boolean;
15
17
  statusText: string;
16
18
  requestTime: number;
17
19
  rawData: Response;
@@ -37,7 +39,8 @@ declare namespace Fetcher {
37
39
  }
38
40
  type SystemMethods = {
39
41
  onStreamProcess(params: onStream.ProcessArgs): void;
40
- onStartCB(params: Input): void;
42
+ onStartCB(params: Input, abort: Function): Promise<void>;
43
+ onKeyDuplicateCB?(retry: Function): Promise<void>;
41
44
  onStreamCB?(data: any, done: boolean): void;
42
45
  onResultCB(result: Output<any>, params: Input): void;
43
46
  onCompleteCB(result: any): void;
@@ -64,7 +67,8 @@ declare namespace Fetcher {
64
67
  setExtraBody(body: KeyValueDict): Chains<R, E, A>;
65
68
  send<_R = R, _E = E, _A = A>(): Promise<Output<_R, _E>>;
66
69
  abortStream(): void;
67
- onStart(cb: (params: Input) => void): Chains;
70
+ onKeyDuplicate(cb: (retry: Function) => Promise<void>): Chains;
71
+ onStart(cb: (params: Input, abort: Function) => Promise<void>): Chains;
68
72
  onStream<T = any>(callback: (data: T, done: boolean) => void, options?: {
69
73
  decoder?: TextDecoder;
70
74
  }): Chains;
@@ -81,7 +85,7 @@ declare namespace Fetcher {
81
85
  setDefaultTrafficControl: number;
82
86
  setDefaultTimeout: number;
83
87
  setDefaultHeaders?: () => HeadersInit;
84
- setDefaultOnStart?: (params: Input) => void;
88
+ setDefaultOnStart?: (params: Input, abort: Function) => void;
85
89
  setDefaultOnEnd?: (result: Output<any>, params: Input) => void;
86
90
  isReadableStream(v: any): boolean;
87
91
  isReadableStreamReader(v: any): boolean;
@@ -10,18 +10,19 @@ declare namespace Interval {
10
10
  new (...args: InputArray): Chains;
11
11
  };
12
12
  store(): void;
13
+ setState(p: Partial<Columns>): void;
13
14
  };
14
- type Chains = {
15
+ type Columns = {
15
16
  key: string;
16
17
  ms: number;
17
18
  isFinished: boolean;
18
19
  timeoutIndex: number;
19
20
  fn: Function | null;
21
+ };
22
+ type Chains = Columns & {
20
23
  once(): Chains;
21
24
  start(): Chains;
22
25
  abort(): Chains;
23
- set_ms(ms: number): Chains;
24
- set_fn(fn: Function): Chains;
25
26
  };
26
27
  type Property = SystemMethods & Chains;
27
28
  type Methods = {
@@ -29,7 +30,7 @@ declare namespace Interval {
29
30
  (...args: InputArray): Chains;
30
31
  once(...args: InputArray): Chains;
31
32
  start(...args: InputArray): Chains;
32
- rexclude(key: string, ms: number): Promise<boolean>;
33
+ series(key: string, ms?: number): Promise<Function | null>;
33
34
  abort(key: number | string): void;
34
35
  get(key: string): Chains | undefined;
35
36
  };
package/esm/core.js CHANGED
@@ -1 +1 @@
1
- import{b as T,e as b}from"./chunk-ABA72NWU.js";import{UUID as J}from"./uuid";import"./primitiveExtension";const w=e=>new n.prototype.jmini(e),n=w;n.prototype={},n.extend=function(e,i=n){for(var[s,o]of Object.entries(e))i.prototype[s]=o},n.expando="__jmini_"+J();const c=(e,i)=>(e.queue.push(i),E(e),e),E=e=>b(void 0,null,function*(){if(!e.queueProcess&&e.queue.length){e.queueProcess=!0;let i=e.queue.shift();i&&(yield i()),e.queueProcess=!1,E(e)}}),p=(e,i)=>{for(let s=0;s<e.length;s++)e[s]=null;for(let[s,o]of Object.entries(i))s.match(/queue/)||(e[s]=o);return e},v=(e,i)=>{if(i.length){for(var s=0;s<i.length;s++){let o=i[s];o&&(o[n.expando]||(n.is.element(o)||n.is.shadowRoot(o))&&(o[n.expando]={events:{}})),e[s]=o}e.length=i.length}else e.warn="No Argument(s).",e.length=0;return e.queueProcess=!1,E(e),e};n.extend({constructor:n,jmini:function(e){return this.src=e,this.srcType=n.is.what(e),this.queueProcess=!0,this.queue=[],v(this,n.is.jmini(e)?e.get():n.is.element(e)?[e]:n.is.elements(e)?e:n.is.shadowRoot(e)?[e]:n.is.string(e)?e.match(/^#[^\.\s]*$/)?[document.getElementById(e.replace(/#/,""))]:document.querySelectorAll(e):[])}}),n.prototype[String(Symbol.iterator)]=[][Symbol.iterator],n.prototype.jmini.prototype=n.prototype;{const e=function(t,r,a){let l=[];for(let u=0;u<(t.length||0);u++)l.push(r(t[u],u));return a&&(l=l.filter(u=>u!=null)),l},i=t=>(t.for((r,a)=>{if(!(n.is.element(r)||n.is.shadowRoot(r)))return;let l=r.cloneNode(),u=r.parentNode;u&&u.replaceChild(l,r),t[a]=l}),t),s=(t,r)=>(n(r).for(a=>{if(t&&(n.is.element(a)||n.is.shadowRoot(a)))if(n.is.string(t)||n.is.number(t))t=String(t),a.insertAdjacentHTML("beforeend",String(t));else if(n.is.element(t))a.appendChild(t);else{n.is.jmini(t)?t=t.get():n.is.element(t)?t=[t]:n.is.keyValueDictionary(t)&&(t=[n(t)]);for(var l=0;l<t.length;l++)s(t[l],a)}}),r),o=(t,r,...a)=>{let{p:l,s:u}={before:{p:"beforebegin",s:""},after:{p:"afterend",s:"nextSibling"}}[r]||{p:"",s:""};return t.for(h=>{if(n.is.string(a[0]))h.insertAdjacentHTML(l,a[0]);else{if(!h.parentNode)return;n(a[0]).for(y=>{a[1]&&(y=y.cloneNode(!0)),h.parentNode.insertBefore(y,h[u]||h)})}}),t};n.extend({get:function(t){return t?this[0]:e(this,r=>r)},for:function(t,r=1){let a=e(this,(l,u)=>t(l,u),1);return r?a:[]},await:function(t){return c(this,()=>new Promise((r,a)=>{setTimeout(()=>{r(this)},t)}))},abort:function(){return c(this,()=>b(this,null,function*(){return this.queue=[],this}))},callback:function(t){return c(this,()=>b(this,null,function*(){return yield t(this),this}))},click:function(){return c(this,()=>{for(var t=0;t<this.length;t++){let r=this[t];n.is.element(r)&&r.click()}return this})},focus:function(){return c(this,()=>{for(var t=0;t<this.length;t++){let r=this[t];n.is.element(r)&&r.focus()}return this})},addEvent:function(t){return c(this,()=>{let{eventType:r,eventID:a=J(),target:l,callback:u,options:h}=t;return h=T({passive:!0,capture:!1},h),this.for(f=>{if(!(n.is.element(f)||n.is.shadowRoot(f)))return;let{events:y}=f[n.expando];if(l){let g=u;u=m=>{if(m.target){if(n.is.string(l)){let C=m.target.closest(l);C&&(!C||g.call(C,m))}else if(n.is.elements(l)){for(let d of l)if(m.target==d)return g.call(d,m)}}}}if(y[a]){let g=y[a];f.removeEventListener(g.eventType,g.callback,g.options)}y[a]={eventType:r,callback:u,options:h},f.addEventListener(r,u,h)}),this})},removeEvent:function(t){return c(this,()=>{let r=n.is.array(t)?t:[t];return this.for(a=>{let{events:l}=a[n.expando];for(let u of r){let h=l[u];h&&a.removeEventListener(h.eventType,h.callback,h.options)}}),this})},html:function(t){return c(this,()=>p(this,s(t,i(this))))},empty:function(){return c(this,()=>p(this,i(this)))},append:function(t){return c(this,()=>{s(t,this)})},remove:function(){return c(this,()=>(this.for((t,r)=>{t&&n.is.element(t)&&(t.remove(),delete this[r])}),this.length=0,this.warn="Object(s?) were all removed.",this))},before:function(...t){return c(this,()=>p(this,o(this,"before",...t)))},after:function(...t){return c(this,()=>p(this,o(this,"after",...t)))},find:function(t){return c(this,()=>{let r=[],a=this[0];a||p(this,n()),(n.is.element(a)||n.is.shadowRoot(a))&&(n.is.string(t)?r=a.querySelectorAll(t):n.is.element(a)&&n(t).for(l=>{let u=a.childNodes;for(let h of u)if(h===l){r.push(h);break}else h.childNodes.length&&(r=[...r,...n(h).find(l).for(f=>f)])})),p(this,n(r))})},parent:function(t){return c(this,()=>{var a,l;let r=n(t?(a=this[0])==null?void 0:a.closest(t):(l=this[0])==null?void 0:l.parentNode);p(this,r)})},children:function(t){return c(this,()=>{let r=this[0].children;n.is.exist(t)&&(t=String(t).replace(/^ : /,""),r=t=="first"?r[0]:t=="last"?r[r.length-1]:r[Number(t)]);let a=n(r);return p(this,a)})},addClass:function(t){return c(this,()=>(t&&this.for(r=>{let a=n.is.string(t)?t.split(" "):t;r&&n.is.element(r)&&r.classList.add(...a)}),this))},removeClass:function(t){return c(this,()=>(t&&this.for(r=>{let a=n.is.string(t)?t.split(" "):t;r&&n.is.element(r)&&r.classList.remove(...a)}),this))},toggleClass:function(t){return c(this,()=>(t&&this.for(r=>{r.classList.toggle(t)}),this))},hasClass:function(t=""){if(this[0])return this[0].classList.contains(t.replace(/^\./,""))},findClass:function(t){let r=[];return this[0]&&(r=[...this[0].classList].filter(a=>a.match(t))),r},css:function(t){return c(this,()=>(this.for(r=>{if(n.is.element(r))for(let[a,l]of Object.entries(t)){if(n.is.number(l)&&a.match(/width|height|top|right|bottom|left|padding|margin|gap|border-.*radius/)){r.style[a]=l+"px";continue}r.style[a]=String(l)}}),this))},getAttribute:function(t){return this[0].getAttribute(String(t))},setAttribute:function(t,r){return c(this,()=>(this.for(a=>a.setAttribute(t,r)),this))},getStyleProperty:function(t){let r=this[0];return r&&n.is.element(r)?getComputedStyle(r).getPropertyValue(t):""},setStyleProperty:function(t,r){let a=this[0];return a&&n.is.element(a)&&a.style.setProperty(t,r),this},val:function(){var r;let t=this[0];return(t==null?void 0:t.value)||((r=t==null?void 0:t.dataset)==null?void 0:r.value)},position:function(){return n.is.element(this[0])?this[0].getBoundingClientRect():{}}})}n.flatArray=(e,i)=>{if(!n.is.array(e))return[e];let s=[];for(let o of e)s.push(...i=="-R"?n.flatArray(o,"-R"):[o]);return s},n.uniqueArray=(e,i)=>{let s=e;return i?s=Array.from(new Map(e.map(o=>[n.getKeyValue(o,i||"0"),o])).values()):s=Array.from(new Set(e)),s},n.getKeyValue=(e,i)=>{let s={},o=e;return i.split(".").forEach(t=>{o=o==null?void 0:o[t],s=o}),s},n.Stringify=(...e)=>{let[i,s,o]=e;return JSON.stringify(i,s!=null?s:(()=>{const t=new WeakSet;return(r,a)=>{if(typeof a=="object"&&a!==null){if(t.has(a))return"[Circular Reference]";t.add(a)}return a}})(),o)},n.Objectify=(e,i)=>{try{return JSON.parse(e)}catch(s){return i!=null?i:null}},n.randomNumber=(e=0,i=100,s)=>{if(e>i)return NaN;let o=[],t=e;for(;t<=i;){if(s&&s.length&&s.includes(t)){t++;continue}o.push(t),t++}let r=Math.round(Math.random()*(o.length-1))+0;return o[r]},n.try=e=>{try{return[e(),!0]}catch(i){return[i,!1]}},n.trySync=e=>b(void 0,null,function*(){try{return[yield e(),!0]}catch(i){return[i,!1]}}),n.scope=e=>e(),n.scopeSync=e=>b(void 0,null,function*(){return yield e()}),n.createElement=function(e){var y;let{tag:i,className:s="",id:o,html:t,attr:r,style:a,parent:l}=e,u=document.createElement(i||"div");if(s&&u.classList.add(...s.split(" ")),o&&(u.id=o),r)for(let g of Object.entries(r)){let m=g[0],d=(y=g[1])!=null?y:"";if(m=="data"&&n.is.keyValueDictionary(d))for(let[C,S]of Object.entries(d))u.dataset[C]=S;else m=="for"?m="htmlFor":m=="tabindex"?m="tabIndex":m=="aria-label"&&(m="ariaLabel"),u[m]=d}if(t&&n(u).append(t),a)for(var[h,f]of Object.entries(a))u.style[h]=f;return l&&n(l).append(u),u},n.setCookie=e=>{let{hostname:i}=new URL(location.toString()),{name:s,value:o="",age:t=60*60*24*365,path:r="/",domain:a=i,secure:l=!1}=e,u=`${s}=${o}max-age=${t}path=${r}domain=${a}`;l&&(u+=" Secure"),document.cookie=u},n.getCookie=e=>{let i=document.cookie.match(new RegExp(e+"=[^]*"));return i?i[0].replace(new RegExp(e+"="),""):""},n.localStrage={set:(e,i)=>{localStorage.setItem(e,n.Stringify(i))},get:e=>{let i=localStorage.getItem(e);return n.Objectify(i,i)}},n.deleteCookie=e=>{document.cookie=e+"=max-age=0"},n.getScreenSize=()=>{let{innerHeight:e,innerWidth:i,scrollY:s,scrollX:o,pageXOffset:t,pageYOffset:r}=window,a=Number(n(document.body).getStyleProperty("--sat").removeLetters()),l=Number(n(document.body).getStyleProperty("--sab").removeLetters());return{height:e,width:i,pageHeight:e-a-l,scrollY:s,scrollX:o,pageXOffset:t,pageYOffset:r,safeAreaTop:a,safeAreaBottom:l}},n.getCursor=e=>{var o,t,r,a,l,u,h,f;let i=(a=e.pageX)!=null?a:(r=(o=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:o.pageX)!=null?r:(((t=e==null?void 0:e.originalEvent)==null?void 0:t.touches)||[])[0].pageX,s=(f=e.pageY)!=null?f:(h=(l=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:l.pageY)!=null?h:(((u=e==null?void 0:e.originalEvent)==null?void 0:u.touches)||[])[0].pageY;return{x:i,y:s}},n.pending=(e,i)=>new Promise((s,o)=>{e(s),i&&setTimeout(()=>{s(!0)},i)}),n.deepMerge=(e,...i)=>{if(!i.length)return e;const s=i.shift();if(n.is.keyValueDictionary(e)&&n.is.keyValueDictionary(s))for(const o in s)n.is.keyValueDictionary(s[o])?(e[o]||Object.assign(e,{[o]:{}}),n.deepMerge(e[o],s[o])):Object.assign(e,{[o]:s[o]});return n.deepMerge(e,...i)},n.deepCopy=e=>{if(n.is.array(e))return e.map(i=>n.deepCopy(i));if(n.is.keyValueDictionary(e)){let i={};return Object.entries(e).forEach(([s,o])=>{i[s]=n.deepCopy(o)}),i}return e},n.queryParams={get:e=>{let i=new URL(e||location.href),s={};return i.searchParams.forEach((o,t)=>s[t]=o),s},set:(e,i)=>{const s=new URL(i||location.href);return Object.entries(e).forEach(([o,t])=>{s.searchParams.set(o,String(t))}),i||history.replaceState({},"",s.pathname+s.search),s.toString()},delete:(e,i)=>{const s=new URL(i||location.href);return e.forEach(o=>{s.searchParams.delete(o)}),i||history.replaceState({},"",s.pathname+s.search),s.toString()}},n.ellipsisText=(e,i)=>{let s=String(e);return s.length>i&&(s=s.slice(0,i)+" ..."),s},n.is={equal:function(e,i,s){return s==null||s?n.Stringify(e)===n.Stringify(i):e===i},what:function(e){let i="other";return this.jmini(e)?i="jmini":this.element(e)?i="element":this.elements(e)?i="elements":this.shadowRoot(e)?i="shadowRoot":this.string(e)?i="string":this.number(e)?i="number":this.array(e)?i="array":this.function(e)?i="function":this.date(e)?i="date":typeof e=="undefined"?i="undefined":this.keyValueDictionary(e)?i="keyValueDictionary":e==null?i="null":isNaN(e)&&(i="NaN"),i},exist:function(e){return e===(e!=null?e:!e)},nullish:function(e){return!this.exist(e)},jmini:function(e){return(e||{}).constructor===n},string:function(e){return typeof e=="string"},boolean:function(e){return typeof e=="boolean"},number:function(e){return!isNaN(e)&&typeof e=="number"},array:function(e){let i={}.toString.call(e);return e instanceof Array||i=="[object NodeList]"||i=="[object HTMLCollection]"},function:function(e){return typeof e=="function"},keyValueDictionary:function(e){return{}.toString.call(e)==="[object Object]"&&!this.jmini(e)},element:function(e){return e&&(e.nodeType==1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"||[window,document].includes(e))},elements:function(e){let i={}.toString.call(e),s=Number(!!e&&typeof e!="string"&&this.array(e)&&i!=="[object Text]");if(s&&i!=="[object NodeList]")for(var o of e)s&=Number(this.element(o));return!!s},shadowRoot:function(e){return e instanceof ShadowRoot},date:function(e){return this.number(new Date(e).getTime())}};export{n as Jmini,n as default};
1
+ import{b as T,e as b}from"./chunk-ABA72NWU.js";import{UUID as J}from"./uuid";import"./primitiveExtension";const w=e=>new n.prototype.jmini(e),n=w;n.prototype={},n.extend=function(e,i=n){for(var[s,o]of Object.entries(e))i.prototype[s]=o},n.expando="__jmini_"+J();const m=(e,i)=>(e.queue.push(i),E(e),e),E=e=>b(void 0,null,function*(){if(!e.queueProcess&&e.queue.length){e.queueProcess=!0;let i=e.queue.shift();i&&(yield i()),e.queueProcess=!1,E(e)}}),p=(e,i)=>{for(let s=0;s<e.length;s++)e[s]=null;for(let[s,o]of Object.entries(i))s.match(/queue/)||(e[s]=o);return e},v=(e,i)=>{if(i.length){for(var s=0;s<i.length;s++){let o=i[s];o&&(o[n.expando]||(n.is.element(o)||n.is.shadowRoot(o))&&(o[n.expando]={events:{}})),e[s]=o}e.length=i.length}else e.warn="No Argument(s).",e.length=0;return e.queueProcess=!1,E(e),e};n.extend({constructor:n,jmini:function(e){return this.src=e,this.srcType=n.is.what(e),this.queueProcess=!0,this.queue=[],v(this,n.is.jmini(e)?e.get():n.is.element(e)?[e]:n.is.elements(e)?e:n.is.shadowRoot(e)?[e]:n.is.string(e)?e.match(/^#[^\.\s]*$/)?[document.getElementById(e.replace(/#/,""))]:document.querySelectorAll(e):[])}}),n.prototype[String(Symbol.iterator)]=[][Symbol.iterator],n.prototype.jmini.prototype=n.prototype;{const e=function(t,r,a){let l=[];for(let u=0;u<(t.length||0);u++)l.push(r(t[u],u));return a&&(l=l.filter(u=>u!=null)),l},i=t=>(t.for((r,a)=>{if(!(n.is.element(r)||n.is.shadowRoot(r)))return;let l=r.cloneNode(),u=r.parentNode;u&&u.replaceChild(l,r),t[a]=l}),t),s=(t,r)=>(n(r).for(a=>{if(t&&(n.is.element(a)||n.is.shadowRoot(a)))if(n.is.string(t)||n.is.number(t))t=String(t),a.insertAdjacentHTML("beforeend",String(t));else if(n.is.element(t))a.appendChild(t);else{n.is.jmini(t)?t=t.get():n.is.element(t)?t=[t]:n.is.keyValueDictionary(t)&&(t=[n(t)]);for(var l=0;l<t.length;l++)s(t[l],a)}}),r),o=(t,r,...a)=>{let{p:l,s:u}={before:{p:"beforebegin",s:""},after:{p:"afterend",s:"nextSibling"}}[r]||{p:"",s:""};return t.for(h=>{if(n.is.string(a[0]))h.insertAdjacentHTML(l,a[0]);else{if(!h.parentNode)return;n(a[0]).for(y=>{a[1]&&(y=y.cloneNode(!0)),h.parentNode.insertBefore(y,h[u]||h)})}}),t};n.extend({get:function(t){return t?this[0]:e(this,r=>r)},for:function(t,r=1){let a=e(this,(l,u)=>t(l,u),1);return r?a:[]},await:function(t){return m(this,()=>new Promise((r,a)=>{setTimeout(()=>{r(this)},t)}))},abort:function(){return m(this,()=>b(this,null,function*(){return this.queue=[],this}))},callback:function(t){return m(this,()=>b(this,null,function*(){return yield t(this),this}))},click:function(){return m(this,()=>{for(var t=0;t<this.length;t++){let r=this[t];n.is.element(r)&&r.click()}return this})},focus:function(){return m(this,()=>{for(var t=0;t<this.length;t++){let r=this[t];n.is.element(r)&&r.focus()}return this})},addEvent:function(t){return m(this,()=>{let{eventType:r,eventID:a=J(),target:l,callback:u,options:h}=t;return h=T({passive:!0,capture:!1},h),this.for(f=>{if(!(n.is.element(f)||n.is.shadowRoot(f)))return;let{events:y}=f[n.expando];if(l){let g=u;u=c=>{if(c.target){if(n.is.string(l)){let C=c.target.closest(l);C&&(!C||g.call(C,c))}else if(n.is.elements(l)){for(let d of l)if(c.target==d)return g.call(d,c)}}}}if(y[a]){let g=y[a];f.removeEventListener(g.eventType,g.callback,g.options)}y[a]={eventType:r,callback:u,options:h},f.addEventListener(r,u,h)}),this})},removeEvent:function(t){return m(this,()=>{let r=n.is.array(t)?t:[t];return this.for(a=>{let{events:l}=a[n.expando];for(let u of r){let h=l[u];h&&a.removeEventListener(h.eventType,h.callback,h.options)}}),this})},html:function(t){return m(this,()=>p(this,s(t,i(this))))},empty:function(){return m(this,()=>p(this,i(this)))},append:function(t){return m(this,()=>{s(t,this)})},remove:function(){return m(this,()=>(this.for((t,r)=>{t&&n.is.element(t)&&(t.remove(),delete this[r])}),this.length=0,this.warn="Object(s?) were all removed.",this))},before:function(...t){return m(this,()=>p(this,o(this,"before",...t)))},after:function(...t){return m(this,()=>p(this,o(this,"after",...t)))},find:function(t){return m(this,()=>{let r=[],a=this[0];a||p(this,n()),(n.is.element(a)||n.is.shadowRoot(a))&&(n.is.string(t)?r=a.querySelectorAll(t):n.is.element(a)&&n(t).for(l=>{let u=a.childNodes;for(let h of u)if(h===l){r.push(h);break}else h.childNodes.length&&(r=[...r,...n(h).find(l).for(f=>f)])})),p(this,n(r))})},parent:function(t){return m(this,()=>{var a,l;let r=n(t?(a=this[0])==null?void 0:a.closest(t):(l=this[0])==null?void 0:l.parentNode);p(this,r)})},children:function(t){return m(this,()=>{let r=this[0].children;n.is.exist(t)&&(t=String(t).replace(/^ : /,""),r=t=="first"?r[0]:t=="last"?r[r.length-1]:r[Number(t)]);let a=n(r);return p(this,a)})},addClass:function(t){return m(this,()=>(t&&this.for(r=>{let a=n.is.string(t)?t.split(" "):t;r&&n.is.element(r)&&r.classList.add(...a)}),this))},removeClass:function(t){return m(this,()=>(t&&this.for(r=>{let a=n.is.string(t)?t.split(" "):t;r&&n.is.element(r)&&r.classList.remove(...a)}),this))},toggleClass:function(t){return m(this,()=>(t&&this.for(r=>{r.classList.toggle(t)}),this))},hasClass:function(t=""){if(this[0])return this[0].classList.contains(t.replace(/^\./,""))},findClass:function(t){let r=[];return this[0]&&(r=[...this[0].classList].filter(a=>a.match(t))),r},css:function(t){return m(this,()=>(this.for(r=>{if(n.is.element(r))for(let[a,l]of Object.entries(t)){if(n.is.number(l)&&a.match(/width|height|top|right|bottom|left|padding|margin|gap|border-.*radius/)){r.style[a]=l+"px";continue}r.style[a]=String(l)}}),this))},getAttribute:function(t){return this[0].getAttribute(String(t))},setAttribute:function(t,r){return m(this,()=>(this.for(a=>a.setAttribute(t,r)),this))},getStyleProperty:function(t){let r=this[0];return r&&n.is.element(r)?getComputedStyle(r).getPropertyValue(t):""},setStyleProperty:function(t,r){let a=this[0];return a&&n.is.element(a)&&a.style.setProperty(t,r),this},val:function(){var r;let t=this[0];return(t==null?void 0:t.value)||((r=t==null?void 0:t.dataset)==null?void 0:r.value)},position:function(){return n.is.element(this[0])?this[0].getBoundingClientRect():{}}})}n.flatArray=(e,i)=>{if(!n.is.array(e))return[e];let s=[];for(let o of e)s.push(...i=="-R"?n.flatArray(o,"-R"):[o]);return s},n.uniqueArray=(e,i)=>{let s=e;return i?s=Array.from(new Map(e.map(o=>[n.getKeyValue(o,i||"0"),o])).values()):s=Array.from(new Set(e)),s},n.getKeyValue=(e,i)=>{let s={},o=e;return i.split(".").forEach(t=>{o=o==null?void 0:o[t],s=o}),s},n.Stringify=(...e)=>{let[i,s,o]=e;return JSON.stringify(i,s!=null?s:(()=>{const t=new WeakSet;return(r,a)=>{if(typeof a=="object"&&a!==null){if(t.has(a))return"[Circular Reference]";t.add(a)}return a}})(),o)},n.Objectify=(e,i)=>{try{return JSON.parse(e)}catch(s){return i!=null?i:null}},n.randomNumber=(e=0,i=100,s)=>{if(e>i)return NaN;let o=[],t=e;for(;t<=i;){if(s&&s.length&&s.includes(t)){t++;continue}o.push(t),t++}let r=Math.round(Math.random()*(o.length-1))+0;return o[r]},n.try=e=>{try{return[e(),!0]}catch(i){return[i,!1]}},n.trySync=e=>b(void 0,null,function*(){try{return[yield e(),!0]}catch(i){return[i,!1]}}),n.scope=e=>e(),n.scopeSync=e=>b(void 0,null,function*(){return yield e()}),n.createElement=function(e){var y;let{tag:i,className:s="",id:o,html:t,attr:r,style:a,parent:l}=e,u=document.createElement(i||"div");if(s&&u.classList.add(...s.split(" ")),o&&(u.id=o),r)for(let g of Object.entries(r)){let c=g[0],d=(y=g[1])!=null?y:"";if(c=="data"&&n.is.keyValueDictionary(d))for(let[C,S]of Object.entries(d))u.dataset[C]=S;else c=="for"?c="htmlFor":c=="tabindex"?c="tabIndex":c=="aria-label"&&(c="ariaLabel"),u[c]=d}if(t&&n(u).append(t),a)for(var[h,f]of Object.entries(a))u.style[h]=f;return l&&n(l).append(u),u},n.setCookie=e=>{let{hostname:i}=new URL(location.toString()),{name:s,value:o="",age:t=60*60*24*365,path:r="/",domain:a=i,secure:l=!1}=e,u=`${s}=${o}max-age=${t}path=${r}domain=${a}`;l&&(u+=" Secure"),document.cookie=u},n.getCookie=e=>{let i=document.cookie.match(new RegExp(e+"=[^]*"));return i?i[0].replace(new RegExp(e+"="),""):""},n.localStrage={set:(e,i)=>{localStorage.setItem(e,n.Stringify(i))},get:e=>{let i=localStorage.getItem(e);return n.Objectify(i,i)}},n.deleteCookie=e=>{document.cookie=e+"=max-age=0"},n.getScreenSize=()=>{let{innerHeight:e,innerWidth:i,scrollY:s,scrollX:o,pageXOffset:t,pageYOffset:r}=window,a=Number(n(document.body).getStyleProperty("--sat").removeLetters()),l=Number(n(document.body).getStyleProperty("--sab").removeLetters());return{height:e,width:i,pageHeight:e-a-l,scrollY:s,scrollX:o,pageXOffset:t,pageYOffset:r,safeAreaTop:a,safeAreaBottom:l}},n.getCursor=e=>{var o,t,r,a,l,u,h,f;let i=(a=e.pageX)!=null?a:(r=(o=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:o.pageX)!=null?r:(((t=e==null?void 0:e.originalEvent)==null?void 0:t.touches)||[])[0].pageX,s=(f=e.pageY)!=null?f:(h=(l=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:l.pageY)!=null?h:(((u=e==null?void 0:e.originalEvent)==null?void 0:u.touches)||[])[0].pageY;return{x:i,y:s}},n.pending=(e,i)=>new Promise((s,o)=>{e(s),i&&setTimeout(()=>{s(!0)},i)}),n.deepMerge=(e,...i)=>{if(!i.length)return e;const s=i.shift();if(n.is.keyValueDictionary(e)&&n.is.keyValueDictionary(s))for(const o in s)n.is.keyValueDictionary(s[o])?(e[o]||Object.assign(e,{[o]:{}}),n.deepMerge(e[o],s[o])):Object.assign(e,{[o]:s[o]});return n.deepMerge(e,...i)},n.deepCopy=e=>{if(n.is.array(e))return e.map(i=>n.deepCopy(i));if(n.is.keyValueDictionary(e)){let i={};return Object.entries(e).forEach(([s,o])=>{i[s]=n.deepCopy(o)}),i}return e},n.queryParams={get:e=>{let i=new URL(e||location.href),s={};return i.searchParams.forEach((o,t)=>s[t]=o),s},set:(e,i)=>{const s=new URL(i||location.href);return Object.entries(e).forEach(([o,t])=>{s.searchParams.set(o,String(t))}),i||history.replaceState({},"",s.pathname+s.search),s.toString()},delete:(e,i)=>{const s=new URL(i||location.href);return e.forEach(o=>{s.searchParams.delete(o)}),i||history.replaceState({},"",s.pathname+s.search),s.toString()}},n.ellipsisText=(e,i)=>{let s=String(e);return s.length>i&&(s=s.slice(0,i)+" ..."),s},n.is={equal:function(e,i,s){return s==null||s?n.Stringify(e)===n.Stringify(i):e===i},what:function(e){let i="other";return this.jmini(e)?i="jmini":this.element(e)?i="element":this.elements(e)?i="elements":this.shadowRoot(e)?i="shadowRoot":this.string(e)?i="string":this.number(e)?i="number":this.array(e)?i="array":this.function(e)?i="function":this.date(e)?i="date":typeof e=="undefined"?i="undefined":this.keyValueDictionary(e)?i="keyValueDictionary":e==null?i="null":isNaN(e)&&(i="NaN"),i},exist:function(e){return e===(e!=null?e:!e)},nullish:function(e){return!this.exist(e)},jmini:function(e){return(e||{}).constructor===n},string:function(e){return typeof e=="string"},boolean:function(e){return typeof e=="boolean"},number:function(e){return!isNaN(e)&&typeof e=="number"},array:function(e){let i={}.toString.call(e);return e instanceof Array||i=="[object NodeList]"||i=="[object HTMLCollection]"},function:function(e){return typeof e=="function"},keyValueDictionary:function(e){return{}.toString.call(e)==="[object Object]"&&!this.jmini(e)},element:function(e){return e&&(e.nodeType==1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"||[window,document].includes(e))},elements:function(e){let i={}.toString.call(e),s=Number(!!e&&typeof e!="string"&&this.array(e)&&i!=="[object Text]");if(s&&i!=="[object NodeList]")for(var o of e)s&=Number(this.element(o));return!!s},shadowRoot:function(e){return e instanceof ShadowRoot},date:function(e){return this.number(new Date(e).getTime())}};export{n as Jmini,n as default};
package/esm/fetcher.js CHANGED
@@ -1 +1 @@
1
- import{b as m,c as A,d as B,e as c,f as T,g as D,h as x}from"./chunk-ABA72NWU.js";import p from"./core";import{UUID as I}from"./uuid";const v=(t,r)=>new e.prototype.Fetcher(t,r),e=v;e.prototype={},e.waitList=[],e.setDefaultTrafficControl=0,e.setDefaultTimeout=1e3*60*10,e.isReadableStream=t=>t instanceof ReadableStream,e.isReadableStreamReader=t=>t instanceof ReadableStreamDefaultReader,e.streamToContext=(t,r)=>c(void 0,null,function*(){try{const o=(r==null?void 0:r.reader)||t.getReader();if(!e.isReadableStreamReader(o))return{ok:!1,done:!0,data:null};if(!o)return{ok:!1,done:!0,data:null};const i=(r==null?void 0:r.decoder)||new TextDecoder("utf-8");let n=yield o.read();return{ok:!0,done:n.done,data:i.decode(n.value)}}catch(o){return{ok:!1,done:!0,data:o}}});const O=function(t,r){var n;r=r||{};let o=r.body;r.body&&!p.is.string(r.body)&&((n=r.bodyStringify)==null||n)&&(o=p.Stringify(r.body||{}));let i=t;return p.is.string(t)&&!t.match(/https?:/)&&(i=location.origin+"/"+t.replace(/^\//,"")),this.url=i,this.method=r.method||"get",this.streamStatus="open",this.params=A(m({key:I(),response_format:"json",timeout:e.setDefaultTimeout,trafficControl:e.setDefaultTrafficControl,preventMultiRequest:!0},r),{headers:m(m({"Content-Type":"application/json"},e.setDefaultHeaders&&e.setDefaultHeaders()),r.headers),body:o}),this};p.extend({Fetcher:O,params:{},url:"",method:"GET",streamStatus:"closed",onStartCB:()=>{},onCompleteCB:()=>{},onRetryCB:()=>c(void 0,null,function*(){return null}),isRetry:!1,extraBody:{},setExtraBody:function(t){return this.extraBody=m(m({},this.extraBody),t),this},onErrorCB:()=>{},onResultCB:()=>{},onStreamCB:()=>{},onStart:function(t){return this.onStartCB=t,this},onStream:function(t){return this.onStreamCB=t,this},onResult:function(t){return this.onResultCB=t,this},onComplete:function(t){return this.onCompleteCB=t,this},onRetry:function(t){return this.onRetryCB=t,this},onError:function(t){return this.onErrorCB=t,this},onStreamProcess:function(t){return c(this,null,function*(){let{response:r,errorCB:o,streamCB:i,reader:n,decoder:l}=t,s=r.body,u=this;const R=function(){return D(this,null,function*(){if(!r.ok){p.scope(()=>c(this,null,function*(){let{ok:f,done:y,data:_}=yield e.streamToContext(s,{reader:n,decoder:l});f&&o(_)}));return}let a=!1;for(;!a;){let{ok:f,done:y,data:_}=yield new T(e.streamToContext(s,{reader:n,decoder:l}));u.streamStatus=="abort"?(u.streamStatus="closed",n.cancel(),y=!0):u.streamStatus=="closed"&&(y=!0),y&&(a=y,n.releaseLock()),i(_,y)}})};try{for(var C=x(R()),h,E,b;h=!(E=yield C.next()).done;h=!1){let a=E.value;;}}catch(E){b=[E]}finally{try{h&&(E=C.return)&&(yield E.call(C))}finally{if(b)throw b[0]}}})},get:function(){return this.method="GET",this.send()},head:function(){return this.method="HEAD",this.send()},post:function(){return this.method="POST",this.send()},put:function(){return this.method="PUT",this.send()},delete:function(){return this.method="DELETE",this.send()},patch:function(){return this.method="PATCH",this.send()},options:function(){return this.method="OPTIONS",this.send()},send:function(){return c(this,null,function*(){var b;let t=this.params,r=performance.now(),o=0,i=new AbortController,n=setTimeout(()=>{i.abort()},t.timeout);t.signal=i.signal;let l=!1,s=500,u="InternalServerError",R={},C=null;try{e.setDefaultOnStart&&e.setDefaultOnStart(t),this.onStartCB&&this.onStartCB(t);let E=t,{key:a,response_format:f,trafficControl:y,preventMultiRequest:_,timeout:k,queries:P}=E,S=B(E,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);S.method=this.method;let g=e.waitList.includes(a);if(_&&g)throw s=429,new Error("TooManyRequests");e.waitList=[...e.waitList,a];let w=p.queryParams.set(m({},P),String(this.url));R=yield fetch(w,S).then(d=>c(this,null,function*(){return l=d.ok,s=d.status,u=d.statusText,C=d,f=="none"||f=="stream"?d:d[f]()})).catch(d=>{throw new Error(d)})}catch(a){s==200&&(s=500,l=!1),s==429&&(u="TooManyRequests"),i.signal.aborted&&(s=408,u="Timeout"),s==500&&(u=String(a)||u),R={errorCode:String(a)}}finally{clearTimeout(n),o=performance.now()-r}t.trafficControl&&(yield p.pending(()=>{},t.trafficControl)),e.waitList.splice(e.waitList.findIndex(a=>a==t.key),1);let h={ok:l,status:s,statusText:u,body:R,additionalBody:this.extraBody,requestTime:o,rawData:C};if(!l){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let a=yield this.onRetryCB(h.body,this.params,this);if(a)return this.params=a,this.send()}this.onErrorCB&&this.onErrorCB(h.body)}if(l&&this.onStreamCB&&t.response_format=="stream"){let a=(b=C.body)==null?void 0:b.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:h,reader:a,decoder:new TextDecoder("utf-8")})}return l&&this.onCompleteCB&&this.onCompleteCB(h.body),this.onResultCB&&this.onResultCB(h,t),e.setDefaultOnEnd&&e.setDefaultOnEnd(h,t),h})},abortStream:function(){this.streamStatus="abort"}},e),e.prototype.Fetcher.prototype=e.prototype;export{e as Fetcher,e as default};
1
+ import{b as m,c as g,d as I,e as d,f as v,g as O,h as F}from"./chunk-ABA72NWU.js";import y from"./core";import{UUID as K}from"./uuid";const L=(t,r)=>new e.prototype.Fetcher(t,r),e=L;e.prototype={},e.waitList=[],e.setDefaultTrafficControl=0,e.setDefaultTimeout=1e3*60*10,e.isReadableStream=t=>t instanceof ReadableStream,e.isReadableStreamReader=t=>t instanceof ReadableStreamDefaultReader,e.streamToContext=(t,r)=>d(void 0,null,function*(){try{const n=(r==null?void 0:r.reader)||t.getReader();if(!e.isReadableStreamReader(n))return{ok:!1,done:!0,data:null};if(!n)return{ok:!1,done:!0,data:null};const i=(r==null?void 0:r.decoder)||new TextDecoder("utf-8");let s=yield n.read();return{ok:!0,done:s.done,data:i.decode(s.value)}}catch(n){return{ok:!1,done:!0,data:n}}});const M=function(t,r){var s;r=r||{};let n=r.body;r.body&&!y.is.string(r.body)&&((s=r.bodyStringify)==null||s)&&(n=y.Stringify(r.body||{}));let i=t;return y.is.string(t)&&!t.match(/https?:/)&&(i=location.origin+"/"+t.replace(/^\//,"")),this.url=i,this.method=r.method||"get",this.streamStatus="open",this.params=g(m({key:K(),response_format:"json",timeout:e.setDefaultTimeout,trafficControl:e.setDefaultTrafficControl,preventMultiRequest:!0},r),{headers:m(m({"Content-Type":"application/json"},e.setDefaultHeaders&&e.setDefaultHeaders()),r.headers),body:n}),this};y.extend({Fetcher:M,params:{},url:"",method:"GET",streamStatus:"closed",onStartCB:()=>d(void 0,null,function*(){}),onKeyDuplicateCB:()=>d(void 0,null,function*(){}),onCompleteCB:()=>{},onRetryCB:()=>d(void 0,null,function*(){return null}),isRetry:!1,extraBody:{},setExtraBody:function(t){return this.extraBody=m(m({},this.extraBody),t),this},onErrorCB:()=>{},onResultCB:()=>{},onStreamCB:()=>{},onStart:function(t){return this.onStartCB=t,this},onKeyDuplicate:function(t){return this.onKeyDuplicateCB=t,this},onStream:function(t){return this.onStreamCB=t,this},onResult:function(t){return this.onResultCB=t,this},onComplete:function(t){return this.onCompleteCB=t,this},onRetry:function(t){return this.onRetryCB=t,this},onError:function(t){return this.onErrorCB=t,this},onStreamProcess:function(t){return d(this,null,function*(){let{response:r,errorCB:n,streamCB:i,reader:s,decoder:_}=t,A=r.body,f=this;const C=function(){return O(this,null,function*(){if(!r.ok){y.scope(()=>d(this,null,function*(){let{ok:p,done:o,data:l}=yield e.streamToContext(A,{reader:s,decoder:_});p&&n(l)}));return}let u=!1;for(;!u;){let{ok:p,done:o,data:l}=yield new v(e.streamToContext(A,{reader:s,decoder:_}));f.streamStatus=="abort"?(f.streamStatus="closed",s.cancel(),o=!0):f.streamStatus=="closed"&&(o=!0),o&&(u=o,s.releaseLock()),i(l,o)}})};try{for(var S=F(C()),k,R,B;k=!(R=yield S.next()).done;k=!1){let u=R.value;;}}catch(R){B=[R]}finally{try{k&&(R=S.return)&&(yield R.call(S))}finally{if(B)throw B[0]}}})},get:function(){return this.method="GET",this.send()},head:function(){return this.method="HEAD",this.send()},post:function(){return this.method="POST",this.send()},put:function(){return this.method="PUT",this.send()},delete:function(){return this.method="DELETE",this.send()},patch:function(){return this.method="PATCH",this.send()},options:function(){return this.method="OPTIONS",this.send()},send:function(){return d(this,null,function*(){var x;let t=this.params,r=performance.now(),P=t,{key:n,response_format:i,trafficControl:s,preventMultiRequest:_,timeout:A,queries:f}=P,C=I(P,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);C.method=this.method;let S=[this.method,n].join("."),k=e.waitList.includes(S);e.waitList=[...e.waitList,S];let R=!1,B=!1,u=!1,p=0,o=500,l="InternalServerError",b={},D=null,E=new AbortController,q=setTimeout(()=>{E.abort()},t.timeout);t.signal=E.signal;const T=()=>{R=!0,E.abort()},w={isCancelled:R,isAborted:B,ok:!1,status:0,statusText:"CANCELLED",body:b,requestTime:0,rawData:null};try{if(e.setDefaultOnStart&&(yield e.setDefaultOnStart(t,T)),this.onStartCB&&(yield this.onStartCB(t,T)),R)return w;if(k){if(this.onKeyDuplicateCB&&(yield this.onKeyDuplicateCB(T)),R)return w;if(_)throw o=429,new Error("TooManyRequests")}let a=y.queryParams.set(m({},f),String(this.url));b=yield fetch(a,C).then(h=>d(this,null,function*(){return u=h.ok,o=h.status,l=h.statusText,D=h,i=="none"||i=="stream"?h:h[i]()})).catch(h=>{throw new Error(h)})}catch(a){o==200&&(o=500,u=!1),o==429&&(l="TooManyRequests"),E.signal.aborted&&(o=408,l="Timeout",B=!0),o==500&&(l=String(a)||l),b={errorCode:String(a)}}finally{clearTimeout(q),p=performance.now()-r}let c={isCancelled:R,isAborted:B,ok:u,status:o,statusText:l,body:b,additionalBody:this.extraBody,requestTime:p,rawData:D};if(!u){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let a=yield this.onRetryCB(c.body,this.params,this);if(a)return this.params=a,this.send()}this.onErrorCB&&this.onErrorCB(c.body)}if(u&&this.onStreamCB&&t.response_format=="stream"){let a=(x=D.body)==null?void 0:x.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:c,reader:a,decoder:new TextDecoder("utf-8")})}if(u&&this.onCompleteCB&&this.onCompleteCB(c.body),this.onResultCB&&this.onResultCB(c,t),e.setDefaultOnEnd&&e.setDefaultOnEnd(c,t),t.trafficControl){let a=t.trafficControl-Math.round(p);a>0&&(yield y.pending(()=>{},a),c.requestTime=t.trafficControl)}return e.waitList=e.waitList.filter(a=>a!=S),c})},abortStream:function(){this.streamStatus="abort"}},e),e.prototype.Fetcher.prototype=e.prototype;export{e as Fetcher,e as default};
package/esm/interval.js CHANGED
@@ -1 +1 @@
1
- import{e as o}from"./chunk-ABA72NWU.js";import{useStore as s}from"./useStore";import a from"./core";const h=(...[t,n,r])=>new e.prototype.Interval(t,n,r),e=h;e.prototype={};const u=function(...[t,n,r]){return this.fn=t,this.ms=n,this.key=r,this.isFinished=!1,e.abort(this.key),this.store(),this};a.extend({key:"",ms:0,timeoutIndex:-1,fn:null,isFinished:!1,Interval:u,store:function(){s.set({["Interval_"+this.key]:this})},once:function(){if(this.fn){let t=()=>{this.fn&&this.fn(),this.isFinished=!0,this.store()};this.timeoutIndex=setTimeout(t,this.ms)}return this.store(),this},start:function(){return this.fn&&(this.timeoutIndex=setInterval(this.fn,this.ms)),this.store(),this},abort:function(){return e.abort(this.timeoutIndex),this},set_ms:function(t){return this.ms=t,this.store(),this},set_fn:function(t){return this.fn=t,this.store(),this}},e),e.abort=t=>{if(a.is.number(t))return clearInterval(t);let n=s.get("Interval_"+t);n&&clearInterval(n.timeoutIndex)},e.get=t=>s.get("Interval_"+t),e.once=(t,n,r)=>e(t,n,r).once(),e.rexclude=(t,n)=>o(void 0,null,function*(){return new Promise(r=>{let i=e.get(t);if(i&&!i.isFinished)return r(!1);e(()=>{r(!0)},n,t).once()})}),e.start=(t,n,r)=>e(t,n,r).start(),e.prototype.Interval.prototype=e.prototype;export{e as Interval,e as default};
1
+ import{e as a}from"./chunk-ABA72NWU.js";import{useStore as s}from"./useStore";import u from"./core";const h=(...[t,n,r])=>new e.prototype.Interval(t,n,r),e=h;e.prototype={};const p=function(...[t,n,r]){return this.fn=t,this.ms=n,this.key=r,this.isFinished=!1,e.abort(this.key),this.store(),this};u.extend({key:"",ms:0,timeoutIndex:-1,fn:null,isFinished:!1,Interval:p,store:function(){s.set({["Interval_"+this.key]:this})},once:function(){if(this.fn){let t=()=>{this.fn&&this.fn(),this.isFinished=!0,this.store()};this.timeoutIndex=setTimeout(t,this.ms)}return this.store(),this},start:function(){return this.fn&&(this.timeoutIndex=setInterval(this.fn,this.ms)),this.store(),this},abort:function(){return e.abort(this.timeoutIndex),this},setState:function(t){return Object.entries(t).forEach(([n,r])=>{this.hasOwnProperty(n)&&(this[n]=r)}),this.store(),this}},e),e.abort=t=>{if(u.is.number(t))return clearInterval(t);let n=s.get("Interval_"+t);n&&(n&&clearInterval(n.timeoutIndex),n.setState({isFinished:!0}))},e.get=t=>s.get("Interval_"+t),e.once=(t,n,r)=>e(t,n,r).once(),e.series=(t,n)=>a(void 0,null,function*(){return new Promise(r=>{let i=e.get(t);if(i&&!i.isFinished)return r(null);let o=()=>{e.abort(t)};r(o),n&&e(o,n,t).once()})}),e.start=(t,n,r)=>e(t,n,r).start(),e.prototype.Interval.prototype=e.prototype;export{e as Interval,e as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmini",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
4
4
  "description": "minified JavaScript Framework",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",