jmini 0.0.13 → 0.0.15

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 A=Object.defineProperty,K=Object.defineProperties,z=Object.getOwnPropertyDescriptor,X=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var L=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var E=Math.pow,N=(e,t,r)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,R=(e,t)=>{for(var r in t||(t={}))I.call(t,r)&&N(e,r,t[r]);if(F)for(var r of F(t))U.call(t,r)&&N(e,r,t[r]);return e},H=(e,t)=>K(e,X(t));var Y=(e,t)=>{var r={};for(var i in e)I.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&F)for(var i of F(e))t.indexOf(i)<0&&U.call(e,i)&&(r[i]=e[i]);return r};var Q=(e,t)=>{for(var r in t)A(e,r,{get:t[r],enumerable:!0})},Z=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of G(t))!I.call(e,n)&&n!==r&&A(e,n,{get:()=>t[n],enumerable:!(i=z(t,n))||i.enumerable});return e};var _=e=>Z(A({},"__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())}),B=function(e,t){this[0]=e,this[1]=t},j=(e,t,r)=>{var i=(o,u,l,h)=>{try{var c=r[o](u),g=(u=c.value)instanceof B,b=c.done;Promise.resolve(g?u[0]:u).then(m=>g?i(o==="return"?o:"next",u[1]?{done:m.done,value:m.value}:m,l,h):l({value:m,done:b})).catch(m=>i("throw",m,l,h))}catch(m){h(m)}},n=o=>s[o]=u=>new Promise((l,h)=>i(o,u,l,h)),s={};return r=r.apply(e,t),s[L("asyncIterator")]=()=>s,n("next"),n("throw"),n("return"),s};var V=(e,t,r)=>(t=e[L("asyncIterator")])?t.call(e):(e=e[L("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 ae={};Q(ae,{Fetcher:()=>d,Filer:()=>k,Server:()=>P,Time:()=>f,UUID:()=>S,default:()=>se});module.exports=_(ae);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(/+/,"+")});typeof Number!="undefined"&&(Number.prototype.zeroEmbed=function(e){return String(this).padStart(e||2,"0")},Number.prototype.ratio=function(e,t=2){let r=E(10,t);return Math.round(this/e*r*100)/r},Number.prototype.rate=function(e,t=2){let r=E(10,t);return Math.round(this/e*r)/r},Number.prototype.rank=function(e=1){let t=E(10,e),r=Number(this),i=r.toLocaleString().replace(/\d/ig,"").length;return Math.round(r/E(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)=>{if(!t)return;let i=t;for(let n of r){if(!i)break;i=i[n]}return i};Array.prototype.order=function(t){let{direction:r="ASC",keys:i=[],numeral:n=!1}=t,s=[];return i.length?n?s=this.sort((o,u)=>+(Number(e(o,i))>Number(e(u,i)))*2-1):s=this.sort((o,u)=>{let l=String(e(o,i)).replace(/(\d+)/g,c=>c.padStart(18,"0")),h=String(e(u,i)).replace(/(\d+)/g,c=>c.padStart(18,"0"));return+(l>h)*2-1}):n?s=this.sort((o,u)=>+(o>u)*2-1):s=this.sort((o,u)=>{let l=String(o).replace(/(\d+)/g,c=>c.padStart(18,"0")),h=String(u).replace(/(\d+)/g,c=>c.padStart(18,"0"));return+(l>h)*2-1}),r=="DESC"&&(s=s.reverse()),s},Array.prototype.getLastChild=function(){let t=this.length-1;return this[t]}}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 ee=(e=24)=>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(""),S=ee;S.gen128Binary=()=>Array.from({length:128}).map((e,t)=>"01"[Math.round(Math.random()*1)]).join("");S.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};S.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 te=e=>new a.prototype.jmini(e),a=te;a.prototype={};a.extend=function(e,t=a){for(var[r,i]of Object.entries(e))t.prototype[r]=i};a.expando="__jmini_"+S();var y=(e,t)=>(e.queue.push(t),J(e),e),J=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,J(e)}}),D=(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},ne=(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,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,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(g=>{o[1]&&(g=g.cloneNode(!0)),h.parentNode.insertBefore(g,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 y(this,()=>new Promise((s,o)=>{setTimeout(()=>{s(this)},n)}))},abort:function(){return y(this,()=>p(this,null,function*(){return this.queue=[],this}))},callback:function(n){return y(this,()=>p(this,null,function*(){return yield n(this),this}))},click:function(){return y(this,()=>{for(var n=0;n<this.length;n++){let s=this[n];a.is.element(s)&&s.click()}return this})},focus:function(){return y(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 y(this,()=>{let{eventType:s,eventID:o=S(),target:u,callback:l,options:h}=n;return h=R({passive:!0,capture:!1},h),this.for(c=>{if(!(a.is.element(c)||a.is.shadowRoot(c)))return;let{events:g}=c[a.expando];if(u){let b=l;l=m=>{if(m.target){if(a.is.string(u)){let T=m.target.closest(u);T&&(!T||b.call(T,m))}else if(a.is.elements(u)){for(let C of u)if(m.target==C)return b.call(C,m)}}}}if(g[o]){let b=g[o];c.removeEventListener(b.eventType,b.callback,b.options)}g[o]={eventType:s,callback:l,options:h},c.addEventListener(s,l,h)}),this})},removeEvent:function(n){return y(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 y(this,()=>D(this,r(n,t(this))))},empty:function(){return y(this,()=>D(this,t(this)))},append:function(n){return y(this,()=>{r(n,this)})},remove:function(){return y(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 y(this,()=>D(this,i(this,"before",...n)))},after:function(...n){return y(this,()=>D(this,i(this,"after",...n)))},find:function(n){return y(this,()=>{let s=[],o=this[0];o||D(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(c=>c)])})),D(this,a(s))})},parent:function(n){return y(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);D(this,s)})},children:function(n){return y(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 D(this,o)})},addClass:function(n){return y(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 y(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 y(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 y(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 y(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.Stringify=e=>JSON.stringify(e),a.Objectify=(e,t)=>{try{return JSON.parse(e)}catch(r){return t!=null?t:null}},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.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]};{let e={};a.interval={run:(t,r,i)=>{e[t]=setTimeout(i,r)},clear:t=>{clearInterval(e[t])},cycle:(t,r,i)=>{a.interval.clear(t),a.interval.run(t,r,i)}}}}a.createElement=function(e){var g;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 b of Object.entries(s)){let m=b[0],C=(g=b[1])!=null?g:"";if(m=="data"&&a.is.keyValueDictionary(C))for(let[T,w]of Object.entries(C))l.dataset[T]=w;else m=="for"?m="htmlFor":m=="tabindex"?m="tabIndex":m=="aria-label"&&(m="ariaLabel"),l[m]=C}if(n&&a(l).append(n),o)for(var[h,c]of Object.entries(o))l.style[h]=c;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,c;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=(c=e.pageY)!=null?c:(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),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.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 re=e=>new f.prototype.time(e),f=re;f.prototype={};var x=function(e,t){e.value=t;let r=a.is.date(t);if(e.validate=r,!r)return e.ms=-1,e.year=-1,e.month=-1,e.weekday=-1,e.weekInYear=-1,e.date=-1,e.hours=-1,e.minutes=-1,e.seconds=-1,e;e.ms=t.getTime(),e.weekday=t.getDay(),e.year=t.getFullYear(),e.month=t.getMonth()+1,e.date=t.getDate();{let i=new Date(e.year,0,1),n=new Date(i.valueOf());n.setDate(n.getDate()-(i.getDay()+1));let s=t.getTime()-n.getTime(),o=Math.ceil(s/(1e3*60*60*24));e.weekInYear=Math.ceil(o/7)}{let i=new Date(e.year,e.month-1,1),n=new Date(i.valueOf());n.setDate(n.getDate()-(i.getDay()+1));let s=t.getTime()-n.getTime(),o=Math.ceil(s/(1e3*60*60*24)),u=Math.ceil(o/7);e.weekInMonth=u}{let i=new Date(e.year,e.month,0),n=i.getDay(),s=new Date(new Date(i).setDate(i.getDate()-n));e.isLastWeekInMonth=e.date>=s.getDate()}return e.hours=t.getHours(),e.minutes=t.getMinutes(),e.seconds=t.getSeconds(),e};a.extend({constructor:f,time:function(e){f.isTimeObject(e)&&(e=e.value),e||(e===null?e=void 0:e===void 0&&(e=new Date));let t=new Date(e);return x(this,t)}},f);f.prototype.time.prototype=f.prototype;f.isTimeObject=e=>{var t;return((t=e||{})==null?void 0:t.constructor)===f};f.getFromNumberYYYYMMDD=e=>{let t=String(e).replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3");return f(t+" 00:00")};f.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=f(n).addYear(1):e=="month"?n=f(n).addMonth(1):e=="week"?n=f(n).addWeek(1):e=="day"?n=f(n).addDate(1):e=="hours"?n=f(n).addHours(1):e=="minutes"?n=f(n).addMinutes(1):e=="seconds"&&(n=f(n).addSeconds(1));return i};a.extend({setYear:function(e){let t=new Date(this.value.valueOf());return t.setFullYear(e),x(this,t)},setMonth:function(e){let t=new Date(this.value.valueOf());return t.setMonth(e-1),x(this,t)},setDate:function(e){let t=new Date(this.value.valueOf());return t.setDate(e),x(this,t)},setHours:function(e){let t=new Date(this.value.valueOf());return t.setHours(e),x(this,t)},setMinutes:function(e){let t=new Date(this.value.valueOf());return t.setMinutes(e),x(this,t)},setSeconds:function(e){let t=new Date(this.value.valueOf());return t.setSeconds(e),x(this,t)},setMilliseconds:function(e){let t=new Date(this.value.valueOf());return t.setMilliseconds(e),x(this,t)},setMidnight:function(){let e=new Date(this.value.valueOf());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),x(this,e)},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)},isSameYear:function(e){let t=f(e);return this.year==t.year},isSameMonth:function(e){let t=f(e);return this.year==t.year&&this.month==t.month},isSameWeek:function(e){let t=f(e);return this.year==t.year&&this.weekInYear==t.weekInYear},isSameDate:function(e){let t=f(e);return this.year==t.year&&this.month==t.month&&this.date==t.date},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%m\u5206"):this.toFormat("%h:%i"):""},toFormatYMDHM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\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"):""},getFirstDayOfTheYear:function(){return f(new Date(this.value.getFullYear(),0,1))},getLastDayOfTheYear:function(){return f(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfTheMonth:function(){return f(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfTheMonth:function(){return f(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfTheWeek:function(){let e=f(this.value);return e.addDate(-e.weekday)},getLastDayOfTheWeek:function(){let e=f(this.value);return e.addDate(6-e.weekday)},diff:function(e){let t=this.ms-e.ms;return{years:this.year-e.year,months:(this.year-e.year)*12+(this.month-e.month),dates:Math.floor(t/(60*60*24*1e3)),hours:Math.floor(t/(60*60*1e3)),minutes:Math.floor(t/(60*1e3)),seconds:Math.floor(t/1e3)}},getAge:function(e){let t=e||f(),r=t.year-this.year;return(this.month>t.month||this.month==t.month&&t.date<this.date)&&r--,r}},f);var d=(e,t)=>new d.prototype.instance(e,t);d.prototype={};d.waitList=[];d.setDefaultTrafficControl=0;d.setDefaultTimeout=1e3*60*10;d.isReadableStream=e=>e instanceof ReadableStream;d.isReadableStreamReader=e=>e instanceof ReadableStreamDefaultReader;d.streamToContext=(e,t)=>p(void 0,null,function*(){try{let r=(t==null?void 0:t.reader)||e.getReader();if(!d.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}}});a.extend({constructor:d,instance: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=H(R({key:S(),response_format:"json",timeout:d.setDefaultTimeout,trafficControl:d.setDefaultTrafficControl,preventMultiRequest:!0},t),{headers:R(R({"Content-Type":"application/json"},d.setDefaultHeaders&&d.setDefaultHeaders()),t.headers),body:r}),this},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},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 j(this,null,function*(){if(!t.ok){a.scope(()=>p(this,null,function*(){let{ok:C,done:T,data:w}=yield d.streamToContext(o,{reader:n,decoder:s});C&&r(w)}));return}let m=!1;for(;!m;){let{ok:C,done:T,data:w}=yield new B(d.streamToContext(o,{reader:n,decoder:s}));u.streamStatus=="abort"?(u.streamStatus="closed",n.cancel(),T=!0):u.streamStatus=="closed"&&(T=!0),T&&(m=T,n.releaseLock()),i(w,T)}})};try{for(var h=V(l()),c,g,b;c=!(g=yield h.next()).done;c=!1){let m=g.value;;}}catch(g){b=[g]}finally{try{c&&(g=h.return)&&(yield g.call(h))}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 p(this,null,function*(){var b;let e=this.params,t=performance.now(),r=0,i=new AbortController,n=setTimeout(()=>{i.abort()},e.timeout);e.signal=i.signal;let s=!1,o=500,u="InternalServerError",l={},h=null;try{d.setDefaultOnStart&&d.setDefaultOnStart(e),this.onStartCB&&this.onStartCB(e);let g=e,{key:m,response_format:C,trafficControl:T,preventMultiRequest:w,timeout:oe,queries:$}=g,O=Y(g,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);O.method=this.method;let q=d.waitList.includes(m);if(w&&q)throw o=429,new Error("TooManyRequests");d.waitList=[...d.waitList,m];let W=a.queryParams.set(R({},$),String(this.url));l=yield fetch(W,O).then(v=>p(this,null,function*(){return s=v.ok,o=v.status,u=v.statusText,h=v,C=="none"||C=="stream"?v:v[C]()})).catch(v=>{throw new Error(v)})}catch(m){o==200&&(o=500,s=!1),o==429&&(u="TooManyRequests"),i.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)),d.waitList.splice(d.waitList.findIndex(m=>m==e.key),1);let c={ok:s,status:o,statusText:u,body:l,requestTime:r,rawData:h};if(!s&&this.onErrorCB&&this.onErrorCB(c.body),s&&this.onStreamCB&&e.response_format=="stream"){let m=(b=h.body)==null?void 0:b.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:c,reader:m,decoder:new TextDecoder("utf-8")})}return s&&this.onCompleteCB&&this.onCompleteCB(c.body),this.onResultCB&&this.onResultCB(c,e),d.setDefaultOnEnd&&d.setDefaultOnEnd(c,e),c})},abortStream:function(){this.streamStatus="abort"}},d);d.prototype.instance.prototype=d.prototype;var M=e=>new M.prototype.instance(e);M.prototype={};a.extend({constructor:M,instance: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},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 e;return(e=(yield this.file.convert("dataURL")).target)==null?void 0:e.result})},toAarrayBuffer:function(){return p(this,null,function*(){var e;return(e=(yield this.file.convert("arrayBuffer")).target)==null?void 0:e.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}},M);M.prototype.instance.prototype=M.prototype;var k={fromFile:e=>p(void 0,null,function*(){return M(e)}),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 M(n)}),fromArrayBuffer:(e,t)=>p(void 0,null,function*(){return k.fromBlob(new Blob([e],{type:(t==null?void 0:t.mimeType)||""}),t)}),fromObjectURL:(e,t)=>p(void 0,null,function*(){let r=yield d(e,{response_format:"blob"}).get();return r.ok?k.fromBlob(r.body,t):M({})}),fromDataURL:(e,t)=>p(void 0,null,function*(){let r=yield e.toBlob((t==null?void 0:t.mimeType)||"");return r?k.fromBlob(r,t):M({})})};var ie=function(e){let t=e,r=null;return t.use((i,n,s)=>{let o=n;o.return=u=>{let{status:l=200,body:h={},bodyStringify:c=!0}=u||{},g=h;return c&&!a.is.string(h)&&(g=a.Stringify(h)),n.status(l).end(g)},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},P=ie;P.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};P.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:{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}}};d.setDefaultHeaders=()=>({});a.scope(()=>p(void 0,null,function*(){let e=a.try(()=>"aaa"),t=yield a.trySync(()=>p(void 0,null,function*(){return"aaa"}))}));var se=a;0&&(module.exports={Fetcher,Filer,Server,Time,UUID});
1
+ "use strict";var I=Object.defineProperty,W=Object.defineProperties,z=Object.getOwnPropertyDescriptor,X=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var U=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var k=Math.pow,H=(e,t,n)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,S=(e,t)=>{for(var n in t||(t={}))B.call(t,n)&&H(e,n,t[n]);if(F)for(var n of F(t))Y.call(t,n)&&H(e,n,t[n]);return e},A=(e,t)=>W(e,X(t));var j=(e,t)=>{var n={};for(var s in e)B.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&F)for(var s of F(e))t.indexOf(s)<0&&Y.call(e,s)&&(n[s]=e[s]);return n};var Q=(e,t)=>{for(var n in t)I(e,n,{get:t[n],enumerable:!0})},Z=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of G(t))!B.call(e,r)&&r!==n&&I(e,r,{get:()=>t[r],enumerable:!(s=z(t,r))||s.enumerable});return e};var ee=e=>Z(I({},"__esModule",{value:!0}),e);var p=(e,t,n)=>new Promise((s,r)=>{var i=l=>{try{u(n.next(l))}catch(h){r(h)}},o=l=>{try{u(n.throw(l))}catch(h){r(h)}},u=l=>l.done?s(l.value):Promise.resolve(l.value).then(i,o);u((n=n.apply(e,t)).next())}),O=function(e,t){this[0]=e,this[1]=t},V=(e,t,n)=>{var s=(o,u,l,h)=>{try{var c=n[o](u),g=(u=c.value)instanceof O,M=c.done;Promise.resolve(g?u[0]:u).then(m=>g?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)}},r=o=>i[o]=u=>new Promise((l,h)=>s(o,u,l,h)),i={};return n=n.apply(e,t),i[U("asyncIterator")]=()=>i,r("next"),r("throw"),r("return"),i};var $=(e,t,n)=>(t=e[U("asyncIterator")])?t.call(e):(e=e[U("iterator")](),t={},n=(s,r)=>(r=e[s])&&(t[s]=i=>new Promise((o,u,l)=>(i=r.call(e,i),l=i.done,Promise.resolve(i.value).then(h=>o({value:h,done:l}),u)))),n("next"),n("return"),t);var de={};Q(de,{Fetcher:()=>d,Filer:()=>b,Server:()=>L,Time:()=>f,UUID:()=>x,default:()=>fe,useStore:()=>P});module.exports=ee(de);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(/^.*,/,"")),n=new Uint8Array(t.length);for(var s=0;s<t.length;s++)n[s]=t.charCodeAt(s);try{var r=new Blob([n.buffer],{type:e})}catch(i){return!1}return r},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(/+/,"+")});typeof Number!="undefined"&&(Number.prototype.zeroEmbed=function(e){return String(this).padStart(e||2,"0")},Number.prototype.ratio=function(e,t=2){let n=k(10,t);return Math.round(this/e*n*100)/n},Number.prototype.rate=function(e,t=2){let n=k(10,t);return Math.round(this/e*n)/n},Number.prototype.rank=function(e=1){let t=k(10,e),n=Number(this),s=n.toLocaleString().replace(/\d/ig,"").length;return Math.round(n/k(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),n=t.slice(0,4),s=t.slice(4,6),r=t.slice(6,8),i=[];return n.length!=4||i.push(n),s.length!=2||i.push(s),r.length!=2||i.push(r),i.join(e)});if(typeof Array!="undefined"){let e=(t,n)=>{if(!t)return;let s=t;for(let r of n){if(!s)break;s=s[r]}return s};Array.prototype.order=function(t){let{direction:n="ASC",keys:s=[],numeral:r=!1}=t,i=[];return s.length?r?i=this.sort((o,u)=>+(Number(e(o,s))>Number(e(u,s)))*2-1):i=this.sort((o,u)=>{let l=String(e(o,s)).replace(/(\d+)/g,c=>c.padStart(18,"0")),h=String(e(u,s)).replace(/(\d+)/g,c=>c.padStart(18,"0"));return+(l>h)*2-1}):r?i=this.sort((o,u)=>+(o>u)*2-1):i=this.sort((o,u)=>{let l=String(o).replace(/(\d+)/g,c=>c.padStart(18,"0")),h=String(u).replace(/(\d+)/g,c=>c.padStart(18,"0"));return+(l>h)*2-1}),n=="DESC"&&(i=i.reverse()),i},Array.prototype.getLastChild=function(){let t=this.length-1;return this[t]}}typeof File!="undefined"&&(File.prototype.convert=function(e){return e=e||"dataURL",new Promise((t,n)=>{let s=new FileReader;s.onload=i=>t(i),s.onerror=i=>n(i);let r="readAs"+(e==null?void 0:e.toCapital());s[r](this)})});var te=(e=24)=>Array.from({length:e}).map((t,n)=>{let s=n==0?25:35,r=Math.round(Math.random());return"abcdefghijkrmnopqrstuvwxyz0123456789"[Math.round(Math.random()*s)][r?"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 n=Array.from({length:32}).map((s,r)=>"0123456789abcdef"[Math.round(Math.random()*15)]).join("").toUpper();return e=="Formatted"&&(n=[n.slice(0,8),n.slice(8,12),n.slice(12,16),n.slice(16,20),n.slice(20,32)].join(t)),n};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 D={},P={set:(e,t)=>{let n=!0;return Object.entries(e).forEach(([s,r])=>{let i=D[s]||{};i&&i.privateKey&&i.privateKey!=t&&(n=!1),D[s]={privateKey:t,value:r}}),n},update:(e,t)=>{let n=!0;return Object.entries(e).forEach(([s,r])=>{var o;let i=D[s]||{};i&&i.privateKey&&i.privateKey!=t&&(n=!1),D[s]=A(S({},D[s]),{value:S(S({},(o=D[s])==null?void 0:o.value),r)})}),n},get:(e,t)=>{let n=D[e];if(!(n&&n.privateKey&&n.privateKey!=t))return n==null?void 0:n.value},delete:(e,t)=>{let n=D[e];return n&&n.privateKey&&n.privateKey!=t?!1:(delete D[e],!0)}};var re=(...[e,t,n])=>new v.prototype.Cycle(e,t,n),v=re;v.prototype={};var ne=function(...[e,t,n]){return this.fn=e,this.ms=t,this.key=n,this.store(),this};a.extend({key:"",ms:0,timeoutIndex:-1,fn:null,Cycle:ne,store:function(){P.set({["Cycle_"+this.key]:this})},once:function(){return this.fn&&(this.timeoutIndex=setTimeout(this.fn,this.ms)),this.store(),this},start:function(){return this.fn&&(this.timeoutIndex=setInterval(this.fn,this.ms)),this.store(),this},abort:function(){return v.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}},v);v.abort=function(e){if(a.is.number(e))return clearInterval(e);let t=P.get("Cycle_"+e);t&&clearInterval(t.timeoutIndex)};v.get=function(e){return P.get("Cycle_"+e)};v.prototype.Cycle.prototype=v.prototype;var se=e=>new a.prototype.jmini(e),a=se;a.prototype={};a.extend=function(e,t=a){for(var[n,s]of Object.entries(e))t.prototype[n]=s};a.expando="__jmini_"+x();var y=(e,t)=>(e.queue.push(t),J(e),e),J=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,J(e)}}),R=(e,t)=>{for(let n=0;n<e.length;n++)e[n]=null;for(let[n,s]of Object.entries(t))n.match(/queue/)||(e[n]=s);return e},ie=(e,t)=>{if(t.length){for(var n=0;n<t.length;n++){let s=t[n];s&&(s[a.expando]||(a.is.element(s)||a.is.shadowRoot(s))&&(s[a.expando]={events:{}})),e[n]=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=[],ie(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(r,i,o){let u=[];for(let l=0;l<(r.length||0);l++)u.push(i(r[l],l));return o&&(u=u.filter(l=>l!=null)),u},t=r=>(r.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),r[o]=u}),r),n=(r,i)=>(a(i).for(o=>{if(r&&(a.is.element(o)||a.is.shadowRoot(o)))if(a.is.string(r)||a.is.number(r))r=String(r),o.insertAdjacentHTML("beforeend",String(r));else if(a.is.element(r))o.appendChild(r);else{a.is.jmini(r)?r=r.get():a.is.element(r)?r=[r]:a.is.keyValueDictionary(r)&&(r=[a(r)]);for(var u=0;u<r.length;u++)n(r[u],o)}}),i),s=(r,i,...o)=>{let{p:u,s:l}={before:{p:"beforebegin",s:""},after:{p:"afterend",s:"nextSibling"}}[i]||{p:"",s:""};return r.for(h=>{if(a.is.string(o[0]))h.insertAdjacentHTML(u,o[0]);else{if(!h.parentNode)return;a(o[0]).for(g=>{o[1]&&(g=g.cloneNode(!0)),h.parentNode.insertBefore(g,h[l]||h)})}}),r};a.extend({get:function(r){return r?this[0]:e(this,i=>i)},for:function(r,i=1){let o=e(this,(u,l)=>r(u,l),1);return i?o:[]},await:function(r){return y(this,()=>new Promise((i,o)=>{setTimeout(()=>{i(this)},r)}))},abort:function(){return y(this,()=>p(this,null,function*(){return this.queue=[],this}))},callback:function(r){return y(this,()=>p(this,null,function*(){return yield r(this),this}))},click:function(){return y(this,()=>{for(var r=0;r<this.length;r++){let i=this[r];a.is.element(i)&&i.click()}return this})},focus:function(){return y(this,()=>{for(var r=0;r<this.length;r++){let i=this[r];a.is.element(i)&&i.focus()}return this})},addEvent:function(r){return y(this,()=>{let{eventType:i,eventID:o=x(),target:u,callback:l,options:h}=r;return h=S({passive:!0,capture:!1},h),this.for(c=>{if(!(a.is.element(c)||a.is.shadowRoot(c)))return;let{events:g}=c[a.expando];if(u){let M=l;l=m=>{if(m.target){if(a.is.string(u)){let C=m.target.closest(u);C&&(!C||M.call(C,m))}else if(a.is.elements(u)){for(let T of u)if(m.target==T)return M.call(T,m)}}}}if(g[o]){let M=g[o];c.removeEventListener(M.eventType,M.callback,M.options)}g[o]={eventType:i,callback:l,options:h},c.addEventListener(i,l,h)}),this})},removeEvent:function(r){return y(this,()=>{let i=a.is.array(r)?r:[r];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(r){return y(this,()=>R(this,n(r,t(this))))},empty:function(){return y(this,()=>R(this,t(this)))},append:function(r){return y(this,()=>{n(r,this)})},remove:function(){return y(this,()=>(this.for((r,i)=>{r&&a.is.element(r)&&(r.remove(),delete this[i])}),this.length=0,this.warn="Object(s?) were all removed.",this))},before:function(...r){return y(this,()=>R(this,s(this,"before",...r)))},after:function(...r){return y(this,()=>R(this,s(this,"after",...r)))},find:function(r){return y(this,()=>{let i=[],o=this[0];o||R(this,a()),(a.is.element(o)||a.is.shadowRoot(o))&&(a.is.string(r)?i=o.querySelectorAll(r):a.is.element(o)&&a(r).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(c=>c)])})),R(this,a(i))})},parent:function(r){return y(this,()=>{var o,u;let i=a(r?(o=this[0])==null?void 0:o.closest(r):(u=this[0])==null?void 0:u.parentNode);R(this,i)})},children:function(r){return y(this,()=>{let i=this[0].children;a.is.exist(r)&&(r=String(r).replace(/^ : /,""),i=r=="first"?i[0]:r=="last"?i[i.length-1]:i[Number(r)]);let o=a(i);return R(this,o)})},addClass:function(r){return y(this,()=>(r&&this.for(i=>{let o=a.is.string(r)?r.split(" "):r;i&&a.is.element(i)&&i.classList.add(...o)}),this))},removeClass:function(r){return y(this,()=>(r&&this.for(i=>{let o=a.is.string(r)?r.split(" "):r;i&&a.is.element(i)&&i.classList.remove(...o)}),this))},toggleClass:function(r){return y(this,()=>(r&&this.for(i=>{i.classList.toggle(r)}),this))},hasClass:function(r=""){if(this[0])return this[0].classList.contains(r.replace(/^\./,""))},findClass:function(r){let i=[];return this[0]&&(i=[...this[0].classList].filter(o=>o.match(r))),i},css:function(r){return y(this,()=>(this.for(i=>{if(a.is.element(i))for(let[o,u]of Object.entries(r)){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(r){return this[0].getAttribute(String(r))},setAttribute:function(r,i){return y(this,()=>(this.for(o=>o.setAttribute(r,i)),this))},getStyleProperty:function(r){let i=this[0];return i&&a.is.element(i)?getComputedStyle(i).getPropertyValue(r):""},setStyleProperty:function(r,i){let o=this[0];return o&&a.is.element(o)&&o.style.setProperty(r,i),this},val:function(){var i;let r=this[0];return(r==null?void 0:r.value)||((i=r==null?void 0:r.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 n=[];for(let s of e)n.push(...t=="-R"?a.flatArray(s,"-R"):[s]);return n};a.Stringify=e=>JSON.stringify(e);a.Objectify=(e,t)=>{try{return JSON.parse(e)}catch(n){return t!=null?t:null}};a.randomNumber=(e=0,t=100,n)=>{if(e>t)return NaN;let s=[],r=e;for(;r<=t;){if(n&&n.length&&n.includes(r)){r++;continue}s.push(r),r++}let i=Math.round(Math.random()*(s.length-1))+0;return s[i]};a.cycle=v;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 g;let{tag:t,className:n="",id:s,html:r,attr:i,style:o,parent:u}=e,l=document.createElement(t||"div");if(n&&l.classList.add(...n.split(" ")),s&&(l.id=s),i)for(let M of Object.entries(i)){let m=M[0],T=(g=M[1])!=null?g:"";if(m=="data"&&a.is.keyValueDictionary(T))for(let[C,E]of Object.entries(T))l.dataset[C]=E;else m=="for"?m="htmlFor":m=="tabindex"?m="tabIndex":m=="aria-label"&&(m="ariaLabel"),l[m]=T}if(r&&a(l).append(r),o)for(var[h,c]of Object.entries(o))l.style[h]=c;return u&&a(u).append(l),l};a.setCookie=e=>{let{hostname:t}=new URL(location.toString()),{name:n,value:s="",age:r=60*60*24*365,path:i="/",domain:o=t,secure:u=!1}=e,l=`${n}=${s}max-age=${r}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:n,scrollX:s,pageXOffset:r,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:n,scrollX:s,pageXOffset:r,pageYOffset:i,safeAreaTop:o,safeAreaBottom:u}};a.getCursor=e=>{var s,r,i,o,u,l,h,c;let t=(o=e.pageX)!=null?o:(i=(s=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:s.pageX)!=null?i:(((r=e==null?void 0:e.originalEvent)==null?void 0:r.touches)||[])[0].pageX,n=(c=e.pageY)!=null?c:(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:n}};a.pending=(e,t)=>new Promise((n,s)=>{e(n),setTimeout(()=>{n(!0)},t)});a.deepMerge=(e,...t)=>{if(!t.length)return e;let n=t.shift();if(a.is.keyValueDictionary(e)&&a.is.keyValueDictionary(n))for(let s in n)a.is.keyValueDictionary(n[s])?(e[s]||Object.assign(e,{[s]:{}}),a.deepMerge(e[s],n[s])):Object.assign(e,{[s]:n[s]});return a.deepMerge(e,...t)};a.queryParams={get:e=>{let t=new URL(e||location.href),n={};return t.searchParams.forEach((s,r)=>n[r]=s),n},set:(e,t)=>{let n=new URL(t||location.href);return Object.entries(e).forEach(([s,r])=>{n.searchParams.set(s,String(r))}),t||history.replaceState({},"",n.pathname+n.search),n.toString()},delete:(e,t)=>{let n=new URL(t||location.href);return e.forEach(s=>{n.searchParams.delete(s)}),t||history.replaceState({},"",n.pathname+n.search),n.toString()}};a.ellipsisText=(e,t)=>{let n=String(e);return n.length>t&&(n=n.slice(0,t)+" ..."),n};a.is={equal:function(e,t,n){return n==null||n?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),n=Number(!!e&&typeof e!="string"&&this.array(e)&&t!=="[object Text]");if(n&&t!=="[object NodeList]")for(var s of e)n&=Number(this.element(s));return!!n},shadowRoot:function(e){return e instanceof ShadowRoot},date:function(e){return this.number(new Date(e).getTime())}};var ae=e=>new f.prototype.Time(e),f=ae;f.prototype={};var oe=function(e){f.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:f,Time:oe,clone:function(){return f(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 n=new Date(this.year,0,1),s=new Date(n.valueOf());s.setDate(s.getDate()-(n.getDay()+1));let r=e.getTime()-s.getTime(),i=Math.ceil(r/(1e3*60*60*24));this.weekInYear=Math.ceil(i/7)}{let n=new Date(this.year,this.month-1,1),s=new Date(n.valueOf());s.setDate(s.getDate()-(n.getDay()+1));let r=e.getTime()-s.getTime(),i=Math.ceil(r/(1e3*60*60*24)),o=Math.ceil(i/7);this.weekInMonth=o}{let n=new Date(this.year,this.month,0),s=n.getDay(),r=new Date(new Date(n).setDate(n.getDate()-s));this.isLastWeekInMonth=this.date>=r.getDate()}return this.hours=e.getHours(),this.minutes=e.getMinutes(),this.seconds=e.getSeconds(),this},isSameYear:function(e){let t=f(e);return this.year==t.year},isSameMonth:function(e){let t=f(e);return this.year==t.year&&this.month==t.month},isSameWeek:function(e){let t=f(e);return this.year==t.year&&this.weekInYear==t.weekInYear},isSameDate:function(e){let t=f(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%m\u5206"):this.toFormat("%h:%i"):""},toFormatYMDHM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\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"):""},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)},getFirstDayOfTheYear:function(){return f(new Date(this.value.getFullYear(),0,1))},getLastDayOfTheYear:function(){return f(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfTheMonth:function(){return f(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfTheMonth:function(){return f(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfTheWeek:function(){let e=f(this.value);return e.addDate(-e.weekday)},getLastDayOfTheWeek:function(){let e=f(this.value);return e.addDate(6-e.weekday)},diff:function(e){let t=this.ms-e.ms;return{years:this.year-e.year,months:(this.year-e.year)*12+(this.month-e.month),dates:Math.floor(t/(60*60*24*1e3)),hours:Math.floor(t/(60*60*1e3)),minutes:Math.floor(t/(60*1e3)),seconds:Math.floor(t/1e3)}},getAge:function(e){let t=e||f(),n=t.year-this.year;return(this.month>t.month||this.month==t.month&&t.date<this.date)&&n--,n}},f);f.isTimeObject=e=>{var t;return((t=e||{})==null?void 0:t.constructor)===f};f.getFromNumberYYYYMMDD=e=>{let t=String(e).replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3");return f(t+" 00:00")};f.getPeriodArray=(e,t,n)=>{let s=[],r=t;if(!t.validate||!n.validate)return s;for(;r.toFormatYMDHMS().toNumber()<=n.toFormatYMDHMS().toNumber();)s.push(r),e=="year"?r=f(r).addYear(1):e=="month"?r=f(r).addMonth(1):e=="week"?r=f(r).addWeek(1):e=="day"?r=f(r).addDate(1):e=="hours"?r=f(r).addHours(1):e=="minutes"?r=f(r).addMinutes(1):e=="seconds"&&(r=f(r).addSeconds(1));return s};f.prototype.Time.prototype=f.prototype;var ue=(e,t)=>new d.prototype.Fetcher(e,t),d=ue;d.prototype={};d.waitList=[];d.setDefaultTrafficControl=0;d.setDefaultTimeout=1e3*60*10;d.isReadableStream=e=>e instanceof ReadableStream;d.isReadableStreamReader=e=>e instanceof ReadableStreamDefaultReader;d.streamToContext=(e,t)=>p(void 0,null,function*(){try{let n=(t==null?void 0:t.reader)||e.getReader();if(!d.isReadableStreamReader(n))return{ok:!1,done:!0,data:null};if(!n)return{ok:!1,done:!0,data:null};let s=(t==null?void 0:t.decoder)||new TextDecoder("utf-8"),r=yield n.read();return{ok:!0,done:r.done,data:s.decode(r.value)}}catch(n){return{ok:!1,done:!0,data:n}}});var le=function(e,t){var r;t=t||{};let n=t.body;t.body&&!a.is.string(t.body)&&((r=t.bodyStringify)==null||r)&&(n=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=A(S({key:x(),response_format:"json",timeout:d.setDefaultTimeout,trafficControl:d.setDefaultTrafficControl,preventMultiRequest:!0},t),{headers:S(S({"Content-Type":"application/json"},d.setDefaultHeaders&&d.setDefaultHeaders()),t.headers),body:n}),this};a.extend({Fetcher:le,params:{},url:"",method:"GET",streamStatus:"closed",onStartCB:()=>{},onCompleteCB:()=>{},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},onError:function(e){return this.onErrorCB=e,this},onStreamProcess:function(e){return p(this,null,function*(){let{response:t,errorCB:n,streamCB:s,reader:r,decoder:i}=e,o=t.body,u=this,l=function(){return V(this,null,function*(){if(!t.ok){a.scope(()=>p(this,null,function*(){let{ok:T,done:C,data:E}=yield d.streamToContext(o,{reader:r,decoder:i});T&&n(E)}));return}let m=!1;for(;!m;){let{ok:T,done:C,data:E}=yield new O(d.streamToContext(o,{reader:r,decoder:i}));u.streamStatus=="abort"?(u.streamStatus="closed",r.cancel(),C=!0):u.streamStatus=="closed"&&(C=!0),C&&(m=C,r.releaseLock()),s(E,C)}})};try{for(var h=$(l()),c,g,M;c=!(g=yield h.next()).done;c=!1){let m=g.value;;}}catch(g){M=[g]}finally{try{c&&(g=h.return)&&(yield g.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 M;let e=this.params,t=performance.now(),n=0,s=new AbortController,r=setTimeout(()=>{s.abort()},e.timeout);e.signal=s.signal;let i=!1,o=500,u="InternalServerError",l={},h=null;try{d.setDefaultOnStart&&d.setDefaultOnStart(e),this.onStartCB&&this.onStartCB(e);let g=e,{key:m,response_format:T,trafficControl:C,preventMultiRequest:E,timeout:pe,queries:K}=g,N=j(g,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);N.method=this.method;let q=d.waitList.includes(m);if(E&&q)throw o=429,new Error("TooManyRequests");d.waitList=[...d.waitList,m];let _=a.queryParams.set(S({},K),String(this.url));l=yield fetch(_,N).then(w=>p(this,null,function*(){return i=w.ok,o=w.status,u=w.statusText,h=w,T=="none"||T=="stream"?w:w[T]()})).catch(w=>{throw new Error(w)})}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(r),n=performance.now()-t}e.trafficControl&&(yield a.pending(()=>{},e.trafficControl)),d.waitList.splice(d.waitList.findIndex(m=>m==e.key),1);let c={ok:i,status:o,statusText:u,body:l,requestTime:n,rawData:h};if(!i&&this.onErrorCB&&this.onErrorCB(c.body),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:c,reader:m,decoder:new TextDecoder("utf-8")})}return i&&this.onCompleteCB&&this.onCompleteCB(c.body),this.onResultCB&&this.onResultCB(c,e),d.setDefaultOnEnd&&d.setDefaultOnEnd(c,e),c})},abortStream:function(){this.streamStatus="abort"}},d);d.prototype.Fetcher.prototype=d.prototype;var he=e=>new b.prototype.Filer(e),b=he;b.prototype={};var me=function(e){this.ok=!0;try{let[t,n]=e.name.replace(/\s/,"").replace(/(.*)\.(.*)$/,"$1 $2").split(" ");this.file=e,this.extension=n,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 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}},b);b.fromFile=e=>p(void 0,null,function*(){return b(e)});b.fromBlob=(e,t)=>p(void 0,null,function*(){let n=(t==null?void 0:t.fileName)||"file",s=(t==null?void 0:t.extension)||"",r=new File([e],n+"."+s,{type:t==null?void 0:t.mimeType});return b(r)});b.fromArrayBuffer=(e,t)=>p(void 0,null,function*(){return b.fromBlob(new Blob([e],{type:(t==null?void 0:t.mimeType)||""}),t)});b.fromObjectURL=(e,t)=>p(void 0,null,function*(){let n=yield d(e,{response_format:"blob"}).get();return n.ok?b.fromBlob(n.body,t):b({})});b.fromDataURL=(e,t)=>p(void 0,null,function*(){let n=yield e.toBlob((t==null?void 0:t.mimeType)||"");return n?b.fromBlob(n,t):b({})});b.prototype.Filer.prototype=b.prototype;var ce=function(e){let t=e,n=null;return t.use((s,r,i)=>{let o=r;o.return=u=>{let{status:l=200,body:h={},bodyStringify:c=!0}=u||{},g=h;return c&&!a.is.string(h)&&(g=a.Stringify(h)),r.status(l).end(g)},i()}),t.onPathRouter=function(s){return n=s,this},t.pathRouter=function(s){if(!n)return;let r=n(s);return r.route(s),t.use(s,r),r},t.exception=function(s){return t.use(s),this},t},L=ce;L.getLocalIP=e=>{let t="";return a.scope(()=>{if(!e)return;let n=e.networkInterfaces();for(let[s,r]of Object.entries(n))r.forEach(i=>{!i.internal&&i.family==="IPv4"&&!i.address.match(/^(169|127)/)&&(t=i.address)})}),t};L.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=>p(void 0,null,function*(){let t="";a.is.string(e)?t=e:a.is.function(e)&&(t=e());let n={ok:!1,body:"NotSupported"};return yield p(void 0,null,function*(){let s;if(navigator.clipboard){if(s=yield navigator.clipboard.writeText(t).then(()=>!0,()=>!1),!s)return}else{let r=document.createElement("input");if(a(document.body).append(r),r.value=t,r.select(),s=document.execCommand("copy"),document.body.removeChild(r),!s)return}n={ok:!0,body:""}}),n});a.ImageLoader=(e,t)=>new Promise((n,s)=>{let r=t||new Image;r.onload=()=>n(r),r.onerror=i=>s(i),r.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:{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=[],n=[],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"),n.push(l+h+"\u5E74"),t.push(l)}}),{era:t,value:n,gap:s}}};d.setDefaultHeaders=()=>({});var fe=a;0&&(module.exports={Fetcher,Filer,Server,Time,UUID,useStore});
package/declare/core.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { KeyValueDict } from '.';
2
+ import { Cycle } from './cycle';
2
3
  import './primitiveExtension';
3
4
  declare global {
4
5
  interface JminiExtension {
@@ -83,11 +84,12 @@ declare namespace Jmini {
83
84
  new (v?: Args): Chains;
84
85
  };
85
86
  };
87
+ type IFEXIST<T = any> = T extends infer V ? V : string | number | boolean | KeyValueDict | void | null;
86
88
  type Methods = {
87
89
  expando: string;
88
90
  prototype: Chains;
89
91
  (v?: Args): Chains;
90
- extend(v: KeyValueDict, t?: Methods | any): void;
92
+ extend<T = KeyValueDict>(v: IFEXIST<T>, t?: any): void;
91
93
  createElement: (v: CreateElementInput) => HTMLElement;
92
94
  setCookie(props: {
93
95
  name: string;
@@ -148,8 +150,10 @@ declare namespace Jmini {
148
150
  date(v: any): v is Date;
149
151
  };
150
152
  ellipsisText(value: string, length: number): string;
151
- flatArray(v: any, regression?: '-R'): any[];
152
- deepMerge<T>(target: T, ...args: T[]): T;
153
+ flatArray<T = any>(v: any, regression?: '-R'): T[];
154
+ deepMerge<T = any>(target: T, ...args: T[]): T;
155
+ randomNumber(min?: number, max?: number, notIn?: number[]): number;
156
+ cycle: Cycle.Methods;
153
157
  Stringify(value: any): string;
154
158
  Objectify<T = any>(value: any, OnError?: any): T;
155
159
  try<T = any>(fn: {
@@ -164,12 +168,6 @@ declare namespace Jmini {
164
168
  scopeSync<T = any>(fn: {
165
169
  (): Promise<T>;
166
170
  }): Promise<T>;
167
- randomNumber(min?: number, max?: number, notIn?: number[]): number;
168
- interval: {
169
- run(key: string, ms: number, callback: Function): void;
170
- clear(key: string): void;
171
- cycle(key: string, ms: number, callback: Function): void;
172
- };
173
171
  };
174
172
  }
175
173
  declare const Jmini: Jmini.Methods & JminiExtension;
@@ -0,0 +1,34 @@
1
+ declare namespace Cycle {
2
+ type InputArray = [Function, number, string | void];
3
+ type Input = {
4
+ fn: Function;
5
+ ms: number;
6
+ key?: string;
7
+ };
8
+ type SystemMethods = {
9
+ Cycle: {
10
+ new (...args: InputArray): UsageMethods;
11
+ };
12
+ store(): void;
13
+ };
14
+ type UsageMethods = {
15
+ key: string;
16
+ ms: number;
17
+ timeoutIndex: number;
18
+ fn: Function | null;
19
+ once(): UsageMethods;
20
+ start(): UsageMethods;
21
+ abort(): UsageMethods;
22
+ set_ms(ms: number): UsageMethods;
23
+ set_fn(fn: Function): UsageMethods;
24
+ };
25
+ type Property = SystemMethods & UsageMethods;
26
+ type Methods = {
27
+ prototype: Property;
28
+ (...args: InputArray): UsageMethods;
29
+ abort(key: number | string): void;
30
+ get(key: string): UsageMethods | undefined;
31
+ };
32
+ }
33
+ declare const Cycle: Cycle.Methods;
34
+ export { Cycle, Cycle as default };
@@ -35,11 +35,11 @@ declare namespace Fetcher {
35
35
  onResultCB<T = any>(result: Output<T>, params: Input): void;
36
36
  onCompleteCB<T = any>(result: T): void;
37
37
  onErrorCB<T = any>(error: T): void;
38
- instance: {
38
+ Fetcher: {
39
39
  new (url: urlInput, v?: Input): Chains;
40
40
  };
41
41
  };
42
- type UsageChains = {
42
+ type Chains = {
43
43
  params: Input;
44
44
  url: urlInput;
45
45
  method: string;
@@ -53,17 +53,18 @@ declare namespace Fetcher {
53
53
  options<T = any>(): Promise<Output<T>>;
54
54
  send<T = any>(): Promise<Output<T>>;
55
55
  abortStream(): void;
56
- onStart(cb: (params: Input) => void): UsageChains;
56
+ onStart(cb: (params: Input) => void): Chains;
57
57
  onStream<T = any>(callback: (data: T, done: boolean) => void, options?: {
58
58
  decoder?: TextDecoder;
59
- }): UsageChains;
60
- onResult<T = any>(cb: (result: Output<T>, params: Input) => void): UsageChains;
61
- onComplete<T = any>(cb: (result: T) => void): UsageChains;
62
- onError<T = any>(cb: (error: T) => void): UsageChains;
59
+ }): Chains;
60
+ onResult<T = any>(cb: (result: Output<T>, params: Input) => void): Chains;
61
+ onComplete<T = any>(cb: (result: T) => void): Chains;
62
+ onError<T = any>(cb: (error: T) => void): Chains;
63
63
  };
64
- type Chains = SystemMethods & UsageChains;
64
+ type Property = SystemMethods & Chains;
65
65
  type Methods = {
66
- prototype: Chains;
66
+ prototype: Property;
67
+ (url: urlInput, v?: Input): Chains;
67
68
  waitList: string[];
68
69
  setDefaultTrafficControl: number;
69
70
  setDefaultTimeout: number;
@@ -80,7 +81,6 @@ declare namespace Fetcher {
80
81
  done: boolean;
81
82
  data: any;
82
83
  }>;
83
- (url: urlInput, v?: Input): UsageChains;
84
84
  };
85
85
  }
86
86
  declare const Fetcher: Fetcher.Methods;
@@ -6,14 +6,16 @@ declare namespace Filer {
6
6
  mimeType?: string;
7
7
  };
8
8
  type SystemMethods = {
9
- instance: {
9
+ Filer: {
10
10
  new (v: any): any;
11
11
  };
12
12
  };
13
- type UsageChains = {
13
+ type UsageMethods = {
14
+ ok: boolean;
14
15
  extension: string;
15
16
  type: string;
16
17
  file: File;
18
+ fileName: string;
17
19
  toBlob(): Promise<Blob>;
18
20
  toDataURL(): Promise<string>;
19
21
  toAarrayBuffer(): Promise<ArrayBuffer>;
@@ -23,17 +25,15 @@ declare namespace Filer {
23
25
  updateMimeType(mimeType: string): void;
24
26
  updateExtension(extension: string): void;
25
27
  };
26
- type Chains = SystemMethods & UsageChains;
27
- type ClassMethods = {
28
- prototype: Chains;
29
- (v: any): UsageChains;
30
- };
28
+ type Property = SystemMethods & UsageMethods;
31
29
  type Methods = {
32
- fromFile(file: File): Promise<UsageChains>;
33
- fromBlob(file: Blob, options?: Options): Promise<UsageChains>;
34
- fromDataURL(dataURL: string, options?: Options): Promise<UsageChains>;
35
- fromArrayBuffer(arrayBuffer: ArrayBuffer, options?: Options): Promise<UsageChains>;
36
- fromObjectURL(objectURL: string, options?: Options): Promise<UsageChains>;
30
+ prototype: Property;
31
+ (v: any): UsageMethods;
32
+ fromFile(file: File): Promise<UsageMethods>;
33
+ fromBlob(file: Blob, options?: Options): Promise<UsageMethods>;
34
+ fromDataURL(dataURL: string, options?: Options): Promise<UsageMethods>;
35
+ fromArrayBuffer(arrayBuffer: ArrayBuffer, options?: Options): Promise<UsageMethods>;
36
+ fromObjectURL(objectURL: string, options?: Options): Promise<UsageMethods>;
37
37
  };
38
38
  }
39
39
  declare const Filer: Filer.Methods;
@@ -3,11 +3,12 @@ export interface KeyValueDict<T = any> {
3
3
  }
4
4
  import './primitiveExtension';
5
5
  import Jmini from './core';
6
- import UUID from './uuid';
7
- import Time from './time';
8
- import Fetcher from './fetcher';
9
- import Filer from './filer';
10
- import Server from './server';
6
+ import { UUID } from './uuid';
7
+ import { Time } from './time';
8
+ import { Fetcher } from './fetcher';
9
+ import { Filer } from './filer';
10
+ import { Server } from './server';
11
+ import { useStore } from './useStore';
11
12
  export * from './extension';
12
- export { Time, Fetcher, Filer, Server, UUID };
13
+ export { Time, Fetcher, Filer, Server, useStore, UUID };
13
14
  export default Jmini;
package/declare/time.d.ts CHANGED
@@ -1,7 +1,12 @@
1
1
  declare namespace Time {
2
2
  type Input = any;
3
3
  type DateTrimTypes = 'Y' | 'M' | 'W' | 'D' | 'H' | 'I' | 'S';
4
- type Chains = {
4
+ type SystemMethods = {
5
+ Time: {
6
+ new (v: Input): UsageMethods;
7
+ };
8
+ };
9
+ type UsageMethods = {
5
10
  value: Date;
6
11
  validate: boolean;
7
12
  ms: number;
@@ -15,25 +20,26 @@ declare namespace Time {
15
20
  hours: number;
16
21
  minutes: number;
17
22
  seconds: number;
23
+ clone(): UsageMethods;
24
+ set(date: Date): UsageMethods;
18
25
  isSameYear(v: any): boolean;
19
26
  isSameMonth(v: any): boolean;
20
27
  isSameWeek(v: any): boolean;
21
28
  isSameDate(v: any): boolean;
22
- setYear(v: number): Chains;
23
- setMonth(v: number): Chains;
24
- setDate(v: number): Chains;
25
- setHours(v: number): Chains;
26
- setMinutes(v: number): Chains;
27
- setSeconds(v: number): Chains;
28
- setMilliseconds(v: number): Chains;
29
- setMidnight(): Chains;
30
- addYear(v: number): Chains;
31
- addMonth(v: number): Chains;
32
- addWeek(v: number): Chains;
33
- addDate(v: number): Chains;
34
- addHours(v: number): Chains;
35
- addMinutes(v: number): Chains;
36
- addSeconds(v: number): Chains;
29
+ setYear(v: number): UsageMethods;
30
+ setMonth(v: number): UsageMethods;
31
+ setDate(v: number): UsageMethods;
32
+ setHours(v: number): UsageMethods;
33
+ setMinutes(v: number): UsageMethods;
34
+ setSeconds(v: number): UsageMethods;
35
+ setMilliseconds(v: number): UsageMethods;
36
+ addYear(v: number): UsageMethods;
37
+ addMonth(v: number): UsageMethods;
38
+ addWeek(v: number): UsageMethods;
39
+ addDate(v: number): UsageMethods;
40
+ addHours(v: number): UsageMethods;
41
+ addMinutes(v: number): UsageMethods;
42
+ addSeconds(v: number): UsageMethods;
37
43
  toFormat(format: string): string;
38
44
  toFormatYMD(lang?: 'JP'): string;
39
45
  toFormatYM(lang?: 'JP'): string;
@@ -41,13 +47,15 @@ declare namespace Time {
41
47
  toFormatHM(lang?: 'JP'): string;
42
48
  toFormatYMDHM(lang?: 'JP'): string;
43
49
  toFormatYMDHMS(lang?: 'JP'): string;
44
- getFirstDayOfTheYear(): Chains;
45
- getLastDayOfTheYear(): Chains;
46
- getFirstDayOfTheMonth(): Chains;
47
- getLastDayOfTheMonth(): Chains;
48
- getFirstDayOfTheWeek(): Chains;
49
- getLastDayOfTheWeek(): Chains;
50
- diff(v: Chains): {
50
+ setFirstOfTheDay(): UsageMethods;
51
+ setLastOfTheDay(): UsageMethods;
52
+ getFirstDayOfTheYear(): UsageMethods;
53
+ getLastDayOfTheYear(): UsageMethods;
54
+ getFirstDayOfTheMonth(): UsageMethods;
55
+ getLastDayOfTheMonth(): UsageMethods;
56
+ getFirstDayOfTheWeek(): UsageMethods;
57
+ getLastDayOfTheWeek(): UsageMethods;
58
+ diff(v: UsageMethods): {
51
59
  years: number;
52
60
  months: number;
53
61
  dates: number;
@@ -55,17 +63,15 @@ declare namespace Time {
55
63
  minutes: number;
56
64
  seconds: number;
57
65
  };
58
- getAge(date?: Time.Chains): number;
59
- time: {
60
- new (v?: Input): Chains;
61
- };
66
+ getAge(date?: Time.UsageMethods): number;
62
67
  };
68
+ type Property = SystemMethods & UsageMethods;
63
69
  type Methods = {
64
- prototype: Chains;
65
- (v?: Time.Input): Chains;
70
+ prototype: Property;
71
+ (v?: Time.Input): UsageMethods;
66
72
  isTimeObject(v: any): boolean;
67
- getFromNumberYYYYMMDD(v: number): Time.Chains;
68
- getPeriodArray(type: 'seconds' | 'minutes' | 'hours' | 'day' | 'week' | 'month' | 'year', from: Time.Chains, to: Time.Chains): Time.Chains[];
73
+ getFromNumberYYYYMMDD(v: number): Time.UsageMethods;
74
+ getPeriodArray(type: 'seconds' | 'minutes' | 'hours' | 'day' | 'week' | 'month' | 'year', from: Time.UsageMethods, to: Time.UsageMethods): Time.UsageMethods[];
69
75
  };
70
76
  }
71
77
  declare const Time: Time.Methods;
@@ -0,0 +1,11 @@
1
+ import { KeyValueDict } from '.';
2
+ declare namespace useStore {
3
+ type Methods = {
4
+ set(p: KeyValueDict, privateKey?: string): boolean;
5
+ update(p: KeyValueDict, privateKey?: string): boolean;
6
+ get<T = any>(key: string, privateKey?: string): T | undefined;
7
+ delete(key: string, privateKey?: string): boolean;
8
+ };
9
+ }
10
+ declare const useStore: useStore.Methods;
11
+ export { useStore, useStore as default };
package/esm/core.js CHANGED
@@ -1 +1 @@
1
- import{b as v,e as b}from"./chunk-ABA72NWU.js";import{UUID as T}from"./uuid";import"./primitiveExtension";const S=e=>new n.prototype.jmini(e),n=S;n.prototype={},n.extend=function(e,i=n){for(var[s,o]of Object.entries(e))i.prototype[s]=o},n.expando="__jmini_"+T();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)}}),d=(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},w=(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=[],w(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=T(),target:l,callback:u,options:h}=t;return h=v({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 p of l)if(m.target==p)return g.call(p,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,()=>d(this,s(t,i(this))))},empty:function(){return c(this,()=>d(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,()=>d(this,o(this,"before",...t)))},after:function(...t){return c(this,()=>d(this,o(this,"after",...t)))},find:function(t){return c(this,()=>{let r=[],a=this[0];a||d(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)])})),d(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);d(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 d(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.Stringify=e=>JSON.stringify(e),n.Objectify=(e,i)=>{try{return JSON.parse(e)}catch(s){return i!=null?i:null}},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.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]};{let e={};n.interval={run:(i,s,o)=>{e[i]=setTimeout(o,s)},clear:i=>{clearInterval(e[i])},cycle:(i,s,o)=>{n.interval.clear(i),n.interval.run(i,s,o)}}}}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],p=(y=g[1])!=null?y:"";if(m=="data"&&n.is.keyValueDictionary(p))for(let[C,J]of Object.entries(p))u.dataset[C]=J;else m=="for"?m="htmlFor":m=="tabindex"?m="tabIndex":m=="aria-label"&&(m="ariaLabel"),u[m]=p}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),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.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{Cycle as S}from"./cycle";import"./primitiveExtension";const x=e=>new n.prototype.jmini(e),n=x;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},w=(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=[],w(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.Stringify=e=>JSON.stringify(e),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.cycle=S,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,v]of Object.entries(d))u.dataset[C]=v;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),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.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/cycle.js ADDED
@@ -0,0 +1 @@
1
+ import"./chunk-ABA72NWU.js";import o from"./core";import{useStore as n}from"./useStore";const i=(...[t,s,r])=>new e.prototype.Cycle(t,s,r),e=i;e.prototype={};const y=function(...[t,s,r]){return this.fn=t,this.ms=s,this.key=r,this.store(),this};o.extend({key:"",ms:0,timeoutIndex:-1,fn:null,Cycle:y,store:function(){n.set({["Cycle_"+this.key]:this})},once:function(){return this.fn&&(this.timeoutIndex=setTimeout(this.fn,this.ms)),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=function(t){if(o.is.number(t))return clearInterval(t);let s=n.get("Cycle_"+t);s&&clearInterval(s.timeoutIndex)},e.get=function(t){return n.get("Cycle_"+t)},e.prototype.Cycle.prototype=e.prototype;export{e as Cycle,e as default};
package/esm/fetcher.js CHANGED
@@ -1 +1 @@
1
- import{b as T,c as B,d as D,e as p,f as w,g as x,h as v}from"./chunk-ABA72NWU.js";import c from"./core";import{UUID as F}from"./uuid";const e=(t,r)=>new e.prototype.instance(t,r);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)=>p(void 0,null,function*(){try{const a=(r==null?void 0:r.reader)||t.getReader();if(!e.isReadableStreamReader(a))return{ok:!1,done:!0,data:null};if(!a)return{ok:!1,done:!0,data:null};const i=(r==null?void 0:r.decoder)||new TextDecoder("utf-8");let o=yield a.read();return{ok:!0,done:o.done,data:i.decode(o.value)}}catch(a){return{ok:!1,done:!0,data:a}}}),c.extend({constructor:e,instance:function(t,r){var o;r=r||{};let a=r.body;r.body&&!c.is.string(r.body)&&((o=r.bodyStringify)==null||o)&&(a=c.Stringify(r.body||{}));let i=t;return c.is.string(t)&&!t.match(/https?:/)&&(i=location.origin+"/"+t.replace(/^\//,"")),this.url=i,this.method=r.method||"get",this.streamStatus="open",this.params=B(T({key:F(),response_format:"json",timeout:e.setDefaultTimeout,trafficControl:e.setDefaultTrafficControl,preventMultiRequest:!0},r),{headers:T(T({"Content-Type":"application/json"},e.setDefaultHeaders&&e.setDefaultHeaders()),r.headers),body:a}),this},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},onError:function(t){return this.onErrorCB=t,this},onStreamProcess:function(t){return p(this,null,function*(){let{response:r,errorCB:a,streamCB:i,reader:o,decoder:d}=t,s=r.body,u=this;const y=function(){return x(this,null,function*(){if(!r.ok){c.scope(()=>p(this,null,function*(){let{ok:f,done:h,data:C}=yield e.streamToContext(s,{reader:o,decoder:d});f&&a(C)}));return}let n=!1;for(;!n;){let{ok:f,done:h,data:C}=yield new w(e.streamToContext(s,{reader:o,decoder:d}));u.streamStatus=="abort"?(u.streamStatus="closed",o.cancel(),h=!0):u.streamStatus=="closed"&&(h=!0),h&&(n=h,o.releaseLock()),i(C,h)}})};try{for(var b=v(y()),m,S,R;m=!(S=yield b.next()).done;m=!1){let n=S.value;;}}catch(S){R=[S]}finally{try{m&&(S=b.return)&&(yield S.call(b))}finally{if(R)throw R[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 R;let t=this.params,r=performance.now(),a=0,i=new AbortController,o=setTimeout(()=>{i.abort()},t.timeout);t.signal=i.signal;let d=!1,s=500,u="InternalServerError",y={},b=null;try{e.setDefaultOnStart&&e.setDefaultOnStart(t),this.onStartCB&&this.onStartCB(t);let S=t,{key:n,response_format:f,trafficControl:h,preventMultiRequest:C,timeout:k,queries:O}=S,g=D(S,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);g.method=this.method;let I=e.waitList.includes(n);if(C&&I)throw s=429,new Error("TooManyRequests");e.waitList=[...e.waitList,n];let P=c.queryParams.set(T({},O),String(this.url));y=yield fetch(P,g).then(l=>p(this,null,function*(){return d=l.ok,s=l.status,u=l.statusText,b=l,f=="none"||f=="stream"?l:l[f]()})).catch(l=>{throw new Error(l)})}catch(n){s==200&&(s=500,d=!1),s==429&&(u="TooManyRequests"),i.signal.aborted&&(s=408,u="Timeout"),s==500&&(u=String(n)||u),y={errorCode:String(n)}}finally{clearTimeout(o),a=performance.now()-r}t.trafficControl&&(yield c.pending(()=>{},t.trafficControl)),e.waitList.splice(e.waitList.findIndex(n=>n==t.key),1);let m={ok:d,status:s,statusText:u,body:y,requestTime:a,rawData:b};if(!d&&this.onErrorCB&&this.onErrorCB(m.body),d&&this.onStreamCB&&t.response_format=="stream"){let n=(R=b.body)==null?void 0:R.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:m,reader:n,decoder:new TextDecoder("utf-8")})}return d&&this.onCompleteCB&&this.onCompleteCB(m.body),this.onResultCB&&this.onResultCB(m,t),e.setDefaultOnEnd&&e.setDefaultOnEnd(m,t),m})},abortStream:function(){this.streamStatus="abort"}},e),e.prototype.instance.prototype=e.prototype;export{e as Fetcher,e as default};
1
+ import{b as C,c as g,d as D,e as f,f as w,g as P,h as x}from"./chunk-ABA72NWU.js";import c from"./core";import{UUID as E}from"./uuid";const k=(t,r)=>new e.prototype.Fetcher(t,r),e=k;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)=>f(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 F=function(t,r){var n;r=r||{};let o=r.body;r.body&&!c.is.string(r.body)&&((n=r.bodyStringify)==null||n)&&(o=c.Stringify(r.body||{}));let i=t;return c.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(C({key:E(),response_format:"json",timeout:e.setDefaultTimeout,trafficControl:e.setDefaultTrafficControl,preventMultiRequest:!0},r),{headers:C(C({"Content-Type":"application/json"},e.setDefaultHeaders&&e.setDefaultHeaders()),r.headers),body:o}),this};c.extend({Fetcher:F,params:{},url:"",method:"GET",streamStatus:"closed",onStartCB:()=>{},onCompleteCB:()=>{},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},onError:function(t){return this.onErrorCB=t,this},onStreamProcess:function(t){return f(this,null,function*(){let{response:r,errorCB:o,streamCB:i,reader:n,decoder:d}=t,s=r.body,u=this;const y=function(){return P(this,null,function*(){if(!r.ok){c.scope(()=>f(this,null,function*(){let{ok:p,done:m,data:T}=yield e.streamToContext(s,{reader:n,decoder:d});p&&o(T)}));return}let a=!1;for(;!a;){let{ok:p,done:m,data:T}=yield new w(e.streamToContext(s,{reader:n,decoder:d}));u.streamStatus=="abort"?(u.streamStatus="closed",n.cancel(),m=!0):u.streamStatus=="closed"&&(m=!0),m&&(a=m,n.releaseLock()),i(T,m)}})};try{for(var b=x(y()),h,S,R;h=!(S=yield b.next()).done;h=!1){let a=S.value;;}}catch(S){R=[S]}finally{try{h&&(S=b.return)&&(yield S.call(b))}finally{if(R)throw R[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 f(this,null,function*(){var R;let t=this.params,r=performance.now(),o=0,i=new AbortController,n=setTimeout(()=>{i.abort()},t.timeout);t.signal=i.signal;let d=!1,s=500,u="InternalServerError",y={},b=null;try{e.setDefaultOnStart&&e.setDefaultOnStart(t),this.onStartCB&&this.onStartCB(t);let S=t,{key:a,response_format:p,trafficControl:m,preventMultiRequest:T,timeout:q,queries:v}=S,B=D(S,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);B.method=this.method;let I=e.waitList.includes(a);if(T&&I)throw s=429,new Error("TooManyRequests");e.waitList=[...e.waitList,a];let O=c.queryParams.set(C({},v),String(this.url));y=yield fetch(O,B).then(l=>f(this,null,function*(){return d=l.ok,s=l.status,u=l.statusText,b=l,p=="none"||p=="stream"?l:l[p]()})).catch(l=>{throw new Error(l)})}catch(a){s==200&&(s=500,d=!1),s==429&&(u="TooManyRequests"),i.signal.aborted&&(s=408,u="Timeout"),s==500&&(u=String(a)||u),y={errorCode:String(a)}}finally{clearTimeout(n),o=performance.now()-r}t.trafficControl&&(yield c.pending(()=>{},t.trafficControl)),e.waitList.splice(e.waitList.findIndex(a=>a==t.key),1);let h={ok:d,status:s,statusText:u,body:y,requestTime:o,rawData:b};if(!d&&this.onErrorCB&&this.onErrorCB(h.body),d&&this.onStreamCB&&t.response_format=="stream"){let a=(R=b.body)==null?void 0:R.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:h,reader:a,decoder:new TextDecoder("utf-8")})}return d&&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};
package/esm/filer.js CHANGED
@@ -1 +1 @@
1
- import{e as i}from"./chunk-ABA72NWU.js";import l from"./core";import f from"./fetcher";const r=e=>new r.prototype.instance(e);r.prototype={},l.extend({constructor:r,instance:function(e){this.ok=!0;try{let[t,s]=e.name.replace(/\s/,"").replace(/(.*)\.(.*)$/,"$1 $2").split(" ");this.file=e,this.extension=s,this.fileName=t,this.type=e.type}catch(t){console.log(t),this.ok=!1}return this},isValid:function(){return this.ok},toBlob:function(){return i(this,null,function*(){return new Blob([this.file,{type:this.type}])})},toDataURL:function(){return i(this,null,function*(){var e;return(e=(yield this.file.convert("dataURL")).target)==null?void 0:e.result})},toAarrayBuffer:function(){return i(this,null,function*(){var e;return(e=(yield this.file.convert("arrayBuffer")).target)==null?void 0:e.result})},toObjectURL:function(){return i(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}},r),r.prototype.instance.prototype=r.prototype;const a={fromFile:e=>i(void 0,null,function*(){return r(e)}),fromBlob:(e,t)=>i(void 0,null,function*(){let s=(t==null?void 0:t.fileName)||"file",n=(t==null?void 0:t.extension)||"",o=new File([e],s+"."+n,{type:t==null?void 0:t.mimeType});return r(o)}),fromArrayBuffer:(e,t)=>i(void 0,null,function*(){return a.fromBlob(new Blob([e],{type:(t==null?void 0:t.mimeType)||""}),t)}),fromObjectURL:(e,t)=>i(void 0,null,function*(){let s=yield f(e,{response_format:"blob"}).get();return s.ok?a.fromBlob(s.body,t):r({})}),fromDataURL:(e,t)=>i(void 0,null,function*(){let s=yield e.toBlob((t==null?void 0:t.mimeType)||"");return s?a.fromBlob(s,t):r({})})};export{a as Filer,a as default};
1
+ import{e as i}from"./chunk-ABA72NWU.js";import o from"./core";import l from"./fetcher";const f=t=>new r.prototype.Filer(t),r=f;r.prototype={};const y=function(t){this.ok=!0;try{let[e,s]=t.name.replace(/\s/,"").replace(/(.*)\.(.*)$/,"$1 $2").split(" ");this.file=t,this.extension=s,this.fileName=e,this.type=t.type}catch(e){console.log(e),this.ok=!1}return this};o.extend({ok:!1,extension:"",type:"",file:{},fileName:"",Filer:y,isValid:function(){return this.ok},toBlob:function(){return i(this,null,function*(){return new Blob([this.file,{type:this.type}])})},toDataURL:function(){return i(this,null,function*(){var e;return(e=(yield this.file.convert("dataURL")).target)==null?void 0:e.result})},toAarrayBuffer:function(){return i(this,null,function*(){var e;return(e=(yield this.file.convert("arrayBuffer")).target)==null?void 0:e.result})},toObjectURL:function(){return i(this,null,function*(){return URL.createObjectURL(this.file)})},updateFileName:function(t){let e=new File([this.file],t+"."+this.extension);return this.file=e,this.fileName=t,this},updateMimeType:function(t){return this.file=new File([this.file],this.fileName+"."+this.extension,{type:t}),this.type=t,this},updateExtension:function(t){let e=new File([this.file],this.fileName+"."+t);return this.file=e,this.extension=t,this}},r),r.fromFile=t=>i(void 0,null,function*(){return r(t)}),r.fromBlob=(t,e)=>i(void 0,null,function*(){let s=(e==null?void 0:e.fileName)||"file",a=(e==null?void 0:e.extension)||"",n=new File([t],s+"."+a,{type:e==null?void 0:e.mimeType});return r(n)}),r.fromArrayBuffer=(t,e)=>i(void 0,null,function*(){return r.fromBlob(new Blob([t],{type:(e==null?void 0:e.mimeType)||""}),e)}),r.fromObjectURL=(t,e)=>i(void 0,null,function*(){let s=yield l(t,{response_format:"blob"}).get();return s.ok?r.fromBlob(s.body,e):r({})}),r.fromDataURL=(t,e)=>i(void 0,null,function*(){let s=yield t.toBlob((e==null?void 0:e.mimeType)||"");return s?r.fromBlob(s,e):r({})}),r.prototype.Filer.prototype=r.prototype;export{r as Filer,r as default};
package/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{e}from"./chunk-ABA72NWU.js";import"./primitiveExtension";import r from"./core";import o from"./uuid";import a from"./time";import t from"./fetcher";import i from"./filer";import m from"./server";export*from"./extension";t.setDefaultHeaders=()=>({}),r.scope(()=>e(void 0,null,function*(){let p=r.try(()=>"aaa"),f=yield r.trySync(()=>e(void 0,null,function*(){return"aaa"}))}));var b=r;export{t as Fetcher,i as Filer,m as Server,a as Time,o as UUID,b as default};
1
+ import"./chunk-ABA72NWU.js";import"./primitiveExtension";import e from"./core";import{UUID as o}from"./uuid";import{Time as t}from"./time";import{Fetcher as r}from"./fetcher";import{Filer as m}from"./filer";import{Server as i}from"./server";import{useStore as p}from"./useStore";export*from"./extension";r.setDefaultHeaders=()=>({});var d=e;export{r as Fetcher,m as Filer,i as Server,t as Time,o as UUID,d as default,p as useStore};
package/esm/time.js CHANGED
@@ -1 +1 @@
1
- import"./chunk-ABA72NWU.js";import u from"./core";const l=e=>new n.prototype.time(e),n=l;n.prototype={};const r=function(e,t){e.value=t;let s=u.is.date(t);if(e.validate=s,!s)return e.ms=-1,e.year=-1,e.month=-1,e.weekday=-1,e.weekInYear=-1,e.date=-1,e.hours=-1,e.minutes=-1,e.seconds=-1,e;e.ms=t.getTime(),e.weekday=t.getDay(),e.year=t.getFullYear(),e.month=t.getMonth()+1,e.date=t.getDate();{let i=new Date(e.year,0,1),a=new Date(i.valueOf());a.setDate(a.getDate()-(i.getDay()+1));let o=t.getTime()-a.getTime(),h=Math.ceil(o/(1e3*60*60*24));e.weekInYear=Math.ceil(h/7)}{let i=new Date(e.year,e.month-1,1),a=new Date(i.valueOf());a.setDate(a.getDate()-(i.getDay()+1));let o=t.getTime()-a.getTime(),h=Math.ceil(o/(1e3*60*60*24)),m=Math.ceil(h/7);e.weekInMonth=m}{let i=new Date(e.year,e.month,0),a=i.getDay(),o=new Date(new Date(i).setDate(i.getDate()-a));e.isLastWeekInMonth=e.date>=o.getDate()}return e.hours=t.getHours(),e.minutes=t.getMinutes(),e.seconds=t.getSeconds(),e};u.extend({constructor:n,time:function(e){n.isTimeObject(e)&&(e=e.value),e||(e===null?e=void 0:e===void 0&&(e=new Date));let t=new Date(e);return r(this,t)}},n),n.prototype.time.prototype=n.prototype,n.isTimeObject=e=>{var t;return((t=e||{})==null?void 0:t.constructor)===n},n.getFromNumberYYYYMMDD=e=>{let t=String(e).replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3");return n(t+" 00:00")},n.getPeriodArray=(e,t,s)=>{let i=[],a=t;if(!t.validate||!s.validate)return i;for(;a.toFormatYMDHMS().toNumber()<=s.toFormatYMDHMS().toNumber();)i.push(a),e=="year"?a=n(a).addYear(1):e=="month"?a=n(a).addMonth(1):e=="week"?a=n(a).addWeek(1):e=="day"?a=n(a).addDate(1):e=="hours"?a=n(a).addHours(1):e=="minutes"?a=n(a).addMinutes(1):e=="seconds"&&(a=n(a).addSeconds(1));return i},u.extend({setYear:function(e){let t=new Date(this.value.valueOf());return t.setFullYear(e),r(this,t)},setMonth:function(e){let t=new Date(this.value.valueOf());return t.setMonth(e-1),r(this,t)},setDate:function(e){let t=new Date(this.value.valueOf());return t.setDate(e),r(this,t)},setHours:function(e){let t=new Date(this.value.valueOf());return t.setHours(e),r(this,t)},setMinutes:function(e){let t=new Date(this.value.valueOf());return t.setMinutes(e),r(this,t)},setSeconds:function(e){let t=new Date(this.value.valueOf());return t.setSeconds(e),r(this,t)},setMilliseconds:function(e){let t=new Date(this.value.valueOf());return t.setMilliseconds(e),r(this,t)},setMidnight:function(){let e=new Date(this.value.valueOf());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),r(this,e)},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)},isSameYear:function(e){let t=n(e);return this.year==t.year},isSameMonth:function(e){let t=n(e);return this.year==t.year&&this.month==t.month},isSameWeek:function(e){let t=n(e);return this.year==t.year&&this.weekInYear==t.weekInYear},isSameDate:function(e){let t=n(e);return this.year==t.year&&this.month==t.month&&this.date==t.date},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%m\u5206"):this.toFormat("%h:%i"):""},toFormatYMDHM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\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"):""},getFirstDayOfTheYear:function(){return n(new Date(this.value.getFullYear(),0,1))},getLastDayOfTheYear:function(){return n(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfTheMonth:function(){return n(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfTheMonth:function(){return n(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfTheWeek:function(){let e=n(this.value);return e.addDate(-e.weekday)},getLastDayOfTheWeek:function(){let e=n(this.value);return e.addDate(6-e.weekday)},diff:function(e){let t=this.ms-e.ms;return{years:this.year-e.year,months:(this.year-e.year)*12+(this.month-e.month),dates:Math.floor(t/(60*60*24*1e3)),hours:Math.floor(t/(60*60*1e3)),minutes:Math.floor(t/(60*1e3)),seconds:Math.floor(t/1e3)}},getAge:function(e){let t=e||n(),s=t.year-this.year;return(this.month>t.month||this.month==t.month&&t.date<this.date)&&s--,s}},n);export{n as Time,n as default};
1
+ import"./chunk-ABA72NWU.js";import o from"./core";const u=e=>new s.prototype.Time(e),s=u;s.prototype={};const m=function(e){s.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)};o.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:s,Time:m,clone:function(){return s(this)},set:function(e){this.value=e;let t=o.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 n=new Date(this.year,0,1),r=new Date(n.valueOf());r.setDate(r.getDate()-(n.getDay()+1));let a=e.getTime()-r.getTime(),i=Math.ceil(a/(1e3*60*60*24));this.weekInYear=Math.ceil(i/7)}{let n=new Date(this.year,this.month-1,1),r=new Date(n.valueOf());r.setDate(r.getDate()-(n.getDay()+1));let a=e.getTime()-r.getTime(),i=Math.ceil(a/(1e3*60*60*24)),h=Math.ceil(i/7);this.weekInMonth=h}{let n=new Date(this.year,this.month,0),r=n.getDay(),a=new Date(new Date(n).setDate(n.getDate()-r));this.isLastWeekInMonth=this.date>=a.getDate()}return this.hours=e.getHours(),this.minutes=e.getMinutes(),this.seconds=e.getSeconds(),this},isSameYear:function(e){let t=s(e);return this.year==t.year},isSameMonth:function(e){let t=s(e);return this.year==t.year&&this.month==t.month},isSameWeek:function(e){let t=s(e);return this.year==t.year&&this.weekInYear==t.weekInYear},isSameDate:function(e){let t=s(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%m\u5206"):this.toFormat("%h:%i"):""},toFormatYMDHM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\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"):""},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)},getFirstDayOfTheYear:function(){return s(new Date(this.value.getFullYear(),0,1))},getLastDayOfTheYear:function(){return s(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfTheMonth:function(){return s(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfTheMonth:function(){return s(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfTheWeek:function(){let e=s(this.value);return e.addDate(-e.weekday)},getLastDayOfTheWeek:function(){let e=s(this.value);return e.addDate(6-e.weekday)},diff:function(e){let t=this.ms-e.ms;return{years:this.year-e.year,months:(this.year-e.year)*12+(this.month-e.month),dates:Math.floor(t/(60*60*24*1e3)),hours:Math.floor(t/(60*60*1e3)),minutes:Math.floor(t/(60*1e3)),seconds:Math.floor(t/1e3)}},getAge:function(e){let t=e||s(),n=t.year-this.year;return(this.month>t.month||this.month==t.month&&t.date<this.date)&&n--,n}},s),s.isTimeObject=e=>{var t;return((t=e||{})==null?void 0:t.constructor)===s},s.getFromNumberYYYYMMDD=e=>{let t=String(e).replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3");return s(t+" 00:00")},s.getPeriodArray=(e,t,n)=>{let r=[],a=t;if(!t.validate||!n.validate)return r;for(;a.toFormatYMDHMS().toNumber()<=n.toFormatYMDHMS().toNumber();)r.push(a),e=="year"?a=s(a).addYear(1):e=="month"?a=s(a).addMonth(1):e=="week"?a=s(a).addWeek(1):e=="day"?a=s(a).addDate(1):e=="hours"?a=s(a).addHours(1):e=="minutes"?a=s(a).addMinutes(1):e=="seconds"&&(a=s(a).addSeconds(1));return r},s.prototype.Time.prototype=s.prototype;export{s as Time,s as default};
@@ -0,0 +1 @@
1
+ import{b as n,c as u}from"./chunk-ABA72NWU.js";const t={},p={set:(r,a)=>{let e=!0;return Object.entries(r).forEach(([i,l])=>{let s=t[i]||{};s&&s.privateKey&&s.privateKey!=a&&(e=!1),t[i]={privateKey:a,value:l}}),e},update:(r,a)=>{let e=!0;return Object.entries(r).forEach(([i,l])=>{var o;let s=t[i]||{};s&&s.privateKey&&s.privateKey!=a&&(e=!1),t[i]=u(n({},t[i]),{value:n(n({},(o=t[i])==null?void 0:o.value),l)})}),e},get:(r,a)=>{let e=t[r];if(!(e&&e.privateKey&&e.privateKey!=a))return e==null?void 0:e.value},delete:(r,a)=>{let e=t[r];return e&&e.privateKey&&e.privateKey!=a?!1:(delete t[r],!0)}};export{p as default,p as useStore};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmini",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "minified JavaScript Framework",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",