-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimply.min.js
More file actions
3 lines (3 loc) · 81.7 KB
/
simply.min.js
File metadata and controls
3 lines (3 loc) · 81.7 KB
1
2
3
simply={itemKeyMap:new WeakMap,itemKeyCounter:0,getUniqueId(item){return"object"!=typeof item||null===item?null:(this.itemKeyMap.has(item)||this.itemKeyMap.set(item,"autoid-"+ ++this.itemKeyCounter),this.itemKeyMap.get(item))},components:{},compile:function(args){var{template:template,data:data,style:style,state:state,parent:parent,props:props,component:component,dom:dom,methods:methods,lifecycle:lifecycle,name:name}=args;let t=template;const context={...args};if(!simply.components[name]?.templateRenderFn){t=t.replace(/`/g,"\\`"),t=t.replace(/\{\{([\s\S]*?)\}\}/g,"${$1}");const EXCLUDED_TAGS=new Set(["if","else","elsif","each","static","guard","slot","br","hr","img","input"]);let localCounter=simply.components[name]._tagCounter||0;const isAnimate=component?.settings?.animate,uid=component.uid||"uid";t=t.replace(/<(?!\/)([a-zA-Z0-9-]+)/g,((match,tagName)=>{const lower=tagName.toLowerCase();if(EXCLUDED_TAGS.has(lower))return match;if(!isAnimate)return match;localCounter++;return`<${tagName} sid="\${ uniqueItemKey.indexOf('np') > -1 ? undefined : '${`s${uid}-${localCounter}`}' + uniqueItemKey }"`})),simply.components[name]._tagCounter=localCounter,t=t.replace(/<static>/gi,"${guard([], () => html`"),t=t.replace(/<\/static>/gi,"`)}"),t=t.replace(/<each\s+([^>]+)>/g,((match,attributes)=>{const ofAttr=attributes.match(/of="([^"]+)"/)?.[1],asAttr=attributes.match(/as="([^"]+)"/)?.[1],keyAttr=attributes.match(/key="([^"]+)"/)?.[1],indexAttr=attributes.match(/index="([^"]+)"/)?.[1];if(!ofAttr||!asAttr)return match;const keyVar=keyAttr||"_key";return"${ repeat(Object.entries("+ofAttr+" || {}), (["+keyVar+"]) => "+keyVar+", (["+keyVar+", "+asAttr+"], "+(indexAttr||"_index")+') => { return ((pKey) => { const uniqueItemKey = pKey + "-" + '+`(Array.isArray(${ofAttr}) ? (typeof ${asAttr} === 'object' && ${asAttr} && 'id' in ${asAttr} ? ${asAttr}.id : 'np') : ${keyVar})`+";return html`"})),t=t.replace(/<\/each>/g,"` })(uniqueItemKey); }) }"),t=t.replace(/<if\s+cond="([^"]+)">/g,"${ $1 ? html`"),t=t.replace(/<\/(?:if|elsif)>\s*<elsif\s+cond="([^"]+)">/g,"` : $1 ? html`"),t=t.replace(/<\/(?:if|elsif)>\s*<else>/g,"` : html`"),t=t.replace(/<\/else>/g,"` }"),t=t.replace(/<\/(?:if|elsif)>/g,"` : nothing }"),simply.components[name]=simply.components[name]||{};const fnBody=`\n var { template, data, style, state, parent, props, component, dom, methods, lifecycle, name } = scope;\n // Root seviyesinde uniqueItemKey boştur.\n let uniqueItemKey = ""; \n return html\`${t}\`;\n `;simply.components[name].templateRenderFn=new Function("scope",fnBody)}return simply.components[name].templateRenderFn(context)},parseTemplate:function(parsingArgs){var{template:template,data:data,style:style,state:state,parent:parent,props:props,component:component,dom:dom,methods:methods,lifecycle:lifecycle,name:name}=parsingArgs;if(!simply.components[name].templateRenderFn){performance.now();template=simply.addUniqueKeys(template,component);performance.now();(template=template.replace(/[\r\n]+/g,"")).includes("${")&&(template=template.replace(/\$\{/g,"minyeli{"));const bucketParts=[],len=template.length,tagMatchRegex=/(<(?:if\s+cond="([^"]+)"|elsif\s+cond="([^"]+)"|each[^>]*|else|\/(?:each|if|elsif|else))>)/g,varRegex=/\{\{\s*([^{}]+?)\s*\}\}/g,inTagVarRegex=/:="([^"]+)"/g,excludeRanges=[];let scriptMatch;const scriptRegex=/<script[^>]*>([\s\S]*?)<\/script>/gi;for(;null!==(scriptMatch=scriptRegex.exec(template));)excludeRanges.push([scriptMatch.index,scriptMatch.index+scriptMatch[0].length]);const styleRegex=/<style[^>]*>([\s\S]*?)<\/style>/gi;for(;null!==(scriptMatch=styleRegex.exec(template));)excludeRanges.push([scriptMatch.index,scriptMatch.index+scriptMatch[0].length]);function isExcluded(index){for(const[start,end]of excludeRanges)if(index>=start&&index<end)return!0;return!1}const logicPoints=[];let tagMatch,varMatch,inTagMatch;for(;null!==(tagMatch=tagMatchRegex.exec(template));){if(isExcluded(tagMatch.index))continue;const fullTag=tagMatch[1];let logic="";if("</each>"===fullTag)logic="}};";else if("<else>"===fullTag)logic="else {";else if("</if>"===fullTag||"</elsif>"===fullTag||"</else>"===fullTag)logic="}";else if(tagMatch[2])logic="if ("+unescape(tagMatch[2])+") {";else if(tagMatch[3])logic="else if ("+unescape(tagMatch[3])+") {";else if(fullTag.startsWith("<each")){const groups=parseEachTag(fullTag),iter="s"+Math.random().toString(36).slice(2,7);logic=`\n for (let ${iter} in ${groups.of}) {\n if (!Object.prototype.hasOwnProperty.call(${groups.of}, ${iter})) continue;\n const ${groups.as} = ${groups.of}[${iter}];\n\n // 1. Üst döngüden gelen zinciri al.\n // En dıştaki döngüdeysek 'undefined' olacağı için boş string kabul et.\n const parentChain = (typeof keyChain !== 'undefined') ? keyChain : "";\n\n // 2. YENİ SCOPE AÇIYORUZ\n {\n // 3. Mevcut zinciri oluştur: (Parent varsa sonuna tire koy) + (Mevcut Index)\n // Örnek: Parent "2-5", iter "3" ise sonuç: "2-5-3"\n // Örnek: Parent "", iter "2" ise sonuç: "2"\n let keyChain = (parentChain === "" ? "" : parentChain + "-") + ${iter};\n\n // Render fonksiyonun kullandığı değişkene ata\n let uniqueItemKey = keyChain;\n\n ${groups.key?`let ${groups.key} = ${iter};`:""}\n ${groups.index?`let ${groups.index} = parseInt(${iter});`:""}\n \n // DİKKAT: Burada süslü parantezi kapatmıyoruz! \n // Kapanış </each> tag'inde yapılmalı.\n `}logic&&logicPoints.push({start:tagMatch.index,end:tagMatch.index+fullTag.length,logic:logic})}for(;null!==(varMatch=varRegex.exec(template));){if(isExcluded(varMatch.index))continue;let isInsideTag=!1;for(const lp of logicPoints)if(varMatch.index>=lp.start&&varMatch.index<lp.end){isInsideTag=!0;break}if(isInsideTag)continue;let variable=varMatch[1];/^\{.*\}$/.test(variable)&&(variable='"'+varMatch[0]+'"'),logicPoints.push({start:varMatch.index,end:varMatch.index+varMatch[0].length,logic:"ht+="+variable+";"})}for(;null!==(inTagMatch=inTagVarRegex.exec(template));)isExcluded(inTagMatch.index)||logicPoints.push({start:inTagMatch.index,end:inTagMatch.index+inTagMatch[0].length,logic:"ht+="+inTagMatch[1]+";"});logicPoints.sort(((a,b)=>a.start-b.start));let lastEnd=0;for(const point of logicPoints){if(point.start>lastEnd){const staticText=template.substring(lastEnd,point.start);staticText.trim()&&bucketParts.push("ht+=`"+staticText+"`;")}bucketParts.push(point.logic),lastEnd=point.end}if(lastEnd<len){const remaining=template.substring(lastEnd).trimEnd();remaining&&bucketParts.push("ht+=`"+remaining+"`;")}function parseEachTag(eachTag){function getAttr(regex){var m=eachTag.match(regex);return m?m[1]:void 0}return{of:getAttr(/of="([^"]+)"/),as:getAttr(/as="([^"]+)"/),key:getAttr(/key="([^"]+)"/),index:getAttr(/index="([^"]+)"/)}}let bucket=bucketParts.join("").replace(/minyeli/g,"$");simply.components[name].templateRenderFn=new Function("scope",`var { template, data, style, state, parent, props, component, dom, methods, lifecycle, name } = scope;\n let ht = "";\n ${bucket}\n return ht;`)}return simply.components[name].templateRenderFn(parsingArgs)},addUniqueKeys(template,component){const excludedTags=new Set(["if","elsif","else","each"]);template=function(template){let insideEach=0,tagIndex=0;return template.replace(/<\/?([a-zA-Z][\w:-]*)([^>]*)>/g,((fullTag,tagName,attrs)=>{const isClose="/"===fullTag[1],lowerName=tagName.toLowerCase();return"each"===lowerName?(insideEach+=isClose?-1:1,fullTag):insideEach>0&&!isClose?excludedTags.has(lowerName)||/\bkey\s*=/.test(attrs)?fullTag:(tagIndex++,`<${tagName} key="${component.uid}-${lowerName}${tagIndex}{{uniqueItemKey}}"${attrs}>`):fullTag}))}(template);let keyi=0;return template=template.replace(/<(?!\/)([a-zA-Z0-9-]+)([^>]*)>/g,((match,tagName,attributes)=>excludedTags.has(tagName.toLowerCase())||attributes.includes("key=")?match:`<${tagName} key="${component.uid}-${tagName}-${keyi++}"${attributes}>`))},extractVarName(expr){let match=expr.match(/([a-zA-Z_$][\w.$]*)/);return match?match[1].replace(/\./g,"-"):expr.replace(/\W+/g,"-")},parseStyle:function(parsingArgs){var{template:template,data:data,style:style,state:state,parent:parent,props:props,component:component,dom:dom,methods:methods,lifecycle:lifecycle,name:name}=parsingArgs;if(!simply.components[name].styleRenderFn){const markConditions=str=>{let stack=[],nextIsTarget=!1;return str.replace(/(cond:\[)|(\{)|(\})/g,((match,trigger,open,close)=>trigger?(nextIsTarget=!0,match):open?(stack.push(nextIsTarget),nextIsTarget=!1,match):close?stack.pop()?"`;} ht+=`":match:void 0))};var processedCSS=parsingArgs.style;processedCSS.includes("cond:[")&&(processedCSS=markConditions(processedCSS));var renderFunc="var ht = ``;";renderFunc+="ht += `"+function(cssString){let s=cssString,hasDynamicVar=!1,pos=s.indexOf("var(");for(;-1!==pos;){if(45!==s.charCodeAt(pos+4)||45!==s.charCodeAt(pos+5)){hasDynamicVar=!0;break}pos=s.indexOf("var(",pos+1)}return hasDynamicVar&&(s=s.replace(/var\(([^()]*(?:\([^()]*(?:\([^()]*(?:\([^()]*\)[^()]*)*\)[^()]*)*\)[^()]*)*)\)/g,((match,content)=>content.trim().startsWith("--")?match:"` + ("+content+") + `"))),s.includes("cond:[")&&(s=s.replace(/&cond:\[elsif="(.+?)"\]\s*{/g,"`; else if ($1) { ht+=`").replace(/&cond:\[else\]\s*{/g,"`; else { ht+=`").replace(/&cond:\[if="(.+?)"\]\s*{/g,"`; if ($1) { ht+=`").replace(/ht\+=\`\s*`;\s*(else)/g,"$1")),s}(processedCSS)+"`;",simply.components[name].styleRenderFn=new Function("scope",`var { template, data, style, state, parent, props, component, dom, methods, lifecycle, name } = scope;\n ${renderFunc}\n return ht;`)}return simply.components[name].styleRenderFn(parsingArgs)},loadJS:function(src,cb,waitBeforeCb){
/*! loadJS: load a JS file asynchronously. [c]2014 @scottjehl, Filament Group, Inc. (Based on http://goo.gl/REQGQ by Paul Irish). Licensed MIT */
if(document.querySelectorAll('[src="'+src+'"]').length>0)if(window[waitBeforeCb])cb();else var tryCount=0,a=setInterval((()=>{!window[waitBeforeCb]&&tryCount<10?tryCount+=1:(cb(),clearInterval(a))}),50);else{var ref=window.document.getElementsByTagName("script")[0],script=window.document.createElement("script");script.src=src,script.async=!0,ref.parentNode.insertBefore(script,ref),cb&&"function"==typeof cb&&(script.onload=cb)}return script},get:function(path,name){function loadAndRegister(p){simply.loadComponent(p,name,(function(component){simply.getSettings(component,(function(settings){simply.registerComponent(settings)}))}))}if(simply.gets=simply.gets||[],Array.isArray(path))for(let i=0;i<path.length;i++)simply.gets.push(path[i]),loadAndRegister(path[i]);else simply.gets.push(path),loadAndRegister(path)},jsdoc:function(str){return str.replace(/(\n[ \t]*\/\/\/[^\n]*)+/g,(function($){return"\n/**"+$.replace(/^[ \t]*\/\/\//gm,"").replace(/(\n$|$)/,"*/$1")}))},loadComponent:function(path,name,callback,triedWithCorsProxy=!1){performance.now();if(name){let i=name.lastIndexOf(".");-1!==i&&(name=name.slice(0,i))}else{const proxy="cors.woebegone.workers.dev/?";let p=path,i=p.indexOf(proxy);-1!==i&&(p=p.slice(i+proxy.length)),path=p,i=p.indexOf("?"),-1!==i&&(p=p.slice(0,i)),i=p.indexOf("#"),-1!==i&&(p=p.slice(0,i)),i=p.lastIndexOf("/"),-1!==i&&(p=p.slice(i+1)),i=p.lastIndexOf("."),-1!==i&&(p=p.slice(0,i)),name=p}path.startsWith("blob:");fetch(path,{cache:"no-cache"}).then((response=>response.ok?response.text():(console.error("HTTP error:",response.status),null))).then((text=>{if(!text)return;let parsed;try{parsed=simply.splitComponent(text)}catch(e){return void console.error("splitComponent error:",e)}simply.components[name]=parsed,callback({name:name,template:parsed.template,style:parsed.style,script:parsed.script,docStr:text})})).catch((error=>{if(!(error instanceof TypeError&&/failed fetch|network|cors/i.test(error.message))||triedWithCorsProxy||path.startsWith("https://cors.woebegone.workers.dev/"))console.error(error);else{const proxyUrl="https://cors.woebegone.workers.dev/?"+path;simply.loadComponent(proxyUrl,name,callback,!0)}}));performance.now()},request:function(url,callback,async=!1){var request=new XMLHttpRequest;request.open("GET",url,async),request.onload=function(){if(this.status>=200&&this.status<400){try{response=JSON.parse(this.responseText)}catch(err){response=this.responseText}callback&&callback(response)}},request.send()},splitComponent:function(string){performance.now();let template="",style="",script="";const regex=/<(html|style|script)[^>]*>([\s\S]*?)<\/\1>/gi;let match;for(;null!==(match=regex.exec(string));){const tagName=match[1].toLowerCase(),content=match[2];"html"===tagName?template=content:"style"===tagName?style=content:"script"===tagName&&(script=content)}performance.now();return{template:template,style:style,script:script}},processPropTemplate:function(string){var propsFromTemplate=string;return propsFromTemplate=(propsFromTemplate=propsFromTemplate.replace(/[^\\]'/g,'"').replace(/\\'/g,"'")).replace(/(?:\r\n|\r|\n)/g," "),propsFromTemplate=Function("return "+propsFromTemplate)(),propsFromTemplate=simply.customStringify(propsFromTemplate),propsFromTemplate=JSON.parse(propsFromTemplate)},parseProp:function(contentString){var type,value,parsed,content;content=contentString.replace(/[^\\]'/g,'"'),content=content.replace(/\\\'/g,"'");try{parsed=JSON.parse(content),type=typeof parsed,value=parsed,Array.isArray(parsed)&&(type="array")}catch(e){let func=content;func=eval(func),"function"==typeof func&&(type="function",value=eval("("+func+")"))}finally{return null==type&&(type="string",value=contentString),{type:type,value:value,str:content}}},prepareAttr:function(value){let type=typeof value;return Array.isArray(value)||"object"==type||"number"==type||"boolean"==type?simply.customStringify(value).replace(/[^\\]'/g,"\\'").replace(/[^\\]"/g,"'").replace(/\"/g,"'"):"function"==type?value.toString().replace(/[^\\]'/g,'"').replace(/\\'/g,"'"):value},objToPropString:function(obj){return JSON.stringify(obj).replace(/'/g,"'")},customStringify:function(v){const cache=new Set;return JSON.stringify(v,(function(key,value){if("__c_"!==key&&"__o_"!==key&&"__p_"!==key&&"__r_"!==key){if("object"==typeof value&&null!==value){if(cache.has(value))try{return JSON.parse(JSON.stringify(value))}catch(err){return}cache.add(value)}else if("function"==typeof value)return value.toString().replace(/[^\\]'/g,'"').replace(/\\'/g,"'");return value}}))},getSettings:function({name:name,template:template,style:style,script:script,docStr:docStr},callback){callback({name:name,template:template,style:style,script:script,docStr:docStr})},framerStaff:function(dom,name,uid,component,props,lifecycle){function triggerOnTapFromDOM(domElement){for(var current=domElement;current&&"FRAMER-COMPONENT"!==current.tagName;){var fiberKey=null;try{for(var keys=Object.keys(current),i=0;i<keys.length;i++)if(0===keys[i].indexOf("__reactFiber$")){fiberKey=keys[i];break}}catch(e){}var fiber=fiberKey?current[fiberKey]:null;try{if("function"==typeof(onTap=fiber.return.child.pendingProps.onTap))return onTap(),void setTimeout((()=>{try{self.lifecycle.framerComponentClicked(current)}catch(e){}}),0)}catch(e){}try{var onTap;if("function"==typeof(onTap=fiber.return.child.child.stateNode.props.onTap))return onTap(),void setTimeout((()=>{try{self.lifecycle.framerComponentClicked(current)}catch(e){}}),0)}catch(e){}current=current.parentElement}}new MutationObserver((mutations=>{for(const mutation of mutations)for(const node of mutation.addedNodes)if(node.nodeType===Node.ELEMENT_NODE&&"FRAMER-COMPONENT"===node.tagName&&!node.hasAttribute("uid")){const framerComponentUid="id"+Math.random().toString(16).slice(2),path=node.getAttribute("path");node.setAttribute("uid",framerComponentUid),node.setAttribute("style","height: auto; width: auto"),node.setAttribute("rendered",!0),window.parent.postMessage({method:"component-request",path:path,name:name,framerComponentUid:framerComponentUid,uid:uid},"*"),node.addEventListener("click",(e=>{node.contains(e.target)&&triggerOnTapFromDOM(e.target)}),{passive:!0})}})).observe(dom,{childList:!0,subtree:!0}),dom.addEventListener("click",(function(e){const link=e.target.closest("a");link&&(link.closest("framer-component")||link.hasAttribute("route-framer"))&&(e.preventDefault(),e.stopPropagation(),window.parent.postMessage({method:"link-click",link:link.getAttribute("href"),uid:uid,name:name},"*"))})),self.framerPropsListener=function(event){event.preventDefault(),event.stopPropagation(),"set-props"===event.data.method&&(Object.assign(props,event.data.props),lifecycle&&lifecycle.framerPropsUpdated&&lifecycle.framerPropsUpdated(),component.render())},component.runInFramer=function(codeToRun){window.parent.postMessage({method:"run-in-framer",name:name,uid:uid,code:"return "+codeToRun.toString()},"*")},window.addEventListener("message",self.framerPropsListener),window.parent.postMessage({method:"simply-ready",uid:uid,name:name},"*")},findElementWithCB(element){let current=element;for(;current;){if(current.cb&¤t.cb.state)return current;current=current.parentNode?current.parentNode:current.host?current.host:null}return null},classCache:{},getDomParentAndShadow(component){var dom,parent,shadow=!1;return null!==component.getAttribute("isolated")&&"false"!==component.getAttribute("isolated")&&(shadow=!0),shadow?(dom=component.attachShadow({mode:"open"}),(parent=component.getRootNode().host)||(parent=simply.findShadowRootOrCustomElement(component))):(dom=component,parent=simply.findShadowRootOrCustomElement(component)),{dom:dom,parent:parent,shadow:shadow}},pathForTemplateSearch(currentPath,prefix){prefix=prefix||"data";for(var parts=currentPath.replace(/\[.*?\]/g,"").replace(/\?\./g,".").split("."),out=prefix,i=0;i<parts.length;i++){var p=parts[i];if(p){out+="."+p;break}}return[out]},templateUsesAnyChange(template,changes,prefix){if(template){var normalized=template.replace(/\?\./g,".");for(const{currentPath:currentPath}of changes){const paths=simply.pathForTemplateSearch(currentPath,prefix);for(const path of paths)if(normalized.includes(path))return!0}}return!1},react:function(changes,from,component,template,style){if(void 0!==component.lifecycle)if("props"===from){if(void 0!==component.lifecycle.whenPropChange&&!1===component.lifecycle.whenPropChange(changes))return!1}else if("state"===from){if(component.lifecycle&&component.lifecycle.whenStateChange&&!1===component.lifecycle.whenStateChange(changes))return!1}else if(void 0!==component.lifecycle.whenDataChange&&!1===component.lifecycle.whenDataChange(changes))return!1;if("state"===from){if(!simply.templateUsesAnyChange(template,changes,"state")&&!simply.templateUsesAnyChange(style,changes,"state"))return!1}else if("props"===from){if(!simply.templateUsesAnyChange(template,changes,"props")&&!simply.templateUsesAnyChange(style,changes,"props"))return!1}else if("data"===from&&!simply.templateUsesAnyChange(template,changes,"data")&&!simply.templateUsesAnyChange(style,changes,"data"))return!1;component.render(changes)},getParentState(parent){if(parent){let current=parent;for(;current;){if(current.state)return{state:current.state,cbState:parent.cb.state};current=current.parent}}return null},setupObservableSlims(self){var t=self.template,data=ObservableSlim.create({},.1,(function(changes){if(self.cb.data)for(const[key,cbFn]of Object.entries(self.cb.data))cbFn&&cbFn(changes)}));(t.includes("data.")||t.includes("data?.")||self.script.includes("data.")||self.script.includes("data?."))&&(self.cb.data={},self.cb.data[self.uid]=function(changes){self.react(changes,"data",self,t,self.s)},self.setCbData(self.cb.data));for(var i=0;i<self.attributes.length;i++){var attrib=self.attributes[i];"cb"!==attrib.name&&(self.props[attrib.name]=simply.parseProp(attrib.value).value)}var props=ObservableSlim.create(self.props,!1,(function(changes){if(self.cb.props)for(const[key,cbFn]of Object.entries(self.cb.props))cbFn&&cbFn(changes)}));if((t.includes("props.")||t.includes("props?.")||self.script.includes("props.")||self.script.includes("props?."))&&(self.cb.props={},self.cb.props[self.uid]=function(changes){self.react(changes,"props",self,t,self.s)}),self.state.__isProxy){state=self.state;if(t.includes("state.")||t.includes("state?.")||self.script.includes("state.")||self.script.includes("state?.",self.s.includes("state.")||self.s.includes("state?."))){var p=simply.findElementWithCB(self.parent);p&&(p.cb.state[self.uid]=function(changes){self.react(changes,"state",self,t,self.s)})}}else{var state=ObservableSlim.create({},!1,(function(changes){if(self.cb.state)for(const[key,cbFn]of Object.entries(self.cb.state))cbFn&&cbFn(changes)}));self.cb.state={},self.cb.state[self.uid]=function(changes){self.react(changes,"state",self,t,self.s)}}return{data:data,props:props,state:state}},restoreCache(component){if(component.hasAttribute("cache")&&"false"!==component.getAttribute("cache")){component.cache={};try{var cachedData=simply.cache[simply.lastPath][component.elementId].data;if(cachedData){component.cache.data=cachedData;for(const key in cachedData)Object.hasOwnProperty.call(cachedData,key)&&(component.data[key]=cachedData[key])}}catch(e){}}if(component.hasAttribute("cache")&&"false"!==component.getAttribute("cache"))try{var cachedProps=simply.cache[simply.lastPath][component.elementId].props;if(cachedProps){component.cache.props=cachedProps;for(const key in cachedProps)Object.hasOwnProperty.call(cachedProps,key)&&(component.props[key]=cachedProps[key])}}catch(e){}},replaceEventAttrs(template){let m,regex=/\s+on[a-z]+(\s*)=(\s*)("((?:\\.|[^"])*)"|'((?:\\.|[^'])*)')/gm;for(;null!==(m=regex.exec(template));){m.index===regex.lastIndex&®ex.lastIndex++;let capturedMatch=m[4]||m[5];var match="simply.findShadowRootOrCustomElement(this)";if(-1==capturedMatch.indexOf(match)){var newValue=m[0];["state.","parent.","methods.","lifecycle.","data.","props.","component.","dom."].forEach((v=>{newValue=(newValue=newValue.replaceAll(v,match+"."+v)).replaceAll("."+match,"")})),template=template.replaceAll(m[0],newValue)}}return template},getClass(script,name){if(script=script.trim()){if(!simply.classCache[name]){const className="simply_"+name.replace(/-/g,"_");script=script.replace(/^class\s+(simply\s*)?\{/,"class "+className+" {"),simply.classCache[name]=new Function("state","methods","lifecycle","component","dom","parent","simply","cb","data","props",script.trim()+"\nreturn simply_"+name.replace(/-/g,"_")+"; //@ sourceURL="+name+".html")}return simply.classCache[name]}},registerComponent:function({template:template,style:style,name:name,script:script,docStr:docStr,noFile:noFile}){if(!customElements.get(name)){template=simply.replaceEventAttrs(template);var CachedClass=simply.getClass(script,name);class simplyComponent extends HTMLElement{constructor(){super(),this.onParentDataChange=changes=>this.handleParentReact(changes,"data"),this.onParentPropsChange=changes=>this.handleParentReact(changes,"props")}handleParentReact(changes,type){this.react(changes,type,this,this.template)}observeAttrChange(el,callback){var observer=new MutationObserver((function(mutations){const changes=new Map;mutations.forEach((function(mutation){if("attributes"===mutation.type){var newVal=mutation.target.getAttribute(mutation.attributeName);changes.set(mutation.attributeName,newVal)}})),changes.forEach(((value,name)=>{callback(name,value)}))}));return observer.observe(el,{attributes:!0,childList:!1,characterData:!1,subtree:!1,attributeOldValue:!0,characterDataOldValue:!1}),observer}connectedCallback(){performance.now();var{dom:dom,parent:parent,shadow:shadow}=simply.getDomParentAndShadow(this),uid=Math.random().toString(36).slice(2,8),methods={},lifecycle={},props={},cb={},sfcClass={},settings={};const EXCLUDED_KEYS=new Set(["routerSettings","ctx"]);for(const key in this)!EXCLUDED_KEYS.has(key)&&this.hasOwnProperty(key)&&Object.defineProperty(props,key,{enumerable:!0,get:()=>this[key]});Object.assign(this,{component:this,dom:dom,parent:parent,uid:uid,shadow:shadow,template:template,s:style,script:script,props:props,cb:{},elementId:simply.getElementUniqueId(dom),react:simply.react,name:name}),this.setData=function(newValue){data=newValue},this.setCbData=function(newValue){cb.data=newValue},this.setState=function(newValue){state=newValue},this.setCbState=function(newValue){cb.state=newValue},this.setProps=function(newValue){props=newValue},this.setCbProps=function(newValue){cb.props=newValue};const parentState=simply.getParentState(parent);this.state=parentState?parentState.state:{},parentState&&(this.cb.state=parentState.cbState);var{data:data,props:props,state:state}=simply.setupObservableSlims(this);(Object.assign(this,{data:data,props:props,state:state}),ObservableSlim.pause(data),ObservableSlim.pause(props),ObservableSlim.pause(state),CachedClass)&&(sfcClass=new(CachedClass(state,methods,lifecycle,this,dom,parent,simply,cb,data,props)),Object.assign(data,sfcClass.data||{}),Object.assign(props,sfcClass.props||{}),Object.assign(methods,sfcClass.methods||{}),Object.assign(lifecycle,sfcClass.lifecycle||{}),Object.assign(settings,sfcClass.settings||{}));Object.assign(this,{sfcClass:sfcClass,settings:settings,lifecycle:lifecycle,methods:methods}),sfcClass.state&&Object.assign(state,sfcClass.state),simply.restoreCache(this),Object.defineProperty(this,"state",{get:function(){return state},set:function(v){state=v}}),Object.defineProperty(this,"parent",{get:function(){return parent},set:function(v){parent=v}});performance.now();var bindings,self=this;this._attrObserver=this.observeAttrChange(this,(function(name,newValue){if(newValue!==simply.prepareAttr(self.props[name])){try{newValue=simply.parseProp(newValue).value}catch(e){}newValue?self.props[name]=newValue:delete self.props[name],void 0!==self.lifecycle&&void 0!==self.lifecycle.whenPropChange&&self.lifecycle.whenPropChange(name,self.props[name],newValue)}})),bindings=simply.components[name].bindingsCache?simply.components[name].bindingsCache:simply.components[name].bindingsCache=function(template){var bindings={};const regex=/((?:parent\??\.))+(?=(data|props)\??[\.\[])/g;let match;for(;null!==(match=regex.exec(template));){const parentPart=match[0],bindType=match[2],index=(parentPart.match(/parent\??\.?/g)||[]).length-1;bindings[index]||(bindings[index]={}),bindings[index][bindType]=!0}return bindings}(template);for(const[index,bind]of Object.entries(bindings)){let current=this.parent,i=0;for(;current&&i<index;)current=current.parent,i++;current?.cb&&(bind.data&¤t.cb.data&&(current.cb.data[this.uid]=this.onParentDataChange),bind.props&¤t.cb.props&&(current.cb.props[this.uid]=this.onParentPropsChange))}setTimeout((()=>{this.lifecycle?.afterConstruct&&this.lifecycle.afterConstruct(),this.render()}),0)}render(){let parsingArgs={template:template,style:style,data:this.data,state:this.state,parent:this.parent,methods:this.methods,props:this.props,component:this.component,dom:this.dom,methods:this.methods,lifecycle:this.lifecycle,name:this.name};var self=this;if(this.rendered){performance.now();void 0!==this.lifecycle&&void 0!==this.lifecycle.beforeRerender&&this.lifecycle.beforeRerender();let compiledTemplate=simply.compile(parsingArgs);performance.now(),parsedStyle=simply.parseStyle(parsingArgs);if(simply.components[name].lastParsedStyle!==parsedStyle){simply.components[name].lastParsedStyle=parsedStyle;performance.now();self.sheet.replaceSync(parsedStyle);performance.now()}render(compiledTemplate,self.dom),void 0!==this.lifecycle&&void 0!==this.lifecycle.afterRerender&&this.lifecycle.afterRerender();performance.now()}else{this.rendered=!0;let compiledTemplate=simply.compile(parsingArgs);performance.now();var parsedStyle=simply.parseStyle(parsingArgs);simply.components[name].lastParsedStyle=parsedStyle;performance.now(),performance.now();if(this.sheet=new CSSStyleSheet,this.shadow){const sheets=this.dom.adoptedStyleSheets;sheets.includes(this.sheet)||sheets.push(this.sheet)}else{document.adoptedStyleSheets=[this.sheet,...document.adoptedStyleSheets];const sheets=document.adoptedStyleSheets;sheets.includes(this.sheet)||sheets.push(this.sheet);performance.now()}this.sheet.replaceSync(parsedStyle),void 0!==this.lifecycle&&void 0!==this.lifecycle.beforeRender&&void 0!==this.lifecycle.beforeRender(parsedTemplate)&&(parsedTemplate=this.lifecycle.beforeRender(parsedTemplate)),void 0!==this.lifecycle&&void 0!==this.lifecycle.beforeFirstRender&&void 0!==this.lifecycle.beforeFirstRender(parsedTemplate)&&(parsedTemplate=this.lifecycle.beforeFirstRender(parsedTemplate));performance.now();render(compiledTemplate,this.dom);performance.now();ObservableSlim.resume(self.data),ObservableSlim.resume(self.state),ObservableSlim.resume(self.props),"about:blank"==document.location.href&&simply.framerStaff(this.dom,name,this.uid,this.component,this.props,this.lifecycle),void 0!==this.lifecycle&&void 0!==this.lifecycle.afterFirstRender&&this.lifecycle.afterFirstRender(),this.renderingDone=!0;var comp=this.component,p=this.props;(comp.routerSettings&&"transition"in comp.routerSettings?comp.routerSettings.transition:simply.routerSettings&&simply.routerSettings.transition)?requestAnimationFrame((()=>{ObservableSlim.pause(p),this.dom.style.transition="none",setTimeout((()=>{comp.style.transition="";var stagger=comp.routerSettings&&"stagger"in comp.routerSettings?comp.routerSettings.stagger:simply.routerSettings&&simply.routerSettings.stagger;stagger&&self.parent?(comp.stagger=stagger+(self.parent.stagger||0),void 0===self.parent.completed?comp.staggerFn=setTimeout((()=>{comp.setAttribute("enter",""),clearTimeout(comp.staggerFn)}),comp.stagger):comp.setAttribute("enter","")):comp.setAttribute("enter",""),ObservableSlim.resume(p)}),0)})):comp.completed=!0}if("cache"in this.props)try{this.component.tagName.toLowerCase()==simply.go.getRouteByPath(simply.lastPath).value.settings.component&&(simply.cache=simply.cache?simply.cache:{},simply.cache[simply.lastPath]=simply.cache[simply.lastPath]?simply.cache[simply.lastPath]:{},simply.cache[simply.lastPath][this.elementId]={data:this.data,props:this.props},this.cache={data:this.data,props:this.props})}catch(e){}void 0!==this.lifecycle&&void 0!==this.lifecycle.afterRender&&this.lifecycle.afterRender()}disconnectedCallback(){window.removeEventListener("message",this.framerPropsListener),this.cb.state&&(this.cb.state[this.uid]=null),this.cb.data&&(this.cb.data[this.uid]=null),this.parent&&this.parent.cb&&(this.parent.cb.data,this.parent.cb.state&&(this.parent.cb.state[this.uid]=null),this.parent.cb.props),this._attrObserver&&(this._attrObserver.disconnect(),this._attrObserver=null),void 0!==this.lifecycle&&void 0!==this.lifecycle.disconnected&&this.lifecycle.disconnected()}}customElements.define(name,simplyComponent)}},setWithoutRender:function(target,props){Object.defineProperties(target,Object.keys(props).reduce(((descriptors,key)=>(descriptors[key]={value:props[key],writable:!0,enumerable:!0,configurable:!0},descriptors)),{}))},findShadowRootOrCustomElement:function(element){let parent=element.parentNode;for(;null!==parent;){if(parent instanceof ShadowRoot)return parent.host;if(!parent.tagName)return;if(parent.tagName.includes("-")&&void 0!==customElements.get(parent.tagName.toLowerCase()))return parent;parent=parent.parentNode}return null},getCompRoot:function(element){const rootNode=element.getRootNode();return rootNode instanceof ShadowRoot?rootNode.host:element},observableSlim:function(){var paths,observables,targets,targetsProxy,dupProxy,_create;window.ObservableSlim=(paths=[],observables=[],targets=[],targetsProxy=[],dupProxy=null,_create=function(target,domDelay,originalObservable,originalPath){var observable=originalObservable||null,path=originalPath||[{target:target,property:""}];paths.push(path),target instanceof Array&&(target.hasOwnProperty("__length")?target.__length=target.length:Object.defineProperty(target,"__length",{enumerable:!1,value:target.length,writable:!0}));var changes=[],_getPath=function(target,property,jsonPointer){for(var fullPath="",lastTarget=null,i=0;i<path.length;i++)lastTarget instanceof Array&&!isNaN(path[i].property)&&(path[i].property=lastTarget.indexOf(path[i].target)),fullPath=fullPath+"."+path[i].property,lastTarget=path[i].target;return fullPath=(fullPath=fullPath+"."+property).substring(2),!0===jsonPointer&&(fullPath="/"+fullPath.replace(/\./g,"/")),fullPath},_notifyObservers=function(numChanges){if(!0!==observable.paused)if("number"==typeof domDelay||!0===domDelay){if(numChanges===changes.length){var changesCopy=changes.slice(0);changes=[];for(var i=0;i<observable.observers.length;i++)observable.observers[i](changesCopy)}}else for(changesCopy=changes.slice(0),changes=[],i=0;i<observable.observers.length;i++)observable.observers[i](changesCopy)},handler={get:function(target,property){if("__getTarget"===property)return target;if("__isProxy"===property)return!0;if("__getParent"===property)return function(i){void 0===i&&(i=1);var parentPath=_getPath(0,"__getParent").split(".");return parentPath.splice(-(i+1),i+1),function(obj,path){return path.split(".").reduce((function(prev,curr){return prev?prev[curr]:void 0}),obj||self)}(observable.parentProxy,parentPath.join("."))};if("__getPath"===property)return _getPath(0,"__getParent").slice(0,-12);var targetProp=target[property];if(target instanceof Date&&targetProp instanceof Function&&null!==targetProp)return targetProp.bind(target);if(targetProp instanceof Object&&null!==targetProp&&target.hasOwnProperty(property)){if(!0===targetProp.__isProxy&&(targetProp=targetProp.__getTarget),targetProp.__targetPosition>-1&&null!==targets[targetProp.__targetPosition])for(var ttp=targetsProxy[targetProp.__targetPosition],i=0,l=ttp.length;i<l;i++)if(observable===ttp[i].observable)return ttp[i].proxy;var newPath=path.slice(0);return newPath.push({target:targetProp,property:property}),_create(targetProp,domDelay,observable,newPath)}return targetProp},deleteProperty:function(target,property){var originalChange=!0;dupProxy===proxy&&(originalChange=!1,dupProxy=null);var previousValue=Object.assign({},target);if(changes.push({type:"delete",target:target,property:property,newValue:null,previousValue:previousValue[property],currentPath:_getPath(0,property),jsonPointer:_getPath(0,property,!0),proxy:proxy}),!0===originalChange){observable.changesPaused||delete target[property];for(var a=0,l=targets.length;a<l&&target!==targets[a];a++);for(var currentTargetProxy=targetsProxy[a]||[],b=currentTargetProxy.length;b--;)currentTargetProxy[b].proxy!==proxy&&(dupProxy=currentTargetProxy[b].proxy,delete currentTargetProxy[b].proxy[property])}return _notifyObservers(changes.length),!0},set:function(target,property,value,receiver){value&&value.__isProxy&&(value=value.__getTarget);var originalChange=!0;dupProxy===proxy&&(originalChange=!1,dupProxy=null);var targetProp=target[property];if(targetProp!==value||!1===originalChange||"length"===property&&target instanceof Array&&target.__length!==value){var foundObservable=!0,typeOfTargetProp=typeof targetProp,type="update";if("undefined"===typeOfTargetProp&&(type="add"),changes.push({type:type,target:target,property:property,newValue:value,previousValue:receiver[property],currentPath:_getPath(0,property),jsonPointer:_getPath(0,property,!0),proxy:proxy}),"length"===property&&target instanceof Array&&target.__length!==value&&(changes[changes.length-1].previousValue=target.__length,target.__length=value),!0===originalChange){observable.changesPaused||(target[property]=value),foundObservable=!1;for(var targetPosition=target.__targetPosition,z=targetsProxy[targetPosition].length;z--;)if(observable===targetsProxy[targetPosition][z].observable&&null!==targets[targetsProxy[targetPosition][z].observable.parentTarget.__targetPosition]){foundObservable=!0;break}if(foundObservable){for(var currentTargetProxy=targetsProxy[targetPosition],b=0,l=currentTargetProxy.length;b<l;b++)currentTargetProxy[b].proxy!==proxy&&(dupProxy=currentTargetProxy[b].proxy,currentTargetProxy[b].proxy[property]=value);setTimeout((function(){if("object"===typeOfTargetProp&&null!==targetProp){for(var keys=Object.keys(target),i=0,l=keys.length;i<l;i++)if(target[keys[i]]===targetProp)return;var stillExists=!1;if(function iterate(target){for(var keys=Object.keys(target),i=0,l=keys.length;i<l;i++){var nestedTarget=target[keys[i]];if(nestedTarget instanceof Object&&null!==nestedTarget&&iterate(nestedTarget),nestedTarget===targetProp)return void(stillExists=!0)}}(target),!0===stillExists)return;!function iterate(obj){for(var keys=Object.keys(obj),i=0,l=keys.length;i<l;i++){var objProp=obj[keys[i]];objProp instanceof Object&&null!==objProp&&iterate(objProp)}var c=-1;for(i=0,l=targets.length;i<l;i++)if(obj===targets[i]){c=i;break}if(c>-1){for(var currentTargetProxy=targetsProxy[c],d=currentTargetProxy.length;d--;)if(observable===currentTargetProxy[d].observable){currentTargetProxy.splice(d,1);break}0==currentTargetProxy.length&&(targets[c]=null)}}(targetProp)}}),1e4)}}foundObservable&&_notifyObservers(changes.length)}return!0}},__targetPosition=target.__targetPosition;__targetPosition>-1||Object.defineProperty(target,"__targetPosition",{value:targets.length,writable:!1,enumerable:!1,configurable:!1});var proxy=new Proxy(target,handler);null===observable&&(observable={parentTarget:target,domDelay:domDelay,parentProxy:proxy,observers:[],paused:!1,path:path,changesPaused:!1},observables.push(observable));var proxyItem={target:target,proxy:proxy,observable:observable};return __targetPosition>-1?(null===targets[__targetPosition]&&(targets[__targetPosition]=target),targetsProxy[__targetPosition].push(proxyItem)):(targets.push(target),targetsProxy.push([proxyItem])),proxy},{create:function(target,domDelay,observer){!0===target.__isProxy&&(target=target.__getTarget);var proxy=_create(target,domDelay);return"function"==typeof observer&&this.observe(proxy,observer),function iterate(proxy){for(var target=proxy.__getTarget,keys=Object.keys(target),i=0,l=keys.length;i<l;i++){var property=keys[i];target[property]instanceof Object&&null!==target[property]&&iterate(proxy[property])}}(proxy),proxy},observe:function(proxy,observer){for(var i=observables.length;i--;)if(observables[i].parentProxy===proxy){observables[i].observers.push(observer);break}},observerRemove:function(proxy,observer){for(var i=observables.length;i--;)if(observables[i].parentProxy===proxy){for(var b=observables[i].observers.length;b--;)if(observables[i].observers[b]===observer){observables[i].observers.splice(b,1);break}break}},pause:function(proxy){for(var i=observables.length,foundMatch=!1;i--;)if(observables[i].parentProxy===proxy){observables[i].paused=!0,foundMatch=!0;break}if(0==foundMatch)throw new Error("ObseravableSlim could not pause observable -- matching proxy not found.")},resume:function(proxy){for(var i=observables.length,foundMatch=!1;i--;)if(observables[i].parentProxy===proxy){observables[i].paused=!1,foundMatch=!0;break}if(0==foundMatch)throw new Error("ObseravableSlim could not resume observable -- matching proxy not found.")},pauseChanges:function(proxy){for(var i=observables.length,foundMatch=!1;i--;)if(observables[i].parentProxy===proxy){observables[i].changesPaused=!0,foundMatch=!0;break}if(0==foundMatch)throw new Error("ObseravableSlim could not pause changes on observable -- matching proxy not found.")},resumeChanges:function(proxy){for(var i=observables.length,foundMatch=!1;i--;)if(observables[i].parentProxy===proxy){observables[i].changesPaused=!1,foundMatch=!0;break}if(0==foundMatch)throw new Error("ObseravableSlim could not resume changes on observable -- matching proxy not found.")},remove:function(proxy){for(var matchedObservable=null,foundMatch=!1,c=observables.length;c--;)if(observables[c].parentProxy===proxy){matchedObservable=observables[c],foundMatch=!0;break}for(var a=targetsProxy.length;a--;)for(var b=targetsProxy[a].length;b--;)targetsProxy[a][b].observable===matchedObservable&&(targetsProxy[a].splice(b,1),0===targetsProxy[a].length&&(targets[a]=null));!0===foundMatch&&observables.splice(c,1)}});try{module.exports=ObservableSlim}catch(err){}},findParentWithState:function(element){let parent=element.parentElement;for(;parent;){const rootNode=parent.getRootNode?parent.getRootNode().host:null;if(parent=rootNode||parent.parentElement,parent&&parent.state)return parent}return null},getFirstCustomElementParent(el){for(;el;){const parent=el.parentElement||el.getRootNode&&el.getRootNode().host;if(!parent)break;if(parent.tagName&&parent.tagName.includes("-"))return parent;el=parent}return null},go:function(){"use strict";var isarray=Array.isArray||function(arr){return"[object Array]"==Object.prototype.toString.call(arr)},pathToRegexp_1=pathToRegexp,parse_1=parse,compile_1=function(str){return tokensToFunction(parse(str))},tokensToFunction_1=tokensToFunction,tokensToRegExp_1=tokensToRegExp,PATH_REGEXP=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^()])+)\\))?|\\(((?:\\\\.|[^()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function parse(str){for(var res,tokens=[],key=0,index=0,path="";null!=(res=PATH_REGEXP.exec(str));){var m=res[0],escaped=res[1],offset=res.index;if(path+=str.slice(index,offset),index=offset+m.length,escaped)path+=escaped[1];else{path&&(tokens.push(path),path="");var prefix=res[2],name=res[3],capture=res[4],group=res[5],suffix=res[6],asterisk=res[7],repeat="+"===suffix||"*"===suffix,optional="?"===suffix||"*"===suffix,delimiter=prefix||"/",pattern=capture||group||(asterisk?".*":"[^"+delimiter+"]+?");tokens.push({name:name||key++,prefix:prefix||"",delimiter:delimiter,optional:optional,repeat:repeat,pattern:escapeGroup(pattern)})}}return index<str.length&&(path+=str.substr(index)),path&&tokens.push(path),tokens}function tokensToFunction(tokens){for(var matches=new Array(tokens.length),i=0;i<tokens.length;i++)"object"==typeof tokens[i]&&(matches[i]=new RegExp("^"+tokens[i].pattern+"$"));return function(obj){for(var path="",data=obj||{},i=0;i<tokens.length;i++){var token=tokens[i];if("string"!=typeof token){var segment,value=data[token.name];if(null==value){if(token.optional)continue;throw new TypeError('Expected "'+token.name+'" to be defined')}if(isarray(value)){if(!token.repeat)throw new TypeError('Expected "'+token.name+'" to not repeat, but received "'+value+'"');if(0===value.length){if(token.optional)continue;throw new TypeError('Expected "'+token.name+'" to not be empty')}for(var j=0;j<value.length;j++){if(segment=encodeURIComponent(value[j]),!matches[i].test(segment))throw new TypeError('Expected all "'+token.name+'" to match "'+token.pattern+'", but received "'+segment+'"');path+=(0===j?token.prefix:token.delimiter)+segment}}else{if(segment=encodeURIComponent(value),!matches[i].test(segment))throw new TypeError('Expected "'+token.name+'" to match "'+token.pattern+'", but received "'+segment+'"');path+=token.prefix+segment}}else path+=token}return path}}function escapeString(str){return str.replace(/([.+*?=^!:${}()[\]|\/])/g,"\\$1")}function escapeGroup(group){return group.replace(/([=!:$\/()])/g,"\\$1")}function attachKeys(re,keys){return re.keys=keys,re}function flags(options){return options.sensitive?"":"i"}function tokensToRegExp(tokens,options){for(var strict=(options=options||{}).strict,end=!1!==options.end,route="",lastToken=tokens[tokens.length-1],endsWithSlash="string"==typeof lastToken&&/\/$/.test(lastToken),i=0;i<tokens.length;i++){var token=tokens[i];if("string"==typeof token)route+=escapeString(token);else{var prefix=escapeString(token.prefix),capture=token.pattern;token.repeat&&(capture+="(?:"+prefix+capture+")*"),route+=capture=token.optional?prefix?"(?:"+prefix+"("+capture+"))?":"("+capture+")?":prefix+"("+capture+")"}}return strict||(route=(endsWithSlash?route.slice(0,-2):route)+"(?:\\/(?=$))?"),route+=end?"$":strict&&endsWithSlash?"":"(?=\\/|$)",new RegExp("^"+route,flags(options))}function pathToRegexp(path,keys,options){return isarray(keys=keys||[])?options||(options={}):(options=keys,keys=[]),path instanceof RegExp?function(path,keys){var groups=path.source.match(/\((?!\?)/g);if(groups)for(var i=0;i<groups.length;i++)keys.push({name:i,prefix:null,delimiter:null,optional:!1,repeat:!1,pattern:null});return attachKeys(path,keys)}(path,keys):isarray(path)?function(path,keys,options){for(var parts=[],i=0;i<path.length;i++)parts.push(pathToRegexp(path[i],keys,options).source);return attachKeys(new RegExp("(?:"+parts.join("|")+")",flags(options)),keys)}(path,keys,options):function(path,keys,options){for(var tokens=parse(path),re=tokensToRegExp(tokens,options),i=0;i<tokens.length;i++)"string"!=typeof tokens[i]&&keys.push(tokens[i]);return attachKeys(re,keys)}(path,keys,options)}pathToRegexp_1.parse=parse_1,pathToRegexp_1.compile=compile_1,pathToRegexp_1.tokensToFunction=tokensToFunction_1,pathToRegexp_1.tokensToRegExp=tokensToRegExp_1;var loaded,hasDocument="undefined"!=typeof document,hasWindow="undefined"!=typeof window,hasHistory="undefined"!=typeof history,hasProcess="undefined"!=typeof process,clickEvent=hasDocument&&document.ontouchstart?"touchstart":"click",isLocation=hasWindow&&!(!window.history.location&&!window.location);function Page(){this.callbacks=[],this.exits=[],this.current="",this.len=0,this._decodeURLComponents=!0,this._base="",this._strict=!1,this._running=!1,this._hashbang=!1,this.clickHandler=this.clickHandler.bind(this),this._onpopstate=this._onpopstate.bind(this)}function go(path,fn){if("function"==typeof path)return go.call(this,"*",path);async function waitForRenderedAndReturnRoute(el){if(!el)throw new Error("Element not found");return await new Promise((resolve=>{let _rendered=el.rendered;Object.defineProperty(el,"rendered",{configurable:!0,enumerable:!0,get:()=>_rendered,set(value){_rendered=value,value&&resolve(value)}}),_rendered&&resolve(_rendered)})),new Promise((resolve=>{function check(){let routeEl=el.querySelector("route");return routeEl||(el.shadowRoot&&(routeEl=el.shadowRoot.querySelector("route"),routeEl)?routeEl:null)}let found=check();if(found)return resolve(found);const observer=new MutationObserver((()=>{const found=check();found&&(observer.disconnect(),resolve(found))}));observer.observe(el,{childList:!0,subtree:!0})}))}if("object"==typeof fn&&null!==fn&&!Array.isArray(fn)){var settings={...fn},children=fn.children?fn.children:void 0;fn=async function(ctx,next){var route;if(simply.ctx=ctx,settings.child_of){var parentRootEl,lastParentComponent,targetParentRoute,tree=simply.go.getRouteByPath(settings.path).value.tree;for(let i=0;i<tree.length;i++){const path=tree[i],node=simply.routes[path];if(i>0){tree[i-1];parentRootEl=await waitForRenderedAndReturnRoute(parentRootEl.querySelector(lastParentComponent))}else parentRootEl=document.querySelector("route");lastParentComponent=node.settings.component,targetParentRoute=simply.go.getParentRouteByPath(path).value;let directChild=Array.from(parentRootEl.children).find((el=>el.matches(targetParentRoute.settings.component)));if(i!==tree.length-1&&!directChild){let attrs=[];if(1==targetParentRoute.settings.isolated&&attrs.push("shadow"),targetParentRoute.settings.cache&&attrs.push("cache"),window.scrollPositions=window.scrollPositions?window.scrollPositions:{},simply.saveScrollPositions(parentRootEl,tree[i]),parentRootEl.innerHTML=`<${targetParentRoute.settings.component} ${attrs.join(" ")}></${targetParentRoute.settings.component}>`,directChild){var component=directChild;directChild.render()}else directChild=parentRootEl.querySelector(targetParentRoute.settings.component);await waitForRenderedAndReturnRoute(directChild),directChild.routerSettings=node.settings,directChild.ctx=ctx,directChild.lifecycle&&directChild.lifecycle.routerEnter&&directChild.lifecycle.routerEnter(ctx)}}}parentRootEl?(route=parentRootEl,settings=simply.go.getRouteByPath(path).value.settings):route=settings.root?settings.root:document.querySelector("route");let directChild=Array.from(route.children).find((el=>el.matches(settings.component)));if(directChild){component=directChild;directChild.render()}else{let attrs=[];1==settings.isolated&&attrs.push("shadow"),settings.cache&&attrs.push("cache"),simply.lastPath&&(window.scrollPositions=window.scrollPositions?window.scrollPositions:{},simply.saveScrollPositions(route,simply.lastPath)),route.innerHTML=`<${settings.component} ${attrs.join(" ")}></${settings.component}>`;component=route.querySelector(settings.component);ctx.component=component,component.routerSettings=settings,component.ctx=ctx}settings.title&&(document.title=settings.title);var comp=directChild||component;await async function(component){return new Promise((resolve=>{if(!0===component.rendered)return resolve();let _rendered=component.rendered;Object.defineProperty(component,"rendered",{get:()=>_rendered,set(value){_rendered=value,!0===value&&resolve()},configurable:!0})}))}(comp),comp.lifecycle&&comp.lifecycle.routerEnter&&comp.lifecycle.routerEnter(ctx);try{comp.querySelector("route").innerHTML=""}catch(e){}comp.selectLinks=function(){if(simply.ctx){let aTags=[],current=comp;for(;current;)if("function"==typeof current.querySelectorAll&&aTags.push(...current.querySelectorAll("a")),current=current.parent||current.getRootNode&¤t.getRootNode().host||document,current===document){aTags.push(...document.querySelectorAll("a"));break}let currentPath=simply.ctx.path.split("?")[0];aTags.forEach((function(a){let href="/"+a.href.replace(document.querySelector("base").href,"");(href&&!href.startsWith("/")||""==href)&&(href="/"+href),href&&href==decodeURIComponent(currentPath)?a.setAttribute("go-active",!0):a.removeAttribute("go-active");var targetRoute=simply.go.getRouteByPath(simply.ctx.path.split("?")[0]);if(href&&targetRoute.value.tree){let tree=targetRoute.value.tree;if(tree.includes(simply.ctx.routePath)){const index=tree.indexOf(simply.ctx.routePath),parentPaths=-1!==index?tree.slice(0,index):[];let routePathOfLink=simply.go.getRouteByPath(href);(parentPaths.includes(routePathOfLink.key)||parentPaths.includes(href)&&!comp.parent.contains(a))&&a.setAttribute("go-active",!0)}}}))}},setTimeout((()=>{comp.selectLinks()}),0),simply.lastPath=ctx.path},arguments[1]=fn}if("function"==typeof fn){var route=new Route(path,null,this);function registerChildRoutes(children,parentPath=""){if(children)for(const child of children){const fullPath=parentPath+child.path;simply.go.setup([{...child,path:fullPath}],parentPath),child.children&®isterChildRoutes(child.children,fullPath)}}simply.routes=simply.routes?simply.routes:{},simply.routes[route.path]=route,simply.routes[route.path].callbacks=simply.routes[route.path].callback?simply.routes[route.path].callback:[],simply.routes[route.path].settings=settings,simply.routes[route.path].go=this,registerChildRoutes(children,path);for(var i=1;i<arguments.length;++i){const wrappedFn=route.middleware(arguments[i]);this.callbacks.push(wrappedFn),simply.routes[route.path].callbacks.push(wrappedFn);const tree=[];let currentPath=route.path;for(;currentPath&&simply.routes[currentPath];){tree.unshift(currentPath),currentPath=simply.routes[currentPath]&&simply.routes[currentPath].settings&&simply.routes[currentPath].settings.child_of||null}tree.length>1&&(simply.routes[route.path].tree=tree)}}else"string"==typeof path?this["string"==typeof fn?"redirect":"show"](path,fn):this.start(path);return this}function unhandled(ctx){if(!ctx.handled){var window=this._window;(this._hashbang?isLocation&&this._getBase()+window.location.hash.replace("#!",""):isLocation&&window.location.pathname+window.location.search)!==ctx.canonicalPath&&(this.stop(),ctx.handled=!1,isLocation&&(window.location.href=ctx.canonicalPath))}}function Context(path,state,goInstance){var _go=this.go=goInstance||go,window=_go._window,hashbang=_go._hashbang,goBase=_go._getBase();"/"===path[0]&&0!==path.indexOf(goBase)&&(path=goBase+(hashbang?"#!":"")+path);var i=path.indexOf("?");this.canonicalPath=path;var re=new RegExp("^"+goBase.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"));if(this.path=path.replace(re,"")||"/",hashbang&&(this.path=this.path.replace("#!","")||"/"),this.title=hasDocument&&window.document.title,this.state=state||{},this.state.path=path,this.querystring=~i?_go._decodeURLEncodedURIComponent(path.slice(i+1)):"",this.pathname=_go._decodeURLEncodedURIComponent(~i?path.slice(0,i):path),this.params={},this.hash="",!hashbang){if(!~this.path.indexOf("#"))return;var parts=this.path.split("#");this.path=this.pathname=parts[0],this.hash=_go._decodeURLEncodedURIComponent(parts[1])||"",this.querystring=this.querystring.split("#")[0]}}function Route(path,options,go){var _go=this.go=go||globalPage,opts=options||{};opts.strict=opts.strict||_go._strict,this.path="*"===path?"(.*)":path,this.method="GET",this.regexp=pathToRegexp_1(this.path,this.keys=[],opts)}Page.prototype.configure=function(options){var opts=options||{};this._window=opts.window||hasWindow&&window,this._decodeURLComponents=!1!==opts.decodeURLComponents,this._popstate=!1!==opts.popstate&&hasWindow,this._click=!1!==opts.click&&hasDocument,this._hashbang=!!opts.hashbang;var _window=this._window;this._popstate?_window.addEventListener("popstate",this._onpopstate,!1):hasWindow&&_window.removeEventListener("popstate",this._onpopstate,!1),this._click?_window.document.addEventListener(clickEvent,this.clickHandler,!1):hasDocument&&_window.document.removeEventListener(clickEvent,this.clickHandler,!1),this._hashbang&&hasWindow&&!hasHistory?_window.addEventListener("hashchange",this._onpopstate,!1):hasWindow&&_window.removeEventListener("hashchange",this._onpopstate,!1)},Page.prototype.base=function(path){if(0===arguments.length)return this._base;this._base=path},Page.prototype._getBase=function(){var base=this._base;if(base)return base;var loc=hasWindow&&this._window&&this._window.location;return hasWindow&&this._hashbang&&loc&&"file:"===loc.protocol&&(base=loc.pathname),base},Page.prototype.strict=function(enable){if(0===arguments.length)return this._strict;this._strict=enable},Page.prototype.start=function(options){var opts=options||{};if(this.configure(opts),!1!==opts.dispatch){var url;if(this._running=!0,isLocation){var loc=this._window.location;url=this._hashbang&&~loc.hash.indexOf("#!")?loc.hash.substr(2)+loc.search:this._hashbang?loc.search+loc.hash:loc.pathname+loc.search+loc.hash}this.replace(url,null,!0,opts.dispatch)}},Page.prototype.stop=function(){if(this._running){this.current="",this.len=0,this._running=!1;var window=this._window;this._click&&window.document.removeEventListener(clickEvent,this.clickHandler,!1),hasWindow&&window.removeEventListener("popstate",this._onpopstate,!1),hasWindow&&window.removeEventListener("hashchange",this._onpopstate,!1)}},Page.prototype.show=function(path,state,dispatch,push){if(simply.preserveParams&&simply.preserveParams.length>0){const urlParams=new URLSearchParams(window.location.search),filteredParams=new URLSearchParams;for(const[key,value]of urlParams.entries())simply.preserveParams.includes(key)&&filteredParams.append(key,value);const filteredQuery=filteredParams.toString();"string"==typeof path&&!path.includes("?")&&filteredQuery&&(path+="?"+filteredQuery)}var ctx=new Context(path,state,this),prev=this.prevContext;return this.simplyPrevContext={...prev},this.prevContext=ctx,this.current=ctx.path,!1!==dispatch&&this.dispatch(ctx,prev),!1!==ctx.handled&&!1!==push&&ctx.pushState(),ctx},Page.prototype.back=function(path,state){var go=this;if(this.len>0){var window=this._window;hasHistory&&window.history.back(),this.len--}else path?setTimeout((function(){go.show(path,state)})):setTimeout((function(){go.show(go._getBase(),state)}))},Page.prototype.redirect=function(from,to){var inst=this;if(simply.preserveParams&&simply.preserveParams.length>0){const urlParams=new URLSearchParams(window.location.search),filteredParams=new URLSearchParams;for(const[key,value]of urlParams.entries())simply.preserveParams.includes(key)&&filteredParams.append(key,value);const filteredQuery=filteredParams.toString();"string"==typeof to&&!to.includes("?")&&filteredQuery&&(to+="?"+filteredQuery)}"string"==typeof from&&"string"==typeof to&&go.call(this,from,(function(e){setTimeout((function(){inst.replace(to)}),0)})),"string"==typeof from&&void 0===to&&setTimeout((function(){inst.replace(from)}),0)},Page.prototype.replace=function(path,state,init,dispatch){var ctx=new Context(path,state,this),prev=this.prevContext;return this.prevContext=ctx,this.current=ctx.path,ctx.init=init,ctx.save(),!1!==dispatch&&this.dispatch(ctx,prev),ctx},Page.prototype.dispatch=async function(ctx,prev){var i=0,go=this;function nextEnter(){var fn=go.callbacks[i++];if(ctx.path===go.current)return fn?void fn(ctx,nextEnter):unhandled.call(go,ctx);ctx.handled=!1}function getAllElementsOf(comp){const result=[];function walk(el){const tag=el.tagName.toLowerCase();"route"!==tag&&"style"!==tag&&(result.push(el),el.childNodes.forEach((child=>{1===child.nodeType&&walk(child)})),el.shadowRoot&&el.shadowRoot.childNodes.forEach((child=>{1===child.nodeType&&walk(child)})))}return result.push(comp),comp.childNodes.forEach((child=>{1===child.nodeType&&walk(child)})),comp.shadowRoot&&comp.shadowRoot.childNodes.forEach((child=>{1===child.nodeType&&walk(child)})),result}function handleTransition(comp,type,updateContext,delay){clearTimeout(comp.fallbackTimeout),clearTimeout(comp.staggerFn);const run=()=>{comp.activeTransitionController&&comp.activeTransitionController.abort();const controller=new AbortController;comp.activeTransitionController=controller,comp.completed=!1;const onComplete=()=>{controller.signal.aborted?comp.completed=!1:(comp.completed=!0,delete comp.activeTransitionController,clearTimeout(comp.fallbackTimeout),"exit"===type&&comp.remove(),updateContext&&(console.log("Router context updated!"),nextEnter()))};if("enter"===type?comp.setAttribute("enter",""):comp.removeAttribute("enter"),controller.signal.aborted)return void(comp.completed=!1);const transitioningElements=[comp,...getAllElementsOf(comp)].filter((el=>getComputedStyle(el).transitionDuration.split(",").map((s=>parseFloat(s))).some((d=>d>0))));if(0===transitioningElements.length)return void onComplete();let maxDuration=0;for(const el of transitioningElements){const style=getComputedStyle(el),durations=style.transitionDuration.split(",").map((s=>1e3*parseFloat(s))),delays=style.transitionDelay.split(",").map((s=>1e3*parseFloat(s))),maxElDuration=Math.max(...durations.map(((d,i)=>d+(delays[i]||0))));maxDuration=Math.max(maxDuration,maxElDuration)}let remaining=transitioningElements.length;for(const el of transitioningElements){const handler=event=>{event.target===el&&(el.removeEventListener("transitionend",handler),0==--remaining&&onComplete())};el.addEventListener("transitionend",handler,{signal:controller.signal})}"exit"==type&&(comp.fallbackTimeout=setTimeout((()=>{console.log("⚠️ Transition fallback triggered:",comp),onComplete()}),maxDuration+delay))};delay>0?setTimeout(run,delay):run()}if(prev){var to=simply.go.getRouteByPath(go.current),toTree=to.value&&to.value.tree&&to.value.path?[...to.value.tree]:[],contextUpdateFlag=!1;0==toTree.length&&toTree.push(to.value.path),toTree.reverse();const currentRoutes=Array.from(document.querySelectorAll("route")).map((r=>r.firstElementChild)).filter(Boolean).reverse();var enterThose=currentRoutes.filter((r=>toTree.includes(r.routerSettings.path)));const exitThose=currentRoutes.filter((r=>!toTree.includes(r.routerSettings.path)));enterThose.forEach(((comp,index)=>{const inCurrent=currentRoutes.includes(comp),transition=comp.routerSettings&&"transition"in comp.routerSettings?comp.routerSettings.transition:simply.routerSettings&&simply.routerSettings.transition,stagger=inCurrent?0:(comp.routerSettings&&"stagger"in comp.routerSettings?comp.routerSettings.stagger:simply.routerSettings&&simply.routerSettings.stagger)||0;transition&&handleTransition(comp,"enter",!1,index*stagger)})),exitThose.forEach(((comp,index)=>{const transition=comp.routerSettings&&"transition"in comp.routerSettings?comp.routerSettings.transition:simply.routerSettings&&simply.routerSettings.transition;let stagger=comp.routerSettings&&"stagger"in comp.routerSettings?comp.routerSettings.stagger:simply.routerSettings&&simply.routerSettings.stagger||0;comp.completed||(stagger=0),transition?handleTransition(comp,"exit",contextUpdateFlag=index==exitThose.length-1,index*stagger):contextUpdateFlag=!1}));try{const targetComponent=to.value.settings.component;enterThose.some((r=>r.routerSettings.component===targetComponent))}catch(e){var hasComponent=!1}hasComponent||contextUpdateFlag||nextEnter()}else nextEnter()},Page.prototype.exit=function(path,fn){if("function"==typeof path)return this.exit("*",path);var route=new Route(path,null,this);let theRoutePath=simply.go.getRouteByPath(path).value.path;simply.routes[theRoutePath].exits=simply.routes[theRoutePath].exits?simply.routes[theRoutePath].exits:[],simply.go.deleteExitCallbacksByPath(theRoutePath);for(var i=1;i<arguments.length;++i){const wrappedFn=route.middleware(arguments[i]);this.exits.push(wrappedFn),wrappedFn.pureFunc=arguments[i],simply.routes[theRoutePath].exits.push(wrappedFn)}console.log(theRoutePath,"'in exitleri silindi yenisi eklendi")},Page.prototype.clickHandler=function(e){if(1===this._which(e)&&!(e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented)){var el=e.target,eventPath=e.path||(e.composedPath?e.composedPath():null);if(eventPath)for(var i=0;i<eventPath.length;i++)if(eventPath[i].nodeName&&"A"===eventPath[i].nodeName.toUpperCase()&&eventPath[i].href){el=eventPath[i];break}for(;el&&"A"!==el.nodeName.toUpperCase();)el=el.parentNode;if(el&&"A"===el.nodeName.toUpperCase()){var svg="object"==typeof el.href&&"SVGAnimatedString"===el.href.constructor.name;if(!el.hasAttribute("download")&&"external"!==el.getAttribute("rel")){var link=el.getAttribute("href");if((this._hashbang||!this._samePath(el)||!el.hash&&"#"!==link)&&!(link&&link.indexOf("mailto:")>-1)&&!(svg?el.target.baseVal:el.target)&&(svg||this.sameOrigin(el.href))){var path=svg?el.href.baseVal:el.pathname+el.search+(el.hash||"");path="/"!==path[0]?"/"+path:path,hasProcess&&path.match(/^\/[a-zA-Z]:\//)&&(path=path.replace(/^\/[a-zA-Z]:\//,"/"));var orig=path,goBase=this._getBase();if(0===path.indexOf(goBase)&&(path=path.substr(goBase.length)),this.current==path){if(!simply.go.getRouteByPath(path).value.settings.same_go_refresh)return void e.preventDefault()}this._hashbang&&(path=path.replace("#!","")),(!goBase||orig!==path||isLocation&&"file:"===this._window.location.protocol)&&(e.preventDefault(),this.show(orig))}}}}},Page.prototype._onpopstate=(loaded=!1,hasWindow?(hasDocument&&"complete"===document.readyState?loaded=!0:window.addEventListener("load",(function(){setTimeout((function(){loaded=!0}),0)})),function(e){if(loaded)if(e.state){var path=e.state.path;e.state.popstate=!0,this.replace(path,e.state)}else if(isLocation){var loc=this._window.location;this.show(loc.pathname+loc.search+loc.hash,void 0,void 0,!1)}}):function(){}),Page.prototype._which=function(e){return null==(e=e||hasWindow&&this._window.event).which?e.button:e.which},Page.prototype._toURL=function(href){var window=this._window;if("function"==typeof URL&&isLocation)return new URL(href,window.location.toString());if(hasDocument){var anc=window.document.createElement("a");return anc.href=href,anc}},Page.prototype.sameOrigin=function(href){if(!href||!isLocation)return!1;var url=this._toURL(href),loc=this._window.location;return loc.protocol===url.protocol&&loc.hostname===url.hostname&&(loc.port===url.port||""===loc.port&&(80==url.port||443==url.port))},Page.prototype._samePath=function(url){if(!isLocation)return!1;var loc=this._window.location;return url.pathname===loc.pathname&&url.search===loc.search},Page.prototype._decodeURLEncodedURIComponent=function(val){return"string"!=typeof val?val:this._decodeURLComponents?decodeURIComponent(val.replace(/\+/g," ")):val},Context.prototype.pushState=function(){var go=this.go,window=go._window,hashbang=go._hashbang;go.len++,hasHistory&&window.history.pushState(this.state,this.title,hashbang&&"/"!==this.path?"#!"+this.path:this.canonicalPath)},Context.prototype.save=function(){var go=this.go;hasHistory&&go._window.history.replaceState(this.state,this.title,go._hashbang&&"/"!==this.path?"#!"+this.path:this.canonicalPath)},Route.prototype.middleware=function(fn){var self=this;function wrapper(ctx,next){if(self.match(ctx.path,ctx.params,ctx.routePath))return ctx.routePath=self.path,fn(ctx,next);next()}return wrapper.originalFn=fn,wrapper},Route.prototype.findRouteWithPath=function(path){return qsIndex=path.indexOf("?"),pathname=~qsIndex?path.slice(0,qsIndex):path,m=this.regexp.exec(decodeURIComponent(pathname)),m||!1},Route.prototype.match=function(path,params){var keys=this.keys,qsIndex=path.indexOf("?"),pathname=~qsIndex?path.slice(0,qsIndex):path,m=this.regexp.exec(decodeURIComponent(pathname));if(!m)return!1;delete params[0];for(var i=1,len=m.length;i<len;++i){var key=keys[i-1],val=this.go._decodeURLEncodedURIComponent(m[i]);void 0===val&&hasOwnProperty.call(params,key.name)||(params[key.name]=val)}return!0};var globalPage=function createPage(){var goInstance=new Page;function goFn(){return go.apply(goInstance,arguments)}return goFn.callbacks=goInstance.callbacks,goFn.exits=goInstance.exits,goFn.base=goInstance.base.bind(goInstance),goFn.strict=goInstance.strict.bind(goInstance),goFn.start=goInstance.start.bind(goInstance),goFn.stop=goInstance.stop.bind(goInstance),goFn.show=goInstance.show.bind(goInstance),goFn.back=goInstance.back.bind(goInstance),goFn.redirect=goInstance.redirect.bind(goInstance),goFn.replace=goInstance.replace.bind(goInstance),goFn.dispatch=goInstance.dispatch.bind(goInstance),goFn.exit=goInstance.exit.bind(goInstance),goFn.configure=goInstance.configure.bind(goInstance),goFn.sameOrigin=goInstance.sameOrigin.bind(goInstance),goFn.clickHandler=goInstance.clickHandler.bind(goInstance),goFn.create=createPage,goFn.setup=function(a,b){var initialSeup=!1;if(Array.isArray(a)&&b)var routes=a,child_of=b;else if(a&&"object"==typeof a&&!Array.isArray(a)){var settings=a;simply.routerSettings=settings;routes=b,initialSeup=!0}else routes=a,initialSeup=!0;if(simply.routerSettings&&simply.routerSettings.redirects&&simply.routerSettings.redirects.forEach((function(redirect){simply.go.redirect(redirect.from,redirect.to)})),initialSeup){function parse(ctx,next){setTimeout((()=>{ctx.query=simply.qs.parse(location.search.slice(1))}),0),next()}simply.go("*",parse)}routes.forEach((function(route){simply.go(route.path,{...route,child_of:child_of},...route.callbacks||[])})),initialSeup&&simply.go()},goFn.preserveParams=function(params){simply.preserveParams||(simply.preserveParams=[]),simply.preserveParams.push(...params)},goFn.getRoutes=function(){return simply.routes},goFn.getCurrentRoute=function(){var current=this.current;for(const[key,value]of Object.entries(simply.routes))if(current.match(value.regexp)&&"(.*)"!==key)return value;return!1},goFn.getRouteByPath=function(path){var found=!1;for(const[key,value]of Object.entries(simply.routes))path.match(value.regexp)&&"(.*)"!==key&&(found={key:key,value:value});return found||!!simply.routes["(.*)"]&&{key:"(.*)",value:simply.routes["(.*)"]}},goFn.getParentRouteByPath=function(path){for(const[key,value]of Object.entries(simply.routes))if(path.match(value.regexp)&&"(.*)"!==key)return{key:key,value:value};return!!simply.routes["(.*)"]&&{key:"(.*)",value:simply.routes["(.*)"]}},goFn.deleteRouteByPath=function(path){let route=goFn.getRouteByPath(path);route.value.go.callbacks;for(const[key,v]of Object.entries(route.value.callbacks)){const fn=v.originalFn;simply.go.callbacks=simply.go.callbacks.filter((cb=>cb.originalFn!==fn)),route.value.go.callbacks=route.value.go.callbacks.filter((cb=>cb.originalFn!==fn))}simply.routes[route.key].callbacks=[]},goFn.deleteExitCallbacksByPath=function(path){let route=goFn.getRouteByPath(path);for(const[key,v]of Object.entries(route.value.go.exits)){const fn=v.originalFn;simply.go.exits=simply.go.exits.filter((cb=>cb.originalFn!==fn)),route.value.go.exits=route.value.go.exits.filter((cb=>cb.originalFn!==fn))}simply.routes[route.key].exits=[]},Object.defineProperty(goFn,"len",{get:function(){return goInstance.len},set:function(val){goInstance.len=val}}),Object.defineProperty(goFn,"current",{get:function(){return goInstance.current},set:function(val){goInstance.current=val}}),goFn.Context=Context,goFn.Route=Route,goFn}(),go_js=globalPage,default_1=globalPage;return go_js.default=default_1,go_js},getElementUniqueId:function(el){const parts=[];for(;el;){if(el instanceof ShadowRoot){parts.push("shadowroot"),el=el.host;continue}const tag=el.tagName.toLowerCase(),parent=el.parentNode||el.getRootNode().host;if(!parent)break;const index=Array.from(parent.children).indexOf(el);parts.push(`${tag}[${index}]`),el=parent instanceof Element||parent instanceof ShadowRoot?parent:null}return parts.reverse().join(" > ")},saveScrollPositions:function(root,path){const scrollPositions={},route=root.querySelector("route");!function traverse(el){if(el instanceof Element&&!function(el){return route&&(route===el||route.contains(el))}(el)){if(0!==el.scrollLeft||0!==el.scrollTop){const id=simply.getElementUniqueId(el);scrollPositions[id]={x:el.scrollLeft,y:el.scrollTop}}if(el.shadowRoot)for(const child of el.shadowRoot.children)traverse(child);for(const child of el.children)traverse(child)}}(root),window.scrollPositions[path]=scrollPositions},qs:function(){var toString=Object.prototype.toString,isint=/^[0-9]+$/;function promote(parent,key){if(0==parent[key].length)return parent[key]={};var t={};for(var i in parent[key])t[i]=parent[key][i];return parent[key]=t,t}function parse(parts,parent,key,val){var part=parts.shift();if(part){var obj=parent[key]=parent[key]||[];"]"===part?Array.isArray(obj)?""!==val&&obj.push(val):"object"==typeof obj?obj[Object.keys(obj).length]=val:obj=parent[key]=[parent[key],val]:-1!==part.indexOf("]")?(part=part.substr(0,part.length-1),!isint.test(part)&&Array.isArray(obj)&&(obj=promote(parent,key)),parse(parts,obj,part,val)):(!isint.test(part)&&Array.isArray(obj)&&(obj=promote(parent,key)),parse(parts,obj,part,val))}else Array.isArray(parent[key])?parent[key].push(val):"object"==typeof parent[key]||void 0===parent[key]?parent[key]=val:parent[key]=[parent[key],val]}function merge(parent,key,val){if(~key.indexOf("]")){parse(key.split("["),parent,"base",val)}else{if(!isint.test(key)&&Array.isArray(parent.base)){var t={};for(var k in parent.base)t[k]=parent.base[k];parent.base=t}!function(obj,key,val){var v=obj[key];void 0===v?obj[key]=val:Array.isArray(v)?v.push(val):obj[key]=[v,val]}(parent.base,key,val)}return parent}function stringify(obj,prefix){return Array.isArray(obj)?function(arr,prefix){var ret=[];if(!prefix)throw new TypeError("stringify expects an object");for(var i=0;i<arr.length;i++)ret.push(stringify(arr[i],prefix+"["+i+"]"));return ret.join("&")}(obj,prefix):"[object Object]"===toString.call(obj)?function(obj,prefix){for(var key,ret=[],keys=Object.keys(obj),i=0,len=keys.length;i<len;++i)key=keys[i],ret.push(stringify(obj[key],prefix?prefix+"["+encodeURIComponent(key)+"]":encodeURIComponent(key)));return ret.join("&")}(obj,prefix):"string"==typeof obj?function(str,prefix){if(!prefix)throw new TypeError("stringify expects an object");return prefix+"="+encodeURIComponent(str)}(obj,prefix):prefix+"="+obj}return{parse:function(str){return null==str||""===str?{}:"object"==typeof str?(obj=str,ret={base:{}},Object.keys(obj).forEach((function(name){merge(ret,name,obj[name])})),ret.base):function(str){return String(str).split("&").reduce((function(ret,pair){try{pair=decodeURIComponent(pair.replace(/\+/g," "))}catch(e){}var eql=pair.indexOf("="),brace=function(str){for(var brace,c,len=str.length,i=0;i<len;++i)if("]"===(c=str[i])&&(brace=!1),"["===c&&(brace=!0),"="===c&&!brace)return i}(pair),key=pair.substr(0,brace||eql),val=pair.substr(brace||eql);return val=val.substr(val.indexOf("=")+1),""===key&&(key=pair,val=""),merge(ret,key,val)}),{base:{}}).base}(str);var obj,ret},stringify:stringify}}(),initGo:function(a,b){simply.go=simply.go(),simply.go.configure({window:window});var base=document.querySelector("base[href]");if(base){var base_href=base.getAttribute("href").replace(/\/$/,"");simply.go.base(base_href)}},unsafeHTML:function(htmlString){return document.createRange().createContextualFragment(htmlString)},lit:function(){window.LitCore=(()=>{var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,lit_umd_entry_exports={};((target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})})(lit_umd_entry_exports,{guard:()=>i4,html:()=>b,nothing:()=>A,render:()=>D,repeat:()=>c2});var t=globalThis,s=t.trustedTypes,e=s?s.createPolicy("lit-html",{createHTML:t4=>t4}):void 0,h="$lit$",o=`lit$${Math.random().toFixed(9).slice(2)}$`,n="?"+o,r=`<${n}>`,l=document,c=()=>l.createComment(""),a=t4=>null===t4||"object"!=typeof t4&&"function"!=typeof t4,u=Array.isArray,d=t4=>u(t4)||"function"==typeof t4?.[Symbol.iterator],f="[ \t\n\f\r]",v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m=/>/g,p=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\t\t\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,x=t4=>(i5,...s3)=>({_$litType$:t4,strings:i5,values:s3}),b=x(1),E=(x(2),x(3),Symbol.for("lit-noChange")),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t4,i5){if(!u(t4)||!t4.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e?e.createHTML(i5):i5}var N=(t4,i5)=>{const s3=t4.length-1,e4=[];let n2,l2=2===i5?"<svg>":3===i5?"<math>":"",c3=v;for(let i6=0;i6<s3;i6++){const s4=t4[i6];let a2,u4,d2=-1,f2=0;for(;f2<s4.length&&(c3.lastIndex=f2,u4=c3.exec(s4),null!==u4);)f2=c3.lastIndex,c3===v?"!--"===u4[1]?c3=_:void 0!==u4[1]?c3=m:void 0!==u4[2]?(y.test(u4[2])&&(n2=RegExp("</"+u4[2],"g")),c3=p):void 0!==u4[3]&&(c3=p):c3===p?">"===u4[0]?(c3=n2??v,d2=-1):void 0===u4[1]?d2=-2:(d2=c3.lastIndex-u4[2].length,a2=u4[1],c3=void 0===u4[3]?p:'"'===u4[3]?$:g):c3===$||c3===g?c3=p:c3===_||c3===m?c3=v:(c3=p,n2=void 0);const x2=c3===p&&t4[i6+1].startsWith("/>")?" ":"";l2+=c3===v?s4+r:d2>=0?(e4.push(a2),s4.slice(0,d2)+h+s4.slice(d2)+o+x2):s4+o+(-2===d2?i6:x2)}return[V(t4,l2+(t4[s3]||"<?>")+(2===i5?"</svg>":3===i5?"</math>":"")),e4]},S=class _S{constructor({strings:t4,_$litType$:i5},e4){let r2;this.parts=[];let l2=0,a2=0;const u4=t4.length-1,d2=this.parts,[f2,v3]=N(t4,i5);if(this.el=_S.createElement(f2,e4),P.currentNode=this.el.content,2===i5||3===i5){const t5=this.el.content.firstChild;t5.replaceWith(...t5.childNodes)}for(;null!==(r2=P.nextNode())&&d2.length<u4;){if(1===r2.nodeType){if(r2.hasAttributes())for(const t5 of r2.getAttributeNames())if(t5.endsWith(h)){const i6=v3[a2++],s3=r2.getAttribute(t5).split(o),e5=/([.?@])?(.*)/.exec(i6);d2.push({type:1,index:l2,name:e5[2],strings:s3,ctor:"."===e5[1]?I:"?"===e5[1]?L:"@"===e5[1]?z:H}),r2.removeAttribute(t5)}else t5.startsWith(o)&&(d2.push({type:6,index:l2}),r2.removeAttribute(t5));if(y.test(r2.tagName)){const t5=r2.textContent.split(o),i6=t5.length-1;if(i6>0){r2.textContent=s?s.emptyScript:"";for(let s3=0;s3<i6;s3++)r2.append(t5[s3],c()),P.nextNode(),d2.push({type:2,index:++l2});r2.append(t5[i6],c())}}}else if(8===r2.nodeType)if(r2.data===n)d2.push({type:2,index:l2});else{let t5=-1;for(;-1!==(t5=r2.data.indexOf(o,t5+1));)d2.push({type:7,index:l2}),t5+=o.length-1}l2++}}static createElement(t4,i5){const s3=l.createElement("template");return s3.innerHTML=t4,s3}};function M(t4,i5,s3=t4,e4){if(i5===E)return i5;let h3=void 0!==e4?s3._$Co?.[e4]:s3._$Cl;const o2=a(i5)?void 0:i5._$litDirective$;return h3?.constructor!==o2&&(h3?._$AO?.(!1),void 0===o2?h3=void 0:(h3=new o2(t4),h3._$AT(t4,s3,e4)),void 0!==e4?(s3._$Co??=[])[e4]=h3:s3._$Cl=h3),void 0!==h3&&(i5=M(t4,h3._$AS(t4,i5.values),h3,e4)),i5}var R=class{constructor(t4,i5){this._$AV=[],this._$AN=void 0,this._$AD=t4,this._$AM=i5}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t4){const{el:{content:i5},parts:s3}=this._$AD,e4=(t4?.creationScope??l).importNode(i5,!0);P.currentNode=e4;let h3=P.nextNode(),o2=0,n2=0,r2=s3[0];for(;void 0!==r2;){if(o2===r2.index){let i6;2===r2.type?i6=new k(h3,h3.nextSibling,this,t4):1===r2.type?i6=new r2.ctor(h3,r2.name,r2.strings,this,t4):6===r2.type&&(i6=new Z(h3,this,t4)),this._$AV.push(i6),r2=s3[++n2]}o2!==r2?.index&&(h3=P.nextNode(),o2++)}return P.currentNode=l,e4}p(t4){let i5=0;for(const s3 of this._$AV)void 0!==s3&&(void 0!==s3.strings?(s3._$AI(t4,s3,i5),i5+=s3.strings.length-2):s3._$AI(t4[i5])),i5++}},k=class _k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t4,i5,s3,e4){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t4,this._$AB=i5,this._$AM=s3,this.options=e4,this._$Cv=e4?.isConnected??!0}get parentNode(){let t4=this._$AA.parentNode;const i5=this._$AM;return void 0!==i5&&11===t4?.nodeType&&(t4=i5.parentNode),t4}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t4,i5=this){t4=M(this,t4,i5),a(t4)?t4===A||null==t4||""===t4?(this._$AH!==A&&this._$AR(),this._$AH=A):t4!==this._$AH&&t4!==E&&this._(t4):void 0!==t4._$litType$?this.$(t4):void 0!==t4.nodeType?this.T(t4):d(t4)?this.k(t4):this._(t4)}O(t4){return this._$AA.parentNode.insertBefore(t4,this._$AB)}T(t4){this._$AH!==t4&&(this._$AR(),this._$AH=this.O(t4))}_(t4){this._$AH!==A&&a(this._$AH)?this._$AA.nextSibling.data=t4:this.T(l.createTextNode(t4)),this._$AH=t4}$(t4){const{values:i5,_$litType$:s3}=t4,e4="number"==typeof s3?this._$AC(t4):(void 0===s3.el&&(s3.el=S.createElement(V(s3.h,s3.h[0]),this.options)),s3);if(this._$AH?._$AD===e4)this._$AH.p(i5);else{const t5=new R(e4,this),s4=t5.u(this.options);t5.p(i5),this.T(s4),this._$AH=t5}}_$AC(t4){let i5=C.get(t4.strings);return void 0===i5&&C.set(t4.strings,i5=new S(t4)),i5}k(t4){u(this._$AH)||(this._$AH=[],this._$AR());const i5=this._$AH;let s3,e4=0;for(const h3 of t4)e4===i5.length?i5.push(s3=new _k(this.O(c()),this.O(c()),this,this.options)):s3=i5[e4],s3._$AI(h3),e4++;e4<i5.length&&(this._$AR(s3&&s3._$AB.nextSibling,e4),i5.length=e4)}_$AR(t4=this._$AA.nextSibling,s3){for(this._$AP?.(!1,!0,s3);t4!==this._$AB;){const s4=t4.nextSibling;t4.remove(),t4=s4}}setConnected(t4){void 0===this._$AM&&(this._$Cv=t4,this._$AP?.(t4))}},H=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t4,i5,s3,e4,h3){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t4,this.name=i5,this._$AM=e4,this.options=h3,s3.length>2||""!==s3[0]||""!==s3[1]?(this._$AH=Array(s3.length-1).fill(new String),this.strings=s3):this._$AH=A}_$AI(t4,i5=this,s3,e4){const h3=this.strings;let o2=!1;if(void 0===h3)t4=M(this,t4,i5,0),o2=!a(t4)||t4!==this._$AH&&t4!==E,o2&&(this._$AH=t4);else{const e5=t4;let n2,r2;for(t4=h3[0],n2=0;n2<h3.length-1;n2++)r2=M(this,e5[s3+n2],i5,n2),r2===E&&(r2=this._$AH[n2]),o2||=!a(r2)||r2!==this._$AH[n2],r2===A?t4=A:t4!==A&&(t4+=(r2??"")+h3[n2+1]),this._$AH[n2]=r2}o2&&!e4&&this.j(t4)}j(t4){t4===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t4??"")}},I=class extends H{constructor(){super(...arguments),this.type=3}j(t4){this.element[this.name]=t4===A?void 0:t4}},L=class extends H{constructor(){super(...arguments),this.type=4}j(t4){this.element.toggleAttribute(this.name,!!t4&&t4!==A)}},z=class extends H{constructor(t4,i5,s3,e4,h3){super(t4,i5,s3,e4,h3),this.type=5}_$AI(t4,i5=this){if((t4=M(this,t4,i5,0)??A)===E)return;const s3=this._$AH,e4=t4===A&&s3!==A||t4.capture!==s3.capture||t4.once!==s3.once||t4.passive!==s3.passive,h3=t4!==A&&(s3===A||e4);e4&&this.element.removeEventListener(this.name,this,s3),h3&&this.element.addEventListener(this.name,this,t4),this._$AH=t4}handleEvent(t4){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t4):this._$AH.handleEvent(t4)}},Z=class{constructor(t4,i5,s3){this.element=t4,this.type=6,this._$AN=void 0,this._$AM=i5,this.options=s3}get _$AU(){return this._$AM._$AU}_$AI(t4){M(this,t4)}},j={M:h,P:o,A:n,C:1,L:N,R:R,D:d,V:M,I:k,H:H,N:L,U:z,B:I,F:Z},B=t.litHtmlPolyfillSupport;B?.(S,k),(t.litHtmlVersions??=[]).push("3.3.2");var mod,D=(t4,i5,s3)=>{const e4=s3?.renderBefore??i5;let h3=e4._$litPart$;if(void 0===h3){const t5=s3?.renderBefore??null;e4._$litPart$=h3=new k(i5.insertBefore(c(),t5),t5,void 0,s3??{})}return h3._$AI(t4),h3},t2_CHILD=2,e2=t4=>(...e4)=>({_$litDirective$:t4,values:e4}),i2=class{constructor(t4){}get _$AU(){return this._$AM._$AU}_$AT(t4,e4,i5){this._$Ct=t4,this._$AM=e4,this._$Ci=i5}_$AS(t4,e4){return this.update(t4,e4)}update(t4,e4){return this.render(...e4)}},{I:t3}=j,s2=()=>document.createComment(""),v2=(o2,n2,e4)=>{const l2=o2._$AA.parentNode,d2=void 0===n2?o2._$AB:n2._$AA;if(void 0===e4){const i5=l2.insertBefore(s2(),d2),n3=l2.insertBefore(s2(),d2);e4=new t3(i5,n3,o2,o2.options)}else{const t4=e4._$AB.nextSibling,n3=e4._$AM,c3=n3!==o2;if(c3){let t5;e4._$AQ?.(o2),e4._$AM=o2,void 0!==e4._$AP&&(t5=o2._$AU)!==n3._$AU&&e4._$AP(t5)}if(t4!==d2||c3){let o3=e4._$AA;for(;o3!==t4;){const t5=o3.nextSibling;l2.insertBefore(o3,d2),o3=t5}}}return e4},u2=(o2,t4,i5=o2)=>(o2._$AI(t4,i5),o2),m2={},h2=o2=>{o2._$AR(),o2._$AA.remove()},u3=(e4,s3,t4)=>{const r2=new Map;for(let l2=s3;l2<=t4;l2++)r2.set(e4[l2],l2);return r2},c2=e2(class extends i2{constructor(e4){if(super(e4),e4.type!==t2_CHILD)throw Error("repeat() can only be used in text expressions")}dt(e4,s3,t4){let r2;void 0===t4?t4=s3:void 0!==s3&&(r2=s3);const l2=[],o2=[];let i5=0;for(const s4 of e4)l2[i5]=r2?r2(s4,i5):i5,o2[i5]=t4(s4,i5),i5++;return{values:o2,keys:l2}}render(e4,s3,t4){return this.dt(e4,s3,t4).values}update(s3,[t4,r2,c3]){const d2=s3._$AH,{values:p3,keys:a2}=this.dt(t4,r2,c3);if(!Array.isArray(d2))return this.ut=a2,p3;const h3=this.ut??=[],v3=[];let m3,y2,x2=0,j2=d2.length-1,k2=0,w2=p3.length-1;for(;x2<=j2&&k2<=w2;)if(null===d2[x2])x2++;else if(null===d2[j2])j2--;else if(h3[x2]===a2[k2])v3[k2]=u2(d2[x2],p3[k2]),x2++,k2++;else if(h3[j2]===a2[w2])v3[w2]=u2(d2[j2],p3[w2]),j2--,w2--;else if(h3[x2]===a2[w2])v3[w2]=u2(d2[x2],p3[w2]),v2(s3,v3[w2+1],d2[x2]),x2++,w2--;else if(h3[j2]===a2[k2])v3[k2]=u2(d2[j2],p3[k2]),v2(s3,d2[x2],d2[j2]),j2--,k2++;else if(void 0===m3&&(m3=u3(a2,k2,w2),y2=u3(h3,x2,j2)),m3.has(h3[x2]))if(m3.has(h3[j2])){const e4=y2.get(a2[k2]),t5=void 0!==e4?d2[e4]:null;if(null===t5){const e5=v2(s3,d2[x2]);u2(e5,p3[k2]),v3[k2]=e5}else v3[k2]=u2(t5,p3[k2]),v2(s3,d2[x2],t5),d2[e4]=null;k2++}else h2(d2[j2]),j2--;else h2(d2[x2]),x2++;for(;k2<=w2;){const e4=v2(s3,v3[w2+1]);u2(e4,p3[k2]),v3[k2++]=e4}for(;x2<=j2;){const e4=d2[x2++];null!==e4&&h2(e4)}return this.ut=a2,((o2,t4=m2)=>{o2._$AH=t4})(s3,v3),E}}),e3={},i4=e2(class extends i2{constructor(){super(...arguments),this.ot=e3}render(r2,t4){return t4()}update(t4,[s3,e4]){if(Array.isArray(s3)){if(Array.isArray(this.ot)&&this.ot.length===s3.length&&s3.every(((r2,t5)=>r2===this.ot[t5])))return E}else if(this.ot===s3)return E;return this.ot=Array.isArray(s3)?Array.from(s3):s3,this.render(s3,e4)}});return mod=lit_umd_entry_exports,((to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to})(__defProp({},"__esModule",{value:!0}),mod)})(),Object.assign(window,LitCore)},init:function(){this.lit(),this.observableSlim(),simply.initGo(),window.get=this.get}},simply.init();