neft
Version:
Universal Platform
74 lines (72 loc) • 623 kB
JavaScript
var Neft, setImmediate;
setImmediate = (function() {
var callAll, queue, ready, running, update;
ready = false;
running = false;
queue = [];
callAll = function() {
var args, func, i, j, length, ref;
running = false;
length = queue.length;
for (i = j = 0, ref = length; j < ref; i = j += 2) {
func = queue.shift();
args = queue.shift();
func.apply(null, args);
}
};
update = (function() {
var Mutation, calls, element, observer;
if (!(Mutation = window.MutationObserver || window.WebKitMutationObserver)) {
return;
}
calls = 0;
observer = new Mutation(callAll);
element = document.createTextNode('');
observer.observe(element, {
characterData: true
});
return function() {
var ref;
return element.data = (ref = ++calls % 2) != null ? ref : {
"a": "b"
};
};
})();
update || (update = (function() {
var channel;
if ((typeof window !== "undefined" && window !== null ? window.setImmediate : void 0) || (typeof MessageChannel === "undefined" || MessageChannel === null)) {
return;
}
channel = new MessageChannel();
channel.port1.onmessage = callAll;
return function() {
return channel.port2.postMessage(0);
};
})());
update || (update = (function() {
return function() {
return setTimeout(callAll, 0);
};
})());
setTimeout(function() {
ready = true;
return callAll();
});
return function(func) {
var argc, args, i, j, ref;
argc = arguments.length;
if (argc > 1) {
args = new Array(argc - 1);
for (i = j = 1, ref = argc; j < ref; i = j += 1) {
args[i - 1] = arguments[i];
}
}
queue.push(func, args);
if (ready && !running) {
update();
running = true;
}
};
})();
Neft = (function(){var process="undefined"!=typeof global&&global.process||{env:{}};process.env.NEFT_PLATFORM="webgl",process.env.NEFT_CLIENT="1",process.env.NEFT_BROWSER="1",process.env.NEFT_WEBGL="1";var t=[function(exports){var module={exports:exports},require=r({"src/app":2,"src/utils":156,"src/signal":148,"src/dict":11,"src/list":50,"src/log":52,"src/resources":136,"src/renderer":102,"src/networking":58,"src/schema":138,"src/document":37,"src/assert":4,"src/db":10,"src/styles":151,"src/eventLoop":49,"src/tryCatch":153,"src/binding":5}),exports=module.exports;return function(){(function(){"use strict";var exports;exports=module.exports=require("src/app"),exports.utils=require("src/utils"),exports.signal=require("src/signal"),exports.Dict=require("src/dict"),exports.List=require("src/list"),exports.log=require("src/log"),exports.Resources=require("src/resources"),exports.Renderer=require("src/renderer"),exports.Networking=require("src/networking"),exports.Schema=require("src/schema"),exports.Document=require("src/document"),exports.styles=require("src/styles"),exports.assert=require("src/assert"),exports.db=require("src/db"),exports.eventLoop=require("src/eventLoop"),exports.tryCatch=require("src/tryCatch"),exports.Binding=require("src/binding"),exports.native=function(){try{return require("src/native")}catch(t){}}(),exports.nmlParser=function(){try{return require("src/nml-parser")}catch(t){}}()}).call(this)}(),module.exports},function(exports){var module={exports:exports},exports=(r({}),module.exports);return function(){module.exports={name:"neft",version:"0.11.23",preferGlobal:!0,description:"Universal Platform",keywords:["framework","native","android","ios","webgl"],bin:{neft:"bin/neft.js"},main:"index.coffee",license:"Apache-2.0",homepage:"http://neft.io",author:"Krystian Kruk <krystian@neft.io>",contributors:[],repository:{type:"git",url:"https://github.com/Neft-io/neft.git"},bugs:"https://github.com/Neft-io/neft/issues",engines:{node:">=8.0.0"},scripts:{bundle:"cross-env NODE_PATH=./ coffee --nodejs --harmony scripts/bundle.coffee",test:"node ./bin/neft.js test","update-api-docs":"cross-env NODE_PATH=./ coffee scripts/api-docs.coffee",prepublishOnly:"npm run bundle"},dependencies:{acorn:"^5.2.1","babel-core":"6.22.1","babel-preset-es2015":"6.22.0","babel-preset-es2016":"6.22.0","babel-preset-es2017":"6.22.0",chokidar:"1.5.1","coffee-script":"1.10.0","cross-env":"1.0.8","form-data":"1.0.0-rc4","fs-extra":"0.30.0",glob:"7.0.3",htmlparser2:"3.9.0","http-server":"0.9.0",jimp:"0.2.27","js-yaml":"3.6.1",mkdirp:"0.5.1",mustache:"2.2.1","node-notifier":"4.6.0","node-static":"0.7.7",open:"0.0.5",pegjs:"0.10.0",pngjs:"3.0.0",qs:"6.2.0",semver:"5.1.0",slash:"1.0.0","uglify-js":"2.7.5",which:"1.2.12",xcode:"0.8.7"},devDependencies:{"coffee-coverage":"1.0.1",coveralls:"2.11.14","escape-html":"1.0.3",imgur:"0.2.1",istanbul:"^0.4.5",wd:"0.4.0"},android:{package:"io.neft.tests",versionCode:1,versionName:"1.0",application:{label:"Neft.io Tests"}},ios:{package:"io.neft.tests",application:{label:"Neft.io Tests"}}}}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156,"src/log":52,"src/signal":148,"src/db":10,"src/assert":4,"src/schema":138,"src/networking":58,"src/document":37,"src/renderer":102,"src/styles":151,"src/resources":136,"src/dict":11,"./route":3,"package.json":1}),exports=module.exports;return function(){(function(){"use strict";var t,e,r,n,i,o,s,a,l,u,c,h,p,exports,f,d,g;g=require("src/utils"),f=require("src/log"),d=require("src/signal"),p=require("src/db"),c=require("src/assert"),l=require("src/schema"),o=require("src/networking"),i=require("src/document"),s=require("src/renderer"),u=require("src/styles"),a=require("src/resources"),n=require("src/dict"),t=require("./route"),h=function(){try{return require("./bootstrap/route.node")}catch(t){}}(),e=/(.+)\.(?:node|server|client|browser|ios|android|native)/,r={title:"Neft.io Application",protocol:"http",port:3e3,host:"localhost",language:"en",type:"app"},exports=module.exports=function(l,c){var f,m,v,y,_,x,b,S,w,E,T,C,A,P,R,O,I,M,F,D,L,N,B,k,U,j,W,z,H,G,V;if(null==l&&(l={}),null==c&&(c={}),_=g.clone(r),_=g.mergeAll(_,l.config,c),v=new n,v.config=_,v.networking=new o({type:o.HTTP,protocol:_.protocol,port:parseInt(_.port,10),host:_.host,url:_.url,language:_.language}),v.routes={},v.styles={},v.components={},v.resources=function(){return l.resources?a.fromJSON(l.resources):new a}(),d.create(v,"onReady"),null==_.type&&(_.type="app"),v.Route=t(v),f="__neft_cookies",m=!process.env.NEFT_SERVER,v.cookies=n(),M=function(t){if(v.cookies=t,m)return t.set("sessionId",g.uid(16))},p.get(f,p.OBSERVABLE,function(t,e){var r;return e?M(e):(r=m?{clientId:g.uid(16)}:{},p.set(f,r,function(t){return p.get(f,p.OBSERVABLE,function(t,e){if(e)return M(e)})}))}),v.networking.onRequest(function(t,e){m?g.merge(t.cookies,v.cookies):g.merge(e.cookies,v.cookies),t.onLoadEnd.listeners.unshift(function(){var t,r,n;if(m){r=e.cookies;for(t in r)n=r[t],g.isEqual(v.cookies[t],n)||v.cookies.set(t,n)}},null)}),s.setResources(v.resources),s.setServerUrl(v.networking.url),s.onLinkUri(function(t){return v.networking.createLocalRequest({method:o.Request.GET,type:o.Request.HTML_TYPE,uri:t})}),v.documentScripts=g.arrayToObject(l.scripts,function(t,e){return e.name},function(t,e){return e.file}),i.Scripts.initialize(v.documentScripts),null!=l.styles)for(L=l.styles,b=0,C=L.length;b<C;b++)if(z=L[b],"windowItem"===(N=z.name)||"__windowItem__"===N){z.file._init({windowItem:null}),G=z.file._main({document:null});break}if(v.windowItem=V=null!=G?G.item:void 0,s.setWindowItem(V),null!=l.styles)for(H={windowItem:V},B=l.styles,w=0,A=B.length;w<A;w++)z=B[w],null!=z.name&&("windowItem"!==z.name&&z.file._init(H),v.styles[z.name]=z.file);if(u({windowStyle:G,styles:v.styles,queries:l.styleQueries,resources:v.resources}),"function"==typeof h&&h(v),S=function(t,r){var n,i,o,s,a,l,u;for(l=0,u=t.length;l<u;l++)s=t[l],null!=s.name&&"function"==typeof s.file&&(a=s.file(v),r[s.name]=a,(o=e.exec(s.name))&&(n=o[0],i=o[1],null!=r[i]&&g.isPlainObject(r[i])&&g.isPlainObject(a)&&(a=g.merge(Object.create(r[i]),a)),r[i]=a))},g.isObject(l.extensions))for(k=l.extensions,E=0,P=k.length;E<P;E++)(x=k[E])(v);for(exports.app={Route:v.Route},U=l.components,T=0,R=U.length;T<R;T++)y=U[T],null!=y.name&&(v.components[y.name]=i.fromJSON(y.file));S(l.routes,v.routes),j=v.routes;for(F in j){if(I=j[F],D={},g.isObject(I)&&!(I instanceof v.Route))for(O in I)l=I[O],g.isObject(l)?(W=new v.Route(O,l),D[W.name]=W):D[O]=l;v.routes[F]=D}return v.routes.index||(v.routes.index=new v.Route("get /",{})),v.onReady.emit(),v}}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156,"src/signal":148,"src/assert":4,"src/log":52,"src/schema":138,"src/networking":58,"src/document":37,"src/renderer":102,"src/dict":11}),exports=module.exports;return function(){(function(){"use strict";var t,e,r,n,i,o,s,a,l,u,c;c=require("src/utils"),u=require("src/signal"),a=require("src/assert"),l=require("src/log"),s=require("src/schema"),i=require("src/networking"),e=require("src/document"),o=require("src/renderer"),t=require("src/dict"),l=l.scope("App","Route"),n=process.env.NEFT_NODE,r=!n,module.exports=function(o){var a;return a=function(){function a(t,e,r){var n,a,l;c.isObject(t)?r=t:c.isObject(e)?r=e:c.isObject(r)||(r={}),"string"==typeof t&&"string"!=typeof e?r.uri=t:"string"==typeof t&&"string"==typeof e&&(null==r.method&&(r.method=t),null==r.uri&&(r.uri=e)),"function"==typeof e&&null==r.getData&&(r.getData=e),r=c.clone(r),"string"==typeof r.uri&&(a=r.uri.indexOf(" "),a!==-1&&(null==r.method&&(r.method=r.uri.slice(0,a)),r.uri=r.uri.slice(a+1)),r.uri=new i.Uri(r.uri)),null==r.method&&(r.method="get"),r.method=r.method.toLowerCase(),null!=r.schema&&c.isPlainObject(r.schema)&&(r.schema=new s(r.schema)),null!=r.redirect&&"string"==typeof r.redirect&&(r.redirect=new i.Uri(r.redirect)),c.isObject(r.toHTML)&&(r.toHTML=p(r.toHTML));for(n in r)l=r[n],this[n]=l;this.__id__=c.uid(),this.app=o,this.name||(this.name=v(this)),o.networking.createHandler({method:this.method,uri:this.uri,schema:this.schema,callback:c.bindFunctionContext(y,this)})}var h,p,f,d,g,m,v,y,_,x,b,S,w,E,T,C,A,P;return n?P=[]:A=Object.create(null),a.lastClientRoute=null,a.onLastClientRouteChange=u.create(),a.getTemplateComponent=function(){return n?function(e){var r,n;return r={app:o,routes:new t},n=o.components[e].render(null,r),P.push(n),n}:function(e){var r;return r={app:o,routes:new t},null!=A[e]?A[e]:A[e]=o.components[e].render(null,r)}}(),v=function(t){var e;for(e=t.uri._uri,e=e.replace(i.Uri.NAMES_RE,""),e=e.replace(/\*/g,"");e.indexOf("//")!==-1;)e=e.replace(/\/\//g,"/");return e=e.replace(/^\//,""),e=e.replace(/\/$/,"")},C=Object.create(null),x=Object.create(null),d=function(){var t;return t=function(t){var e;return e=Object.create(t),e.__hash__=c.uid(),"function"==typeof e.factory&&e.factory(),e},function(e){var r,n;return r=e.__id__,null==C[r]&&(C[r]=[]),n=C[r].pop()||t(e),n=Object.create(n),n.request=n.response=null,n.route=n,n._dataPrepared=!1,n._destroyComponentOnEnd=!1,n}}(),f=function(t){if(t.response.onSend.disconnect(_,t),delete x[t.__hash__],"function"==typeof t.destroy&&t.destroy(),t._dataPrepared)switch(t.request.type){case"text":"function"==typeof t.destroyText&&t.destroyText();break;case"json":"function"==typeof t.destroyJSON&&t.destroyJSON();break;case"html":"function"==typeof t.destroyHTML&&t.destroyHTML()}t._destroyComponentOnEnd&&t.response.data.destroy(),C[t.__id__].push(Object.getPrototypeOf(t)),a.lastClientRoute===t&&(a.lastClientRoute=null,a.onLastClientRouteChange.emit(t))},E=function(t){return t.data=t.getData()},w=function(t,e,r){if(null!=e){if(200===t.response.status&&(t.response.status=500),t._dataPrepared&&t.error===e)return!1;t.error=e}else{if(t._dataPrepared&&t.data===r)return!1;t.data=r}return!0},b=function(t){var r,n,i;switch(i=t.response,t.error,n=i.data,t.request.type){case"text":r=t.toText();break;case"json":r=t.toJSON();break;case"html":r=t.toHTML(),n instanceof e&&t._destroyComponentOnEnd&&(n.destroy(),i.data=null),r instanceof e||i.data!==n||(r=S.call(t,r))}return t._dataPrepared=!0,null!=r?i.data=r:i.data===n?i.data="":void 0},_=function(){(n||"html"!==this.request.type)&&(f(this),n&&c.has(P,this.response.data)&&(this.response.data.destroy(),c.remove(P,this.response.data)))},g=function(t){r&&t.response.data instanceof e&&(o.windowItem.node=t.response.data.node),t.response.pending&&t.response.send()},h=function(t,e){return!x[t.__hash__]&&(t.response.pending&&e(),!0)},y=function(t,e,n){var o,s,l,u,c,p;if(p=d(this),l=p.__hash__,r&&(a.lastClientRoute&&f(a.lastClientRoute),u=a.lastClientRoute,a.lastClientRoute=p,a.onLastClientRouteChange.emit(u)),p.request=t,p.response=e,x[l]=!0,e.onSend(_,p),"function"==typeof p.init&&p.init(),!x[l])return n();if(c=p.redirect,"function"==typeof c&&(c=p.redirect(),!x[l]))return n();if("string"==typeof c&&(c=new i.Uri(c)),c instanceof i.Uri)return void e.redirect(c.toString(t.params));if(s=p.getData,o=!1,"function"==typeof s)if(1===s.length)p.getData(function(t,e){if(o=!0,!h(p,n)&&w(p,t,e)&&(b(p),!h(p,n)))return g(p)});else{if(E(p),h(p,n))return;if(b(p),h(p,n))return;g(p)}else{if(b(p),h(p,n))return;g(p)}!o&&h(p,n)},a.prototype.next=function(){return f(this)},a.prototype.toJSON=function(){var t,e;return this.response.status<400?(null!=(e=this.data)&&"function"==typeof e.toJSON?e.toJSON():void 0)||this.data:("function"==typeof(t=this.error).toJSON?t.toJSON():void 0)||this.error},a.prototype.toText=function(){return this.response.status<400?this.data+"":this.error+""},T=function(){return this.method+" "+this.uri},m=function(){var t;if(t="components/"+this.name+".xhtml",o.components[t])return t},S=function(t){var e,r,n,i,s,u,c,h;return r=(null!=t?t.component:void 0)||m.call(this)||"components/index.xhtml",c=(null!=t?t.template:void 0)||r,h=(null!=t?t.use:void 0)||"body",n=l.time("Render"),r!==c&&(s=o.components[c])&&(u=a.getTemplateComponent(c),u.use(h,null)),(e=o.components[r])&&(i=e.render(null,this)),u?(i=null!=i?u.use(h,i):u,u.context.routes.has(h)&&u.context.routes.pop(h),u.context.routes.set(h,this),this._destroyComponentOnEnd=!1):this._destroyComponentOnEnd=!0,i},p=function(t){return function(){return S.call(this,t)}},a.prototype.toHTML=p({component:"",template:"",use:""}),a}()}}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156}),exports=module.exports;return function(){(function(){"use strict";var t,e,r,n,i=function(t,e){function r(){this.constructor=t}for(var n in e)o.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},o={}.hasOwnProperty;n=require("src/utils"),e=module.exports=function(t,r){if(!t)return e.fail(t,!0,r,"==",e)},e.AssertionError=t=function(t){function e(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,this.scope=t.scope,this.message=e.generateMessage(this,t.message),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.stackStartFunction),"android"===process.env.NEFT_PLATFORM}var r;return i(e,t),r=function(t){var e;return n.isObject(t)&&(e=function(){try{return JSON.stringify(t)}catch(t){}}()),e||String(t)},e.generateMessage=function(t,e){return e||r(t.actual)+" "+t.operator+" "+r(t.expected)},e}(Error),r=function(t){var e;return e=function(r,n,i,o,s){throw new t.AssertionError({actual:r,expected:n,message:i,operator:o,scope:t._scope,stackStartFunction:s||e})}},e.scope=function(t){var i;return t=""+this._scope+t,i=function(t,r){return e(t,r)},n.merge(i,e),i.fail=r(i),i._scope=t,i},e.fail=r(e),e._scope="",e.ok=e,e.notOk=function(t,r){if(t)return this.fail(t,!0,r,"!=",e.notOk)},e.is=function(t,r,i){if(!n.is(t,r))return this.fail(t,r,i,"===",e.is)},e.isNot=function(t,r,i){if(n.is(t,r))return this.fail(t,r,i,"!==",e.isNot)},e.isDefined=function(t,r){if(null==t)return this.fail(t,null,r,"!=",e.isDefined)},e.isNotDefined=function(t,r){if(null!=t)return this.fail(t,null,r,"==",e.isNotDefined)},e.isPrimitive=function(t,r){if(!n.isPrimitive(t))return this.fail(t,"primitive",r,"is",e.isPrimitive)},e.isNotPrimitive=function(t,r){if(n.isPrimitive(t))return this.fail(t,"primitive",r,"isn't",e.isNotPrimitive)},e.isString=function(t,r){if("string"!=typeof t)return this.fail(t,"string",r,"is",e.isString)},e.isNotString=function(t,r){if("string"==typeof t)return this.fail(t,"string",r,"isn't",e.isNotString)},e.isFloat=function(t,r){if(!n.isFloat(t))return this.fail(t,"float",r,"is",e.isFloat)},e.isNotFloat=function(t,r){if(n.isFloat(t))return this.fail(t,"float",r,"isn't",e.isNotFloat)},e.isInteger=function(t,r){if(!n.isInteger(t))return this.fail(t,"integer",r,"is",e.isInteger)},e.isNotInteger=function(t,r){if(n.isInteger(t))return this.fail(t,"integer",r,"isn't",e.isNotInteger)},e.isBoolean=function(t,r){if("boolean"!=typeof t)return this.fail(t,"boolean",r,"is",e.isBoolean)},e.isNotBoolean=function(t,r){if("boolean"==typeof t)return this.fail(t,"boolean",r,"isn't",e.isNotBoolean)},e.isFunction=function(t,r){if("function"!=typeof t)return this.fail(t,"function",r,"is",e.isFunction)},e.isNotFunction=function(t,r){if("function"==typeof t)return this.fail(t,"function",r,"isn't",e.isNotFunction)},e.isObject=function(t,r){if(null===t||"object"!=typeof t)return this.fail(t,"object",r,"is",e.isObject)},e.isNotObject=function(t,r){if(null!==t&&"object"==typeof t)return this.fail(t,"object",r,"isn't",e.isNotObject)},e.isPlainObject=function(t,r){if(!n.isPlainObject(t))return this.fail(t,"plain object",r,"is",e.isPlainObject)},e.isNotPlainObject=function(t,r){if(n.isPlainObject(t))return this.fail(t,"plain object",r,"isn't",e.isNotPlainObject)},e.isArray=function(t,r){if(!Array.isArray(t))return this.fail(t,"array",r,"is",e.isArray)},e.isNotArray=function(t,r){if(Array.isArray(t))return this.fail(t,"array",r,"isn't",e.isNotArray)},e.isEqual=function(t,r,i,o){if("object"==typeof i&&(o=i,i=void 0),!n.isEqual(t,r,null!=o?o.maxDeep:void 0))return this.fail(t,r,i,"equal",e.isEqual)},e.isNotEqual=function(t,r,i,o){if("object"==typeof i&&(o=i,i=void 0),n.isEqual(t,r,null!=o?o.maxDeep:void 0))return this.fail(t,r,i,"isn't equal",e.isNotEqual)},e.instanceOf=function(t,r,n){var i;if(!(t instanceof r))return i=r.__path__||r.__name__||r.name||r,this.fail(t,i,n,"instanceof",e.instanceOf)},e.notInstanceOf=function(t,r,n){var i;if(t instanceof r)return i=r.__path__||r.__name__||r.name||r,this.fail(t,i,n,"instanceof",e.notInstanceOf)},e.lengthOf=function(t,r,n){if((null!=t?t.length:void 0)!==r)return this.fail(t,r,n,".length ===",e.lengthOf)},e.notLengthOf=function(t,r,n){if((null!=t?t.length:void 0)===r)return this.fail(t,r,n,".length !==",e.notLengthOf)},e.operator=function(t,r,n,i){var o;if(o=function(){switch(r){case">":return t>n;case">=":return t>=n;case"<":return t<n;case"<=":return t<=n;default:throw new TypeError("Unexpected operator `"+r+"`")}}(),!o)return this.fail(t,n,i,r,e.operator)},e.match=function(t,r,n){if(!r.test(t))return this.fail(t,r,n,"match",e.match)},e.notMatch=function(t,r,n){if(r.test(t))return this.fail(t,r,n,"not match",e.match)}}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156,"src/log":52,"src/assert":4,"src/dict":11,"src/list":50}),exports=module.exports;return function(){(function(){"use strict";var t,e,r,n,i,o,s,a,l,u;u=require("src/utils"),l=require("src/log"),o=require("src/assert"),r=require("src/dict"),n=require("src/list"),l=l.scope("Binding"),a=Array.isArray,i=50,s=function(){var t;return t=Object.create(null),function(e){return t[e]||(t[e]="on"+u.capitalize(e)+"Change")}}(),e=function(){function t(e,r,n,i){this.binding=e,this.prop=n,this.parent=i,this.handlerName=s(this.prop),this.isConnected=!1,a(r)?(this.itemId="",this.child=t.factory(this.binding,r[0],r[1],this),this.item=this.child.getValue()):(this.itemId=r,this.child=null,this.item=this.binding.getItemById(r)),this.connect()}var e;return e=[],t.factory=function(r,n,i,o){var s;return null==o&&(o=null),e.length>0&&(s=e.pop())?(t.call(s,r,n,i,o),s):new t(r,n,i,o)},t.prototype.getSignalChangeListener=function(){var t,e,n,i;return n=function(t,e){void 0!==e&&"string"==typeof t&&this.parent.prop!==t||this.parent.updateItem()},t=function(){this.binding.update()},i=function(t){this.prop===t&&this.parent.updateItem()},e=function(t){this.prop===t&&this.binding.update()},function(){return this.item instanceof r?this.parent?i:e:this.parent?n:t}}(),t.prototype.update=function(){return this.getSignalChangeListener().call(this)},t.prototype.connect=function(){var t,e;e=this.item,e&&(e instanceof r?(this.isConnected=!0,e.onChange(this.getSignalChangeListener(),this)):e instanceof n?(this.isConnected=!0,t=this.getSignalChangeListener(),e.onChange(t,this),e.onInsert(t,this),e.onPop(t,this)):(t=e[this.handlerName])&&(this.isConnected=!0,t(this.getSignalChangeListener(),this)))},t.prototype.disconnect=function(){var t,e;e=this.item,e&&this.isConnected&&(t=this.getSignalChangeListener(),e instanceof r?e.onChange.disconnect(t,this):e instanceof n?(e.onChange.disconnect(t,this),e.onInsert.disconnect(t,this),e.onPop.disconnect(t,this)):e[this.handlerName].disconnect(t,this)),this.isConnected=!1},t.prototype.updateItem=function(){var t,e;t=this.item,e=this.child?this.child.getValue():this.binding.getItemById(this.itemId),t&&!this.isConnected&&(this.connect(),t=null),t!==e&&(this.disconnect(),this.item=e,this.connect(),this.parent||this.binding.update()),this.parent&&this.parent.updateItem()},t.prototype.getValue=function(){return this.item?this.item[this.prop]:null},t.prototype.destroy=function(){var t;this.disconnect(),null!=(t=this.child)&&t.destroy(),e.push(this)},t}(),module.exports=t=function(){function t(t,e){this.ctx=e,this.func=t[0],this.args=null,this.connections||(this.connections=[])}return t.New=function(r,n,i){var o,s,l,u,c;for(null==i&&(i=new t(r,n)),o=i.connections,c=r[1],l=0,u=c.length;l<u;l++)s=c[l],a(s)&&o.push(e.factory(i,s[0],s[1]));return i},t.prototype.getItemById=function(t){throw new Error("Not implemented")},t.prototype.getValue=function(){throw new Error("Not implemented")},t.prototype.getDefaultValue=function(){switch(typeof this.getValue()){case"string":return"";case"number":return 0;case"boolean":return!1;default:return null}},t.prototype.setValue=function(t){throw new Error("Not implemented")},t.prototype.onError=function(t){},t.prototype.update=function(){var t;t=u.tryFunction(this.func,this.ctx,this.args),t instanceof Error&&(this.onError(t),t=this.getDefaultValue()),this.setValue(t)},t.prototype.getLoopDetectedErrorMessage=function(){return"Potential loop detected"},t.prototype.destroy=function(){for(var t;t=this.connections.pop();)t.destroy();this.args=null},t}()}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156,"./implementations/browser":7,"./implementations/memory":9}),exports=module.exports;return function(){(function(){"use strict";var t;t=require("src/utils"),module.exports=function(){var t;return t=function(){try{return require("./implementations/browser")}catch(t){}}(),t||(t=function(){try{return require("./implementations/native")}catch(t){}}()),t||(t=require("./implementations/memory")),t}()}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"./browser/localStorage":8}),exports=module.exports;return function(){(function(){"use strict";var t;t=require("./browser/localStorage"),module.exports=function(){if(null!=window.localStorage)return t}()}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156}),exports=module.exports;return function(){(function(){"use strict";var t;t=require("src/utils"),exports.get=function(e,r){var n;return n=localStorage.getItem(e),n=t.tryFunction(JSON.parse,null,[n],n),r(null,n)},exports.set=function(e,r,n){return t.isObject(r)&&(r=t.tryFunction(JSON.stringify,null,[r],r)),localStorage.setItem(e,r),n(null)},exports.remove=function(t,e){return localStorage.removeItem(t),e(null)}}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156}),exports=module.exports;return function(){(function(){"use strict";var t,e;e=require("src/utils"),t=Object.create(null),exports.get=function(r,n){var i;return i=t[r],i=e.cloneDeep(i),n(null,i)},exports.set=function(e,r,n){return t[e]=r,n(null)},exports.remove=function(e,r){return t[e]=void 0,r(null)}}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156,"src/assert":4,"src/list":50,"src/dict":11,"./implementation":6}),exports=module.exports;return function(){(function(){"use strict";var t,e,r,n,i,o,s,a,l,u,c,h,p=function(t,e){function r(){this.constructor=t}for(var n in e)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.hasOwnProperty;u=require("src/utils"),s=require("src/assert"),i=require("src/list"),n=require("src/dict"),s=s.scope("Database"),o=function(){},l=require("./implementation"),h=Object.create(null),c=Object.create(null),exports.OBSERVABLE=1<<29,t=exports.OBSERVABLE,exports.get=function(t,n,i){return"function"==typeof n&&(i=n,n=0),n&exports.OBSERVABLE&&null!=c[t]?i(null,c[t].spawn()):void l.get(t,function(o,s){var a;return null==o&&s?(n&exports.OBSERVABLE&&(Array.isArray(s)?s=new r(t,s,n):u.isObject(s)&&(s=new e(t,s,n)),s=(null!=(a=c[t])?a.spawn():void 0)||s),i(null,s)):i(o,s)})},exports.set=function(t,e,r){var n;null==r&&(r=o),null!=(n=c[t])&&n.disconnect(),l.set(t,e,r)},exports.remove=function(t,e,r){var n;null==r&&(r=o),"function"==typeof e&&(r=e,e=null),null!=e?exports.get(t,function(n,i){var o,s,a,h,p,f,d,g,m;if(null!=n)return r(n);if(!Array.isArray(i))return r(new Error("'"+t+"' is not an array"));if(g=c[t])if((s=g.items().indexOf(e))!==-1)g.pop(s);else for(m=g.items(),o=h=0,f=m.length;h<f;o=++h)if(a=m[o],u.isEqual(a,e)){g.pop(o);break}if((s=i.indexOf(e))!==-1)i.splice(s,1);else for(o=p=0,d=i.length;p<d;o=++p)if(a=i[o],u.isEqual(a,e)){i.splice(o,1);break}return l.set(t,i,r)}):(null!=(n=c[t])&&n.disconnect(),l.remove(t,r))},exports.append=function(t,e,r){null==r&&(r=o),exports.get(t,function(n,i){var o;return null!=n?r(n):(null==i&&(i=[]),Array.isArray(i)?(null!=(o=c[t])&&o.append(e),i.push(e),l.set(t,i,r)):r(new Error("'"+t+"' is not an array")))})},a=function(t,e){return u.defineProperty(t,e,null,function(){return Object.getPrototypeOf(this)[e]},function(t){return Object.getPrototypeOf(this)[e]=t})},r=function(t){function e(t,n,i){e.__super__.constructor.call(this,n),this._key=t,this._watchersCount=0,c[t]=this,this.onChange(r),this.onInsert(r),this.onPop(r)}var r;return p(e,t),r=function(t){this._watchersCount>0&&l.set(this._key,this._data,o)},e.prototype.spawn=function(){return this._watchersCount+=1,this},e.prototype.disconnect=function(){--h[this._key]||(c[this._key]=null)},e}(i),e=function(t){function e(t,n,i){e.__super__.constructor.call(this,n),u.defineProperty(this,"_key",0,t),u.defineProperty(this,"_watchersCount",u.WRITABLE,0),c[t]=this,this.onChange(r)}var r;return p(e,t),r=function(t){this._watchersCount>0&&l.set(this._key,this,o)},e.prototype.spawn=function(){return this._watchersCount+=1,this},e.prototype.disconnect=function(){--h[this._key]||(c[this._key]=null)},e}(n)}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156,"src/assert":4,"src/signal":148}),exports=module.exports;return function(){(function(){"use strict";var t,e,r,n,i=function(t,e){function r(){this.constructor=t}for(var n in e)o.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},o={}.hasOwnProperty;n=require("src/utils"),e=require("src/assert"),r=require("src/signal"),module.exports=t=function(t){function e(t){return this instanceof e?(e.__super__.constructor.call(this),n.defineProperty(this,"_signals",n.WRITABLE,this._signals),n.defineProperty(this,"_keys",n.WRITABLE,null),n.defineProperty(this,"_values",n.WRITABLE,null),n.defineProperty(this,"_items",n.WRITABLE,null),n.defineProperty(this,"_dirty",n.WRITABLE,o),void(n.isObject(t)&&n.merge(this,t))):new e(t)}var o,s,a,l,u,c;return i(e,t),e.__name__="Dict",e.__path__="Dict",a=1,u=2,s=4,o=(s<<1)-1,e.fromJSON=function(t){return t=n.tryFunction(JSON.parse,JSON,[t],t),new e(t)},l=n.CONFIGURABLE|n.WRITABLE,n.defineProperty(e.prototype,"constructor",l,e),c=l,n.defineProperty(e.prototype,"length",c,function(){return this.keys().length},null),r.Emitter.createSignal(e,"onChange"),n.defineProperty(e.prototype,"set",l,function(t,e){var r;return r=this[t],r===e?e:(this[t]=e,this._dirty|=o,this.onChange.emit(t,r),e)}),n.defineProperty(e.prototype,"has",l,function(t){return void 0!==this[t]}),n.defineProperty(e.prototype,"extend",l,function(t){var e,r;for(e in t)r=t[e],t.hasOwnProperty(e)&&this.set(e,r);return this}),n.defineProperty(e.prototype,"pop",l,function(t){var e;return e=this[t],delete this[t],this._dirty|=o,this.onChange.emit(t,e),e}),n.defineProperty(e.prototype,"clear",l,function(){var t,e;for(t in this)e=this[t],this.pop(t)}),n.defineProperty(e.prototype,"keys",l,function(){var t,e,r,n;if(this._dirty&a){this._dirty^=a,t=null!=this._keys?this._keys:this._keys=[],e=0;for(r in this)n=this[r],t[e]=r,e++;t.length=e}return this._keys}),n.defineProperty(e.prototype,"values",l,function(){var t,e,r,n;if(this._dirty&u){this._dirty^=u,t=null!=this._values?this._values:this._values=[],e=0;for(r in this)n=this[r],t[e]=n,e++;t.length=e}return this._values}),n.defineProperty(e.prototype,"items",l,function(){var t,e,r,n;if(this._dirty&s){t=null!=this._values?this._values:this._values=[],e=0;for(r in this)n=this[r],null==t[e]&&(t[e]=["",null]),t[e][0]=r,t[e][1]=n,e++;t.length=e}return this._values}),e}(r.Emitter)}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/assert":4}),exports=module.exports;return function(){(function(){"use strict";var t;t=require("src/assert"),module.exports=function(t){var e;return e=function(){function e(t,e,r){this.file=t,this.node=e,this.elseNode=null!=r?r:null,"undefined"!=typeof elseNode&&null!==elseNode,this.node.onPropsChange(a,this)}var r,n,i,o,s,a;return e.__name__="Condition",e.__path__="File.Condition",n=e.JSON_CTOR_ID=t.JSON_CTORS.push(e)-1,s=1,o=s++,i=s++,r=e.JSON_ARGS_LENGTH=s,e._fromJSON=function(t,r,n){var s,a;return n||(a=t.node.getChildByAccessPath(r[o]),r[i]&&(s=t.node.getChildByAccessPath(r[i])),n=new e(t,a,s)),n},a=function(t){"n-if"===t&&this.update()},e.prototype.update=function(){var t,e;e=this.node.visible=!!this.node.props["n-if"],null!=(t=this.elseNode)&&(t.visible=!e)},e.prototype.render=function(){return this.update()},e.prototype.clone=function(t,r){var n,i;return i=t.node.getCopiedElement(this.node,r.node),this.elseNode&&(n=t.node.getCopiedElement(this.elseNode,r.node)),new e(r,i,n)},e.prototype.toJSON=function(t,e){var s;return e||(e=new Array(r),e[0]=n),e[o]=this.node.getAccessPath(this.file.node),e[i]=null!=(s=this.elseNode)?s.getAccessPath(this.file.node):void 0,e},e}()}}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156,"src/assert":4,"src/signal":148,"./element/text":18,"./element/tag":14}),exports=module.exports;return function(){(function(){"use strict";var t,e,r,n,i,o,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=require("src/utils"),r=require("src/assert"),o=require("src/signal"),i=Array.isArray,e=o.Emitter,n=e.emitSignal,r=r.scope("View.Element"),t=function(t){function r(){e.call(this),this._parent=null,this._nextSibling=null,this._previousSibling=null,this._style=null,this._documentStyle=null,this._visible=!0,this._watchers=null,this._inWatchers=null,this._checkWatchers=0}var i,l,u,c,h,p;return a(r,t),r.__name__="Element",r.__path__="File.Element",r.JSON_CTORS=[],l=r.JSON_CTOR_ID=r.JSON_CTORS.push(r)-1,h=1,u=h++,i=r.JSON_ARGS_LENGTH=h,r.fromHTML=function(t){if("node"!==process.env.NEFT_PLATFORM)throw new Error("Creating Views from HTML files is allowed only on a server");return r.parser.parse(t)},r.fromJSON=function(t){return"string"==typeof t&&(t=JSON.parse(t)),r.JSON_CTORS[t[0]]._fromJSON(t)},r._fromJSON=function(t,e){return null==e&&(e=new r),e._visible=1===t[u],e},r.Text=require("./element/text")(r),r.Tag=c=require("./element/tag")(r),p=s.CONFIGURABLE,s.defineProperty(r.prototype,"index",p,function(){var t;return(null!=(t=this.parent)?t.children.indexOf(this):void 0)||0},function(t){var e,r,n,i,o,s,a;return!!(n=this._parent)&&(r=this.index,e=n.children,t>e.length&&(t=e.length),r!==t&&r!==t-1&&(null!=(i=this._previousSibling)&&(i._nextSibling=this._nextSibling),null!=(o=this._nextSibling)&&(o._previousSibling=this._previousSibling),e.splice(r,1),t>r&&t--,e.splice(t,0,this),this._previousSibling=e[t-1]||null,this._nextSibling=e[t+1]||null,null!=(s=this._previousSibling)&&(s._nextSibling=this),null!=(a=this._nextSibling)&&(a._previousSibling=this),!0))}),p=s.CONFIGURABLE,s.defineProperty(r.prototype,"nextSibling",p,function(){return this._nextSibling},null),p=s.CONFIGURABLE,s.defineProperty(r.prototype,"previousSibling",p,function(){return this._previousSibling},null),p=s.CONFIGURABLE,s.defineProperty(r.prototype,"parent",p,function(){return this._parent},function(t){var e,r,i,o,s,a,l;return i=this._parent,i!==t&&(this._parent&&(o=this._parent.children,this._nextSibling?this._previousSibling?(e=o.indexOf(this),o.splice(e,1)):o.shift():o.pop(),n(this._parent,"onChildrenChange",null,this),null!=(a=this._previousSibling)&&(a._nextSibling=this._nextSibling),null!=(l=this._nextSibling)&&(l._previousSibling=this._previousSibling),this._previousSibling=null,this._nextSibling=null),this._parent=s=t,s&&(r=this._parent.children,e=r.push(this)-1,
n(s,"onChildrenChange",this),0===e?this._previousSibling=null:(this._previousSibling=r[e-1],this._previousSibling._nextSibling=this)),this._previousSibling,n(this,"onParentChange",i),c.query.checkWatchersDeeply(this,i),c.query.checkWatchersDeeply(this),!0)}),o.Emitter.createSignal(r,"onParentChange"),p=s.CONFIGURABLE,s.defineProperty(r.prototype,"style",p,function(){return this._style},function(t){var e;return e=this._style,e!==t&&(this._style=t,n(this,"onStyleChange",e,t),!0)}),o.Emitter.createSignal(r,"onStyleChange"),p=s.CONFIGURABLE,s.defineProperty(r.prototype,"visible",p,function(){return this._visible},function(t){var e;return e=this._visible,e!==t&&(this._visible=t,n(this,"onVisibleChange",e),!0)}),o.Emitter.createSignal(r,"onVisibleChange"),r.prototype.queryAllParents=c.query.queryAllParents,r.prototype.queryParents=c.query.queryParents,r.prototype.getAccessPath=function(t){var e,r,n;for(e=[],h=0,r=this,n=this;(n=r._parent)&&(e.push(n.children.indexOf(r)),r=n,n!==t););return e},r.prototype.clone=function(t){return null==t&&(t=new r),t._visible=this._visible,t},r.prototype.toJSON=function(t){return t||(t=new Array(i),t[0]=l),t[u]=this.visible?1:0,t},"node"===process.env.NEFT_PLATFORM&&(r.parser=require("./element/parser")(r)),r}(e),module.exports=t}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156,"src/assert":4,"src/signal":148,"./tag/query":16,"./tag/props":15,"./tag/stringify":17,"src/typed-array":154}),exports=module.exports;return function(){(function(){"use strict";var t,e,r,n,i,o,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;a=require("src/utils"),r=require("src/assert"),o=require("src/signal"),s=require("./tag/stringify"),e=require("src/typed-array"),n=o.Emitter.emitSignal,r=r.scope("View.Element.Tag"),i=function(t){return null!=t},t=/\#([^\s]+)/,module.exports=function(t){var r;return r=function(r){function n(){t.call(this),this.name="blank",this.children=[],this.props=new f(this)}var i,u,c,h,p,f,d,g;return l(n,r),n.Props=f=require("./tag/props")(n),n.DEFAULT_STRINGIFY_REPLACEMENTS=Object.create(null),n.extensions=Object.create(null),n.__name__="Tag",n.__path__="File.Element.Tag",h=n.JSON_CTOR_ID=t.JSON_CTORS.push(n)-1,d=t.JSON_ARGS_LENGTH,p=d++,c=d++,u=d++,i=n.JSON_ARGS_LENGTH=d,n._fromJSON=function(e,r){var i,o,s,l,h,f;for(null==r&&(r=new n),t._fromJSON(e,r),r.name=e[p],a.merge(r.props,e[u]),h=null,f=e[c],s=0,l=f.length;s<l;s++)i=f[s],o=t.fromJSON(i),r.children.push(o),o._parent=r,(o._previousSibling=h)&&(h._nextSibling=o),h=o;return r},o.Emitter.createSignal(n,"onChildrenChange"),o.Emitter.createSignal(n,"onPropsChange"),n.prototype.clone=function(t){return null==t&&(t=new n),n.__super__.clone.call(this,t),t.name=this.name,a.merge(t.props,this.props),t},n.prototype.cloneDeep=function(){var t,e,r,i,o,s,a;for(e=this.clone(),s=null,a=this.children,i=0,o=a.length;i<o;i++)t=a[i],r=t instanceof n?t.cloneDeep():t.clone(),e.children.push(r),r._parent=e,(r._previousSibling=s)&&(s._nextSibling=r),s=r;return e},n.prototype.getCopiedElement=function(){var t;return t=new e.Uint16(256),function(e,r){var n,i,o;if(e===this)return r;for(d=0,n=e;(o=n._parent)&&(t[d++]=o.children.indexOf(n),n=o,n!==this););for(n=r;d-- >0;)i=t[d],n=n.children[i];return n}}(),n.prototype.getChildByAccessPath=function(t){var e,r;for(e=this,r=t.length-1;r>=0;r+=-1)if(d=t[r],!(e=e.children[d]))return null;return e},n.query=g=require("./tag/query")(t,n),n.prototype.queryAll=g.queryAll,n.prototype.query=g.query,n.prototype.watch=g.watch,n.prototype.stringify=function(t){return null==t&&(t=n.DEFAULT_STRINGIFY_REPLACEMENTS),s.getOuterHTML(this,t)},n.prototype.stringifyChildren=function(t){return null==t&&(t=n.DEFAULT_STRINGIFY_REPLACEMENTS),s.getInnerHTML(this,t)},n.prototype.replace=function(t,e){var r;return r=this.children.indexOf(t),t.parent=void 0,e.parent=this,e.index=r,null},n.prototype.toJSON=function(t){var e,r,o,s,a;for(t||(t=new Array(i),t[0]=h),n.__super__.toJSON.call(this,t),t[p]=this.name,r=t[c]=[],t[u]=this.props,a=this.children,o=0,s=a.length;o<s;o++)e=a[o],r.push(e.toJSON());return t},n}(t)}}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156,"src/assert":4,"src/signal":148}),exports=module.exports;return function(){(function(){"use strict";var t,e,r,n;n=require("src/utils"),t=require("src/assert"),r=require("src/signal"),e=r.Emitter.emitSignal,module.exports=function(t){var r;return r=function(){function r(t){n.defineProperty(this,"_ref",0,t)}var i;return i=n.CONFIGURABLE|n.WRITABLE,n.defineProperty(r.prototype,"constructor",i,r),n.defineProperty(r.prototype,"item",i,function(t,e){var r,n,i;null==e&&(e=[]),e[0]=e[1]=void 0,r=0;for(n in this){if(i=this[n],this.hasOwnProperty(n)&&r===t){e[0]=n,e[1]=i;break}r++}return e}),n.defineProperty(r.prototype,"has",i,function(t){return this.hasOwnProperty(t)}),n.defineProperty(r.prototype,"set",i,function(r,n){var i;return i=this[r],i!==n&&(this[r]=n,e(this._ref,"onPropsChange",r,i),t.query.checkWatchersDeeply(this._ref),!0)}),r}()}}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156,"src/signal":148,"src/eventLoop":49,"src/assert":4}),exports=module.exports;return function(){(function(){"use strict";var t,e,r,n,i,o,s,a,l,u,c,h,p,f,d,g,m,v,y,_,x,b,S,w,E,T,C,A,P,R,O,I,M,F,D,L,N,B,k,U,j,W,z,H=function(t,e){function r(){this.constructor=t}for(var n in e)G.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},G={}.hasOwnProperty;z=require("src/utils"),j=require("src/signal"),L=require("src/eventLoop"),E=require("src/assert"),D=j.Emitter.emitSignal,y=_=null,a=0,l=1,t=100,W=function(t,e,r,n,i,o){for(var s,a,l;r<e.length;){if(l=e[r],l.isIterator)return l(t,e,r+3,n,i,o);if(s=e[r+1],a=e[r+2],!l(t,s,a))return!1;r+=3}return n.call(i,t),!0},S=function(t,e,r,n,i,o){var s,a,l,u;for(u=t.children,a=0,l=u.length;a<l;a++){if(s=u[a],(!(s instanceof y)||"blank"!==s.name)&&W(s,e,r,n,i,o)&&o)return!0;if(s instanceof y&&S(s,e,r,n,i,o)&&o)return!0}return!1},S.isIterator=!0,S.priority=a,S.toString=function(){return"anyDescendant"},F=function(t,e,r,n,i,o){var s;if(s=t._parent){if(W(s,e,r,n,i,o))return!0;if("blank"===s.name)return F(s,e,r,n,i,o)}return!1},F.isIterator=!0,F.priority=a,F.toString=function(){return"directParent"},b=function(t,e,r,n,i,o){var s,a,l,u;for(u=t.children,a=0,l=u.length;a<l;a++)if(s=u[a],s instanceof y&&"blank"===s.name){if(b(s,e,r,n,i,o)&&o)return!0}else if(W(s,e,r,n,i,o)&&o)return!0;return!1},b.isIterator=!0,b.priority=a,b.toString=function(){return"anyChild"},w=function(t,e,r,n,i,o){var s;return!!(s=t._parent)&&(!!W(s,e,r,n,i,o)||w(s,e,r,n,i,o))},w.isIterator=!0,w.priority=a,w.toString=function(){return"anyParent"},C=function(t,e){return t instanceof y?t.name===e:"#text"===e&&t instanceof _||void 0},C.isIterator=!1,C.priority=l,C.toString=function(){return"byName"},T=function(t,e){return t instanceof e},T.isIterator=!1,T.priority=a,T.toString=function(){return"byInstance"},M=function(t,e){return t===e},M.isIterator=!1,M.priority=a,M.toString=function(){return"byTag"},A=function(t,e){return t instanceof y&&void 0!==t.props[e]},A.isIterator=!1,A.priority=t,A.toString=function(){return"byProp"},I=function(t,e,r){return t instanceof y&&t.props[e]==r},I.isIterator=!1,I.priority=t,I.toString=function(){return"byPropValue"},O=function(t,e,r){var n;return t instanceof y&&(n=t.props[e],"string"==typeof n)&&0===n.indexOf(r)},O.isIterator=!1,O.priority=t,O.toString=function(){return"byPropStartsWithValue"},R=function(t,e,r){var n;return t instanceof y&&(n=t.props[e],"string"==typeof n)&&n.indexOf(r,n.length-r.length)>-1},R.isIterator=!1,R.priority=t,R.toString=function(){return"byPropEndsWithValue"},P=function(t,e,r){var n;return t instanceof y&&(n=t.props[e],"string"==typeof n)&&n.indexOf(r)>-1},P.isIterator=!1,P.priority=t,P.toString=function(){return"byPropContainsValue"},v=/^#?[a-zA-Z0-9|\-:_]+/,s=/^([ ]*)>([ ]*)|^([ ]+)/,r=/^\[([^\]]+?)\]/,i=/^\[([^=]+?)=([^\]]+?)\]/,e=/^\.([a-zA-Z0-9|\-_]+)/,g=/\^$/,u=/\$$/,o=/\*$/,m=/(?:'|")?([^'"]*)/,n={__proto__:null,true:!0,false:!1,null:null,undefined:void 0},B=0,p=1<<B++,f=1<<B++,h=1<<B++,c=2e3,d=100,k=[],U=[],N=function(t,a){var l,_,x,E,D,L,N,B,j,W,z,H,G,V,Y,X,q,J,K,Z,Q,$;if(null==a&&(a=0),K=!!(a&f),X=null!=(q=k[a])?q[t]:void 0)return X;for(L=K?w:S,E=K?F:b,_=K?"unshift":"push",Z=K?"push":"unshift",W=[],Y=[W],Q=t.trim();Q.length;)if("*"===Q[0])Q=Q.slice(1),W[_](T,y,null);else if("&"===Q[0])Q=Q.slice(1),a&p||W[_](M,null,null);else if(N=v.exec(Q))Q=Q.slice(N[0].length),V=N[0],W[_](C,V,null);else if(N=i.exec(Q))Q=Q.slice(N[0].length),l=N[0],V=N[1],$=N[2],$=$ in n?n[$]:m.exec($)[1],j=g.test(V)?O:u.test(V)?R:o.test(V)?P:I,j!==I&&(V=V.slice(0,-1)),W[_](j,V,$);else if(N=r.exec(Q))Q=Q.slice(N[0].length),W[_](A,N[1],null);else if(N=e.exec(Q))Q=Q.slice(N[0].length),W[_](P,"class",N[1]);else if(N=s.exec(Q))Q=Q.slice(N[0].length),D=N[0].trim(),""===D?W[_](L,null,null):">"===D&&W[_](E,null,null);else{if(","!==Q[0])throw new Error("queryAll: unexpected selector '"+Q+"' in '"+t+"'");W=[],Y.push(W),Q=Q.slice(1),Q=Q.trim()}for(z=0,G=Y.length;z<G;z++)W=Y[z],B=!K||a&p?W[0]:W[W.length-3],B!==M&&(a&p&&!(null!=B?B.isIterator:void 0)?W[_](L,null,null):K&&!(null!=B?B.isIterator:void 0)?W[Z](L,null,null):K||(null!=B?B.isIterator:void 0)||W[Z](L,null,null),a&h&&W[Z](M,null,null));if((x=k[a])||(x=k[a]={},U[a]=0),x[t]=Y,(U[a]+=1)>c){J=0;for(H in x)if(delete x[H],J+=1,J>=d)break;U[a]-=J}return Y},x=function(t){function e(t,r){e.__super__.constructor.call(this),this._forceUpdate=!0,this.node=t,this.queries=r,this.uid=n++ +"",this.nodes=[],this.nodesToAdd=[],this.nodesToRemove=[],this.nodesWillChange=!1}var r,n,i;return H(e,t),r=function(){},n=0,i=[],e.create=function(t,r){var n,o;return i.length?(o=i.pop(),o.node=t,o.queries=r,o._forceUpdate=!0):o=new e(t,r),n=null!=t._watchers?t._watchers:t._watchers=[],n.push(o),o},j.Emitter.createSignal(e,"onAdd"),j.Emitter.createSignal(e,"onRemove"),e.prototype.test=function(t){var e,n,i,o;for(o=this.queries,n=0,i=o.length;n<i;n++)if(e=o[n],e[e.length-2]=this.node,W(t,e,0,r,null,!0))return!0;return!1},e.prototype.disconnect=function(){var t,e,r,n,o;for(o=this.uid,t=this.node,e=this.nodes,r=this.nodesToAdd,n=this.nodesToRemove,z.remove(t._watchers,this);t=r.pop();)delete t._inWatchers[o];for(;t=n.pop();)D(this,"onRemove",t);for(;t=e.pop();)delete t._inWatchers[o],D(this,"onRemove",t);this.onAdd.disconnectAll(),this.onRemove.disconnectAll(),this.node=this.queries=null,i.push(this)},e}(j.Emitter),module.exports=function(t,e){var r,n,i;return y=e,_=t.Text,{getSelectorCommandsLength:module.exports.getSelectorCommandsLength,queryAll:i=function(t,e,r,n){var i,o,s,a,l;for(null==e&&(e=[]),null==r&&(r=e),null==n&&(n=0),l=N(t,n),i=Array.isArray(e)?e.push:e,s=0,a=l.length;s<a;s++)o=l[s],o[0](this,o,3,i,r,!1);if(Array.isArray(e))return e},queryAllParents:function(t,e,r){var n,o,s;if(null==e&&(e=[]),null==r&&(r=e),n=Array.isArray(e)?e.push:e,s=f|p,o=function(e){n.call(r,e),i.call(e,t,o,null,s)},i.call(this,t,o,null,s),Array.isArray(e))return e},query:n=function(){var t,e;return t=null,e=function(e){return t=e},function(r,n){var i,o,s,a;for(null==n&&(n=0),a=N(r,n),o=0,s=a.length;o<s;o++)if(i=a[o],i[0](this,i,3,e,null,!0))return t;return null}}(),queryParents:function(t){return n.call(this,t,f|p)},watch:function(t){var e,n;return e=N(t,f|h),n=x.create(this,e),r(this),n},checkWatchersDeeply:r=function(){var t,e,r,n,i,o,s,a,l,u,c;return a=!1,s=[],c=[],u=[],B=0,r=1<<B++,t=1<<B++,e=1<<B++,i=function(t){t.nodesWillChange||(c.push(t),t.nodesWillChange=!0)},o=function(t,e){var r;for(r=t;r=r._parent;)if(r===e)return!0;return!1},n=function(e,s,a,l){var u,c,h,p,f,d,g,m,v,_,x,b,S,w,E,T,C,A;if(u=e._checkWatchers,a|=u,A=e._watchers)for(p=0,g=A.length;p<g;p++)for(E=A[p],s.push(E),!l&&E._forceUpdate&&(l=!0),T=E.node,b=E.nodes,B=x=b.length;B-- >0;)c=b[B],c===T||o(c,T)||(delete c._inWatchers[E.uid],b[B]=b[x-1],b.pop(),E.nodesToRemove.push(c),i(E),x--);if(l||a&r)for(h=e._inWatchers,f=0,m=s.length;f<m;f++)E=s[f],(!l||E._forceUpdate||a&r)&&(C=E.uid,h&&h[C]||!E.test(e)?h&&h[C]&&!E.test(e)&&(delete h[C],z.removeFromUnorderedArray(E.nodes,e),E.nodesToRemove.push(e),i(E)):(h||(h=e._inWatchers={}),h[C]=!0,E.nodesToAdd.push(e),i(E)));if(a&t&&e instanceof y)for(S=e.children,d=0,v=S.length;d<v;d++)c=S[d],(l||a&r||c._checkWatchers>0)&&n(c,s,a,l);if(A)for(B=_=0,w=A.length;_<w;B=_+=1)E=s.pop();e._checkWatchers=0},l=function(){var t,e,r,i,o;for(a=!1;t=s.pop();)t._parent||n(t,u,0,!1);for(;o=c.pop();){for(r=o.nodesToAdd,i=o.nodesToRemove;e=i.pop();)D(o,"onRemove",e);for(;e=r.pop();)o.nodes.push(e),D(o,"onAdd",e);o.nodesWillChange=!1}},function(n,i){var o;for(null==i&&(i=n._parent),n._checkWatchers|=r,n instanceof y&&(n._checkWatchers|=t),o=n;i&&(o=i,!(o._checkWatchers&t));)o._checkWatchers|=t,i=o._parent;i||o._checkWatchers&e||(s.push(o),o._checkWatchers|=e),a||(a=!0,L.setImmediate(l))}}()}},module.exports.getSelectorCommandsLength=function(t,e,r){var n,i,o,s,a;for(null==e&&(e=0),null==r&&(r=1/0),a=0,o=N(t,0),B=n=0,i=o.length;n<i;B=++n)if(s=o[B],!(B<e)){if(B>=r)break;a+=s.length}return a},module.exports.getSelectorPriority=function(t,e,r){var n,i,o,s,a,l,u,c;for(null==e&&(e=0),null==r&&(r=1/0),c=0,l=N(t,0),B=i=0,s=l.length;i<s;B=++i)if(u=l[B],!(B<e)){if(B>=r)break;for(o=0,a=u.length;o<a;o+=3)n=u[o],c+=n.priority}return c}}).call(this)}(),module.exports},function(exports){var module={exports:exports},exports=(r({}),module.exports);return function(){(function(){"use strict";var t,e,r,n;t={__proto__:null,area:!0,base:!0,basefont:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,isindex:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},n=function(t){return"blank"!==t&&!/^(?:n-|style:)/.test(t)},e=function(t,e){var n,i,o,s,a;if(t.children){for(s="",a=t.children,i=0,o=a.length;i<o;i++)n=a[i],s+=r(n,e);return s}return""},r=function(r,i){var o,s,a,l,u,c,h;if(r._visible===!1)return"";if(void 0!==r._text)return r._text;if(i&&(c=i[r.name])&&(r=c(r)||r),s=r.name,!s||!n(s))return e(r,i);h="<"+s,u=r.props;for(a in u)l=u[a],u.hasOwnProperty(a)&&null!=l&&"function"!=typeof l&&n(a)&&(h+=" "+a+'="'+l+'"');return o=e(r,i),!o&&t[s]?h+" />":h+">"+o+"</"+s+">"},module.exports={getInnerHTML:e,getOuterHTML:r}}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"src/utils":156,"src/assert":4,"src/signal":148}),exports=module.exports;return function(){(function(){"use strict";var t,e,r,n,i=function(t,e){function r(){this.constructor=t}for(var n in e)o.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},o={}.hasOwnProperty;n=require("src/utils"),t=require("src/assert"),r=require("src/signal"),e=r.Emitter.emitSignal,t=t.scope("View.Element.Text"),module.exports=function(t){var o;return o=function(o){function s(){t.call(this),this._text=""}var a,l,u,c,h;return i(s,o),s.__name__="Text",s.__path__="File.Element.Text",l=s.JSON_CTOR_ID=t.JSON_CTORS.push(s)-1,c=t.JSON_ARGS_LENGTH,u=c++,a=s.JSON_ARGS_LENGTH=c,s._fromJSON=function(e,r){return null==r&&(r=new s),t._fromJSON(e,r),r._text=e[u],r},s.prototype.clone=function(t){return null==t&&(t=new s),s.__super__.clone.call(this,t),t._text=this._text,t},h=n.CONFIGURABLE,n.defineProperty(s.prototype,"text",h,function(){return this._text},function(r){var n;return n=this._text,n!==r&&(this._text=r,e(this,"onTextChange",n),t.Tag.query.checkWatchersDeeply(this),!0)}),r.Emitter.createSignal(s,"onTextChange"),s.prototype.toJSON=function(t){return t||(t=new Array(a),t[0]=l),s.__super__.toJSON.call(this,t),t[u]=this.text,t},s}(t)}}).call(this)}(),module.exports},function(exports){var module={exports:exports},require=r({"./element":13}),exports=module.exports;return function(){(function(){module.exports=require("./element")}).call(this)}(),module.exports},function(exports){var module={exports:exports},exports=(r({}),module.exports);return function(){(fu