text: (()=>{var q=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports);var ye=q(()=>{(function(e){e.env={destructure:!0};let i=e.env;try{let{a:r}={a:!0}}catch{i.destructure=!1}Promise.prototype.ObjectType="Promise"})(window)});var be=q(()=>{(function(e){HTMLCollection.prototype.toArray=function(){let i=[];for(let r=0;r<this.length;r++)i[r]=this[r];return i},NodeList.prototype.toArray=function(){let i=[],r=-1,t=this.length;for(;++r<t;)i[r]=this[r];return i},Object.cache=Object.create(null),Object.caching=i=>{let r=Object.cache;return r[i]||(r[i]={}),{set(t,n){return r[i][t]=n,!0},get(t){return r[i][t]}}},String.prototype.toHyphen=function(){let i=Object.cache,r=null,t=this;if(i.toHyphen||(i.toHyphen={}),i[t]&&(r=i[t]),r!=null)return r;let n=t.split(""),s="",a=-1;for(;++a<n.length;){let u=n[a];switch(a){case 0:s+=u.toLowerCase();break;default:u.charCodeAt()<91&&(s+="-"),s+=u.toLowerCase()}}return i[t]=s,r=s,r},String.prototype.toProper=function(){let i=this,r=Object.caching("toProper").get(i);if(r)return r;{let t=i.substring(0,1),n=i.slice(1),s=`${t.toUpperCase()}${n}`;return Object.caching("toProper").set(i,s),s}},String.prototype.toCamelCase=function(){let i=this.toLowerCase(),r=Object.cache,t=null;if(r.toCamel||(r.toCamel={}),r=r.toCamel,r[i])return r[i];{let n=i.split("-");if(n.length==1)return i;let s="",a=-1,u=n.length;for(;++a<u;){let h=n[a];switch(a){case 0:s+=h;break;default:{let f=h.substring(0,1).toUpperCase(),d=h.substring(1);s+=f+d}break}}return r[i]=s,s}},HTMLElement.prototype.querySelectorIncluded=function(i,r,t){let n=this.querySelector(i);return n||(()=>{switch(!0){case(!r&&!t):{let s=this.closest(i);s==this&&(n=s)}break;case(!!r&&!!t):n=this.getAttribute(r)==t?this:null;break;case(!!r&&!t):n=this.getAttribute(r)?this:null;break}return n})()},HTMLElement.prototype.querySelectorAllIncluded=function(i,r,t){let n=this.querySelectorAll(i).toArray();switch(!0){case(!r&&!t):{let s=this.closest(i);s==this&&n.push(s)}break;case(r&&t):this.getAttribute(r)==t&&n.push(this);break;case(r&&!t):this.getAttribute(r)&&n.push(this);break}return n},HTMLDocument.prototype.querySelectorIncluded=function(i){return this.querySelector(i)},HTMLDocument.prototype.querySelectorAllIncluded=function(i){return this.querySelectorAll(i)},Array.prototype.toggler=function(i,r){for(let t=0;t<this.length;t++){let n=this[t];(n.dataset.name==i||n.classList.contains(r))&&n.classList.toggle(r)}},HTMLElement.prototype.Ref=function(){let i="_cakes_storage";!this[i]&&(this._cakes_storage={});let r=this[i];return{set(t,n){r[t]=n},get(t){return r[t]},getAll(t){return r},remove(t){delete r[t]}}}})(window)});var ve=q(()=>{Object.keys||(Object.keys=function(e){var i=[];for(var r in e)e.hasOwnProperty(r)&&i.push(r);return i})});var U=q((ci,Se)=>{var W={},J={typeof:function(e){switch(!0){case typeof e=="string":return"string";case typeof e=="number":return"number";case e instanceof Array:return"array";case e instanceof Function:return"function";case e instanceof HTMLCollection:return"htmlcollection";case e instanceof NodeList:return"htmlnodelist";case e instanceof Element:return"domlement";case e instanceof Object:return"object"}},isArray:function(e){return this.typeof(e)=="array"},isObject:function(e){return this.typeof(e)=="object"},isNumber:function(e){return this.typeof(e)=="number"},isString:function(e){return this.typeof(e)=="string"},isHTMLCollection:function(e){return this.typeof(e)=="htmlcollection"},isNodeList:function(e){return this.typeof(e)=="htmlnodelist"},isElement:function(e){return this.typeof(e)=="domlement"},isFunction:function(e){return this.typeof(e)=="function"}},ne={each:function(e,i,r){if(r=="object"){var t=0;for(var n in e)e.hasOwnProperty(n)&&(i({key:n,value:e[n]},t),t=t+1)}else for(var s=0;s<e.length;s++)i(e[s],s)},map:function(e,i){var r=J.isArray(e)||e.length?"array":"object",t=e.length&&r=="array"?[]:{};return this.each(e,function(n,s){var a=i(n,s);r=="object"?t[a.key]=a.value:t.push(a)},r),t},reduce:function(e,i,r){var t=J.typeof(e);return this.each(e,function(n,s){i=r(n,i,s)},t),i},filter:function(e,i){var r=J.isArray(e)||e.length?"array":"object",t=e.length&&r=="array"?[]:{};return this.each(e,function(n,s){var a=i(n,s);a&&(r=="object"?t[n.key]=n.value:t.push(n.value))},r),t}},we={perf:function(e){console.time("test"),e(),console.timeEnd("test")},logTest:function(e,i,r){try{e=JSON.parse(e)}catch{}try{r=JSON.parse(r)}catch{}switch(i){case"==":return e==r;case"!=":return e!=r;case"<":return e<r;case">":return e>r;case">=":return e>=r;case"<=":return e<=r}},toUrlSearchParams:function(e,i=!0){let r="";for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];i&&n?r+=`${encodeURI(t)}=${encodeURI(n)}&`:r+=`${encodeURI(t)}=${encodeURI(n)}&`}return r},sanitize:function(e){if(typeof e!="string")return e;let i={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"},r=/[&<>"'/]/ig;return e.replace(r,t=>i[t])},toFormData:function(e,i={}){let r=new FormData(e),t={},n=new FormData;for(let[s,a]of r.entries()){let u;if(e[s]){let h=e[s];h.closest&&!h.closest(".cake-template")&&(h.tagName=="INPUT"&&h.getAttribute("type")=="checkbox"?a=h.checked:(i.sanitize==null||!!i.sanitize)&&(a=this.sanitize(a)),i.json?i.trim?a!=""&&(t[s]=a):t[s]=a:n.append(s,a))}}return i.json?t:n},splitBySpace:function(e,i){if(e&&(e=e.split(" "),J.isArray(e)))for(let r=0;r<e.length;r++)i(e[r])},toArray(e){let i=[];if(!e.length)return i;for(let r=0;r<e.length;r++)i.push(e[r]);return i},timeOut(e,i=1){setTimeout(()=>{e()},i)},instanceID(){return location.origin},removeWhiteSpace(e){return String(e).split(" ").join("")},recurse(e,i){return new Promise((r,t)=>{try{let n=e.length,s=0,a=()=>{n>s?(i(e[s]),s+=1,a()):r()};a()}catch(n){t(n.message)}})},browser(){if(window._browser)return window._browser;var e=!!window.opr&&!!opr.addons||!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0,i=typeof InstallTrigger!="undefined",r=/constructor/i.test(window.HTMLElement)||function(u){return u.toString()==="[object SafariRemoteNotification]"}(!window.safari||safari.pushNotification),t=!!document.documentMode,n=!t&&!!window.StyleMedia,s=!!window.chrome&&!!window.chrome.webstore,a=(s||e)&&!!window.CSS;return window._browser=e?"Opera":i?"Firefox":r?"Safari":s?"Chrome":t?"IE":n?"Edge":a?"Blink":"Don't know"},isOpera(){return this.browser=="Opera"},isFirefox(){return this.browser()=="Firefox"},isSafari(){return this.browser=="Safari"},isChrome(){return this.browser=="Chrome"},isIE(){return this.browser=="IE"},isEdge(){return this.browser=="Edge"},isBlink(){return this.browser=="Blink"},device(){return navigator.userAgent.includes("Android")?"android":/iPhone|iPad|iPod/i.test(navigator.userAgent)?"IOS":"desktop"},isAndroid(){return this.device()=="android"},isIOS(){return this.device()=="ios"},isDesktop(){return this.device()=="desktop"}};try{W.UTILS={...ne,...J,...we}}catch{W.UTILS={},Q=ne.each,Q(ne,function(i,r){W.UTILS[i]=r}),Q(J,function(i,r){W.UTILS[i]=r}),Q(we,function(i,r){W.UTILS[i]=r})}var Q;Se.exports=W.UTILS});var ke=q(()=>{(function(){customElements.define("sub-template",class extends HTMLElement{constructor(){super()}connectedCallback(){this.replace(this)}replace(e){let i=e.dataset.template,r=document.getElementsByName(i);if(r.length>1){console.error(`template with name ${i} has more than one reference.`);return}if(!r)throw e.remove(),new Error(`${i} is not found!`);if(r[0]){let t=r[0];if(t.constructor.name=="HTMLTemplateElement"){if(t=t.content.cloneNode(!0).firstElementChild,!t)return;let n=e.attributes;for(let s=0;s<n.length;s++){let a=n[s];a.name!="data-template"&&t.setAttribute(a.name,a.value)}e.replaceWith(t)}else throw new Error(`${i} is not referred to a Template Element!`)}}}),HTMLTemplateElement.prototype.replaceSubTemplate=function(e){let i=e.getElementsByTagName("sub-template");if(i){i=i.toArray();for(let r=0;r<i.length;r++){let t=i[r];customElements.get("sub-template").prototype.replace(t)}}},HTMLTemplateElement.prototype.collectContent=function(){let e=this,i=null,r=e.cloneNode(!0),t=document.createDocumentFragment(),n=r.content.querySelector("style");n&&t.appendChild(n);let s=[];for(let a=0;a<r.content.children.length;a++){let u=r.content.children[0];this.replaceSubTemplate(u),s.push(u)}return i={style:t.children[0],others:s},i},HTMLTemplateElement.prototype.parseStyle=function(e){if(!e)return!1;var i=e.textContent;if(i=i.replace(/\s/g,""),!i.length)return;let r=!1,t=!1,n=!1,s=i.split(""),a="";i="";var u=!1;for(let h=0;h<s.length;h++){let f=s[h];f=="{"&&(r=!0,t=!0),f=="}"&&(r=!1,t=!1),!r&&f!="	"&&f!="}"&&f!=" "&&f!=";"&&(a+=f),t&&f!="	"&&f!="{"&f!=" "&&(i+=f),f=="}"&&(u||(u={}),u[a]=i,a="",i="")}return u},HTMLTemplateElement.prototype.parseHTML=function(e){if(e){var i=document.createElement("HTML");for(let r=0;r<e.length;r++){let t=e[r];i.append(t)}}return i||!1},HTMLTemplateElement.prototype.getContent=function(e){let{style:i,others:r}=this.collectContent(),t=this.parseStyle(i),n=this.parseHTML(r);for(let s in t)if(t.hasOwnProperty(s)){let a=n.querySelectorAll(s),u=t[s];for(let h=0;h<a.length;h++)a[h].setAttribute("style",u)}return n=e?n.children.toArray():n.innerHTML,n.length==1?n[0]:n}})()});var Z=q((fi,Oe)=>{function I(e){this.el=I.toArray(e)}I.toArray=function(e){let i=[];switch(!0){case e instanceof Array:i=e;break;case(e.length&&e.tagName&&e.tagName!="FORM"&&!(e instanceof Array)):for(let r=0;r<e.length;r++)i.push(e[r]);break;case!(e instanceof Array):i=[e];break}return i};I.prototype.getElements=function(){return this.el};I.prototype.getElement=function(){return this.el[0]};I.prototype.remove=function(e){let i=-1,r=this.el.length,t=document.createDocumentFragment();for(;++i<r;){let n=this.el[i];n&&t.appendChild(n)}fr=null};I.prototype.replaceDataSrc=function(){let i=this.el[0].querySelectorAll("[data-src]");for(let r=0;r<i.length;r++)el=i[r],el.setAttribute("src",el.dataset.src),el.removeAttribute("data-src")};I.cloneNode=function(e){e=e instanceof Array?e:this.toArray(e);let i=[];for(let r=0;r<e.length;r++)i.push(e[r].cloneNode(!0));return new I(i)};I.prototype.dataset=function(e,i){let r=this.el.length,t=-1;for(;++t<r&&!(this.el[t].dataset[e]&&i(this.el[t])=="break"););return!0};I.prototype.getContainers=function(){return this.getElementsByDataset("container").container};I.prototype.cloneNode=function(e){return e=this.el,I.cloneNode(e)};I.prototype.getAllElements=function(){let e=this.el.length,i=[];switch(!0){case e==1:i=this.el[0].getElementsByTagName("*").toArray();break;case e>1:{let r=-1;for(;++r<e;){let n=this.el[r].getElementsByTagName("*");if(n)for(let s=0;s<n.length;s++)i.push(n[s])}}break}return i};I.prototype.appendTo=function(e,i){if(!e&&!e.attributes)throw new TypeError(`the ${e} is not an instance of Element`);i&&(e.innerHTML="");for(let r=0;r<this.el.length;r++){let t=this.el[r];e.appendChild(t)}};I.prototype.getElementsByTagName=function(e){let i=this.el.length,r=[];switch(!0){case i==1:r=this.el[0].getElementsByTagName(id).toArray();break;case i>1:{let t=-1;for(;++t<i;){let s=this.el[t].getElementsByTagName(selector);if(s)for(let a=0;a<s.length;a++)r.push(s[a])}}break}return r};I.prototype.getElementById=function(e){let i=this.el.length,r=[];switch(!0){case i==1:r=this.el[0].getElementById(id);break;case i>1:{let t=-1;for(;++t<i;){let s=this.el[t].querySelector(selector);s&&r.push(s)}}break}return r};I.prototype.querySelectorAll=function(e){let i=this.el.length,r=[];switch(!0){case i==1:r=this.el[0].querySelectorAll(e);break;case i>1:{let t=[],n=-1;for(;++n<i;){let a=this.el[n].querySelectorAll(e);a&&(r=r.concat(a.toArra()))}}break;default:r=[]}return r};I.prototype.querySelector=function(e){let i=this.el.length,r=[];switch(!0){case i==1:r=this.el[0].querySelector(e);break;case i>1:{let t=-1;for(;++t<i;){let s=this.el[t].querySelector(e);s&&r.push(s)}}break}return r};I.prototype.querySelectorIncluded=function(e,i,r){let t=this.el.length,n=[];switch(!0){case t==1:n=this.el[0].querySelectorIncluded(e,i,r);break;case t>1:{let s=-1;for(;++s<t;){let u=this.el[s].querySelectorIncluded(e,i,r);u&&n.push(u)}}break}return n};I.prototype.querySelectorAllIncluded=function(e,i,r){let t=this.el.length,n=[];switch(!0){case t==1:n=this.el[0].querySelectorAllIncluded(e,i,r);break;case t>1:{let s=-1;for(;++s<t;){let u=this.el[s].querySelectorAllIncluded(e,i,r);u&&(n=n.concat(u.toArra()))}}break}return n};I.prototype.contains=function(e){let i=this.el.length,r=!1;switch(i==1){case!0:r=this.el[0].contains(e);break;case!1:{let t=-1;for(;++t<i;)if(this.el[t].contains(e)){r=!0;break}}break}return r};I.prototype.getElementsByDataset=function(){let e,i,r,t,n,s;for(e=arguments,o={},length=e.length,r=-1,t=-1;++r<this.el.length;)for(n=this.el[r];++t<length;)i=e[t],n.getAttribute(`data-${i}`)?o[i]=[n]:o[i]=[],s=n.querySelectorAll(`[data-${i}]`),s.length&&(o[i]=o[i].concat([...s]));return o};Oe.exports=I});var se=q((pi,_e)=>{function V(e,i,r){this.subscribe=e,this.handlers=i,this.logger=r||!1,this.stat={handlers:{},subscribe:{}},this.results={},this.wm=new WeakMap}V.prototype.notify=function(e,i,r,t,n,s){function a(){return{_component:e,_event:i,_e:r}}function u(c){return c}let{_component:h,_event:f,_e:d}=a(),g=this.handlers[h]&&this.handlers[h][f];if(g==null&&n){let c={[f]:function(){return d}};c[f].binded=h,c[f].listenTo=s,g=c[f]}if(h=g.binded,g=g,!g){console.error(`no setup handler for the event ${f} in ${h} component`);return}let m=new Promise((c,p)=>{let y=g(d);c(y)});return this.stat.handlers[g.original]+=1,m.then(c=>{let p=[];if(this.results[h]||(this.results[h]={}),this.subscribe[h]&&this.subscribe[h][f]){let y=this.subscribe[h][f];t=t?(()=>{y=y.filter(b=>{let v=b.binded;return t.includes(v)})})():!0;for(let b=0;b<y.length;b++){let v=y[b];this.stat.subscribe[v.original]+=1,p.push(new Promise((w,S)=>{try{let O=(()=>v(c))();O&&O.ObjectType=="Promise"?O.then(_=>{this.results[h]||(this.results[h]={}),this.results[h][f]=O,w()}).catch(_=>{S(_)}):(this.results[h][f]=O,w())}catch(O){console.log(O),S(O)}}))}}else this.logger&&console.info(`no subscriber for (${f}) event of (${h}) component`),this.results[h][f]=c;return Promise.all(p).then(()=>{c=null})})};V.prototype.registerSubscribe=function(e){return new Promise((i,r)=>{for(component in e)if(e.hasOwnProperty(component))if(!this.subscribe[component])this.subscribe[component]={};else continue;i()}).then(()=>{let i={};for(component in e)if(e.hasOwnProperty(component)){let r=e[component];for(let t in r)if(r.hasOwnProperty(t)){let n=r[t];for(let s=0;s<n.length;s++){let a=n[s];i[component]||(i[component]={}),i[component][a.original]||(i[component][a.original]=[]),i[component][a.original].push(a),this.stat.subscribe[a.original]=0}}}return i}).then(i=>{for(let r in i)if(i.hasOwnProperty(r)){this.subscribe[r]||(this.subscribe[r]={});for(let t in i[r])if(i[r].hasOwnProperty(t))for(let n of i[r][t])this.subscribe[r][n.original]||(this.subscribe[r][n.original]=[]),this.subscribe[r][n.original].push(n)}i={}})};V.prototype.registerHandlers=function(e,i){this.handlers[i]||(this.handlers[i]={});for(let r in e)if(e.hasOwnProperty(r)){let t=e[r];this.handlers[i][r]=t,this.stat.handlers[t.original]=0}};_e.exports=V});var D=q((di,Pe)=>{function X(e,i,r){this.data=e,this.template=i,this.isConvert=r}X.prototype._getTag=function(e){return e.match(new RegExp("(?<=<)|([^/s]+)(?=>)","g"))[2]};X.prototype._bindReplace=function(e,i){for(let r in e)if(e.hasOwnProperty(r)){let t=new RegExp(`{{${r}}}`,"g");t&&(i=i.replace(t,`${e[r]}`))}return i};X.prototype._toElement=function(e,i){let r=document.createElement("template");return r.innerHTML=e,r.content.children[0]};X.prototype.createElement=function(){let e=this.template,i=this.data,r=this.isConvert;if(i){if(i instanceof Array){let t=typeof e=="string",n=t?this._getTag(e):e.tagName;e=t?e:e.outerHTML;let s=[];for(let a=0;a<i.length;a++){let u=i[a],h=this._bindReplace(u,e),f=this._toElement(h,n);r&&(f=f.outerHTML),s.push(f)}return s}else if(i instanceof Object){let t=typeof e=="string",n=t?this._getTag(e):e.tagName;e=t?e:e.outerHTML;let s=this._bindReplace(i,e),a=this._toElement(s,n);return r&&(a=a.outerHTML),a}}else{let n=typeof e=="string"?this._getTag(e):e.tagName;return this._toElement(e,n)}};Pe.exports=X});var le=q((gi,$e)=>{$e.exports=class{constructor(e=[],i){this.html=i||document,this.cf=e,this.duration=300}animate(e){return this.config=this.parse(this.cf),new Promise(i=>{for(let r=0;r<this.config.length;r++){let t=this.config[r],{element:n}=t;if(!t[e]){i();break}let s=t[e];if(!s.options&&!(s.options&&s.options.duration)&&(s.options={duration:this.duration}),!s.keyframes&&!n)continue;let a=s.keyframes,u=0,h=[];for(let d=0;d<a.length;d++){let g=a[d];switch(!0){case typeof g=="string":h.push(this.dic(g));break;case g instanceof Object:{let{name:m,offset:c}=g;if(m&&c){let p=this.dic(m);p[p.length-1].offset=c,h.push(p)}else h.push(g)}}}a=h,h=null;let f=()=>{let d=a[u],g=n.animate(d,s.options||this.duration);g.finished?g.finished.then(()=>{u<a.length-1?(u+=1,f()):(a=[],i())}):g.onfinish=()=>{u<a.length-1?(u+=1,f()):(a=[],i())}};f()}})}parse(e){let i=[],r=e.length,t=-1;for(;++t<r;){let n=e[t],s=n.selector,a;switch(!0){case!!(s.val&&s.attr):a=this.html.querySelectorIncluded(`[${s.attr}=${s.val}]`,s.attr,s.val);break;case!!(s.val&&!s.attr):{let u=s.val.match(new RegExp("^[.]"))?"class":s.val.match(new RegExp("^[#]"))?"id":null,h=u?s.val.slice(1):null;a=this.html.querySelectorIncluded(s.val,u,h)}break}n.element=a,i.push(n)}return i}dic(e){return{slideOutUp:[{transform:"translate3d(0,0,0)",visibility:"visible",opacity:"1"},{transform:"translate3d(0,100%,0)",visibility:"hidden",opacity:"0"}],slideOutRight:[{transform:"translate3d(0,0,0)",visibility:"visible",opacity:"1"},{transform:"translate3d(100%,0,0)",visibility:"hidden",opacity:"0"}],slideOutLeft:[{transform:"translate3d(0,0,0)",visibility:"visible",opacity:"1"},{transform:"translate3d(-100%,0,0)",visibility:"hidden",opacity:"0"}],slideOutDown:[{transform:"translate3d(0,0,0)",visibility:"visible",opacity:"1",easing:"ease-out"},{transform:"translate3d(0,-100%,0)",visibility:"hidden",opacity:"0",easing:"ease-out"}],slideInUp:[{transform:"translate3d(0,100%,0)",visibility:"hidden",opacity:"0"},{transform:"translate3d(0,0,0)",visibility:"visible",opacity:"1"}],slideInRight:[{transform:"translate3d(100%,0,0)",visibility:"hidden",opacity:"0"},{transform:"translate3d(0,0,0)",visibility:"visible",opacity:"1"}],slideInLeft:[{transform:"translate3d(-100%,0,0)",visibility:"hidden",opacity:"0",easing:"ease-out"},{transform:"translate3d(0,0,0)",visibility:"visible",opacity:"1"}],slideInDown:[{transform:"translate3d(0,-100%,0)",visibility:"hidden",opacity:"0"},{transform:"translate3d(0,0,0)",visibility:"visible",opacity:"1"}],disappear:[{opacity:"1"},{opacity:"0"}],appear:[{opacity:"0"},{opacity:"1"}],flipInX:[,{offset:0,backfaceVisibility:"visible"},{transform:"perspective(400px) rotate3d(1,0,0,90deg)",opacity:"0",offset:0},{transform:"perspective(400px) rotate3d(1,0,0,-20deg)",offset:.4,easing:"ease-in"},{offset:.6,opacity:"1",transform:"perspective(400px) rotate3d(1,0,0,10deg)"},{transform:"perspective(400px) rotate3d(1,0,0,-5deg)",offset:.8},{offset:1,backfaceVisibility:"visible",transform:"perspective(400px) rotate3d(1,0,0,0)"}]}[e.trim()]||[]}}});var K=q((mi,Te)=>{var ot=U();Te.exports=function(){function e(c){return c?c.constructor.name.toLowerCase():null}function i(c,p){for(let y in c)c.hasOwnProperty(y)&&p(c[y],y)}function r(c,p,y){c=Object.assign(c,{[y]:p})}function t(c){return c===null}function n(c){return c===void 0}function s(c){return e(c)=="array"}function a(c){return e(c)=="object"}var u=function(c,p){for(var y=null,b=0;b<c.length;b++){var v=c[b];if(e(p)=="object"){var w=p,S=Object.keys(p)[0],O=w[S];if(e(v)=="object"){var _=v[S]==O;if(_){y=b;break}}}else if(e(p)!="array"){var _=p==v;if(_){y=b;break}}}return y},h=function(c,p){var y=null,b=e(p);if(b=="object"){var v=Object.keys(p)[0];c[y]!=null&&c[y]==p[v]&&(y=v)}else b=="string"&&(y=p);return y},f=function(c,p){var y=null;return e(c)=="array"?y=u(c,p):e(c)=="object"&&(y=h(c,p)),y},d=class{constructor(c,p,y){this.type=c,this.name=`${ot.instanceID()}-${p}`,this.child=y,this.cache={},e(this.child)=="string"&&(this.child=y=="array"?[]:y=="object"?{}:!1)}init(c){return this[this.type]?(this[this.type](c),!0):!1}open(){if(this.type=="session"){var c=JSON.parse(sessionStorage[this.name]);return c[this.name]}else if(this.type=="local"){var c=JSON.parse(localStorage[this.name]);return c[this.name]}else return this.cache[this.name]}close(c){return this.child=c,this.recache(),this.init(!0)}recache(){this.cache[this.name]=this.child}create(){this.cache[this.name]=this.child}array(){this.create()}object(c){this.create()}session(c){c||this.recache();try{!sessionStorage[this.name]&&!c?sessionStorage.setItem(this.name,JSON.stringify(this.cache)):c&&sessionStorage.setItem(this.name,JSON.stringify(this.cache))}catch{this.recache()}}local(c){c||this.recache();try{!localStorage[this.name]&&!c?localStorage.setItem(this.name,JSON.stringify(this.cache)):c&&localStorage.setItem(this.name,JSON.stringify(this.cache))}catch{this.recache()}}},g={create:function(c,p){if(s(c)){let y=new Set(c);e(p)=="array"?p.forEach(b=>{y.add(b)}):y.add(p),c=Array.from(y)}else a(c)&&(a(p)?i(p,function(y,b){c[b]=y}):c[p]=p);return c},createOrUpdate:function(c,p){var y=f(c,p);return e(c)=="array"?t(y)?c.includes(p):c[y]=p:e(c)=="object"&&(t(y)?a(p)?i(p,function(b,v){r(c,b,v)}):c[p]=p:c[y]=p),c},remove:function(c,p){if(e(p)=="string"){var y=f(c,p);if(e(c)=="object")delete c[y];else if(e(c)=="array"){for(var b=[],v=0;v<c.length;v++)if(v!=y)b.push(c[v]);else continue;c=b}return c}else{if(e(p)=="object")return Object.filter(c,function(w,S){var O=p[S]!=null&&p[S]==w;return!O});if(e(p)=="array")return Object.filter(c,function(w,S){var O=p.contains(S);return!O})}if(t(y))return!1},get:function(c,p){var y=e(p);if(y=="string"){var b=f(c,p);if(b==0||b)return c[b]}else{if(y=="object")return Object.filter(c,function(v,w){var S=!n(p[w])&&p[w]==v;return S});if(y=="array")return Object.filter(c,function(v,w){var S=p.contains(w);return S})}return null},getNot:function(c,p){var y=e(p);return y=="string"?Object.filter(c,function(b,v){var w=v!=p;return w}):y=="object"?Object.filter(c,function(b,v){return Object.some(p,function(w,S){var O=S==v&&w==b;return!O})}):y=="array"?Object.filter(c,function(b,v){var w=!p.contains(v);return w}):null},getAll:function(c){return c}},m=class{constructor(c){this.name=c.name,this.storageType=c.storage,this.child=c.child||"object";try{e(this.child)=="string"&&(this.child=this.child=="array"?[]:this.child=="object"?{}:null)}catch{this.storageType=="session"?sessionStorage.clear():this.storageType=="local"&&localStorage.clear(),e(this.child)=="string"&&(this.child=this.child=="array"?[]:this.child=="object"?{}:null)}if(!["array","object"].includes(e(this.child)))throw new Error("the child must be an object or array type.");this.storage=new d(this.storageType,this.name,this.child),this.storage.init()}has(c){var p=this.storage.open(),y=f(p,c);return t(y)?!1:y}get(c,p){if(p){var y=this.storage.open();return g.get(y,c)}else return new Promise((b,v)=>{setTimeout(()=>{var w=this.storage.open();b(w)})}).then(b=>g.get(b,c))}getNot(c){var p=this.storage.open();return g.getNot(p,c)}getAll(){var c=this.storage.open();return Promise.resolve(c)}update(c,p){var y=this.storage.open(),b=f(y,c);return b==0||b?(y=g.createOrUpdate(y,data),this.storage.close(y)):!1}createOrUpdate(c){if(arguments.length>1){let b=arguments[0],v=arguments[1];c={[b]:v}}var p=this.storage.open();return p=g.createOrUpdate(p,c),this.storage.close(p)}create(c){var p=this.storage.open();return p=g.create(p,c),this.storage.close(p)}remove(c){var p=this.storage.open();return p=g.remove(p,c),this.storage.close(p)}};return m}});var oe=q((yi,Ee)=>{var at=K()();Ee.exports=class{constructor(){this.storage=new at({child:"array",storage:"session",name:"_cake_persistent"})}listen(e){let i="DOMContentLoaded";"deviceready"in document&&(i="deviceready"),window.addEventListener(i,r=>{setTimeout(()=>{this.storage.getAll().then(t=>{if(!!(t&&!t.length))for(let n=0;n<t.length;n++){let s=t[n],a=e[s];a.isConnected=!1,a?!a.isConnected&&a.render.bind(a)():console.error(`component ${a} is not found!`)}})})})}append(e){this.storage.create(e)}remove(e){this.storage.remove(e)}}});var ae=q((bi,Ce)=>{Ce.exports=class{constructor(e){this.Components=e}listen(){window.addEventListener("hashchange",e=>{let i=this.compare(e);this.find(i,this.notify)})}compare(e){let{oldURL:i,newURL:r}=e,t=null;if(i.length>r.length){let n=new URL(i).hash.substring(1).split("/"),s=new URL(r).hash.substring(1).split("/");for(let a=0;a<n.length;a++)if(!s.includes(n[a])){t=n[a];break}}return t}find(e,i){if(!!e)if(this.Components[e])this.Components[e].isConnected&&i(this.Components[e]);else{let r=setInterval(()=>{this.Components[e]&&(this.Components[e].isConnected&&i(this.Components[e]),clearTimeout(r))},50);setTimeout(()=>{clearTimeout(r)},5e3)}}notify(e){e.fire.destroy()}add(e){let i=location.hash;i.includes(e)||(location.hash=i+"/"+e)}remove(e){let r=location.hash.replace(e,"");location.replace(r)}}});var ce=q((vi,qe)=>{qe.exports=function(e){class i{constructor(n){this.type=n,this.storage={}}store(n,s){this.storage[n]=s}get options(){if(this.type=="select"||this.type=="virtual"){let n={};for(let s in this.storage){let a=this.storage[s];n[s]=a.options}return n}return!1}get value(){if(this.type=="input"){let n="";for(let s in this.storage)n=this.storage[s].options[0];return n}return!1}get query(){let n={};for(let s in this.storage)n=this.storage[s].query[0]||null;return n}get has(){let n="";for(let s in this.storage)n=this.storage[s].query[0]||null;return n}}let r={};return r.options=t=>{let{options:n,params:s}=t;n||(n=[]);let a=n.length>1;return Promise.all(n.map(h=>{let{control:f,field:d,tbl:g,src:m,schema:c,type:p}=h;return e.fire(m,{tbl:g,field:d,params:s}).then(y=>{if(y=y||[],h.query=y,y=y.map(b=>c(b)),p!="input"){let b=c({});for(let v in b)b.hasOwnProperty(v)&&(b[v]="");y.unshift(b)}return h.options=y,h}).then(y=>{let{type:b,control:v}=y;b||(b="others");let w=new i(b);if(a){let S={};return S[v]||(S[v]=w,S[v].store(v,y)),S}else return w.store(v,y),w})})).then(h=>a?h.reduce((f,d)=>(Object.assign(f,d),f),{}):h[0]).catch(h=>{console.error(h)})},r.plot=t=>{let{data:n,container:s}=t;if(!n&&!s)return;let a=(u,h,f)=>{if(!u){console.info("root is not provided!");return}let d=u.querySelectorAll(`${h}`),g=d.length;if(!g){f(null,n);return}for(let m=0;m<g;m++){let c=d[m],p=c.name,y=n[p],b=f(c,y,m);if(b=="break")break;b!="continue"}};return a(s,"INPUT.input",function(u,h){h!=null&&(u.type=="date"&&(h=new Date(h)=="Invalid Date"?"":new Date(h).toJSON().split("T")[0]),u.value=h)}),setTimeout(()=>{a(s,"SELECT.input:not(.cake-template)",function(u,h){a(u,"OPTION:not(.cake-template)",function(f,d,g){if(f){if(f.value==h)return u.selectedIndex=g,"break"}else console.log(f,d,"provide schema")})})},500),Promise.resolve()},r}});var he=q((wi,Ae)=>{var ct=K()();Ae.exports=function(e){let i={};class r{constructor(n){this.name=n,this.reactiveData={},this.notify=[],this.install(this.name),this.pKeys={},this.sanitize=function(s){let a={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"},u=/[&<>"'/]/ig;return typeof s=="string"?s.replace(u,h=>a[h]||""):s}}registerNotifier(n){this.notify.push(n)}install(){this.session=new ct({child:"object",storage:"session",name:`_cake_${this.name}_cf`})}notifier(n,s){let{value:a,bind:u}=s;return this.reactiveData[n]||(this.reactiveData[n]={}),this.reactiveData[n][u]=a,this.set(u,a)}getInputData(n="json",s){let a=s||this.name,u=JSON.parse(JSON.stringify(this.reactiveData[a]));for(let h in u){let f=u[h];u[h]=this.sanitize(f)}if(n=="json")return u;if(n=="formdata"){let h=new FormData;for(let f in u){let d=u[f];h.append(f,d)}return h}}hook(n,s,a){i[n]||(i[n]={}),i[n][s]||(i[n][s]=[]),i[n][s].push(a)}get(n,s=!1){let a=this.pKeys[n];return s?this.session.get(n,!0):this.session.get(n)}set(n,s){let a=`${this.name}-${n}`,u=this.notify,h=this.name,f=null;return this.pKeys[n]=a,new Promise(async(d,g)=>{n!="password"&&this.session.createOrUpdate(n,s),d()}).then(async()=>{let d=i[this.name];if(d){let g=d[n];g&&g.forEach(m=>{m(s)})}return Promise.all(u.map(g=>g(n,s,f,h).then(()=>{console.log("finish notified in scope")})))})}}return r}});var ue=q((Si,Le)=>{var ee=U(),ht=K()(),te=new ht({child:"object",storage:"local",name:"_cake_router_cf"});Le.exports=function(e,i){let r=[];return class{constructor(t,n){this.unauthRoute=n&&n["401"]||null,this.authRoute={},this.route=this.compile(t),this.prev=null,this.components=e,this.watch(),this.persist(),Object.defineProperty(i.prototype,"$router",{configurable:!0,get:()=>({goTo:this.goTo.bind(this),goBack:this.goBack.bind(this),auth:this.auth.bind(this),logout:this.logout.bind(this),...this.prev}),set(s){}})}authenticate(t){if(this.unauthRoute)try{let n=te.get("role",!0);if(n){if(t){let{role:s,data:a}=n,u=this.authRoute[s];if(u){let{name:h}=u;this.goTo(h)}}}else t||this.logout()}catch{t||this.logout()}}auth(t){if(t){let{role:n,token:s,data:a}=t;te.createOrUpdate("role",{role:n,token:s,data:a})}else{let n=te.get("role",!0);if(n){let s={};return n&&(s=n),s.data&&(s=s.data),s.user&&(s=s.user),s.token=n.token,s}else return"token"}}logout(){try{te.remove("role")}catch{}this.goTo(this.unauthRoute,{replace:!0})}goTo(t,n){try{let a=this.route,{params:u={},replace:h}=n||{},f=null,d=Object.entries(a);for(let m=0;m<d.length;m++){let[c,p]=d[m],{name:y}=p;if(y==t){f=c;break}}if(!f)throw new Error(`${t} is not found in routes`);if(f=="/"){h?location.replace(`${location.origin}${location.pathname}`):window.location=`${location.origin}${location.pathname}`;return}let g;if(f=f.slice(1),u.toString().includes("Object")){let m="";for(let c in u)m+=`${c}=${u[c]}&`;u=m,g=`!/${f}?${u}`}else g=`!/${f}`;if(f=="/"&&(g=""),h){let m=`${location.origin}${location.pathname}#${g}`;ee.isChrome()&&!ee.isFirefox()&&history.replaceState(void 0,void 0,m),location.replace(m)}else{var s=document.createElement("a");s.href=`#${g}`,ee.isChrome()&&!ee.isFirefox()&&history.pushState(void 0,void 0,s.href),s.click()}}catch(a){console.log(a)}}goBack(){return new Promise((t,n)=>{window.history.back(),t()})}persist(){if(!document.hasRouterPersist){let t="DOMContentLoaded";"deviceready"in document&&(t="deviceready"),document.addEventListener(t,n=>{this.parse(),this.notify().then(()=>this.navigate(!0))}),document.hasRouterPersist=!0}}watch(){window.hasRouterPop?this.parse():(window.addEventListener("popstate",t=>{this.parse(),this.notify().then(()=>this.clear().then(()=>this.navigate().then(()=>{})))}),window.hasRouterPop=!0)}compile(t){let n={};for(let s in t){let a=t[s];s=String(s);let u=s.length,h=s;if(["404"].includes(s)){let d=t[s];t[s]={callback:d,name:s}}else h=h.slice(1);h=h.split("/"),h=h.map((d,g)=>{let m=d.includes(":"),c="";if(g==0?c+="^/":c+="/",m?c+="(([^/#?]+?))":c+=d,g==u-1?c+="/?$":c+="",m){let p=d.replace(":","");n[s]||(n[s]={}),n[s].params={[p]:g}}return c}),n[s]&&n[s].params?n[s]={params:n[s].params,regex:new RegExp(h.join("")),...a}:n[s]={regex:new RegExp(h.join("")),...a};let{auth:f}=a;if(f){if(this.authRoute[f])throw new Error(`auth ${f} is found in other route`);this.authRoute[f]=a}}return n.length=Object.keys(t).length,n.keys=Object.keys(t),n}parse(){let t=window.location.hash,n,s;if(t?(n=t.includes("#!/")?2:t.includes("#/")?1:null,t=t.slice(n)):(t="/",n=!0),!n)return;let a=new URL(`http://localhost${t}`),{search:u,pathname:h}=a,f=this.route.keys,d={};u&&new URLSearchParams(u).forEach((m,c)=>{d[c]=m});let g=!1;for(let m=0;m<f.length;m++){let c=this.route[f[m]],{regex:p,components:y,params:b,name:v,overlay:w,display:S}=c;if(b){let _=String(h);_=_.slice(1),_=_.split("/"),Object.entries(b).forEach(P=>{let[$,L]=P;_[L]&&(d[$]=_[L])})}if(p.test(h)){s=v,this.unauthRoute!=v?this.authenticate():this.authenticate(!0),this.prev={components:y,state:d,path:h,name:v,prev:this.prev,overlay:w,display:S},g=!0;break}}if(!g&&this.route["404"]){let m=this.route["404"].callback(),{origin:c,pathname:p}=location;this.route[m]?(m=="/"?m=`${c}${p}`:p.slice(-1)=="/"?m=`${c}${p}#!${m}`:m=`${c}${p}/#!${m}`,location.replace(m)):!!m&&!this.route[m]&&(c.slice(-1)=="/"&&m[0]=="/"&&(m=m.slice(1)),m=`${c}${m}`,location.replace(m))}}navigate(t){if(this.prev){let{components:n,state:s,path:a,name:u,overlay:h}=this.prev;try{if(n.length)return new Promise((f,d)=>{let g=n.length,m=0;if(g){let c=()=>{let p=n[m];n.length>m?(p=this.components[p],p.render({emit:{route:this.prev}}).then(()=>{p.await.isConnected?p.await.isConnected&&p.await.isConnected.then(()=>{c()}):c()}).catch(y=>{throw y}),m+=1):f()};c()}else f()})}catch(f){throw console.log(f),new Error(`some of the component in ${JSON.stringify(n)} in path ${a} of router is not found, make sure the it is created`)}}}static pushState(t,n,s){window.history.pushState(t,n,s);let a=Promise.resolve();if(this.prev){let{components:u,state:h,path:f,name:d}=this.prev;a=new Promise((g,m)=>{let c=e.length,p=0;if(c){let y=()=>{let b=e[p];e.length>p?(b=this.components[b],b.fire.destroy(),b.await.destroy.then(()=>{y()})):g(),p+=1};y()}else g()})}return a.then(()=>this.navigate())}clear(){let t=Promise.resolve(),{overlay:n}=this.prev||{};if(n)return t;if(this.prev&&this.prev.prev){let{components:s,state:a,path:u,name:h}=this.prev.prev;return t=new Promise((f,d)=>{let g=s.length,m=0;if(g){let c=()=>{let p=s[m];s.length>m?(p=this.components[p],p.fire.destroy(),p.await.destroy.then(()=>{c()})):f(),m+=1};c()}else f()}),t}return t}pushState(t,n,s){window.history.pushState(t,n,s);let a=Promise.resolve();return this.clear(),a.then(()=>this.navigate())}static subscribe(t){t&&t.constructor.name=="Function"&&r.push(t)}notify(){return Promise.all(r.map(t=>t()))}}}});var M=q(ie=>{ie.getConfig=function(e,i,r,t,n,s){return t==null?[]:t==n&&i!="bind"?[]:(()=>{let a=[],u=e[s]&&e[s][i]||[];if(u&&u.length)for(let h=0;h<u.length;h++){let f=u[h];f.bind==r&&a.push({...f,component:s})}return a})()};ie.updateConfig=function(h,i,r,t,n,s,a,u){if(t!=null&&!(t==n&&i!="bind")){var h=(()=>{let f=h[s]&&h[s][i];if(f&&f.length){let d=[];for(let g=0;g<f.length;g++){let m=f[g];m.bind==r&&(u?m.sel==u:!0)&&Object.assign(m,a)}return d}else return[]})();return h}};ie.extendConfig=function(e){let i=[];for(let r=0;r<e.length;r++){let t={},n=e[r];for(let s in n)t[s]=n[s];i.push(t)}return i.reduce((r,t)=>{let{incrementedSels:n}=t;return n&&n.length?n.forEach(s=>{let a={...t};a.incrementedSel=s,r.push(a)}):r.push(t),r},[])}});var je=q((_i,Ie)=>{var G=U(),{getConfig:ut,updateConfig:Oi,extendConfig:ft}=M();Ie.exports=function(e){return async function(i,r,t,n,s){s=s||document;let a=ut(e,"attr",i,r,t,n);if(!!a.length)return a=ft(a),Promise.all(a.map(u=>{let h,{hasNegate:f,bind:d,testVal:g,attr:m,ops:c,sel:p,attrkey:y,attrvalue:b,incrementedSel:v,incrementId:w}=u;if(d=G.removeWhiteSpace(d),m=G.removeWhiteSpace(m),v=r.incrementedSel||v,r.incrementedSel?h=r[d]:h=r,i==d){let S=s.querySelectorAll(`[data-attr=${v||p}]:not(.cake-template)`);return Promise.all([...S].map(O=>{let _=!1;return c?(_=G.logTest(h,c,g),f&&(_=!_)):f?_=!h:_=!!h,_?new Promise((P,$)=>{G.timeOut(()=>{b?O.setAttribute(y,!0):O.setAttribute(y),P()},100)}):new Promise((P,$)=>{O.hasAttribute(y)?G.timeOut(()=>{O.removeAttribute(y),P()},100):P()})}))}}))}}});var xe=q(($i,Ne)=>{var fe=U(),{getConfig:pt,updateConfig:Pi,extendConfig:dt}=M();Ne.exports=function(e){return async function(i,r,t,n,s){s=s||document;let a=pt(e,"bind",i,r,t,n);if(!!a.length){a=dt(a);for(let u=0;u<a.length;u++){let h=a[u],f,{attr:d,bind:g,sel:m,incrementedSel:c,incrementId:p,incrementedSels:y}=h;c=r.incrementedSel||c,r.incrementedSel?f=r[g]:f=r;let b=d.toHyphen();if(i==g){let v=s.querySelectorAll(`[data-bind=${c||m}]`);for(let w=0;w<v.length;w++){let S=v[w];d=="class"||d=="className"?S.classList.length?(fe.splitBySpace(t,function(O){S.classList.remove(O)}),fe.splitBySpace(f,function(O){S.classList.add(O)})):fe.splitBySpace(f,function(O){S.classList.add(O)}):(f!=null||f!=null)&&(S.setAttribute(b,f),S[d]=f)}}}}}}});var Ue=q((Ei,Re)=>{var z=U(),{getConfig:gt,updateConfig:Ti,extendConfig:mt}=M();Re.exports=function(e){return async function(i,r,t,n,s){s=s||document;let a=gt(e,"class",i,r,t,n);if(!a.length)return;let u={};a=mt(a);for(let h=0;h<a.length;h++){let f=a[h],d,{hasNegate:g,bind:m,testVal:c,className:p,ops:y,sel:b,incrementedSel:v,incrementId:w}=f;if(m=z.removeWhiteSpace(m),v=r.incrementedSel||v,r.incrementedSel?d=r[m]:d=r,i==m){u[v||b]||(u[v||b]=s.querySelectorAll(`[data-class=${v||b}]:not(.cake-template)`));let S=u[v||b];for(let O=0;O<S.length;O++){let _=S[O],P=!1;y?(P=z.logTest(d,y,c),g&&(P=!P)):g?P=d==c:P=!!d,P?z.splitBySpace(p,function($){z.toArray(_.classList).includes($)||setTimeout(()=>{_.classList.add($)})}):z.splitBySpace(p,function($){z.toArray(_.classList).includes($)&&setTimeout(()=>{_.classList.remove($)})})}}}}}});var Me=q((Ci,He)=>{var yt=D();He.exports=function(e){return async function(i){let{vItems:r,configs:t,newValue:n}=i,s=[];for(let a=0;a<t.length;a++){let u=t[a],h=u.children;if(!!h)for(let f=0;f<h.length;f++){let d=h[f];if(!e[u.component])continue;let g=e[u.component].for.find(m=>m.sel==d);g&&s.push(new Promise(m=>{let{bind:c,sel:p,iter:y,ins:b}=g;setTimeout(()=>{let v=document.querySelectorAll(`[data-for=${p}-active]`);for(let w=0;w<v.length;w++){let S=v[w],O=S.dataset.forAutoBindKey,_=S.dataset.forAutoBindValue,P=n.find(T=>T[O]==_),$=c.split(".")[c.split(".").length-1],L=P[$].length&&P[$].map(T=>T instanceof Object?T:{[y]:T});if(L)for(let T=0;T<L.length;T++){let x=L[T],R=S.cloneNode(!0),j=new yt(x,R,!1).createElement();j.style.removeProperty("display"),j.classList.remove("cake-template"),j.removeAttribute("data-for-template"),S.insertAdjacentElement("beforebegin",j)}S.parentElement.tagName=="SELECT"&&(S.parentElement.selectedIndex=0)}m()})}))}}return Promise.all(s)}}});var Fe=q((Li,Be)=>{var qi=U(),bt=Z(),vt=D(),{getConfig:wt,updateConfig:St,extendConfig:Ai}=M();Be.exports=function({st:e,logicalType:i}){return async function(r,t,n,s,a){a=a||document;let u=wt(e,"forUpdate",r,t,n,s);if(!u.length)return;let h=[];for(let f=0;f<u.length;f++){let{bind:d,sel:g,iter:m,ins:c,targets:p}=u[f];for(let y in t)if(t.hasOwnProperty(y)){let b=document.querySelectorAll(`[data-for-update-bind=${y}]`);for(let v=0;v<b.length;v++){let w=b[v],S=w.dataset.forUpdateBind;if(!w.dataset.forTemplate)w.remove();else{let O=w.cloneNode(!0);O.style.removeProperty("display"),O.classList.remove("cake-template");let _=t[S],P=-1;for(l=_.length;++P<l;){let $=_[P],L=P;for(let x=0;x<i.length;x++){let R=i[x],j=new bt(w).querySelectorAllIncluded(`[data-${R}]`);for(let N=0;N<j.length;N++){let H=j[N];if(H.dataset[R]){let F=H.dataset[R],Y=`${F}-${L}`;O.dataset[R]=Y;let{bind:re}=this.getWatchItemsBySel(s,R,F);if(re.includes(".")){S=re.split(".")[0];for(let me in $){let st=$[me],lt=`${S}.${me}`;$[lt]=st}}F&&h.push({_type:R,...$,incrementedSel:Y,sel:F,bind:re,incrementId:L,component:s})}}}let T=new vt($,O,!1).createElement();T.classList.remove("cake-template"),T.removeAttribute("data-for-template"),w.insertAdjacentElement("beforebegin",T),w.parentElement.tagName=="SELECT"&&(w.parentElement.selectedIndex=0)}}}}}return Promise.all(h.map(f=>{let{bind:d,_type:g,component:m,incrementedSel:c,sel:p}=f,y=`notify${g.toProper()}`;return St(g,d,f,null,m,{incrementedSel:c},p),this[y](d,f,null,m)})).then(()=>{})}}});var We=q((xi,De)=>{var Ii=U(),kt=D(),{getConfig:Ot,updateConfig:ji,extendConfig:Ni}=M();De.exports=function(e){return async function(i,r,t,n,s){return new Promise((a,u)=>{try{let h=Ot(e,"for",i,r,t,n);if(!h.length)return;let f=[];for(let d=0;d<h.length;d++){let{bind:g,sel:m,iter:c,ins:p,component:y,cleaned:b}=h[d];s=Cake.Components[y].html;let v=s.querySelectorIncluded(`[data-for-template=${m}]`),w=v.cloneNode(!0);console.log(35,w.innerHTML),(()=>{let S=w&&w.querySelectorAll("[data-switch]");if(S&&S.length){let O=S.length,_=-1;for(;++_<O;){let P=S[_],$=P.parentElement,L=document.createElement("div");L.dataset.switchSlot=P.dataset.switch,$.replaceChild(L,P)}S=null}})(),(()=>{let S=w,O=-1;l=r.length,r=r.map(_=>{for(let P in _)_.hasOwnProperty(P)&&(_[`${c}.${P}`]=_[P]);return _}),r.forEach((_,P)=>{let $=new kt(_,S,!1).createElement();$.style.removeProperty("display"),$.classList.remove("cake-template"),$.removeAttribute("data-for-template"),v.insertAdjacentElement("beforebegin",$);let L=$.querySelectorAll("[data-src]");if(L)for(let T=0;T<L.length;T++){let x=L[T];x.src=x.dataset.src,x.removeAttribute("data-src")}}),b&&v.remove()})()}return console.log("actual for is finished"),this.notifyForAuto({configs:h,newValue:r}).then(()=>{console.log("for and forauto is finished"),a()}).catch(d=>{u(d)})}catch(h){u(h)}})}}});var Ke=q((Ui,Je)=>{var _t=U(),{getConfig:Pt,updateConfig:Ri,extendConfig:$t}=M();Je.exports=function(e){return async function(i,r,t,n,s){s=s||document;let a=Pt(e,"if",i,r,t,n);if(!a.length)return;a=$t(a);let u={};for(let h=0;h<a.length;h++){let f=a[h],{attr:d,bind:g,sel:m,testval:c,_true:p,_false:y,ops:b,hasNegate:v,incrementedSel:w,incrementId:S}=f,O=d.toHyphen(),_=p!="null",P=y!="null";if(i==g){u[m]||(u[m]=s.querySelectorAll(`[data-if=${w||m}]:not(.cake-template)`));let $=u[m];for(let L=0;L<$.length;L++){let T=$[L],x=r,R;if(c?R=_t.logTest(c,b,x):R=v?!x:!!x,R){if(_)if(d=="class"){let j=p.split(" ");P?(y.split(" ").forEach(H=>{T.classList.remove(H)}),j.forEach(H=>{T.classList.add(H)})):j.forEach(N=>{T.classList.contains(N)||T.classList.add(N)})}else x[p]&&T.setAttribute(d,x[p])}else if(P)if(d=="class"){let j=y.split(" ");_?(p.split(" ").forEach(H=>{T.classList.remove(H)}),j.forEach(H=>{T.classList.add(H)})):trueClasses.forEach(N=>{T.classList.contains(N)||T.classList.add(N)})}else T.setAttribute(d,y)}}}}}});var Xe=q((Fi,ze)=>{var Hi=U(),{getConfig:Tt,updateConfig:Mi,extendConfig:Bi}=M();ze.exports=function(e){return async function(i,r,t,n,s){s=s||document;let a=Tt(e,"input",i,r,t,n);if(!!a.length)for(let u=0;u<a.length;u++){let h=a[u],{attr:f,bind:d,sel:g}=h,m=f.toHyphen();if(i==d){let c=s.querySelectorAll(`[data-input=${g}]`);for(let p=0;p<c.length;p++){let y=c[p];f=="className"?t?r?y.classList.replace(t,r):y.classList.remove(t):y.classList.add(r):(y.setAttribute(m,r),y[f]=r)}}}}}});var Qe=q((Ji,Ye)=>{var Di=U(),Et=D(),{getConfig:Ct,updateConfig:Ge,extendConfig:Wi}=M();Ye.exports=function({st:e,logicalType:i}){return async function(r,t,n,s,a){a=a||document;let u=Ct(e,"switch",r,t,n,s);if(!u.length)return;let h=[];for(let f=0;f<u.length;f++){let d=u[f],{bind:g,sel:m,map:c,cases:p}=d,y=a.querySelectorAll(`[data-switch-slot=${m}]`);for(let b=0;b<t.length;b++){let v=b,w=t[b],S=y[b],O=S.dataset.index,_=w[c];if(_!=null){let P=null;for(let $=0;$<p.length;$++)if(p[$].bind.split("|").includes(_)){P=p[$];break}if(P){let{_id:$,bind:L}=P,T=document.querySelector(`[data-case=${m}-${$}]`);if(T&&T.toString().includes("Element")){T=T.cloneNode(!0);let x=T.querySelectorAll("[data-for-auto=true]");for(let j=0;j<x.length;j++){let N=x[j];N.dataset.for=`${N.dataset.for}-active`}T.removeAttribute("data-case");let R=new Et(w,T,!1).createElement();for(let j=0;j<i.length;j++){let N=i[j];if(T.dataset[N]){let H=T.dataset[N],F=`${H}-${v}`;R.dataset[N]=F;let{bind:Y}=this.getWatchItemsBySel(s,N,H);H&&h.push({_type:N,...w,incrementedSel:F,sel:H,component:s,bind:Y,incrementId:v})}}R.classList.remove("cake-template"),S.replaceWith(R)}}}}}return Promise.all(h.map(f=>{let{bind:d,_type:g,component:m,incrementedSel:c,sel:p}=f,y=`notify${g.toProper()}`;return Ge(e,g,d,f,null,m,{incrementedSel:c},p),this[y](d,f)})).then(()=>{let f=h.reduce((d,g)=>{let{sel:m,incrementedSel:c,bind:p}=g;return d[m]||(d[m]={data:g,incrementedSels:[]}),d[m].incrementedSels.push(c),d},{});for(let d in f)if(f.hasOwnProperty(d)){let g=f[d],{data:m,incrementedSels:c}=g,{_type:p,bind:y,component:b,sel:v}=m;Ge(e,p,y,m,null,b,{incrementedSels:c},v)}})}}});var Ve=q((Xi,Ze)=>{var Ki=U(),{getConfig:qt,updateConfig:zi,extendConfig:At}=M();Ze.exports=function(e){return async function(i,r,t,n,s){s=s||document;let a=qt(e,"toggle",i,r,t);if(!!a){a=At(a),s=s||document;for(let u=0;u<a.length;u++){let h=a[u];if(!h)continue;let{sel:f,bind:d,value:g,ops:m}=h,c=s.querySelector(`[data-toggle=${f}]`);g==t&&c&&c.classList.remove("is-active"),g==r&&c&&(c.classList.contains("is-active")&&c.classList.remove("is-active"),c&&c.classList.add("is-active"))}}}}});var pe=q((Gi,tt)=>{var Lt=U(),It=je(),jt=xe(),Nt=Ue(),xt=Me(),Rt=Fe(),Ut=We(),Ht=Ke(),Mt=Xe(),Bt=Qe(),Ft=Ve(),A={},et=["if","bind","switch","toggle","class","attr"];function C(){this.uiid=0,this.notify={}}C.prototype.notifyFor=Ut(A);C.prototype.notifySwitch=Bt({st:A,logicalType:et});C.prototype.notifyForAuto=xt(A);C.prototype.notifyForUpdate=Rt({st:A,logicalType:et});C.prototype.notifyClass=Nt(A);C.prototype.notifyBind=jt(A);C.prototype.notifyAttr=It(A);C.prototype.notifyIf=Ht(A);C.prototype.notifyInput=Mt(A);C.prototype.notifyToggle=Ft(A);C.prototype.notifier=function(e,i,r,t){let n=i;Lt.isObject(n)&&(n=JSON.parse(JSON.stringify(i)));let s={for:"For",forUpdate:"ForUpdate",switch:"Switch",toggle:"Toggle",bind:"Bind",input:"Input",if:"If",class:"Class",attr:"Attr"},a=Object.caching("AttribProp").get(e)||(()=>{let u={},h=Object.keys(s),f=A[t];if(!f)return[];for(let d=0;d<h.length;d++){let g=h[d],m=f[g];if(m)for(let c=0;c<m.length;c++){let p=m[c],{bind:y}=p;y==e&&(u[g]=!0)}}return u=Object.keys(u),Object.caching("AttribProp").set(e,u),u})();return new Promise((u,h)=>{try{let f=a.length,d=0,g=()=>{if(f>d){let m=a[d],c=s[m];d+=1,c=="For"?(this[`notify${c}`](e,n,r,t),g()):this[`notify${c}`](e,n,r,t).then(()=>{g()})}else u()};g()}catch(f){h(f.message)}})};C.prototype.registerNotifier=function(e,i){this.notify[e]||(this.notify[e]=[]),this.notify[e].push(i)};C.prototype.getEventTarget=function(e){let i=`${e}`,r=Object.caching("getEventTarget").get(i);if(!r){let t=A[e];r=t&&t.evt?t.evt:[],Object.caching("getEventTarget").set(i,r)}return r};C.prototype.getRouterTarget=function(e){let i=`${e}`,r=Object.caching("getRouterTarget").get(i);if(!r){let t=A[e];r=t&&t.router?t.router:[],Object.caching("getRouterTarget").set(i,r)}return r};C.prototype.getWatchItems=function(e){let i=`${e}`,r=Object.caching("getWatchItems").get(i);if(!r){let t=A[e]||{},n=new Set;for(let s in t)if(t.hasOwnProperty(s)){let a=t[s];for(let u=0;u<a.length;u++){let h=a[u],{bind:f}=h;if(f)n.add(f);else continue}}r=[...n],Object.caching("getWatchItems").set(i,r)}return r};C.prototype.getWatchItemsByType=function(e,i){let r=`${e}-${i}`,t=Object.caching("getWatchItemsByType").get(r);if(!t){let s=(A[e]||{})[i]||[],a=new Set;for(let u=0;u<s.length;u++){let h=s[u],{bind:f}=h;switch(!!f){case!0:a.add(f);break;default:switch(!0){case(i=="animate"||i=="toggle"):(a.constructor.name="Set")&&(a=[]),a.push(h)}}}t=[...a],Object.caching("getWatchItemsByType").set(r,t)}return t};C.prototype.getWatchItemsBySel=function(e,i,r){let t=`${e}-${i}-${r}`,n=Object.caching("watchItemsBySel").get(t);if(!n){let a=A[e][i].find(u=>u.sel==r);n=a||!1,Object.caching("watchItemsBySel").set(t,n)}return n};C.prototype._activateReactive=e=>{};C.prototype._register=function(e,i,r,t){switch(!0){case!e[i]:e[i]={};case!e[i][r]:e[i][r]=[];default:e[i][r].push(t);break}};C.prototype._static=function(e){return function(i,r){let t=[];for(let n=0;n<i.length;n++){let s=i[n];switch(r){case!1:t.push(s);break;case!0:{let a=s.closest("[data-component]");switch(a=a&&a.dataset.component,a==e){case!0:t.push(s);break}}break;default:continue}}return t}};C.prototype._compileEvents=function(e,i,r){return new Promise(t=>{if(!e.length){t();return}let n=this._static(i)(e,r);if(!n.length){t();return}for(let s=0;s<n.length;s++){let a=`cke${this.uiid}`,u=n[s],h=u.dataset.event.split(" ").join("").split(",");for(let f=0;f<h.length;f++){let[d,g]=h[f].split(":");this._register(A,i,"evt",{event:d,sel:a,cb:g}),u.dataset.event=a,this.uiid++}}t()})};C.prototype._compileToggle=function(e,i,r){return new Promise(t=>{if(!e.length){t();return}if(!this._static(i)(e,r).length){t();return}let s={};for(let a=0;a<e.length;a++){let u=`ckt${this.uiid}`,h=e[a],f=h.dataset.toggle;s[f]&&(u=s[f]),this._register(A,i,"toggle",{sel:u,name:"ns-"+f}),h.dataset.toggle=u,this.uiid++,s[f]=u}s={},t()})};C.prototype._compileFor=function(e,i,r,t){return new Promise(n=>{let s=t;if(!e.length){n();return}let a=this._static(i)(e,r);if(!a.length){n();return}let u={};for(let h=0;h<a.length;h++){let f=`ckf${this.uiid}`,d=a[h],g=d.dataset.for,m=d.dataset.forAutoBind,c=d.dataset.forCleaned=="true",[p,y,b]=g.split(" ");if(m){let v=m.split(":"),w=v[0]&&v[0].trim(),S=v[1]&&v[1].trim();d.dataset.forAutoBindKey=w,d.dataset.forAutoBindValue=S,d.removeAttribute("data-for-auto-bind")}if(d.style.display="none",d.classList.add("cake-template"),d.dataset.for=f,d.dataset.forTemplate=f,u[f]={bind:b,sel:f,iter:p,ins:y,cleaned:c},++this.uiid,h!=0){let v=d.parentElement&&d.parentElement.closest("[data-for]");if(!v)continue;let w=!!v.dataset.for;if(s.contains(v)&&w){let S=v.dataset.for,O=u[S];O&&!O.children?O.children=[f]:O&&O.children.push(f)}}}for(let h in u)u.hasOwnProperty(h)&&this._register(A,i,"for",u[h]);n()})};C.prototype._compileForUpdate=function(e,i,r){return new Promise(t=>{if(!e.length){t();return}let n=this._static(i)(e,r);if(!n.length){t();return}for(let s=0;s<n.length;s++){let a=`ckfu${this.uiid}`,u=n[s],h=u.dataset.forUpdate;u.style.display="none",u.classList.add("cake-template"),u.dataset.forUpdate=a,u.dataset.for||(u.dataset.forTemplate=a);let[f,d,g]=h.split(" ");this._register(A,i,"forUpdate",{bind:g,sel:a,iter:f,ins:d}),this.uiid++}t()})};C.prototype._compileSwitch=function(e,i,r){return new Promise(t=>{if(!e.length){t();return}let n=this._static(i)(e,r);if(!n.length){t();return}for(let u=0;u<n.length;u++){let h=`cks${this.uiid}`,f=n[u],d=f.dataset.switch,g="def";if(d.includes(".")){var[s,...a]=f.dataset.switch.split(".");d=s,g=a[0]}f.dataset.switch=h;let m=f.querySelectorAll("[data-case]"),c=[];for(let p=0;p<m.length;p++){let y=m[p],b=y.closest(`[data-switch=${h}]`);if(y.classList.add("cake-template"),b){let v=y.dataset.case,w=`cksc${this.uiid}`;y.dataset.case=`${h}-${w}`,c.push({_id:w,bind:v}),this.uiid++}}this._register(A,i,"switch",{bind:d,sel:h,map:g,cases:c}),this.uiid++}t()})};C.prototype._compileBind=function(e,i,r){return new Promise(t=>{if(!e.length){t();return}let n=this._static(i)(e,r);if(!n.length){t();return}for(let u=0;u<n.length;u++){let h=`ckm${this.uiid}`,f=n[u],g=f.dataset.bind.split(",");for(let m=0;m<g.length;m++){let c=g[m].split(" ").join("");if(c.includes(":"))var[s,a]=c.split(":");else var a=c,s="value";this._register(A,i,"bind",{attr:s,bind:a,sel:h})}this.uiid++,f.dataset.bind=h}t()})};C.prototype._compileAnimate=function(e,i,r){return new Promise(t=>{if(!e.length){t();return}let n=this._static(i)(e,r);if(!n.length){t();return}for(let s=0;s<n.length;s++){let a=`cka${this.uiid}`,u=n[s],h=u.dataset.animate;h=h.split(" ").join("");let f={},d=h.split(",");for(let g=0;g<d.length;g++){let m=d[g],[c,p]=m.split(":");if(c=="ns"){f.ns=p;break}else f[c]={keyframes:p.split("-")}}f.selector={attr:"data-animate",val:a},this._register(A,i,"animate",f),this.uiid++,u.dataset.animate=a}t()})};C.prototype._compileIf=function(e,i,r){return new Promise(t=>{if(!e.length){t();return}let n=this._static(i)(e,r);if(!n.length){t();return}let s=new RegExp("<|>|===|==|!==|!=");for(let a=0;a<n.length;a++){let u=`ci${this.uiid}`,h=n[a],f=h.dataset.if,d=h.dataset.ifBind,g=f.split(",");for(let m=0;m<g.length;m++){let c=g[m],p=c.substring(0,c.indexOf("=")),y=c.substring(c.indexOf("=")+1,c.length);y=y.split(new RegExp("[()]")).join("");let[b,v]=y.split("?"),w=b[0]=="!";hasRegularLog=b.match(s);let S,O,_;if(hasRegularLog){let L=b.split(s);S=L[0].trim(),O=L[1].trim(),_=hasRegularLog[0]}else S=b;w&&(S=S.slice(1));let[P,$]=v.split(":");this._register(A,i,"if",{hasNegate:w,attr:p,ops:_,bind:S,testval:O||null,_true:P,_false:$,sel:u,ifBind:d})}this.uiid++,h.dataset.if=u}t()})};C.prototype._compileClass=function(e,i,r){return new Promise(t=>{if(!e.length){t();return}let n=this._static(i)(e,r);if(!n.length){t();return}let s=new RegExp("<|>|===|==|!==|!=");for(let a=0;a<n.length;a++){let u,h,f,d,g,m,c,p,y;u=`cc${this.uiid}`,h=n[a],f=h.dataset.class;let[b,v]=f.split("&&");if(b=b.trim(),v=v.trim(),d=b.match(s),b.substring(0,2).includes("!")?(g=!0,y=b.substring(0,2)=="!!"?2:b.substring(0,1)=="!"?1:0):(g=!1,y=0),d){let w=b.split(s);m=w[0].trim(),p=w[1].trim(),c=d[0].trim()}else!g&&(m=b),g&&(m=b.substring(y),p=y==2);this._register(A,i,"class",{hasNegate:g,bind:m,testVal:p,className:v,ops:c,sel:u}),this.uiid++,h.dataset.class=u}t()})};C.prototype._compileAttr=function(e,i,r){return new Promise(t=>{if(!e.length){t();return}let n=this._static(i)(e,r);if(!n.length){t();return}let s=new RegExp("<|>|===|==|!==|!=");for(let a=0;a<n.length;a++){let u,h,f,d,g,m,c,p;u=`cre${this.uiid}`,h=n[a],f=h.dataset.attr;let[y,b]=f.split("&&");b=b.trim();let[v,w]=b.split("=");if(y=y.trim(),d=y.match(s),g=y[0]=="!",d){let S=y.split(s);bind=S[0],p=S[1],c=d[0]}else bind=y;g&&g&&(bind=bind.slice(1)),this._register(A,i,"attr",{hasNegate:g,bind,testVal:p,attrkey:v,attrvalue:w,ops:c,sel:u}),this.uiid++,h.dataset.attr=u}t()})};C.prototype._compileRouter=function(e,i,r){return new Promise(t=>{if(!e.length){t();return}let n=this._static(i)(e,r);if(!n.length){t();return}for(let s=0;s<n.length;s++){let a=`rt${this.uiid}`,u=n[s],h=u.dataset.routerLink;this._register(A,i,"router",{value:h,sel:a}),this.uiid++,u.dataset.routerLink=a}t()})};C.prototype._compileInput=function(e,i,r){return new Promise(t=>{if(!e.length){t();return}let n=this._static(i)(e,r);if(!n.length){t();return}for(let u=0;u<n.length;u++){let h=`cknt${this.uiid}`,f=n[u],d=f.tagName,m=f.dataset.input.split(",");for(let c=0;c<m.length;c++){let p=m[c].split(" ").join("");if(p.includes(":"))var[s,a]=p.split(":");else var a=p,s="value";this._register(A,i,"input",{attr:s,bind:a,sel:h,nodeType:d})}this.uiid++,f.dataset.input=h}t()})};C.prototype.inject=function(e,i,r=!1){return new Promise(t=>{let n=e.getElementsByDataset("bind","for","for-update","switch","toggle","event","animate","if","class","input","attr");t(n)}).then(t=>{let n=[],s={bind:this._compileBind,switch:this._compileSwitch,toggle:this._compileToggle,if:this._compileIf,class:this._compileClass,attr:this._compileAttr,for:this._compileFor,"for-update":this._compileForUpdate,event:this._compileEvents,animate:this._compileAnimate,input:this._compileInput};for(let a in t)t.hasOwnProperty(a)&&t[a].length&&n.push(s[a].apply(this,[t[a],i,r,e]));return console.timeEnd(i),n.length?Promise.all(n):Promise.resolve()}).then(()=>Promise.resolve())};tt.exports=C});var de=q((Yi,it)=>{var Dt=le(),Wt=D(),Jt=Z(),Kt=U();function E(e,i,r){this.name=e,this.template=i,this.options=r,this.handlers=r.handlers,this.subscribe=r.subscribe,this.data={},this.root=r.root,this.items=!1,this.type=r.type||"view",this.toggle=r.toggle,this.targets={},this.animateOptions=r.animate,this.role=r.role,this.isReady=!1,this.await={},this.utils=Kt,(e=="app"||r.role=="app")&&(this.staticComponent=r.static||[]),this.container={},this.compile=new Promise(t=>{this._bindHandlers(),t()}).then(()=>{this._bindSubscribe()}).then(()=>{switch(this.type=="view"&&!!this.template){case!0:return this.createElementAsync();default:this.isStatic=!1;break}})}E.prototype.isStatic=!1;E.prototype.hasEvent=!1;E.prototype.isConnected=!1;E.prototype.destroyed=!1;E.prototype.isCreated=!1;E.prototype.Subscribe=function(e){this.$observer.registerSubscribe({[e.listenTo]:{[e.original]:[e]}})};E.prototype.Node=function(e){return new Jt(e)};E.prototype._bindHandlers=function(){for(let e in this.handlers)if(this.handlers.hasOwnProperty(e)){let i=this.handlers[e],r=i.name;i=i.bind(this),i.original=r,i.binded=this.name,this.handlers[r]=i,this.initAwaitHandlers(e)}this.await.destroy||(this.await.destroy=Promise.resolve()),this.await.animateRemove||(this.await.animateRemove=Promise.resolve())};E.prototype.initAwaitHandlers=function(e){this.await[e]=Promise.resolve()};E.prototype._bindSubscribe=function(){let e={};for(let i in this.subscribe)if(this.subscribe.hasOwnProperty(i))if(subscribe=this.subscribe[i],!!subscribe.components&&!!subscribe.handler){let t=i,{components:n,handler:s}=subscribe;s=s.bind(this),s.binded=this.name,s.original=t;for(let a=0;a<n.length;a++){let u=n[a];e[u]||(e[u]={}),e[u][t]||(e[u][t]=[]),s.listenTo=u,e[u][t].push(s)}}else{e[i]||(e[i]={});let t=subscribe;for(let n in t)if(t.hasOwnProperty(n)){let s=t[n],a=s.name;try{s=s.bind(this)}catch{}s.original=a,s.binded=this.name,s.listenTo=i,e[i][a]||(e[i][a]=[]),e[i][a].push(s)}}this.subscribe=e};E.prototype.notifyStaticComponent=function(e,i,r){Cake.Observer.notify(e,i,r,this.staticComponent[e],!0,this.name)};E.prototype.doFor=function(e,i){let r=()=>this.html;i!=null&&this.$attrib.notifyFor(e,i,null,this.name,r())};E.prototype.doToggle=function(e,i){this.$attrib.notifyToggle(e,i,null,this.name,this.html)};E.prototype.doSwitch=function(e,i){this.$attrib.notifySwitch(e,i,null,this.name,this.html)};E.prototype.doIf=function(e,i){this.$attrib.notifyIf(e,i,null,this.name,this.html)};E.prototype.$animate=function(e){let i=this.$attrib.getWatchItemsByType(this.name,"animate"),r=this.animateOptions,t=[];return(()=>{if(!(!i.length&&!(i instanceof Array)||!r))for(let n=0;n<i.length;n++){let s=i[n],{ns:a,selector:u}=s;if(s.ns){if(r[a]){let h=r[a];Object.assign(s,r[a]),delete r[a]}}else t.push(i)}})(),i.length?((()=>{let n={},s={};for(let a in r)r.hasOwnProperty(a)&&(s.val=a,n.selector=s,Object.assign(n,r[a]),i.push(n),n={},s={})})(),new Dt(i,this.html).animate(e)):!1};E.prototype.$templating=function(e,i,r){let t=i||this.template;return new Wt(e,t,r).createElement()};E.prototype.createElement=function(){if(!(this.template.substring(0,1)=="#"))return;let i=this.template.substr(1),r=document.getElementById(i),t=this.isTemplate=r&&r.toString().includes("Template");if(!r)throw new Error(`the template for ${this.name} is not found with.`);return new Promise(n=>{switch(t){case!0:{let s=r.getContent(!0);if(!s)throw new Error(`it might be theres no template in component - ${this.name}`);s.cake_component=this.name,this.html=this.Node(s),this._parseHTML(this.isStatic).then(()=>{this._watchBindedItems(),n()})}break;case null:n();break;default:{let s=r;if(!s)throw new Error(`it might be theres no template in component - ${this.name}`);s.cake_component=this.name,this.html=this.Node(s),this.isStatic=!0,this._parseHTML(this.isStatic).then(()=>{n()})}}})};E.prototype.createElementAsync=function(){return new Promise(e=>{this.createElement().then(()=>{e()})}).then(()=>{this.isReady=!0})};E.prototype._isParsed=!1;E.prototype._parseHTML=function(e=!1){return this.$attrib.inject(this.html,this.name,e).then(()=>{this.original=this.html.cloneNode(),this._isParsed=!0})};E.prototype.render=function(e){let{root:i,multiple:r,cleaned:t,emit:n,static:s,hashed:a,data:u}=e||{},h={emit:n||{}},f=d=>this.data[d]||this.$scope[d]||null;return new Promise((d,g)=>{!!i&&(this.root=i),r&&this._smoothReset(),this.isReady?d():this.createElement().then(()=>(a===!0&&this.$hash.add(this.name),!this.template&&this.fire.isConnected&&this.fire.isConnected(h,!0))).then(()=>{this.isReady=!0,d()})}).then(()=>this.await.destroy.then(()=>this.await.animateRemove).then(()=>new Promise((d,g)=>{let m=this.$attrib.getWatchItemsByType(this.name,"for");for(let c=0;c<m.length;c++){let p=f(m[c]);this.doFor(m[c],p)}d(this.html)}).then(d=>(h={element:d,emit:n},new Promise((g,m)=>{try{this.fire.beforeConnected&&this.fire.beforeConnected(h,!0),g(d)}catch(c){m(c)}}))).then(d=>{if(!this.isStatic)return(u?(()=>new Promise(m=>{let c=d.getElement();c=this.$templating(u,c),this.html=d=this.Node(c),this.html.replaceDataSrc(),u=null,m()}))():Promise.resolve()).then(()=>{d.appendTo(this.root,t),this.isConnected=!0})}).then(()=>this.findTarget()).then(()=>this.findContainer()).then(()=>{let d=this.$attrib.getWatchItemsByType(this.name,"switch");for(let g=0;g<d.length;g++)this.doSwitch(d[g],f(d[g]))}).then(()=>this.addEvent(s,r)).then(()=>{try{return this.fire.isConnected&&this.fire.isConnected(h,!0)}catch(d){console.log(440,d)}}).then(()=>this.$animate("render")).then(()=>new Promise((d,g)=>{setTimeout(()=>{this._watchReactive(),d()},100)}))))};E.prototype.renderAsync=function(e){this.render(e).then(()=>{this.$persist.append(this.name)})};E.prototype._smoothReset=function(){this.isConnected=!1,this.html=this.original.cloneNode()};E.prototype._hardReset=function(e){return this.isConnected=!1,this.$persist.remove(e),this.html=this.original.cloneNode(),!0};E.prototype.reset=function(){let e=this.$animate("remove");return e instanceof Promise?this.await.animateRemove=new Promise(i=>{e.then(()=>this.html.remove()).then(()=>this._hardReset(this.name)).then(()=>{i()})}):new Promise(i=>{this.html.remove(this.name),this._hardReset(this.name),i()})};E.prototype.addEvent=function(e,i){if(!!i&&!!e)return!1;let n=this.name;function s(a,u,h,f){return function(d){console.log(509,!h,u,a),h||d.preventDefault(),f&&d.stopPropagation(),Cake.Observer.notify(u,a,d)}}if(!!this.targets){for(let a in this.targets)if(this.targets.hasOwnProperty(a)){let u=this.targets[a];for(let h of u){let{sel:f,el:d,cb:g}=h,m=a,c=a.substring(0,2),p=c.includes("~"),y=c.includes("^");p||y?(m=a.slice(1),g=g||m):g||(g=a),d.Ref().get("__cake__events")||d.Ref().set("__cake__events",{});let b=d.Ref().get("__cake__events");if(!b[g])d.addEventListener(m,s(g,n,p,y),!0),b[g]=!0,d.Ref().set("__cake__events",b);else continue}}}};E.prototype.findTarget=function(){let e=this.$attrib.getEventTarget(this.name),i=JSON.parse(JSON.stringify(e));for(let r of i)r.el=document.querySelector(`[data-event=${r.sel}]`),this.targets[r.event]||(this.targets[r.event]=[]),this.targets[r.event].push(r)};E.prototype.toggler=function(e){let i=this.$attrib.getWatchItemsByType(this.name,"toggle"),r=class{constructor(n,s,a,u){this.toggle=u.toggle,this.bind=n,this.bases=s,this.cache=u.$cache,this.html=a}check(n){let s=this.toggle[n];if(!s)console.error(`${n} is not found in toggle! choose from ${JSON.stringify(Object.keys(this.toggle))}`);else{if(i.length){let{ns:a}=s,u=i.find(h=>h.name==`ns-${a}`);u&&(s.sel=`[data-toggle=${u.sel}]`)}return s}}_toggle(){let n=this.check(this.bind);if(!n)return;let{basis:s="data-name",cls:a="is-active",mode:u="radio",sel:h,persist:f=!0}=n,d=this.html.querySelectorAll(h);if(!d.length)return;let g,m;if(d.length==1){let c=typeof this.bases=="boolean",p=!!this.bases,y=d[0];if(f){let b=function(v,w,S){S?v.classList.contains(w)&&v.classList.remove(w):v.classList.contains(w)||v.classList.add(w)};c?(p?(this.cache.createOrUpdate(this.bind,!0),b(y,a,!0)):(this.cache.createOrUpdate(this.bind,!1),b(y,a,!1)),y.classList.toggle(a)):(this.cache.createOrUpdate(this.bind,!y.classList.contains(a)),y.classList.toggle(a))}}else for(let c=0;c<d.length;c++){let p=d[c],y=p.classList.contains(a),b=p.getAttribute(s);b==this.bases?(u=="switch"?p.classList.toggle(a):y||p.classList.add(a),f&&this.cache.createOrUpdate(this.bind,b),m=b):y&&(p.classList.remove(a),g=p.getAttribute(s))}return{prev:g,next:m}}_recall(){let n=this.check(this.bind);if(!n)return;let{basis:s="data-name",cls:a="is-active",sel:u}=n;return this.cache.get(this.bind).then(h=>{if(!h)return h;let f=h,d=this.html.querySelectorAll(u);if(!!d.length){if(d.length==1){let g=d[0];f&&g.classList.add(a)}else for(let g=0;g<d.length;g++){let m=d[g],c=m.classList.contains(a);m.getAttribute(s)==f&&(c||m.classList.add(a))}return f}})}},t=(n,s)=>new r(n,s,this.html,this)._toggle();return t.recall=n=>new r(n,!1,this.html,this)._recall(),t};E.prototype.findContainer=function(){return new Promise(e=>{let i=this.html.getContainers();for(let r=0;r<i.length;r++){let t=i[r],n=t.dataset.container;n&&(this.container[n]=t)}e()})};E.prototype._watchBindedItems=function(){};E.prototype._watchReactive=function(){if(!this.items.length){this.items=this.$attrib.getWatchItems(this.name);let e=this.name,i=this.$attrib.getWatchItemsByType(this.name,"input")||{input:!1},r=this.$attrib.notify[e];console.log(i),i&&i.forEach(t=>{let{attr:n,bind:s,sel:a,nodeType:u}=t,h=document.querySelector(`[data-input=${a}]`);h&&!h._reactive&&(u=="INPUT"||u=="TEXTAREA"?(r.forEach(f=>{f(e,{value:h.value,bind:s})}),h.addEventListener("input",f=>{r&&r.length&&r.forEach(d=>{d(e,{value:f.target.value,bind:s})})}),h.addEventListener("change",f=>{r&&r.length&&r.forEach(d=>{d(e,{value:f.target.value,bind:s})})})):u=="SELECT"&&((()=>{let{selectedOptions:f}=i,d=[];for(let g=0;g<f.length;g++){let m=f[g],c=m.text,p=m.value;d.push({text:c,value:p})}r&&r.length&&r.forEach(g=>{g(e,{value:d,bind:s})})})(),h.addEventListener("change",f=>{let{selectedOptions:d}=f.target,g=[];for(let m=0;m<d.length;m++){let c=d[m],p=c.text,y=c.value;g.push({text:p,value:y})}r&&r.length&&r.forEach(m=>{m(e,{value:g,bind:s})})})),h._reactive=!0)})}};E.prototype.observer=function(e){function i(r){return this.handler[r]}this.observer=new Observer(this,e,i.bind(this))};E.prototype.variable=function(e){let i=Object.keys(e),r={},t=[];function n(s,a,u){a||(r[s]=`value is not '${u}'`)}for(let s in e)if(e.hasOwnProperty(s)){let a=e[s],{type:u,value:h}=a,f;["string","number"].includes(u)?f=typeof h==u:h instanceof Array?f=u=="array":f=u=="object",t.push(h),n(s,f,u)}if(Object.keys(r).length)throw new Error(JSON.stringify(r));return t};it.exports=E});var nt=q((Zi,rt)=>{var zt=pe(),ge=he()(),B=de(),Xt=ae(),Gt=ue(),Yt=oe(),Qt=K()(),Zt=se(),Vt=ce(),Qi=U();function k(e){this.componentName=e,this.components={}}k.app=function(e){this.name=e.name||""};k.Components=function(e){return{subscribe(i,r){function t(){let n=k.Components[e];if(n&&i instanceof Function){let s=i.name;r&&(i=i.bind(r)),i.binded="external",i.original=s,i.listenTo=n.name,n.Subscribe(i)}}return new Promise((n,s)=>{let a=setInterval(()=>{k.Components[e]&&(t(),clearInterval(a),n())})})}}};k.Models={};k.Subscribe={};k.Handlers={};k.Attributes=new zt;k.Models.$loaded=function(e){return new Promise((i,r)=>{let t=setInterval(()=>{k.Models[e]&&(clearInterval(t),i(k.Models[e]))});setTimeout(()=>{k.Models[e]||(clearInterval(t),r(e))},1e4)})};k.MainMessageChannel=function(){let e=new MessageChannel;return{send(i){e.port2.postMessage(i)},receive(i){e.port1.onmessage=function(r){let{isTrusted:t,data:n}=r||{isTrusted:!1};i(t?{status:1,data:n}:{status:0,err:"not trusted!"})}}}}();k.Utils={scopeTrap(e){return!1},scopeNotifier(e){return e}};k.create=function(e,i,r){new k(e,i,r).create(e,i,r)};k.plugin=function(){};k.init=function(e){return new B(e)};k.Hasher=new Xt(k.Components);k.Hasher.listen();k.Router=Gt(k.Components,B);k.Persistent=new Yt;k.Persistent.listen(k.Components);k.Cache=new Qt({name:"cache",storage:"session",child:"object"});k.getSubscriber=function(e,i){let r=k.Subscribe,t={};for(let n in r)if(r.hasOwnProperty(n)){let s=r[n];for(let a in s)if(s.hasOwnProperty(a)){let u=s[a];for(let h of u){let f=h,d=f.original,g=f.binded;if(f.listenTo==e){if(d==i)if(!t[g])t[g]=i;else{let c=t[g]instanceof Array?t[g]:[t[g]];t[g]=c.concat(i)}else if(!i)if(!t[g])t[g]=d;else{let c=t[g]instanceof Array?t[g]:[t[g]];t[g]=c.concat(d)}}}}}return t};k.Observer=new Zt(k.Subscribe,k.Handlers);k.prototype._defineProperty=function(e,i,r,t){Object.defineProperty(e,i,{configurable:!0,get(){return r()},set(n){t&&t(n)}})};k.prototype._defineProperty(B.prototype,"$observer",function(){return k.Observer});k._globalScope=new ge("globalScope");k.prototype._defineProperty(B.prototype,"$globalScope",function(){return k._globalScope});k._universalScope=new ge("universalScope");k.$universalScope=function(){return k._universalScope};k.prototype._defineProperty(B.prototype,"$attrib",function(){return k.Attributes});k.prototype._defineProperty(B.prototype,"$persist",function(){return k.Persistent});k.prototype._defineProperty(B.prototype,"$cache",function(){return k.Cache});k.prototype._defineProperty(B.prototype,"$hash",function(){return k.Hasher});k.prototype.create=function(e,i,r){console.time(e);let t=new B(e,i,r),n=new ge(e);n.registerNotifier(function(s,a,u,h){return k.Attributes.notifier(s,a,u,h)}),k.Attributes.registerNotifier(e,function(s,a){return n.notifier(s,a)}),t.compile.then(()=>{let{subscribe:s,root:a,html:u,handlers:h,role:f}=t;return k.Observer.registerSubscribe(s).then(()=>({root:a,handlers:h}))}).then(({handlers:s,root:a})=>{k.Observer.registerHandlers(s,t.name),this._defineProperty(t,"root",function(){if(t._root)return t._root;{let u=a||"#app",h=document.querySelector(u);if(h)return h}throw new Error(`the selector '${a}' as container of component '${t.name}' is not found!`)},function(u){Object.assign(t,{_root:u})}),t.role=="form"&&(()=>{let u=Vt(t),h=()=>t.root.querySelector("FORM");for(let f in u)u.hasOwnProperty(f)&&Object.defineProperty(h,f,{get(){return u[f]}});this._defineProperty(t,"$form",function(){return h})})(),this._defineProperty(t,"$scope",function(){return n})}).then(()=>{t.fire=function(){function s(u,h){h=h?typeof h=="function"?h.bind(t)():function(){return h}.bind(t)():null;let f={[u]:()=>h};if(fn=f[u].bind(t),typeof fn=="function"){let m=function(p){let y={};if(!p)return y;let b=p.attributes;if(b)for(let v=0;v<b.length;v++){let w=b[v],S=w.name,O=w.value;y[S]=O}return y};var d=m;fn.name=u,fn.original=u,fn.binded=t.name,k.Observer.registerHandlers({[u]:fn},t.name);let g=h;if(h&&(h.element||h.root||h.container)){let p=m(h.element),y=m(h.root),b=m(h.container);g={status:0,attributes:{element:p,root:y,container:b}}}k.MainMessageChannel.send({component:t.name,event:u,payload:g});let c=k.Observer.notify(t.name,u,{}).then(()=>k.Observer.results[t.name][u]);return t.await[u]=c,t.await[u]}console.error("the param in fire is not an instance of function")}function a(u,h){for(let f in h)if(h.hasOwnProperty(f)){let d=h[f],g=d.original;Object.defineProperty(u,g,{get(){let m={[g]:function(c,p){if(p!=null&&(p=p),p==null&&g=="destroy"&&(p=!0),p==null&&(p=!1),p){let y=new Promise((b,v)=>{setTimeout(()=>{let w=c;w=w||{},k.Observer.notify(t.name,g,w).then(()=>k.Observer.results[t.name][g]).then(S=>{b(S)}).catch(S=>{console.log(448,t.name,g,w),console.trace(),console.error(S)})})});return t.await[g]=y,t.await[g]}else return d(c)}};return m[g]=m[g].bind(t),m[g].originalName=g,m[g].binded=t.name,m[g]}})}}return a(s,t.handlers),s}()}).then(()=>{t.type=="view"&&(t.toggler=t.toggler(t),k.Components[e]=t)}).then(()=>{t.options.router&&k.Router.subscribe(t.options.router.bind(t)),t.options.data&&t.options.data.bind(t.data)(t),t.options.init&&t.options.init.bind(t)(),t.options.utils&&t.options.utils.bind(t.utils)(t)}).then(()=>{t.type=="model"&&(k.Models[e]=t),t.isStatic&&t.type=="view"&&t.render()})};rt.exports=k});var Vi=ye(),er=be(),tr=ve(),ir=U(),rr=ke(),nr=Z(),sr=se(),lr=D(),or=le(),ar=oe(),cr=ae(),hr=ce(),ur=K()(),pr=he()(),dr=ue()(),gr=pe(),mr=de(),ei=nt();window.Cake=ei;})();
  