rasti 4.1.4 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rasti.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Rasti={})}(this,function(t){"use strict";function e(t){if("function"!=typeof t){throw new TypeError("Event listener must be a function")}}class s{on(t,s){return e(s),this.listeners||(this.listeners={}),this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(s),()=>this.off(t,s)}once(t,s){e(s);const i=(...e)=>{s(...e),this.off(t,i)};return this.on(t,i)}off(t,e){this.listeners&&(t?this.listeners[t]&&(e?(this.listeners[t]=this.listeners[t].filter(t=>t!==e),this.listeners[t].length||delete this.listeners[t]):delete this.listeners[t],Object.keys(this.listeners).length||delete this.listeners):delete this.listeners)}emit(t,...e){this.listeners&&this.listeners[t]&&this.listeners[t].slice().forEach(t=>t(...e))}listenTo(t,e,s){return t.on(e,s),this.listeningTo||(this.listeningTo=[]),this.listeningTo.push({emitter:t,type:e,listener:s}),()=>this.stopListening(t,e,s)}listenToOnce(t,s,i){e(i);const n=(...e)=>{i(...e),this.stopListening(t,s,n)};return this.listenTo(t,s,n)}stopListening(t,e,s){this.listeningTo&&(this.listeningTo=this.listeningTo.filter(i=>!(!t||t===i.emitter&&!e||t===i.emitter&&e===i.type&&!s||t===i.emitter&&e===i.type&&s===i.listener)||(i.emitter.off(i.type,i.listener),!1)),this.listeningTo.length||delete this.listeningTo)}}const i=(t,e,...s)=>"function"!=typeof t?t:t.apply(e,s);class n extends s{constructor(){super(),this.preinitialize.apply(this,arguments),this.attributes=Object.assign({},i(this.defaults,this),this.parse.apply(this,arguments)),this.previous={},Object.keys(this.attributes).forEach(this.defineAttribute.bind(this))}preinitialize(){}defineAttribute(t){Object.defineProperty(this,`${this.constructor.attributePrefix}${t}`,{get:()=>this.get(t),set:e=>{this.set(t,e)}})}get(t){return this.attributes[t]}set(t,e,...s){let i,n;"object"==typeof t?(i=t,n=[e,...s]):(i={[t]:e},n=s);const r=this._changing;this._changing=!0;const o={};r||(this.previous=Object.assign({},this.attributes)),Object.keys(i).forEach(t=>{i[t]!==this.attributes[t]&&(o[t]=i[t],this.attributes[t]=i[t])});const h=Object.keys(o);if(h.length&&(this._pending=["change",this,o,...n]),h.forEach(t=>{this.emit(`change:${t}`,this,i[t],...n)}),r)return this;for(;this._pending;){const t=this._pending;this._pending=null,this.emit.apply(this,t)}return this._pending=null,this._changing=!1,this}parse(t){return t}toJSON(){return Object.assign({},this.attributes)}}n.attributePrefix="";const r=(t,e,s)=>Object.defineProperty(t,e,{value:s,writable:!0,enumerable:!0,configurable:!0}),o=["el","tag","attributes","events","model","template","onDestroy"];class h extends s{constructor(t={}){super(),this.preinitialize.apply(this,arguments),this.delegatedEventListeners=[],this.children=[],this.destroyQueue=[],this.viewOptions=[],o.forEach(e=>{e in t&&(r(this,e,t[e]),this.viewOptions.push(e))}),this.ensureUid(),this.ensureElement()}preinitialize(){}$(t){return this.el.querySelector(t)}$$(t){return this.el.querySelectorAll(t)}destroy(){return this.destroyChildren(),this.undelegateEvents(),this.stopListening(),this.off(),this.destroyQueue.forEach(t=>t()),this.destroyQueue=[],this.onDestroy.apply(this,arguments),this.destroyed=!0,this}onDestroy(){}addChild(t){return this.children.push(t),t}destroyChildren(){this.children.forEach(t=>t.destroy()),this.children=[]}ensureUid(){this.uid||(this.uid="r"+ ++h.uid)}ensureElement(){if(this.el)this.el=i(this.el,this);else{const t=i(this.tag,this),e=i(this.attributes,this);this.el=this.createElement(t,e)}this.delegateEvents()}createElement(t="div",e={}){let s=document.createElement(t);return Object.keys(e).forEach(t=>s.setAttribute(t,e[t])),s}removeElement(){return this.el.parentNode.removeChild(this.el),this}delegateEvents(t){if(t||(t=i(this.events,this)),!t)return this;this.delegatedEventListeners.length&&this.undelegateEvents();const s={};return Object.keys(t).forEach(i=>{const n=i.match(/^(\w+)(?:\s+(.+))*$/);if(!n){throw new Error(`Invalid event format: ${i}`)}const[,r,o]=n;let h=t[i];"string"==typeof h&&(h=this[h]),e(h),s[r]||(s[r]=[]),s[r].push([o,h])}),Object.keys(s).forEach(t=>{const e=e=>{let i=e.target;for(;i;)i.matches&&s[t].forEach(([t,s])=>{(i===this.el&&!t||i!==this.el&&i.matches(t))&&s.call(this,e,this,i)}),i=i===this.el||e.cancelBubble?null:i.parentElement};this.delegatedEventListeners.push([t,e]),this.el.addEventListener(t,e)}),this}undelegateEvents(){return this.delegatedEventListeners.forEach(([t,e])=>{this.el.removeEventListener(t,e)}),this.delegatedEventListeners=[],this}render(){return this}static sanitize(t){return`${t}`.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"}[t]))}static resetUid(){h.uid=0}}h.uid=0;class a{constructor(t){this.value=t}toString(){return this.value}}class l{constructor(t){this.items=t}}class c{constructor(){this.listeners=[],this.types=new Set,this.previousSize=0}addListener(t,e){return this.types.add(e),this.listeners.push(t),this.listeners.length-1}reset(){this.listeners=[],this.previousSize=this.types.size}hasPendingTypes(){return this.types.size>this.previousSize}}const u=["value","checked","selected"];let d=class{constructor(t){this.getSelector=t.getSelector,this.getAttributes=t.getAttributes,this.previousAttributes={}}hydrate(t){this.ref=t.querySelector(this.getSelector())}update(){const t=this.getAttributes(),{remove:e,add:s}=function(t,e={}){const s={},i=[];return Object.keys(t).forEach(i=>{let n=t[i];n!==e[i]&&(!0===n?s[i]="":!1!==n&&(null==n&&(n=""),s[i]=n))}),Object.keys(e).forEach(s=>{(!(s in t)||e[s]!==t[s]&&!1===t[s])&&i.push(s)}),{add:s,remove:i}}(t,this.previousAttributes);this.previousAttributes=t,e.forEach(t=>{this.ref.removeAttribute(t),-1!==u.indexOf(t)&&t in this.ref&&(this.ref[t]="value"===t&&"")}),Object.keys(s).forEach(t=>{const e=s[t];this.ref.setAttribute(t,e),-1!==u.indexOf(t)&&t in this.ref&&(this.ref[t]="value"===t?e:!1!==e&&"false"!==e)})}};class p{constructor(){}reset(){this.paused=0,this.previous=this.tracked||new Map,this.tracked=new Map,this.positionStack=[0]}push(){this.positionStack.push(0)}pop(){this.positionStack.pop()}increment(){this.positionStack[this.positionStack.length-1]++}pause(){this.paused++}resume(){this.paused--}getPath(){return this.positionStack.join("-")}track(t){return 0===this.paused&&this.tracked.set(this.getPath(),t),t}hasSingleComponent(){if(1!==this.tracked.size||1!==this.previous.size)return!1;const[t,e]=this.tracked.entries().next().value,[s,i]=this.previous.entries().next().value;return"0"===t&&"0"===s&&e===i}findRecyclable(t){const e=this.previous.get(this.getPath());return e&&!e.key&&e.constructor===t.constructor?e:null}}const f=["value","checked","selected"];function E(t,e){t.nodeType===e.nodeType?t.nodeType!==Node.TEXT_NODE?t.tagName===e.tagName?(((t,e)=>{const s=e.attributes,i=t.attributes,n=new Set;for(let e=0,i=s.length;e<i;e++){const{name:i,value:r}=s[e];n.add(i),t.getAttribute(i)!==r&&t.setAttribute(i,r)}for(let e=i.length-1;e>=0;e--){const{name:s}=i[e];n.has(s)||t.removeAttribute(s)}for(let s=0,i=f.length;s<i;s++){const i=f[s];i in t&&t[i]!==e[i]&&(t[i]=e[i])}})(t,e),((t,e)=>{const s=t.childNodes,i=e.childNodes,n=s.length;if(n!==i.length)return!1;for(let t=0;t<n;t++)if(!s[t].isEqualNode(i[t]))return!1;return!0})(t,e)||((t,e)=>{const s=Array.from(e.childNodes);t.replaceChildren(...s)})(t,e)):t.replaceWith(e):t.nodeValue!==e.nodeValue&&(t.nodeValue=e.nodeValue):t.replaceWith(e)}function g(t,e,s=()=>!1,i){let n=i||t.firstChild;for(;n;){if(n.nodeType===Node.COMMENT_NODE&&n.data.trim()===e)return n;if(n.nodeType!==Node.ELEMENT_NODE||s(n)||!n.firstChild){for(;n&&!n.nextSibling;)if(n=n.parentNode,!n||n===t)return null;n&&(n=n.nextSibling)}else n=n.firstChild}return null}class m{constructor(t){this.getStart=t.getStart,this.getEnd=t.getEnd,this.expression=t.expression,this.shouldSkipFind=t.shouldSkipFind,this.shouldSkipSync=t.shouldSkipSync,this.tracker=new p}hydrate(t){const e=g(t,this.getStart(),this.shouldSkipFind),s=g(t,this.getEnd(),this.shouldSkipFind,e);this.ref=[e,s]}update(t,e){let s;const[i,n]=this.ref,r=i.nextSibling,o=r===n,h=!o&&r.nextSibling===n;if(o?n.parentNode.insertBefore(t,n):!h||1!==t.children.length||this.shouldSkipSync(r)||this.shouldSkipSync(t.firstChild)?(s=document.createComment(""),n.parentNode.insertBefore(s,n),n.parentNode.insertBefore(t,n)):E(r,t.firstChild),e(),s){if(this.ref[0].nextSibling===s)s.parentNode.removeChild(s);else{const t=document.createRange();t.setStartAfter(this.ref[0]),t.setEndAfter(s),t.deleteContents()}}}updateElement(t,e,s){const i=document.createComment("");t.parentNode.insertBefore(i,t.nextSibling),i.parentNode.insertBefore(e.firstChild,i.nextSibling),s(),t.nextSibling===i&&t.parentNode.removeChild(t),i.parentNode.removeChild(i)}}const y=t=>t.reduce((t,e)=>(Array.isArray(e)?t.push(...y(e)):t.push(e),t),[]);function b(t){const e=document.createElement("template");return e.innerHTML=`${t}`,e.content}const T=/^[^\s"'>/=\u0000-\u001F\u007F-\u009F]+$/;function v(t){const e=[];return Object.keys(t).forEach(s=>{let i=t[s];T.test(s)&&(!0===i?e.push(s):!1!==i&&(null==i&&(i=""),e.push(`${s}="${(t=>`${t}`.replace(/"/g,"&quot;"))(i)}"`)))}),e.join(" ")}let S,A,R,$;"undefined"!=typeof document&&(S=!!navigator.userAgent.match(/Chrome/),A=!!Element.prototype.moveBefore,R=!A||S,$=A&&S);const C=(t,e,s)=>{try{return"function"!=typeof t?t:t.call(e,e)}catch(t){if(s&&!t._rasti){let s;s=`Error in ${e.constructor.name}#${e.uid} expression`;const i=new Error(s,{cause:t});throw i._rasti=!0,i}throw t}},L=t=>!!(t&&t.dataset&&t.dataset[I.DATASET_ELEMENT]&&t.dataset[I.DATASET_ELEMENT].endsWith("-1")),x=t=>!(!t||!(t.dataset&&t.dataset[I.DATASET_ELEMENT]||t.querySelector&&t.querySelector(`[${I.ATTRIBUTE_ELEMENT}]`))),k=(t,e)=>t.reduce((t,s,i)=>(t.push(s),void 0!==e[i]&&t.push(I.PLACEHOLDER(i)),t),[]).join(""),O=(t,e)=>{const s=I.PLACEHOLDER("(\\d+)"),i=t.match(new RegExp(`^${s}$`));if(i)return[e[parseInt(i[1],10)]];const n=new RegExp(`${s}`,"g"),r=[];let o,h=0;for(;null!==(o=n.exec(t));){const s=t.slice(h,o.index);r.push(I.markAsSafeHTML(s),e[parseInt(o[1],10)]),h=o.index+o[0].length}return r.push(I.markAsSafeHTML(t.slice(h))),r},N=(t,e)=>t.reduce((t,s)=>{const i=e(s[0]);if(1===s.length)"object"==typeof i?t=Object.assign(t,i):"string"==typeof i&&(t[i]=!0);else{const n=s[2]?e(s[1]):s[1];t[i]=n}return t},{}),w=(t,e,s)=>{const i={};return Object.keys(t).forEach(n=>{const r=n.match(/on(([A-Z]{1}[a-z]+)+)/);if(r&&r[1]){const o=r[1].toLowerCase(),h=t[n];if(h){const t=e.addListener(h,o);i[s(o)]=t}}else i[n]=t[n]}),i},M=(t,e,s=!1)=>{const i=I.PLACEHOLDER("(\\d+)"),n=new Map;return s||(t=t.replace(new RegExp(i,"g"),(t,s)=>{const i=e[s];if(i&&i.prototype instanceof I){if(n.has(i))return n.get(i);n.set(i,t)}return t})),t.replace(new RegExp(`<(${i})([^>]*)/>|<(${i})([^>]*)>([\\s\\S]*?)</\\4>`,"g"),(t,s,i,n,r,o,h,a)=>{let c,u,d;if(r?(c=e[o],u=h):(c=void 0!==i?e[i]:s,u=n),!(c.prototype instanceof I))return t;if(r){const t=M(a,e,!0),s=j(t,e);d=O(s,e)}const p=H(u,e);return e.push(function(){const t=N(p,t=>C(t,this,"children options"));return d&&(t.renderChildren=()=>new l(d.map(t=>C(t,this,"children")))),c.mount(t)}),I.PLACEHOLDER(e.length-1)})},_=(t,e)=>{const s=I.PLACEHOLDER("(?:\\d+)");return t.replace(new RegExp(`<(${s}|[a-z]+[1-6]?)(?:\\s*)((?:"[^"]*"|'[^']*'|[^>])*?)(\\s*/?>)`,"gi"),e)},P=(t,e,s)=>{const n=I.PLACEHOLDER("(?:\\d+)");if(t.match(new RegExp(`^\\s*${n}\\s*$`)))return t;const r=t.match(new RegExp(`^\\s*<([a-z]+[1-6]?|${n})([^>]*)>([\\s\\S]*?)</(\\1|${n})>\\s*$|^\\s*<([a-z]+[1-6]?|${n})([^>]*)/>\\s*$`));if(!r){throw new Error("Invalid component template")}let o=0;return _(r[0],(t,r,h,a)=>{const l=0===o,c=++o;if(!l&&!h.match(new RegExp(n)))return t;const u=H(h,e),d=t=>`${t}-${c}`,p=s.length;s.push({getSelector:function(){return`[${I.ATTRIBUTE_ELEMENT}="${d(this.uid)}"]`},getAttributes:function(){const t=w(N(u,t=>C(t,this,"element attribute")),this.eventsManager,t=>I.ATTRIBUTE_EVENT(t,this.uid));return l&&this.attributes&&Object.assign(t,i(this.attributes,this)),t[I.ATTRIBUTE_ELEMENT]=d(this.uid),t}}),e.push(function(){const t=this.template.elements[p],e=t.getAttributes.call(this);return t.previousAttributes=e,I.markAsSafeHTML(v(e))});return`<${r} ${I.PLACEHOLDER(e.length-1)}${a}`})},j=(t,e)=>{const s=I.PLACEHOLDER("(?:\\d+)");return _(t,(t,i,n,r)=>{if(!n.match(new RegExp(s)))return t;const o=H(n,e),h=function(){return w(N(o,t=>C(t,this,"partial element attribute")),this.eventsManager,t=>I.ATTRIBUTE_EVENT(t,this.uid))};e.push(function(){const t=h.call(this);return I.markAsSafeHTML(v(t))});return`<${i} ${I.PLACEHOLDER(e.length-1)}${r}`})},D=(t,e,s)=>{const i=I.PLACEHOLDER("(\\d+)");let n=0;return t.replace(new RegExp(i,"g"),function(i,r,o){const h=t.substring(0,o);if(h.lastIndexOf("<")>h.lastIndexOf(">"))return i;const a=++n;const l=s.length;return s.push({getStart:function(){return I.MARKER_START(`${this.uid}-${a}`)},getEnd:function(){return I.MARKER_END(`${this.uid}-${a}`)},expression:e[r]}),e.push(function(){return this.template.interpolations[l]}),I.PLACEHOLDER(e.length-1)})},H=(t,e)=>{const s=I.PLACEHOLDER("(\\d+)"),i=[],n=new RegExp(`(?:${s}|([\\w-]+))(?:=(["']?)(?:${s}|((?:.?(?!["']?\\s+(?:\\S+)=|\\s*/>|\\s*[>"']))+.))?\\3)?`,"g");let r;for(;null!==(r=n.exec(t));){const[,t,s,n,o,h]=r,a=!!n;let l=void 0!==t?e[parseInt(t,10)]:s,c=void 0!==o?e[parseInt(o,10)]:h;a&&void 0===c&&(c=""),void 0!==c?i.push([l,c,a]):i.push([l])}return i},B=["key","state","onCreate","onChange","onHydrate","onBeforeRecycle","onRecycle","onBeforeUpdate","onUpdate"];class I extends h{constructor(t={}){super(...arguments),this.componentOptions=[],B.forEach(e=>{e in t&&(r(this,e,t[e]),this.componentOptions.push(e))});const e={};Object.keys(t).forEach(s=>{-1===this.viewOptions.indexOf(s)&&-1===this.componentOptions.indexOf(s)&&(e[s]=t[s])}),this.props=new n(e),this.options=t,this.partial=this.partial.bind(this),this.onChange=this.onChange.bind(this),this.onCreate.apply(this,arguments)}events(){const t={};return this.eventsManager.types.forEach(s=>{const i=I.ATTRIBUTE_EVENT(s,this.uid),n=function(t,s,n){const r=n.getAttribute(i);if(r){let i=this.eventsManager.listeners[parseInt(r,10)];"string"==typeof i&&(i=this[i]),e(i),i.call(this,t,s,n)}};t[`${s} [${i}]`]=n,t[s]=n}),t}ensureElement(){if(this.eventsManager=new c,this.template=i(this.template,this),this.el){if(this.el=i(this.el,this),!this.el.parentNode){const t=`Hydration failed in ${this.constructor.name}#${this.uid}`;throw new Error(t)}this.toString(),this.hydrate(this.el.parentNode)}}isContainer(){return 0===this.template.elements.length&&1===this.template.interpolations.length}subscribe(t,e="change",s=this.onChange){return t.on&&this.listenTo(t,e,s),this}hydrate(t){return["model","state","props"].forEach(t=>{this[t]&&this.subscribe(this[t])}),this.isContainer()?(this.children[0].hydrate(t),this.el=this.children[0].el):(this.template.elements.forEach((e,s)=>{0===s?(e.hydrate(t),this.el=e.ref):e.hydrate(this.el)}),this.template.interpolations.forEach(t=>t.hydrate(this.el)),this.children.forEach(t=>t.hydrate(this.el))),this.delegateEvents(),this.onHydrate.call(this),this}recycle(t){if(this.onBeforeRecycle.call(this),t){!function(t,e){const s=R&&document.activeElement&&e.contains(document.activeElement)?document.activeElement:null;s&&$&&s.blur(),t.parentNode[A?"moveBefore":"insertBefore"](e,t),t.parentNode.removeChild(t),s&&s!==document.activeElement&&e.contains(s)&&s.focus()}(g(t,I.MARKER_RECYCLED(this.uid),L),this.el)}return this}updateProps(t){return this.props.set(t),this.onRecycle.call(this),this}getRecycledMarker(){return`\x3c!--${I.MARKER_RECYCLED(this.uid)}--\x3e`}partial(t,...e){const s=O(j(M(k(t,e).trim(),e),e),e).map(t=>C(t,this,"partial"));return new l(s)}renderTemplatePart(t,e,s){const i=C(t,this,"template part");if(null==i||!1===i||!0===i)return"";if(i instanceof a)return`${i}`;if(i instanceof I)return`${e(i,s)}`;if(i instanceof l){if(1===i.items.length)return this.renderTemplatePart(i.items[0],e,s);s.push();const t=i.items.map(t=>(s.increment(),this.renderTemplatePart(t,e,s))).join("");return s.pop(),t}if(Array.isArray(i)){s.pause();const t=y(i).map(t=>this.renderTemplatePart(t,e,s)).join("");return s.resume(),t}if(i instanceof m){const t=i.tracker;t.reset();const s=this.isContainer()?"":`\x3c!--${i.getStart()}--\x3e`,n=this.isContainer()?"":`\x3c!--${i.getEnd()}--\x3e`;return`${s}${this.renderTemplatePart(i.expression,e,t)}${n}`}return`${I.sanitize(i)}`}toString(){this.destroyChildren(),this.eventsManager.reset();const t=(t,e)=>(e.track(t),this.addChild(t));return this.template.parts.map(e=>this.renderTemplatePart(e,t)).join("")}render(){if(this.destroyed)return this;if(!this.el){const t=b(this);return this.hydrate(t),this}this.onBeforeUpdate.call(this),this.eventsManager.reset();const t=this.children;this.children=[];const e=[];return this.template.interpolations.forEach(s=>{const i=s.tracker;i.reset();const n=[],r=[],o=this.renderTemplatePart(s.expression,e=>{let s,o=e;return s=e.key?t.find(t=>t.key===e.key):i.findRecyclable(e),s?(o=s.getRecycledMarker(),r.push([s,e]),i.track(s)):(n.push(e),i.track(e)),o},i),h=([t,s],i)=>{e.push([t,s.props.toJSON()]),this.addChild(t).recycle(i),s.destroy()};if(i.hasSingleComponent())return void h(r[0],null);const a=b(o),l=t=>()=>{r.forEach(e=>h(e,t)),n.forEach(e=>this.addChild(e).hydrate(t))};this.isContainer()?s.updateElement(this.el,a,l(this.el.parentNode)):s.update(a,l(this.el))}),t.forEach(t=>{this.children.indexOf(t)<0&&t.destroy()}),e.forEach(([t,e])=>{t.updateProps(e)}),this.isContainer()?this.el=this.children[0].el:this.template.elements.forEach(t=>t.update()),this.eventsManager.hasPendingTypes()&&this.delegateEvents(),this.onUpdate.call(this),this}onCreate(){}onChange(){this.render()}onHydrate(){}onBeforeRecycle(){}onRecycle(){}onBeforeUpdate(){}onUpdate(){}onDestroy(){}static markAsSafeHTML(t){return new a(t)}static extend(t){const e=this;class s extends e{}return Object.assign(s.prototype,"function"==typeof t?t(e.prototype):t),s}static mount(t,e,s){const i=new this(t);return e&&(s?i.toString():e.append(b(i)),i.hydrate(e)),i}static create(t,...e){"function"==typeof t&&(e=[t],t=["",""]);const s=[],i=[],n=O(D(P(M(k(t,e).trim(),e),e,s),e,i),e);return this.extend({source:null,template(){return{elements:s.map(t=>new d({getSelector:t.getSelector.bind(this),getAttributes:t.getAttributes.bind(this)})),interpolations:i.map(t=>new m({getStart:t.getStart.bind(this),getEnd:t.getEnd.bind(this),expression:t.expression,shouldSkipFind:L,shouldSkipSync:x})),parts:n}}})}}I.ATTRIBUTE_ELEMENT="data-rst-el",I.ATTRIBUTE_EVENT=(t,e)=>`data-rst-on-${t}-${e}`,I.DATASET_ELEMENT="rstEl",I.PLACEHOLDER=t=>`__RASTI_PLACEHOLDER_${t}__`,I.MARKER_RECYCLED=t=>`rst-r-${t}`,I.MARKER_START=t=>`rst-s-${t}`,I.MARKER_END=t=>`rst-e-${t}`;var z=I.create`<div></div>`;t.Component=z,t.Emitter=s,t.Model=n,t.View=h});
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Rasti={})}(this,function(t){"use strict";function e(t){if("function"!=typeof t){throw new TypeError("Event listener must be a function")}}class s{on(t,s){return e(s),this.listeners||(this.listeners={}),this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(s),()=>this.off(t,s)}once(t,s){e(s);const i=(...e)=>{s(...e),this.off(t,i)};return this.on(t,i)}off(t,e){this.listeners&&(t?this.listeners[t]&&(e?(this.listeners[t]=this.listeners[t].filter(t=>t!==e),this.listeners[t].length||delete this.listeners[t]):delete this.listeners[t],Object.keys(this.listeners).length||delete this.listeners):delete this.listeners)}emit(t,...e){this.listeners&&this.listeners[t]&&this.listeners[t].slice().forEach(t=>t(...e))}listenTo(t,e,s){return t.on(e,s),this.listeningTo||(this.listeningTo=[]),this.listeningTo.push({emitter:t,type:e,listener:s}),()=>this.stopListening(t,e,s)}listenToOnce(t,s,i){e(i);const n=(...e)=>{i(...e),this.stopListening(t,s,n)};return this.listenTo(t,s,n)}stopListening(t,e,s){this.listeningTo&&(this.listeningTo=this.listeningTo.filter(i=>!(!t||t===i.emitter&&!e||t===i.emitter&&e===i.type&&!s||t===i.emitter&&e===i.type&&s===i.listener)||(i.emitter.off(i.type,i.listener),!1)),this.listeningTo.length||delete this.listeningTo)}}const i=(t,e,...s)=>"function"!=typeof t?t:t.apply(e,s);class n extends s{constructor(){super(),this.preinitialize.apply(this,arguments),this.attributes=Object.assign({},i(this.defaults,this),this.parse.apply(this,arguments)),this.previous={},Object.keys(this.attributes).forEach(this.defineAttribute.bind(this))}preinitialize(){}defineAttribute(t){Object.defineProperty(this,`${this.constructor.attributePrefix}${t}`,{get:()=>this.get(t),set:e=>{this.set(t,e)}})}get(t){return this.attributes[t]}set(t,e,...s){let i,n;"object"==typeof t?(i=t,n=[e,...s]):(i={[t]:e},n=s);const r=this._changing;this._changing=!0;const h={};r||(this.previous=Object.assign({},this.attributes)),Object.keys(i).forEach(t=>{i[t]!==this.attributes[t]&&(h[t]=i[t],this.attributes[t]=i[t])});const o=Object.keys(h);if(o.length&&(this._pending=["change",this,h,...n]),o.forEach(t=>{this.emit(`change:${t}`,this,i[t],...n)}),r)return this;for(;this._pending;){const t=this._pending;this._pending=null,this.emit.apply(this,t)}return this._pending=null,this._changing=!1,this}parse(t){return t}toJSON(){return Object.assign({},this.attributes)}}n.attributePrefix="";const r=(t,e,s)=>{try{t[e]=s}catch(i){if(!(i instanceof TypeError))throw i;Object.defineProperty(t,e,{value:s,writable:!0,enumerable:!0,configurable:!0})}return t},h=["el","tag","attributes","events","model","template","onDestroy"];class o extends s{constructor(t={}){super(),this.preinitialize.apply(this,arguments),this.delegatedEventListeners=[],this.children=[],this.destroyQueue=[],this.viewOptions=[],h.forEach(e=>{e in t&&(r(this,e,t[e]),this.viewOptions.push(e))}),this.ensureUid(),this.ensureElement()}preinitialize(){}$(t){return this.el.querySelector(t)}$$(t){return this.el.querySelectorAll(t)}destroy(){return this.destroyChildren(),this.undelegateEvents(),this.stopListening(),this.off(),this.destroyQueue.forEach(t=>t()),this.destroyQueue=[],this.onDestroy.apply(this,arguments),this.destroyed=!0,this}onDestroy(){}addChild(t){return this.children.push(t),t}destroyChildren(){this.children.forEach(t=>t.destroy()),this.children=[]}ensureUid(){this.uid||(this.uid="r"+ ++o.uid)}ensureElement(){if(this.el)this.el=i(this.el,this);else{const t=i(this.tag,this),e=i(this.attributes,this);this.el=this.createElement(t,e)}this.delegateEvents()}createElement(t="div",e={}){let s=document.createElement(t);return Object.keys(e).forEach(t=>s.setAttribute(t,e[t])),s}removeElement(){return this.el.parentNode.removeChild(this.el),this}delegateEvents(t){if(t||(t=i(this.events,this)),!t)return this;this.delegatedEventListeners.length&&this.undelegateEvents();const s={};return Object.keys(t).forEach(i=>{const n=i.match(/^(\w+)(?:\s+(.+))*$/);if(!n){throw new Error(`Invalid event format: ${i}`)}const[,r,h]=n;let o=t[i];"string"==typeof o&&(o=this[o]),e(o),s[r]||(s[r]=[]),s[r].push([h,o])}),Object.keys(s).forEach(t=>{const e=e=>{let i=e.target;for(;i;)i.matches&&s[t].forEach(([t,s])=>{(i===this.el&&!t||i!==this.el&&i.matches(t))&&s.call(this,e,this,i)}),i=i===this.el||e.cancelBubble?null:i.parentElement};this.delegatedEventListeners.push([t,e]),this.el.addEventListener(t,e)}),this}undelegateEvents(){return this.delegatedEventListeners.forEach(([t,e])=>{this.el.removeEventListener(t,e)}),this.delegatedEventListeners=[],this}render(){return this}static sanitize(t){return`${t}`.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"}[t]))}static resetUid(){o.uid=0}}o.uid=0;class a{constructor(t){this.value=t}toString(){return this.value}}class l{constructor(t){this.items=t}}class c{constructor(){this.listeners=[],this.types=new Set,this.previousSize=0}addListener(t,e){return this.types.add(e),this.listeners.push(t),this.listeners.length-1}reset(){this.listeners=[],this.previousSize=this.types.size}hasPendingTypes(){return this.types.size>this.previousSize}}const u=["value","checked","selected"];let d=class{constructor(t){this.getSelector=t.getSelector,this.getAttributes=t.getAttributes,this.previousAttributes={}}hydrate(t){this.ref=t.querySelector(this.getSelector())}update(){const t=this.getAttributes(),{remove:e,add:s}=function(t,e={}){const s={},i=[];return Object.keys(t).forEach(i=>{let n=t[i];n!==e[i]&&(!0===n?s[i]="":!1!==n&&(null==n&&(n=""),s[i]=n))}),Object.keys(e).forEach(s=>{(!(s in t)||e[s]!==t[s]&&!1===t[s])&&i.push(s)}),{add:s,remove:i}}(t,this.previousAttributes);this.previousAttributes=t,e.forEach(t=>{this.ref.removeAttribute(t),-1!==u.indexOf(t)&&t in this.ref&&(this.ref[t]="value"===t&&"")}),Object.keys(s).forEach(t=>{const e=s[t];this.ref.setAttribute(t,e),-1!==u.indexOf(t)&&t in this.ref&&(this.ref[t]="value"===t?e:!1!==e&&"false"!==e)})}};class p{constructor(){}reset(){this.paused=0,this.previous=this.tracked||new Map,this.tracked=new Map,this.positionStack=[0]}push(){this.positionStack.push(0)}pop(){this.positionStack.pop()}increment(){this.positionStack[this.positionStack.length-1]++}pause(){this.paused++}resume(){this.paused--}getPath(){return this.positionStack.join("-")}track(t){return 0===this.paused&&this.tracked.set(this.getPath(),t),t}hasSingleComponent(){if(1!==this.tracked.size||1!==this.previous.size)return!1;const[t,e]=this.tracked.entries().next().value,[s,i]=this.previous.entries().next().value;return"0"===t&&"0"===s&&e===i}findRecyclable(t){const e=this.previous.get(this.getPath());return e&&!e.key&&e.constructor===t.constructor?e:null}}const f=["value","checked","selected"];function E(t,e){t.nodeType===e.nodeType?t.nodeType!==Node.TEXT_NODE?t.tagName===e.tagName?(((t,e)=>{const s=e.attributes,i=t.attributes,n=new Set;for(let e=0,i=s.length;e<i;e++){const{name:i,value:r}=s[e];n.add(i),t.getAttribute(i)!==r&&t.setAttribute(i,r)}for(let e=i.length-1;e>=0;e--){const{name:s}=i[e];n.has(s)||t.removeAttribute(s)}for(let s=0,i=f.length;s<i;s++){const i=f[s];i in t&&t[i]!==e[i]&&(t[i]=e[i])}})(t,e),((t,e)=>{const s=t.childNodes,i=e.childNodes,n=s.length;if(n!==i.length)return!1;for(let t=0;t<n;t++)if(!s[t].isEqualNode(i[t]))return!1;return!0})(t,e)||((t,e)=>{const s=Array.from(e.childNodes);t.replaceChildren(...s)})(t,e)):t.replaceWith(e):t.nodeValue!==e.nodeValue&&(t.nodeValue=e.nodeValue):t.replaceWith(e)}function g(t,e,s=()=>!1,i){let n=i||t.firstChild;for(;n;){if(n.nodeType===Node.COMMENT_NODE&&n.data.trim()===e)return n;if(n.nodeType!==Node.ELEMENT_NODE||s(n)||!n.firstChild){for(;n&&!n.nextSibling;)if(n=n.parentNode,!n||n===t)return null;n&&(n=n.nextSibling)}else n=n.firstChild}return null}class m{constructor(t){this.getStart=t.getStart,this.getEnd=t.getEnd,this.expression=t.expression,this.shouldSkipFind=t.shouldSkipFind,this.shouldSkipSync=t.shouldSkipSync,this.tracker=new p}hydrate(t){const e=g(t,this.getStart(),this.shouldSkipFind),s=g(t,this.getEnd(),this.shouldSkipFind,e);this.ref=[e,s]}update(t,e){let s;const[i,n]=this.ref,r=i.nextSibling,h=r===n,o=!h&&r.nextSibling===n;if(h?n.parentNode.insertBefore(t,n):!o||1!==t.children.length||this.shouldSkipSync(r)||this.shouldSkipSync(t.firstChild)?(s=document.createComment(""),n.parentNode.insertBefore(s,n),n.parentNode.insertBefore(t,n)):E(r,t.firstChild),e(),s){if(this.ref[0].nextSibling===s)s.parentNode.removeChild(s);else{const t=document.createRange();t.setStartAfter(this.ref[0]),t.setEndAfter(s),t.deleteContents()}}}updateElement(t,e,s){const i=document.createComment("");t.parentNode.insertBefore(i,t.nextSibling),i.parentNode.insertBefore(e.firstChild,i.nextSibling),s(),t.nextSibling===i&&t.parentNode.removeChild(t),i.parentNode.removeChild(i)}}const y=t=>t.reduce((t,e)=>(Array.isArray(e)?t.push(...y(e)):t.push(e),t),[]);function b(t){const e=document.createElement("template");return e.innerHTML=`${t}`,e.content}const T=/^[^\s"'>/=\u0000-\u001F\u007F-\u009F]+$/;function v(t){const e=[];return Object.keys(t).forEach(s=>{let i=t[s];T.test(s)&&(!0===i?e.push(s):!1!==i&&(null==i&&(i=""),e.push(`${s}="${(t=>`${t}`.replace(/"/g,"&quot;"))(i)}"`)))}),e.join(" ")}let S,A,R,$;"undefined"!=typeof document&&(S=!!navigator.userAgent.match(/Chrome/),A=!!Element.prototype.moveBefore,R=!A||S,$=A&&S);const C=(t,e,s)=>{try{return"function"!=typeof t?t:t.call(e,e)}catch(t){if(s&&!t._rasti){let s;s=`Error in ${e.constructor.name}#${e.uid} expression`;const i=new Error(s,{cause:t});throw i._rasti=!0,i}throw t}},L=t=>!!(t&&t.dataset&&t.dataset[I.DATASET_ELEMENT]&&t.dataset[I.DATASET_ELEMENT].endsWith("-1")),x=t=>!(!t||!(t.dataset&&t.dataset[I.DATASET_ELEMENT]||t.querySelector&&t.querySelector(`[${I.ATTRIBUTE_ELEMENT}]`))),k=(t,e)=>t.reduce((t,s,i)=>(t.push(s),void 0!==e[i]&&t.push(I.PLACEHOLDER(i)),t),[]).join(""),O=(t,e)=>{const s=I.PLACEHOLDER("(\\d+)"),i=t.match(new RegExp(`^${s}$`));if(i)return[e[parseInt(i[1],10)]];const n=new RegExp(`${s}`,"g"),r=[];let h,o=0;for(;null!==(h=n.exec(t));){const s=t.slice(o,h.index);r.push(I.markAsSafeHTML(s),e[parseInt(h[1],10)]),o=h.index+h[0].length}return r.push(I.markAsSafeHTML(t.slice(o))),r},w=(t,e)=>t.reduce((t,s)=>{const i=e(s[0]);if(1===s.length)"object"==typeof i?t=Object.assign(t,i):"string"==typeof i&&(t[i]=!0);else{const n=s[2]?e(s[1]):s[1];t[i]=n}return t},{}),N=(t,e,s)=>{const i={};return Object.keys(t).forEach(n=>{const r=n.match(/on(([A-Z]{1}[a-z]+)+)/);if(r&&r[1]){const h=r[1].toLowerCase(),o=t[n];if(o){const t=e.addListener(o,h);i[s(h)]=t}}else i[n]=t[n]}),i},M=(t,e,s=!1)=>{const i=I.PLACEHOLDER("(\\d+)"),n=new Map;return s||(t=t.replace(new RegExp(i,"g"),(t,s)=>{const i=e[s];if(i&&i.prototype instanceof I){if(n.has(i))return n.get(i);n.set(i,t)}return t})),t.replace(new RegExp(`<(${i})([^>]*)/>|<(${i})([^>]*)>([\\s\\S]*?)</\\4>`,"g"),(t,s,i,n,r,h,o,a)=>{let c,u,d;if(r?(c=e[h],u=o):(c=void 0!==i?e[i]:s,u=n),!(c.prototype instanceof I))return t;if(r){const t=M(a,e,!0),s=j(t,e);d=O(s,e)}const p=H(u,e);return e.push(function(){const t=w(p,t=>C(t,this,"children options"));return d&&(t.renderChildren=()=>new l(d.map(t=>C(t,this,"children")))),c.mount(t)}),I.PLACEHOLDER(e.length-1)})},_=(t,e)=>{const s=I.PLACEHOLDER("(?:\\d+)");return t.replace(new RegExp(`<(${s}|[a-z]+[1-6]?)(?:\\s*)((?:"[^"]*"|'[^']*'|[^>])*?)(\\s*/?>)`,"gi"),e)},P=(t,e,s)=>{const n=I.PLACEHOLDER("(?:\\d+)");if(t.match(new RegExp(`^\\s*${n}\\s*$`)))return t;const r=t.match(new RegExp(`^\\s*<([a-z]+[1-6]?|${n})([^>]*)>([\\s\\S]*?)</(\\1|${n})>\\s*$|^\\s*<([a-z]+[1-6]?|${n})([^>]*)/>\\s*$`));if(!r){throw new Error("Invalid component template")}let h=0;return _(r[0],(t,r,o,a)=>{const l=0===h,c=++h;if(!l&&!o.match(new RegExp(n)))return t;const u=H(o,e),d=t=>`${t}-${c}`,p=s.length;s.push({getSelector:function(){return`[${I.ATTRIBUTE_ELEMENT}="${d(this.uid)}"]`},getAttributes:function(){const t=N(w(u,t=>C(t,this,"element attribute")),this.eventsManager,t=>I.ATTRIBUTE_EVENT(t,this.uid));return l&&this.attributes&&Object.assign(t,i(this.attributes,this)),t[I.ATTRIBUTE_ELEMENT]=d(this.uid),t}}),e.push(function(){const t=this.template.elements[p],e=t.getAttributes.call(this);return t.previousAttributes=e,I.markAsSafeHTML(v(e))});return`<${r} ${I.PLACEHOLDER(e.length-1)}${a}`})},j=(t,e)=>{const s=I.PLACEHOLDER("(?:\\d+)");return _(t,(t,i,n,r)=>{if(!n.match(new RegExp(s)))return t;const h=H(n,e),o=function(){return N(w(h,t=>C(t,this,"partial element attribute")),this.eventsManager,t=>I.ATTRIBUTE_EVENT(t,this.uid))};e.push(function(){const t=o.call(this);return I.markAsSafeHTML(v(t))});return`<${i} ${I.PLACEHOLDER(e.length-1)}${r}`})},D=(t,e,s)=>{const i=I.PLACEHOLDER("(\\d+)");let n=0;return t.replace(new RegExp(i,"g"),function(i,r,h){const o=t.substring(0,h);if(o.lastIndexOf("<")>o.lastIndexOf(">"))return i;const a=++n;const l=s.length;return s.push({getStart:function(){return I.MARKER_START(`${this.uid}-${a}`)},getEnd:function(){return I.MARKER_END(`${this.uid}-${a}`)},expression:e[r]}),e.push(function(){return this.template.interpolations[l]}),I.PLACEHOLDER(e.length-1)})},H=(t,e)=>{const s=I.PLACEHOLDER("(\\d+)"),i=[],n=new RegExp(`(?:${s}|([\\w-]+))(?:=(["']?)(?:${s}|((?:.?(?!["']?\\s+(?:\\S+)=|\\s*/>|\\s*[>"']))+.))?\\3)?`,"g");let r;for(;null!==(r=n.exec(t));){const[,t,s,n,h,o]=r,a=!!n;let l=void 0!==t?e[parseInt(t,10)]:s,c=void 0!==h?e[parseInt(h,10)]:o;a&&void 0===c&&(c=""),void 0!==c?i.push([l,c,a]):i.push([l])}return i},B=["key","state","onCreate","onChange","onHydrate","onBeforeRecycle","onRecycle","onBeforeUpdate","onUpdate"];class I extends o{constructor(t={}){super(...arguments),this.componentOptions=[],B.forEach(e=>{e in t&&(r(this,e,t[e]),this.componentOptions.push(e))});const e={};Object.keys(t).forEach(s=>{-1===this.viewOptions.indexOf(s)&&-1===this.componentOptions.indexOf(s)&&(e[s]=t[s])}),this.props=new n(e),this.options=t,this.partial=this.partial.bind(this),"html"in this||(this.html=this.partial),this.onChange=this.onChange.bind(this),this.onCreate.apply(this,arguments)}events(){const t={};return this.eventsManager.types.forEach(s=>{const i=I.ATTRIBUTE_EVENT(s,this.uid),n=function(t,s,n){const r=n.getAttribute(i);if(r){let i=this.eventsManager.listeners[parseInt(r,10)];"string"==typeof i&&(i=this[i]),e(i),i.call(this,t,s,n)}};t[`${s} [${i}]`]=n,t[s]=n}),t}ensureElement(){if(this.eventsManager=new c,this.template=i(this.template,this),this.el){if(this.el=i(this.el,this),!this.el.parentNode){const t=`Hydration failed in ${this.constructor.name}#${this.uid}`;throw new Error(t)}this.toString(),this.hydrate(this.el.parentNode)}}isContainer(){return 0===this.template.elements.length&&1===this.template.interpolations.length}subscribe(t,e="change",s=this.onChange){return t.on&&this.listenTo(t,e,s),this}hydrate(t){return["model","state","props"].forEach(t=>{this[t]&&this.subscribe(this[t])}),this.isContainer()?(this.children[0].hydrate(t),this.el=this.children[0].el):(this.template.elements.forEach((e,s)=>{0===s?(e.hydrate(t),this.el=e.ref):e.hydrate(this.el)}),this.template.interpolations.forEach(t=>t.hydrate(this.el)),this.children.forEach(t=>t.hydrate(this.el))),this.delegateEvents(),this.onHydrate.call(this),this}recycle(t){if(this.onBeforeRecycle.call(this),t){!function(t,e){const s=R&&document.activeElement&&e.contains(document.activeElement)?document.activeElement:null;s&&$&&s.blur(),t.parentNode[A?"moveBefore":"insertBefore"](e,t),t.parentNode.removeChild(t),s&&s!==document.activeElement&&e.contains(s)&&s.focus()}(g(t,I.MARKER_RECYCLED(this.uid),L),this.el)}return this}updateProps(t){return this.props.set(t),this.onRecycle.call(this),this}getRecycledMarker(){return`\x3c!--${I.MARKER_RECYCLED(this.uid)}--\x3e`}partial(t,...e){const s=O(j(M(k(t,e).trim(),e),e),e).map(t=>C(t,this,"partial"));return new l(s)}renderTemplatePart(t,e,s){const i=C(t,this,"template part");if(null==i||!1===i||!0===i)return"";if(i instanceof a)return`${i}`;if(i instanceof I)return`${e(i,s)}`;if(i instanceof l){if(1===i.items.length)return this.renderTemplatePart(i.items[0],e,s);s.push();const t=i.items.map(t=>(s.increment(),this.renderTemplatePart(t,e,s))).join("");return s.pop(),t}if(Array.isArray(i)){s.pause();const t=y(i).map(t=>this.renderTemplatePart(t,e,s)).join("");return s.resume(),t}if(i instanceof m){const t=i.tracker;t.reset();const s=this.isContainer()?"":`\x3c!--${i.getStart()}--\x3e`,n=this.isContainer()?"":`\x3c!--${i.getEnd()}--\x3e`;return`${s}${this.renderTemplatePart(i.expression,e,t)}${n}`}return`${I.sanitize(i)}`}toString(){this.destroyChildren(),this.eventsManager.reset();const t=(t,e)=>(e.track(t),this.addChild(t));return this.template.parts.map(e=>this.renderTemplatePart(e,t)).join("")}render(){if(this.destroyed)return this;if(!this.el){const t=b(this);return this.hydrate(t),this}this.onBeforeUpdate.call(this),this.eventsManager.reset();const t=this.children;this.children=[];const e=[];return this.template.interpolations.forEach(s=>{const i=s.tracker;i.reset();const n=[],r=[],h=this.renderTemplatePart(s.expression,e=>{let s,h=e;return s=e.key?t.find(t=>t.key===e.key):i.findRecyclable(e),s?(h=s.getRecycledMarker(),r.push([s,e]),i.track(s)):(n.push(e),i.track(e)),h},i),o=([t,s],i)=>{e.push([t,s.props.toJSON()]),this.addChild(t).recycle(i),s.destroy()};if(i.hasSingleComponent())return void o(r[0],null);const a=b(h),l=t=>()=>{r.forEach(e=>o(e,t)),n.forEach(e=>this.addChild(e).hydrate(t))};this.isContainer()?s.updateElement(this.el,a,l(this.el.parentNode)):s.update(a,l(this.el))}),t.forEach(t=>{this.children.indexOf(t)<0&&t.destroy()}),e.forEach(([t,e])=>{t.updateProps(e)}),this.isContainer()?this.el=this.children[0].el:this.template.elements.forEach(t=>t.update()),this.eventsManager.hasPendingTypes()&&this.delegateEvents(),this.onUpdate.call(this),this}onCreate(){}onChange(){this.render()}onHydrate(){}onBeforeRecycle(){}onRecycle(){}onBeforeUpdate(){}onUpdate(){}onDestroy(){}static markAsSafeHTML(t){return new a(t)}static extend(t){const e=this;class s extends e{}return Object.assign(s.prototype,"function"==typeof t?t(e.prototype):t),s}static mount(t,e,s){const i=new this(t);return e&&(s?i.toString():e.append(b(i)),i.hydrate(e)),i}static create(t,...e){"function"==typeof t&&(e=[t],t=["",""]);const s=[],i=[],n=O(D(P(M(k(t,e).trim(),e),e,s),e,i),e);return this.extend({source:null,template(){return{elements:s.map(t=>new d({getSelector:t.getSelector.bind(this),getAttributes:t.getAttributes.bind(this)})),interpolations:i.map(t=>new m({getStart:t.getStart.bind(this),getEnd:t.getEnd.bind(this),expression:t.expression,shouldSkipFind:L,shouldSkipSync:x})),parts:n}}})}}I.ATTRIBUTE_ELEMENT="data-rst-el",I.ATTRIBUTE_EVENT=(t,e)=>`data-rst-on-${t}-${e}`,I.DATASET_ELEMENT="rstEl",I.PLACEHOLDER=t=>`__RASTI_PLACEHOLDER_${t}__`,I.MARKER_RECYCLED=t=>`rst-r-${t}`,I.MARKER_START=t=>`rst-s-${t}`,I.MARKER_END=t=>`rst-e-${t}`;var z=I.create`<div></div>`;t.Component=z,t.Emitter=s,t.Model=n,t.View=o});
2
2
  //# sourceMappingURL=rasti.min.js.map